earthsdk3-ol 3.8.0-beta.9 → 3.9.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.
@@ -1,7 +1,7 @@
1
- var EarthSDK3_OL=function(W,d,Rn){"use strict";var hE=Object.defineProperty;var lE=(W,d,Rn)=>d in W?hE(W,d,{enumerable:!0,configurable:!0,writable:!0,value:Rn}):W[d]=Rn;var R=(W,d,Rn)=>lE(W,typeof d!="symbol"?d+"":d,Rn);var as=typeof document<"u"?document.currentScript:null;W.copyright=void 0;try{const i="earthsdk3-ol",t="3.8.0-beta.9",e="2026-03-07T11:39:03.000Z",n="北京西部世界科技有限公司",s="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",o="16cfb638b4cbe9462933499dd326558f100c7973",a=((Date.now()-1772883543e3)/36e5).toFixed(1),c=`%c🌏 ${i}%c ${t}.${o.slice(0,8)}.${e} (距今${a}个小时)
1
+ var EarthSDK3_OL=(function(X,p,Mi){"use strict";var HA=Object.defineProperty;var XA=(X,p,Mi)=>p in X?HA(X,p,{enumerable:!0,configurable:!0,writable:!0,value:Mi}):X[p]=Mi;var I=(X,p,Mi)=>XA(X,typeof p!="symbol"?p+"":p,Mi);var qo=typeof document<"u"?document.currentScript:null;X.copyright=void 0;try{const n="earthsdk3-ol",e="3.9.0",t="2026-04-21T06:26:44.000Z",i="北京西部世界科技有限公司",s="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",o="bd3885858c999138ec83e1f979e98dda6a2443e1",a=((Date.now()-1776752804e3)/36e5).toFixed(1),l=`%c🌏 ${n}%c ${e}.${o.slice(0,8)}.${t} (距今${a}个小时)
2
2
  %c${s?s+`
3
- `:""}当前网站正在使用${i},此软件版权归${n}所有
4
- `;W.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){return OWNERLINK_},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","16cfb638b4cbe9462933499dd326558f100c7973")},get info(){return c},get date(){return"2026-03-07T11:39:03.000Z"},get author(){return"suplyang"},get version(){return"3.8.0-beta.9"},get name(){return"earthsdk3-ol"},get commitId(){return"16cfb638b4cbe9462933499dd326558f100c7973"},print(h=!1){!h&&window._xe2_no_copy_print||console.info(this.info,`
3
+ `:""}当前网站正在使用${n},此软件版权归${i}所有
4
+ `;X.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){return OWNERLINK_},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","bd3885858c999138ec83e1f979e98dda6a2443e1")},get info(){return l},get date(){return"2026-04-21T06:26:44.000Z"},get author(){return"suplyang"},get version(){return"3.9.0"},get name(){return"earthsdk3-ol"},get commitId(){return"bd3885858c999138ec83e1f979e98dda6a2443e1"},print(c=!1){!c&&window._xe2_no_copy_print||console.info(this.info,`
5
5
  font-size: 18px;
6
6
  font-weight: 1000;
7
7
  line-height: 1;
@@ -18,22 +18,19 @@ var EarthSDK3_OL=function(W,d,Rn){"use strict";var hE=Object.defineProperty;var
18
18
  color: rgb(0, 120, 215);
19
19
  padding-bottom: 2px;
20
20
  padding-left: 35px;
21
- `)}}),window.g_XE3CopyRights=window.g_XE3CopyRights||{},window.g_XE3CopyRights[i]=W.copyright,window.g_earthsdk_copyright_print=window.g_earthsdk_copyright_print??!0,window.g_earthsdk_copyright_print&&W.copyright.print()}catch{}class le extends d.Destroyable{constructor(){super()}}R(le,"defaults",{enabled:!0}),(i=>{i.createDefaultProps=()=>({enabled:!0})})(le||(le={})),d.extendClassProps(le.prototype,le.createDefaultProps);function Ql(i){return Math.pow(i,3)}function Pn(i){return 1-Ql(1-i)}function Ap(i){return 3*i*i-2*i*i*i}function Mp(i){return i}class We{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}const cs={PROPERTYCHANGE:"propertychange"};class xr{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function Dp(i,t,e){let n,s;e=e||On;let o=0,r=i.length,a=!1;for(;o<r;)n=o+(r-o>>1),s=+e(i[n],t),s<0?o=n+1:(r=n,a=!s);return a?o:~o}function On(i,t){return i>t?1:i<t?-1:0}function Sr(i,t,e){if(i[0]<=t)return 0;const n=i.length;if(t<=i[n-1])return n-1;if(typeof e=="function"){for(let s=1;s<n;++s){const o=i[s];if(o===t)return s;if(o<t)return e(t,i[s-1],o)>0?s-1:s}return n-1}if(e>0){for(let s=1;s<n;++s)if(i[s]<t)return s-1;return n-1}if(e<0){for(let s=1;s<n;++s)if(i[s]<=t)return s;return n-1}for(let s=1;s<n;++s){if(i[s]==t)return s;if(i[s]<t)return i[s-1]-t<t-i[s]?s-1:s}return n-1}function Fp(i,t,e){for(;t<e;){const n=i[t];i[t]=i[e],i[e]=n,++t,--e}}function In(i,t){const e=Array.isArray(t)?t:[t],n=e.length;for(let s=0;s<n;s++)i[i.length]=e[s]}function Vi(i,t){const e=i.length;if(e!==t.length)return!1;for(let n=0;n<e;n++)if(i[n]!==t[n])return!1;return!0}function Lp(i,t,e){const n=t||On;return i.every(function(s,o){if(o===0)return!0;const r=n(i[o-1],s);return!(r>0||r===0)})}function Ks(){return!0}function Rr(){return!1}function hs(){}function zp(i){let t=!1,e,n,s;return function(){const o=Array.prototype.slice.call(arguments);return(!t||this!==s||!Vi(o,n))&&(t=!0,s=this,n=o,e=i.apply(this,arguments)),e}}function Qs(i){for(const t in i)delete i[t]}function Js(i){let t;for(t in i)return!1;return!t}class to extends xr{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const n=this.listeners_||(this.listeners_={}),s=n[t]||(n[t]=[]);s.includes(e)||s.push(e)}dispatchEvent(t){const e=typeof t=="string",n=e?t:t.type,s=this.listeners_&&this.listeners_[n];if(!s)return;const o=e?new We(t):t;o.target||(o.target=this.eventTarget_||this);const r=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});n in r||(r[n]=0,a[n]=0),++r[n];let c;for(let h=0,l=s.length;h<l;++h)if("handleEvent"in s[h]?c=s[h].handleEvent(o):c=s[h].call(this,o),c===!1||o.propagationStopped){c=!1;break}if(--r[n]===0){let h=a[n];for(delete a[n];h--;)this.removeEventListener(n,hs);delete r[n]}return c}disposeInternal(){this.listeners_&&Qs(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){const n=this.listeners_&&this.listeners_[t];if(n){const s=n.indexOf(e);s!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(n[s]=hs,++this.pendingRemovals_[t]):(n.splice(s,1),n.length===0&&delete this.listeners_[t]))}}}const ht={CHANGE:"change",ERROR:"error",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",TOUCHMOVE:"touchmove",WHEEL:"wheel"};function Ct(i,t,e,n,s){if(n&&n!==i&&(e=e.bind(n)),s){const r=e;e=function(){i.removeEventListener(t,e),r.apply(this,arguments)}}const o={target:i,type:t,listener:e};return i.addEventListener(t,e),o}function Pr(i,t,e,n){return Ct(i,t,e,n,!0)}function Mt(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),Qs(i))}class eo extends to{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(ht.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const n=t.length,s=new Array(n);for(let o=0;o<n;++o)s[o]=Ct(this,t[o],e);return s}return Ct(this,t,e)}onceInternal(t,e){let n;if(Array.isArray(t)){const s=t.length;n=new Array(s);for(let o=0;o<s;++o)n[o]=Pr(this,t[o],e)}else n=Pr(this,t,e);return e.ol_key=n,n}unInternal(t,e){const n=e.ol_key;if(n)gi(n);else if(Array.isArray(t))for(let s=0,o=t.length;s<o;++s)this.removeEventListener(t[s],e);else this.removeEventListener(t,e)}}eo.prototype.on,eo.prototype.once,eo.prototype.un;function gi(i){if(Array.isArray(i))for(let t=0,e=i.length;t<e;++t)Mt(i[t]);else Mt(i)}function vt(){throw new Error("Unimplemented abstract method.")}let Np=0;function St(i){return i.ol_uid||(i.ol_uid=String(++Np))}const Up="7.5.2";class Jl extends We{constructor(t,e,n){super(t),this.key=e,this.oldValue=n}}class Ke extends eo{constructor(t){super(),this.on,this.once,this.un,St(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_)||{}}hasProperties(){return!!this.values_}notify(t,e){let n;n=`change:${t}`,this.hasListener(n)&&this.dispatchEvent(new Jl(n,t,e)),n=cs.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new Jl(n,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,n){const s=this.values_||(this.values_={});if(n)s[t]=e;else{const o=s[t];s[t]=e,o!==e&&this.notify(t,o)}}setProperties(t,e){for(const n in t)this.set(n,t[n],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const n=this.values_[t];delete this.values_[t],Js(this.values_)&&(this.values_=null),e||this.notify(t,n)}}}const Bi=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",jp=Bi.includes("firefox");Bi.includes("safari")&&!Bi.includes("chrom")&&(Bi.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(Bi));const kp=Bi.includes("webkit")&&!Bi.includes("edge"),tu=Bi.includes("macintosh"),eu=typeof devicePixelRatio<"u"?devicePixelRatio:1,dc=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,Wp=typeof Image<"u"&&Image.prototype.decode,iu=function(){let i=!1;try{const t=Object.defineProperty({},"passive",{get:function(){i=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch{}return i}(),qp={1:"The view center is not defined",2:"The view resolution is not defined",3:"The view rotation is not defined",4:"`image` and `src` cannot be provided at the same time",5:"`imgSize` must be set when `image` is provided",7:"`format` must be set when `url` is set",8:"Unknown `serverType` configured",9:"`url` must be configured or set using `#setUrl()`",10:"The default `geometryFunction` can only handle `Point` geometries",11:"`options.featureTypes` must be an Array",12:"`options.geometryName` must also be provided when `options.bbox` is set",13:"Invalid corner",14:"Invalid color",15:"Tried to get a value for a key that does not exist in the cache",16:"Tried to set a value for a key that is used already",17:"`resolutions` must be sorted in descending order",18:"Either `origin` or `origins` must be configured, never both",19:"Number of `tileSizes` and `resolutions` must be equal",20:"Number of `origins` and `resolutions` must be equal",22:"Either `tileSize` or `tileSizes` must be configured, never both",24:"Invalid extent or geometry provided as `geometry`",25:"Cannot fit empty extent provided as `geometry`",26:"Features must have an id set",27:"Features must have an id set",28:'`renderMode` must be `"hybrid"` or `"vector"`',30:"The passed `feature` was already added to the source",31:"Tried to enqueue an `element` that was already added to the queue",32:"Transformation matrix cannot be inverted",33:"Invalid units",34:"Invalid geometry layout",36:"Unknown SRS type",37:"Unknown geometry type found",38:"`styleMapValue` has an unknown type",39:"Unknown geometry type",40:"Expected `feature` to have a geometry",41:"Expected an `ol/style/Style` or an array of `ol/style/Style.js`",42:"Question unknown, the answer is 42",43:"Expected `layers` to be an array or a `Collection`",47:"Expected `controls` to be an array or an `ol/Collection`",48:"Expected `interactions` to be an array or an `ol/Collection`",49:"Expected `overlays` to be an array or an `ol/Collection`",50:"`options.featureTypes` should be an Array",51:"Either `url` or `tileJSON` options must be provided",52:"Unknown `serverType` configured",53:"Unknown `tierSizeCalculation` configured",55:"The {-y} placeholder requires a tile grid with extent",56:"mapBrowserEvent must originate from a pointer event",57:"At least 2 conditions are required",59:"Invalid command found in the PBF",60:"Missing or invalid `size`",61:"Cannot determine IIIF Image API version from provided image information JSON",62:"A `WebGLArrayBuffer` must either be of type `ELEMENT_ARRAY_BUFFER` or `ARRAY_BUFFER`",64:"Layer opacity must be a number",66:"`forEachFeatureAtCoordinate` cannot be used on a WebGL layer if the hit detection logic has not been enabled. This is done by providing adequate shaders using the `hitVertexShader` and `hitFragmentShader` properties of `WebGLPointsLayerRenderer`",67:"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both",68:"A VectorTile source can only be rendered if it has a projection compatible with the view projection",69:"`width` or `height` cannot be provided together with `scale`"};class nu extends Error{constructor(t){const e=qp[t];super(e),this.code=t,this.name="AssertionError",this.message=e}}function pt(i,t){if(!i)throw new nu(t)}new Array(6);function be(){return[1,0,0,1,0,0]}function Gp(i,t){const e=i[0],n=i[1],s=i[2],o=i[3],r=i[4],a=i[5],c=t[0],h=t[1],l=t[2],u=t[3],f=t[4],g=t[5];return i[0]=e*c+s*h,i[1]=n*c+o*h,i[2]=e*l+s*u,i[3]=n*l+o*u,i[4]=e*f+s*g+r,i[5]=n*f+o*g+a,i}function Vp(i,t,e,n,s,o,r){return i[0]=t,i[1]=e,i[2]=n,i[3]=s,i[4]=o,i[5]=r,i}function Bp(i,t){return i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[4]=t[4],i[5]=t[5],i}function Ut(i,t){const e=t[0],n=t[1];return t[0]=i[0]*e+i[2]*n+i[4],t[1]=i[1]*e+i[3]*n+i[5],t}function Yp(i,t,e){return Vp(i,t,0,0,e,0,0)}function qe(i,t,e,n,s,o,r,a){const c=Math.sin(o),h=Math.cos(o);return i[0]=n*h,i[1]=s*c,i[2]=-n*c,i[3]=s*h,i[4]=r*n*h-a*n*c+t,i[5]=r*s*c+a*s*h+e,i}function Or(i,t){const e=Hp(t);pt(e!==0,32);const n=t[0],s=t[1],o=t[2],r=t[3],a=t[4],c=t[5];return i[0]=r/e,i[1]=-s/e,i[2]=-o/e,i[3]=n/e,i[4]=(o*c-r*a)/e,i[5]=-(n*c-s*a)/e,i}function Hp(i){return i[0]*i[3]-i[1]*i[2]}let su;function fc(i){const t="matrix("+i.join(", ")+")";if(dc)return t;const e=su||(su=document.createElement("div"));return e.style.transform=t,e.style.transform}const Zt={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Ir(i){const t=Te();for(let e=0,n=i.length;e<n;++e)ro(t,i[e]);return t}function Xp(i,t,e){const n=Math.min.apply(null,i),s=Math.min.apply(null,t),o=Math.max.apply(null,i),r=Math.max.apply(null,t);return pi(n,s,o,r,e)}function io(i,t,e){return e?(e[0]=i[0]-t,e[1]=i[1]-t,e[2]=i[2]+t,e[3]=i[3]+t,e):[i[0]-t,i[1]-t,i[2]+t,i[3]+t]}function ou(i,t){return t?(t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t):i.slice()}function no(i,t,e){let n,s;return t<i[0]?n=i[0]-t:i[2]<t?n=t-i[2]:n=0,e<i[1]?s=i[1]-e:i[3]<e?s=e-i[3]:s=0,n*n+s*s}function so(i,t){return gc(i,t[0],t[1])}function Tn(i,t){return i[0]<=t[0]&&t[2]<=i[2]&&i[1]<=t[1]&&t[3]<=i[3]}function gc(i,t,e){return i[0]<=t&&t<=i[2]&&i[1]<=e&&e<=i[3]}function pc(i,t){const e=i[0],n=i[1],s=i[2],o=i[3],r=t[0],a=t[1];let c=Zt.UNKNOWN;return r<e?c=c|Zt.LEFT:r>s&&(c=c|Zt.RIGHT),a<n?c=c|Zt.BELOW:a>o&&(c=c|Zt.ABOVE),c===Zt.UNKNOWN&&(c=Zt.INTERSECTING),c}function Te(){return[1/0,1/0,-1/0,-1/0]}function pi(i,t,e,n,s){return s?(s[0]=i,s[1]=t,s[2]=e,s[3]=n,s):[i,t,e,n]}function oo(i){return pi(1/0,1/0,-1/0,-1/0,i)}function $p(i,t){const e=i[0],n=i[1];return pi(e,n,e,n,t)}function Zp(i,t,e,n,s){const o=oo(s);return ru(o,i,t,e,n)}function Yi(i,t){return i[0]==t[0]&&i[2]==t[2]&&i[1]==t[1]&&i[3]==t[3]}function Kp(i,t){return t[0]<i[0]&&(i[0]=t[0]),t[2]>i[2]&&(i[2]=t[2]),t[1]<i[1]&&(i[1]=t[1]),t[3]>i[3]&&(i[3]=t[3]),i}function ro(i,t){t[0]<i[0]&&(i[0]=t[0]),t[0]>i[2]&&(i[2]=t[0]),t[1]<i[1]&&(i[1]=t[1]),t[1]>i[3]&&(i[3]=t[1])}function ru(i,t,e,n,s){for(;e<n;e+=s)Qp(i,t[e],t[e+1]);return i}function Qp(i,t,e){i[0]=Math.min(i[0],t),i[1]=Math.min(i[1],e),i[2]=Math.max(i[2],t),i[3]=Math.max(i[3],e)}function au(i,t){let e;return e=t(Tr(i)),e||(e=t(Ar(i)),e)||(e=t(Mr(i)),e)||(e=t(Ae(i)),e)?e:!1}function mc(i){let t=0;return Xi(i)||(t=yt(i)*Ht(i)),t}function Tr(i){return[i[0],i[1]]}function Ar(i){return[i[2],i[1]]}function Hi(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function Jp(i,t){let e;return t==="bottom-left"?e=Tr(i):t==="bottom-right"?e=Ar(i):t==="top-left"?e=Ae(i):t==="top-right"?e=Mr(i):pt(!1,13),e}function _c(i,t,e,n,s){const[o,r,a,c,h,l,u,f]=yc(i,t,e,n);return pi(Math.min(o,a,h,u),Math.min(r,c,l,f),Math.max(o,a,h,u),Math.max(r,c,l,f),s)}function yc(i,t,e,n){const s=t*n[0]/2,o=t*n[1]/2,r=Math.cos(e),a=Math.sin(e),c=s*r,h=s*a,l=o*r,u=o*a,f=i[0],g=i[1];return[f-c+u,g-h-l,f-c-u,g-h+l,f+c-u,g+h+l,f+c+u,g+h-l,f-c+u,g-h-l]}function Ht(i){return i[3]-i[1]}function An(i,t,e){const n=e||Te();return te(i,t)?(i[0]>t[0]?n[0]=i[0]:n[0]=t[0],i[1]>t[1]?n[1]=i[1]:n[1]=t[1],i[2]<t[2]?n[2]=i[2]:n[2]=t[2],i[3]<t[3]?n[3]=i[3]:n[3]=t[3]):oo(n),n}function Ae(i){return[i[0],i[3]]}function Mr(i){return[i[2],i[3]]}function yt(i){return i[2]-i[0]}function te(i,t){return i[0]<=t[2]&&i[2]>=t[0]&&i[1]<=t[3]&&i[3]>=t[1]}function Xi(i){return i[2]<i[0]||i[3]<i[1]}function tm(i,t){return t?(t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t):i}function em(i,t){const e=(i[2]-i[0])/2*(t-1),n=(i[3]-i[1])/2*(t-1);i[0]-=e,i[2]+=e,i[1]-=n,i[3]+=n}function im(i,t,e){let n=!1;const s=pc(i,t),o=pc(i,e);if(s===Zt.INTERSECTING||o===Zt.INTERSECTING)n=!0;else{const r=i[0],a=i[1],c=i[2],h=i[3],l=t[0],u=t[1],f=e[0],g=e[1],_=(g-u)/(f-l);let y,w;o&Zt.ABOVE&&!(s&Zt.ABOVE)&&(y=f-(g-h)/_,n=y>=r&&y<=c),!n&&o&Zt.RIGHT&&!(s&Zt.RIGHT)&&(w=g-(f-c)*_,n=w>=a&&w<=h),!n&&o&Zt.BELOW&&!(s&Zt.BELOW)&&(y=f-(g-a)/_,n=y>=r&&y<=c),!n&&o&Zt.LEFT&&!(s&Zt.LEFT)&&(w=g-(f-r)*_,n=w>=a&&w<=h)}return n}function nm(i,t,e,n){if(Xi(i))return oo(e);let s=[];s=[i[0],i[1],i[2],i[1],i[2],i[3],i[0],i[3]],t(s,s,2);const o=[],r=[];for(let a=0,c=s.length;a<c;a+=2)o.push(s[a]),r.push(s[a+1]);return Xp(o,r,e)}function cu(i,t){const e=t.getExtent(),n=Hi(i);if(t.canWrapX()&&(n[0]<e[0]||n[0]>=e[2])){const s=yt(e),r=Math.floor((n[0]-e[0])/s)*s;i[0]-=r,i[2]-=r}return i}function sm(i,t){if(t.canWrapX()){const e=t.getExtent();if(!isFinite(i[0])||!isFinite(i[2]))return[[e[0],i[1],e[2],i[3]]];cu(i,t);const n=yt(e);if(yt(i)>n)return[[e[0],i[1],e[2],i[3]]];if(i[0]<e[0])return[[i[0]+n,i[1],e[2],i[3]],[e[0],i[1],i[2],i[3]]];if(i[2]>e[2])return[[i[0],i[1],e[2],i[3]],[e[0],i[1],i[2]-n,i[3]]]}return[i]}const wc={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class vc{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_||wc[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 ao=6378137,ls=Math.PI*ao,om=[-ls,-ls,ls,ls],rm=[-180,-85,180,85],Dr=ao*Math.log(Math.tan(Math.PI/2));class us extends vc{constructor(t){super({code:t,units:"m",extent:om,global:!0,worldExtent:rm,getPointResolution:function(e,n){return e/Math.cosh(n[1]/ao)}})}}const hu=[new us("EPSG:3857"),new us("EPSG:102100"),new us("EPSG:102113"),new us("EPSG:900913"),new us("http://www.opengis.net/def/crs/EPSG/0/3857"),new us("http://www.opengis.net/gml/srs/epsg.xml#3857")];function am(i,t,e){const n=i.length;e=e>1?e:2,t===void 0&&(e>2?t=i.slice():t=new Array(n));for(let s=0;s<n;s+=e){t[s]=ls*i[s]/180;let o=ao*Math.log(Math.tan(Math.PI*(+i[s+1]+90)/360));o>Dr?o=Dr:o<-Dr&&(o=-Dr),t[s+1]=o}return t}function cm(i,t,e){const n=i.length;e=e>1?e:2,t===void 0&&(e>2?t=i.slice():t=new Array(n));for(let s=0;s<n;s+=e)t[s]=180*i[s]/ls,t[s+1]=360*Math.atan(Math.exp(i[s+1]/ao))/Math.PI-90;return t}const hm=6378137,lu=[-180,-90,180,90],lm=Math.PI*hm/180;class Mn extends vc{constructor(t,e){super({code:t,units:"degrees",extent:lu,axisOrientation:e,global:!0,metersPerUnit:lm,worldExtent:lu})}}const uu=[new Mn("CRS:84"),new Mn("EPSG:4326","neu"),new Mn("urn:ogc:def:crs:OGC:1.3:CRS84"),new Mn("urn:ogc:def:crs:OGC:2:84"),new Mn("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Mn("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Mn("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Ec={};function um(i){return Ec[i]||Ec[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function dm(i,t){Ec[i]=t}let ds={};function fs(i,t,e){const n=i.getCode(),s=t.getCode();n in ds||(ds[n]={}),ds[n][s]=e}function fm(i,t){let e;return i in ds&&t in ds[i]&&(e=ds[i][t]),e}function qt(i,t,e){return Math.min(Math.max(i,t),e)}function gm(i,t,e,n,s,o){const r=s-e,a=o-n;if(r!==0||a!==0){const c=((i-e)*r+(t-n)*a)/(r*r+a*a);c>1?(e=s,n=o):c>0&&(e+=r*c,n+=a*c)}return Dn(i,t,e,n)}function Dn(i,t,e,n){const s=e-i,o=n-t;return s*s+o*o}function pm(i){const t=i.length;for(let n=0;n<t;n++){let s=n,o=Math.abs(i[n][n]);for(let a=n+1;a<t;a++){const c=Math.abs(i[a][n]);c>o&&(o=c,s=a)}if(o===0)return null;const r=i[s];i[s]=i[n],i[n]=r;for(let a=n+1;a<t;a++){const c=-i[a][n]/i[n][n];for(let h=n;h<t+1;h++)n==h?i[a][h]=0:i[a][h]+=c*i[n][h]}}const e=new Array(t);for(let n=t-1;n>=0;n--){e[n]=i[n][t]/i[n][n];for(let s=n-1;s>=0;s--)i[s][t]-=i[s][n]*e[n]}return e}function Fr(i){return i*Math.PI/180}function $i(i,t){const e=i%t;return e*t<0?e+t:e}function xe(i,t,e){return i+e*(t-i)}function Cc(i,t){const e=Math.pow(10,t);return Math.round(i*e)/e}function Lr(i,t){return Math.floor(Cc(i,t))}function zr(i,t){return Math.ceil(Cc(i,t))}function mm(i,t){const e=(""+i).split("."),n=(""+t).split(".");for(let s=0;s<Math.max(e.length,n.length);s++){const o=parseInt(e[s]||"0",10),r=parseInt(n[s]||"0",10);if(o>r)return 1;if(r>o)return-1}return 0}function _m(i,t){return i[0]+=+t[0],i[1]+=+t[1],i}function Nr(i,t){let e=!0;for(let n=i.length-1;n>=0;--n)if(i[n]!=t[n]){e=!1;break}return e}function bc(i,t){const e=Math.cos(t),n=Math.sin(t),s=i[0]*e-i[1]*n,o=i[1]*e+i[0]*n;return i[0]=s,i[1]=o,i}function ym(i,t){return i[0]*=t,i[1]*=t,i}function du(i,t){if(t.canWrapX()){const e=yt(t.getExtent()),n=wm(i,t,e);n&&(i[0]-=n*e)}return i}function wm(i,t,e){const n=t.getExtent();let s=0;return t.canWrapX()&&(i[0]<n[0]||i[0]>n[2])&&(e=e||yt(n),s=Math.floor((i[0]-n[0])/e)),s}const fu=63710088e-1;function xc(i,t,e){e=e||fu;const n=Fr(i[1]),s=Fr(t[1]),o=(s-n)/2,r=Fr(t[0]-i[0])/2,a=Math.sin(o)*Math.sin(o)+Math.sin(r)*Math.sin(r)*Math.cos(n)*Math.cos(s);return 2*e*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function Sc(i,t){let e=0;for(let n=0,s=i.length;n<s-1;++n)e+=xc(i[n],i[n+1],t);return e}function gu(i,t){t=t||{};const e=t.radius||fu,n=t.projection||"EPSG:3857",s=i.getType();s!=="GeometryCollection"&&(i=i.clone().transform(n,"EPSG:4326"));let o=0,r,a,c,h,l,u;switch(s){case"Point":case"MultiPoint":break;case"LineString":case"LinearRing":{r=i.getCoordinates(),o=Sc(r,e);break}case"MultiLineString":case"Polygon":{for(r=i.getCoordinates(),c=0,h=r.length;c<h;++c)o+=Sc(r[c],e);break}case"MultiPolygon":{for(r=i.getCoordinates(),c=0,h=r.length;c<h;++c)for(a=r[c],l=0,u=a.length;l<u;++l)o+=Sc(a[l],e);break}case"GeometryCollection":{const f=i.getGeometries();for(c=0,h=f.length;c<h;++c)o+=gu(f[c],t);break}default:throw new Error("Unsupported geometry type: "+s)}return o}function pu(...i){console.warn(...i)}let Rc=!0;function mu(i){Rc=!1}function Pc(i,t){if(t!==void 0){for(let e=0,n=i.length;e<n;++e)t[e]=i[e];t=t}else t=i.slice();return t}function _u(i,t){if(t!==void 0&&i!==t){for(let e=0,n=i.length;e<n;++e)t[e]=i[e];i=t}return i}function yu(i){dm(i.getCode(),i),fs(i,i,Pc)}function vm(i){i.forEach(yu)}function Gt(i){return typeof i=="string"?um(i):i||null}function wu(i,t,e,n){i=Gt(i);let s;const o=i.getPointResolutionFunc();if(o)s=o(t,e);else{const r=i.getUnits();if(r=="degrees"||n=="degrees")s=t;else{const a=Ic(i,Gt("EPSG:4326"));if(a===_u&&r!=="degrees")s=t*i.getMetersPerUnit();else{let h=[e[0]-t/2,e[1],e[0]+t/2,e[1],e[0],e[1]-t/2,e[0],e[1]+t/2];h=a(h,h,2);const l=xc(h.slice(0,2),h.slice(2,4)),u=xc(h.slice(4,6),h.slice(6,8));s=(l+u)/2}const c=i.getMetersPerUnit();c!==void 0&&(s/=c)}}return s}function vu(i){vm(i),i.forEach(function(t){i.forEach(function(e){t!==e&&fs(t,e,Pc)})})}function Em(i,t,e,n){i.forEach(function(s){t.forEach(function(o){fs(s,o,e),fs(o,s,n)})})}function Oc(i,t){return i?typeof i=="string"?Gt(i):i:Gt(t)}function Eu(i){return function(t,e,n){const s=t.length;n=n!==void 0?n:2,e=e!==void 0?e:new Array(s);for(let o=0;o<s;o+=n){const r=i(t.slice(o,o+n)),a=r.length;for(let c=0,h=n;c<h;++c)e[o+c]=c>=a?t[o+c]:r[c]}return e}}function Cu(i,t,e,n){const s=Gt(i),o=Gt(t);fs(s,o,Eu(e)),fs(o,s,Eu(n))}function _t(i,t){return mu(),co(i,"EPSG:4326",t!==void 0?t:"EPSG:3857")}function Kt(i,t){const e=co(i,"EPSG:3857","EPSG:4326"),n=e[0];return(n<-180||n>180)&&(e[0]=$i(n+180,360)-180),e}function Zi(i,t){if(i===t)return!0;const e=i.getUnits()===t.getUnits();return(i.getCode()===t.getCode()||Ic(i,t)===Pc)&&e}function Ic(i,t){const e=i.getCode(),n=t.getCode();let s=fm(e,n);return s||(s=_u),s}function Fn(i,t){const e=Gt(i),n=Gt(t);return Ic(e,n)}function co(i,t,e){return Fn(t,e)(i,void 0,i.length)}function bu(i,t,e,n){const s=Fn(t,e);return nm(i,s,void 0)}function Tc(i,t){return i}function mi(i,t){return Rc&&!Nr(i,[0,0])&&i[0]>=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(Rc=!1,pu("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i}function xu(i,t){return i}function _i(i,t){return i}function Cm(){vu(hu),vu(uu),Em(uu,hu,am,cm)}Cm();function yi(i,t,e,n,s,o){o=o||[];let r=0;for(let a=t;a<e;a+=n){const c=i[a],h=i[a+1];o[r++]=s[0]*c+s[2]*h+s[4],o[r++]=s[1]*c+s[3]*h+s[5]}return o&&o.length!=r&&(o.length=r),o}function Su(i,t,e,n,s,o,r){r=r||[];const a=Math.cos(s),c=Math.sin(s),h=o[0],l=o[1];let u=0;for(let f=t;f<e;f+=n){const g=i[f]-h,_=i[f+1]-l;r[u++]=h+g*a-_*c,r[u++]=l+g*c+_*a;for(let y=f+2;y<f+n;++y)r[u++]=i[y]}return r&&r.length!=u&&(r.length=u),r}function bm(i,t,e,n,s,o,r,a){a=a||[];const c=r[0],h=r[1];let l=0;for(let u=t;u<e;u+=n){const f=i[u]-c,g=i[u+1]-h;a[l++]=c+s*f,a[l++]=h+o*g;for(let _=u+2;_<u+n;++_)a[l++]=i[_]}return a&&a.length!=l&&(a.length=l),a}function xm(i,t,e,n,s,o,r){r=r||[];let a=0;for(let c=t;c<e;c+=n){r[a++]=i[c]+s,r[a++]=i[c+1]+o;for(let h=c+2;h<c+n;++h)r[a++]=i[h]}return r&&r.length!=a&&(r.length=a),r}const Ru=be();class Sm extends Ke{constructor(){super(),this.extent_=Te(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=zp(function(t,e,n){if(!n)return this.getSimplifiedGeometry(e);const s=this.clone();return s.applyTransform(n),s.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return vt()}closestPointXY(t,e,n,s){return vt()}containsXY(t,e){const n=this.getClosestPoint([t,e]);return n[0]===t&&n[1]===e}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 vt()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&oo(e),this.extentRevision_=this.getRevision()}return tm(this.extent_,t)}rotate(t,e){vt()}scale(t,e,n){vt()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return vt()}getType(){return vt()}applyTransform(t){vt()}intersectsExtent(t){return vt()}translate(t,e){vt()}transform(t,e){const n=Gt(t),s=n.getUnits()=="tile-pixels"?function(o,r,a){const c=n.getExtent(),h=n.getWorldExtent(),l=Ht(h)/Ht(c);return qe(Ru,h[0],h[3],l,-l,0,0,0),yi(o,0,o.length,a,Ru,r),Fn(n,e)(o,r,a)}:Fn(n,e);return this.applyTransform(s),this}}class gs extends Sm{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates=null}computeExtent(t){return Zp(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return vt()}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=Pu(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){vt()}setLayout(t,e,n){let s;if(t)s=Pu(t);else{for(let o=0;o<n;++o){if(e.length===0){this.layout="XY",this.stride=2;return}e=e[0]}s=e.length,t=Rm(s)}this.layout=t,this.stride=s}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.stride),this.changed())}rotate(t,e){const n=this.getFlatCoordinates();if(n){const s=this.getStride();Su(n,0,n.length,s,t,e,n),this.changed()}}scale(t,e,n){e===void 0&&(e=t),n||(n=Hi(this.getExtent()));const s=this.getFlatCoordinates();if(s){const o=this.getStride();bm(s,0,s.length,o,t,e,n,s),this.changed()}}translate(t,e){const n=this.getFlatCoordinates();if(n){const s=this.getStride();xm(n,0,n.length,s,t,e,n),this.changed()}}}function Rm(i){let t;return i==2?t="XY":i==3?t="XYZ":i==4&&(t="XYZM"),t}function Pu(i){let t;return i=="XY"?t=2:i=="XYZ"||i=="XYM"?t=3:i=="XYZM"&&(t=4),t}function Pm(i,t,e){const n=i.getFlatCoordinates();if(!n)return null;const s=i.getStride();return yi(n,0,n.length,s,t,e)}function Ou(i,t,e,n,s,o,r){const a=i[t],c=i[t+1],h=i[e]-a,l=i[e+1]-c;let u;if(h===0&&l===0)u=t;else{const f=((s-a)*h+(o-c)*l)/(h*h+l*l);if(f>1)u=e;else if(f>0){for(let g=0;g<n;++g)r[g]=xe(i[t+g],i[e+g],f);r.length=n;return}else u=t}for(let f=0;f<n;++f)r[f]=i[u+f];r.length=n}function Ac(i,t,e,n,s){let o=i[t],r=i[t+1];for(t+=n;t<e;t+=n){const a=i[t],c=i[t+1],h=Dn(o,r,a,c);h>s&&(s=h),o=a,r=c}return s}function Iu(i,t,e,n,s){for(let o=0,r=e.length;o<r;++o){const a=e[o];s=Ac(i,t,a,n,s),t=a}return s}function Mc(i,t,e,n,s,o,r,a,c,h,l){if(t==e)return h;let u,f;if(s===0){if(f=Dn(r,a,i[t],i[t+1]),f<h){for(u=0;u<n;++u)c[u]=i[t+u];return c.length=n,f}return h}l=l||[NaN,NaN];let g=t+n;for(;g<e;)if(Ou(i,g-n,g,n,r,a,l),f=Dn(r,a,l[0],l[1]),f<h){for(h=f,u=0;u<n;++u)c[u]=l[u];c.length=n,g+=n}else g+=n*Math.max((Math.sqrt(f)-Math.sqrt(h))/s|0,1);if(o&&(Ou(i,e-n,t,n,r,a,l),f=Dn(r,a,l[0],l[1]),f<h)){for(h=f,u=0;u<n;++u)c[u]=l[u];c.length=n}return h}function Tu(i,t,e,n,s,o,r,a,c,h,l){l=l||[NaN,NaN];for(let u=0,f=e.length;u<f;++u){const g=e[u];h=Mc(i,t,g,n,s,o,r,a,c,h,l),t=g}return h}function Om(i,t,e,n){for(let s=0,o=e.length;s<o;++s)i[t++]=e[s];return t}function Ur(i,t,e,n){for(let s=0,o=e.length;s<o;++s){const r=e[s];for(let a=0;a<n;++a)i[t++]=r[a]}return t}function Au(i,t,e,n,s){s=s||[];let o=0;for(let r=0,a=e.length;r<a;++r){const c=Ur(i,t,e[r],n);s[o++]=c,t=c}return s.length=o,s}function Dc(i,t,e,n,s,o,r){const a=(e-t)/n;if(a<3){for(;t<e;t+=n)o[r++]=i[t],o[r++]=i[t+1];return r}const c=new Array(a);c[0]=1,c[a-1]=1;const h=[t,e-n];let l=0;for(;h.length>0;){const u=h.pop(),f=h.pop();let g=0;const _=i[f],y=i[f+1],w=i[u],E=i[u+1];for(let b=f+n;b<u;b+=n){const P=i[b],I=i[b+1],M=gm(P,I,_,y,w,E);M>g&&(l=b,g=M)}g>s&&(c[(l-t)/n]=1,f+n<l&&h.push(f,l),l+n<u&&h.push(l,u))}for(let u=0;u<a;++u)c[u]&&(o[r++]=i[t+u*n],o[r++]=i[t+u*n+1]);return r}function Im(i,t,e,n,s,o,r,a){for(let c=0,h=e.length;c<h;++c){const l=e[c];r=Dc(i,t,l,n,s,o,r),a.push(r),t=l}return r}function Ln(i,t){return t*Math.round(i/t)}function Tm(i,t,e,n,s,o,r){if(t==e)return r;let a=Ln(i[t],s),c=Ln(i[t+1],s);t+=n,o[r++]=a,o[r++]=c;let h,l;do if(h=Ln(i[t],s),l=Ln(i[t+1],s),t+=n,t==e)return o[r++]=h,o[r++]=l,r;while(h==a&&l==c);for(;t<e;){const u=Ln(i[t],s),f=Ln(i[t+1],s);if(t+=n,u==h&&f==l)continue;const g=h-a,_=l-c,y=u-a,w=f-c;if(g*w==_*y&&(g<0&&y<g||g==y||g>0&&y>g)&&(_<0&&w<_||_==w||_>0&&w>_)){h=u,l=f;continue}o[r++]=h,o[r++]=l,a=h,c=l,h=u,l=f}return o[r++]=h,o[r++]=l,r}function Am(i,t,e,n,s,o,r,a){for(let c=0,h=e.length;c<h;++c){const l=e[c];r=Tm(i,t,l,n,s,o,r),a.push(r),t=l}return r}function Ki(i,t,e,n,s){s=s!==void 0?s:[];let o=0;for(let r=t;r<e;r+=n)s[o++]=i.slice(r,r+n);return s.length=o,s}function ho(i,t,e,n,s){s=s!==void 0?s:[];let o=0;for(let r=0,a=e.length;r<a;++r){const c=e[r];s[o++]=Ki(i,t,c,n,s[o]),t=c}return s.length=o,s}function Mu(i,t,e,n,s){s=s!==void 0?s:[];let o=0;for(let r=0,a=e.length;r<a;++r){const c=e[r];s[o++]=c.length===1&&c[0]===t?[]:ho(i,t,c,n,s[o]),t=c[c.length-1]}return s.length=o,s}function Du(i,t,e,n){let s=0,o=i[e-n],r=i[e-n+1];for(;t<e;t+=n){const a=i[t],c=i[t+1];s+=r*a-o*c,o=a,r=c}return s/2}function Mm(i,t,e,n){let s=0;for(let o=0,r=e.length;o<r;++o){const a=e[o];s+=Du(i,t,a,n),t=a}return s}class lo extends gs{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 lo(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,n,s){return s<no(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Ac(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Mc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,n,s))}getArea(){return Du(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Ki(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=Dc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new lo(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Ur(this.flatCoordinates,0,t,this.stride),this.changed()}}class Ge extends gs{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new Ge(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,n,s){const o=this.flatCoordinates,r=Dn(t,e,o[0],o[1]);if(r<s){const a=this.stride;for(let c=0;c<a;++c)n[c]=o[c];return n.length=a,r}return s}getCoordinates(){return this.flatCoordinates?this.flatCoordinates.slice():[]}computeExtent(t){return $p(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return gc(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Om(this.flatCoordinates,0,t,this.stride),this.changed()}}function Dm(i,t,e,n,s){return!au(s,function(r){return!zn(i,t,e,n,r[0],r[1])})}function zn(i,t,e,n,s,o){let r=0,a=i[e-n],c=i[e-n+1];for(;t<e;t+=n){const h=i[t],l=i[t+1];c<=o?l>o&&(h-a)*(o-c)-(s-a)*(l-c)>0&&r++:l<=o&&(h-a)*(o-c)-(s-a)*(l-c)<0&&r--,a=h,c=l}return r!==0}function Fu(i,t,e,n,s,o){if(e.length===0||!zn(i,t,e[0],n,s,o))return!1;for(let r=1,a=e.length;r<a;++r)if(zn(i,e[r-1],e[r],n,s,o))return!1;return!0}function Fm(i,t,e,n,s,o,r){let a,c,h,l,u,f,g;const _=s[o+1],y=[];for(let b=0,P=e.length;b<P;++b){const I=e[b];for(l=i[I-n],f=i[I-n+1],a=t;a<I;a+=n)u=i[a],g=i[a+1],(_<=f&&g<=_||f<=_&&_<=g)&&(h=(_-f)/(g-f)*(u-l)+l,y.push(h)),l=u,f=g}let w=NaN,E=-1/0;for(y.sort(On),l=y[0],a=1,c=y.length;a<c;++a){u=y[a];const b=Math.abs(u-l);b>E&&(h=(l+u)/2,Fu(i,t,e,n,h,_)&&(w=h,E=b)),l=u}return isNaN(w)&&(w=s[o]),[w,_,E]}function Lu(i,t,e,n,s){let o;for(t+=n;t<e;t+=n)if(o=s(i.slice(t-n,t),i.slice(t,t+n)),o)return o;return!1}function jr(i,t,e,n,s){const o=ru(Te(),i,t,e,n);return te(s,o)?Tn(s,o)||o[0]>=s[0]&&o[2]<=s[2]||o[1]>=s[1]&&o[3]<=s[3]?!0:Lu(i,t,e,n,function(r,a){return im(s,r,a)}):!1}function Lm(i,t,e,n,s){for(let o=0,r=e.length;o<r;++o){if(jr(i,t,e[o],n,s))return!0;t=e[o]}return!1}function zu(i,t,e,n,s){return!!(jr(i,t,e,n,s)||zn(i,t,e,n,s[0],s[1])||zn(i,t,e,n,s[0],s[3])||zn(i,t,e,n,s[2],s[1])||zn(i,t,e,n,s[2],s[3]))}function zm(i,t,e,n,s){if(!zu(i,t,e[0],n,s))return!1;if(e.length===1)return!0;for(let o=1,r=e.length;o<r;++o)if(Dm(i,e[o-1],e[o],n,s)&&!jr(i,e[o-1],e[o],n,s))return!1;return!0}function Nm(i,t,e,n){for(;t<e-n;){for(let s=0;s<n;++s){const o=i[t+s];i[t+s]=i[e-n+s],i[e-n+s]=o}t+=n,e-=n}}function Nu(i,t,e,n){let s=0,o=i[e-n],r=i[e-n+1];for(;t<e;t+=n){const a=i[t],c=i[t+1];s+=(a-o)*(c+r),o=a,r=c}return s===0?void 0:s>0}function Um(i,t,e,n,s){s=s!==void 0?s:!1;for(let o=0,r=e.length;o<r;++o){const a=e[o],c=Nu(i,t,a,n);if(o===0){if(s&&c||!s&&!c)return!1}else if(s&&!c||!s&&c)return!1;t=a}return!0}function Uu(i,t,e,n,s){s=s!==void 0?s:!1;for(let o=0,r=e.length;o<r;++o){const a=e[o],c=Nu(i,t,a,n);(o===0?s&&c||!s&&!c:s&&!c||!s&&c)&&Nm(i,t,a,n),t=a}return t}class ps extends gs{constructor(t,e,n){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,e!==void 0&&n?(this.setFlatCoordinates(e,t),this.ends_=n):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?In(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new ps(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,n,s){return s<no(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Iu(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Tu(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,n,s))}containsXY(t,e){return Fu(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return Mm(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),Uu(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,ho(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=Hi(this.getExtent());this.flatInteriorPoint_=Fm(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Ge(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new lo(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,n=this.ends_,s=[];let o=0;for(let r=0,a=n.length;r<a;++r){const c=n[r],h=new lo(e.slice(o,c),t);s.push(h),o=c}return s}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;Um(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Uu(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],n=[];return e.length=Am(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,n),new ps(e,"XY",n)}getType(){return"Polygon"}intersectsExtent(t){return zm(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const n=Au(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}}function Fc(i){if(Xi(i))throw new Error("Cannot create polygon from empty extent");const t=i[0],e=i[1],n=i[2],s=i[3],o=[t,e,t,s,n,s,n,e,t,e];return new ps(o,"XY",[o.length])}const ue={ADD:"add",REMOVE:"remove"},ju={LENGTH:"length"};class kr extends We{constructor(t,e,n){super(t),this.element=e,this.index=n}}class Qe extends Ke{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t||[],this.unique_)for(let n=0,s=this.array_.length;n<s;++n)this.assertUnique_(this.array_[n],n);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,n=t.length;e<n;++e)this.push(t[e]);return this}forEach(t){const e=this.array_;for(let n=0,s=e.length;n<s;++n)t(e[n],n,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(ju.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 kr(ue.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 n=0,s=e.length;n<s;++n)if(e[n]===t)return this.removeAt(n)}removeAt(t){if(t<0||t>=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new kr(ue.REMOVE,e,t)),e}setAt(t,e){const n=this.getLength();if(t>=n){this.insertAt(t,e);return}if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const s=this.array_[t];this.array_[t]=e,this.dispatchEvent(new kr(ue.REMOVE,s,t)),this.dispatchEvent(new kr(ue.ADD,e,t))}updateLength_(){this.set(ju.LENGTH,this.array_.length)}assertUnique_(t,e){for(let n=0,s=this.array_.length;n<s;++n)if(this.array_[n]===t&&n!==e)throw new nu(58)}}class Je extends Ke{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 Je(this.hasProperties()?this.getProperties():null);t.setGeometryName(this.getGeometryName());const e=this.getGeometry();e&&t.setGeometry(e.clone());const n=this.getStyle();return n&&t.setStyle(n),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(Mt(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=Ct(t,ht.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?jm(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 jm(i){if(typeof i=="function")return i;let t;return Array.isArray(i)?t=i:(pt(typeof i.getZIndex=="function",41),t=[i]),function(){return t}}const ti={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};class de{constructor(t){t=t||{},this.color_=t.color!==void 0?t.color:null}clone(){const t=this.getColor();return new de({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){this.color_=t}}function ku(i,t,e,n,s,o,r){let a,c;const h=(e-t)/n;if(h===1)a=t;else if(h===2)a=t,c=s;else if(h!==0){let l=i[t],u=i[t+1],f=0;const g=[0];for(let w=t+n;w<e;w+=n){const E=i[w],b=i[w+1];f+=Math.sqrt((E-l)*(E-l)+(b-u)*(b-u)),g.push(f),l=E,u=b}const _=s*f,y=Dp(g,_);y<0?(c=(_-g[-y-2])/(g[-y-1]-g[-y-2]),a=t+(-y-2)*n):a=t+y*n}r=r>1?r:2,o=o||new Array(r);for(let l=0;l<r;++l)o[l]=a===void 0?NaN:c===void 0?i[a+l]:xe(i[a+l],i[a+n+l],c);return o}function Lc(i,t,e,n,s,o){if(e==t)return null;let r;if(s<i[t+n-1])return o?(r=i.slice(t,t+n),r[n-1]=s,r):null;if(i[e-1]<s)return o?(r=i.slice(e-n,e),r[n-1]=s,r):null;if(s==i[t+n-1])return i.slice(t,t+n);let a=t/n,c=e/n;for(;a<c;){const f=a+c>>1;s<i[(f+1)*n-1]?c=f:a=f+1}const h=i[a*n-1];if(s==h)return i.slice((a-1)*n,(a-1)*n+n);const l=i[(a+1)*n-1],u=(s-h)/(l-h);r=[];for(let f=0;f<n-1;++f)r.push(xe(i[(a-1)*n+f],i[a*n+f],u));return r.push(s),r}function km(i,t,e,n,s,o,r){if(r)return Lc(i,t,e[e.length-1],n,s,o);let a;if(s<i[n-1])return o?(a=i.slice(0,n),a[n-1]=s,a):null;if(i[i.length-1]<s)return o?(a=i.slice(i.length-n),a[n-1]=s,a):null;for(let c=0,h=e.length;c<h;++c){const l=e[c];if(t!=l){if(s<i[t+n-1])return null;if(s<=i[l-1])return Lc(i,t,l,n,s,!1);t=l}}return null}function Wu(i,t,e,n){let s=i[t],o=i[t+1],r=0;for(let a=t+n;a<e;a+=n){const c=i[a],h=i[a+1];r+=Math.sqrt((c-s)*(c-s)+(h-o)*(h-o)),s=c,o=h}return r}class wi extends gs{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){this.flatCoordinates?In(this.flatCoordinates,t):this.flatCoordinates=t.slice(),this.changed()}clone(){const t=new wi(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,n,s){return s<no(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Ac(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Mc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,n,s))}forEachSegment(t){return Lu(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,Lc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return Ki(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return ku(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return Wu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){const e=[];return e.length=Dc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new wi(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return jr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Ur(this.flatCoordinates,0,t,this.stride),this.changed()}}class Se{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 Se({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setWidth(t){this.width_=t}}const ot={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function qu(i,t,e){return e===void 0&&(e=[0,0]),e[0]=i[0]+2*t,e[1]=i[1]+2*t,e}function Gu(i){return i[0]>0&&i[1]>0}function Vu(i,t,e){return e===void 0&&(e=[0,0]),e[0]=i[0]*t+.5|0,e[1]=i[1]*t+.5|0,e}function fe(i,t){return Array.isArray(i)?i:(t===void 0?t=[i,i]:(t[0]=i,t[1]=i),t)}class Wr{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=fe(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new Wr({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 vt()}getImage(t){return vt()}getHitDetectionImage(){return vt()}getPixelRatio(t){return 1}getImageState(){return vt()}getImageSize(){return vt()}getOrigin(){return vt()}getSize(){return vt()}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_=fe(t)}listenImageChange(t){vt()}load(){vt()}unlistenImageChange(t){vt()}}const Wm=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,qm=/^([a-z]*)$|^hsla?\(.*\)$/i;function Bu(i){return typeof i=="string"?i:Hu(i)}function Gm(i){const t=document.createElement("div");if(t.style.color=i,t.style.color!==""){document.body.appendChild(t);const e=getComputedStyle(t).color;return document.body.removeChild(t),e}return""}const Vm=function(){const t={};let e=0;return function(n){let s;if(t.hasOwnProperty(n))s=t[n];else{if(e>=1024){let o=0;for(const r in t)(o++&3)===0&&(delete t[r],--e)}s=Bm(n),t[n]=s,++e}return s}}();function qr(i){return Array.isArray(i)?i:Vm(i)}function Bm(i){let t,e,n,s,o;if(qm.exec(i)&&(i=Gm(i)),Wm.exec(i)){const r=i.length-1;let a;r<=4?a=1:a=2;const c=r===4||r===8;t=parseInt(i.substr(1+0*a,a),16),e=parseInt(i.substr(1+1*a,a),16),n=parseInt(i.substr(1+2*a,a),16),c?s=parseInt(i.substr(1+3*a,a),16):s=255,a==1&&(t=(t<<4)+t,e=(e<<4)+e,n=(n<<4)+n,c&&(s=(s<<4)+s)),o=[t,e,n,s/255]}else i.startsWith("rgba(")?(o=i.slice(5,-1).split(",").map(Number),Yu(o)):i.startsWith("rgb(")?(o=i.slice(4,-1).split(",").map(Number),o.push(1),Yu(o)):pt(!1,14);return o}function Yu(i){return i[0]=qt(i[0]+.5|0,0,255),i[1]=qt(i[1]+.5|0,0,255),i[2]=qt(i[2]+.5|0,0,255),i[3]=qt(i[3],0,1),i}function Hu(i){let t=i[0];t!=(t|0)&&(t=t+.5|0);let e=i[1];e!=(e|0)&&(e=e+.5|0);let n=i[2];n!=(n|0)&&(n=n+.5|0);const s=i[3]===void 0?1:Math.round(i[3]*100)/100;return"rgba("+t+","+e+","+n+","+s+")"}function ei(i){return Array.isArray(i)?Hu(i):i}function Vt(i,t,e,n){let s;return e&&e.length?s=e.shift():dc?s=new OffscreenCanvas(i||300,t||300):s=document.createElement("canvas"),i&&(s.width=i),t&&(s.height=t),s.getContext("2d",n)}function Gr(i){const t=i.canvas;t.width=1,t.height=1,i.clearRect(0,0,1,1)}function Xu(i,t){const e=t.parentNode;e&&e.replaceChild(i,t)}function zc(i){return i&&i.parentNode?i.parentNode.removeChild(i):null}function Ym(i){for(;i.lastChild;)i.removeChild(i.lastChild)}function Hm(i,t){const e=i.childNodes;for(let n=0;;++n){const s=e[n],o=t[n];if(!s&&!o)break;if(s!==o){if(!s){i.appendChild(o);continue}if(!o){i.removeChild(s),--n;continue}i.insertBefore(o,s)}}}const Vr="ol-hidden",Br="ol-unselectable",Nc="ol-control",$u="ol-collapsed",Xm=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z]+?)\\s*$`].join(""),"i"),Zu=["style","variant","weight","size","lineHeight","family"],Ku=function(i){const t=i.match(Xm);if(!t)return null;const e={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"};for(let n=0,s=Zu.length;n<s;++n){const o=t[n+1];o!==void 0&&(e[Zu[n]]=o)}return e.families=e.family.split(/,\s?/),e},Qu="10px sans-serif",ge="#000",Yr="round",vi=[],Ei=0,ms="round",uo=10,fo="#000",go="center",Hr="middle",Nn=[0,0,0,0],po=1,Ci=new Ke;let _s=null,Uc;const jc={},$m=function(){const t="32px ",e=["monospace","serif"],n=e.length,s="wmytzilWMYTZIL@#/&?$%10";let o,r;function a(h,l,u){let f=!0;for(let g=0;g<n;++g){const _=e[g];if(r=Xr(h+" "+l+" "+t+_,s),u!=_){const y=Xr(h+" "+l+" "+t+u+","+_,s);f=f&&y!=r}}return!!f}function c(){let h=!0;const l=Ci.getKeys();for(let u=0,f=l.length;u<f;++u){const g=l[u];Ci.get(g)<100&&(a.apply(this,g.split(`
22
- `))?(Qs(jc),_s=null,Uc=void 0,Ci.set(g,100)):(Ci.set(g,Ci.get(g)+1,!0),h=!1))}h&&(clearInterval(o),o=void 0)}return function(h){const l=Ku(h);if(!l)return;const u=l.families;for(let f=0,g=u.length;f<g;++f){const _=u[f],y=l.style+`
23
- `+l.weight+`
24
- `+_;Ci.get(y)===void 0&&(Ci.set(y,100,!0),a(l.style,l.weight,_)||(Ci.set(y,0,!0),o===void 0&&(o=setInterval(c,32))))}}}(),Zm=function(){let i;return function(t){let e=jc[t];if(e==null){if(dc){const n=Ku(t),s=Ju(t,"Žg");e=(isNaN(Number(n.lineHeight))?1.2:Number(n.lineHeight))*(s.actualBoundingBoxAscent+s.actualBoundingBoxDescent)}else i||(i=document.createElement("div"),i.innerHTML="M",i.style.minHeight="0",i.style.maxHeight="none",i.style.height="auto",i.style.padding="0",i.style.border="none",i.style.position="absolute",i.style.display="block",i.style.left="-99999px"),i.style.font=t,document.body.appendChild(i),e=i.offsetHeight,document.body.removeChild(i);jc[t]=e}return e}}();function Ju(i,t){return _s||(_s=Vt(1,1)),i!=Uc&&(_s.font=i,Uc=_s.font),_s.measureText(t)}function Xr(i,t){return Ju(i,t).width}function td(i,t,e){if(t in e)return e[t];const n=t.split(`
25
- `).reduce((s,o)=>Math.max(s,Xr(i,o)),0);return e[t]=n,n}function Km(i,t){const e=[],n=[],s=[];let o=0,r=0,a=0,c=0;for(let h=0,l=t.length;h<=l;h+=2){const u=t[h];if(u===`
26
- `||h===l){o=Math.max(o,r),s.push(r),r=0,a+=c;continue}const f=t[h+1]||i.font,g=Xr(f,u);e.push(g),r+=g;const _=Zm(f);n.push(_),c=Math.max(c,_)}return{width:o,height:a,widths:e,heights:n,lineWidths:s}}function Qm(i,t,e,n,s,o,r,a,c,h,l){i.save(),e!==1&&(i.globalAlpha*=e),t&&i.setTransform.apply(i,t),n.contextInstructions?(i.translate(c,h),i.scale(l[0],l[1]),Jm(n,i)):l[0]<0||l[1]<0?(i.translate(c,h),i.scale(l[0],l[1]),i.drawImage(n,s,o,r,a,0,0,r,a)):i.drawImage(n,s,o,r,a,c,h,r*l[0],a*l[1]),i.restore()}function Jm(i,t){const e=i.contextInstructions;for(let n=0,s=e.length;n<s;n+=2)Array.isArray(e[n+1])?t[e[n]].apply(t,e[n+1]):t[e[n]]=e[n+1]}class mo extends Wr{constructor(t){const e=t.rotateWithView!==void 0?t.rotateWithView:!1;super({opacity:1,rotateWithView:e,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.canvas_=void 0,this.hitDetectionCanvas_=null,this.fill_=t.fill!==void 0?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius_=t.radius!==void 0?t.radius:t.radius1,this.radius2_=t.radius2,this.angle_=t.angle!==void 0?t.angle:0,this.stroke_=t.stroke!==void 0?t.stroke:null,this.size_=null,this.renderOptions_=null,this.render()}clone(){const t=this.getScale(),e=new mo({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_;if(!t)return null;const e=this.getDisplacement(),n=this.getScaleArray();return[t[0]/2-e[0]/n[0],t[1]/2+e[1]/n[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||this.createHitDetectionCanvas_(this.renderOptions_),this.hitDetectionCanvas_}getImage(t){let e=this.canvas_[t];if(!e){const n=this.renderOptions_,s=Vt(n.size*t,n.size*t);this.draw_(n,s,t),e=s.canvas,this.canvas_[t]=e}return e}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return ot.LOADED}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius_}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,n){if(e===0||this.points_===1/0||t!=="bevel"&&t!=="miter")return e;let s=this.radius_,o=this.radius2_===void 0?s:this.radius2_;if(s<o){const D=s;s=o,o=D}const r=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/r,c=o*Math.sin(a),h=Math.sqrt(o*o-c*c),l=s-h,u=Math.sqrt(c*c+l*l),f=u/c;if(t==="miter"&&f<=n)return f*e;const g=e/2/f,_=e/2*(l/u),w=Math.sqrt((s+g)*(s+g)+_*_)-s;if(this.radius2_===void 0||t==="bevel")return w*2;const E=s*Math.sin(a),b=Math.sqrt(s*s-E*E),P=o-b,M=Math.sqrt(E*E+P*P)/E;if(M<=n){const D=M*e/2-o-s;return 2*Math.max(w,D)}return w*2}createRenderOptions(){let t=ms,e=0,n=null,s=0,o,r=0;this.stroke_&&(o=this.stroke_.getColor(),o===null&&(o=fo),o=ei(o),r=this.stroke_.getWidth(),r===void 0&&(r=po),n=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset(),t=this.stroke_.getLineJoin(),t===void 0&&(t=ms),e=this.stroke_.getMiterLimit(),e===void 0&&(e=uo));const a=this.calculateLineJoinSize_(t,r,e),c=Math.max(this.radius_,this.radius2_||0),h=Math.ceil(2*c+a);return{strokeStyle:o,strokeWidth:r,size:h,lineDash:n,lineDashOffset:s,lineJoin:t,miterLimit:e}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.canvas_={},this.size_=[t,t]}draw_(t,e,n){if(e.scale(n,n),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let s=this.fill_.getColor();s===null&&(s=ge),e.fillStyle=ei(s),e.fill()}this.stroke_&&(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())}createHitDetectionCanvas_(t){if(this.fill_){let e=this.fill_.getColor(),n=0;if(typeof e=="string"&&(e=qr(e)),e===null?n=1:Array.isArray(e)&&(n=e.length===4?e[3]:1),n===0){const s=Vt(t.size,t.size);this.hitDetectionCanvas_=s.canvas,this.drawHitDetectionCanvas_(t,s)}}this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.getImage(1))}createPath_(t){let e=this.points_;const n=this.radius_;if(e===1/0)t.arc(0,0,n,0,2*Math.PI);else{const s=this.radius2_===void 0?n:this.radius2_;this.radius2_!==void 0&&(e*=2);const o=this.angle_-Math.PI/2,r=2*Math.PI/e;for(let a=0;a<e;a++){const c=o+a*r,h=a%2===0?n:s;t.lineTo(h*Math.cos(c),h*Math.sin(c))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=ge,e.fill(),this.stroke_&&(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())}}class ii extends mo{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 ii({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 Xt{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=ed,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 Xt({geometry:t,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer(),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_=ed,this.geometry_=t}setZIndex(t){this.zIndex_=t}}function t0(i){let t;if(typeof i=="function")t=i;else{let e;Array.isArray(i)?e=i:(pt(typeof i.getZIndex=="function",41),e=[i]),t=function(){return e}}return t}let kc=null;function e0(i,t){if(!kc){const e=new de({color:"rgba(255,255,255,0.4)"}),n=new Se({color:"#3399CC",width:1.25});kc=[new Xt({image:new ii({fill:e,stroke:n,radius:5}),fill:e,stroke:n})]}return kc}function ed(i){return i.getGeometry()}const i0="#333";class _o{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.scale_=t.scale,this.scaleArray_=fe(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 de({color:i0}),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}clone(){const t=this.getScale();return new _o({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=fe(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 It={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 id extends Ke{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[It.OPACITY]=t.opacity!==void 0?t.opacity:1,pt(typeof e[It.OPACITY]=="number",64),e[It.VISIBLE]=t.visible!==void 0?t.visible:!0,e[It.Z_INDEX]=t.zIndex,e[It.MAX_RESOLUTION]=t.maxResolution!==void 0?t.maxResolution:1/0,e[It.MIN_RESOLUTION]=t.minResolution!==void 0?t.minResolution:0,e[It.MIN_ZOOM]=t.minZoom!==void 0?t.minZoom:-1/0,e[It.MAX_ZOOM]=t.maxZoom!==void 0?t.maxZoom:1/0,this.className_=e.className!==void 0?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:t===void 0?!0:t},n=this.getZIndex();return e.opacity=qt(Math.round(this.getOpacity()*100)/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=n===void 0&&!e.managed?1/0:n,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return vt()}getLayerStatesArray(t){return vt()}getExtent(){return this.get(It.EXTENT)}getMaxResolution(){return this.get(It.MAX_RESOLUTION)}getMinResolution(){return this.get(It.MIN_RESOLUTION)}getMinZoom(){return this.get(It.MIN_ZOOM)}getMaxZoom(){return this.get(It.MAX_ZOOM)}getOpacity(){return this.get(It.OPACITY)}getSourceState(){return vt()}getVisible(){return this.get(It.VISIBLE)}getZIndex(){return this.get(It.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(It.EXTENT,t)}setMaxResolution(t){this.set(It.MAX_RESOLUTION,t)}setMinResolution(t){this.set(It.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(It.MAX_ZOOM,t)}setMinZoom(t){this.set(It.MIN_ZOOM,t)}setOpacity(t){pt(typeof t=="number",64),this.set(It.OPACITY,t)}setVisible(t){this.set(It.VISIBLE,t)}setZIndex(t){this.set(It.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}const Bt={ANIMATING:0,INTERACTING:1},Ve={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"},n0=42,Wc=256;function nd(i,t,e){return function(n,s,o,r,a){if(!n)return;if(!s&&!t)return n;const c=t?0:o[0]*s,h=t?0:o[1]*s,l=a?a[0]:0,u=a?a[1]:0;let f=i[0]+c/2+l,g=i[2]-c/2+l,_=i[1]+h/2+u,y=i[3]-h/2+u;f>g&&(f=(g+f)/2,g=f),_>y&&(_=(y+_)/2,y=_);let w=qt(n[0],f,g),E=qt(n[1],_,y);if(r&&e&&s){const b=30*s;w+=-b*Math.log(1+Math.max(0,f-n[0])/b)+b*Math.log(1+Math.max(0,n[0]-g)/b),E+=-b*Math.log(1+Math.max(0,_-n[1])/b)+b*Math.log(1+Math.max(0,n[1]-y)/b)}return[w,E]}}function s0(i){return i}function qc(i,t,e,n){const s=yt(t)/e[0],o=Ht(t)/e[1];return n?Math.min(i,Math.max(s,o)):Math.min(i,Math.min(s,o))}function Gc(i,t,e){let n=Math.min(i,t);const s=50;return n*=Math.log(1+s*Math.max(0,i/t-1))/s+1,e&&(n=Math.max(n,e),n/=Math.log(1+s*Math.max(0,e/i-1))/s+1),qt(n,e/2,t*2)}function o0(i,t,e,n){return t=t!==void 0?t:!0,function(s,o,r,a){if(s!==void 0){const c=i[0],h=i[i.length-1],l=e?qc(c,e,r,n):c;if(a)return t?Gc(s,l,h):qt(s,h,l);const u=Math.min(l,s),f=Math.floor(Sr(i,u,o));return i[f]>l&&f<i.length-1?i[f+1]:i[f]}}}function r0(i,t,e,n,s,o){return n=n!==void 0?n:!0,e=e!==void 0?e:0,function(r,a,c,h){if(r!==void 0){const l=s?qc(t,s,c,o):t;if(h)return n?Gc(r,l,e):qt(r,e,l);const u=1e-9,f=Math.ceil(Math.log(t/l)/Math.log(i)-u),g=-a*(.5-u)+.5,_=Math.min(l,r),y=Math.floor(Math.log(t/_)/Math.log(i)+g),w=Math.max(f,y),E=t/Math.pow(i,w);return qt(E,e,l)}}}function sd(i,t,e,n,s){return e=e!==void 0?e:!0,function(o,r,a,c){if(o!==void 0){const h=n?qc(i,n,a,s):i;return!e||!c?qt(o,t,h):Gc(o,h,t)}}}function Vc(i){if(i!==void 0)return 0}function od(i){if(i!==void 0)return i}function a0(i){const t=2*Math.PI/i;return function(e,n){if(n)return e;if(e!==void 0)return e=Math.floor(e/t+.5)*t,e}}function c0(i){return i=i||Fr(5),function(t,e){if(e)return t;if(t!==void 0)return Math.abs(t)<=i?0:t}}const Bc=0;class ni extends Ke{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Oc(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&&mu(),t.center&&(t.center=mi(t.center,this.projection_)),t.extent&&(t.extent=_i(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const a in Ve)delete e[a];this.setProperties(e,!0);const n=l0(t);this.maxResolution_=n.maxResolution,this.minResolution_=n.minResolution,this.zoomFactor_=n.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=n.minZoom;const s=h0(t),o=n.constraint,r=u0(t);this.constraints_={center:s,resolution:o,rotation:r},this.setRotation(t.rotation!==void 0?t.rotation:0),this.setCenterInternal(t.center!==void 0?t.center:null),t.resolution!==void 0?this.setResolution(t.resolution):t.zoom!==void 0&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const n=this.getCenterInternal();if(n){const s=t||[0,0,0,0];e=e||[0,0,0,0];const o=this.getResolution(),r=o/2*(s[3]-e[3]+e[1]-s[1]),a=o/2*(s[0]-e[0]+e[2]-s[2]);this.setCenterInternal([n[0]+r,n[1]-a])}}getUpdatedOptions_(t){const e=this.getProperties();return e.resolution!==void 0?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let n=0;n<e.length;++n){let s=arguments[n];s.center&&(s=Object.assign({},s),s.center=mi(s.center,this.getProjection())),s.anchor&&(s=Object.assign({},s),s.anchor=mi(s.anchor,this.getProjection())),e[n]=s}this.animateInternal.apply(this,e)}animateInternal(t){let e=arguments.length,n;e>1&&typeof arguments[e-1]=="function"&&(n=arguments[e-1],--e);let s=0;for(;s<e&&!this.isDef();++s){const l=arguments[s];l.center&&this.setCenterInternal(l.center),l.zoom!==void 0?this.setZoom(l.zoom):l.resolution&&this.setResolution(l.resolution),l.rotation!==void 0&&this.setRotation(l.rotation)}if(s===e){n&&$r(n,!0);return}let o=Date.now(),r=this.targetCenter_.slice(),a=this.targetResolution_,c=this.targetRotation_;const h=[];for(;s<e;++s){const l=arguments[s],u={start:o,complete:!1,anchor:l.anchor,duration:l.duration!==void 0?l.duration:1e3,easing:l.easing||Ap,callback:n};if(l.center&&(u.sourceCenter=r,u.targetCenter=l.center.slice(),r=u.targetCenter),l.zoom!==void 0?(u.sourceResolution=a,u.targetResolution=this.getResolutionForZoom(l.zoom),a=u.targetResolution):l.resolution&&(u.sourceResolution=a,u.targetResolution=l.resolution,a=u.targetResolution),l.rotation!==void 0){u.sourceRotation=c;const f=$i(l.rotation-c+Math.PI,2*Math.PI)-Math.PI;u.targetRotation=c+f,c=u.targetRotation}d0(u)?u.complete=!0:o+=u.duration,h.push(u)}this.animations_.push(h),this.setHint(Bt.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[Bt.ANIMATING]>0}getInteracting(){return this.hints_[Bt.INTERACTING]>0}cancelAnimations(){this.setHint(Bt.ANIMATING,-this.hints_[Bt.ANIMATING]);let t;for(let e=0,n=this.animations_.length;e<n;++e){const s=this.animations_[e];if(s[0].callback&&$r(s[0].callback,!1),!t)for(let o=0,r=s.length;o<r;++o){const a=s[o];if(!a.complete){t=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let n=this.animations_.length-1;n>=0;--n){const s=this.animations_[n];let o=!0;for(let r=0,a=s.length;r<a;++r){const c=s[r];if(c.complete)continue;const h=t-c.start;let l=c.duration>0?h/c.duration:1;l>=1?(c.complete=!0,l=1):o=!1;const u=c.easing(l);if(c.sourceCenter){const f=c.sourceCenter[0],g=c.sourceCenter[1],_=c.targetCenter[0],y=c.targetCenter[1];this.nextCenter_=c.targetCenter;const w=f+u*(_-f),E=g+u*(y-g);this.targetCenter_=[w,E]}if(c.sourceResolution&&c.targetResolution){const f=u===1?c.targetResolution:c.sourceResolution+u*(c.targetResolution-c.sourceResolution);if(c.anchor){const g=this.getViewportSize_(this.getRotation()),_=this.constraints_.resolution(f,0,g,!0);this.targetCenter_=this.calculateCenterZoom(_,c.anchor)}this.nextResolution_=c.targetResolution,this.targetResolution_=f,this.applyTargetState_(!0)}if(c.sourceRotation!==void 0&&c.targetRotation!==void 0){const f=u===1?$i(c.targetRotation+Math.PI,2*Math.PI)-Math.PI:c.sourceRotation+u*(c.targetRotation-c.sourceRotation);if(c.anchor){const g=this.constraints_.rotation(f,!0);this.targetCenter_=this.calculateCenterRotate(g,c.anchor)}this.nextRotation_=c.targetRotation,this.targetRotation_=f}if(this.applyTargetState_(!0),e=!0,!c.complete)break}if(o){this.animations_[n]=null,this.setHint(Bt.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const r=s[0].callback;r&&$r(r,!0)}}this.animations_=this.animations_.filter(Boolean),e&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let n;const s=this.getCenterInternal();return s!==void 0&&(n=[s[0]-e[0],s[1]-e[1]],bc(n,t-this.getRotation()),_m(n,e)),n}calculateCenterZoom(t,e){let n;const s=this.getCenterInternal(),o=this.getResolution();if(s!==void 0&&o!==void 0){const r=e[0]-t*(e[0]-s[0])/o,a=e[1]-t*(e[1]-s[1])/o;n=[r,a]}return n}getViewportSize_(t){const e=this.viewportSize_;if(t){const n=e[0],s=e[1];return[Math.abs(n*Math.cos(t))+Math.abs(s*Math.sin(t)),Math.abs(n*Math.sin(t))+Math.abs(s*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t&&Tc(t,this.getProjection())}getCenterInternal(){return this.get(Ve.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 xu(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();pt(e,1);const n=this.getResolution();pt(n!==void 0,2);const s=this.getRotation();return pt(s!==void 0,3),_c(e,n,s,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(Ve.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(_i(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const n=yt(t)/e[0],s=Ht(t)/e[1];return Math.max(n,s)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,s=Math.log(e/n)/Math.log(t);return function(o){return e/Math.pow(t,o*s)}}getRotation(){return this.get(Ve.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),n=this.getConstrainedResolution(this.maxResolution_),s=this.minResolution_,o=Math.log(n/s)/e;return function(r){return Math.log(n/r)/e/o}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const n=this.padding_;return n&&(e=[e[0]-n[1]-n[3],e[1]-n[0]-n[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),n=this.getRotation();let s=this.getCenterInternal();const o=this.padding_;if(o){const r=this.getViewportSizeMinusPadding_();s=Yc(s,this.getViewportSize_(),[r[0]/2+o[3],r[1]/2+o[0]],e,n)}return{center:s.slice(0),projection:t!==void 0?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return e!==void 0&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e=this.minZoom_||0,n,s;if(this.resolutions_){const o=Sr(this.resolutions_,t,1);e=o,n=this.resolutions_[o],o==this.resolutions_.length-1?s=2:s=n/this.resolutions_[o+1]}else n=this.maxResolution_,s=this.zoomFactor_;return e+Math.log(n/t)/Math.log(s)}getResolutionForZoom(t){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;const e=qt(Math.floor(t),0,this.resolutions_.length-2),n=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(n,qt(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let n;if(pt(Array.isArray(t)||typeof t.getSimplifiedGeometry=="function",24),Array.isArray(t)){pt(!Xi(t),25);const s=_i(t,this.getProjection());n=Fc(s)}else if(t.getType()==="Circle"){const s=_i(t.getExtent(),this.getProjection());n=Fc(s),n.rotate(this.getRotation(),Hi(s))}else n=t;this.fitInternal(n,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),n=Math.cos(e),s=Math.sin(-e),o=t.getFlatCoordinates(),r=t.getStride();let a=1/0,c=1/0,h=-1/0,l=-1/0;for(let u=0,f=o.length;u<f;u+=r){const g=o[u]*n-o[u+1]*s,_=o[u]*s+o[u+1]*n;a=Math.min(a,g),c=Math.min(c,_),h=Math.max(h,g),l=Math.max(l,_)}return[a,c,h,l]}fitInternal(t,e){e=e||{};let n=e.size;n||(n=this.getViewportSizeMinusPadding_());const s=e.padding!==void 0?e.padding:[0,0,0,0],o=e.nearest!==void 0?e.nearest:!1;let r;e.minResolution!==void 0?r=e.minResolution:e.maxZoom!==void 0?r=this.getResolutionForZoom(e.maxZoom):r=0;const a=this.rotatedExtentForGeometry(t);let c=this.getResolutionForExtentInternal(a,[n[0]-s[1]-s[3],n[1]-s[0]-s[2]]);c=isNaN(c)?r:Math.max(c,r),c=this.getConstrainedResolution(c,o?0:1);const h=this.getRotation(),l=Math.sin(h),u=Math.cos(h),f=Hi(a);f[0]+=(s[1]-s[3])/2*c,f[1]+=(s[0]-s[2])/2*c;const g=f[0]*u-f[1]*l,_=f[1]*u+f[0]*l,y=this.getConstrainedCenter([g,_],c),w=e.callback?e.callback:hs;e.duration!==void 0?this.animateInternal({resolution:c,center:y,duration:e.duration,easing:e.easing},w):(this.targetResolution_=c,this.targetCenter_=y,this.applyTargetState_(!1,!0),$r(w,!0))}centerOn(t,e,n){this.centerOnInternal(mi(t,this.getProjection()),e,n)}centerOnInternal(t,e,n){this.setCenterInternal(Yc(t,e,n,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,n,s){let o;const r=this.padding_;if(r&&t){const a=this.getViewportSizeMinusPadding_(-n),c=Yc(t,s,[a[0]/2+r[3],a[1]/2+r[0]],e,n);o=[t[0]-c[0],t[1]-c[1]]}return o}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(t){const e=Tc(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&&mi(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const n=this.getAnimating()||this.getInteracting(),s=this.getViewportSize_(this.getRotation()),o=this.constraints_.resolution(this.targetResolution_*t,0,s,n);e&&(this.targetCenter_=this.calculateCenterZoom(o,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=mi(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const n=this.getAnimating()||this.getInteracting(),s=this.constraints_.rotation(this.targetRotation_+t,n);e&&(this.targetCenter_=this.calculateCenterRotate(s,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t&&mi(t,this.getProjection()))}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const n=this.getAnimating()||this.getInteracting()||e,s=this.constraints_.rotation(this.targetRotation_,n),o=this.getViewportSize_(s),r=this.constraints_.resolution(this.targetResolution_,0,o,n),a=this.constraints_.center(this.targetCenter_,r,o,n,this.calculateCenterShift(this.targetCenter_,r,s,o));this.get(Ve.ROTATION)!==s&&this.set(Ve.ROTATION,s),this.get(Ve.RESOLUTION)!==r&&(this.set(Ve.RESOLUTION,r),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Ve.CENTER)||!Nr(this.get(Ve.CENTER),a))&&this.set(Ve.CENTER,a),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,n){t=t!==void 0?t:200;const s=e||0,o=this.constraints_.rotation(this.targetRotation_),r=this.getViewportSize_(o),a=this.constraints_.resolution(this.targetResolution_,s,r),c=this.constraints_.center(this.targetCenter_,a,r,!1,this.calculateCenterShift(this.targetCenter_,a,o,r));if(t===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=o,this.targetCenter_=c,this.applyTargetState_();return}n=n||(t===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==o||!this.getCenterInternal()||!Nr(this.getCenterInternal(),c))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:o,center:c,resolution:a,duration:t,easing:Pn,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Bt.INTERACTING,1)}endInteraction(t,e,n){n=n&&mi(n,this.getProjection()),this.endInteractionInternal(t,e,n)}endInteractionInternal(t,e,n){this.getInteracting()&&(this.setHint(Bt.INTERACTING,-1),this.resolveConstraints(t,e,n))}getConstrainedCenter(t,e){const n=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,e||this.getResolution(),n)}getConstrainedZoom(t,e){const n=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(n,e))}getConstrainedResolution(t,e){e=e||0;const n=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,n)}}function $r(i,t){setTimeout(function(){i(t)},0)}function h0(i){if(i.extent!==void 0){const e=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return nd(i.extent,i.constrainOnlyCenter,e)}const t=Oc(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&t.isGlobal()){const e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,nd(e,!1,!1)}return s0}function l0(i){let t,e,n,r=i.minZoom!==void 0?i.minZoom:Bc,a=i.maxZoom!==void 0?i.maxZoom:28;const c=i.zoomFactor!==void 0?i.zoomFactor:2,h=i.multiWorld!==void 0?i.multiWorld:!1,l=i.smoothResolutionConstraint!==void 0?i.smoothResolutionConstraint:!0,u=i.showFullExtent!==void 0?i.showFullExtent:!1,f=Oc(i.projection,"EPSG:3857"),g=f.getExtent();let _=i.constrainOnlyCenter,y=i.extent;if(!h&&!y&&f.isGlobal()&&(_=!1,y=g),i.resolutions!==void 0){const w=i.resolutions;e=w[r],n=w[a]!==void 0?w[a]:w[w.length-1],i.constrainResolution?t=o0(w,l,!_&&y,u):t=sd(e,n,l,!_&&y,u)}else{const E=(g?Math.max(yt(g),Ht(g)):360*wc.degrees/f.getMetersPerUnit())/Wc/Math.pow(2,Bc),b=E/Math.pow(2,28-Bc);e=i.maxResolution,e!==void 0?r=0:e=E/Math.pow(c,r),n=i.minResolution,n===void 0&&(i.maxZoom!==void 0?i.maxResolution!==void 0?n=e/Math.pow(c,a):n=E/Math.pow(c,a):n=b),a=r+Math.floor(Math.log(e/n)/Math.log(c)),n=e/Math.pow(c,a-r),i.constrainResolution?t=r0(c,e,n,l,!_&&y,u):t=sd(e,n,l,!_&&y,u)}return{constraint:t,maxResolution:e,minResolution:n,minZoom:r,zoomFactor:c}}function u0(i){if(i.enableRotation!==void 0?i.enableRotation:!0){const e=i.constrainRotation;return e===void 0||e===!0?c0():e===!1?od:typeof e=="number"?a0(e):od}return Vc}function d0(i){return!(i.sourceCenter&&i.targetCenter&&!Nr(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function Yc(i,t,e,n,s){const o=Math.cos(-s);let r=Math.sin(-s),a=i[0]*o-i[1]*r,c=i[1]*o+i[0]*r;a+=(t[0]/2-e[0])*n,c+=(e[1]-t[1]/2)*n,r=-r;const h=a*o-c*r,l=c*o+a*r;return[h,l]}class yo extends id{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(It.SOURCE,this.handleSourcePropertyChange_);const n=t.source?t.source:null;this.setSource(n)}getLayersArray(t){return t=t||[],t.push(this),t}getLayerStatesArray(t){return t=t||[],t.push(this.getLayerState()),t}getSource(){return this.get(It.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_&&(Mt(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=Ct(t,ht.CHANGE,this.handleSourceChange_,this),t.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return!this.renderer_||!this.rendered?null:this.renderer_.getData(t)}isVisible(t){let e;const n=this.getMapInternal();!t&&n&&(t=n.getView()),t instanceof ni?e={viewState:t.getState(),extent:t.calculateExtent()}:e=t,!e.layerStatesArray&&n&&(e.layerStatesArray=n.getLayerGroup().getLayerStatesArray());let s;e.layerStatesArray?s=e.layerStatesArray.find(r=>r.layer===this):s=this.getLayerState();const o=this.getExtent();return Hc(s,e.viewState)&&(!o||te(o,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];let e;const n=this.getSource();if(n&&(e=n.getAttributions()),!e)return[];const s=t instanceof ni?t.getViewStateAndExtent():t;let o=e(s);return Array.isArray(o)||(o=[o]),o}render(t,e){const n=this.getRenderer();return n.prepareFrame(t)?(this.rendered=!0,n.renderFrame(t,e)):null}unrender(){this.rendered=!1}setMapInternal(t){t||this.unrender(),this.set(It.MAP,t)}getMapInternal(){return this.get(It.MAP)}setMap(t){this.mapPrecomposeKey_&&(Mt(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(Mt(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=Ct(t,ti.PRECOMPOSE,function(e){const s=e.frameState.layerStatesArray,o=this.getLayerState(!1);pt(!s.some(function(r){return r.layer===o.layer}),67),s.push(o)},this),this.mapRenderKey_=Ct(this,ht.CHANGE,t.render,t),this.changed())}setSource(t){this.set(It.SOURCE,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}disposeInternal(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),super.disposeInternal()}}function Hc(i,t){if(!i.visible)return!1;const e=t.resolution;if(e<i.minResolution||e>=i.maxResolution)return!1;const n=t.zoom;return n>i.minZoom&&n<=i.maxZoom}function f0(i,t,e,n,s){rd(i,t,e||0,n||i.length-1,s||g0)}function rd(i,t,e,n,s){for(;n>e;){if(n-e>600){var o=n-e+1,r=t-e+1,a=Math.log(o),c=.5*Math.exp(2*a/3),h=.5*Math.sqrt(a*c*(o-c)/o)*(r-o/2<0?-1:1),l=Math.max(e,Math.floor(t-r*c/o+h)),u=Math.min(n,Math.floor(t+(o-r)*c/o+h));rd(i,t,l,u,s)}var f=i[t],g=e,_=n;for(wo(i,e,t),s(i[n],f)>0&&wo(i,e,n);g<_;){for(wo(i,g,_),g++,_--;s(i[g],f)<0;)g++;for(;s(i[_],f)>0;)_--}s(i[e],f)===0?wo(i,e,_):(_++,wo(i,_,n)),_<=t&&(e=_+1),t<=_&&(n=_-1)}}function wo(i,t,e){var n=i[t];i[t]=i[e],i[e]=n}function g0(i,t){return i<t?-1:i>t?1:0}let Xc=class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const n=[];if(!Kr(t,e))return n;const s=this.toBBox,o=[];for(;e;){for(let r=0;r<e.children.length;r++){const a=e.children[r],c=e.leaf?s(a):a;Kr(t,c)&&(e.leaf?n.push(a):Zc(t,c)?this._all(a,n):o.push(a))}e=o.pop()}return n}collides(t){let e=this.data;if(!Kr(t,e))return!1;const n=[];for(;e;){for(let s=0;s<e.children.length;s++){const o=e.children[s],r=e.leaf?this.toBBox(o):o;if(Kr(t,r)){if(e.leaf||Zc(t,r))return!0;n.push(o)}}e=n.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let n=0;n<t.length;n++)this.insert(t[n]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=e;else if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const n=this.data;this.data=e,e=n}this._insert(e,this.data.height-e.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=ws([]),this}remove(t,e){if(!t)return this;let n=this.data;const s=this.toBBox(t),o=[],r=[];let a,c,h;for(;n||o.length;){if(n||(n=o.pop(),c=o[o.length-1],a=r.pop(),h=!0),n.leaf){const l=p0(t,n.children,e);if(l!==-1)return n.children.splice(l,1),o.push(n),this._condense(o),this}!h&&!n.leaf&&Zc(n,s)?(o.push(n),r.push(a),a=0,c=n,n=n.children[0]):c?(a++,n=c.children[a],h=!1):n=null}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const n=[];for(;t;)t.leaf?e.push(...t.children):n.push(...t.children),t=n.pop();return e}_build(t,e,n,s){const o=n-e+1;let r=this._maxEntries,a;if(o<=r)return a=ws(t.slice(e,n+1)),ys(a,this.toBBox),a;s||(s=Math.ceil(Math.log(o)/Math.log(r)),r=Math.ceil(o/Math.pow(r,s-1))),a=ws([]),a.leaf=!1,a.height=s;const c=Math.ceil(o/r),h=c*Math.ceil(Math.sqrt(r));ad(t,e,n,h,this.compareMinX);for(let l=e;l<=n;l+=h){const u=Math.min(l+h-1,n);ad(t,l,u,c,this.compareMinY);for(let f=l;f<=u;f+=c){const g=Math.min(f+c-1,u);a.children.push(this._build(t,f,g,s-1))}}return ys(a,this.toBBox),a}_chooseSubtree(t,e,n,s){for(;s.push(e),!(e.leaf||s.length-1===n);){let o=1/0,r=1/0,a;for(let c=0;c<e.children.length;c++){const h=e.children[c],l=$c(h),u=y0(t,h)-l;u<r?(r=u,o=l<o?l:o,a=h):u===r&&l<o&&(o=l,a=h)}e=a||e.children[0]}return e}_insert(t,e,n){const s=n?t:this.toBBox(t),o=[],r=this._chooseSubtree(s,this.data,e,o);for(r.children.push(t),Eo(r,s);e>=0&&o[e].children.length>this._maxEntries;)this._split(o,e),e--;this._adjustParentBBoxes(s,o,e)}_split(t,e){const n=t[e],s=n.children.length,o=this._minEntries;this._chooseSplitAxis(n,o,s);const r=this._chooseSplitIndex(n,o,s),a=ws(n.children.splice(r,n.children.length-r));a.height=n.height,a.leaf=n.leaf,ys(n,this.toBBox),ys(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(n,a)}_splitRoot(t,e){this.data=ws([t,e]),this.data.height=t.height+1,this.data.leaf=!1,ys(this.data,this.toBBox)}_chooseSplitIndex(t,e,n){let s,o=1/0,r=1/0;for(let a=e;a<=n-e;a++){const c=vo(t,0,a,this.toBBox),h=vo(t,a,n,this.toBBox),l=w0(c,h),u=$c(c)+$c(h);l<o?(o=l,s=a,r=u<r?u:r):l===o&&u<r&&(r=u,s=a)}return s||n-e}_chooseSplitAxis(t,e,n){const s=t.leaf?this.compareMinX:m0,o=t.leaf?this.compareMinY:_0,r=this._allDistMargin(t,e,n,s),a=this._allDistMargin(t,e,n,o);r<a&&t.children.sort(s)}_allDistMargin(t,e,n,s){t.children.sort(s);const o=this.toBBox,r=vo(t,0,e,o),a=vo(t,n-e,n,o);let c=Zr(r)+Zr(a);for(let h=e;h<n-e;h++){const l=t.children[h];Eo(r,t.leaf?o(l):l),c+=Zr(r)}for(let h=n-e-1;h>=e;h--){const l=t.children[h];Eo(a,t.leaf?o(l):l),c+=Zr(a)}return c}_adjustParentBBoxes(t,e,n){for(let s=n;s>=0;s--)Eo(e[s],t)}_condense(t){for(let e=t.length-1,n;e>=0;e--)t[e].children.length===0?e>0?(n=t[e-1].children,n.splice(n.indexOf(t[e]),1)):this.clear():ys(t[e],this.toBBox)}};function p0(i,t,e){if(!e)return t.indexOf(i);for(let n=0;n<t.length;n++)if(e(i,t[n]))return n;return-1}function ys(i,t){vo(i,0,i.children.length,t,i)}function vo(i,t,e,n,s){s||(s=ws(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let o=t;o<e;o++){const r=i.children[o];Eo(s,i.leaf?n(r):r)}return s}function Eo(i,t){return i.minX=Math.min(i.minX,t.minX),i.minY=Math.min(i.minY,t.minY),i.maxX=Math.max(i.maxX,t.maxX),i.maxY=Math.max(i.maxY,t.maxY),i}function m0(i,t){return i.minX-t.minX}function _0(i,t){return i.minY-t.minY}function $c(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function Zr(i){return i.maxX-i.minX+(i.maxY-i.minY)}function y0(i,t){return(Math.max(t.maxX,i.maxX)-Math.min(t.minX,i.minX))*(Math.max(t.maxY,i.maxY)-Math.min(t.minY,i.minY))}function w0(i,t){const e=Math.max(i.minX,t.minX),n=Math.max(i.minY,t.minY),s=Math.min(i.maxX,t.maxX),o=Math.min(i.maxY,t.maxY);return Math.max(0,s-e)*Math.max(0,o-n)}function Zc(i,t){return i.minX<=t.minX&&i.minY<=t.minY&&t.maxX<=i.maxX&&t.maxY<=i.maxY}function Kr(i,t){return t.minX<=i.maxX&&t.minY<=i.maxY&&t.maxX>=i.minX&&t.maxY>=i.minY}function ws(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function ad(i,t,e,n,s){const o=[t,e];for(;o.length;){if(e=o.pop(),t=o.pop(),e-t<=n)continue;const r=t+Math.ceil((e-t)/n/2)*n;f0(i,r,t,e,s),o.push(t,r,r,e)}}class v0{constructor(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}clear(){this.cache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const n=this.cache_[e];(t++&3)===0&&!n.hasListener()&&(delete this.cache_[e],--this.cacheSize_)}}}get(t,e,n){const s=cd(t,e,n);return s in this.cache_?this.cache_[s]:null}set(t,e,n,s){const o=cd(t,e,n);this.cache_[o]=s,++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function cd(i,t,e){const n=e?Bu(e):"null";return t+":"+i+":"+n}const Qr=new v0;class Kc extends to{constructor(t,e,n,s){super(),this.extent=t,this.pixelRatio_=n,this.resolution=e,this.state=s}changed(){this.dispatchEvent(ht.CHANGE)}getExtent(){return this.extent}getImage(){return vt()}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){vt()}}class E0 extends Kc{constructor(t,e,n,s,o,r,a){super(t,e,n,ot.IDLE),this.src_=s,this.image_=new Image,o!==null&&(this.image_.crossOrigin=o),this.context_=a,this.unlisten_=null,this.state=ot.IDLE,this.imageLoadFunction_=r}getImage(){if(this.state==ot.LOADED&&this.context_&&!(this.image_ instanceof HTMLCanvasElement)){const t=this.context_.canvas;t.width=this.image_.width,t.height=this.image_.height,this.context_.drawImage(this.image_,0,0),this.image_=this.context_.canvas}return this.image_}handleImageError_(){this.state=ot.ERROR,this.unlistenImage_(),this.changed()}handleImageLoad_(){this.resolution===void 0&&(this.resolution=Ht(this.extent)/this.image_.height),this.state=ot.LOADED,this.unlistenImage_(),this.changed()}load(){(this.state==ot.IDLE||this.state==ot.ERROR)&&(this.state=ot.LOADING,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=Qc(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}setImage(t){this.image_=t,this.resolution=Ht(this.extent)/this.image_.height}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function Qc(i,t,e){const n=i;let s=!0,o=!1,r=!1;const a=[Pr(n,ht.LOAD,function(){r=!0,o||t()})];return n.src&&Wp?(o=!0,n.decode().then(function(){s&&t()}).catch(function(c){s&&(r?t():e())})):a.push(Pr(n,ht.ERROR,e)),function(){s=!1,a.forEach(Mt)}}let Co=null;class C0 extends to{constructor(t,e,n,s,o,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=s,this.canvas_={},this.color_=r,this.unlisten_=null,this.imageState_=o,this.size_=n,this.src_=e,this.tainted_}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===ot.LOADED){Co||(Co=Vt(1,1,void 0,{willReadFrequently:!0})),Co.drawImage(this.image_,0,0);try{Co.getImageData(0,0,1,1),this.tainted_=!1}catch{Co=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(ht.CHANGE)}handleImageError_(){this.imageState_=ot.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=ot.LOADED,this.size_?(this.image_.width=this.size_[0],this.image_.height=this.size_[1]):this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],n=Vt(t,e);n.fillRect(0,0,t,e),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===ot.IDLE){this.image_||this.initializeImage_(),this.imageState_=ot.LOADING;try{this.image_.src=this.src_}catch{this.handleImageError_()}this.unlisten_=Qc(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==ot.LOADED)return;const e=this.image_,n=document.createElement("canvas");n.width=Math.ceil(e.width*t),n.height=Math.ceil(e.height*t);const s=n.getContext("2d");s.scale(t,t),s.drawImage(e,0,0),s.globalCompositeOperation="multiply",s.fillStyle=Bu(this.color_),s.fillRect(0,0,n.width/t,n.height/t),s.globalCompositeOperation="destination-in",s.drawImage(e,0,0),this.canvas_[t]=n}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function b0(i,t,e,n,s,o){let r=Qr.get(t,n,o);return r||(r=new C0(i,t,e,n,s,o),Qr.set(t,n,o,r)),r}function hd(i,t,e,n){return e!==void 0&&n!==void 0?[e/i,n/t]:e!==void 0?e/i:n!==void 0?n/t:1}class vs extends Wr{constructor(t){t=t||{};const e=t.opacity!==void 0?t.opacity:1,n=t.rotation!==void 0?t.rotation:0,s=t.scale!==void 0?t.scale:1,o=t.rotateWithView!==void 0?t.rotateWithView:!1;super({opacity:e,rotation:n,scale:s,displacement:t.displacement!==void 0?t.displacement:[0,0],rotateWithView:o,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 r=t.img!==void 0?t.img:null;this.imgSize_=t.imgSize;let a=t.src;pt(!(a!==void 0&&r),4),pt(!r||r&&this.imgSize_,5),(a===void 0||a.length===0)&&r&&(a=r.src||St(r)),pt(a!==void 0&&a.length>0,6),pt(!((t.width!==void 0||t.height!==void 0)&&t.scale!==void 0),69);const c=t.src!==void 0?ot.IDLE:ot.LOADED;if(this.color_=t.color!==void 0?qr(t.color):null,this.iconImage_=b0(r,a,this.imgSize_!==void 0?this.imgSize_:null,this.crossOrigin_,c,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,t.width!==void 0||t.height!==void 0){let h,l;if(t.size)[h,l]=t.size;else{const u=this.getImage(1);if(u instanceof HTMLCanvasElement||u.src&&u.complete)h=u.width,l=u.height;else{this.initialOptions_=t;const f=()=>{if(this.unlistenImageChange(f),!this.initialOptions_)return;const g=this.iconImage_.getSize();this.setScale(hd(g[0],g[1],t.width,t.height))};this.listenImageChange(f);return}}h!==void 0&&this.setScale(hd(h,l,t.width,t.height))}}clone(){let t,e,n;return this.initialOptions_?(e=this.initialOptions_.width,n=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new vs({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,imgSize:this.imgSize_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:n,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const s=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!s)return null;t=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(t[0]*=s[0]),this.anchorYUnits_=="fraction"&&(t[1]*=s[1])}if(this.anchorOrigin_!="top-left"){if(!s)return null;t===this.anchor_&&(t=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(t[0]=-t[0]+s[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(t[1]=-t[1]+s[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),n=this.getScaleArray();return[t[0]-e[0]/n[0],t[1]+e[1]/n[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if(this.offsetOrigin_!="top-left"){const e=this.getSize(),n=this.iconImage_.getSize();if(!e||!n)return null;t=t.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(t[0]=n[0]-e[0]-t[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(t[1]=n[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}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()==ot.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()==ot.LOADED)return this.iconImage_.getSize()[1]*t[1]}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(ht.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(ht.CHANGE,t)}}function ld(i){return new Xt({fill:bo(i,""),stroke:xo(i,""),text:x0(i),image:S0(i)})}function bo(i,t){const e=i[t+"fill-color"];if(e)return e==="none"?null:new de({color:e})}function xo(i,t){const e=i[t+"stroke-width"],n=i[t+"stroke-color"];if(!(!e&&!n))return new Se({width:e,color:n,lineCap:i[t+"stroke-line-cap"],lineJoin:i[t+"stroke-line-join"],lineDash:i[t+"stroke-line-dash"],lineDashOffset:i[t+"stroke-line-dash-offset"],miterLimit:i[t+"stroke-miter-limit"]})}function x0(i){const t=i["text-value"];return t?new _o({text:t,font:i["text-font"],maxAngle:i["text-max-angle"],offsetX:i["text-offset-x"],offsetY:i["text-offset-y"],overflow:i["text-overflow"],placement:i["text-placement"],repeat:i["text-repeat"],scale:i["text-scale"],rotateWithView:i["text-rotate-with-view"],rotation:i["text-rotation"],textAlign:i["text-align"],justify:i["text-justify"],textBaseline:i["text-baseline"],padding:i["text-padding"],fill:bo(i,"text-"),backgroundFill:bo(i,"text-background-"),stroke:xo(i,"text-"),backgroundStroke:xo(i,"text-background-")}):void 0}function S0(i){const t=i["icon-src"],e=i["icon-img"];if(t||e)return new vs({src:t,img:e,imgSize:i["icon-img-size"],anchor:i["icon-anchor"],anchorOrigin:i["icon-anchor-origin"],anchorXUnits:i["icon-anchor-x-units"],anchorYUnits:i["icon-anchor-y-units"],color:i["icon-color"],crossOrigin:i["icon-cross-origin"],offset:i["icon-offset"],displacement:i["icon-displacement"],opacity:i["icon-opacity"],scale:i["icon-scale"],width:i["icon-width"],height:i["icon-height"],rotation:i["icon-rotation"],rotateWithView:i["icon-rotate-with-view"],size:i["icon-size"],declutterMode:i["icon-declutter-mode"]});const n=i["shape-points"];if(n){const o="shape-";return new mo({points:n,fill:bo(i,o),stroke:xo(i,o),radius:i["shape-radius"],radius1:i["shape-radius1"],radius2:i["shape-radius2"],angle:i["shape-angle"],displacement:i["shape-displacement"],rotation:i["shape-rotation"],rotateWithView:i["shape-rotate-with-view"],scale:i["shape-scale"],declutterMode:i["shape-declutter-mode"]})}const s=i["circle-radius"];if(s){const o="circle-";return new ii({radius:s,fill:bo(i,o),stroke:xo(i,o),displacement:i["circle-displacement"],scale:i["circle-scale"],rotation:i["circle-rotation"],rotateWithView:i["circle-rotate-with-view"],declutterMode:i["circle-declutter-mode"]})}}const ud={RENDER_ORDER:"renderOrder"};class dd extends yo{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=t.declutter!==void 0?t.declutter:!1,this.renderBuffer_=t.renderBuffer!==void 0?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=t.updateWhileAnimating!==void 0?t.updateWhileAnimating:!1,this.updateWhileInteracting_=t.updateWhileInteracting!==void 0?t.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(ud.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t){t.declutterTree||(t.declutterTree=new Xc(9)),this.getRenderer().renderDeclutter(t)}setRenderOrder(t){this.set(ud.RENDER_ORDER,t)}setStyle(t){let e;if(t===void 0)e=e0;else if(t===null)e=null;else if(typeof t=="function")e=t;else if(t instanceof Xt)e=t;else if(Array.isArray(t)){const n=t.length,s=new Array(n);for(let o=0;o<n;++o){const r=t[o];r instanceof Xt?s[o]=r:s[o]=ld(r)}e=s}else e=ld(t);this.style_=e,this.styleFunction_=t===null?void 0:t0(this.style_),this.changed()}}const st={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},Jr=[st.FILL],Qi=[st.STROKE],Un=[st.BEGIN_PATH],fd=[st.CLOSE_PATH];class gd{drawCustom(t,e,n,s){}drawGeometry(t){}setStyle(t){}drawCircle(t,e){}drawFeature(t,e){}drawGeometryCollection(t,e){}drawLineString(t,e){}drawMultiLineString(t,e){}drawMultiPoint(t,e){}drawMultiPolygon(t,e){}drawPoint(t,e){}drawPolygon(t,e){}drawText(t,e){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}class So extends gd{constructor(t,e,n,s){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=s,this.maxLineWidth=0,this.resolution=n,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return e==1?t:t.map(function(n){return n*e})}appendFlatPointCoordinates(t,e){const n=this.getBufferedMaxExtent(),s=this.tmpCoordinate_,o=this.coordinates;let r=o.length;for(let a=0,c=t.length;a<c;a+=e)s[0]=t[a],s[1]=t[a+1],so(n,s)&&(o[r++]=s[0],o[r++]=s[1]);return r}appendFlatLineCoordinates(t,e,n,s,o,r){const a=this.coordinates;let c=a.length;const h=this.getBufferedMaxExtent();r&&(e+=s);let l=t[e],u=t[e+1];const f=this.tmpCoordinate_;let g=!0,_,y,w;for(_=e+s;_<n;_+=s)f[0]=t[_],f[1]=t[_+1],w=pc(h,f),w!==y?(g&&(a[c++]=l,a[c++]=u,g=!1),a[c++]=f[0],a[c++]=f[1]):w===Zt.INTERSECTING?(a[c++]=f[0],a[c++]=f[1],g=!1):g=!0,l=f[0],u=f[1],y=w;return(o&&g||_===e+s)&&(a[c++]=l,a[c++]=u),c}drawCustomCoordinates_(t,e,n,s,o){for(let r=0,a=n.length;r<a;++r){const c=n[r],h=this.appendFlatLineCoordinates(t,e,c,s,!1,!1);o.push(h),e=c}return e}drawCustom(t,e,n,s){this.beginGeometry(t,e);const o=t.getType(),r=t.getStride(),a=this.coordinates.length;let c,h,l,u,f;switch(o){case"MultiPolygon":c=t.getOrientedFlatCoordinates(),u=[];const g=t.getEndss();f=0;for(let _=0,y=g.length;_<y;++_){const w=[];f=this.drawCustomCoordinates_(c,f,g[_],r,w),u.push(w)}this.instructions.push([st.CUSTOM,a,u,t,n,Mu]),this.hitDetectionInstructions.push([st.CUSTOM,a,u,t,s||n,Mu]);break;case"Polygon":case"MultiLineString":l=[],c=o=="Polygon"?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),f=this.drawCustomCoordinates_(c,0,t.getEnds(),r,l),this.instructions.push([st.CUSTOM,a,l,t,n,ho]),this.hitDetectionInstructions.push([st.CUSTOM,a,l,t,s||n,ho]);break;case"LineString":case"Circle":c=t.getFlatCoordinates(),h=this.appendFlatLineCoordinates(c,0,c.length,r,!1,!1),this.instructions.push([st.CUSTOM,a,h,t,n,Ki]),this.hitDetectionInstructions.push([st.CUSTOM,a,h,t,s||n,Ki]);break;case"MultiPoint":c=t.getFlatCoordinates(),h=this.appendFlatPointCoordinates(c,r),h>a&&(this.instructions.push([st.CUSTOM,a,h,t,n,Ki]),this.hitDetectionInstructions.push([st.CUSTOM,a,h,t,s||n,Ki]));break;case"Point":c=t.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),h=this.coordinates.length,this.instructions.push([st.CUSTOM,a,h,t,n]),this.hitDetectionInstructions.push([st.CUSTOM,a,h,t,s||n]);break}this.endGeometry(e)}beginGeometry(t,e){this.beginGeometryInstruction1_=[st.BEGIN_GEOMETRY,e,0,t],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[st.BEGIN_GEOMETRY,e,0,t],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;t.reverse();let e;const n=t.length;let s,o,r=-1;for(e=0;e<n;++e)s=t[e],o=s[0],o==st.END_GEOMETRY?r=e:o==st.BEGIN_GEOMETRY&&(s[2]=e,Fp(this.hitDetectionInstructions,r,e),r=-1)}setFillStrokeStyle(t,e){const n=this.state;if(t){const s=t.getColor();n.fillStyle=ei(s||ge)}else n.fillStyle=void 0;if(e){const s=e.getColor();n.strokeStyle=ei(s||fo);const o=e.getLineCap();n.lineCap=o!==void 0?o:Yr;const r=e.getLineDash();n.lineDash=r?r.slice():vi;const a=e.getLineDashOffset();n.lineDashOffset=a||Ei;const c=e.getLineJoin();n.lineJoin=c!==void 0?c:ms;const h=e.getWidth();n.lineWidth=h!==void 0?h:po;const l=e.getMiterLimit();n.miterLimit=l!==void 0?l:uo,n.lineWidth>this.maxLineWidth&&(this.maxLineWidth=n.lineWidth,this.bufferedMaxExtent_=null)}else n.strokeStyle=void 0,n.lineCap=void 0,n.lineDash=null,n.lineDashOffset=void 0,n.lineJoin=void 0,n.lineWidth=void 0,n.miterLimit=void 0}createFill(t){const e=t.fillStyle,n=[st.SET_FILL_STYLE,e];return typeof e!="string"&&n.push(!0),n}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[st.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const n=t.fillStyle;(typeof n!="string"||t.currentFillStyle!=n)&&(n!==void 0&&this.instructions.push(e.call(this,t)),t.currentFillStyle=n)}updateStrokeStyle(t,e){const n=t.strokeStyle,s=t.lineCap,o=t.lineDash,r=t.lineDashOffset,a=t.lineJoin,c=t.lineWidth,h=t.miterLimit;(t.currentStrokeStyle!=n||t.currentLineCap!=s||o!=t.currentLineDash&&!Vi(t.currentLineDash,o)||t.currentLineDashOffset!=r||t.currentLineJoin!=a||t.currentLineWidth!=c||t.currentMiterLimit!=h)&&(n!==void 0&&e.call(this,t),t.currentStrokeStyle=n,t.currentLineCap=s,t.currentLineDash=o,t.currentLineDashOffset=r,t.currentLineJoin=a,t.currentLineWidth=c,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=[st.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=ou(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;io(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class R0 extends So{constructor(t,e,n,s){super(t,e,n,s),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e){if(!this.image_)return;this.beginGeometry(t,e);const n=t.getFlatCoordinates(),s=t.getStride(),o=this.coordinates.length,r=this.appendFlatPointCoordinates(n,s);this.instructions.push([st.DRAW_IMAGE,o,r,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([st.DRAW_IMAGE,o,r,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e){if(!this.image_)return;this.beginGeometry(t,e);const n=t.getFlatCoordinates(),s=t.getStride(),o=this.coordinates.length,r=this.appendFlatPointCoordinates(n,s);this.instructions.push([st.DRAW_IMAGE,o,r,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([st.DRAW_IMAGE,o,r,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const n=t.getAnchor(),s=t.getSize(),o=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=n[0],this.anchorY_=n[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=s[1],this.opacity_=t.getOpacity(),this.originX_=o[0],this.originY_=o[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=s[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}class P0 extends So{constructor(t,e,n,s){super(t,e,n,s)}drawFlatCoordinates_(t,e,n,s){const o=this.coordinates.length,r=this.appendFlatLineCoordinates(t,e,n,s,!1,!1),a=[st.MOVE_TO_LINE_TO,o,r];return this.instructions.push(a),this.hitDetectionInstructions.push(a),n}drawLineString(t,e){const n=this.state,s=n.strokeStyle,o=n.lineWidth;if(s===void 0||o===void 0)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([st.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,vi,Ei],Un);const r=t.getFlatCoordinates(),a=t.getStride();this.drawFlatCoordinates_(r,0,r.length,a),this.hitDetectionInstructions.push(Qi),this.endGeometry(e)}drawMultiLineString(t,e){const n=this.state,s=n.strokeStyle,o=n.lineWidth;if(s===void 0||o===void 0)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([st.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,vi,Ei],Un);const r=t.getEnds(),a=t.getFlatCoordinates(),c=t.getStride();let h=0;for(let l=0,u=r.length;l<u;++l)h=this.drawFlatCoordinates_(a,h,r[l],c);this.hitDetectionInstructions.push(Qi),this.endGeometry(e)}finish(){const t=this.state;return t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&this.instructions.push(Qi),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(Qi),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(Un)}}class pd extends So{constructor(t,e,n,s){super(t,e,n,s)}drawFlatCoordinatess_(t,e,n,s){const o=this.state,r=o.fillStyle!==void 0,a=o.strokeStyle!==void 0,c=n.length;this.instructions.push(Un),this.hitDetectionInstructions.push(Un);for(let h=0;h<c;++h){const l=n[h],u=this.coordinates.length,f=this.appendFlatLineCoordinates(t,e,l,s,!0,!a),g=[st.MOVE_TO_LINE_TO,u,f];this.instructions.push(g),this.hitDetectionInstructions.push(g),a&&(this.instructions.push(fd),this.hitDetectionInstructions.push(fd)),e=l}return r&&(this.instructions.push(Jr),this.hitDetectionInstructions.push(Jr)),a&&(this.instructions.push(Qi),this.hitDetectionInstructions.push(Qi)),e}drawCircle(t,e){const n=this.state,s=n.fillStyle,o=n.strokeStyle;if(s===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e),n.fillStyle!==void 0&&this.hitDetectionInstructions.push([st.SET_FILL_STYLE,ge]),n.strokeStyle!==void 0&&this.hitDetectionInstructions.push([st.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,vi,Ei]);const r=t.getFlatCoordinates(),a=t.getStride(),c=this.coordinates.length;this.appendFlatLineCoordinates(r,0,r.length,a,!1,!1);const h=[st.CIRCLE,c];this.instructions.push(Un,h),this.hitDetectionInstructions.push(Un,h),n.fillStyle!==void 0&&(this.instructions.push(Jr),this.hitDetectionInstructions.push(Jr)),n.strokeStyle!==void 0&&(this.instructions.push(Qi),this.hitDetectionInstructions.push(Qi)),this.endGeometry(e)}drawPolygon(t,e){const n=this.state,s=n.fillStyle,o=n.strokeStyle;if(s===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e),n.fillStyle!==void 0&&this.hitDetectionInstructions.push([st.SET_FILL_STYLE,ge]),n.strokeStyle!==void 0&&this.hitDetectionInstructions.push([st.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,vi,Ei]);const r=t.getEnds(),a=t.getOrientedFlatCoordinates(),c=t.getStride();this.drawFlatCoordinatess_(a,0,r,c),this.endGeometry(e)}drawMultiPolygon(t,e){const n=this.state,s=n.fillStyle,o=n.strokeStyle;if(s===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e),n.fillStyle!==void 0&&this.hitDetectionInstructions.push([st.SET_FILL_STYLE,ge]),n.strokeStyle!==void 0&&this.hitDetectionInstructions.push([st.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,vi,Ei]);const r=t.getEndss(),a=t.getOrientedFlatCoordinates(),c=t.getStride();let h=0;for(let l=0,u=r.length;l<u;++l)h=this.drawFlatCoordinatess_(a,h,r[l],c);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const t=this.tolerance;if(t!==0){const e=this.coordinates;for(let n=0,s=e.length;n<s;++n)e[n]=Ln(e[n],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;t.fillStyle!==void 0&&this.updateFillStyle(t,this.createFill),t.strokeStyle!==void 0&&this.updateStrokeStyle(t,this.applyStroke)}}function O0(i,t,e,n,s){const o=[];let r=e,a=0,c=t.slice(e,2);for(;a<i&&r+s<n;){const[h,l]=c.slice(-2),u=t[r+s],f=t[r+s+1],g=Math.sqrt((u-h)*(u-h)+(f-l)*(f-l));if(a+=g,a>=i){const _=(i-a+g)/g,y=xe(h,u,_),w=xe(l,f,_);c.push(y,w),o.push(c),c=[y,w],a==i&&(r+=s),a=0}else if(a<i)c.push(t[r+s],t[r+s+1]),r+=s;else{const _=g-a,y=xe(h,u,_/g),w=xe(l,f,_/g);c.push(y,w),o.push(c),c=[y,w],a=0,r+=s}}return a>0&&o.push(c),o}function I0(i,t,e,n,s){let o=e,r=e,a=0,c=0,h=e,l,u,f,g,_,y,w,E,b,P;for(u=e;u<n;u+=s){const I=t[u],M=t[u+1];_!==void 0&&(b=I-_,P=M-y,g=Math.sqrt(b*b+P*P),w!==void 0&&(c+=f,l=Math.acos((w*b+E*P)/(f*g)),l>i&&(c>a&&(a=c,o=h,r=u),c=0,h=u-s)),f=g,w=b,E=P),_=I,y=M}return c+=g,c>a?[h,u]:[o,r]}const ta={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class T0 extends So{constructor(t,e,n,s){super(t,e,n,s),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[ge]={fillStyle:ge},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e){const n=this.textFillState_,s=this.textStrokeState_,o=this.textState_;if(this.text_===""||!o||!n&&!s)return;const r=this.coordinates;let a=r.length;const c=t.getType();let h=null,l=t.getStride();if(o.placement==="line"&&(c=="LineString"||c=="MultiLineString"||c=="Polygon"||c=="MultiPolygon")){if(!te(this.getBufferedMaxExtent(),t.getExtent()))return;let u;if(h=t.getFlatCoordinates(),c=="LineString")u=[h.length];else if(c=="MultiLineString")u=t.getEnds();else if(c=="Polygon")u=t.getEnds().slice(0,1);else if(c=="MultiPolygon"){const y=t.getEndss();u=[];for(let w=0,E=y.length;w<E;++w)u.push(y[w][0])}this.beginGeometry(t,e);const f=o.repeat,g=f?void 0:o.textAlign;let _=0;for(let y=0,w=u.length;y<w;++y){let E;f?E=O0(f*this.resolution,h,_,u[y],l):E=[h.slice(_,u[y])];for(let b=0,P=E.length;b<P;++b){const I=E[b];let M=0,D=I.length;if(g==null){const z=I0(o.maxAngle,I,0,I.length,2);M=z[0],D=z[1]}for(let z=M;z<D;z+=l)r.push(I[z],I[z+1]);const L=r.length;_=u[y],this.drawChars_(a,L),a=L}}this.endGeometry(e)}else{let u=o.overflow?null:[];switch(c){case"Point":case"MultiPoint":h=t.getFlatCoordinates();break;case"LineString":h=t.getFlatMidpoint();break;case"Circle":h=t.getCenter();break;case"MultiLineString":h=t.getFlatMidpoints(),l=2;break;case"Polygon":h=t.getFlatInteriorPoint(),o.overflow||u.push(h[2]/this.resolution),l=3;break;case"MultiPolygon":const E=t.getFlatInteriorPoints();h=[];for(let b=0,P=E.length;b<P;b+=3)o.overflow||u.push(E[b+2]/this.resolution),h.push(E[b],E[b+1]);if(h.length===0)return;l=2;break}const f=this.appendFlatPointCoordinates(h,l);if(f===a)return;if(u&&(f-a)/2!==h.length/l){let E=a/2;u=u.filter((b,P)=>{const I=r[(E+P)*2]===h[P*l]&&r[(E+P)*2+1]===h[P*l+1];return I||--E,I})}this.saveTextStates_(),(o.backgroundFill||o.backgroundStroke)&&(this.setFillStrokeStyle(o.backgroundFill,o.backgroundStroke),o.backgroundFill&&this.updateFillStyle(this.state,this.createFill),o.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(t,e);let g=o.padding;if(g!=Nn&&(o.scale[0]<0||o.scale[1]<0)){let E=o.padding[0],b=o.padding[1],P=o.padding[2],I=o.padding[3];o.scale[0]<0&&(b=-b,I=-I),o.scale[1]<0&&(E=-E,P=-P),g=[E,b,P,I]}const _=this.pixelRatio;this.instructions.push([st.DRAW_IMAGE,a,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,void 0,this.declutterImageWithText_,g==Nn?Nn:g.map(function(E){return E*_}),!!o.backgroundFill,!!o.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,u]);const y=1/_,w=this.state.fillStyle;o.backgroundFill&&(this.state.fillStyle=ge,this.hitDetectionInstructions.push(this.createFill(this.state))),this.hitDetectionInstructions.push([st.DRAW_IMAGE,a,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[y,y],NaN,void 0,this.declutterImageWithText_,g,!!o.backgroundFill,!!o.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?ge:this.fillKey_,this.textOffsetX_,this.textOffsetY_,u]),o.backgroundFill&&(this.state.fillStyle=w,this.hitDetectionInstructions.push(this.createFill(this.state))),this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,n=this.textFillState_,s=this.strokeKey_;t&&(s in this.strokeStates||(this.strokeStates[s]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const o=this.textKey_;o in this.textStates||(this.textStates[o]={font:e.font,textAlign:e.textAlign||go,justify:e.justify,textBaseline:e.textBaseline||Hr,scale:e.scale});const r=this.fillKey_;n&&(r in this.fillStates||(this.fillStates[r]={fillStyle:n.fillStyle}))}drawChars_(t,e){const n=this.textStrokeState_,s=this.textState_,o=this.strokeKey_,r=this.textKey_,a=this.fillKey_;this.saveTextStates_();const c=this.pixelRatio,h=ta[s.textBaseline],l=this.textOffsetY_*c,u=this.text_,f=n?n.lineWidth*Math.abs(s.scale[0])/2:0;this.instructions.push([st.DRAW_CHARS,t,e,h,s.overflow,a,s.maxAngle,c,l,o,f*c,u,r,1]),this.hitDetectionInstructions.push([st.DRAW_CHARS,t,e,h,s.overflow,a&&ge,s.maxAngle,1,l,o,f,u,r,1/c])}setTextStyle(t,e){let n,s,o;if(!t)this.text_="";else{const r=t.getFill();r?(s=this.textFillState_,s||(s={},this.textFillState_=s),s.fillStyle=ei(r.getColor()||ge)):(s=null,this.textFillState_=s);const a=t.getStroke();if(!a)o=null,this.textStrokeState_=o;else{o=this.textStrokeState_,o||(o={},this.textStrokeState_=o);const _=a.getLineDash(),y=a.getLineDashOffset(),w=a.getWidth(),E=a.getMiterLimit();o.lineCap=a.getLineCap()||Yr,o.lineDash=_?_.slice():vi,o.lineDashOffset=y===void 0?Ei:y,o.lineJoin=a.getLineJoin()||ms,o.lineWidth=w===void 0?po:w,o.miterLimit=E===void 0?uo:E,o.strokeStyle=ei(a.getColor()||fo)}n=this.textState_;const c=t.getFont()||Qu;$m(c);const h=t.getScaleArray();n.overflow=t.getOverflow(),n.font=c,n.maxAngle=t.getMaxAngle(),n.placement=t.getPlacement(),n.textAlign=t.getTextAlign(),n.repeat=t.getRepeat(),n.justify=t.getJustify(),n.textBaseline=t.getTextBaseline()||Hr,n.backgroundFill=t.getBackgroundFill(),n.backgroundStroke=t.getBackgroundStroke(),n.padding=t.getPadding()||Nn,n.scale=h===void 0?[1,1]:h;const l=t.getOffsetX(),u=t.getOffsetY(),f=t.getRotateWithView(),g=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=l===void 0?0:l,this.textOffsetY_=u===void 0?0:u,this.textRotateWithView_=f===void 0?!1:f,this.textRotation_=g===void 0?0:g,this.strokeKey_=o?(typeof o.strokeStyle=="string"?o.strokeStyle:St(o.strokeStyle))+o.lineCap+o.lineDashOffset+"|"+o.lineWidth+o.lineJoin+o.miterLimit+"["+o.lineDash.join()+"]":"",this.textKey_=n.font+n.scale+(n.textAlign||"?")+(n.repeat||"?")+(n.justify||"?")+(n.textBaseline||"?"),this.fillKey_=s?typeof s.fillStyle=="string"?s.fillStyle:"|"+St(s.fillStyle):""}this.declutterImageWithText_=e}}const A0={Circle:pd,Default:So,Image:R0,LineString:P0,Polygon:pd,Text:T0};class md{constructor(t,e,n,s){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=s,this.resolution_=n,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const n=this.buildersByZIndex_[e];for(const s in n){const o=n[s].finish();t[e][s]=o}}return t}getBuilder(t,e){const n=t!==void 0?t.toString():"0";let s=this.buildersByZIndex_[n];s===void 0&&(s={},this.buildersByZIndex_[n]=s);let o=s[e];if(o===void 0){const r=A0[e];o=new r(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),s[e]=o}return o}}class M0 extends eo{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.declutterExecutorGroup=null}getFeatures(t){return vt()}getData(t){return null}prepareFrame(t){return vt()}renderFrame(t,e){return vt()}loadedTileCallback(t,e,n){t[e]||(t[e]={}),t[e][n.tileCoord.toString()]=n}createLoadedTileFinder(t,e,n){return(s,o)=>{const r=this.loadedTileCallback.bind(this,n,s);return t.forEachLoadedTile(e,s,o,r)}}forEachFeatureAtCoordinate(t,e,n,s,o){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;(e.getState()===ot.LOADED||e.getState()===ot.ERROR)&&this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=ot.LOADED&&e!=ot.ERROR&&t.addEventListener(ht.CHANGE,this.boundHandleImageChange_),e==ot.IDLE&&(t.load(),e=t.getState()),e==ot.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&t.getSourceState()==="ready"&&t.changed()}disposeInternal(){delete this.layer_,super.disposeInternal()}}class _d extends We{constructor(t,e,n,s){super(t),this.inversePixelTransform=e,this.frameState=n,this.context=s}}const yd=[];let Es=null;function D0(){Es=Vt(1,1,void 0,{willReadFrequently:!0})}class Jc extends M0{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=be(),this.pixelTransform=be(),this.inversePixelTransform=be(),this.context=null,this.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(t,e,n){Es||D0(),Es.clearRect(0,0,1,1);let s;try{Es.drawImage(t,e,n,1,1,0,0,1,1),s=Es.getImageData(0,0,1,1).data}catch{return Es=null,null}return s}getBackground(t){let n=this.getLayer().getBackground();return typeof n=="function"&&(n=n(t.viewState.resolution)),n||void 0}useContainer(t,e,n){const s=this.getLayer().getClassName();let o,r;if(t&&t.className===s&&(!n||t&&t.style.backgroundColor&&Vi(qr(t.style.backgroundColor),qr(n)))){const a=t.firstElementChild;a instanceof HTMLCanvasElement&&(r=a.getContext("2d"))}if(r&&r.canvas.style.transform===e?(this.container=t,this.context=r,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){o=document.createElement("div"),o.className=s;let a=o.style;a.position="absolute",a.width="100%",a.height="100%",r=Vt();const c=r.canvas;o.appendChild(c),a=c.style,a.position="absolute",a.left="0",a.transformOrigin="top left",this.container=o,this.context=r}!this.containerReused&&n&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=n)}clipUnrotated(t,e,n){const s=Ae(n),o=Mr(n),r=Ar(n),a=Tr(n);Ut(e.coordinateToPixelTransform,s),Ut(e.coordinateToPixelTransform,o),Ut(e.coordinateToPixelTransform,r),Ut(e.coordinateToPixelTransform,a);const c=this.inversePixelTransform;Ut(c,s),Ut(c,o),Ut(c,r),Ut(c,a),t.save(),t.beginPath(),t.moveTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(a[0]),Math.round(a[1])),t.clip()}dispatchRenderEvent_(t,e,n){const s=this.getLayer();if(s.hasListener(t)){const o=new _d(t,this.inversePixelTransform,n,e);s.dispatchEvent(o)}}preRender(t,e){this.frameState=e,this.dispatchRenderEvent_(ti.PRERENDER,t,e)}postRender(t,e){this.dispatchRenderEvent_(ti.POSTRENDER,t,e)}getRenderTransform(t,e,n,s,o,r,a){const c=o/2,h=r/2,l=s/e,u=-l,f=-t[0]+a,g=-t[1];return qe(this.tempTransform,c,h,l,u,-n,f,g)}disposeInternal(){delete this.frameState,super.disposeInternal()}}function F0(i,t,e,n,s,o,r,a,c,h,l,u){let f=i[t],g=i[t+1],_=0,y=0,w=0,E=0;function b(){_=f,y=g,t+=n,f=i[t],g=i[t+1],E+=w,w=Math.sqrt((f-_)*(f-_)+(g-y)*(g-y))}do b();while(t<e-n&&E+w<o);let P=w===0?0:(o-E)/w;const I=xe(_,f,P),M=xe(y,g,P),D=t-n,L=E,z=o+a*c(h,s,l);for(;t<e-n&&E+w<z;)b();P=w===0?0:(z-E)/w;const q=xe(_,f,P),Y=xe(y,g,P);let X;if(u){const A=[I,M,q,Y];Su(A,0,4,2,u,A,A),X=A[0]>A[2]}else X=I>q;const Q=Math.PI,m=[],v=D+n===t;t=D,w=0,E=L,f=i[t],g=i[t+1];let S;if(v){b(),S=Math.atan2(g-y,f-_),X&&(S+=S>0?-Q:Q);const A=(q+I)/2,F=(Y+M)/2;return m[0]=[A,F,(z-o)/2,S,s],m}s=s.replace(/\n/g," ");for(let A=0,F=s.length;A<F;){b();let N=Math.atan2(g-y,f-_);if(X&&(N+=N>0?-Q:Q),S!==void 0){let et=N-S;if(et+=et>Q?-2*Q:et<-Q?2*Q:0,Math.abs(et)>r)return null}S=N;const G=A;let V=0;for(;A<F;++A){const et=X?F-A-1:A,it=a*c(h,s[et],l);if(t+n<e&&E+w<o+V+it/2)break;V+=it}if(A===G)continue;const Z=X?s.substring(F-G,F-A):s.substring(G,A);P=w===0?0:(o+V/2-E)/w;const B=xe(_,f,P),at=xe(y,g,P);m.push([B,at,V/2,N,Z]),o+=V}return m}const Cs=Te(),Ji=[],bi=[],xi=[],tn=[];function wd(i){return i[3].declutterBox}const vd=new RegExp("[֑-ࣿיִ-﷿ﹰ-ﻼࠀ-࿿-]");function th(i,t){return t==="start"?t=vd.test(i)?"right":"left":t==="end"&&(t=vd.test(i)?"left":"right"),ta[t]}function L0(i,t,e){return e>0&&i.push(`
27
- `,""),i.push(t,""),i}class z0{constructor(t,e,n,s){this.overlaps=n,this.pixelRatio=e,this.resolution=t,this.alignFill_,this.instructions=s.instructions,this.coordinates=s.coordinates,this.coordinateCache_={},this.renderedTransform_=be(),this.hitDetectionInstructions=s.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=s.fillStates||{},this.strokeStates=s.strokeStates||{},this.textStates=s.textStates||{},this.widths_={},this.labels_={}}createLabel(t,e,n,s){const o=t+e+n+s;if(this.labels_[o])return this.labels_[o];const r=s?this.strokeStates[s]:null,a=n?this.fillStates[n]:null,c=this.textStates[e],h=this.pixelRatio,l=[c.scale[0]*h,c.scale[1]*h],u=Array.isArray(t),f=c.justify?ta[c.justify]:th(Array.isArray(t)?t[0]:t,c.textAlign||go),g=s&&r.lineWidth?r.lineWidth:0,_=u?t:t.split(`
28
- `).reduce(L0,[]),{width:y,height:w,widths:E,heights:b,lineWidths:P}=Km(c,_),I=y+g,M=[],D=(I+2)*l[0],L=(w+g)*l[1],z={width:D<0?Math.floor(D):Math.ceil(D),height:L<0?Math.floor(L):Math.ceil(L),contextInstructions:M};(l[0]!=1||l[1]!=1)&&M.push("scale",l),s&&(M.push("strokeStyle",r.strokeStyle),M.push("lineWidth",g),M.push("lineCap",r.lineCap),M.push("lineJoin",r.lineJoin),M.push("miterLimit",r.miterLimit),M.push("setLineDash",[r.lineDash]),M.push("lineDashOffset",r.lineDashOffset)),n&&M.push("fillStyle",a.fillStyle),M.push("textBaseline","middle"),M.push("textAlign","center");const q=.5-f;let Y=f*I+q*g;const X=[],Q=[];let m=0,v=0,S=0,A=0,F;for(let N=0,G=_.length;N<G;N+=2){const V=_[N];if(V===`
29
- `){v+=m,m=0,Y=f*I+q*g,++A;continue}const Z=_[N+1]||c.font;Z!==F&&(s&&X.push("font",Z),n&&Q.push("font",Z),F=Z),m=Math.max(m,b[S]);const B=[V,Y+q*E[S]+f*(E[S]-P[A]),.5*(g+m)+v];Y+=E[S],s&&X.push("strokeText",B),n&&Q.push("fillText",B),++S}return Array.prototype.push.apply(M,X),Array.prototype.push.apply(M,Q),this.labels_[o]=z,z}replayTextBackground_(t,e,n,s,o,r,a){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,n),t.lineTo.apply(t,s),t.lineTo.apply(t,o),t.lineTo.apply(t,e),r&&(this.alignFill_=r[2],this.fill_(t)),a&&(this.setStrokeStyle_(t,a),t.stroke())}calculateImageOrLabelDimensions_(t,e,n,s,o,r,a,c,h,l,u,f,g,_,y,w){a*=f[0],c*=f[1];let E=n-a,b=s-c;const P=o+h>t?t-h:o,I=r+l>e?e-l:r,M=_[3]+P*f[0]+_[1],D=_[0]+I*f[1]+_[2],L=E-_[3],z=b-_[0];(y||u!==0)&&(Ji[0]=L,tn[0]=L,Ji[1]=z,bi[1]=z,bi[0]=L+M,xi[0]=bi[0],xi[1]=z+D,tn[1]=xi[1]);let q;return u!==0?(q=qe(be(),n,s,1,1,u,-n,-s),Ut(q,Ji),Ut(q,bi),Ut(q,xi),Ut(q,tn),pi(Math.min(Ji[0],bi[0],xi[0],tn[0]),Math.min(Ji[1],bi[1],xi[1],tn[1]),Math.max(Ji[0],bi[0],xi[0],tn[0]),Math.max(Ji[1],bi[1],xi[1],tn[1]),Cs)):pi(Math.min(L,L+M),Math.min(z,z+D),Math.max(L,L+M),Math.max(z,z+D),Cs),g&&(E=Math.round(E),b=Math.round(b)),{drawImageX:E,drawImageY:b,drawImageW:P,drawImageH:I,originX:h,originY:l,declutterBox:{minX:Cs[0],minY:Cs[1],maxX:Cs[2],maxY:Cs[3],value:w},canvasTransform:q,scale:f}}replayImageOrLabel_(t,e,n,s,o,r,a){const c=!!(r||a),h=s.declutterBox,l=t.canvas,u=a?a[2]*s.scale[0]/2:0;return h.minX-u<=l.width/e&&h.maxX+u>=0&&h.minY-u<=l.height/e&&h.maxY+u>=0&&(c&&this.replayTextBackground_(t,Ji,bi,xi,tn,r,a),Qm(t,s.canvasTransform,o,n,s.originX,s.originY,s.drawImageW,s.drawImageH,s.drawImageX,s.drawImageY,s.scale)),!0}fill_(t){if(this.alignFill_){const e=Ut(this.renderedTransform_,[0,0]),n=512*this.pixelRatio;t.save(),t.translate(e[0]%n,e[1]%n),t.rotate(this.viewRotation_)}t.fill(),this.alignFill_&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6])}drawLabelWithPointPlacement_(t,e,n,s){const o=this.textStates[e],r=this.createLabel(t,e,s,n),a=this.strokeStates[n],c=this.pixelRatio,h=th(Array.isArray(t)?t[0]:t,o.textAlign||go),l=ta[o.textBaseline||Hr],u=a&&a.lineWidth?a.lineWidth:0,f=r.width/c-2*o.scale[0],g=h*f+2*(.5-h)*u,_=l*r.height/c+2*(.5-l)*u;return{label:r,anchorX:g,anchorY:_}}execute_(t,e,n,s,o,r,a,c){let h;this.pixelCoordinates_&&Vi(n,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=yi(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),Bp(this.renderedTransform_,n));let l=0;const u=s.length;let f=0,g,_,y,w,E,b,P,I,M,D,L,z,q=0,Y=0,X=null,Q=null;const m=this.coordinateCache_,v=this.viewRotation_,S=Math.round(Math.atan2(-n[1],n[0])*1e12)/1e12,A={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:v},F=this.instructions!=s||this.overlaps?0:200;let N,G,V,Z;for(;l<u;){const B=s[l];switch(B[0]){case st.BEGIN_GEOMETRY:N=B[1],Z=B[3],N.getGeometry()?a!==void 0&&!te(a,Z.getExtent())?l=B[2]+1:++l:l=B[2];break;case st.BEGIN_PATH:q>F&&(this.fill_(t),q=0),Y>F&&(t.stroke(),Y=0),!q&&!Y&&(t.beginPath(),w=NaN,E=NaN),++l;break;case st.CIRCLE:f=B[1];const et=h[f],it=h[f+1],gt=h[f+2],wt=h[f+3],dt=gt-et,Et=wt-it,ft=Math.sqrt(dt*dt+Et*Et);t.moveTo(et+ft,it),t.arc(et,it,ft,0,2*Math.PI,!0),++l;break;case st.CLOSE_PATH:t.closePath(),++l;break;case st.CUSTOM:f=B[1],g=B[2];const xt=B[3],Ft=B[4],kt=B.length==6?B[5]:void 0;A.geometry=xt,A.feature=N,l in m||(m[l]=[]);const Wt=m[l];kt?kt(h,f,g,2,Wt):(Wt[0]=h[f],Wt[1]=h[f+1],Wt.length=2),Ft(Wt,A),++l;break;case st.DRAW_IMAGE:f=B[1],g=B[2],I=B[3],_=B[4],y=B[5];let he=B[6];const ye=B[7],ns=B[8],we=B[9],En=B[10];let Cn=B[11];const bn=B[12];let ae=B[13];const ve=B[14],Oe=B[15];if(!I&&B.length>=20){M=B[19],D=B[20],L=B[21],z=B[22];const $t=this.drawLabelWithPointPlacement_(M,D,L,z);I=$t.label,B[3]=I;const Zs=B[23];_=($t.anchorX-Zs)*this.pixelRatio,B[4]=_;const je=B[24];y=($t.anchorY-je)*this.pixelRatio,B[5]=y,he=I.height,B[6]=he,ae=I.width,B[13]=ae}let Ne;B.length>25&&(Ne=B[25]);let ki,fi,Rt;B.length>17?(ki=B[16],fi=B[17],Rt=B[18]):(ki=Nn,fi=!1,Rt=!1),En&&S?Cn+=v:!En&&!S&&(Cn-=v);let Ee=0;for(;f<g;f+=2){if(Ne&&Ne[Ee++]<ae/this.pixelRatio)continue;const $t=this.calculateImageOrLabelDimensions_(I.width,I.height,h[f],h[f+1],ae,he,_,y,ns,we,Cn,bn,o,ki,fi||Rt,N),Zs=[t,e,I,$t,ye,fi?X:null,Rt?Q:null];if(c){if(ve==="none")continue;if(ve==="obstacle"){c.insert($t.declutterBox);continue}else{let je,qi;if(Oe){const Ie=g-f;if(!Oe[Ie]){Oe[Ie]=Zs;continue}if(je=Oe[Ie],delete Oe[Ie],qi=wd(je),c.collides(qi))continue}if(c.collides($t.declutterBox))continue;je&&(c.insert(qi),this.replayImageOrLabel_.apply(this,je)),c.insert($t.declutterBox)}}this.replayImageOrLabel_.apply(this,Zs)}++l;break;case st.DRAW_CHARS:const Ze=B[1],At=B[2],Ue=B[3],ac=B[4];z=B[5];const cc=B[6],Er=B[7],Wi=B[8];L=B[9];const Cr=B[10];M=B[11],D=B[12];const hc=[B[13],B[13]],br=this.textStates[D],ss=br.font,os=[br.scale[0]*Er,br.scale[1]*Er];let rs;ss in this.widths_?rs=this.widths_[ss]:(rs={},this.widths_[ss]=rs);const xn=Wu(h,Ze,At,2),Sn=Math.abs(os[0])*td(ss,M,rs);if(ac||Sn<=xn){const $t=this.textStates[D].textAlign,Zs=(xn-Sn)*th(M,$t),je=F0(h,Ze,At,2,M,Zs,cc,Math.abs(os[0]),td,ss,rs,S?0:this.viewRotation_);t:if(je){const qi=[];let Ie,lc,uc,Ce,ke;if(L)for(Ie=0,lc=je.length;Ie<lc;++Ie){ke=je[Ie],uc=ke[4],Ce=this.createLabel(uc,D,"",L),_=ke[2]+(os[0]<0?-Cr:Cr),y=Ue*Ce.height+(.5-Ue)*2*Cr*os[1]/os[0]-Wi;const Gi=this.calculateImageOrLabelDimensions_(Ce.width,Ce.height,ke[0],ke[1],Ce.width,Ce.height,_,y,0,0,ke[3],hc,!1,Nn,!1,N);if(c&&c.collides(Gi.declutterBox))break t;qi.push([t,e,Ce,Gi,1,null,null])}if(z)for(Ie=0,lc=je.length;Ie<lc;++Ie){ke=je[Ie],uc=ke[4],Ce=this.createLabel(uc,D,z,""),_=ke[2],y=Ue*Ce.height-Wi;const Gi=this.calculateImageOrLabelDimensions_(Ce.width,Ce.height,ke[0],ke[1],Ce.width,Ce.height,_,y,0,0,ke[3],hc,!1,Nn,!1,N);if(c&&c.collides(Gi.declutterBox))break t;qi.push([t,e,Ce,Gi,1,null,null])}c&&c.load(qi.map(wd));for(let Gi=0,cE=qi.length;Gi<cE;++Gi)this.replayImageOrLabel_.apply(this,qi[Gi])}}++l;break;case st.END_GEOMETRY:if(r!==void 0){N=B[1];const $t=r(N,Z);if($t)return $t}++l;break;case st.FILL:F?q++:this.fill_(t),++l;break;case st.MOVE_TO_LINE_TO:for(f=B[1],g=B[2],G=h[f],V=h[f+1],b=G+.5|0,P=V+.5|0,(b!==w||P!==E)&&(t.moveTo(G,V),w=b,E=P),f+=2;f<g;f+=2)G=h[f],V=h[f+1],b=G+.5|0,P=V+.5|0,(f==g-2||b!==w||P!==E)&&(t.lineTo(G,V),w=b,E=P);++l;break;case st.SET_FILL_STYLE:X=B,this.alignFill_=B[2],q&&(this.fill_(t),q=0,Y&&(t.stroke(),Y=0)),t.fillStyle=B[1],++l;break;case st.SET_STROKE_STYLE:Q=B,Y&&(t.stroke(),Y=0),this.setStrokeStyle_(t,B),++l;break;case st.STROKE:F?Y++:t.stroke(),++l;break;default:++l;break}}q&&this.fill_(t),Y&&t.stroke()}execute(t,e,n,s,o,r){this.viewRotation_=s,this.execute_(t,e,n,this.instructions,o,void 0,void 0,r)}executeHitDetection(t,e,n,s,o){return this.viewRotation_=n,this.execute_(t,1,e,this.hitDetectionInstructions,!0,s,o)}}const eh=["Polygon","Circle","LineString","Image","Text","Default"];class Ed{constructor(t,e,n,s,o,r){this.maxExtent_=t,this.overlaps_=s,this.pixelRatio_=n,this.resolution_=e,this.renderBuffer_=r,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=be(),this.createExecutors_(o)}clip(t,e){const n=this.getClipCoords(e);t.beginPath(),t.moveTo(n[0],n[1]),t.lineTo(n[2],n[3]),t.lineTo(n[4],n[5]),t.lineTo(n[6],n[7]),t.clip()}createExecutors_(t){for(const e in t){let n=this.executorsByZIndex_[e];n===void 0&&(n={},this.executorsByZIndex_[e]=n);const s=t[e];for(const o in s){const r=s[o];n[o]=new z0(this.resolution_,this.pixelRatio_,this.overlaps_,r)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const n=this.executorsByZIndex_[e];for(let s=0,o=t.length;s<o;++s)if(t[s]in n)return!0}return!1}forEachFeatureAtCoordinate(t,e,n,s,o,r){s=Math.round(s);const a=s*2+1,c=qe(this.hitDetectionTransform_,s+.5,s+.5,1/e,-1/e,-n,-t[0],-t[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=Vt(a,a,void 0,{willReadFrequently:!0}));const l=this.hitDetectionContext_;l.canvas.width!==a||l.canvas.height!==a?(l.canvas.width=a,l.canvas.height=a):h||l.clearRect(0,0,a,a);let u;this.renderBuffer_!==void 0&&(u=Te(),ro(u,t),io(u,e*(this.renderBuffer_+s),u));const f=N0(s);let g;function _(M,D){const L=l.getImageData(0,0,a,a).data;for(let z=0,q=f.length;z<q;z++)if(L[f[z]]>0){if(!r||g!=="Image"&&g!=="Text"||r.includes(M)){const Y=(f[z]-3)/4,X=s-Y%a,Q=s-(Y/a|0),m=o(M,D,X*X+Q*Q);if(m)return m}l.clearRect(0,0,a,a);break}}const y=Object.keys(this.executorsByZIndex_).map(Number);y.sort(On);let w,E,b,P,I;for(w=y.length-1;w>=0;--w){const M=y[w].toString();for(b=this.executorsByZIndex_[M],E=eh.length-1;E>=0;--E)if(g=eh[E],P=b[g],P!==void 0&&(I=P.executeHitDetection(l,c,n,_,u),I))return I}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const n=e[0],s=e[1],o=e[2],r=e[3],a=[n,s,n,r,o,r,o,s];return yi(a,0,8,2,t,a),a}isEmpty(){return Js(this.executorsByZIndex_)}execute(t,e,n,s,o,r,a){const c=Object.keys(this.executorsByZIndex_).map(Number);c.sort(On),this.maxExtent_&&(t.save(),this.clip(t,n)),r=r||eh;let h,l,u,f,g,_;for(a&&c.reverse(),h=0,l=c.length;h<l;++h){const y=c[h].toString();for(g=this.executorsByZIndex_[y],u=0,f=r.length;u<f;++u){const w=r[u];_=g[w],_!==void 0&&_.execute(t,e,n,s,o,a)}}this.maxExtent_&&t.restore()}}const ih={};function N0(i){if(ih[i]!==void 0)return ih[i];const t=i*2+1,e=i*i,n=new Array(e+1);for(let o=0;o<=i;++o)for(let r=0;r<=i;++r){const a=o*o+r*r;if(a>e)break;let c=n[a];c||(c=[],n[a]=c),c.push(((i+o)*t+(i+r))*4+3),o>0&&c.push(((i-o)*t+(i+r))*4+3),r>0&&(c.push(((i+o)*t+(i-r))*4+3),o>0&&c.push(((i-o)*t+(i-r))*4+3))}const s=[];for(let o=0,r=n.length;o<r;++o)n[o]&&s.push(...n[o]);return ih[i]=s,s}class Cd extends gd{constructor(t,e,n,s,o,r,a){super(),this.context_=t,this.pixelRatio_=e,this.extent_=n,this.transform_=s,this.transformRotation_=s?Cc(Math.atan2(s[1],s[0]),10):0,this.viewRotation_=o,this.squaredTolerance_=r,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_=be()}drawImages_(t,e,n,s){if(!this.image_)return;const o=yi(t,e,n,s,this.transform_,this.pixelCoordinates_),r=this.context_,a=this.tmpLocalTransform_,c=r.globalAlpha;this.imageOpacity_!=1&&(r.globalAlpha=c*this.imageOpacity_);let h=this.imageRotation_;this.transformRotation_===0&&(h-=this.viewRotation_),this.imageRotateWithView_&&(h+=this.viewRotation_);for(let l=0,u=o.length;l<u;l+=2){const f=o[l]-this.imageAnchorX_,g=o[l+1]-this.imageAnchorY_;if(h!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const _=f+this.imageAnchorX_,y=g+this.imageAnchorY_;qe(a,_,y,1,1,h,-_,-y),r.setTransform.apply(r,a),r.translate(_,y),r.scale(this.imageScale_[0],this.imageScale_[1]),r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),r.setTransform(1,0,0,1,0,0)}else r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,f,g,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(r.globalAlpha=c)}drawText_(t,e,n,s){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const o=yi(t,e,n,s,this.transform_,this.pixelCoordinates_),r=this.context_;let a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);e<n;e+=s){const c=o[e]+this.textOffsetX_,h=o[e+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(r.translate(c-this.textOffsetX_,h-this.textOffsetY_),r.rotate(a),r.translate(this.textOffsetX_,this.textOffsetY_),r.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&r.strokeText(this.text_,0,0),this.textFillState_&&r.fillText(this.text_,0,0),r.setTransform(1,0,0,1,0,0)):(this.textStrokeState_&&r.strokeText(this.text_,c,h),this.textFillState_&&r.fillText(this.text_,c,h))}}moveToLineTo_(t,e,n,s,o){const r=this.context_,a=yi(t,e,n,s,this.transform_,this.pixelCoordinates_);r.moveTo(a[0],a[1]);let c=a.length;o&&(c-=2);for(let h=2;h<c;h+=2)r.lineTo(a[h],a[h+1]);return o&&r.closePath(),n}drawRings_(t,e,n,s){for(let o=0,r=n.length;o<r;++o)e=this.moveToLineTo_(t,e,n[o],s,!0);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!te(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=Pm(t,this.transform_,this.pixelCoordinates_),n=e[2]-e[0],s=e[3]-e[1],o=Math.sqrt(n*n+s*s),r=this.context_;r.beginPath(),r.arc(e[0],e[1],o,0,2*Math.PI),this.fillState_&&r.fill(),this.strokeState_&&r.stroke()}this.text_!==""&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t);break}}drawFeature(t,e){const n=e.getGeometryFunction()(t);n&&(this.setStyle(e),this.drawGeometry(n))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let n=0,s=e.length;n<s;++n)this.drawGeometry(e[n])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),n=t.getStride();this.image_&&this.drawImages_(e,0,e.length,n),this.text_!==""&&this.drawText_(e,0,e.length,n)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),n=t.getStride();this.image_&&this.drawImages_(e,0,e.length,n),this.text_!==""&&this.drawText_(e,0,e.length,n)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!te(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,n=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(n,0,n.length,t.getStride(),!1),e.stroke()}if(this.text_!==""){const e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getExtent();if(te(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const n=this.context_,s=t.getFlatCoordinates();let o=0;const r=t.getEnds(),a=t.getStride();n.beginPath();for(let c=0,h=r.length;c<h;++c)o=this.moveToLineTo_(s,o,r[c],a,!1);n.stroke()}if(this.text_!==""){const n=t.getFlatMidpoints();this.drawText_(n,0,n.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!te(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_)),!!te(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,n=t.getOrientedFlatCoordinates();let s=0;const o=t.getEndss(),r=t.getStride();e.beginPath();for(let a=0,c=o.length;a<c;++a){const h=o[a];s=this.drawRings_(n,s,h,r)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,n=this.contextFillState_;n?n.fillStyle!=t.fillStyle&&(n.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,n=this.contextStrokeState_;n?(n.lineCap!=t.lineCap&&(n.lineCap=t.lineCap,e.lineCap=t.lineCap),Vi(n.lineDash,t.lineDash)||e.setLineDash(n.lineDash=t.lineDash),n.lineDashOffset!=t.lineDashOffset&&(n.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),n.lineJoin!=t.lineJoin&&(n.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),n.lineWidth!=t.lineWidth&&(n.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),n.miterLimit!=t.miterLimit&&(n.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),n.strokeStyle!=t.strokeStyle&&(n.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){const e=this.context_,n=this.contextTextState_,s=t.textAlign?t.textAlign:go;n?(n.font!=t.font&&(n.font=t.font,e.font=t.font),n.textAlign!=s&&(n.textAlign=s,e.textAlign=s),n.textBaseline!=t.textBaseline&&(n.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=s,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:s,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(!t)this.fillState_=null;else{const n=t.getColor();this.fillState_={fillStyle:ei(n||ge)}}if(!e)this.strokeState_=null;else{const n=e.getColor(),s=e.getLineCap(),o=e.getLineDash(),r=e.getLineDashOffset(),a=e.getLineJoin(),c=e.getWidth(),h=e.getMiterLimit(),l=o||vi;this.strokeState_={lineCap:s!==void 0?s:Yr,lineDash:this.pixelRatio_===1?l:l.map(u=>u*this.pixelRatio_),lineDashOffset:(r||Ei)*this.pixelRatio_,lineJoin:a!==void 0?a:ms,lineWidth:(c!==void 0?c:po)*this.pixelRatio_,miterLimit:h!==void 0?h:uo,strokeStyle:ei(n||fo)}}}setImageStyle(t){let e;if(!t||!(e=t.getSize())){this.image_=null;return}const n=t.getPixelRatio(this.pixelRatio_),s=t.getAnchor(),o=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=s[0]*n,this.imageAnchorY_=s[1]*n,this.imageHeight_=e[1]*n,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=o[0],this.imageOriginY_=o[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const r=t.getScaleArray();this.imageScale_=[r[0]*this.pixelRatio_/n,r[1]*this.pixelRatio_/n],this.imageWidth_=e[0]*n}setTextStyle(t){if(!t)this.text_="";else{const e=t.getFill();if(!e)this.textFillState_=null;else{const g=e.getColor();this.textFillState_={fillStyle:ei(g||ge)}}const n=t.getStroke();if(!n)this.textStrokeState_=null;else{const g=n.getColor(),_=n.getLineCap(),y=n.getLineDash(),w=n.getLineDashOffset(),E=n.getLineJoin(),b=n.getWidth(),P=n.getMiterLimit();this.textStrokeState_={lineCap:_!==void 0?_:Yr,lineDash:y||vi,lineDashOffset:w||Ei,lineJoin:E!==void 0?E:ms,lineWidth:b!==void 0?b:po,miterLimit:P!==void 0?P:uo,strokeStyle:ei(g||fo)}}const s=t.getFont(),o=t.getOffsetX(),r=t.getOffsetY(),a=t.getRotateWithView(),c=t.getRotation(),h=t.getScaleArray(),l=t.getText(),u=t.getTextAlign(),f=t.getTextBaseline();this.textState_={font:s!==void 0?s:Qu,textAlign:u!==void 0?u:go,textBaseline:f!==void 0?f:Hr},this.text_=l!==void 0?Array.isArray(l)?l.reduce((g,_,y)=>g+=y%2?" ":_,""):l:"",this.textOffsetX_=o!==void 0?this.pixelRatio_*o:0,this.textOffsetY_=r!==void 0?this.pixelRatio_*r:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=c!==void 0?c:0,this.textScale_=[this.pixelRatio_*h[0],this.pixelRatio_*h[1]]}}}const si=.5;function U0(i,t,e,n,s,o,r){const a=i[0]*si,c=i[1]*si,h=Vt(a,c);h.imageSmoothingEnabled=!1;const l=h.canvas,u=new Cd(h,si,s,null,r),f=e.length,g=Math.floor((256*256*256-1)/f),_={};for(let w=1;w<=f;++w){const E=e[w-1],b=E.getStyleFunction()||n;if(!b)continue;let P=b(E,o);if(!P)continue;Array.isArray(P)||(P=[P]);const M=(w*g).toString(16).padStart(7,"#00000");for(let D=0,L=P.length;D<L;++D){const z=P[D],q=z.getGeometryFunction()(E);if(!q||!te(s,q.getExtent()))continue;const Y=z.clone(),X=Y.getFill();X&&X.setColor(M);const Q=Y.getStroke();Q&&(Q.setColor(M),Q.setLineDash(null)),Y.setText(void 0);const m=z.getImage();if(m){const F=m.getImageSize();if(!F)continue;const N=Vt(F[0],F[1],void 0,{alpha:!1}),G=N.canvas;N.fillStyle=M,N.fillRect(0,0,G.width,G.height),Y.setImage(new vs({img:G,imgSize:F,anchor:m.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:m.getOrigin(),opacity:1,size:m.getSize(),scale:m.getScale(),rotation:m.getRotation(),rotateWithView:m.getRotateWithView()}))}const v=Y.getZIndex()||0;let S=_[v];S||(S={},_[v]=S,S.Polygon=[],S.Circle=[],S.LineString=[],S.Point=[]);const A=q.getType();if(A==="GeometryCollection"){const F=q.getGeometriesArrayRecursive();for(let N=0,G=F.length;N<G;++N){const V=F[N];S[V.getType().replace("Multi","")].push(V,Y)}}else S[A.replace("Multi","")].push(q,Y)}}const y=Object.keys(_).map(Number).sort(On);for(let w=0,E=y.length;w<E;++w){const b=_[y[w]];for(const P in b){const I=b[P];for(let M=0,D=I.length;M<D;M+=2){u.setStyle(I[M+1]);for(let L=0,z=t.length;L<z;++L)u.setTransform(t[L]),u.drawGeometry(I[M])}}}return h.getImageData(0,0,l.width,l.height)}function j0(i,t,e){const n=[];if(e){const s=Math.floor(Math.round(i[0])*si),o=Math.floor(Math.round(i[1])*si),r=(qt(s,0,e.width-1)+qt(o,0,e.height-1)*e.width)*4,a=e.data[r],c=e.data[r+1],l=e.data[r+2]+256*(c+256*a),u=Math.floor((256*256*256-1)/t.length);l&&l%u===0&&n.push(t[l/u-1])}return n}const k0=.5,bd={Point:X0,LineString:B0,Polygon:Z0,MultiPoint:$0,MultiLineString:Y0,MultiPolygon:H0,GeometryCollection:V0,Circle:q0};function W0(i,t){return parseInt(St(i),10)-parseInt(St(t),10)}function xd(i,t){const e=nh(i,t);return e*e}function nh(i,t){return k0*i/t}function q0(i,t,e,n,s){const o=e.getFill(),r=e.getStroke();if(o||r){const c=i.getBuilder(e.getZIndex(),"Circle");c.setFillStrokeStyle(o,r),c.drawCircle(t,n)}const a=e.getText();if(a&&a.getText()){const c=(s||i).getBuilder(e.getZIndex(),"Text");c.setTextStyle(a),c.drawText(t,n)}}function Sd(i,t,e,n,s,o,r){let a=!1;const c=e.getImage();if(c){const h=c.getImageState();h==ot.LOADED||h==ot.ERROR?c.unlistenImageChange(s):(h==ot.IDLE&&c.load(),c.listenImageChange(s),a=!0)}return G0(i,t,e,n,o,r),a}function G0(i,t,e,n,s,o){const r=e.getGeometryFunction()(t);if(!r)return;const a=r.simplifyTransformed(n,s);if(e.getRenderer())Rd(i,a,e,t);else{const h=bd[a.getType()];h(i,a,e,t,o)}}function Rd(i,t,e,n){if(t.getType()=="GeometryCollection"){const o=t.getGeometries();for(let r=0,a=o.length;r<a;++r)Rd(i,o[r],e,n);return}i.getBuilder(e.getZIndex(),"Default").drawCustom(t,n,e.getRenderer(),e.getHitDetectionRenderer())}function V0(i,t,e,n,s){const o=t.getGeometriesArray();let r,a;for(r=0,a=o.length;r<a;++r){const c=bd[o[r].getType()];c(i,o[r],e,n,s)}}function B0(i,t,e,n,s){const o=e.getStroke();if(o){const a=i.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,o),a.drawLineString(t,n)}const r=e.getText();if(r&&r.getText()){const a=(s||i).getBuilder(e.getZIndex(),"Text");a.setTextStyle(r),a.drawText(t,n)}}function Y0(i,t,e,n,s){const o=e.getStroke();if(o){const a=i.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,o),a.drawMultiLineString(t,n)}const r=e.getText();if(r&&r.getText()){const a=(s||i).getBuilder(e.getZIndex(),"Text");a.setTextStyle(r),a.drawText(t,n)}}function H0(i,t,e,n,s){const o=e.getFill(),r=e.getStroke();if(r||o){const c=i.getBuilder(e.getZIndex(),"Polygon");c.setFillStrokeStyle(o,r),c.drawMultiPolygon(t,n)}const a=e.getText();if(a&&a.getText()){const c=(s||i).getBuilder(e.getZIndex(),"Text");c.setTextStyle(a),c.drawText(t,n)}}function X0(i,t,e,n,s){const o=e.getImage(),r=e.getText();let a;if(o){if(o.getImageState()!=ot.LOADED)return;let c=i;if(s){const l=o.getDeclutterMode();if(l!=="none")if(c=s,l==="obstacle"){const u=i.getBuilder(e.getZIndex(),"Image");u.setImageStyle(o,a),u.drawPoint(t,n)}else r&&r.getText()&&(a={})}const h=c.getBuilder(e.getZIndex(),"Image");h.setImageStyle(o,a),h.drawPoint(t,n)}if(r&&r.getText()){let c=i;s&&(c=s);const h=c.getBuilder(e.getZIndex(),"Text");h.setTextStyle(r,a),h.drawText(t,n)}}function $0(i,t,e,n,s){const o=e.getImage(),r=e.getText();let a;if(o){if(o.getImageState()!=ot.LOADED)return;let c=i;if(s){const l=o.getDeclutterMode();if(l!=="none")if(c=s,l==="obstacle"){const u=i.getBuilder(e.getZIndex(),"Image");u.setImageStyle(o,a),u.drawMultiPoint(t,n)}else r&&r.getText()&&(a={})}const h=c.getBuilder(e.getZIndex(),"Image");h.setImageStyle(o,a),h.drawMultiPoint(t,n)}if(r&&r.getText()){let c=i;s&&(c=s);const h=c.getBuilder(e.getZIndex(),"Text");h.setTextStyle(r,a),h.drawText(t,n)}}function Z0(i,t,e,n,s){const o=e.getFill(),r=e.getStroke();if(o||r){const c=i.getBuilder(e.getZIndex(),"Polygon");c.setFillStrokeStyle(o,r),c.drawPolygon(t,n)}const a=e.getText();if(a&&a.getText()){const c=(s||i).getBuilder(e.getZIndex(),"Text");c.setTextStyle(a),c.drawText(t,n)}}class Pd extends Jc{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=Te(),this.wrappedRenderedExtent_=Te(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedRenderOrder_=null,this.replayGroup_=null,this.replayGroupChanged=!0,this.declutterExecutorGroup=null,this.clipping=!0,this.compositionContext_=null,this.opacity_=1}renderWorlds(t,e,n){const s=e.extent,o=e.viewState,r=o.center,a=o.resolution,c=o.projection,h=o.rotation,l=c.getExtent(),u=this.getLayer().getSource(),f=e.pixelRatio,g=e.viewHints,_=!(g[Bt.ANIMATING]||g[Bt.INTERACTING]),y=this.compositionContext_,w=Math.round(e.size[0]*f),E=Math.round(e.size[1]*f),b=u.getWrapX()&&c.canWrapX(),P=b?yt(l):null,I=b?Math.ceil((s[2]-l[2])/P)+1:1;let M=b?Math.floor((s[0]-l[0])/P):0;do{const D=this.getRenderTransform(r,a,h,f,w,E,M*P);t.execute(y,1,D,h,_,void 0,n)}while(++M<I)}setupCompositionContext_(){if(this.opacity_!==1){const t=Vt(this.context.canvas.width,this.context.canvas.height,yd);this.compositionContext_=t}else this.compositionContext_=this.context}releaseCompositionContext_(){if(this.opacity_!==1){const t=this.context.globalAlpha;this.context.globalAlpha=this.opacity_,this.context.drawImage(this.compositionContext_.canvas,0,0),this.context.globalAlpha=t,Gr(this.compositionContext_),yd.push(this.compositionContext_.canvas),this.compositionContext_=null}}renderDeclutter(t){this.declutterExecutorGroup&&(this.setupCompositionContext_(),this.renderWorlds(this.declutterExecutorGroup,t,t.declutterTree),this.releaseCompositionContext_())}renderFrame(t,e){const n=t.pixelRatio,s=t.layerStatesArray[t.layerIndex];Yp(this.pixelTransform,1/n,1/n),Or(this.inversePixelTransform,this.pixelTransform);const o=fc(this.pixelTransform);this.useContainer(e,o,this.getBackground(t));const r=this.context,a=r.canvas,c=this.replayGroup_,h=this.declutterExecutorGroup;let l=c&&!c.isEmpty()||h&&!h.isEmpty();if(!l&&!(this.getLayer().hasListener(ti.PRERENDER)||this.getLayer().hasListener(ti.POSTRENDER)))return null;const u=Math.round(t.size[0]*n),f=Math.round(t.size[1]*n);a.width!=u||a.height!=f?(a.width=u,a.height=f,a.style.transform!==o&&(a.style.transform=o)):this.containerReused||r.clearRect(0,0,u,f),this.preRender(r,t);const g=t.viewState;g.projection,this.opacity_=s.opacity,this.setupCompositionContext_();let _=!1;if(l&&s.extent&&this.clipping){const y=_i(s.extent);l=te(y,t.extent),_=l&&!Tn(y,t.extent),_&&this.clipUnrotated(this.compositionContext_,t,y)}return l&&this.renderWorlds(c,t),_&&this.compositionContext_.restore(),this.releaseCompositionContext_(),this.postRender(r,t),this.renderedRotation_!==g.rotation&&(this.renderedRotation_=g.rotation,this.hitDetectionImageData_=null),this.container}getFeatures(t){return new Promise(e=>{if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const n=[this.context.canvas.width,this.context.canvas.height];Ut(this.pixelTransform,n);const s=this.renderedCenter_,o=this.renderedResolution_,r=this.renderedRotation_,a=this.renderedProjection_,c=this.wrappedRenderedExtent_,h=this.getLayer(),l=[],u=n[0]*si,f=n[1]*si;l.push(this.getRenderTransform(s,o,r,si,u,f,0).slice());const g=h.getSource(),_=a.getExtent();if(g.getWrapX()&&a.canWrapX()&&!Tn(_,c)){let y=c[0];const w=yt(_);let E=0,b;for(;y<_[0];)--E,b=w*E,l.push(this.getRenderTransform(s,o,r,si,u,f,b).slice()),y+=w;for(E=0,y=c[2];y>_[2];)++E,b=w*E,l.push(this.getRenderTransform(s,o,r,si,u,f,b).slice()),y-=w}this.hitDetectionImageData_=U0(n,l,this.renderedFeatures_,h.getStyleFunction(),c,o,r)}e(j0(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,n,s,o){if(!this.replayGroup_)return;const r=e.viewState.resolution,a=e.viewState.rotation,c=this.getLayer(),h={},l=function(g,_,y){const w=St(g),E=h[w];if(E){if(E!==!0&&y<E.distanceSq){if(y===0)return h[w]=!0,o.splice(o.lastIndexOf(E),1),s(g,c,_);E.geometry=_,E.distanceSq=y}}else{if(y===0)return h[w]=!0,s(g,c,_);o.push(h[w]={feature:g,layer:c,geometry:_,distanceSq:y,callback:s})}};let u;const f=[this.replayGroup_];return this.declutterExecutorGroup&&f.push(this.declutterExecutorGroup),f.some(g=>u=g.forEachFeatureAtCoordinate(t,r,a,n,l,g===this.declutterExecutorGroup&&e.declutterTree?e.declutterTree.all().map(_=>_.value):null)),u}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),n=e.getSource();if(!n)return!1;const s=t.viewHints[Bt.ANIMATING],o=t.viewHints[Bt.INTERACTING],r=e.getUpdateWhileAnimating(),a=e.getUpdateWhileInteracting();if(this.ready&&!r&&s||!a&&o)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const c=t.extent,h=t.viewState,l=h.projection,u=h.resolution,f=t.pixelRatio,g=e.getRevision(),_=e.getRenderBuffer();let y=e.getRenderOrder();y===void 0&&(y=W0);const w=h.center.slice(),E=io(c,_*u),b=E.slice(),P=[E.slice()],I=l.getExtent();if(n.getWrapX()&&l.canWrapX()&&!Tn(I,t.extent)){const S=yt(I),A=Math.max(yt(E)/2,S);E[0]=I[0]-A,E[2]=I[2]+A,du(w,l);const F=cu(P[0],l);F[0]<I[0]&&F[2]<I[2]?P.push([F[0]+S,F[1],F[2]+S,F[3]]):F[0]>I[0]&&F[2]>I[2]&&P.push([F[0]-S,F[1],F[2]-S,F[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==g&&this.renderedRenderOrder_==y&&Tn(this.wrappedRenderedExtent_,E))return Vi(this.renderedExtent_,b)||(this.hitDetectionImageData_=null,this.renderedExtent_=b),this.renderedCenter_=w,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const M=new md(nh(u,f),E,u,f);let D;this.getLayer().getDeclutter()&&(D=new md(nh(u,f),E,u,f));let L;for(let S=0,A=P.length;S<A;++S)n.loadFeatures(P[S],u,l);const z=xd(u,f);let q=!0;const Y=S=>{let A;const F=S.getStyleFunction()||e.getStyleFunction();if(F&&(A=F(S,u)),A){const N=this.renderFeature(S,z,A,M,L,D);q=q&&!N}},X=xu(E),Q=n.getFeaturesInExtent(X);y&&Q.sort(y);for(let S=0,A=Q.length;S<A;++S)Y(Q[S]);this.renderedFeatures_=Q,this.ready=q;const m=M.finish(),v=new Ed(E,u,f,n.getOverlaps(),m,e.getRenderBuffer());return D&&(this.declutterExecutorGroup=new Ed(E,u,f,n.getOverlaps(),D.finish(),e.getRenderBuffer())),this.renderedResolution_=u,this.renderedRevision_=g,this.renderedRenderOrder_=y,this.renderedExtent_=b,this.wrappedRenderedExtent_=E,this.renderedCenter_=w,this.renderedProjection_=l,this.replayGroup_=v,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,n,s,o,r){if(!n)return!1;let a=!1;if(Array.isArray(n))for(let c=0,h=n.length;c<h;++c)a=Sd(s,t,n[c],e,this.boundHandleStyleImageChange_,o,r)||a;else a=Sd(s,t,n,e,this.boundHandleStyleImageChange_,o,r);return a}}class oi extends dd{constructor(t){super(t)}createRenderer(){return new Pd(this)}}class Od{constructor(t){this.rbush_=new Xc(t),this.items_={}}insert(t,e){const n={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(n),this.items_[St(e)]=n}load(t,e){const n=new Array(e.length);for(let s=0,o=e.length;s<o;s++){const r=t[s],a=e[s],c={minX:r[0],minY:r[1],maxX:r[2],maxY:r[3],value:a};n[s]=c,this.items_[St(a)]=c}this.rbush_.load(n)}remove(t){const e=St(t),n=this.items_[e];return delete this.items_[e],this.rbush_.remove(n)!==null}update(t,e){const n=this.items_[St(e)],s=[n.minX,n.minY,n.maxX,n.maxY];Yi(s,t)||(this.remove(e),this.insert(t,e))}getAll(){return this.rbush_.all().map(function(e){return e.value})}getInExtent(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).map(function(s){return s.value})}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,e){return this.forEach_(this.getInExtent(t),e)}forEach_(t,e){let n;for(let s=0,o=t.length;s<o;s++)if(n=e(t[s]),n)return n;return n}isEmpty(){return Js(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return pi(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 Ro extends Ke{constructor(t){super(),this.projection=Gt(t.projection),this.attributions_=Id(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible!==void 0?t.attributionsCollapsible:!0,this.loading=!1,this.state_=t.state!==void 0?t.state:"ready",this.wrapX_=t.wrapX!==void 0?t.wrapX:!1,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;const e=this;this.viewPromise_=new Promise(function(n,s){e.viewResolver=n,e.viewRejector=s})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(t){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=Id(t),this.changed()}setState(t){this.state_=t,this.changed()}}function Id(i){return i?Array.isArray(i)?function(t){return i}:typeof i=="function"?i:function(t){return[i]}:null}const Be={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function K0(i,t){return[[-1/0,-1/0,1/0,1/0]]}let Q0=!1;function J0(i,t,e,n,s,o,r){const a=new XMLHttpRequest;a.open("GET",typeof i=="function"?i(e,n,s):i,!0),t.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=Q0,a.onload=function(c){if(!a.status||a.status>=200&&a.status<300){const h=t.getType();let l;h=="json"||h=="text"?l=a.responseText:h=="xml"?(l=a.responseXML,l||(l=new DOMParser().parseFromString(a.responseText,"application/xml"))):h=="arraybuffer"&&(l=a.response),l?o(t.readFeatures(l,{extent:e,featureProjection:s}),t.readProjection(l)):r()}else r()},a.onerror=r,a.send()}function Td(i,t){return function(e,n,s,o,r){const a=this;J0(i,t,e,n,s,function(c,h){a.addFeatures(c),o!==void 0&&o(c)},r||hs)}}class en extends We{constructor(t,e,n){super(t),this.feature=e,this.features=n}}class Si extends Ro{constructor(t){t=t||{},super({attributions:t.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:t.wrapX!==void 0?t.wrapX:!0}),this.on,this.once,this.un,this.loader_=hs,this.format_=t.format,this.overlaps_=t.overlaps===void 0?!0:t.overlaps,this.url_=t.url,t.loader!==void 0?this.loader_=t.loader:this.url_!==void 0&&(pt(this.format_,7),this.loader_=Td(this.url_,this.format_)),this.strategy_=t.strategy!==void 0?t.strategy:K0;const e=t.useSpatialIndex!==void 0?t.useSpatialIndex:!0;this.featuresRtree_=e?new Od:null,this.loadedExtentsRtree_=new Od,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let n,s;Array.isArray(t.features)?s=t.features:t.features&&(n=t.features,s=n.getArray()),!e&&n===void 0&&(n=new Qe(s)),s!==void 0&&this.addFeaturesInternal(s),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=St(t);if(!this.addToIndex_(e,t)){this.featuresCollection_&&this.featuresCollection_.remove(t);return}this.setupChangeEvents_(e,t);const n=t.getGeometry();if(n){const s=n.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(s,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new en(Be.ADDFEATURE,t))}setupChangeEvents_(t,e){this.featureChangeKeys_[t]=[Ct(e,ht.CHANGE,this.handleFeatureChange_,this),Ct(e,cs.PROPERTYCHANGE,this.handleFeatureChange_,this)]}addToIndex_(t,e){let n=!0;const s=e.getId();return s!==void 0&&(s.toString()in this.idIndex_?n=!1:this.idIndex_[s.toString()]=e),n&&(pt(!(t in this.uidIndex_),30),this.uidIndex_[t]=e),n}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],n=[],s=[];for(let o=0,r=t.length;o<r;o++){const a=t[o],c=St(a);this.addToIndex_(c,a)&&n.push(a)}for(let o=0,r=n.length;o<r;o++){const a=n[o],c=St(a);this.setupChangeEvents_(c,a);const h=a.getGeometry();if(h){const l=h.getExtent();e.push(l),s.push(a)}else this.nullGeometryFeatures_[c]=a}if(this.featuresRtree_&&this.featuresRtree_.load(e,s),this.hasListener(Be.ADDFEATURE))for(let o=0,r=n.length;o<r;o++)this.dispatchEvent(new en(Be.ADDFEATURE,n[o]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(Be.ADDFEATURE,function(n){e||(e=!0,t.push(n.feature),e=!1)}),this.addEventListener(Be.REMOVEFEATURE,function(n){e||(e=!0,t.remove(n.feature),e=!1)}),t.addEventListener(ue.ADD,n=>{e||(e=!0,this.addFeature(n.element),e=!1)}),t.addEventListener(ue.REMOVE,n=>{e||(e=!0,this.removeFeature(n.element),e=!1)}),this.featuresCollection_=t}clear(t){if(t){for(const n in this.featureChangeKeys_)this.featureChangeKeys_[n].forEach(Mt);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){const n=s=>{this.removeFeatureInternal(s)};this.featuresRtree_.forEach(n);for(const s in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[s])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new en(Be.CLEAR);this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const n=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(n,function(s){if(s.getGeometry().intersectsCoordinate(t))return e(s)})}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,function(n){if(n.getGeometry().intersectsExtent(t)){const o=e(n);if(o)return o}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),Js(this.nullGeometryFeatures_)||In(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,function(n){e.push(n)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const s=sm(t,e);return[].concat(...s.map(o=>this.featuresRtree_.getInExtent(o)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const n=t[0],s=t[1];let o=null;const r=[NaN,NaN];let a=1/0;const c=[-1/0,-1/0,1/0,1/0];return e=e||Ks,this.featuresRtree_.forEachInExtent(c,function(h){if(e(h)){const l=h.getGeometry(),u=a;if(a=l.closestPointXY(n,s,r,a),a<u){o=h;const f=Math.sqrt(a);c[0]=n-f,c[1]=s-f,c[2]=n+f,c[3]=s+f}}}),o}getExtent(t){return this.featuresRtree_.getExtent(t)}getFeatureById(t){const e=this.idIndex_[t.toString()];return e!==void 0?e:null}getFeatureByUid(t){const e=this.uidIndex_[t];return e!==void 0?e:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){const e=t.target,n=St(e),s=e.getGeometry();if(!s)n in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[n]=e);else{const r=s.getExtent();n in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[n],this.featuresRtree_&&this.featuresRtree_.insert(r,e)):this.featuresRtree_&&this.featuresRtree_.update(r,e)}const o=e.getId();if(o!==void 0){const r=o.toString();this.idIndex_[r]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[r]=e)}else this.removeFromIdIndex_(e),this.uidIndex_[n]=e;this.changed(),this.dispatchEvent(new en(Be.CHANGEFEATURE,e))}hasFeature(t){const e=t.getId();return e!==void 0?e in this.idIndex_:St(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Js(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(t,e,n){const s=this.loadedExtentsRtree_,o=this.strategy_(t,e,n);for(let r=0,a=o.length;r<a;++r){const c=o[r];s.forEachInExtent(c,function(l){return Tn(l.extent,c)})||(++this.loadingExtentsCount_,this.dispatchEvent(new en(Be.FEATURESLOADSTART)),this.loader_.call(this,c,e,n,l=>{--this.loadingExtentsCount_,this.dispatchEvent(new en(Be.FEATURESLOADEND,void 0,l))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new en(Be.FEATURESLOADERROR))}),s.insert(c,{extent:c.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_;let n;e.forEachInExtent(t,function(s){if(Yi(s.extent,t))return n=s,!0}),n&&e.remove(n)}removeFeature(t){if(!t)return;const e=St(t);e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t),this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=St(t),n=this.featureChangeKeys_[e];if(!n)return;n.forEach(Mt),delete this.featureChangeKeys_[e];const s=t.getId();return s!==void 0&&delete this.idIndex_[s.toString()],delete this.uidIndex_[e],this.dispatchEvent(new en(Be.REMOVEFEATURE,t)),t}removeFromIdIndex_(t){let e=!1;for(const n in this.idIndex_)if(this.idIndex_[n]===t){delete this.idIndex_[n],e=!0;break}return e}setLoader(t){this.loader_=t}setUrl(t){pt(this.format_,7),this.url_=t,this.setLoader(Td(t,this.format_))}}function Ad(i){if(!(i.context instanceof CanvasRenderingContext2D))throw new Error("Only works for render events from Canvas 2D layers");const t=i.inversePixelTransform[0],e=i.inversePixelTransform[1],n=Math.sqrt(t*t+e*e),s=i.frameState,o=Gp(i.inversePixelTransform.slice(),s.coordinateToPixelTransform),r=xd(s.viewState.resolution,n);let a;return new Cd(i.context,n,s.extent,o,s.viewState.rotation,r,a)}class Md extends Kc{constructor(t,e,n,s,o){const r=o!==void 0?ot.IDLE:ot.LOADED;super(t,e,n,r),this.loader_=o!==void 0?o:null,this.canvas_=s,this.error_=null}getError(){return this.error_}handleLoad_(t){t?(this.error_=t,this.state=ot.ERROR):this.state=ot.LOADED,this.changed()}load(){this.state==ot.IDLE&&(this.state=ot.LOADING,this.changed(),this.loader_(this.handleLoad_.bind(this)))}getImage(){return this.canvas_}}const rt={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class Dd extends to{constructor(t,e,n){super(),n=n||{},this.tileCoord=t,this.state=e,this.interimTile=null,this.key="",this.transition_=n.transition===void 0?250:n.transition,this.transitionStarts_={},this.interpolate=!!n.interpolate}changed(){this.dispatchEvent(ht.CHANGE)}release(){this.state===rt.ERROR&&this.setState(rt.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getInterimTile(){if(!this.interimTile)return this;let t=this.interimTile;do{if(t.getState()==rt.LOADED)return this.transition_=0,t;t=t.interimTile}while(t);return this}refreshInterimChain(){if(!this.interimTile)return;let t=this.interimTile,e=this;do{if(t.getState()==rt.LOADED){t.interimTile=null;break}else t.getState()==rt.LOADING?e=t:t.getState()==rt.IDLE?e.interimTile=t.interimTile:e=t;t=e.interimTile}while(t)}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==rt.ERROR&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}load(){vt()}getAlpha(t,e){if(!this.transition_)return 1;let n=this.transitionStarts_[t];if(!n)n=e,this.transitionStarts_[t]=n;else if(n===-1)return 1;const s=e-n+1e3/60;return s>=this.transition_?1:Ql(s/this.transition_)}inTransition(t){return this.transition_?this.transitionStarts_[t]!==-1:!1}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}}class Fd extends Dd{constructor(t,e,n,s,o,r){super(t,e,r),this.crossOrigin_=s,this.src_=n,this.key=n,this.image_=new Image,s!==null&&(this.image_.crossOrigin=s),this.unlisten_=null,this.tileLoadFunction_=o}getImage(){return this.image_}setImage(t){this.image_=t,this.state=rt.LOADED,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=rt.ERROR,this.unlistenImage_(),this.image_=t_(),this.changed()}handleImageLoad_(){const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=rt.LOADED:this.state=rt.EMPTY,this.unlistenImage_(),this.changed()}load(){this.state==rt.ERROR&&(this.state=rt.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==rt.IDLE&&(this.state=rt.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=Qc(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function t_(){const i=Vt(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}class e_{constructor(t,e,n){this.decay_=t,this.minVelocity_=e,this.delay_=n,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;let n=e-3;for(;n>0&&this.points_[n+2]>t;)n-=3;const s=this.points_[e+2]-this.points_[n+2];if(s<16.666666666666668)return!1;const o=this.points_[e]-this.points_[n],r=this.points_[e+1]-this.points_[n+1];return this.angle_=Math.atan2(r,o),this.initialVelocity_=Math.sqrt(o*o+r*r)/s,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}class i_ extends xr{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){vt()}calculateMatrices2D(t){const e=t.viewState,n=t.coordinateToPixelTransform,s=t.pixelToCoordinateTransform;qe(n,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),Or(s,n)}forEachFeatureAtCoordinate(t,e,n,s,o,r,a,c){let h;const l=e.viewState;function u(I,M,D,L){return o.call(r,M,I?D:null,L)}const f=l.projection,g=du(t.slice(),f),_=[[0,0]];if(f.canWrapX()&&s){const I=f.getExtent(),M=yt(I);_.push([-M,0],[M,0])}const y=e.layerStatesArray,w=y.length,E=[],b=[];for(let I=0;I<_.length;I++)for(let M=w-1;M>=0;--M){const D=y[M],L=D.layer;if(L.hasRenderer()&&Hc(D,l)&&a.call(c,L)){const z=L.getRenderer(),q=L.getSource();if(z&&q){const Y=q.getWrapX()?g:t,X=u.bind(null,D.managed);b[0]=Y[0]+_[I][0],b[1]=Y[1]+_[I][1],h=z.forEachFeatureAtCoordinate(b,e,n,X,E)}if(h)return h}}if(E.length===0)return;const P=1/E.length;return E.forEach((I,M)=>I.distanceSq+=M*P),E.sort((I,M)=>I.distanceSq-M.distanceSq),E.some(I=>h=I.callback(I.feature,I.layer,I.geometry)),h}hasFeatureAtCoordinate(t,e,n,s,o,r){return this.forEachFeatureAtCoordinate(t,e,n,s,Ks,this,o,r)!==void 0}getMap(){return this.map_}renderFrame(t){vt()}flushDeclutterItems(t){}scheduleExpireIconCache(t){Qr.canExpireCache()&&t.postRenderFunctions.push(n_)}}function n_(i,t){Qr.expire()}class s_ extends i_{constructor(t){super(t),this.fontChangeListenerKey_=Ct(Ci,cs.PROPERTYCHANGE,t.redrawText.bind(t)),this.element_=document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=Br+" ol-layers";const n=t.getViewport();n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0,this.declutterLayers_=[]}dispatchRenderEvent(t,e){const n=this.getMap();if(n.hasListener(t)){const s=new _d(t,void 0,e);n.dispatchEvent(s)}}disposeInternal(){Mt(this.fontChangeListenerKey_),this.element_.parentNode.removeChild(this.element_),super.disposeInternal()}renderFrame(t){if(!t){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(t),this.dispatchRenderEvent(ti.PRECOMPOSE,t);const e=t.layerStatesArray.sort(function(r,a){return r.zIndex-a.zIndex}),n=t.viewState;this.children_.length=0;const s=this.declutterLayers_;s.length=0;let o=null;for(let r=0,a=e.length;r<a;++r){const c=e[r];t.layerIndex=r;const h=c.layer,l=h.getSourceState();if(!Hc(c,n)||l!="ready"&&l!="undefined"){h.unrender();continue}const u=h.render(t,o);u&&(u!==o&&(this.children_.push(u),o=u),"getDeclutter"in h&&s.push(h))}this.flushDeclutterItems(t),Hm(this.element_,this.children_),this.dispatchRenderEvent(ti.POSTCOMPOSE,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}flushDeclutterItems(t){const e=this.declutterLayers_;for(let n=e.length-1;n>=0;--n)e[n].renderDeclutter(t);e.length=0}}class nn extends We{constructor(t,e){super(t),this.layer=e}}const sh={LAYERS:"layers"};class sn extends id{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let n=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(sh.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new Qe(n.slice(),{unique:!0}):pt(typeof n.getArray=="function",43):n=new Qe(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(Mt),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(Ct(t,ue.ADD,this.handleLayersAdd_,this),Ct(t,ue.REMOVE,this.handleLayersRemove_,this));for(const n in this.listenerKeys_)this.listenerKeys_[n].forEach(Mt);Qs(this.listenerKeys_);const e=t.getArray();for(let n=0,s=e.length;n<s;n++){const o=e[n];this.registerLayerListeners_(o),this.dispatchEvent(new nn("addlayer",o))}this.changed()}registerLayerListeners_(t){const e=[Ct(t,cs.PROPERTYCHANGE,this.handleLayerChange_,this),Ct(t,ht.CHANGE,this.handleLayerChange_,this)];t instanceof sn&&e.push(Ct(t,"addlayer",this.handleLayerGroupAdd_,this),Ct(t,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[St(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new nn("addlayer",t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new nn("removelayer",t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new nn("addlayer",e)),this.changed()}handleLayersRemove_(t){const e=t.element,n=St(e);this.listenerKeys_[n].forEach(Mt),delete this.listenerKeys_[n],this.dispatchEvent(new nn("removelayer",e)),this.changed()}getLayers(){return this.get(sh.LAYERS)}setLayers(t){const e=this.getLayers();if(e){const n=e.getArray();for(let s=0,o=n.length;s<o;++s)this.dispatchEvent(new nn("removelayer",n[s]))}this.set(sh.LAYERS,t)}getLayersArray(t){return t=t!==void 0?t:[],this.getLayers().forEach(function(e){e.getLayersArray(t)}),t}getLayerStatesArray(t){const e=t!==void 0?t:[],n=e.length;this.getLayers().forEach(function(r){r.getLayerStatesArray(e)});const s=this.getLayerState();let o=s.zIndex;!t&&s.zIndex===void 0&&(o=0);for(let r=n,a=e.length;r<a;r++){const c=e[r];c.opacity*=s.opacity,c.visible=c.visible&&s.visible,c.maxResolution=Math.min(c.maxResolution,s.maxResolution),c.minResolution=Math.max(c.minResolution,s.minResolution),c.minZoom=Math.max(c.minZoom,s.minZoom),c.maxZoom=Math.min(c.maxZoom,s.maxZoom),s.extent!==void 0&&(c.extent!==void 0?c.extent=An(c.extent,s.extent):c.extent=s.extent),c.zIndex===void 0&&(c.zIndex=o)}return e}getSourceState(){return"ready"}}class bs extends We{constructor(t,e,n){super(t),this.map=e,this.frameState=n!==void 0?n:null}}class on extends bs{constructor(t,e,n,s,o,r){super(t,e,o),this.originalEvent=n,this.pixel_=null,this.coordinate_=null,this.dragging=s!==void 0?s:!1,this.activePointers=r}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 zt={SINGLECLICK:"singleclick",CLICK:ht.CLICK,DBLCLICK:ht.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},oh={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown"};class o_ extends to{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=e===void 0?1:e,this.down_=null;const n=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=n,this.pointerdownListenerKey_=Ct(n,oh.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=Ct(n,oh.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(ht.TOUCHMOVE,this.boundHandleTouchMove_,iu?{passive:!1}:!1)}emulateClick_(t){let e=new on(zt.CLICK,this.map_,t);this.dispatchEvent(e),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new on(zt.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const n=new on(zt.SINGLECLICK,this.map_,t);this.dispatchEvent(n)},250)}updateActivePointers_(t){const e=t,n=e.pointerId;if(e.type==zt.POINTERUP||e.type==zt.POINTERCANCEL){delete this.trackedTouches_[n];for(const s in this.trackedTouches_)if(this.trackedTouches_[s].target!==e.target){delete this.trackedTouches_[s];break}}else(e.type==zt.POINTERDOWN||e.type==zt.POINTERMOVE)&&(this.trackedTouches_[n]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new on(zt.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(Mt),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 on(zt.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),this.dragListenerKeys_.length===0){const n=this.map_.getOwnerDocument();this.dragListenerKeys_.push(Ct(n,zt.POINTERMOVE,this.handlePointerMove_,this),Ct(n,zt.POINTERUP,this.handlePointerUp_,this),Ct(this.element_,zt.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(Ct(this.element_.getRootNode(),zt.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new on(zt.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 on(zt.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_&&(Mt(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(ht.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(Mt(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(Mt),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const rn={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},ee={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},ea=1/0;class r_{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,Qs(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,n=t[0];t.length==1?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const s=this.keyFunction_(n);return delete this.queuedElements_[s],n}enqueue(t){pt(!(this.keyFunction_(t)in this.queuedElements_),31);const e=this.priorityFunction_(t);return e!=ea?(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(t){return t*2+1}getRightChildIndex_(t){return t*2+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return this.elements_.length===0}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,n=this.priorities_,s=e.length,o=e[t],r=n[t],a=t;for(;t<s>>1;){const c=this.getLeftChildIndex_(t),h=this.getRightChildIndex_(t),l=h<s&&n[h]<n[c]?h:c;e[t]=e[l],n[t]=n[l],t=l}e[t]=o,n[t]=r,this.siftDown_(a,t)}siftDown_(t,e){const n=this.elements_,s=this.priorities_,o=n[e],r=s[e];for(;e>t;){const a=this.getParentIndex_(e);if(s[a]>r)n[e]=n[a],s[e]=s[a],e=a;else break}n[e]=o,s[e]=r}reprioritize(){const t=this.priorityFunction_,e=this.elements_,n=this.priorities_;let s=0;const o=e.length;let r,a,c;for(a=0;a<o;++a)r=e[a],c=t(r),c==ea?delete this.queuedElements_[this.keyFunction_(r)]:(n[s]=c,e[s++]=r);e.length=s,n.length=s,this.heapify_()}}class Ld extends r_{constructor(t,e){super(function(n){return t.apply(null,n)},function(n){return n[0].getKey()}),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);return e&&t[0].addEventListener(ht.CHANGE,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,n=e.getState();if(n===rt.LOADED||n===rt.ERROR||n===rt.EMPTY){n!==rt.ERROR&&e.removeEventListener(ht.CHANGE,this.boundHandleTileChange_);const s=e.getKey();s in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[s],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let n=0,s,o,r;for(;this.tilesLoading_<t&&n<e&&this.getCount()>0;)o=this.dequeue()[0],r=o.getKey(),s=o.getState(),s===rt.IDLE&&!(r in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[r]=!0,++this.tilesLoading_,++n,o.load())}}function a_(i,t,e,n,s){if(!i||!(e in i.wantedTiles)||!i.wantedTiles[e][t.getKey()])return ea;const o=i.viewState.center,r=n[0]-o[0],a=n[1]-o[1];return 65536*Math.log(s)+Math.sqrt(r*r+a*a)/s}class rh extends Ke{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(){zc(this.element),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&zc(this.element);for(let e=0,n=this.listenerKeys.length;e<n;++e)Mt(this.listenerKeys[e]);this.listenerKeys.length=0,this.map_=t,t&&((this.target_?this.target_:t.getOverlayContainerStopEvent()).appendChild(this.element),this.render!==hs&&this.listenerKeys.push(Ct(t,rn.POSTRENDER,this.render,this)),t.render())}render(t){}setTarget(t){this.target_=typeof t=="string"?document.getElementById(t):t}}class c_ extends rh{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);const e=t.className!==void 0?t.className:"ol-attribution",n=t.tipLabel!==void 0?t.tipLabel:"Attributions",s=t.expandClassName!==void 0?t.expandClassName:e+"-expand",o=t.collapseLabel!==void 0?t.collapseLabel:"›",r=t.collapseClassName!==void 0?t.collapseClassName:e+"-collapse";typeof o=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=o,this.collapseLabel_.className=r):this.collapseLabel_=o;const a=t.label!==void 0?t.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=s):this.label_=a;const c=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=n,this.toggleButton_.appendChild(c),this.toggleButton_.addEventListener(ht.CLICK,this.handleClick_.bind(this),!1);const h=e+" "+Br+" "+Nc+(this.collapsed_&&this.collapsible_?" "+$u:"")+(this.collapsible_?"":" ol-uncollapsible"),l=this.element;l.className=h,l.appendChild(this.toggleButton_),l.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=Array.from(new Set(this.getMap().getAllLayers().flatMap(s=>s.getAttributions(t)))),n=!this.getMap().getAllLayers().some(s=>s.getSource()&&s.getSource().getAttributionsCollapsible()===!1);return this.overrideCollapsible_||this.setCollapsible(n),e}updateElement_(t){if(!t){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const e=this.collectSourceAttributions_(t),n=e.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!Vi(e,this.renderedAttributions_)){Ym(this.ulElement_);for(let s=0,o=e.length;s<o;++s){const r=document.createElement("li");r.innerHTML=e[s],this.ulElement_.appendChild(r)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle($u),this.collapsed_?Xu(this.collapseLabel_,this.label_):Xu(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 h_ extends rh{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target});const e=t.className!==void 0?t.className:"ol-rotate",n=t.label!==void 0?t.label:"⇧",s=t.compassClassName!==void 0?t.compassClassName:"ol-compass";this.label_=null,typeof n=="string"?(this.label_=document.createElement("span"),this.label_.className=s,this.label_.textContent=n):(this.label_=n,this.label_.classList.add(s));const o=t.tipLabel?t.tipLabel:"Reset rotation",r=document.createElement("button");r.className=e+"-reset",r.setAttribute("type","button"),r.title=o,r.appendChild(this.label_),r.addEventListener(ht.CLICK,this.handleClick_.bind(this),!1);const a=e+" "+Br+" "+Nc,c=this.element;c.className=a,c.appendChild(r),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(Vr)}handleClick_(t){t.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const e=this.getMap().getView();if(!e)return;const n=e.getRotation();n!==void 0&&(this.duration_>0&&n%(2*Math.PI)!==0?e.animate({rotation:0,duration:this.duration_,easing:Pn}):e.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const n=e.viewState.rotation;if(n!=this.rotation_){const s="rotate("+n+"rad)";if(this.autoHide_){const o=this.element.classList.contains(Vr);!o&&n===0?this.element.classList.add(Vr):o&&n!==0&&this.element.classList.remove(Vr)}this.label_.style.transform=s}this.rotation_=n}}class l_ extends rh{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=t.className!==void 0?t.className:"ol-zoom",n=t.delta!==void 0?t.delta:1,s=t.zoomInClassName!==void 0?t.zoomInClassName:e+"-in",o=t.zoomOutClassName!==void 0?t.zoomOutClassName:e+"-out",r=t.zoomInLabel!==void 0?t.zoomInLabel:"+",a=t.zoomOutLabel!==void 0?t.zoomOutLabel:"–",c=t.zoomInTipLabel!==void 0?t.zoomInTipLabel:"Zoom in",h=t.zoomOutTipLabel!==void 0?t.zoomOutTipLabel:"Zoom out",l=document.createElement("button");l.className=s,l.setAttribute("type","button"),l.title=c,l.appendChild(typeof r=="string"?document.createTextNode(r):r),l.addEventListener(ht.CLICK,this.handleClick_.bind(this,n),!1);const u=document.createElement("button");u.className=o,u.setAttribute("type","button"),u.title=h,u.appendChild(typeof a=="string"?document.createTextNode(a):a),u.addEventListener(ht.CLICK,this.handleClick_.bind(this,-n),!1);const f=e+" "+Br+" "+Nc,g=this.element;g.className=f,g.appendChild(l),g.appendChild(u),this.duration_=t.duration!==void 0?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const n=this.getMap().getView();if(!n)return;const s=n.getZoom();if(s!==void 0){const o=n.getConstrainedZoom(s+t);this.duration_>0?(n.getAnimating()&&n.cancelAnimations(),n.animate({zoom:o,duration:this.duration_,easing:Pn})):n.setZoom(o)}}}function zd(i){i=i||{};const t=new Qe;return(i.zoom!==void 0?i.zoom:!0)&&t.push(new l_(i.zoomOptions)),(i.rotate!==void 0?i.rotate:!0)&&t.push(new h_(i.rotateOptions)),(i.attribution!==void 0?i.attribution:!0)&&t.push(new c_(i.attributionOptions)),t}const Nd={ACTIVE:"active"};class Po extends Ke{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(Nd.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(Nd.ACTIVE,t)}setMap(t){this.map_=t}}function u_(i,t,e){const n=i.getCenterInternal();if(n){const s=[n[0]+t[0],n[1]+t[1]];i.animateInternal({duration:e!==void 0?e:250,easing:Mp,center:i.getConstrainedCenter(s)})}}function ah(i,t,e,n){const s=i.getZoom();if(s===void 0)return;const o=i.getConstrainedZoom(s+t),r=i.getResolutionForZoom(o);i.getAnimating()&&i.cancelAnimations(),i.animate({resolution:r,anchor:e,duration:n!==void 0?n:250,easing:Pn})}class d_ extends Po{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==zt.DBLCLICK){const n=t.originalEvent,s=t.map,o=t.coordinate,r=n.shiftKey?-this.delta_:this.delta_,a=s.getView();ah(a,r,o,this.duration_),n.preventDefault(),e=!0}return!e}}class Oo extends Po{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==zt.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==zt.POINTERUP){const n=this.handleUpEvent(t);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(t.type==zt.POINTERDOWN){const n=this.handleDownEvent(t);this.handlingDownUpSequence=n,e=this.stopDown(n)}else t.type==zt.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 ch(i){const t=i.length;let e=0,n=0;for(let s=0;s<t;s++)e+=i[s].clientX,n+=i[s].clientY;return{clientX:e/t,clientY:n/t}}function hh(i){const t=arguments;return function(e){let n=!0;for(let s=0,o=t.length;s<o&&(n=n&&t[s](e),!!n);++s);return n}}const f_=function(i){const t=i.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},g_=function(i){const t=i.map.getTargetElement(),e=i.map.getOwnerDocument().activeElement;return t.contains(e)},Ud=function(i){return i.map.getTargetElement().hasAttribute("tabindex")?g_(i):!0},p_=Ks,jd=function(i){const t=i.originalEvent;return t.button==0&&!(kp&&tu&&t.ctrlKey)},kd=function(i){const t=i.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},m_=function(i){const t=i.originalEvent;return tu?t.metaKey:t.ctrlKey},__=function(i){const t=i.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Wd=function(i){const t=i.originalEvent,e=t.target.tagName;return e!=="INPUT"&&e!=="SELECT"&&e!=="TEXTAREA"&&!t.target.isContentEditable},lh=function(i){const t=i.originalEvent;return pt(t!==void 0,56),t.pointerType=="mouse"},y_=function(i){const t=i.originalEvent;return pt(t!==void 0,56),t.isPrimary&&t.button===0};class w_ extends Oo{constructor(t){super({stopDown:Rr}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:hh(kd,y_);this.condition_=t.onFocusOnly?hh(Ud,e):e,this.noKinetic_=!1}handleDragEvent(t){const e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());const n=this.targetPointers,s=e.getEventPixel(ch(n));if(n.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(s[0],s[1]),this.lastCentroid){const o=[this.lastCentroid[0]-s[0],s[1]-this.lastCentroid[1]],a=t.map.getView();ym(o,a.getResolution()),bc(o,a.getRotation()),a.adjustCenterInternal(o)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=s,this.lastPointersCount_=n.length,t.originalEvent.preventDefault()}handleUpEvent(t){const e=t.map,n=e.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const s=this.kinetic_.getDistance(),o=this.kinetic_.getAngle(),r=n.getCenterInternal(),a=e.getPixelFromCoordinateInternal(r),c=e.getCoordinateFromPixelInternal([a[0]-s*Math.cos(o),a[1]-s*Math.sin(o)]);n.animateInternal({center:n.getConstrainedCenter(c),duration:500,easing:Pn})}return this.panning_&&(this.panning_=!1,n.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(t){if(this.targetPointers.length>0&&this.condition_(t)){const n=t.map.getView();return this.lastCentroid=null,n.getAnimating()&&n.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}}class v_ extends Oo{constructor(t){t=t||{},super({stopDown:Rr}),this.condition_=t.condition?t.condition:f_,this.lastAngle_=void 0,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){if(!lh(t))return;const e=t.map,n=e.getView();if(n.getConstraints().rotation===Vc)return;const s=e.getSize(),o=t.pixel,r=Math.atan2(s[1]/2-o[1],o[0]-s[0]/2);if(this.lastAngle_!==void 0){const a=r-this.lastAngle_;n.adjustRotationInternal(-a)}this.lastAngle_=r}handleUpEvent(t){return lh(t)?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){return lh(t)&&jd(t)&&this.condition_(t)?(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}class E_ extends xr{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,n="px",s=this.element_.style;s.left=Math.min(t[0],e[0])+n,s.top=Math.min(t[1],e[1])+n,s.width=Math.abs(e[0]-t[0])+n,s.height=Math.abs(e[1]-t[1])+n}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){const t=this.startPixel_,e=this.endPixel_,s=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);s[4]=s[0].slice(),this.geometry_?this.geometry_.setCoordinates([s]):this.geometry_=new ps([s])}getGeometry(){return this.geometry_}}const ia={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class uh extends We{constructor(t,e,n){super(t),this.coordinate=e,this.mapBrowserEvent=n}}class C_ extends Oo{constructor(t){super(),this.on,this.once,this.un,t=t||{},this.box_=new E_(t.className||"ol-dragbox"),this.minArea_=t.minArea!==void 0?t.minArea:64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition?t.condition:jd,this.boxEndCondition_=t.boxEndCondition?t.boxEndCondition:this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,n){const s=n[0]-e[0],o=n[1]-e[1];return s*s+o*o>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new uh(ia.BOXDRAG,t.coordinate,t))}handleUpEvent(t){this.box_.setMap(null);const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new uh(e?ia.BOXEND:ia.BOXCANCEL,t.coordinate,t)),!1}handleDownEvent(t){return this.condition_(t)?(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new uh(ia.BOXSTART,t.coordinate,t)),!0):!1}onBoxEnd(t){}}class b_ extends C_{constructor(t){t=t||{};const e=t.condition?t.condition:__;super({condition:e,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=t.duration!==void 0?t.duration:200,this.out_=t.out!==void 0?t.out:!1}onBoxEnd(t){const n=this.getMap().getView();let s=this.getGeometry();if(this.out_){const o=n.rotatedExtentForGeometry(s),r=n.getResolutionForExtentInternal(o),a=n.getResolution()/r;s=s.clone(),s.scale(a*a)}n.fitInternal(s,{duration:this.duration_,easing:Pn})}}const jn={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};class x_ extends Po{constructor(t){super(),t=t||{},this.defaultCondition_=function(e){return kd(e)&&Wd(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==ht.KEYDOWN){const n=t.originalEvent,s=n.key;if(this.condition_(t)&&(s==jn.DOWN||s==jn.LEFT||s==jn.RIGHT||s==jn.UP)){const r=t.map.getView(),a=r.getResolution()*this.pixelDelta_;let c=0,h=0;s==jn.DOWN?h=-a:s==jn.LEFT?c=-a:s==jn.RIGHT?c=a:h=a;const l=[c,h];bc(l,r.getRotation()),u_(r,l,this.duration_),n.preventDefault(),e=!0}}return!e}}class S_ extends Po{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(e){return!m_(e)&&Wd(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==ht.KEYDOWN||t.type==ht.KEYPRESS){const n=t.originalEvent,s=n.key;if(this.condition_(t)&&(s==="+"||s==="-")){const o=t.map,r=s==="+"?this.delta_:-this.delta_,a=o.getView();ah(a,r,void 0,this.duration_),n.preventDefault(),e=!0}}return!e}}class R_ extends Po{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:p_;this.condition_=t.onFocusOnly?hh(Ud,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();if(!t)return;t.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_)}handleEvent(t){if(!this.condition_(t)||t.type!==ht.WHEEL)return!0;const n=t.map,s=t.originalEvent;s.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.coordinate);let o;if(t.type==ht.WHEEL&&(o=s.deltaY,jp&&s.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(o/=eu),s.deltaMode===WheelEvent.DOM_DELTA_LINE&&(o*=40)),o===0)return!1;this.lastDelta_=o;const r=Date.now();this.startTime_===void 0&&(this.startTime_=r),(!this.mode_||r-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(o)<4?"trackpad":"wheel");const a=n.getView();if(this.mode_==="trackpad"&&!(a.getConstrainResolution()||this.constrainResolution_))return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(a.getAnimating()&&a.cancelAnimations(),a.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),a.adjustZoom(-o/this.deltaPerZoom_,this.lastAnchor_),this.startTime_=r,!1;this.totalDelta_+=o;const c=Math.max(this.timeout_-(r-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,n),c),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let n=-qt(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),ah(e,n,this.lastAnchor_,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}}class P_ extends Oo{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=Rr),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=t.threshold!==void 0?t.threshold:.3,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){let e=0;const n=this.targetPointers[0],s=this.targetPointers[1],o=Math.atan2(s.clientY-n.clientY,s.clientX-n.clientX);if(this.lastAngle_!==void 0){const c=o-this.lastAngle_;this.rotationDelta_+=c,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=c}this.lastAngle_=o;const r=t.map,a=r.getView();a.getConstraints().rotation!==Vc&&(this.anchor_=r.getCoordinateFromPixelInternal(r.getEventPixel(ch(this.targetPointers))),this.rotating_&&(r.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 O_ extends Oo{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=Rr),super(e),this.anchor_=null,this.duration_=t.duration!==void 0?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const n=this.targetPointers[0],s=this.targetPointers[1],o=n.clientX-s.clientX,r=n.clientY-s.clientY,a=Math.sqrt(o*o+r*r);this.lastDistance_!==void 0&&(e=this.lastDistance_/a),this.lastDistance_=a;const c=t.map,h=c.getView();e!=1&&(this.lastScaleDelta_=e),this.anchor_=c.getCoordinateFromPixelInternal(c.getEventPixel(ch(this.targetPointers))),c.render(),h.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const n=t.map.getView(),s=this.lastScaleDelta_>1?1:-1;return n.endInteraction(this.duration_,s),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}function qd(i){i=i||{};const t=new Qe,e=new e_(-.005,.05,100);return(i.altShiftDragRotate!==void 0?i.altShiftDragRotate:!0)&&t.push(new v_),(i.doubleClickZoom!==void 0?i.doubleClickZoom:!0)&&t.push(new d_({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan!==void 0?i.dragPan:!0)&&t.push(new w_({onFocusOnly:i.onFocusOnly,kinetic:e})),(i.pinchRotate!==void 0?i.pinchRotate:!0)&&t.push(new P_),(i.pinchZoom!==void 0?i.pinchZoom:!0)&&t.push(new O_({duration:i.zoomDuration})),(i.keyboard!==void 0?i.keyboard:!0)&&(t.push(new x_),t.push(new S_({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom!==void 0?i.mouseWheelZoom:!0)&&t.push(new R_({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom!==void 0?i.shiftDragZoom:!0)&&t.push(new b_({duration:i.zoomDuration})),t}function Gd(i){if(i instanceof yo){i.setMapInternal(null);return}i instanceof sn&&i.getLayers().forEach(Gd)}function Vd(i,t){if(i instanceof yo){i.setMapInternal(t);return}if(i instanceof sn){const e=i.getLayers().getArray();for(let n=0,s=e.length;n<s;++n)Vd(e[n],t)}}let I_=class extends Ke{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=T_(t);this.renderComplete_,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:eu,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=be(),this.pixelToCoordinateTransform_=be(),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||zd(),this.interactions=e.interactions||qd({onFocusOnly:!0}),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new Ld(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(ee.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(ee.VIEW,this.handleViewChanged_),this.addChangeListener(ee.SIZE,this.handleSizeChanged_),this.addChangeListener(ee.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const n=this;t.view&&!(t.view instanceof ni)&&t.view.then(function(s){n.setView(new ni(s))}),this.controls.addEventListener(ue.ADD,s=>{s.element.setMap(this)}),this.controls.addEventListener(ue.REMOVE,s=>{s.element.setMap(null)}),this.interactions.addEventListener(ue.ADD,s=>{s.element.setMap(this)}),this.interactions.addEventListener(ue.REMOVE,s=>{s.element.setMap(null)}),this.overlays_.addEventListener(ue.ADD,s=>{this.addOverlayInternal_(s.element)}),this.overlays_.addEventListener(ue.REMOVE,s=>{const o=s.element.getId();o!==void 0&&delete this.overlayIdIndex_[o.toString()],s.element.setMap(null)}),this.controls.forEach(s=>{s.setMap(this)}),this.interactions.forEach(s=>{s.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){Vd(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,n){if(!this.frameState_||!this.renderer_)return;const s=this.getCoordinateFromPixelInternal(t);n=n!==void 0?n:{};const o=n.hitTolerance!==void 0?n.hitTolerance:0,r=n.layerFilter!==void 0?n.layerFilter:Ks,a=n.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(s,this.frameState_,o,a,e,null,r,null)}getFeaturesAtPixel(t,e){const n=[];return this.forEachFeatureAtPixel(t,function(s){n.push(s)},e),n}getAllLayers(){const t=[];function e(n){n.forEach(function(s){s instanceof sn?e(s.getLayers()):t.push(s)})}return e(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const n=this.getCoordinateFromPixelInternal(t);e=e!==void 0?e:{};const s=e.layerFilter!==void 0?e.layerFilter:Ks,o=e.hitTolerance!==void 0?e.hitTolerance:0,r=e.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(n,this.frameState_,o,r,s,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const n=this.viewport_.getBoundingClientRect(),s=this.getSize(),o=n.width/s[0],r=n.height/s[1],a="changedTouches"in t?t.changedTouches[0]:t;return[(a.clientX-n.left)/o,(a.clientY-n.top)/r]}getTarget(){return this.get(ee.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return Tc(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?Ut(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(ee.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof Qe){e.setLayers(t);return}const n=e.getLayers();n.clear(),n.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,n=t.length;e<n;++e){const s=t[e];if(!s.visible)continue;const o=s.layer.getRenderer();if(o&&!o.ready)return!0;const r=s.layer.getSource();if(r&&r.loading)return!0}return!1}getPixelFromCoordinate(t){const e=mi(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?Ut(e.coordinateToPixelTransform,t.slice(0,2)):null}getRenderer(){return this.renderer_}getSize(){return this.get(ee.SIZE)}getView(){return this.get(ee.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,n,s){return a_(this.frameState_,t,e,n,s)}handleBrowserEvent(t,e){e=e||t.type;const n=new on(e,this,t);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,n=e.type;if(n===oh.POINTERDOWN||n===ht.WHEEL||n===ht.KEYDOWN){const s=this.getOwnerDocument(),o=this.viewport_.getRootNode?this.viewport_.getRootNode():s,r=e.target;if(this.overlayContainerStopEvent_.contains(r)||!(o===s?s.documentElement:o).contains(r))return}if(t.frameState=this.frameState_,this.dispatchEvent(t)!==!1){const s=this.getInteractions().getArray().slice();for(let o=s.length-1;o>=0;o--){const r=s[o];if(r.getMap()!==this||!r.getActive()||!this.getTargetElement())continue;if(!r.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let s=this.maxTilesLoading_,o=s;if(t){const r=t.viewHints;if(r[Bt.ANIMATING]||r[Bt.INTERACTING]){const a=Date.now()-t.time>8;s=a?0:8,o=a?0:2}}e.getTilesLoading()<s&&(e.reprioritize(),e.loadMoreTiles(s,o))}t&&this.renderer_&&!t.animate&&(this.renderComplete_===!0?(this.hasListener(ti.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(ti.RENDERCOMPLETE,t),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new bs(rn.LOADEND,this,t)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new bs(rn.LOADSTART,this,t))));const n=this.postRenderFunctions_;for(let s=0,o=n.length;s<o;++s)n[s](this,t);n.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let n=0,s=this.targetChangeHandlerKeys_.length;n<s;++n)Mt(this.targetChangeHandlerKeys_[n]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(ht.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(ht.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,zc(this.viewport_)}if(this.targetElement_){this.resizeObserver_.unobserve(this.targetElement_);const n=this.targetElement_.getRootNode();n instanceof ShadowRoot&&this.resizeObserver_.unobserve(n.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 s_(this)),this.mapBrowserEventHandler_=new o_(this,this.moveTolerance_);for(const o in zt)this.mapBrowserEventHandler_.addEventListener(zt[o],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(ht.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(ht.WHEEL,this.boundHandleBrowserEvent_,iu?{passive:!1}:!1);const n=this.keyboardEventTarget_?this.keyboardEventTarget_:e;this.targetChangeHandlerKeys_=[Ct(n,ht.KEYDOWN,this.handleBrowserEvent,this),Ct(n,ht.KEYPRESS,this.handleBrowserEvent,this)];const s=e.getRootNode();s instanceof ShadowRoot&&this.resizeObserver_.observe(s.host),this.resizeObserver_.observe(e)}this.updateSize()}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(Mt(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(Mt(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(),this.viewPropertyListenerKey_=Ct(t,cs.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=Ct(t,ht.CHANGE,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(Mt),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new nn("addlayer",t)),this.layerGroupPropertyListenerKeys_=[Ct(t,cs.PROPERTYCHANGE,this.render,this),Ct(t,ht.CHANGE,this.render,this),Ct(t,"addlayer",this.handleLayerAdd_,this),Ct(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(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,n=t.length;e<n;++e){const s=t[e].layer;s.hasRenderer()&&s.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}flushDeclutterItems(){const t=this.frameState_;t&&this.renderer_.flushDeclutterItems(t)}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){return this.getLayerGroup().getLayers().remove(t)}handleLayerRemove_(t){Gd(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),n=this.getView(),s=this.frameState_;let o=null;if(e!==void 0&&Gu(e)&&n&&n.isDef()){const r=n.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=n.getState();if(o={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutterTree:null,extent:_c(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:r,wantedTiles:{},mapId:St(this),renderTargets:{}},a.nextCenter&&a.nextResolution){const c=isNaN(a.nextRotation)?a.rotation:a.nextRotation;o.nextExtent=_c(a.nextCenter,a.nextResolution,c,e)}}this.frameState_=o,this.renderer_.renderFrame(o),o&&(o.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,o.postRenderFunctions),s&&(!this.previousExtent_||!Xi(this.previousExtent_)&&!Yi(o.extent,this.previousExtent_))&&(this.dispatchEvent(new bs(rn.MOVESTART,this,s)),this.previousExtent_=oo(this.previousExtent_)),this.previousExtent_&&!o.viewHints[Bt.ANIMATING]&&!o.viewHints[Bt.INTERACTING]&&!Yi(o.extent,this.previousExtent_)&&(this.dispatchEvent(new bs(rn.MOVEEND,this,o)),ou(o.extent,this.previousExtent_))),this.dispatchEvent(new bs(rn.POSTRENDER,this,o)),this.renderComplete_=this.hasListener(rn.LOADSTART)||this.hasListener(rn.LOADEND)||this.hasListener(ti.RENDERCOMPLETE)?!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady():void 0,this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new nn("removelayer",e)),this.set(ee.LAYERGROUP,t)}setSize(t){this.set(ee.SIZE,t)}setTarget(t){this.set(ee.TARGET,t)}setView(t){if(!t||t instanceof ni){this.set(ee.VIEW,t);return}this.set(ee.VIEW,new ni);const e=this;t.then(function(n){e.setView(new ni(n))})}updateSize(){const t=this.getTargetElement();let e;if(t){const s=getComputedStyle(t),o=t.offsetWidth-parseFloat(s.borderLeftWidth)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)-parseFloat(s.borderRightWidth),r=t.offsetHeight-parseFloat(s.borderTopWidth)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)-parseFloat(s.borderBottomWidth);!isNaN(o)&&!isNaN(r)&&(e=[o,r],!Gu(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&pu("No map visible because the map container's width or height are 0."))}const n=this.getSize();e&&(!n||!Vi(e,n))&&(this.setSize(e),this.updateViewportSize_())}updateViewportSize_(){const t=this.getView();if(t){let e;const n=getComputedStyle(this.viewport_);n.width&&n.height&&(e=[parseInt(n.width,10),parseInt(n.height,10)]),t.setViewportSize(e)}}};function T_(i){let t=null;i.keyboardEventTarget!==void 0&&(t=typeof i.keyboardEventTarget=="string"?document.getElementById(i.keyboardEventTarget):i.keyboardEventTarget);const e={},n=i.layers&&typeof i.layers.getLayers=="function"?i.layers:new sn({layers:i.layers});e[ee.LAYERGROUP]=n,e[ee.TARGET]=i.target,e[ee.VIEW]=i.view instanceof ni?i.view:new ni;let s;i.controls!==void 0&&(Array.isArray(i.controls)?s=new Qe(i.controls.slice()):(pt(typeof i.controls.getArray=="function",47),s=i.controls));let o;i.interactions!==void 0&&(Array.isArray(i.interactions)?o=new Qe(i.interactions.slice()):(pt(typeof i.interactions.getArray=="function",48),o=i.interactions));let r;return i.overlays!==void 0?Array.isArray(i.overlays)?r=new Qe(i.overlays.slice()):(pt(typeof i.overlays.getArray=="function",49),r=i.overlays):r=new Qe,{controls:s,interactions:o,keyboardEventTarget:t,overlays:r,values:e}}class A_{constructor(t){this.highWaterMark=t!==void 0?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.pop()}clear(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const n=this.entries_[t];return pt(n!==void 0,15),n===this.newest_||(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n),n.value_}remove(t){const e=this.entries_[t];return pt(e!==void 0,15),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e=0,n;for(n=this.newest_;n;n=n.older)t[e++]=n.key_;return t}getValues(){const t=new Array(this.count_);let e=0,n;for(n=this.newest_;n;n=n.older)t[e++]=n.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){if(this.containsKey(t))return this.entries_[t].value_}pop(){const t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){pt(!(t in this.entries_),16);const n={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[t]=n,++this.count_}setSize(t){this.highWaterMark=t}}function Bd(i,t,e,n){return n!==void 0?(n[0]=i,n[1]=t,n[2]=e,n):[i,t,e]}function na(i,t,e){return i+"/"+t+"/"+e}function Yd(i){return na(i[0],i[1],i[2])}function M_(i){return i.split("/").map(Number)}function Hd(i){return(i[1]<<i[0])+i[2]}function D_(i,t){const e=i[0],n=i[1],s=i[2];if(t.getMinZoom()>e||e>t.getMaxZoom())return!1;const o=t.getFullTileRange(e);return o?o.containsXY(n,s):!0}class Xd extends A_{clear(){for(;this.getCount()>0;)this.pop().release();super.clear()}expireCache(t){for(;this.canExpireCache()&&!(this.peekLast().getKey()in t);)this.pop().release()}pruneExceptNewestZ(){if(this.getCount()===0)return;const t=this.peekFirstKey(),n=M_(t)[0];this.forEach(s=>{s.tileCoord[0]!==n&&(this.remove(Yd(s.tileCoord)),s.release())})}}class dh{constructor(t,e,n,s){this.minX=t,this.maxX=e,this.minY=n,this.maxY=s}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function xs(i,t,e,n,s){return s!==void 0?(s.minX=i,s.maxX=t,s.minY=e,s.maxY=n,s):new dh(i,t,e,n)}async function $d(i,t=128,e=128,n="map",s=1){return new Promise((o,r)=>{i.renderSync();try{const a=i.getSize()||[t,e],c=document.createElement("canvas"),h=a[0]*s,l=a[1]*s;c.width=h,c.height=l;const u=c.getContext("2d",{willReadFrequently:!0});if(!u)throw new Error("Failed to create canvas context");Array.from(i.getViewport().querySelectorAll(".ol-layer canvas, canvas.ol-layer")).filter(_=>{if(!(_ instanceof HTMLCanvasElement)||_.width===0)return!1;try{return _.toDataURL("image/png"),!0}catch{return console.warn("跳过跨域图层:",_),!1}}).forEach(_=>{var b;const y=parseFloat(_.style.opacity||"1");u.globalAlpha=y;let w=[1,0,0,1,0,0];const E=_.style.transform;if(E){const[P,I,M,D,L,z]=((b=E.match(/^matrix\(([^)]+)\)$/))==null?void 0:b[1].split(",").map(Number))||[1,0,0,1,0,0];u.setTransform({a:P,b:I,c:M,d:D,e:L,f:z})}u.drawImage(_,0,0,h,l)}),u.globalAlpha=1,u.setTransform(1,0,0,1,0,0);const g=c.toDataURL("image/png");o(g)}catch(a){r(a)}})}function Zd(i,t){const{center:e,orbitPeriod:n,heading:s=0}=t,o=i.getView(),a=(f=>f*Math.PI/180)(s);let c,h,l=!0;const u=f=>{h||(h=f);const _=(f-h)%n/n,y=2*Math.PI*_+a;o.setRotation(-y),i.render(),l&&(c=requestAnimationFrame(u))};return c=requestAnimationFrame(u),{stop(){l=!1,cancelAnimationFrame(c),o.setRotation(0)}}}function F_(i,t){const e=_t(t),n=new Je({geometry:new Ge(e)});n.setStyle(new Xt({image:new ii({radius:6,fill:new de({color:"red"}),stroke:new Se({color:"white",width:2})}),text:new _o({text:"中心点可视化-测试后删除",font:"14px sans-serif",fill:new de({color:"black"}),stroke:new Se({color:"white",width:3}),offsetY:-15})}));const s=new oi({source:new Si({features:[n]})});i.addLayer(s)}class Kd extends d.Destroyable{constructor(e,n,s){super();R(this,"keysPressed",{w:!1,a:!1,s:!1,d:!1});R(this,"animationId",0);R(this,"view");R(this,"updatePosition",()=>{const e=this.view.getCenter();if(!e)return;const n=this.view.getZoom()??10,s=1e3/Math.pow(2,n-10);let[o,r]=e;this.keysPressed.w&&(r+=s),this.keysPressed.s&&(r-=s),this.keysPressed.a&&(o-=s),this.keysPressed.d&&(o+=s),this.view.setCenter([o,r]),this.animationId=requestAnimationFrame(this.updatePosition)});this.map=n,this.view=n.getView(),this.view.setCenter(_t(s));const o=c=>{c.key in this.keysPressed&&(this.keysPressed[c.key]=!0)},r=c=>{c.key in this.keysPressed&&(this.keysPressed[c.key]=!1)},a=c=>{c.preventDefault();const h=this.view.getZoom()??10,l=c.deltaY>0?-1:1;this.view.setZoom(h+l)};e.addEventListener("keydown",o),e.addEventListener("keyup",r),n.getTargetElement().addEventListener("wheel",a,{passive:!1}),this.d(()=>e.removeEventListener("keydown",o)),this.d(()=>e.removeEventListener("keyup",r)),this.d(()=>n.getTargetElement().removeEventListener("wheel",a)),this.animationId=requestAnimationFrame(this.updatePosition),this.d(()=>cancelAnimationFrame(this.animationId))}}function L_(i){const e=Math.PI/3,n=256,s=i*2*Math.tan(e/2)/i,o=Math.log2(2*Math.PI*6378137/(s*n));return parseFloat(o.toFixed(3))}function Io(i){return 6378137/Math.pow(2,i-5)}function kn(i){const e=Math.log2(6378137/i)+5+0;return Math.min(28,Math.max(0,e))}class Qd extends d.Destroyable{constructor(e){super();R(this,"lastTime",performance.now());R(this,"frameCount",0);R(this,"currentFPS",0);R(this,"map");R(this,"calculateFPS",()=>{const e=performance.now();this.frameCount++,e-this.lastTime>=1e3&&(this.currentFPS=Math.round(this.frameCount*1e3/(e-this.lastTime)),this.frameCount=0,this.lastTime=e)});this.map=e,this.map.on("postrender",this.calculateFPS),this.d(()=>{this.map.un("postrender",this.calculateFPS)})}getFPS(){return this.currentFPS}}const Jd=[0,-90,0];function tf(i,t){const e=i.viewer;if(!e)return;const n=e.getView(),{position:s,rotation:o,duration:r=1e3,hdelta:a,pdelta:c,cancelCallback:h}=t;if(!s)return;const[l,u,f]=s,g=_t([l,u]),_=(kn==null?void 0:kn(f))??n.getZoom(),w=(((o==null?void 0:o[0])??0)+(a??0))*Math.PI/180,E={center:g,zoom:_,rotation:-w,duration:r};try{return n.animate(E,()=>{}),Promise.resolve(!0)}catch{return h==null||h(),Promise.resolve(!1)}}function Ri(i,t,e,n,s,o){return(i==null?void 0:i.viewer)&&tf(i,{position:t,rotation:n,duration:s&&s*1e3,cancelCallback:o})}function sa(i){const t=i.map(e=>_t([e[0],e[1]]));return Ir(t)}const To=(i,t,e=1,n=350)=>{i.getView().fit(t,{duration:e*1e3,padding:Array.isArray(n)?n:[n,n,n,n]})},z_=(i,t,e=1,n=350)=>{const s=sa(t);To(i,s,e,n)},fh=(i,t,e=1,n=350)=>{const s=_t([t[0],t[1]]),o=Ir([s]);To(i,o,e,n)},N_=(i,t,e)=>{};function ef(i,t){const e=i.viewer;if(!e)throw new Error("viewer.map is undefined");const n=e.getView(),s=n.getCenter();if(!s)throw new Error("view center is undefined");const o=n.getZoom(),r=(Io==null?void 0:Io(o??0))??0;return[s[0],s[1],r]}class U_ extends d.Destroyable{constructor(e,n){super();R(this,"_map");R(this,"_view");R(this,"_enabled",!0);R(this,"_keys",[]);R(this,"_changed",new d.Event);R(this,"_options");R(this,"_rafPending",!1);R(this,"_rafId",null);R(this,"_lastEmit",0);if(this._options={emitImmediately:!0,usePostRender:!1,throttleMs:0,useRaf:!0,...n},e instanceof Rn.Map){this._map=e;const s=this._map.getView();if(!s)throw new Error("OlViewChanged: map.getView() is undefined");this._view=s}else this._view=e;this._attach(),this.dispose(()=>this._detach()),this._options.emitImmediately&&this._emit()}get changed(){return this._changed}get enabled(){return this._enabled}set enabled(e){this._enabled!==e&&(this._enabled=e,e&&this._emit())}attachMap(e){this._map!==e&&(this._detach(),this._map=e,this._attach(),this._emit())}_on(e,n,s){const o=e.on(n,s);return this._keys.push(o),this.dispose(()=>gi(o)),o}_attach(){this._on(this._view,"change:center",()=>this._scheduleEmit()),this._on(this._view,"change:resolution",()=>this._scheduleEmit()),this._on(this._view,"change:rotation",()=>this._scheduleEmit()),this._map&&(this._on(this._map,"change:size",()=>this._scheduleEmit()),this._options.usePostRender&&this._on(this._map,"postrender",()=>this._scheduleEmit()))}_detach(){this._keys.forEach(gi),this._keys.length=0,this._rafId!=null&&(cancelAnimationFrame(this._rafId),this._rafId=null,this._rafPending=!1)}_scheduleEmit(){if(this._enabled){if(this._options.useRaf){if(this._rafPending)return;this._rafPending=!0,this._rafId=requestAnimationFrame(()=>{this._rafPending=!1,this._rafId=null,this._emitWithThrottle()});return}this._emitWithThrottle()}}_emitWithThrottle(){const e=performance.now();this._options.throttleMs>0&&e-this._lastEmit<this._options.throttleMs||(this._lastEmit=e,this._emit())}_emit(){this._enabled&&this._changed.emit()}}async function nf(i,t,e,n){if(!i)throw new Error("olMap is undefined");await Promise.resolve();const s=i.getEventPixel(t);if(!s)return;const o=i.getCoordinateFromPixel(s);if(!o)return;const[r,a]=Kt(o),c=e??0;return n?(n[0]=r,n[1]=a,n[2]=c,n):[r,a,c]}function sf(i,t,e,n,s,o){s.constraintMode="none",s.startDragPos=[0,0,0];const r=t.getEventPixel(i),a=t.getCoordinateFromPixel(r);if(!a)return!1;const c=Kt(a),h=[c[0],c[1],e.position[2]],l=e.position,u=e.heading,f=j_(t,n,l),g=(_,y)=>{const w=k_(l,h,_),E=d.geoRhumbDistance(l,h);if(w>.98&&E<f&&!(o!=null&&o[y])){s.constraintMode=y;const b=d.geoRhumbDestination(l,E,_);if(b)return s.startDragPos=[b[0],b[1],l[2]],!0}return!1};return g(u+90,"x")||g(u,"y")?!0:!(o!=null&&o.xy)&&d.geoRhumbDistance(l,h)<f?(s.constraintMode="xy",s.startDragPos=h,!0):!1}function j_(i,t,e){const n=i.getPixelFromCoordinate(_t([e[0],e[1]])),s=[n[0]+t,n[1]],o=Kt(i.getCoordinateFromPixel(s));return d.geoRhumbDistance([e[0],e[1],0],[o[0],o[1],0])}function k_(i,t,e){const n=d.geoRhumbHeading(i,t),s=e*Math.PI/180,o=n*Math.PI/180;return Math.cos(s)*Math.cos(o)+Math.sin(s)*Math.sin(o)}function an(i,t,e,n){const s=d.geoRhumbDistance(i,e),o=d.geoRhumbHeading(i,e),r=Math.cos(o*Math.PI/180)*Math.cos(t*Math.PI/180)+Math.sin(o*Math.PI/180)*Math.sin(t*Math.PI/180);return r>0?d.geoRhumbDestination(i,s,t,n):d.geoRhumbDestination(i,s,t+180,n),[r>0?s:-s,n]}function W_(i,t,e){const n=e*.1,s=[];for(let o=-9;o<10;++o){const r=d.geoRhumbDestination(i,n*o,t);r&&s.push(r)}return s}function q_(i,t){return d.geoNearestPointOnLine(i,t).geometry.coordinates}function G_(i,t,e,n=10){const s={constraintMode:"none",startDragPos:[0,0,0]},o=i.getPixelFromCoordinate(_t([e.position[0],e.position[1]])),r=i.getEventPixel(t),a=r[0]-o[0],c=r[1]-o[1],l=(Math.atan2(-c,a)*(180/Math.PI)-e.heading+360)%360;Math.abs(a)<n&&Math.abs(c)<n?s.constraintMode="xy":l>=75&&l<=105||l>=255&&l<=285?s.constraintMode="y":l<=15||l>=345||l>=165&&l<=195?s.constraintMode="x":s.constraintMode="xy";const[u,f]=Kt(i.getCoordinateFromPixel(r));return s.startDragPos=[u,f,e.position[2]],s}function V_(i,t,e){const n=i.getPixelFromCoordinate(t),s=[n[0]+e,n[1]],o=i.getCoordinateFromPixel(s);if(!o)return 1/0;const[r,a]=Kt(o),[c,h]=Kt(t);return Math.abs(d.geoRhumbDistance([c,h,0],[r,a,0]))}function of(i,t,e,n,s,o){const r=s-e,a=o-n,c=i-e,h=t-n,l=r*c+a*h;if(l<=0)return Math.hypot(i-e,t-n);const u=r*r+a*a;if(u<=l)return Math.hypot(i-s,t-o);const f=l/u,g=e+f*r,_=n+f*a;return Math.hypot(i-g,t-_)}function rf(i,t,e,n=8,s,o){const r=s??{constraintMode:"none",startDragPos:[0,0,0]};r.constraintMode="none",r.startDragPos=[0,0,0];const a=_t([e.position[0],e.position[1]]),c=i.getPixelFromCoordinate(a);if(!c)return r;const h=i.getEventPixel(t),[l,u]=h,f=Math.max(1e-6,e.dimensions[0]),g=e.heading,_=d.geoRhumbDestination(e.position,f,g+90),y=d.geoRhumbDestination(e.position,f,g+0);if(!_||!y)return r;const w=a,E=a,b=_t([_[0],_[1]]),P=_t([y[0],y[1]]),I=i.getPixelFromCoordinate(w),M=i.getPixelFromCoordinate(b),D=i.getPixelFromCoordinate(E),L=i.getPixelFromCoordinate(P),z=V_(i,a,n),Y=Math.hypot(l-c[0],u-c[1])<=n,X=of(l,u,I[0],I[1],M[0],M[1]),Q=of(l,u,D[0],D[1],L[0],L[1]);if(!(o!=null&&o.zAxis)){const S=f,A=d.geoRhumbDestination(e.position,S,g);if(!A)return r;const F=i.getPixelFromCoordinate(_t([A[0],A[1]]));Math.hypot(F[0]-c[0],F[1]-c[1])}let m="none";!(o!=null&&o.x)&&X<=n&&X<Q&&(m="x"),!(o!=null&&o.y)&&Q<=n&&Q<X&&(m="y");const v=Kt(i.getCoordinateFromPixel(h));if(m==="x"||m==="y"){const S=m==="x"?g+90:g+0,[A,F]=an(e.position,S,[v[0],v[1],e.position[2]]);if(A>0&&F&&d.geoDistance(F,[v[0],v[1],e.position[2]])<=z)return r.constraintMode=m,r.startDragPos=[F[0],F[1],e.position[2]],r}return!(o!=null&&o.xy)&&(Y||!0)&&(r.constraintMode="xy",r.startDragPos=[v[0],v[1],e.position[2]]),r}class af extends d.Destroyable{constructor(t,e,n,s=100){super();const o=t.getView(),[r,a]=d.getReactFuncs(n),c=()=>{const l=o.getZoom()??0,u=s*Math.pow(2,10-l);a([u,u,u])};c();const h=()=>c();o.on("change:resolution",h),this.ad(()=>o.un("change:resolution",h))}}function C(i){return i!=null}function j(i){this.name="DeveloperError",this.message=i;let t;try{throw new Error}catch(e){t=e.stack}this.stack=t}C(Object.create)&&(j.prototype=Object.create(Error.prototype),j.prototype.constructor=j),j.prototype.toString=function(){let i=`${this.name}: ${this.message}`;return C(this.stack)&&(i+=`
30
- ${this.stack.toString()}`),i},j.throwInstantiationError=function(){throw new j("This function defines an interface and should not be called directly.")};const p={};p.typeOf={};function B_(i){return`${i} is required, actual value was undefined`}function Ss(i,t,e){return`Expected ${e} to be typeof ${t}, actual typeof was ${i}`}p.defined=function(i,t){if(!C(t))throw new j(B_(i))},p.typeOf.func=function(i,t){if(typeof t!="function")throw new j(Ss(typeof t,"function",i))},p.typeOf.string=function(i,t){if(typeof t!="string")throw new j(Ss(typeof t,"string",i))},p.typeOf.number=function(i,t){if(typeof t!="number")throw new j(Ss(typeof t,"number",i))},p.typeOf.number.lessThan=function(i,t,e){if(p.typeOf.number(i,t),t>=e)throw new j(`Expected ${i} to be less than ${e}, actual value was ${t}`)},p.typeOf.number.lessThanOrEquals=function(i,t,e){if(p.typeOf.number(i,t),t>e)throw new j(`Expected ${i} to be less than or equal to ${e}, actual value was ${t}`)},p.typeOf.number.greaterThan=function(i,t,e){if(p.typeOf.number(i,t),t<=e)throw new j(`Expected ${i} to be greater than ${e}, actual value was ${t}`)},p.typeOf.number.greaterThanOrEquals=function(i,t,e){if(p.typeOf.number(i,t),t<e)throw new j(`Expected ${i} to be greater than or equal to ${e}, actual value was ${t}`)},p.typeOf.object=function(i,t){if(typeof t!="object")throw new j(Ss(typeof t,"object",i))},p.typeOf.bool=function(i,t){if(typeof t!="boolean")throw new j(Ss(typeof t,"boolean",i))},p.typeOf.bigint=function(i,t){if(typeof t!="bigint")throw new j(Ss(typeof t,"bigint",i))},p.typeOf.number.equals=function(i,t,e,n){if(p.typeOf.number(i,e),p.typeOf.number(t,n),e!==n)throw new j(`${i} must be equal to ${t}, the actual values are ${e} and ${n}`)};var cf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function hf(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var gh,lf;function Y_(){if(lf)return gh;lf=1;var i=function(t){t==null&&(t=new Date().getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,t.constructor==Array?this.init_by_array(t,t.length):this.init_seed(t)};return i.prototype.init_seed=function(t){for(this.mt[0]=t>>>0,this.mti=1;this.mti<this.N;this.mti++){var t=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(((t&4294901760)>>>16)*1812433253<<16)+(t&65535)*1812433253+this.mti,this.mt[this.mti]>>>=0}},i.prototype.init_by_array=function(t,e){var n,s,o;for(this.init_seed(19650218),n=1,s=0,o=this.N>e?this.N:e;o;o--){var r=this.mt[n-1]^this.mt[n-1]>>>30;this.mt[n]=(this.mt[n]^(((r&4294901760)>>>16)*1664525<<16)+(r&65535)*1664525)+t[s]+s,this.mt[n]>>>=0,n++,s++,n>=this.N&&(this.mt[0]=this.mt[this.N-1],n=1),s>=e&&(s=0)}for(o=this.N-1;o;o--){var r=this.mt[n-1]^this.mt[n-1]>>>30;this.mt[n]=(this.mt[n]^(((r&4294901760)>>>16)*1566083941<<16)+(r&65535)*1566083941)-n,this.mt[n]>>>=0,n++,n>=this.N&&(this.mt[0]=this.mt[this.N-1],n=1)}this.mt[0]=2147483648},i.prototype.random_int=function(){var t,e=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti==this.N+1&&this.init_seed(5489),n=0;n<this.N-this.M;n++)t=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^t>>>1^e[t&1];for(;n<this.N-1;n++)t=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^t>>>1^e[t&1];t=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^t>>>1^e[t&1],this.mti=0}return t=this.mt[this.mti++],t^=t>>>11,t^=t<<7&2636928640,t^=t<<15&4022730752,t^=t>>>18,t>>>0},i.prototype.random_int31=function(){return this.random_int()>>>1},i.prototype.random_incl=function(){return this.random_int()*23283064370807974e-26},i.prototype.random=function(){return this.random_int()*23283064365386963e-26},i.prototype.random_excl=function(){return(this.random_int()+.5)*23283064365386963e-26},i.prototype.random_long=function(){var t=this.random_int()>>>5,e=this.random_int()>>>6;return(t*67108864+e)*11102230246251565e-32},gh=i,gh}var H_=Y_();const uf=hf(H_),T={};T.EPSILON1=.1,T.EPSILON2=.01,T.EPSILON3=.001,T.EPSILON4=1e-4,T.EPSILON5=1e-5,T.EPSILON6=1e-6,T.EPSILON7=1e-7,T.EPSILON8=1e-8,T.EPSILON9=1e-9,T.EPSILON10=1e-10,T.EPSILON11=1e-11,T.EPSILON12=1e-12,T.EPSILON13=1e-13,T.EPSILON14=1e-14,T.EPSILON15=1e-15,T.EPSILON16=1e-16,T.EPSILON17=1e-17,T.EPSILON18=1e-18,T.EPSILON19=1e-19,T.EPSILON20=1e-20,T.EPSILON21=1e-21,T.GRAVITATIONALPARAMETER=3986004418e5,T.SOLAR_RADIUS=6955e5,T.LUNAR_RADIUS=1737400,T.SIXTY_FOUR_KILOBYTES=65536,T.FOUR_GIGABYTES=4294967296,T.sign=Math.sign??function(t){return t=+t,t===0||t!==t?t:t>0?1:-1},T.signNotZero=function(i){return i<0?-1:1},T.toSNorm=function(i,t){return t=t??255,Math.round((T.clamp(i,-1,1)*.5+.5)*t)},T.fromSNorm=function(i,t){return t=t??255,T.clamp(i,0,t)/t*2-1},T.normalize=function(i,t,e){return e=Math.max(e-t,0),e===0?0:T.clamp((i-t)/e,0,1)},T.sinh=Math.sinh??function(t){return(Math.exp(t)-Math.exp(-t))/2},T.cosh=Math.cosh??function(t){return(Math.exp(t)+Math.exp(-t))/2},T.lerp=function(i,t,e){return(1-e)*i+e*t},T.PI=Math.PI,T.ONE_OVER_PI=1/Math.PI,T.PI_OVER_TWO=Math.PI/2,T.PI_OVER_THREE=Math.PI/3,T.PI_OVER_FOUR=Math.PI/4,T.PI_OVER_SIX=Math.PI/6,T.THREE_PI_OVER_TWO=3*Math.PI/2,T.TWO_PI=2*Math.PI,T.ONE_OVER_TWO_PI=1/(2*Math.PI),T.RADIANS_PER_DEGREE=Math.PI/180,T.DEGREES_PER_RADIAN=180/Math.PI,T.RADIANS_PER_ARCSECOND=T.RADIANS_PER_DEGREE/3600,T.toRadians=function(i){if(!C(i))throw new j("degrees is required.");return i*T.RADIANS_PER_DEGREE},T.toDegrees=function(i){if(!C(i))throw new j("radians is required.");return i*T.DEGREES_PER_RADIAN},T.convertLongitudeRange=function(i){if(!C(i))throw new j("angle is required.");const t=T.TWO_PI,e=i-Math.floor(i/t)*t;return e<-Math.PI?e+t:e>=Math.PI?e-t:e},T.clampToLatitudeRange=function(i){if(!C(i))throw new j("angle is required.");return T.clamp(i,-1*T.PI_OVER_TWO,T.PI_OVER_TWO)},T.negativePiToPi=function(i){if(!C(i))throw new j("angle is required.");return i>=-T.PI&&i<=T.PI?i:T.zeroToTwoPi(i+T.PI)-T.PI},T.zeroToTwoPi=function(i){if(!C(i))throw new j("angle is required.");if(i>=0&&i<=T.TWO_PI)return i;const t=T.mod(i,T.TWO_PI);return Math.abs(t)<T.EPSILON14&&Math.abs(i)>T.EPSILON14?T.TWO_PI:t},T.mod=function(i,t){if(!C(i))throw new j("m is required.");if(!C(t))throw new j("n is required.");if(t===0)throw new j("divisor cannot be 0.");return T.sign(i)===T.sign(t)&&Math.abs(i)<Math.abs(t)?i:(i%t+t)%t},T.equalsEpsilon=function(i,t,e,n){if(!C(i))throw new j("left is required.");if(!C(t))throw new j("right is required.");e=e??0,n=n??e;const s=Math.abs(i-t);return s<=n||s<=e*Math.max(Math.abs(i),Math.abs(t))},T.lessThan=function(i,t,e){if(!C(i))throw new j("first is required.");if(!C(t))throw new j("second is required.");if(!C(e))throw new j("absoluteEpsilon is required.");return i-t<-e},T.lessThanOrEquals=function(i,t,e){if(!C(i))throw new j("first is required.");if(!C(t))throw new j("second is required.");if(!C(e))throw new j("absoluteEpsilon is required.");return i-t<e},T.greaterThan=function(i,t,e){if(!C(i))throw new j("first is required.");if(!C(t))throw new j("second is required.");if(!C(e))throw new j("absoluteEpsilon is required.");return i-t>e},T.greaterThanOrEquals=function(i,t,e){if(!C(i))throw new j("first is required.");if(!C(t))throw new j("second is required.");if(!C(e))throw new j("absoluteEpsilon is required.");return i-t>-e};const oa=[1];T.factorial=function(i){if(typeof i!="number"||i<0)throw new j("A number greater than or equal to 0 is required.");const t=oa.length;if(i>=t){let e=oa[t-1];for(let n=t;n<=i;n++){const s=e*n;oa.push(s),e=s}}return oa[i]},T.incrementWrap=function(i,t,e){if(e=e??0,!C(i))throw new j("n is required.");if(t<=e)throw new j("maximumValue must be greater than minimumValue.");return++i,i>t&&(i=e),i},T.isPowerOfTwo=function(i){if(typeof i!="number"||i<0||i>4294967295)throw new j("A number between 0 and (2^32)-1 is required.");return i!==0&&(i&i-1)===0},T.nextPowerOfTwo=function(i){if(typeof i!="number"||i<0||i>2147483648)throw new j("A number between 0 and 2^31 is required.");return--i,i|=i>>1,i|=i>>2,i|=i>>4,i|=i>>8,i|=i>>16,++i,i},T.previousPowerOfTwo=function(i){if(typeof i!="number"||i<0||i>4294967295)throw new j("A number between 0 and (2^32)-1 is required.");return i|=i>>1,i|=i>>2,i|=i>>4,i|=i>>8,i|=i>>16,i|=i>>32,i=(i>>>0)-(i>>>1),i},T.clamp=function(i,t,e){return p.typeOf.number("value",i),p.typeOf.number("min",t),p.typeOf.number("max",e),i<t?t:i>e?e:i};let df=new uf;T.setRandomNumberSeed=function(i){if(!C(i))throw new j("seed is required.");df=new uf(i)},T.nextRandomNumber=function(){return df.random()},T.randomBetween=function(i,t){return T.nextRandomNumber()*(t-i)+i},T.acosClamped=function(i){if(!C(i))throw new j("value is required.");return Math.acos(T.clamp(i,-1,1))},T.asinClamped=function(i){if(!C(i))throw new j("value is required.");return Math.asin(T.clamp(i,-1,1))},T.chordLength=function(i,t){if(!C(i))throw new j("angle is required.");if(!C(t))throw new j("radius is required.");return 2*t*Math.sin(i*.5)},T.logBase=function(i,t){if(!C(i))throw new j("number is required.");if(!C(t))throw new j("base is required.");return Math.log(i)/Math.log(t)},T.cbrt=Math.cbrt??function(t){const e=Math.pow(Math.abs(t),.3333333333333333);return t<0?-e:e},T.log2=Math.log2??function(t){return Math.log(t)*Math.LOG2E},T.fog=function(i,t){const e=i*t;return 1-Math.exp(-(e*e))},T.fastApproximateAtan=function(i){return p.typeOf.number("x",i),i*(-.1784*Math.abs(i)-.0663*i*i+1.0301)},T.fastApproximateAtan2=function(i,t){p.typeOf.number("x",i),p.typeOf.number("y",t);let e,n=Math.abs(i);e=Math.abs(t);const s=Math.max(n,e);e=Math.min(n,e);const o=e/s;if(isNaN(o))throw new j("either x or y must be nonzero");return n=T.fastApproximateAtan(o),n=Math.abs(t)>Math.abs(i)?T.PI_OVER_TWO-n:n,n=i<0?T.PI-n:n,n=t<0?-n:n,n};function O(i,t,e){this.x=i??0,this.y=t??0,this.z=e??0}O.fromSpherical=function(i,t){p.typeOf.object("spherical",i),C(t)||(t=new O);const e=i.clock,n=i.cone,s=i.magnitude??1,o=s*Math.sin(n);return t.x=o*Math.cos(e),t.y=o*Math.sin(e),t.z=s*Math.cos(n),t},O.fromElements=function(i,t,e,n){return C(n)?(n.x=i,n.y=t,n.z=e,n):new O(i,t,e)},O.clone=function(i,t){if(C(i))return C(t)?(t.x=i.x,t.y=i.y,t.z=i.z,t):new O(i.x,i.y,i.z)},O.fromCartesian4=O.clone,O.packedLength=3,O.pack=function(i,t,e){return p.typeOf.object("value",i),p.defined("array",t),e=e??0,t[e++]=i.x,t[e++]=i.y,t[e]=i.z,t},O.unpack=function(i,t,e){return p.defined("array",i),t=t??0,C(e)||(e=new O),e.x=i[t++],e.y=i[t++],e.z=i[t],e},O.packArray=function(i,t){p.defined("array",i);const e=i.length,n=e*3;if(!C(t))t=new Array(n);else{if(!Array.isArray(t)&&t.length!==n)throw new j("If result is a typed array, it must have exactly array.length * 3 elements");t.length!==n&&(t.length=n)}for(let s=0;s<e;++s)O.pack(i[s],t,s*3);return t},O.unpackArray=function(i,t){if(p.defined("array",i),p.typeOf.number.greaterThanOrEquals("array.length",i.length,3),i.length%3!==0)throw new j("array length must be a multiple of 3.");const e=i.length;C(t)?t.length=e/3:t=new Array(e/3);for(let n=0;n<e;n+=3){const s=n/3;t[s]=O.unpack(i,n,t[s])}return t},O.fromArray=O.unpack,O.maximumComponent=function(i){return p.typeOf.object("cartesian",i),Math.max(i.x,i.y,i.z)},O.minimumComponent=function(i){return p.typeOf.object("cartesian",i),Math.min(i.x,i.y,i.z)},O.minimumByComponent=function(i,t,e){return p.typeOf.object("first",i),p.typeOf.object("second",t),p.typeOf.object("result",e),e.x=Math.min(i.x,t.x),e.y=Math.min(i.y,t.y),e.z=Math.min(i.z,t.z),e},O.maximumByComponent=function(i,t,e){return p.typeOf.object("first",i),p.typeOf.object("second",t),p.typeOf.object("result",e),e.x=Math.max(i.x,t.x),e.y=Math.max(i.y,t.y),e.z=Math.max(i.z,t.z),e},O.clamp=function(i,t,e,n){p.typeOf.object("value",i),p.typeOf.object("min",t),p.typeOf.object("max",e),p.typeOf.object("result",n);const s=T.clamp(i.x,t.x,e.x),o=T.clamp(i.y,t.y,e.y),r=T.clamp(i.z,t.z,e.z);return n.x=s,n.y=o,n.z=r,n},O.magnitudeSquared=function(i){return p.typeOf.object("cartesian",i),i.x*i.x+i.y*i.y+i.z*i.z},O.magnitude=function(i){return Math.sqrt(O.magnitudeSquared(i))};const ra=new O;O.distance=function(i,t){return p.typeOf.object("left",i),p.typeOf.object("right",t),O.subtract(i,t,ra),O.magnitude(ra)},O.distanceSquared=function(i,t){return p.typeOf.object("left",i),p.typeOf.object("right",t),O.subtract(i,t,ra),O.magnitudeSquared(ra)},O.normalize=function(i,t){p.typeOf.object("cartesian",i),p.typeOf.object("result",t);const e=O.magnitude(i);if(t.x=i.x/e,t.y=i.y/e,t.z=i.z/e,isNaN(t.x)||isNaN(t.y)||isNaN(t.z))throw new j("normalized result is not a number");return t},O.dot=function(i,t){return p.typeOf.object("left",i),p.typeOf.object("right",t),i.x*t.x+i.y*t.y+i.z*t.z},O.multiplyComponents=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.x=i.x*t.x,e.y=i.y*t.y,e.z=i.z*t.z,e},O.divideComponents=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.x=i.x/t.x,e.y=i.y/t.y,e.z=i.z/t.z,e},O.add=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.x=i.x+t.x,e.y=i.y+t.y,e.z=i.z+t.z,e},O.subtract=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.x=i.x-t.x,e.y=i.y-t.y,e.z=i.z-t.z,e},O.multiplyByScalar=function(i,t,e){return p.typeOf.object("cartesian",i),p.typeOf.number("scalar",t),p.typeOf.object("result",e),e.x=i.x*t,e.y=i.y*t,e.z=i.z*t,e},O.divideByScalar=function(i,t,e){return p.typeOf.object("cartesian",i),p.typeOf.number("scalar",t),p.typeOf.object("result",e),e.x=i.x/t,e.y=i.y/t,e.z=i.z/t,e},O.negate=function(i,t){return p.typeOf.object("cartesian",i),p.typeOf.object("result",t),t.x=-i.x,t.y=-i.y,t.z=-i.z,t},O.abs=function(i,t){return p.typeOf.object("cartesian",i),p.typeOf.object("result",t),t.x=Math.abs(i.x),t.y=Math.abs(i.y),t.z=Math.abs(i.z),t};const ff=new O;O.lerp=function(i,t,e,n){return p.typeOf.object("start",i),p.typeOf.object("end",t),p.typeOf.number("t",e),p.typeOf.object("result",n),O.multiplyByScalar(t,e,ff),n=O.multiplyByScalar(i,1-e,n),O.add(ff,n,n)};const aa=new O,ph=new O;O.angleBetween=function(i,t){p.typeOf.object("left",i),p.typeOf.object("right",t),O.normalize(i,aa),O.normalize(t,ph);const e=O.dot(aa,ph),n=O.magnitude(O.cross(aa,ph,aa));return Math.atan2(n,e)};const X_=new O;O.mostOrthogonalAxis=function(i,t){p.typeOf.object("cartesian",i),p.typeOf.object("result",t);const e=O.normalize(i,X_);return O.abs(e,e),e.x<=e.y?e.x<=e.z?t=O.clone(O.UNIT_X,t):t=O.clone(O.UNIT_Z,t):e.y<=e.z?t=O.clone(O.UNIT_Y,t):t=O.clone(O.UNIT_Z,t),t},O.projectVector=function(i,t,e){p.defined("a",i),p.defined("b",t),p.defined("result",e);const n=O.dot(i,t)/O.dot(t,t);return O.multiplyByScalar(t,n,e)},O.equals=function(i,t){return i===t||C(i)&&C(t)&&i.x===t.x&&i.y===t.y&&i.z===t.z},O.equalsArray=function(i,t,e){return i.x===t[e]&&i.y===t[e+1]&&i.z===t[e+2]},O.equalsEpsilon=function(i,t,e,n){return i===t||C(i)&&C(t)&&T.equalsEpsilon(i.x,t.x,e,n)&&T.equalsEpsilon(i.y,t.y,e,n)&&T.equalsEpsilon(i.z,t.z,e,n)},O.cross=function(i,t,e){p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e);const n=i.x,s=i.y,o=i.z,r=t.x,a=t.y,c=t.z,h=s*c-o*a,l=o*r-n*c,u=n*a-s*r;return e.x=h,e.y=l,e.z=u,e},O.midpoint=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.x=(i.x+t.x)*.5,e.y=(i.y+t.y)*.5,e.z=(i.z+t.z)*.5,e},O.fromDegrees=function(i,t,e,n,s){return p.typeOf.number("longitude",i),p.typeOf.number("latitude",t),i=T.toRadians(i),t=T.toRadians(t),O.fromRadians(i,t,e,n,s)};let Me=new O,Rs=new O;O._ellipsoidRadiiSquared=new O(40680631590769,40680631590769,40408299984661445e-3),O.fromRadians=function(i,t,e,n,s){p.typeOf.number("longitude",i),p.typeOf.number("latitude",t),e=e??0;const o=C(n)?n.radiiSquared:O._ellipsoidRadiiSquared,r=Math.cos(t);Me.x=r*Math.cos(i),Me.y=r*Math.sin(i),Me.z=Math.sin(t),Me=O.normalize(Me,Me),O.multiplyComponents(o,Me,Rs);const a=Math.sqrt(O.dot(Me,Rs));return Rs=O.divideByScalar(Rs,a,Rs),Me=O.multiplyByScalar(Me,e,Me),C(s)||(s=new O),O.add(Rs,Me,s)},O.fromDegreesArray=function(i,t,e){if(p.defined("coordinates",i),i.length<2||i.length%2!==0)throw new j("the number of coordinates must be a multiple of 2 and at least 2");const n=i.length;C(e)?e.length=n/2:e=new Array(n/2);for(let s=0;s<n;s+=2){const o=i[s],r=i[s+1],a=s/2;e[a]=O.fromDegrees(o,r,0,t,e[a])}return e},O.fromRadiansArray=function(i,t,e){if(p.defined("coordinates",i),i.length<2||i.length%2!==0)throw new j("the number of coordinates must be a multiple of 2 and at least 2");const n=i.length;C(e)?e.length=n/2:e=new Array(n/2);for(let s=0;s<n;s+=2){const o=i[s],r=i[s+1],a=s/2;e[a]=O.fromRadians(o,r,0,t,e[a])}return e},O.fromDegreesArrayHeights=function(i,t,e){if(p.defined("coordinates",i),i.length<3||i.length%3!==0)throw new j("the number of coordinates must be a multiple of 3 and at least 3");const n=i.length;C(e)?e.length=n/3:e=new Array(n/3);for(let s=0;s<n;s+=3){const o=i[s],r=i[s+1],a=i[s+2],c=s/3;e[c]=O.fromDegrees(o,r,a,t,e[c])}return e},O.fromRadiansArrayHeights=function(i,t,e){if(p.defined("coordinates",i),i.length<3||i.length%3!==0)throw new j("the number of coordinates must be a multiple of 3 and at least 3");const n=i.length;C(e)?e.length=n/3:e=new Array(n/3);for(let s=0;s<n;s+=3){const o=i[s],r=i[s+1],a=i[s+2],c=s/3;e[c]=O.fromRadians(o,r,a,t,e[c])}return e},O.ZERO=Object.freeze(new O(0,0,0)),O.ONE=Object.freeze(new O(1,1,1)),O.UNIT_X=Object.freeze(new O(1,0,0)),O.UNIT_Y=Object.freeze(new O(0,1,0)),O.UNIT_Z=Object.freeze(new O(0,0,1)),O.prototype.clone=function(i){return O.clone(this,i)},O.prototype.equals=function(i){return O.equals(this,i)},O.prototype.equalsEpsilon=function(i,t,e){return O.equalsEpsilon(this,i,t,e)},O.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z})`};const $_=new O,Z_=new O;function gf(i,t,e,n,s){if(!C(i))throw new j("cartesian is required.");if(!C(t))throw new j("oneOverRadii is required.");if(!C(e))throw new j("oneOverRadiiSquared is required.");if(!C(n))throw new j("centerToleranceSquared is required.");const o=i.x,r=i.y,a=i.z,c=t.x,h=t.y,l=t.z,u=o*o*c*c,f=r*r*h*h,g=a*a*l*l,_=u+f+g,y=Math.sqrt(1/_),w=O.multiplyByScalar(i,y,$_);if(_<n)return isFinite(y)?O.clone(w,s):void 0;const E=e.x,b=e.y,P=e.z,I=Z_;I.x=w.x*E*2,I.y=w.y*b*2,I.z=w.z*P*2;let M=(1-y)*O.magnitude(i)/(.5*O.magnitude(I)),D=0,L,z,q,Y,X,Q,m,v,S,A,F;do{M-=D,q=1/(1+M*E),Y=1/(1+M*b),X=1/(1+M*P),Q=q*q,m=Y*Y,v=X*X,S=Q*q,A=m*Y,F=v*X,L=u*Q+f*m+g*v-1,z=u*S*E+f*A*b+g*F*P;const N=-2*z;D=L/N}while(Math.abs(L)>T.EPSILON12);return C(s)?(s.x=o*q,s.y=r*Y,s.z=a*X,s):new O(o*q,r*Y,a*X)}function lt(i,t,e){this.longitude=i??0,this.latitude=t??0,this.height=e??0}lt.fromRadians=function(i,t,e,n){return p.typeOf.number("longitude",i),p.typeOf.number("latitude",t),e=e??0,C(n)?(n.longitude=i,n.latitude=t,n.height=e,n):new lt(i,t,e)},lt.fromDegrees=function(i,t,e,n){return p.typeOf.number("longitude",i),p.typeOf.number("latitude",t),i=T.toRadians(i),t=T.toRadians(t),lt.fromRadians(i,t,e,n)};const K_=new O,Q_=new O,J_=new O;lt._ellipsoidOneOverRadii=new O(1567855942887398e-22,1567855942887398e-22,1573130351105623e-22),lt._ellipsoidOneOverRadiiSquared=new O(2458172257647332e-29,2458172257647332e-29,24747391015697002e-30),lt._ellipsoidCenterToleranceSquared=T.EPSILON1,lt.fromCartesian=function(i,t,e){const n=C(t)?t.oneOverRadii:lt._ellipsoidOneOverRadii,s=C(t)?t.oneOverRadiiSquared:lt._ellipsoidOneOverRadiiSquared,o=C(t)?t._centerToleranceSquared:lt._ellipsoidCenterToleranceSquared,r=gf(i,n,s,o,Q_);if(!C(r))return;let a=O.multiplyComponents(r,s,K_);a=O.normalize(a,a);const c=O.subtract(i,r,J_),h=Math.atan2(a.y,a.x),l=Math.asin(a.z),u=T.sign(O.dot(c,i))*O.magnitude(c);return C(e)?(e.longitude=h,e.latitude=l,e.height=u,e):new lt(h,l,u)},lt.toCartesian=function(i,t,e){return p.defined("cartographic",i),O.fromRadians(i.longitude,i.latitude,i.height,t,e)},lt.clone=function(i,t){if(C(i))return C(t)?(t.longitude=i.longitude,t.latitude=i.latitude,t.height=i.height,t):new lt(i.longitude,i.latitude,i.height)},lt.equals=function(i,t){return i===t||C(i)&&C(t)&&i.longitude===t.longitude&&i.latitude===t.latitude&&i.height===t.height},lt.equalsEpsilon=function(i,t,e){return e=e??0,i===t||C(i)&&C(t)&&Math.abs(i.longitude-t.longitude)<=e&&Math.abs(i.latitude-t.latitude)<=e&&Math.abs(i.height-t.height)<=e},lt.ZERO=Object.freeze(new lt(0,0,0)),lt.prototype.clone=function(i){return lt.clone(this,i)},lt.prototype.equals=function(i){return lt.equals(this,i)},lt.prototype.equalsEpsilon=function(i,t){return lt.equalsEpsilon(this,i,t)},lt.prototype.toString=function(){return`(${this.longitude}, ${this.latitude}, ${this.height})`};function tt(i,t){this.x=i??0,this.y=t??0}tt.fromElements=function(i,t,e){return C(e)?(e.x=i,e.y=t,e):new tt(i,t)},tt.clone=function(i,t){if(C(i))return C(t)?(t.x=i.x,t.y=i.y,t):new tt(i.x,i.y)},tt.fromCartesian3=tt.clone,tt.fromCartesian4=tt.clone,tt.packedLength=2,tt.pack=function(i,t,e){return p.typeOf.object("value",i),p.defined("array",t),e=e??0,t[e++]=i.x,t[e]=i.y,t},tt.unpack=function(i,t,e){return p.defined("array",i),t=t??0,C(e)||(e=new tt),e.x=i[t++],e.y=i[t],e},tt.packArray=function(i,t){p.defined("array",i);const e=i.length,n=e*2;if(!C(t))t=new Array(n);else{if(!Array.isArray(t)&&t.length!==n)throw new j("If result is a typed array, it must have exactly array.length * 2 elements");t.length!==n&&(t.length=n)}for(let s=0;s<e;++s)tt.pack(i[s],t,s*2);return t},tt.unpackArray=function(i,t){if(p.defined("array",i),p.typeOf.number.greaterThanOrEquals("array.length",i.length,2),i.length%2!==0)throw new j("array length must be a multiple of 2.");const e=i.length;C(t)?t.length=e/2:t=new Array(e/2);for(let n=0;n<e;n+=2){const s=n/2;t[s]=tt.unpack(i,n,t[s])}return t},tt.fromArray=tt.unpack,tt.maximumComponent=function(i){return p.typeOf.object("cartesian",i),Math.max(i.x,i.y)},tt.minimumComponent=function(i){return p.typeOf.object("cartesian",i),Math.min(i.x,i.y)},tt.minimumByComponent=function(i,t,e){return p.typeOf.object("first",i),p.typeOf.object("second",t),p.typeOf.object("result",e),e.x=Math.min(i.x,t.x),e.y=Math.min(i.y,t.y),e},tt.maximumByComponent=function(i,t,e){return p.typeOf.object("first",i),p.typeOf.object("second",t),p.typeOf.object("result",e),e.x=Math.max(i.x,t.x),e.y=Math.max(i.y,t.y),e},tt.clamp=function(i,t,e,n){p.typeOf.object("value",i),p.typeOf.object("min",t),p.typeOf.object("max",e),p.typeOf.object("result",n);const s=T.clamp(i.x,t.x,e.x),o=T.clamp(i.y,t.y,e.y);return n.x=s,n.y=o,n},tt.magnitudeSquared=function(i){return p.typeOf.object("cartesian",i),i.x*i.x+i.y*i.y},tt.magnitude=function(i){return Math.sqrt(tt.magnitudeSquared(i))};const ca=new tt;tt.distance=function(i,t){return p.typeOf.object("left",i),p.typeOf.object("right",t),tt.subtract(i,t,ca),tt.magnitude(ca)},tt.distanceSquared=function(i,t){return p.typeOf.object("left",i),p.typeOf.object("right",t),tt.subtract(i,t,ca),tt.magnitudeSquared(ca)},tt.normalize=function(i,t){p.typeOf.object("cartesian",i),p.typeOf.object("result",t);const e=tt.magnitude(i);if(t.x=i.x/e,t.y=i.y/e,isNaN(t.x)||isNaN(t.y))throw new j("normalized result is not a number");return t},tt.dot=function(i,t){return p.typeOf.object("left",i),p.typeOf.object("right",t),i.x*t.x+i.y*t.y},tt.cross=function(i,t){return p.typeOf.object("left",i),p.typeOf.object("right",t),i.x*t.y-i.y*t.x},tt.multiplyComponents=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.x=i.x*t.x,e.y=i.y*t.y,e},tt.divideComponents=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.x=i.x/t.x,e.y=i.y/t.y,e},tt.add=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.x=i.x+t.x,e.y=i.y+t.y,e},tt.subtract=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.x=i.x-t.x,e.y=i.y-t.y,e},tt.multiplyByScalar=function(i,t,e){return p.typeOf.object("cartesian",i),p.typeOf.number("scalar",t),p.typeOf.object("result",e),e.x=i.x*t,e.y=i.y*t,e},tt.divideByScalar=function(i,t,e){return p.typeOf.object("cartesian",i),p.typeOf.number("scalar",t),p.typeOf.object("result",e),e.x=i.x/t,e.y=i.y/t,e},tt.negate=function(i,t){return p.typeOf.object("cartesian",i),p.typeOf.object("result",t),t.x=-i.x,t.y=-i.y,t},tt.abs=function(i,t){return p.typeOf.object("cartesian",i),p.typeOf.object("result",t),t.x=Math.abs(i.x),t.y=Math.abs(i.y),t};const pf=new tt;tt.lerp=function(i,t,e,n){return p.typeOf.object("start",i),p.typeOf.object("end",t),p.typeOf.number("t",e),p.typeOf.object("result",n),tt.multiplyByScalar(t,e,pf),n=tt.multiplyByScalar(i,1-e,n),tt.add(pf,n,n)};const mf=new tt,_f=new tt;tt.angleBetween=function(i,t){return p.typeOf.object("left",i),p.typeOf.object("right",t),tt.normalize(i,mf),tt.normalize(t,_f),T.acosClamped(tt.dot(mf,_f))};const ty=new tt;tt.mostOrthogonalAxis=function(i,t){p.typeOf.object("cartesian",i),p.typeOf.object("result",t);const e=tt.normalize(i,ty);return tt.abs(e,e),e.x<=e.y?t=tt.clone(tt.UNIT_X,t):t=tt.clone(tt.UNIT_Y,t),t},tt.equals=function(i,t){return i===t||C(i)&&C(t)&&i.x===t.x&&i.y===t.y},tt.equalsArray=function(i,t,e){return i.x===t[e]&&i.y===t[e+1]},tt.equalsEpsilon=function(i,t,e,n){return i===t||C(i)&&C(t)&&T.equalsEpsilon(i.x,t.x,e,n)&&T.equalsEpsilon(i.y,t.y,e,n)},tt.ZERO=Object.freeze(new tt(0,0)),tt.ONE=Object.freeze(new tt(1,1)),tt.UNIT_X=Object.freeze(new tt(1,0)),tt.UNIT_Y=Object.freeze(new tt(0,1)),tt.prototype.clone=function(i){return tt.clone(this,i)},tt.prototype.equals=function(i){return tt.equals(this,i)},tt.prototype.equalsEpsilon=function(i,t,e){return tt.equalsEpsilon(this,i,t,e)},tt.prototype.toString=function(){return`(${this.x}, ${this.y})`};function yf(i,t,e,n){t=t??0,e=e??0,n=n??0,p.typeOf.number.greaterThanOrEquals("x",t,0),p.typeOf.number.greaterThanOrEquals("y",e,0),p.typeOf.number.greaterThanOrEquals("z",n,0),i._radii=new O(t,e,n),i._radiiSquared=new O(t*t,e*e,n*n),i._radiiToTheFourth=new O(t*t*t*t,e*e*e*e,n*n*n*n),i._oneOverRadii=new O(t===0?0:1/t,e===0?0:1/e,n===0?0:1/n),i._oneOverRadiiSquared=new O(t===0?0:1/(t*t),e===0?0:1/(e*e),n===0?0:1/(n*n)),i._minimumRadius=Math.min(t,e,n),i._maximumRadius=Math.max(t,e,n),i._centerToleranceSquared=T.EPSILON1,i._radiiSquared.z!==0&&(i._squaredXOverSquaredZ=i._radiiSquared.x/i._radiiSquared.z)}function ct(i,t,e){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,this._squaredXOverSquaredZ=void 0,yf(this,i,t,e)}Object.defineProperties(ct.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),ct.clone=function(i,t){if(!C(i))return;const e=i._radii;return C(t)?(O.clone(e,t._radii),O.clone(i._radiiSquared,t._radiiSquared),O.clone(i._radiiToTheFourth,t._radiiToTheFourth),O.clone(i._oneOverRadii,t._oneOverRadii),O.clone(i._oneOverRadiiSquared,t._oneOverRadiiSquared),t._minimumRadius=i._minimumRadius,t._maximumRadius=i._maximumRadius,t._centerToleranceSquared=i._centerToleranceSquared,t):new ct(e.x,e.y,e.z)},ct.fromCartesian3=function(i,t){return C(t)||(t=new ct),C(i)&&yf(t,i.x,i.y,i.z),t},ct.WGS84=Object.freeze(new ct(6378137,6378137,6356752314245179e-9)),ct.UNIT_SPHERE=Object.freeze(new ct(1,1,1)),ct.MOON=Object.freeze(new ct(T.LUNAR_RADIUS,T.LUNAR_RADIUS,T.LUNAR_RADIUS)),ct.MARS=Object.freeze(new ct(3396190,3396190,3376200)),ct._default=ct.WGS84,Object.defineProperties(ct,{default:{get:function(){return ct._default},set:function(i){p.typeOf.object("value",i),ct._default=i,O._ellipsoidRadiiSquared=i.radiiSquared,lt._ellipsoidOneOverRadii=i.oneOverRadii,lt._ellipsoidOneOverRadiiSquared=i.oneOverRadiiSquared,lt._ellipsoidCenterToleranceSquared=i._centerToleranceSquared}}}),ct.prototype.clone=function(i){return ct.clone(this,i)},ct.packedLength=O.packedLength,ct.pack=function(i,t,e){return p.typeOf.object("value",i),p.defined("array",t),e=e??0,O.pack(i._radii,t,e),t},ct.unpack=function(i,t,e){p.defined("array",i),t=t??0;const n=O.unpack(i,t);return ct.fromCartesian3(n,e)},ct.prototype.geocentricSurfaceNormal=O.normalize,ct.prototype.geodeticSurfaceNormalCartographic=function(i,t){p.typeOf.object("cartographic",i);const e=i.longitude,n=i.latitude,s=Math.cos(n),o=s*Math.cos(e),r=s*Math.sin(e),a=Math.sin(n);return C(t)||(t=new O),t.x=o,t.y=r,t.z=a,O.normalize(t,t)},ct.prototype.geodeticSurfaceNormal=function(i,t){if(p.typeOf.object("cartesian",i),isNaN(i.x)||isNaN(i.y)||isNaN(i.z))throw new j("cartesian has a NaN component");if(!O.equalsEpsilon(i,O.ZERO,T.EPSILON14))return C(t)||(t=new O),t=O.multiplyComponents(i,this._oneOverRadiiSquared,t),O.normalize(t,t)};const ey=new O,iy=new O;ct.prototype.cartographicToCartesian=function(i,t){const e=ey,n=iy;this.geodeticSurfaceNormalCartographic(i,e),O.multiplyComponents(this._radiiSquared,e,n);const s=Math.sqrt(O.dot(e,n));return O.divideByScalar(n,s,n),O.multiplyByScalar(e,i.height,e),C(t)||(t=new O),O.add(n,e,t)},ct.prototype.cartographicArrayToCartesianArray=function(i,t){p.defined("cartographics",i);const e=i.length;C(t)?t.length=e:t=new Array(e);for(let n=0;n<e;n++)t[n]=this.cartographicToCartesian(i[n],t[n]);return t};const ny=new O,sy=new O,oy=new O;ct.prototype.cartesianToCartographic=function(i,t){const e=this.scaleToGeodeticSurface(i,sy);if(!C(e))return;const n=this.geodeticSurfaceNormal(e,ny),s=O.subtract(i,e,oy),o=Math.atan2(n.y,n.x),r=Math.asin(n.z),a=T.sign(O.dot(s,i))*O.magnitude(s);return C(t)?(t.longitude=o,t.latitude=r,t.height=a,t):new lt(o,r,a)},ct.prototype.cartesianArrayToCartographicArray=function(i,t){p.defined("cartesians",i);const e=i.length;C(t)?t.length=e:t=new Array(e);for(let n=0;n<e;++n)t[n]=this.cartesianToCartographic(i[n],t[n]);return t},ct.prototype.scaleToGeodeticSurface=function(i,t){return gf(i,this._oneOverRadii,this._oneOverRadiiSquared,this._centerToleranceSquared,t)},ct.prototype.scaleToGeocentricSurface=function(i,t){p.typeOf.object("cartesian",i),C(t)||(t=new O);const e=i.x,n=i.y,s=i.z,o=this._oneOverRadiiSquared,r=1/Math.sqrt(e*e*o.x+n*n*o.y+s*s*o.z);return O.multiplyByScalar(i,r,t)},ct.prototype.transformPositionToScaledSpace=function(i,t){return C(t)||(t=new O),O.multiplyComponents(i,this._oneOverRadii,t)},ct.prototype.transformPositionFromScaledSpace=function(i,t){return C(t)||(t=new O),O.multiplyComponents(i,this._radii,t)},ct.prototype.equals=function(i){return this===i||C(i)&&O.equals(this._radii,i._radii)},ct.prototype.toString=function(){return this._radii.toString()},ct.prototype.getSurfaceNormalIntersectionWithZAxis=function(i,t,e){if(p.typeOf.object("position",i),!T.equalsEpsilon(this._radii.x,this._radii.y,T.EPSILON15))throw new j("Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)");p.typeOf.number.greaterThan("Ellipsoid.radii.z",this._radii.z,0),t=t??0;const n=this._squaredXOverSquaredZ;if(C(e)||(e=new O),e.x=0,e.y=0,e.z=i.z*(1-n),!(Math.abs(e.z)>=this._radii.z-t))return e};const ry=new O;ct.prototype.getLocalCurvature=function(i,t){p.typeOf.object("surfacePosition",i),C(t)||(t=new tt);const e=this.getSurfaceNormalIntersectionWithZAxis(i,0,ry),n=O.distance(i,e),s=this.minimumRadius*n/this.maximumRadius**2,o=n*s**2;return tt.fromElements(1/n,1/o,t)};const ay=[.14887433898163,.43339539412925,.67940956829902,.86506336668898,.97390652851717,0],cy=[.29552422471475,.26926671930999,.21908636251598,.14945134915058,.066671344308684,0];function wf(i,t,e){p.typeOf.number("a",i),p.typeOf.number("b",t),p.typeOf.func("func",e);const n=.5*(t+i),s=.5*(t-i);let o=0;for(let r=0;r<5;r++){const a=s*ay[r];o+=cy[r]*(e(n+a)+e(n-a))}return o*=s,o}ct.prototype.surfaceArea=function(i){p.typeOf.object("rectangle",i);const t=i.west;let e=i.east;const n=i.south,s=i.north;for(;e<t;)e+=T.TWO_PI;const o=this._radiiSquared,r=o.x,a=o.y,c=o.z,h=r*a;return wf(n,s,function(l){const u=Math.cos(l),f=Math.sin(l);return Math.cos(l)*wf(t,e,function(g){const _=Math.cos(g),y=Math.sin(g);return Math.sqrt(h*f*f+c*(a*_*_+r*y*y)*u*u)})})};function k(i,t,e,n,s,o,r,a,c){this[0]=i??0,this[1]=n??0,this[2]=r??0,this[3]=t??0,this[4]=s??0,this[5]=a??0,this[6]=e??0,this[7]=o??0,this[8]=c??0}k.packedLength=9,k.pack=function(i,t,e){return p.typeOf.object("value",i),p.defined("array",t),e=e??0,t[e++]=i[0],t[e++]=i[1],t[e++]=i[2],t[e++]=i[3],t[e++]=i[4],t[e++]=i[5],t[e++]=i[6],t[e++]=i[7],t[e++]=i[8],t},k.unpack=function(i,t,e){return p.defined("array",i),t=t??0,C(e)||(e=new k),e[0]=i[t++],e[1]=i[t++],e[2]=i[t++],e[3]=i[t++],e[4]=i[t++],e[5]=i[t++],e[6]=i[t++],e[7]=i[t++],e[8]=i[t++],e},k.packArray=function(i,t){p.defined("array",i);const e=i.length,n=e*9;if(!C(t))t=new Array(n);else{if(!Array.isArray(t)&&t.length!==n)throw new j("If result is a typed array, it must have exactly array.length * 9 elements");t.length!==n&&(t.length=n)}for(let s=0;s<e;++s)k.pack(i[s],t,s*9);return t},k.unpackArray=function(i,t){if(p.defined("array",i),p.typeOf.number.greaterThanOrEquals("array.length",i.length,9),i.length%9!==0)throw new j("array length must be a multiple of 9.");const e=i.length;C(t)?t.length=e/9:t=new Array(e/9);for(let n=0;n<e;n+=9){const s=n/9;t[s]=k.unpack(i,n,t[s])}return t},k.clone=function(i,t){if(C(i))return C(t)?(t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t):new k(i[0],i[3],i[6],i[1],i[4],i[7],i[2],i[5],i[8])},k.fromArray=k.unpack,k.fromColumnMajorArray=function(i,t){return p.defined("values",i),k.clone(i,t)},k.fromRowMajorArray=function(i,t){return p.defined("values",i),C(t)?(t[0]=i[0],t[1]=i[3],t[2]=i[6],t[3]=i[1],t[4]=i[4],t[5]=i[7],t[6]=i[2],t[7]=i[5],t[8]=i[8],t):new k(i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8])},k.fromQuaternion=function(i,t){p.typeOf.object("quaternion",i);const e=i.x*i.x,n=i.x*i.y,s=i.x*i.z,o=i.x*i.w,r=i.y*i.y,a=i.y*i.z,c=i.y*i.w,h=i.z*i.z,l=i.z*i.w,u=i.w*i.w,f=e-r-h+u,g=2*(n-l),_=2*(s+c),y=2*(n+l),w=-e+r-h+u,E=2*(a-o),b=2*(s-c),P=2*(a+o),I=-e-r+h+u;return C(t)?(t[0]=f,t[1]=y,t[2]=b,t[3]=g,t[4]=w,t[5]=P,t[6]=_,t[7]=E,t[8]=I,t):new k(f,g,_,y,w,E,b,P,I)},k.fromHeadingPitchRoll=function(i,t){p.typeOf.object("headingPitchRoll",i);const e=Math.cos(-i.pitch),n=Math.cos(-i.heading),s=Math.cos(i.roll),o=Math.sin(-i.pitch),r=Math.sin(-i.heading),a=Math.sin(i.roll),c=e*n,h=-s*r+a*o*n,l=a*r+s*o*n,u=e*r,f=s*n+a*o*r,g=-a*n+s*o*r,_=-o,y=a*e,w=s*e;return C(t)?(t[0]=c,t[1]=u,t[2]=_,t[3]=h,t[4]=f,t[5]=y,t[6]=l,t[7]=g,t[8]=w,t):new k(c,h,l,u,f,g,_,y,w)},k.fromScale=function(i,t){return p.typeOf.object("scale",i),C(t)?(t[0]=i.x,t[1]=0,t[2]=0,t[3]=0,t[4]=i.y,t[5]=0,t[6]=0,t[7]=0,t[8]=i.z,t):new k(i.x,0,0,0,i.y,0,0,0,i.z)},k.fromUniformScale=function(i,t){return p.typeOf.number("scale",i),C(t)?(t[0]=i,t[1]=0,t[2]=0,t[3]=0,t[4]=i,t[5]=0,t[6]=0,t[7]=0,t[8]=i,t):new k(i,0,0,0,i,0,0,0,i)},k.fromCrossProduct=function(i,t){return p.typeOf.object("vector",i),C(t)?(t[0]=0,t[1]=i.z,t[2]=-i.y,t[3]=-i.z,t[4]=0,t[5]=i.x,t[6]=i.y,t[7]=-i.x,t[8]=0,t):new k(0,-i.z,i.y,i.z,0,-i.x,-i.y,i.x,0)},k.fromRotationX=function(i,t){p.typeOf.number("angle",i);const e=Math.cos(i),n=Math.sin(i);return C(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=e,t[5]=n,t[6]=0,t[7]=-n,t[8]=e,t):new k(1,0,0,0,e,-n,0,n,e)},k.fromRotationY=function(i,t){p.typeOf.number("angle",i);const e=Math.cos(i),n=Math.sin(i);return C(t)?(t[0]=e,t[1]=0,t[2]=-n,t[3]=0,t[4]=1,t[5]=0,t[6]=n,t[7]=0,t[8]=e,t):new k(e,0,n,0,1,0,-n,0,e)},k.fromRotationZ=function(i,t){p.typeOf.number("angle",i);const e=Math.cos(i),n=Math.sin(i);return C(t)?(t[0]=e,t[1]=n,t[2]=0,t[3]=-n,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new k(e,-n,0,n,e,0,0,0,1)},k.toArray=function(i,t){return p.typeOf.object("matrix",i),C(t)?(t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t):[i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8]]},k.getElementIndex=function(i,t){return p.typeOf.number.greaterThanOrEquals("row",t,0),p.typeOf.number.lessThanOrEquals("row",t,2),p.typeOf.number.greaterThanOrEquals("column",i,0),p.typeOf.number.lessThanOrEquals("column",i,2),i*3+t},k.getColumn=function(i,t,e){p.typeOf.object("matrix",i),p.typeOf.number.greaterThanOrEquals("index",t,0),p.typeOf.number.lessThanOrEquals("index",t,2),p.typeOf.object("result",e);const n=t*3,s=i[n],o=i[n+1],r=i[n+2];return e.x=s,e.y=o,e.z=r,e},k.setColumn=function(i,t,e,n){p.typeOf.object("matrix",i),p.typeOf.number.greaterThanOrEquals("index",t,0),p.typeOf.number.lessThanOrEquals("index",t,2),p.typeOf.object("cartesian",e),p.typeOf.object("result",n),n=k.clone(i,n);const s=t*3;return n[s]=e.x,n[s+1]=e.y,n[s+2]=e.z,n},k.getRow=function(i,t,e){p.typeOf.object("matrix",i),p.typeOf.number.greaterThanOrEquals("index",t,0),p.typeOf.number.lessThanOrEquals("index",t,2),p.typeOf.object("result",e);const n=i[t],s=i[t+3],o=i[t+6];return e.x=n,e.y=s,e.z=o,e},k.setRow=function(i,t,e,n){return p.typeOf.object("matrix",i),p.typeOf.number.greaterThanOrEquals("index",t,0),p.typeOf.number.lessThanOrEquals("index",t,2),p.typeOf.object("cartesian",e),p.typeOf.object("result",n),n=k.clone(i,n),n[t]=e.x,n[t+3]=e.y,n[t+6]=e.z,n};const hy=new O;k.setScale=function(i,t,e){p.typeOf.object("matrix",i),p.typeOf.object("scale",t),p.typeOf.object("result",e);const n=k.getScale(i,hy),s=t.x/n.x,o=t.y/n.y,r=t.z/n.z;return e[0]=i[0]*s,e[1]=i[1]*s,e[2]=i[2]*s,e[3]=i[3]*o,e[4]=i[4]*o,e[5]=i[5]*o,e[6]=i[6]*r,e[7]=i[7]*r,e[8]=i[8]*r,e};const ly=new O;k.setUniformScale=function(i,t,e){p.typeOf.object("matrix",i),p.typeOf.number("scale",t),p.typeOf.object("result",e);const n=k.getScale(i,ly),s=t/n.x,o=t/n.y,r=t/n.z;return e[0]=i[0]*s,e[1]=i[1]*s,e[2]=i[2]*s,e[3]=i[3]*o,e[4]=i[4]*o,e[5]=i[5]*o,e[6]=i[6]*r,e[7]=i[7]*r,e[8]=i[8]*r,e};const mh=new O;k.getScale=function(i,t){return p.typeOf.object("matrix",i),p.typeOf.object("result",t),t.x=O.magnitude(O.fromElements(i[0],i[1],i[2],mh)),t.y=O.magnitude(O.fromElements(i[3],i[4],i[5],mh)),t.z=O.magnitude(O.fromElements(i[6],i[7],i[8],mh)),t};const vf=new O;k.getMaximumScale=function(i){return k.getScale(i,vf),O.maximumComponent(vf)};const uy=new O;k.setRotation=function(i,t,e){p.typeOf.object("matrix",i),p.typeOf.object("result",e);const n=k.getScale(i,uy);return e[0]=t[0]*n.x,e[1]=t[1]*n.x,e[2]=t[2]*n.x,e[3]=t[3]*n.y,e[4]=t[4]*n.y,e[5]=t[5]*n.y,e[6]=t[6]*n.z,e[7]=t[7]*n.z,e[8]=t[8]*n.z,e};const dy=new O;k.getRotation=function(i,t){p.typeOf.object("matrix",i),p.typeOf.object("result",t);const e=k.getScale(i,dy);return t[0]=i[0]/e.x,t[1]=i[1]/e.x,t[2]=i[2]/e.x,t[3]=i[3]/e.y,t[4]=i[4]/e.y,t[5]=i[5]/e.y,t[6]=i[6]/e.z,t[7]=i[7]/e.z,t[8]=i[8]/e.z,t},k.multiply=function(i,t,e){p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e);const n=i[0]*t[0]+i[3]*t[1]+i[6]*t[2],s=i[1]*t[0]+i[4]*t[1]+i[7]*t[2],o=i[2]*t[0]+i[5]*t[1]+i[8]*t[2],r=i[0]*t[3]+i[3]*t[4]+i[6]*t[5],a=i[1]*t[3]+i[4]*t[4]+i[7]*t[5],c=i[2]*t[3]+i[5]*t[4]+i[8]*t[5],h=i[0]*t[6]+i[3]*t[7]+i[6]*t[8],l=i[1]*t[6]+i[4]*t[7]+i[7]*t[8],u=i[2]*t[6]+i[5]*t[7]+i[8]*t[8];return e[0]=n,e[1]=s,e[2]=o,e[3]=r,e[4]=a,e[5]=c,e[6]=h,e[7]=l,e[8]=u,e},k.add=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e[0]=i[0]+t[0],e[1]=i[1]+t[1],e[2]=i[2]+t[2],e[3]=i[3]+t[3],e[4]=i[4]+t[4],e[5]=i[5]+t[5],e[6]=i[6]+t[6],e[7]=i[7]+t[7],e[8]=i[8]+t[8],e},k.subtract=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e[0]=i[0]-t[0],e[1]=i[1]-t[1],e[2]=i[2]-t[2],e[3]=i[3]-t[3],e[4]=i[4]-t[4],e[5]=i[5]-t[5],e[6]=i[6]-t[6],e[7]=i[7]-t[7],e[8]=i[8]-t[8],e},k.multiplyByVector=function(i,t,e){p.typeOf.object("matrix",i),p.typeOf.object("cartesian",t),p.typeOf.object("result",e);const n=t.x,s=t.y,o=t.z,r=i[0]*n+i[3]*s+i[6]*o,a=i[1]*n+i[4]*s+i[7]*o,c=i[2]*n+i[5]*s+i[8]*o;return e.x=r,e.y=a,e.z=c,e},k.multiplyByScalar=function(i,t,e){return p.typeOf.object("matrix",i),p.typeOf.number("scalar",t),p.typeOf.object("result",e),e[0]=i[0]*t,e[1]=i[1]*t,e[2]=i[2]*t,e[3]=i[3]*t,e[4]=i[4]*t,e[5]=i[5]*t,e[6]=i[6]*t,e[7]=i[7]*t,e[8]=i[8]*t,e},k.multiplyByScale=function(i,t,e){return p.typeOf.object("matrix",i),p.typeOf.object("scale",t),p.typeOf.object("result",e),e[0]=i[0]*t.x,e[1]=i[1]*t.x,e[2]=i[2]*t.x,e[3]=i[3]*t.y,e[4]=i[4]*t.y,e[5]=i[5]*t.y,e[6]=i[6]*t.z,e[7]=i[7]*t.z,e[8]=i[8]*t.z,e},k.multiplyByUniformScale=function(i,t,e){return p.typeOf.object("matrix",i),p.typeOf.number("scale",t),p.typeOf.object("result",e),e[0]=i[0]*t,e[1]=i[1]*t,e[2]=i[2]*t,e[3]=i[3]*t,e[4]=i[4]*t,e[5]=i[5]*t,e[6]=i[6]*t,e[7]=i[7]*t,e[8]=i[8]*t,e},k.negate=function(i,t){return p.typeOf.object("matrix",i),p.typeOf.object("result",t),t[0]=-i[0],t[1]=-i[1],t[2]=-i[2],t[3]=-i[3],t[4]=-i[4],t[5]=-i[5],t[6]=-i[6],t[7]=-i[7],t[8]=-i[8],t},k.transpose=function(i,t){p.typeOf.object("matrix",i),p.typeOf.object("result",t);const e=i[0],n=i[3],s=i[6],o=i[1],r=i[4],a=i[7],c=i[2],h=i[5],l=i[8];return t[0]=e,t[1]=n,t[2]=s,t[3]=o,t[4]=r,t[5]=a,t[6]=c,t[7]=h,t[8]=l,t};function fy(i){let t=0;for(let e=0;e<9;++e){const n=i[e];t+=n*n}return Math.sqrt(t)}const _h=[1,0,0],yh=[2,2,1];function gy(i){let t=0;for(let e=0;e<3;++e){const n=i[k.getElementIndex(yh[e],_h[e])];t+=2*n*n}return Math.sqrt(t)}function py(i,t){const e=T.EPSILON15;let n=0,s=1;for(let h=0;h<3;++h){const l=Math.abs(i[k.getElementIndex(yh[h],_h[h])]);l>n&&(s=h,n=l)}let o=1,r=0;const a=_h[s],c=yh[s];if(Math.abs(i[k.getElementIndex(c,a)])>e){const h=i[k.getElementIndex(c,c)],l=i[k.getElementIndex(a,a)],u=i[k.getElementIndex(c,a)],f=(h-l)/2/u;let g;f<0?g=-1/(-f+Math.sqrt(1+f*f)):g=1/(f+Math.sqrt(1+f*f)),o=1/Math.sqrt(1+g*g),r=g*o}return t=k.clone(k.IDENTITY,t),t[k.getElementIndex(a,a)]=t[k.getElementIndex(c,c)]=o,t[k.getElementIndex(c,a)]=r,t[k.getElementIndex(a,c)]=-r,t}const ha=new k,Ef=new k;k.computeEigenDecomposition=function(i,t){p.typeOf.object("matrix",i);const e=T.EPSILON20,n=10;let s=0,o=0;C(t)||(t={});const r=t.unitary=k.clone(k.IDENTITY,t.unitary),a=t.diagonal=k.clone(i,t.diagonal),c=e*fy(a);for(;o<n&&gy(a)>c;)py(a,ha),k.transpose(ha,Ef),k.multiply(a,ha,a),k.multiply(Ef,a,a),k.multiply(r,ha,r),++s>2&&(++o,s=0);return t},k.abs=function(i,t){return p.typeOf.object("matrix",i),p.typeOf.object("result",t),t[0]=Math.abs(i[0]),t[1]=Math.abs(i[1]),t[2]=Math.abs(i[2]),t[3]=Math.abs(i[3]),t[4]=Math.abs(i[4]),t[5]=Math.abs(i[5]),t[6]=Math.abs(i[6]),t[7]=Math.abs(i[7]),t[8]=Math.abs(i[8]),t},k.determinant=function(i){p.typeOf.object("matrix",i);const t=i[0],e=i[3],n=i[6],s=i[1],o=i[4],r=i[7],a=i[2],c=i[5],h=i[8];return t*(o*h-c*r)+s*(c*n-e*h)+a*(e*r-o*n)},k.inverse=function(i,t){p.typeOf.object("matrix",i),p.typeOf.object("result",t);const e=i[0],n=i[1],s=i[2],o=i[3],r=i[4],a=i[5],c=i[6],h=i[7],l=i[8],u=k.determinant(i);if(Math.abs(u)<=T.EPSILON15)throw new j("matrix is not invertible");t[0]=r*l-h*a,t[1]=h*s-n*l,t[2]=n*a-r*s,t[3]=c*a-o*l,t[4]=e*l-c*s,t[5]=o*s-e*a,t[6]=o*h-c*r,t[7]=c*n-e*h,t[8]=e*r-o*n;const f=1/u;return k.multiplyByScalar(t,f,t)};const my=new k;k.inverseTranspose=function(i,t){return p.typeOf.object("matrix",i),p.typeOf.object("result",t),k.inverse(k.transpose(i,my),t)},k.equals=function(i,t){return i===t||C(i)&&C(t)&&i[0]===t[0]&&i[1]===t[1]&&i[2]===t[2]&&i[3]===t[3]&&i[4]===t[4]&&i[5]===t[5]&&i[6]===t[6]&&i[7]===t[7]&&i[8]===t[8]},k.equalsEpsilon=function(i,t,e){return e=e??0,i===t||C(i)&&C(t)&&Math.abs(i[0]-t[0])<=e&&Math.abs(i[1]-t[1])<=e&&Math.abs(i[2]-t[2])<=e&&Math.abs(i[3]-t[3])<=e&&Math.abs(i[4]-t[4])<=e&&Math.abs(i[5]-t[5])<=e&&Math.abs(i[6]-t[6])<=e&&Math.abs(i[7]-t[7])<=e&&Math.abs(i[8]-t[8])<=e},k.IDENTITY=Object.freeze(new k(1,0,0,0,1,0,0,0,1)),k.ZERO=Object.freeze(new k(0,0,0,0,0,0,0,0,0)),k.COLUMN0ROW0=0,k.COLUMN0ROW1=1,k.COLUMN0ROW2=2,k.COLUMN1ROW0=3,k.COLUMN1ROW1=4,k.COLUMN1ROW2=5,k.COLUMN2ROW0=6,k.COLUMN2ROW1=7,k.COLUMN2ROW2=8,Object.defineProperties(k.prototype,{length:{get:function(){return k.packedLength}}}),k.prototype.clone=function(i){return k.clone(this,i)},k.prototype.equals=function(i){return k.equals(this,i)},k.equalsArray=function(i,t,e){return i[0]===t[e]&&i[1]===t[e+1]&&i[2]===t[e+2]&&i[3]===t[e+3]&&i[4]===t[e+4]&&i[5]===t[e+5]&&i[6]===t[e+6]&&i[7]===t[e+7]&&i[8]===t[e+8]},k.prototype.equalsEpsilon=function(i,t){return k.equalsEpsilon(this,i,t)},k.prototype.toString=function(){return`(${this[0]}, ${this[3]}, ${this[6]})
21
+ `)}}),window.g_XE3CopyRights=window.g_XE3CopyRights||{},window.g_XE3CopyRights[n]=X.copyright,window.g_earthsdk_copyright_print=window.g_earthsdk_copyright_print??!0,window.g_earthsdk_copyright_print&&X.copyright.print()}catch{}class on extends p.Destroyable{constructor(){super()}}I(on,"defaults",{enabled:!0}),(n=>{n.createDefaultProps=()=>({enabled:!0})})(on||(on={})),p.extendClassProps(on.prototype,on.createDefaultProps);function $g(n){return Math.pow(n,3)}function Xs(n){return 1-$g(1-n)}function vv(n){return 3*n*n-2*n*n*n}function bv(n){return n}function Ev(n,e,t){let i,s;t=t||li;let o=0,r=n.length,a=!1;for(;o<r;)i=o+(r-o>>1),s=+t(n[i],e),s<0?o=i+1:(r=i,a=!s);return a?o:~o}function li(n,e){return n>e?1:n<e?-1:0}function Cv(n,e){return n<e?1:n>e?-1:0}function Xl(n,e,t){if(n[0]<=e)return 0;const i=n.length;if(e<=n[i-1])return i-1;if(typeof t=="function"){for(let s=1;s<i;++s){const o=n[s];if(o===e)return s;if(o<e)return t(e,n[s-1],o)>0?s-1:s}return i-1}if(t>0){for(let s=1;s<i;++s)if(n[s]<e)return s-1;return i-1}if(t<0){for(let s=1;s<i;++s)if(n[s]<=e)return s;return i-1}for(let s=1;s<i;++s){if(n[s]==e)return s;if(n[s]<e)return n[s-1]-e<e-n[s]?s-1:s}return i-1}function xv(n,e,t){for(;e<t;){const i=n[e];n[e]=n[t],n[t]=i,++e,--t}}function ci(n,e){const t=Array.isArray(e)?e:[e],i=t.length;for(let s=0;s<i;s++)n[n.length]=t[s]}function us(n,e){const t=n.length;if(t!==e.length)return!1;for(let i=0;i<t;i++)if(n[i]!==e[i])return!1;return!0}function Pv(n,e,t){const i=e||li;return n.every(function(s,o){if(o===0)return!0;const r=i(n[o-1],s);return!(r>0||r===0)})}const Dt={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Hr(n){const e=gn();for(let t=0,i=n.length;t<i;++t)Xr(e,n[t]);return e}function Sv(n,e,t){const i=Math.min.apply(null,n),s=Math.min.apply(null,e),o=Math.max.apply(null,n),r=Math.max.apply(null,e);return Fi(i,s,o,r,t)}function hi(n,e,t){return t?(t[0]=n[0]-e,t[1]=n[1]-e,t[2]=n[2]+e,t[3]=n[3]+e,t):[n[0]-e,n[1]-e,n[2]+e,n[3]+e]}function Hg(n,e){return e?(e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e):n.slice()}function Ys(n,e,t){let i,s;return e<n[0]?i=n[0]-e:n[2]<e?i=e-n[2]:i=0,t<n[1]?s=n[1]-t:n[3]<t?s=t-n[3]:s=0,i*i+s*s}function Zs(n,e){return Au(n,e[0],e[1])}function Di(n,e){return n[0]<=e[0]&&e[2]<=n[2]&&n[1]<=e[1]&&e[3]<=n[3]}function Au(n,e,t){return n[0]<=e&&e<=n[2]&&n[1]<=t&&t<=n[3]}function Mu(n,e){const t=n[0],i=n[1],s=n[2],o=n[3],r=e[0],a=e[1];let l=Dt.UNKNOWN;return r<t?l=l|Dt.LEFT:r>s&&(l=l|Dt.RIGHT),a<i?l=l|Dt.BELOW:a>o&&(l=l|Dt.ABOVE),l===Dt.UNKNOWN&&(l=Dt.INTERSECTING),l}function gn(){return[1/0,1/0,-1/0,-1/0]}function Fi(n,e,t,i,s){return s?(s[0]=n,s[1]=e,s[2]=t,s[3]=i,s):[n,e,t,i]}function Wo(n){return Fi(1/0,1/0,-1/0,-1/0,n)}function Xg(n,e){const t=n[0],i=n[1];return Fi(t,i,t,i,e)}function Du(n,e,t,i,s){const o=Wo(s);return Zg(o,n,e,t,i)}function Li(n,e){return n[0]==e[0]&&n[2]==e[2]&&n[1]==e[1]&&n[3]==e[3]}function Yg(n,e){return e[0]<n[0]&&(n[0]=e[0]),e[2]>n[2]&&(n[2]=e[2]),e[1]<n[1]&&(n[1]=e[1]),e[3]>n[3]&&(n[3]=e[3]),n}function Xr(n,e){e[0]<n[0]&&(n[0]=e[0]),e[0]>n[2]&&(n[2]=e[0]),e[1]<n[1]&&(n[1]=e[1]),e[1]>n[3]&&(n[3]=e[1])}function Zg(n,e,t,i,s){for(;t<i;t+=s)Rv(n,e[t],e[t+1]);return n}function Rv(n,e,t){n[0]=Math.min(n[0],e),n[1]=Math.min(n[1],t),n[2]=Math.max(n[2],e),n[3]=Math.max(n[3],t)}function Kg(n,e){let t;return t=e(Yl(n)),t||(t=e(Zl(n)),t)||(t=e(Ql(n)),t)||(t=e(rn(n)),t)?t:!1}function Fu(n){let e=0;return zi(n)||(e=Ie(n)*lt(n)),e}function Yl(n){return[n[0],n[1]]}function Zl(n){return[n[2],n[1]]}function xn(n){return[(n[0]+n[2])/2,(n[1]+n[3])/2]}function Tv(n,e){let t;if(e==="bottom-left")t=Yl(n);else if(e==="bottom-right")t=Zl(n);else if(e==="top-left")t=rn(n);else if(e==="top-right")t=Ql(n);else throw new Error("Invalid corner");return t}function Kl(n,e,t,i,s){const[o,r,a,l,c,h,u,d]=Qg(n,e,t,i);return Fi(Math.min(o,a,c,u),Math.min(r,l,h,d),Math.max(o,a,c,u),Math.max(r,l,h,d),s)}function Qg(n,e,t,i){const s=e*i[0]/2,o=e*i[1]/2,r=Math.cos(t),a=Math.sin(t),l=s*r,c=s*a,h=o*r,u=o*a,d=n[0],f=n[1];return[d-l+u,f-c-h,d-l-u,f-c+h,d+l-u,f+c+h,d+l+u,f+c-h,d-l+u,f-c-h]}function lt(n){return n[3]-n[1]}function Bn(n,e,t){const i=t||gn();return pt(n,e)?(n[0]>e[0]?i[0]=n[0]:i[0]=e[0],n[1]>e[1]?i[1]=n[1]:i[1]=e[1],n[2]<e[2]?i[2]=n[2]:i[2]=e[2],n[3]<e[3]?i[3]=n[3]:i[3]=e[3]):Wo(i),i}function rn(n){return[n[0],n[3]]}function Ql(n){return[n[2],n[3]]}function Ie(n){return n[2]-n[0]}function pt(n,e){return n[0]<=e[2]&&n[2]>=e[0]&&n[1]<=e[3]&&n[3]>=e[1]}function zi(n){return n[2]<n[0]||n[3]<n[1]}function Iv(n,e){return e?(e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e):n}function Ov(n,e){const t=(n[2]-n[0])/2*(e-1),i=(n[3]-n[1])/2*(e-1);n[0]-=t,n[2]+=t,n[1]-=i,n[3]+=i}function Av(n,e,t){let i=!1;const s=Mu(n,e),o=Mu(n,t);if(s===Dt.INTERSECTING||o===Dt.INTERSECTING)i=!0;else{const r=n[0],a=n[1],l=n[2],c=n[3],h=e[0],u=e[1],d=t[0],f=t[1],g=(f-u)/(d-h);let _,v;o&Dt.ABOVE&&!(s&Dt.ABOVE)&&(_=d-(f-c)/g,i=_>=r&&_<=l),!i&&o&Dt.RIGHT&&!(s&Dt.RIGHT)&&(v=f-(d-l)*g,i=v>=a&&v<=c),!i&&o&Dt.BELOW&&!(s&Dt.BELOW)&&(_=d-(f-a)/g,i=_>=r&&_<=l),!i&&o&Dt.LEFT&&!(s&Dt.LEFT)&&(v=f-(d-r)*g,i=v>=a&&v<=c)}return i}function Jg(n,e,t,i){if(zi(n))return Wo(t);let s=[];if(i>1){const a=n[2]-n[0],l=n[3]-n[1];for(let c=0;c<i;++c)s.push(n[0]+a*c/i,n[1],n[2],n[1]+l*c/i,n[2]-a*c/i,n[3],n[0],n[3]-l*c/i)}else s=[n[0],n[1],n[2],n[1],n[2],n[3],n[0],n[3]];e(s,s,2);const o=[],r=[];for(let a=0,l=s.length;a<l;a+=2)o.push(s[a]),r.push(s[a+1]);return Sv(o,r,t)}function em(n,e){const t=e.getExtent(),i=xn(n);if(e.canWrapX()&&(i[0]<t[0]||i[0]>=t[2])){const s=Ie(t),r=Math.floor((i[0]-t[0])/s)*s;n[0]-=r,n[2]-=r}return n}function tm(n,e,t){if(e.canWrapX()){const i=e.getExtent();if(!isFinite(n[0])||!isFinite(n[2]))return[[i[0],n[1],i[2],n[3]]];em(n,e);const s=Ie(i);if(Ie(n)>s&&!t)return[[i[0],n[1],i[2],n[3]]];if(n[0]<i[0])return[[n[0]+s,n[1],i[2],n[3]],[i[0],n[1],n[2],n[3]]];if(n[2]>i[2])return[[n[0],n[1],i[2],n[3]],[i[0],n[1],n[2]-s,n[3]]]}return[n]}function ct(n,e,t){return Math.min(Math.max(n,e),t)}function Mv(n,e,t,i,s,o){const r=s-t,a=o-i;if(r!==0||a!==0){const l=((n-t)*r+(e-i)*a)/(r*r+a*a);l>1?(t=s,i=o):l>0&&(t+=r*l,i+=a*l)}return Ks(n,e,t,i)}function Ks(n,e,t,i){const s=t-n,o=i-e;return s*s+o*o}function Dv(n){const e=n.length;for(let i=0;i<e;i++){let s=i,o=Math.abs(n[i][i]);for(let a=i+1;a<e;a++){const l=Math.abs(n[a][i]);l>o&&(o=l,s=a)}if(o===0)return null;const r=n[s];n[s]=n[i],n[i]=r;for(let a=i+1;a<e;a++){const l=-n[a][i]/n[i][i];for(let c=i;c<e+1;c++)i==c?n[a][c]=0:n[a][c]+=l*n[i][c]}}const t=new Array(e);for(let i=e-1;i>=0;i--){t[i]=n[i][e]/n[i][i];for(let s=i-1;s>=0;s--)n[s][e]-=n[s][i]*t[i]}return t}function nm(n){return n*180/Math.PI}function ds(n){return n*Math.PI/180}function fs(n,e){const t=n%e;return t*e<0?t+e:t}function mn(n,e,t){return n+t*(e-n)}function Yr(n,e){const t=Math.pow(10,e);return Math.round(n*t)/t}function im(n,e){return Math.round(Yr(n,e))}function Jl(n,e){return Math.floor(Yr(n,e))}function ps(n,e){return Math.ceil(Yr(n,e))}function Lu(n,e,t){if(n>=e&&n<t)return n;const i=t-e;return((n-e)%i+i)%i+e}const sm=63710088e-1;function zu(n,e,t){t=t||sm;const i=ds(n[1]),s=ds(e[1]),o=(s-i)/2,r=ds(e[0]-n[0])/2,a=Math.sin(o)*Math.sin(o)+Math.sin(r)*Math.sin(r)*Math.cos(i)*Math.cos(s);return 2*t*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function Nu(n,e){let t=0;for(let i=0,s=n.length;i<s-1;++i)t+=zu(n[i],n[i+1],e);return t}function om(n,e){e=e||{};const t=e.radius||sm,i=e.projection||"EPSG:3857",s=n.getType();s!=="GeometryCollection"&&(n=n.clone().transform(i,"EPSG:4326"));let o=0,r,a,l,c,h,u;switch(s){case"Point":case"MultiPoint":break;case"LineString":case"LinearRing":{r=n.getCoordinates(),o=Nu(r,t);break}case"MultiLineString":case"Polygon":{for(r=n.getCoordinates(),l=0,c=r.length;l<c;++l)o+=Nu(r[l],t);break}case"MultiPolygon":{for(r=n.getCoordinates(),l=0,c=r.length;l<c;++l)for(a=r[l],h=0,u=a.length;h<u;++h)o+=Nu(a[h],t);break}case"GeometryCollection":{const d=n.getGeometries();for(l=0,c=d.length;l<c;++l)o+=om(d[l],e);break}default:throw new Error("Unsupported geometry type: "+s)}return o}function be(){throw new Error("Unimplemented abstract method.")}let Fv=0;function Re(n){return n.ol_uid||(n.ol_uid=String(++Fv))}const Lv="10.8.0",Vo={PROPERTYCHANGE:"propertychange"},we={CHANGE:"change",ERROR:"error",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",TOUCHMOVE:"touchmove",WHEEL:"wheel"};class Zr{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function Kr(){return!0}function ec(){return!1}function Qr(){}function rm(n){let e,t,i;return function(){const s=Array.prototype.slice.call(arguments);return(!t||this!==i||!us(s,t))&&(i=this,t=s,e=n.apply(this,arguments)),e}}function Bo(n){function e(){let t;try{t=n()}catch(i){return Promise.reject(i)}return t instanceof Promise?t:Promise.resolve(t)}return e()}function Jr(n){for(const e in n)delete n[e]}function gs(n){let e;for(e in n)return!1;return!e}class $n{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}class ea extends Zr{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;const i=this.listeners_||(this.listeners_={}),s=i[e]||(i[e]=[]);s.includes(t)||s.push(t)}dispatchEvent(e){const t=typeof e=="string",i=t?e:e.type,s=this.listeners_&&this.listeners_[i];if(!s)return;const o=t?new $n(e):e;o.target||(o.target=this.eventTarget_||this);const r=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});i in r||(r[i]=0,a[i]=0),++r[i];let l;for(let c=0,h=s.length;c<h;++c)if("handleEvent"in s[c]?l=s[c].handleEvent(o):l=s[c].call(this,o),l===!1||o.propagationStopped){l=!1;break}if(--r[i]===0){let c=a[i];for(delete a[i];c--;)this.removeEventListener(i,Qr);delete r[i]}return l}disposeInternal(){this.listeners_&&Jr(this.listeners_)}getListeners(e){return this.listeners_&&this.listeners_[e]||void 0}hasListener(e){return this.listeners_?e?e in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(e,t){if(!this.listeners_)return;const i=this.listeners_[e];if(!i)return;const s=i.indexOf(t);s!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(i[s]=Qr,++this.pendingRemovals_[e]):(i.splice(s,1),i.length===0&&delete this.listeners_[e]))}}function qe(n,e,t,i,s){if(s){const r=t;t=function(a){return n.removeEventListener(e,t),r.call(i??this,a)}}else i&&i!==n&&(t=t.bind(i));const o={target:n,type:e,listener:t};return n.addEventListener(e,t),o}function tc(n,e,t,i){return qe(n,e,t,i,!0)}function st(n){n&&n.target&&(n.target.removeEventListener(n.type,n.listener),Jr(n))}class ta extends ea{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(we.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){const i=e.length,s=new Array(i);for(let o=0;o<i;++o)s[o]=qe(this,e[o],t);return s}return qe(this,e,t)}onceInternal(e,t){let i;if(Array.isArray(e)){const s=e.length;i=new Array(s);for(let o=0;o<s;++o)i[o]=tc(this,e[o],t)}else i=tc(this,e,t);return t.ol_key=i,i}unInternal(e,t){const i=t.ol_key;if(i)ui(i);else if(Array.isArray(e))for(let s=0,o=e.length;s<o;++s)this.removeEventListener(e[s],t);else this.removeEventListener(e,t)}}ta.prototype.on,ta.prototype.once,ta.prototype.un;function ui(n){if(Array.isArray(n))for(let e=0,t=n.length;e<t;++e)st(n[e]);else st(n)}class am extends $n{constructor(e,t,i){super(e),this.key=t,this.oldValue=i}}class di extends ta{constructor(e){super(),this.on,this.once,this.un,Re(this),this.values_=null,e!==void 0&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}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(e,t){let i;i=`change:${e}`,this.hasListener(i)&&this.dispatchEvent(new am(i,e,t)),i=Vo.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new am(i,e,t))}addChangeListener(e,t){this.addEventListener(`change:${e}`,t)}removeChangeListener(e,t){this.removeEventListener(`change:${e}`,t)}set(e,t,i){const s=this.values_||(this.values_={});if(i)s[e]=t;else{const o=s[e];s[e]=t,o!==t&&this.notify(e,o)}}setProperties(e,t){for(const i in e)this.set(i,e[i],t)}applyProperties(e){e.values_&&Object.assign(this.values_||(this.values_={}),e.values_)}unset(e,t){if(this.values_&&e in this.values_){const i=this.values_[e];delete this.values_[e],gs(this.values_)&&(this.values_=null),t||this.notify(e,i)}}}function lm(...n){console.warn(...n)}function cm(n,e){const t=(""+n).split("."),i=(""+e).split(".");for(let s=0;s<Math.max(t.length,i.length);s++){const o=parseInt(t[s]||"0",10),r=parseInt(i[s]||"0",10);if(o>r)return 1;if(r>o)return-1}return 0}function zv(n,e){return n[0]+=+e[0],n[1]+=+e[1],n}function nc(n,e){let t=!0;for(let i=n.length-1;i>=0;--i)if(n[i]!=e[i]){t=!1;break}return t}function ku(n,e){const t=Math.cos(e),i=Math.sin(e),s=n[0]*t-n[1]*i,o=n[1]*t+n[0]*i;return n[0]=s,n[1]=o,n}function Nv(n,e){return n[0]*=e,n[1]*=e,n}function kv(n,e){const t=n[0]-e[0],i=n[1]-e[1];return t*t+i*i}function jv(n,e){return Math.sqrt(kv(n,e))}function ju(n,e){if(e.canWrapX()){const t=Ie(e.getExtent()),i=Uv(n,e,t);i&&(n[0]-=i*t)}return n}function Uv(n,e,t){const i=e.getExtent();let s=0;return e.canWrapX()&&(n[0]<i[0]||n[0]>i[2])&&(t=t||Ie(i),s=Math.floor((n[0]-i[0])/t)),s}function Gv(n,e,t){const i=Math.sqrt((e[0]-n[0])*(e[0]-n[0])+(e[1]-n[1])*(e[1]-n[1])),s=[(e[0]-n[0])/i,(e[1]-n[1])/i],o=[-s[1],s[0]],r=Math.sqrt((t[0]-n[0])*(t[0]-n[0])+(t[1]-n[1])*(t[1]-n[1])),a=[(t[0]-n[0])/r,(t[1]-n[1])/r];let l=i===0||r===0?0:Math.acos(ct(a[0]*s[0]+a[1]*s[1],-1,1));return l=Math.max(l,1e-5),a[0]*o[0]+a[1]*o[1]>0?l:Math.PI*2-l}const ic={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class na{constructor(e){this.code_=e.code,this.units_=e.units,this.extent_=e.extent!==void 0?e.extent:null,this.worldExtent_=e.worldExtent!==void 0?e.worldExtent:null,this.axisOrientation_=e.axisOrientation!==void 0?e.axisOrientation:"enu",this.global_=e.global!==void 0?e.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=e.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=e.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||ic[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!!(e&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!!(this.global_&&e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}}const ia=6378137,$o=Math.PI*ia,qv=[-$o,-$o,$o,$o],Wv=[-180,-85,180,85],sc=ia*Math.log(Math.tan(Math.PI/2));class Ho extends na{constructor(e){super({code:e,units:"m",extent:qv,global:!0,worldExtent:Wv,getPointResolution:function(t,i){return t/Math.cosh(i[1]/ia)}})}}const hm=[new Ho("EPSG:3857"),new Ho("EPSG:102100"),new Ho("EPSG:102113"),new Ho("EPSG:900913"),new Ho("http://www.opengis.net/def/crs/EPSG/0/3857"),new Ho("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Vv(n,e,t,i){const s=n.length;t=t>1?t:2,i=i??t,e===void 0&&(t>2?e=n.slice():e=new Array(s));for(let o=0;o<s;o+=i){e[o]=$o*n[o]/180;let r=ia*Math.log(Math.tan(Math.PI*(+n[o+1]+90)/360));r>sc?r=sc:r<-sc&&(r=-sc),e[o+1]=r}return e}function Bv(n,e,t,i){const s=n.length;t=t>1?t:2,i=i??t,e===void 0&&(t>2?e=n.slice():e=new Array(s));for(let o=0;o<s;o+=i)e[o]=180*n[o]/$o,e[o+1]=360*Math.atan(Math.exp(n[o+1]/ia))/Math.PI-90;return e}const $v=6378137,um=[-180,-90,180,90],Hv=Math.PI*$v/180;class Qs extends na{constructor(e,t){super({code:e,units:"degrees",extent:um,axisOrientation:t,global:!0,metersPerUnit:Hv,worldExtent:um})}}const dm=[new Qs("CRS:84"),new Qs("EPSG:4326","neu"),new Qs("urn:ogc:def:crs:OGC:1.3:CRS84"),new Qs("urn:ogc:def:crs:OGC:2:84"),new Qs("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Qs("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Qs("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Uu={};function Xv(n){return Uu[n]||Uu[n.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function Yv(n,e){Uu[n]=e}let Xo={};function Js(n,e,t){const i=n.getCode(),s=e.getCode();i in Xo||(Xo[i]={}),Xo[i][s]=t}function Gu(n,e){return n in Xo&&e in Xo[n]?Xo[n][e]:null}const oc=.9996,Pn=.00669438,rc=Pn*Pn,ac=rc*Pn,eo=Pn/(1-Pn),fm=Math.sqrt(1-Pn),Yo=(1-fm)/(1+fm),pm=Yo*Yo,qu=pm*Yo,Wu=qu*Yo,gm=Wu*Yo,mm=1-Pn/4-3*rc/64-5*ac/256,Zv=3*Pn/8+3*rc/32+45*ac/1024,Kv=15*rc/256+45*ac/1024,Qv=35*ac/3072,Jv=3/2*Yo-27/32*qu+269/512*gm,eb=21/16*pm-55/32*Wu,tb=151/96*qu-417/128*gm,nb=1097/512*Wu,lc=6378137;function ib(n,e,t){const i=n-5e5,r=(t.north?e:e-1e7)/oc/(lc*mm),a=r+Jv*Math.sin(2*r)+eb*Math.sin(4*r)+tb*Math.sin(6*r)+nb*Math.sin(8*r),l=Math.sin(a),c=l*l,h=Math.cos(a),u=l/h,d=u*u,f=d*d,g=1-Pn*c,_=Math.sqrt(1-Pn*c),v=lc/_,E=(1-Pn)/g,w=eo*h**2,C=w*w,P=i/(v*oc),R=P*P,A=R*P,O=A*P,M=O*P,z=M*P,k=a-u/E*(R/2-O/24*(5+3*d+10*w-4*C-9*eo))+z/720*(61+90*d+298*w+45*f-252*eo-3*C);let q=(P-A/6*(1+2*d+w)+M/120*(5-2*w+28*d-3*C+8*eo+24*f))/h;return q=Lu(q+ds(wm(t.number)),-Math.PI,Math.PI),[nm(q),nm(k)]}const ym=-80,_m=84,sb=-180,ob=180;function rb(n,e,t){n=Lu(n,sb,ob),e<ym?e=ym:e>_m&&(e=_m);const i=ds(e),s=Math.sin(i),o=Math.cos(i),r=s/o,a=r*r,l=a*a,c=ds(n),h=wm(t.number),u=ds(h),d=lc/Math.sqrt(1-Pn*s**2),f=eo*o**2,g=o*Lu(c-u,-Math.PI,Math.PI),_=g*g,v=_*g,E=v*g,w=E*g,C=w*g,P=lc*(mm*i-Zv*Math.sin(2*i)+Kv*Math.sin(4*i)-Qv*Math.sin(6*i)),R=oc*d*(g+v/6*(1-a+f)+w/120*(5-18*a+l+72*f-58*eo))+5e5;let A=oc*(P+d*r*(_/2+E/24*(5-a+9*f+4*f**2)+C/720*(61-58*a+l+600*f-330*eo)));return t.north||(A+=1e7),[R,A]}function wm(n){return(n-1)*6-180+3}const ab=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function vm(n){let e=0;for(const s of ab){const o=n.match(s);if(o){e=parseInt(o[1]);break}}if(!e)return null;let t=0,i=!1;return e>32700&&e<32761?t=e-32700:e>32600&&e<32661&&(i=!0,t=e-32600),t?{number:t,north:i}:null}function bm(n,e){return function(t,i,s,o){const r=t.length;s=s>1?s:2,o=o??s,i||(s>2?i=t.slice():i=new Array(r));for(let a=0;a<r;a+=o){const l=t[a],c=t[a+1],h=n(l,c,e);i[a]=h[0],i[a+1]=h[1]}return i}}function lb(n){return vm(n)?new na({code:n,units:"m"}):null}function cb(n){const e=vm(n.getCode());return e?{forward:bm(rb,e),inverse:bm(ib,e)}:null}const hb=[cb],ub=[lb];let Vu=!0;function Em(n){Vu=!1}function Bu(n,e){if(e!==void 0){for(let t=0,i=n.length;t<i;++t)e[t]=n[t];e=e}else e=n.slice();return e}function cc(n){Yv(n.getCode(),n),Js(n,n,Bu)}function db(n){n.forEach(cc)}function Ne(n){if(typeof n!="string")return n;const e=Xv(n);if(e)return e;for(const t of ub){const i=t(n);if(i)return i}return null}function Cm(n,e,t,i){n=Ne(n);let s;const o=n.getPointResolutionFunc();if(o)s=o(e,t);else{const r=n.getUnits();if(r=="degrees"&&!i||i=="degrees")s=e;else{const a=sa(n,Ne("EPSG:4326"));if(!a&&r!=="degrees")s=e*n.getMetersPerUnit();else{let c=[t[0]-e/2,t[1],t[0]+e/2,t[1],t[0],t[1]-e/2,t[0],t[1]+e/2];c=a(c,c,2);const h=zu(c.slice(0,2),c.slice(2,4)),u=zu(c.slice(4,6),c.slice(6,8));s=(h+u)/2}const l=n.getMetersPerUnit();l!==void 0&&(s/=l)}}return s}function xm(n){db(n),n.forEach(function(e){n.forEach(function(t){e!==t&&Js(e,t,Bu)})})}function fb(n,e,t,i){n.forEach(function(s){e.forEach(function(o){Js(s,o,t),Js(o,s,i)})})}function $u(n,e){return n?typeof n=="string"?Ne(n):n:Ne(e)}function Hu(n){return(function(e,t,i,s){const o=e.length;i=i!==void 0?i:2,s=s??i,t=t!==void 0?t:new Array(o);for(let r=0;r<o;r+=s){const a=n(e.slice(r,r+i)),l=a.length;for(let c=0,h=s;c<h;++c)t[r+c]=c>=l?e[r+c]:a[c]}return t})}function Pm(n,e,t,i){const s=Ne(n),o=Ne(e);Js(s,o,Hu(t)),Js(o,s,Hu(i))}function Me(n,e){return Em(),Zo(n,"EPSG:4326",e!==void 0?e:"EPSG:3857")}function Ft(n,e){const t=Zo(n,"EPSG:3857","EPSG:4326"),i=t[0];return(i<-180||i>180)&&(t[0]=fs(i+180,360)-180),t}function Wt(n,e){if(n===e)return!0;const t=n.getUnits()===e.getUnits();return(n.getCode()===e.getCode()||sa(n,e)===Bu)&&t}function sa(n,e){const t=n.getCode(),i=e.getCode();let s=Gu(t,i);if(s)return s;let o=null,r=null;for(const l of hb)o||(o=l(n)),r||(r=l(e));if(!o&&!r)return null;const a="EPSG:4326";if(r)if(o)s=Xu(o.inverse,r.forward);else{const l=Gu(t,a);l&&(s=Xu(l,r.forward))}else{const l=Gu(a,i);l&&(s=Xu(o.inverse,l))}return s&&(cc(n),cc(e),Js(n,e,s)),s}function Xu(n,e){return function(t,i,s,o){return i=n(t,i,s,o),e(i,i,s,o)}}function Ni(n,e){const t=Ne(n),i=Ne(e);return sa(t,i)}function Zo(n,e,t){const i=Ni(e,t);if(!i){const s=Ne(e).getCode(),o=Ne(t).getCode();throw new Error(`No transform available between ${s} and ${o}`)}return i(n,void 0,n.length)}function oa(n,e,t,i){const s=Ni(e,t);return Jg(n,s,void 0,i)}let pb=null;function gb(){return pb}function Yu(n,e){return n}function ki(n,e){return Vu&&!nc(n,[0,0])&&n[0]>=-180&&n[0]<=180&&n[1]>=-90&&n[1]<=90&&(Vu=!1,lm("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),n}function Zu(n,e){return n}function fi(n,e){return n}function mb(){xm(hm),xm(dm),fb(dm,hm,Vv,Bv)}mb();function Be(n,e){if(!n)throw new Error(e)}const Sm=new Array(6);function Kt(){return[1,0,0,1,0,0]}function Rm(n){return Ku(n,1,0,0,1,0,0)}function hc(n,e){const t=n[0],i=n[1],s=n[2],o=n[3],r=n[4],a=n[5],l=e[0],c=e[1],h=e[2],u=e[3],d=e[4],f=e[5];return n[0]=t*l+s*c,n[1]=i*l+o*c,n[2]=t*h+s*u,n[3]=i*h+o*u,n[4]=t*d+s*f+r,n[5]=i*d+o*f+a,n}function Ku(n,e,t,i,s,o,r){return n[0]=e,n[1]=t,n[2]=i,n[3]=s,n[4]=o,n[5]=r,n}function yb(n,e){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n}function _t(n,e){const t=e[0],i=e[1];return e[0]=n[0]*t+n[2]*i+n[4],e[1]=n[1]*t+n[3]*i+n[5],e}function Qu(n,e,t){return hc(n,Ku(Sm,e,0,0,t,0,0))}function _b(n,e,t){return hc(n,Ku(Sm,1,0,0,1,e,t))}function Hn(n,e,t,i,s,o,r,a){const l=Math.sin(o),c=Math.cos(o);return n[0]=i*c,n[1]=s*l,n[2]=-i*l,n[3]=s*c,n[4]=r*i*c-a*i*l+e,n[5]=r*s*l+a*s*c+t,n}function Tm(n,e){const t=wb(e);Be(t!==0,"Transformation matrix cannot be inverted");const i=e[0],s=e[1],o=e[2],r=e[3],a=e[4],l=e[5];return n[0]=r/t,n[1]=-s/t,n[2]=-o/t,n[3]=i/t,n[4]=(o*l-r*a)/t,n[5]=-(i*l-s*a)/t,n}function wb(n){return n[0]*n[3]-n[1]*n[2]}const vb=[1e5,1e5,1e5,1e5,2,2];function bb(n){return"matrix("+n.join(", ")+")"}function Ju(n){return n.substring(7,n.length-1).split(",").map(parseFloat)}function Eb(n,e){const t=Ju(n),i=Ju(e);for(let s=0;s<6;++s)if(Math.round((t[s]-i[s])*vb[s])!==0)return!1;return!0}function pi(n,e,t,i,s,o,r){o=o||[],r=r||2;let a=0;for(let l=e;l<t;l+=i){const c=n[l],h=n[l+1];o[a++]=s[0]*c+s[2]*h+s[4],o[a++]=s[1]*c+s[3]*h+s[5];for(let u=2;u<r;u++)o[a++]=n[l+u]}return o&&o.length!=a&&(o.length=a),o}function Im(n,e,t,i,s,o,r){r=r||[];const a=Math.cos(s),l=Math.sin(s),c=o[0],h=o[1];let u=0;for(let d=e;d<t;d+=i){const f=n[d]-c,g=n[d+1]-h;r[u++]=c+f*a-g*l,r[u++]=h+f*l+g*a;for(let _=d+2;_<d+i;++_)r[u++]=n[_]}return r&&r.length!=u&&(r.length=u),r}function Cb(n,e,t,i,s,o,r,a){a=a||[];const l=r[0],c=r[1];let h=0;for(let u=e;u<t;u+=i){const d=n[u]-l,f=n[u+1]-c;a[h++]=l+s*d,a[h++]=c+o*f;for(let g=u+2;g<u+i;++g)a[h++]=n[g]}return a&&a.length!=h&&(a.length=h),a}function xb(n,e,t,i,s,o,r){r=r||[];let a=0;for(let l=e;l<t;l+=i){r[a++]=n[l]+s,r[a++]=n[l+1]+o;for(let c=l+2;c<l+i;++c)r[a++]=n[c]}return r&&r.length!=a&&(r.length=a),r}const Om=Kt(),Pb=[NaN,NaN];class Am extends di{constructor(){super(),this.extent_=gn(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=rm((e,t,i)=>{if(!i)return this.getSimplifiedGeometry(t);const s=this.clone();return s.applyTransform(i),s.getSimplifiedGeometry(t)})}simplifyTransformed(e,t){return this.simplifyTransformedInternal(this.getRevision(),e,t)}clone(){return be()}closestPointXY(e,t,i,s){return be()}containsXY(e,t){return this.closestPointXY(e,t,Pb,Number.MIN_VALUE)===0}getClosestPoint(e,t){return t=t||[NaN,NaN],this.closestPointXY(e[0],e[1],t,1/0),t}intersectsCoordinate(e){return this.containsXY(e[0],e[1])}computeExtent(e){return be()}getExtent(e){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&Wo(t),this.extentRevision_=this.getRevision()}return Iv(this.extent_,e)}rotate(e,t){be()}scale(e,t,i){be()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return be()}getType(){return be()}applyTransform(e){be()}intersectsExtent(e){return be()}translate(e,t){be()}transform(e,t){const i=Ne(e),s=i.getUnits()=="tile-pixels"?function(o,r,a){const l=i.getExtent(),c=i.getWorldExtent(),h=lt(c)/lt(l);Hn(Om,c[0],c[3],h,-h,0,0,0);const u=pi(o,0,o.length,a,Om,r),d=Ni(i,t);return d?d(u,u,a):u}:Ni(i,t);return this.applyTransform(s),this}}class to extends Am{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(e){return Du(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return be()}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(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const t=this.getSimplifiedGeometryInternal(e);return t.getFlatCoordinates().length<this.flatCoordinates.length?t:(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getSimplifiedGeometryInternal(e){return this}getStride(){return this.stride}setFlatCoordinates(e,t){this.stride=Mm(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){be()}setLayout(e,t,i){let s;if(e)s=Mm(e);else{for(let o=0;o<i;++o){if(t.length===0){this.layout="XY",this.stride=2;return}t=t[0]}s=t.length,e=no(s)}this.layout=e,this.stride=s}applyTransform(e){this.flatCoordinates&&(e(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(e,t){const i=this.getFlatCoordinates();if(i){const s=this.getStride();Im(i,0,i.length,s,e,t,i),this.changed()}}scale(e,t,i){t===void 0&&(t=e),i||(i=xn(this.getExtent()));const s=this.getFlatCoordinates();if(s){const o=this.getStride();Cb(s,0,s.length,o,e,t,i,s),this.changed()}}translate(e,t){const i=this.getFlatCoordinates();if(i){const s=this.getStride();xb(i,0,i.length,s,e,t,i),this.changed()}}}function no(n){let e;return n==2?e="XY":n==3?e="XYZ":n==4&&(e="XYZM"),e}function Mm(n){let e;return n=="XY"?e=2:n=="XYZ"||n=="XYM"?e=3:n=="XYZM"&&(e=4),e}function Sb(n,e,t){const i=n.getFlatCoordinates();if(!i)return null;const s=n.getStride();return pi(i,0,i.length,s,e,t)}function Dm(n,e,t,i){let s=0;const o=n[t-i],r=n[t-i+1];let a=0,l=0;for(;e<t;e+=i){const c=n[e]-o,h=n[e+1]-r;s+=l*c-a*h,a=c,l=h}return s/2}function Fm(n,e,t,i){let s=0;for(let o=0,r=t.length;o<r;++o){const a=t[o];s+=Dm(n,e,a,i),e=a}return s}function Rb(n,e,t,i){let s=0;for(let o=0,r=t.length;o<r;++o){const a=t[o];s+=Fm(n,e,a,i),e=a[a.length-1]}return s}function Lm(n,e,t,i,s,o,r){const a=n[e],l=n[e+1],c=n[t]-a,h=n[t+1]-l;let u;if(c===0&&h===0)u=e;else{const d=((s-a)*c+(o-l)*h)/(c*c+h*h);if(d>1)u=t;else if(d>0){for(let f=0;f<i;++f)r[f]=mn(n[e+f],n[t+f],d);r.length=i;return}else u=e}for(let d=0;d<i;++d)r[d]=n[u+d];r.length=i}function ed(n,e,t,i,s){let o=n[e],r=n[e+1];for(e+=i;e<t;e+=i){const a=n[e],l=n[e+1],c=Ks(o,r,a,l);c>s&&(s=c),o=a,r=l}return s}function td(n,e,t,i,s){for(let o=0,r=t.length;o<r;++o){const a=t[o];s=ed(n,e,a,i,s),e=a}return s}function Tb(n,e,t,i,s){for(let o=0,r=t.length;o<r;++o){const a=t[o];s=td(n,e,a,i,s),e=a[a.length-1]}return s}function nd(n,e,t,i,s,o,r,a,l,c,h){if(e==t)return c;let u,d;if(s===0){if(d=Ks(r,a,n[e],n[e+1]),d<c){for(u=0;u<i;++u)l[u]=n[e+u];return l.length=i,d}return c}h=h||[NaN,NaN];let f=e+i;for(;f<t;)if(Lm(n,f-i,f,i,r,a,h),d=Ks(r,a,h[0],h[1]),d<c){for(c=d,u=0;u<i;++u)l[u]=h[u];l.length=i,f+=i}else f+=i*Math.max((Math.sqrt(d)-Math.sqrt(c))/s|0,1);if(o&&(Lm(n,t-i,e,i,r,a,h),d=Ks(r,a,h[0],h[1]),d<c)){for(c=d,u=0;u<i;++u)l[u]=h[u];l.length=i}return c}function id(n,e,t,i,s,o,r,a,l,c,h){h=h||[NaN,NaN];for(let u=0,d=t.length;u<d;++u){const f=t[u];c=nd(n,e,f,i,s,o,r,a,l,c,h),e=f}return c}function Ib(n,e,t,i,s,o,r,a,l,c,h){h=h||[NaN,NaN];for(let u=0,d=t.length;u<d;++u){const f=t[u];c=id(n,e,f,i,s,o,r,a,l,c,h),e=f[f.length-1]}return c}function Ob(n,e,t,i){for(let s=0,o=t.length;s<o;++s)n[e++]=t[s];return e}function uc(n,e,t,i){for(let s=0,o=t.length;s<o;++s){const r=t[s];for(let a=0;a<i;++a)n[e++]=r[a]}return e}function ra(n,e,t,i,s){s=s||[];let o=0;for(let r=0,a=t.length;r<a;++r){const l=uc(n,e,t[r],i);s[o++]=l,e=l}return s.length=o,s}function zm(n,e,t,i,s){s=s||[];let o=0;for(let r=0,a=t.length;r<a;++r){const l=ra(n,e,t[r],i,s[o]);l.length===0&&(l[0]=e),s[o++]=l,e=l[l.length-1]}return s.length=o,s}function ms(n,e,t,i,s){s=s!==void 0?s:[];let o=0;for(let r=e;r<t;r+=i)s[o++]=n.slice(r,r+i);return s.length=o,s}function aa(n,e,t,i,s){s=s!==void 0?s:[];let o=0;for(let r=0,a=t.length;r<a;++r){const l=t[r];s[o++]=ms(n,e,l,i,s[o]),e=l}return s.length=o,s}function sd(n,e,t,i,s){s=s!==void 0?s:[];let o=0;for(let r=0,a=t.length;r<a;++r){const l=t[r];s[o++]=l.length===1&&l[0]===e?[]:aa(n,e,l,i,s[o]),e=l[l.length-1]}return s.length=o,s}function dc(n,e,t,i,s,o,r){const a=(t-e)/i;if(a<3){for(;e<t;e+=i)o[r++]=n[e],o[r++]=n[e+1];return r}const l=new Array(a);l[0]=1,l[a-1]=1;const c=[e,t-i];let h=0;for(;c.length>0;){const u=c.pop(),d=c.pop();let f=0;const g=n[d],_=n[d+1],v=n[u],E=n[u+1];for(let w=d+i;w<u;w+=i){const C=n[w],P=n[w+1],R=Mv(C,P,g,_,v,E);R>f&&(h=w,f=R)}f>s&&(l[(h-e)/i]=1,d+i<h&&c.push(d,h),h+i<u&&c.push(h,u))}for(let u=0;u<a;++u)l[u]&&(o[r++]=n[e+u*i],o[r++]=n[e+u*i+1]);return r}function Nm(n,e,t,i,s,o,r,a){for(let l=0,c=t.length;l<c;++l){const h=t[l];r=dc(n,e,h,i,s,o,r),a.push(r),e=h}return r}function io(n,e){return e*Math.round(n/e)}function Ab(n,e,t,i,s,o,r){if(e==t)return r;let a=io(n[e],s),l=io(n[e+1],s);e+=i,o[r++]=a,o[r++]=l;let c,h;do if(c=io(n[e],s),h=io(n[e+1],s),e+=i,e==t)return o[r++]=c,o[r++]=h,r;while(c==a&&h==l);for(;e<t;){const u=io(n[e],s),d=io(n[e+1],s);if(e+=i,u==c&&d==h)continue;const f=c-a,g=h-l,_=u-a,v=d-l;if(f*v==g*_&&(f<0&&_<f||f==_||f>0&&_>f)&&(g<0&&v<g||g==v||g>0&&v>g)){c=u,h=d;continue}o[r++]=c,o[r++]=h,a=c,l=h,c=u,h=d}return o[r++]=c,o[r++]=h,r}function od(n,e,t,i,s,o,r,a){for(let l=0,c=t.length;l<c;++l){const h=t[l];r=Ab(n,e,h,i,s,o,r),a.push(r),e=h}return r}function Mb(n,e,t,i,s,o,r,a){for(let l=0,c=t.length;l<c;++l){const h=t[l],u=[];r=od(n,e,h,i,s,o,r,u),a.push(u),e=h[h.length-1]}return r}class la extends to{constructor(e,t){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}clone(){return new la(this.flatCoordinates.slice(),this.layout)}closestPointXY(e,t,i,s){return s<Ys(this.getExtent(),e,t)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ed(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),nd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,i,s))}getArea(){return Dm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return ms(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){const t=[];return t.length=dc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new la(t,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=uc(this.flatCoordinates,0,e,this.stride),this.changed()}}class yn extends to{constructor(e,t){super(),this.setCoordinates(e,t)}clone(){const e=new yn(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,i,s){const o=this.flatCoordinates,r=Ks(e,t,o[0],o[1]);if(r<s){const a=this.stride;for(let l=0;l<a;++l)i[l]=o[l];return i.length=a,r}return s}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(e){return Xg(this.flatCoordinates,e)}getType(){return"Point"}intersectsExtent(e){return Au(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Ob(this.flatCoordinates,0,e,this.stride),this.changed()}}function Db(n,e,t,i,s){return!Kg(s,function(r){return!so(n,e,t,i,r[0],r[1])})}function so(n,e,t,i,s,o){let r=0,a=n[t-i],l=n[t-i+1];for(;e<t;e+=i){const c=n[e],h=n[e+1];l<=o?h>o&&(c-a)*(o-l)-(s-a)*(h-l)>0&&r++:h<=o&&(c-a)*(o-l)-(s-a)*(h-l)<0&&r--,a=c,l=h}return r!==0}function rd(n,e,t,i,s,o){if(t.length===0||!so(n,e,t[0],i,s,o))return!1;for(let r=1,a=t.length;r<a;++r)if(so(n,t[r-1],t[r],i,s,o))return!1;return!0}function Fb(n,e,t,i,s,o){if(t.length===0)return!1;for(let r=0,a=t.length;r<a;++r){const l=t[r];if(rd(n,e,l,i,s,o))return!0;e=l[l.length-1]}return!1}function ad(n,e,t,i,s,o,r){let a,l,c,h,u,d,f;const g=s[o+1],_=[];for(let w=0,C=t.length;w<C;++w){const P=t[w];for(h=n[P-i],d=n[P-i+1],a=e;a<P;a+=i)u=n[a],f=n[a+1],(g<=d&&f<=g||d<=g&&g<=f)&&(c=(g-d)/(f-d)*(u-h)+h,_.push(c)),h=u,d=f}let v=NaN,E=-1/0;for(_.sort(li),h=_[0],a=1,l=_.length;a<l;++a){u=_[a];const w=Math.abs(u-h);w>E&&(c=(h+u)/2,rd(n,e,t,i,c,g)&&(v=c,E=w)),h=u}return isNaN(v)&&(v=s[o]),r?(r.push(v,g,E),r):[v,g,E]}function km(n,e,t,i,s){let o=[];for(let r=0,a=t.length;r<a;++r){const l=t[r];o=ad(n,e,l,i,s,2*r,o),e=l[l.length-1]}return o}function jm(n,e,t,i,s){let o;for(e+=i;e<t;e+=i)if(o=s(n.slice(e-i,e),n.slice(e,e+i)),o)return o;return!1}function fc(n,e,t,i,s,o){return o=o??Zg(gn(),n,e,t,i),pt(s,o)?o[0]>=s[0]&&o[2]<=s[2]||o[1]>=s[1]&&o[3]<=s[3]?!0:jm(n,e,t,i,function(r,a){return Av(s,r,a)}):!1}function Lb(n,e,t,i,s){for(let o=0,r=t.length;o<r;++o){if(fc(n,e,t[o],i,s))return!0;e=t[o]}return!1}function Um(n,e,t,i,s){return!!(fc(n,e,t,i,s)||so(n,e,t,i,s[0],s[1])||so(n,e,t,i,s[0],s[3])||so(n,e,t,i,s[2],s[1])||so(n,e,t,i,s[2],s[3]))}function Gm(n,e,t,i,s){if(!Um(n,e,t[0],i,s))return!1;if(t.length===1)return!0;for(let o=1,r=t.length;o<r;++o)if(Db(n,t[o-1],t[o],i,s)&&!fc(n,t[o-1],t[o],i,s))return!1;return!0}function zb(n,e,t,i,s){for(let o=0,r=t.length;o<r;++o){const a=t[o];if(Gm(n,e,a,i,s))return!0;e=a[a.length-1]}return!1}function Nb(n,e,t,i){for(;e<t-i;){for(let s=0;s<i;++s){const o=n[e+s];n[e+s]=n[t-i+s],n[t-i+s]=o}e+=i,t-=i}}function ld(n,e,t,i){let s=0,o=n[t-i],r=n[t-i+1];for(;e<t;e+=i){const a=n[e],l=n[e+1];s+=(a-o)*(l+r),o=a,r=l}return s===0?void 0:s>0}function cd(n,e,t,i,s){s=s!==void 0?s:!1;for(let o=0,r=t.length;o<r;++o){const a=t[o],l=ld(n,e,a,i);if(o===0){if(s&&l||!s&&!l)return!1}else if(s&&!l||!s&&l)return!1;e=a}return!0}function qm(n,e,t,i,s){for(let o=0,r=t.length;o<r;++o){const a=t[o];if(!cd(n,e,a,i,s))return!1;a.length&&(e=a[a.length-1])}return!0}function pc(n,e,t,i,s){s=s!==void 0?s:!1;for(let o=0,r=t.length;o<r;++o){const a=t[o],l=ld(n,e,a,i);(o===0?s&&l||!s&&!l:s&&!l||!s&&l)&&Nb(n,e,a,i),e=a}return e}function hd(n,e,t,i,s){for(let o=0,r=t.length;o<r;++o)e=pc(n,e,t[o],i,s);return e}function Wm(n,e){const t=[];let i=0,s=0,o;for(let r=0,a=e.length;r<a;++r){const l=e[r],c=ld(n,i,l,2);if(o===void 0&&(o=c),c===o)t.push(e.slice(s,r+1));else{if(t.length===0)continue;t[t.length-1].push(e[s])}s=r+1,i=l}return t}class Xn extends to{constructor(e,t,i){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,t!==void 0&&i?(this.setFlatCoordinates(t,e),this.ends_=i):this.setCoordinates(e,t)}appendLinearRing(e){this.flatCoordinates?ci(this.flatCoordinates,e.getFlatCoordinates()):this.flatCoordinates=e.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const e=new Xn(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,i,s){return s<Ys(this.getExtent(),e,t)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(td(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),id(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,i,s))}containsXY(e,t){return rd(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return Fm(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),pc(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,aa(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const e=xn(this.getExtent());this.flatInteriorPoint_=ad(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new yn(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new la(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLinearRings(){const e=this.layout,t=this.flatCoordinates,i=this.ends_,s=[];let o=0;for(let r=0,a=i.length;r<a;++r){const l=i[r],c=new la(t.slice(o,l),e);s.push(c),o=l}return s}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const e=this.flatCoordinates;cd(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=pc(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){const t=[],i=[];return t.length=od(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),t,0,i),new Xn(t,"XY",i)}getType(){return"Polygon"}intersectsExtent(e){return Gm(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=ra(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}}function ud(n){if(zi(n))throw new Error("Cannot create polygon from empty extent");const e=n[0],t=n[1],i=n[2],s=n[3],o=[e,t,e,s,i,s,i,t,e,t];return new Xn(o,"XY",[o.length])}const an={ADD:"add",REMOVE:"remove"},Vm={LENGTH:"length"};class gc extends $n{constructor(e,t,i){super(e),this.element=t,this.index=i}}class Sn extends di{constructor(e,t){if(super(),this.on,this.once,this.un,t=t||{},this.unique_=!!t.unique,this.array_=e??[],this.unique_)for(let i=1,s=this.array_.length;i<s;++i)this.assertUnique_(this.array_[i],i);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(e){for(let t=0,i=e.length;t<i;++t)this.push(e[t]);return this}forEach(e){const t=this.array_;for(let i=0,s=t.length;i<s;++i)e(t[i],i,t)}getArray(){return this.array_}item(e){return this.array_[e]}getLength(){return this.get(Vm.LENGTH)}insertAt(e,t){if(e<0||e>this.getLength())throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new gc(an.ADD,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){const t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){const t=this.array_;for(let i=0,s=t.length;i<s;++i)if(t[i]===e)return this.removeAt(i)}removeAt(e){if(e<0||e>=this.getLength())return;const t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new gc(an.REMOVE,t,e)),t}setAt(e,t){const i=this.getLength();if(e>=i){this.insertAt(e,t);return}if(e<0)throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t,e);const s=this.array_[e];this.array_[e]=t,this.dispatchEvent(new gc(an.REMOVE,s,e)),this.dispatchEvent(new gc(an.ADD,t,e))}updateLength_(){this.set(Vm.LENGTH,this.array_.length)}assertUnique_(e,t){const i=this.array_;for(let s=0,o=i.length;s<o;++s)if(i[s]===e&&s!==t)throw new Error("Duplicate item added to a unique collection")}}class Rn extends di{constructor(e){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_),e)if(typeof e.getSimplifiedGeometry=="function"){const t=e;this.setGeometry(t)}else{const t=e;this.setProperties(t)}}clone(){const e=new Rn(this.hasProperties()?this.getProperties():null);e.setGeometryName(this.getGeometryName());const t=this.getGeometry();t&&e.setGeometry(t.clone());const i=this.getStyle();return i&&e.setStyle(i),e}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_&&(st(this.geometryChangeKey_),this.geometryChangeKey_=null);const e=this.getGeometry();e&&(this.geometryChangeKey_=qe(e,we.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?kb(e):void 0,this.changed()}setId(e){this.id_=e,this.changed()}setGeometryName(e){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=e,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}}function kb(n){if(typeof n=="function")return n;let e;return Array.isArray(n)?e=n:(Be(typeof n.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[n]),function(){return e}}function mc(n,e,t,i,s,o,r){let a,l;const c=(t-e)/i;if(c===1)a=e;else if(c===2)a=e,l=s;else if(c!==0){let h=n[e],u=n[e+1],d=0;const f=[0];for(let v=e+i;v<t;v+=i){const E=n[v],w=n[v+1];d+=Math.sqrt((E-h)*(E-h)+(w-u)*(w-u)),f.push(d),h=E,u=w}const g=s*d,_=Ev(f,g);_<0?(l=(g-f[-_-2])/(f[-_-1]-f[-_-2]),a=e+(-_-2)*i):a=e+_*i}r=r>1?r:2,o=o||new Array(r);for(let h=0;h<r;++h)o[h]=a===void 0?NaN:l===void 0?n[a+h]:mn(n[a+h],n[a+i+h],l);return o}function dd(n,e,t,i,s,o){if(t==e)return null;let r;if(s<n[e+i-1])return o?(r=n.slice(e,e+i),r[i-1]=s,r):null;if(n[t-1]<s)return o?(r=n.slice(t-i,t),r[i-1]=s,r):null;if(s==n[e+i-1])return n.slice(e,e+i);let a=e/i,l=t/i;for(;a<l;){const d=a+l>>1;s<n[(d+1)*i-1]?l=d:a=d+1}const c=n[a*i-1];if(s==c)return n.slice((a-1)*i,(a-1)*i+i);const h=n[(a+1)*i-1],u=(s-c)/(h-c);r=[];for(let d=0;d<i-1;++d)r.push(mn(n[(a-1)*i+d],n[a*i+d],u));return r.push(s),r}function jb(n,e,t,i,s,o,r){if(r)return dd(n,e,t[t.length-1],i,s,o);let a;if(s<n[i-1])return o?(a=n.slice(0,i),a[i-1]=s,a):null;if(n[n.length-1]<s)return o?(a=n.slice(n.length-i),a[i-1]=s,a):null;for(let l=0,c=t.length;l<c;++l){const h=t[l];if(e!=h){if(s<n[e+i-1])return null;if(s<=n[h-1])return dd(n,e,h,i,s,!1);e=h}}return null}function fd(n,e,t,i){let s=n[e],o=n[e+1],r=0;for(let a=e+i;a<t;a+=i){const l=n[a],c=n[a+1];r+=Math.sqrt((l-s)*(l-s)+(c-o)*(c-o)),s=l,o=c}return r}class Yn extends to{constructor(e,t){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendCoordinate(e){ci(this.flatCoordinates,e),this.changed()}clone(){const e=new Yn(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,i,s){return s<Ys(this.getExtent(),e,t)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ed(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),nd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,e,t,i,s))}forEachSegment(e){return jm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinateAtM(e,t){return this.layout!="XYM"&&this.layout!="XYZM"?null:(t=t!==void 0?t:!1,dd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t))}getCoordinates(){return ms(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(e,t){return mc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,this.stride)}getLength(){return fd(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(e){const t=[];return t.length=dc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new Yn(t,"XY")}getType(){return"LineString"}intersectsExtent(e){return fc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,this.getExtent())}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=uc(this.flatCoordinates,0,e,this.stride),this.changed()}}const Tn={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"},oo=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"";oo.includes("safari")&&!oo.includes("chrom")&&(oo.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(oo));const Ub=oo.includes("webkit")&&!oo.includes("edge"),Bm=oo.includes("macintosh"),Gb=typeof devicePixelRatio<"u"?devicePixelRatio:1,ln=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,pd=typeof Image<"u"&&Image.prototype.decode,$m=typeof createImageBitmap=="function",Hm=(function(){let n=!1;try{const e=Object.defineProperty({},"passive",{get:function(){n=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch{}return n})(),le={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function ht(n,e,t,i){let s;return t&&t.length?s=t.shift():ln?s=new class extends OffscreenCanvas{constructor(){super(...arguments);I(this,"style",{})}}(n??300,e??150):s=document.createElement("canvas"),n&&(s.width=n),e&&(s.height=e),s.getContext("2d",i)}let gd;function yc(){return gd||(gd=ht(1,1)),gd}function ca(n){const e=n.canvas;e.width=1,e.height=1,n.clearRect(0,0,1,1)}function Xm(n,e){const t=e.parentNode;t&&t.replaceChild(n,e)}function qb(n){for(;n.lastChild;)n.lastChild.remove()}function Wb(n,e){const t=n.childNodes;for(let i=0;;++i){const s=t[i],o=e[i];if(!s&&!o)break;if(s!==o){if(!s){n.appendChild(o);continue}if(!o){n.removeChild(s),--i;continue}n.insertBefore(o,s)}}}function Ym(){return new Proxy({childNodes:[],appendChild:function(e){return this.childNodes.push(e),e},remove:function(){},removeChild:function(e){const t=this.childNodes.indexOf(e);if(t===-1)throw new Error("Node to remove was not found");return this.childNodes.splice(t,1),e},insertBefore:function(e,t){const i=this.childNodes.indexOf(t);if(i===-1)throw new Error("Reference node not found");return this.childNodes.splice(i,0,e),e},style:{}},{get(e,t,i){return t==="firstElementChild"?e.childNodes.length>0?e.childNodes[0]:null:Reflect.get(e,t,i)}})}function ys(n){return typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas}const md=[NaN,NaN,NaN,0];let yd;function Vb(){return yd||(yd=ht(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),yd}const Bb=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,$b=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Hb=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Xb=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function _c(n,e){return n.endsWith("%")?Number(n.substring(0,n.length-1))/e:Number(n)}function ha(n){throw new Error('failed to parse "'+n+'" as color')}function Zm(n){if(n.toLowerCase().startsWith("rgb")){const o=n.match($b)||n.match(Bb)||n.match(Hb);if(o){const r=o[4],a=100/255;return[ct(_c(o[1],a)+.5|0,0,255),ct(_c(o[2],a)+.5|0,0,255),ct(_c(o[3],a)+.5|0,0,255),r!==void 0?ct(_c(r,100),0,1):1]}ha(n)}if(n.startsWith("#")){if(Xb.test(n)){const o=n.substring(1),r=o.length<=4?1:2,a=[0,0,0,255];for(let l=0,c=o.length;l<c;l+=r){let h=parseInt(o.substring(l,l+r),16);r===1&&(h+=h<<4),a[l/r]=h}return a[3]=a[3]/255,a}ha(n)}const e=Vb();e.fillStyle="#abcdef";let t=e.fillStyle;e.fillStyle=n,e.fillStyle===t&&(e.fillStyle="#fedcba",t=e.fillStyle,e.fillStyle=n,e.fillStyle===t&&ha(n));const i=e.fillStyle;if(i.startsWith("#")||i.startsWith("rgba"))return Zm(i);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);const s=Array.from(e.getImageData(0,0,1,1).data);return s[3]=Yr(s[3]/255,3),s}function Yb(n){return typeof n=="string"?n:Cd(n)}const Zb=1024,ua={};let _d=0;function Kb(n){if(n.length===4)return n;const e=n.slice();return e[3]=1,e}function wd(n){return n>.0031308?Math.pow(n,.4166666666666667)*269.025-14.025:n*3294.6}function vd(n){return n>.2068965?Math.pow(n,3):(n-.13793103448275862)*.12841854934601665}function bd(n){return n>10.314724?Math.pow((n+14.025)/269.025,2.4):n/3294.6}function Ed(n){return n>.0088564?Math.pow(n,.3333333333333333):n/.12841854934601665+.13793103448275862}function Km(n){const e=bd(n[0]),t=bd(n[1]),i=bd(n[2]),s=Ed(e*.222488403+t*.716873169+i*.06060791),o=500*(Ed(e*.452247074+t*.399439023+i*.148375274)-s),r=200*(s-Ed(e*.016863605+t*.117638439+i*.865350722)),a=Math.atan2(r,o)*(180/Math.PI);return[116*s-16,Math.sqrt(o*o+r*r),a<0?a+360:a,n[3]]}function Qb(n){const e=(n[0]+16)/116,t=n[1],i=n[2]*Math.PI/180,s=vd(e),o=vd(e+t/500*Math.cos(i)),r=vd(e-t/200*Math.sin(i)),a=wd(o*3.021973625-s*1.617392459-r*.404875592),l=wd(o*-.943766287+s*1.916279586+r*.027607165),c=wd(o*.069407491-s*.22898585+r*1.159737864);return[ct(a+.5|0,0,255),ct(l+.5|0,0,255),ct(c+.5|0,0,255),n[3]]}function wc(n){if(n==="none")return md;if(ua.hasOwnProperty(n))return ua[n];if(_d>=Zb){let t=0;for(const i in ua)(t++&3)===0&&(delete ua[i],--_d)}const e=Zm(n);e.length!==4&&ha(n);for(const t of e)isNaN(t)&&ha(n);return ua[n]=e,++_d,e}function ro(n){return Array.isArray(n)?n:wc(n)}function Cd(n){let e=n[0];e!=(e|0)&&(e=e+.5|0);let t=n[1];t!=(t|0)&&(t=t+.5|0);let i=n[2];i!=(i|0)&&(i=i+.5|0);const s=n[3]===void 0?1:Math.round(n[3]*1e3)/1e3;return"rgba("+e+","+t+","+i+","+s+")"}class vc extends ea{constructor(e,t,i,s){super(),this.extent=e,this.pixelRatio_=i,this.resolution=t,this.state=typeof s=="function"?le.IDLE:s,this.image_=null,this.loader=typeof s=="function"?s:null}changed(){this.dispatchEvent(we.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==le.IDLE&&this.loader){this.state=le.LOADING,this.changed();const e=this.getResolution(),t=Array.isArray(e)?e[0]:e;Bo(()=>this.loader(this.getExtent(),t,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||$m&&i instanceof ImageBitmap||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement)&&(this.image_=i),this.state=le.LOADED}).catch(i=>{this.state=le.ERROR,console.error(i)}).finally(()=>this.changed())}}setImage(e){this.image_=e}setResolution(e){this.resolution=e}}function Jb(n,e,t){const i=n;let s=!0,o=!1,r=!1;const a=[tc(i,we.LOAD,function(){r=!0,o||e()})];return i.src&&pd?(o=!0,i.decode().then(function(){s&&e()}).catch(function(l){s&&(r?e():t())})):a.push(tc(i,we.ERROR,t)),function(){s=!1,a.forEach(st)}}function eE(n,e){return new Promise((t,i)=>{function s(){r(),t(n)}function o(){r(),i(new Error("Image load error"))}function r(){n.removeEventListener("load",s),n.removeEventListener("error",o)}n.addEventListener("load",s),n.addEventListener("error",o)})}function Qm(n,e){return e&&(n.src=e),n.src&&pd?new Promise((t,i)=>n.decode().then(()=>t(n)).catch(s=>n.complete&&n.width?t(n):i(s))):eE(n)}function Jm(n,e){return e&&(n.src=e),n.src&&pd&&$m?n.decode().then(()=>createImageBitmap(n)).catch(t=>{if(n.complete&&n.width)return n;throw t}):Qm(n)}class tE{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 e=0;for(const t in this.cache_){const i=this.cache_[t];(e++&3)===0&&!i.hasListener()&&(delete this.cache_[t],delete this.patternCache_[t],--this.cacheSize_)}}}get(e,t){const i=xd(e,t);return i in this.cache_?this.cache_[i]:null}getPattern(e,t){const i=xd(e,t);return i in this.patternCache_?this.patternCache_[i]:null}set(e,t,i,s){const o=xd(e,t),r=o in this.cache_;this.cache_[o]=i,s&&(i.getImageState()===le.IDLE&&i.load(),i.getImageState()===le.LOADING?i.ready().then(()=>{this.patternCache_[o]=yc().createPattern(i.getImage(1),"repeat")}):this.patternCache_[o]=yc().createPattern(i.getImage(1),"repeat")),r||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}}function xd(n,e){const t=e?ro(e):"null";return n+":"+t}const In=new tE;let da=null;class e0 extends ea{constructor(e,t,i,s,o){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=i==null?void 0:i.crossOrigin,this.referrerPolicy_=i==null?void 0:i.referrerPolicy,this.canvas_={},this.color_=o,this.imageState_=s===void 0?le.IDLE:s,this.size_=e&&e.width&&e.height?[e.width,e.height]:null,this.src_=t,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===le.LOADED){da||(da=ht(1,1,void 0,{willReadFrequently:!0})),da.drawImage(this.image_,0,0);try{da.getImageData(0,0,1,1),this.tainted_=!1}catch{da=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(we.CHANGE)}handleImageError_(){this.imageState_=le.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=le.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}setImage(e){this.image_=e}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const e=this.size_[0],t=this.size_[1],i=ht(e,t);i.fillRect(0,0,e,t),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===le.IDLE){this.image_||this.initializeImage_(),this.imageState_=le.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&Qm(this.image_,this.src_).then(e=>{this.image_=e,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==le.LOADED)return;const t=this.image_,i=ht(Math.ceil(t.width*e),Math.ceil(t.height*e)),s=i.canvas;i.scale(e,e),i.drawImage(t,0,0),i.globalCompositeOperation="multiply",i.fillStyle=Yb(this.color_),i.fillRect(0,0,s.width/e,s.height/e),i.globalCompositeOperation="destination-in",i.drawImage(t,0,0),this.canvas_[e]=s}ready(){return this.ready_||(this.ready_=new Promise(e=>{if(this.imageState_===le.LOADED||this.imageState_===le.ERROR)e();else{const t=()=>{(this.imageState_===le.LOADED||this.imageState_===le.ERROR)&&(this.removeEventListener(we.CHANGE,t),e())};this.addEventListener(we.CHANGE,t)}})),this.ready_}}function fa(n,e,t,i,s,o){let r=e===void 0?void 0:In.get(e,s);return r||(r=new e0(n,n&&"src"in n?n.src||void 0:e,t,i,s),In.set(e,s,r,o)),o&&r&&!In.getPattern(e,s)&&In.set(e,s,r,o),r}function gi(n){return n?Array.isArray(n)?Cd(n):typeof n=="object"&&"src"in n?nE(n):n:null}function nE(n){if(!n.offset||!n.size)return In.getPattern(n.src,n.color);const e=n.src+":"+n.offset,t=In.getPattern(e,n.color);if(t)return t;const i=In.get(n.src,null);if(i.getImageState()!==le.LOADED)return null;const s=ht(n.size[0],n.size[1]);return s.drawImage(i.getImage(1),n.offset[0],n.offset[1],n.size[0],n.size[1],0,0,n.size[0],n.size[1]),fa(s.canvas,e,void 0,le.LOADED,n.color,!0),In.getPattern(e,n.color)}function iE(n,e,t,i,s,o){s=s??[],o=o??e;const r=n[0],a=n[1],l=n[n.length-4],c=n[n.length-3];let h,u,d,f,g,_,v,E,w=0;for(let C=0;C<n.length;C+=e){d=h,f=u,g=void 0,_=void 0,C+e<n.length&&(g=n[C+e],_=n[C+e+1]),i&&C===0&&(d=l,f=c),i&&C===n.length-2&&(g=r,_=a),h=n[C],u=n[C+1],[v,E]=bc(h,u,d,f,g,_,t),s[w++]=v,s[w++]=E;for(let P=2;P<o;P++)s[w++]=n[C+P]}return s.length!=w&&(s.length=w),s}function bc(n,e,t,i,s,o,r){let a,l;t!==void 0&&i!==void 0?(a=n-t,l=e-i):s!==void 0&&o!==void 0?(a=s-n,l=o-e):(a=1,l=0);const c=Math.hypot(a,l),h=a/c,u=l/c;if(a=-u,l=h,t===void 0||i===void 0)return[n+a*r,e+l*r];if(s===void 0||o===void 0)return[n+a*r,e+l*r];const d=Gv([n,e],[t,i],[s,o]);if(Math.cos(d)>.998)return[n+h*r,e+u*r];const f=Math.cos(d/2),g=Math.sin(d/2),_=g*a+f*l,v=-f*a+g*l,E=_*(1/g),w=v*(1/g);return[n+E*r,e+w*r]}class t0{drawCustom(e,t,i,s,o){}drawGeometry(e){}setStyle(e){}drawCircle(e,t,i){}drawFeature(e,t,i){}drawGeometryCollection(e,t,i){}drawLineString(e,t,i){}drawMultiLineString(e,t,i){}drawMultiPoint(e,t,i){}drawMultiPolygon(e,t,i){}drawPoint(e,t,i){}drawPolygon(e,t,i){}drawText(e,t,i){}setFillStrokeStyle(e,t){}setImageStyle(e,t){}setTextStyle(e,t){}}const Ec="ol-hidden",Cc="ol-unselectable",Pd="ol-control",n0="ol-collapsed",sE=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"),i0=["style","variant","weight","size","lineHeight","family"],Sd={normal:400,bold:700},Rd=function(n){const e=n.match(sE);if(!e)return null;const t={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let i=0,s=i0.length;i<s;++i){const o=e[i+1];o!==void 0&&(t[i0[i]]=typeof o=="string"?o.trim():o)}return isNaN(Number(t.weight))&&t.weight in Sd&&(t.weight=Sd[t.weight]),t.families=t.family.split(/,\s?/).map(i=>i.trim().replace(/^['"]|['"]$/g,"")),t},s0="10px sans-serif",cn="#000",Ko="round",ji=[],Ui=0,Qo="round",pa=10,oE=0,ga="#000",ma="center",xc="middle",ao=[0,0,0,0],ya=1,lo=new di;let _a=null,o0;const Td={},rE=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function aE(n,e,t){return`${n} ${e} 16px "${t}"`}const lE=(function(){let e,t;async function i(o){await t.ready;const r=await t.load(o);if(r.length===0)return!1;const a=Rd(o),l=a.families[0].toLowerCase(),c=a.weight;return r.some(h=>{const u=h.family.replace(/^['"]|['"]$/g,"").toLowerCase(),d=Sd[h.weight]||h.weight;return u===l&&h.style===a.style&&d==c})}async function s(){await t.ready;let o=!0;const r=lo.getProperties(),a=Object.keys(r).filter(l=>r[l]<100);for(let l=a.length-1;l>=0;--l){const c=a[l];let h=r[c];h<100&&(await i(c)?(Jr(Td),lo.set(c,100)):(h+=10,lo.set(c,h,!0),h<100&&(o=!1)))}e=void 0,o||(e=setTimeout(s,100))}return async function(o){t||(t=ln?self.fonts:document.fonts);const r=Rd(o);if(!r)return;const a=r.families;let l=!1;for(const c of a){if(rE.has(c))continue;const h=aE(r.style,r.weight,c);lo.get(h)===void 0&&(lo.set(h,0,!0),l=!0)}l&&(clearTimeout(e),e=setTimeout(s,100))}})(),cE=(function(){let n;return function(e){let t=Td[e];if(t==null){if(ln){const i=Rd(e),s=r0(e,"Žg");t=(isNaN(Number(i.lineHeight))?1.2:Number(i.lineHeight))*(s.actualBoundingBoxAscent+s.actualBoundingBoxDescent)}else n||(n=document.createElement("div"),n.innerHTML="M",n.style.minHeight="0",n.style.maxHeight="none",n.style.height="auto",n.style.padding="0",n.style.border="none",n.style.position="absolute",n.style.display="block",n.style.left="-99999px"),n.style.font=e,document.body.appendChild(n),t=n.offsetHeight,document.body.removeChild(n);Td[e]=t}return t}})();function r0(n,e){return _a||(_a=ht(1,1)),n!=o0&&(_a.font=n,o0=_a.font),_a.measureText(e)}function a0(n,e){return r0(n,e).width}function l0(n,e,t){if(e in t)return t[e];const i=e.split(`
22
+ `).reduce((s,o)=>Math.max(s,a0(n,o)),0);return t[e]=i,i}function hE(n,e){const t=[],i=[],s=[];let o=0,r=0,a=0,l=0;for(let c=0,h=e.length;c<=h;c+=2){const u=e[c];if(u===`
23
+ `||c===h){o=Math.max(o,r),s.push(r),r=0,a+=l,l=0;continue}const d=e[c+1]||n.font,f=a0(d,u);t.push(f),r+=f;const g=cE(d);i.push(g),l=Math.max(l,g)}return{width:o,height:a,widths:t,heights:i,lineWidths:s}}function uE(n,e,t,i,s,o,r,a,l,c,h){n.save(),t!==1&&(n.globalAlpha===void 0?n.globalAlpha=u=>u.globalAlpha*=t:n.globalAlpha*=t),e&&n.transform.apply(n,e),i.contextInstructions?(n.translate(l,c),n.scale(h[0],h[1]),dE(i,n)):h[0]<0||h[1]<0?(n.translate(l,c),n.scale(h[0],h[1]),n.drawImage(i,s,o,r,a,0,0,r,a)):n.drawImage(i,s,o,r,a,l,c,r*h[0],a*h[1]),n.restore()}function dE(n,e){const t=n.contextInstructions;for(let i=0,s=t.length;i<s;i+=2)Array.isArray(t[i+1])?e[t[i]].apply(e,t[i+1]):e[t[i]]=t[i+1]}class c0 extends t0{constructor(e,t,i,s,o,r,a){super(),this.context_=e,this.pixelRatio_=t,this.extent_=i,this.transform_=s,this.transformRotation_=s?Yr(Math.atan2(s[1],s[0]),10):0,this.viewRotation_=o,this.squaredTolerance_=r,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_=Kt()}drawImages_(e,t,i,s){if(!this.image_)return;const o=pi(e,t,i,s,this.transform_,this.pixelCoordinates_),r=this.context_,a=this.tmpLocalTransform_,l=r.globalAlpha;this.imageOpacity_!=1&&(r.globalAlpha=l*this.imageOpacity_);let c=this.imageRotation_;this.transformRotation_===0&&(c-=this.viewRotation_),this.imageRotateWithView_&&(c+=this.viewRotation_);for(let h=0,u=o.length;h<u;h+=2){const d=o[h]-this.imageAnchorX_,f=o[h+1]-this.imageAnchorY_;if(c!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const g=d+this.imageAnchorX_,_=f+this.imageAnchorY_;Hn(a,g,_,1,1,c,-g,-_),r.save(),r.transform.apply(r,a),r.translate(g,_),r.scale(this.imageScale_[0],this.imageScale_[1]),r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),r.restore()}else r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,d,f,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(r.globalAlpha=l)}drawText_(e,t,i,s){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const o=pi(e,t,i,s,this.transform_,this.pixelCoordinates_),r=this.context_;let a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);t<i;t+=s){const l=o[t]+this.textOffsetX_,c=o[t+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(r.save(),r.translate(l-this.textOffsetX_,c-this.textOffsetY_),r.rotate(a),r.translate(this.textOffsetX_,this.textOffsetY_),r.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&r.strokeText(this.text_,0,0),this.textFillState_&&r.fillText(this.text_,0,0),r.restore()):(this.textStrokeState_&&r.strokeText(this.text_,l,c),this.textFillState_&&r.fillText(this.text_,l,c))}}moveToLineTo_(e,t,i,s,o,r){const a=this.context_;let l=pi(e,t,i,s,this.transform_,this.pixelCoordinates_);Math.abs(r)>0&&(l=iE(l,s,r,o,l)),a.moveTo(l[0],l[1]);let c=l.length;o&&(c-=2);for(let h=2;h<c;h+=2)a.lineTo(l[h],l[h+1]);return o&&a.closePath(),i}drawRings_(e,t,i,s,o){for(let r=0,a=i.length;r<a;++r)t=this.moveToLineTo_(e,t,i[r],s,!0,o);return t}drawCircle(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!pt(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=Sb(e,this.transform_,this.pixelCoordinates_),i=t[2]-t[0],s=t[3]-t[1],o=Math.sqrt(i*i+s*s),r=this.context_;r.beginPath(),r.arc(t[0],t[1],o,0,2*Math.PI),this.fillState_&&r.fill(),this.strokeState_&&r.stroke()}this.text_!==""&&this.drawText_(e.getCenter(),0,2,2)}}setStyle(e){this.setFillStrokeStyle(e.getFill(),e.getStroke()),this.setImageStyle(e.getImage()),this.setTextStyle(e.getText())}setTransform(e){this.transform_=e}drawGeometry(e){switch(e.getType()){case"Point":this.drawPoint(e);break;case"LineString":this.drawLineString(e);break;case"Polygon":this.drawPolygon(e);break;case"MultiPoint":this.drawMultiPoint(e);break;case"MultiLineString":this.drawMultiLineString(e);break;case"MultiPolygon":this.drawMultiPolygon(e);break;case"GeometryCollection":this.drawGeometryCollection(e);break;case"Circle":this.drawCircle(e);break}}drawFeature(e,t){const i=t.getGeometryFunction()(e);i&&(this.setStyle(t),this.drawGeometry(i))}drawGeometryCollection(e){const t=e.getGeometriesArray();for(let i=0,s=t.length;i<s;++i)this.drawGeometry(t[i])}drawPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getFlatCoordinates(),i=e.getStride();this.image_&&this.drawImages_(t,0,t.length,i),this.text_!==""&&this.drawText_(t,0,t.length,i)}drawMultiPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getFlatCoordinates(),i=e.getStride();this.image_&&this.drawImages_(t,0,t.length,i),this.text_!==""&&this.drawText_(t,0,t.length,i)}drawLineString(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!pt(this.extent_,e.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const t=this.context_,i=e.getFlatCoordinates();t.beginPath(),this.moveToLineTo_(i,0,i.length,e.getStride(),!1,this.strokeState_.strokeOffset),t.stroke()}if(this.text_!==""){const t=e.getFlatMidpoint();this.drawText_(t,0,2,2)}}}drawMultiLineString(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getExtent();if(pt(this.extent_,t)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const i=this.context_,s=e.getFlatCoordinates();let o=0;const r=e.getEnds(),a=e.getStride();i.beginPath();for(let l=0,c=r.length;l<c;++l)o=this.moveToLineTo_(s,o,r[l],a,!1,this.strokeState_.strokeOffset);i.stroke()}if(this.text_!==""){const i=e.getFlatMidpoints();this.drawText_(i,0,i.length,2)}}}drawPolygon(e){var t;if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!pt(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const i=this.context_;i.beginPath(),this.drawRings_(e.getOrientedFlatCoordinates(),0,e.getEnds(),e.getStride(),(t=this.strokeState_)==null?void 0:t.strokeOffset),this.fillState_&&i.fill(),this.strokeState_&&i.stroke()}if(this.text_!==""){const i=e.getFlatInteriorPoint();this.drawText_(i,0,2,2)}}}drawMultiPolygon(e){var t;if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!pt(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const i=this.context_,s=e.getOrientedFlatCoordinates();let o=0;const r=e.getEndss(),a=e.getStride();i.beginPath();for(let l=0,c=r.length;l<c;++l){const h=r[l];o=this.drawRings_(s,o,h,a,(t=this.strokeState_)==null?void 0:t.strokeOffset)}this.fillState_&&i.fill(),this.strokeState_&&i.stroke()}if(this.text_!==""){const i=e.getFlatInteriorPoints();this.drawText_(i,0,i.length,2)}}}setContextFillState_(e){const t=this.context_,i=this.contextFillState_;i?i.fillStyle!=e.fillStyle&&(i.fillStyle=e.fillStyle,t.fillStyle=e.fillStyle):(t.fillStyle=e.fillStyle,this.contextFillState_={fillStyle:e.fillStyle})}setContextStrokeState_(e){const t=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=e.lineCap&&(i.lineCap=e.lineCap,t.lineCap=e.lineCap),us(i.lineDash,e.lineDash)||t.setLineDash(i.lineDash=e.lineDash),i.lineDashOffset!=e.lineDashOffset&&(i.lineDashOffset=e.lineDashOffset,t.lineDashOffset=e.lineDashOffset),i.lineJoin!=e.lineJoin&&(i.lineJoin=e.lineJoin,t.lineJoin=e.lineJoin),i.lineWidth!=e.lineWidth&&(i.lineWidth=e.lineWidth,t.lineWidth=e.lineWidth),i.miterLimit!=e.miterLimit&&(i.miterLimit=e.miterLimit,t.miterLimit=e.miterLimit),i.strokeStyle!=e.strokeStyle&&(i.strokeStyle=e.strokeStyle,t.strokeStyle=e.strokeStyle)):(t.lineCap=e.lineCap,t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset,t.lineJoin=e.lineJoin,t.lineWidth=e.lineWidth,t.miterLimit=e.miterLimit,t.strokeStyle=e.strokeStyle,this.contextStrokeState_={lineCap:e.lineCap,lineDash:e.lineDash,lineDashOffset:e.lineDashOffset,lineJoin:e.lineJoin,lineWidth:e.lineWidth,miterLimit:e.miterLimit,strokeStyle:e.strokeStyle})}setContextTextState_(e){const t=this.context_,i=this.contextTextState_,s=e.textAlign?e.textAlign:ma;i?(i.font!=e.font&&(i.font=e.font,t.font=e.font),i.textAlign!=s&&(i.textAlign=s,t.textAlign=s),i.textBaseline!=e.textBaseline&&(i.textBaseline=e.textBaseline,t.textBaseline=e.textBaseline)):(t.font=e.font,t.textAlign=s,t.textBaseline=e.textBaseline,this.contextTextState_={font:e.font,textAlign:s,textBaseline:e.textBaseline})}setFillStrokeStyle(e,t){if(!e)this.fillState_=null;else{const i=e.getColor();this.fillState_={fillStyle:gi(i||cn)}}if(!t)this.strokeState_=null;else{const i=t.getColor(),s=t.getLineCap(),o=t.getLineDash(),r=t.getLineDashOffset(),a=t.getLineJoin(),l=t.getWidth(),c=t.getMiterLimit(),h=o||ji,u=t.getOffset();this.strokeState_={lineCap:s!==void 0?s:Ko,lineDash:this.pixelRatio_===1?h:h.map(d=>d*this.pixelRatio_),lineDashOffset:(r||Ui)*this.pixelRatio_,lineJoin:a!==void 0?a:Qo,lineWidth:(l!==void 0?l:ya)*this.pixelRatio_,miterLimit:c!==void 0?c:pa,strokeStyle:gi(i||ga),strokeOffset:(u??0)*this.pixelRatio_}}}setImageStyle(e){let t;if(!e||!(t=e.getSize())){this.image_=null;return}const i=e.getPixelRatio(this.pixelRatio_),s=e.getAnchor(),o=e.getOrigin();this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=s[0]*i,this.imageAnchorY_=s[1]*i,this.imageHeight_=t[1]*i,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=o[0],this.imageOriginY_=o[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();const r=e.getScaleArray();this.imageScale_=[r[0]*this.pixelRatio_/i,r[1]*this.pixelRatio_/i],this.imageWidth_=t[0]*i}setTextStyle(e){if(!e)this.text_="";else{const t=e.getFill();if(!t)this.textFillState_=null;else{const f=t.getColor();this.textFillState_={fillStyle:gi(f||cn)}}const i=e.getStroke();if(!i)this.textStrokeState_=null;else{const f=i.getColor(),g=i.getLineCap(),_=i.getLineDash(),v=i.getLineDashOffset(),E=i.getLineJoin(),w=i.getWidth(),C=i.getMiterLimit();this.textStrokeState_={lineCap:g!==void 0?g:Ko,lineDash:_||ji,lineDashOffset:v||Ui,lineJoin:E!==void 0?E:Qo,lineWidth:w!==void 0?w:ya,miterLimit:C!==void 0?C:pa,strokeStyle:gi(f||ga)}}const s=e.getFont(),o=e.getOffsetX(),r=e.getOffsetY(),a=e.getRotateWithView(),l=e.getRotation(),c=e.getScaleArray(),h=e.getText(),u=e.getTextAlign(),d=e.getTextBaseline();this.textState_={font:s!==void 0?s:s0,textAlign:u!==void 0?u:ma,textBaseline:d!==void 0?d:xc},this.text_=h!==void 0?Array.isArray(h)?h.reduce((f,g,_)=>f+=_%2?" ":g,""):h:"",this.textOffsetX_=o!==void 0?this.pixelRatio_*o:0,this.textOffsetY_=r!==void 0?this.pixelRatio_*r:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*c[0],this.pixelRatio_*c[1]]}}}const fE=.5,h0={Point:bE,LineString:_E,Polygon:CE,MultiPoint:EE,MultiLineString:wE,MultiPolygon:vE,GeometryCollection:yE,Circle:gE};function pE(n,e){return parseInt(Re(n),10)-parseInt(Re(e),10)}function Pc(n,e){const t=u0(n,e);return t*t}function u0(n,e){return fE*n/e}function gE(n,e,t,i,s){const o=t.getFill(),r=t.getStroke();if(o||r){const l=n.getBuilder(t.getZIndex(),"Circle");l.setFillStrokeStyle(o,r),l.drawCircle(e,i,s)}const a=t.getText();if(a&&a.getText()){const l=n.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,i)}}function Sc(n,e,t,i,s,o,r,a){const l=[],c=t.getImage();if(c){let d=!0;const f=c.getImageState();f==le.LOADED||f==le.ERROR?d=!1:f==le.IDLE&&c.load(),d&&l.push(c.ready())}const h=t.getFill();h&&h.loading()&&l.push(h.ready());const u=l.length>0;return u&&Promise.all(l).then(()=>s(null)),mE(n,e,t,i,o,r,a),u}function mE(n,e,t,i,s,o,r){const a=t.getGeometryFunction()(e);if(!a)return;const l=a.simplifyTransformed(i,s);if(t.getRenderer())d0(n,l,t,e,r);else{const h=h0[l.getType()];h(n,l,t,e,r,o)}}function d0(n,e,t,i,s){if(e.getType()=="GeometryCollection"){const r=e.getGeometries();for(let a=0,l=r.length;a<l;++a)d0(n,r[a],t,i,s);return}n.getBuilder(t.getZIndex(),"Default").drawCustom(e,i,t.getRenderer(),t.getHitDetectionRenderer(),s)}function yE(n,e,t,i,s,o){const r=e.getGeometriesArray();let a,l;for(a=0,l=r.length;a<l;++a){const c=h0[r[a].getType()];c(n,r[a],t,i,s,o)}}function _E(n,e,t,i,s){const o=t.getStroke();if(o){const a=n.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,o),a.drawLineString(e,i,s)}const r=t.getText();if(r&&r.getText()){const a=n.getBuilder(t.getZIndex(),"Text");a.setTextStyle(r),a.drawText(e,i,s)}}function wE(n,e,t,i,s){const o=t.getStroke();if(o){const a=n.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,o),a.drawMultiLineString(e,i,s)}const r=t.getText();if(r&&r.getText()){const a=n.getBuilder(t.getZIndex(),"Text");a.setTextStyle(r),a.drawText(e,i,s)}}function vE(n,e,t,i,s){const o=t.getFill(),r=t.getStroke();if(r||o){const l=n.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(o,r),l.drawMultiPolygon(e,i,s)}const a=t.getText();if(a&&a.getText()){const l=n.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,i,s)}}function bE(n,e,t,i,s,o){const r=t.getImage(),a=t.getText(),l=a&&a.getText(),c=o&&r&&l?{}:void 0;if(r){if(r.getImageState()!=le.LOADED)return;const h=n.getBuilder(t.getZIndex(),"Image");h.setImageStyle(r,c),h.drawPoint(e,i,s)}if(l){const h=n.getBuilder(t.getZIndex(),"Text");h.setTextStyle(a,c),h.drawText(e,i,s)}}function EE(n,e,t,i,s,o){const r=t.getImage(),a=r&&r.getOpacity()!==0,l=t.getText(),c=l&&l.getText(),h=o&&a&&c?{}:void 0;if(a){if(r.getImageState()!=le.LOADED)return;const u=n.getBuilder(t.getZIndex(),"Image");u.setImageStyle(r,h),u.drawMultiPoint(e,i,s)}if(c){const u=n.getBuilder(t.getZIndex(),"Text");u.setTextStyle(l,h),u.drawText(e,i,s)}}function CE(n,e,t,i,s){const o=t.getFill(),r=t.getStroke();if(o||r){const l=n.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(o,r),l.drawPolygon(e,i,s)}const a=t.getText();if(a&&a.getText()){const l=n.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,i,s)}}function f0(n){if(!(n.context instanceof CanvasRenderingContext2D))throw new Error("Only works for render events from Canvas 2D layers");const e=n.inversePixelTransform[0],t=n.inversePixelTransform[1],i=Math.sqrt(e*e+t*t),s=n.frameState,o=hc(n.inversePixelTransform.slice(),s.coordinateToPixelTransform),r=Pc(s.viewState.resolution,i);let a;return new c0(n.context,i,s.extent,o,s.viewState.rotation,r,a)}let xE=!1;function p0(n,e,t,i,s,o,r){const a=new XMLHttpRequest;a.open("GET",typeof n=="function"?n(t,i,s):n,!0),e.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=xE,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){const c=e.getType();try{let h;c=="text"||c=="json"?h=a.responseText:c=="xml"?h=a.responseXML||a.responseText:c=="arraybuffer"&&(h=a.response),h?o(e.readFeatures(h,{extent:t,featureProjection:s}),e.readProjection(h)):r()}catch{r()}}else r()},a.onerror=r,a.send()}function g0(n,e){return function(t,i,s,o,r){p0(n,e,t,i,s,(a,l)=>{this.addFeatures(a),o!==void 0&&o(a)},()=>{this.changed(),r!==void 0&&r()})}}function PE(n,e){return[[-1/0,-1/0,1/0,1/0]]}function SE(n,e){return[n]}function m0(n,e,t,i){const s=[];let o=gn();for(let r=0,a=t.length;r<a;++r){const l=t[r];o=Du(n,e,l[0],i),s.push((o[0]+o[2])/2,(o[1]+o[3])/2),e=l[l.length-1]}return s}class Rc extends Am{constructor(e){super(),this.geometries_=e,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(st),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const e=this.geometries_;for(let t=0,i=e.length;t<i;++t)this.changeEventsKeys_.push(qe(e[t],we.CHANGE,this.changed,this))}clone(){const e=new Rc(Id(this.geometries_));return e.applyProperties(this),e}closestPointXY(e,t,i,s){if(s<Ys(this.getExtent(),e,t))return s;const o=this.geometries_;for(let r=0,a=o.length;r<a;++r)s=o[r].closestPointXY(e,t,i,s);return s}containsXY(e,t){const i=this.geometries_;for(let s=0,o=i.length;s<o;++s)if(i[s].containsXY(e,t))return!0;return!1}computeExtent(e){Wo(e);const t=this.geometries_;for(let i=0,s=t.length;i<s;++i)Yg(e,t[i].getExtent());return e}getGeometries(){return Id(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let e=[];const t=this.geometries_;for(let i=0,s=t.length;i<s;++i)t[i].getType()===this.getType()?e=e.concat(t[i].getGeometriesArrayRecursive()):e.push(t[i]);return e}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<this.simplifiedGeometryMaxMinSquaredTolerance)return this;const t=[],i=this.geometries_;let s=!1;for(let o=0,r=i.length;o<r;++o){const a=i[o],l=a.getSimplifiedGeometry(e);t.push(l),l!==a&&(s=!0)}return s?new Rc(t):(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getType(){return"GeometryCollection"}intersectsExtent(e){const t=this.geometries_;for(let i=0,s=t.length;i<s;++i)if(t[i].intersectsExtent(e))return!0;return!1}isEmpty(){return this.geometries_.length===0}rotate(e,t){const i=this.geometries_;for(let s=0,o=i.length;s<o;++s)i[s].rotate(e,t);this.changed()}scale(e,t,i){i||(i=xn(this.getExtent()));const s=this.geometries_;for(let o=0,r=s.length;o<r;++o)s[o].scale(e,t,i);this.changed()}setGeometries(e){this.setGeometriesArray(Id(e))}setGeometriesArray(e){this.unlistenGeometriesChange_(),this.geometries_=e,this.listenGeometriesChange_(),this.changed()}applyTransform(e){const t=this.geometries_;for(let i=0,s=t.length;i<s;++i)t[i].applyTransform(e);this.changed()}translate(e,t){const i=this.geometries_;for(let s=0,o=i.length;s<o;++s)i[s].translate(e,t);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function Id(n){return n.map(e=>e.clone())}class co extends to{constructor(e,t,i){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(e[0]))this.setCoordinates(e,t);else if(t!==void 0&&i)this.setFlatCoordinates(t,e),this.ends_=i;else{const s=e,o=[],r=[];for(let l=0,c=s.length;l<c;++l){const h=s[l];ci(o,h.getFlatCoordinates()),r.push(o.length)}const a=s.length===0?this.getLayout():s[0].getLayout();this.setFlatCoordinates(a,o),this.ends_=r}}appendLineString(e){ci(this.flatCoordinates,e.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const e=new co(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,i,s){return s<Ys(this.getExtent(),e,t)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(td(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),id(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,e,t,i,s))}getCoordinateAtM(e,t,i){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(t=t!==void 0?t:!1,i=i!==void 0?i:!1,jb(this.flatCoordinates,0,this.ends_,this.stride,e,t,i))}getCoordinates(){return aa(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(e){return e<0||this.ends_.length<=e?null:new Yn(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLineStrings(){const e=this.flatCoordinates,t=this.ends_,i=this.layout,s=[];let o=0;for(let r=0,a=t.length;r<a;++r){const l=t[r],c=new Yn(e.slice(o,l),i);s.push(c),o=l}return s}getLength(){const e=this.ends_;let t=0,i=0;for(let s=0,o=e.length;s<o;++s)i+=fd(this.flatCoordinates,t,e[s],this.stride),t=e[s];return i}getFlatMidpoints(){const e=[],t=this.flatCoordinates;let i=0;const s=this.ends_,o=this.stride;for(let r=0,a=s.length;r<a;++r){const l=s[r],c=mc(t,i,l,o,.5);ci(e,c),i=l}return e}getSimplifiedGeometryInternal(e){const t=[],i=[];return t.length=Nm(this.flatCoordinates,0,this.ends_,this.stride,e,t,0,i),new co(t,"XY",i)}getType(){return"MultiLineString"}intersectsExtent(e){return Lb(this.flatCoordinates,0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=ra(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}}class Jo extends to{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){ci(this.flatCoordinates,e.getFlatCoordinates()),this.changed()}clone(){const e=new Jo(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,i,s){if(s<Ys(this.getExtent(),e,t))return s;const o=this.flatCoordinates,r=this.stride;for(let a=0,l=o.length;a<l;a+=r){const c=Ks(e,t,o[a],o[a+1]);if(c<s){s=c;for(let h=0;h<r;++h)i[h]=o[a+h];i.length=r}}return s}getCoordinates(){return ms(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){const t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new yn(this.flatCoordinates.slice(e*this.stride,(e+1)*this.stride),this.layout)}getPoints(){const e=this.flatCoordinates,t=this.layout,i=this.stride,s=[];for(let o=0,r=e.length;o<r;o+=i){const a=new yn(e.slice(o,o+i),t);s.push(a)}return s}getType(){return"MultiPoint"}intersectsExtent(e){const t=this.flatCoordinates,i=this.stride;for(let s=0,o=t.length;s<o;s+=i){const r=t[s],a=t[s+1];if(Au(e,r,a))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=uc(this.flatCoordinates,0,e,this.stride),this.changed()}}class wa extends to{constructor(e,t,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(e[0])){const s=e,o=[],r=[];for(let a=0,l=s.length;a<l;++a){const c=s[a],h=o.length,u=c.getEnds();for(let d=0,f=u.length;d<f;++d)u[d]+=h;ci(o,c.getFlatCoordinates()),r.push(u)}t=s.length===0?this.getLayout():s[0].getLayout(),e=o,i=r}t!==void 0&&i?(this.setFlatCoordinates(t,e),this.endss_=i):this.setCoordinates(e,t)}appendPolygon(e){let t;if(!this.flatCoordinates)this.flatCoordinates=e.getFlatCoordinates().slice(),t=e.getEnds().slice(),this.endss_.push();else{const i=this.flatCoordinates.length;ci(this.flatCoordinates,e.getFlatCoordinates()),t=e.getEnds().slice();for(let s=0,o=t.length;s<o;++s)t[s]+=i}this.endss_.push(t),this.changed()}clone(){const e=this.endss_.length,t=new Array(e);for(let s=0;s<e;++s)t[s]=this.endss_[s].slice();const i=new wa(this.flatCoordinates.slice(),this.layout,t);return i.applyProperties(this),i}closestPointXY(e,t,i,s){return s<Ys(this.getExtent(),e,t)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Tb(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Ib(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,i,s))}containsXY(e,t){return Fb(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return Rb(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),hd(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,sd(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const e=m0(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=km(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new Jo(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const e=this.flatCoordinates;qm(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=hd(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){const t=[],i=[];return t.length=Mb(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(e),t,0,i),new wa(t,"XY",i)}getPolygon(e){if(e<0||this.endss_.length<=e)return null;let t;if(e===0)t=0;else{const o=this.endss_[e-1];t=o[o.length-1]}const i=this.endss_[e].slice(),s=i[i.length-1];if(t!==0)for(let o=0,r=i.length;o<r;++o)i[o]-=t;return new Xn(this.flatCoordinates.slice(t,s),this.layout,i)}getPolygons(){const e=this.layout,t=this.flatCoordinates,i=this.endss_,s=[];let o=0;for(let r=0,a=i.length;r<a;++r){const l=i[r].slice(),c=l[l.length-1];if(o!==0)for(let u=0,d=l.length;u<d;++u)l[u]-=o;const h=new Xn(t.slice(o,c),e,l);s.push(h),o=c}return s}getType(){return"MultiPolygon"}intersectsExtent(e){return zb(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);const i=zm(this.flatCoordinates,0,e,this.stride,this.endss_);if(i.length===0)this.flatCoordinates.length=0;else{const s=i[i.length-1];this.flatCoordinates.length=s.length===0?0:s[s.length-1]}this.changed()}}const y0=Kt();class Vt{constructor(e,t,i,s,o,r){this.styleFunction,this.extent_,this.id_=r,this.type_=e,this.flatCoordinates_=t,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=o,this.squaredTolerance_,this.stride_=s,this.simplifiedGeometry_}get(e){return this.properties_[e]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?Xg(this.flatCoordinates_):Du(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const e=xn(this.getExtent());this.flatInteriorPoints_=ad(this.flatCoordinates_,0,this.ends_,2,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const e=Wm(this.flatCoordinates_,this.ends_),t=m0(this.flatCoordinates_,0,e,2);this.flatInteriorPoints_=km(this.flatCoordinates_,0,e,2,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=mc(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const e=this.flatCoordinates_;let t=0;const i=this.ends_;for(let s=0,o=i.length;s<o;++s){const r=i[s],a=mc(e,t,r,2,.5);ci(this.flatMidpoints_,a),t=r}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(e){return this}simplifyTransformed(e,t){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(e){e=Ne(e);const t=e.getExtent(),i=e.getWorldExtent();if(t&&i){const s=lt(i)/lt(t);Hn(y0,i[0],i[3],s,-s,0,0,0),pi(this.flatCoordinates_,0,this.flatCoordinates_.length,2,y0,this.flatCoordinates_)}}applyTransform(e){e(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){var e;return new Vt(this.type_,this.flatCoordinates_.slice(),(e=this.ends_)==null?void 0:e.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=rm((e,t)=>{if(e===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),t&&this.simplifiedGeometry_.applyTransform(t);const i=this.simplifiedGeometry_.getFlatCoordinates();let s;switch(this.type_){case"LineString":i.length=dc(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,i,0),s=[i.length];break;case"MultiLineString":s=[],i.length=Nm(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,i,0,s);break;case"Polygon":s=[],i.length=od(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(e),i,0,s);break}return s&&(this.simplifiedGeometry_=new Vt(this.type_,i,s,2,this.properties_,this.id_)),this.squaredTolerance_=e,this.simplifiedGeometry_}),this}}Vt.prototype.getFlatCoordinates=Vt.prototype.getOrientedFlatCoordinates;function _0(n,e,t=0,i=n.length-1,s=RE){for(;i>t;){if(i-t>600){const l=i-t+1,c=e-t+1,h=Math.log(l),u=.5*Math.exp(2*h/3),d=.5*Math.sqrt(h*u*(l-u)/l)*(c-l/2<0?-1:1),f=Math.max(t,Math.floor(e-c*u/l+d)),g=Math.min(i,Math.floor(e+(l-c)*u/l+d));_0(n,e,f,g,s)}const o=n[e];let r=t,a=i;for(va(n,t,e),s(n[i],o)>0&&va(n,t,i);r<a;){for(va(n,r,a),r++,a--;s(n[r],o)<0;)r++;for(;s(n[a],o)>0;)a--}s(n[t],o)===0?va(n,t,a):(a++,va(n,a,i)),a<=e&&(t=a+1),e<=a&&(i=a-1)}}function va(n,e,t){const i=n[e];n[e]=n[t],n[t]=i}function RE(n,e){return n<e?-1:n>e?1:0}let Od=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data;const i=[];if(!Ic(e,t))return i;const s=this.toBBox,o=[];for(;t;){for(let r=0;r<t.children.length;r++){const a=t.children[r],l=t.leaf?s(a):a;Ic(e,l)&&(t.leaf?i.push(a):Md(e,l)?this._all(a,i):o.push(a))}t=o.pop()}return i}collides(e){let t=this.data;if(!Ic(e,t))return!1;const i=[];for(;t;){for(let s=0;s<t.children.length;s++){const o=t.children[s],r=t.leaf?this.toBBox(o):o;if(Ic(e,r)){if(t.leaf||Md(e,r))return!0;i.push(o)}}t=i.pop()}return!1}load(e){if(!(e&&e.length))return this;if(e.length<this._minEntries){for(let i=0;i<e.length;i++)this.insert(e[i]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(!this.data.children.length)this.data=t;else if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){const i=this.data;this.data=t,t=i}this._insert(t,this.data.height-t.height-1,!0)}return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=tr([]),this}remove(e,t){if(!e)return this;let i=this.data;const s=this.toBBox(e),o=[],r=[];let a,l,c;for(;i||o.length;){if(i||(i=o.pop(),l=o[o.length-1],a=r.pop(),c=!0),i.leaf){const h=TE(e,i.children,t);if(h!==-1)return i.children.splice(h,1),o.push(i),this._condense(o),this}!c&&!i.leaf&&Md(i,s)?(o.push(i),r.push(a),a=0,l=i,i=i.children[0]):l?(a++,i=l.children[a],c=!1):i=null}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){const i=[];for(;e;)e.leaf?t.push(...e.children):i.push(...e.children),e=i.pop();return t}_build(e,t,i,s){const o=i-t+1;let r=this._maxEntries,a;if(o<=r)return a=tr(e.slice(t,i+1)),er(a,this.toBBox),a;s||(s=Math.ceil(Math.log(o)/Math.log(r)),r=Math.ceil(o/Math.pow(r,s-1))),a=tr([]),a.leaf=!1,a.height=s;const l=Math.ceil(o/r),c=l*Math.ceil(Math.sqrt(r));w0(e,t,i,c,this.compareMinX);for(let h=t;h<=i;h+=c){const u=Math.min(h+c-1,i);w0(e,h,u,l,this.compareMinY);for(let d=h;d<=u;d+=l){const f=Math.min(d+l-1,u);a.children.push(this._build(e,d,f,s-1))}}return er(a,this.toBBox),a}_chooseSubtree(e,t,i,s){for(;s.push(t),!(t.leaf||s.length-1===i);){let o=1/0,r=1/0,a;for(let l=0;l<t.children.length;l++){const c=t.children[l],h=Ad(c),u=AE(e,c)-h;u<r?(r=u,o=h<o?h:o,a=c):u===r&&h<o&&(o=h,a=c)}t=a||t.children[0]}return t}_insert(e,t,i){const s=i?e:this.toBBox(e),o=[],r=this._chooseSubtree(s,this.data,t,o);for(r.children.push(e),Ea(r,s);t>=0&&o[t].children.length>this._maxEntries;)this._split(o,t),t--;this._adjustParentBBoxes(s,o,t)}_split(e,t){const i=e[t],s=i.children.length,o=this._minEntries;this._chooseSplitAxis(i,o,s);const r=this._chooseSplitIndex(i,o,s),a=tr(i.children.splice(r,i.children.length-r));a.height=i.height,a.leaf=i.leaf,er(i,this.toBBox),er(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(i,a)}_splitRoot(e,t){this.data=tr([e,t]),this.data.height=e.height+1,this.data.leaf=!1,er(this.data,this.toBBox)}_chooseSplitIndex(e,t,i){let s,o=1/0,r=1/0;for(let a=t;a<=i-t;a++){const l=ba(e,0,a,this.toBBox),c=ba(e,a,i,this.toBBox),h=ME(l,c),u=Ad(l)+Ad(c);h<o?(o=h,s=a,r=u<r?u:r):h===o&&u<r&&(r=u,s=a)}return s||i-t}_chooseSplitAxis(e,t,i){const s=e.leaf?this.compareMinX:IE,o=e.leaf?this.compareMinY:OE,r=this._allDistMargin(e,t,i,s),a=this._allDistMargin(e,t,i,o);r<a&&e.children.sort(s)}_allDistMargin(e,t,i,s){e.children.sort(s);const o=this.toBBox,r=ba(e,0,t,o),a=ba(e,i-t,i,o);let l=Tc(r)+Tc(a);for(let c=t;c<i-t;c++){const h=e.children[c];Ea(r,e.leaf?o(h):h),l+=Tc(r)}for(let c=i-t-1;c>=t;c--){const h=e.children[c];Ea(a,e.leaf?o(h):h),l+=Tc(a)}return l}_adjustParentBBoxes(e,t,i){for(let s=i;s>=0;s--)Ea(t[s],e)}_condense(e){for(let t=e.length-1,i;t>=0;t--)e[t].children.length===0?t>0?(i=e[t-1].children,i.splice(i.indexOf(e[t]),1)):this.clear():er(e[t],this.toBBox)}};function TE(n,e,t){if(!t)return e.indexOf(n);for(let i=0;i<e.length;i++)if(t(n,e[i]))return i;return-1}function er(n,e){ba(n,0,n.children.length,e,n)}function ba(n,e,t,i,s){s||(s=tr(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let o=e;o<t;o++){const r=n.children[o];Ea(s,n.leaf?i(r):r)}return s}function Ea(n,e){return n.minX=Math.min(n.minX,e.minX),n.minY=Math.min(n.minY,e.minY),n.maxX=Math.max(n.maxX,e.maxX),n.maxY=Math.max(n.maxY,e.maxY),n}function IE(n,e){return n.minX-e.minX}function OE(n,e){return n.minY-e.minY}function Ad(n){return(n.maxX-n.minX)*(n.maxY-n.minY)}function Tc(n){return n.maxX-n.minX+(n.maxY-n.minY)}function AE(n,e){return(Math.max(e.maxX,n.maxX)-Math.min(e.minX,n.minX))*(Math.max(e.maxY,n.maxY)-Math.min(e.minY,n.minY))}function ME(n,e){const t=Math.max(n.minX,e.minX),i=Math.max(n.minY,e.minY),s=Math.min(n.maxX,e.maxX),o=Math.min(n.maxY,e.maxY);return Math.max(0,s-t)*Math.max(0,o-i)}function Md(n,e){return n.minX<=e.minX&&n.minY<=e.minY&&e.maxX<=n.maxX&&e.maxY<=n.maxY}function Ic(n,e){return e.minX<=n.maxX&&e.minY<=n.maxY&&e.maxX>=n.minX&&e.maxY>=n.minY}function tr(n){return{children:n,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function w0(n,e,t,i,s){const o=[e,t];for(;o.length;){if(t=o.pop(),e=o.pop(),t-e<=i)continue;const r=e+Math.ceil((t-e)/i/2)*i;_0(n,r,e,t,s),o.push(e,r,r,t)}}class v0{constructor(e){this.rbush_=new Od(e),this.items_={}}insert(e,t){const i={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(i),this.items_[Re(t)]=i}load(e,t){const i=new Array(t.length);for(let s=0,o=t.length;s<o;s++){const r=e[s],a=t[s],l={minX:r[0],minY:r[1],maxX:r[2],maxY:r[3],value:a};i[s]=l,this.items_[Re(a)]=l}this.rbush_.load(i)}remove(e){const t=Re(e),i=this.items_[t];return delete this.items_[t],this.rbush_.remove(i)!==null}update(e,t){const i=this.items_[Re(t)],s=[i.minX,i.minY,i.maxX,i.maxY];Li(s,e)||(this.remove(t),this.insert(e,t))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(e){const t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this.rbush_.search(t).map(function(s){return s.value})}forEach(e){return this.forEach_(this.getAll(),e)}forEachInExtent(e,t){return this.forEach_(this.getInExtent(e),t)}forEach_(e,t){let i;for(let s=0,o=e.length;s<o;s++)if(i=t(e[s]),i)return i;return i}isEmpty(){return gs(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){const t=this.rbush_.toJSON();return Fi(t.minX,t.minY,t.maxX,t.maxY,e)}concat(e){this.rbush_.load(e.rbush_.all());for(const t in e.items_)this.items_[t]=e.items_[t]}}class Ca extends di{constructor(e){super(),this.projection=Ne(e.projection),this.attributions_=b0(e.attributions),this.attributionsCollapsible_=e.attributionsCollapsible??!0,this.loading=!1,this.state_=e.state!==void 0?e.state:"ready",this.wrapX_=e.wrapX!==void 0?e.wrapX:!1,this.interpolate_=!!e.interpolate,this.viewResolver=null,this.viewRejector=null;const t=this;this.viewPromise_=new Promise(function(i,s){t.viewResolver=i,t.viewRejector=s})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(e){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(e){this.attributions_=b0(e),this.changed()}setState(e){this.state_=e,this.changed()}}function b0(n){return n?typeof n=="function"?n:(Array.isArray(n)||(n=[n]),e=>n):null}const On={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};class _s extends $n{constructor(e,t,i){super(e),this.feature=t,this.features=i}}class _n extends Ca{constructor(e){e=e||{},super({attributions:e.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:e.wrapX!==void 0?e.wrapX:!0}),this.on,this.once,this.un,this.loader_=Qr,this.format_=e.format||null,this.overlaps_=e.overlaps===void 0?!0:e.overlaps,this.url_=e.url,e.loader!==void 0?this.loader_=e.loader:this.url_!==void 0&&(Be(this.format_,"`format` must be set when `url` is set"),this.loader_=g0(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:PE;const t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new v0:null,this.loadedExtentsRtree_=new v0,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let i,s;Array.isArray(e.features)?s=e.features:e.features&&(i=e.features,s=i.getArray()),!t&&i===void 0&&(i=new Sn(s)),s!==void 0&&this.addFeaturesInternal(s),i!==void 0&&this.bindFeaturesCollection_(i)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){const t=Re(e);if(!this.addToIndex_(t,e)){this.featuresCollection_&&this.featuresCollection_.remove(e);return}this.setupChangeEvents_(t,e);const i=e.getGeometry();if(i){const s=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(s,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new _s(On.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof Vt||(this.featureChangeKeys_[e]=[qe(t,we.CHANGE,this.handleFeatureChange_,this),qe(t,Vo.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(e,t){let i=!0;if(t.getId()!==void 0){const s=String(t.getId());if(!(s in this.idIndex_))this.idIndex_[s]=t;else if(t instanceof Vt){const o=this.idIndex_[s];o instanceof Vt?Array.isArray(o)?o.push(t):this.idIndex_[s]=[o,t]:i=!1}else i=!1}return i&&(Be(!(e in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[e]=t),i}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){const t=[],i=[],s=[];for(let o=0,r=e.length;o<r;o++){const a=e[o],l=Re(a);this.addToIndex_(l,a)&&i.push(a)}for(let o=0,r=i.length;o<r;o++){const a=i[o],l=Re(a);this.setupChangeEvents_(l,a);const c=a.getGeometry();if(c){const h=c.getExtent();t.push(h),s.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(t,s),this.hasListener(On.ADDFEATURE))for(let o=0,r=i.length;o<r;o++)this.dispatchEvent(new _s(On.ADDFEATURE,i[o]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(On.ADDFEATURE,function(i){t||(t=!0,e.push(i.feature),t=!1)}),this.addEventListener(On.REMOVEFEATURE,function(i){t||(t=!0,e.remove(i.feature),t=!1)}),e.addEventListener(an.ADD,i=>{t||(t=!0,this.addFeature(i.element),t=!1)}),e.addEventListener(an.REMOVE,i=>{t||(t=!0,this.removeFeature(i.element),t=!1)}),this.featuresCollection_=e}clear(e){if(e){for(const i in this.featureChangeKeys_)this.featureChangeKeys_[i].forEach(st);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 t=new _s(On.CLEAR);this.dispatchEvent(t),this.changed()}forEachFeature(e){if(this.featuresRtree_)return this.featuresRtree_.forEach(e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureAtCoordinateDirect(e,t){const i=[e[0],e[1],e[0],e[1]];return this.forEachFeatureInExtent(i,function(s){const o=s.getGeometry();if(o instanceof Vt||o.intersectsCoordinate(e))return t(s)})}forEachFeatureInExtent(e,t){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(e,t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureIntersectingExtent(e,t){return this.forEachFeatureInExtent(e,function(i){const s=i.getGeometry();if(s instanceof Vt||s.intersectsExtent(e)){const o=t(i);if(o)return o}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),gs(this.nullGeometryFeatures_)||ci(e,Object.values(this.nullGeometryFeatures_))),e}getFeaturesAtCoordinate(e){const t=[];return this.forEachFeatureAtCoordinateDirect(e,function(i){t.push(i)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);const s=tm(e,t);return[].concat(...s.map(o=>this.featuresRtree_.getInExtent(o)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(e,t){const i=e[0],s=e[1];let o=null;const r=[NaN,NaN];let a=1/0;const l=[-1/0,-1/0,1/0,1/0];return t=t||Kr,this.featuresRtree_.forEachInExtent(l,function(c){if(t(c)){const h=c.getGeometry(),u=a;if(a=h instanceof Vt?0:h.closestPointXY(i,s,r,a),a<u){o=c;const d=Math.sqrt(a);l[0]=i-d,l[1]=s-d,l[2]=i+d,l[3]=s+d}}}),o}getExtent(e){var t;return((t=this.featuresRtree_)==null?void 0:t.getExtent(e))??null}getFeatureById(e){const t=this.idIndex_[e.toString()];return t!==void 0?t:null}getFeatureByUid(e){const t=this.uidIndex_[e];return t!==void 0?t:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(e){const t=e.target,i=Re(t),s=t.getGeometry();if(!s)i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(t),this.nullGeometryFeatures_[i]=t);else{const r=s.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(r,t)):this.featuresRtree_&&this.featuresRtree_.update(r,t)}const o=t.getId();if(o!==void 0){const r=o.toString();this.idIndex_[r]!==t&&(this.removeFromIdIndex_(t),this.idIndex_[r]=t)}else this.removeFromIdIndex_(t),this.uidIndex_[i]=t;this.changed(),this.dispatchEvent(new _s(On.CHANGEFEATURE,t))}hasFeature(e){const t=e.getId();return t!==void 0?t in this.idIndex_:Re(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&gs(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(e,t,i){const s=this.loadedExtentsRtree_,o=this.strategy_(e,t,i);for(let r=0,a=o.length;r<a;++r){const l=o[r];s.forEachInExtent(l,function(h){return Di(h.extent,l)})||(++this.loadingExtentsCount_,this.dispatchEvent(new _s(On.FEATURESLOADSTART)),this.loader_.call(this,l,t,i,h=>{--this.loadingExtentsCount_,this.dispatchEvent(new _s(On.FEATURESLOADEND,void 0,h))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new _s(On.FEATURESLOADERROR))}),s.insert(l,{extent:l.slice()}))}this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){const t=this.loadedExtentsRtree_,i=t.forEachInExtent(e,function(s){if(Li(s.extent,e))return s});i&&t.remove(i)}removeFeatures(e){let t=!1;for(let i=0,s=e.length;i<s;++i)t=this.removeFeatureInternal(e[i])||t;t&&this.changed()}removeFeature(e){if(!e)return;this.removeFeatureInternal(e)&&this.changed()}removeFeatureInternal(e){const t=Re(e);if(!(t in this.uidIndex_))return!1;t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e);const i=this.featureChangeKeys_[t];i==null||i.forEach(st),delete this.featureChangeKeys_[t];const s=e.getId();if(s!==void 0){const o=s.toString(),r=this.idIndex_[o];r===e?delete this.idIndex_[o]:Array.isArray(r)&&(r.splice(r.indexOf(e),1),r.length===1&&(this.idIndex_[o]=r[0]))}return delete this.uidIndex_[t],this.hasListener(On.REMOVEFEATURE)&&this.dispatchEvent(new _s(On.REMOVEFEATURE,e)),!0}removeFromIdIndex_(e){for(const t in this.idIndex_)if(this.idIndex_[t]===e){delete this.idIndex_[t];break}}setLoader(e){this.loader_=e}setUrl(e){Be(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(g0(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}}class wt{constructor(e){e=e||{},this.patternImage_=null,this.color_=null,e.color!==void 0&&this.setColor(e.color)}clone(){const e=this.getColor();return new wt({color:Array.isArray(e)?e.slice():e||void 0})}getColor(){return this.color_}setColor(e){if(e!==null&&typeof e=="object"&&"src"in e){const t=fa(null,e.src,{crossOrigin:"anonymous"},void 0,e.offset?null:e.color?e.color:null,!(e.offset&&e.size));t.ready().then(()=>{this.patternImage_=null}),t.getImageState()===le.IDLE&&t.load(),t.getImageState()===le.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){const e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?Re(e):typeof e=="object"&&"src"in e?e.src+":"+e.offset:ro(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}class St{constructor(e){e=e||{},this.color_=e.color!==void 0?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=e.lineDash!==void 0?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.offset_=e.offset,this.width_=e.width}clone(){const e=this.getColor();return new St({color:Array.isArray(e)?e.slice():e||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),offset:this.getOffset(),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_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(e){this.color_=e}setLineCap(e){this.lineCap_=e}setLineDash(e){this.lineDash_=e}setLineDashOffset(e){this.lineDashOffset_=e}setLineJoin(e){this.lineJoin_=e}setMiterLimit(e){this.miterLimit_=e}setOffset(e){this.offset_=e}setWidth(e){this.width_=e}}function E0(n){return n[0]>0&&n[1]>0}function DE(n,e,t){return t===void 0&&(t=[0,0]),t[0]=n[0]*e+.5|0,t[1]=n[1]*e+.5|0,t}function Bt(n,e){return Array.isArray(n)?n:(e===void 0?e=[n,n]:(e[0]=n,e[1]=n),e)}class Oc{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=Bt(e.scale),this.displacement_=e.displacement,this.declutterMode_=e.declutterMode}clone(){const e=this.getScale();return new Oc({opacity:this.getOpacity(),scale:Array.isArray(e)?e.slice():e,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 be()}getImage(e){return be()}getHitDetectionImage(){return be()}getPixelRatio(e){return 1}getImageState(){return be()}getImageSize(){return be()}getOrigin(){return be()}getSize(){return be()}setDisplacement(e){this.displacement_=e}setOpacity(e){this.opacity_=e}setRotateWithView(e){this.rotateWithView_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=Bt(e)}listenImageChange(e){be()}load(){be()}unlistenImageChange(e){be()}ready(){return Promise.resolve()}}class xa extends Oc{constructor(e){super({opacity:1,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,rotation:e.rotation!==void 0?e.rotation:0,scale:e.scale!==void 0?e.scale:1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=e.fill!==void 0?e.fill:null,this.origin_=[0,0],this.points_=e.points,this.radius=e.radius,this.radius2_=e.radius2,this.angle_=e.angle!==void 0?e.angle:0,this.stroke_=e.stroke!==void 0?e.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?le.LOADING:le.LOADED,this.imageState_===le.LOADING&&this.ready().then(()=>this.imageState_=le.LOADED),this.render()}clone(){const e=this.getScale(),t=new xa({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(e)?e.slice():e,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}getAnchor(){const e=this.size_,t=this.getDisplacement(),i=this.getScaleArray();return[e[0]/2-t[0]/i[0],e[1]/2+t[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(e){var o,r;const t=(o=this.fill_)==null?void 0:o.getKey(),i=`${e},${this.angle_},${this.radius},${this.radius2_},${this.points_},${t}`+Object.values(this.renderOptions_).join(",");let s=(r=In.get(i,null))==null?void 0:r.getImage(1);if(!s){const a=this.renderOptions_,l=Math.ceil(a.size*e),c=ht(l,l);this.draw_(a,c,e),s=c.canvas;const h=new e0(s,void 0,null,le.LOADED,null);In.set(i,null,h),createImageBitmap(s).then(u=>{h.setImage(u)})}return s}getPixelRatio(e){return e}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(e){this.radius!==e&&(this.radius=e,this.render())}getRadius2(){return this.radius2_}setRadius2(e){this.radius2_!==e&&(this.radius2_=e,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e,this.render()}listenImageChange(e){}load(){}unlistenImageChange(e){}calculateLineJoinSize_(e,t,i){if(t===0||this.points_===1/0||e!=="bevel"&&e!=="miter")return t;let s=this.radius,o=this.radius2_===void 0?s:this.radius2_;if(s<o){const A=s;s=o,o=A}const r=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/r,l=o*Math.sin(a),c=Math.sqrt(o*o-l*l),h=s-c,u=Math.sqrt(l*l+h*h),d=u/l;if(e==="miter"&&d<=i)return d*t;const f=t/2/d,g=t/2*(h/u),v=Math.sqrt((s+f)*(s+f)+g*g)-s;if(this.radius2_===void 0||e==="bevel")return v*2;const E=s*Math.sin(a),w=Math.sqrt(s*s-E*E),C=o-w,R=Math.sqrt(E*E+C*C)/E;if(R<=i){const A=R*t/2-o-s;return 2*Math.max(v,A)}return v*2}createRenderOptions(){let e=Ko,t=Qo,i=0,s=null,o=0,r,a=0;this.stroke_&&(r=gi(this.stroke_.getColor()??ga),a=this.stroke_.getWidth()??ya,s=this.stroke_.getLineDash(),o=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??Qo,e=this.stroke_.getLineCap()??Ko,i=this.stroke_.getMiterLimit()??pa);const l=this.calculateLineJoinSize_(t,a,i),c=Math.max(this.radius,this.radius2_||0),h=Math.ceil(2*c+l);return{strokeStyle:r,strokeWidth:a,size:h,lineCap:e,lineDash:s,lineDashOffset:o,lineJoin:t,miterLimit:i}}render(){this.renderOptions_=this.createRenderOptions();const e=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[e,e]}draw_(e,t,i){if(t.scale(i,i),t.translate(e.size/2,e.size/2),this.createPath_(t),this.fill_){let s=this.fill_.getColor();s===null&&(s=cn),t.fillStyle=gi(s),t.fill()}e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineCap=e.lineCap,t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}createHitDetectionCanvas_(e){let t;if(this.fill_){let i=this.fill_.getColor(),s=0;typeof i=="string"&&(i=ro(i)),i===null?s=1:Array.isArray(i)&&(s=i.length===4?i[3]:1),s===0&&(t=ht(e.size,e.size),this.drawHitDetectionCanvas_(e,t))}return t?t.canvas:this.getImage(1)}createPath_(e){let t=this.points_;const i=this.radius;if(t===1/0)e.arc(0,0,i,0,2*Math.PI);else{const s=this.radius2_===void 0?i:this.radius2_;this.radius2_!==void 0&&(t*=2);const o=this.angle_-Math.PI/2,r=2*Math.PI/t;for(let a=0;a<t;a++){const l=o+a*r,c=a%2===0?i:s;e.lineTo(c*Math.cos(l),c*Math.sin(l))}e.closePath()}}drawHitDetectionCanvas_(e,t){t.translate(e.size/2,e.size/2),this.createPath_(t),t.fillStyle=cn,t.fill(),e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}}class An extends xa{constructor(e){e=e||{radius:5},super({points:1/0,fill:e.fill,radius:e.radius,stroke:e.stroke,scale:e.scale!==void 0?e.scale:1,rotation:e.rotation!==void 0?e.rotation:0,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode})}clone(){const e=this.getScale(),t=new An({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}}class Xe{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=x0,e.geometry!==void 0&&this.setGeometry(e.geometry),this.fill_=e.fill!==void 0?e.fill:null,this.image_=e.image!==void 0?e.image:null,this.renderer_=e.renderer!==void 0?e.renderer:null,this.hitDetectionRenderer_=e.hitDetectionRenderer!==void 0?e.hitDetectionRenderer:null,this.stroke_=e.stroke!==void 0?e.stroke:null,this.text_=e.text!==void 0?e.text:null,this.zIndex_=e.zIndex}clone(){let e=this.getGeometry();return e&&typeof e=="object"&&(e=e.clone()),new Xe({geometry:e??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(e){this.renderer_=e}setHitDetectionRenderer(e){this.hitDetectionRenderer_=e}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(e){this.fill_=e}getImage(){return this.image_}setImage(e){this.image_=e}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e}getText(){return this.text_}setText(e){this.text_=e}getZIndex(){return this.zIndex_}setGeometry(e){typeof e=="function"?this.geometryFunction_=e:typeof e=="string"?this.geometryFunction_=function(t){return t.get(e)}:e?e!==void 0&&(this.geometryFunction_=function(){return e}):this.geometryFunction_=x0,this.geometry_=e}setZIndex(e){this.zIndex_=e}}function FE(n){let e;if(typeof n=="function")e=n;else{let t;Array.isArray(n)?t=n:(Be(typeof n.getZIndex=="function","Expected an `Style` or an array of `Style`"),t=[n]),e=function(){return t}}return e}let Dd=null;function C0(n,e){if(!Dd){const t=new wt({color:"rgba(255,255,255,0.4)"}),i=new St({color:"#3399CC",width:1.25});Dd=[new Xe({image:new An({fill:t,stroke:i,radius:5}),fill:t,stroke:i})]}return Dd}function x0(n){return n.getGeometry()}const LE="#333";class nr{constructor(e){e=e||{},this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.keepUpright_=e.keepUpright,this.scale_=e.scale,this.scaleArray_=Bt(e.scale!==void 0?e.scale:1),this.text_=e.text,this.textAlign_=e.textAlign,this.justify_=e.justify,this.repeat_=e.repeat,this.textBaseline_=e.textBaseline,this.fill_=e.fill!==void 0?e.fill:new wt({color:LE}),this.maxAngle_=e.maxAngle!==void 0?e.maxAngle:Math.PI/4,this.placement_=e.placement!==void 0?e.placement:"point",this.overflow_=!!e.overflow,this.stroke_=e.stroke!==void 0?e.stroke:null,this.offsetX_=e.offsetX!==void 0?e.offsetX:0,this.offsetY_=e.offsetY!==void 0?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=e.padding===void 0?null:e.padding,this.declutterMode_=e.declutterMode}clone(){const e=this.getScale();return new nr({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(e)?e.slice():e,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof wt?this.getFill().clone():this.getFill(),stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(e){this.overflow_=e}setFont(e){this.font_=e}setMaxAngle(e){this.maxAngle_=e}setOffsetX(e){this.offsetX_=e}setOffsetY(e){this.offsetY_=e}setPlacement(e){this.placement_=e}setRepeat(e){this.repeat_=e}setRotateWithView(e){this.rotateWithView_=e}setKeepUpright(e){this.keepUpright_=e}setFill(e){this.fill_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=Bt(e!==void 0?e:1)}setStroke(e){this.stroke_=e}setText(e){this.text_=e}setTextAlign(e){this.textAlign_=e}setJustify(e){this.justify_=e}setTextBaseline(e){this.textBaseline_=e}setBackgroundFill(e){this.backgroundFill_=e}setBackgroundStroke(e){this.backgroundStroke_=e}setPadding(e){this.padding_=e}}const ot={ANIMATING:0,INTERACTING:1},fe={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},Ac=[fe.FILL],ws=[fe.STROKE],ho=[fe.BEGIN_PATH],P0=[fe.CLOSE_PATH];class Pa extends t0{constructor(e,t,i,s){super(),this.tolerance=e,this.maxExtent=t,this.pixelRatio=s,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(e){const t=this.pixelRatio;return t==1?e:e.map(function(i){return i*t})}appendFlatPointCoordinates(e,t){const i=this.getBufferedMaxExtent(),s=this.tmpCoordinate_,o=this.coordinates;let r=o.length;for(let a=0,l=e.length;a<l;a+=t)s[0]=e[a],s[1]=e[a+1],Zs(i,s)&&(o[r++]=s[0],o[r++]=s[1]);return r}appendFlatLineCoordinates(e,t,i,s,o,r){const a=this.coordinates;let l=a.length;const c=this.getBufferedMaxExtent();r&&(t+=s);let h=e[t],u=e[t+1];const d=this.tmpCoordinate_;let f=!0,g,_,v;for(g=t+s;g<i;g+=s)d[0]=e[g],d[1]=e[g+1],v=Mu(c,d),v!==_?(f&&(a[l++]=h,a[l++]=u,f=!1),a[l++]=d[0],a[l++]=d[1]):v===Dt.INTERSECTING?(a[l++]=d[0],a[l++]=d[1],f=!1):f=!0,h=d[0],u=d[1],_=v;return(o&&f||g===t+s)&&(a[l++]=h,a[l++]=u),l}drawCustomCoordinates_(e,t,i,s,o){for(let r=0,a=i.length;r<a;++r){const l=i[r],c=this.appendFlatLineCoordinates(e,t,l,s,!1,!1);o.push(c),t=l}return t}drawCustom(e,t,i,s,o){this.beginGeometry(e,t,o);const r=e.getType(),a=e.getStride(),l=this.coordinates.length;let c,h,u,d,f;switch(r){case"MultiPolygon":c=e.getOrientedFlatCoordinates(),d=[];const g=e.getEndss();f=0;for(let _=0,v=g.length;_<v;++_){const E=[];f=this.drawCustomCoordinates_(c,f,g[_],a,E),d.push(E)}this.instructions.push([fe.CUSTOM,l,d,e,i,sd,o]),this.hitDetectionInstructions.push([fe.CUSTOM,l,d,e,s||i,sd,o]);break;case"Polygon":case"MultiLineString":u=[],c=r=="Polygon"?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),f=this.drawCustomCoordinates_(c,0,e.getEnds(),a,u),this.instructions.push([fe.CUSTOM,l,u,e,i,aa,o]),this.hitDetectionInstructions.push([fe.CUSTOM,l,u,e,s||i,aa,o]);break;case"LineString":case"Circle":c=e.getFlatCoordinates(),h=this.appendFlatLineCoordinates(c,0,c.length,a,!1,!1),this.instructions.push([fe.CUSTOM,l,h,e,i,ms,o]),this.hitDetectionInstructions.push([fe.CUSTOM,l,h,e,s||i,ms,o]);break;case"MultiPoint":c=e.getFlatCoordinates(),h=this.appendFlatPointCoordinates(c,a),h>l&&(this.instructions.push([fe.CUSTOM,l,h,e,i,ms,o]),this.hitDetectionInstructions.push([fe.CUSTOM,l,h,e,s||i,ms,o]));break;case"Point":c=e.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),h=this.coordinates.length,this.instructions.push([fe.CUSTOM,l,h,e,i,void 0,o]),this.hitDetectionInstructions.push([fe.CUSTOM,l,h,e,s||i,void 0,o]);break}this.endGeometry(t)}beginGeometry(e,t,i){this.beginGeometryInstruction1_=[fe.BEGIN_GEOMETRY,t,0,e,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[fe.BEGIN_GEOMETRY,t,0,e,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const e=this.hitDetectionInstructions;e.reverse();let t;const i=e.length;let s,o,r=-1;for(t=0;t<i;++t)s=e[t],o=s[0],o==fe.END_GEOMETRY?r=t:o==fe.BEGIN_GEOMETRY&&(s[2]=t,xv(this.hitDetectionInstructions,r,t),r=-1)}fillStyleToState(e,t={}){if(e){const i=e.getColor();t.fillPatternScale=i&&typeof i=="object"&&"src"in i?this.pixelRatio:1,t.fillStyle=gi(i||cn)}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){const i=e.getColor();t.strokeStyle=gi(i||ga);const s=e.getLineCap();t.lineCap=s!==void 0?s:Ko;const o=e.getLineDash();t.lineDash=o?o.slice():ji;const r=e.getLineDashOffset();t.lineDashOffset=r||Ui;const a=e.getLineJoin();t.lineJoin=a!==void 0?a:Qo;const l=e.getWidth();t.lineWidth=l!==void 0?l:ya;const c=e.getMiterLimit();t.miterLimit=c!==void 0?c:pa;const h=e.getOffset();t.strokeOffset=h??oE,t.lineWidth>this.maxLineWidth&&(this.maxLineWidth=t.lineWidth,this.bufferedMaxExtent_=null)}else t.strokeStyle=void 0,t.lineCap=void 0,t.lineDash=null,t.lineDashOffset=void 0,t.lineJoin=void 0,t.lineWidth=void 0,t.miterLimit=void 0,t.strokeOffset=void 0;return t}setFillStrokeStyle(e,t){const i=this.state;this.fillStyleToState(e,i),this.strokeStyleToState(t,i)}createFill(e){const t=e.fillStyle,i=[fe.SET_FILL_STYLE,t];return typeof t!="string"&&i.push(e.fillPatternScale),i}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[fe.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,e.lineDash?this.applyPixelRatio(e.lineDash):null,e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){const i=e.fillStyle;(typeof i!="string"||e.currentFillStyle!=i)&&(this.instructions.push(t.call(this,e)),e.currentFillStyle=i)}updateStrokeStyle(e,t){const i=e.strokeStyle,s=e.lineCap,o=e.lineDash,r=e.lineDashOffset,a=e.lineJoin,l=e.lineWidth,c=e.miterLimit,h=e.strokeOffset;(e.currentStrokeStyle!=i||e.currentLineCap!=s||o!=e.currentLineDash&&!us(e.currentLineDash,o)||e.currentLineDashOffset!=r||e.currentLineJoin!=a||e.currentLineWidth!=l||e.currentMiterLimit!=c||e.currentStrokeOffset!=h)&&(t.call(this,e),e.currentStrokeStyle=i,e.currentLineCap=s,e.currentLineDash=o,e.currentLineDashOffset=r,e.currentLineJoin=a,e.currentLineWidth=l,e.currentMiterLimit=c,e.currentStrokeOffset=h)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const t=[fe.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Hg(this.maxExtent),this.maxLineWidth>0)){const e=this.resolution*(this.maxLineWidth+1)/2;hi(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class zE extends Pa{constructor(e,t,i,s){super(e,t,i,s),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(e,t,i){if(!this.image_||this.maxExtent&&!Zs(this.maxExtent,e.getFlatCoordinates()))return;this.beginGeometry(e,t,i);const s=e.getFlatCoordinates(),o=e.getStride(),r=this.coordinates.length,a=this.appendFlatPointCoordinates(s,o);this.instructions.push([fe.DRAW_IMAGE,r,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([fe.DRAW_IMAGE,r,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(t)}drawMultiPoint(e,t,i){if(!this.image_)return;this.beginGeometry(e,t,i);const s=e.getFlatCoordinates(),o=[];for(let l=0,c=s.length;l<c;l+=e.getStride())(!this.maxExtent||Zs(this.maxExtent,s.slice(l,l+2)))&&o.push(s[l],s[l+1]);const r=this.coordinates.length,a=this.appendFlatPointCoordinates(o,2);this.instructions.push([fe.DRAW_IMAGE,r,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([fe.DRAW_IMAGE,r,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(t)}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(e,t){const i=e.getAnchor(),s=e.getSize(),o=e.getOrigin();this.imagePixelRatio_=e.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=e.getHitDetectionImage(),this.image_=e.getImage(this.pixelRatio),this.height_=s[1],this.opacity_=e.getOpacity(),this.originX_=o[0],this.originY_=o[1],this.rotateWithView_=e.getRotateWithView(),this.rotation_=e.getRotation(),this.scale_=e.getScaleArray(),this.width_=s[0],this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}}class NE extends Pa{constructor(e,t,i,s){super(e,t,i,s)}drawFlatCoordinates_(e,t,i,s,o){const r=this.coordinates.length,a=this.appendFlatLineCoordinates(e,t,i,s,!1,!1);return this.instructions.push([fe.MOVE_TO_LINE_TO,r,a,o*this.pixelRatio]),this.hitDetectionInstructions.push([fe.MOVE_TO_LINE_TO,r,a,o]),i}drawLineString(e,t,i){const s=this.state,o=s.strokeStyle,r=s.lineWidth,a=s.strokeOffset;if(o===void 0||r===void 0)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(e,t,i),this.hitDetectionInstructions.push([fe.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,ji,Ui],ho);const l=e.getFlatCoordinates(),c=e.getStride();this.drawFlatCoordinates_(l,0,l.length,c,a),this.hitDetectionInstructions.push(ws),this.endGeometry(t)}drawMultiLineString(e,t,i){const s=this.state,o=s.strokeStyle,r=s.lineWidth,a=s.strokeOffset;if(o===void 0||r===void 0)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(e,t,i),this.hitDetectionInstructions.push([fe.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,ji,Ui],ho);const l=e.getEnds(),c=e.getFlatCoordinates(),h=e.getStride();let u=0;for(let d=0,f=l.length;d<f;++d)u=this.drawFlatCoordinates_(c,u,l[d],h,a);this.hitDetectionInstructions.push(ws),this.endGeometry(t)}finish(){const e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(ws),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(ws),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(ho)}}class S0 extends Pa{constructor(e,t,i,s){super(e,t,i,s)}drawFlatCoordinatess_(e,t,i,s,o){const r=this.state,a=r.fillStyle!==void 0,l=r.strokeStyle!==void 0,c=i.length;this.instructions.push(ho),this.hitDetectionInstructions.push(ho);for(let h=0;h<c;++h){const u=i[h],d=this.coordinates.length,f=this.appendFlatLineCoordinates(e,t,u,s,!0,!l);this.instructions.push([fe.MOVE_TO_LINE_TO,d,f,o*this.pixelRatio,!0]),this.hitDetectionInstructions.push([fe.MOVE_TO_LINE_TO,d,f,o,!0]),l&&(this.instructions.push(P0),this.hitDetectionInstructions.push(P0)),t=u}return a&&(this.instructions.push(Ac),this.hitDetectionInstructions.push(Ac)),l&&(this.instructions.push(ws),this.hitDetectionInstructions.push(ws)),t}drawCircle(e,t,i){const s=this.state,o=s.fillStyle,r=s.strokeStyle,a=s.strokeOffset;if(o===void 0&&r===void 0||this.handleStrokeOffset_(()=>this.drawCircle(e,t,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,i),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([fe.SET_FILL_STYLE,cn]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([fe.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,ji,Ui]);const l=e.getFlatCoordinates(),c=e.getStride(),h=this.coordinates.length;this.appendFlatLineCoordinates(l,0,l.length,c,!1,!1);const u=[fe.CIRCLE,h,a];this.instructions.push(ho,u),this.hitDetectionInstructions.push(ho,u),s.fillStyle!==void 0&&(this.instructions.push(Ac),this.hitDetectionInstructions.push(Ac)),s.strokeStyle!==void 0&&(this.instructions.push(ws),this.hitDetectionInstructions.push(ws)),this.endGeometry(t)}drawPolygon(e,t,i){const s=this.state,o=s.fillStyle,r=s.strokeStyle,a=s.strokeOffset;if(o===void 0&&r===void 0||this.handleStrokeOffset_(()=>this.drawPolygon(e,t,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,i),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([fe.SET_FILL_STYLE,cn]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([fe.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,ji,Ui]);const l=e.getEnds(),c=e.getOrientedFlatCoordinates(),h=e.getStride();this.drawFlatCoordinatess_(c,0,l,h,a),this.endGeometry(t)}drawMultiPolygon(e,t,i){const s=this.state,o=s.fillStyle,r=s.strokeStyle,a=s.strokeOffset;if(o===void 0&&r===void 0||this.handleStrokeOffset_(()=>this.drawMultiPolygon(e,t,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,i),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([fe.SET_FILL_STYLE,cn]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([fe.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,ji,Ui]);const l=e.getEndss(),c=e.getOrientedFlatCoordinates(),h=e.getStride();let u=0;for(let d=0,f=l.length;d<f;++d)u=this.drawFlatCoordinatess_(c,u,l[d],h,a);this.endGeometry(t)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const e=this.tolerance;if(e!==0){const t=this.coordinates;for(let i=0,s=t.length;i<s;++i)t[i]=io(t[i],e)}return super.finish()}setFillStrokeStyles_(){const e=this.state;this.updateFillStyle(e,this.createFill),this.updateStrokeStyle(e,this.applyStroke)}handleStrokeOffset_(e){const t=this.state,i=t.fillStyle,s=t.strokeStyle,o=t.strokeOffset;return Math.abs(o)>0&&i!==void 0&&s!==void 0?(t.strokeStyle=void 0,t.strokeOffset=0,e(),t.fillStyle=void 0,t.strokeStyle=s,t.strokeOffset=o,e(),t.fillStyle=i,!0):!1}}function kE(n,e,t,i,s){const o=[];let r=t,a=0,l=e.slice(t,2);for(;a<n&&r+s<i;){const[c,h]=l.slice(-2),u=e[r+s],d=e[r+s+1],f=Math.sqrt((u-c)*(u-c)+(d-h)*(d-h));if(a+=f,a>=n){const g=(n-a+f)/f,_=mn(c,u,g),v=mn(h,d,g);l.push(_,v),o.push(l),l=[_,v],a==n&&(r+=s),a=0}else if(a<n)l.push(e[r+s],e[r+s+1]),r+=s;else{const g=f-a,_=mn(c,u,g/f),v=mn(h,d,g/f);l.push(_,v),o.push(l),l=[_,v],a=0,r+=s}}return a>0&&o.push(l),o}function jE(n,e,t,i,s){let o=t,r=t,a=0,l=0,c=t,h,u,d,f,g,_,v,E,w,C;for(u=t;u<i;u+=s){const P=e[u],R=e[u+1];g!==void 0&&(w=P-g,C=R-_,f=Math.sqrt(w*w+C*C),v!==void 0&&(l+=d,h=Math.acos((v*w+E*C)/(d*f)),h>n&&(l>a&&(a=l,o=c,r=u),l=0,c=u-s)),d=f,v=w,E=C),g=P,_=R}return l+=f,l>a?[c,u]:[o,r]}const Mc={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class UE extends Pa{constructor(e,t,i,s){super(e,t,i,s),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[cn]={fillStyle:cn},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 e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t,i){const s=this.textFillState_,o=this.textStrokeState_,r=this.textState_;if(this.text_===""||!r||!s&&!o)return;const a=this.coordinates;let l=a.length;const c=e.getType();let h=null,u=e.getStride();if(r.placement==="line"&&(c=="LineString"||c=="MultiLineString"||c=="Polygon"||c=="MultiPolygon")){if(!pt(this.maxExtent,e.getExtent()))return;let d;if(h=e.getFlatCoordinates(),c=="LineString")d=[h.length];else if(c=="MultiLineString")d=e.getEnds();else if(c=="Polygon")d=e.getEnds().slice(0,1);else if(c=="MultiPolygon"){const v=e.getEndss();d=[];for(let E=0,w=v.length;E<w;++E)d.push(v[E][0])}this.beginGeometry(e,t,i);const f=r.repeat,g=f?void 0:r.textAlign;let _=0;for(let v=0,E=d.length;v<E;++v){let w;f?w=kE(f*this.resolution,h,_,d[v],u):w=[h.slice(_,d[v])];for(let C=0,P=w.length;C<P;++C){const R=w[C];let A=0,O=R.length;if(g==null){const z=jE(r.maxAngle,R,0,R.length,2);A=z[0],O=z[1]}for(let z=A;z<O;z+=u)a.push(R[z],R[z+1]);const M=a.length;_=d[v],this.drawChars_(l,M),l=M}}this.endGeometry(t)}else{let d=r.overflow?null:[];switch(c){case"Point":case"MultiPoint":h=e.getFlatCoordinates();break;case"LineString":h=e.getFlatMidpoint();break;case"Circle":h=e.getCenter();break;case"MultiLineString":h=e.getFlatMidpoints(),u=2;break;case"Polygon":h=e.getFlatInteriorPoint(),r.overflow||d.push(h[2]/this.resolution),u=3;break;case"MultiPolygon":const P=e.getFlatInteriorPoints();h=[];for(let R=0,A=P.length;R<A;R+=3)r.overflow||d.push(P[R+2]/this.resolution),h.push(P[R],P[R+1]);if(h.length===0)return;u=2;break}const f=this.appendFlatPointCoordinates(h,u);if(f===l)return;if(d&&(f-l)/2!==h.length/u){let P=l/2;d=d.filter((R,A)=>{const O=a[(P+A)*2]===h[A*u]&&a[(P+A)*2+1]===h[A*u+1];return O||--P,O})}this.saveTextStates_();const g=r.backgroundFill?this.createFill(this.fillStyleToState(r.backgroundFill)):null,_=r.backgroundStroke?this.createStroke(this.strokeStyleToState(r.backgroundStroke)):null;this.beginGeometry(e,t,i);let v=r.padding;if(v!=ao&&(r.scale[0]<0||r.scale[1]<0)){let P=r.padding[0],R=r.padding[1],A=r.padding[2],O=r.padding[3];r.scale[0]<0&&(R=-R,O=-O),r.scale[1]<0&&(P=-P,A=-A),v=[P,R,A,O]}const E=this.pixelRatio;this.instructions.push([fe.DRAW_IMAGE,l,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,v==ao?ao:v.map(function(P){return P*E}),g,_,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]);const w=1/E,C=g?g.slice(0):null;C&&(C[1]=cn),this.hitDetectionInstructions.push([fe.DRAW_IMAGE,l,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[w,w],NaN,this.declutterMode_,this.declutterImageWithText_,v,C,_,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?cn:this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]),this.endGeometry(t)}}saveTextStates_(){const e=this.textStrokeState_,t=this.textState_,i=this.textFillState_,s=this.strokeKey_;e&&(s in this.strokeStates||(this.strokeStates[s]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));const o=this.textKey_;o in this.textStates||(this.textStates[o]={font:t.font,textAlign:t.textAlign||ma,justify:t.justify,textBaseline:t.textBaseline||xc,scale:t.scale});const r=this.fillKey_;i&&(r in this.fillStates||(this.fillStates[r]={fillStyle:i.fillStyle}))}drawChars_(e,t){const i=this.textStrokeState_,s=this.textState_,o=this.strokeKey_,r=this.textKey_,a=this.fillKey_;this.saveTextStates_();const l=this.pixelRatio,c=Mc[s.textBaseline],h=this.textOffsetY_*l,u=this.text_,d=i?i.lineWidth*Math.abs(s.scale[0])/2:0;this.instructions.push([fe.DRAW_CHARS,e,t,c,s.overflow,a,s.maxAngle,l,h,o,d*l,u,r,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([fe.DRAW_CHARS,e,t,c,s.overflow,a&&cn,s.maxAngle,l,h,o,d*l,u,r,1/l,this.declutterMode_,this.textKeepUpright_])}setTextStyle(e,t){let i,s,o;if(!e)this.text_="";else{const r=e.getFill();r?(s=this.textFillState_,s||(s={},this.textFillState_=s),s.fillStyle=gi(r.getColor()||cn)):(s=null,this.textFillState_=s);const a=e.getStroke();if(!a)o=null,this.textStrokeState_=o;else{o=this.textStrokeState_,o||(o={},this.textStrokeState_=o);const _=a.getLineDash(),v=a.getLineDashOffset(),E=a.getWidth(),w=a.getMiterLimit();o.lineCap=a.getLineCap()||Ko,o.lineDash=_?_.slice():ji,o.lineDashOffset=v===void 0?Ui:v,o.lineJoin=a.getLineJoin()||Qo,o.lineWidth=E===void 0?ya:E,o.miterLimit=w===void 0?pa:w,o.strokeStyle=gi(a.getColor()||ga)}i=this.textState_;const l=e.getFont()||s0;lE(l);const c=e.getScaleArray();i.overflow=e.getOverflow(),i.font=l,i.maxAngle=e.getMaxAngle(),i.placement=e.getPlacement(),i.textAlign=e.getTextAlign(),i.repeat=e.getRepeat(),i.justify=e.getJustify(),i.textBaseline=e.getTextBaseline()||xc,i.backgroundFill=e.getBackgroundFill(),i.backgroundStroke=e.getBackgroundStroke(),i.padding=e.getPadding()||ao,i.scale=c===void 0?[1,1]:c;const h=e.getOffsetX(),u=e.getOffsetY(),d=e.getRotateWithView(),f=e.getKeepUpright(),g=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=h===void 0?0:h,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_=o?(typeof o.strokeStyle=="string"?o.strokeStyle:Re(o.strokeStyle))+o.lineCap+o.lineDashOffset+"|"+o.lineWidth+o.lineJoin+o.miterLimit+"["+o.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=s&&s.fillStyle?typeof s.fillStyle=="string"?s.fillStyle:"|"+Re(s.fillStyle):""}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}}const GE={Circle:S0,Default:Pa,Image:zE,LineString:NE,Polygon:S0,Text:UE};class R0{constructor(e,t,i,s){this.tolerance_=e,this.maxExtent_=t,this.pixelRatio_=s,this.resolution_=i,this.buildersByZIndex_={}}finish(){const e={};for(const t in this.buildersByZIndex_){e[t]=e[t]||{};const i=this.buildersByZIndex_[t];for(const s in i){const o=i[s].finish();e[t][s]=o}}return e}getBuilder(e,t){const i=e!==void 0?e.toString():"0";let s=this.buildersByZIndex_[i];s===void 0&&(s={},this.buildersByZIndex_[i]=s);let o=s[t];if(o===void 0){const r=GE[t];o=new r(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),s[t]=o}return o}}function qE(n,e,t,i,s,o,r,a,l,c,h,u,d=!0){let f=n[e],g=n[e+1],_=0,v=0,E=0,w=0;function C(){_=f,v=g,e+=i,f=n[e],g=n[e+1],w+=E,E=Math.sqrt((f-_)*(f-_)+(g-v)*(g-v))}do C();while(e<t-i&&w+E<o);let P=E===0?0:(o-w)/E;const R=mn(_,f,P),A=mn(v,g,P),O=e-i,M=w,z=o+a*l(c,s,h);for(;e<t-i&&w+E<z;)C();P=E===0?0:(z-w)/E;const k=mn(_,f,P),q=mn(v,g,P);let Y=!1;if(d)if(u){const N=[R,A,k,q];Im(N,0,4,2,u,N,N),Y=N[0]>N[2]}else Y=R>k;const m=Math.PI,b=[],S=O+i===e;e=O,E=0,w=M,f=n[e],g=n[e+1];let L;if(S){C(),L=Math.atan2(g-v,f-_),Y&&(L+=L>0?-m:m);const N=(k+R)/2,j=(q+A)/2;return b[0]=[N,j,(z-o)/2,L,s],b}s=s.replace(/\n/g," ");for(let N=0,j=s.length;N<j;){C();let U=Math.atan2(g-v,f-_);if(Y&&(U+=U>0?-m:m),L!==void 0){let V=U-L;if(V+=V>m?-2*m:V<-m?2*m:0,Math.abs(V)>r)return null}L=U;const B=N;let Z=0;for(;N<j;++N){const V=Y?j-N-1:N,re=a*l(c,s[V],h);if(e+i<t&&w+E<o+Z+re/2)break;Z+=re}if(N===B)continue;const G=Y?s.substring(j-B,j-N):s.substring(B,N);P=E===0?0:(o+Z/2-w)/E;const ae=mn(_,f,P),ne=mn(v,g,P);b.push([ae,ne,Z/2,U,G]),o+=Z}return b}class Fd{constructor(){I(this,"pushMethodArgs_",(...e)=>(this.push_(e),this));this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(yc(),{get:(e,t)=>{if(typeof yc()[t]=="function")return this.push_(t),this.pushMethodArgs_},set:(e,t,i)=>(this.push_(t,i),!0)})}push_(...e){const t=this.instructions_,i=this.zIndex+this.offset_;t[i]||(t[i]=[]),t[i].push(...e)}pushFunction(e){this.push_(e)}getContext(){return this.context_}draw(e){this.instructions_.forEach(t=>{for(let i=0,s=t.length;i<s;++i){const o=t[i];if(typeof o=="function"){o(e);continue}const r=t[++i];if(typeof e[o]=="function")e[o](...r);else{if(typeof r=="function"){e[o]=r(e);continue}e[o]=r}}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}}const ir=gn(),vs=[],Gi=[],qi=[],bs=[];function T0(n){return n[3].declutterBox}const I0=new RegExp("[֑-ࣿיִ-﷿ﹰ-ﻼࠀ-࿿-]");function Ld(n,e){return e==="start"?e=I0.test(n)?"right":"left":e==="end"&&(e=I0.test(n)?"left":"right"),Mc[e]}function WE(n,e,t){return t>0&&n.push(`
24
+ `,""),n.push(e,""),n}function VE(n,e,t){return t%2===0&&(n+=e),n}class BE{constructor(e,t,i,s,o){this.overlaps=i,this.pixelRatio=t,this.resolution=e,this.alignAndScaleFill_,this.instructions=s.instructions,this.coordinates=s.coordinates,this.coordinateCache_={},this.renderedTransform_=Kt(),this.hitDetectionInstructions=s.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=s.fillStates||{},this.strokeStates=s.strokeStates||{},this.textStates=s.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=o?new Fd:null}getZIndexContext(){return this.zIndexContext_}createLabel(e,t,i,s){const o=e+t+i+s;if(this.labels_[o])return this.labels_[o];const r=s?this.strokeStates[s]:null,a=i?this.fillStates[i]:null,l=this.textStates[t],c=this.pixelRatio,h=[l.scale[0]*c,l.scale[1]*c],u=l.justify?Mc[l.justify]:Ld(Array.isArray(e)?e[0]:e,l.textAlign||ma),d=s&&r.lineWidth?r.lineWidth:0,f=Array.isArray(e)?e:String(e).split(`
25
+ `).reduce(WE,[]),{width:g,height:_,widths:v,heights:E,lineWidths:w}=hE(l,f),C=g+d,P=[],R=(C+2)*h[0],A=(_+d)*h[1],O={width:R<0?Math.floor(R):Math.ceil(R),height:A<0?Math.floor(A):Math.ceil(A),contextInstructions:P};(h[0]!=1||h[1]!=1)&&P.push("scale",h),s&&(P.push("strokeStyle",r.strokeStyle),P.push("lineWidth",d),P.push("lineCap",r.lineCap),P.push("lineJoin",r.lineJoin),P.push("miterLimit",r.miterLimit),P.push("setLineDash",[r.lineDash]),P.push("lineDashOffset",r.lineDashOffset)),i&&P.push("fillStyle",a.fillStyle),P.push("textBaseline","middle"),P.push("textAlign","center");const M=.5-u;let z=u*C+M*d;const k=[],q=[];let Y=0,m=0,b=0,S=0,L;for(let N=0,j=f.length;N<j;N+=2){const U=f[N];if(U===`
26
+ `){m+=Y,Y=0,z=u*C+M*d,++S;continue}const B=f[N+1]||l.font;B!==L&&(s&&k.push("font",B),i&&q.push("font",B),L=B),Y=Math.max(Y,E[b]);const Z=[U,z+M*v[b]+u*(v[b]-w[S]),.5*(d+Y)+m];z+=v[b],s&&k.push("strokeText",Z),i&&q.push("fillText",Z),++b}return Array.prototype.push.apply(P,k),Array.prototype.push.apply(P,q),this.labels_[o]=O,O}replayTextBackground_(e,t,i,s,o,r,a){e.beginPath(),e.moveTo.apply(e,t),e.lineTo.apply(e,i),e.lineTo.apply(e,s),e.lineTo.apply(e,o),e.lineTo.apply(e,t),r&&(this.alignAndScaleFill_=r[2],e.fillStyle=r[1],this.fill_(e)),a&&(this.setStrokeStyle_(e,a),e.stroke())}calculateImageOrLabelDimensions_(e,t,i,s,o,r,a,l,c,h,u,d,f,g,_,v){a*=d[0],l*=d[1];let E=i-a,w=s-l;const C=o+c>e?e-c:o,P=r+h>t?t-h:r,R=g[3]+C*d[0]+g[1],A=g[0]+P*d[1]+g[2],O=E-g[3],M=w-g[0];(_||u!==0)&&(vs[0]=O,bs[0]=O,vs[1]=M,Gi[1]=M,Gi[0]=O+R,qi[0]=Gi[0],qi[1]=M+A,bs[1]=qi[1]);let z;return u!==0?(z=Hn(Kt(),i,s,1,1,u,-i,-s),_t(z,vs),_t(z,Gi),_t(z,qi),_t(z,bs),Fi(Math.min(vs[0],Gi[0],qi[0],bs[0]),Math.min(vs[1],Gi[1],qi[1],bs[1]),Math.max(vs[0],Gi[0],qi[0],bs[0]),Math.max(vs[1],Gi[1],qi[1],bs[1]),ir)):Fi(Math.min(O,O+R),Math.min(M,M+A),Math.max(O,O+R),Math.max(M,M+A),ir),f&&(E=Math.round(E),w=Math.round(w)),{drawImageX:E,drawImageY:w,drawImageW:C,drawImageH:P,originX:c,originY:h,declutterBox:{minX:ir[0],minY:ir[1],maxX:ir[2],maxY:ir[3],value:v},canvasTransform:z,scale:d}}replayImageOrLabel_(e,t,i,s,o,r,a){const l=!!(r||a),c=s.declutterBox,h=a?a[2]*s.scale[0]/2:0;return c.minX-h<=t[0]&&c.maxX+h>=0&&c.minY-h<=t[1]&&c.maxY+h>=0&&(l&&this.replayTextBackground_(e,vs,Gi,qi,bs,r,a),uE(e,s.canvasTransform,o,i,s.originX,s.originY,s.drawImageW,s.drawImageH,s.drawImageX,s.drawImageY,s.scale)),!0}fill_(e){const t=this.alignAndScaleFill_;if(t){const i=_t(this.renderedTransform_,[0,0]),s=512*this.pixelRatio;e.save(),e.translate(i[0]%s,i[1]%s),t!==1&&e.scale(t,t)}e.fill(),t&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],t[1]&&(e.lineWidth=t[2],e.lineCap=t[3],e.lineJoin=t[4],e.miterLimit=t[5],e.lineDashOffset=t[7],e.setLineDash(t[6]))}drawLabelWithPointPlacement_(e,t,i,s){const o=this.textStates[t],r=this.createLabel(e,t,s,i),a=this.strokeStates[i],l=this.pixelRatio,c=Ld(Array.isArray(e)?e[0]:e,o.textAlign||ma),h=Mc[o.textBaseline||xc],u=a&&a.lineWidth?a.lineWidth:0,d=r.width/l-2*o.scale[0],f=c*d+2*(.5-c)*u,g=h*r.height/l+2*(.5-h)*u;return{label:r,anchorX:f,anchorY:g}}execute_(e,t,i,s,o,r,a,l){const c=this.zIndexContext_;let h;this.pixelCoordinates_&&us(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=pi(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),yb(this.renderedTransform_,i));let u=0;const d=s.length;let f=0,g,_,v,E,w,C,P,R,A,O,M,z,k,q,Y,m,b=0,S=0;const L=this.coordinateCache_,N=this.viewRotation_,j=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,U={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:N},B=this.instructions!=s||this.overlaps?0:200;let Z,G,ae,ne;for(;u<d;){const V=s[u];switch(V[0]){case fe.BEGIN_GEOMETRY:Z=V[1],ne=V[3],Z.getGeometry()?a!==void 0&&!pt(a,ne.getExtent())?u=V[2]+1:++u:u=V[2],c&&(c.zIndex=V[4]);break;case fe.BEGIN_PATH:b>B&&(this.fill_(e),b=0),S>B&&(e.stroke(),S=0),!b&&!S&&(e.beginPath(),R=NaN,A=NaN),++u;break;case fe.CIRCLE:f=V[1],E=V[2]??0;const se=h[f],he=h[f+1],ye=h[f+2]-E,pe=h[f+3]-E,Fe=ye-se,je=pe-he,ee=Math.sqrt(Fe*Fe+je*je);e.moveTo(se+ee,he),e.arc(se,he,ee,0,2*Math.PI,!0),++u;break;case fe.CLOSE_PATH:e.closePath(),++u;break;case fe.CUSTOM:f=V[1],g=V[2];const ft=V[3],rt=V[4],_e=V[5];U.geometry=ft,U.feature=Z,u in L||(L[u]=[]);const tn=L[u];_e?_e(h,f,g,2,tn):(tn[0]=h[f],tn[1]=h[f+1],tn.length=2),c&&(c.zIndex=V[6]),rt(tn,U),++u;break;case fe.DRAW_IMAGE:f=V[1],g=V[2],z=V[3],_=V[4],v=V[5];let Ut=V[6];const yt=V[7],At=V[8],et=V[9],jn=V[10];let nt=V[11];const Un=V[12];let Gn=V[13];P=V[14]||"declutter";const ai=V[15];if(!z&&V.length>=20){k=V[19],q=V[20],Y=V[21],m=V[22];const pn=this.drawLabelWithPointPlacement_(k,q,Y,m);z=pn.label,V[3]=z;const as=V[23];_=(pn.anchorX-as)*this.pixelRatio,V[4]=_;const Wn=V[24];v=(pn.anchorY-Wn)*this.pixelRatio,V[5]=v,Ut=z.height,V[6]=Ut,Gn=z.width,V[13]=Gn}let Ve;V.length>25&&(Ve=V[25]);let Ge,Le,de;V.length>17?(Ge=V[16],Le=V[17],de=V[18]):(Ge=ao,Le=null,de=null),jn&&j?nt+=N:!jn&&!j&&(nt-=N);let Qe=0;for(;f<g;f+=2){if(Ve&&Ve[Qe++]<Gn/this.pixelRatio)continue;const pn=this.calculateImageOrLabelDimensions_(z.width,z.height,h[f],h[f+1],Gn,Ut,_,v,At,et,nt,Un,o,Ge,!!Le||!!de,Z),as=[e,t,z,pn,yt,Le,de];if(l){let Wn,Ai,Vn;if(ai){const Ct=g-f;if(!ai[Ct]){ai[Ct]={args:as,declutterMode:P};continue}const sn=ai[Ct];Wn=sn.args,Ai=sn.declutterMode,delete ai[Ct],Vn=T0(Wn)}let ls,cs;if(Wn&&(Ai!=="declutter"||!l.collides(Vn))&&(ls=!0),(P!=="declutter"||!l.collides(pn.declutterBox))&&(cs=!0),Ai==="declutter"&&P==="declutter"){const Ct=ls&&cs;ls=Ct,cs=Ct}ls&&(Ai!=="none"&&l.insert(Vn),this.replayImageOrLabel_.apply(this,Wn)),cs&&(P!=="none"&&l.insert(pn.declutterBox),this.replayImageOrLabel_.apply(this,as))}else this.replayImageOrLabel_.apply(this,as)}++u;break;case fe.DRAW_CHARS:const Pe=V[1],Se=V[2],He=V[3],Et=V[4];m=V[5];const nn=V[6],Gt=V[7],at=V[8];Y=V[9];const Mt=V[10];k=V[11],Array.isArray(k)&&(k=k.reduce(VE,"")),q=V[12];const it=[V[13],V[13]];P=V[14]||"declutter";const qt=V[15],Lt=this.textStates[q],Pt=Lt.font,tt=[Lt.scale[0]*Gt,Lt.scale[1]*Gt];let It;Pt in this.widths_?It=this.widths_[Pt]:(It={},this.widths_[Pt]=It);const Oi=fd(h,Pe,Se,2),qn=Math.abs(tt[0])*l0(Pt,k,It);if(Et||qn<=Oi){const pn=this.textStates[q].textAlign,as=(Oi-qn)*Ld(k,pn),Wn=qE(h,Pe,Se,2,k,as,nn,Math.abs(tt[0]),l0,Pt,It,j?0:this.viewRotation_,qt);e:if(Wn){const Ai=[];let Vn,ls,cs,Ct,sn;if(Y)for(Vn=0,ls=Wn.length;Vn<ls;++Vn){sn=Wn[Vn],cs=sn[4],Ct=this.createLabel(cs,q,"",Y),_=sn[2]+(tt[0]<0?-Mt:Mt),v=He*Ct.height+(.5-He)*2*Mt*tt[1]/tt[0]-at;const hs=this.calculateImageOrLabelDimensions_(Ct.width,Ct.height,sn[0],sn[1],Ct.width,Ct.height,_,v,0,0,sn[3],it,!1,ao,!1,Z);if(l&&P==="declutter"&&l.collides(hs.declutterBox))break e;Ai.push([e,t,Ct,hs,1,null,null])}if(m)for(Vn=0,ls=Wn.length;Vn<ls;++Vn){sn=Wn[Vn],cs=sn[4],Ct=this.createLabel(cs,q,m,""),_=sn[2],v=He*Ct.height-at;const hs=this.calculateImageOrLabelDimensions_(Ct.width,Ct.height,sn[0],sn[1],Ct.width,Ct.height,_,v,0,0,sn[3],it,!1,ao,!1,Z);if(l&&P==="declutter"&&l.collides(hs.declutterBox))break e;Ai.push([e,t,Ct,hs,1,null,null])}l&&P!=="none"&&l.load(Ai.map(T0));for(let hs=0,$A=Ai.length;hs<$A;++hs)this.replayImageOrLabel_.apply(this,Ai[hs])}}++u;break;case fe.END_GEOMETRY:if(r!==void 0){Z=V[1];const pn=r(Z,ne,P);if(pn)return pn}++u;break;case fe.FILL:B?b++:this.fill_(e),++u;break;case fe.MOVE_TO_LINE_TO:for(f=V[1],g=V[2],E=V[3],w=V[4]??!1,G=h[f],ae=h[f+1],E&&(C=f,[G,ae]=bc(G,ae,w?h[g-4]:void 0,w?h[g-3]:void 0,h[f+2],h[f+3],E)),e.moveTo(G,ae),R=G+.5|0,A=ae+.5|0,f+=2;f<g;f+=2)G=h[f],ae=h[f+1],O=G+.5|0,M=ae+.5|0,(f==g-2||O!==R||M!==A)&&(E&&(f==g-2?[G,ae]=bc(G,ae,h[f-2],h[f-1],w?h[C+2]:void 0,w?h[C+3]:void 0,E):[G,ae]=bc(G,ae,h[f-2],h[f-1],h[f+2],h[f+3],E)),e.lineTo(G,ae),R=O,A=M);++u;break;case fe.SET_FILL_STYLE:this.alignAndScaleFill_=V[2],b&&(this.fill_(e),b=0,S&&(e.stroke(),S=0)),e.fillStyle=V[1],++u;break;case fe.SET_STROKE_STYLE:S&&(e.stroke(),S=0),this.setStrokeStyle_(e,V),++u;break;case fe.STROKE:B?S++:e.stroke(),++u;break;default:++u;break}}b&&this.fill_(e),S&&e.stroke()}execute(e,t,i,s,o,r){this.viewRotation_=s,this.execute_(e,t,i,this.instructions,o,void 0,void 0,r)}executeHitDetection(e,t,i,s,o){return this.viewRotation_=i,this.execute_(e,[e.canvas.width,e.canvas.height],t,this.hitDetectionInstructions,!0,s,o)}}const uo=["Polygon","Circle","LineString","Image","Text","Default"],Dc=["Image","Text"],$E=uo.filter(n=>!Dc.includes(n));let O0=!1,A0=!1;function HE(){let n=0;const e=i=>{const s=ht(1,1,null,{willReadFrequently:i});let o=0;const r=performance.now();for(;performance.now()-r<50;++o)s.fillStyle=`rgba(255,0,${o%256},1)`,s.fillRect(0,0,1,1),s.getImageData(0,0,1,1);return n=o>n?o:n,o};O0={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0}[n],A0=!0}class M0{constructor(e,t,i,s,o,r,a){this.maxExtent_=e,this.overlaps_=s,this.pixelRatio_=i,this.resolution_=t,this.renderBuffer_=r,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=Kt(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(o,a)}clip(e,t){const i=this.getClipCoords(t);e.beginPath(),e.moveTo(i[0],i[1]),e.lineTo(i[2],i[3]),e.lineTo(i[4],i[5]),e.lineTo(i[6],i[7]),e.clip()}createExecutors_(e,t){for(const i in e){let s=this.executorsByZIndex_[i];s===void 0&&(s={},this.executorsByZIndex_[i]=s);const o=e[i];for(const r in o){const a=o[r];s[r]=new BE(this.resolution_,this.pixelRatio_,this.overlaps_,a,t)}}}hasExecutors(e){for(const t in this.executorsByZIndex_){const i=this.executorsByZIndex_[t];for(let s=0,o=e.length;s<o;++s)if(e[s]in i)return!0}return!1}forEachFeatureAtCoordinate(e,t,i,s,o,r){A0===!1&&HE(),s=Math.round(s);const a=s*2+1,l=Hn(this.hitDetectionTransform_,s+.5,s+.5,1/t,-1/t,-i,-e[0],-e[1]),c=!this.hitDetectionContext_;c&&(this.hitDetectionContext_=ht(a,a,null,{willReadFrequently:O0}));const h=this.hitDetectionContext_;h.canvas.width!==a||h.canvas.height!==a?(h.canvas.width=a,h.canvas.height=a):c||h.clearRect(0,0,a,a);let u;this.renderBuffer_!==void 0&&(u=gn(),Xr(u,e),hi(u,t*(this.renderBuffer_+s),u));const d=XE(s);let f;function g(R,A,O){const M=h.getImageData(0,0,a,a).data;for(let z=0,k=d.length;z<k;z++)if(M[d[z]]>0){if(!r||O==="none"||f!=="Image"&&f!=="Text"||r.includes(R)){const q=(d[z]-3)/4,Y=s-q%a,m=s-(q/a|0),b=o(R,A,Y*Y+m*m);if(b)return b}h.clearRect(0,0,a,a);break}}const _=Object.keys(this.executorsByZIndex_).map(Number);_.sort(li);let v,E,w,C,P;for(v=_.length-1;v>=0;--v){const R=_[v].toString();for(w=this.executorsByZIndex_[R],E=uo.length-1;E>=0;--E)if(f=uo[E],C=w[f],C!==void 0&&(P=C.executeHitDetection(h,l,i,g,u),P))return P}}getClipCoords(e){const t=this.maxExtent_;if(!t)return null;const i=t[0],s=t[1],o=t[2],r=t[3],a=[i,s,i,r,o,r,o,s];return pi(a,0,8,2,e,a),a}isEmpty(){return gs(this.executorsByZIndex_)}execute(e,t,i,s,o,r,a){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?Cv:li),r=r||uo;const c=uo.length;for(let h=0,u=l.length;h<u;++h){const d=l[h].toString(),f=this.executorsByZIndex_[d];for(let g=0,_=r.length;g<_;++g){const v=r[g],E=f[v];if(E!==void 0){const w=a===null?void 0:E.getZIndexContext(),C=w?w.getContext():e,P=this.maxExtent_&&v!=="Image"&&v!=="Text";if(P&&(C.save(),this.clip(C,i)),!w||v==="Text"||v==="Image"?E.execute(C,t,i,s,o,a):w.pushFunction(R=>E.execute(R,t,i,s,o,a)),P&&C.restore(),w){w.offset();const R=l[h]*c+uo.indexOf(v);this.deferredZIndexContexts_[R]||(this.deferredZIndexContexts_[R]=[]),this.deferredZIndexContexts_[R].push(w)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(li);for(let i=0,s=t.length;i<s;++i)e[t[i]].forEach(o=>{o.draw(this.renderedContext_),o.clear()}),e[t[i]].length=0}}const zd={};function XE(n){if(zd[n]!==void 0)return zd[n];const e=n*2+1,t=n*n,i=new Array(t+1);for(let o=0;o<=n;++o)for(let r=0;r<=n;++r){const a=o*o+r*r;if(a>t)break;let l=i[a];l||(l=[],i[a]=l),l.push(((n+o)*e+(n+r))*4+3),o>0&&l.push(((n-o)*e+(n+r))*4+3),r>0&&(l.push(((n+o)*e+(n-r))*4+3),o>0&&l.push(((n-o)*e+(n-r))*4+3))}const s=[];for(let o=0,r=i.length;o<r;++o)i[o]&&s.push(...i[o]);return zd[n]=s,s}function D0(n,e,t,i){return t!==void 0&&i!==void 0?[t/n,i/e]:t!==void 0?t/n:i!==void 0?i/e:1}class Es extends Oc{constructor(e){e=e||{};const t=e.opacity!==void 0?e.opacity:1,i=e.rotation!==void 0?e.rotation:0,s=e.scale!==void 0?e.scale:1,o=e.rotateWithView!==void 0?e.rotateWithView:!1;super({opacity:t,rotation:i,scale:s,displacement:e.displacement!==void 0?e.displacement:[0,0],rotateWithView:o,declutterMode:e.declutterMode}),this.anchor_=e.anchor!==void 0?e.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=e.anchorOrigin!==void 0?e.anchorOrigin:"top-left",this.anchorXUnits_=e.anchorXUnits!==void 0?e.anchorXUnits:"fraction",this.anchorYUnits_=e.anchorYUnits!==void 0?e.anchorYUnits:"fraction",this.crossOrigin_=e.crossOrigin!==void 0?e.crossOrigin:null,this.referrerPolicy_=e.referrerPolicy;const r=e.img!==void 0?e.img:null;let a=e.src;Be(!(a!==void 0&&r),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&r&&(a=r.src||Re(r)),Be(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),Be(!((e.width!==void 0||e.height!==void 0)&&e.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(e.src!==void 0?l=le.IDLE:r!==void 0&&("complete"in r?r.complete?l=r.src?le.LOADED:le.IDLE:l=le.LOADING:l=le.LOADED),this.color_=e.color!==void 0?ro(e.color):null,this.iconImage_=fa(r,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},l,this.color_),this.offset_=e.offset!==void 0?e.offset:[0,0],this.offsetOrigin_=e.offsetOrigin!==void 0?e.offsetOrigin:"top-left",this.origin_=null,this.size_=e.size!==void 0?e.size:null,this.initialOptions_,e.width!==void 0||e.height!==void 0){let c,h;if(e.size)[c,h]=e.size;else{const u=this.getImage(1);if(u.width&&u.height)c=u.width,h=u.height;else if(u instanceof HTMLImageElement){this.initialOptions_=e;const d=()=>{if(this.unlistenImageChange(d),!this.initialOptions_)return;const f=this.iconImage_.getSize();this.setScale(D0(f[0],f[1],e.width,e.height))};this.listenImageChange(d);return}}c!==void 0&&this.setScale(D0(c,h,e.width,e.height))}}clone(){let e,t,i;return this.initialOptions_?(t=this.initialOptions_.width,i=this.initialOptions_.height):(e=this.getScale(),e=Array.isArray(e)?e.slice():e),new Es({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_,referrerPolicy:this.referrerPolicy_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:e,width:t,height:i,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let e=this.normalizedAnchor_;if(!e){e=this.anchor_;const s=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!s)return null;e=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(e[0]*=s[0]),this.anchorYUnits_=="fraction"&&(e[1]*=s[1])}if(this.anchorOrigin_!="top-left"){if(!s)return null;e===this.anchor_&&(e=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(e[0]=-e[0]+s[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(e[1]=-e[1]+s[1])}this.normalizedAnchor_=e}const t=this.getDisplacement(),i=this.getScaleArray();return[e[0]-t[0]/i[0],e[1]+t[1]/i[1]]}setAnchor(e){this.anchor_=e,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(e){const t=e?ro(e):null;if(this.color_===t||this.color_&&t&&this.color_.length===t.length&&this.color_.every((r,a)=>r===t[a]))return;this.color_=t;const i=this.getSrc(),s=i!==void 0?null:this.getHitDetectionImage(),o=i!==void 0?le.IDLE:this.iconImage_.getImageState();this.iconImage_=fa(s,i,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},o,this.color_)}getImage(e){return this.iconImage_.getImage(e)}getPixelRatio(e){return this.iconImage_.getPixelRatio(e)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let e=this.offset_;if(this.offsetOrigin_!="top-left"){const t=this.getSize(),i=this.iconImage_.getSize();if(!t||!i)return null;e=e.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(e[0]=i[0]-t[0]-e[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(e[1]=i[1]-t[1]-e[1])}return this.origin_=e,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(e){this.iconImage_=fa(null,e,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},le.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const e=this.getScaleArray();if(this.size_)return this.size_[0]*e[0];if(this.iconImage_.getImageState()==le.LOADED)return this.iconImage_.getSize()[0]*e[0]}getHeight(){const e=this.getScaleArray();if(this.size_)return this.size_[1]*e[1];if(this.iconImage_.getImageState()==le.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(we.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(we.CHANGE,e)}ready(){return this.iconImage_.ready()}}const wn=.5;function F0(n,e,t,i,s,o,r,a,l){const c=l?Zu(s):s,h=n[0]*wn,u=n[1]*wn,d=ht(h,u);d.imageSmoothingEnabled=!1;const f=d.canvas,g=new c0(d,wn,s,null,r,a,l?sa(gb(),l):null),_=t.length,v=Math.floor((256*256*256-1)/_),E={};for(let C=1;C<=_;++C){const P=t[C-1],R=P.getStyleFunction()||i;if(!R)continue;let A=R(P,o);if(!A)continue;Array.isArray(A)||(A=[A]);const M=(C*v).toString(16).padStart(7,"#00000");for(let z=0,k=A.length;z<k;++z){const q=A[z],Y=q.getGeometryFunction()(P);if(!Y||!pt(c,Y.getExtent()))continue;const m=q.clone(),b=m.getFill();b&&b.setColor(M);const S=m.getStroke();S&&(S.setColor(M),S.setLineDash(null)),m.setText(void 0);const L=q.getImage();if(L){const B=L.getImageSize();if(!B)continue;const Z=ht(B[0],B[1],void 0,{alpha:!1}),G=Z.canvas;Z.fillStyle=M,Z.fillRect(0,0,G.width,G.height),m.setImage(new Es({img:G,anchor:L.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:L.getOrigin(),opacity:1,size:L.getSize(),scale:L.getScale(),rotation:L.getRotation(),rotateWithView:L.getRotateWithView()}))}const N=m.getZIndex()||0;let j=E[N];j||(j={},E[N]=j,j.Polygon=[],j.Circle=[],j.LineString=[],j.Point=[]);const U=Y.getType();if(U==="GeometryCollection"){const B=Y.getGeometriesArrayRecursive();for(let Z=0,G=B.length;Z<G;++Z){const ae=B[Z];j[ae.getType().replace("Multi","")].push(ae,m)}}else j[U.replace("Multi","")].push(Y,m)}}const w=Object.keys(E).map(Number).sort(li);for(let C=0,P=w.length;C<P;++C){const R=E[w[C]];for(const A in R){const O=R[A];for(let M=0,z=O.length;M<z;M+=2){g.setStyle(O[M+1]);for(let k=0,q=e.length;k<q;++k)g.setTransform(e[k]),g.drawGeometry(O[M])}}}return d.getImageData(0,0,f.width,f.height)}function L0(n,e,t){const i=[];if(t){const s=Math.floor(Math.round(n[0])*wn),o=Math.floor(Math.round(n[1])*wn),r=(ct(s,0,t.width-1)+ct(o,0,t.height-1)*t.width)*4,a=t.data[r],l=t.data[r+1],h=t.data[r+2]+256*(l+256*a),u=Math.floor((256*256*256-1)/e.length);h&&h%u===0&&i.push(e[h/u-1])}return i}class z0 extends $n{constructor(e,t,i,s){super(e),this.inversePixelTransform=t,this.frameState=i,this.context=s}}const YE=5;class ZE extends ta{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=YE}getStaleKeys(){return this.staleKeys_}prependStaleKey(e){this.staleKeys_.unshift(e),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(e){return be()}getData(e){return null}prepareFrame(e){return be()}renderFrame(e,t){return be()}forEachFeatureAtCoordinate(e,t,i,s,o){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){const t=e.target;(t.getState()===le.LOADED||t.getState()===le.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=le.LOADED&&t!=le.ERROR&&e.addEventListener(we.CHANGE,this.boundHandleImageChange_),t==le.IDLE&&(e.load(),t=e.getState()),t==le.LOADED}renderIfReadyAndVisible(){const e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}}const N0=[];let sr=null;function KE(){sr=ht(1,1,void 0,{willReadFrequently:!0})}class Nd extends ZE{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=Kt(),this.pixelTransform=Kt(),this.inversePixelTransform=Kt(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,i){sr||KE(),sr.clearRect(0,0,1,1);let s;try{sr.drawImage(e,t,i,1,1,0,0,1,1),s=sr.getImageData(0,0,1,1).data}catch{return sr=null,null}return s}getBackground(e){let i=this.getLayer().getBackground();return typeof i=="function"&&(i=i(e.viewState.resolution)),i||void 0}useContainer(e,t,i){const s=this.getLayer().getClassName();let o,r;if(e&&e.className===s&&(!i||e&&e.style.backgroundColor&&us(ro(e.style.backgroundColor),ro(i)))){const a=e.firstElementChild;ys(a)&&(r=a.getContext("2d"))}if(r&&Eb(r.canvas.style.transform,t)?(this.container=e,this.context=r,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){o=ln?Ym():document.createElement("div"),o.className=s;let a=o.style;a.position="absolute",a.width="100%",a.height="100%",r=ht();const l=r.canvas;o.appendChild(l),a=l.style,a.position="absolute",a.left="0",a.transformOrigin="top left",this.container=o,this.context=r}!this.containerReused&&i&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=i)}clipUnrotated(e,t,i){const s=rn(i),o=Ql(i),r=Zl(i),a=Yl(i);_t(t.coordinateToPixelTransform,s),_t(t.coordinateToPixelTransform,o),_t(t.coordinateToPixelTransform,r),_t(t.coordinateToPixelTransform,a);const l=this.inversePixelTransform;_t(l,s),_t(l,o),_t(l,r),_t(l,a),e.save(),e.beginPath(),e.moveTo(Math.round(s[0]),Math.round(s[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.lineTo(Math.round(r[0]),Math.round(r[1])),e.lineTo(Math.round(a[0]),Math.round(a[1])),e.clip()}prepareContainer(e,t){const i=e.extent,s=e.viewState.resolution,o=e.viewState.rotation,r=e.pixelRatio,a=Math.round(Ie(i)/s*r),l=Math.round(lt(i)/s*r);Hn(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/r,1/r,o,-a/2,-l/2),Tm(this.inversePixelTransform,this.pixelTransform);const c=bb(this.pixelTransform);if(this.useContainer(t,c,this.getBackground(e)),!this.containerReused){const h=this.context.canvas;h.width!=a||h.height!=l?(h.width=a,h.height=l):this.context.clearRect(0,0,a,l),c!==h.style.transform&&(h.style.transform=c)}}dispatchRenderEvent_(e,t,i){const s=this.getLayer();if(s.hasListener(e)){const o=new z0(e,this.inversePixelTransform,i,t);s.dispatchEvent(o)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(Tn.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(Tn.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new Fd),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(Tn.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(Tn.POSTRENDER,this.context,e))}getRenderTransform(e,t,i,s,o,r,a){const l=o/2,c=r/2,h=s/t,u=-h,d=-e[0]+a,f=-e[1];return Hn(this.tempTransform,l,c,h,u,-i,d,f)}disposeInternal(){delete this.frameState,super.disposeInternal()}}class k0 extends Nd{constructor(e){super(e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=gn(),this.wrappedRenderedExtent_=gn(),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(e,t,i){const s=t.extent,o=t.viewState,r=o.center,a=o.resolution,l=o.projection,c=o.rotation,h=l.getExtent(),u=this.getLayer().getSource(),d=this.getLayer().getDeclutter(),f=t.pixelRatio,g=t.viewHints,_=!(g[ot.ANIMATING]||g[ot.INTERACTING]),v=this.context,E=Math.round(Ie(s)/a*f),w=Math.round(lt(s)/a*f),C=u.getWrapX()&&l.canWrapX(),P=C?Ie(h):null,R=C?Math.ceil((s[2]-h[2])/P)+(this.extendX_?2:1):1;let A=C?Math.floor((s[0]-h[0])/P)-(this.extendX_?1:0):0;do{let O=this.getRenderTransform(r,a,0,f,E,w,A*P);t.declutter&&(O=O.slice(0)),e.execute(v,[v.canvas.width,v.canvas.height],O,c,_,i===void 0?uo:i?Dc:$E,i?d&&t.declutter[d]:void 0)}while(++A<R)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=ht(this.context.canvas.width,this.context.canvas.height,N0))}resetDrawContext_(){if(this.opacity_!==1&&this.targetContext_){const e=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=e,ca(this.context),N0.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(e){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,e,!0)}renderDeferredInternal(e){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,e,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(e,t){const i=e.layerStatesArray[e.layerIndex];this.opacity_=i.opacity;const s=e.viewState;this.prepareContainer(e,t);const o=this.context,r=this.replayGroup_;let a=r&&!r.isEmpty();if(!a&&!(this.getLayer().hasListener(Tn.PRERENDER)||this.getLayer().hasListener(Tn.POSTRENDER)))return this.container;this.setDrawContext_(),this.preRender(o,e),s.projection,this.clipExtent_=null;let l=!1;if(a&&i.extent&&this.clipping){const c=fi(i.extent);a=pt(c,e.extent),a&&!Di(c,e.extent)&&(e.declutter?this.clipExtent_=c:(this.clipUnrotated(o,e,c),l=!0))}return a&&this.renderWorlds(r,e,this.getLayer().getDeclutter()?!1:void 0),l&&o.restore(),this.postRender(o,e),this.renderedRotation_!==s.rotation&&(this.renderedRotation_=s.rotation,this.hitDetectionImageData_=null),e.declutter||this.resetDrawContext_(),this.container}getFeatures(e){return new Promise(t=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const i=this.frameState.size.slice(),s=this.renderedCenter_,o=this.renderedResolution_,r=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,c=this.getLayer(),h=[],u=i[0]*wn,d=i[1]*wn;h.push(this.getRenderTransform(s,o,r,wn,u,d,0).slice());const f=c.getSource(),g=a.getExtent();if(f.getWrapX()&&a.canWrapX()&&!Di(g,l)){let _=l[0];const v=Ie(g);let E=0,w;for(;_<g[0];)--E,w=v*E,h.push(this.getRenderTransform(s,o,r,wn,u,d,w).slice()),_+=v;for(E=0,_=l[2];_>g[2];)++E,w=v*E,h.push(this.getRenderTransform(s,o,r,wn,u,d,w).slice()),_-=v}this.hitDetectionImageData_=F0(i,h,this.renderedFeatures_,c.getStyleFunction(),l,o,r,Pc(o,this.renderedPixelRatio_),null)}t(L0(e,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(e,t,i,s,o){var d,f;if(!this.replayGroup_)return;const r=t.viewState.resolution,a=t.viewState.rotation,l=this.getLayer(),c={},h=function(g,_,v){const E=Re(g),w=c[E];if(w){if(w!==!0&&v<w.distanceSq){if(v===0)return c[E]=!0,o.splice(o.lastIndexOf(w),1),s(g,l,_);w.geometry=_,w.distanceSq=v}}else{if(v===0)return c[E]=!0,s(g,l,_);o.push(c[E]={feature:g,layer:l,geometry:_,distanceSq:v,callback:s})}},u=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(e,r,a,i,h,u?(f=(d=t.declutter)==null?void 0:d[u])==null?void 0:f.all().map(g=>g.value):null)}handleFontsChanged(){const e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){const t=this.getLayer(),i=t.getSource();if(!i)return!1;const s=e.viewHints[ot.ANIMATING],o=e.viewHints[ot.INTERACTING],r=t.getUpdateWhileAnimating(),a=t.getUpdateWhileInteracting();if(this.ready&&!r&&s||!a&&o)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const l=e.extent,c=e.viewState,h=c.projection,u=c.resolution,d=e.pixelRatio,f=t.getRevision(),g=t.getRenderBuffer();let _=t.getRenderOrder();_===void 0&&(_=pE);const v=c.center.slice(),E=hi(l,g*u),w=E.slice(),C=[E.slice()],P=h.getExtent(),R=i.getWrapX()&&h.canWrapX();if(this.extendX_=!1,R){const S=i.getExtent();S&&!zi(S)&&(this.extendX_=S[0]<P[0]||S[2]>P[2])}if(R&&(!Di(P,e.extent)||this.extendX_)){const S=Ie(P),L=Math.max(Ie(E)/2,S);let N=P[0],j=P[2];this.extendX_&&(N-=S,j+=S),E[0]=N-L,E[2]=j+L,ju(v,h);const U=em(C[0],h);U[0]<P[0]&&U[2]<P[2]?C.push([U[0]+S,U[1],U[2]+S,U[3]]):U[0]>P[0]&&U[2]>P[2]&&C.push([U[0]-S,U[1],U[2]-S,U[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedPixelRatio_===d&&this.renderedRevision_==f&&this.renderedRenderOrder_==_&&this.renderedFrameDeclutter_===!!e.declutter&&Di(this.wrappedRenderedExtent_,E))return us(this.renderedExtent_,w)||(this.hitDetectionImageData_=null,this.renderedExtent_=w),this.renderedCenter_=v,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const A=new R0(u0(u,d),E,u,d);let O;for(let S=0,L=C.length;S<L;++S)i.loadFeatures(C[S],u,h);const M=Pc(u,d);let z=!0;const k=(S,L)=>{let N;const j=S.getStyleFunction()||t.getStyleFunction();if(j&&(N=j(S,u)),N){const U=this.renderFeature(S,M,N,A,O,this.getLayer().getDeclutter(),L);z=z&&!U}},q=Zu(E),Y=i.getFeaturesInExtent(q);_&&Y.sort(_);for(let S=0,L=Y.length;S<L;++S)k(Y[S],S);this.renderedFeatures_=Y,this.ready=z;const m=A.finish(),b=new M0(E,u,d,i.getOverlaps(),m,t.getRenderBuffer(),!!e.declutter);return this.renderedResolution_=u,this.renderedRevision_=f,this.renderedRenderOrder_=_,this.renderedFrameDeclutter_=!!e.declutter,this.renderedExtent_=w,this.wrappedRenderedExtent_=E,this.renderedCenter_=v,this.renderedProjection_=h,this.renderedPixelRatio_=d,this.replayGroup_=b,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(e,t,i,s,o,r,a){if(!i)return!1;let l=!1;if(Array.isArray(i))for(let c=0,h=i.length;c<h;++c)l=Sc(s,e,i[c],t,this.boundHandleStyleImageChange_,o,r,a)||l;else l=Sc(s,e,i,t,this.boundHandleStyleImageChange_,o,r,a);return l}}let fo=0;const Qt=1<<fo++,ke=1<<fo++,hn=1<<fo++,Zn=1<<fo++,po=1<<fo++,Sa=1<<fo++,Fc=Math.pow(2,fo)-1,kd={[Qt]:"boolean",[ke]:"number",[hn]:"string",[Zn]:"color",[po]:"number[]",[Sa]:"size"},QE=Object.keys(kd).map(Number).sort(li);function JE(n){return n in kd}function Ra(n){const e=[];for(const t of QE)Ta(n,t)&&e.push(kd[t]);return e.length===0?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function Ta(n,e){return(n&e)===e}function Cs(n,e){return n===e}class Ot{constructor(e,t){if(!JE(e))throw new Error(`literal expressions must have a specific type, got ${Ra(e)}`);this.type=e,this.value=t}}class eC{constructor(e,t,...i){this.type=e,this.operator=t,this.args=i}}function j0(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1,mapState:!1}}function zt(n,e,t){switch(typeof n){case"boolean":{if(Cs(e,hn))return new Ot(hn,n?"true":"false");if(!Ta(e,Qt))throw new Error(`got a boolean, but expected ${Ra(e)}`);return new Ot(Qt,n)}case"number":{if(Cs(e,Sa))return new Ot(Sa,Bt(n));if(Cs(e,Qt))return new Ot(Qt,!!n);if(Cs(e,hn))return new Ot(hn,n.toString());if(!Ta(e,ke))throw new Error(`got a number, but expected ${Ra(e)}`);return new Ot(ke,n)}case"string":{if(Cs(e,Zn))return new Ot(Zn,wc(n));if(Cs(e,Qt))return new Ot(Qt,!!n);if(!Ta(e,hn))throw new Error(`got a string, but expected ${Ra(e)}`);return new Ot(hn,n)}}if(!Array.isArray(n))throw new Error("expression must be an array or a primitive value");if(n.length===0)throw new Error("empty expression");if(typeof n[0]=="string")return uC(n,e,t);for(const i of n)if(typeof i!="number")throw new Error("expected an array of numbers");if(Cs(e,Sa)){if(n.length!==2)throw new Error(`expected an array of two values for a size, got ${n.length}`);return new Ot(Sa,n)}if(Cs(e,Zn)){if(n.length===3)return new Ot(Zn,[...n,1]);if(n.length===4)return new Ot(Zn,n);throw new Error(`expected an array of 3 or 4 values for a color, got ${n.length}`)}if(!Ta(e,po))throw new Error(`got an array of numbers, but expected ${Ra(e)}`);return new Ot(po,n)}const Q={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"},tC={[Q.Get]:Ee(De(1,1/0),U0),[Q.Var]:Ee(De(1,1),nC),[Q.Has]:Ee(De(1,1/0),U0),[Q.Id]:Ee(iC,or),[Q.Concat]:Ee(De(2,1/0),$e(hn)),[Q.GeometryType]:Ee(sC,or),[Q.LineMetric]:Ee(or),[Q.Resolution]:Ee(jd,or),[Q.Zoom]:Ee(jd,or),[Q.Time]:Ee(jd,or),[Q.Any]:Ee(De(2,1/0),$e(Qt)),[Q.All]:Ee(De(2,1/0),$e(Qt)),[Q.Not]:Ee(De(1,1),$e(Qt)),[Q.Equal]:Ee(De(2,2),$e(Fc)),[Q.NotEqual]:Ee(De(2,2),$e(Fc)),[Q.GreaterThan]:Ee(De(2,2),$e(ke)),[Q.GreaterThanOrEqualTo]:Ee(De(2,2),$e(ke)),[Q.LessThan]:Ee(De(2,2),$e(ke)),[Q.LessThanOrEqualTo]:Ee(De(2,2),$e(ke)),[Q.Multiply]:Ee(De(2,1/0),G0),[Q.Coalesce]:Ee(De(2,1/0),G0),[Q.Divide]:Ee(De(2,2),$e(ke)),[Q.Add]:Ee(De(2,1/0),$e(ke)),[Q.Subtract]:Ee(De(2,2),$e(ke)),[Q.Clamp]:Ee(De(3,3),$e(ke)),[Q.Mod]:Ee(De(2,2),$e(ke)),[Q.Pow]:Ee(De(2,2),$e(ke)),[Q.Abs]:Ee(De(1,1),$e(ke)),[Q.Floor]:Ee(De(1,1),$e(ke)),[Q.Ceil]:Ee(De(1,1),$e(ke)),[Q.Round]:Ee(De(1,1),$e(ke)),[Q.Sin]:Ee(De(1,1),$e(ke)),[Q.Cos]:Ee(De(1,1),$e(ke)),[Q.Atan]:Ee(De(1,2),$e(ke)),[Q.Sqrt]:Ee(De(1,1),$e(ke)),[Q.Match]:Ee(De(4,1/0),q0,rC),[Q.Between]:Ee(De(3,3),$e(ke)),[Q.Interpolate]:Ee(De(6,1/0),q0,aC),[Q.Case]:Ee(De(3,1/0),oC,lC),[Q.In]:Ee(De(2,2),cC),[Q.Number]:Ee(De(1,1/0),$e(Fc)),[Q.String]:Ee(De(1,1/0),$e(Fc)),[Q.Array]:Ee(De(1,1/0),$e(ke)),[Q.Color]:Ee(De(1,4),$e(ke)),[Q.Band]:Ee(De(1,3),$e(ke)),[Q.Palette]:Ee(De(2,2),hC),[Q.ToString]:Ee(De(1,1),$e(Qt|ke|hn|Zn))};function U0(n,e,t){const i=n.length-1,s=new Array(i);for(let o=0;o<i;++o){const r=n[o+1];switch(typeof r){case"number":{s[o]=new Ot(ke,r);break}case"string":{s[o]=new Ot(hn,r);break}default:throw new Error(`expected a string key or numeric array index for a get operation, got ${r}`)}o===0&&t.properties.add(String(r))}return s}function nC(n,e,t){const i=n[1];if(typeof i!="string")throw new Error("expected a string argument for var operation");return t.variables.add(i),[new Ot(hn,i)]}function iC(n,e,t){t.featureId=!0}function sC(n,e,t){t.geometryType=!0}function jd(n,e,t){t.mapState=!0}function or(n,e,t){const i=n[0];if(n.length!==1)throw new Error(`expected no arguments for ${i} operation`);return[]}function De(n,e){return function(t,i,s){const o=t[0],r=t.length-1;if(n===e){if(r!==n){const a=n===1?"":"s";throw new Error(`expected ${n} argument${a} for ${o}, got ${r}`)}}else if(r<n||r>e){const a=e===1/0?`${n} or more`:`${n} to ${e}`;throw new Error(`expected ${a} arguments for ${o}, got ${r}`)}}}function G0(n,e,t){const i=n.length-1,s=new Array(i);for(let o=0;o<i;++o){const r=zt(n[o+1],e,t);s[o]=r}return s}function $e(n){return function(e,t,i){const s=e.length-1,o=new Array(s);for(let r=0;r<s;++r){const a=zt(e[r+1],n,i);o[r]=a}return o}}function oC(n,e,t){const i=n[0],s=n.length-1;if(s%2===0)throw new Error(`expected an odd number of arguments for ${i}, got ${s} instead`)}function q0(n,e,t){const i=n[0],s=n.length-1;if(s%2===1)throw new Error(`expected an even number of arguments for operation ${i}, got ${s} instead`)}function rC(n,e,t){const i=n.length-1,s=hn|ke|Qt,o=zt(n[1],s,t),r=zt(n[n.length-1],e,t),a=new Array(i-2);for(let l=0;l<i-2;l+=2){try{const c=zt(n[l+2],o.type,t);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+1} of match expression: ${c.message}`)}try{const c=zt(n[l+3],r.type,t);a[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+2} of match expression: ${c.message}`)}}return[o,...a,r]}function aC(n,e,t){const i=n[1];let s;switch(i[0]){case"linear":s=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`);s=l;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(i)}`)}const o=new Ot(ke,s);let r;try{r=zt(n[2],ke,t)}catch(l){throw new Error(`failed to parse argument 1 in interpolate expression: ${l.message}`)}const a=new Array(n.length-3);for(let l=0;l<a.length;l+=2){try{const c=zt(n[l+3],ke,t);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${c.message}`)}try{const c=zt(n[l+4],e,t);a[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${c.message}`)}}return[o,r,...a]}function lC(n,e,t){const i=zt(n[n.length-1],e,t),s=new Array(n.length-1);for(let o=0;o<s.length-1;o+=2){try{const r=zt(n[o+1],Qt,t);s[o]=r}catch(r){throw new Error(`failed to parse argument ${o} of case expression: ${r.message}`)}try{const r=zt(n[o+2],i.type,t);s[o+1]=r}catch(r){throw new Error(`failed to parse argument ${o+1} of case expression: ${r.message}`)}}return s[s.length-1]=i,s}function cC(n,e,t){let i=n[2];if(!Array.isArray(i))throw new Error('the second argument for the "in" operator must be an array');let s;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],s=hn}else s=ke;const o=new Array(i.length);for(let a=0;a<o.length;a++)try{const l=zt(i[a],s,t);o[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[zt(n[1],s,t),...o]}function hC(n,e,t){let i;try{i=zt(n[1],ke,t)}catch(r){throw new Error(`failed to parse first argument in palette expression: ${r.message}`)}const s=n[2];if(!Array.isArray(s))throw new Error("the second argument of palette must be an array");const o=new Array(s.length);for(let r=0;r<o.length;r++){let a;try{a=zt(s[r],Zn,t)}catch(l){throw new Error(`failed to parse color at index ${r} in palette expression: ${l.message}`)}if(!(a instanceof Ot))throw new Error(`the palette color at index ${r} must be a literal value`);o[r]=a}return[i,...o]}function Ee(...n){return function(e,t,i){const s=e[0];let o;for(let r=0;r<n.length;r++){const a=n[r](e,t,i);if(r==n.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");o=a}}return new eC(t,s,...o)}}function uC(n,e,t){const i=n[0],s=tC[i];if(!s)throw new Error(`unknown operator: ${i}`);return s(n,e,t)}function W0(n){if(!n)return"";const e=n.getType();switch(e){case"Point":case"LineString":case"Polygon":return e;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return e.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return W0(n.getGeometries()[0]);default:return""}}function V0(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function mi(n,e,t){const i=zt(n,e,t);return Kn(i)}function Kn(n,e){if(n instanceof Ot){if(n.type===Zn&&typeof n.value=="string"){const i=wc(n.value);return function(){return i}}return function(){return n.value}}const t=n.operator;switch(t){case Q.Number:case Q.String:case Q.Coalesce:return dC(n);case Q.Get:case Q.Var:case Q.Has:return fC(n);case Q.Id:return i=>i.featureId;case Q.GeometryType:return i=>i.geometryType;case Q.Concat:{const i=n.args.map(s=>Kn(s));return s=>"".concat(...i.map(o=>o(s).toString()))}case Q.Resolution:return i=>i.resolution;case Q.Any:case Q.All:case Q.Between:case Q.In:case Q.Not:return gC(n);case Q.Equal:case Q.NotEqual:case Q.LessThan:case Q.LessThanOrEqualTo:case Q.GreaterThan:case Q.GreaterThanOrEqualTo:return pC(n);case Q.Multiply:case Q.Divide:case Q.Add:case Q.Subtract:case Q.Clamp:case Q.Mod:case Q.Pow:case Q.Abs:case Q.Floor:case Q.Ceil:case Q.Round:case Q.Sin:case Q.Cos:case Q.Atan:case Q.Sqrt:return mC(n);case Q.Case:return yC(n);case Q.Match:return _C(n);case Q.Interpolate:return wC(n);case Q.ToString:return vC(n);default:throw new Error(`Unsupported operator ${t}`)}}function dC(n,e){const t=n.operator,i=n.args.length,s=new Array(i);for(let o=0;o<i;++o)s[o]=Kn(n.args[o]);switch(t){case Q.Coalesce:return o=>{for(let r=0;r<i;++r){const a=s[r](o);if(typeof a<"u"&&a!==null)return a}throw new Error("Expected one of the values to be non-null")};case Q.Number:case Q.String:return o=>{for(let r=0;r<i;++r){const a=s[r](o);if(typeof a===t)return a}throw new Error(`Expected one of the values to be a ${t}`)};default:throw new Error(`Unsupported assertion operator ${t}`)}}function fC(n,e){const i=n.args[0].value;switch(n.operator){case Q.Get:return s=>{const o=n.args;let r=s.properties[i];for(let a=1,l=o.length;a<l;++a){const h=o[a].value;r=r[h]}return r};case Q.Var:return s=>s.variables[i];case Q.Has:return s=>{const o=n.args;if(!(i in s.properties))return!1;let r=s.properties[i];for(let a=1,l=o.length;a<l;++a){const h=o[a].value;if(!r||!Object.hasOwn(r,h))return!1;r=r[h]}return!0};default:throw new Error(`Unsupported accessor operator ${n.operator}`)}}function pC(n,e){const t=n.operator,i=Kn(n.args[0]),s=Kn(n.args[1]);switch(t){case Q.Equal:return o=>i(o)===s(o);case Q.NotEqual:return o=>i(o)!==s(o);case Q.LessThan:return o=>i(o)<s(o);case Q.LessThanOrEqualTo:return o=>i(o)<=s(o);case Q.GreaterThan:return o=>i(o)>s(o);case Q.GreaterThanOrEqualTo:return o=>i(o)>=s(o);default:throw new Error(`Unsupported comparison operator ${t}`)}}function gC(n,e){const t=n.operator,i=n.args.length,s=new Array(i);for(let o=0;o<i;++o)s[o]=Kn(n.args[o]);switch(t){case Q.Any:return o=>{for(let r=0;r<i;++r)if(s[r](o))return!0;return!1};case Q.All:return o=>{for(let r=0;r<i;++r)if(!s[r](o))return!1;return!0};case Q.Between:return o=>{const r=s[0](o),a=s[1](o),l=s[2](o);return r>=a&&r<=l};case Q.In:return o=>{const r=s[0](o);for(let a=1;a<i;++a)if(r===s[a](o))return!0;return!1};case Q.Not:return o=>!s[0](o);default:throw new Error(`Unsupported logical operator ${t}`)}}function mC(n,e){const t=n.operator,i=n.args.length,s=new Array(i);for(let o=0;o<i;++o)s[o]=Kn(n.args[o]);switch(t){case Q.Multiply:return o=>{let r=1;for(let a=0;a<i;++a)r*=s[a](o);return r};case Q.Divide:return o=>s[0](o)/s[1](o);case Q.Add:return o=>{let r=0;for(let a=0;a<i;++a)r+=s[a](o);return r};case Q.Subtract:return o=>s[0](o)-s[1](o);case Q.Clamp:return o=>{const r=s[0](o),a=s[1](o);if(r<a)return a;const l=s[2](o);return r>l?l:r};case Q.Mod:return o=>s[0](o)%s[1](o);case Q.Pow:return o=>Math.pow(s[0](o),s[1](o));case Q.Abs:return o=>Math.abs(s[0](o));case Q.Floor:return o=>Math.floor(s[0](o));case Q.Ceil:return o=>Math.ceil(s[0](o));case Q.Round:return o=>Math.round(s[0](o));case Q.Sin:return o=>Math.sin(s[0](o));case Q.Cos:return o=>Math.cos(s[0](o));case Q.Atan:return i===2?o=>Math.atan2(s[0](o),s[1](o)):o=>Math.atan(s[0](o));case Q.Sqrt:return o=>Math.sqrt(s[0](o));default:throw new Error(`Unsupported numeric operator ${t}`)}}function yC(n,e){const t=n.args.length,i=new Array(t);for(let s=0;s<t;++s)i[s]=Kn(n.args[s]);return s=>{for(let o=0;o<t-1;o+=2)if(i[o](s))return i[o+1](s);return i[t-1](s)}}function _C(n,e){const t=n.args.length,i=new Array(t);for(let s=0;s<t;++s)i[s]=Kn(n.args[s]);return s=>{const o=i[0](s);for(let r=1;r<t-1;r+=2)if(o===i[r](s))return i[r+1](s);return i[t-1](s)}}function wC(n,e){const t=n.args.length,i=new Array(t);for(let s=0;s<t;++s)i[s]=Kn(n.args[s]);return s=>{const o=i[0](s),r=i[1](s);let a,l;for(let c=2;c<t;c+=2){const h=i[c](s);let u=i[c+1](s);const d=Array.isArray(u);if(d&&(u=Kb(u)),h>=r)return c===2?u:d?bC(o,r,a,l,h,u):Ia(o,r,a,l,h,u);a=h,l=u}return l}}function vC(n,e){const t=n.operator,i=n.args.length,s=new Array(i);for(let o=0;o<i;++o)s[o]=Kn(n.args[o]);switch(t){case Q.ToString:return o=>{const r=s[0](o);return n.args[0].type===Zn?Cd(r):r.toString()};default:throw new Error(`Unsupported convert operator ${t}`)}}function Ia(n,e,t,i,s,o){const r=s-t;if(r===0)return i;const a=e-t,l=n===1?a/r:(Math.pow(n,a)-1)/(Math.pow(n,r)-1);return i+l*(o-i)}function bC(n,e,t,i,s,o){if(s-t===0)return i;const a=Km(i),l=Km(o);let c=l[2]-a[2];c>180?c-=360:c<-180&&(c+=360);const h=[Ia(n,e,t,a[0],s,l[0]),Ia(n,e,t,a[1],s,l[1]),a[2]+Ia(n,e,t,0,s,c),Ia(n,e,t,i[3],s,o[3])];return Qb(h)}function EC(n){return!0}function CC(n){const e=j0(),t=xC(n,e),i=V0();return function(s,o){if(i.properties=s.getPropertiesInternal(),i.resolution=o,e.featureId){const r=s.getId();r!==void 0?i.featureId=r:i.featureId=null}return e.geometryType&&(i.geometryType=W0(s.getGeometry())),t(i)}}function B0(n){const e=j0(),t=n.length,i=new Array(t);for(let r=0;r<t;++r)i[r]=Ud(n[r],e);const s=V0(),o=new Array(t);return function(r,a){if(s.properties=r.getPropertiesInternal(),s.resolution=a,e.featureId){const c=r.getId();c!==void 0?s.featureId=c:s.featureId=null}let l=0;for(let c=0;c<t;++c){const h=i[c](s);h&&(o[l]=h,l+=1)}return o.length=l,o}}function xC(n,e){const t=n.length,i=new Array(t);for(let s=0;s<t;++s){const o=n[s],r="filter"in o?mi(o.filter,Qt,e):EC;let a;if(Array.isArray(o.style)){const l=o.style.length;a=new Array(l);for(let c=0;c<l;++c)a[c]=Ud(o.style[c],e)}else a=[Ud(o.style,e)];i[s]={filter:r,styles:a}}return function(s){const o=[];let r=!1;for(let a=0;a<t;++a){const l=i[a].filter;if(l(s)&&!(n[a].else&&r)){r=!0;for(const c of i[a].styles){const h=c(s);h&&o.push(h)}}}return o}}function Ud(n,e){const t=Oa(n,"",e),i=Aa(n,"",e),s=PC(n,e),o=SC(n,e),r=Nt(n,"z-index",e);if(!t&&!i&&!s&&!o&&!gs(n))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(n));const a=new Xe;return function(l){let c=!0;if(t){const h=t(l);h&&(c=!1),a.setFill(h)}if(i){const h=i(l);h&&(c=!1),a.setStroke(h)}if(s){const h=s(l);h&&(c=!1),a.setText(h)}if(o){const h=o(l);h&&(c=!1),a.setImage(h)}return r&&a.setZIndex(r(l)),c?null:a}}function Oa(n,e,t){let i;if(e+"fill-pattern-src"in n)i=OC(n,e+"fill-",t);else{if(n[e+"fill-color"]==="none")return o=>null;i=Lc(n,e+"fill-color",t)}if(!i)return null;const s=new wt;return function(o){const r=i(o);return r===md?null:(s.setColor(r),s)}}function Aa(n,e,t){const i=Nt(n,e+"stroke-width",t),s=Lc(n,e+"stroke-color",t);if(!i&&!s)return null;const o=Vi(n,e+"stroke-line-cap",t),r=Vi(n,e+"stroke-line-join",t),a=$0(n,e+"stroke-line-dash",t),l=Nt(n,e+"stroke-line-dash-offset",t),c=Nt(n,e+"stroke-miter-limit",t),h=Nt(n,e+"stroke-offset",t),u=new St;return function(d){if(s){const f=s(d);if(f===md)return null;u.setColor(f)}if(i&&u.setWidth(i(d)),o){const f=o(d);if(f!=="butt"&&f!=="round"&&f!=="square")throw new Error("Expected butt, round, or square line cap");u.setLineCap(f)}if(r){const f=r(d);if(f!=="bevel"&&f!=="round"&&f!=="miter")throw new Error("Expected bevel, round, or miter line join");u.setLineJoin(f)}return a&&u.setLineDash(a(d)),l&&u.setLineDashOffset(l(d)),c&&u.setMiterLimit(c(d)),h&&u.setOffset(h(d)),u}}function PC(n,e){const t="text-",i=Vi(n,t+"value",e);if(!i)return null;const s=Oa(n,t,e),o=Oa(n,t+"background-",e),r=Aa(n,t,e),a=Aa(n,t+"background-",e),l=Vi(n,t+"font",e),c=Nt(n,t+"max-angle",e),h=Nt(n,t+"offset-x",e),u=Nt(n,t+"offset-y",e),d=rr(n,t+"overflow",e),f=Vi(n,t+"placement",e),g=Nt(n,t+"repeat",e),_=Nc(n,t+"scale",e),v=rr(n,t+"rotate-with-view",e),E=Nt(n,t+"rotation",e),w=Vi(n,t+"align",e),C=Vi(n,t+"justify",e),P=Vi(n,t+"baseline",e),R=rr(n,t+"keep-upright",e),A=$0(n,t+"padding",e),O=kc(n,t+"declutter-mode"),M=new nr({declutterMode:O});return function(z){if(M.setText(i(z)),s&&M.setFill(s(z)),o&&M.setBackgroundFill(o(z)),r&&M.setStroke(r(z)),a&&M.setBackgroundStroke(a(z)),l&&M.setFont(l(z)),c&&M.setMaxAngle(c(z)),h&&M.setOffsetX(h(z)),u&&M.setOffsetY(u(z)),d&&M.setOverflow(d(z)),f){const k=f(z);if(k!=="point"&&k!=="line")throw new Error("Expected point or line for text-placement");M.setPlacement(k)}if(g&&M.setRepeat(g(z)),_&&M.setScale(_(z)),v&&M.setRotateWithView(v(z)),E&&M.setRotation(E(z)),w){const k=w(z);if(k!=="left"&&k!=="center"&&k!=="right"&&k!=="end"&&k!=="start")throw new Error("Expected left, right, center, start, or end for text-align");M.setTextAlign(k)}if(C){const k=C(z);if(k!=="left"&&k!=="right"&&k!=="center")throw new Error("Expected left, right, or center for text-justify");M.setJustify(k)}if(P){const k=P(z);if(k!=="bottom"&&k!=="top"&&k!=="middle"&&k!=="alphabetic"&&k!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");M.setTextBaseline(k)}return A&&M.setPadding(A(z)),R&&M.setKeepUpright(R(z)),M}}function SC(n,e){return"icon-src"in n?RC(n,e):"shape-points"in n?TC(n,e):"circle-radius"in n?IC(n,e):null}function RC(n,e){const t="icon-",i=t+"src",s=Z0(n[i],i),o=zc(n,t+"anchor",e),r=Nc(n,t+"scale",e),a=Nt(n,t+"opacity",e),l=zc(n,t+"displacement",e),c=Nt(n,t+"rotation",e),h=rr(n,t+"rotate-with-view",e),u=X0(n,t+"anchor-origin"),d=Y0(n,t+"anchor-x-units"),f=Y0(n,t+"anchor-y-units"),g=Wi(n,t+"color");let _,v=null;g!==void 0&&(Array.isArray(g)&&g.length>0&&typeof g[0]=="string"?v=Lc(n,t+"color",e):_=K0(g,t+"color"));const E=MC(n,t+"cross-origin"),w=DC(n,t+"offset"),C=X0(n,t+"offset-origin"),P=Gd(n,t+"width"),R=Gd(n,t+"height"),A=AC(n,t+"size"),O=kc(n,t+"declutter-mode"),M={src:s,anchorOrigin:u,anchorXUnits:d,anchorYUnits:f,crossOrigin:E,offset:w,offsetOrigin:C,height:R,width:P,size:A,declutterMode:O};let z=null;return function(k){if(z)v&&z.setColor(v(k));else{const q=v?v(k):_;z=new Es(q!==void 0?Object.assign({},M,{color:q}):Object.assign({},M))}return a&&z.setOpacity(a(k)),l&&z.setDisplacement(l(k)),c&&z.setRotation(c(k)),h&&z.setRotateWithView(h(k)),r&&z.setScale(r(k)),o&&z.setAnchor(o(k)),z}}function TC(n,e){const t="shape-",i=t+"points",s=t+"radius",o=qd(n[i],i);if(!(s in n))throw new Error(`Expected a number for ${s}`);const r=Nt(n,s,e),a=typeof n[s]=="number"?n[s]:5,l=t+"radius2",c=Nt(n,l,e),h=typeof n[l]=="number"?n[l]:void 0,u=Oa(n,t,e),d=Aa(n,t,e),f=Nc(n,t+"scale",e),g=zc(n,t+"displacement",e),_=Nt(n,t+"rotation",e),v=rr(n,t+"rotate-with-view",e),E=Gd(n,t+"angle"),w=kc(n,t+"declutter-mode"),C=new xa({points:o,radius:a,radius2:h,angle:E,declutterMode:w});return function(P){return r&&C.setRadius(r(P)),c&&C.setRadius2(c(P)),u&&C.setFill(u(P)),d&&C.setStroke(d(P)),g&&C.setDisplacement(g(P)),_&&C.setRotation(_(P)),v&&C.setRotateWithView(v(P)),f&&C.setScale(f(P)),C}}function IC(n,e){const t="circle-",i=Oa(n,t,e),s=Aa(n,t,e),o=Nt(n,t+"radius",e),r=Nc(n,t+"scale",e),a=zc(n,t+"displacement",e),l=Nt(n,t+"rotation",e),c=rr(n,t+"rotate-with-view",e),h=kc(n,t+"declutter-mode"),u=new An({radius:5,declutterMode:h});return function(d){return o&&u.setRadius(o(d)),i&&u.setFill(i(d)),s&&u.setStroke(s(d)),a&&u.setDisplacement(a(d)),l&&u.setRotation(l(d)),c&&u.setRotateWithView(c(d)),r&&u.setScale(r(d)),u}}function Wi(n,e){if(!(e in n))return;const t=n[e];return t===void 0?void 0:t}function Nt(n,e,t){const i=Wi(n,e);if(i===void 0)return;const s=mi(i,ke,t);return function(o){return qd(s(o),e)}}function Vi(n,e,t){const i=Wi(n,e);if(i===void 0)return null;const s=mi(i,hn,t);return function(o){return Z0(s(o),e)}}function OC(n,e,t){const i=Vi(n,e+"pattern-src",t),s=H0(n,e+"pattern-offset",t),o=H0(n,e+"pattern-size",t),r=Lc(n,e+"color",t);return function(a){return{src:i(a),offset:s&&s(a),size:o&&o(a),color:r&&r(a)}}}function rr(n,e,t){const i=Wi(n,e);if(i===void 0)return null;const s=mi(i,Qt,t);return function(o){const r=s(o);if(typeof r!="boolean")throw new Error(`Expected a boolean for ${e}`);return r}}function Lc(n,e,t){const i=Wi(n,e);if(i===void 0)return null;const s=mi(i,Zn,t);return function(o){return K0(s(o),e)}}function $0(n,e,t){const i=Wi(n,e);if(i===void 0)return null;if(Array.isArray(i)&&(i.length===0||typeof i[0]!="string")){const o=i.map((r,a)=>{if(typeof r=="number")return()=>r;const l=mi(r,ke,t);return function(c){return qd(l(c),`${e}[${a}]`)}});return function(r){const a=new Array(o.length);for(let l=0;l<o.length;++l)a[l]=o[l](r);return a}}const s=mi(i,po,t);return function(o){return Ma(s(o),e)}}function zc(n,e,t){const i=Wi(n,e);if(i===void 0)return null;const s=mi(i,po,t);return function(o){const r=Ma(s(o),e);if(r.length!==2)throw new Error(`Expected two numbers for ${e}`);return r}}function H0(n,e,t){const i=Wi(n,e);if(i===void 0)return null;const s=mi(i,po,t);return function(o){return Q0(s(o),e)}}function Nc(n,e,t){const i=Wi(n,e);if(i===void 0)return null;const s=mi(i,po|ke,t);return function(o){return FC(s(o),e)}}function Gd(n,e){const t=n[e];if(t!==void 0){if(typeof t!="number")throw new Error(`Expected a number for ${e}`);return t}}function AC(n,e){const t=n[e];if(t!==void 0){if(typeof t=="number")return Bt(t);if(!Array.isArray(t))throw new Error(`Expected a number or size array for ${e}`);if(t.length!==2||typeof t[0]!="number"||typeof t[1]!="number")throw new Error(`Expected a number or size array for ${e}`);return t}}function MC(n,e){const t=n[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);return t}}function X0(n,e){const t=n[e];if(t!==void 0){if(t!=="bottom-left"&&t!=="bottom-right"&&t!=="top-left"&&t!=="top-right")throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return t}}function Y0(n,e){const t=n[e];if(t!==void 0){if(t!=="pixels"&&t!=="fraction")throw new Error(`Expected pixels or fraction for ${e}`);return t}}function DC(n,e){const t=n[e];if(t!==void 0)return Ma(t,e)}function kc(n,e){const t=n[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);if(t!=="declutter"&&t!=="obstacle"&&t!=="none")throw new Error(`Expected declutter, obstacle, or none for ${e}`);return t}}function Ma(n,e){if(!Array.isArray(n))throw new Error(`Expected an array for ${e}`);const t=n.length;for(let i=0;i<t;++i)if(typeof n[i]!="number")throw new Error(`Expected an array of numbers for ${e}`);return n}function Z0(n,e){if(typeof n!="string")throw new Error(`Expected a string for ${e}`);return n}function qd(n,e){if(typeof n!="number")throw new Error(`Expected a number for ${e}`);return n}function K0(n,e){if(typeof n=="string")return n;const t=Ma(n,e),i=t.length;if(i<3||i>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return t}function Q0(n,e){const t=Ma(n,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function FC(n,e){return typeof n=="number"?n:Q0(n,e)}const Qn={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function J0(n,e,t){return(function(i,s,o,r,a){if(!i)return;if(!s&&!e)return i;const l=e?0:o[0]*s,c=e?0:o[1]*s,h=a?a[0]:0,u=a?a[1]:0;let d=n[0]+l/2+h,f=n[2]-l/2+h,g=n[1]+c/2+u,_=n[3]-c/2+u;d>f&&(d=(f+d)/2,f=d),g>_&&(g=(_+g)/2,_=g);let v=ct(i[0],d,f),E=ct(i[1],g,_);if(r&&t&&s){const w=30*s;v+=-w*Math.log(1+Math.max(0,d-i[0])/w)+w*Math.log(1+Math.max(0,i[0]-f)/w),E+=-w*Math.log(1+Math.max(0,g-i[1])/w)+w*Math.log(1+Math.max(0,i[1]-_)/w)}return[v,E]})}function LC(n){return n}function Wd(n,e,t,i){const s=Ie(e)/t[0],o=lt(e)/t[1];return i?Math.min(n,Math.max(s,o)):Math.min(n,Math.min(s,o))}function Vd(n,e,t){let i=Math.min(n,e);const s=50;return i*=Math.log(1+s*Math.max(0,n/e-1))/s+1,t&&(i=Math.max(i,t),i/=Math.log(1+s*Math.max(0,t/n-1))/s+1),ct(i,t/2,e*2)}function zC(n,e,t,i){return e=e!==void 0?e:!0,(function(s,o,r,a){if(s!==void 0){const l=n[0],c=n[n.length-1],h=t?Wd(l,t,r,i):l;if(a)return e?Vd(s,h,c):ct(s,c,h);const u=Math.min(h,s),d=Math.floor(Xl(n,u,o));return n[d]>h&&d<n.length-1?n[d+1]:n[d]}})}function NC(n,e,t,i,s,o){return i=i!==void 0?i:!0,t=t!==void 0?t:0,(function(r,a,l,c){if(r!==void 0){const h=s?Wd(e,s,l,o):e;if(c)return i?Vd(r,h,t):ct(r,t,h);const u=1e-9,d=Math.ceil(Math.log(e/h)/Math.log(n)-u),f=-a*(.5-u)+.5,g=Math.min(h,r),_=Math.floor(Math.log(e/g)/Math.log(n)+f),v=Math.max(d,_),E=e/Math.pow(n,v);return ct(E,t,h)}})}function ey(n,e,t,i,s){return t=t!==void 0?t:!0,(function(o,r,a,l){if(o!==void 0){const c=i?Wd(n,i,a,s):n;return!t||!l?ct(o,e,c):Vd(o,c,e)}})}function Bd(n){if(n!==void 0)return 0}function ty(n){if(n!==void 0)return n}function kC(n){const e=2*Math.PI/n;return(function(t,i){if(i)return t;if(t!==void 0)return t=Math.floor(t/e+.5)*e,t})}function jC(n){const e=ds(5);return(function(t,i){return i||t===void 0?t:Math.abs(t)<=e?0:t})}const ny=42,$d=256,Hd=0;class yi extends di{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=$u(e.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,e.projection&&Em(),e.center&&(e.center=ki(e.center,this.projection_)),e.extent&&(e.extent=fi(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){const t=Object.assign({},e);for(const a in Qn)delete t[a];this.setProperties(t,!0);const i=GC(e);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=e.resolutions,this.padding_=e.padding,this.minZoom_=i.minZoom;const s=UC(e),o=i.constraint,r=qC(e);this.constraints_={center:s,resolution:o,rotation:r},this.setRotation(e.rotation!==void 0?e.rotation:0),this.setCenterInternal(e.center!==void 0?e.center:null),e.resolution!==void 0?this.setResolution(e.resolution):e.zoom!==void 0&&this.setZoom(e.zoom)}get padding(){return this.padding_}set padding(e){let t=this.padding_;this.padding_=e;const i=this.getCenterInternal();if(i){const s=e||[0,0,0,0];t=t||[0,0,0,0];const o=this.getResolution(),r=o/2*(s[3]-t[3]+t[1]-s[1]),a=o/2*(s[0]-t[0]+t[2]-s[2]);this.setCenterInternal([i[0]+r,i[1]-a])}}getUpdatedOptions_(e){const t=this.getProperties();return t.resolution!==void 0?t.resolution=this.getResolution():t.zoom=this.getZoom(),t.center=this.getCenterInternal(),t.rotation=this.getRotation(),Object.assign({},t,e)}animate(e){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const t=new Array(arguments.length);for(let i=0;i<t.length;++i){let s=arguments[i];s.center&&(s=Object.assign({},s),s.center=ki(s.center,this.getProjection())),s.anchor&&(s=Object.assign({},s),s.anchor=ki(s.anchor,this.getProjection())),t[i]=s}this.animateInternal.apply(this,t)}animateInternal(e){let t=arguments.length,i;t>1&&typeof arguments[t-1]=="function"&&(i=arguments[t-1],--t);let s=0;for(;s<t&&!this.isDef();++s){const h=arguments[s];h.center&&this.setCenterInternal(h.center),h.zoom!==void 0?this.setZoom(h.zoom):h.resolution&&this.setResolution(h.resolution),h.rotation!==void 0&&this.setRotation(h.rotation)}if(s===t){i&&jc(i,!0);return}let o=Date.now(),r=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_;const c=[];for(;s<t;++s){const h=arguments[s],u={start:o,complete:!1,anchor:h.anchor,duration:h.duration!==void 0?h.duration:1e3,easing:h.easing||vv,callback:i};if(h.center&&(u.sourceCenter=r,u.targetCenter=h.center.slice(),r=u.targetCenter),h.zoom!==void 0?(u.sourceResolution=a,u.targetResolution=this.getResolutionForZoom(h.zoom),a=u.targetResolution):h.resolution&&(u.sourceResolution=a,u.targetResolution=h.resolution,a=u.targetResolution),h.rotation!==void 0){u.sourceRotation=l;const d=fs(h.rotation-l+Math.PI,2*Math.PI)-Math.PI;u.targetRotation=l+d,l=u.targetRotation}WC(u)?u.complete=!0:o+=u.duration,c.push(u)}this.animations_.push(c),this.setHint(ot.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[ot.ANIMATING]>0}getInteracting(){return this.hints_[ot.INTERACTING]>0}cancelAnimations(){this.setHint(ot.ANIMATING,-this.hints_[ot.ANIMATING]);let e;for(let t=0,i=this.animations_.length;t<i;++t){const s=this.animations_[t];if(s[0].callback&&jc(s[0].callback,!1),!e)for(let o=0,r=s.length;o<r;++o){const a=s[o];if(!a.complete){e=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=e,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 e=Date.now();let t=!1;for(let i=this.animations_.length-1;i>=0;--i){const s=this.animations_[i];let o=!0;for(let r=0,a=s.length;r<a;++r){const l=s[r];if(l.complete)continue;const c=e-l.start;let h=l.duration>0?c/l.duration:1;h>=1?(l.complete=!0,h=1):o=!1;const u=l.easing(h);if(l.sourceCenter){const d=l.sourceCenter[0],f=l.sourceCenter[1],g=l.targetCenter[0],_=l.targetCenter[1];this.nextCenter_=l.targetCenter;const v=d+u*(g-d),E=f+u*(_-f);this.targetCenter_=[v,E]}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?fs(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),t=!0,!l.complete)break}if(o){this.animations_[i]=null,this.setHint(ot.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const r=s[0].callback;r&&jc(r,!0)}}this.animations_=this.animations_.filter(Boolean),t&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let i;const s=this.getCenterInternal();return s!==void 0&&(i=[s[0]-t[0],s[1]-t[1]],ku(i,e-this.getRotation()),zv(i,t)),i}calculateCenterZoom(e,t){let i;const s=this.getCenterInternal(),o=this.getResolution();if(s!==void 0&&o!==void 0){const r=t[0]-e*(t[0]-s[0])/o,a=t[1]-e*(t[1]-s[1])/o;i=[r,a]}return i}getViewportSize_(e){const t=this.viewportSize_;if(e){const i=t[0],s=t[1];return[Math.abs(i*Math.cos(e))+Math.abs(s*Math.sin(e)),Math.abs(i*Math.sin(e))+Math.abs(s*Math.cos(e))]}return t}setViewportSize(e){this.viewportSize_=Array.isArray(e)?e.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const e=this.getCenterInternal();return e&&Yu(e,this.getProjection())}getCenterInternal(){return this.get(Qn.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(e){return e!==void 0?(e[0]=this.hints_[0],e[1]=this.hints_[1],e):this.hints_.slice()}calculateExtent(e){const t=this.calculateExtentInternal(e);return Zu(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();const t=this.getCenterInternal();Be(t,"The view center is not defined");const i=this.getResolution();Be(i!==void 0,"The view resolution is not defined");const s=this.getRotation();return Be(s!==void 0,"The view rotation is not defined"),Kl(t,i,s,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get(Qn.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(fi(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();const i=Ie(e)/t[0],s=lt(e)/t[1];return Math.max(i,s)}getResolutionForValueFunction(e){e=e||2;const t=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,s=Math.log(t/i)/Math.log(e);return(function(o){return t/Math.pow(e,o*s)})}getRotation(){return this.get(Qn.ROTATION)}getValueForResolutionFunction(e){const t=Math.log(e||2),i=this.getConstrainedResolution(this.maxResolution_),s=this.minResolution_,o=Math.log(i/s)/t;return(function(r){return Math.log(i/r)/t/o})}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e);const i=this.padding_;return i&&(t=[t[0]-i[1]-i[3],t[1]-i[0]-i[2]]),t}getState(){const e=this.getProjection(),t=this.getResolution(),i=this.getRotation();let s=this.getCenterInternal();const o=this.padding_;if(o){const r=this.getViewportSizeMinusPadding_();s=Xd(s,this.getViewportSize_(),[r[0]/2+o[3],r[1]/2+o[0]],t,i)}return{center:s.slice(0),projection:e!==void 0?e:null,resolution:t,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let e;const t=this.getResolution();return t!==void 0&&(e=this.getZoomForResolution(t)),e}getZoomForResolution(e){let t=this.minZoom_||0,i,s;if(this.resolutions_){const o=Xl(this.resolutions_,e,1);t=o,i=this.resolutions_[o],o==this.resolutions_.length-1?s=2:s=i/this.resolutions_[o+1]}else i=this.maxResolution_,s=this.zoomFactor_;return t+Math.log(i/e)/Math.log(s)}getResolutionForZoom(e){var t;if((t=this.resolutions_)!=null&&t.length){if(this.resolutions_.length===1)return this.resolutions_[0];const i=ct(Math.floor(e),0,this.resolutions_.length-2),s=this.resolutions_[i]/this.resolutions_[i+1];return this.resolutions_[i]/Math.pow(s,ct(e-i,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let i;if(Be(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(e)){Be(!zi(e),"Cannot fit empty extent provided as `geometry`");const s=fi(e,this.getProjection());i=ud(s)}else if(e.getType()==="Circle"){const s=fi(e.getExtent(),this.getProjection());i=ud(s),i.rotate(this.getRotation(),xn(s))}else i=e;this.fitInternal(i,t)}rotatedExtentForGeometry(e){const t=this.getRotation(),i=Math.cos(t),s=Math.sin(-t),o=e.getFlatCoordinates(),r=e.getStride();let a=1/0,l=1/0,c=-1/0,h=-1/0;for(let u=0,d=o.length;u<d;u+=r){const f=o[u]*i-o[u+1]*s,g=o[u]*s+o[u+1]*i;a=Math.min(a,f),l=Math.min(l,g),c=Math.max(c,f),h=Math.max(h,g)}return[a,l,c,h]}fitInternal(e,t){t=t||{};let i=t.size;i||(i=this.getViewportSizeMinusPadding_());const s=t.padding!==void 0?t.padding:[0,0,0,0],o=t.nearest!==void 0?t.nearest:!1;let r;t.minResolution!==void 0?r=t.minResolution:t.maxZoom!==void 0?r=this.getResolutionForZoom(t.maxZoom):r=0;const a=this.rotatedExtentForGeometry(e);let l=this.getResolutionForExtentInternal(a,[i[0]-s[1]-s[3],i[1]-s[0]-s[2]]);l=isNaN(l)?r:Math.max(l,r),l=this.getConstrainedResolution(l,o?0:1);const c=this.getRotation(),h=Math.sin(c),u=Math.cos(c),d=xn(a);d[0]+=(s[1]-s[3])/2*l,d[1]+=(s[0]-s[2])/2*l;const f=d[0]*u-d[1]*h,g=d[1]*u+d[0]*h,_=this.getConstrainedCenter([f,g],l),v=t.callback?t.callback:Qr;t.duration!==void 0?this.animateInternal({resolution:l,center:_,duration:t.duration,easing:t.easing},v):(this.targetResolution_=l,this.targetCenter_=_,this.applyTargetState_(!1,!0),jc(v,!0))}centerOn(e,t,i){this.centerOnInternal(ki(e,this.getProjection()),t,i)}centerOnInternal(e,t,i){this.setCenterInternal(Xd(e,t,i,this.getResolution(),this.getRotation()))}calculateCenterShift(e,t,i,s){let o;const r=this.padding_;if(r&&e){const a=this.getViewportSizeMinusPadding_(-i),l=Xd(e,s,[a[0]/2+r[3],a[1]/2+r[0]],t,i);o=[e[0]-l[0],e[1]-l[1]]}return o}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(e){const t=Yu(this.targetCenter_,this.getProjection());this.setCenter([t[0]+e[0],t[1]+e[1]])}adjustCenterInternal(e){const t=this.targetCenter_;this.setCenterInternal([t[0]+e[0],t[1]+e[1]])}adjustResolution(e,t){t=t&&ki(t,this.getProjection()),this.adjustResolutionInternal(e,t)}adjustResolutionInternal(e,t){const i=this.getAnimating()||this.getInteracting(),s=this.getViewportSize_(this.getRotation()),o=this.constraints_.resolution(this.targetResolution_*e,0,s,i);t&&(this.targetCenter_=this.calculateCenterZoom(o,t)),this.targetResolution_*=e,this.applyTargetState_()}adjustZoom(e,t){this.adjustResolution(Math.pow(this.zoomFactor_,-e),t)}adjustRotation(e,t){t&&(t=ki(t,this.getProjection())),this.adjustRotationInternal(e,t)}adjustRotationInternal(e,t){const i=this.getAnimating()||this.getInteracting(),s=this.constraints_.rotation(this.targetRotation_+e,i);t&&(this.targetCenter_=this.calculateCenterRotate(s,t)),this.targetRotation_+=e,this.applyTargetState_()}setCenter(e){this.setCenterInternal(e&&ki(e,this.getProjection()))}setCenterInternal(e){this.targetCenter_=e,this.applyTargetState_()}setHint(e,t){return this.hints_[e]+=t,this.changed(),this.hints_[e]}setResolution(e){this.targetResolution_=e,this.applyTargetState_()}setRotation(e){this.targetRotation_=e,this.applyTargetState_()}setZoom(e){this.setResolution(this.getResolutionForZoom(e))}applyTargetState_(e,t){const i=this.getAnimating()||this.getInteracting()||t,s=this.constraints_.rotation(this.targetRotation_,i),o=this.getViewportSize_(s),r=this.constraints_.resolution(this.targetResolution_,0,o,i),a=this.constraints_.center(this.targetCenter_,r,o,i,this.calculateCenterShift(this.targetCenter_,r,s,o));this.get(Qn.ROTATION)!==s&&this.set(Qn.ROTATION,s),this.get(Qn.RESOLUTION)!==r&&(this.set(Qn.RESOLUTION,r),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Qn.CENTER)||!nc(this.get(Qn.CENTER),a))&&this.set(Qn.CENTER,a),this.getAnimating()&&!e&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(e,t,i){e=e!==void 0?e:200;const s=t||0,o=this.constraints_.rotation(this.targetRotation_),r=this.getViewportSize_(o),a=this.constraints_.resolution(this.targetResolution_,s,r),l=this.constraints_.center(this.targetCenter_,a,r,!1,this.calculateCenterShift(this.targetCenter_,a,o,r));if(e===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=o,this.targetCenter_=l,this.applyTargetState_();return}i=i||(e===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==o||!this.getCenterInternal()||!nc(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:o,center:l,resolution:a,duration:e,easing:Xs,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(ot.INTERACTING,1)}endInteraction(e,t,i){i=i&&ki(i,this.getProjection()),this.endInteractionInternal(e,t,i)}endInteractionInternal(e,t,i){this.getInteracting()&&(this.setHint(ot.INTERACTING,-1),this.resolveConstraints(e,t,i))}getConstrainedCenter(e,t){const i=this.getViewportSize_(this.getRotation());return this.constraints_.center(e,t||this.getResolution(),i)}getConstrainedZoom(e,t){const i=this.getResolutionForZoom(e);return this.getZoomForResolution(this.getConstrainedResolution(i,t))}getConstrainedResolution(e,t){t=t||0;const i=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(e,t,i)}}function jc(n,e){setTimeout(function(){n(e)},0)}function UC(n){if(n.extent!==void 0){const t=n.smoothExtentConstraint!==void 0?n.smoothExtentConstraint:!0;return J0(n.extent,n.constrainOnlyCenter,t)}const e=$u(n.projection,"EPSG:3857");if(n.multiWorld!==!0&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,J0(t,!1,!1)}return LC}function GC(n){let e,t,i,r=n.minZoom!==void 0?n.minZoom:Hd,a=n.maxZoom!==void 0?n.maxZoom:28;const l=n.zoomFactor!==void 0?n.zoomFactor:2,c=n.multiWorld!==void 0?n.multiWorld:!1,h=n.smoothResolutionConstraint!==void 0?n.smoothResolutionConstraint:!0,u=n.showFullExtent!==void 0?n.showFullExtent:!1,d=$u(n.projection,"EPSG:3857"),f=d.getExtent();let g=n.constrainOnlyCenter,_=n.extent;if(!c&&!_&&d.isGlobal()&&(g=!1,_=f),n.resolutions!==void 0){const v=n.resolutions;t=v[r],i=v[a]!==void 0?v[a]:v[v.length-1],n.constrainResolution?e=zC(v,h,!g&&_,u):e=ey(t,i,h,!g&&_,u)}else{const E=(f?Math.max(Ie(f),lt(f)):360*ic.degrees/d.getMetersPerUnit())/$d/Math.pow(2,Hd),w=E/Math.pow(2,28-Hd);t=n.maxResolution,t!==void 0?r=0:t=E/Math.pow(l,r),i=n.minResolution,i===void 0&&(n.maxZoom!==void 0?n.maxResolution!==void 0?i=t/Math.pow(l,a):i=E/Math.pow(l,a):i=w),a=r+Math.floor(Math.log(t/i)/Math.log(l)),i=t/Math.pow(l,a-r),n.constrainResolution?e=NC(l,t,i,h,!g&&_,u):e=ey(t,i,h,!g&&_,u)}return{constraint:e,maxResolution:t,minResolution:i,minZoom:r,zoomFactor:l}}function qC(n){if(n.enableRotation!==void 0?n.enableRotation:!0){const t=n.constrainRotation;return t===void 0||t===!0?jC():t===!1?ty:typeof t=="number"?kC(t):ty}return Bd}function WC(n){return!(n.sourceCenter&&n.targetCenter&&!nc(n.sourceCenter,n.targetCenter)||n.sourceResolution!==n.targetResolution||n.sourceRotation!==n.targetRotation)}function Xd(n,e,t,i,s){const o=Math.cos(-s);let r=Math.sin(-s),a=n[0]*o-n[1]*r,l=n[1]*o+n[0]*r;a+=(e[0]/2-t[0])*i,l+=(t[1]-e[1]/2)*i,r=-r;const c=a*o-l*r,h=l*o+a*r;return[c,h]}const Ke={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 iy extends di{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;const t=Object.assign({},e);typeof e.properties=="object"&&(delete t.properties,Object.assign(t,e.properties)),t[Ke.OPACITY]=e.opacity!==void 0?e.opacity:1,Be(typeof t[Ke.OPACITY]=="number","Layer opacity must be a number"),t[Ke.VISIBLE]=e.visible!==void 0?e.visible:!0,t[Ke.Z_INDEX]=e.zIndex,t[Ke.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[Ke.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[Ke.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[Ke.MAX_ZOOM]=e.maxZoom!==void 0?e.maxZoom:1/0,this.className_=t.className!==void 0?t.className:"ol-layer",delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){const t=this.state_||{layer:this,managed:e===void 0?!0:e},i=this.getZIndex();return t.opacity=ct(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=i===void 0&&!t.managed?1/0:i,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return be()}getLayerStatesArray(e){return be()}getExtent(){return this.get(Ke.EXTENT)}getMaxResolution(){return this.get(Ke.MAX_RESOLUTION)}getMinResolution(){return this.get(Ke.MIN_RESOLUTION)}getMinZoom(){return this.get(Ke.MIN_ZOOM)}getMaxZoom(){return this.get(Ke.MAX_ZOOM)}getOpacity(){return this.get(Ke.OPACITY)}getSourceState(){return be()}getVisible(){return this.get(Ke.VISIBLE)}getZIndex(){return this.get(Ke.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(Ke.EXTENT,e)}setMaxResolution(e){this.set(Ke.MAX_RESOLUTION,e)}setMinResolution(e){this.set(Ke.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(Ke.MAX_ZOOM,e)}setMinZoom(e){this.set(Ke.MIN_ZOOM,e)}setOpacity(e){Be(typeof e=="number","Layer opacity must be a number"),this.set(Ke.OPACITY,e)}setVisible(e){this.set(Ke.VISIBLE,e)}setZIndex(e){this.set(Ke.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}class Da extends iy{constructor(e){const t=Object.assign({},e);delete t.source,super(t),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,e.render&&(this.render=e.render),e.map&&this.setMap(e.map),this.addChangeListener(Ke.SOURCE,this.handleSourcePropertyChange_);const i=e.source?e.source:null;this.setSource(i)}getLayersArray(e){return e=e||[],e.push(this),e}getLayerStatesArray(e){return e=e||[],e.push(this.getLayerState()),e}getSource(){return this.get(Ke.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){const e=this.getSource();return e?e.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(st(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const e=this.getSource();e&&(this.sourceChangeKey_=qe(e,we.CHANGE,this.handleSourceChange_,this),e.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}isVisible(e){let t;const i=this.getMapInternal();!e&&i&&(e=i.getView()),e instanceof yi?t={viewState:e.getState(),extent:e.calculateExtent()}:t=e,!t.layerStatesArray&&i&&(t.layerStatesArray=i.getLayerGroup().getLayerStatesArray());let s;if(t.layerStatesArray){if(s=t.layerStatesArray.find(r=>r.layer===this),!s)return!1}else s=this.getLayerState();const o=this.getExtent();return Yd(s,t.viewState)&&(!o||pt(o,t.extent))}getAttributions(e){var o;if(!this.isVisible(e))return[];const t=(o=this.getSource())==null?void 0:o.getAttributions();if(!t)return[];const i=e instanceof yi?e.getViewStateAndExtent():e;let s=t(i);return Array.isArray(s)||(s=[s]),s}render(e,t){const i=this.getRenderer();return i.prepareFrame(e)?(this.rendered=!0,i.renderFrame(e,t)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(e,t){}renderDeferred(e){const t=this.getRenderer();t&&t.renderDeferred(e)}setMapInternal(e){e||this.unrender(),this.set(Ke.MAP,e)}getMapInternal(){return this.get(Ke.MAP)}setMap(e){this.mapPrecomposeKey_&&(st(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(st(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=qe(e,Tn.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=qe(this,we.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){const t=e.frameState.layerStatesArray,i=this.getLayerState(!1);Be(!t.some(s=>s.layer===i.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),t.push(i)}setSource(e){this.set(Ke.SOURCE,e)}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 Yd(n,e){if(!n.visible)return!1;const t=e.resolution;if(t<n.minResolution||t>=n.maxResolution)return!1;const i=e.zoom;return i>n.minZoom&&i<=n.maxZoom}const sy={RENDER_ORDER:"renderOrder"};class Uc extends Da{constructor(e){e=e||{};const t=Object.assign({},e);delete t.style,delete t.renderBuffer,delete t.updateWhileAnimating,delete t.updateWhileInteracting,super(t),this.declutter_=e.declutter?String(e.declutter):void 0,this.renderBuffer_=e.renderBuffer!==void 0?e.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(e.style),this.updateWhileAnimating_=e.updateWhileAnimating!==void 0?e.updateWhileAnimating:!1,this.updateWhileInteracting_=e.updateWhileInteracting!==void 0?e.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(e){return super.getFeatures(e)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(sy.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(e,t){const i=this.getDeclutter();i in e.declutter||(e.declutter[i]=new Od(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(sy.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?C0:e;const t=VC(e);this.styleFunction_=e===null?void 0:FE(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}}function VC(n){if(n===void 0)return C0;if(!n)return null;if(typeof n=="function"||n instanceof Xe)return n;if(!Array.isArray(n))return B0([n]);if(n.length===0)return[];const e=n.length,t=n[0];if(t instanceof Xe){const s=new Array(e);for(let o=0;o<e;++o){const r=n[o];if(!(r instanceof Xe))throw new Error("Expected a list of style instances");s[o]=r}return s}if("style"in t){const s=new Array(e);for(let o=0;o<e;++o){const r=n[o];if(!("style"in r))throw new Error("Expected a list of rules with a style property");s[o]=r}return CC(s)}return B0(n)}class Mn extends Uc{constructor(e){super(e)}createRenderer(){return new k0(this)}}class oy extends vc{constructor(e,t,i,s,o){const r=o!==void 0?le.IDLE:le.LOADED;super(e,t,i,r),this.loader_=o!==void 0?o:null,this.canvas_=s,this.error_=null}getError(){return this.error_}handleLoad_(e){e?(this.error_=e,this.state=le.ERROR):this.state=le.LOADED,this.changed()}load(){this.state==le.IDLE&&(this.state=le.LOADING,this.changed(),this.loader_(this.handleLoad_.bind(this)))}getImage(){return this.canvas_}}const oe={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class Fa extends ea{constructor(e,t,i){super(),i=i||{},this.tileCoord=e,this.state=t,this.key="",this.transition_=i.transition===void 0?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(we.CHANGE)}release(){this.setState(oe.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(e){if(this.state!==oe.EMPTY){if(this.state!==oe.ERROR&&this.state>e)throw new Error("Tile load sequence violation");this.state=e,this.changed()}}load(){be()}getAlpha(e,t){if(!this.transition_)return 1;let i=this.transitionStarts_[e];if(!i)i=t,this.transitionStarts_[e]=i;else if(i===-1)return 1;const s=t-i+1e3/60;return s>=this.transition_?1:$g(s/this.transition_)}inTransition(e){return this.transition_?this.transitionStarts_[e]!==-1:!1}endTransition(e){this.transition_&&(this.transitionStarts_[e]=-1)}disposeInternal(){this.release(),super.disposeInternal()}}class ry extends Fa{constructor(e,t,i,s,o,r){super(e,t,r),this.crossOrigin_=s==null?void 0:s.crossOrigin,this.referrerPolicy_=s==null?void 0:s.referrerPolicy,this.src_=i,this.key=i,this.image_,ln?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=o}getImage(){return this.image_}setImage(e){this.image_=e,this.state=oe.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=oe.ERROR,this.unlistenImage_(),this.image_=BC(),this.changed()}handleImageLoad_(){if(ln)this.state=oe.LOADED;else{const e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=oe.LOADED:this.state=oe.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==oe.ERROR&&(this.state=oe.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==oe.IDLE&&(this.state=oe.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=Jb(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}}function BC(){const n=ht(1,1);return n.fillStyle="rgba(0,0,0,0)",n.fillRect(0,0,1,1),n.canvas}class $C{constructor(e,t,i){this.decay_=e,this.minVelocity_=t,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(e,t){this.points_.push(e,t,Date.now())}end(){if(this.points_.length<6)return!1;const e=Date.now()-this.delay_,t=this.points_.length-3;if(this.points_[t+2]<e)return!1;let i=t-3;for(;i>0&&this.points_[i+2]>e;)i-=3;const s=this.points_[t+2]-this.points_[i+2];if(s<16.666666666666668)return!1;const o=this.points_[t]-this.points_[i],r=this.points_[t+1]-this.points_[i+1];return this.angle_=Math.atan2(r,o),this.initialVelocity_=Math.sqrt(o*o+r*r)/s,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}class ar extends $n{constructor(e,t,i){super(e),this.map=t,this.frameState=i!==void 0?i:null}}class xs extends ar{constructor(e,t,i,s,o,r){super(e,t,o),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=s!==void 0?s:!1,this.activePointers=r}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(e){this.pixel_=e}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(e){this.coordinate_=e}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}}const vt={SINGLECLICK:"singleclick",CLICK:we.CLICK,DBLCLICK:we.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},Zd={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown"};class HC extends ea{constructor(e,t){super(e),this.map_=e,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=t===void 0?1:t,this.down_=null;const i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=qe(i,Zd.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=qe(i,Zd.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(we.TOUCHMOVE,this.boundHandleTouchMove_,Hm?{passive:!1}:!1)}emulateClick_(e){let t=new xs(vt.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new xs(vt.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const i=new xs(vt.SINGLECLICK,this.map_,e);this.dispatchEvent(i)},250)}updateActivePointers_(e){const t=e,i=t.pointerId;if(t.type==vt.POINTERUP||t.type==vt.POINTERCANCEL){delete this.trackedTouches_[i];for(const s in this.trackedTouches_)if(this.trackedTouches_[s].target!==t.target){delete this.trackedTouches_[s];break}}else(t.type==vt.POINTERDOWN||t.type==vt.POINTERMOVE)&&(this.trackedTouches_[i]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);const t=new xs(vt.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(st),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return e.button===0}handlePointerDown_(e){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(e);const t=new xs(vt.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);if(this.dispatchEvent(t),this.down_=new PointerEvent(e.type,e),Object.defineProperty(this.down_,"target",{writable:!1,value:e.target}),this.dragListenerKeys_.length===0){const i=this.map_.getOwnerDocument();this.dragListenerKeys_.push(qe(i,vt.POINTERMOVE,this.handlePointerMove_,this),qe(i,vt.POINTERUP,this.handlePointerUp_,this),qe(this.element_,vt.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==i&&this.dragListenerKeys_.push(qe(this.element_.getRootNode(),vt.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;const t=new xs(vt.POINTERDRAG,this.map_,e,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(t)}}relayMoveEvent_(e){this.originalPointerMoveEvent_=e;const t=!!(this.down_&&this.isMoving_(e));this.dispatchEvent(new xs(vt.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){const t=this.originalPointerMoveEvent_;(!t||t.defaultPrevented)&&(typeof e.cancelable!="boolean"||e.cancelable===!0)&&e.preventDefault()}isMoving_(e){return this.dragging_||Math.abs(e.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(e.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(st(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(we.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(st(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(st),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const Ps={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},$t={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},Gc=1/0;class XC{constructor(e,t){this.priorityFunction_=e,this.keyFunction_=t,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,Jr(this.queuedElements_)}dequeue(){const e=this.elements_,t=this.priorities_,i=e[0];e.length==1?(e.length=0,t.length=0):(e[0]=e.pop(),t[0]=t.pop(),this.siftUp_(0));const s=this.keyFunction_(i);return delete this.queuedElements_[s],i}enqueue(e){Be(!(this.keyFunction_(e)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const t=this.priorityFunction_(e);return t!=Gc?(this.elements_.push(e),this.priorities_.push(t),this.queuedElements_[this.keyFunction_(e)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(e){return e*2+1}getRightChildIndex_(e){return e*2+2}getParentIndex_(e){return e-1>>1}heapify_(){let e;for(e=(this.elements_.length>>1)-1;e>=0;e--)this.siftUp_(e)}isEmpty(){return this.elements_.length===0}isKeyQueued(e){return e in this.queuedElements_}isQueued(e){return this.isKeyQueued(this.keyFunction_(e))}siftUp_(e){const t=this.elements_,i=this.priorities_,s=t.length,o=t[e],r=i[e],a=e;for(;e<s>>1;){const l=this.getLeftChildIndex_(e),c=this.getRightChildIndex_(e),h=c<s&&i[c]<i[l]?c:l;t[e]=t[h],i[e]=i[h],e=h}t[e]=o,i[e]=r,this.siftDown_(a,e)}siftDown_(e,t){const i=this.elements_,s=this.priorities_,o=i[t],r=s[t];for(;t>e;){const a=this.getParentIndex_(t);if(s[a]>r)i[t]=i[a],s[t]=s[a],t=a;else break}i[t]=o,s[t]=r}reprioritize(){const e=this.priorityFunction_,t=this.elements_,i=this.priorities_;let s=0;const o=t.length;let r,a,l;for(a=0;a<o;++a)r=t[a],l=e(r),l==Gc?delete this.queuedElements_[this.keyFunction_(r)]:(i[s]=l,t[s++]=r);t.length=s,i.length=s,this.heapify_()}}class ay extends XC{constructor(e,t){super(i=>e.apply(null,i),i=>i[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=t,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(e){const t=super.enqueue(e);return t&&e[0].addEventListener(we.CHANGE,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){const t=e.target,i=t.getState();if(i===oe.LOADED||i===oe.ERROR||i===oe.EMPTY){i!==oe.ERROR&&t.removeEventListener(we.CHANGE,this.boundHandleTileChange_);const s=t.getKey();s in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[s],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(e,t){let i=0;for(;this.tilesLoading_<e&&i<t&&this.getCount()>0;){const s=this.dequeue()[0],o=s.getKey();s.getState()===oe.IDLE&&!(o in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[o]=!0,++this.tilesLoading_,++i,s.load())}}}function YC(n,e,t,i,s){if(!n||!(t in n.wantedTiles)||!n.wantedTiles[t][e.getKey()])return Gc;const o=n.viewState.center,r=i[0]-o[0],a=i[1]-o[1];return 65536*Math.log(s)+Math.sqrt(r*r+a*a)/s}class Kd extends di{constructor(e){super();const t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents="auto"),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){var e;(e=this.element)==null||e.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(e){var t;this.map_&&((t=this.element)==null||t.remove());for(let i=0,s=this.listenerKeys.length;i<s;++i)st(this.listenerKeys[i]);if(this.listenerKeys.length=0,this.map_=e,e){const i=this.target_??e.getOverlayContainerStopEvent();this.element&&i.appendChild(this.element),this.render!==Qr&&this.listenerKeys.push(qe(e,Ps.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}}class ZC extends Kd{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=e.collapsed!==void 0?e.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=e.collapsible!==void 0,this.collapsible_=e.collapsible!==void 0?e.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=e.attributions;const t=e.className!==void 0?e.className:"ol-attribution",i=e.tipLabel!==void 0?e.tipLabel:"Attributions",s=e.expandClassName!==void 0?e.expandClassName:t+"-expand",o=e.collapseLabel!==void 0?e.collapseLabel:"›",r=e.collapseClassName!==void 0?e.collapseClassName:t+"-collapse";typeof o=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=o,this.collapseLabel_.className=r):this.collapseLabel_=o;const a=e.label!==void 0?e.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=s):this.label_=a;const l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=i,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(we.CLICK,this.handleClick_.bind(this),!1);const c=t+" "+Cc+" "+Pd+(this.collapsed_&&this.collapsible_?" "+n0:"")+(this.collapsible_?"":" ol-uncollapsible"),h=this.element;h.className=c,h.appendChild(this.toggleButton_),h.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(e){const t=this.getMap().getAllLayers(),i=new Set(t.flatMap(s=>s.getAttributions(e)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(s=>i.add(s)):i.add(this.attributions_)),!this.overrideCollapsible_){const s=!t.some(o=>{var r;return((r=o.getSource())==null?void 0:r.getAttributionsCollapsible())===!1});this.setCollapsible(s)}return Array.from(i)}async updateElement_(e){if(!e){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const t=await Promise.all(this.collectSourceAttributions_(e).map(s=>Bo(()=>s))),i=t.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!us(t,this.renderedAttributions_)){qb(this.ulElement_);for(let s=0,o=t.length;s<o;++s){const r=document.createElement("li");r.innerHTML=t[s],this.ulElement_.appendChild(r)}this.renderedAttributions_=t}}handleClick_(e){e.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(n0),this.collapsed_?Xm(this.collapseLabel_,this.label_):Xm(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(e){this.collapsible_!==e&&(this.collapsible_=e,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(e){this.userCollapsed_=e,!(!this.collapsible_||this.collapsed_===e)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(e){this.updateElement_(e.frameState)}}class KC extends Kd{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target});const t=e.className!==void 0?e.className:"ol-rotate",i=e.label!==void 0?e.label:"⇧",s=e.compassClassName!==void 0?e.compassClassName:"ol-compass";this.label_=null,typeof i=="string"?(this.label_=document.createElement("span"),this.label_.className=s,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(s));const o=e.tipLabel?e.tipLabel:"Reset rotation",r=document.createElement("button");r.className=t+"-reset",r.setAttribute("type","button"),r.title=o,r.appendChild(this.label_),r.addEventListener(we.CLICK,this.handleClick_.bind(this),!1);const a=t+" "+Cc+" "+Pd,l=this.element;l.className=a,l.appendChild(r),this.callResetNorth_=e.resetNorth?e.resetNorth:void 0,this.duration_=e.duration!==void 0?e.duration:250,this.autoHide_=e.autoHide!==void 0?e.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Ec)}handleClick_(e){e.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const t=this.getMap().getView();if(!t)return;const i=t.getRotation();i!==void 0&&(this.duration_>0&&i%(2*Math.PI)!==0?t.animate({rotation:0,duration:this.duration_,easing:Xs}):t.setRotation(0))}render(e){const t=e.frameState;if(!t)return;const i=t.viewState.rotation;if(i!=this.rotation_){const s="rotate("+i+"rad)";if(this.autoHide_){const o=this.element.classList.contains(Ec);!o&&i===0?this.element.classList.add(Ec):o&&i!==0&&this.element.classList.remove(Ec)}this.label_.style.transform=s}this.rotation_=i}}class QC extends Kd{constructor(e){e=e||{},super({element:document.createElement("div"),target:e.target});const t=e.className!==void 0?e.className:"ol-zoom",i=e.delta!==void 0?e.delta:1,s=e.zoomInClassName!==void 0?e.zoomInClassName:t+"-in",o=e.zoomOutClassName!==void 0?e.zoomOutClassName:t+"-out",r=e.zoomInLabel!==void 0?e.zoomInLabel:"+",a=e.zoomOutLabel!==void 0?e.zoomOutLabel:"–",l=e.zoomInTipLabel!==void 0?e.zoomInTipLabel:"Zoom in",c=e.zoomOutTipLabel!==void 0?e.zoomOutTipLabel:"Zoom out",h=document.createElement("button");h.className=s,h.setAttribute("type","button"),h.title=l,h.appendChild(typeof r=="string"?document.createTextNode(r):r),h.addEventListener(we.CLICK,this.handleClick_.bind(this,i),!1);const u=document.createElement("button");u.className=o,u.setAttribute("type","button"),u.title=c,u.appendChild(typeof a=="string"?document.createTextNode(a):a),u.addEventListener(we.CLICK,this.handleClick_.bind(this,-i),!1);const d=t+" "+Cc+" "+Pd,f=this.element;f.className=d,f.appendChild(h),f.appendChild(u),this.duration_=e.duration!==void 0?e.duration:250}handleClick_(e,t){t.preventDefault(),this.zoomByDelta_(e)}zoomByDelta_(e){const i=this.getMap().getView();if(!i)return;const s=i.getZoom();if(s!==void 0){const o=i.getConstrainedZoom(s+e);this.duration_>0?(i.getAnimating()&&i.cancelAnimations(),i.animate({zoom:o,duration:this.duration_,easing:Xs})):i.setZoom(o)}}}function ly(n){n=n||{};const e=new Sn;return(n.zoom!==void 0?n.zoom:!0)&&e.push(new QC(n.zoomOptions)),(n.rotate!==void 0?n.rotate:!0)&&e.push(new KC(n.rotateOptions)),(n.attribution!==void 0?n.attribution:!0)&&e.push(new ZC(n.attributionOptions)),e}const cy={ACTIVE:"active"};class La extends di{constructor(e){super(),this.on,this.once,this.un,e&&e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(cy.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(cy.ACTIVE,e)}setMap(e){this.map_=e}}function JC(n,e,t){const i=n.getCenterInternal();if(i){const s=[i[0]+e[0],i[1]+e[1]];n.animateInternal({duration:t!==void 0?t:250,easing:bv,center:n.getConstrainedCenter(s)})}}function Qd(n,e,t,i){const s=n.getZoom();if(s===void 0)return;const o=n.getConstrainedZoom(s+e),r=n.getResolutionForZoom(o);n.getAnimating()&&n.cancelAnimations(),n.animate({resolution:r,anchor:t,duration:i!==void 0?i:250,easing:Xs})}class ex extends La{constructor(e){super(),e=e||{},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:250}handleEvent(e){let t=!1;if(e.type==vt.DBLCLICK){const i=e.originalEvent,s=e.map,o=e.coordinate,r=i.shiftKey?-this.delta_:this.delta_,a=s.getView();Qd(a,r,o,this.duration_),i.preventDefault(),t=!0}return!t}}function Jd(n){const e=arguments;return function(t){let i=!0;for(let s=0,o=e.length;s<o&&(i=i&&e[s](t),!!i);++s);return i}}const tx=function(n){const e=n.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},nx=function(n){const e=n.map.getTargetElement(),t=e.getRootNode(),i=n.map.getOwnerDocument().activeElement;return t instanceof ShadowRoot?t.host.contains(i):e.contains(i)},hy=function(n){const e=n.map.getTargetElement(),t=e.getRootNode();return(t instanceof ShadowRoot?t.host:e).hasAttribute("tabindex")?nx(n):!0},ix=Kr,uy=function(n){const e=n.originalEvent;return"pointerId"in e&&e.button==0&&!(Ub&&Bm&&e.ctrlKey)},dy=function(n){const e=n.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},sx=function(n){const e=n.originalEvent;return Bm?e.metaKey:e.ctrlKey},ox=function(n){const e=n.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},fy=function(n){const e=n.originalEvent,t=e.target.tagName;return t!=="INPUT"&&t!=="SELECT"&&t!=="TEXTAREA"&&!e.target.isContentEditable},ef=function(n){const e=n.originalEvent;return"pointerId"in e&&e.pointerType=="mouse"},rx=function(n){const e=n.originalEvent;return"pointerId"in e&&e.isPrimary&&e.button===0};class za extends La{constructor(e){e=e||{},super(e),e.handleDownEvent&&(this.handleDownEvent=e.handleDownEvent),e.handleDragEvent&&(this.handleDragEvent=e.handleDragEvent),e.handleMoveEvent&&(this.handleMoveEvent=e.handleMoveEvent),e.handleUpEvent&&(this.handleUpEvent=e.handleUpEvent),e.stopDown&&(this.stopDown=e.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(e){return!1}handleDragEvent(e){}handleEvent(e){if(!e.originalEvent)return!0;let t=!1;if(this.updateTrackedPointers_(e),this.handlingDownUpSequence){if(e.type==vt.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==vt.POINTERUP){const i=this.handleUpEvent(e);this.handlingDownUpSequence=i&&this.targetPointers.length>0}}else if(e.type==vt.POINTERDOWN){const i=this.handleDownEvent(e);this.handlingDownUpSequence=i,t=this.stopDown(i)}else e.type==vt.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}}function tf(n){const e=n.length;let t=0,i=0;for(let s=0;s<e;s++)t+=n[s].clientX,i+=n[s].clientY;return{clientX:t/e,clientY:i/e}}class ax extends za{constructor(e){super({stopDown:ec}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const t=e.condition?e.condition:Jd(dy,rx);this.condition_=e.onFocusOnly?Jd(hy,t):t,this.noKinetic_=!1}handleDragEvent(e){const t=e.map;this.panning_||(this.panning_=!0,t.getView().beginInteraction());const i=this.targetPointers,s=t.getEventPixel(tf(i));if(i.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(s[0],s[1]),this.lastCentroid){const o=[this.lastCentroid[0]-s[0],s[1]-this.lastCentroid[1]],a=e.map.getView();Nv(o,a.getResolution()),ku(o,a.getRotation()),a.adjustCenterInternal(o)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=s,this.lastPointersCount_=i.length,e.originalEvent.preventDefault()}handleUpEvent(e){const t=e.map,i=t.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const s=this.kinetic_.getDistance(),o=this.kinetic_.getAngle(),r=i.getCenterInternal(),a=t.getPixelFromCoordinateInternal(r),l=t.getCoordinateFromPixelInternal([a[0]-s*Math.cos(o),a[1]-s*Math.sin(o)]);i.animateInternal({center:i.getConstrainedCenter(l),duration:500,easing:Xs})}return this.panning_&&(this.panning_=!1,i.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(e){if(this.targetPointers.length>0&&this.condition_(e)){const i=e.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 lx extends za{constructor(e){e=e||{},super({stopDown:ec}),this.condition_=e.condition?e.condition:tx,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!ef(e))return;const t=e.map,i=t.getView();if(i.getConstraints().rotation===Bd)return;const s=t.getSize(),o=e.pixel,r=Math.atan2(s[1]/2-o[1],o[0]-s[0]/2);if(this.lastAngle_!==void 0){const a=r-this.lastAngle_;i.adjustRotationInternal(-a)}this.lastAngle_=r}handleUpEvent(e){return ef(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return ef(e)&&uy(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}class cx extends Zr{constructor(e){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+e,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const e=this.startPixel_,t=this.endPixel_,i="px",s=this.element_.style;s.left=Math.min(e[0],t[0])+i,s.top=Math.min(e[1],t[1])+i,s.width=Math.abs(t[0]-e[0])+i,s.height=Math.abs(t[1]-e[1])+i}setMap(e){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=e,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(e,t){this.startPixel_=e,this.endPixel_=t,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;const e=this.startPixel_,t=this.endPixel_,s=[e,[e[0],t[1]],t,[t[0],e[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);s[4]=s[0].slice(),this.geometry_?this.geometry_.setCoordinates([s]):this.geometry_=new Xn([s])}getGeometry(){return this.geometry_}}const lr={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class Na extends $n{constructor(e,t,i){super(e),this.coordinate=t,this.mapBrowserEvent=i}}class hx extends za{constructor(e){super(),this.on,this.once,this.un,e=e??{},this.box_=new cx(e.className||"ol-dragbox"),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??uy,this.boxEndCondition_=e.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(e,t,i){const s=i[0]-t[0],o=i[1]-t[1];return s*s+o*o>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(e){this.startPixel_&&(this.box_.setPixels(this.startPixel_,e.pixel),this.dispatchEvent(new Na(lr.BOXDRAG,e.coordinate,e)))}handleUpEvent(e){if(!this.startPixel_)return!1;const t=this.boxEndCondition_(e,this.startPixel_,e.pixel);return t&&this.onBoxEnd(e),this.dispatchEvent(new Na(t?lr.BOXEND:lr.BOXCANCEL,e.coordinate,e)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(e){return this.condition_(e)?(this.startPixel_=e.pixel,this.box_.setMap(e.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new Na(lr.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Na(lr.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Na(lr.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(e)}}class ux extends hx{constructor(e){e=e||{};const t=e.condition?e.condition:ox;super({condition:t,className:e.className||"ol-dragzoom",minArea:e.minArea}),this.duration_=e.duration!==void 0?e.duration:200,this.out_=e.out!==void 0?e.out:!1}onBoxEnd(e){const i=this.getMap().getView();let s=this.getGeometry();if(this.out_){const o=i.rotatedExtentForGeometry(s),r=i.getResolutionForExtentInternal(o),a=i.getResolution()/r;s=s.clone(),s.scale(a*a)}i.fitInternal(s,{duration:this.duration_,easing:Xs})}}const go={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};class dx extends La{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return dy(t)&&fy(t)},this.condition_=e.condition!==void 0?e.condition:this.defaultCondition_,this.duration_=e.duration!==void 0?e.duration:100,this.pixelDelta_=e.pixelDelta!==void 0?e.pixelDelta:128}handleEvent(e){let t=!1;if(e.type==we.KEYDOWN){const i=e.originalEvent,s=i.key;if(this.condition_(e)&&(s==go.DOWN||s==go.LEFT||s==go.RIGHT||s==go.UP)){const r=e.map.getView(),a=r.getResolution()*this.pixelDelta_;let l=0,c=0;s==go.DOWN?c=-a:s==go.LEFT?l=-a:s==go.RIGHT?l=a:c=a;const h=[l,c];ku(h,r.getRotation()),JC(r,h,this.duration_),i.preventDefault(),t=!0}}return!t}}class fx extends La{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(t){return!sx(t)&&fy(t)},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:100}handleEvent(e){let t=!1;if(e.type==we.KEYDOWN||e.type==we.KEYPRESS){const i=e.originalEvent,s=i.key;if(this.condition_(e)&&(s==="+"||s==="-")){const o=e.map,r=s==="+"?this.delta_:-this.delta_,a=o.getView();Qd(a,r,void 0,this.duration_),i.preventDefault(),t=!0}}return!t}}const px=40,gx=300;class mx extends La{constructor(e){e=e||{},super(e),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=e.maxDelta!==void 0?e.maxDelta:1,this.duration_=e.duration!==void 0?e.duration:250,this.timeout_=e.timeout!==void 0?e.timeout:80,this.useAnchor_=e.useAnchor!==void 0?e.useAnchor:!0,this.constrainResolution_=e.constrainResolution!==void 0?e.constrainResolution:!1;const t=e.condition?e.condition:ix;this.condition_=e.onFocusOnly?Jd(hy,t):t,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 e=this.getMap();if(!e)return;e.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(e){if(!this.condition_(e)||e.type!==we.WHEEL)return!0;const i=e.map,s=e.originalEvent;s.preventDefault(),this.useAnchor_&&(this.lastAnchor_=e.pixel);let o=s.deltaY;switch(s.deltaMode){case WheelEvent.DOM_DELTA_LINE:o*=px;break;case WheelEvent.DOM_DELTA_PAGE:o*=gx;break}if(o===0)return!1;this.lastDelta_=o;const r=Date.now();this.startTime_===void 0&&(this.startTime_=r),(!this.mode_||r-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(o)<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(-o/this.deltaPerZoom_,this.lastAnchor_?i.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=r,!1;this.totalDelta_+=o;const l=Math.max(this.timeout_-(r-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,i),l),!1}handleWheelZoom_(e){const t=e.getView();t.getAnimating()&&t.cancelAnimations();let i=-ct(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),Qd(t,i,this.lastAnchor_?e.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(e){this.useAnchor_=e,e||(this.lastAnchor_=null)}}class yx extends za{constructor(e){e=e||{};const t=e;t.stopDown||(t.stopDown=ec),super(t),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=e.threshold!==void 0?e.threshold:.3,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){let t=0;const i=this.targetPointers[0],s=this.targetPointers[1],o=Math.atan2(s.clientY-i.clientY,s.clientX-i.clientX);if(this.lastAngle_!==void 0){const l=o-this.lastAngle_;this.rotationDelta_+=l,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),t=l}this.lastAngle_=o;const r=e.map,a=r.getView();a.getConstraints().rotation!==Bd&&(this.anchor_=r.getCoordinateFromPixelInternal(r.getEventPixel(tf(this.targetPointers))),this.rotating_&&(r.render(),a.adjustRotationInternal(t,this.anchor_)))}handleUpEvent(e){return this.targetPointers.length<2?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){if(this.targetPointers.length>=2){const t=e.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}}class _x extends za{constructor(e){e=e||{};const t=e;t.stopDown||(t.stopDown=ec),super(t),this.anchor_=null,this.duration_=e.duration!==void 0?e.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(e){let t=1;const i=this.targetPointers[0],s=this.targetPointers[1],o=i.clientX-s.clientX,r=i.clientY-s.clientY,a=Math.sqrt(o*o+r*r);this.lastDistance_!==void 0&&(t=this.lastDistance_/a),this.lastDistance_=a;const l=e.map,c=l.getView();t!=1&&(this.lastScaleDelta_=t),this.anchor_=l.getCoordinateFromPixelInternal(l.getEventPixel(tf(this.targetPointers))),l.render(),c.adjustResolutionInternal(t,this.anchor_)}handleUpEvent(e){if(this.targetPointers.length<2){const i=e.map.getView(),s=this.lastScaleDelta_>1?1:-1;return i.endInteraction(this.duration_,s),!1}return!0}handleDownEvent(e){if(this.targetPointers.length>=2){const t=e.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}}function py(n){n=n||{};const e=new Sn,t=new $C(-.005,.05,100);return(n.altShiftDragRotate!==void 0?n.altShiftDragRotate:!0)&&e.push(new lx),(n.doubleClickZoom!==void 0?n.doubleClickZoom:!0)&&e.push(new ex({delta:n.zoomDelta,duration:n.zoomDuration})),(n.dragPan!==void 0?n.dragPan:!0)&&e.push(new ax({onFocusOnly:n.onFocusOnly,kinetic:t})),(n.pinchRotate!==void 0?n.pinchRotate:!0)&&e.push(new yx),(n.pinchZoom!==void 0?n.pinchZoom:!0)&&e.push(new _x({duration:n.zoomDuration})),(n.keyboard!==void 0?n.keyboard:!0)&&(e.push(new dx),e.push(new fx({delta:n.zoomDelta,duration:n.zoomDuration}))),(n.mouseWheelZoom!==void 0?n.mouseWheelZoom:!0)&&e.push(new mx({onFocusOnly:n.onFocusOnly,duration:n.zoomDuration})),(n.shiftDragZoom!==void 0?n.shiftDragZoom:!0)&&e.push(new ux({duration:n.zoomDuration})),e}const Ss={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"};class Rs extends $n{constructor(e,t){super(e),this.layer=t}}const nf={LAYERS:"layers"};class Ts extends iy{constructor(e){e=e||{};const t=Object.assign({},e);delete t.layers;let i=e.layers;super(t),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(nf.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new Sn(i.slice(),{unique:!0}):Be(typeof i.getArray=="function","Expected `layers` to be an array or a `Collection`"):i=new Sn(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(st),this.layersListenerKeys_.length=0;const e=this.getLayers();this.layersListenerKeys_.push(qe(e,an.ADD,this.handleLayersAdd_,this),qe(e,an.REMOVE,this.handleLayersRemove_,this));for(const i in this.listenerKeys_)this.listenerKeys_[i].forEach(st);Jr(this.listenerKeys_);const t=e.getArray();for(let i=0,s=t.length;i<s;i++){const o=t[i];this.registerLayerListeners_(o),this.dispatchEvent(new Rs(Ss.ADDLAYER,o))}this.changed()}registerLayerListeners_(e){const t=[qe(e,Vo.PROPERTYCHANGE,this.handleLayerChange_,this),qe(e,we.CHANGE,this.handleLayerChange_,this)];e instanceof Ts&&t.push(qe(e,Ss.ADDLAYER,this.handleLayerGroupAdd_,this),qe(e,Ss.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Re(e)]=t}handleLayerGroupAdd_(e){this.dispatchEvent(new Rs(Ss.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new Rs(Ss.REMOVELAYER,e.layer))}handleLayersAdd_(e){const t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new Rs(Ss.ADDLAYER,t)),this.changed()}handleLayersRemove_(e){const t=e.element,i=Re(t);this.listenerKeys_[i].forEach(st),delete this.listenerKeys_[i],this.dispatchEvent(new Rs(Ss.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(nf.LAYERS)}setLayers(e){const t=this.getLayers();if(t){const i=t.getArray();for(let s=0,o=i.length;s<o;++s)this.dispatchEvent(new Rs(Ss.REMOVELAYER,i[s]))}this.set(nf.LAYERS,e)}getLayersArray(e){return e=e!==void 0?e:[],this.getLayers().forEach(function(t){t.getLayersArray(e)}),e}getLayerStatesArray(e){const t=e!==void 0?e:[],i=t.length;this.getLayers().forEach(function(r){r.getLayerStatesArray(t)});const s=this.getLayerState();let o=s.zIndex;!e&&s.zIndex===void 0&&(o=0);for(let r=i,a=t.length;r<a;r++){const l=t[r];l.opacity*=s.opacity,l.visible=l.visible&&s.visible,l.maxResolution=Math.min(l.maxResolution,s.maxResolution),l.minResolution=Math.max(l.minResolution,s.minResolution),l.minZoom=Math.max(l.minZoom,s.minZoom),l.maxZoom=Math.min(l.maxZoom,s.maxZoom),s.extent!==void 0&&(l.extent!==void 0?l.extent=Bn(l.extent,s.extent):l.extent=s.extent),l.zIndex===void 0&&(l.zIndex=o)}return t}getSourceState(){return"ready"}}class wx extends Zr{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){be()}calculateMatrices2D(e){const t=e.viewState,i=e.coordinateToPixelTransform,s=e.pixelToCoordinateTransform;Hn(i,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),Tm(s,i)}forEachFeatureAtCoordinate(e,t,i,s,o,r,a,l){let c;const h=t.viewState;function u(P,R,A,O){return o.call(r,R,P?A:null,O)}const d=h.projection,f=ju(e.slice(),d),g=[[0,0]];if(d.canWrapX()&&s){const P=d.getExtent(),R=Ie(P);g.push([-R,0],[R,0])}const _=t.layerStatesArray,v=_.length,E=[],w=[];for(let P=0;P<g.length;P++)for(let R=v-1;R>=0;--R){const A=_[R],O=A.layer;if(O.hasRenderer()&&Yd(A,h)&&a.call(l,O)){const M=O.getRenderer(),z=O.getSource();if(M&&z){const k=z.getWrapX()?f:e,q=u.bind(null,A.managed);w[0]=k[0]+g[P][0],w[1]=k[1]+g[P][1],c=M.forEachFeatureAtCoordinate(w,t,i,q,E)}if(c)return c}}if(E.length===0)return;const C=1/E.length;return E.forEach((P,R)=>P.distanceSq+=R*C),E.sort((P,R)=>P.distanceSq-R.distanceSq),E.some(P=>c=P.callback(P.feature,P.layer,P.geometry)),c}hasFeatureAtCoordinate(e,t,i,s,o,r){return this.forEachFeatureAtCoordinate(e,t,i,s,Kr,this,o,r)!==void 0}getMap(){return this.map_}renderFrame(e){be()}scheduleExpireIconCache(e){In.canExpireCache()&&e.postRenderFunctions.push(vx)}}function vx(n,e){In.expire()}class bx extends wx{constructor(e){super(e),this.fontChangeListenerKey_=qe(lo,Vo.PROPERTYCHANGE,e.redrawText,e),this.element_=ln?Ym():document.createElement("div");const t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=Cc+" ol-layers";const i=e.getViewport();i&&i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(e,t){const i=this.getMap();if(i.hasListener(e)){const s=new z0(e,void 0,t);i.dispatchEvent(s)}}disposeInternal(){st(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(e){if(!e){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(e),this.dispatchRenderEvent(Tn.PRECOMPOSE,e);const t=e.layerStatesArray.sort((c,h)=>c.zIndex-h.zIndex);t.some(c=>c.layer instanceof Uc&&c.layer.getDeclutter())&&(e.declutter={});const s=e.viewState;this.children_.length=0;const o=[];let r=null;for(let c=0,h=t.length;c<h;++c){const u=t[c];e.layerIndex=c;const d=u.layer,f=d.getSourceState();if(!Yd(u,s)||f!="ready"&&f!="undefined"){d.unrender();continue}const g=d.render(e,r);g&&(g!==r&&(this.children_.push(g),r=g),o.push(u))}this.declutter(e,o),Wb(this.element_,this.children_);const l=this.getMap().getTargetElement();if(ys(l)){const c=l.getContext("2d");for(const h of this.children_){const u=h.firstElementChild||h,d=h.style.backgroundColor;if(d&&(!ys(u)||u.width>0)&&(c.fillStyle=d,c.fillRect(0,0,l.width,l.height)),ys(u)&&u.width>0){c.save();const f=h.style.opacity||u.style.opacity;c.globalAlpha=f===""?1:Number(f);const g=u.style.transform;if(g)c.transform(...Ju(g));else{const _=parseFloat(u.style.width)/u.width,v=parseFloat(u.style.height)/u.height;c.transform(_,0,0,v,0,0)}c.drawImage(u,0,0),c.restore()}}}this.dispatchRenderEvent(Tn.POSTCOMPOSE,e),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(e)}declutter(e,t){if(e.declutter){for(let i=t.length-1;i>=0;--i){const s=t[i],o=s.layer;o.getDeclutter()&&o.renderDeclutter(e,s)}t.forEach(i=>i.layer.renderDeferred(e))}}}function gy(n){if(n instanceof Da){n.setMapInternal(null);return}n instanceof Ts&&n.getLayers().forEach(gy)}function my(n,e){if(n instanceof Da){n.setMapInternal(e);return}if(n instanceof Ts){const t=n.getLayers().getArray();for(let i=0,s=t.length;i<s;++i)my(t[i],e)}}let yy=class extends di{constructor(e){super(),e=e||{},this.on,this.once,this.un;const t=Ex(e);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=e.maxTilesLoading!==void 0?e.maxTilesLoading:16,this.pixelRatio_=e.pixelRatio!==void 0?e.pixelRatio:Gb,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Kt(),this.pixelToCoordinateTransform_=Kt(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,ln||(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_=e.moveTolerance,this.keyboardEventTarget_=t.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,ln||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(ln?new Sn:ly()),this.interactions=t.interactions||(ln?new Sn:py({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new ay(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener($t.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener($t.VIEW,this.handleViewChanged_),this.addChangeListener($t.SIZE,this.handleSizeChanged_),this.addChangeListener($t.TARGET,this.handleTargetChanged_),this.setProperties(t.values);const i=this;e.view&&!(e.view instanceof yi)&&e.view.then(function(s){i.setView(new yi(s))}),this.controls.addEventListener(an.ADD,s=>{s.element.setMap(this)}),this.controls.addEventListener(an.REMOVE,s=>{s.element.setMap(null)}),this.interactions.addEventListener(an.ADD,s=>{s.element.setMap(this)}),this.interactions.addEventListener(an.REMOVE,s=>{s.element.setMap(null)}),this.overlays_.addEventListener(an.ADD,s=>{this.addOverlayInternal_(s.element)}),this.overlays_.addEventListener(an.REMOVE,s=>{const o=s.element.getId();o!==void 0&&delete this.overlayIdIndex_[o.toString()],s.element.setMap(null)}),this.controls.forEach(s=>{s.setMap(this)}),this.interactions.forEach(s=>{s.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(e){this.getControls().push(e)}addInteraction(e){this.getInteractions().push(e)}addLayer(e){this.getLayerGroup().getLayers().push(e)}handleLayerAdd_(e){my(e.layer,this)}addOverlay(e){this.getOverlays().push(e)}addOverlayInternal_(e){const t=e.getId();t!==void 0&&(this.overlayIdIndex_[t.toString()]=e),e.setMap(this)}disposeInternal(){var e;this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),(e=this.resizeObserver_)==null||e.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(e,t,i){if(!this.frameState_||!this.renderer_)return;const s=this.getCoordinateFromPixelInternal(e);i=i!==void 0?i:{};const o=i.hitTolerance!==void 0?i.hitTolerance:0,r=i.layerFilter!==void 0?i.layerFilter:Kr,a=i.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(s,this.frameState_,o,a,t,null,r,null)}getFeaturesAtPixel(e,t){const i=[];return this.forEachFeatureAtPixel(e,function(s){i.push(s)},t),i}getAllLayers(){const e=[];function t(i){i.forEach(function(s){s instanceof Ts?t(s.getLayers()):e.push(s)})}return t(this.getLayers()),e}hasFeatureAtPixel(e,t){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(e);t=t!==void 0?t:{};const s=t.layerFilter!==void 0?t.layerFilter:Kr,o=t.hitTolerance!==void 0?t.hitTolerance:0,r=t.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,o,r,s,null)}getEventCoordinate(e){return this.getCoordinateFromPixel(this.getEventPixel(e))}getEventCoordinateInternal(e){return this.getCoordinateFromPixelInternal(this.getEventPixel(e))}getEventPixel(e){const i=this.viewport_.getBoundingClientRect(),s=this.getSize(),o=i.width/s[0],r=i.height/s[1],a="changedTouches"in e?e.changedTouches[0]:e;return[(a.clientX-i.left)/o,(a.clientY-i.top)/r]}getTarget(){return this.get($t.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return Yu(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){const t=this.frameState_;return t?_t(t.pixelToCoordinateTransform,e.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(e){const t=this.overlayIdIndex_[e.toString()];return t!==void 0?t:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get($t.LAYERGROUP)}setLayers(e){const t=this.getLayerGroup();if(e instanceof Sn){t.setLayers(e);return}const i=t.getLayers();i.clear(),i.extend(e)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const e=this.getLayerGroup().getLayerStatesArray();for(let t=0,i=e.length;t<i;++t){const s=e[t];if(!s.visible)continue;const o=s.layer.getRenderer();if(o&&!o.ready)return!0;const r=s.layer.getSource();if(r&&r.loading)return!0}return!1}getPixelFromCoordinate(e){const t=ki(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){const t=this.frameState_;return t?_t(t.coordinateToPixelTransform,e.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(e){this.pixelRatio_!==e&&(this.pixelRatio_=e,this.render())}getRenderer(){return this.renderer_}getSize(){return this.get($t.SIZE)}getView(){return this.get($t.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const e=this.getTargetElement();return e?e.ownerDocument:document}getTilePriority(e,t,i,s){return YC(this.frameState_,e,t,i,s)}handleBrowserEvent(e,t){t=t||e.type;const i=new xs(t,this,e);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(e){if(!this.frameState_)return;const t=e.originalEvent,i=t.type;if(i===Zd.POINTERDOWN||i===we.WHEEL||i===we.KEYDOWN){const s=this.getOwnerDocument(),o=this.viewport_.getRootNode?this.viewport_.getRootNode():s,r=t.target,a=o instanceof ShadowRoot?o.host===r?o.host.ownerDocument:o:o===s?s.documentElement:o;if(this.overlayContainerStopEvent_.contains(r)||!a.contains(r))return}if(e.frameState=this.frameState_,this.dispatchEvent(e)!==!1){const s=this.getInteractions().getArray().slice();for(let o=s.length-1;o>=0;o--){const r=s[o];if(r.getMap()!==this||!r.getActive()||!this.getTargetElement())continue;if(!r.handleEvent(e)||e.propagationStopped)break}}}handlePostRender(){const e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let s=this.maxTilesLoading_,o=s;if(e){const r=e.viewHints;if(r[ot.ANIMATING]||r[ot.INTERACTING]){const a=Date.now()-e.time>8;s=a?0:8,o=a?0:2}}t.getTilesLoading()<s&&(t.reprioritize(),t.loadMoreTiles(s,o))}e&&this.renderer_&&!e.animate&&(this.renderComplete_?(this.hasListener(Tn.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Tn.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new ar(Ps.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new ar(Ps.LOADSTART,this,e))));const i=this.postRenderFunctions_;if(e)for(let s=0,o=i.length;s<o;++s)i[s](this,e);i.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){var i,s;if(this.mapBrowserEventHandler_){for(let o=0,r=this.targetChangeHandlerKeys_.length;o<r;++o)st(this.targetChangeHandlerKeys_[o]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(we.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(we.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!ys(this.targetElement_)){(i=this.resizeObserver_)==null||i.unobserve(this.targetElement_);const o=this.targetElement_.getRootNode();o instanceof ShadowRoot&&this.resizeObserver_.unobserve(o.host),this.setSize(void 0)}const e=this.getTarget(),t=typeof e=="string"?document.getElementById(e):e;if(this.targetElement_=t,!t)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{if(ys(t)||t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new bx(this)),!ys(t)){this.mapBrowserEventHandler_=new HC(this,this.moveTolerance_);for(const r in vt)this.mapBrowserEventHandler_.addEventListener(vt[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(we.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(we.WHEEL,this.boundHandleBrowserEvent_,Hm?{passive:!1}:!1);let o;if(this.keyboardEventTarget_)o=this.keyboardEventTarget_;else{const r=t.getRootNode();o=r instanceof ShadowRoot?r.host:t}if(this.targetChangeHandlerKeys_=[qe(o,we.KEYDOWN,this.handleBrowserEvent,this),qe(o,we.KEYPRESS,this.handleBrowserEvent,this)],t instanceof HTMLElement){const r=t.getRootNode();r instanceof ShadowRoot&&this.resizeObserver_.observe(r.host),(s=this.resizeObserver_)==null||s.observe(t)}}this.updateSize()}}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(st(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(st(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=qe(e,Vo.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=qe(e,we.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(st),this.layerGroupPropertyListenerKeys_=null);const e=this.getLayerGroup();e&&(this.handleLayerAdd_(new Rs("addlayer",e)),this.layerGroupPropertyListenerKeys_=[qe(e,Vo.PROPERTYCHANGE,this.render,this),qe(e,we.CHANGE,this.render,this),qe(e,"addlayer",this.handleLayerAdd_,this),qe(e,"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 e=this.frameState_.layerStatesArray;for(let t=0,i=e.length;t<i;++t){const s=e[t].layer;s.hasRenderer()&&s.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(e){return this.getControls().remove(e)}removeInteraction(e){return this.getInteractions().remove(e)}removeLayer(e){return this.getLayerGroup().getLayers().remove(e)}handleLayerRemove_(e){gy(e.layer)}removeOverlay(e){return this.getOverlays().remove(e)}renderFrame_(e){const t=this.getSize(),i=this.getView(),s=this.frameState_;let o=null;if(t!==void 0&&E0(t)&&i&&i.isDef()){const r=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=i.getState();if(o={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:Kl(a.center,a.resolution,a.rotation,t),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:t,tileQueue:this.tileQueue_,time:e,usedTiles:{},viewState:a,viewHints:r,wantedTiles:{},mapId:Re(this),renderTargets:{}},a.nextCenter&&a.nextResolution){const l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;o.nextExtent=Kl(a.nextCenter,a.nextResolution,l,t)}}this.frameState_=o,this.renderer_.renderFrame(o),o&&(o.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,o.postRenderFunctions),s&&(!this.previousExtent_||!zi(this.previousExtent_)&&!Li(o.extent,this.previousExtent_))&&(this.dispatchEvent(new ar(Ps.MOVESTART,this,s)),this.previousExtent_=Wo(this.previousExtent_)),this.previousExtent_&&!o.viewHints[ot.ANIMATING]&&!o.viewHints[ot.INTERACTING]&&!Li(o.extent,this.previousExtent_)&&(this.dispatchEvent(new ar(Ps.MOVEEND,this,o)),Hg(o.extent,this.previousExtent_))),this.dispatchEvent(new ar(Ps.POSTRENDER,this,o)),this.renderComplete_=(this.hasListener(Ps.LOADSTART)||this.hasListener(Ps.LOADEND)||this.hasListener(Tn.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(e){const t=this.getLayerGroup();t&&this.handleLayerRemove_(new Rs("removelayer",t)),this.set($t.LAYERGROUP,e)}setSize(e){this.set($t.SIZE,e)}setTarget(e){this.set($t.TARGET,e)}setView(e){if(!e||e instanceof yi){this.set($t.VIEW,e);return}this.set($t.VIEW,new yi);const t=this;e.then(function(i){t.setView(new yi(i))})}updateSize(){const e=this.getTargetElement();let t;if(e){let s,o;if(ys(e)){const r=e.getContext("2d").getTransform();s=e.width/r.a,o=e.height/r.d}else{const r=getComputedStyle(e);s=e.offsetWidth-parseFloat(r.borderLeftWidth)-parseFloat(r.paddingLeft)-parseFloat(r.paddingRight)-parseFloat(r.borderRightWidth),o=e.offsetHeight-parseFloat(r.borderTopWidth)-parseFloat(r.paddingTop)-parseFloat(r.paddingBottom)-parseFloat(r.borderBottomWidth)}!isNaN(s)&&!isNaN(o)&&(t=[Math.max(0,s),Math.max(0,o)],!E0(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&lm("No map visible because the map container's width or height are 0."))}const i=this.getSize();t&&(!i||!us(t,i))&&(this.setSize(t),this.updateViewportSize_(t))}updateViewportSize_(e){const t=this.getView();t&&t.setViewportSize(e)}};function Ex(n){let e=null;n.keyboardEventTarget!==void 0&&(e=typeof n.keyboardEventTarget=="string"?document.getElementById(n.keyboardEventTarget):n.keyboardEventTarget);const t={},i=n.layers&&typeof n.layers.getLayers=="function"?n.layers:new Ts({layers:n.layers});t[$t.LAYERGROUP]=i,t[$t.TARGET]=n.target,t[$t.VIEW]=n.view instanceof yi?n.view:new yi;let s;n.controls!==void 0&&(Array.isArray(n.controls)?s=new Sn(n.controls.slice()):(Be(typeof n.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),s=n.controls));let o;n.interactions!==void 0&&(Array.isArray(n.interactions)?o=new Sn(n.interactions.slice()):(Be(typeof n.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),o=n.interactions));let r;return n.overlays!==void 0?Array.isArray(n.overlays)?r=new Sn(n.overlays.slice()):(Be(typeof n.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),r=n.overlays):r=new Sn,{controls:s,interactions:o,keyboardEventTarget:e,overlays:r,values:t}}class sf{constructor(e,t,i,s){this.minX=e,this.maxX=t,this.minY=i,this.maxY=s}contains(e){return this.containsXY(e[1],e[2])}containsTileRange(e){return this.minX<=e.minX&&e.maxX<=this.maxX&&this.minY<=e.minY&&e.maxY<=this.maxY}containsXY(e,t){return this.minX<=e&&e<=this.maxX&&this.minY<=t&&t<=this.maxY}equals(e){return this.minX==e.minX&&this.minY==e.minY&&this.maxX==e.maxX&&this.maxY==e.maxY}extend(e){e.minX<this.minX&&(this.minX=e.minX),e.maxX>this.maxX&&(this.maxX=e.maxX),e.minY<this.minY&&(this.minY=e.minY),e.maxY>this.maxY&&(this.maxY=e.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(e){return this.minX<=e.maxX&&this.maxX>=e.minX&&this.minY<=e.maxY&&this.maxY>=e.minY}}function cr(n,e,t,i,s){return s!==void 0?(s.minX=n,s.maxX=e,s.minY=t,s.maxY=i,s):new sf(n,e,t,i)}const _y=[];class Cx extends Fa{constructor(e,t,i,s,o){super(e,t,{transition:0}),this.context_=null,this.executorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.replayState_={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=s.bind(void 0,this),this.removeSourceTiles_=o,this.wrappedTileCoord=i}getContext(){return this.context_||(this.context_=ht(1,1,_y)),this.context_}hasContext(){return!!this.context_}getImage(){return this.hasContext()?this.getContext().canvas:null}getReplayState(e){const t=Re(e);return t in this.replayState_||(this.replayState_[t]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedPixelRatio:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.replayState_[t]}load(){this.getSourceTiles()}release(){this.context_&&(ca(this.context_),_y.push(this.context_.canvas),this.context_=null),this.removeSourceTiles_(this),this.sourceTiles.length=0,super.release()}}let xx=class extends Fa{constructor(e,t,i,s,o,r){super(e,t,r),this.extent=null,this.format_=s,this.features_=null,this.loader_,this.projection=null,this.resolution,this.tileLoadFunction_=o,this.url_=i,this.key=i}getTileUrl(){return this.url_}getFormat(){return this.format_}getFeatures(){return this.features_}load(){this.state==oe.IDLE&&(this.setState(oe.LOADING),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))}onLoad(e,t){this.setFeatures(e)}onError(){this.setState(oe.ERROR)}setFeatures(e){this.features_=e,this.setState(oe.LOADED)}setLoader(e){this.loader_=e}};async function wy(n,e=128,t=128,i="map",s=1){return new Promise((o,r)=>{n.renderSync();try{const a=n.getSize()||[e,t],l=document.createElement("canvas"),c=a[0]*s,h=a[1]*s;l.width=c,l.height=h;const u=l.getContext("2d",{willReadFrequently:!0});if(!u)throw new Error("Failed to create canvas context");Array.from(n.getViewport().querySelectorAll(".ol-layer canvas, canvas.ol-layer")).filter(g=>{if(!(g instanceof HTMLCanvasElement)||g.width===0)return!1;try{return g.toDataURL("image/png"),!0}catch{return console.warn("跳过跨域图层:",g),!1}}).forEach(g=>{var w;const _=parseFloat(g.style.opacity||"1");u.globalAlpha=_;let v=[1,0,0,1,0,0];const E=g.style.transform;if(E){const[C,P,R,A,O,M]=((w=E.match(/^matrix\(([^)]+)\)$/))==null?void 0:w[1].split(",").map(Number))||[1,0,0,1,0,0];u.setTransform({a:C,b:P,c:R,d:A,e:O,f:M})}u.drawImage(g,0,0,c,h)}),u.globalAlpha=1,u.setTransform(1,0,0,1,0,0);const f=l.toDataURL("image/png");o(f)}catch(a){r(a)}})}function vy(n,e){const{center:t,orbitPeriod:i,heading:s=0}=e,o=n.getView(),a=(d=>d*Math.PI/180)(s);let l,c,h=!0;const u=d=>{c||(c=d);const g=(d-c)%i/i,_=2*Math.PI*g+a;o.setRotation(-_),n.render(),h&&(l=requestAnimationFrame(u))};return l=requestAnimationFrame(u),{stop(){h=!1,cancelAnimationFrame(l),o.setRotation(0)}}}function Px(n,e){const t=Me(e),i=new Rn({geometry:new yn(t)});i.setStyle(new Xe({image:new An({radius:6,fill:new wt({color:"red"}),stroke:new St({color:"white",width:2})}),text:new nr({text:"中心点可视化-测试后删除",font:"14px sans-serif",fill:new wt({color:"black"}),stroke:new St({color:"white",width:3}),offsetY:-15})}));const s=new Mn({source:new _n({features:[i]})});n.addLayer(s)}class by extends p.Destroyable{constructor(t,i,s){super();I(this,"keysPressed",{w:!1,a:!1,s:!1,d:!1});I(this,"animationId",0);I(this,"view");I(this,"updatePosition",()=>{const t=this.view.getCenter();if(!t)return;const i=this.view.getZoom()??10,s=1e3/Math.pow(2,i-10);let[o,r]=t;this.keysPressed.w&&(r+=s),this.keysPressed.s&&(r-=s),this.keysPressed.a&&(o-=s),this.keysPressed.d&&(o+=s),this.view.setCenter([o,r]),this.animationId=requestAnimationFrame(this.updatePosition)});this.map=i,this.view=i.getView(),this.view.setCenter(Me(s));const o=l=>{l.key in this.keysPressed&&(this.keysPressed[l.key]=!0)},r=l=>{l.key in this.keysPressed&&(this.keysPressed[l.key]=!1)},a=l=>{l.preventDefault();const c=this.view.getZoom()??10,h=l.deltaY>0?-1:1;this.view.setZoom(c+h)};t.addEventListener("keydown",o),t.addEventListener("keyup",r),i.getTargetElement().addEventListener("wheel",a,{passive:!1}),this.d(()=>t.removeEventListener("keydown",o)),this.d(()=>t.removeEventListener("keyup",r)),this.d(()=>i.getTargetElement().removeEventListener("wheel",a)),this.animationId=requestAnimationFrame(this.updatePosition),this.d(()=>cancelAnimationFrame(this.animationId))}}function Sx(n){const t=Math.PI/3,i=256,s=n*2*Math.tan(t/2)/n,o=Math.log2(2*Math.PI*6378137/(s*i));return parseFloat(o.toFixed(3))}function ka(n){return 6378137/Math.pow(2,n-5)}function mo(n){const t=Math.log2(6378137/n)+5+0;return Math.min(28,Math.max(0,t))}class Ey extends p.Destroyable{constructor(t){super();I(this,"lastTime",performance.now());I(this,"frameCount",0);I(this,"currentFPS",0);I(this,"map");I(this,"calculateFPS",()=>{const t=performance.now();this.frameCount++,t-this.lastTime>=1e3&&(this.currentFPS=Math.round(this.frameCount*1e3/(t-this.lastTime)),this.frameCount=0,this.lastTime=t)});this.map=t,this.map.on("postrender",this.calculateFPS),this.d(()=>{this.map.un("postrender",this.calculateFPS)})}getFPS(){return this.currentFPS}}const Cy=[0,-90,0];function xy(n,e){const t=n.viewer;if(!t)return;const i=t.getView(),{position:s,rotation:o,duration:r=1e3,hdelta:a,pdelta:l,cancelCallback:c}=e;if(!s)return;const[h,u,d]=s,f=Me([h,u]),g=(mo==null?void 0:mo(d))??i.getZoom(),v=(((o==null?void 0:o[0])??0)+(a??0))*Math.PI/180,E={center:f,zoom:g,rotation:-v,duration:r};try{return i.animate(E,()=>{}),Promise.resolve(!0)}catch{return c==null||c(),Promise.resolve(!1)}}function Bi(n,e,t,i,s,o){return(n==null?void 0:n.viewer)&&xy(n,{position:e,rotation:i,duration:s&&s*1e3,cancelCallback:o})}function qc(n){const e=n.map(t=>Me([t[0],t[1]]));return Hr(e)}const ja=(n,e,t=1,i=350)=>{n.getView().fit(e,{duration:t*1e3,padding:Array.isArray(i)?i:[i,i,i,i]})},Rx=(n,e,t=1,i=350)=>{const s=qc(e);ja(n,s,t,i)},of=(n,e,t=1,i=350)=>{const s=Me([e[0],e[1]]),o=Hr([s]);ja(n,o,t,i)},Tx=(n,e,t)=>{};function Py(n,e){const t=n.viewer;if(!t)throw new Error("viewer.map is undefined");const i=t.getView(),s=i.getCenter();if(!s)throw new Error("view center is undefined");const o=i.getZoom(),r=(ka==null?void 0:ka(o??0))??0;return[s[0],s[1],r]}class Ix extends p.Destroyable{constructor(t,i){super();I(this,"_map");I(this,"_view");I(this,"_enabled",!0);I(this,"_keys",[]);I(this,"_changed",new p.Event);I(this,"_options");I(this,"_rafPending",!1);I(this,"_rafId",null);I(this,"_lastEmit",0);if(this._options={emitImmediately:!0,usePostRender:!1,throttleMs:0,useRaf:!0,...i},t instanceof Mi.Map){this._map=t;const s=this._map.getView();if(!s)throw new Error("OlViewChanged: map.getView() is undefined");this._view=s}else this._view=t;this._attach(),this.dispose(()=>this._detach()),this._options.emitImmediately&&this._emit()}get changed(){return this._changed}get enabled(){return this._enabled}set enabled(t){this._enabled!==t&&(this._enabled=t,t&&this._emit())}attachMap(t){this._map!==t&&(this._detach(),this._map=t,this._attach(),this._emit())}_on(t,i,s){const o=t.on(i,s);return this._keys.push(o),this.dispose(()=>ui(o)),o}_attach(){this._on(this._view,"change:center",()=>this._scheduleEmit()),this._on(this._view,"change:resolution",()=>this._scheduleEmit()),this._on(this._view,"change:rotation",()=>this._scheduleEmit()),this._map&&(this._on(this._map,"change:size",()=>this._scheduleEmit()),this._options.usePostRender&&this._on(this._map,"postrender",()=>this._scheduleEmit()))}_detach(){this._keys.forEach(ui),this._keys.length=0,this._rafId!=null&&(cancelAnimationFrame(this._rafId),this._rafId=null,this._rafPending=!1)}_scheduleEmit(){if(this._enabled){if(this._options.useRaf){if(this._rafPending)return;this._rafPending=!0,this._rafId=requestAnimationFrame(()=>{this._rafPending=!1,this._rafId=null,this._emitWithThrottle()});return}this._emitWithThrottle()}}_emitWithThrottle(){const t=performance.now();this._options.throttleMs>0&&t-this._lastEmit<this._options.throttleMs||(this._lastEmit=t,this._emit())}_emit(){this._enabled&&this._changed.emit()}}async function Sy(n,e,t,i){if(!n)throw new Error("olMap is undefined");await Promise.resolve();const s=n.getEventPixel(e);if(!s)return;const o=n.getCoordinateFromPixel(s);if(!o)return;const[r,a]=Ft(o),l=t??0;return i?(i[0]=r,i[1]=a,i[2]=l,i):[r,a,l]}function Ry(n,e,t,i,s,o){s.constraintMode="none",s.startDragPos=[0,0,0];const r=e.getEventPixel(n),a=e.getCoordinateFromPixel(r);if(!a)return!1;const l=Ft(a),c=[l[0],l[1],t.position[2]],h=t.position,u=t.heading,d=Ox(e,i,h),f=(g,_)=>{const v=Ax(h,c,g),E=p.geoRhumbDistance(h,c);if(v>.98&&E<d&&!(o!=null&&o[_])){s.constraintMode=_;const w=p.geoRhumbDestination(h,E,g);if(w)return s.startDragPos=[w[0],w[1],h[2]],!0}return!1};return f(u+90,"x")||f(u,"y")?!0:!(o!=null&&o.xy)&&p.geoRhumbDistance(h,c)<d?(s.constraintMode="xy",s.startDragPos=c,!0):!1}function Ox(n,e,t){const i=n.getPixelFromCoordinate(Me([t[0],t[1]])),s=[i[0]+e,i[1]],o=Ft(n.getCoordinateFromPixel(s));return p.geoRhumbDistance([t[0],t[1],0],[o[0],o[1],0])}function Ax(n,e,t){const i=p.geoRhumbHeading(n,e),s=t*Math.PI/180,o=i*Math.PI/180;return Math.cos(s)*Math.cos(o)+Math.sin(s)*Math.sin(o)}function Is(n,e,t,i){const s=p.geoRhumbDistance(n,t),o=p.geoRhumbHeading(n,t),r=Math.cos(o*Math.PI/180)*Math.cos(e*Math.PI/180)+Math.sin(o*Math.PI/180)*Math.sin(e*Math.PI/180);return r>0?p.geoRhumbDestination(n,s,e,i):p.geoRhumbDestination(n,s,e+180,i),[r>0?s:-s,i]}function Mx(n,e,t){const i=t*.1,s=[];for(let o=-9;o<10;++o){const r=p.geoRhumbDestination(n,i*o,e);r&&s.push(r)}return s}function Dx(n,e){return p.geoNearestPointOnLine(n,e).geometry.coordinates}function Fx(n,e,t,i=10){const s={constraintMode:"none",startDragPos:[0,0,0]},o=n.getPixelFromCoordinate(Me([t.position[0],t.position[1]])),r=n.getEventPixel(e),a=r[0]-o[0],l=r[1]-o[1],h=(Math.atan2(-l,a)*(180/Math.PI)-t.heading+360)%360;Math.abs(a)<i&&Math.abs(l)<i?s.constraintMode="xy":h>=75&&h<=105||h>=255&&h<=285?s.constraintMode="y":h<=15||h>=345||h>=165&&h<=195?s.constraintMode="x":s.constraintMode="xy";const[u,d]=Ft(n.getCoordinateFromPixel(r));return s.startDragPos=[u,d,t.position[2]],s}function Lx(n,e,t){const i=n.getPixelFromCoordinate(e),s=[i[0]+t,i[1]],o=n.getCoordinateFromPixel(s);if(!o)return 1/0;const[r,a]=Ft(o),[l,c]=Ft(e);return Math.abs(p.geoRhumbDistance([l,c,0],[r,a,0]))}function Ty(n,e,t,i,s,o){const r=s-t,a=o-i,l=n-t,c=e-i,h=r*l+a*c;if(h<=0)return Math.hypot(n-t,e-i);const u=r*r+a*a;if(u<=h)return Math.hypot(n-s,e-o);const d=h/u,f=t+d*r,g=i+d*a;return Math.hypot(n-f,e-g)}function Iy(n,e,t,i=8,s,o){const r=s??{constraintMode:"none",startDragPos:[0,0,0]};r.constraintMode="none",r.startDragPos=[0,0,0];const a=Me([t.position[0],t.position[1]]),l=n.getPixelFromCoordinate(a);if(!l)return r;const c=n.getEventPixel(e),[h,u]=c,d=Math.max(1e-6,t.dimensions[0]),f=t.heading,g=p.geoRhumbDestination(t.position,d,f+90),_=p.geoRhumbDestination(t.position,d,f+0);if(!g||!_)return r;const v=a,E=a,w=Me([g[0],g[1]]),C=Me([_[0],_[1]]),P=n.getPixelFromCoordinate(v),R=n.getPixelFromCoordinate(w),A=n.getPixelFromCoordinate(E),O=n.getPixelFromCoordinate(C),M=Lx(n,a,i),k=Math.hypot(h-l[0],u-l[1])<=i,q=Ty(h,u,P[0],P[1],R[0],R[1]),Y=Ty(h,u,A[0],A[1],O[0],O[1]);if(!(o!=null&&o.zAxis)){const S=d,L=p.geoRhumbDestination(t.position,S,f);if(!L)return r;const N=n.getPixelFromCoordinate(Me([L[0],L[1]]));Math.hypot(N[0]-l[0],N[1]-l[1])}let m="none";!(o!=null&&o.x)&&q<=i&&q<Y&&(m="x"),!(o!=null&&o.y)&&Y<=i&&Y<q&&(m="y");const b=Ft(n.getCoordinateFromPixel(c));if(m==="x"||m==="y"){const S=m==="x"?f+90:f+0,[L,N]=Is(t.position,S,[b[0],b[1],t.position[2]]);if(L>0&&N&&p.geoDistance(N,[b[0],b[1],t.position[2]])<=M)return r.constraintMode=m,r.startDragPos=[N[0],N[1],t.position[2]],r}return!(o!=null&&o.xy)&&(k||!0)&&(r.constraintMode="xy",r.startDragPos=[b[0],b[1],t.position[2]]),r}class Oy extends p.Destroyable{constructor(e,t,i,s=100){super();const o=e.getView(),[r,a]=p.getReactFuncs(i),l=()=>{const h=o.getZoom()??0,u=s*Math.pow(2,10-h);a([u,u,u])};l();const c=()=>l();o.on("change:resolution",c),this.ad(()=>o.un("change:resolution",c))}}function x(n){return n!=null}function $(n){this.name="DeveloperError",this.message=n;let e;try{throw new Error}catch(t){e=t.stack}this.stack=e}x(Object.create)&&($.prototype=Object.create(Error.prototype),$.prototype.constructor=$),$.prototype.toString=function(){let n=`${this.name}: ${this.message}`;return x(this.stack)&&(n+=`
27
+ ${this.stack.toString()}`),n},$.throwInstantiationError=function(){throw new $("This function defines an interface and should not be called directly.")};const y={};y.typeOf={};function zx(n){return`${n} is required, actual value was undefined`}function hr(n,e,t){return`Expected ${t} to be typeof ${e}, actual typeof was ${n}`}y.defined=function(n,e){if(!x(e))throw new $(zx(n))},y.typeOf.func=function(n,e){if(typeof e!="function")throw new $(hr(typeof e,"function",n))},y.typeOf.string=function(n,e){if(typeof e!="string")throw new $(hr(typeof e,"string",n))},y.typeOf.number=function(n,e){if(typeof e!="number")throw new $(hr(typeof e,"number",n))},y.typeOf.number.lessThan=function(n,e,t){if(y.typeOf.number(n,e),e>=t)throw new $(`Expected ${n} to be less than ${t}, actual value was ${e}`)},y.typeOf.number.lessThanOrEquals=function(n,e,t){if(y.typeOf.number(n,e),e>t)throw new $(`Expected ${n} to be less than or equal to ${t}, actual value was ${e}`)},y.typeOf.number.greaterThan=function(n,e,t){if(y.typeOf.number(n,e),e<=t)throw new $(`Expected ${n} to be greater than ${t}, actual value was ${e}`)},y.typeOf.number.greaterThanOrEquals=function(n,e,t){if(y.typeOf.number(n,e),e<t)throw new $(`Expected ${n} to be greater than or equal to ${t}, actual value was ${e}`)},y.typeOf.object=function(n,e){if(typeof e!="object")throw new $(hr(typeof e,"object",n))},y.typeOf.bool=function(n,e){if(typeof e!="boolean")throw new $(hr(typeof e,"boolean",n))},y.typeOf.bigint=function(n,e){if(typeof e!="bigint")throw new $(hr(typeof e,"bigint",n))},y.typeOf.number.equals=function(n,e,t,i){if(y.typeOf.number(n,t),y.typeOf.number(e,i),t!==i)throw new $(`${n} must be equal to ${e}, the actual values are ${t} and ${i}`)};var Ay=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function My(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var rf,Dy;function Nx(){if(Dy)return rf;Dy=1;var n=function(e){e==null&&(e=new Date().getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,e.constructor==Array?this.init_by_array(e,e.length):this.init_seed(e)};return n.prototype.init_seed=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){var e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(((e&4294901760)>>>16)*1812433253<<16)+(e&65535)*1812433253+this.mti,this.mt[this.mti]>>>=0}},n.prototype.init_by_array=function(e,t){var i,s,o;for(this.init_seed(19650218),i=1,s=0,o=this.N>t?this.N:t;o;o--){var r=this.mt[i-1]^this.mt[i-1]>>>30;this.mt[i]=(this.mt[i]^(((r&4294901760)>>>16)*1664525<<16)+(r&65535)*1664525)+e[s]+s,this.mt[i]>>>=0,i++,s++,i>=this.N&&(this.mt[0]=this.mt[this.N-1],i=1),s>=t&&(s=0)}for(o=this.N-1;o;o--){var r=this.mt[i-1]^this.mt[i-1]>>>30;this.mt[i]=(this.mt[i]^(((r&4294901760)>>>16)*1566083941<<16)+(r&65535)*1566083941)-i,this.mt[i]>>>=0,i++,i>=this.N&&(this.mt[0]=this.mt[this.N-1],i=1)}this.mt[0]=2147483648},n.prototype.random_int=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var i;for(this.mti==this.N+1&&this.init_seed(5489),i=0;i<this.N-this.M;i++)e=this.mt[i]&this.UPPER_MASK|this.mt[i+1]&this.LOWER_MASK,this.mt[i]=this.mt[i+this.M]^e>>>1^t[e&1];for(;i<this.N-1;i++)e=this.mt[i]&this.UPPER_MASK|this.mt[i+1]&this.LOWER_MASK,this.mt[i]=this.mt[i+(this.M-this.N)]^e>>>1^t[e&1];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[e&1],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=e<<7&2636928640,e^=e<<15&4022730752,e^=e>>>18,e>>>0},n.prototype.random_int31=function(){return this.random_int()>>>1},n.prototype.random_incl=function(){return this.random_int()*23283064370807974e-26},n.prototype.random=function(){return this.random_int()*23283064365386963e-26},n.prototype.random_excl=function(){return(this.random_int()+.5)*23283064365386963e-26},n.prototype.random_long=function(){var e=this.random_int()>>>5,t=this.random_int()>>>6;return(e*67108864+t)*11102230246251565e-32},rf=n,rf}var kx=Nx();const Fy=My(kx),F={};F.EPSILON1=.1,F.EPSILON2=.01,F.EPSILON3=.001,F.EPSILON4=1e-4,F.EPSILON5=1e-5,F.EPSILON6=1e-6,F.EPSILON7=1e-7,F.EPSILON8=1e-8,F.EPSILON9=1e-9,F.EPSILON10=1e-10,F.EPSILON11=1e-11,F.EPSILON12=1e-12,F.EPSILON13=1e-13,F.EPSILON14=1e-14,F.EPSILON15=1e-15,F.EPSILON16=1e-16,F.EPSILON17=1e-17,F.EPSILON18=1e-18,F.EPSILON19=1e-19,F.EPSILON20=1e-20,F.EPSILON21=1e-21,F.GRAVITATIONALPARAMETER=3986004418e5,F.SOLAR_RADIUS=6955e5,F.LUNAR_RADIUS=1737400,F.SIXTY_FOUR_KILOBYTES=65536,F.FOUR_GIGABYTES=4294967296,F.sign=Math.sign??function(e){return e=+e,e===0||e!==e?e:e>0?1:-1},F.signNotZero=function(n){return n<0?-1:1},F.toSNorm=function(n,e){return e=e??255,Math.round((F.clamp(n,-1,1)*.5+.5)*e)},F.fromSNorm=function(n,e){return e=e??255,F.clamp(n,0,e)/e*2-1},F.normalize=function(n,e,t){return t=Math.max(t-e,0),t===0?0:F.clamp((n-e)/t,0,1)},F.sinh=Math.sinh??function(e){return(Math.exp(e)-Math.exp(-e))/2},F.cosh=Math.cosh??function(e){return(Math.exp(e)+Math.exp(-e))/2},F.lerp=function(n,e,t){return(1-t)*n+t*e},F.PI=Math.PI,F.ONE_OVER_PI=1/Math.PI,F.PI_OVER_TWO=Math.PI/2,F.PI_OVER_THREE=Math.PI/3,F.PI_OVER_FOUR=Math.PI/4,F.PI_OVER_SIX=Math.PI/6,F.THREE_PI_OVER_TWO=3*Math.PI/2,F.TWO_PI=2*Math.PI,F.ONE_OVER_TWO_PI=1/(2*Math.PI),F.RADIANS_PER_DEGREE=Math.PI/180,F.DEGREES_PER_RADIAN=180/Math.PI,F.RADIANS_PER_ARCSECOND=F.RADIANS_PER_DEGREE/3600,F.toRadians=function(n){if(!x(n))throw new $("degrees is required.");return n*F.RADIANS_PER_DEGREE},F.toDegrees=function(n){if(!x(n))throw new $("radians is required.");return n*F.DEGREES_PER_RADIAN},F.convertLongitudeRange=function(n){if(!x(n))throw new $("angle is required.");const e=F.TWO_PI,t=n-Math.floor(n/e)*e;return t<-Math.PI?t+e:t>=Math.PI?t-e:t},F.clampToLatitudeRange=function(n){if(!x(n))throw new $("angle is required.");return F.clamp(n,-1*F.PI_OVER_TWO,F.PI_OVER_TWO)},F.negativePiToPi=function(n){if(!x(n))throw new $("angle is required.");return n>=-F.PI&&n<=F.PI?n:F.zeroToTwoPi(n+F.PI)-F.PI},F.zeroToTwoPi=function(n){if(!x(n))throw new $("angle is required.");if(n>=0&&n<=F.TWO_PI)return n;const e=F.mod(n,F.TWO_PI);return Math.abs(e)<F.EPSILON14&&Math.abs(n)>F.EPSILON14?F.TWO_PI:e},F.mod=function(n,e){if(!x(n))throw new $("m is required.");if(!x(e))throw new $("n is required.");if(e===0)throw new $("divisor cannot be 0.");return F.sign(n)===F.sign(e)&&Math.abs(n)<Math.abs(e)?n:(n%e+e)%e},F.equalsEpsilon=function(n,e,t,i){if(!x(n))throw new $("left is required.");if(!x(e))throw new $("right is required.");t=t??0,i=i??t;const s=Math.abs(n-e);return s<=i||s<=t*Math.max(Math.abs(n),Math.abs(e))},F.lessThan=function(n,e,t){if(!x(n))throw new $("first is required.");if(!x(e))throw new $("second is required.");if(!x(t))throw new $("absoluteEpsilon is required.");return n-e<-t},F.lessThanOrEquals=function(n,e,t){if(!x(n))throw new $("first is required.");if(!x(e))throw new $("second is required.");if(!x(t))throw new $("absoluteEpsilon is required.");return n-e<t},F.greaterThan=function(n,e,t){if(!x(n))throw new $("first is required.");if(!x(e))throw new $("second is required.");if(!x(t))throw new $("absoluteEpsilon is required.");return n-e>t},F.greaterThanOrEquals=function(n,e,t){if(!x(n))throw new $("first is required.");if(!x(e))throw new $("second is required.");if(!x(t))throw new $("absoluteEpsilon is required.");return n-e>-t};const Wc=[1];F.factorial=function(n){if(typeof n!="number"||n<0)throw new $("A number greater than or equal to 0 is required.");const e=Wc.length;if(n>=e){let t=Wc[e-1];for(let i=e;i<=n;i++){const s=t*i;Wc.push(s),t=s}}return Wc[n]},F.incrementWrap=function(n,e,t){if(t=t??0,!x(n))throw new $("n is required.");if(e<=t)throw new $("maximumValue must be greater than minimumValue.");return++n,n>e&&(n=t),n},F.isPowerOfTwo=function(n){if(typeof n!="number"||n<0||n>4294967295)throw new $("A number between 0 and (2^32)-1 is required.");return n!==0&&(n&n-1)===0},F.nextPowerOfTwo=function(n){if(typeof n!="number"||n<0||n>2147483648)throw new $("A number between 0 and 2^31 is required.");return--n,n|=n>>1,n|=n>>2,n|=n>>4,n|=n>>8,n|=n>>16,++n,n},F.previousPowerOfTwo=function(n){if(typeof n!="number"||n<0||n>4294967295)throw new $("A number between 0 and (2^32)-1 is required.");return n|=n>>1,n|=n>>2,n|=n>>4,n|=n>>8,n|=n>>16,n|=n>>32,n=(n>>>0)-(n>>>1),n},F.clamp=function(n,e,t){return y.typeOf.number("value",n),y.typeOf.number("min",e),y.typeOf.number("max",t),n<e?e:n>t?t:n};let Ly=new Fy;F.setRandomNumberSeed=function(n){if(!x(n))throw new $("seed is required.");Ly=new Fy(n)},F.nextRandomNumber=function(){return Ly.random()},F.randomBetween=function(n,e){return F.nextRandomNumber()*(e-n)+n},F.acosClamped=function(n){if(!x(n))throw new $("value is required.");return Math.acos(F.clamp(n,-1,1))},F.asinClamped=function(n){if(!x(n))throw new $("value is required.");return Math.asin(F.clamp(n,-1,1))},F.chordLength=function(n,e){if(!x(n))throw new $("angle is required.");if(!x(e))throw new $("radius is required.");return 2*e*Math.sin(n*.5)},F.logBase=function(n,e){if(!x(n))throw new $("number is required.");if(!x(e))throw new $("base is required.");return Math.log(n)/Math.log(e)},F.cbrt=Math.cbrt??function(e){const t=Math.pow(Math.abs(e),.3333333333333333);return e<0?-t:t},F.log2=Math.log2??function(e){return Math.log(e)*Math.LOG2E},F.fog=function(n,e){const t=n*e;return 1-Math.exp(-(t*t))},F.fastApproximateAtan=function(n){return y.typeOf.number("x",n),n*(-.1784*Math.abs(n)-.0663*n*n+1.0301)},F.fastApproximateAtan2=function(n,e){y.typeOf.number("x",n),y.typeOf.number("y",e);let t,i=Math.abs(n);t=Math.abs(e);const s=Math.max(i,t);t=Math.min(i,t);const o=t/s;if(isNaN(o))throw new $("either x or y must be nonzero");return i=F.fastApproximateAtan(o),i=Math.abs(e)>Math.abs(n)?F.PI_OVER_TWO-i:i,i=n<0?F.PI-i:i,i=e<0?-i:i,i};class D{constructor(e,t,i){this.x=e??0,this.y=t??0,this.z=i??0}static fromSpherical(e,t){y.typeOf.object("spherical",e),x(t)||(t=new D);const i=e.clock,s=e.cone,o=e.magnitude??1,r=o*Math.sin(s);return t.x=r*Math.cos(i),t.y=r*Math.sin(i),t.z=o*Math.cos(s),t}static fromElements(e,t,i,s){return x(s)?(s.x=e,s.y=t,s.z=i,s):new D(e,t,i)}static clone(e,t){if(x(e))return x(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t):new D(e.x,e.y,e.z)}static pack(e,t,i){return y.typeOf.object("value",e),y.defined("array",t),i=i??0,t[i++]=e.x,t[i++]=e.y,t[i]=e.z,t}static unpack(e,t,i){return y.defined("array",e),t=t??0,x(i)||(i=new D),i.x=e[t++],i.y=e[t++],i.z=e[t],i}static packArray(e,t){y.defined("array",e);const i=e.length,s=i*3;if(!x(t))t=new Array(s);else{if(!Array.isArray(t)&&t.length!==s)throw new $("If result is a typed array, it must have exactly array.length * 3 elements");t.length!==s&&(t.length=s)}for(let o=0;o<i;++o)D.pack(e[o],t,o*3);return t}static unpackArray(e,t){if(y.defined("array",e),y.typeOf.number.greaterThanOrEquals("array.length",e.length,3),e.length%3!==0)throw new $("array length must be a multiple of 3.");const i=e.length;x(t)?t.length=i/3:t=new Array(i/3);for(let s=0;s<i;s+=3){const o=s/3;t[o]=D.unpack(e,s,t[o])}return t}static maximumComponent(e){return y.typeOf.object("cartesian",e),Math.max(e.x,e.y,e.z)}static minimumComponent(e){return y.typeOf.object("cartesian",e),Math.min(e.x,e.y,e.z)}static minimumByComponent(e,t,i){return y.typeOf.object("first",e),y.typeOf.object("second",t),y.typeOf.object("result",i),i.x=Math.min(e.x,t.x),i.y=Math.min(e.y,t.y),i.z=Math.min(e.z,t.z),i}static maximumByComponent(e,t,i){return y.typeOf.object("first",e),y.typeOf.object("second",t),y.typeOf.object("result",i),i.x=Math.max(e.x,t.x),i.y=Math.max(e.y,t.y),i.z=Math.max(e.z,t.z),i}static clamp(e,t,i,s){y.typeOf.object("value",e),y.typeOf.object("min",t),y.typeOf.object("max",i),y.typeOf.object("result",s);const o=F.clamp(e.x,t.x,i.x),r=F.clamp(e.y,t.y,i.y),a=F.clamp(e.z,t.z,i.z);return s.x=o,s.y=r,s.z=a,s}static magnitudeSquared(e){return y.typeOf.object("cartesian",e),e.x*e.x+e.y*e.y+e.z*e.z}static magnitude(e){return Math.sqrt(D.magnitudeSquared(e))}static distance(e,t){return y.typeOf.object("left",e),y.typeOf.object("right",t),D.subtract(e,t,Vc),D.magnitude(Vc)}static distanceSquared(e,t){return y.typeOf.object("left",e),y.typeOf.object("right",t),D.subtract(e,t,Vc),D.magnitudeSquared(Vc)}static normalize(e,t){y.typeOf.object("cartesian",e),y.typeOf.object("result",t);const i=D.magnitude(e);if(t.x=e.x/i,t.y=e.y/i,t.z=e.z/i,isNaN(t.x)||isNaN(t.y)||isNaN(t.z))throw new $("normalized result is not a number");return t}static dot(e,t){return y.typeOf.object("left",e),y.typeOf.object("right",t),e.x*t.x+e.y*t.y+e.z*t.z}static multiplyComponents(e,t,i){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",i),i.x=e.x*t.x,i.y=e.y*t.y,i.z=e.z*t.z,i}static divideComponents(e,t,i){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",i),i.x=e.x/t.x,i.y=e.y/t.y,i.z=e.z/t.z,i}static add(e,t,i){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",i),i.x=e.x+t.x,i.y=e.y+t.y,i.z=e.z+t.z,i}static subtract(e,t,i){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",i),i.x=e.x-t.x,i.y=e.y-t.y,i.z=e.z-t.z,i}static multiplyByScalar(e,t,i){return y.typeOf.object("cartesian",e),y.typeOf.number("scalar",t),y.typeOf.object("result",i),i.x=e.x*t,i.y=e.y*t,i.z=e.z*t,i}static divideByScalar(e,t,i){return y.typeOf.object("cartesian",e),y.typeOf.number("scalar",t),y.typeOf.object("result",i),i.x=e.x/t,i.y=e.y/t,i.z=e.z/t,i}static negate(e,t){return y.typeOf.object("cartesian",e),y.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t.z=-e.z,t}static abs(e,t){return y.typeOf.object("cartesian",e),y.typeOf.object("result",t),t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t}static lerp(e,t,i,s){return y.typeOf.object("start",e),y.typeOf.object("end",t),y.typeOf.number("t",i),y.typeOf.object("result",s),D.multiplyByScalar(t,i,zy),s=D.multiplyByScalar(e,1-i,s),D.add(zy,s,s)}static angleBetween(e,t){y.typeOf.object("left",e),y.typeOf.object("right",t),D.normalize(e,Bc),D.normalize(t,af);const i=D.dot(Bc,af),s=D.magnitude(D.cross(Bc,af,Bc));return Math.atan2(s,i)}static mostOrthogonalAxis(e,t){y.typeOf.object("cartesian",e),y.typeOf.object("result",t);const i=D.normalize(e,jx);return D.abs(i,i),i.x<=i.y?i.x<=i.z?t=D.clone(D.UNIT_X,t):t=D.clone(D.UNIT_Z,t):i.y<=i.z?t=D.clone(D.UNIT_Y,t):t=D.clone(D.UNIT_Z,t),t}static projectVector(e,t,i){y.defined("a",e),y.defined("b",t),y.defined("result",i);const s=D.dot(e,t)/D.dot(t,t);return D.multiplyByScalar(t,s,i)}static equals(e,t){return e===t||x(e)&&x(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z}static equalsArray(e,t,i){return e.x===t[i]&&e.y===t[i+1]&&e.z===t[i+2]}static equalsEpsilon(e,t,i,s){return e===t||x(e)&&x(t)&&F.equalsEpsilon(e.x,t.x,i,s)&&F.equalsEpsilon(e.y,t.y,i,s)&&F.equalsEpsilon(e.z,t.z,i,s)}static cross(e,t,i){y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",i);const s=e.x,o=e.y,r=e.z,a=t.x,l=t.y,c=t.z,h=o*c-r*l,u=r*a-s*c,d=s*l-o*a;return i.x=h,i.y=u,i.z=d,i}static midpoint(e,t,i){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",i),i.x=(e.x+t.x)*.5,i.y=(e.y+t.y)*.5,i.z=(e.z+t.z)*.5,i}static fromDegrees(e,t,i,s,o){return y.typeOf.number("longitude",e),y.typeOf.number("latitude",t),e=F.toRadians(e),t=F.toRadians(t),D.fromRadians(e,t,i,s,o)}static fromRadians(e,t,i,s,o){y.typeOf.number("longitude",e),y.typeOf.number("latitude",t),i=i??0;const r=x(s)?s.radiiSquared:D._ellipsoidRadiiSquared,a=Math.cos(t);Dn.x=a*Math.cos(e),Dn.y=a*Math.sin(e),Dn.z=Math.sin(t),Dn=D.normalize(Dn,Dn),D.multiplyComponents(r,Dn,ur);const l=Math.sqrt(D.dot(Dn,ur));return ur=D.divideByScalar(ur,l,ur),Dn=D.multiplyByScalar(Dn,i,Dn),x(o)||(o=new D),D.add(ur,Dn,o)}static fromDegreesArray(e,t,i){if(y.defined("coordinates",e),e.length<2||e.length%2!==0)throw new $("the number of coordinates must be a multiple of 2 and at least 2");const s=e.length;x(i)?i.length=s/2:i=new Array(s/2);for(let o=0;o<s;o+=2){const r=e[o],a=e[o+1],l=o/2;i[l]=D.fromDegrees(r,a,0,t,i[l])}return i}static fromRadiansArray(e,t,i){if(y.defined("coordinates",e),e.length<2||e.length%2!==0)throw new $("the number of coordinates must be a multiple of 2 and at least 2");const s=e.length;x(i)?i.length=s/2:i=new Array(s/2);for(let o=0;o<s;o+=2){const r=e[o],a=e[o+1],l=o/2;i[l]=D.fromRadians(r,a,0,t,i[l])}return i}static fromDegreesArrayHeights(e,t,i){if(y.defined("coordinates",e),e.length<3||e.length%3!==0)throw new $("the number of coordinates must be a multiple of 3 and at least 3");const s=e.length;x(i)?i.length=s/3:i=new Array(s/3);for(let o=0;o<s;o+=3){const r=e[o],a=e[o+1],l=e[o+2],c=o/3;i[c]=D.fromDegrees(r,a,l,t,i[c])}return i}static fromRadiansArrayHeights(e,t,i){if(y.defined("coordinates",e),e.length<3||e.length%3!==0)throw new $("the number of coordinates must be a multiple of 3 and at least 3");const s=e.length;x(i)?i.length=s/3:i=new Array(s/3);for(let o=0;o<s;o+=3){const r=e[o],a=e[o+1],l=e[o+2],c=o/3;i[c]=D.fromRadians(r,a,l,t,i[c])}return i}clone(e){return D.clone(this,e)}equals(e){return D.equals(this,e)}equalsEpsilon(e,t,i){return D.equalsEpsilon(this,e,t,i)}toString(){return`(${this.x}, ${this.y}, ${this.z})`}}D.fromCartesian4=D.clone,D.packedLength=3,D.fromArray=D.unpack;const Vc=new D,zy=new D,Bc=new D,af=new D,jx=new D;let Dn=new D,ur=new D;D._ellipsoidRadiiSquared=new D(40680631590769,40680631590769,40408299984661445e-3),D.ZERO=Object.freeze(new D(0,0,0)),D.ONE=Object.freeze(new D(1,1,1)),D.UNIT_X=Object.freeze(new D(1,0,0)),D.UNIT_Y=Object.freeze(new D(0,1,0)),D.UNIT_Z=Object.freeze(new D(0,0,1));class ce{constructor(e,t,i,s){this.x=e??0,this.y=t??0,this.z=i??0,this.w=s??0}static fromElements(e,t,i,s,o){return x(o)?(o.x=e,o.y=t,o.z=i,o.w=s,o):new ce(e,t,i,s)}static fromColor(e,t){return y.typeOf.object("color",e),x(t)?(t.x=e.red,t.y=e.green,t.z=e.blue,t.w=e.alpha,t):new ce(e.red,e.green,e.blue,e.alpha)}static clone(e,t){if(x(e))return x(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new ce(e.x,e.y,e.z,e.w)}static pack(e,t,i){return y.typeOf.object("value",e),y.defined("array",t),i=i??0,t[i++]=e.x,t[i++]=e.y,t[i++]=e.z,t[i]=e.w,t}static unpack(e,t,i){return y.defined("array",e),t=t??0,x(i)||(i=new ce),i.x=e[t++],i.y=e[t++],i.z=e[t++],i.w=e[t],i}static packArray(e,t){y.defined("array",e);const i=e.length,s=i*4;if(!x(t))t=new Array(s);else{if(!Array.isArray(t)&&t.length!==s)throw new $("If result is a typed array, it must have exactly array.length * 4 elements");t.length!==s&&(t.length=s)}for(let o=0;o<i;++o)ce.pack(e[o],t,o*4);return t}static unpackArray(e,t){if(y.defined("array",e),y.typeOf.number.greaterThanOrEquals("array.length",e.length,4),e.length%4!==0)throw new $("array length must be a multiple of 4.");const i=e.length;x(t)?t.length=i/4:t=new Array(i/4);for(let s=0;s<i;s+=4){const o=s/4;t[o]=ce.unpack(e,s,t[o])}return t}static maximumComponent(e){return y.typeOf.object("cartesian",e),Math.max(e.x,e.y,e.z,e.w)}static minimumComponent(e){return y.typeOf.object("cartesian",e),Math.min(e.x,e.y,e.z,e.w)}static minimumByComponent(e,t,i){return y.typeOf.object("first",e),y.typeOf.object("second",t),y.typeOf.object("result",i),i.x=Math.min(e.x,t.x),i.y=Math.min(e.y,t.y),i.z=Math.min(e.z,t.z),i.w=Math.min(e.w,t.w),i}static maximumByComponent(e,t,i){return y.typeOf.object("first",e),y.typeOf.object("second",t),y.typeOf.object("result",i),i.x=Math.max(e.x,t.x),i.y=Math.max(e.y,t.y),i.z=Math.max(e.z,t.z),i.w=Math.max(e.w,t.w),i}static clamp(e,t,i,s){y.typeOf.object("value",e),y.typeOf.object("min",t),y.typeOf.object("max",i),y.typeOf.object("result",s);const o=F.clamp(e.x,t.x,i.x),r=F.clamp(e.y,t.y,i.y),a=F.clamp(e.z,t.z,i.z),l=F.clamp(e.w,t.w,i.w);return s.x=o,s.y=r,s.z=a,s.w=l,s}static magnitudeSquared(e){return y.typeOf.object("cartesian",e),e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w}static magnitude(e){return Math.sqrt(ce.magnitudeSquared(e))}static distance(e,t){return y.typeOf.object("left",e),y.typeOf.object("right",t),ce.subtract(e,t,$c),ce.magnitude($c)}static distanceSquared(e,t){return y.typeOf.object("left",e),y.typeOf.object("right",t),ce.subtract(e,t,$c),ce.magnitudeSquared($c)}static normalize(e,t){y.typeOf.object("cartesian",e),y.typeOf.object("result",t);const i=ce.magnitude(e);if(t.x=e.x/i,t.y=e.y/i,t.z=e.z/i,t.w=e.w/i,isNaN(t.x)||isNaN(t.y)||isNaN(t.z)||isNaN(t.w))throw new $("normalized result is not a number");return t}static dot(e,t){return y.typeOf.object("left",e),y.typeOf.object("right",t),e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w}static multiplyComponents(e,t,i){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",i),i.x=e.x*t.x,i.y=e.y*t.y,i.z=e.z*t.z,i.w=e.w*t.w,i}static divideComponents(e,t,i){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",i),i.x=e.x/t.x,i.y=e.y/t.y,i.z=e.z/t.z,i.w=e.w/t.w,i}static add(e,t,i){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",i),i.x=e.x+t.x,i.y=e.y+t.y,i.z=e.z+t.z,i.w=e.w+t.w,i}static subtract(e,t,i){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",i),i.x=e.x-t.x,i.y=e.y-t.y,i.z=e.z-t.z,i.w=e.w-t.w,i}static multiplyByScalar(e,t,i){return y.typeOf.object("cartesian",e),y.typeOf.number("scalar",t),y.typeOf.object("result",i),i.x=e.x*t,i.y=e.y*t,i.z=e.z*t,i.w=e.w*t,i}static divideByScalar(e,t,i){return y.typeOf.object("cartesian",e),y.typeOf.number("scalar",t),y.typeOf.object("result",i),i.x=e.x/t,i.y=e.y/t,i.z=e.z/t,i.w=e.w/t,i}static negate(e,t){return y.typeOf.object("cartesian",e),y.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t}static abs(e,t){return y.typeOf.object("cartesian",e),y.typeOf.object("result",t),t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t.w=Math.abs(e.w),t}static lerp(e,t,i,s){return y.typeOf.object("start",e),y.typeOf.object("end",t),y.typeOf.number("t",i),y.typeOf.object("result",s),ce.multiplyByScalar(t,i,Ny),s=ce.multiplyByScalar(e,1-i,s),ce.add(Ny,s,s)}static mostOrthogonalAxis(e,t){y.typeOf.object("cartesian",e),y.typeOf.object("result",t);const i=ce.normalize(e,Ux);return ce.abs(i,i),i.x<=i.y?i.x<=i.z?i.x<=i.w?t=ce.clone(ce.UNIT_X,t):t=ce.clone(ce.UNIT_W,t):i.z<=i.w?t=ce.clone(ce.UNIT_Z,t):t=ce.clone(ce.UNIT_W,t):i.y<=i.z?i.y<=i.w?t=ce.clone(ce.UNIT_Y,t):t=ce.clone(ce.UNIT_W,t):i.z<=i.w?t=ce.clone(ce.UNIT_Z,t):t=ce.clone(ce.UNIT_W,t),t}static equals(e,t){return e===t||x(e)&&x(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w}static equalsArray(e,t,i){return e.x===t[i]&&e.y===t[i+1]&&e.z===t[i+2]&&e.w===t[i+3]}static equalsEpsilon(e,t,i,s){return e===t||x(e)&&x(t)&&F.equalsEpsilon(e.x,t.x,i,s)&&F.equalsEpsilon(e.y,t.y,i,s)&&F.equalsEpsilon(e.z,t.z,i,s)&&F.equalsEpsilon(e.w,t.w,i,s)}clone(e){return ce.clone(this,e)}equals(e){return ce.equals(this,e)}equalsEpsilon(e,t,i){return ce.equalsEpsilon(this,e,t,i)}toString(){return`(${this.x}, ${this.y}, ${this.z}, ${this.w})`}static packFloat(e,t){return y.typeOf.number("value",e),x(t)||(t=new ce),lf[0]=e,ky?(t.x=Ht[0],t.y=Ht[1],t.z=Ht[2],t.w=Ht[3]):(t.x=Ht[3],t.y=Ht[2],t.z=Ht[1],t.w=Ht[0]),t}static unpackFloat(e){return y.typeOf.object("packedFloat",e),ky?(Ht[0]=e.x,Ht[1]=e.y,Ht[2]=e.z,Ht[3]=e.w):(Ht[0]=e.w,Ht[1]=e.z,Ht[2]=e.y,Ht[3]=e.x),lf[0]}}ce.packedLength=4,ce.fromArray=ce.unpack;const $c=new ce,Ny=new ce,Ux=new ce;ce.ZERO=Object.freeze(new ce(0,0,0,0)),ce.ONE=Object.freeze(new ce(1,1,1,1)),ce.UNIT_X=Object.freeze(new ce(1,0,0,0)),ce.UNIT_Y=Object.freeze(new ce(0,1,0,0)),ce.UNIT_Z=Object.freeze(new ce(0,0,1,0)),ce.UNIT_W=Object.freeze(new ce(0,0,0,1));const lf=new Float32Array(1),Ht=new Uint8Array(lf.buffer),Gx=new Uint32Array([287454020]),ky=new Uint8Array(Gx.buffer)[0]===68,_i={};_i.EMPTY_OBJECT=Object.freeze({}),_i.EMPTY_ARRAY=Object.freeze([]);function H(n,e,t,i,s,o,r,a,l){this[0]=n??0,this[1]=i??0,this[2]=r??0,this[3]=e??0,this[4]=s??0,this[5]=a??0,this[6]=t??0,this[7]=o??0,this[8]=l??0}H.packedLength=9,H.pack=function(n,e,t){return y.typeOf.object("value",n),y.defined("array",e),t=t??0,e[t++]=n[0],e[t++]=n[1],e[t++]=n[2],e[t++]=n[3],e[t++]=n[4],e[t++]=n[5],e[t++]=n[6],e[t++]=n[7],e[t++]=n[8],e},H.unpack=function(n,e,t){return y.defined("array",n),e=e??0,x(t)||(t=new H),t[0]=n[e++],t[1]=n[e++],t[2]=n[e++],t[3]=n[e++],t[4]=n[e++],t[5]=n[e++],t[6]=n[e++],t[7]=n[e++],t[8]=n[e++],t},H.packArray=function(n,e){y.defined("array",n);const t=n.length,i=t*9;if(!x(e))e=new Array(i);else{if(!Array.isArray(e)&&e.length!==i)throw new $("If result is a typed array, it must have exactly array.length * 9 elements");e.length!==i&&(e.length=i)}for(let s=0;s<t;++s)H.pack(n[s],e,s*9);return e},H.unpackArray=function(n,e){if(y.defined("array",n),y.typeOf.number.greaterThanOrEquals("array.length",n.length,9),n.length%9!==0)throw new $("array length must be a multiple of 9.");const t=n.length;x(e)?e.length=t/9:e=new Array(t/9);for(let i=0;i<t;i+=9){const s=i/9;e[s]=H.unpack(n,i,e[s])}return e},H.clone=function(n,e){if(x(n))return x(e)?(e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e):new H(n[0],n[3],n[6],n[1],n[4],n[7],n[2],n[5],n[8])},H.fromArray=H.unpack,H.fromColumnMajorArray=function(n,e){return y.defined("values",n),H.clone(n,e)},H.fromRowMajorArray=function(n,e){return y.defined("values",n),x(e)?(e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],e):new H(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8])},H.fromQuaternion=function(n,e){y.typeOf.object("quaternion",n);const t=n.x*n.x,i=n.x*n.y,s=n.x*n.z,o=n.x*n.w,r=n.y*n.y,a=n.y*n.z,l=n.y*n.w,c=n.z*n.z,h=n.z*n.w,u=n.w*n.w,d=t-r-c+u,f=2*(i-h),g=2*(s+l),_=2*(i+h),v=-t+r-c+u,E=2*(a-o),w=2*(s-l),C=2*(a+o),P=-t-r+c+u;return x(e)?(e[0]=d,e[1]=_,e[2]=w,e[3]=f,e[4]=v,e[5]=C,e[6]=g,e[7]=E,e[8]=P,e):new H(d,f,g,_,v,E,w,C,P)},H.fromHeadingPitchRoll=function(n,e){y.typeOf.object("headingPitchRoll",n);const t=Math.cos(-n.pitch),i=Math.cos(-n.heading),s=Math.cos(n.roll),o=Math.sin(-n.pitch),r=Math.sin(-n.heading),a=Math.sin(n.roll),l=t*i,c=-s*r+a*o*i,h=a*r+s*o*i,u=t*r,d=s*i+a*o*r,f=-a*i+s*o*r,g=-o,_=a*t,v=s*t;return x(e)?(e[0]=l,e[1]=u,e[2]=g,e[3]=c,e[4]=d,e[5]=_,e[6]=h,e[7]=f,e[8]=v,e):new H(l,c,h,u,d,f,g,_,v)},H.fromScale=function(n,e){return y.typeOf.object("scale",n),x(e)?(e[0]=n.x,e[1]=0,e[2]=0,e[3]=0,e[4]=n.y,e[5]=0,e[6]=0,e[7]=0,e[8]=n.z,e):new H(n.x,0,0,0,n.y,0,0,0,n.z)},H.fromUniformScale=function(n,e){return y.typeOf.number("scale",n),x(e)?(e[0]=n,e[1]=0,e[2]=0,e[3]=0,e[4]=n,e[5]=0,e[6]=0,e[7]=0,e[8]=n,e):new H(n,0,0,0,n,0,0,0,n)},H.fromCrossProduct=function(n,e){return y.typeOf.object("vector",n),x(e)?(e[0]=0,e[1]=n.z,e[2]=-n.y,e[3]=-n.z,e[4]=0,e[5]=n.x,e[6]=n.y,e[7]=-n.x,e[8]=0,e):new H(0,-n.z,n.y,n.z,0,-n.x,-n.y,n.x,0)},H.fromRotationX=function(n,e){y.typeOf.number("angle",n);const t=Math.cos(n),i=Math.sin(n);return x(e)?(e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=t,e[5]=i,e[6]=0,e[7]=-i,e[8]=t,e):new H(1,0,0,0,t,-i,0,i,t)},H.fromRotationY=function(n,e){y.typeOf.number("angle",n);const t=Math.cos(n),i=Math.sin(n);return x(e)?(e[0]=t,e[1]=0,e[2]=-i,e[3]=0,e[4]=1,e[5]=0,e[6]=i,e[7]=0,e[8]=t,e):new H(t,0,i,0,1,0,-i,0,t)},H.fromRotationZ=function(n,e){y.typeOf.number("angle",n);const t=Math.cos(n),i=Math.sin(n);return x(e)?(e[0]=t,e[1]=i,e[2]=0,e[3]=-i,e[4]=t,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e):new H(t,-i,0,i,t,0,0,0,1)},H.toArray=function(n,e){return y.typeOf.object("matrix",n),x(e)?(e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e):[n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8]]},H.getElementIndex=function(n,e){return y.typeOf.number.greaterThanOrEquals("row",e,0),y.typeOf.number.lessThanOrEquals("row",e,2),y.typeOf.number.greaterThanOrEquals("column",n,0),y.typeOf.number.lessThanOrEquals("column",n,2),n*3+e},H.getColumn=function(n,e,t){y.typeOf.object("matrix",n),y.typeOf.number.greaterThanOrEquals("index",e,0),y.typeOf.number.lessThanOrEquals("index",e,2),y.typeOf.object("result",t);const i=e*3,s=n[i],o=n[i+1],r=n[i+2];return t.x=s,t.y=o,t.z=r,t},H.setColumn=function(n,e,t,i){y.typeOf.object("matrix",n),y.typeOf.number.greaterThanOrEquals("index",e,0),y.typeOf.number.lessThanOrEquals("index",e,2),y.typeOf.object("cartesian",t),y.typeOf.object("result",i),i=H.clone(n,i);const s=e*3;return i[s]=t.x,i[s+1]=t.y,i[s+2]=t.z,i},H.getRow=function(n,e,t){y.typeOf.object("matrix",n),y.typeOf.number.greaterThanOrEquals("index",e,0),y.typeOf.number.lessThanOrEquals("index",e,2),y.typeOf.object("result",t);const i=n[e],s=n[e+3],o=n[e+6];return t.x=i,t.y=s,t.z=o,t},H.setRow=function(n,e,t,i){return y.typeOf.object("matrix",n),y.typeOf.number.greaterThanOrEquals("index",e,0),y.typeOf.number.lessThanOrEquals("index",e,2),y.typeOf.object("cartesian",t),y.typeOf.object("result",i),i=H.clone(n,i),i[e]=t.x,i[e+3]=t.y,i[e+6]=t.z,i};const qx=new D;H.setScale=function(n,e,t){y.typeOf.object("matrix",n),y.typeOf.object("scale",e),y.typeOf.object("result",t);const i=H.getScale(n,qx),s=e.x/i.x,o=e.y/i.y,r=e.z/i.z;return t[0]=n[0]*s,t[1]=n[1]*s,t[2]=n[2]*s,t[3]=n[3]*o,t[4]=n[4]*o,t[5]=n[5]*o,t[6]=n[6]*r,t[7]=n[7]*r,t[8]=n[8]*r,t};const Wx=new D;H.setUniformScale=function(n,e,t){y.typeOf.object("matrix",n),y.typeOf.number("scale",e),y.typeOf.object("result",t);const i=H.getScale(n,Wx),s=e/i.x,o=e/i.y,r=e/i.z;return t[0]=n[0]*s,t[1]=n[1]*s,t[2]=n[2]*s,t[3]=n[3]*o,t[4]=n[4]*o,t[5]=n[5]*o,t[6]=n[6]*r,t[7]=n[7]*r,t[8]=n[8]*r,t};const cf=new D;H.getScale=function(n,e){return y.typeOf.object("matrix",n),y.typeOf.object("result",e),e.x=D.magnitude(D.fromElements(n[0],n[1],n[2],cf)),e.y=D.magnitude(D.fromElements(n[3],n[4],n[5],cf)),e.z=D.magnitude(D.fromElements(n[6],n[7],n[8],cf)),e};const jy=new D;H.getMaximumScale=function(n){return H.getScale(n,jy),D.maximumComponent(jy)};const Vx=new D;H.setRotation=function(n,e,t){y.typeOf.object("matrix",n),y.typeOf.object("result",t);const i=H.getScale(n,Vx);return t[0]=e[0]*i.x,t[1]=e[1]*i.x,t[2]=e[2]*i.x,t[3]=e[3]*i.y,t[4]=e[4]*i.y,t[5]=e[5]*i.y,t[6]=e[6]*i.z,t[7]=e[7]*i.z,t[8]=e[8]*i.z,t};const Bx=new D;H.getRotation=function(n,e){y.typeOf.object("matrix",n),y.typeOf.object("result",e);const t=H.getScale(n,Bx);return e[0]=n[0]/t.x,e[1]=n[1]/t.x,e[2]=n[2]/t.x,e[3]=n[3]/t.y,e[4]=n[4]/t.y,e[5]=n[5]/t.y,e[6]=n[6]/t.z,e[7]=n[7]/t.z,e[8]=n[8]/t.z,e},H.multiply=function(n,e,t){y.typeOf.object("left",n),y.typeOf.object("right",e),y.typeOf.object("result",t);const i=n[0]*e[0]+n[3]*e[1]+n[6]*e[2],s=n[1]*e[0]+n[4]*e[1]+n[7]*e[2],o=n[2]*e[0]+n[5]*e[1]+n[8]*e[2],r=n[0]*e[3]+n[3]*e[4]+n[6]*e[5],a=n[1]*e[3]+n[4]*e[4]+n[7]*e[5],l=n[2]*e[3]+n[5]*e[4]+n[8]*e[5],c=n[0]*e[6]+n[3]*e[7]+n[6]*e[8],h=n[1]*e[6]+n[4]*e[7]+n[7]*e[8],u=n[2]*e[6]+n[5]*e[7]+n[8]*e[8];return t[0]=i,t[1]=s,t[2]=o,t[3]=r,t[4]=a,t[5]=l,t[6]=c,t[7]=h,t[8]=u,t},H.add=function(n,e,t){return y.typeOf.object("left",n),y.typeOf.object("right",e),y.typeOf.object("result",t),t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t[3]=n[3]+e[3],t[4]=n[4]+e[4],t[5]=n[5]+e[5],t[6]=n[6]+e[6],t[7]=n[7]+e[7],t[8]=n[8]+e[8],t},H.subtract=function(n,e,t){return y.typeOf.object("left",n),y.typeOf.object("right",e),y.typeOf.object("result",t),t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t[3]=n[3]-e[3],t[4]=n[4]-e[4],t[5]=n[5]-e[5],t[6]=n[6]-e[6],t[7]=n[7]-e[7],t[8]=n[8]-e[8],t},H.multiplyByVector=function(n,e,t){y.typeOf.object("matrix",n),y.typeOf.object("cartesian",e),y.typeOf.object("result",t);const i=e.x,s=e.y,o=e.z,r=n[0]*i+n[3]*s+n[6]*o,a=n[1]*i+n[4]*s+n[7]*o,l=n[2]*i+n[5]*s+n[8]*o;return t.x=r,t.y=a,t.z=l,t},H.multiplyByScalar=function(n,e,t){return y.typeOf.object("matrix",n),y.typeOf.number("scalar",e),y.typeOf.object("result",t),t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t[4]=n[4]*e,t[5]=n[5]*e,t[6]=n[6]*e,t[7]=n[7]*e,t[8]=n[8]*e,t},H.multiplyByScale=function(n,e,t){return y.typeOf.object("matrix",n),y.typeOf.object("scale",e),y.typeOf.object("result",t),t[0]=n[0]*e.x,t[1]=n[1]*e.x,t[2]=n[2]*e.x,t[3]=n[3]*e.y,t[4]=n[4]*e.y,t[5]=n[5]*e.y,t[6]=n[6]*e.z,t[7]=n[7]*e.z,t[8]=n[8]*e.z,t},H.multiplyByUniformScale=function(n,e,t){return y.typeOf.object("matrix",n),y.typeOf.number("scale",e),y.typeOf.object("result",t),t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t[4]=n[4]*e,t[5]=n[5]*e,t[6]=n[6]*e,t[7]=n[7]*e,t[8]=n[8]*e,t},H.negate=function(n,e){return y.typeOf.object("matrix",n),y.typeOf.object("result",e),e[0]=-n[0],e[1]=-n[1],e[2]=-n[2],e[3]=-n[3],e[4]=-n[4],e[5]=-n[5],e[6]=-n[6],e[7]=-n[7],e[8]=-n[8],e},H.transpose=function(n,e){y.typeOf.object("matrix",n),y.typeOf.object("result",e);const t=n[0],i=n[3],s=n[6],o=n[1],r=n[4],a=n[7],l=n[2],c=n[5],h=n[8];return e[0]=t,e[1]=i,e[2]=s,e[3]=o,e[4]=r,e[5]=a,e[6]=l,e[7]=c,e[8]=h,e};function $x(n){let e=0;for(let t=0;t<9;++t){const i=n[t];e+=i*i}return Math.sqrt(e)}const hf=[1,0,0],uf=[2,2,1];function Hx(n){let e=0;for(let t=0;t<3;++t){const i=n[H.getElementIndex(uf[t],hf[t])];e+=2*i*i}return Math.sqrt(e)}function Xx(n,e){const t=F.EPSILON15;let i=0,s=1;for(let c=0;c<3;++c){const h=Math.abs(n[H.getElementIndex(uf[c],hf[c])]);h>i&&(s=c,i=h)}let o=1,r=0;const a=hf[s],l=uf[s];if(Math.abs(n[H.getElementIndex(l,a)])>t){const c=n[H.getElementIndex(l,l)],h=n[H.getElementIndex(a,a)],u=n[H.getElementIndex(l,a)],d=(c-h)/2/u;let f;d<0?f=-1/(-d+Math.sqrt(1+d*d)):f=1/(d+Math.sqrt(1+d*d)),o=1/Math.sqrt(1+f*f),r=f*o}return e=H.clone(H.IDENTITY,e),e[H.getElementIndex(a,a)]=e[H.getElementIndex(l,l)]=o,e[H.getElementIndex(l,a)]=r,e[H.getElementIndex(a,l)]=-r,e}const Hc=new H,Uy=new H;H.computeEigenDecomposition=function(n,e){y.typeOf.object("matrix",n);const t=F.EPSILON20,i=10;let s=0,o=0;x(e)||(e={});const r=e.unitary=H.clone(H.IDENTITY,e.unitary),a=e.diagonal=H.clone(n,e.diagonal),l=t*$x(a);for(;o<i&&Hx(a)>l;)Xx(a,Hc),H.transpose(Hc,Uy),H.multiply(a,Hc,a),H.multiply(Uy,a,a),H.multiply(r,Hc,r),++s>2&&(++o,s=0);return e},H.abs=function(n,e){return y.typeOf.object("matrix",n),y.typeOf.object("result",e),e[0]=Math.abs(n[0]),e[1]=Math.abs(n[1]),e[2]=Math.abs(n[2]),e[3]=Math.abs(n[3]),e[4]=Math.abs(n[4]),e[5]=Math.abs(n[5]),e[6]=Math.abs(n[6]),e[7]=Math.abs(n[7]),e[8]=Math.abs(n[8]),e},H.determinant=function(n){y.typeOf.object("matrix",n);const e=n[0],t=n[3],i=n[6],s=n[1],o=n[4],r=n[7],a=n[2],l=n[5],c=n[8];return e*(o*c-l*r)+s*(l*i-t*c)+a*(t*r-o*i)},H.inverse=function(n,e){y.typeOf.object("matrix",n),y.typeOf.object("result",e);const t=n[0],i=n[1],s=n[2],o=n[3],r=n[4],a=n[5],l=n[6],c=n[7],h=n[8],u=H.determinant(n);if(Math.abs(u)<=F.EPSILON15)throw new $("matrix is not invertible");e[0]=r*h-c*a,e[1]=c*s-i*h,e[2]=i*a-r*s,e[3]=l*a-o*h,e[4]=t*h-l*s,e[5]=o*s-t*a,e[6]=o*c-l*r,e[7]=l*i-t*c,e[8]=t*r-o*i;const d=1/u;return H.multiplyByScalar(e,d,e)};const Yx=new H;H.inverseTranspose=function(n,e){return y.typeOf.object("matrix",n),y.typeOf.object("result",e),H.inverse(H.transpose(n,Yx),e)},H.equals=function(n,e){return n===e||x(n)&&x(e)&&n[0]===e[0]&&n[1]===e[1]&&n[2]===e[2]&&n[3]===e[3]&&n[4]===e[4]&&n[5]===e[5]&&n[6]===e[6]&&n[7]===e[7]&&n[8]===e[8]},H.equalsEpsilon=function(n,e,t){return t=t??0,n===e||x(n)&&x(e)&&Math.abs(n[0]-e[0])<=t&&Math.abs(n[1]-e[1])<=t&&Math.abs(n[2]-e[2])<=t&&Math.abs(n[3]-e[3])<=t&&Math.abs(n[4]-e[4])<=t&&Math.abs(n[5]-e[5])<=t&&Math.abs(n[6]-e[6])<=t&&Math.abs(n[7]-e[7])<=t&&Math.abs(n[8]-e[8])<=t},H.IDENTITY=Object.freeze(new H(1,0,0,0,1,0,0,0,1)),H.ZERO=Object.freeze(new H(0,0,0,0,0,0,0,0,0)),H.COLUMN0ROW0=0,H.COLUMN0ROW1=1,H.COLUMN0ROW2=2,H.COLUMN1ROW0=3,H.COLUMN1ROW1=4,H.COLUMN1ROW2=5,H.COLUMN2ROW0=6,H.COLUMN2ROW1=7,H.COLUMN2ROW2=8,Object.defineProperties(H.prototype,{length:{get:function(){return H.packedLength}}}),H.prototype.clone=function(n){return H.clone(this,n)},H.prototype.equals=function(n){return H.equals(this,n)},H.equalsArray=function(n,e,t){return n[0]===e[t]&&n[1]===e[t+1]&&n[2]===e[t+2]&&n[3]===e[t+3]&&n[4]===e[t+4]&&n[5]===e[t+5]&&n[6]===e[t+6]&&n[7]===e[t+7]&&n[8]===e[t+8]},H.prototype.equalsEpsilon=function(n,e){return H.equalsEpsilon(this,n,e)},H.prototype.toString=function(){return`(${this[0]}, ${this[3]}, ${this[6]})
31
28
  (${this[1]}, ${this[4]}, ${this[7]})
32
- (${this[2]}, ${this[5]}, ${this[8]})`};function K(i,t,e,n){this.x=i??0,this.y=t??0,this.z=e??0,this.w=n??0}K.fromElements=function(i,t,e,n,s){return C(s)?(s.x=i,s.y=t,s.z=e,s.w=n,s):new K(i,t,e,n)},K.fromColor=function(i,t){return p.typeOf.object("color",i),C(t)?(t.x=i.red,t.y=i.green,t.z=i.blue,t.w=i.alpha,t):new K(i.red,i.green,i.blue,i.alpha)},K.clone=function(i,t){if(C(i))return C(t)?(t.x=i.x,t.y=i.y,t.z=i.z,t.w=i.w,t):new K(i.x,i.y,i.z,i.w)},K.packedLength=4,K.pack=function(i,t,e){return p.typeOf.object("value",i),p.defined("array",t),e=e??0,t[e++]=i.x,t[e++]=i.y,t[e++]=i.z,t[e]=i.w,t},K.unpack=function(i,t,e){return p.defined("array",i),t=t??0,C(e)||(e=new K),e.x=i[t++],e.y=i[t++],e.z=i[t++],e.w=i[t],e},K.packArray=function(i,t){p.defined("array",i);const e=i.length,n=e*4;if(!C(t))t=new Array(n);else{if(!Array.isArray(t)&&t.length!==n)throw new j("If result is a typed array, it must have exactly array.length * 4 elements");t.length!==n&&(t.length=n)}for(let s=0;s<e;++s)K.pack(i[s],t,s*4);return t},K.unpackArray=function(i,t){if(p.defined("array",i),p.typeOf.number.greaterThanOrEquals("array.length",i.length,4),i.length%4!==0)throw new j("array length must be a multiple of 4.");const e=i.length;C(t)?t.length=e/4:t=new Array(e/4);for(let n=0;n<e;n+=4){const s=n/4;t[s]=K.unpack(i,n,t[s])}return t},K.fromArray=K.unpack,K.maximumComponent=function(i){return p.typeOf.object("cartesian",i),Math.max(i.x,i.y,i.z,i.w)},K.minimumComponent=function(i){return p.typeOf.object("cartesian",i),Math.min(i.x,i.y,i.z,i.w)},K.minimumByComponent=function(i,t,e){return p.typeOf.object("first",i),p.typeOf.object("second",t),p.typeOf.object("result",e),e.x=Math.min(i.x,t.x),e.y=Math.min(i.y,t.y),e.z=Math.min(i.z,t.z),e.w=Math.min(i.w,t.w),e},K.maximumByComponent=function(i,t,e){return p.typeOf.object("first",i),p.typeOf.object("second",t),p.typeOf.object("result",e),e.x=Math.max(i.x,t.x),e.y=Math.max(i.y,t.y),e.z=Math.max(i.z,t.z),e.w=Math.max(i.w,t.w),e},K.clamp=function(i,t,e,n){p.typeOf.object("value",i),p.typeOf.object("min",t),p.typeOf.object("max",e),p.typeOf.object("result",n);const s=T.clamp(i.x,t.x,e.x),o=T.clamp(i.y,t.y,e.y),r=T.clamp(i.z,t.z,e.z),a=T.clamp(i.w,t.w,e.w);return n.x=s,n.y=o,n.z=r,n.w=a,n},K.magnitudeSquared=function(i){return p.typeOf.object("cartesian",i),i.x*i.x+i.y*i.y+i.z*i.z+i.w*i.w},K.magnitude=function(i){return Math.sqrt(K.magnitudeSquared(i))};const la=new K;K.distance=function(i,t){return p.typeOf.object("left",i),p.typeOf.object("right",t),K.subtract(i,t,la),K.magnitude(la)},K.distanceSquared=function(i,t){return p.typeOf.object("left",i),p.typeOf.object("right",t),K.subtract(i,t,la),K.magnitudeSquared(la)},K.normalize=function(i,t){p.typeOf.object("cartesian",i),p.typeOf.object("result",t);const e=K.magnitude(i);if(t.x=i.x/e,t.y=i.y/e,t.z=i.z/e,t.w=i.w/e,isNaN(t.x)||isNaN(t.y)||isNaN(t.z)||isNaN(t.w))throw new j("normalized result is not a number");return t},K.dot=function(i,t){return p.typeOf.object("left",i),p.typeOf.object("right",t),i.x*t.x+i.y*t.y+i.z*t.z+i.w*t.w},K.multiplyComponents=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.x=i.x*t.x,e.y=i.y*t.y,e.z=i.z*t.z,e.w=i.w*t.w,e},K.divideComponents=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.x=i.x/t.x,e.y=i.y/t.y,e.z=i.z/t.z,e.w=i.w/t.w,e},K.add=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.x=i.x+t.x,e.y=i.y+t.y,e.z=i.z+t.z,e.w=i.w+t.w,e},K.subtract=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.x=i.x-t.x,e.y=i.y-t.y,e.z=i.z-t.z,e.w=i.w-t.w,e},K.multiplyByScalar=function(i,t,e){return p.typeOf.object("cartesian",i),p.typeOf.number("scalar",t),p.typeOf.object("result",e),e.x=i.x*t,e.y=i.y*t,e.z=i.z*t,e.w=i.w*t,e},K.divideByScalar=function(i,t,e){return p.typeOf.object("cartesian",i),p.typeOf.number("scalar",t),p.typeOf.object("result",e),e.x=i.x/t,e.y=i.y/t,e.z=i.z/t,e.w=i.w/t,e},K.negate=function(i,t){return p.typeOf.object("cartesian",i),p.typeOf.object("result",t),t.x=-i.x,t.y=-i.y,t.z=-i.z,t.w=-i.w,t},K.abs=function(i,t){return p.typeOf.object("cartesian",i),p.typeOf.object("result",t),t.x=Math.abs(i.x),t.y=Math.abs(i.y),t.z=Math.abs(i.z),t.w=Math.abs(i.w),t};const Cf=new K;K.lerp=function(i,t,e,n){return p.typeOf.object("start",i),p.typeOf.object("end",t),p.typeOf.number("t",e),p.typeOf.object("result",n),K.multiplyByScalar(t,e,Cf),n=K.multiplyByScalar(i,1-e,n),K.add(Cf,n,n)};const _y=new K;K.mostOrthogonalAxis=function(i,t){p.typeOf.object("cartesian",i),p.typeOf.object("result",t);const e=K.normalize(i,_y);return K.abs(e,e),e.x<=e.y?e.x<=e.z?e.x<=e.w?t=K.clone(K.UNIT_X,t):t=K.clone(K.UNIT_W,t):e.z<=e.w?t=K.clone(K.UNIT_Z,t):t=K.clone(K.UNIT_W,t):e.y<=e.z?e.y<=e.w?t=K.clone(K.UNIT_Y,t):t=K.clone(K.UNIT_W,t):e.z<=e.w?t=K.clone(K.UNIT_Z,t):t=K.clone(K.UNIT_W,t),t},K.equals=function(i,t){return i===t||C(i)&&C(t)&&i.x===t.x&&i.y===t.y&&i.z===t.z&&i.w===t.w},K.equalsArray=function(i,t,e){return i.x===t[e]&&i.y===t[e+1]&&i.z===t[e+2]&&i.w===t[e+3]},K.equalsEpsilon=function(i,t,e,n){return i===t||C(i)&&C(t)&&T.equalsEpsilon(i.x,t.x,e,n)&&T.equalsEpsilon(i.y,t.y,e,n)&&T.equalsEpsilon(i.z,t.z,e,n)&&T.equalsEpsilon(i.w,t.w,e,n)},K.ZERO=Object.freeze(new K(0,0,0,0)),K.ONE=Object.freeze(new K(1,1,1,1)),K.UNIT_X=Object.freeze(new K(1,0,0,0)),K.UNIT_Y=Object.freeze(new K(0,1,0,0)),K.UNIT_Z=Object.freeze(new K(0,0,1,0)),K.UNIT_W=Object.freeze(new K(0,0,0,1)),K.prototype.clone=function(i){return K.clone(this,i)},K.prototype.equals=function(i){return K.equals(this,i)},K.prototype.equalsEpsilon=function(i,t,e){return K.equalsEpsilon(this,i,t,e)},K.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z}, ${this.w})`};const wh=new Float32Array(1),ie=new Uint8Array(wh.buffer),yy=new Uint32Array([287454020]),bf=new Uint8Array(yy.buffer)[0]===68;K.packFloat=function(i,t){return p.typeOf.number("value",i),C(t)||(t=new K),wh[0]=i,bf?(t.x=ie[0],t.y=ie[1],t.z=ie[2],t.w=ie[3]):(t.x=ie[3],t.y=ie[2],t.z=ie[1],t.w=ie[0]),t},K.unpackFloat=function(i){return p.typeOf.object("packedFloat",i),bf?(ie[0]=i.x,ie[1]=i.y,ie[2]=i.z,ie[3]=i.w):(ie[0]=i.w,ie[1]=i.z,ie[2]=i.y,ie[3]=i.x),wh[0]};const ri={};ri.EMPTY_OBJECT=Object.freeze({}),ri.EMPTY_ARRAY=Object.freeze([]);function De(i){this.name="RuntimeError",this.message=i;let t;try{throw new Error}catch(e){t=e.stack}this.stack=t}C(Object.create)&&(De.prototype=Object.create(Error.prototype),De.prototype.constructor=De),De.prototype.toString=function(){let i=`${this.name}: ${this.message}`;return C(this.stack)&&(i+=`
33
- ${this.stack.toString()}`),i};function U(i,t,e,n,s,o,r,a,c,h,l,u,f,g,_,y){this[0]=i??0,this[1]=s??0,this[2]=c??0,this[3]=f??0,this[4]=t??0,this[5]=o??0,this[6]=h??0,this[7]=g??0,this[8]=e??0,this[9]=r??0,this[10]=l??0,this[11]=_??0,this[12]=n??0,this[13]=a??0,this[14]=u??0,this[15]=y??0}U.packedLength=16,U.pack=function(i,t,e){return p.typeOf.object("value",i),p.defined("array",t),e=e??0,t[e++]=i[0],t[e++]=i[1],t[e++]=i[2],t[e++]=i[3],t[e++]=i[4],t[e++]=i[5],t[e++]=i[6],t[e++]=i[7],t[e++]=i[8],t[e++]=i[9],t[e++]=i[10],t[e++]=i[11],t[e++]=i[12],t[e++]=i[13],t[e++]=i[14],t[e]=i[15],t},U.unpack=function(i,t,e){return p.defined("array",i),t=t??0,C(e)||(e=new U),e[0]=i[t++],e[1]=i[t++],e[2]=i[t++],e[3]=i[t++],e[4]=i[t++],e[5]=i[t++],e[6]=i[t++],e[7]=i[t++],e[8]=i[t++],e[9]=i[t++],e[10]=i[t++],e[11]=i[t++],e[12]=i[t++],e[13]=i[t++],e[14]=i[t++],e[15]=i[t],e},U.packArray=function(i,t){p.defined("array",i);const e=i.length,n=e*16;if(!C(t))t=new Array(n);else{if(!Array.isArray(t)&&t.length!==n)throw new j("If result is a typed array, it must have exactly array.length * 16 elements");t.length!==n&&(t.length=n)}for(let s=0;s<e;++s)U.pack(i[s],t,s*16);return t},U.unpackArray=function(i,t){if(p.defined("array",i),p.typeOf.number.greaterThanOrEquals("array.length",i.length,16),i.length%16!==0)throw new j("array length must be a multiple of 16.");const e=i.length;C(t)?t.length=e/16:t=new Array(e/16);for(let n=0;n<e;n+=16){const s=n/16;t[s]=U.unpack(i,n,t[s])}return t},U.clone=function(i,t){if(C(i))return C(t)?(t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],t):new U(i[0],i[4],i[8],i[12],i[1],i[5],i[9],i[13],i[2],i[6],i[10],i[14],i[3],i[7],i[11],i[15])},U.fromArray=U.unpack,U.fromColumnMajorArray=function(i,t){return p.defined("values",i),U.clone(i,t)},U.fromRowMajorArray=function(i,t){return p.defined("values",i),C(t)?(t[0]=i[0],t[1]=i[4],t[2]=i[8],t[3]=i[12],t[4]=i[1],t[5]=i[5],t[6]=i[9],t[7]=i[13],t[8]=i[2],t[9]=i[6],t[10]=i[10],t[11]=i[14],t[12]=i[3],t[13]=i[7],t[14]=i[11],t[15]=i[15],t):new U(i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8],i[9],i[10],i[11],i[12],i[13],i[14],i[15])},U.fromRotationTranslation=function(i,t,e){return p.typeOf.object("rotation",i),t=t??O.ZERO,C(e)?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=0,e[4]=i[3],e[5]=i[4],e[6]=i[5],e[7]=0,e[8]=i[6],e[9]=i[7],e[10]=i[8],e[11]=0,e[12]=t.x,e[13]=t.y,e[14]=t.z,e[15]=1,e):new U(i[0],i[3],i[6],t.x,i[1],i[4],i[7],t.y,i[2],i[5],i[8],t.z,0,0,0,1)},U.fromTranslationQuaternionRotationScale=function(i,t,e,n){p.typeOf.object("translation",i),p.typeOf.object("rotation",t),p.typeOf.object("scale",e),C(n)||(n=new U);const s=e.x,o=e.y,r=e.z,a=t.x*t.x,c=t.x*t.y,h=t.x*t.z,l=t.x*t.w,u=t.y*t.y,f=t.y*t.z,g=t.y*t.w,_=t.z*t.z,y=t.z*t.w,w=t.w*t.w,E=a-u-_+w,b=2*(c-y),P=2*(h+g),I=2*(c+y),M=-a+u-_+w,D=2*(f-l),L=2*(h-g),z=2*(f+l),q=-a-u+_+w;return n[0]=E*s,n[1]=I*s,n[2]=L*s,n[3]=0,n[4]=b*o,n[5]=M*o,n[6]=z*o,n[7]=0,n[8]=P*r,n[9]=D*r,n[10]=q*r,n[11]=0,n[12]=i.x,n[13]=i.y,n[14]=i.z,n[15]=1,n},U.fromTranslationRotationScale=function(i,t){return p.typeOf.object("translationRotationScale",i),U.fromTranslationQuaternionRotationScale(i.translation,i.rotation,i.scale,t)},U.fromTranslation=function(i,t){return p.typeOf.object("translation",i),U.fromRotationTranslation(k.IDENTITY,i,t)},U.fromScale=function(i,t){return p.typeOf.object("scale",i),C(t)?(t[0]=i.x,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i.y,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=i.z,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new U(i.x,0,0,0,0,i.y,0,0,0,0,i.z,0,0,0,0,1)},U.fromUniformScale=function(i,t){return p.typeOf.number("scale",i),C(t)?(t[0]=i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=i,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new U(i,0,0,0,0,i,0,0,0,0,i,0,0,0,0,1)},U.fromRotation=function(i,t){return p.typeOf.object("rotation",i),C(t)||(t=new U),t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=0,t[4]=i[3],t[5]=i[4],t[6]=i[5],t[7]=0,t[8]=i[6],t[9]=i[7],t[10]=i[8],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t};const Ps=new O,Os=new O,Ao=new O;U.fromCamera=function(i,t){p.typeOf.object("camera",i);const e=i.position,n=i.direction,s=i.up;p.typeOf.object("camera.position",e),p.typeOf.object("camera.direction",n),p.typeOf.object("camera.up",s),O.normalize(n,Ps),O.normalize(O.cross(Ps,s,Os),Os),O.normalize(O.cross(Os,Ps,Ao),Ao);const o=Os.x,r=Os.y,a=Os.z,c=Ps.x,h=Ps.y,l=Ps.z,u=Ao.x,f=Ao.y,g=Ao.z,_=e.x,y=e.y,w=e.z,E=o*-_+r*-y+a*-w,b=u*-_+f*-y+g*-w,P=c*_+h*y+l*w;return C(t)?(t[0]=o,t[1]=u,t[2]=-c,t[3]=0,t[4]=r,t[5]=f,t[6]=-h,t[7]=0,t[8]=a,t[9]=g,t[10]=-l,t[11]=0,t[12]=E,t[13]=b,t[14]=P,t[15]=1,t):new U(o,r,a,E,u,f,g,b,-c,-h,-l,P,0,0,0,1)},U.computePerspectiveFieldOfView=function(i,t,e,n,s){p.typeOf.number.greaterThan("fovY",i,0),p.typeOf.number.lessThan("fovY",i,Math.PI),p.typeOf.number.greaterThan("near",e,0),p.typeOf.number.greaterThan("far",n,0),p.typeOf.object("result",s);const r=1/Math.tan(i*.5),a=r/t,c=(n+e)/(e-n),h=2*n*e/(e-n);return s[0]=a,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=r,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=c,s[11]=-1,s[12]=0,s[13]=0,s[14]=h,s[15]=0,s},U.computeOrthographicOffCenter=function(i,t,e,n,s,o,r){p.typeOf.number("left",i),p.typeOf.number("right",t),p.typeOf.number("bottom",e),p.typeOf.number("top",n),p.typeOf.number("near",s),p.typeOf.number("far",o),p.typeOf.object("result",r);let a=1/(t-i),c=1/(n-e),h=1/(o-s);const l=-(t+i)*a,u=-(n+e)*c,f=-(o+s)*h;return a*=2,c*=2,h*=-2,r[0]=a,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=c,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=h,r[11]=0,r[12]=l,r[13]=u,r[14]=f,r[15]=1,r},U.computePerspectiveOffCenter=function(i,t,e,n,s,o,r){p.typeOf.number("left",i),p.typeOf.number("right",t),p.typeOf.number("bottom",e),p.typeOf.number("top",n),p.typeOf.number("near",s),p.typeOf.number("far",o),p.typeOf.object("result",r);const a=2*s/(t-i),c=2*s/(n-e),h=(t+i)/(t-i),l=(n+e)/(n-e),u=-(o+s)/(o-s),f=-1,g=-2*o*s/(o-s);return r[0]=a,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=c,r[6]=0,r[7]=0,r[8]=h,r[9]=l,r[10]=u,r[11]=f,r[12]=0,r[13]=0,r[14]=g,r[15]=0,r},U.computeInfinitePerspectiveOffCenter=function(i,t,e,n,s,o){p.typeOf.number("left",i),p.typeOf.number("right",t),p.typeOf.number("bottom",e),p.typeOf.number("top",n),p.typeOf.number("near",s),p.typeOf.object("result",o);const r=2*s/(t-i),a=2*s/(n-e),c=(t+i)/(t-i),h=(n+e)/(n-e),l=-1,u=-1,f=-2*s;return o[0]=r,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=a,o[6]=0,o[7]=0,o[8]=c,o[9]=h,o[10]=l,o[11]=u,o[12]=0,o[13]=0,o[14]=f,o[15]=0,o},U.computeViewportTransformation=function(i,t,e,n){C(n)||(n=new U),i=i??ri.EMPTY_OBJECT;const s=i.x??0,o=i.y??0,r=i.width??0,a=i.height??0;t=t??0,e=e??1;const c=r*.5,h=a*.5,l=(e-t)*.5,u=c,f=h,g=l,_=s+c,y=o+h,w=t+l,E=1;return n[0]=u,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=f,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=g,n[11]=0,n[12]=_,n[13]=y,n[14]=w,n[15]=E,n},U.computeView=function(i,t,e,n,s){return p.typeOf.object("position",i),p.typeOf.object("direction",t),p.typeOf.object("up",e),p.typeOf.object("right",n),p.typeOf.object("result",s),s[0]=n.x,s[1]=e.x,s[2]=-t.x,s[3]=0,s[4]=n.y,s[5]=e.y,s[6]=-t.y,s[7]=0,s[8]=n.z,s[9]=e.z,s[10]=-t.z,s[11]=0,s[12]=-O.dot(n,i),s[13]=-O.dot(e,i),s[14]=O.dot(t,i),s[15]=1,s},U.toArray=function(i,t){return p.typeOf.object("matrix",i),C(t)?(t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],t):[i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8],i[9],i[10],i[11],i[12],i[13],i[14],i[15]]},U.getElementIndex=function(i,t){return p.typeOf.number.greaterThanOrEquals("row",t,0),p.typeOf.number.lessThanOrEquals("row",t,3),p.typeOf.number.greaterThanOrEquals("column",i,0),p.typeOf.number.lessThanOrEquals("column",i,3),i*4+t},U.getColumn=function(i,t,e){p.typeOf.object("matrix",i),p.typeOf.number.greaterThanOrEquals("index",t,0),p.typeOf.number.lessThanOrEquals("index",t,3),p.typeOf.object("result",e);const n=t*4,s=i[n],o=i[n+1],r=i[n+2],a=i[n+3];return e.x=s,e.y=o,e.z=r,e.w=a,e},U.setColumn=function(i,t,e,n){p.typeOf.object("matrix",i),p.typeOf.number.greaterThanOrEquals("index",t,0),p.typeOf.number.lessThanOrEquals("index",t,3),p.typeOf.object("cartesian",e),p.typeOf.object("result",n),n=U.clone(i,n);const s=t*4;return n[s]=e.x,n[s+1]=e.y,n[s+2]=e.z,n[s+3]=e.w,n},U.getRow=function(i,t,e){p.typeOf.object("matrix",i),p.typeOf.number.greaterThanOrEquals("index",t,0),p.typeOf.number.lessThanOrEquals("index",t,3),p.typeOf.object("result",e);const n=i[t],s=i[t+4],o=i[t+8],r=i[t+12];return e.x=n,e.y=s,e.z=o,e.w=r,e},U.setRow=function(i,t,e,n){return p.typeOf.object("matrix",i),p.typeOf.number.greaterThanOrEquals("index",t,0),p.typeOf.number.lessThanOrEquals("index",t,3),p.typeOf.object("cartesian",e),p.typeOf.object("result",n),n=U.clone(i,n),n[t]=e.x,n[t+4]=e.y,n[t+8]=e.z,n[t+12]=e.w,n},U.setTranslation=function(i,t,e){return p.typeOf.object("matrix",i),p.typeOf.object("translation",t),p.typeOf.object("result",e),e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=t.x,e[13]=t.y,e[14]=t.z,e[15]=i[15],e};const wy=new O;U.setScale=function(i,t,e){p.typeOf.object("matrix",i),p.typeOf.object("scale",t),p.typeOf.object("result",e);const n=U.getScale(i,wy),s=t.x/n.x,o=t.y/n.y,r=t.z/n.z;return e[0]=i[0]*s,e[1]=i[1]*s,e[2]=i[2]*s,e[3]=i[3],e[4]=i[4]*o,e[5]=i[5]*o,e[6]=i[6]*o,e[7]=i[7],e[8]=i[8]*r,e[9]=i[9]*r,e[10]=i[10]*r,e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e};const vy=new O;U.setUniformScale=function(i,t,e){p.typeOf.object("matrix",i),p.typeOf.number("scale",t),p.typeOf.object("result",e);const n=U.getScale(i,vy),s=t/n.x,o=t/n.y,r=t/n.z;return e[0]=i[0]*s,e[1]=i[1]*s,e[2]=i[2]*s,e[3]=i[3],e[4]=i[4]*o,e[5]=i[5]*o,e[6]=i[6]*o,e[7]=i[7],e[8]=i[8]*r,e[9]=i[9]*r,e[10]=i[10]*r,e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e};const vh=new O;U.getScale=function(i,t){return p.typeOf.object("matrix",i),p.typeOf.object("result",t),t.x=O.magnitude(O.fromElements(i[0],i[1],i[2],vh)),t.y=O.magnitude(O.fromElements(i[4],i[5],i[6],vh)),t.z=O.magnitude(O.fromElements(i[8],i[9],i[10],vh)),t};const xf=new O;U.getMaximumScale=function(i){return U.getScale(i,xf),O.maximumComponent(xf)};const Ey=new O;U.setRotation=function(i,t,e){p.typeOf.object("matrix",i),p.typeOf.object("result",e);const n=U.getScale(i,Ey);return e[0]=t[0]*n.x,e[1]=t[1]*n.x,e[2]=t[2]*n.x,e[3]=i[3],e[4]=t[3]*n.y,e[5]=t[4]*n.y,e[6]=t[5]*n.y,e[7]=i[7],e[8]=t[6]*n.z,e[9]=t[7]*n.z,e[10]=t[8]*n.z,e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e};const Cy=new O;U.getRotation=function(i,t){p.typeOf.object("matrix",i),p.typeOf.object("result",t);const e=U.getScale(i,Cy);return t[0]=i[0]/e.x,t[1]=i[1]/e.x,t[2]=i[2]/e.x,t[3]=i[4]/e.y,t[4]=i[5]/e.y,t[5]=i[6]/e.y,t[6]=i[8]/e.z,t[7]=i[9]/e.z,t[8]=i[10]/e.z,t},U.multiply=function(i,t,e){p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e);const n=i[0],s=i[1],o=i[2],r=i[3],a=i[4],c=i[5],h=i[6],l=i[7],u=i[8],f=i[9],g=i[10],_=i[11],y=i[12],w=i[13],E=i[14],b=i[15],P=t[0],I=t[1],M=t[2],D=t[3],L=t[4],z=t[5],q=t[6],Y=t[7],X=t[8],Q=t[9],m=t[10],v=t[11],S=t[12],A=t[13],F=t[14],N=t[15],G=n*P+a*I+u*M+y*D,V=s*P+c*I+f*M+w*D,Z=o*P+h*I+g*M+E*D,B=r*P+l*I+_*M+b*D,at=n*L+a*z+u*q+y*Y,et=s*L+c*z+f*q+w*Y,it=o*L+h*z+g*q+E*Y,gt=r*L+l*z+_*q+b*Y,wt=n*X+a*Q+u*m+y*v,dt=s*X+c*Q+f*m+w*v,Et=o*X+h*Q+g*m+E*v,ft=r*X+l*Q+_*m+b*v,xt=n*S+a*A+u*F+y*N,Ft=s*S+c*A+f*F+w*N,kt=o*S+h*A+g*F+E*N,Wt=r*S+l*A+_*F+b*N;return e[0]=G,e[1]=V,e[2]=Z,e[3]=B,e[4]=at,e[5]=et,e[6]=it,e[7]=gt,e[8]=wt,e[9]=dt,e[10]=Et,e[11]=ft,e[12]=xt,e[13]=Ft,e[14]=kt,e[15]=Wt,e},U.add=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e[0]=i[0]+t[0],e[1]=i[1]+t[1],e[2]=i[2]+t[2],e[3]=i[3]+t[3],e[4]=i[4]+t[4],e[5]=i[5]+t[5],e[6]=i[6]+t[6],e[7]=i[7]+t[7],e[8]=i[8]+t[8],e[9]=i[9]+t[9],e[10]=i[10]+t[10],e[11]=i[11]+t[11],e[12]=i[12]+t[12],e[13]=i[13]+t[13],e[14]=i[14]+t[14],e[15]=i[15]+t[15],e},U.subtract=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e[0]=i[0]-t[0],e[1]=i[1]-t[1],e[2]=i[2]-t[2],e[3]=i[3]-t[3],e[4]=i[4]-t[4],e[5]=i[5]-t[5],e[6]=i[6]-t[6],e[7]=i[7]-t[7],e[8]=i[8]-t[8],e[9]=i[9]-t[9],e[10]=i[10]-t[10],e[11]=i[11]-t[11],e[12]=i[12]-t[12],e[13]=i[13]-t[13],e[14]=i[14]-t[14],e[15]=i[15]-t[15],e},U.multiplyTransformation=function(i,t,e){p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e);const n=i[0],s=i[1],o=i[2],r=i[4],a=i[5],c=i[6],h=i[8],l=i[9],u=i[10],f=i[12],g=i[13],_=i[14],y=t[0],w=t[1],E=t[2],b=t[4],P=t[5],I=t[6],M=t[8],D=t[9],L=t[10],z=t[12],q=t[13],Y=t[14],X=n*y+r*w+h*E,Q=s*y+a*w+l*E,m=o*y+c*w+u*E,v=n*b+r*P+h*I,S=s*b+a*P+l*I,A=o*b+c*P+u*I,F=n*M+r*D+h*L,N=s*M+a*D+l*L,G=o*M+c*D+u*L,V=n*z+r*q+h*Y+f,Z=s*z+a*q+l*Y+g,B=o*z+c*q+u*Y+_;return e[0]=X,e[1]=Q,e[2]=m,e[3]=0,e[4]=v,e[5]=S,e[6]=A,e[7]=0,e[8]=F,e[9]=N,e[10]=G,e[11]=0,e[12]=V,e[13]=Z,e[14]=B,e[15]=1,e},U.multiplyByMatrix3=function(i,t,e){p.typeOf.object("matrix",i),p.typeOf.object("rotation",t),p.typeOf.object("result",e);const n=i[0],s=i[1],o=i[2],r=i[4],a=i[5],c=i[6],h=i[8],l=i[9],u=i[10],f=t[0],g=t[1],_=t[2],y=t[3],w=t[4],E=t[5],b=t[6],P=t[7],I=t[8],M=n*f+r*g+h*_,D=s*f+a*g+l*_,L=o*f+c*g+u*_,z=n*y+r*w+h*E,q=s*y+a*w+l*E,Y=o*y+c*w+u*E,X=n*b+r*P+h*I,Q=s*b+a*P+l*I,m=o*b+c*P+u*I;return e[0]=M,e[1]=D,e[2]=L,e[3]=0,e[4]=z,e[5]=q,e[6]=Y,e[7]=0,e[8]=X,e[9]=Q,e[10]=m,e[11]=0,e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},U.multiplyByTranslation=function(i,t,e){p.typeOf.object("matrix",i),p.typeOf.object("translation",t),p.typeOf.object("result",e);const n=t.x,s=t.y,o=t.z,r=n*i[0]+s*i[4]+o*i[8]+i[12],a=n*i[1]+s*i[5]+o*i[9]+i[13],c=n*i[2]+s*i[6]+o*i[10]+i[14];return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=r,e[13]=a,e[14]=c,e[15]=i[15],e},U.multiplyByScale=function(i,t,e){p.typeOf.object("matrix",i),p.typeOf.object("scale",t),p.typeOf.object("result",e);const n=t.x,s=t.y,o=t.z;return n===1&&s===1&&o===1?U.clone(i,e):(e[0]=n*i[0],e[1]=n*i[1],e[2]=n*i[2],e[3]=i[3],e[4]=s*i[4],e[5]=s*i[5],e[6]=s*i[6],e[7]=i[7],e[8]=o*i[8],e[9]=o*i[9],e[10]=o*i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e)},U.multiplyByUniformScale=function(i,t,e){return p.typeOf.object("matrix",i),p.typeOf.number("scale",t),p.typeOf.object("result",e),e[0]=i[0]*t,e[1]=i[1]*t,e[2]=i[2]*t,e[3]=i[3],e[4]=i[4]*t,e[5]=i[5]*t,e[6]=i[6]*t,e[7]=i[7],e[8]=i[8]*t,e[9]=i[9]*t,e[10]=i[10]*t,e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},U.multiplyByVector=function(i,t,e){p.typeOf.object("matrix",i),p.typeOf.object("cartesian",t),p.typeOf.object("result",e);const n=t.x,s=t.y,o=t.z,r=t.w,a=i[0]*n+i[4]*s+i[8]*o+i[12]*r,c=i[1]*n+i[5]*s+i[9]*o+i[13]*r,h=i[2]*n+i[6]*s+i[10]*o+i[14]*r,l=i[3]*n+i[7]*s+i[11]*o+i[15]*r;return e.x=a,e.y=c,e.z=h,e.w=l,e},U.multiplyByPointAsVector=function(i,t,e){p.typeOf.object("matrix",i),p.typeOf.object("cartesian",t),p.typeOf.object("result",e);const n=t.x,s=t.y,o=t.z,r=i[0]*n+i[4]*s+i[8]*o,a=i[1]*n+i[5]*s+i[9]*o,c=i[2]*n+i[6]*s+i[10]*o;return e.x=r,e.y=a,e.z=c,e},U.multiplyByPoint=function(i,t,e){p.typeOf.object("matrix",i),p.typeOf.object("cartesian",t),p.typeOf.object("result",e);const n=t.x,s=t.y,o=t.z,r=i[0]*n+i[4]*s+i[8]*o+i[12],a=i[1]*n+i[5]*s+i[9]*o+i[13],c=i[2]*n+i[6]*s+i[10]*o+i[14];return e.x=r,e.y=a,e.z=c,e},U.multiplyByScalar=function(i,t,e){return p.typeOf.object("matrix",i),p.typeOf.number("scalar",t),p.typeOf.object("result",e),e[0]=i[0]*t,e[1]=i[1]*t,e[2]=i[2]*t,e[3]=i[3]*t,e[4]=i[4]*t,e[5]=i[5]*t,e[6]=i[6]*t,e[7]=i[7]*t,e[8]=i[8]*t,e[9]=i[9]*t,e[10]=i[10]*t,e[11]=i[11]*t,e[12]=i[12]*t,e[13]=i[13]*t,e[14]=i[14]*t,e[15]=i[15]*t,e},U.negate=function(i,t){return p.typeOf.object("matrix",i),p.typeOf.object("result",t),t[0]=-i[0],t[1]=-i[1],t[2]=-i[2],t[3]=-i[3],t[4]=-i[4],t[5]=-i[5],t[6]=-i[6],t[7]=-i[7],t[8]=-i[8],t[9]=-i[9],t[10]=-i[10],t[11]=-i[11],t[12]=-i[12],t[13]=-i[13],t[14]=-i[14],t[15]=-i[15],t},U.transpose=function(i,t){p.typeOf.object("matrix",i),p.typeOf.object("result",t);const e=i[1],n=i[2],s=i[3],o=i[6],r=i[7],a=i[11];return t[0]=i[0],t[1]=i[4],t[2]=i[8],t[3]=i[12],t[4]=e,t[5]=i[5],t[6]=i[9],t[7]=i[13],t[8]=n,t[9]=o,t[10]=i[10],t[11]=i[14],t[12]=s,t[13]=r,t[14]=a,t[15]=i[15],t},U.abs=function(i,t){return p.typeOf.object("matrix",i),p.typeOf.object("result",t),t[0]=Math.abs(i[0]),t[1]=Math.abs(i[1]),t[2]=Math.abs(i[2]),t[3]=Math.abs(i[3]),t[4]=Math.abs(i[4]),t[5]=Math.abs(i[5]),t[6]=Math.abs(i[6]),t[7]=Math.abs(i[7]),t[8]=Math.abs(i[8]),t[9]=Math.abs(i[9]),t[10]=Math.abs(i[10]),t[11]=Math.abs(i[11]),t[12]=Math.abs(i[12]),t[13]=Math.abs(i[13]),t[14]=Math.abs(i[14]),t[15]=Math.abs(i[15]),t},U.equals=function(i,t){return i===t||C(i)&&C(t)&&i[12]===t[12]&&i[13]===t[13]&&i[14]===t[14]&&i[0]===t[0]&&i[1]===t[1]&&i[2]===t[2]&&i[4]===t[4]&&i[5]===t[5]&&i[6]===t[6]&&i[8]===t[8]&&i[9]===t[9]&&i[10]===t[10]&&i[3]===t[3]&&i[7]===t[7]&&i[11]===t[11]&&i[15]===t[15]},U.equalsEpsilon=function(i,t,e){return e=e??0,i===t||C(i)&&C(t)&&Math.abs(i[0]-t[0])<=e&&Math.abs(i[1]-t[1])<=e&&Math.abs(i[2]-t[2])<=e&&Math.abs(i[3]-t[3])<=e&&Math.abs(i[4]-t[4])<=e&&Math.abs(i[5]-t[5])<=e&&Math.abs(i[6]-t[6])<=e&&Math.abs(i[7]-t[7])<=e&&Math.abs(i[8]-t[8])<=e&&Math.abs(i[9]-t[9])<=e&&Math.abs(i[10]-t[10])<=e&&Math.abs(i[11]-t[11])<=e&&Math.abs(i[12]-t[12])<=e&&Math.abs(i[13]-t[13])<=e&&Math.abs(i[14]-t[14])<=e&&Math.abs(i[15]-t[15])<=e},U.getTranslation=function(i,t){return p.typeOf.object("matrix",i),p.typeOf.object("result",t),t.x=i[12],t.y=i[13],t.z=i[14],t},U.getMatrix3=function(i,t){return p.typeOf.object("matrix",i),p.typeOf.object("result",t),t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[4],t[4]=i[5],t[5]=i[6],t[6]=i[8],t[7]=i[9],t[8]=i[10],t};const by=new k,xy=new k,Sy=new K,Ry=new K(0,0,0,1);U.inverse=function(i,t){p.typeOf.object("matrix",i),p.typeOf.object("result",t);const e=i[0],n=i[4],s=i[8],o=i[12],r=i[1],a=i[5],c=i[9],h=i[13],l=i[2],u=i[6],f=i[10],g=i[14],_=i[3],y=i[7],w=i[11],E=i[15];let b=f*E,P=g*w,I=u*E,M=g*y,D=u*w,L=f*y,z=l*E,q=g*_,Y=l*w,X=f*_,Q=l*y,m=u*_;const v=b*a+M*c+D*h-(P*a+I*c+L*h),S=P*r+z*c+X*h-(b*r+q*c+Y*h),A=I*r+q*a+Q*h-(M*r+z*a+m*h),F=L*r+Y*a+m*c-(D*r+X*a+Q*c),N=P*n+I*s+L*o-(b*n+M*s+D*o),G=b*e+q*s+Y*o-(P*e+z*s+X*o),V=M*e+z*n+m*o-(I*e+q*n+Q*o),Z=D*e+X*n+Q*s-(L*e+Y*n+m*s);b=s*h,P=o*c,I=n*h,M=o*a,D=n*c,L=s*a,z=e*h,q=o*r,Y=e*c,X=s*r,Q=e*a,m=n*r;const B=b*y+M*w+D*E-(P*y+I*w+L*E),at=P*_+z*w+X*E-(b*_+q*w+Y*E),et=I*_+q*y+Q*E-(M*_+z*y+m*E),it=L*_+Y*y+m*w-(D*_+X*y+Q*w),gt=I*f+L*g+P*u-(D*g+b*u+M*f),wt=Y*g+b*l+q*f-(z*f+X*g+P*l),dt=z*u+m*g+M*l-(Q*g+I*l+q*u),Et=Q*f+D*l+X*u-(Y*u+m*f+L*l);let ft=e*v+n*S+s*A+o*F;if(Math.abs(ft)<T.EPSILON21){if(k.equalsEpsilon(U.getMatrix3(i,by),xy,T.EPSILON7)&&K.equals(U.getRow(i,3,Sy),Ry))return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=0,t[11]=0,t[12]=-i[12],t[13]=-i[13],t[14]=-i[14],t[15]=1,t;throw new De("matrix is not invertible because its determinate is zero.")}return ft=1/ft,t[0]=v*ft,t[1]=S*ft,t[2]=A*ft,t[3]=F*ft,t[4]=N*ft,t[5]=G*ft,t[6]=V*ft,t[7]=Z*ft,t[8]=B*ft,t[9]=at*ft,t[10]=et*ft,t[11]=it*ft,t[12]=gt*ft,t[13]=wt*ft,t[14]=dt*ft,t[15]=Et*ft,t},U.inverseTransformation=function(i,t){p.typeOf.object("matrix",i),p.typeOf.object("result",t);const e=i[0],n=i[1],s=i[2],o=i[4],r=i[5],a=i[6],c=i[8],h=i[9],l=i[10],u=i[12],f=i[13],g=i[14],_=-e*u-n*f-s*g,y=-o*u-r*f-a*g,w=-c*u-h*f-l*g;return t[0]=e,t[1]=o,t[2]=c,t[3]=0,t[4]=n,t[5]=r,t[6]=h,t[7]=0,t[8]=s,t[9]=a,t[10]=l,t[11]=0,t[12]=_,t[13]=y,t[14]=w,t[15]=1,t};const Py=new U;U.inverseTranspose=function(i,t){return p.typeOf.object("matrix",i),p.typeOf.object("result",t),U.inverse(U.transpose(i,Py),t)},U.IDENTITY=Object.freeze(new U(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),U.ZERO=Object.freeze(new U(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),U.COLUMN0ROW0=0,U.COLUMN0ROW1=1,U.COLUMN0ROW2=2,U.COLUMN0ROW3=3,U.COLUMN1ROW0=4,U.COLUMN1ROW1=5,U.COLUMN1ROW2=6,U.COLUMN1ROW3=7,U.COLUMN2ROW0=8,U.COLUMN2ROW1=9,U.COLUMN2ROW2=10,U.COLUMN2ROW3=11,U.COLUMN3ROW0=12,U.COLUMN3ROW1=13,U.COLUMN3ROW2=14,U.COLUMN3ROW3=15,Object.defineProperties(U.prototype,{length:{get:function(){return U.packedLength}}}),U.prototype.clone=function(i){return U.clone(this,i)},U.prototype.equals=function(i){return U.equals(this,i)},U.equalsArray=function(i,t,e){return i[0]===t[e]&&i[1]===t[e+1]&&i[2]===t[e+2]&&i[3]===t[e+3]&&i[4]===t[e+4]&&i[5]===t[e+5]&&i[6]===t[e+6]&&i[7]===t[e+7]&&i[8]===t[e+8]&&i[9]===t[e+9]&&i[10]===t[e+10]&&i[11]===t[e+11]&&i[12]===t[e+12]&&i[13]===t[e+13]&&i[14]===t[e+14]&&i[15]===t[e+15]},U.prototype.equalsEpsilon=function(i,t){return U.equalsEpsilon(this,i,t)},U.prototype.toString=function(){return`(${this[0]}, ${this[4]}, ${this[8]}, ${this[12]})
29
+ (${this[2]}, ${this[5]}, ${this[8]})`};function Fn(n){this.name="RuntimeError",this.message=n;let e;try{throw new Error}catch(t){e=t.stack}this.stack=e}x(Object.create)&&(Fn.prototype=Object.create(Error.prototype),Fn.prototype.constructor=Fn),Fn.prototype.toString=function(){let n=`${this.name}: ${this.message}`;return x(this.stack)&&(n+=`
30
+ ${this.stack.toString()}`),n};function W(n,e,t,i,s,o,r,a,l,c,h,u,d,f,g,_){this[0]=n??0,this[1]=s??0,this[2]=l??0,this[3]=d??0,this[4]=e??0,this[5]=o??0,this[6]=c??0,this[7]=f??0,this[8]=t??0,this[9]=r??0,this[10]=h??0,this[11]=g??0,this[12]=i??0,this[13]=a??0,this[14]=u??0,this[15]=_??0}W.packedLength=16,W.pack=function(n,e,t){return y.typeOf.object("value",n),y.defined("array",e),t=t??0,e[t++]=n[0],e[t++]=n[1],e[t++]=n[2],e[t++]=n[3],e[t++]=n[4],e[t++]=n[5],e[t++]=n[6],e[t++]=n[7],e[t++]=n[8],e[t++]=n[9],e[t++]=n[10],e[t++]=n[11],e[t++]=n[12],e[t++]=n[13],e[t++]=n[14],e[t]=n[15],e},W.unpack=function(n,e,t){return y.defined("array",n),e=e??0,x(t)||(t=new W),t[0]=n[e++],t[1]=n[e++],t[2]=n[e++],t[3]=n[e++],t[4]=n[e++],t[5]=n[e++],t[6]=n[e++],t[7]=n[e++],t[8]=n[e++],t[9]=n[e++],t[10]=n[e++],t[11]=n[e++],t[12]=n[e++],t[13]=n[e++],t[14]=n[e++],t[15]=n[e],t},W.packArray=function(n,e){y.defined("array",n);const t=n.length,i=t*16;if(!x(e))e=new Array(i);else{if(!Array.isArray(e)&&e.length!==i)throw new $("If result is a typed array, it must have exactly array.length * 16 elements");e.length!==i&&(e.length=i)}for(let s=0;s<t;++s)W.pack(n[s],e,s*16);return e},W.unpackArray=function(n,e){if(y.defined("array",n),y.typeOf.number.greaterThanOrEquals("array.length",n.length,16),n.length%16!==0)throw new $("array length must be a multiple of 16.");const t=n.length;x(e)?e.length=t/16:e=new Array(t/16);for(let i=0;i<t;i+=16){const s=i/16;e[s]=W.unpack(n,i,e[s])}return e},W.clone=function(n,e){if(x(n))return x(e)?(e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],e):new W(n[0],n[4],n[8],n[12],n[1],n[5],n[9],n[13],n[2],n[6],n[10],n[14],n[3],n[7],n[11],n[15])},W.fromArray=W.unpack,W.fromColumnMajorArray=function(n,e){return y.defined("values",n),W.clone(n,e)},W.fromRowMajorArray=function(n,e){return y.defined("values",n),x(e)?(e[0]=n[0],e[1]=n[4],e[2]=n[8],e[3]=n[12],e[4]=n[1],e[5]=n[5],e[6]=n[9],e[7]=n[13],e[8]=n[2],e[9]=n[6],e[10]=n[10],e[11]=n[14],e[12]=n[3],e[13]=n[7],e[14]=n[11],e[15]=n[15],e):new W(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8],n[9],n[10],n[11],n[12],n[13],n[14],n[15])},W.fromRotationTranslation=function(n,e,t){return y.typeOf.object("rotation",n),e=e??D.ZERO,x(t)?(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=0,t[4]=n[3],t[5]=n[4],t[6]=n[5],t[7]=0,t[8]=n[6],t[9]=n[7],t[10]=n[8],t[11]=0,t[12]=e.x,t[13]=e.y,t[14]=e.z,t[15]=1,t):new W(n[0],n[3],n[6],e.x,n[1],n[4],n[7],e.y,n[2],n[5],n[8],e.z,0,0,0,1)},W.fromTranslationQuaternionRotationScale=function(n,e,t,i){y.typeOf.object("translation",n),y.typeOf.object("rotation",e),y.typeOf.object("scale",t),x(i)||(i=new W);const s=t.x,o=t.y,r=t.z,a=e.x*e.x,l=e.x*e.y,c=e.x*e.z,h=e.x*e.w,u=e.y*e.y,d=e.y*e.z,f=e.y*e.w,g=e.z*e.z,_=e.z*e.w,v=e.w*e.w,E=a-u-g+v,w=2*(l-_),C=2*(c+f),P=2*(l+_),R=-a+u-g+v,A=2*(d-h),O=2*(c-f),M=2*(d+h),z=-a-u+g+v;return i[0]=E*s,i[1]=P*s,i[2]=O*s,i[3]=0,i[4]=w*o,i[5]=R*o,i[6]=M*o,i[7]=0,i[8]=C*r,i[9]=A*r,i[10]=z*r,i[11]=0,i[12]=n.x,i[13]=n.y,i[14]=n.z,i[15]=1,i},W.fromTranslationRotationScale=function(n,e){return y.typeOf.object("translationRotationScale",n),W.fromTranslationQuaternionRotationScale(n.translation,n.rotation,n.scale,e)},W.fromTranslation=function(n,e){return y.typeOf.object("translation",n),W.fromRotationTranslation(H.IDENTITY,n,e)},W.fromScale=function(n,e){return y.typeOf.object("scale",n),x(e)?(e[0]=n.x,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n.y,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=n.z,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e):new W(n.x,0,0,0,0,n.y,0,0,0,0,n.z,0,0,0,0,1)},W.fromUniformScale=function(n,e){return y.typeOf.number("scale",n),x(e)?(e[0]=n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e):new W(n,0,0,0,0,n,0,0,0,0,n,0,0,0,0,1)},W.fromRotation=function(n,e){return y.typeOf.object("rotation",n),x(e)||(e=new W),e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=0,e[4]=n[3],e[5]=n[4],e[6]=n[5],e[7]=0,e[8]=n[6],e[9]=n[7],e[10]=n[8],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e};const dr=new D,fr=new D,Ua=new D;W.fromCamera=function(n,e){y.typeOf.object("camera",n);const t=n.position,i=n.direction,s=n.up;y.typeOf.object("camera.position",t),y.typeOf.object("camera.direction",i),y.typeOf.object("camera.up",s),D.normalize(i,dr),D.normalize(D.cross(dr,s,fr),fr),D.normalize(D.cross(fr,dr,Ua),Ua);const o=fr.x,r=fr.y,a=fr.z,l=dr.x,c=dr.y,h=dr.z,u=Ua.x,d=Ua.y,f=Ua.z,g=t.x,_=t.y,v=t.z,E=o*-g+r*-_+a*-v,w=u*-g+d*-_+f*-v,C=l*g+c*_+h*v;return x(e)?(e[0]=o,e[1]=u,e[2]=-l,e[3]=0,e[4]=r,e[5]=d,e[6]=-c,e[7]=0,e[8]=a,e[9]=f,e[10]=-h,e[11]=0,e[12]=E,e[13]=w,e[14]=C,e[15]=1,e):new W(o,r,a,E,u,d,f,w,-l,-c,-h,C,0,0,0,1)},W.computePerspectiveFieldOfView=function(n,e,t,i,s){y.typeOf.number.greaterThan("fovY",n,0),y.typeOf.number.lessThan("fovY",n,Math.PI),y.typeOf.number.greaterThan("near",t,0),y.typeOf.number.greaterThan("far",i,0),y.typeOf.object("result",s);const r=1/Math.tan(n*.5),a=r/e,l=(i+t)/(t-i),c=2*i*t/(t-i);return s[0]=a,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=r,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=l,s[11]=-1,s[12]=0,s[13]=0,s[14]=c,s[15]=0,s},W.computeOrthographicOffCenter=function(n,e,t,i,s,o,r){y.typeOf.number("left",n),y.typeOf.number("right",e),y.typeOf.number("bottom",t),y.typeOf.number("top",i),y.typeOf.number("near",s),y.typeOf.number("far",o),y.typeOf.object("result",r);let a=1/(e-n),l=1/(i-t),c=1/(o-s);const h=-(e+n)*a,u=-(i+t)*l,d=-(o+s)*c;return a*=2,l*=2,c*=-2,r[0]=a,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=l,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=c,r[11]=0,r[12]=h,r[13]=u,r[14]=d,r[15]=1,r},W.computePerspectiveOffCenter=function(n,e,t,i,s,o,r){y.typeOf.number("left",n),y.typeOf.number("right",e),y.typeOf.number("bottom",t),y.typeOf.number("top",i),y.typeOf.number("near",s),y.typeOf.number("far",o),y.typeOf.object("result",r);const a=2*s/(e-n),l=2*s/(i-t),c=(e+n)/(e-n),h=(i+t)/(i-t),u=-(o+s)/(o-s),d=-1,f=-2*o*s/(o-s);return r[0]=a,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=l,r[6]=0,r[7]=0,r[8]=c,r[9]=h,r[10]=u,r[11]=d,r[12]=0,r[13]=0,r[14]=f,r[15]=0,r},W.computeInfinitePerspectiveOffCenter=function(n,e,t,i,s,o){y.typeOf.number("left",n),y.typeOf.number("right",e),y.typeOf.number("bottom",t),y.typeOf.number("top",i),y.typeOf.number("near",s),y.typeOf.object("result",o);const r=2*s/(e-n),a=2*s/(i-t),l=(e+n)/(e-n),c=(i+t)/(i-t),h=-1,u=-1,d=-2*s;return o[0]=r,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=a,o[6]=0,o[7]=0,o[8]=l,o[9]=c,o[10]=h,o[11]=u,o[12]=0,o[13]=0,o[14]=d,o[15]=0,o},W.computeViewportTransformation=function(n,e,t,i){x(i)||(i=new W),n=n??_i.EMPTY_OBJECT;const s=n.x??0,o=n.y??0,r=n.width??0,a=n.height??0;e=e??0,t=t??1;const l=r*.5,c=a*.5,h=(t-e)*.5,u=l,d=c,f=h,g=s+l,_=o+c,v=e+h,E=1;return i[0]=u,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=d,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=f,i[11]=0,i[12]=g,i[13]=_,i[14]=v,i[15]=E,i},W.computeView=function(n,e,t,i,s){return y.typeOf.object("position",n),y.typeOf.object("direction",e),y.typeOf.object("up",t),y.typeOf.object("right",i),y.typeOf.object("result",s),s[0]=i.x,s[1]=t.x,s[2]=-e.x,s[3]=0,s[4]=i.y,s[5]=t.y,s[6]=-e.y,s[7]=0,s[8]=i.z,s[9]=t.z,s[10]=-e.z,s[11]=0,s[12]=-D.dot(i,n),s[13]=-D.dot(t,n),s[14]=D.dot(e,n),s[15]=1,s},W.toArray=function(n,e){return y.typeOf.object("matrix",n),x(e)?(e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],e):[n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8],n[9],n[10],n[11],n[12],n[13],n[14],n[15]]},W.getElementIndex=function(n,e){return y.typeOf.number.greaterThanOrEquals("row",e,0),y.typeOf.number.lessThanOrEquals("row",e,3),y.typeOf.number.greaterThanOrEquals("column",n,0),y.typeOf.number.lessThanOrEquals("column",n,3),n*4+e},W.getColumn=function(n,e,t){y.typeOf.object("matrix",n),y.typeOf.number.greaterThanOrEquals("index",e,0),y.typeOf.number.lessThanOrEquals("index",e,3),y.typeOf.object("result",t);const i=e*4,s=n[i],o=n[i+1],r=n[i+2],a=n[i+3];return t.x=s,t.y=o,t.z=r,t.w=a,t},W.setColumn=function(n,e,t,i){y.typeOf.object("matrix",n),y.typeOf.number.greaterThanOrEquals("index",e,0),y.typeOf.number.lessThanOrEquals("index",e,3),y.typeOf.object("cartesian",t),y.typeOf.object("result",i),i=W.clone(n,i);const s=e*4;return i[s]=t.x,i[s+1]=t.y,i[s+2]=t.z,i[s+3]=t.w,i},W.getRow=function(n,e,t){y.typeOf.object("matrix",n),y.typeOf.number.greaterThanOrEquals("index",e,0),y.typeOf.number.lessThanOrEquals("index",e,3),y.typeOf.object("result",t);const i=n[e],s=n[e+4],o=n[e+8],r=n[e+12];return t.x=i,t.y=s,t.z=o,t.w=r,t},W.setRow=function(n,e,t,i){return y.typeOf.object("matrix",n),y.typeOf.number.greaterThanOrEquals("index",e,0),y.typeOf.number.lessThanOrEquals("index",e,3),y.typeOf.object("cartesian",t),y.typeOf.object("result",i),i=W.clone(n,i),i[e]=t.x,i[e+4]=t.y,i[e+8]=t.z,i[e+12]=t.w,i},W.setTranslation=function(n,e,t){return y.typeOf.object("matrix",n),y.typeOf.object("translation",e),y.typeOf.object("result",t),t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=e.x,t[13]=e.y,t[14]=e.z,t[15]=n[15],t};const Zx=new D;W.setScale=function(n,e,t){y.typeOf.object("matrix",n),y.typeOf.object("scale",e),y.typeOf.object("result",t);const i=W.getScale(n,Zx),s=e.x/i.x,o=e.y/i.y,r=e.z/i.z;return t[0]=n[0]*s,t[1]=n[1]*s,t[2]=n[2]*s,t[3]=n[3],t[4]=n[4]*o,t[5]=n[5]*o,t[6]=n[6]*o,t[7]=n[7],t[8]=n[8]*r,t[9]=n[9]*r,t[10]=n[10]*r,t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t};const Kx=new D;W.setUniformScale=function(n,e,t){y.typeOf.object("matrix",n),y.typeOf.number("scale",e),y.typeOf.object("result",t);const i=W.getScale(n,Kx),s=e/i.x,o=e/i.y,r=e/i.z;return t[0]=n[0]*s,t[1]=n[1]*s,t[2]=n[2]*s,t[3]=n[3],t[4]=n[4]*o,t[5]=n[5]*o,t[6]=n[6]*o,t[7]=n[7],t[8]=n[8]*r,t[9]=n[9]*r,t[10]=n[10]*r,t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t};const df=new D;W.getScale=function(n,e){return y.typeOf.object("matrix",n),y.typeOf.object("result",e),e.x=D.magnitude(D.fromElements(n[0],n[1],n[2],df)),e.y=D.magnitude(D.fromElements(n[4],n[5],n[6],df)),e.z=D.magnitude(D.fromElements(n[8],n[9],n[10],df)),e};const Gy=new D;W.getMaximumScale=function(n){return W.getScale(n,Gy),D.maximumComponent(Gy)};const Qx=new D;W.setRotation=function(n,e,t){y.typeOf.object("matrix",n),y.typeOf.object("result",t);const i=W.getScale(n,Qx);return t[0]=e[0]*i.x,t[1]=e[1]*i.x,t[2]=e[2]*i.x,t[3]=n[3],t[4]=e[3]*i.y,t[5]=e[4]*i.y,t[6]=e[5]*i.y,t[7]=n[7],t[8]=e[6]*i.z,t[9]=e[7]*i.z,t[10]=e[8]*i.z,t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t};const Jx=new D;W.getRotation=function(n,e){y.typeOf.object("matrix",n),y.typeOf.object("result",e);const t=W.getScale(n,Jx);return e[0]=n[0]/t.x,e[1]=n[1]/t.x,e[2]=n[2]/t.x,e[3]=n[4]/t.y,e[4]=n[5]/t.y,e[5]=n[6]/t.y,e[6]=n[8]/t.z,e[7]=n[9]/t.z,e[8]=n[10]/t.z,e},W.multiply=function(n,e,t){y.typeOf.object("left",n),y.typeOf.object("right",e),y.typeOf.object("result",t);const i=n[0],s=n[1],o=n[2],r=n[3],a=n[4],l=n[5],c=n[6],h=n[7],u=n[8],d=n[9],f=n[10],g=n[11],_=n[12],v=n[13],E=n[14],w=n[15],C=e[0],P=e[1],R=e[2],A=e[3],O=e[4],M=e[5],z=e[6],k=e[7],q=e[8],Y=e[9],m=e[10],b=e[11],S=e[12],L=e[13],N=e[14],j=e[15],U=i*C+a*P+u*R+_*A,B=s*C+l*P+d*R+v*A,Z=o*C+c*P+f*R+E*A,G=r*C+h*P+g*R+w*A,ae=i*O+a*M+u*z+_*k,ne=s*O+l*M+d*z+v*k,V=o*O+c*M+f*z+E*k,re=r*O+h*M+g*z+w*k,se=i*q+a*Y+u*m+_*b,he=s*q+l*Y+d*m+v*b,ye=o*q+c*Y+f*m+E*b,pe=r*q+h*Y+g*m+w*b,Fe=i*S+a*L+u*N+_*j,je=s*S+l*L+d*N+v*j,ee=o*S+c*L+f*N+E*j,ft=r*S+h*L+g*N+w*j;return t[0]=U,t[1]=B,t[2]=Z,t[3]=G,t[4]=ae,t[5]=ne,t[6]=V,t[7]=re,t[8]=se,t[9]=he,t[10]=ye,t[11]=pe,t[12]=Fe,t[13]=je,t[14]=ee,t[15]=ft,t},W.add=function(n,e,t){return y.typeOf.object("left",n),y.typeOf.object("right",e),y.typeOf.object("result",t),t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t[3]=n[3]+e[3],t[4]=n[4]+e[4],t[5]=n[5]+e[5],t[6]=n[6]+e[6],t[7]=n[7]+e[7],t[8]=n[8]+e[8],t[9]=n[9]+e[9],t[10]=n[10]+e[10],t[11]=n[11]+e[11],t[12]=n[12]+e[12],t[13]=n[13]+e[13],t[14]=n[14]+e[14],t[15]=n[15]+e[15],t},W.subtract=function(n,e,t){return y.typeOf.object("left",n),y.typeOf.object("right",e),y.typeOf.object("result",t),t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t[3]=n[3]-e[3],t[4]=n[4]-e[4],t[5]=n[5]-e[5],t[6]=n[6]-e[6],t[7]=n[7]-e[7],t[8]=n[8]-e[8],t[9]=n[9]-e[9],t[10]=n[10]-e[10],t[11]=n[11]-e[11],t[12]=n[12]-e[12],t[13]=n[13]-e[13],t[14]=n[14]-e[14],t[15]=n[15]-e[15],t},W.multiplyTransformation=function(n,e,t){y.typeOf.object("left",n),y.typeOf.object("right",e),y.typeOf.object("result",t);const i=n[0],s=n[1],o=n[2],r=n[4],a=n[5],l=n[6],c=n[8],h=n[9],u=n[10],d=n[12],f=n[13],g=n[14],_=e[0],v=e[1],E=e[2],w=e[4],C=e[5],P=e[6],R=e[8],A=e[9],O=e[10],M=e[12],z=e[13],k=e[14],q=i*_+r*v+c*E,Y=s*_+a*v+h*E,m=o*_+l*v+u*E,b=i*w+r*C+c*P,S=s*w+a*C+h*P,L=o*w+l*C+u*P,N=i*R+r*A+c*O,j=s*R+a*A+h*O,U=o*R+l*A+u*O,B=i*M+r*z+c*k+d,Z=s*M+a*z+h*k+f,G=o*M+l*z+u*k+g;return t[0]=q,t[1]=Y,t[2]=m,t[3]=0,t[4]=b,t[5]=S,t[6]=L,t[7]=0,t[8]=N,t[9]=j,t[10]=U,t[11]=0,t[12]=B,t[13]=Z,t[14]=G,t[15]=1,t},W.multiplyByMatrix3=function(n,e,t){y.typeOf.object("matrix",n),y.typeOf.object("rotation",e),y.typeOf.object("result",t);const i=n[0],s=n[1],o=n[2],r=n[4],a=n[5],l=n[6],c=n[8],h=n[9],u=n[10],d=e[0],f=e[1],g=e[2],_=e[3],v=e[4],E=e[5],w=e[6],C=e[7],P=e[8],R=i*d+r*f+c*g,A=s*d+a*f+h*g,O=o*d+l*f+u*g,M=i*_+r*v+c*E,z=s*_+a*v+h*E,k=o*_+l*v+u*E,q=i*w+r*C+c*P,Y=s*w+a*C+h*P,m=o*w+l*C+u*P;return t[0]=R,t[1]=A,t[2]=O,t[3]=0,t[4]=M,t[5]=z,t[6]=k,t[7]=0,t[8]=q,t[9]=Y,t[10]=m,t[11]=0,t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t},W.multiplyByTranslation=function(n,e,t){y.typeOf.object("matrix",n),y.typeOf.object("translation",e),y.typeOf.object("result",t);const i=e.x,s=e.y,o=e.z,r=i*n[0]+s*n[4]+o*n[8]+n[12],a=i*n[1]+s*n[5]+o*n[9]+n[13],l=i*n[2]+s*n[6]+o*n[10]+n[14];return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=r,t[13]=a,t[14]=l,t[15]=n[15],t},W.multiplyByScale=function(n,e,t){y.typeOf.object("matrix",n),y.typeOf.object("scale",e),y.typeOf.object("result",t);const i=e.x,s=e.y,o=e.z;return i===1&&s===1&&o===1?W.clone(n,t):(t[0]=i*n[0],t[1]=i*n[1],t[2]=i*n[2],t[3]=n[3],t[4]=s*n[4],t[5]=s*n[5],t[6]=s*n[6],t[7]=n[7],t[8]=o*n[8],t[9]=o*n[9],t[10]=o*n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t)},W.multiplyByUniformScale=function(n,e,t){return y.typeOf.object("matrix",n),y.typeOf.number("scale",e),y.typeOf.object("result",t),t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3],t[4]=n[4]*e,t[5]=n[5]*e,t[6]=n[6]*e,t[7]=n[7],t[8]=n[8]*e,t[9]=n[9]*e,t[10]=n[10]*e,t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t},W.multiplyByVector=function(n,e,t){y.typeOf.object("matrix",n),y.typeOf.object("cartesian",e),y.typeOf.object("result",t);const i=e.x,s=e.y,o=e.z,r=e.w,a=n[0]*i+n[4]*s+n[8]*o+n[12]*r,l=n[1]*i+n[5]*s+n[9]*o+n[13]*r,c=n[2]*i+n[6]*s+n[10]*o+n[14]*r,h=n[3]*i+n[7]*s+n[11]*o+n[15]*r;return t.x=a,t.y=l,t.z=c,t.w=h,t},W.multiplyByPointAsVector=function(n,e,t){y.typeOf.object("matrix",n),y.typeOf.object("cartesian",e),y.typeOf.object("result",t);const i=e.x,s=e.y,o=e.z,r=n[0]*i+n[4]*s+n[8]*o,a=n[1]*i+n[5]*s+n[9]*o,l=n[2]*i+n[6]*s+n[10]*o;return t.x=r,t.y=a,t.z=l,t},W.multiplyByPoint=function(n,e,t){y.typeOf.object("matrix",n),y.typeOf.object("cartesian",e),y.typeOf.object("result",t);const i=e.x,s=e.y,o=e.z,r=n[0]*i+n[4]*s+n[8]*o+n[12],a=n[1]*i+n[5]*s+n[9]*o+n[13],l=n[2]*i+n[6]*s+n[10]*o+n[14];return t.x=r,t.y=a,t.z=l,t},W.multiplyByScalar=function(n,e,t){return y.typeOf.object("matrix",n),y.typeOf.number("scalar",e),y.typeOf.object("result",t),t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t[4]=n[4]*e,t[5]=n[5]*e,t[6]=n[6]*e,t[7]=n[7]*e,t[8]=n[8]*e,t[9]=n[9]*e,t[10]=n[10]*e,t[11]=n[11]*e,t[12]=n[12]*e,t[13]=n[13]*e,t[14]=n[14]*e,t[15]=n[15]*e,t},W.negate=function(n,e){return y.typeOf.object("matrix",n),y.typeOf.object("result",e),e[0]=-n[0],e[1]=-n[1],e[2]=-n[2],e[3]=-n[3],e[4]=-n[4],e[5]=-n[5],e[6]=-n[6],e[7]=-n[7],e[8]=-n[8],e[9]=-n[9],e[10]=-n[10],e[11]=-n[11],e[12]=-n[12],e[13]=-n[13],e[14]=-n[14],e[15]=-n[15],e},W.transpose=function(n,e){y.typeOf.object("matrix",n),y.typeOf.object("result",e);const t=n[1],i=n[2],s=n[3],o=n[6],r=n[7],a=n[11];return e[0]=n[0],e[1]=n[4],e[2]=n[8],e[3]=n[12],e[4]=t,e[5]=n[5],e[6]=n[9],e[7]=n[13],e[8]=i,e[9]=o,e[10]=n[10],e[11]=n[14],e[12]=s,e[13]=r,e[14]=a,e[15]=n[15],e},W.abs=function(n,e){return y.typeOf.object("matrix",n),y.typeOf.object("result",e),e[0]=Math.abs(n[0]),e[1]=Math.abs(n[1]),e[2]=Math.abs(n[2]),e[3]=Math.abs(n[3]),e[4]=Math.abs(n[4]),e[5]=Math.abs(n[5]),e[6]=Math.abs(n[6]),e[7]=Math.abs(n[7]),e[8]=Math.abs(n[8]),e[9]=Math.abs(n[9]),e[10]=Math.abs(n[10]),e[11]=Math.abs(n[11]),e[12]=Math.abs(n[12]),e[13]=Math.abs(n[13]),e[14]=Math.abs(n[14]),e[15]=Math.abs(n[15]),e},W.equals=function(n,e){return n===e||x(n)&&x(e)&&n[12]===e[12]&&n[13]===e[13]&&n[14]===e[14]&&n[0]===e[0]&&n[1]===e[1]&&n[2]===e[2]&&n[4]===e[4]&&n[5]===e[5]&&n[6]===e[6]&&n[8]===e[8]&&n[9]===e[9]&&n[10]===e[10]&&n[3]===e[3]&&n[7]===e[7]&&n[11]===e[11]&&n[15]===e[15]},W.equalsEpsilon=function(n,e,t){return t=t??0,n===e||x(n)&&x(e)&&Math.abs(n[0]-e[0])<=t&&Math.abs(n[1]-e[1])<=t&&Math.abs(n[2]-e[2])<=t&&Math.abs(n[3]-e[3])<=t&&Math.abs(n[4]-e[4])<=t&&Math.abs(n[5]-e[5])<=t&&Math.abs(n[6]-e[6])<=t&&Math.abs(n[7]-e[7])<=t&&Math.abs(n[8]-e[8])<=t&&Math.abs(n[9]-e[9])<=t&&Math.abs(n[10]-e[10])<=t&&Math.abs(n[11]-e[11])<=t&&Math.abs(n[12]-e[12])<=t&&Math.abs(n[13]-e[13])<=t&&Math.abs(n[14]-e[14])<=t&&Math.abs(n[15]-e[15])<=t},W.getTranslation=function(n,e){return y.typeOf.object("matrix",n),y.typeOf.object("result",e),e.x=n[12],e.y=n[13],e.z=n[14],e},W.getMatrix3=function(n,e){return y.typeOf.object("matrix",n),y.typeOf.object("result",e),e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[4],e[4]=n[5],e[5]=n[6],e[6]=n[8],e[7]=n[9],e[8]=n[10],e};const eP=new H,tP=new H,nP=new ce,iP=new ce(0,0,0,1);W.inverse=function(n,e){y.typeOf.object("matrix",n),y.typeOf.object("result",e);const t=n[0],i=n[4],s=n[8],o=n[12],r=n[1],a=n[5],l=n[9],c=n[13],h=n[2],u=n[6],d=n[10],f=n[14],g=n[3],_=n[7],v=n[11],E=n[15];let w=d*E,C=f*v,P=u*E,R=f*_,A=u*v,O=d*_,M=h*E,z=f*g,k=h*v,q=d*g,Y=h*_,m=u*g;const b=w*a+R*l+A*c-(C*a+P*l+O*c),S=C*r+M*l+q*c-(w*r+z*l+k*c),L=P*r+z*a+Y*c-(R*r+M*a+m*c),N=O*r+k*a+m*l-(A*r+q*a+Y*l),j=C*i+P*s+O*o-(w*i+R*s+A*o),U=w*t+z*s+k*o-(C*t+M*s+q*o),B=R*t+M*i+m*o-(P*t+z*i+Y*o),Z=A*t+q*i+Y*s-(O*t+k*i+m*s);w=s*c,C=o*l,P=i*c,R=o*a,A=i*l,O=s*a,M=t*c,z=o*r,k=t*l,q=s*r,Y=t*a,m=i*r;const G=w*_+R*v+A*E-(C*_+P*v+O*E),ae=C*g+M*v+q*E-(w*g+z*v+k*E),ne=P*g+z*_+Y*E-(R*g+M*_+m*E),V=O*g+k*_+m*v-(A*g+q*_+Y*v),re=P*d+O*f+C*u-(A*f+w*u+R*d),se=k*f+w*h+z*d-(M*d+q*f+C*h),he=M*u+m*f+R*h-(Y*f+P*h+z*u),ye=Y*d+A*h+q*u-(k*u+m*d+O*h);let pe=t*b+i*S+s*L+o*N;if(Math.abs(pe)<F.EPSILON21){if(H.equalsEpsilon(W.getMatrix3(n,eP),tP,F.EPSILON7)&&ce.equals(W.getRow(n,3,nP),iP))return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=0,e[11]=0,e[12]=-n[12],e[13]=-n[13],e[14]=-n[14],e[15]=1,e;throw new Fn("matrix is not invertible because its determinate is zero.")}return pe=1/pe,e[0]=b*pe,e[1]=S*pe,e[2]=L*pe,e[3]=N*pe,e[4]=j*pe,e[5]=U*pe,e[6]=B*pe,e[7]=Z*pe,e[8]=G*pe,e[9]=ae*pe,e[10]=ne*pe,e[11]=V*pe,e[12]=re*pe,e[13]=se*pe,e[14]=he*pe,e[15]=ye*pe,e},W.inverseTransformation=function(n,e){y.typeOf.object("matrix",n),y.typeOf.object("result",e);const t=n[0],i=n[1],s=n[2],o=n[4],r=n[5],a=n[6],l=n[8],c=n[9],h=n[10],u=n[12],d=n[13],f=n[14],g=-t*u-i*d-s*f,_=-o*u-r*d-a*f,v=-l*u-c*d-h*f;return e[0]=t,e[1]=o,e[2]=l,e[3]=0,e[4]=i,e[5]=r,e[6]=c,e[7]=0,e[8]=s,e[9]=a,e[10]=h,e[11]=0,e[12]=g,e[13]=_,e[14]=v,e[15]=1,e};const sP=new W;W.inverseTranspose=function(n,e){return y.typeOf.object("matrix",n),y.typeOf.object("result",e),W.inverse(W.transpose(n,sP),e)},W.IDENTITY=Object.freeze(new W(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),W.ZERO=Object.freeze(new W(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),W.COLUMN0ROW0=0,W.COLUMN0ROW1=1,W.COLUMN0ROW2=2,W.COLUMN0ROW3=3,W.COLUMN1ROW0=4,W.COLUMN1ROW1=5,W.COLUMN1ROW2=6,W.COLUMN1ROW3=7,W.COLUMN2ROW0=8,W.COLUMN2ROW1=9,W.COLUMN2ROW2=10,W.COLUMN2ROW3=11,W.COLUMN3ROW0=12,W.COLUMN3ROW1=13,W.COLUMN3ROW2=14,W.COLUMN3ROW3=15,Object.defineProperties(W.prototype,{length:{get:function(){return W.packedLength}}}),W.prototype.clone=function(n){return W.clone(this,n)},W.prototype.equals=function(n){return W.equals(this,n)},W.equalsArray=function(n,e,t){return n[0]===e[t]&&n[1]===e[t+1]&&n[2]===e[t+2]&&n[3]===e[t+3]&&n[4]===e[t+4]&&n[5]===e[t+5]&&n[6]===e[t+6]&&n[7]===e[t+7]&&n[8]===e[t+8]&&n[9]===e[t+9]&&n[10]===e[t+10]&&n[11]===e[t+11]&&n[12]===e[t+12]&&n[13]===e[t+13]&&n[14]===e[t+14]&&n[15]===e[t+15]},W.prototype.equalsEpsilon=function(n,e){return W.equalsEpsilon(this,n,e)},W.prototype.toString=function(){return`(${this[0]}, ${this[4]}, ${this[8]}, ${this[12]})
34
31
  (${this[1]}, ${this[5]}, ${this[9]}, ${this[13]})
35
32
  (${this[2]}, ${this[6]}, ${this[10]}, ${this[14]})
36
- (${this[3]}, ${this[7]}, ${this[11]}, ${this[15]})`};function Mo(i,t,e){p.defined("array",i),p.defined("itemToFind",t),p.defined("comparator",e);let n=0,s=i.length-1,o,r;for(;n<=s;){if(o=~~((n+s)/2),r=e(i[o],t),r<0){n=o+1;continue}if(r>0){s=o-1;continue}return o}return~(s+1)}function Eh(i,t,e,n,s){this.xPoleWander=i,this.yPoleWander=t,this.xPoleOffset=e,this.yPoleOffset=n,this.ut1MinusUtc=s}function Ch(i){if(i===null||isNaN(i))throw new j("year is required and must be a number.");return i%4===0&&i%100!==0||i%400===0}const Sf=[31,28,31,30,31,30,31,31,30,31,30,31];function bh(i,t,e,n,s,o,r,a){i=i??1,t=t??1,e=e??1,n=n??0,s=s??0,o=o??0,r=r??0,a=a??!1,y(),w(),this.year=i,this.month=t,this.day=e,this.hour=n,this.minute=s,this.second=o,this.millisecond=r,this.isLeapSecond=a;function y(){p.typeOf.number.greaterThanOrEquals("Year",i,1),p.typeOf.number.lessThanOrEquals("Year",i,9999),p.typeOf.number.greaterThanOrEquals("Month",t,1),p.typeOf.number.lessThanOrEquals("Month",t,12),p.typeOf.number.greaterThanOrEquals("Day",e,1),p.typeOf.number.lessThanOrEquals("Day",e,31),p.typeOf.number.greaterThanOrEquals("Hour",n,0),p.typeOf.number.lessThanOrEquals("Hour",n,23),p.typeOf.number.greaterThanOrEquals("Minute",s,0),p.typeOf.number.lessThanOrEquals("Minute",s,59),p.typeOf.bool("IsLeapSecond",a),p.typeOf.number.greaterThanOrEquals("Second",o,0),p.typeOf.number.lessThanOrEquals("Second",o,a?60:59),p.typeOf.number.greaterThanOrEquals("Millisecond",r,0),p.typeOf.number.lessThan("Millisecond",r,1e3)}function w(){const E=t===2&&Ch(i)?Sf[t-1]+1:Sf[t-1];if(e>E)throw new j("Month and Day represents invalid date")}}function Pt(i,t){this.julianDate=i,this.offset=t}const Dt=Object.freeze({SECONDS_PER_MILLISECOND:.001,SECONDS_PER_MINUTE:60,MINUTES_PER_HOUR:60,HOURS_PER_DAY:24,SECONDS_PER_HOUR:3600,MINUTES_PER_DAY:1440,SECONDS_PER_DAY:86400,DAYS_PER_JULIAN_CENTURY:36525,PICOSECOND:1e-9,MODIFIED_JULIAN_DATE_DIFFERENCE:24000005e-1}),mt=Object.freeze({UTC:0,TAI:1}),Rf=new bh,ua=[31,28,31,30,31,30,31,31,30,31,30,31],da=29;function xh(i,t){return $.compare(i.julianDate,t.julianDate)}const Is=new Pt;function fa(i){Is.julianDate=i;const t=$.leapSeconds;let e=Mo(t,Is,xh);e<0&&(e=~e),e>=t.length&&(e=t.length-1);let n=t[e].offset;e>0&&$.secondsDifference(t[e].julianDate,i)>n&&(e--,n=t[e].offset),$.addSeconds(i,n,i)}function Pf(i,t){Is.julianDate=i;const e=$.leapSeconds;let n=Mo(e,Is,xh);if(n<0&&(n=~n),n===0)return $.addSeconds(i,-e[0].offset,t);if(n>=e.length)return $.addSeconds(i,-e[n-1].offset,t);const s=$.secondsDifference(e[n].julianDate,i);if(s===0)return $.addSeconds(i,-e[n].offset,t);if(!(s<=1))return $.addSeconds(i,-e[--n].offset,t)}function cn(i,t,e){const n=t/Dt.SECONDS_PER_DAY|0;return i+=n,t-=Dt.SECONDS_PER_DAY*n,t<0&&(i--,t+=Dt.SECONDS_PER_DAY),e.dayNumber=i,e.secondsOfDay=t,e}function Sh(i,t,e,n,s,o,r){const a=(t-14)/12|0,c=i+4800+a;let h=(1461*c/4|0)+(367*(t-2-12*a)/12|0)-(3*((c+100)/100|0)/4|0)+e-32075;n=n-12,n<0&&(n+=24);const l=o+(n*Dt.SECONDS_PER_HOUR+s*Dt.SECONDS_PER_MINUTE+r*Dt.SECONDS_PER_MILLISECOND);return l>=43200&&(h-=1),[h,l]}const Oy=/^(\d{4})$/,Iy=/^(\d{4})-(\d{2})$/,Ty=/^(\d{4})-?(\d{3})$/,Ay=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,My=/^(\d{4})-?(\d{2})-?(\d{2})$/,Rh=/([Z+\-])?(\d{2})?:?(\d{2})?$/,Dy=/^(\d{2})(\.\d+)?/.source+Rh.source,Fy=/^(\d{2}):?(\d{2})(\.\d+)?/.source+Rh.source,Ly=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+Rh.source,Ye="Invalid ISO 8601 date.";function $(i,t,e){this.dayNumber=void 0,this.secondsOfDay=void 0,i=i??0,t=t??0,e=e??mt.UTC;const n=i|0;t=t+(i-n)*Dt.SECONDS_PER_DAY,cn(n,t,this),e===mt.UTC&&fa(this)}$.fromGregorianDate=function(i,t){if(!(i instanceof bh))throw new j("date must be a valid GregorianDate.");const e=Sh(i.year,i.month,i.day,i.hour,i.minute,i.second,i.millisecond);return C(t)?(cn(e[0],e[1],t),fa(t),t):new $(e[0],e[1],mt.UTC)},$.fromDate=function(i,t){if(!(i instanceof Date)||isNaN(i.getTime()))throw new j("date must be a valid JavaScript Date.");const e=Sh(i.getUTCFullYear(),i.getUTCMonth()+1,i.getUTCDate(),i.getUTCHours(),i.getUTCMinutes(),i.getUTCSeconds(),i.getUTCMilliseconds());return C(t)?(cn(e[0],e[1],t),fa(t),t):new $(e[0],e[1],mt.UTC)},$.fromIso8601=function(i,t){if(typeof i!="string")throw new j(Ye);i=i.replace(",",".");let e=i.split("T"),n,s=1,o=1,r=0,a=0,c=0,h=0;const l=e[0],u=e[1];let f,g;if(!C(l))throw new j(Ye);let _;if(e=l.match(My),e!==null){if(_=l.split("-").length-1,_>0&&_!==2)throw new j(Ye);n=+e[1],s=+e[2],o=+e[3]}else if(e=l.match(Iy),e!==null)n=+e[1],s=+e[2];else if(e=l.match(Oy),e!==null)n=+e[1];else{let b;if(e=l.match(Ty),e!==null){if(n=+e[1],b=+e[2],g=Ch(n),b<1||g&&b>366||!g&&b>365)throw new j(Ye)}else if(e=l.match(Ay),e!==null){n=+e[1];const P=+e[2],I=+e[3]||0;if(_=l.split("-").length-1,_>0&&(!C(e[3])&&_!==1||C(e[3])&&_!==2))throw new j(Ye);const M=new Date(Date.UTC(n,0,4));b=P*7+I-M.getUTCDay()-3}else throw new j(Ye);f=new Date(Date.UTC(n,0,1)),f.setUTCDate(b),s=f.getUTCMonth()+1,o=f.getUTCDate()}if(g=Ch(n),s<1||s>12||o<1||(s!==2||!g)&&o>ua[s-1]||g&&s===2&&o>da)throw new j(Ye);let y;if(C(u)){if(e=u.match(Ly),e!==null){if(_=u.split(":").length-1,_>0&&_!==2&&_!==3)throw new j(Ye);r=+e[1],a=+e[2],c=+e[3],h=+(e[4]||0)*1e3,y=5}else if(e=u.match(Fy),e!==null){if(_=u.split(":").length-1,_>2)throw new j(Ye);r=+e[1],a=+e[2],c=+(e[3]||0)*60,y=4}else if(e=u.match(Dy),e!==null)r=+e[1],a=+(e[2]||0)*60,y=3;else throw new j(Ye);if(a>=60||c>=61||r>24||r===24&&(a>0||c>0||h>0))throw new j(Ye);const b=e[y],P=+e[y+1],I=+(e[y+2]||0);switch(b){case"+":r=r-P,a=a-I;break;case"-":r=r+P,a=a+I;break;case"Z":break;default:a=a+new Date(Date.UTC(n,s-1,o,r,a)).getTimezoneOffset();break}}const w=c===60;for(w&&c--;a>=60;)a-=60,r++;for(;r>=24;)r-=24,o++;for(f=g&&s===2?da:ua[s-1];o>f;)o-=f,s++,s>12&&(s-=12,n++),f=g&&s===2?da:ua[s-1];for(;a<0;)a+=60,r--;for(;r<0;)r+=24,o--;for(;o<1;)s--,s<1&&(s+=12,n--),f=g&&s===2?da:ua[s-1],o+=f;const E=Sh(n,s,o,r,a,c,h);return C(t)?(cn(E[0],E[1],t),fa(t)):t=new $(E[0],E[1],mt.UTC),w&&$.addSeconds(t,1,t),t},$.now=function(i){return $.fromDate(new Date,i)};const ga=new $(0,0,mt.TAI);$.toGregorianDate=function(i,t){if(!C(i))throw new j("julianDate is required.");let e=!1,n=Pf(i,ga);C(n)||($.addSeconds(i,-1,ga),n=Pf(ga,ga),e=!0);let s=n.dayNumber;const o=n.secondsOfDay;o>=43200&&(s+=1);let r=s+68569|0;const a=4*r/146097|0;r=r-((146097*a+3)/4|0)|0;const c=4e3*(r+1)/1461001|0;r=r-(1461*c/4|0)+31|0;const h=80*r/2447|0,l=r-(2447*h/80|0)|0;r=h/11|0;const u=h+2-12*r|0,f=100*(a-49)+c+r|0;let g=o/Dt.SECONDS_PER_HOUR|0,_=o-g*Dt.SECONDS_PER_HOUR;const y=_/Dt.SECONDS_PER_MINUTE|0;_=_-y*Dt.SECONDS_PER_MINUTE;let w=_|0;const E=(_-w)/Dt.SECONDS_PER_MILLISECOND;return g+=12,g>23&&(g-=24),e&&(w+=1),C(t)?(t.year=f,t.month=u,t.day=l,t.hour=g,t.minute=y,t.second=w,t.millisecond=E,t.isLeapSecond=e,t):new bh(f,u,l,g,y,w,E,e)},$.toDate=function(i){if(!C(i))throw new j("julianDate is required.");const t=$.toGregorianDate(i,Rf);let e=t.second;return t.isLeapSecond&&(e-=1),new Date(Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,e,t.millisecond))},$.toIso8601=function(i,t){if(!C(i))throw new j("julianDate is required.");const e=$.toGregorianDate(i,Rf);let n=e.year,s=e.month,o=e.day,r=e.hour;const a=e.minute,c=e.second,h=e.millisecond;n===1e4&&s===1&&o===1&&r===0&&a===0&&c===0&&h===0&&(n=9999,s=12,o=31,r=24);let l;if(!C(t)&&h!==0){const u=h*.01;return l=u<1e-6?u.toFixed(20).replace(".","").replace(/0+$/,""):u.toString().replace(".",""),`${n.toString().padStart(4,"0")}-${s.toString().padStart(2,"0")}-${o.toString().padStart(2,"0")}T${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${c.toString().padStart(2,"0")}.${l}Z`}return!C(t)||t===0?`${n.toString().padStart(4,"0")}-${s.toString().padStart(2,"0")}-${o.toString().padStart(2,"0")}T${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${c.toString().padStart(2,"0")}Z`:(l=(h*.01).toFixed(t).replace(".","").slice(0,t),`${n.toString().padStart(4,"0")}-${s.toString().padStart(2,"0")}-${o.toString().padStart(2,"0")}T${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${c.toString().padStart(2,"0")}.${l}Z`)},$.clone=function(i,t){if(C(i))return C(t)?(t.dayNumber=i.dayNumber,t.secondsOfDay=i.secondsOfDay,t):new $(i.dayNumber,i.secondsOfDay,mt.TAI)},$.compare=function(i,t){if(!C(i))throw new j("left is required.");if(!C(t))throw new j("right is required.");const e=i.dayNumber-t.dayNumber;return e!==0?e:i.secondsOfDay-t.secondsOfDay},$.equals=function(i,t){return i===t||C(i)&&C(t)&&i.dayNumber===t.dayNumber&&i.secondsOfDay===t.secondsOfDay},$.equalsEpsilon=function(i,t,e){return e=e??0,i===t||C(i)&&C(t)&&Math.abs($.secondsDifference(i,t))<=e},$.totalDays=function(i){if(!C(i))throw new j("julianDate is required.");return i.dayNumber+i.secondsOfDay/Dt.SECONDS_PER_DAY},$.secondsDifference=function(i,t){if(!C(i))throw new j("left is required.");if(!C(t))throw new j("right is required.");return(i.dayNumber-t.dayNumber)*Dt.SECONDS_PER_DAY+(i.secondsOfDay-t.secondsOfDay)},$.daysDifference=function(i,t){if(!C(i))throw new j("left is required.");if(!C(t))throw new j("right is required.");const e=i.dayNumber-t.dayNumber,n=(i.secondsOfDay-t.secondsOfDay)/Dt.SECONDS_PER_DAY;return e+n},$.computeTaiMinusUtc=function(i){Is.julianDate=i;const t=$.leapSeconds;let e=Mo(t,Is,xh);return e<0&&(e=~e,--e,e<0&&(e=0)),t[e].offset},$.addSeconds=function(i,t,e){if(!C(i))throw new j("julianDate is required.");if(!C(t))throw new j("seconds is required.");if(!C(e))throw new j("result is required.");return cn(i.dayNumber,i.secondsOfDay+t,e)},$.addMinutes=function(i,t,e){if(!C(i))throw new j("julianDate is required.");if(!C(t))throw new j("minutes is required.");if(!C(e))throw new j("result is required.");const n=i.secondsOfDay+t*Dt.SECONDS_PER_MINUTE;return cn(i.dayNumber,n,e)},$.addHours=function(i,t,e){if(!C(i))throw new j("julianDate is required.");if(!C(t))throw new j("hours is required.");if(!C(e))throw new j("result is required.");const n=i.secondsOfDay+t*Dt.SECONDS_PER_HOUR;return cn(i.dayNumber,n,e)},$.addDays=function(i,t,e){if(!C(i))throw new j("julianDate is required.");if(!C(t))throw new j("days is required.");if(!C(e))throw new j("result is required.");const n=i.dayNumber+t;return cn(n,i.secondsOfDay,e)},$.lessThan=function(i,t){return $.compare(i,t)<0},$.lessThanOrEquals=function(i,t){return $.compare(i,t)<=0},$.greaterThan=function(i,t){return $.compare(i,t)>0},$.greaterThanOrEquals=function(i,t){return $.compare(i,t)>=0},$.prototype.clone=function(i){return $.clone(this,i)},$.prototype.equals=function(i){return $.equals(this,i)},$.prototype.equalsEpsilon=function(i,t){return $.equalsEpsilon(this,i,t)},$.prototype.toString=function(){return $.toIso8601(this)},$.leapSeconds=[new Pt(new $(2441317,43210,mt.TAI),10),new Pt(new $(2441499,43211,mt.TAI),11),new Pt(new $(2441683,43212,mt.TAI),12),new Pt(new $(2442048,43213,mt.TAI),13),new Pt(new $(2442413,43214,mt.TAI),14),new Pt(new $(2442778,43215,mt.TAI),15),new Pt(new $(2443144,43216,mt.TAI),16),new Pt(new $(2443509,43217,mt.TAI),17),new Pt(new $(2443874,43218,mt.TAI),18),new Pt(new $(2444239,43219,mt.TAI),19),new Pt(new $(2444786,43220,mt.TAI),20),new Pt(new $(2445151,43221,mt.TAI),21),new Pt(new $(2445516,43222,mt.TAI),22),new Pt(new $(2446247,43223,mt.TAI),23),new Pt(new $(2447161,43224,mt.TAI),24),new Pt(new $(2447892,43225,mt.TAI),25),new Pt(new $(2448257,43226,mt.TAI),26),new Pt(new $(2448804,43227,mt.TAI),27),new Pt(new $(2449169,43228,mt.TAI),28),new Pt(new $(2449534,43229,mt.TAI),29),new Pt(new $(2450083,43230,mt.TAI),30),new Pt(new $(2450630,43231,mt.TAI),31),new Pt(new $(2451179,43232,mt.TAI),32),new Pt(new $(2453736,43233,mt.TAI),33),new Pt(new $(2454832,43234,mt.TAI),34),new Pt(new $(2456109,43235,mt.TAI),35),new Pt(new $(2457204,43236,mt.TAI),36),new Pt(new $(2457754,43237,mt.TAI),37)];var pa={exports:{}},Do={exports:{}};/*! https://mths.be/punycode v1.4.0 by @mathias */var zy=Do.exports,Of;function Ny(){return Of||(Of=1,function(i,t){(function(e){var n=t&&!t.nodeType&&t,s=i&&!i.nodeType&&i,o=typeof cf=="object"&&cf;(o.global===o||o.window===o||o.self===o)&&(e=o);var r,a=2147483647,c=36,h=1,l=26,u=38,f=700,g=72,_=128,y="-",w=/^xn--/,E=/[^\x20-\x7E]/,b=/[\x2E\u3002\uFF0E\uFF61]/g,P={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},I=c-h,M=Math.floor,D=String.fromCharCode,L;function z(V){throw new RangeError(P[V])}function q(V,Z){for(var B=V.length,at=[];B--;)at[B]=Z(V[B]);return at}function Y(V,Z){var B=V.split("@"),at="";B.length>1&&(at=B[0]+"@",V=B[1]),V=V.replace(b,".");var et=V.split("."),it=q(et,Z).join(".");return at+it}function X(V){for(var Z=[],B=0,at=V.length,et,it;B<at;)et=V.charCodeAt(B++),et>=55296&&et<=56319&&B<at?(it=V.charCodeAt(B++),(it&64512)==56320?Z.push(((et&1023)<<10)+(it&1023)+65536):(Z.push(et),B--)):Z.push(et);return Z}function Q(V){return q(V,function(Z){var B="";return Z>65535&&(Z-=65536,B+=D(Z>>>10&1023|55296),Z=56320|Z&1023),B+=D(Z),B}).join("")}function m(V){return V-48<10?V-22:V-65<26?V-65:V-97<26?V-97:c}function v(V,Z){return V+22+75*(V<26)-((Z!=0)<<5)}function S(V,Z,B){var at=0;for(V=B?M(V/f):V>>1,V+=M(V/Z);V>I*l>>1;at+=c)V=M(V/I);return M(at+(I+1)*V/(V+u))}function A(V){var Z=[],B=V.length,at,et=0,it=_,gt=g,wt,dt,Et,ft,xt,Ft,kt,Wt,he;for(wt=V.lastIndexOf(y),wt<0&&(wt=0),dt=0;dt<wt;++dt)V.charCodeAt(dt)>=128&&z("not-basic"),Z.push(V.charCodeAt(dt));for(Et=wt>0?wt+1:0;Et<B;){for(ft=et,xt=1,Ft=c;Et>=B&&z("invalid-input"),kt=m(V.charCodeAt(Et++)),(kt>=c||kt>M((a-et)/xt))&&z("overflow"),et+=kt*xt,Wt=Ft<=gt?h:Ft>=gt+l?l:Ft-gt,!(kt<Wt);Ft+=c)he=c-Wt,xt>M(a/he)&&z("overflow"),xt*=he;at=Z.length+1,gt=S(et-ft,at,ft==0),M(et/at)>a-it&&z("overflow"),it+=M(et/at),et%=at,Z.splice(et++,0,it)}return Q(Z)}function F(V){var Z,B,at,et,it,gt,wt,dt,Et,ft,xt,Ft=[],kt,Wt,he,ye;for(V=X(V),kt=V.length,Z=_,B=0,it=g,gt=0;gt<kt;++gt)xt=V[gt],xt<128&&Ft.push(D(xt));for(at=et=Ft.length,et&&Ft.push(y);at<kt;){for(wt=a,gt=0;gt<kt;++gt)xt=V[gt],xt>=Z&&xt<wt&&(wt=xt);for(Wt=at+1,wt-Z>M((a-B)/Wt)&&z("overflow"),B+=(wt-Z)*Wt,Z=wt,gt=0;gt<kt;++gt)if(xt=V[gt],xt<Z&&++B>a&&z("overflow"),xt==Z){for(dt=B,Et=c;ft=Et<=it?h:Et>=it+l?l:Et-it,!(dt<ft);Et+=c)ye=dt-ft,he=c-ft,Ft.push(D(v(ft+ye%he,0))),dt=M(ye/he);Ft.push(D(v(dt,0))),it=S(B,Wt,at==et),B=0,++at}++B,++Z}return Ft.join("")}function N(V){return Y(V,function(Z){return w.test(Z)?A(Z.slice(4).toLowerCase()):Z})}function G(V){return Y(V,function(Z){return E.test(Z)?"xn--"+F(Z):Z})}if(r={version:"1.3.2",ucs2:{decode:X,encode:Q},decode:A,encode:F,toASCII:G,toUnicode:N},n&&s)if(i.exports==n)s.exports=r;else for(L in r)r.hasOwnProperty(L)&&(n[L]=r[L]);else e.punycode=r})(zy)}(Do,Do.exports)),Do.exports}var ma={exports:{}};/*!
33
+ (${this[3]}, ${this[7]}, ${this[11]}, ${this[15]})`};let Os;const gt={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},un={};Object.defineProperties(un,{element:{get:function(){if(un.supportsFullscreen())return document[gt.fullscreenElement]}},changeEventName:{get:function(){if(un.supportsFullscreen())return gt.fullscreenchange}},errorEventName:{get:function(){if(un.supportsFullscreen())return gt.fullscreenerror}},enabled:{get:function(){if(un.supportsFullscreen())return document[gt.fullscreenEnabled]}},fullscreen:{get:function(){if(un.supportsFullscreen())return un.element!==null}}}),un.supportsFullscreen=function(){if(x(Os))return Os;Os=!1;const n=document.body;if(typeof n.requestFullscreen=="function")return gt.requestFullscreen="requestFullscreen",gt.exitFullscreen="exitFullscreen",gt.fullscreenEnabled="fullscreenEnabled",gt.fullscreenElement="fullscreenElement",gt.fullscreenchange="fullscreenchange",gt.fullscreenerror="fullscreenerror",Os=!0,Os;const e=["webkit","moz","o","ms","khtml"];let t;for(let i=0,s=e.length;i<s;++i){const o=e[i];t=`${o}RequestFullscreen`,typeof n[t]=="function"?(gt.requestFullscreen=t,Os=!0):(t=`${o}RequestFullScreen`,typeof n[t]=="function"&&(gt.requestFullscreen=t,Os=!0)),t=`${o}ExitFullscreen`,typeof document[t]=="function"?gt.exitFullscreen=t:(t=`${o}CancelFullScreen`,typeof document[t]=="function"&&(gt.exitFullscreen=t)),t=`${o}FullscreenEnabled`,document[t]!==void 0?gt.fullscreenEnabled=t:(t=`${o}FullScreenEnabled`,document[t]!==void 0&&(gt.fullscreenEnabled=t)),t=`${o}FullscreenElement`,document[t]!==void 0?gt.fullscreenElement=t:(t=`${o}FullScreenElement`,document[t]!==void 0&&(gt.fullscreenElement=t)),t=`${o}fullscreenchange`,document[`on${t}`]!==void 0&&(o==="ms"&&(t="MSFullscreenChange"),gt.fullscreenchange=t),t=`${o}fullscreenerror`,document[`on${t}`]!==void 0&&(o==="ms"&&(t="MSFullscreenError"),gt.fullscreenerror=t)}return Os},un.requestFullscreen=function(n,e){un.supportsFullscreen()&&n[gt.requestFullscreen]({vrDisplay:e})},un.exitFullscreen=function(){un.supportsFullscreen()&&document[gt.exitFullscreen]()},un._names=gt;let Ln;typeof navigator<"u"?Ln=navigator:Ln={};function Ga(n){const e=n.split(".");for(let t=0,i=e.length;t<i;++t)e[t]=parseInt(e[t],10);return e}let Xc,qy;function ff(){if(!x(Xc)&&(Xc=!1,!Qc())){const n=/ Chrome\/([\.0-9]+)/.exec(Ln.userAgent);n!==null&&(Xc=!0,qy=Ga(n[1]))}return Xc}function oP(){return ff()&&qy}let Yc,Wy;function Vy(){if(!x(Yc)&&(Yc=!1,!ff()&&!Qc()&&/ Safari\/[\.0-9]+/.test(Ln.userAgent))){const n=/ Version\/([\.0-9]+)/.exec(Ln.userAgent);n!==null&&(Yc=!0,Wy=Ga(n[1]))}return Yc}function rP(){return Vy()&&Wy}let Zc,pf;function By(){if(!x(Zc)){Zc=!1;const n=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(Ln.userAgent);n!==null&&(Zc=!0,pf=Ga(n[1]),pf.isNightly=!!n[2])}return Zc}function aP(){return By()&&pf}let Kc,$y;function Qc(){if(!x(Kc)){Kc=!1;const n=/ Edg\/([\.0-9]+)/.exec(Ln.userAgent);n!==null&&(Kc=!0,$y=Ga(n[1]))}return Kc}function lP(){return Qc()&&$y}let Jc,gf;function eh(){if(!x(Jc)){Jc=!1;const n=/Firefox\/([\.0-9]+)/.exec(Ln.userAgent);n!==null&&(Jc=!0,gf=Ga(n[1]))}return Jc}let mf;function cP(){return x(mf)||(mf=/Windows/i.test(Ln.appVersion)),mf}let yf;function hP(){return x(yf)||(yf=navigator.platform==="iPhone"||navigator.platform==="iPod"||navigator.platform==="iPad"),yf}function uP(){return eh()&&gf}let _f;function dP(){return x(_f)||(_f=!eh()&&typeof PointerEvent<"u"&&(!x(Ln.pointerEnabled)||Ln.pointerEnabled)),_f}let Hy,th;function Xy(){if(!x(th)){const n=document.createElement("canvas");n.setAttribute("style","image-rendering: -moz-crisp-edges;image-rendering: pixelated;");const e=n.style.imageRendering;th=x(e)&&e!=="",th&&(Hy=e)}return th}function fP(){return Xy()?Hy:void 0}function Xt(){if(!Xt.initialized)throw new $("You must call FeatureDetection.supportsWebP.initialize and wait for the promise to resolve before calling FeatureDetection.supportsWebP");return Xt._result}Xt._promise=void 0,Xt._result=void 0,Xt.initialize=function(){return x(Xt._promise)||(Xt._promise=new Promise(n=>{const e=new Image;e.onload=function(){Xt._result=e.width>0&&e.height>0,n(Xt._result)},e.onerror=function(){Xt._result=!1,n(Xt._result)},e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA"})),Xt._promise},Object.defineProperties(Xt,{initialized:{get:function(){return x(Xt._result)}}});const pr=[];typeof ArrayBuffer<"u"&&(pr.push(Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array),typeof Uint8ClampedArray<"u"&&pr.push(Uint8ClampedArray),typeof Uint8ClampedArray<"u"&&pr.push(Uint8ClampedArray),typeof BigInt64Array<"u"&&pr.push(BigInt64Array),typeof BigUint64Array<"u"&&pr.push(BigUint64Array));const Yt={isChrome:ff,chromeVersion:oP,isSafari:Vy,safariVersion:rP,isWebkit:By,webkitVersion:aP,isEdge:Qc,edgeVersion:lP,isFirefox:eh,firefoxVersion:uP,isWindows:cP,isIPadOrIOS:hP,hardwareConcurrency:Ln.hardwareConcurrency??3,supportsPointerEvents:dP,supportsImageRenderingPixelated:Xy,supportsWebP:Xt,imageRenderingValue:fP,typedArrayTypes:pr};Yt.supportsBasis=function(n){return Yt.supportsWebAssembly()&&n.context.supportsBasis},Yt.supportsFullscreen=function(){return un.supportsFullscreen()},Yt.supportsTypedArrays=function(){return typeof ArrayBuffer<"u"},Yt.supportsBigInt64Array=function(){return typeof BigInt64Array<"u"},Yt.supportsBigUint64Array=function(){return typeof BigUint64Array<"u"},Yt.supportsBigInt=function(){return typeof BigInt<"u"},Yt.supportsWebWorkers=function(){return typeof Worker<"u"},Yt.supportsWebAssembly=function(){return typeof WebAssembly<"u"},Yt.supportsWebgl2=function(n){return y.defined("scene",n),n.context.webgl2},Yt.supportsEsmWebWorkers=function(){return!eh()||parseInt(gf)>=114};function wf(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t*6<1?n+(e-n)*6*t:t*2<1?e:t*3<2?n+(e-n)*(.6666666666666666-t)*6:n}function T(n,e,t,i){this.red=n??1,this.green=e??1,this.blue=t??1,this.alpha=i??1}T.fromCartesian4=function(n,e){return y.typeOf.object("cartesian",n),x(e)?(e.red=n.x,e.green=n.y,e.blue=n.z,e.alpha=n.w,e):new T(n.x,n.y,n.z,n.w)},T.fromBytes=function(n,e,t,i,s){return n=T.byteToFloat(n??255),e=T.byteToFloat(e??255),t=T.byteToFloat(t??255),i=T.byteToFloat(i??255),x(s)?(s.red=n,s.green=e,s.blue=t,s.alpha=i,s):new T(n,e,t,i)},T.fromAlpha=function(n,e,t){return y.typeOf.object("color",n),y.typeOf.number("alpha",e),x(t)?(t.red=n.red,t.green=n.green,t.blue=n.blue,t.alpha=e,t):new T(n.red,n.green,n.blue,e)};let vf,bf,$i;Yt.supportsTypedArrays()&&(vf=new ArrayBuffer(4),bf=new Uint32Array(vf),$i=new Uint8Array(vf)),T.fromRgba=function(n,e){return bf[0]=n,T.fromBytes($i[0],$i[1],$i[2],$i[3],e)},T.fromHsl=function(n,e,t,i,s){n=(n??0)%1,e=e??0,t=t??0,i=i??1;let o=t,r=t,a=t;if(e!==0){let l;t<.5?l=t*(1+e):l=t+e-t*e;const c=2*t-l;o=wf(c,l,n+.3333333333333333),r=wf(c,l,n),a=wf(c,l,n-.3333333333333333)}return x(s)?(s.red=o,s.green=r,s.blue=a,s.alpha=i,s):new T(o,r,a,i)},T.fromRandom=function(n,e){n=n??_i.EMPTY_OBJECT;let t=n.red;if(!x(t)){const r=n.minimumRed??0,a=n.maximumRed??1;y.typeOf.number.lessThanOrEquals("minimumRed",r,a),t=r+F.nextRandomNumber()*(a-r)}let i=n.green;if(!x(i)){const r=n.minimumGreen??0,a=n.maximumGreen??1;y.typeOf.number.lessThanOrEquals("minimumGreen",r,a),i=r+F.nextRandomNumber()*(a-r)}let s=n.blue;if(!x(s)){const r=n.minimumBlue??0,a=n.maximumBlue??1;y.typeOf.number.lessThanOrEquals("minimumBlue",r,a),s=r+F.nextRandomNumber()*(a-r)}let o=n.alpha;if(!x(o)){const r=n.minimumAlpha??0,a=n.maximumAlpha??1;y.typeOf.number.lessThanOrEquals("minimumAlpha",r,a),o=r+F.nextRandomNumber()*(a-r)}return x(e)?(e.red=t,e.green=i,e.blue=s,e.alpha=o,e):new T(t,i,s,o)};const pP=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,gP=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,mP=/^rgba?\s*\(\s*([0-9.]+%?)\s*[,\s]+\s*([0-9.]+%?)\s*[,\s]+\s*([0-9.]+%?)(?:\s*[,\s/]+\s*([0-9.]+))?\s*\)$/i,yP=/^hsla?\s*\(\s*([0-9.]+)\s*[,\s]+\s*([0-9.]+%)\s*[,\s]+\s*([0-9.]+%)(?:\s*[,\s/]+\s*([0-9.]+))?\s*\)$/i;T.fromCssColorString=function(n,e){y.typeOf.string("color",n),x(e)||(e=new T),n=n.trim();const t=T[n.toUpperCase()];if(x(t))return T.clone(t,e),e;let i=pP.exec(n);return i!==null?(e.red=parseInt(i[1],16)/15,e.green=parseInt(i[2],16)/15,e.blue=parseInt(i[3],16)/15,e.alpha=parseInt(i[4]??"f",16)/15,e):(i=gP.exec(n),i!==null?(e.red=parseInt(i[1],16)/255,e.green=parseInt(i[2],16)/255,e.blue=parseInt(i[3],16)/255,e.alpha=parseInt(i[4]??"ff",16)/255,e):(i=mP.exec(n),i!==null?(e.red=parseFloat(i[1])/(i[1].substr(-1)==="%"?100:255),e.green=parseFloat(i[2])/(i[2].substr(-1)==="%"?100:255),e.blue=parseFloat(i[3])/(i[3].substr(-1)==="%"?100:255),e.alpha=parseFloat(i[4]??"1.0"),e):(i=yP.exec(n),i!==null?T.fromHsl(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,parseFloat(i[4]??"1.0"),e):(e=void 0,e))))},T.packedLength=4,T.pack=function(n,e,t){return y.typeOf.object("value",n),y.defined("array",e),t=t??0,e[t++]=n.red,e[t++]=n.green,e[t++]=n.blue,e[t]=n.alpha,e},T.unpack=function(n,e,t){return y.defined("array",n),e=e??0,x(t)||(t=new T),t.red=n[e++],t.green=n[e++],t.blue=n[e++],t.alpha=n[e],t},T.byteToFloat=function(n){return n/255},T.floatToByte=function(n){return n===1?255:n*256|0},T.clone=function(n,e){if(x(n))return x(e)?(e.red=n.red,e.green=n.green,e.blue=n.blue,e.alpha=n.alpha,e):new T(n.red,n.green,n.blue,n.alpha)},T.equals=function(n,e){return n===e||x(n)&&x(e)&&n.red===e.red&&n.green===e.green&&n.blue===e.blue&&n.alpha===e.alpha},T.equalsArray=function(n,e,t){return n.red===e[t]&&n.green===e[t+1]&&n.blue===e[t+2]&&n.alpha===e[t+3]},T.prototype.clone=function(n){return T.clone(this,n)},T.prototype.equals=function(n){return T.equals(this,n)},T.prototype.equalsEpsilon=function(n,e){return this===n||x(n)&&Math.abs(this.red-n.red)<=e&&Math.abs(this.green-n.green)<=e&&Math.abs(this.blue-n.blue)<=e&&Math.abs(this.alpha-n.alpha)<=e},T.prototype.toString=function(){return`(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`},T.prototype.toCssColorString=function(){const n=T.floatToByte(this.red),e=T.floatToByte(this.green),t=T.floatToByte(this.blue);return this.alpha===1?`rgb(${n},${e},${t})`:`rgba(${n},${e},${t},${this.alpha})`},T.prototype.toCssHexString=function(){let n=T.floatToByte(this.red).toString(16);n.length<2&&(n=`0${n}`);let e=T.floatToByte(this.green).toString(16);e.length<2&&(e=`0${e}`);let t=T.floatToByte(this.blue).toString(16);if(t.length<2&&(t=`0${t}`),this.alpha<1){let i=T.floatToByte(this.alpha).toString(16);return i.length<2&&(i=`0${i}`),`#${n}${e}${t}${i}`}return`#${n}${e}${t}`},T.prototype.toBytes=function(n){const e=T.floatToByte(this.red),t=T.floatToByte(this.green),i=T.floatToByte(this.blue),s=T.floatToByte(this.alpha);return x(n)?(n[0]=e,n[1]=t,n[2]=i,n[3]=s,n):[e,t,i,s]},T.bytesToRgba=function(n,e,t,i){return $i[0]=n,$i[1]=e,$i[2]=t,$i[3]=i,bf[0]},T.prototype.toRgba=function(){return T.bytesToRgba(T.floatToByte(this.red),T.floatToByte(this.green),T.floatToByte(this.blue),T.floatToByte(this.alpha))},T.prototype.brighten=function(n,e){return y.typeOf.number("magnitude",n),y.typeOf.number.greaterThanOrEquals("magnitude",n,0),y.typeOf.object("result",e),n=1-n,e.red=1-(1-this.red)*n,e.green=1-(1-this.green)*n,e.blue=1-(1-this.blue)*n,e.alpha=this.alpha,e},T.prototype.darken=function(n,e){return y.typeOf.number("magnitude",n),y.typeOf.number.greaterThanOrEquals("magnitude",n,0),y.typeOf.object("result",e),n=1-n,e.red=this.red*n,e.green=this.green*n,e.blue=this.blue*n,e.alpha=this.alpha,e},T.prototype.withAlpha=function(n,e){return T.fromAlpha(this,n,e)},T.add=function(n,e,t){return y.typeOf.object("left",n),y.typeOf.object("right",e),y.typeOf.object("result",t),t.red=n.red+e.red,t.green=n.green+e.green,t.blue=n.blue+e.blue,t.alpha=n.alpha+e.alpha,t},T.subtract=function(n,e,t){return y.typeOf.object("left",n),y.typeOf.object("right",e),y.typeOf.object("result",t),t.red=n.red-e.red,t.green=n.green-e.green,t.blue=n.blue-e.blue,t.alpha=n.alpha-e.alpha,t},T.multiply=function(n,e,t){return y.typeOf.object("left",n),y.typeOf.object("right",e),y.typeOf.object("result",t),t.red=n.red*e.red,t.green=n.green*e.green,t.blue=n.blue*e.blue,t.alpha=n.alpha*e.alpha,t},T.divide=function(n,e,t){return y.typeOf.object("left",n),y.typeOf.object("right",e),y.typeOf.object("result",t),t.red=n.red/e.red,t.green=n.green/e.green,t.blue=n.blue/e.blue,t.alpha=n.alpha/e.alpha,t},T.mod=function(n,e,t){return y.typeOf.object("left",n),y.typeOf.object("right",e),y.typeOf.object("result",t),t.red=n.red%e.red,t.green=n.green%e.green,t.blue=n.blue%e.blue,t.alpha=n.alpha%e.alpha,t},T.lerp=function(n,e,t,i){return y.typeOf.object("start",n),y.typeOf.object("end",e),y.typeOf.number("t",t),y.typeOf.object("result",i),i.red=F.lerp(n.red,e.red,t),i.green=F.lerp(n.green,e.green,t),i.blue=F.lerp(n.blue,e.blue,t),i.alpha=F.lerp(n.alpha,e.alpha,t),i},T.multiplyByScalar=function(n,e,t){return y.typeOf.object("color",n),y.typeOf.number("scalar",e),y.typeOf.object("result",t),t.red=n.red*e,t.green=n.green*e,t.blue=n.blue*e,t.alpha=n.alpha*e,t},T.divideByScalar=function(n,e,t){return y.typeOf.object("color",n),y.typeOf.number("scalar",e),y.typeOf.object("result",t),t.red=n.red/e,t.green=n.green/e,t.blue=n.blue/e,t.alpha=n.alpha/e,t},T.ALICEBLUE=Object.freeze(T.fromCssColorString("#F0F8FF")),T.ANTIQUEWHITE=Object.freeze(T.fromCssColorString("#FAEBD7")),T.AQUA=Object.freeze(T.fromCssColorString("#00FFFF")),T.AQUAMARINE=Object.freeze(T.fromCssColorString("#7FFFD4")),T.AZURE=Object.freeze(T.fromCssColorString("#F0FFFF")),T.BEIGE=Object.freeze(T.fromCssColorString("#F5F5DC")),T.BISQUE=Object.freeze(T.fromCssColorString("#FFE4C4")),T.BLACK=Object.freeze(T.fromCssColorString("#000000")),T.BLANCHEDALMOND=Object.freeze(T.fromCssColorString("#FFEBCD")),T.BLUE=Object.freeze(T.fromCssColorString("#0000FF")),T.BLUEVIOLET=Object.freeze(T.fromCssColorString("#8A2BE2")),T.BROWN=Object.freeze(T.fromCssColorString("#A52A2A")),T.BURLYWOOD=Object.freeze(T.fromCssColorString("#DEB887")),T.CADETBLUE=Object.freeze(T.fromCssColorString("#5F9EA0")),T.CHARTREUSE=Object.freeze(T.fromCssColorString("#7FFF00")),T.CHOCOLATE=Object.freeze(T.fromCssColorString("#D2691E")),T.CORAL=Object.freeze(T.fromCssColorString("#FF7F50")),T.CORNFLOWERBLUE=Object.freeze(T.fromCssColorString("#6495ED")),T.CORNSILK=Object.freeze(T.fromCssColorString("#FFF8DC")),T.CRIMSON=Object.freeze(T.fromCssColorString("#DC143C")),T.CYAN=Object.freeze(T.fromCssColorString("#00FFFF")),T.DARKBLUE=Object.freeze(T.fromCssColorString("#00008B")),T.DARKCYAN=Object.freeze(T.fromCssColorString("#008B8B")),T.DARKGOLDENROD=Object.freeze(T.fromCssColorString("#B8860B")),T.DARKGRAY=Object.freeze(T.fromCssColorString("#A9A9A9")),T.DARKGREEN=Object.freeze(T.fromCssColorString("#006400")),T.DARKGREY=T.DARKGRAY,T.DARKKHAKI=Object.freeze(T.fromCssColorString("#BDB76B")),T.DARKMAGENTA=Object.freeze(T.fromCssColorString("#8B008B")),T.DARKOLIVEGREEN=Object.freeze(T.fromCssColorString("#556B2F")),T.DARKORANGE=Object.freeze(T.fromCssColorString("#FF8C00")),T.DARKORCHID=Object.freeze(T.fromCssColorString("#9932CC")),T.DARKRED=Object.freeze(T.fromCssColorString("#8B0000")),T.DARKSALMON=Object.freeze(T.fromCssColorString("#E9967A")),T.DARKSEAGREEN=Object.freeze(T.fromCssColorString("#8FBC8F")),T.DARKSLATEBLUE=Object.freeze(T.fromCssColorString("#483D8B")),T.DARKSLATEGRAY=Object.freeze(T.fromCssColorString("#2F4F4F")),T.DARKSLATEGREY=T.DARKSLATEGRAY,T.DARKTURQUOISE=Object.freeze(T.fromCssColorString("#00CED1")),T.DARKVIOLET=Object.freeze(T.fromCssColorString("#9400D3")),T.DEEPPINK=Object.freeze(T.fromCssColorString("#FF1493")),T.DEEPSKYBLUE=Object.freeze(T.fromCssColorString("#00BFFF")),T.DIMGRAY=Object.freeze(T.fromCssColorString("#696969")),T.DIMGREY=T.DIMGRAY,T.DODGERBLUE=Object.freeze(T.fromCssColorString("#1E90FF")),T.FIREBRICK=Object.freeze(T.fromCssColorString("#B22222")),T.FLORALWHITE=Object.freeze(T.fromCssColorString("#FFFAF0")),T.FORESTGREEN=Object.freeze(T.fromCssColorString("#228B22")),T.FUCHSIA=Object.freeze(T.fromCssColorString("#FF00FF")),T.GAINSBORO=Object.freeze(T.fromCssColorString("#DCDCDC")),T.GHOSTWHITE=Object.freeze(T.fromCssColorString("#F8F8FF")),T.GOLD=Object.freeze(T.fromCssColorString("#FFD700")),T.GOLDENROD=Object.freeze(T.fromCssColorString("#DAA520")),T.GRAY=Object.freeze(T.fromCssColorString("#808080")),T.GREEN=Object.freeze(T.fromCssColorString("#008000")),T.GREENYELLOW=Object.freeze(T.fromCssColorString("#ADFF2F")),T.GREY=T.GRAY,T.HONEYDEW=Object.freeze(T.fromCssColorString("#F0FFF0")),T.HOTPINK=Object.freeze(T.fromCssColorString("#FF69B4")),T.INDIANRED=Object.freeze(T.fromCssColorString("#CD5C5C")),T.INDIGO=Object.freeze(T.fromCssColorString("#4B0082")),T.IVORY=Object.freeze(T.fromCssColorString("#FFFFF0")),T.KHAKI=Object.freeze(T.fromCssColorString("#F0E68C")),T.LAVENDER=Object.freeze(T.fromCssColorString("#E6E6FA")),T.LAVENDAR_BLUSH=Object.freeze(T.fromCssColorString("#FFF0F5")),T.LAWNGREEN=Object.freeze(T.fromCssColorString("#7CFC00")),T.LEMONCHIFFON=Object.freeze(T.fromCssColorString("#FFFACD")),T.LIGHTBLUE=Object.freeze(T.fromCssColorString("#ADD8E6")),T.LIGHTCORAL=Object.freeze(T.fromCssColorString("#F08080")),T.LIGHTCYAN=Object.freeze(T.fromCssColorString("#E0FFFF")),T.LIGHTGOLDENRODYELLOW=Object.freeze(T.fromCssColorString("#FAFAD2")),T.LIGHTGRAY=Object.freeze(T.fromCssColorString("#D3D3D3")),T.LIGHTGREEN=Object.freeze(T.fromCssColorString("#90EE90")),T.LIGHTGREY=T.LIGHTGRAY,T.LIGHTPINK=Object.freeze(T.fromCssColorString("#FFB6C1")),T.LIGHTSEAGREEN=Object.freeze(T.fromCssColorString("#20B2AA")),T.LIGHTSKYBLUE=Object.freeze(T.fromCssColorString("#87CEFA")),T.LIGHTSLATEGRAY=Object.freeze(T.fromCssColorString("#778899")),T.LIGHTSLATEGREY=T.LIGHTSLATEGRAY,T.LIGHTSTEELBLUE=Object.freeze(T.fromCssColorString("#B0C4DE")),T.LIGHTYELLOW=Object.freeze(T.fromCssColorString("#FFFFE0")),T.LIME=Object.freeze(T.fromCssColorString("#00FF00")),T.LIMEGREEN=Object.freeze(T.fromCssColorString("#32CD32")),T.LINEN=Object.freeze(T.fromCssColorString("#FAF0E6")),T.MAGENTA=Object.freeze(T.fromCssColorString("#FF00FF")),T.MAROON=Object.freeze(T.fromCssColorString("#800000")),T.MEDIUMAQUAMARINE=Object.freeze(T.fromCssColorString("#66CDAA")),T.MEDIUMBLUE=Object.freeze(T.fromCssColorString("#0000CD")),T.MEDIUMORCHID=Object.freeze(T.fromCssColorString("#BA55D3")),T.MEDIUMPURPLE=Object.freeze(T.fromCssColorString("#9370DB")),T.MEDIUMSEAGREEN=Object.freeze(T.fromCssColorString("#3CB371")),T.MEDIUMSLATEBLUE=Object.freeze(T.fromCssColorString("#7B68EE")),T.MEDIUMSPRINGGREEN=Object.freeze(T.fromCssColorString("#00FA9A")),T.MEDIUMTURQUOISE=Object.freeze(T.fromCssColorString("#48D1CC")),T.MEDIUMVIOLETRED=Object.freeze(T.fromCssColorString("#C71585")),T.MIDNIGHTBLUE=Object.freeze(T.fromCssColorString("#191970")),T.MINTCREAM=Object.freeze(T.fromCssColorString("#F5FFFA")),T.MISTYROSE=Object.freeze(T.fromCssColorString("#FFE4E1")),T.MOCCASIN=Object.freeze(T.fromCssColorString("#FFE4B5")),T.NAVAJOWHITE=Object.freeze(T.fromCssColorString("#FFDEAD")),T.NAVY=Object.freeze(T.fromCssColorString("#000080")),T.OLDLACE=Object.freeze(T.fromCssColorString("#FDF5E6")),T.OLIVE=Object.freeze(T.fromCssColorString("#808000")),T.OLIVEDRAB=Object.freeze(T.fromCssColorString("#6B8E23")),T.ORANGE=Object.freeze(T.fromCssColorString("#FFA500")),T.ORANGERED=Object.freeze(T.fromCssColorString("#FF4500")),T.ORCHID=Object.freeze(T.fromCssColorString("#DA70D6")),T.PALEGOLDENROD=Object.freeze(T.fromCssColorString("#EEE8AA")),T.PALEGREEN=Object.freeze(T.fromCssColorString("#98FB98")),T.PALETURQUOISE=Object.freeze(T.fromCssColorString("#AFEEEE")),T.PALEVIOLETRED=Object.freeze(T.fromCssColorString("#DB7093")),T.PAPAYAWHIP=Object.freeze(T.fromCssColorString("#FFEFD5")),T.PEACHPUFF=Object.freeze(T.fromCssColorString("#FFDAB9")),T.PERU=Object.freeze(T.fromCssColorString("#CD853F")),T.PINK=Object.freeze(T.fromCssColorString("#FFC0CB")),T.PLUM=Object.freeze(T.fromCssColorString("#DDA0DD")),T.POWDERBLUE=Object.freeze(T.fromCssColorString("#B0E0E6")),T.PURPLE=Object.freeze(T.fromCssColorString("#800080")),T.RED=Object.freeze(T.fromCssColorString("#FF0000")),T.ROSYBROWN=Object.freeze(T.fromCssColorString("#BC8F8F")),T.ROYALBLUE=Object.freeze(T.fromCssColorString("#4169E1")),T.SADDLEBROWN=Object.freeze(T.fromCssColorString("#8B4513")),T.SALMON=Object.freeze(T.fromCssColorString("#FA8072")),T.SANDYBROWN=Object.freeze(T.fromCssColorString("#F4A460")),T.SEAGREEN=Object.freeze(T.fromCssColorString("#2E8B57")),T.SEASHELL=Object.freeze(T.fromCssColorString("#FFF5EE")),T.SIENNA=Object.freeze(T.fromCssColorString("#A0522D")),T.SILVER=Object.freeze(T.fromCssColorString("#C0C0C0")),T.SKYBLUE=Object.freeze(T.fromCssColorString("#87CEEB")),T.SLATEBLUE=Object.freeze(T.fromCssColorString("#6A5ACD")),T.SLATEGRAY=Object.freeze(T.fromCssColorString("#708090")),T.SLATEGREY=T.SLATEGRAY,T.SNOW=Object.freeze(T.fromCssColorString("#FFFAFA")),T.SPRINGGREEN=Object.freeze(T.fromCssColorString("#00FF7F")),T.STEELBLUE=Object.freeze(T.fromCssColorString("#4682B4")),T.TAN=Object.freeze(T.fromCssColorString("#D2B48C")),T.TEAL=Object.freeze(T.fromCssColorString("#008080")),T.THISTLE=Object.freeze(T.fromCssColorString("#D8BFD8")),T.TOMATO=Object.freeze(T.fromCssColorString("#FF6347")),T.TURQUOISE=Object.freeze(T.fromCssColorString("#40E0D0")),T.VIOLET=Object.freeze(T.fromCssColorString("#EE82EE")),T.WHEAT=Object.freeze(T.fromCssColorString("#F5DEB3")),T.WHITE=Object.freeze(T.fromCssColorString("#FFFFFF")),T.WHITESMOKE=Object.freeze(T.fromCssColorString("#F5F5F5")),T.YELLOW=Object.freeze(T.fromCssColorString("#FFFF00")),T.YELLOWGREEN=Object.freeze(T.fromCssColorString("#9ACD32")),T.TRANSPARENT=Object.freeze(new T(0,0,0,0));class me{constructor(e,t){this.x=e??0,this.y=t??0}static fromElements(e,t,i){return x(i)?(i.x=e,i.y=t,i):new me(e,t)}static clone(e,t){if(x(e))return x(t)?(t.x=e.x,t.y=e.y,t):new me(e.x,e.y)}static pack(e,t,i){return y.typeOf.object("value",e),y.defined("array",t),i=i??0,t[i++]=e.x,t[i]=e.y,t}static unpack(e,t,i){return y.defined("array",e),t=t??0,x(i)||(i=new me),i.x=e[t++],i.y=e[t],i}static packArray(e,t){y.defined("array",e);const i=e.length,s=i*2;if(!x(t))t=new Array(s);else{if(!Array.isArray(t)&&t.length!==s)throw new $("If result is a typed array, it must have exactly array.length * 2 elements");t.length!==s&&(t.length=s)}for(let o=0;o<i;++o)me.pack(e[o],t,o*2);return t}static unpackArray(e,t){if(y.defined("array",e),y.typeOf.number.greaterThanOrEquals("array.length",e.length,2),e.length%2!==0)throw new $("array length must be a multiple of 2.");const i=e.length;x(t)?t.length=i/2:t=new Array(i/2);for(let s=0;s<i;s+=2){const o=s/2;t[o]=me.unpack(e,s,t[o])}return t}static maximumComponent(e){return y.typeOf.object("cartesian",e),Math.max(e.x,e.y)}static minimumComponent(e){return y.typeOf.object("cartesian",e),Math.min(e.x,e.y)}static minimumByComponent(e,t,i){return y.typeOf.object("first",e),y.typeOf.object("second",t),y.typeOf.object("result",i),i.x=Math.min(e.x,t.x),i.y=Math.min(e.y,t.y),i}static maximumByComponent(e,t,i){return y.typeOf.object("first",e),y.typeOf.object("second",t),y.typeOf.object("result",i),i.x=Math.max(e.x,t.x),i.y=Math.max(e.y,t.y),i}static clamp(e,t,i,s){y.typeOf.object("value",e),y.typeOf.object("min",t),y.typeOf.object("max",i),y.typeOf.object("result",s);const o=F.clamp(e.x,t.x,i.x),r=F.clamp(e.y,t.y,i.y);return s.x=o,s.y=r,s}static magnitudeSquared(e){return y.typeOf.object("cartesian",e),e.x*e.x+e.y*e.y}static magnitude(e){return Math.sqrt(me.magnitudeSquared(e))}static distance(e,t){return y.typeOf.object("left",e),y.typeOf.object("right",t),me.subtract(e,t,nh),me.magnitude(nh)}static distanceSquared(e,t){return y.typeOf.object("left",e),y.typeOf.object("right",t),me.subtract(e,t,nh),me.magnitudeSquared(nh)}static normalize(e,t){y.typeOf.object("cartesian",e),y.typeOf.object("result",t);const i=me.magnitude(e);if(t.x=e.x/i,t.y=e.y/i,isNaN(t.x)||isNaN(t.y))throw new $("normalized result is not a number");return t}static dot(e,t){return y.typeOf.object("left",e),y.typeOf.object("right",t),e.x*t.x+e.y*t.y}static cross(e,t){return y.typeOf.object("left",e),y.typeOf.object("right",t),e.x*t.y-e.y*t.x}static multiplyComponents(e,t,i){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",i),i.x=e.x*t.x,i.y=e.y*t.y,i}static divideComponents(e,t,i){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",i),i.x=e.x/t.x,i.y=e.y/t.y,i}static add(e,t,i){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",i),i.x=e.x+t.x,i.y=e.y+t.y,i}static subtract(e,t,i){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",i),i.x=e.x-t.x,i.y=e.y-t.y,i}static multiplyByScalar(e,t,i){return y.typeOf.object("cartesian",e),y.typeOf.number("scalar",t),y.typeOf.object("result",i),i.x=e.x*t,i.y=e.y*t,i}static divideByScalar(e,t,i){return y.typeOf.object("cartesian",e),y.typeOf.number("scalar",t),y.typeOf.object("result",i),i.x=e.x/t,i.y=e.y/t,i}static negate(e,t){return y.typeOf.object("cartesian",e),y.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t}static abs(e,t){return y.typeOf.object("cartesian",e),y.typeOf.object("result",t),t.x=Math.abs(e.x),t.y=Math.abs(e.y),t}static lerp(e,t,i,s){return y.typeOf.object("start",e),y.typeOf.object("end",t),y.typeOf.number("t",i),y.typeOf.object("result",s),me.multiplyByScalar(t,i,Yy),s=me.multiplyByScalar(e,1-i,s),me.add(Yy,s,s)}static angleBetween(e,t){return y.typeOf.object("left",e),y.typeOf.object("right",t),me.normalize(e,Zy),me.normalize(t,Ky),F.acosClamped(me.dot(Zy,Ky))}static mostOrthogonalAxis(e,t){y.typeOf.object("cartesian",e),y.typeOf.object("result",t);const i=me.normalize(e,_P);return me.abs(i,i),i.x<=i.y?t=me.clone(me.UNIT_X,t):t=me.clone(me.UNIT_Y,t),t}static equals(e,t){return e===t||x(e)&&x(t)&&e.x===t.x&&e.y===t.y}static equalsArray(e,t,i){return e.x===t[i]&&e.y===t[i+1]}static equalsEpsilon(e,t,i,s){return e===t||x(e)&&x(t)&&F.equalsEpsilon(e.x,t.x,i,s)&&F.equalsEpsilon(e.y,t.y,i,s)}clone(e){return me.clone(this,e)}equals(e){return me.equals(this,e)}equalsEpsilon(e,t,i){return me.equalsEpsilon(this,e,t,i)}toString(){return`(${this.x}, ${this.y})`}}me.fromCartesian3=me.clone,me.fromCartesian4=me.clone,me.packedLength=2,me.fromArray=me.unpack;const nh=new me,Yy=new me,Zy=new me,Ky=new me,_P=new me;me.ZERO=Object.freeze(new me(0,0)),me.ONE=Object.freeze(new me(1,1)),me.UNIT_X=Object.freeze(new me(1,0)),me.UNIT_Y=Object.freeze(new me(0,1));const wP=new D,vP=new D;function Qy(n,e,t,i,s){if(!x(n))throw new $("cartesian is required.");if(!x(e))throw new $("oneOverRadii is required.");if(!x(t))throw new $("oneOverRadiiSquared is required.");if(!x(i))throw new $("centerToleranceSquared is required.");const o=n.x,r=n.y,a=n.z,l=e.x,c=e.y,h=e.z,u=o*o*l*l,d=r*r*c*c,f=a*a*h*h,g=u+d+f,_=Math.sqrt(1/g),v=D.multiplyByScalar(n,_,wP);if(g<i)return isFinite(_)?D.clone(v,s):void 0;const E=t.x,w=t.y,C=t.z,P=vP;P.x=v.x*E*2,P.y=v.y*w*2,P.z=v.z*C*2;let R=(1-_)*D.magnitude(n)/(.5*D.magnitude(P)),A=0,O,M,z,k,q,Y,m,b,S,L,N;do{R-=A,z=1/(1+R*E),k=1/(1+R*w),q=1/(1+R*C),Y=z*z,m=k*k,b=q*q,S=Y*z,L=m*k,N=b*q,O=u*Y+d*m+f*b-1,M=u*S*E+d*L*w+f*N*C;const j=-2*M;A=O/j}while(Math.abs(O)>F.EPSILON12);return x(s)?(s.x=o*z,s.y=r*k,s.z=a*q,s):new D(o*z,r*k,a*q)}function Oe(n,e,t){this.longitude=n??0,this.latitude=e??0,this.height=t??0}Oe.fromRadians=function(n,e,t,i){return y.typeOf.number("longitude",n),y.typeOf.number("latitude",e),t=t??0,x(i)?(i.longitude=n,i.latitude=e,i.height=t,i):new Oe(n,e,t)},Oe.fromDegrees=function(n,e,t,i){return y.typeOf.number("longitude",n),y.typeOf.number("latitude",e),n=F.toRadians(n),e=F.toRadians(e),Oe.fromRadians(n,e,t,i)};const bP=new D,EP=new D,CP=new D;Oe._ellipsoidOneOverRadii=new D(1567855942887398e-22,1567855942887398e-22,1573130351105623e-22),Oe._ellipsoidOneOverRadiiSquared=new D(2458172257647332e-29,2458172257647332e-29,24747391015697002e-30),Oe._ellipsoidCenterToleranceSquared=F.EPSILON1,Oe.fromCartesian=function(n,e,t){const i=x(e)?e.oneOverRadii:Oe._ellipsoidOneOverRadii,s=x(e)?e.oneOverRadiiSquared:Oe._ellipsoidOneOverRadiiSquared,o=x(e)?e._centerToleranceSquared:Oe._ellipsoidCenterToleranceSquared,r=Qy(n,i,s,o,EP);if(!x(r))return;let a=D.multiplyComponents(r,s,bP);a=D.normalize(a,a);const l=D.subtract(n,r,CP),c=Math.atan2(a.y,a.x),h=Math.asin(a.z),u=F.sign(D.dot(l,n))*D.magnitude(l);return x(t)?(t.longitude=c,t.latitude=h,t.height=u,t):new Oe(c,h,u)},Oe.toCartesian=function(n,e,t){return y.defined("cartographic",n),D.fromRadians(n.longitude,n.latitude,n.height,e,t)},Oe.clone=function(n,e){if(x(n))return x(e)?(e.longitude=n.longitude,e.latitude=n.latitude,e.height=n.height,e):new Oe(n.longitude,n.latitude,n.height)},Oe.equals=function(n,e){return n===e||x(n)&&x(e)&&n.longitude===e.longitude&&n.latitude===e.latitude&&n.height===e.height},Oe.equalsEpsilon=function(n,e,t){return t=t??0,n===e||x(n)&&x(e)&&Math.abs(n.longitude-e.longitude)<=t&&Math.abs(n.latitude-e.latitude)<=t&&Math.abs(n.height-e.height)<=t},Oe.ZERO=Object.freeze(new Oe(0,0,0)),Oe.prototype.clone=function(n){return Oe.clone(this,n)},Oe.prototype.equals=function(n){return Oe.equals(this,n)},Oe.prototype.equalsEpsilon=function(n,e){return Oe.equalsEpsilon(this,n,e)},Oe.prototype.toString=function(){return`(${this.longitude}, ${this.latitude}, ${this.height})`};function Jy(n,e,t,i){e=e??0,t=t??0,i=i??0,y.typeOf.number.greaterThanOrEquals("x",e,0),y.typeOf.number.greaterThanOrEquals("y",t,0),y.typeOf.number.greaterThanOrEquals("z",i,0),n._radii=new D(e,t,i),n._radiiSquared=new D(e*e,t*t,i*i),n._radiiToTheFourth=new D(e*e*e*e,t*t*t*t,i*i*i*i),n._oneOverRadii=new D(e===0?0:1/e,t===0?0:1/t,i===0?0:1/i),n._oneOverRadiiSquared=new D(e===0?0:1/(e*e),t===0?0:1/(t*t),i===0?0:1/(i*i)),n._minimumRadius=Math.min(e,t,i),n._maximumRadius=Math.max(e,t,i),n._centerToleranceSquared=F.EPSILON1,n._radiiSquared.z!==0&&(n._squaredXOverSquaredZ=n._radiiSquared.x/n._radiiSquared.z)}function ve(n,e,t){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,this._squaredXOverSquaredZ=void 0,Jy(this,n,e,t)}Object.defineProperties(ve.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),ve.clone=function(n,e){if(!x(n))return;const t=n._radii;return x(e)?(D.clone(t,e._radii),D.clone(n._radiiSquared,e._radiiSquared),D.clone(n._radiiToTheFourth,e._radiiToTheFourth),D.clone(n._oneOverRadii,e._oneOverRadii),D.clone(n._oneOverRadiiSquared,e._oneOverRadiiSquared),e._minimumRadius=n._minimumRadius,e._maximumRadius=n._maximumRadius,e._centerToleranceSquared=n._centerToleranceSquared,e):new ve(t.x,t.y,t.z)},ve.fromCartesian3=function(n,e){return x(e)||(e=new ve),x(n)&&Jy(e,n.x,n.y,n.z),e},ve.WGS84=Object.freeze(new ve(6378137,6378137,6356752314245179e-9)),ve.UNIT_SPHERE=Object.freeze(new ve(1,1,1)),ve.MOON=Object.freeze(new ve(F.LUNAR_RADIUS,F.LUNAR_RADIUS,F.LUNAR_RADIUS)),ve.MARS=Object.freeze(new ve(3396190,3396190,3376200)),ve._default=ve.WGS84,Object.defineProperties(ve,{default:{get:function(){return ve._default},set:function(n){y.typeOf.object("value",n),ve._default=n,D._ellipsoidRadiiSquared=n.radiiSquared,Oe._ellipsoidOneOverRadii=n.oneOverRadii,Oe._ellipsoidOneOverRadiiSquared=n.oneOverRadiiSquared,Oe._ellipsoidCenterToleranceSquared=n._centerToleranceSquared}}}),ve.prototype.clone=function(n){return ve.clone(this,n)},ve.packedLength=D.packedLength,ve.pack=function(n,e,t){return y.typeOf.object("value",n),y.defined("array",e),t=t??0,D.pack(n._radii,e,t),e},ve.unpack=function(n,e,t){y.defined("array",n),e=e??0;const i=D.unpack(n,e);return ve.fromCartesian3(i,t)},ve.prototype.geocentricSurfaceNormal=D.normalize,ve.prototype.geodeticSurfaceNormalCartographic=function(n,e){y.typeOf.object("cartographic",n);const t=n.longitude,i=n.latitude,s=Math.cos(i),o=s*Math.cos(t),r=s*Math.sin(t),a=Math.sin(i);return x(e)||(e=new D),e.x=o,e.y=r,e.z=a,D.normalize(e,e)},ve.prototype.geodeticSurfaceNormal=function(n,e){if(y.typeOf.object("cartesian",n),isNaN(n.x)||isNaN(n.y)||isNaN(n.z))throw new $("cartesian has a NaN component");if(!D.equalsEpsilon(n,D.ZERO,F.EPSILON14))return x(e)||(e=new D),e=D.multiplyComponents(n,this._oneOverRadiiSquared,e),D.normalize(e,e)};const xP=new D,PP=new D;ve.prototype.cartographicToCartesian=function(n,e){const t=xP,i=PP;this.geodeticSurfaceNormalCartographic(n,t),D.multiplyComponents(this._radiiSquared,t,i);const s=Math.sqrt(D.dot(t,i));return D.divideByScalar(i,s,i),D.multiplyByScalar(t,n.height,t),x(e)||(e=new D),D.add(i,t,e)},ve.prototype.cartographicArrayToCartesianArray=function(n,e){y.defined("cartographics",n);const t=n.length;x(e)?e.length=t:e=new Array(t);for(let i=0;i<t;i++)e[i]=this.cartographicToCartesian(n[i],e[i]);return e};const SP=new D,RP=new D,TP=new D;ve.prototype.cartesianToCartographic=function(n,e){const t=this.scaleToGeodeticSurface(n,RP);if(!x(t))return;const i=this.geodeticSurfaceNormal(t,SP),s=D.subtract(n,t,TP),o=Math.atan2(i.y,i.x),r=Math.asin(i.z),a=F.sign(D.dot(s,n))*D.magnitude(s);return x(e)?(e.longitude=o,e.latitude=r,e.height=a,e):new Oe(o,r,a)},ve.prototype.cartesianArrayToCartographicArray=function(n,e){y.defined("cartesians",n);const t=n.length;x(e)?e.length=t:e=new Array(t);for(let i=0;i<t;++i)e[i]=this.cartesianToCartographic(n[i],e[i]);return e},ve.prototype.scaleToGeodeticSurface=function(n,e){return Qy(n,this._oneOverRadii,this._oneOverRadiiSquared,this._centerToleranceSquared,e)},ve.prototype.scaleToGeocentricSurface=function(n,e){y.typeOf.object("cartesian",n),x(e)||(e=new D);const t=n.x,i=n.y,s=n.z,o=this._oneOverRadiiSquared,r=1/Math.sqrt(t*t*o.x+i*i*o.y+s*s*o.z);return D.multiplyByScalar(n,r,e)},ve.prototype.transformPositionToScaledSpace=function(n,e){return x(e)||(e=new D),D.multiplyComponents(n,this._oneOverRadii,e)},ve.prototype.transformPositionFromScaledSpace=function(n,e){return x(e)||(e=new D),D.multiplyComponents(n,this._radii,e)},ve.prototype.equals=function(n){return this===n||x(n)&&D.equals(this._radii,n._radii)},ve.prototype.toString=function(){return this._radii.toString()},ve.prototype.getSurfaceNormalIntersectionWithZAxis=function(n,e,t){if(y.typeOf.object("position",n),!F.equalsEpsilon(this._radii.x,this._radii.y,F.EPSILON15))throw new $("Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)");y.typeOf.number.greaterThan("Ellipsoid.radii.z",this._radii.z,0),e=e??0;const i=this._squaredXOverSquaredZ;if(x(t)||(t=new D),t.x=0,t.y=0,t.z=n.z*(1-i),!(Math.abs(t.z)>=this._radii.z-e))return t};const IP=new D;ve.prototype.getLocalCurvature=function(n,e){y.typeOf.object("surfacePosition",n),x(e)||(e=new me);const t=this.getSurfaceNormalIntersectionWithZAxis(n,0,IP),i=D.distance(n,t),s=this.minimumRadius*i/this.maximumRadius**2,o=i*s**2;return me.fromElements(1/i,1/o,e)};const OP=[.14887433898163,.43339539412925,.67940956829902,.86506336668898,.97390652851717,0],AP=[.29552422471475,.26926671930999,.21908636251598,.14945134915058,.066671344308684,0];function e_(n,e,t){y.typeOf.number("a",n),y.typeOf.number("b",e),y.typeOf.func("func",t);const i=.5*(e+n),s=.5*(e-n);let o=0;for(let r=0;r<5;r++){const a=s*OP[r];o+=AP[r]*(t(i+a)+t(i-a))}return o*=s,o}ve.prototype.surfaceArea=function(n){y.typeOf.object("rectangle",n);const e=n.west;let t=n.east;const i=n.south,s=n.north;for(;t<e;)t+=F.TWO_PI;const o=this._radiiSquared,r=o.x,a=o.y,l=o.z,c=r*a;return e_(i,s,function(h){const u=Math.cos(h),d=Math.sin(h);return Math.cos(h)*e_(e,t,function(f){const g=Math.cos(f),_=Math.sin(f);return Math.sqrt(c*d*d+l*(a*g*g+r*_*_)*u*u)})})};function qa(n,e,t){y.defined("array",n),y.defined("itemToFind",e),y.defined("comparator",t);let i=0,s=n.length-1,o,r;for(;i<=s;){if(o=~~((i+s)/2),r=t(n[o],e),r<0){i=o+1;continue}if(r>0){s=o-1;continue}return o}return~(s+1)}function Ef(n,e,t,i,s){this.xPoleWander=n,this.yPoleWander=e,this.xPoleOffset=t,this.yPoleOffset=i,this.ut1MinusUtc=s}function Cf(n){if(n===null||isNaN(n))throw new $("year is required and must be a number.");return n%4===0&&n%100!==0||n%400===0}const t_=[31,28,31,30,31,30,31,31,30,31,30,31];function xf(n,e,t,i,s,o,r,a){n=n??1,e=e??1,t=t??1,i=i??0,s=s??0,o=o??0,r=r??0,a=a??!1,_(),v(),this.year=n,this.month=e,this.day=t,this.hour=i,this.minute=s,this.second=o,this.millisecond=r,this.isLeapSecond=a;function _(){y.typeOf.number.greaterThanOrEquals("Year",n,1),y.typeOf.number.lessThanOrEquals("Year",n,9999),y.typeOf.number.greaterThanOrEquals("Month",e,1),y.typeOf.number.lessThanOrEquals("Month",e,12),y.typeOf.number.greaterThanOrEquals("Day",t,1),y.typeOf.number.lessThanOrEquals("Day",t,31),y.typeOf.number.greaterThanOrEquals("Hour",i,0),y.typeOf.number.lessThanOrEquals("Hour",i,23),y.typeOf.number.greaterThanOrEquals("Minute",s,0),y.typeOf.number.lessThanOrEquals("Minute",s,59),y.typeOf.bool("IsLeapSecond",a),y.typeOf.number.greaterThanOrEquals("Second",o,0),y.typeOf.number.lessThanOrEquals("Second",o,a?60:59),y.typeOf.number.greaterThanOrEquals("Millisecond",r,0),y.typeOf.number.lessThan("Millisecond",r,1e3)}function v(){const E=e===2&&Cf(n)?t_[e-1]+1:t_[e-1];if(t>E)throw new $("Month and Day represents invalid date")}}function Ye(n,e){this.julianDate=n,this.offset=e}const ut=Object.freeze({SECONDS_PER_MILLISECOND:.001,SECONDS_PER_MINUTE:60,MINUTES_PER_HOUR:60,HOURS_PER_DAY:24,SECONDS_PER_HOUR:3600,MINUTES_PER_DAY:1440,SECONDS_PER_DAY:86400,DAYS_PER_JULIAN_CENTURY:36525,PICOSECOND:1e-9,MODIFIED_JULIAN_DATE_DIFFERENCE:24000005e-1}),ze=Object.freeze({UTC:0,TAI:1}),n_=new xf,ih=[31,28,31,30,31,30,31,31,30,31,30,31],sh=29;function Pf(n,e){return J.compare(n.julianDate,e.julianDate)}const gr=new Ye;function oh(n){gr.julianDate=n;const e=J.leapSeconds;let t=qa(e,gr,Pf);t<0&&(t=~t),t>=e.length&&(t=e.length-1);let i=e[t].offset;t>0&&J.secondsDifference(e[t].julianDate,n)>i&&(t--,i=e[t].offset),J.addSeconds(n,i,n)}function i_(n,e){gr.julianDate=n;const t=J.leapSeconds;let i=qa(t,gr,Pf);if(i<0&&(i=~i),i===0)return J.addSeconds(n,-t[0].offset,e);if(i>=t.length)return J.addSeconds(n,-t[i-1].offset,e);const s=J.secondsDifference(t[i].julianDate,n);if(s===0)return J.addSeconds(n,-t[i].offset,e);if(!(s<=1))return J.addSeconds(n,-t[--i].offset,e)}function As(n,e,t){const i=e/ut.SECONDS_PER_DAY|0;return n+=i,e-=ut.SECONDS_PER_DAY*i,e<0&&(n--,e+=ut.SECONDS_PER_DAY),t.dayNumber=n,t.secondsOfDay=e,t}function Sf(n,e,t,i,s,o,r){const a=(e-14)/12|0,l=n+4800+a;let c=(1461*l/4|0)+(367*(e-2-12*a)/12|0)-(3*((l+100)/100|0)/4|0)+t-32075;i=i-12,i<0&&(i+=24);const h=o+(i*ut.SECONDS_PER_HOUR+s*ut.SECONDS_PER_MINUTE+r*ut.SECONDS_PER_MILLISECOND);return h>=43200&&(c-=1),[c,h]}const MP=/^(\d{4})$/,DP=/^(\d{4})-(\d{2})$/,FP=/^(\d{4})-?(\d{3})$/,LP=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,zP=/^(\d{4})-?(\d{2})-?(\d{2})$/,Rf=/([Z+\-])?(\d{2})?:?(\d{2})?$/,NP=/^(\d{2})(\.\d+)?/.source+Rf.source,kP=/^(\d{2}):?(\d{2})(\.\d+)?/.source+Rf.source,jP=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+Rf.source,Jn="Invalid ISO 8601 date.";function J(n,e,t){this.dayNumber=void 0,this.secondsOfDay=void 0,n=n??0,e=e??0,t=t??ze.UTC;const i=n|0;e=e+(n-i)*ut.SECONDS_PER_DAY,As(i,e,this),t===ze.UTC&&oh(this)}J.fromGregorianDate=function(n,e){if(!(n instanceof xf))throw new $("date must be a valid GregorianDate.");const t=Sf(n.year,n.month,n.day,n.hour,n.minute,n.second,n.millisecond);return x(e)?(As(t[0],t[1],e),oh(e),e):new J(t[0],t[1],ze.UTC)},J.fromDate=function(n,e){if(!(n instanceof Date)||isNaN(n.getTime()))throw new $("date must be a valid JavaScript Date.");const t=Sf(n.getUTCFullYear(),n.getUTCMonth()+1,n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),n.getUTCMilliseconds());return x(e)?(As(t[0],t[1],e),oh(e),e):new J(t[0],t[1],ze.UTC)},J.fromIso8601=function(n,e){if(typeof n!="string")throw new $(Jn);n=n.replace(",",".");let t=n.split("T"),i,s=1,o=1,r=0,a=0,l=0,c=0;const h=t[0],u=t[1];let d,f;if(!x(h))throw new $(Jn);let g;if(t=h.match(zP),t!==null){if(g=h.split("-").length-1,g>0&&g!==2)throw new $(Jn);i=+t[1],s=+t[2],o=+t[3]}else if(t=h.match(DP),t!==null)i=+t[1],s=+t[2];else if(t=h.match(MP),t!==null)i=+t[1];else{let w;if(t=h.match(FP),t!==null){if(i=+t[1],w=+t[2],f=Cf(i),w<1||f&&w>366||!f&&w>365)throw new $(Jn)}else if(t=h.match(LP),t!==null){i=+t[1];const C=+t[2],P=+t[3]||0;if(g=h.split("-").length-1,g>0&&(!x(t[3])&&g!==1||x(t[3])&&g!==2))throw new $(Jn);const R=new Date(Date.UTC(i,0,4));w=C*7+P-R.getUTCDay()-3}else throw new $(Jn);d=new Date(Date.UTC(i,0,1)),d.setUTCDate(w),s=d.getUTCMonth()+1,o=d.getUTCDate()}if(f=Cf(i),s<1||s>12||o<1||(s!==2||!f)&&o>ih[s-1]||f&&s===2&&o>sh)throw new $(Jn);let _;if(x(u)){if(t=u.match(jP),t!==null){if(g=u.split(":").length-1,g>0&&g!==2&&g!==3)throw new $(Jn);r=+t[1],a=+t[2],l=+t[3],c=+(t[4]||0)*1e3,_=5}else if(t=u.match(kP),t!==null){if(g=u.split(":").length-1,g>2)throw new $(Jn);r=+t[1],a=+t[2],l=+(t[3]||0)*60,_=4}else if(t=u.match(NP),t!==null)r=+t[1],a=+(t[2]||0)*60,_=3;else throw new $(Jn);if(a>=60||l>=61||r>24||r===24&&(a>0||l>0||c>0))throw new $(Jn);const w=t[_],C=+t[_+1],P=+(t[_+2]||0);switch(w){case"+":r=r-C,a=a-P;break;case"-":r=r+C,a=a+P;break;case"Z":break;default:a=a+new Date(Date.UTC(i,s-1,o,r,a)).getTimezoneOffset();break}}const v=l===60;for(v&&l--;a>=60;)a-=60,r++;for(;r>=24;)r-=24,o++;for(d=f&&s===2?sh:ih[s-1];o>d;)o-=d,s++,s>12&&(s-=12,i++),d=f&&s===2?sh:ih[s-1];for(;a<0;)a+=60,r--;for(;r<0;)r+=24,o--;for(;o<1;)s--,s<1&&(s+=12,i--),d=f&&s===2?sh:ih[s-1],o+=d;const E=Sf(i,s,o,r,a,l,c);return x(e)?(As(E[0],E[1],e),oh(e)):e=new J(E[0],E[1],ze.UTC),v&&J.addSeconds(e,1,e),e},J.now=function(n){return J.fromDate(new Date,n)};const rh=new J(0,0,ze.TAI);J.toGregorianDate=function(n,e){if(!x(n))throw new $("julianDate is required.");let t=!1,i=i_(n,rh);x(i)||(J.addSeconds(n,-1,rh),i=i_(rh,rh),t=!0);let s=i.dayNumber;const o=i.secondsOfDay;o>=43200&&(s+=1);let r=s+68569|0;const a=4*r/146097|0;r=r-((146097*a+3)/4|0)|0;const l=4e3*(r+1)/1461001|0;r=r-(1461*l/4|0)+31|0;const c=80*r/2447|0,h=r-(2447*c/80|0)|0;r=c/11|0;const u=c+2-12*r|0,d=100*(a-49)+l+r|0;let f=o/ut.SECONDS_PER_HOUR|0,g=o-f*ut.SECONDS_PER_HOUR;const _=g/ut.SECONDS_PER_MINUTE|0;g=g-_*ut.SECONDS_PER_MINUTE;let v=g|0;const E=(g-v)/ut.SECONDS_PER_MILLISECOND;return f+=12,f>23&&(f-=24),t&&(v+=1),x(e)?(e.year=d,e.month=u,e.day=h,e.hour=f,e.minute=_,e.second=v,e.millisecond=E,e.isLeapSecond=t,e):new xf(d,u,h,f,_,v,E,t)},J.toDate=function(n){if(!x(n))throw new $("julianDate is required.");const e=J.toGregorianDate(n,n_);let t=e.second;return e.isLeapSecond&&(t-=1),new Date(Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,t,e.millisecond))},J.toIso8601=function(n,e){if(!x(n))throw new $("julianDate is required.");const t=J.toGregorianDate(n,n_);let i=t.year,s=t.month,o=t.day,r=t.hour;const a=t.minute,l=t.second,c=t.millisecond;i===1e4&&s===1&&o===1&&r===0&&a===0&&l===0&&c===0&&(i=9999,s=12,o=31,r=24);let h;if(!x(e)&&c!==0){const u=c*.01;return h=u<1e-6?u.toFixed(20).replace(".","").replace(/0+$/,""):u.toString().replace(".",""),`${i.toString().padStart(4,"0")}-${s.toString().padStart(2,"0")}-${o.toString().padStart(2,"0")}T${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${l.toString().padStart(2,"0")}.${h}Z`}return!x(e)||e===0?`${i.toString().padStart(4,"0")}-${s.toString().padStart(2,"0")}-${o.toString().padStart(2,"0")}T${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${l.toString().padStart(2,"0")}Z`:(h=(c*.01).toFixed(e).replace(".","").slice(0,e),`${i.toString().padStart(4,"0")}-${s.toString().padStart(2,"0")}-${o.toString().padStart(2,"0")}T${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${l.toString().padStart(2,"0")}.${h}Z`)},J.clone=function(n,e){if(x(n))return x(e)?(e.dayNumber=n.dayNumber,e.secondsOfDay=n.secondsOfDay,e):new J(n.dayNumber,n.secondsOfDay,ze.TAI)},J.compare=function(n,e){if(!x(n))throw new $("left is required.");if(!x(e))throw new $("right is required.");const t=n.dayNumber-e.dayNumber;return t!==0?t:n.secondsOfDay-e.secondsOfDay},J.equals=function(n,e){return n===e||x(n)&&x(e)&&n.dayNumber===e.dayNumber&&n.secondsOfDay===e.secondsOfDay},J.equalsEpsilon=function(n,e,t){return t=t??0,n===e||x(n)&&x(e)&&Math.abs(J.secondsDifference(n,e))<=t},J.totalDays=function(n){if(!x(n))throw new $("julianDate is required.");return n.dayNumber+n.secondsOfDay/ut.SECONDS_PER_DAY},J.secondsDifference=function(n,e){if(!x(n))throw new $("left is required.");if(!x(e))throw new $("right is required.");return(n.dayNumber-e.dayNumber)*ut.SECONDS_PER_DAY+(n.secondsOfDay-e.secondsOfDay)},J.daysDifference=function(n,e){if(!x(n))throw new $("left is required.");if(!x(e))throw new $("right is required.");const t=n.dayNumber-e.dayNumber,i=(n.secondsOfDay-e.secondsOfDay)/ut.SECONDS_PER_DAY;return t+i},J.computeTaiMinusUtc=function(n){gr.julianDate=n;const e=J.leapSeconds;let t=qa(e,gr,Pf);return t<0&&(t=~t,--t,t<0&&(t=0)),e[t].offset},J.addSeconds=function(n,e,t){if(!x(n))throw new $("julianDate is required.");if(!x(e))throw new $("seconds is required.");if(!x(t))throw new $("result is required.");return As(n.dayNumber,n.secondsOfDay+e,t)},J.addMinutes=function(n,e,t){if(!x(n))throw new $("julianDate is required.");if(!x(e))throw new $("minutes is required.");if(!x(t))throw new $("result is required.");const i=n.secondsOfDay+e*ut.SECONDS_PER_MINUTE;return As(n.dayNumber,i,t)},J.addHours=function(n,e,t){if(!x(n))throw new $("julianDate is required.");if(!x(e))throw new $("hours is required.");if(!x(t))throw new $("result is required.");const i=n.secondsOfDay+e*ut.SECONDS_PER_HOUR;return As(n.dayNumber,i,t)},J.addDays=function(n,e,t){if(!x(n))throw new $("julianDate is required.");if(!x(e))throw new $("days is required.");if(!x(t))throw new $("result is required.");const i=n.dayNumber+e;return As(i,n.secondsOfDay,t)},J.lessThan=function(n,e){return J.compare(n,e)<0},J.lessThanOrEquals=function(n,e){return J.compare(n,e)<=0},J.greaterThan=function(n,e){return J.compare(n,e)>0},J.greaterThanOrEquals=function(n,e){return J.compare(n,e)>=0},J.prototype.clone=function(n){return J.clone(this,n)},J.prototype.equals=function(n){return J.equals(this,n)},J.prototype.equalsEpsilon=function(n,e){return J.equalsEpsilon(this,n,e)},J.prototype.toString=function(){return J.toIso8601(this)},J.leapSeconds=[new Ye(new J(2441317,43210,ze.TAI),10),new Ye(new J(2441499,43211,ze.TAI),11),new Ye(new J(2441683,43212,ze.TAI),12),new Ye(new J(2442048,43213,ze.TAI),13),new Ye(new J(2442413,43214,ze.TAI),14),new Ye(new J(2442778,43215,ze.TAI),15),new Ye(new J(2443144,43216,ze.TAI),16),new Ye(new J(2443509,43217,ze.TAI),17),new Ye(new J(2443874,43218,ze.TAI),18),new Ye(new J(2444239,43219,ze.TAI),19),new Ye(new J(2444786,43220,ze.TAI),20),new Ye(new J(2445151,43221,ze.TAI),21),new Ye(new J(2445516,43222,ze.TAI),22),new Ye(new J(2446247,43223,ze.TAI),23),new Ye(new J(2447161,43224,ze.TAI),24),new Ye(new J(2447892,43225,ze.TAI),25),new Ye(new J(2448257,43226,ze.TAI),26),new Ye(new J(2448804,43227,ze.TAI),27),new Ye(new J(2449169,43228,ze.TAI),28),new Ye(new J(2449534,43229,ze.TAI),29),new Ye(new J(2450083,43230,ze.TAI),30),new Ye(new J(2450630,43231,ze.TAI),31),new Ye(new J(2451179,43232,ze.TAI),32),new Ye(new J(2453736,43233,ze.TAI),33),new Ye(new J(2454832,43234,ze.TAI),34),new Ye(new J(2456109,43235,ze.TAI),35),new Ye(new J(2457204,43236,ze.TAI),36),new Ye(new J(2457754,43237,ze.TAI),37)];var ah={exports:{}},Wa={exports:{}};/*! https://mths.be/punycode v1.4.0 by @mathias */var UP=Wa.exports,s_;function GP(){return s_||(s_=1,(function(n,e){(function(t){var i=e&&!e.nodeType&&e,s=n&&!n.nodeType&&n,o=typeof Ay=="object"&&Ay;(o.global===o||o.window===o||o.self===o)&&(t=o);var r,a=2147483647,l=36,c=1,h=26,u=38,d=700,f=72,g=128,_="-",v=/^xn--/,E=/[^\x20-\x7E]/,w=/[\x2E\u3002\uFF0E\uFF61]/g,C={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},P=l-c,R=Math.floor,A=String.fromCharCode,O;function M(B){throw new RangeError(C[B])}function z(B,Z){for(var G=B.length,ae=[];G--;)ae[G]=Z(B[G]);return ae}function k(B,Z){var G=B.split("@"),ae="";G.length>1&&(ae=G[0]+"@",B=G[1]),B=B.replace(w,".");var ne=B.split("."),V=z(ne,Z).join(".");return ae+V}function q(B){for(var Z=[],G=0,ae=B.length,ne,V;G<ae;)ne=B.charCodeAt(G++),ne>=55296&&ne<=56319&&G<ae?(V=B.charCodeAt(G++),(V&64512)==56320?Z.push(((ne&1023)<<10)+(V&1023)+65536):(Z.push(ne),G--)):Z.push(ne);return Z}function Y(B){return z(B,function(Z){var G="";return Z>65535&&(Z-=65536,G+=A(Z>>>10&1023|55296),Z=56320|Z&1023),G+=A(Z),G}).join("")}function m(B){return B-48<10?B-22:B-65<26?B-65:B-97<26?B-97:l}function b(B,Z){return B+22+75*(B<26)-((Z!=0)<<5)}function S(B,Z,G){var ae=0;for(B=G?R(B/d):B>>1,B+=R(B/Z);B>P*h>>1;ae+=l)B=R(B/P);return R(ae+(P+1)*B/(B+u))}function L(B){var Z=[],G=B.length,ae,ne=0,V=g,re=f,se,he,ye,pe,Fe,je,ee,ft,rt;for(se=B.lastIndexOf(_),se<0&&(se=0),he=0;he<se;++he)B.charCodeAt(he)>=128&&M("not-basic"),Z.push(B.charCodeAt(he));for(ye=se>0?se+1:0;ye<G;){for(pe=ne,Fe=1,je=l;ye>=G&&M("invalid-input"),ee=m(B.charCodeAt(ye++)),(ee>=l||ee>R((a-ne)/Fe))&&M("overflow"),ne+=ee*Fe,ft=je<=re?c:je>=re+h?h:je-re,!(ee<ft);je+=l)rt=l-ft,Fe>R(a/rt)&&M("overflow"),Fe*=rt;ae=Z.length+1,re=S(ne-pe,ae,pe==0),R(ne/ae)>a-V&&M("overflow"),V+=R(ne/ae),ne%=ae,Z.splice(ne++,0,V)}return Y(Z)}function N(B){var Z,G,ae,ne,V,re,se,he,ye,pe,Fe,je=[],ee,ft,rt,_e;for(B=q(B),ee=B.length,Z=g,G=0,V=f,re=0;re<ee;++re)Fe=B[re],Fe<128&&je.push(A(Fe));for(ae=ne=je.length,ne&&je.push(_);ae<ee;){for(se=a,re=0;re<ee;++re)Fe=B[re],Fe>=Z&&Fe<se&&(se=Fe);for(ft=ae+1,se-Z>R((a-G)/ft)&&M("overflow"),G+=(se-Z)*ft,Z=se,re=0;re<ee;++re)if(Fe=B[re],Fe<Z&&++G>a&&M("overflow"),Fe==Z){for(he=G,ye=l;pe=ye<=V?c:ye>=V+h?h:ye-V,!(he<pe);ye+=l)_e=he-pe,rt=l-pe,je.push(A(b(pe+_e%rt,0))),he=R(_e/rt);je.push(A(b(he,0))),V=S(G,ft,ae==ne),G=0,++ae}++G,++Z}return je.join("")}function j(B){return k(B,function(Z){return v.test(Z)?L(Z.slice(4).toLowerCase()):Z})}function U(B){return k(B,function(Z){return E.test(Z)?"xn--"+N(Z):Z})}if(r={version:"1.3.2",ucs2:{decode:q,encode:Y},decode:L,encode:N,toASCII:U,toUnicode:j},i&&s)if(n.exports==i)s.exports=r;else for(O in r)r.hasOwnProperty(O)&&(i[O]=r[O]);else t.punycode=r})(UP)})(Wa,Wa.exports)),Wa.exports}var lh={exports:{}};/*!
37
34
  * URI.js - Mutating URLs
38
35
  * IPv6 Support
39
36
  *
@@ -45,7 +42,7 @@ ${this.stack.toString()}`),i};function U(i,t,e,n,s,o,r,a,c,h,l,u,f,g,_,y){this[0
45
42
  * Licensed under
46
43
  * MIT License http://www.opensource.org/licenses/mit-license
47
44
  *
48
- */var Uy=ma.exports,If;function jy(){return If||(If=1,function(i){(function(t,e){i.exports?i.exports=e():t.IPv6=e(t)})(Uy,function(t){var e=t&&t.IPv6;function n(o){var r=o.toLowerCase(),a=r.split(":"),c=a.length,h=8;a[0]===""&&a[1]===""&&a[2]===""?(a.shift(),a.shift()):a[0]===""&&a[1]===""?a.shift():a[c-1]===""&&a[c-2]===""&&a.pop(),c=a.length,a[c-1].indexOf(".")!==-1&&(h=7);var l;for(l=0;l<c&&a[l]!=="";l++);if(l<h)for(a.splice(l,1,"0000");a.length<h;)a.splice(l,0,"0000");for(var u,f=0;f<h;f++){u=a[f].split("");for(var g=0;g<3&&(u[0]==="0"&&u.length>1);g++)u.splice(0,1);a[f]=u.join("")}var _=-1,y=0,w=0,E=-1,b=!1;for(f=0;f<h;f++)b?a[f]==="0"?w+=1:(b=!1,w>y&&(_=E,y=w)):a[f]==="0"&&(b=!0,E=f,w=1);w>y&&(_=E,y=w),y>1&&a.splice(_,y,""),c=a.length;var P="";for(a[0]===""&&(P=":"),f=0;f<c&&(P+=a[f],f!==c-1);f++)P+=":";return a[c-1]===""&&(P+=":"),P}function s(){return t.IPv6===this&&(t.IPv6=e),this}return{best:n,noConflict:s}})}(ma)),ma.exports}var _a={exports:{}};/*!
45
+ */var qP=lh.exports,o_;function WP(){return o_||(o_=1,(function(n){(function(e,t){n.exports?n.exports=t():e.IPv6=t(e)})(qP,function(e){var t=e&&e.IPv6;function i(o){var r=o.toLowerCase(),a=r.split(":"),l=a.length,c=8;a[0]===""&&a[1]===""&&a[2]===""?(a.shift(),a.shift()):a[0]===""&&a[1]===""?a.shift():a[l-1]===""&&a[l-2]===""&&a.pop(),l=a.length,a[l-1].indexOf(".")!==-1&&(c=7);var h;for(h=0;h<l&&a[h]!=="";h++);if(h<c)for(a.splice(h,1,"0000");a.length<c;)a.splice(h,0,"0000");for(var u,d=0;d<c;d++){u=a[d].split("");for(var f=0;f<3&&(u[0]==="0"&&u.length>1);f++)u.splice(0,1);a[d]=u.join("")}var g=-1,_=0,v=0,E=-1,w=!1;for(d=0;d<c;d++)w?a[d]==="0"?v+=1:(w=!1,v>_&&(g=E,_=v)):a[d]==="0"&&(w=!0,E=d,v=1);v>_&&(g=E,_=v),_>1&&a.splice(g,_,""),l=a.length;var C="";for(a[0]===""&&(C=":"),d=0;d<l&&(C+=a[d],d!==l-1);d++)C+=":";return a[l-1]===""&&(C+=":"),C}function s(){return e.IPv6===this&&(e.IPv6=t),this}return{best:i,noConflict:s}})})(lh)),lh.exports}var ch={exports:{}};/*!
49
46
  * URI.js - Mutating URLs
50
47
  * Second Level Domain (SLD) Support
51
48
  *
@@ -57,7 +54,7 @@ ${this.stack.toString()}`),i};function U(i,t,e,n,s,o,r,a,c,h,l,u,f,g,_,y){this[0
57
54
  * Licensed under
58
55
  * MIT License http://www.opensource.org/licenses/mit-license
59
56
  *
60
- */var ky=_a.exports,Tf;function Wy(){return Tf||(Tf=1,function(i){(function(t,e){i.exports?i.exports=e():t.SecondLevelDomains=e(t)})(ky,function(t){var e=t&&t.SecondLevelDomains,n={list:{ac:" com gov mil net org ",ae:" ac co gov mil name net org pro sch ",af:" com edu gov net org ",al:" com edu gov mil net org ",ao:" co ed gv it og pb ",ar:" com edu gob gov int mil net org tur ",at:" ac co gv or ",au:" asn com csiro edu gov id net org ",ba:" co com edu gov mil net org rs unbi unmo unsa untz unze ",bb:" biz co com edu gov info net org store tv ",bh:" biz cc com edu gov info net org ",bn:" com edu gov net org ",bo:" com edu gob gov int mil net org tv ",br:" adm adv agr am arq art ato b bio blog bmd cim cng cnt com coop ecn edu eng esp etc eti far flog fm fnd fot fst g12 ggf gov imb ind inf jor jus lel mat med mil mus net nom not ntr odo org ppg pro psc psi qsl rec slg srv tmp trd tur tv vet vlog wiki zlg ",bs:" com edu gov net org ",bz:" du et om ov rg ",ca:" ab bc mb nb nf nl ns nt nu on pe qc sk yk ",ck:" biz co edu gen gov info net org ",cn:" ac ah bj com cq edu fj gd gov gs gx gz ha hb he hi hl hn jl js jx ln mil net nm nx org qh sc sd sh sn sx tj tw xj xz yn zj ",co:" com edu gov mil net nom org ",cr:" ac c co ed fi go or sa ",cy:" ac biz com ekloges gov ltd name net org parliament press pro tm ",do:" art com edu gob gov mil net org sld web ",dz:" art asso com edu gov net org pol ",ec:" com edu fin gov info med mil net org pro ",eg:" com edu eun gov mil name net org sci ",er:" com edu gov ind mil net org rochest w ",es:" com edu gob nom org ",et:" biz com edu gov info name net org ",fj:" ac biz com info mil name net org pro ",fk:" ac co gov net nom org ",fr:" asso com f gouv nom prd presse tm ",gg:" co net org ",gh:" com edu gov mil org ",gn:" ac com gov net org ",gr:" com edu gov mil net org ",gt:" com edu gob ind mil net org ",gu:" com edu gov net org ",hk:" com edu gov idv net org ",hu:" 2000 agrar bolt casino city co erotica erotika film forum games hotel info ingatlan jogasz konyvelo lakas media news org priv reklam sex shop sport suli szex tm tozsde utazas video ",id:" ac co go mil net or sch web ",il:" ac co gov idf k12 muni net org ",in:" ac co edu ernet firm gen gov i ind mil net nic org res ",iq:" com edu gov i mil net org ",ir:" ac co dnssec gov i id net org sch ",it:" edu gov ",je:" co net org ",jo:" com edu gov mil name net org sch ",jp:" ac ad co ed go gr lg ne or ",ke:" ac co go info me mobi ne or sc ",kh:" com edu gov mil net org per ",ki:" biz com de edu gov info mob net org tel ",km:" asso com coop edu gouv k medecin mil nom notaires pharmaciens presse tm veterinaire ",kn:" edu gov net org ",kr:" ac busan chungbuk chungnam co daegu daejeon es gangwon go gwangju gyeongbuk gyeonggi gyeongnam hs incheon jeju jeonbuk jeonnam k kg mil ms ne or pe re sc seoul ulsan ",kw:" com edu gov net org ",ky:" com edu gov net org ",kz:" com edu gov mil net org ",lb:" com edu gov net org ",lk:" assn com edu gov grp hotel int ltd net ngo org sch soc web ",lr:" com edu gov net org ",lv:" asn com conf edu gov id mil net org ",ly:" com edu gov id med net org plc sch ",ma:" ac co gov m net org press ",mc:" asso tm ",me:" ac co edu gov its net org priv ",mg:" com edu gov mil nom org prd tm ",mk:" com edu gov inf name net org pro ",ml:" com edu gov net org presse ",mn:" edu gov org ",mo:" com edu gov net org ",mt:" com edu gov net org ",mv:" aero biz com coop edu gov info int mil museum name net org pro ",mw:" ac co com coop edu gov int museum net org ",mx:" com edu gob net org ",my:" com edu gov mil name net org sch ",nf:" arts com firm info net other per rec store web ",ng:" biz com edu gov mil mobi name net org sch ",ni:" ac co com edu gob mil net nom org ",np:" com edu gov mil net org ",nr:" biz com edu gov info net org ",om:" ac biz co com edu gov med mil museum net org pro sch ",pe:" com edu gob mil net nom org sld ",ph:" com edu gov i mil net ngo org ",pk:" biz com edu fam gob gok gon gop gos gov net org web ",pl:" art bialystok biz com edu gda gdansk gorzow gov info katowice krakow lodz lublin mil net ngo olsztyn org poznan pwr radom slupsk szczecin torun warszawa waw wroc wroclaw zgora ",pr:" ac biz com edu est gov info isla name net org pro prof ",ps:" com edu gov net org plo sec ",pw:" belau co ed go ne or ",ro:" arts com firm info nom nt org rec store tm www ",rs:" ac co edu gov in org ",sb:" com edu gov net org ",sc:" com edu gov net org ",sh:" co com edu gov net nom org ",sl:" com edu gov net org ",st:" co com consulado edu embaixada gov mil net org principe saotome store ",sv:" com edu gob org red ",sz:" ac co org ",tr:" av bbs bel biz com dr edu gen gov info k12 name net org pol tel tsk tv web ",tt:" aero biz cat co com coop edu gov info int jobs mil mobi museum name net org pro tel travel ",tw:" club com ebiz edu game gov idv mil net org ",mu:" ac co com gov net or org ",mz:" ac co edu gov org ",na:" co com ",nz:" ac co cri geek gen govt health iwi maori mil net org parliament school ",pa:" abo ac com edu gob ing med net nom org sld ",pt:" com edu gov int net nome org publ ",py:" com edu gov mil net org ",qa:" com edu gov mil net org ",re:" asso com nom ",ru:" ac adygeya altai amur arkhangelsk astrakhan bashkiria belgorod bir bryansk buryatia cbg chel chelyabinsk chita chukotka chuvashia com dagestan e-burg edu gov grozny int irkutsk ivanovo izhevsk jar joshkar-ola kalmykia kaluga kamchatka karelia kazan kchr kemerovo khabarovsk khakassia khv kirov koenig komi kostroma kranoyarsk kuban kurgan kursk lipetsk magadan mari mari-el marine mil mordovia mosreg msk murmansk nalchik net nnov nov novosibirsk nsk omsk orenburg org oryol penza perm pp pskov ptz rnd ryazan sakhalin samara saratov simbirsk smolensk spb stavropol stv surgut tambov tatarstan tom tomsk tsaritsyn tsk tula tuva tver tyumen udm udmurtia ulan-ude vladikavkaz vladimir vladivostok volgograd vologda voronezh vrn vyatka yakutia yamal yekaterinburg yuzhno-sakhalinsk ",rw:" ac co com edu gouv gov int mil net ",sa:" com edu gov med net org pub sch ",sd:" com edu gov info med net org tv ",se:" a ac b bd c d e f g h i k l m n o org p parti pp press r s t tm u w x y z ",sg:" com edu gov idn net org per ",sn:" art com edu gouv org perso univ ",sy:" com edu gov mil net news org ",th:" ac co go in mi net or ",tj:" ac biz co com edu go gov info int mil name net nic org test web ",tn:" agrinet com defense edunet ens fin gov ind info intl mincom nat net org perso rnrt rns rnu tourism ",tz:" ac co go ne or ",ua:" biz cherkassy chernigov chernovtsy ck cn co com crimea cv dn dnepropetrovsk donetsk dp edu gov if in ivano-frankivsk kh kharkov kherson khmelnitskiy kiev kirovograd km kr ks kv lg lugansk lutsk lviv me mk net nikolaev od odessa org pl poltava pp rovno rv sebastopol sumy te ternopil uzhgorod vinnica vn zaporizhzhe zhitomir zp zt ",ug:" ac co go ne or org sc ",uk:" ac bl british-library co cym gov govt icnet jet lea ltd me mil mod national-library-scotland nel net nhs nic nls org orgn parliament plc police sch scot soc ",us:" dni fed isa kids nsn ",uy:" com edu gub mil net org ",ve:" co com edu gob info mil net org web ",vi:" co com k12 net org ",vn:" ac biz com edu gov health info int name net org pro ",ye:" co com gov ltd me net org plc ",yu:" ac co edu gov org ",za:" ac agric alt bourse city co cybernet db edu gov grondar iaccess imt inca landesign law mil net ngo nis nom olivetti org pix school tm web ",zm:" ac co com edu gov net org sch ",com:"ar br cn de eu gb gr hu jpn kr no qc ru sa se uk us uy za ",net:"gb jp se uk ",org:"ae",de:"com "},has:function(s){var o=s.lastIndexOf(".");if(o<=0||o>=s.length-1)return!1;var r=s.lastIndexOf(".",o-1);if(r<=0||r>=o-1)return!1;var a=n.list[s.slice(o+1)];return a?a.indexOf(" "+s.slice(r+1,o)+" ")>=0:!1},is:function(s){var o=s.lastIndexOf(".");if(o<=0||o>=s.length-1)return!1;var r=s.lastIndexOf(".",o-1);if(r>=0)return!1;var a=n.list[s.slice(o+1)];return a?a.indexOf(" "+s.slice(0,o)+" ")>=0:!1},get:function(s){var o=s.lastIndexOf(".");if(o<=0||o>=s.length-1)return null;var r=s.lastIndexOf(".",o-1);if(r<=0||r>=o-1)return null;var a=n.list[s.slice(o+1)];return!a||a.indexOf(" "+s.slice(r+1,o)+" ")<0?null:s.slice(r+1)},noConflict:function(){return t.SecondLevelDomains===this&&(t.SecondLevelDomains=e),this}};return n})}(_a)),_a.exports}/*!
57
+ */var VP=ch.exports,r_;function BP(){return r_||(r_=1,(function(n){(function(e,t){n.exports?n.exports=t():e.SecondLevelDomains=t(e)})(VP,function(e){var t=e&&e.SecondLevelDomains,i={list:{ac:" com gov mil net org ",ae:" ac co gov mil name net org pro sch ",af:" com edu gov net org ",al:" com edu gov mil net org ",ao:" co ed gv it og pb ",ar:" com edu gob gov int mil net org tur ",at:" ac co gv or ",au:" asn com csiro edu gov id net org ",ba:" co com edu gov mil net org rs unbi unmo unsa untz unze ",bb:" biz co com edu gov info net org store tv ",bh:" biz cc com edu gov info net org ",bn:" com edu gov net org ",bo:" com edu gob gov int mil net org tv ",br:" adm adv agr am arq art ato b bio blog bmd cim cng cnt com coop ecn edu eng esp etc eti far flog fm fnd fot fst g12 ggf gov imb ind inf jor jus lel mat med mil mus net nom not ntr odo org ppg pro psc psi qsl rec slg srv tmp trd tur tv vet vlog wiki zlg ",bs:" com edu gov net org ",bz:" du et om ov rg ",ca:" ab bc mb nb nf nl ns nt nu on pe qc sk yk ",ck:" biz co edu gen gov info net org ",cn:" ac ah bj com cq edu fj gd gov gs gx gz ha hb he hi hl hn jl js jx ln mil net nm nx org qh sc sd sh sn sx tj tw xj xz yn zj ",co:" com edu gov mil net nom org ",cr:" ac c co ed fi go or sa ",cy:" ac biz com ekloges gov ltd name net org parliament press pro tm ",do:" art com edu gob gov mil net org sld web ",dz:" art asso com edu gov net org pol ",ec:" com edu fin gov info med mil net org pro ",eg:" com edu eun gov mil name net org sci ",er:" com edu gov ind mil net org rochest w ",es:" com edu gob nom org ",et:" biz com edu gov info name net org ",fj:" ac biz com info mil name net org pro ",fk:" ac co gov net nom org ",fr:" asso com f gouv nom prd presse tm ",gg:" co net org ",gh:" com edu gov mil org ",gn:" ac com gov net org ",gr:" com edu gov mil net org ",gt:" com edu gob ind mil net org ",gu:" com edu gov net org ",hk:" com edu gov idv net org ",hu:" 2000 agrar bolt casino city co erotica erotika film forum games hotel info ingatlan jogasz konyvelo lakas media news org priv reklam sex shop sport suli szex tm tozsde utazas video ",id:" ac co go mil net or sch web ",il:" ac co gov idf k12 muni net org ",in:" ac co edu ernet firm gen gov i ind mil net nic org res ",iq:" com edu gov i mil net org ",ir:" ac co dnssec gov i id net org sch ",it:" edu gov ",je:" co net org ",jo:" com edu gov mil name net org sch ",jp:" ac ad co ed go gr lg ne or ",ke:" ac co go info me mobi ne or sc ",kh:" com edu gov mil net org per ",ki:" biz com de edu gov info mob net org tel ",km:" asso com coop edu gouv k medecin mil nom notaires pharmaciens presse tm veterinaire ",kn:" edu gov net org ",kr:" ac busan chungbuk chungnam co daegu daejeon es gangwon go gwangju gyeongbuk gyeonggi gyeongnam hs incheon jeju jeonbuk jeonnam k kg mil ms ne or pe re sc seoul ulsan ",kw:" com edu gov net org ",ky:" com edu gov net org ",kz:" com edu gov mil net org ",lb:" com edu gov net org ",lk:" assn com edu gov grp hotel int ltd net ngo org sch soc web ",lr:" com edu gov net org ",lv:" asn com conf edu gov id mil net org ",ly:" com edu gov id med net org plc sch ",ma:" ac co gov m net org press ",mc:" asso tm ",me:" ac co edu gov its net org priv ",mg:" com edu gov mil nom org prd tm ",mk:" com edu gov inf name net org pro ",ml:" com edu gov net org presse ",mn:" edu gov org ",mo:" com edu gov net org ",mt:" com edu gov net org ",mv:" aero biz com coop edu gov info int mil museum name net org pro ",mw:" ac co com coop edu gov int museum net org ",mx:" com edu gob net org ",my:" com edu gov mil name net org sch ",nf:" arts com firm info net other per rec store web ",ng:" biz com edu gov mil mobi name net org sch ",ni:" ac co com edu gob mil net nom org ",np:" com edu gov mil net org ",nr:" biz com edu gov info net org ",om:" ac biz co com edu gov med mil museum net org pro sch ",pe:" com edu gob mil net nom org sld ",ph:" com edu gov i mil net ngo org ",pk:" biz com edu fam gob gok gon gop gos gov net org web ",pl:" art bialystok biz com edu gda gdansk gorzow gov info katowice krakow lodz lublin mil net ngo olsztyn org poznan pwr radom slupsk szczecin torun warszawa waw wroc wroclaw zgora ",pr:" ac biz com edu est gov info isla name net org pro prof ",ps:" com edu gov net org plo sec ",pw:" belau co ed go ne or ",ro:" arts com firm info nom nt org rec store tm www ",rs:" ac co edu gov in org ",sb:" com edu gov net org ",sc:" com edu gov net org ",sh:" co com edu gov net nom org ",sl:" com edu gov net org ",st:" co com consulado edu embaixada gov mil net org principe saotome store ",sv:" com edu gob org red ",sz:" ac co org ",tr:" av bbs bel biz com dr edu gen gov info k12 name net org pol tel tsk tv web ",tt:" aero biz cat co com coop edu gov info int jobs mil mobi museum name net org pro tel travel ",tw:" club com ebiz edu game gov idv mil net org ",mu:" ac co com gov net or org ",mz:" ac co edu gov org ",na:" co com ",nz:" ac co cri geek gen govt health iwi maori mil net org parliament school ",pa:" abo ac com edu gob ing med net nom org sld ",pt:" com edu gov int net nome org publ ",py:" com edu gov mil net org ",qa:" com edu gov mil net org ",re:" asso com nom ",ru:" ac adygeya altai amur arkhangelsk astrakhan bashkiria belgorod bir bryansk buryatia cbg chel chelyabinsk chita chukotka chuvashia com dagestan e-burg edu gov grozny int irkutsk ivanovo izhevsk jar joshkar-ola kalmykia kaluga kamchatka karelia kazan kchr kemerovo khabarovsk khakassia khv kirov koenig komi kostroma kranoyarsk kuban kurgan kursk lipetsk magadan mari mari-el marine mil mordovia mosreg msk murmansk nalchik net nnov nov novosibirsk nsk omsk orenburg org oryol penza perm pp pskov ptz rnd ryazan sakhalin samara saratov simbirsk smolensk spb stavropol stv surgut tambov tatarstan tom tomsk tsaritsyn tsk tula tuva tver tyumen udm udmurtia ulan-ude vladikavkaz vladimir vladivostok volgograd vologda voronezh vrn vyatka yakutia yamal yekaterinburg yuzhno-sakhalinsk ",rw:" ac co com edu gouv gov int mil net ",sa:" com edu gov med net org pub sch ",sd:" com edu gov info med net org tv ",se:" a ac b bd c d e f g h i k l m n o org p parti pp press r s t tm u w x y z ",sg:" com edu gov idn net org per ",sn:" art com edu gouv org perso univ ",sy:" com edu gov mil net news org ",th:" ac co go in mi net or ",tj:" ac biz co com edu go gov info int mil name net nic org test web ",tn:" agrinet com defense edunet ens fin gov ind info intl mincom nat net org perso rnrt rns rnu tourism ",tz:" ac co go ne or ",ua:" biz cherkassy chernigov chernovtsy ck cn co com crimea cv dn dnepropetrovsk donetsk dp edu gov if in ivano-frankivsk kh kharkov kherson khmelnitskiy kiev kirovograd km kr ks kv lg lugansk lutsk lviv me mk net nikolaev od odessa org pl poltava pp rovno rv sebastopol sumy te ternopil uzhgorod vinnica vn zaporizhzhe zhitomir zp zt ",ug:" ac co go ne or org sc ",uk:" ac bl british-library co cym gov govt icnet jet lea ltd me mil mod national-library-scotland nel net nhs nic nls org orgn parliament plc police sch scot soc ",us:" dni fed isa kids nsn ",uy:" com edu gub mil net org ",ve:" co com edu gob info mil net org web ",vi:" co com k12 net org ",vn:" ac biz com edu gov health info int name net org pro ",ye:" co com gov ltd me net org plc ",yu:" ac co edu gov org ",za:" ac agric alt bourse city co cybernet db edu gov grondar iaccess imt inca landesign law mil net ngo nis nom olivetti org pix school tm web ",zm:" ac co com edu gov net org sch ",com:"ar br cn de eu gb gr hu jpn kr no qc ru sa se uk us uy za ",net:"gb jp se uk ",org:"ae",de:"com "},has:function(s){var o=s.lastIndexOf(".");if(o<=0||o>=s.length-1)return!1;var r=s.lastIndexOf(".",o-1);if(r<=0||r>=o-1)return!1;var a=i.list[s.slice(o+1)];return a?a.indexOf(" "+s.slice(r+1,o)+" ")>=0:!1},is:function(s){var o=s.lastIndexOf(".");if(o<=0||o>=s.length-1)return!1;var r=s.lastIndexOf(".",o-1);if(r>=0)return!1;var a=i.list[s.slice(o+1)];return a?a.indexOf(" "+s.slice(0,o)+" ")>=0:!1},get:function(s){var o=s.lastIndexOf(".");if(o<=0||o>=s.length-1)return null;var r=s.lastIndexOf(".",o-1);if(r<=0||r>=o-1)return null;var a=i.list[s.slice(o+1)];return!a||a.indexOf(" "+s.slice(r+1,o)+" ")<0?null:s.slice(r+1)},noConflict:function(){return e.SecondLevelDomains===this&&(e.SecondLevelDomains=t),this}};return i})})(ch)),ch.exports}/*!
61
58
  * URI.js - Mutating URLs
62
59
  *
63
60
  * Version: 1.19.11
@@ -68,10 +65,10 @@ ${this.stack.toString()}`),i};function U(i,t,e,n,s,o,r,a,c,h,l,u,f,g,_,y){this[0
68
65
  * Licensed under
69
66
  * MIT License http://www.opensource.org/licenses/mit-license
70
67
  *
71
- */var qy=pa.exports,Af;function Gy(){return Af||(Af=1,function(i){(function(t,e){i.exports?i.exports=e(Ny(),jy(),Wy()):t.URI=e(t.punycode,t.IPv6,t.SecondLevelDomains,t)})(qy,function(t,e,n,s){var o=s&&s.URI;function r(m,v){var S=arguments.length>=1,A=arguments.length>=2;if(!(this instanceof r))return S?A?new r(m,v):new r(m):new r;if(m===void 0){if(S)throw new TypeError("undefined is not a valid argument for URI");typeof location<"u"?m=location.href+"":m=""}if(m===null&&S)throw new TypeError("null is not a valid argument for URI");return this.href(m),v!==void 0?this.absoluteTo(v):this}function a(m){return/^[0-9]+$/.test(m)}r.version="1.19.11";var c=r.prototype,h=Object.prototype.hasOwnProperty;function l(m){return m.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function u(m){return m===void 0?"Undefined":String(Object.prototype.toString.call(m)).slice(8,-1)}function f(m){return u(m)==="Array"}function g(m,v){var S={},A,F;if(u(v)==="RegExp")S=null;else if(f(v))for(A=0,F=v.length;A<F;A++)S[v[A]]=!0;else S[v]=!0;for(A=0,F=m.length;A<F;A++){var N=S&&S[m[A]]!==void 0||!S&&v.test(m[A]);N&&(m.splice(A,1),F--,A--)}return m}function _(m,v){var S,A;if(f(v)){for(S=0,A=v.length;S<A;S++)if(!_(m,v[S]))return!1;return!0}var F=u(v);for(S=0,A=m.length;S<A;S++)if(F==="RegExp"){if(typeof m[S]=="string"&&m[S].match(v))return!0}else if(m[S]===v)return!0;return!1}function y(m,v){if(!f(m)||!f(v)||m.length!==v.length)return!1;m.sort(),v.sort();for(var S=0,A=m.length;S<A;S++)if(m[S]!==v[S])return!1;return!0}function w(m){var v=/^\/+|\/+$/g;return m.replace(v,"")}r._parts=function(){return{protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null,preventInvalidHostname:r.preventInvalidHostname,duplicateQueryParameters:r.duplicateQueryParameters,escapeQuerySpace:r.escapeQuerySpace}},r.preventInvalidHostname=!1,r.duplicateQueryParameters=!1,r.escapeQuerySpace=!0,r.protocol_expression=/^[a-z][a-z0-9.+-]*$/i,r.idn_expression=/[^a-z0-9\._-]/i,r.punycode_expression=/(xn--)/i,r.ip4_expression=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,r.ip6_expression=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,r.find_uri_expression=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/ig,r.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?«»“”„‘’]+$/,parens:/(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g},r.leading_whitespace_expression=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,r.ascii_tab_whitespace=/[\u0009\u000A\u000D]+/g,r.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},r.hostProtocols=["http","https"],r.invalid_hostname_characters=/[^a-zA-Z0-9\.\-:_]/,r.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src",audio:"src",video:"src"},r.getDomAttribute=function(m){if(!(!m||!m.nodeName)){var v=m.nodeName.toLowerCase();if(!(v==="input"&&m.type!=="image"))return r.domAttributes[v]}};function E(m){return escape(m)}function b(m){return encodeURIComponent(m).replace(/[!'()*]/g,E).replace(/\*/g,"%2A")}r.encode=b,r.decode=decodeURIComponent,r.iso8859=function(){r.encode=escape,r.decode=unescape},r.unicode=function(){r.encode=b,r.decode=decodeURIComponent},r.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/ig,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/ig,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}},urnpath:{encode:{expression:/%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/ig,map:{"%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"=","%40":"@"}},decode:{expression:/[\/\?#:]/g,map:{"/":"%2F","?":"%3F","#":"%23",":":"%3A"}}}},r.encodeQuery=function(m,v){var S=r.encode(m+"");return v===void 0&&(v=r.escapeQuerySpace),v?S.replace(/%20/g,"+"):S},r.decodeQuery=function(m,v){m+="",v===void 0&&(v=r.escapeQuerySpace);try{return r.decode(v?m.replace(/\+/g,"%20"):m)}catch{return m}};var P={encode:"encode",decode:"decode"},I,M=function(m,v){return function(S){try{return r[v](S+"").replace(r.characters[m][v].expression,function(A){return r.characters[m][v].map[A]})}catch{return S}}};for(I in P)r[I+"PathSegment"]=M("pathname",P[I]),r[I+"UrnPathSegment"]=M("urnpath",P[I]);var D=function(m,v,S){return function(A){var F;S?F=function(Z){return r[v](r[S](Z))}:F=r[v];for(var N=(A+"").split(m),G=0,V=N.length;G<V;G++)N[G]=F(N[G]);return N.join(m)}};r.decodePath=D("/","decodePathSegment"),r.decodeUrnPath=D(":","decodeUrnPathSegment"),r.recodePath=D("/","encodePathSegment","decode"),r.recodeUrnPath=D(":","encodeUrnPathSegment","decode"),r.encodeReserved=M("reserved","encode"),r.parse=function(m,v){var S;return v||(v={preventInvalidHostname:r.preventInvalidHostname}),m=m.replace(r.leading_whitespace_expression,""),m=m.replace(r.ascii_tab_whitespace,""),S=m.indexOf("#"),S>-1&&(v.fragment=m.substring(S+1)||null,m=m.substring(0,S)),S=m.indexOf("?"),S>-1&&(v.query=m.substring(S+1)||null,m=m.substring(0,S)),m=m.replace(/^(https?|ftp|wss?)?:+[/\\]*/i,"$1://"),m=m.replace(/^[/\\]{2,}/i,"//"),m.substring(0,2)==="//"?(v.protocol=null,m=m.substring(2),m=r.parseAuthority(m,v)):(S=m.indexOf(":"),S>-1&&(v.protocol=m.substring(0,S)||null,v.protocol&&!v.protocol.match(r.protocol_expression)?v.protocol=void 0:m.substring(S+1,S+3).replace(/\\/g,"/")==="//"?(m=m.substring(S+3),m=r.parseAuthority(m,v)):(m=m.substring(S+1),v.urn=!0))),v.path=m,v},r.parseHost=function(m,v){m||(m=""),m=m.replace(/\\/g,"/");var S=m.indexOf("/"),A,F;if(S===-1&&(S=m.length),m.charAt(0)==="[")A=m.indexOf("]"),v.hostname=m.substring(1,A)||null,v.port=m.substring(A+2,S)||null,v.port==="/"&&(v.port=null);else{var N=m.indexOf(":"),G=m.indexOf("/"),V=m.indexOf(":",N+1);V!==-1&&(G===-1||V<G)?(v.hostname=m.substring(0,S)||null,v.port=null):(F=m.substring(0,S).split(":"),v.hostname=F[0]||null,v.port=F[1]||null)}return v.hostname&&m.substring(S).charAt(0)!=="/"&&(S++,m="/"+m),v.preventInvalidHostname&&r.ensureValidHostname(v.hostname,v.protocol),v.port&&r.ensureValidPort(v.port),m.substring(S)||"/"},r.parseAuthority=function(m,v){return m=r.parseUserinfo(m,v),r.parseHost(m,v)},r.parseUserinfo=function(m,v){var S=m,A=m.indexOf("\\");A!==-1&&(m=m.replace(/\\/g,"/"));var F=m.indexOf("/"),N=m.lastIndexOf("@",F>-1?F:m.length-1),G;return N>-1&&(F===-1||N<F)?(G=m.substring(0,N).split(":"),v.username=G[0]?r.decode(G[0]):null,G.shift(),v.password=G[0]?r.decode(G.join(":")):null,m=S.substring(N+1)):(v.username=null,v.password=null),m},r.parseQuery=function(m,v){if(!m)return{};if(m=m.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,""),!m)return{};for(var S={},A=m.split("&"),F=A.length,N,G,V,Z=0;Z<F;Z++)N=A[Z].split("="),G=r.decodeQuery(N.shift(),v),V=N.length?r.decodeQuery(N.join("="),v):null,G!=="__proto__"&&(h.call(S,G)?((typeof S[G]=="string"||S[G]===null)&&(S[G]=[S[G]]),S[G].push(V)):S[G]=V);return S},r.build=function(m){var v="",S=!1;return m.protocol&&(v+=m.protocol+":"),!m.urn&&(v||m.hostname)&&(v+="//",S=!0),v+=r.buildAuthority(m)||"",typeof m.path=="string"&&(m.path.charAt(0)!=="/"&&S&&(v+="/"),v+=m.path),typeof m.query=="string"&&m.query&&(v+="?"+m.query),typeof m.fragment=="string"&&m.fragment&&(v+="#"+m.fragment),v},r.buildHost=function(m){var v="";if(m.hostname)r.ip6_expression.test(m.hostname)?v+="["+m.hostname+"]":v+=m.hostname;else return"";return m.port&&(v+=":"+m.port),v},r.buildAuthority=function(m){return r.buildUserinfo(m)+r.buildHost(m)},r.buildUserinfo=function(m){var v="";return m.username&&(v+=r.encode(m.username)),m.password&&(v+=":"+r.encode(m.password)),v&&(v+="@"),v},r.buildQuery=function(m,v,S){var A="",F,N,G,V;for(N in m)if(N!=="__proto__"&&h.call(m,N))if(f(m[N]))for(F={},G=0,V=m[N].length;G<V;G++)m[N][G]!==void 0&&F[m[N][G]+""]===void 0&&(A+="&"+r.buildQueryParameter(N,m[N][G],S),v!==!0&&(F[m[N][G]+""]=!0));else m[N]!==void 0&&(A+="&"+r.buildQueryParameter(N,m[N],S));return A.substring(1)},r.buildQueryParameter=function(m,v,S){return r.encodeQuery(m,S)+(v!==null?"="+r.encodeQuery(v,S):"")},r.addQuery=function(m,v,S){if(typeof v=="object")for(var A in v)h.call(v,A)&&r.addQuery(m,A,v[A]);else if(typeof v=="string"){if(m[v]===void 0){m[v]=S;return}else typeof m[v]=="string"&&(m[v]=[m[v]]);f(S)||(S=[S]),m[v]=(m[v]||[]).concat(S)}else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter")},r.setQuery=function(m,v,S){if(typeof v=="object")for(var A in v)h.call(v,A)&&r.setQuery(m,A,v[A]);else if(typeof v=="string")m[v]=S===void 0?null:S;else throw new TypeError("URI.setQuery() accepts an object, string as the name parameter")},r.removeQuery=function(m,v,S){var A,F,N;if(f(v))for(A=0,F=v.length;A<F;A++)m[v[A]]=void 0;else if(u(v)==="RegExp")for(N in m)v.test(N)&&(m[N]=void 0);else if(typeof v=="object")for(N in v)h.call(v,N)&&r.removeQuery(m,N,v[N]);else if(typeof v=="string")S!==void 0?u(S)==="RegExp"?!f(m[v])&&S.test(m[v])?m[v]=void 0:m[v]=g(m[v],S):m[v]===String(S)&&(!f(S)||S.length===1)?m[v]=void 0:f(m[v])&&(m[v]=g(m[v],S)):m[v]=void 0;else throw new TypeError("URI.removeQuery() accepts an object, string, RegExp as the first parameter")},r.hasQuery=function(m,v,S,A){switch(u(v)){case"String":break;case"RegExp":for(var F in m)if(h.call(m,F)&&v.test(F)&&(S===void 0||r.hasQuery(m,F,S)))return!0;return!1;case"Object":for(var N in v)if(h.call(v,N)&&!r.hasQuery(m,N,v[N]))return!1;return!0;default:throw new TypeError("URI.hasQuery() accepts a string, regular expression or object as the name parameter")}switch(u(S)){case"Undefined":return v in m;case"Boolean":var G=!!(f(m[v])?m[v].length:m[v]);return S===G;case"Function":return!!S(m[v],v,m);case"Array":if(!f(m[v]))return!1;var V=A?_:y;return V(m[v],S);case"RegExp":return f(m[v])?A?_(m[v],S):!1:!!(m[v]&&m[v].match(S));case"Number":S=String(S);case"String":return f(m[v])?A?_(m[v],S):!1:m[v]===S;default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter")}},r.joinPaths=function(){for(var m=[],v=[],S=0,A=0;A<arguments.length;A++){var F=new r(arguments[A]);m.push(F);for(var N=F.segment(),G=0;G<N.length;G++)typeof N[G]=="string"&&v.push(N[G]),N[G]&&S++}if(!v.length||!S)return new r("");var V=new r("").segment(v);return(m[0].path()===""||m[0].path().slice(0,1)==="/")&&V.path("/"+V.path()),V.normalize()},r.commonPath=function(m,v){var S=Math.min(m.length,v.length),A;for(A=0;A<S;A++)if(m.charAt(A)!==v.charAt(A)){A--;break}return A<1?m.charAt(0)===v.charAt(0)&&m.charAt(0)==="/"?"/":"":((m.charAt(A)!=="/"||v.charAt(A)!=="/")&&(A=m.substring(0,A).lastIndexOf("/")),m.substring(0,A+1))},r.withinString=function(m,v,S){S||(S={});var A=S.start||r.findUri.start,F=S.end||r.findUri.end,N=S.trim||r.findUri.trim,G=S.parens||r.findUri.parens,V=/[a-z0-9-]=["']?$/i;for(A.lastIndex=0;;){var Z=A.exec(m);if(!Z)break;var B=Z.index;if(S.ignoreHtml){var at=m.slice(Math.max(B-3,0),B);if(at&&V.test(at))continue}for(var et=B+m.slice(B).search(F),it=m.slice(B,et),gt=-1;;){var wt=G.exec(it);if(!wt)break;var dt=wt.index+wt[0].length;gt=Math.max(gt,dt)}if(gt>-1?it=it.slice(0,gt)+it.slice(gt).replace(N,""):it=it.replace(N,""),!(it.length<=Z[0].length)&&!(S.ignore&&S.ignore.test(it))){et=B+it.length;var Et=v(it,B,et,m);if(Et===void 0){A.lastIndex=et;continue}Et=String(Et),m=m.slice(0,B)+Et+m.slice(et),A.lastIndex=B+Et.length}}return A.lastIndex=0,m},r.ensureValidHostname=function(m,v){var S=!!m,A=!!v,F=!1;if(A&&(F=_(r.hostProtocols,v)),F&&!S)throw new TypeError("Hostname cannot be empty, if protocol is "+v);if(m&&m.match(r.invalid_hostname_characters)){if(!t)throw new TypeError('Hostname "'+m+'" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available');if(t.toASCII(m).match(r.invalid_hostname_characters))throw new TypeError('Hostname "'+m+'" contains characters other than [A-Z0-9.-:_]')}},r.ensureValidPort=function(m){if(m){var v=Number(m);if(!(a(v)&&v>0&&v<65536))throw new TypeError('Port "'+m+'" is not a valid port')}},r.noConflict=function(m){if(m){var v={URI:this.noConflict()};return s.URITemplate&&typeof s.URITemplate.noConflict=="function"&&(v.URITemplate=s.URITemplate.noConflict()),s.IPv6&&typeof s.IPv6.noConflict=="function"&&(v.IPv6=s.IPv6.noConflict()),s.SecondLevelDomains&&typeof s.SecondLevelDomains.noConflict=="function"&&(v.SecondLevelDomains=s.SecondLevelDomains.noConflict()),v}else s.URI===this&&(s.URI=o);return this},c.build=function(m){return m===!0?this._deferred_build=!0:(m===void 0||this._deferred_build)&&(this._string=r.build(this._parts),this._deferred_build=!1),this},c.clone=function(){return new r(this)},c.valueOf=c.toString=function(){return this.build(!1)._string};function L(m){return function(v,S){return v===void 0?this._parts[m]||"":(this._parts[m]=v||null,this.build(!S),this)}}function z(m,v){return function(S,A){return S===void 0?this._parts[m]||"":(S!==null&&(S=S+"",S.charAt(0)===v&&(S=S.substring(1))),this._parts[m]=S,this.build(!A),this)}}c.protocol=L("protocol"),c.username=L("username"),c.password=L("password"),c.hostname=L("hostname"),c.port=L("port"),c.query=z("query","?"),c.fragment=z("fragment","#"),c.search=function(m,v){var S=this.query(m,v);return typeof S=="string"&&S.length?"?"+S:S},c.hash=function(m,v){var S=this.fragment(m,v);return typeof S=="string"&&S.length?"#"+S:S},c.pathname=function(m,v){if(m===void 0||m===!0){var S=this._parts.path||(this._parts.hostname?"/":"");return m?(this._parts.urn?r.decodeUrnPath:r.decodePath)(S):S}else return this._parts.urn?this._parts.path=m?r.recodeUrnPath(m):"":this._parts.path=m?r.recodePath(m):"/",this.build(!v),this},c.path=c.pathname,c.href=function(m,v){var S;if(m===void 0)return this.toString();this._string="",this._parts=r._parts();var A=m instanceof r,F=typeof m=="object"&&(m.hostname||m.path||m.pathname);if(m.nodeName){var N=r.getDomAttribute(m);m=m[N]||"",F=!1}if(!A&&F&&m.pathname!==void 0&&(m=m.toString()),typeof m=="string"||m instanceof String)this._parts=r.parse(String(m),this._parts);else if(A||F){var G=A?m._parts:m;for(S in G)S!=="query"&&h.call(this._parts,S)&&(this._parts[S]=G[S]);G.query&&this.query(G.query,!1)}else throw new TypeError("invalid input");return this.build(!v),this},c.is=function(m){var v=!1,S=!1,A=!1,F=!1,N=!1,G=!1,V=!1,Z=!this._parts.urn;switch(this._parts.hostname&&(Z=!1,S=r.ip4_expression.test(this._parts.hostname),A=r.ip6_expression.test(this._parts.hostname),v=S||A,F=!v,N=F&&n&&n.has(this._parts.hostname),G=F&&r.idn_expression.test(this._parts.hostname),V=F&&r.punycode_expression.test(this._parts.hostname)),m.toLowerCase()){case"relative":return Z;case"absolute":return!Z;case"domain":case"name":return F;case"sld":return N;case"ip":return v;case"ip4":case"ipv4":case"inet4":return S;case"ip6":case"ipv6":case"inet6":return A;case"idn":return G;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return V}return null};var q=c.protocol,Y=c.port,X=c.hostname;c.protocol=function(m,v){if(m&&(m=m.replace(/:(\/\/)?$/,""),!m.match(r.protocol_expression)))throw new TypeError('Protocol "'+m+`" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]`);return q.call(this,m,v)},c.scheme=c.protocol,c.port=function(m,v){return this._parts.urn?m===void 0?"":this:(m!==void 0&&(m===0&&(m=null),m&&(m+="",m.charAt(0)===":"&&(m=m.substring(1)),r.ensureValidPort(m))),Y.call(this,m,v))},c.hostname=function(m,v){if(this._parts.urn)return m===void 0?"":this;if(m!==void 0){var S={preventInvalidHostname:this._parts.preventInvalidHostname},A=r.parseHost(m,S);if(A!=="/")throw new TypeError('Hostname "'+m+'" contains characters other than [A-Z0-9.-]');m=S.hostname,this._parts.preventInvalidHostname&&r.ensureValidHostname(m,this._parts.protocol)}return X.call(this,m,v)},c.origin=function(m,v){if(this._parts.urn)return m===void 0?"":this;if(m===void 0){var S=this.protocol(),A=this.authority();return A?(S?S+"://":"")+this.authority():""}else{var F=r(m);return this.protocol(F.protocol()).authority(F.authority()).build(!v),this}},c.host=function(m,v){if(this._parts.urn)return m===void 0?"":this;if(m===void 0)return this._parts.hostname?r.buildHost(this._parts):"";var S=r.parseHost(m,this._parts);if(S!=="/")throw new TypeError('Hostname "'+m+'" contains characters other than [A-Z0-9.-]');return this.build(!v),this},c.authority=function(m,v){if(this._parts.urn)return m===void 0?"":this;if(m===void 0)return this._parts.hostname?r.buildAuthority(this._parts):"";var S=r.parseAuthority(m,this._parts);if(S!=="/")throw new TypeError('Hostname "'+m+'" contains characters other than [A-Z0-9.-]');return this.build(!v),this},c.userinfo=function(m,v){if(this._parts.urn)return m===void 0?"":this;if(m===void 0){var S=r.buildUserinfo(this._parts);return S&&S.substring(0,S.length-1)}else return m[m.length-1]!=="@"&&(m+="@"),r.parseUserinfo(m,this._parts),this.build(!v),this},c.resource=function(m,v){var S;return m===void 0?this.path()+this.search()+this.hash():(S=r.parse(m),this._parts.path=S.path,this._parts.query=S.query,this._parts.fragment=S.fragment,this.build(!v),this)},c.subdomain=function(m,v){if(this._parts.urn)return m===void 0?"":this;if(m===void 0){if(!this._parts.hostname||this.is("IP"))return"";var S=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,S)||""}else{var A=this._parts.hostname.length-this.domain().length,F=this._parts.hostname.substring(0,A),N=new RegExp("^"+l(F));if(m&&m.charAt(m.length-1)!=="."&&(m+="."),m.indexOf(":")!==-1)throw new TypeError("Domains cannot contain colons");return m&&r.ensureValidHostname(m,this._parts.protocol),this._parts.hostname=this._parts.hostname.replace(N,m),this.build(!v),this}},c.domain=function(m,v){if(this._parts.urn)return m===void 0?"":this;if(typeof m=="boolean"&&(v=m,m=void 0),m===void 0){if(!this._parts.hostname||this.is("IP"))return"";var S=this._parts.hostname.match(/\./g);if(S&&S.length<2)return this._parts.hostname;var A=this._parts.hostname.length-this.tld(v).length-1;return A=this._parts.hostname.lastIndexOf(".",A-1)+1,this._parts.hostname.substring(A)||""}else{if(!m)throw new TypeError("cannot set domain empty");if(m.indexOf(":")!==-1)throw new TypeError("Domains cannot contain colons");if(r.ensureValidHostname(m,this._parts.protocol),!this._parts.hostname||this.is("IP"))this._parts.hostname=m;else{var F=new RegExp(l(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(F,m)}return this.build(!v),this}},c.tld=function(m,v){if(this._parts.urn)return m===void 0?"":this;if(typeof m=="boolean"&&(v=m,m=void 0),m===void 0){if(!this._parts.hostname||this.is("IP"))return"";var S=this._parts.hostname.lastIndexOf("."),A=this._parts.hostname.substring(S+1);return v!==!0&&n&&n.list[A.toLowerCase()]&&n.get(this._parts.hostname)||A}else{var F;if(m)if(m.match(/[^a-zA-Z0-9-]/))if(n&&n.is(m))F=new RegExp(l(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(F,m);else throw new TypeError('TLD "'+m+'" contains characters other than [A-Z0-9]');else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");F=new RegExp(l(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(F,m)}else throw new TypeError("cannot set TLD empty");return this.build(!v),this}},c.directory=function(m,v){if(this._parts.urn)return m===void 0?"":this;if(m===void 0||m===!0){if(!this._parts.path&&!this._parts.hostname)return"";if(this._parts.path==="/")return"/";var S=this._parts.path.length-this.filename().length-1,A=this._parts.path.substring(0,S)||(this._parts.hostname?"/":"");return m?r.decodePath(A):A}else{var F=this._parts.path.length-this.filename().length,N=this._parts.path.substring(0,F),G=new RegExp("^"+l(N));return this.is("relative")||(m||(m="/"),m.charAt(0)!=="/"&&(m="/"+m)),m&&m.charAt(m.length-1)!=="/"&&(m+="/"),m=r.recodePath(m),this._parts.path=this._parts.path.replace(G,m),this.build(!v),this}},c.filename=function(m,v){if(this._parts.urn)return m===void 0?"":this;if(typeof m!="string"){if(!this._parts.path||this._parts.path==="/")return"";var S=this._parts.path.lastIndexOf("/"),A=this._parts.path.substring(S+1);return m?r.decodePathSegment(A):A}else{var F=!1;m.charAt(0)==="/"&&(m=m.substring(1)),m.match(/\.?\//)&&(F=!0);var N=new RegExp(l(this.filename())+"$");return m=r.recodePath(m),this._parts.path=this._parts.path.replace(N,m),F?this.normalizePath(v):this.build(!v),this}},c.suffix=function(m,v){if(this._parts.urn)return m===void 0?"":this;if(m===void 0||m===!0){if(!this._parts.path||this._parts.path==="/")return"";var S=this.filename(),A=S.lastIndexOf("."),F,N;return A===-1?"":(F=S.substring(A+1),N=/^[a-z0-9%]+$/i.test(F)?F:"",m?r.decodePathSegment(N):N)}else{m.charAt(0)==="."&&(m=m.substring(1));var G=this.suffix(),V;if(G)m?V=new RegExp(l(G)+"$"):V=new RegExp(l("."+G)+"$");else{if(!m)return this;this._parts.path+="."+r.recodePath(m)}return V&&(m=r.recodePath(m),this._parts.path=this._parts.path.replace(V,m)),this.build(!v),this}},c.segment=function(m,v,S){var A=this._parts.urn?":":"/",F=this.path(),N=F.substring(0,1)==="/",G=F.split(A);if(m!==void 0&&typeof m!="number"&&(S=v,v=m,m=void 0),m!==void 0&&typeof m!="number")throw new Error('Bad segment "'+m+'", must be 0-based integer');if(N&&G.shift(),m<0&&(m=Math.max(G.length+m,0)),v===void 0)return m===void 0?G:G[m];if(m===null||G[m]===void 0)if(f(v)){G=[];for(var V=0,Z=v.length;V<Z;V++)!v[V].length&&(!G.length||!G[G.length-1].length)||(G.length&&!G[G.length-1].length&&G.pop(),G.push(w(v[V])))}else(v||typeof v=="string")&&(v=w(v),G[G.length-1]===""?G[G.length-1]=v:G.push(v));else v?G[m]=w(v):G.splice(m,1);return N&&G.unshift(""),this.path(G.join(A),S)},c.segmentCoded=function(m,v,S){var A,F,N;if(typeof m!="number"&&(S=v,v=m,m=void 0),v===void 0){if(A=this.segment(m,v,S),!f(A))A=A!==void 0?r.decode(A):void 0;else for(F=0,N=A.length;F<N;F++)A[F]=r.decode(A[F]);return A}if(!f(v))v=typeof v=="string"||v instanceof String?r.encode(v):v;else for(F=0,N=v.length;F<N;F++)v[F]=r.encode(v[F]);return this.segment(m,v,S)};var Q=c.query;return c.query=function(m,v){if(m===!0)return r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if(typeof m=="function"){var S=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace),A=m.call(this,S);return this._parts.query=r.buildQuery(A||S,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!v),this}else return m!==void 0&&typeof m!="string"?(this._parts.query=r.buildQuery(m,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!v),this):Q.call(this,m,v)},c.setQuery=function(m,v,S){var A=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if(typeof m=="string"||m instanceof String)A[m]=v!==void 0?v:null;else if(typeof m=="object")for(var F in m)h.call(m,F)&&(A[F]=m[F]);else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");return this._parts.query=r.buildQuery(A,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof m!="string"&&(S=v),this.build(!S),this},c.addQuery=function(m,v,S){var A=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return r.addQuery(A,m,v===void 0?null:v),this._parts.query=r.buildQuery(A,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof m!="string"&&(S=v),this.build(!S),this},c.removeQuery=function(m,v,S){var A=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return r.removeQuery(A,m,v),this._parts.query=r.buildQuery(A,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof m!="string"&&(S=v),this.build(!S),this},c.hasQuery=function(m,v,S){var A=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return r.hasQuery(A,m,v,S)},c.setSearch=c.setQuery,c.addSearch=c.addQuery,c.removeSearch=c.removeQuery,c.hasSearch=c.hasQuery,c.normalize=function(){return this._parts.urn?this.normalizeProtocol(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build():this.normalizeProtocol(!1).normalizeHostname(!1).normalizePort(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build()},c.normalizeProtocol=function(m){return typeof this._parts.protocol=="string"&&(this._parts.protocol=this._parts.protocol.toLowerCase(),this.build(!m)),this},c.normalizeHostname=function(m){return this._parts.hostname&&(this.is("IDN")&&t?this._parts.hostname=t.toASCII(this._parts.hostname):this.is("IPv6")&&e&&(this._parts.hostname=e.best(this._parts.hostname)),this._parts.hostname=this._parts.hostname.toLowerCase(),this.build(!m)),this},c.normalizePort=function(m){return typeof this._parts.protocol=="string"&&this._parts.port===r.defaultPorts[this._parts.protocol]&&(this._parts.port=null,this.build(!m)),this},c.normalizePath=function(m){var v=this._parts.path;if(!v)return this;if(this._parts.urn)return this._parts.path=r.recodeUrnPath(this._parts.path),this.build(!m),this;if(this._parts.path==="/")return this;v=r.recodePath(v);var S,A="",F,N;for(v.charAt(0)!=="/"&&(S=!0,v="/"+v),(v.slice(-3)==="/.."||v.slice(-2)==="/.")&&(v+="/"),v=v.replace(/(\/(\.\/)+)|(\/\.$)/g,"/").replace(/\/{2,}/g,"/"),S&&(A=v.substring(1).match(/^(\.\.\/)+/)||"",A&&(A=A[0]));F=v.search(/\/\.\.(\/|$)/),F!==-1;){if(F===0){v=v.substring(3);continue}N=v.substring(0,F).lastIndexOf("/"),N===-1&&(N=F),v=v.substring(0,N)+v.substring(F+3)}return S&&this.is("relative")&&(v=A+v.substring(1)),this._parts.path=v,this.build(!m),this},c.normalizePathname=c.normalizePath,c.normalizeQuery=function(m){return typeof this._parts.query=="string"&&(this._parts.query.length?this.query(r.parseQuery(this._parts.query,this._parts.escapeQuerySpace)):this._parts.query=null,this.build(!m)),this},c.normalizeFragment=function(m){return this._parts.fragment||(this._parts.fragment=null,this.build(!m)),this},c.normalizeSearch=c.normalizeQuery,c.normalizeHash=c.normalizeFragment,c.iso8859=function(){var m=r.encode,v=r.decode;r.encode=escape,r.decode=decodeURIComponent;try{this.normalize()}finally{r.encode=m,r.decode=v}return this},c.unicode=function(){var m=r.encode,v=r.decode;r.encode=b,r.decode=unescape;try{this.normalize()}finally{r.encode=m,r.decode=v}return this},c.readable=function(){var m=this.clone();m.username("").password("").normalize();var v="";if(m._parts.protocol&&(v+=m._parts.protocol+"://"),m._parts.hostname&&(m.is("punycode")&&t?(v+=t.toUnicode(m._parts.hostname),m._parts.port&&(v+=":"+m._parts.port)):v+=m.host()),m._parts.hostname&&m._parts.path&&m._parts.path.charAt(0)!=="/"&&(v+="/"),v+=m.path(!0),m._parts.query){for(var S="",A=0,F=m._parts.query.split("&"),N=F.length;A<N;A++){var G=(F[A]||"").split("=");S+="&"+r.decodeQuery(G[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"),G[1]!==void 0&&(S+="="+r.decodeQuery(G[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}v+="?"+S.substring(1)}return v+=r.decodeQuery(m.hash(),!0),v},c.absoluteTo=function(m){var v=this.clone(),S=["protocol","username","password","hostname","port"],A,F,N;if(this._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(m instanceof r||(m=new r(m)),v._parts.protocol||(v._parts.protocol=m._parts.protocol,this._parts.hostname))return v;for(F=0;N=S[F];F++)v._parts[N]=m._parts[N];return v._parts.path?(v._parts.path.substring(-2)===".."&&(v._parts.path+="/"),v.path().charAt(0)!=="/"&&(A=m.directory(),A=A||(m.path().indexOf("/")===0?"/":""),v._parts.path=(A?A+"/":"")+v._parts.path,v.normalizePath())):(v._parts.path=m._parts.path,v._parts.query||(v._parts.query=m._parts.query)),v.build(),v},c.relativeTo=function(m){var v=this.clone().normalize(),S,A,F,N,G;if(v._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(m=new r(m).normalize(),S=v._parts,A=m._parts,N=v.path(),G=m.path(),N.charAt(0)!=="/")throw new Error("URI is already relative");if(G.charAt(0)!=="/")throw new Error("Cannot calculate a URI relative to another relative URI");if(S.protocol===A.protocol&&(S.protocol=null),S.username!==A.username||S.password!==A.password||S.protocol!==null||S.username!==null||S.password!==null)return v.build();if(S.hostname===A.hostname&&S.port===A.port)S.hostname=null,S.port=null;else return v.build();if(N===G)return S.path="",v.build();if(F=r.commonPath(N,G),!F)return v.build();var V=A.path.substring(F.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../");return S.path=V+S.path.substring(F.length)||"./",v.build()},c.equals=function(m){var v=this.clone(),S=new r(m),A={},F={},N={},G,V,Z;if(v.normalize(),S.normalize(),v.toString()===S.toString())return!0;if(G=v.query(),V=S.query(),v.query(""),S.query(""),v.toString()!==S.toString()||G.length!==V.length)return!1;A=r.parseQuery(G,this._parts.escapeQuerySpace),F=r.parseQuery(V,this._parts.escapeQuerySpace);for(Z in A)if(h.call(A,Z)){if(f(A[Z])){if(!y(A[Z],F[Z]))return!1}else if(A[Z]!==F[Z])return!1;N[Z]=!0}for(Z in F)if(h.call(F,Z)&&!N[Z])return!1;return!0},c.preventInvalidHostname=function(m){return this._parts.preventInvalidHostname=!!m,this},c.duplicateQueryParameters=function(m){return this._parts.duplicateQueryParameters=!!m,this},c.escapeQuerySpace=function(m){return this._parts.escapeQuerySpace=!!m,this},r})}(pa)),pa.exports}var Vy=Gy();const hn=hf(Vy);function By(i){return(i.length===0||i[i.length-1]!=="/")&&(i=`${i}/`),i}function Ts(i,t){if(i===null||typeof i!="object")return i;t=t??!1;const e=new i.constructor;for(const n in i)if(i.hasOwnProperty(n)){let s=i[n];t&&(s=Ts(s,t)),e[n]=s}return e}function ln(i,t,e){e=e??!1;const n={},s=C(i),o=C(t);let r,a,c;if(s)for(r in i)i.hasOwnProperty(r)&&(a=i[r],o&&e&&typeof a=="object"&&t.hasOwnProperty(r)?(c=t[r],typeof c=="object"?n[r]=ln(a,c,e):n[r]=a):n[r]=a);if(o)for(r in t)t.hasOwnProperty(r)&&!n.hasOwnProperty(r)&&(c=t[r],n[r]=c);return n}function Fo(){let i,t;const e=new Promise(function(n,s){i=n,t=s});return{resolve:i,reject:t,promise:e}}function Lo(i,t){let e;return typeof document<"u"&&(e=document),Lo._implementation(i,t,e)}Lo._implementation=function(i,t,e){if(!C(i))throw new j("relative uri is required.");if(!C(t)){if(typeof e>"u")return i;t=e.baseURI??e.location.href}const n=new hn(i);return n.scheme()!==""?n.toString():n.absoluteTo(t).toString()};function Yy(i,t){if(!C(i))throw new j("uri is required.");let e="";const n=i.lastIndexOf("/");return n!==-1&&(e=i.substring(0,n+1)),t&&(i=new hn(i),i.query().length!==0&&(e+=`?${i.query()}`),i.fragment().length!==0&&(e+=`#${i.fragment()}`)),e}function Hy(i){if(!C(i))throw new j("uri is required.");const t=new hn(i);t.normalize();let e=t.path(),n=e.lastIndexOf("/");return n!==-1&&(e=e.substr(n+1)),n=e.lastIndexOf("."),n===-1?e="":e=e.substr(n+1),e}const Mf={};function Df(i,t,e){C(t)||(t=i.width),C(e)||(e=i.height);let n=Mf[t];C(n)||(n={},Mf[t]=n);let s=n[e];if(!C(s)){const o=document.createElement("canvas");o.width=t,o.height=e,s=o.getContext("2d",{willReadFrequently:!0}),s.globalCompositeOperation="copy",n[e]=s}return s.drawImage(i,0,0,t,e),s.getImageData(0,0,t,e).data}const Xy=/^blob:/i;function Ff(i){return p.typeOf.string("uri",i),Xy.test(i)}let ai;function $y(i){C(ai)||(ai=document.createElement("a")),ai.href=window.location.href;const t=ai.host,e=ai.protocol;return ai.href=i,ai.href=ai.href,e!==ai.protocol||t!==ai.host}const Zy=/^data:/i;function Lf(i){return p.typeOf.string("uri",i),Zy.test(i)}function Ky(i){const t=document.createElement("script");return t.async=!0,t.src=i,new Promise((e,n)=>{window.crossOriginIsolated&&t.setAttribute("crossorigin","anonymous");const s=document.getElementsByTagName("head")[0];t.onload=function(){t.onload=void 0,s.removeChild(t),e()},t.onerror=function(o){n(o)},s.appendChild(t)})}function Qy(i){if(!C(i))throw new j("obj is required.");let t="";for(const e in i)if(i.hasOwnProperty(e)){const n=i[e],s=`${encodeURIComponent(e)}=`;if(Array.isArray(n))for(let o=0,r=n.length;o<r;++o)t+=`${s+encodeURIComponent(n[o])}&`;else t+=`${s+encodeURIComponent(n)}&`}return t=t.slice(0,-1),t}function Jy(i){if(!C(i))throw new j("queryString is required.");const t={};if(i==="")return t;const e=i.replace(/\+/g,"%20").split(/[&;]/);for(let n=0,s=e.length;n<s;++n){const o=e[n].split("="),r=decodeURIComponent(o[0]);let a=o[1];C(a)?a=decodeURIComponent(a):a="";const c=t[r];typeof c=="string"?t[r]=[c,a]:Array.isArray(c)?c.push(a):t[r]=a}return t}const Nt=Object.freeze({UNISSUED:0,ISSUED:1,ACTIVE:2,RECEIVED:3,CANCELLED:4,FAILED:5}),tw=Object.freeze({TERRAIN:0,IMAGERY:1,TILES3D:2,OTHER:3});function ya(i){i=i??ri.EMPTY_OBJECT;const t=i.throttleByServer??!1,e=i.throttle??!1;this.url=i.url,this.requestFunction=i.requestFunction,this.cancelFunction=i.cancelFunction,this.priorityFunction=i.priorityFunction,this.priority=i.priority??0,this.throttle=e,this.throttleByServer=t,this.type=i.type??tw.OTHER,this.serverKey=i.serverKey,this.state=Nt.UNISSUED,this.deferred=void 0,this.cancelled=!1}ya.prototype.cancel=function(){this.cancelled=!0},ya.prototype.clone=function(i){return C(i)?(i.url=this.url,i.requestFunction=this.requestFunction,i.cancelFunction=this.cancelFunction,i.priorityFunction=this.priorityFunction,i.priority=this.priority,i.throttle=this.throttle,i.throttleByServer=this.throttleByServer,i.type=this.type,i.serverKey=this.serverKey,i.state=Nt.UNISSUED,i.deferred=void 0,i.cancelled=!1,i):new ya(this)};function ew(i){const t={};if(!i)return t;const e=i.split(`\r
72
- `);for(let n=0;n<e.length;++n){const s=e[n],o=s.indexOf(": ");if(o>0){const r=s.substring(0,o),a=s.substring(o+2);t[r]=a}}return t}function zo(i,t,e){this.statusCode=i,this.response=t,this.responseHeaders=e,typeof this.responseHeaders=="string"&&(this.responseHeaders=ew(this.responseHeaders))}zo.prototype.toString=function(){let i="Request has failed.";return C(this.statusCode)&&(i+=` Status Code: ${this.statusCode}`),i};function No(){this._listeners=new Map,this._toRemove=new Map,this._toAdd=new Map,this._invokingListeners=!1,this._listenerCount=0}Object.defineProperties(No.prototype,{numberOfListeners:{get:function(){return this._listenerCount}}}),No.prototype.addEventListener=function(i,t){p.typeOf.func("listener",i);const e=this,n=e._invokingListeners?e._toAdd:e._listeners;return Ph(this,n,i,t)&&e._listenerCount++,function(){e.removeEventListener(i,t)}};function Ph(i,t,e,n){t.has(e)||t.set(e,new Set);const s=t.get(e);return s.has(n)?!1:(s.add(n),!0)}No.prototype.removeEventListener=function(i,t){p.typeOf.func("listener",i);const e=Oh(this,this._listeners,i,t),n=Oh(this,this._toAdd,i,t),s=e||n;return s&&this._listenerCount--,s};function Oh(i,t,e,n){const s=t.get(e);if(!s||!s.has(n))return!1;if(i._invokingListeners){if(!Ph(i,i._toRemove,e,n))return!1}else s.delete(n),s.size===0&&t.delete(e);return!0}No.prototype.raiseEvent=function(){this._invokingListeners=!0;for(const[i,t]of this._listeners.entries())if(C(i))for(const e of t)i.apply(e,arguments);this._invokingListeners=!1;for(const[i,t]of this._toAdd.entries())for(const e of t)Ph(this,this._listeners,i,e);this._toAdd.clear();for(const[i,t]of this._toRemove.entries())for(const e of t)Oh(this,this._listeners,i,e);this._toRemove.clear()};function Wn(i){p.typeOf.object("options",i),p.defined("options.comparator",i.comparator),this._comparator=i.comparator,this._array=[],this._length=0,this._maximumLength=void 0}Object.defineProperties(Wn.prototype,{length:{get:function(){return this._length}},internalArray:{get:function(){return this._array}},maximumLength:{get:function(){return this._maximumLength},set:function(i){p.typeOf.number.greaterThanOrEquals("maximumLength",i,0);const t=this._length;if(i<t){const e=this._array;for(let n=i;n<t;++n)e[n]=void 0;this._length=i,e.length=i}this._maximumLength=i}},comparator:{get:function(){return this._comparator}}});function Ih(i,t,e){const n=i[t];i[t]=i[e],i[e]=n}Wn.prototype.reserve=function(i){i=i??this._length,this._array.length=i},Wn.prototype.heapify=function(i){i=i??0;const t=this._length,e=this._comparator,n=this._array;let s=-1,o=!0;for(;o;){const r=2*(i+1),a=r-1;a<t&&e(n[a],n[i])<0?s=a:s=i,r<t&&e(n[r],n[s])<0&&(s=r),s!==i?(Ih(n,s,i),i=s):o=!1}},Wn.prototype.resort=function(){const i=this._length;for(let t=Math.ceil(i/2);t>=0;--t)this.heapify(t)},Wn.prototype.insert=function(i){p.defined("element",i);const t=this._array,e=this._comparator,n=this._maximumLength;let s=this._length++;for(s<t.length?t[s]=i:t.push(i);s!==0;){const r=Math.floor((s-1)/2);if(e(t[s],t[r])<0)Ih(t,s,r),s=r;else break}let o;return C(n)&&this._length>n&&(o=t[n],this._length=n),o},Wn.prototype.pop=function(i){if(i=i??0,this._length===0)return;p.typeOf.number.lessThan("index",i,this._length);const t=this._array,e=t[i];return Ih(t,i,--this._length),this.heapify(i),t[this._length]=void 0,e};function iw(i,t){return i.priority-t.priority}const bt={numberOfAttemptedRequests:0,numberOfActiveRequests:0,numberOfCancelledRequests:0,numberOfCancelledActiveRequests:0,numberOfFailedRequests:0,numberOfActiveRequestsEver:0,lastNumberOfActiveRequests:0};let As=20;const ne=new Wn({comparator:iw});ne.maximumLength=As,ne.reserve(As);const ci=[];let Pi={};const nw=typeof document<"u"?new hn(document.location.href):new hn,wa=new No;function Tt(){}Tt.maximumRequests=50,Tt.maximumRequestsPerServer=18,Tt.requestsByServer={},Tt.throttleRequests=!0,Tt.debugShowStatistics=!1,Tt.requestCompletedEvent=wa,Object.defineProperties(Tt,{statistics:{get:function(){return bt}},priorityHeapLength:{get:function(){return As},set:function(i){if(i<As)for(;ne.length>i;){const t=ne.pop();qn(t)}As=i,ne.maximumLength=i,ne.reserve(i)}}});function zf(i){C(i.priorityFunction)&&(i.priority=i.priorityFunction())}Tt.serverHasOpenSlots=function(i,t){t=t??1;const e=Tt.requestsByServer[i]??Tt.maximumRequestsPerServer;return Pi[i]+t<=e},Tt.heapHasOpenSlots=function(i){return ne.length+i<=As};function Nf(i){return i.state===Nt.UNISSUED&&(i.state=Nt.ISSUED,i.deferred=Fo()),i.deferred.promise}function sw(i){return function(t){if(i.state===Nt.CANCELLED)return;const e=i.deferred;--bt.numberOfActiveRequests,--Pi[i.serverKey],wa.raiseEvent(),i.state=Nt.RECEIVED,i.deferred=void 0,e.resolve(t)}}function ow(i){return function(t){i.state!==Nt.CANCELLED&&(++bt.numberOfFailedRequests,--bt.numberOfActiveRequests,--Pi[i.serverKey],wa.raiseEvent(t),i.state=Nt.FAILED,i.deferred.reject(t))}}function Uf(i){const t=Nf(i);return i.state=Nt.ACTIVE,ci.push(i),++bt.numberOfActiveRequests,++bt.numberOfActiveRequestsEver,++Pi[i.serverKey],i.requestFunction().then(sw(i)).catch(ow(i)),t}function qn(i){const t=i.state===Nt.ACTIVE;if(i.state=Nt.CANCELLED,++bt.numberOfCancelledRequests,C(i.deferred)){const e=i.deferred;i.deferred=void 0,e.reject()}t&&(--bt.numberOfActiveRequests,--Pi[i.serverKey],++bt.numberOfCancelledActiveRequests),C(i.cancelFunction)&&i.cancelFunction()}Tt.update=function(){let i,t,e=0;const n=ci.length;for(i=0;i<n;++i){if(t=ci[i],t.cancelled&&qn(t),t.state!==Nt.ACTIVE){++e;continue}e>0&&(ci[i-e]=t)}ci.length-=e;const s=ne.internalArray,o=ne.length;for(i=0;i<o;++i)zf(s[i]);ne.resort();const r=Math.max(Tt.maximumRequests-ci.length,0);let a=0;for(;a<r&&ne.length>0;){if(t=ne.pop(),t.cancelled){qn(t);continue}if(t.throttleByServer&&!Tt.serverHasOpenSlots(t.serverKey)){qn(t);continue}Uf(t),++a}rw()},Tt.getServerKey=function(i){p.typeOf.string("url",i);let t=new hn(i);t.scheme()===""&&(t=t.absoluteTo(nw),t.normalize());let e=t.authority();/:/.test(e)||(e=`${e}:${t.scheme()==="https"?"443":"80"}`);const n=Pi[e];return C(n)||(Pi[e]=0),e},Tt.request=function(i){if(p.typeOf.object("request",i),p.typeOf.string("request.url",i.url),p.typeOf.func("request.requestFunction",i.requestFunction),Lf(i.url)||Ff(i.url))return wa.raiseEvent(),i.state=Nt.RECEIVED,i.requestFunction();if(++bt.numberOfAttemptedRequests,C(i.serverKey)||(i.serverKey=Tt.getServerKey(i.url)),Tt.throttleRequests&&i.throttleByServer&&!Tt.serverHasOpenSlots(i.serverKey))return;if(!Tt.throttleRequests||!i.throttle)return Uf(i);if(ci.length>=Tt.maximumRequests)return;zf(i);const t=ne.insert(i);if(C(t)){if(t===i)return;qn(t)}return Nf(i)};function rw(){Tt.debugShowStatistics&&(bt.numberOfActiveRequests===0&&bt.lastNumberOfActiveRequests>0&&(bt.numberOfAttemptedRequests>0&&(console.log(`Number of attempted requests: ${bt.numberOfAttemptedRequests}`),bt.numberOfAttemptedRequests=0),bt.numberOfCancelledRequests>0&&(console.log(`Number of cancelled requests: ${bt.numberOfCancelledRequests}`),bt.numberOfCancelledRequests=0),bt.numberOfCancelledActiveRequests>0&&(console.log(`Number of cancelled active requests: ${bt.numberOfCancelledActiveRequests}`),bt.numberOfCancelledActiveRequests=0),bt.numberOfFailedRequests>0&&(console.log(`Number of failed requests: ${bt.numberOfFailedRequests}`),bt.numberOfFailedRequests=0)),bt.lastNumberOfActiveRequests=bt.numberOfActiveRequests)}Tt.clearForSpecs=function(){for(;ne.length>0;){const t=ne.pop();qn(t)}const i=ci.length;for(let t=0;t<i;++t)qn(ci[t]);ci.length=0,Pi={},bt.numberOfAttemptedRequests=0,bt.numberOfActiveRequests=0,bt.numberOfCancelledRequests=0,bt.numberOfCancelledActiveRequests=0,bt.numberOfFailedRequests=0,bt.numberOfActiveRequestsEver=0,bt.lastNumberOfActiveRequests=0},Tt.numberOfActiveRequestsByServer=function(i){return Pi[i]},Tt.requestHeap=ne;const Ms={};let Ds={};Ms.add=function(i,t){if(!C(i))throw new j("host is required.");if(!C(t)||t<=0)throw new j("port is required to be greater than 0.");const e=`${i.toLowerCase()}:${t}`;C(Ds[e])||(Ds[e]=!0)},Ms.remove=function(i,t){if(!C(i))throw new j("host is required.");if(!C(t)||t<=0)throw new j("port is required to be greater than 0.");const e=`${i.toLowerCase()}:${t}`;C(Ds[e])&&delete Ds[e]};function aw(i){const t=new hn(i);t.normalize();let e=t.authority();if(e.length!==0){if(t.authority(e),e.indexOf("@")!==-1&&(e=e.split("@")[1]),e.indexOf(":")===-1){let n=t.scheme();if(n.length===0&&(n=window.location.protocol,n=n.substring(0,n.length-1)),n==="http")e+=":80";else if(n==="https")e+=":443";else return}return e}}Ms.contains=function(i){if(!C(i))throw new j("url is required.");const t=aw(i);return!!(C(t)&&C(Ds[t]))},Ms.clear=function(){Ds={}};const jf=function(){try{const i=new XMLHttpRequest;return i.open("GET","#",!0),i.responseType="blob",i.responseType==="blob"}catch{return!1}}();function J(i){i=i??ri.EMPTY_OBJECT,typeof i=="string"&&(i={url:i}),p.typeOf.string("options.url",i.url),this._url=void 0,this._templateValues=hi(i.templateValues,{}),this._queryParameters=hi(i.queryParameters,{}),this.headers=hi(i.headers,{}),this.request=i.request??new ya,this.proxy=i.proxy,this.retryCallback=i.retryCallback,this.retryAttempts=i.retryAttempts??0,this._retryCount=0,i.parseUrl??!0?this.parseUrl(i.url,!0,!0):this._url=i.url,this._credits=i.credits}function hi(i,t){return C(i)?Ts(i):t}J.createIfNeeded=function(i){return i instanceof J?i.getDerivedResource({request:i.request}):typeof i!="string"?i:new J({url:i})};let Fs;J.supportsImageBitmapOptions=function(){return C(Fs)?Fs:typeof createImageBitmap!="function"?(Fs=Promise.resolve(!1),Fs):(Fs=J.fetchBlob({url:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAABGdBTUEAAE4g3rEiDgAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADElEQVQI12Ng6GAAAAEUAIngE3ZiAAAAAElFTkSuQmCC"}).then(function(t){const e={imageOrientation:"flipY",premultiplyAlpha:"none",colorSpaceConversion:"none"};return Promise.all([createImageBitmap(t,e),createImageBitmap(t)])}).then(function(t){const e=Df(t[0]),n=Df(t[1]);return e[1]!==n[1]}).catch(function(){return!1}),Fs)},Object.defineProperties(J,{isBlobSupported:{get:function(){return jf}}}),Object.defineProperties(J.prototype,{queryParameters:{get:function(){return this._queryParameters}},templateValues:{get:function(){return this._templateValues}},url:{get:function(){return this.getUrlComponent(!0,!0)},set:function(i){this.parseUrl(i,!1,!1)}},extension:{get:function(){return Hy(this._url)}},isDataUri:{get:function(){return Lf(this._url)}},isBlobUri:{get:function(){return Ff(this._url)}},isCrossOriginUrl:{get:function(){return $y(this._url)}},hasHeaders:{get:function(){return Object.keys(this.headers).length>0}},credits:{get:function(){return this._credits}}}),J.prototype.toString=function(){return this.getUrlComponent(!0,!0)},J.prototype.parseUrl=function(i,t,e,n){let s=new hn(i);const o=cw(s.query());this._queryParameters=t?va(o,this.queryParameters,e):o,s.search(""),s.fragment(""),C(n)&&s.scheme()===""&&(s=s.absoluteTo(Lo(n))),this._url=s.toString()};function cw(i){return i.length===0?{}:i.indexOf("=")===-1?{[i]:void 0}:Jy(i)}function va(i,t,e){if(!e)return ln(i,t);const n=Ts(i,!0);for(const s in t)if(t.hasOwnProperty(s)){let o=n[s];const r=t[s];C(o)?(Array.isArray(o)||(o=n[s]=[o]),n[s]=o.concat(r)):n[s]=Array.isArray(r)?r.slice():r}return n}J.prototype.getUrlComponent=function(i,t){if(this.isDataUri)return this._url;let e=this._url;i&&(e=`${e}${hw(this.queryParameters)}`),e=e.replace(/%7B/g,"{").replace(/%7D/g,"}");const n=this._templateValues;return Object.keys(n).length>0&&(e=e.replace(/{(.*?)}/g,function(s,o){const r=n[o];return C(r)?encodeURIComponent(r):s})),t&&C(this.proxy)&&(e=this.proxy.getURL(e)),e};function hw(i){const t=Object.keys(i);return t.length===0?"":t.length===1&&!C(i[t[0]])?`?${t[0]}`:`?${Qy(i)}`}J.prototype.setQueryParameters=function(i,t){t?this._queryParameters=va(this._queryParameters,i,!1):this._queryParameters=va(i,this._queryParameters,!1)},J.prototype.appendQueryParameters=function(i){this._queryParameters=va(i,this._queryParameters,!0)},J.prototype.setTemplateValues=function(i,t){t?this._templateValues=ln(this._templateValues,i):this._templateValues=ln(i,this._templateValues)},J.prototype.getDerivedResource=function(i){const t=this.clone();if(t._retryCount=0,C(i.url)){const e=i.preserveQueryParameters??!1;t.parseUrl(i.url,!0,e,this._url)}return C(i.queryParameters)&&(t._queryParameters=ln(i.queryParameters,t.queryParameters)),C(i.templateValues)&&(t._templateValues=ln(i.templateValues,t.templateValues)),C(i.headers)&&(t.headers=ln(i.headers,t.headers)),C(i.proxy)&&(t.proxy=i.proxy),C(i.request)&&(t.request=i.request),C(i.retryCallback)&&(t.retryCallback=i.retryCallback),C(i.retryAttempts)&&(t.retryAttempts=i.retryAttempts),t},J.prototype.retryOnError=function(i){const t=this.retryCallback;if(typeof t!="function"||this._retryCount>=this.retryAttempts)return Promise.resolve(!1);const e=this;return Promise.resolve(t(this,i)).then(function(n){return++e._retryCount,n})},J.prototype.clone=function(i){return C(i)?(i._url=this._url,i._queryParameters=Ts(this._queryParameters),i._templateValues=Ts(this._templateValues),i.headers=Ts(this.headers),i.proxy=this.proxy,i.retryCallback=this.retryCallback,i.retryAttempts=this.retryAttempts,i._retryCount=0,i.request=this.request.clone(),i):new J({url:this._url,queryParameters:this.queryParameters,templateValues:this.templateValues,headers:this.headers,proxy:this.proxy,retryCallback:this.retryCallback,retryAttempts:this.retryAttempts,request:this.request.clone(),parseUrl:!1,credits:C(this.credits)?this.credits.slice():void 0})},J.prototype.getBaseUri=function(i){return Yy(this.getUrlComponent(i),i)},J.prototype.appendForwardSlash=function(){this._url=By(this._url)},J.prototype.fetchArrayBuffer=function(){return this.fetch({responseType:"arraybuffer"})},J.fetchArrayBuffer=function(i){return new J(i).fetchArrayBuffer()},J.prototype.fetchBlob=function(){return this.fetch({responseType:"blob"})},J.fetchBlob=function(i){return new J(i).fetchBlob()},J.prototype.fetchImage=function(i){i=i??ri.EMPTY_OBJECT;const t=i.preferImageBitmap??!1,e=i.preferBlob??!1,n=i.flipY??!1,s=i.skipColorSpaceConversion??!1;if(Ah(this.request),!jf||this.isDataUri||this.isBlobUri||!this.hasHeaders&&!e)return Th({resource:this,flipY:n,skipColorSpaceConversion:s,preferImageBitmap:t});const o=this.fetchBlob();if(!C(o))return;let r,a,c,h;return J.supportsImageBitmapOptions().then(function(l){return r=l,a=r&&t,o}).then(function(l){if(!C(l))return;if(h=l,a)return J.createImageBitmapFromBlob(l,{flipY:n,premultiplyAlpha:!1,skipColorSpaceConversion:s});const u=window.URL.createObjectURL(l);return c=new J({url:u}),Th({resource:c,flipY:n,skipColorSpaceConversion:s,preferImageBitmap:!1})}).then(function(l){if(C(l))return l.blob=h,a||window.URL.revokeObjectURL(c.url),l}).catch(function(l){return C(c)&&window.URL.revokeObjectURL(c.url),l.blob=h,Promise.reject(l)})};function Th(i){const t=i.resource,e=i.flipY,n=i.skipColorSpaceConversion,s=i.preferImageBitmap,o=t.request;o.url=t.url,o.requestFunction=function(){let a=!1;!t.isDataUri&&!t.isBlobUri&&(a=t.isCrossOriginUrl);const c=Fo();return J._Implementations.createImage(o,a,c,e,n,s),c.promise};const r=Tt.request(o);if(C(r))return r.catch(function(a){return o.state!==Nt.FAILED?Promise.reject(a):t.retryOnError(a).then(function(c){return c?(o.state=Nt.UNISSUED,o.deferred=void 0,Th({resource:t,flipY:e,skipColorSpaceConversion:n,preferImageBitmap:s})):Promise.reject(a)})})}J.fetchImage=function(i){return new J(i).fetchImage({flipY:i.flipY,skipColorSpaceConversion:i.skipColorSpaceConversion,preferBlob:i.preferBlob,preferImageBitmap:i.preferImageBitmap})},J.prototype.fetchText=function(){return this.fetch({responseType:"text"})},J.fetchText=function(i){return new J(i).fetchText()},J.prototype.fetchJson=function(){const i=this.fetch({responseType:"text",headers:{Accept:"application/json,*/*;q=0.01"}});if(C(i))return i.then(function(t){if(C(t))return JSON.parse(t)})},J.fetchJson=function(i){return new J(i).fetchJson()},J.prototype.fetchXML=function(){return this.fetch({responseType:"document",overrideMimeType:"text/xml"})},J.fetchXML=function(i){return new J(i).fetchXML()},J.prototype.fetchJsonp=function(i){i=i??"callback",Ah(this.request);let t;do t=`loadJsonp${T.nextRandomNumber().toString().substring(2,8)}`;while(C(window[t]));return kf(this,i,t)};function kf(i,t,e){const n={};n[t]=e,i.setQueryParameters(n);const s=i.request,o=i.url;s.url=o,s.requestFunction=function(){const a=Fo();return window[e]=function(c){a.resolve(c);try{delete window[e]}catch{window[e]=void 0}},J._Implementations.loadAndExecuteScript(o,e,a),a.promise};const r=Tt.request(s);if(C(r))return r.catch(function(a){return s.state!==Nt.FAILED?Promise.reject(a):i.retryOnError(a).then(function(c){return c?(s.state=Nt.UNISSUED,s.deferred=void 0,kf(i,t,e)):Promise.reject(a)})})}J.fetchJsonp=function(i){return new J(i).fetchJsonp(i.callbackParameterName)},J.prototype._makeRequest=function(i){const t=this;Ah(t.request);const e=t.request,n=t.url;e.url=n,e.requestFunction=function(){const o=i.responseType,r=ln(i.headers,t.headers),a=i.overrideMimeType,c=i.method,h=i.data,l=Fo(),u=J._Implementations.loadWithXhr(n,o,c,h,r,l,a);return C(u)&&C(u.abort)&&(e.cancelFunction=function(){u.abort()}),l.promise};const s=Tt.request(e);if(C(s))return s.then(function(o){return e.cancelFunction=void 0,o}).catch(function(o){return e.cancelFunction=void 0,e.state!==Nt.FAILED?Promise.reject(o):t.retryOnError(o).then(function(r){return r?(e.state=Nt.UNISSUED,e.deferred=void 0,t.fetch(i)):Promise.reject(o)})})};function Ah(i){if(i.state===Nt.ISSUED||i.state===Nt.ACTIVE)throw new De("The Resource is already being fetched.");i.state=Nt.UNISSUED,i.deferred=void 0}const lw=/^data:(.*?)(;base64)?,(.*)$/;function Ea(i,t){const e=decodeURIComponent(t);return i?atob(e):e}function Wf(i,t){const e=Ea(i,t),n=new ArrayBuffer(e.length),s=new Uint8Array(n);for(let o=0;o<e.length;o++)s[o]=e.charCodeAt(o);return n}function uw(i,t){t=t??"";const e=i[1],n=!!i[2],s=i[3];let o,r;switch(t){case"":case"text":return Ea(n,s);case"arraybuffer":return Wf(n,s);case"blob":return o=Wf(n,s),new Blob([o],{type:e});case"document":return r=new DOMParser,r.parseFromString(Ea(n,s),e);case"json":return JSON.parse(Ea(n,s));default:throw new j(`Unhandled responseType: ${t}`)}}J.prototype.fetch=function(i){return i=hi(i,{}),i.method="GET",this._makeRequest(i)},J.fetch=function(i){return new J(i).fetch({responseType:i.responseType,overrideMimeType:i.overrideMimeType})},J.prototype.delete=function(i){return i=hi(i,{}),i.method="DELETE",this._makeRequest(i)},J.delete=function(i){return new J(i).delete({responseType:i.responseType,overrideMimeType:i.overrideMimeType,data:i.data})},J.prototype.head=function(i){return i=hi(i,{}),i.method="HEAD",this._makeRequest(i)},J.head=function(i){return new J(i).head({responseType:i.responseType,overrideMimeType:i.overrideMimeType})},J.prototype.options=function(i){return i=hi(i,{}),i.method="OPTIONS",this._makeRequest(i)},J.options=function(i){return new J(i).options({responseType:i.responseType,overrideMimeType:i.overrideMimeType})},J.prototype.post=function(i,t){return p.defined("data",i),t=hi(t,{}),t.method="POST",t.data=i,this._makeRequest(t)},J.post=function(i){return new J(i).post(i.data,{responseType:i.responseType,overrideMimeType:i.overrideMimeType})},J.prototype.put=function(i,t){return p.defined("data",i),t=hi(t,{}),t.method="PUT",t.data=i,this._makeRequest(t)},J.put=function(i){return new J(i).put(i.data,{responseType:i.responseType,overrideMimeType:i.overrideMimeType})},J.prototype.patch=function(i,t){return p.defined("data",i),t=hi(t,{}),t.method="PATCH",t.data=i,this._makeRequest(t)},J.patch=function(i){return new J(i).patch(i.data,{responseType:i.responseType,overrideMimeType:i.overrideMimeType})},J._Implementations={},J._Implementations.loadImageElement=function(i,t,e){const n=new Image;n.onload=function(){n.naturalWidth===0&&n.naturalHeight===0&&n.width===0&&n.height===0&&(n.width=300,n.height=150),e.resolve(n)},n.onerror=function(s){e.reject(s)},t&&(Ms.contains(i)?n.crossOrigin="use-credentials":n.crossOrigin=""),n.src=i},J._Implementations.createImage=function(i,t,e,n,s,o){const r=i.url;J.supportsImageBitmapOptions().then(function(a){if(!(a&&o)){J._Implementations.loadImageElement(r,t,e);return}const c="blob",h="GET",l=Fo(),u=J._Implementations.loadWithXhr(r,c,h,void 0,void 0,l,void 0,void 0,void 0);return C(u)&&C(u.abort)&&(i.cancelFunction=function(){u.abort()}),l.promise.then(function(f){if(!C(f)){e.reject(new De(`Successfully retrieved ${r} but it contained no content.`));return}return J.createImageBitmapFromBlob(f,{flipY:n,premultiplyAlpha:!1,skipColorSpaceConversion:s})}).then(function(f){e.resolve(f)})}).catch(function(a){e.reject(a)})},J.createImageBitmapFromBlob=function(i,t){return p.defined("options",t),p.typeOf.bool("options.flipY",t.flipY),p.typeOf.bool("options.premultiplyAlpha",t.premultiplyAlpha),p.typeOf.bool("options.skipColorSpaceConversion",t.skipColorSpaceConversion),createImageBitmap(i,{imageOrientation:t.flipY?"flipY":"none",premultiplyAlpha:t.premultiplyAlpha?"premultiply":"none",colorSpaceConversion:t.skipColorSpaceConversion?"none":"default"})};function dw(i,t,e,n,s,o,r){fetch(i,{method:e,headers:s}).then(async a=>{if(!a.ok){const c={};a.headers.forEach((h,l)=>{c[l]=h}),o.reject(new zo(a.status,a,c));return}switch(t){case"text":o.resolve(a.text());break;case"json":o.resolve(a.json());break;default:o.resolve(new Uint8Array(await a.arrayBuffer()).buffer);break}}).catch(()=>{o.reject(new zo)})}const fw=typeof XMLHttpRequest>"u";J._Implementations.loadWithXhr=function(i,t,e,n,s,o,r){const a=lw.exec(i);if(a!==null){o.resolve(uw(a,t));return}if(fw){dw(i,t,e,n,s,o);return}const c=new XMLHttpRequest;if(Ms.contains(i)&&(c.withCredentials=!0),c.open(e,i,!0),C(r)&&C(c.overrideMimeType)&&c.overrideMimeType(r),C(s))for(const l in s)s.hasOwnProperty(l)&&c.setRequestHeader(l,s[l]);C(t)&&(c.responseType=t);let h=!1;return typeof i=="string"&&(h=i.indexOf("file://")===0||typeof window<"u"&&window.location.origin==="file://"),c.onload=function(){if((c.status<200||c.status>=300)&&!(h&&c.status===0)){o.reject(new zo(c.status,c.response,c.getAllResponseHeaders()));return}const l=c.response,u=c.responseType;if(e==="HEAD"||e==="OPTIONS"){const g=c.getAllResponseHeaders().trim().split(/[\r\n]+/),_={};g.forEach(function(y){const w=y.split(": "),E=w.shift();_[E]=w.join(": ")}),o.resolve(_);return}if(c.status===204)o.resolve(void 0);else if(C(l)&&(!C(t)||u===t))o.resolve(l);else if(t==="json"&&typeof l=="string")try{o.resolve(JSON.parse(l))}catch(f){o.reject(f)}else(u===""||u==="document")&&C(c.responseXML)&&c.responseXML.hasChildNodes()?o.resolve(c.responseXML):(u===""||u==="text")&&C(c.responseText)?o.resolve(c.responseText):o.reject(new De("Invalid XMLHttpRequest response type."))},c.onerror=function(l){o.reject(new zo)},c.send(n),c},J._Implementations.loadAndExecuteScript=function(i,t,e){return Ky(i).catch(function(n){e.reject(n)})},J._DefaultImplementations={},J._DefaultImplementations.createImage=J._Implementations.createImage,J._DefaultImplementations.loadWithXhr=J._Implementations.loadWithXhr,J._DefaultImplementations.loadAndExecuteScript=J._Implementations.loadAndExecuteScript,J.DEFAULT=Object.freeze(new J({url:typeof document>"u"?"":document.location.href.split("?")[0]}));function Uo(i){i=i??ri.EMPTY_OBJECT,this._dates=void 0,this._samples=void 0,this._dateColumn=-1,this._xPoleWanderRadiansColumn=-1,this._yPoleWanderRadiansColumn=-1,this._ut1MinusUtcSecondsColumn=-1,this._xCelestialPoleOffsetRadiansColumn=-1,this._yCelestialPoleOffsetRadiansColumn=-1,this._taiMinusUtcSecondsColumn=-1,this._columnCount=0,this._lastIndex=-1,this._addNewLeapSeconds=i.addNewLeapSeconds??!0,C(i.data)?qf(this,i.data):qf(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})}Uo.fromUrl=async function(i,t){p.defined("url",i),t=t??ri.EMPTY_OBJECT;const e=J.createIfNeeded(i);let n;try{n=await e.fetchJson()}catch{throw new De(`An error occurred while retrieving the EOP data from the URL ${e.url}.`)}return new Uo({addNewLeapSeconds:t.addNewLeapSeconds,data:n})},Uo.NONE=Object.freeze({compute:function(i,t){return C(t)?(t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0):t=new Eh(0,0,0,0,0),t}}),Uo.prototype.compute=function(i,t){if(!C(this._samples))return;if(C(t)||(t=new Eh(0,0,0,0,0)),this._samples.length===0)return t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0,t;const e=this._dates,n=this._lastIndex;let s=0,o=0;if(C(n)){const a=e[n],c=e[n+1],h=$.lessThanOrEquals(a,i),l=!C(c),u=l||$.greaterThanOrEquals(c,i);if(h&&u)return s=n,!l&&c.equals(i)&&++s,o=s+1,Vf(this,e,this._samples,i,s,o,t),t}let r=Mo(e,i,$.compare,this._dateColumn);return r>=0?(r<e.length-1&&e[r+1].equals(i)&&++r,s=r,o=r):(o=~r,s=o-1,s<0&&(s=0)),this._lastIndex=s,Vf(this,e,this._samples,i,s,o,t),t};function gw(i,t){return $.compare(i.julianDate,t)}function qf(i,t){if(!C(t.columnNames))throw new De("Error in loaded EOP data: The columnNames property is required.");if(!C(t.samples))throw new De("Error in loaded EOP data: The samples property is required.");const e=t.columnNames.indexOf("modifiedJulianDateUtc"),n=t.columnNames.indexOf("xPoleWanderRadians"),s=t.columnNames.indexOf("yPoleWanderRadians"),o=t.columnNames.indexOf("ut1MinusUtcSeconds"),r=t.columnNames.indexOf("xCelestialPoleOffsetRadians"),a=t.columnNames.indexOf("yCelestialPoleOffsetRadians"),c=t.columnNames.indexOf("taiMinusUtcSeconds");if(e<0||n<0||s<0||o<0||r<0||a<0||c<0)throw new De("Error in loaded EOP data: The columnNames property must include modifiedJulianDateUtc, xPoleWanderRadians, yPoleWanderRadians, ut1MinusUtcSeconds, xCelestialPoleOffsetRadians, yCelestialPoleOffsetRadians, and taiMinusUtcSeconds columns");const h=i._samples=t.samples,l=i._dates=[];i._dateColumn=e,i._xPoleWanderRadiansColumn=n,i._yPoleWanderRadiansColumn=s,i._ut1MinusUtcSecondsColumn=o,i._xCelestialPoleOffsetRadiansColumn=r,i._yCelestialPoleOffsetRadiansColumn=a,i._taiMinusUtcSecondsColumn=c,i._columnCount=t.columnNames.length,i._lastIndex=void 0;let u;const f=i._addNewLeapSeconds;for(let g=0,_=h.length;g<_;g+=i._columnCount){const y=h[g+e],w=h[g+c],E=y+Dt.MODIFIED_JULIAN_DATE_DIFFERENCE,b=new $(E,w,mt.TAI);if(l.push(b),f){if(w!==u&&C(u)){const P=$.leapSeconds,I=Mo(P,b,gw);if(I<0){const M=new Pt(b,w);P.splice(~I,0,M)}}u=w}}}function Gf(i,t,e,n,s){const o=e*n;s.xPoleWander=t[o+i._xPoleWanderRadiansColumn],s.yPoleWander=t[o+i._yPoleWanderRadiansColumn],s.xPoleOffset=t[o+i._xCelestialPoleOffsetRadiansColumn],s.yPoleOffset=t[o+i._yCelestialPoleOffsetRadiansColumn],s.ut1MinusUtc=t[o+i._ut1MinusUtcSecondsColumn]}function jo(i,t,e){return t+i*(e-t)}function Vf(i,t,e,n,s,o,r){const a=i._columnCount;if(o>t.length-1)return r.xPoleWander=0,r.yPoleWander=0,r.xPoleOffset=0,r.yPoleOffset=0,r.ut1MinusUtc=0,r;const c=t[s],h=t[o];if(c.equals(h)||n.equals(c))return Gf(i,e,s,a,r),r;if(n.equals(h))return Gf(i,e,o,a,r),r;const l=$.secondsDifference(n,c)/$.secondsDifference(h,c),u=s*a,f=o*a;let g=e[u+i._ut1MinusUtcSecondsColumn],_=e[f+i._ut1MinusUtcSecondsColumn];const y=_-g;if(y>.5||y<-.5){const w=e[u+i._taiMinusUtcSecondsColumn],E=e[f+i._taiMinusUtcSecondsColumn];w!==E&&(h.equals(n)?g=_:_-=E-w)}return r.xPoleWander=jo(l,e[u+i._xPoleWanderRadiansColumn],e[f+i._xPoleWanderRadiansColumn]),r.yPoleWander=jo(l,e[u+i._yPoleWanderRadiansColumn],e[f+i._yPoleWanderRadiansColumn]),r.xPoleOffset=jo(l,e[u+i._xCelestialPoleOffsetRadiansColumn],e[f+i._xCelestialPoleOffsetRadiansColumn]),r.yPoleOffset=jo(l,e[u+i._yCelestialPoleOffsetRadiansColumn],e[f+i._yCelestialPoleOffsetRadiansColumn]),r.ut1MinusUtc=jo(l,g,_),r}function Yt(i,t,e){this.heading=i??0,this.pitch=t??0,this.roll=e??0}Yt.fromQuaternion=function(i,t){if(!C(i))throw new j("quaternion is required");C(t)||(t=new Yt);const e=2*(i.w*i.y-i.z*i.x),n=1-2*(i.x*i.x+i.y*i.y),s=2*(i.w*i.x+i.y*i.z),o=1-2*(i.y*i.y+i.z*i.z),r=2*(i.w*i.z+i.x*i.y);return t.heading=-Math.atan2(r,o),t.roll=Math.atan2(s,n),t.pitch=-T.asinClamped(e),t},Yt.fromDegrees=function(i,t,e,n){if(!C(i))throw new j("heading is required");if(!C(t))throw new j("pitch is required");if(!C(e))throw new j("roll is required");return C(n)||(n=new Yt),n.heading=i*T.RADIANS_PER_DEGREE,n.pitch=t*T.RADIANS_PER_DEGREE,n.roll=e*T.RADIANS_PER_DEGREE,n},Yt.clone=function(i,t){if(C(i))return C(t)?(t.heading=i.heading,t.pitch=i.pitch,t.roll=i.roll,t):new Yt(i.heading,i.pitch,i.roll)},Yt.equals=function(i,t){return i===t||C(i)&&C(t)&&i.heading===t.heading&&i.pitch===t.pitch&&i.roll===t.roll},Yt.equalsEpsilon=function(i,t,e,n){return i===t||C(i)&&C(t)&&T.equalsEpsilon(i.heading,t.heading,e,n)&&T.equalsEpsilon(i.pitch,t.pitch,e,n)&&T.equalsEpsilon(i.roll,t.roll,e,n)},Yt.prototype.clone=function(i){return Yt.clone(this,i)},Yt.prototype.equals=function(i){return Yt.equals(this,i)},Yt.prototype.equalsEpsilon=function(i,t,e){return Yt.equalsEpsilon(this,i,t,e)},Yt.prototype.toString=function(){return`(${this.heading}, ${this.pitch}, ${this.roll})`};const Bf=/((?:.*\/)|^)Cesium\.js(?:\?|\#|$)/;function pw(){const i=document.getElementsByTagName("script");for(let t=0,e=i.length;t<e;++t){const n=i[t].getAttribute("src"),s=Bf.exec(n);if(s!==null)return s[1]}}let Ca;function Yf(i){return typeof document>"u"?i:(C(Ca)||(Ca=document.createElement("a")),Ca.href=i,Ca.href)}let Gn;function Hf(){if(C(Gn))return Gn;let i;if(typeof CESIUM_BASE_URL<"u"?i=CESIUM_BASE_URL:C(as&&as.tagName.toUpperCase()==="SCRIPT"&&as.src||new URL("earthsdk3-ol.iife.js",document.baseURI).href)?i=Lo(".",as&&as.tagName.toUpperCase()==="SCRIPT"&&as.src||new URL("earthsdk3-ol.iife.js",document.baseURI).href):typeof define=="object"&&C(define.amd)&&!define.amd.toUrlUndefined&&C(require.toUrl)?i=Lo("..",Vn("Core/buildModuleUrl.js")):i=pw(),!C(i))throw new j("Unable to determine Cesium base URL automatically, try defining a global variable called CESIUM_BASE_URL.");return Gn=new J({url:Yf(i)}),Gn.appendForwardSlash(),Gn}function mw(i){return Yf(require.toUrl(`../${i}`))}function Xf(i){return Hf().getDerivedResource({url:i}).url}let ba;function Vn(i){return C(ba)||(typeof define=="object"&&C(define.amd)&&!define.amd.toUrlUndefined&&C(require.toUrl)?ba=mw:ba=Xf),ba(i)}Vn._cesiumScriptRegex=Bf,Vn._buildModuleUrlFromBaseUrl=Xf,Vn._clearBaseResource=function(){Gn=void 0},Vn.setBaseUrl=function(i){Gn=J.DEFAULT.getDerivedResource({url:i})},Vn.getCesiumBaseUrl=Hf;function $f(i,t,e){this.x=i,this.y=t,this.s=e}function Mh(i){i=i??ri.EMPTY_OBJECT,this._xysFileUrlTemplate=J.createIfNeeded(i.xysFileUrlTemplate),this._interpolationOrder=i.interpolationOrder??9,this._sampleZeroJulianEphemerisDate=i.sampleZeroJulianEphemerisDate??24423965e-1,this._sampleZeroDateTT=new $(this._sampleZeroJulianEphemerisDate,0,mt.TAI),this._stepSizeDays=i.stepSizeDays??1,this._samplesPerXysFile=i.samplesPerXysFile??1e3,this._totalSamples=i.totalSamples??27426,this._samples=new Array(this._totalSamples*3),this._chunkDownloadsInProgress=[];const t=this._interpolationOrder,e=this._denominators=new Array(t+1),n=this._xTable=new Array(t+1),s=Math.pow(this._stepSizeDays,t);for(let o=0;o<=t;++o){e[o]=s,n[o]=o*this._stepSizeDays;for(let r=0;r<=t;++r)r!==o&&(e[o]*=o-r);e[o]=1/e[o]}this._work=new Array(t+1),this._coef=new Array(t+1)}const _w=new $(0,0,mt.TAI);function Dh(i,t,e){const n=_w;return n.dayNumber=t,n.secondsOfDay=e,$.daysDifference(n,i._sampleZeroDateTT)}Mh.prototype.preload=function(i,t,e,n){const s=Dh(this,i,t),o=Dh(this,e,n);let r=s/this._stepSizeDays-this._interpolationOrder/2|0;r<0&&(r=0);let a=o/this._stepSizeDays-this._interpolationOrder/2|0+this._interpolationOrder;a>=this._totalSamples&&(a=this._totalSamples-1);const c=r/this._samplesPerXysFile|0,h=a/this._samplesPerXysFile|0,l=[];for(let u=c;u<=h;++u)l.push(Fh(this,u));return Promise.all(l)},Mh.prototype.computeXysRadians=function(i,t,e){const n=Dh(this,i,t);if(n<0)return;const s=n/this._stepSizeDays|0;if(s>=this._totalSamples)return;const o=this._interpolationOrder;let r=s-(o/2|0);r<0&&(r=0);let a=r+o;a>=this._totalSamples&&(a=this._totalSamples-1,r=a-o,r<0&&(r=0));let c=!1;const h=this._samples;if(C(h[r*3])||(Fh(this,r/this._samplesPerXysFile|0),c=!0),C(h[a*3])||(Fh(this,a/this._samplesPerXysFile|0),c=!0),c)return;C(e)?(e.x=0,e.y=0,e.s=0):e=new $f(0,0,0);const l=n-r*this._stepSizeDays,u=this._work,f=this._denominators,g=this._coef,_=this._xTable;let y,w;for(y=0;y<=o;++y)u[y]=l-_[y];for(y=0;y<=o;++y){for(g[y]=1,w=0;w<=o;++w)w!==y&&(g[y]*=u[w]);g[y]*=f[y];let E=(r+y)*3;e.x+=g[y]*h[E++],e.y+=g[y]*h[E++],e.s+=g[y]*h[E]}return e};function Fh(i,t){if(i._chunkDownloadsInProgress[t])return i._chunkDownloadsInProgress[t];let e;const n=i._xysFileUrlTemplate;C(n)?e=n.getDerivedResource({templateValues:{0:t}}):e=new J({url:Vn(`Assets/IAU2006_XYS/IAU2006_XYS_${t}.json`)});const s=e.fetchJson().then(function(o){i._chunkDownloadsInProgress[t]=!1;const r=i._samples,a=o.samples,c=t*i._samplesPerXysFile*3;for(let h=0,l=a.length;h<l;++h)r[c+h]=a[h]});return i._chunkDownloadsInProgress[t]=s,s}let un;const Lt={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},pe={};Object.defineProperties(pe,{element:{get:function(){if(pe.supportsFullscreen())return document[Lt.fullscreenElement]}},changeEventName:{get:function(){if(pe.supportsFullscreen())return Lt.fullscreenchange}},errorEventName:{get:function(){if(pe.supportsFullscreen())return Lt.fullscreenerror}},enabled:{get:function(){if(pe.supportsFullscreen())return document[Lt.fullscreenEnabled]}},fullscreen:{get:function(){if(pe.supportsFullscreen())return pe.element!==null}}}),pe.supportsFullscreen=function(){if(C(un))return un;un=!1;const i=document.body;if(typeof i.requestFullscreen=="function")return Lt.requestFullscreen="requestFullscreen",Lt.exitFullscreen="exitFullscreen",Lt.fullscreenEnabled="fullscreenEnabled",Lt.fullscreenElement="fullscreenElement",Lt.fullscreenchange="fullscreenchange",Lt.fullscreenerror="fullscreenerror",un=!0,un;const t=["webkit","moz","o","ms","khtml"];let e;for(let n=0,s=t.length;n<s;++n){const o=t[n];e=`${o}RequestFullscreen`,typeof i[e]=="function"?(Lt.requestFullscreen=e,un=!0):(e=`${o}RequestFullScreen`,typeof i[e]=="function"&&(Lt.requestFullscreen=e,un=!0)),e=`${o}ExitFullscreen`,typeof document[e]=="function"?Lt.exitFullscreen=e:(e=`${o}CancelFullScreen`,typeof document[e]=="function"&&(Lt.exitFullscreen=e)),e=`${o}FullscreenEnabled`,document[e]!==void 0?Lt.fullscreenEnabled=e:(e=`${o}FullScreenEnabled`,document[e]!==void 0&&(Lt.fullscreenEnabled=e)),e=`${o}FullscreenElement`,document[e]!==void 0?Lt.fullscreenElement=e:(e=`${o}FullScreenElement`,document[e]!==void 0&&(Lt.fullscreenElement=e)),e=`${o}fullscreenchange`,document[`on${e}`]!==void 0&&(o==="ms"&&(e="MSFullscreenChange"),Lt.fullscreenchange=e),e=`${o}fullscreenerror`,document[`on${e}`]!==void 0&&(o==="ms"&&(e="MSFullscreenError"),Lt.fullscreenerror=e)}return un},pe.requestFullscreen=function(i,t){pe.supportsFullscreen()&&i[Lt.requestFullscreen]({vrDisplay:t})},pe.exitFullscreen=function(){pe.supportsFullscreen()&&document[Lt.exitFullscreen]()},pe._names=Lt;let se;typeof navigator<"u"?se=navigator:se={};function Bn(i){const t=i.split(".");for(let e=0,n=t.length;e<n;++e)t[e]=parseInt(t[e],10);return t}let xa,Zf;function Lh(){if(!C(xa)&&(xa=!1,!Oa())){const i=/ Chrome\/([\.0-9]+)/.exec(se.userAgent);i!==null&&(xa=!0,Zf=Bn(i[1]))}return xa}function yw(){return Lh()&&Zf}let Sa,Kf;function Qf(){if(!C(Sa)&&(Sa=!1,!Lh()&&!Oa()&&/ Safari\/[\.0-9]+/.test(se.userAgent))){const i=/ Version\/([\.0-9]+)/.exec(se.userAgent);i!==null&&(Sa=!0,Kf=Bn(i[1]))}return Sa}function ww(){return Qf()&&Kf}let Ra,zh;function Jf(){if(!C(Ra)){Ra=!1;const i=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(se.userAgent);i!==null&&(Ra=!0,zh=Bn(i[1]),zh.isNightly=!!i[2])}return Ra}function vw(){return Jf()&&zh}let ko,Nh;function tg(){if(!C(ko)){ko=!1;let i;se.appName==="Microsoft Internet Explorer"?(i=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(se.userAgent),i!==null&&(ko=!0,Nh=Bn(i[1]))):se.appName==="Netscape"&&(i=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(se.userAgent),i!==null&&(ko=!0,Nh=Bn(i[1])))}return ko}function Ew(){return tg()&&Nh}let Pa,eg;function Oa(){if(!C(Pa)){Pa=!1;const i=/ Edg\/([\.0-9]+)/.exec(se.userAgent);i!==null&&(Pa=!0,eg=Bn(i[1]))}return Pa}function Cw(){return Oa()&&eg}let Ia,Uh;function Ta(){if(!C(Ia)){Ia=!1;const i=/Firefox\/([\.0-9]+)/.exec(se.userAgent);i!==null&&(Ia=!0,Uh=Bn(i[1]))}return Ia}let jh;function bw(){return C(jh)||(jh=/Windows/i.test(se.appVersion)),jh}let kh;function xw(){return C(kh)||(kh=navigator.platform==="iPhone"||navigator.platform==="iPod"||navigator.platform==="iPad"),kh}function Sw(){return Ta()&&Uh}let Wh;function Rw(){return C(Wh)||(Wh=!Ta()&&typeof PointerEvent<"u"&&(!C(se.pointerEnabled)||se.pointerEnabled)),Wh}let ig,Aa;function ng(){if(!C(Aa)){const i=document.createElement("canvas");i.setAttribute("style","image-rendering: -moz-crisp-edges;image-rendering: pixelated;");const t=i.style.imageRendering;Aa=C(t)&&t!=="",Aa&&(ig=t)}return Aa}function Pw(){return ng()?ig:void 0}function oe(){if(!oe.initialized)throw new j("You must call FeatureDetection.supportsWebP.initialize and wait for the promise to resolve before calling FeatureDetection.supportsWebP");return oe._result}oe._promise=void 0,oe._result=void 0,oe.initialize=function(){return C(oe._promise)||(oe._promise=new Promise(i=>{const t=new Image;t.onload=function(){oe._result=t.width>0&&t.height>0,i(oe._result)},t.onerror=function(){oe._result=!1,i(oe._result)},t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA"})),oe._promise},Object.defineProperties(oe,{initialized:{get:function(){return C(oe._result)}}});const Ls=[];typeof ArrayBuffer<"u"&&(Ls.push(Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array),typeof Uint8ClampedArray<"u"&&Ls.push(Uint8ClampedArray),typeof Uint8ClampedArray<"u"&&Ls.push(Uint8ClampedArray),typeof BigInt64Array<"u"&&Ls.push(BigInt64Array),typeof BigUint64Array<"u"&&Ls.push(BigUint64Array));const re={isChrome:Lh,chromeVersion:yw,isSafari:Qf,safariVersion:ww,isWebkit:Jf,webkitVersion:vw,isInternetExplorer:tg,internetExplorerVersion:Ew,isEdge:Oa,edgeVersion:Cw,isFirefox:Ta,firefoxVersion:Sw,isWindows:bw,isIPadOrIOS:xw,hardwareConcurrency:se.hardwareConcurrency??3,supportsPointerEvents:Rw,supportsImageRenderingPixelated:ng,supportsWebP:oe,imageRenderingValue:Pw,typedArrayTypes:Ls};re.supportsBasis=function(i){return re.supportsWebAssembly()&&i.context.supportsBasis},re.supportsFullscreen=function(){return pe.supportsFullscreen()},re.supportsTypedArrays=function(){return typeof ArrayBuffer<"u"},re.supportsBigInt64Array=function(){return typeof BigInt64Array<"u"},re.supportsBigUint64Array=function(){return typeof BigUint64Array<"u"},re.supportsBigInt=function(){return typeof BigInt<"u"},re.supportsWebWorkers=function(){return typeof Worker<"u"},re.supportsWebAssembly=function(){return typeof WebAssembly<"u"},re.supportsWebgl2=function(i){return p.defined("scene",i),i.context.webgl2},re.supportsEsmWebWorkers=function(){return!Ta()||parseInt(Uh)>=114};function H(i,t,e,n){this.x=i??0,this.y=t??0,this.z=e??0,this.w=n??0}let Wo=new O;H.fromAxisAngle=function(i,t,e){p.typeOf.object("axis",i),p.typeOf.number("angle",t);const n=t/2,s=Math.sin(n);Wo=O.normalize(i,Wo);const o=Wo.x*s,r=Wo.y*s,a=Wo.z*s,c=Math.cos(n);return C(e)?(e.x=o,e.y=r,e.z=a,e.w=c,e):new H(o,r,a,c)};const Ow=[1,2,0],Iw=new Array(3);H.fromRotationMatrix=function(i,t){p.typeOf.object("matrix",i);let e,n,s,o,r;const a=i[k.COLUMN0ROW0],c=i[k.COLUMN1ROW1],h=i[k.COLUMN2ROW2],l=a+c+h;if(l>0)e=Math.sqrt(l+1),r=.5*e,e=.5/e,n=(i[k.COLUMN1ROW2]-i[k.COLUMN2ROW1])*e,s=(i[k.COLUMN2ROW0]-i[k.COLUMN0ROW2])*e,o=(i[k.COLUMN0ROW1]-i[k.COLUMN1ROW0])*e;else{const u=Ow;let f=0;c>a&&(f=1),h>a&&h>c&&(f=2);const g=u[f],_=u[g];e=Math.sqrt(i[k.getElementIndex(f,f)]-i[k.getElementIndex(g,g)]-i[k.getElementIndex(_,_)]+1);const y=Iw;y[f]=.5*e,e=.5/e,r=(i[k.getElementIndex(_,g)]-i[k.getElementIndex(g,_)])*e,y[g]=(i[k.getElementIndex(g,f)]+i[k.getElementIndex(f,g)])*e,y[_]=(i[k.getElementIndex(_,f)]+i[k.getElementIndex(f,_)])*e,n=-y[0],s=-y[1],o=-y[2]}return C(t)?(t.x=n,t.y=s,t.z=o,t.w=r,t):new H(n,s,o,r)};const sg=new H;let og=new H,qh=new H,rg=new H;H.fromHeadingPitchRoll=function(i,t){return p.typeOf.object("headingPitchRoll",i),rg=H.fromAxisAngle(O.UNIT_X,i.roll,sg),qh=H.fromAxisAngle(O.UNIT_Y,-i.pitch,t),t=H.multiply(qh,rg,qh),og=H.fromAxisAngle(O.UNIT_Z,-i.heading,sg),H.multiply(og,t,t)};const Ma=new O,Gh=new O,He=new H,ag=new H,Da=new H;H.packedLength=4,H.pack=function(i,t,e){return p.typeOf.object("value",i),p.defined("array",t),e=e??0,t[e++]=i.x,t[e++]=i.y,t[e++]=i.z,t[e]=i.w,t},H.unpack=function(i,t,e){return p.defined("array",i),t=t??0,C(e)||(e=new H),e.x=i[t],e.y=i[t+1],e.z=i[t+2],e.w=i[t+3],e},H.packedInterpolationLength=3,H.convertPackedArrayForInterpolation=function(i,t,e,n){H.unpack(i,e*4,Da),H.conjugate(Da,Da);for(let s=0,o=e-t+1;s<o;s++){const r=s*3;H.unpack(i,(t+s)*4,He),H.multiply(He,Da,He),He.w<0&&H.negate(He,He),H.computeAxis(He,Ma);const a=H.computeAngle(He);C(n)||(n=[]),n[r]=Ma.x*a,n[r+1]=Ma.y*a,n[r+2]=Ma.z*a}},H.unpackInterpolationResult=function(i,t,e,n,s){C(s)||(s=new H),O.fromArray(i,0,Gh);const o=O.magnitude(Gh);return H.unpack(t,n*4,ag),o===0?H.clone(H.IDENTITY,He):H.fromAxisAngle(Gh,o,He),H.multiply(He,ag,s)},H.clone=function(i,t){if(C(i))return C(t)?(t.x=i.x,t.y=i.y,t.z=i.z,t.w=i.w,t):new H(i.x,i.y,i.z,i.w)},H.conjugate=function(i,t){return p.typeOf.object("quaternion",i),p.typeOf.object("result",t),t.x=-i.x,t.y=-i.y,t.z=-i.z,t.w=i.w,t},H.magnitudeSquared=function(i){return p.typeOf.object("quaternion",i),i.x*i.x+i.y*i.y+i.z*i.z+i.w*i.w},H.magnitude=function(i){return Math.sqrt(H.magnitudeSquared(i))},H.normalize=function(i,t){p.typeOf.object("result",t);const e=1/H.magnitude(i),n=i.x*e,s=i.y*e,o=i.z*e,r=i.w*e;return t.x=n,t.y=s,t.z=o,t.w=r,t},H.inverse=function(i,t){p.typeOf.object("result",t);const e=H.magnitudeSquared(i);return t=H.conjugate(i,t),H.multiplyByScalar(t,1/e,t)},H.add=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.x=i.x+t.x,e.y=i.y+t.y,e.z=i.z+t.z,e.w=i.w+t.w,e},H.subtract=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.x=i.x-t.x,e.y=i.y-t.y,e.z=i.z-t.z,e.w=i.w-t.w,e},H.negate=function(i,t){return p.typeOf.object("quaternion",i),p.typeOf.object("result",t),t.x=-i.x,t.y=-i.y,t.z=-i.z,t.w=-i.w,t},H.dot=function(i,t){return p.typeOf.object("left",i),p.typeOf.object("right",t),i.x*t.x+i.y*t.y+i.z*t.z+i.w*t.w},H.multiply=function(i,t,e){p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e);const n=i.x,s=i.y,o=i.z,r=i.w,a=t.x,c=t.y,h=t.z,l=t.w,u=r*a+n*l+s*h-o*c,f=r*c-n*h+s*l+o*a,g=r*h+n*c-s*a+o*l,_=r*l-n*a-s*c-o*h;return e.x=u,e.y=f,e.z=g,e.w=_,e},H.multiplyByScalar=function(i,t,e){return p.typeOf.object("quaternion",i),p.typeOf.number("scalar",t),p.typeOf.object("result",e),e.x=i.x*t,e.y=i.y*t,e.z=i.z*t,e.w=i.w*t,e},H.divideByScalar=function(i,t,e){return p.typeOf.object("quaternion",i),p.typeOf.number("scalar",t),p.typeOf.object("result",e),e.x=i.x/t,e.y=i.y/t,e.z=i.z/t,e.w=i.w/t,e},H.computeAxis=function(i,t){p.typeOf.object("quaternion",i),p.typeOf.object("result",t);const e=i.w;if(Math.abs(e-1)<T.EPSILON6||Math.abs(e+1)<T.EPSILON6)return t.x=1,t.y=t.z=0,t;const n=1/Math.sqrt(1-e*e);return t.x=i.x*n,t.y=i.y*n,t.z=i.z*n,t},H.computeAngle=function(i){return p.typeOf.object("quaternion",i),Math.abs(i.w-1)<T.EPSILON6?0:2*Math.acos(i.w)};let Vh=new H;H.lerp=function(i,t,e,n){return p.typeOf.object("start",i),p.typeOf.object("end",t),p.typeOf.number("t",e),p.typeOf.object("result",n),Vh=H.multiplyByScalar(t,e,Vh),n=H.multiplyByScalar(i,1-e,n),H.add(Vh,n,n)};let cg=new H,Bh=new H,Yh=new H;H.slerp=function(i,t,e,n){p.typeOf.object("start",i),p.typeOf.object("end",t),p.typeOf.number("t",e),p.typeOf.object("result",n);let s=H.dot(i,t),o=t;if(s<0&&(s=-s,o=cg=H.negate(t,cg)),1-s<T.EPSILON6)return H.lerp(i,o,e,n);const r=Math.acos(s);return Bh=H.multiplyByScalar(i,Math.sin((1-e)*r),Bh),Yh=H.multiplyByScalar(o,Math.sin(e*r),Yh),n=H.add(Bh,Yh,n),H.multiplyByScalar(n,1/Math.sin(r),n)},H.log=function(i,t){p.typeOf.object("quaternion",i),p.typeOf.object("result",t);const e=T.acosClamped(i.w);let n=0;return e!==0&&(n=e/Math.sin(e)),O.multiplyByScalar(i,n,t)},H.exp=function(i,t){p.typeOf.object("cartesian",i),p.typeOf.object("result",t);const e=O.magnitude(i);let n=0;return e!==0&&(n=Math.sin(e)/e),t.x=i.x*n,t.y=i.y*n,t.z=i.z*n,t.w=Math.cos(e),t};const Tw=new O,Aw=new O,qo=new H,zs=new H;H.computeInnerQuadrangle=function(i,t,e,n){p.typeOf.object("q0",i),p.typeOf.object("q1",t),p.typeOf.object("q2",e),p.typeOf.object("result",n);const s=H.conjugate(t,qo);H.multiply(s,e,zs);const o=H.log(zs,Tw);H.multiply(s,i,zs);const r=H.log(zs,Aw);return O.add(o,r,o),O.multiplyByScalar(o,.25,o),O.negate(o,o),H.exp(o,qo),H.multiply(t,qo,n)},H.squad=function(i,t,e,n,s,o){p.typeOf.object("q0",i),p.typeOf.object("q1",t),p.typeOf.object("s0",e),p.typeOf.object("s1",n),p.typeOf.number("t",s),p.typeOf.object("result",o);const r=H.slerp(i,t,s,qo),a=H.slerp(e,n,s,zs);return H.slerp(r,a,2*s*(1-s),o)};const Mw=new H,hg=1.9011074535173003,Fa=re.supportsTypedArrays()?new Float32Array(8):[],La=re.supportsTypedArrays()?new Float32Array(8):[],Oi=re.supportsTypedArrays()?new Float32Array(8):[],Ii=re.supportsTypedArrays()?new Float32Array(8):[];for(let i=0;i<7;++i){const t=i+1,e=2*t+1;Fa[i]=1/(t*e),La[i]=t/e}Fa[7]=hg/136,La[7]=hg*8/17,H.fastSlerp=function(i,t,e,n){p.typeOf.object("start",i),p.typeOf.object("end",t),p.typeOf.number("t",e),p.typeOf.object("result",n);let s=H.dot(i,t),o;s>=0?o=1:(o=-1,s=-s);const r=s-1,a=1-e,c=e*e,h=a*a;for(let g=7;g>=0;--g)Oi[g]=(Fa[g]*c-La[g])*r,Ii[g]=(Fa[g]*h-La[g])*r;const l=o*e*(1+Oi[0]*(1+Oi[1]*(1+Oi[2]*(1+Oi[3]*(1+Oi[4]*(1+Oi[5]*(1+Oi[6]*(1+Oi[7])))))))),u=a*(1+Ii[0]*(1+Ii[1]*(1+Ii[2]*(1+Ii[3]*(1+Ii[4]*(1+Ii[5]*(1+Ii[6]*(1+Ii[7])))))))),f=H.multiplyByScalar(i,u,Mw);return H.multiplyByScalar(t,l,n),H.add(f,n,n)},H.fastSquad=function(i,t,e,n,s,o){p.typeOf.object("q0",i),p.typeOf.object("q1",t),p.typeOf.object("s0",e),p.typeOf.object("s1",n),p.typeOf.number("t",s),p.typeOf.object("result",o);const r=H.fastSlerp(i,t,s,qo),a=H.fastSlerp(e,n,s,zs);return H.fastSlerp(r,a,2*s*(1-s),o)},H.equals=function(i,t){return i===t||C(i)&&C(t)&&i.x===t.x&&i.y===t.y&&i.z===t.z&&i.w===t.w},H.equalsEpsilon=function(i,t,e){return e=e??0,i===t||C(i)&&C(t)&&Math.abs(i.x-t.x)<=e&&Math.abs(i.y-t.y)<=e&&Math.abs(i.z-t.z)<=e&&Math.abs(i.w-t.w)<=e},H.ZERO=Object.freeze(new H(0,0,0,0)),H.IDENTITY=Object.freeze(new H(0,0,0,1)),H.prototype.clone=function(i){return H.clone(this,i)},H.prototype.equals=function(i){return H.equals(this,i)},H.prototype.equalsEpsilon=function(i,t){return H.equalsEpsilon(this,i,t)},H.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z}, ${this.w})`};const ut={},Hh={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},Ns={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},Xh={},me={east:new O,north:new O,up:new O,west:new O,south:new O,down:new O};let dn=new O,fn=new O,gn=new O;ut.localFrameToFixedFrameGenerator=function(i,t){if(!Hh.hasOwnProperty(i)||!Hh[i].hasOwnProperty(t))throw new j("firstAxis and secondAxis must be east, north, up, west, south or down.");const e=Hh[i][t];let n;const s=i+t;return C(Xh[s])?n=Xh[s]:(n=function(o,r,a){if(!C(o))throw new j("origin is required.");if(isNaN(o.x)||isNaN(o.y)||isNaN(o.z))throw new j("origin has a NaN component");if(C(a)||(a=new U),O.equalsEpsilon(o,O.ZERO,T.EPSILON14))O.unpack(Ns[i],0,dn),O.unpack(Ns[t],0,fn),O.unpack(Ns[e],0,gn);else if(T.equalsEpsilon(o.x,0,T.EPSILON14)&&T.equalsEpsilon(o.y,0,T.EPSILON14)){const c=T.sign(o.z);O.unpack(Ns[i],0,dn),i!=="east"&&i!=="west"&&O.multiplyByScalar(dn,c,dn),O.unpack(Ns[t],0,fn),t!=="east"&&t!=="west"&&O.multiplyByScalar(fn,c,fn),O.unpack(Ns[e],0,gn),e!=="east"&&e!=="west"&&O.multiplyByScalar(gn,c,gn)}else{r=r??ct.default,r.geodeticSurfaceNormal(o,me.up);const c=me.up,h=me.east;h.x=-o.y,h.y=o.x,h.z=0,O.normalize(h,me.east),O.cross(c,h,me.north),O.multiplyByScalar(me.up,-1,me.down),O.multiplyByScalar(me.east,-1,me.west),O.multiplyByScalar(me.north,-1,me.south),dn=me[i],fn=me[t],gn=me[e]}return a[0]=dn.x,a[1]=dn.y,a[2]=dn.z,a[3]=0,a[4]=fn.x,a[5]=fn.y,a[6]=fn.z,a[7]=0,a[8]=gn.x,a[9]=gn.y,a[10]=gn.z,a[11]=0,a[12]=o.x,a[13]=o.y,a[14]=o.z,a[15]=1,a},Xh[s]=n),n},ut.eastNorthUpToFixedFrame=ut.localFrameToFixedFrameGenerator("east","north"),ut.northEastDownToFixedFrame=ut.localFrameToFixedFrameGenerator("north","east"),ut.northUpEastToFixedFrame=ut.localFrameToFixedFrameGenerator("north","up"),ut.northWestUpToFixedFrame=ut.localFrameToFixedFrameGenerator("north","west");const Dw=new H,Fw=new O(1,1,1),Lw=new U;ut.headingPitchRollToFixedFrame=function(i,t,e,n,s){p.typeOf.object("HeadingPitchRoll",t),n=n??ut.eastNorthUpToFixedFrame;const o=H.fromHeadingPitchRoll(t,Dw),r=U.fromTranslationQuaternionRotationScale(O.ZERO,o,Fw,Lw);return s=n(i,e,s),U.multiply(s,r,s)};const zw=new U,Nw=new k;ut.headingPitchRollQuaternion=function(i,t,e,n,s){p.typeOf.object("HeadingPitchRoll",t);const o=ut.headingPitchRollToFixedFrame(i,t,e,n,zw),r=U.getMatrix3(o,Nw);return H.fromRotationMatrix(r,s)};const Uw=new O(1,1,1),jw=new O,lg=new U,kw=new U,Ww=new k,qw=new H;ut.fixedFrameToHeadingPitchRoll=function(i,t,e,n){p.defined("transform",i),t=t??ct.default,e=e??ut.eastNorthUpToFixedFrame,C(n)||(n=new Yt);const s=U.getTranslation(i,jw);if(O.equals(s,O.ZERO))return n.heading=0,n.pitch=0,n.roll=0,n;let o=U.inverseTransformation(e(s,t,lg),lg),r=U.setScale(i,Uw,kw);r=U.setTranslation(r,O.ZERO,r),o=U.multiply(o,r,o);let a=H.fromRotationMatrix(U.getMatrix3(o,Ww),qw);return a=H.normalize(a,a),Yt.fromQuaternion(a,n)};const Gw=6*3600+41*60+50.54841,Vw=8640184812866e-6,Bw=.093104,Yw=-62e-7,Hw=11772758384668e-32,Xw=72921158553e-15,$w=T.TWO_PI/86400;let za=new $;ut.computeIcrfToCentralBodyFixedMatrix=function(i,t){let e=ut.computeIcrfToFixedMatrix(i,t);return C(e)||(e=ut.computeTemeToPseudoFixedMatrix(i,t)),e},ut.computeTemeToPseudoFixedMatrix=function(i,t){if(!C(i))throw new j("date is required.");za=$.addSeconds(i,-$.computeTaiMinusUtc(i),za);const e=za.dayNumber,n=za.secondsOfDay;let s;const o=e-2451545;n>=43200?s=(o+.5)/Dt.DAYS_PER_JULIAN_CENTURY:s=(o-.5)/Dt.DAYS_PER_JULIAN_CENTURY;const a=(Gw+s*(Vw+s*(Bw+s*Yw)))*$w%T.TWO_PI,c=Xw+Hw*(e-24515455e-1),h=(n+Dt.SECONDS_PER_DAY*.5)%Dt.SECONDS_PER_DAY,l=a+c*h,u=Math.cos(l),f=Math.sin(l);return C(t)?(t[0]=u,t[1]=-f,t[2]=0,t[3]=f,t[4]=u,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new k(u,f,0,-f,u,0,0,0,1)},ut.iau2006XysData=new Mh,ut.earthOrientationParameters=Uo.NONE;const $h=32.184,Zw=2451545;ut.preloadIcrfFixed=function(i){const t=i.start.dayNumber,e=i.start.secondsOfDay+$h,n=i.stop.dayNumber,s=i.stop.secondsOfDay+$h;return ut.iau2006XysData.preload(t,e,n,s)},ut.computeIcrfToFixedMatrix=function(i,t){if(!C(i))throw new j("date is required.");C(t)||(t=new k);const e=ut.computeFixedToIcrfMatrix(i,t);if(C(e))return k.transpose(e,t)};const Kw=32.184,Qw=2451545,Na=new Yt,Jw=new k,t1=new $;ut.computeMoonFixedToIcrfMatrix=function(i,t){if(!C(i))throw new j("date is required.");const e=$.addSeconds(i,Kw,t1),n=$.totalDays(e)-Qw,s=T.toRadians(12.112)-T.toRadians(.052992)*n,o=T.toRadians(24.224)-T.toRadians(.105984)*n,r=T.toRadians(227.645)+T.toRadians(13.012)*n,a=T.toRadians(261.105)+T.toRadians(13.340716)*n,c=T.toRadians(358)+T.toRadians(.9856)*n;return Na.pitch=T.toRadians(180)-T.toRadians(3.878)*Math.sin(s)-T.toRadians(.12)*Math.sin(o)+T.toRadians(.07)*Math.sin(r)-T.toRadians(.017)*Math.sin(a),Na.roll=T.toRadians(-23.47)+T.toRadians(1.543)*Math.cos(s)+T.toRadians(.24)*Math.cos(o)-T.toRadians(.028)*Math.cos(r)+T.toRadians(.007)*Math.cos(a),Na.heading=T.toRadians(154.375)+T.toRadians(13.17635831)*n+T.toRadians(3.558)*Math.sin(s)+T.toRadians(.121)*Math.sin(o)-T.toRadians(.064)*Math.sin(r)+T.toRadians(.016)*Math.sin(a)+T.toRadians(.025)*Math.sin(c),k.fromHeadingPitchRoll(Na,Jw)},ut.computeIcrfToMoonFixedMatrix=function(i,t){if(!C(i))throw new j("date is required.");C(t)||(t=new k);const e=ut.computeMoonFixedToIcrfMatrix(i,t);if(C(e))return k.transpose(e,t)};const e1=new $f(0,0,0),i1=new Eh(0,0,0,0,0),Zh=new k,Kh=new k;ut.computeFixedToIcrfMatrix=function(i,t){if(!C(i))throw new j("date is required.");C(t)||(t=new k);const e=ut.earthOrientationParameters.compute(i,i1);if(!C(e))return;const n=i.dayNumber,s=i.secondsOfDay+$h,o=ut.iau2006XysData.computeXysRadians(n,s,e1);if(!C(o))return;const r=o.x+e.xPoleOffset,a=o.y+e.yPoleOffset,c=1/(1+Math.sqrt(1-r*r-a*a)),h=Zh;h[0]=1-c*r*r,h[3]=-c*r*a,h[6]=r,h[1]=-c*r*a,h[4]=1-c*a*a,h[7]=a,h[2]=-r,h[5]=-a,h[8]=1-c*(r*r+a*a);const l=k.fromRotationZ(-o.s,Kh),u=k.multiply(h,l,Zh),f=i.dayNumber,g=i.secondsOfDay-$.computeTaiMinusUtc(i)+e.ut1MinusUtc,_=f-2451545,y=g/Dt.SECONDS_PER_DAY;let w=.779057273264+y+.00273781191135448*(_+y);w=w%1*T.TWO_PI;const E=k.fromRotationZ(w,Kh),b=k.multiply(u,E,Zh),P=Math.cos(e.xPoleWander),I=Math.cos(e.yPoleWander),M=Math.sin(e.xPoleWander),D=Math.sin(e.yPoleWander);let L=n-Zw+s/Dt.SECONDS_PER_DAY;L/=36525;const z=-47e-6*L*T.RADIANS_PER_DEGREE/3600,q=Math.cos(z),Y=Math.sin(z),X=Kh;return X[0]=P*q,X[1]=P*Y,X[2]=M,X[3]=-I*Y+D*M*q,X[4]=I*q+D*M*Y,X[5]=-D*P,X[6]=-D*Y-I*M*q,X[7]=D*q-I*M*Y,X[8]=I*P,k.multiply(b,X,t)};const n1=new K;ut.pointToWindowCoordinates=function(i,t,e,n){return n=ut.pointToGLWindowCoordinates(i,t,e,n),n.y=2*t[5]-n.y,n},ut.pointToGLWindowCoordinates=function(i,t,e,n){if(!C(i))throw new j("modelViewProjectionMatrix is required.");if(!C(t))throw new j("viewportTransformation is required.");if(!C(e))throw new j("point is required.");C(n)||(n=new tt);const s=n1;return U.multiplyByVector(i,K.fromElements(e.x,e.y,e.z,1,s),s),K.multiplyByScalar(s,1/s.w,s),U.multiplyByVector(t,s,s),tt.fromCartesian4(s,n)};const s1=new O,o1=new O,r1=new O;ut.rotationMatrixFromPositionVelocity=function(i,t,e,n){if(!C(i))throw new j("position is required.");if(!C(t))throw new j("velocity is required.");const s=(e??ct.default).geodeticSurfaceNormal(i,s1);let o=O.cross(t,s,o1);O.equalsEpsilon(o,O.ZERO,T.EPSILON6)&&(o=O.clone(O.UNIT_X,o));const r=O.cross(o,t,r1);return O.normalize(r,r),O.cross(t,r,o),O.negate(o,o),O.normalize(o,o),C(n)||(n=new k),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=o.x,n[4]=o.y,n[5]=o.z,n[6]=r.x,n[7]=r.y,n[8]=r.z,n};const ug=new U(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1),dg=new lt,Qh=new O,a1=new O,c1=new k,Jh=new U,fg=new U;ut.basisTo2D=function(i,t,e){if(!C(i))throw new j("projection is required.");if(!C(t))throw new j("matrix is required.");if(!C(e))throw new j("result is required.");const n=U.getTranslation(t,a1),s=i.ellipsoid;let o;if(O.equals(n,O.ZERO))o=O.clone(O.ZERO,Qh);else{const l=s.cartesianToCartographic(n,dg);o=i.project(l,Qh),O.fromElements(o.z,o.x,o.y,o)}const r=ut.eastNorthUpToFixedFrame(n,s,Jh),a=U.inverseTransformation(r,fg),c=U.getMatrix3(t,c1),h=U.multiplyByMatrix3(a,c,e);return U.multiply(ug,h,e),U.setTranslation(e,o,e),e},ut.ellipsoidTo2DModelMatrix=function(i,t,e){if(!C(i))throw new j("projection is required.");if(!C(t))throw new j("center is required.");if(!C(e))throw new j("result is required.");const n=i.ellipsoid,s=ut.eastNorthUpToFixedFrame(t,n,Jh),o=U.inverseTransformation(s,fg),r=n.cartesianToCartographic(t,dg),a=i.project(r,Qh);O.fromElements(a.z,a.x,a.y,a);const c=U.fromTranslation(a,Jh);return U.multiply(ug,o,e),U.multiply(c,e,e),e};function nt(i,t,e,n){this.west=i??0,this.south=t??0,this.east=e??0,this.north=n??0}Object.defineProperties(nt.prototype,{width:{get:function(){return nt.computeWidth(this)}},height:{get:function(){return nt.computeHeight(this)}}}),nt.packedLength=4,nt.pack=function(i,t,e){return p.typeOf.object("value",i),p.defined("array",t),e=e??0,t[e++]=i.west,t[e++]=i.south,t[e++]=i.east,t[e]=i.north,t},nt.unpack=function(i,t,e){return p.defined("array",i),t=t??0,C(e)||(e=new nt),e.west=i[t++],e.south=i[t++],e.east=i[t++],e.north=i[t],e},nt.computeWidth=function(i){p.typeOf.object("rectangle",i);let t=i.east;const e=i.west;return t<e&&(t+=T.TWO_PI),t-e},nt.computeHeight=function(i){return p.typeOf.object("rectangle",i),i.north-i.south},nt.fromDegrees=function(i,t,e,n,s){return i=T.toRadians(i??0),t=T.toRadians(t??0),e=T.toRadians(e??0),n=T.toRadians(n??0),C(s)?(s.west=i,s.south=t,s.east=e,s.north=n,s):new nt(i,t,e,n)},nt.fromRadians=function(i,t,e,n,s){return C(s)?(s.west=i??0,s.south=t??0,s.east=e??0,s.north=n??0,s):new nt(i,t,e,n)},nt.fromCartographicArray=function(i,t){p.defined("cartographics",i);let e=Number.MAX_VALUE,n=-Number.MAX_VALUE,s=Number.MAX_VALUE,o=-Number.MAX_VALUE,r=Number.MAX_VALUE,a=-Number.MAX_VALUE;for(let c=0,h=i.length;c<h;c++){const l=i[c];e=Math.min(e,l.longitude),n=Math.max(n,l.longitude),r=Math.min(r,l.latitude),a=Math.max(a,l.latitude);const u=l.longitude>=0?l.longitude:l.longitude+T.TWO_PI;s=Math.min(s,u),o=Math.max(o,u)}return n-e>o-s&&(e=s,n=o,n>T.PI&&(n=n-T.TWO_PI),e>T.PI&&(e=e-T.TWO_PI)),C(t)?(t.west=e,t.south=r,t.east=n,t.north=a,t):new nt(e,r,n,a)},nt.fromCartesianArray=function(i,t,e){p.defined("cartesians",i),t=t??ct.default;let n=Number.MAX_VALUE,s=-Number.MAX_VALUE,o=Number.MAX_VALUE,r=-Number.MAX_VALUE,a=Number.MAX_VALUE,c=-Number.MAX_VALUE;for(let h=0,l=i.length;h<l;h++){const u=t.cartesianToCartographic(i[h]);n=Math.min(n,u.longitude),s=Math.max(s,u.longitude),a=Math.min(a,u.latitude),c=Math.max(c,u.latitude);const f=u.longitude>=0?u.longitude:u.longitude+T.TWO_PI;o=Math.min(o,f),r=Math.max(r,f)}return s-n>r-o&&(n=o,s=r,s>T.PI&&(s=s-T.TWO_PI),n>T.PI&&(n=n-T.TWO_PI)),C(e)?(e.west=n,e.south=a,e.east=s,e.north=c,e):new nt(n,a,s,c)};const h1=new O,l1=new O,u1=new O,d1=new O,f1=new O,tl=new Array(5);for(let i=0;i<tl.length;++i)tl[i]=new O;nt.fromBoundingSphere=function(i,t,e){p.typeOf.object("boundingSphere",i);const n=i.center,s=i.radius;if(C(t)||(t=ct.default),C(e)||(e=new nt),O.equals(n,O.ZERO))return nt.clone(nt.MAX_VALUE,e),e;const o=ut.eastNorthUpToFixedFrame(n,t,h1),r=U.multiplyByPointAsVector(o,O.UNIT_X,l1);O.normalize(r,r);const a=U.multiplyByPointAsVector(o,O.UNIT_Y,u1);O.normalize(a,a),O.multiplyByScalar(a,s,a),O.multiplyByScalar(r,s,r);const c=O.negate(a,f1),h=O.negate(r,d1),l=tl;let u=l[0];return O.add(n,a,u),u=l[1],O.add(n,h,u),u=l[2],O.add(n,c,u),u=l[3],O.add(n,r,u),l[4]=n,nt.fromCartesianArray(l,t,e)},nt.clone=function(i,t){if(C(i))return C(t)?(t.west=i.west,t.south=i.south,t.east=i.east,t.north=i.north,t):new nt(i.west,i.south,i.east,i.north)},nt.equalsEpsilon=function(i,t,e){return e=e??0,i===t||C(i)&&C(t)&&Math.abs(i.west-t.west)<=e&&Math.abs(i.south-t.south)<=e&&Math.abs(i.east-t.east)<=e&&Math.abs(i.north-t.north)<=e},nt.prototype.clone=function(i){return nt.clone(this,i)},nt.prototype.equals=function(i){return nt.equals(this,i)},nt.equals=function(i,t){return i===t||C(i)&&C(t)&&i.west===t.west&&i.south===t.south&&i.east===t.east&&i.north===t.north},nt.prototype.equalsEpsilon=function(i,t){return nt.equalsEpsilon(this,i,t)},nt._validate=function(i){p.typeOf.object("rectangle",i);const t=i.north;p.typeOf.number.greaterThanOrEquals("north",t,-T.PI_OVER_TWO),p.typeOf.number.lessThanOrEquals("north",t,T.PI_OVER_TWO);const e=i.south;p.typeOf.number.greaterThanOrEquals("south",e,-T.PI_OVER_TWO),p.typeOf.number.lessThanOrEquals("south",e,T.PI_OVER_TWO);const n=i.west;p.typeOf.number.greaterThanOrEquals("west",n,-Math.PI),p.typeOf.number.lessThanOrEquals("west",n,Math.PI);const s=i.east;p.typeOf.number.greaterThanOrEquals("east",s,-Math.PI),p.typeOf.number.lessThanOrEquals("east",s,Math.PI)},nt.southwest=function(i,t){return p.typeOf.object("rectangle",i),C(t)?(t.longitude=i.west,t.latitude=i.south,t.height=0,t):new lt(i.west,i.south)},nt.northwest=function(i,t){return p.typeOf.object("rectangle",i),C(t)?(t.longitude=i.west,t.latitude=i.north,t.height=0,t):new lt(i.west,i.north)},nt.northeast=function(i,t){return p.typeOf.object("rectangle",i),C(t)?(t.longitude=i.east,t.latitude=i.north,t.height=0,t):new lt(i.east,i.north)},nt.southeast=function(i,t){return p.typeOf.object("rectangle",i),C(t)?(t.longitude=i.east,t.latitude=i.south,t.height=0,t):new lt(i.east,i.south)},nt.center=function(i,t){p.typeOf.object("rectangle",i);let e=i.east;const n=i.west;e<n&&(e+=T.TWO_PI);const s=T.negativePiToPi((n+e)*.5),o=(i.south+i.north)*.5;return C(t)?(t.longitude=s,t.latitude=o,t.height=0,t):new lt(s,o)},nt.intersection=function(i,t,e){p.typeOf.object("rectangle",i),p.typeOf.object("otherRectangle",t);let n=i.east,s=i.west,o=t.east,r=t.west;n<s&&o>0?n+=T.TWO_PI:o<r&&n>0&&(o+=T.TWO_PI),n<s&&r<0?r+=T.TWO_PI:o<r&&s<0&&(s+=T.TWO_PI);const a=T.negativePiToPi(Math.max(s,r)),c=T.negativePiToPi(Math.min(n,o));if((i.west<i.east||t.west<t.east)&&c<=a)return;const h=Math.max(i.south,t.south),l=Math.min(i.north,t.north);if(!(h>=l))return C(e)?(e.west=a,e.south=h,e.east=c,e.north=l,e):new nt(a,h,c,l)},nt.simpleIntersection=function(i,t,e){p.typeOf.object("rectangle",i),p.typeOf.object("otherRectangle",t);const n=Math.max(i.west,t.west),s=Math.max(i.south,t.south),o=Math.min(i.east,t.east),r=Math.min(i.north,t.north);if(!(s>=r||n>=o))return C(e)?(e.west=n,e.south=s,e.east=o,e.north=r,e):new nt(n,s,o,r)},nt.union=function(i,t,e){p.typeOf.object("rectangle",i),p.typeOf.object("otherRectangle",t),C(e)||(e=new nt);let n=i.east,s=i.west,o=t.east,r=t.west;n<s&&o>0?n+=T.TWO_PI:o<r&&n>0&&(o+=T.TWO_PI),n<s&&r<0?r+=T.TWO_PI:o<r&&s<0&&(s+=T.TWO_PI);const a=T.negativePiToPi(Math.min(s,r)),c=T.negativePiToPi(Math.max(n,o));return e.west=a,e.south=Math.min(i.south,t.south),e.east=c,e.north=Math.max(i.north,t.north),e},nt.expand=function(i,t,e){return p.typeOf.object("rectangle",i),p.typeOf.object("cartographic",t),C(e)||(e=new nt),e.west=Math.min(i.west,t.longitude),e.south=Math.min(i.south,t.latitude),e.east=Math.max(i.east,t.longitude),e.north=Math.max(i.north,t.latitude),e},nt.contains=function(i,t){p.typeOf.object("rectangle",i),p.typeOf.object("cartographic",t);let e=t.longitude;const n=t.latitude,s=i.west;let o=i.east;return o<s&&(o+=T.TWO_PI,e<0&&(e+=T.TWO_PI)),(e>s||T.equalsEpsilon(e,s,T.EPSILON14))&&(e<o||T.equalsEpsilon(e,o,T.EPSILON14))&&n>=i.south&&n<=i.north};const g1=new lt;nt.subsample=function(i,t,e,n){p.typeOf.object("rectangle",i),t=t??ct.default,e=e??0,C(n)||(n=[]);let s=0;const o=i.north,r=i.south,a=i.east,c=i.west,h=g1;h.height=e,h.longitude=c,h.latitude=o,n[s]=t.cartographicToCartesian(h,n[s]),s++,h.longitude=a,n[s]=t.cartographicToCartesian(h,n[s]),s++,h.latitude=r,n[s]=t.cartographicToCartesian(h,n[s]),s++,h.longitude=c,n[s]=t.cartographicToCartesian(h,n[s]),s++,o<0?h.latitude=o:r>0?h.latitude=r:h.latitude=0;for(let l=1;l<8;++l)h.longitude=-Math.PI+l*T.PI_OVER_TWO,nt.contains(i,h)&&(n[s]=t.cartographicToCartesian(h,n[s]),s++);return h.latitude===0&&(h.longitude=c,n[s]=t.cartographicToCartesian(h,n[s]),s++,h.longitude=a,n[s]=t.cartographicToCartesian(h,n[s]),s++),n.length=s,n},nt.subsection=function(i,t,e,n,s,o){if(p.typeOf.object("rectangle",i),p.typeOf.number.greaterThanOrEquals("westLerp",t,0),p.typeOf.number.lessThanOrEquals("westLerp",t,1),p.typeOf.number.greaterThanOrEquals("southLerp",e,0),p.typeOf.number.lessThanOrEquals("southLerp",e,1),p.typeOf.number.greaterThanOrEquals("eastLerp",n,0),p.typeOf.number.lessThanOrEquals("eastLerp",n,1),p.typeOf.number.greaterThanOrEquals("northLerp",s,0),p.typeOf.number.lessThanOrEquals("northLerp",s,1),p.typeOf.number.lessThanOrEquals("westLerp",t,n),p.typeOf.number.lessThanOrEquals("southLerp",e,s),C(o)||(o=new nt),i.west<=i.east){const a=i.east-i.west;o.west=i.west+t*a,o.east=i.west+n*a}else{const a=T.TWO_PI+i.east-i.west;o.west=T.negativePiToPi(i.west+t*a),o.east=T.negativePiToPi(i.west+n*a)}const r=i.north-i.south;return o.south=i.south+e*r,o.north=i.south+s*r,t===1&&(o.west=i.east),n===1&&(o.east=i.east),e===1&&(o.south=i.north),s===1&&(o.north=i.north),o},nt.MAX_VALUE=Object.freeze(new nt(-Math.PI,-T.PI_OVER_TWO,Math.PI,T.PI_OVER_TWO));function el(i,t,e){return e<0&&(e+=1),e>1&&(e-=1),e*6<1?i+(t-i)*6*e:e*2<1?t:e*3<2?i+(t-i)*(.6666666666666666-e)*6:i}function x(i,t,e,n){this.red=i??1,this.green=t??1,this.blue=e??1,this.alpha=n??1}x.fromCartesian4=function(i,t){return p.typeOf.object("cartesian",i),C(t)?(t.red=i.x,t.green=i.y,t.blue=i.z,t.alpha=i.w,t):new x(i.x,i.y,i.z,i.w)},x.fromBytes=function(i,t,e,n,s){return i=x.byteToFloat(i??255),t=x.byteToFloat(t??255),e=x.byteToFloat(e??255),n=x.byteToFloat(n??255),C(s)?(s.red=i,s.green=t,s.blue=e,s.alpha=n,s):new x(i,t,e,n)},x.fromAlpha=function(i,t,e){return p.typeOf.object("color",i),p.typeOf.number("alpha",t),C(e)?(e.red=i.red,e.green=i.green,e.blue=i.blue,e.alpha=t,e):new x(i.red,i.green,i.blue,t)};let il,nl,Ti;re.supportsTypedArrays()&&(il=new ArrayBuffer(4),nl=new Uint32Array(il),Ti=new Uint8Array(il)),x.fromRgba=function(i,t){return nl[0]=i,x.fromBytes(Ti[0],Ti[1],Ti[2],Ti[3],t)},x.fromHsl=function(i,t,e,n,s){i=(i??0)%1,t=t??0,e=e??0,n=n??1;let o=e,r=e,a=e;if(t!==0){let c;e<.5?c=e*(1+t):c=e+t-e*t;const h=2*e-c;o=el(h,c,i+.3333333333333333),r=el(h,c,i),a=el(h,c,i-.3333333333333333)}return C(s)?(s.red=o,s.green=r,s.blue=a,s.alpha=n,s):new x(o,r,a,n)},x.fromRandom=function(i,t){i=i??ri.EMPTY_OBJECT;let e=i.red;if(!C(e)){const r=i.minimumRed??0,a=i.maximumRed??1;p.typeOf.number.lessThanOrEquals("minimumRed",r,a),e=r+T.nextRandomNumber()*(a-r)}let n=i.green;if(!C(n)){const r=i.minimumGreen??0,a=i.maximumGreen??1;p.typeOf.number.lessThanOrEquals("minimumGreen",r,a),n=r+T.nextRandomNumber()*(a-r)}let s=i.blue;if(!C(s)){const r=i.minimumBlue??0,a=i.maximumBlue??1;p.typeOf.number.lessThanOrEquals("minimumBlue",r,a),s=r+T.nextRandomNumber()*(a-r)}let o=i.alpha;if(!C(o)){const r=i.minimumAlpha??0,a=i.maximumAlpha??1;p.typeOf.number.lessThanOrEquals("minimumAlpha",r,a),o=r+T.nextRandomNumber()*(a-r)}return C(t)?(t.red=e,t.green=n,t.blue=s,t.alpha=o,t):new x(e,n,s,o)};const p1=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,m1=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,_1=/^rgba?\s*\(\s*([0-9.]+%?)\s*[,\s]+\s*([0-9.]+%?)\s*[,\s]+\s*([0-9.]+%?)(?:\s*[,\s/]+\s*([0-9.]+))?\s*\)$/i,y1=/^hsla?\s*\(\s*([0-9.]+)\s*[,\s]+\s*([0-9.]+%)\s*[,\s]+\s*([0-9.]+%)(?:\s*[,\s/]+\s*([0-9.]+))?\s*\)$/i;x.fromCssColorString=function(i,t){p.typeOf.string("color",i),C(t)||(t=new x),i=i.trim();const e=x[i.toUpperCase()];if(C(e))return x.clone(e,t),t;let n=p1.exec(i);return n!==null?(t.red=parseInt(n[1],16)/15,t.green=parseInt(n[2],16)/15,t.blue=parseInt(n[3],16)/15,t.alpha=parseInt(n[4]??"f",16)/15,t):(n=m1.exec(i),n!==null?(t.red=parseInt(n[1],16)/255,t.green=parseInt(n[2],16)/255,t.blue=parseInt(n[3],16)/255,t.alpha=parseInt(n[4]??"ff",16)/255,t):(n=_1.exec(i),n!==null?(t.red=parseFloat(n[1])/(n[1].substr(-1)==="%"?100:255),t.green=parseFloat(n[2])/(n[2].substr(-1)==="%"?100:255),t.blue=parseFloat(n[3])/(n[3].substr(-1)==="%"?100:255),t.alpha=parseFloat(n[4]??"1.0"),t):(n=y1.exec(i),n!==null?x.fromHsl(parseFloat(n[1])/360,parseFloat(n[2])/100,parseFloat(n[3])/100,parseFloat(n[4]??"1.0"),t):(t=void 0,t))))},x.packedLength=4,x.pack=function(i,t,e){return p.typeOf.object("value",i),p.defined("array",t),e=e??0,t[e++]=i.red,t[e++]=i.green,t[e++]=i.blue,t[e]=i.alpha,t},x.unpack=function(i,t,e){return p.defined("array",i),t=t??0,C(e)||(e=new x),e.red=i[t++],e.green=i[t++],e.blue=i[t++],e.alpha=i[t],e},x.byteToFloat=function(i){return i/255},x.floatToByte=function(i){return i===1?255:i*256|0},x.clone=function(i,t){if(C(i))return C(t)?(t.red=i.red,t.green=i.green,t.blue=i.blue,t.alpha=i.alpha,t):new x(i.red,i.green,i.blue,i.alpha)},x.equals=function(i,t){return i===t||C(i)&&C(t)&&i.red===t.red&&i.green===t.green&&i.blue===t.blue&&i.alpha===t.alpha},x.equalsArray=function(i,t,e){return i.red===t[e]&&i.green===t[e+1]&&i.blue===t[e+2]&&i.alpha===t[e+3]},x.prototype.clone=function(i){return x.clone(this,i)},x.prototype.equals=function(i){return x.equals(this,i)},x.prototype.equalsEpsilon=function(i,t){return this===i||C(i)&&Math.abs(this.red-i.red)<=t&&Math.abs(this.green-i.green)<=t&&Math.abs(this.blue-i.blue)<=t&&Math.abs(this.alpha-i.alpha)<=t},x.prototype.toString=function(){return`(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`},x.prototype.toCssColorString=function(){const i=x.floatToByte(this.red),t=x.floatToByte(this.green),e=x.floatToByte(this.blue);return this.alpha===1?`rgb(${i},${t},${e})`:`rgba(${i},${t},${e},${this.alpha})`},x.prototype.toCssHexString=function(){let i=x.floatToByte(this.red).toString(16);i.length<2&&(i=`0${i}`);let t=x.floatToByte(this.green).toString(16);t.length<2&&(t=`0${t}`);let e=x.floatToByte(this.blue).toString(16);if(e.length<2&&(e=`0${e}`),this.alpha<1){let n=x.floatToByte(this.alpha).toString(16);return n.length<2&&(n=`0${n}`),`#${i}${t}${e}${n}`}return`#${i}${t}${e}`},x.prototype.toBytes=function(i){const t=x.floatToByte(this.red),e=x.floatToByte(this.green),n=x.floatToByte(this.blue),s=x.floatToByte(this.alpha);return C(i)?(i[0]=t,i[1]=e,i[2]=n,i[3]=s,i):[t,e,n,s]},x.prototype.toRgba=function(){return Ti[0]=x.floatToByte(this.red),Ti[1]=x.floatToByte(this.green),Ti[2]=x.floatToByte(this.blue),Ti[3]=x.floatToByte(this.alpha),nl[0]},x.prototype.brighten=function(i,t){return p.typeOf.number("magnitude",i),p.typeOf.number.greaterThanOrEquals("magnitude",i,0),p.typeOf.object("result",t),i=1-i,t.red=1-(1-this.red)*i,t.green=1-(1-this.green)*i,t.blue=1-(1-this.blue)*i,t.alpha=this.alpha,t},x.prototype.darken=function(i,t){return p.typeOf.number("magnitude",i),p.typeOf.number.greaterThanOrEquals("magnitude",i,0),p.typeOf.object("result",t),i=1-i,t.red=this.red*i,t.green=this.green*i,t.blue=this.blue*i,t.alpha=this.alpha,t},x.prototype.withAlpha=function(i,t){return x.fromAlpha(this,i,t)},x.add=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.red=i.red+t.red,e.green=i.green+t.green,e.blue=i.blue+t.blue,e.alpha=i.alpha+t.alpha,e},x.subtract=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.red=i.red-t.red,e.green=i.green-t.green,e.blue=i.blue-t.blue,e.alpha=i.alpha-t.alpha,e},x.multiply=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.red=i.red*t.red,e.green=i.green*t.green,e.blue=i.blue*t.blue,e.alpha=i.alpha*t.alpha,e},x.divide=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.red=i.red/t.red,e.green=i.green/t.green,e.blue=i.blue/t.blue,e.alpha=i.alpha/t.alpha,e},x.mod=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.red=i.red%t.red,e.green=i.green%t.green,e.blue=i.blue%t.blue,e.alpha=i.alpha%t.alpha,e},x.lerp=function(i,t,e,n){return p.typeOf.object("start",i),p.typeOf.object("end",t),p.typeOf.number("t",e),p.typeOf.object("result",n),n.red=T.lerp(i.red,t.red,e),n.green=T.lerp(i.green,t.green,e),n.blue=T.lerp(i.blue,t.blue,e),n.alpha=T.lerp(i.alpha,t.alpha,e),n},x.multiplyByScalar=function(i,t,e){return p.typeOf.object("color",i),p.typeOf.number("scalar",t),p.typeOf.object("result",e),e.red=i.red*t,e.green=i.green*t,e.blue=i.blue*t,e.alpha=i.alpha*t,e},x.divideByScalar=function(i,t,e){return p.typeOf.object("color",i),p.typeOf.number("scalar",t),p.typeOf.object("result",e),e.red=i.red/t,e.green=i.green/t,e.blue=i.blue/t,e.alpha=i.alpha/t,e},x.ALICEBLUE=Object.freeze(x.fromCssColorString("#F0F8FF")),x.ANTIQUEWHITE=Object.freeze(x.fromCssColorString("#FAEBD7")),x.AQUA=Object.freeze(x.fromCssColorString("#00FFFF")),x.AQUAMARINE=Object.freeze(x.fromCssColorString("#7FFFD4")),x.AZURE=Object.freeze(x.fromCssColorString("#F0FFFF")),x.BEIGE=Object.freeze(x.fromCssColorString("#F5F5DC")),x.BISQUE=Object.freeze(x.fromCssColorString("#FFE4C4")),x.BLACK=Object.freeze(x.fromCssColorString("#000000")),x.BLANCHEDALMOND=Object.freeze(x.fromCssColorString("#FFEBCD")),x.BLUE=Object.freeze(x.fromCssColorString("#0000FF")),x.BLUEVIOLET=Object.freeze(x.fromCssColorString("#8A2BE2")),x.BROWN=Object.freeze(x.fromCssColorString("#A52A2A")),x.BURLYWOOD=Object.freeze(x.fromCssColorString("#DEB887")),x.CADETBLUE=Object.freeze(x.fromCssColorString("#5F9EA0")),x.CHARTREUSE=Object.freeze(x.fromCssColorString("#7FFF00")),x.CHOCOLATE=Object.freeze(x.fromCssColorString("#D2691E")),x.CORAL=Object.freeze(x.fromCssColorString("#FF7F50")),x.CORNFLOWERBLUE=Object.freeze(x.fromCssColorString("#6495ED")),x.CORNSILK=Object.freeze(x.fromCssColorString("#FFF8DC")),x.CRIMSON=Object.freeze(x.fromCssColorString("#DC143C")),x.CYAN=Object.freeze(x.fromCssColorString("#00FFFF")),x.DARKBLUE=Object.freeze(x.fromCssColorString("#00008B")),x.DARKCYAN=Object.freeze(x.fromCssColorString("#008B8B")),x.DARKGOLDENROD=Object.freeze(x.fromCssColorString("#B8860B")),x.DARKGRAY=Object.freeze(x.fromCssColorString("#A9A9A9")),x.DARKGREEN=Object.freeze(x.fromCssColorString("#006400")),x.DARKGREY=x.DARKGRAY,x.DARKKHAKI=Object.freeze(x.fromCssColorString("#BDB76B")),x.DARKMAGENTA=Object.freeze(x.fromCssColorString("#8B008B")),x.DARKOLIVEGREEN=Object.freeze(x.fromCssColorString("#556B2F")),x.DARKORANGE=Object.freeze(x.fromCssColorString("#FF8C00")),x.DARKORCHID=Object.freeze(x.fromCssColorString("#9932CC")),x.DARKRED=Object.freeze(x.fromCssColorString("#8B0000")),x.DARKSALMON=Object.freeze(x.fromCssColorString("#E9967A")),x.DARKSEAGREEN=Object.freeze(x.fromCssColorString("#8FBC8F")),x.DARKSLATEBLUE=Object.freeze(x.fromCssColorString("#483D8B")),x.DARKSLATEGRAY=Object.freeze(x.fromCssColorString("#2F4F4F")),x.DARKSLATEGREY=x.DARKSLATEGRAY,x.DARKTURQUOISE=Object.freeze(x.fromCssColorString("#00CED1")),x.DARKVIOLET=Object.freeze(x.fromCssColorString("#9400D3")),x.DEEPPINK=Object.freeze(x.fromCssColorString("#FF1493")),x.DEEPSKYBLUE=Object.freeze(x.fromCssColorString("#00BFFF")),x.DIMGRAY=Object.freeze(x.fromCssColorString("#696969")),x.DIMGREY=x.DIMGRAY,x.DODGERBLUE=Object.freeze(x.fromCssColorString("#1E90FF")),x.FIREBRICK=Object.freeze(x.fromCssColorString("#B22222")),x.FLORALWHITE=Object.freeze(x.fromCssColorString("#FFFAF0")),x.FORESTGREEN=Object.freeze(x.fromCssColorString("#228B22")),x.FUCHSIA=Object.freeze(x.fromCssColorString("#FF00FF")),x.GAINSBORO=Object.freeze(x.fromCssColorString("#DCDCDC")),x.GHOSTWHITE=Object.freeze(x.fromCssColorString("#F8F8FF")),x.GOLD=Object.freeze(x.fromCssColorString("#FFD700")),x.GOLDENROD=Object.freeze(x.fromCssColorString("#DAA520")),x.GRAY=Object.freeze(x.fromCssColorString("#808080")),x.GREEN=Object.freeze(x.fromCssColorString("#008000")),x.GREENYELLOW=Object.freeze(x.fromCssColorString("#ADFF2F")),x.GREY=x.GRAY,x.HONEYDEW=Object.freeze(x.fromCssColorString("#F0FFF0")),x.HOTPINK=Object.freeze(x.fromCssColorString("#FF69B4")),x.INDIANRED=Object.freeze(x.fromCssColorString("#CD5C5C")),x.INDIGO=Object.freeze(x.fromCssColorString("#4B0082")),x.IVORY=Object.freeze(x.fromCssColorString("#FFFFF0")),x.KHAKI=Object.freeze(x.fromCssColorString("#F0E68C")),x.LAVENDER=Object.freeze(x.fromCssColorString("#E6E6FA")),x.LAVENDAR_BLUSH=Object.freeze(x.fromCssColorString("#FFF0F5")),x.LAWNGREEN=Object.freeze(x.fromCssColorString("#7CFC00")),x.LEMONCHIFFON=Object.freeze(x.fromCssColorString("#FFFACD")),x.LIGHTBLUE=Object.freeze(x.fromCssColorString("#ADD8E6")),x.LIGHTCORAL=Object.freeze(x.fromCssColorString("#F08080")),x.LIGHTCYAN=Object.freeze(x.fromCssColorString("#E0FFFF")),x.LIGHTGOLDENRODYELLOW=Object.freeze(x.fromCssColorString("#FAFAD2")),x.LIGHTGRAY=Object.freeze(x.fromCssColorString("#D3D3D3")),x.LIGHTGREEN=Object.freeze(x.fromCssColorString("#90EE90")),x.LIGHTGREY=x.LIGHTGRAY,x.LIGHTPINK=Object.freeze(x.fromCssColorString("#FFB6C1")),x.LIGHTSEAGREEN=Object.freeze(x.fromCssColorString("#20B2AA")),x.LIGHTSKYBLUE=Object.freeze(x.fromCssColorString("#87CEFA")),x.LIGHTSLATEGRAY=Object.freeze(x.fromCssColorString("#778899")),x.LIGHTSLATEGREY=x.LIGHTSLATEGRAY,x.LIGHTSTEELBLUE=Object.freeze(x.fromCssColorString("#B0C4DE")),x.LIGHTYELLOW=Object.freeze(x.fromCssColorString("#FFFFE0")),x.LIME=Object.freeze(x.fromCssColorString("#00FF00")),x.LIMEGREEN=Object.freeze(x.fromCssColorString("#32CD32")),x.LINEN=Object.freeze(x.fromCssColorString("#FAF0E6")),x.MAGENTA=Object.freeze(x.fromCssColorString("#FF00FF")),x.MAROON=Object.freeze(x.fromCssColorString("#800000")),x.MEDIUMAQUAMARINE=Object.freeze(x.fromCssColorString("#66CDAA")),x.MEDIUMBLUE=Object.freeze(x.fromCssColorString("#0000CD")),x.MEDIUMORCHID=Object.freeze(x.fromCssColorString("#BA55D3")),x.MEDIUMPURPLE=Object.freeze(x.fromCssColorString("#9370DB")),x.MEDIUMSEAGREEN=Object.freeze(x.fromCssColorString("#3CB371")),x.MEDIUMSLATEBLUE=Object.freeze(x.fromCssColorString("#7B68EE")),x.MEDIUMSPRINGGREEN=Object.freeze(x.fromCssColorString("#00FA9A")),x.MEDIUMTURQUOISE=Object.freeze(x.fromCssColorString("#48D1CC")),x.MEDIUMVIOLETRED=Object.freeze(x.fromCssColorString("#C71585")),x.MIDNIGHTBLUE=Object.freeze(x.fromCssColorString("#191970")),x.MINTCREAM=Object.freeze(x.fromCssColorString("#F5FFFA")),x.MISTYROSE=Object.freeze(x.fromCssColorString("#FFE4E1")),x.MOCCASIN=Object.freeze(x.fromCssColorString("#FFE4B5")),x.NAVAJOWHITE=Object.freeze(x.fromCssColorString("#FFDEAD")),x.NAVY=Object.freeze(x.fromCssColorString("#000080")),x.OLDLACE=Object.freeze(x.fromCssColorString("#FDF5E6")),x.OLIVE=Object.freeze(x.fromCssColorString("#808000")),x.OLIVEDRAB=Object.freeze(x.fromCssColorString("#6B8E23")),x.ORANGE=Object.freeze(x.fromCssColorString("#FFA500")),x.ORANGERED=Object.freeze(x.fromCssColorString("#FF4500")),x.ORCHID=Object.freeze(x.fromCssColorString("#DA70D6")),x.PALEGOLDENROD=Object.freeze(x.fromCssColorString("#EEE8AA")),x.PALEGREEN=Object.freeze(x.fromCssColorString("#98FB98")),x.PALETURQUOISE=Object.freeze(x.fromCssColorString("#AFEEEE")),x.PALEVIOLETRED=Object.freeze(x.fromCssColorString("#DB7093")),x.PAPAYAWHIP=Object.freeze(x.fromCssColorString("#FFEFD5")),x.PEACHPUFF=Object.freeze(x.fromCssColorString("#FFDAB9")),x.PERU=Object.freeze(x.fromCssColorString("#CD853F")),x.PINK=Object.freeze(x.fromCssColorString("#FFC0CB")),x.PLUM=Object.freeze(x.fromCssColorString("#DDA0DD")),x.POWDERBLUE=Object.freeze(x.fromCssColorString("#B0E0E6")),x.PURPLE=Object.freeze(x.fromCssColorString("#800080")),x.RED=Object.freeze(x.fromCssColorString("#FF0000")),x.ROSYBROWN=Object.freeze(x.fromCssColorString("#BC8F8F")),x.ROYALBLUE=Object.freeze(x.fromCssColorString("#4169E1")),x.SADDLEBROWN=Object.freeze(x.fromCssColorString("#8B4513")),x.SALMON=Object.freeze(x.fromCssColorString("#FA8072")),x.SANDYBROWN=Object.freeze(x.fromCssColorString("#F4A460")),x.SEAGREEN=Object.freeze(x.fromCssColorString("#2E8B57")),x.SEASHELL=Object.freeze(x.fromCssColorString("#FFF5EE")),x.SIENNA=Object.freeze(x.fromCssColorString("#A0522D")),x.SILVER=Object.freeze(x.fromCssColorString("#C0C0C0")),x.SKYBLUE=Object.freeze(x.fromCssColorString("#87CEEB")),x.SLATEBLUE=Object.freeze(x.fromCssColorString("#6A5ACD")),x.SLATEGRAY=Object.freeze(x.fromCssColorString("#708090")),x.SLATEGREY=x.SLATEGRAY,x.SNOW=Object.freeze(x.fromCssColorString("#FFFAFA")),x.SPRINGGREEN=Object.freeze(x.fromCssColorString("#00FF7F")),x.STEELBLUE=Object.freeze(x.fromCssColorString("#4682B4")),x.TAN=Object.freeze(x.fromCssColorString("#D2B48C")),x.TEAL=Object.freeze(x.fromCssColorString("#008080")),x.THISTLE=Object.freeze(x.fromCssColorString("#D8BFD8")),x.TOMATO=Object.freeze(x.fromCssColorString("#FF6347")),x.TURQUOISE=Object.freeze(x.fromCssColorString("#40E0D0")),x.VIOLET=Object.freeze(x.fromCssColorString("#EE82EE")),x.WHEAT=Object.freeze(x.fromCssColorString("#F5DEB3")),x.WHITE=Object.freeze(x.fromCssColorString("#FFFFFF")),x.WHITESMOKE=Object.freeze(x.fromCssColorString("#F5F5F5")),x.YELLOW=Object.freeze(x.fromCssColorString("#FFFF00")),x.YELLOWGREEN=Object.freeze(x.fromCssColorString("#9ACD32")),x.TRANSPARENT=Object.freeze(new x(0,0,0,0));function Re(i,t){i=i??0,this._near=i,t=t??Number.MAX_VALUE,this._far=t}Object.defineProperties(Re.prototype,{near:{get:function(){return this._near},set:function(i){this._near=i}},far:{get:function(){return this._far},set:function(i){this._far=i}}}),Re.packedLength=2,Re.pack=function(i,t,e){if(!C(i))throw new j("value is required");if(!C(t))throw new j("array is required");return e=e??0,t[e++]=i.near,t[e]=i.far,t},Re.unpack=function(i,t,e){if(!C(i))throw new j("array is required");return t=t??0,C(e)||(e=new Re),e.near=i[t++],e.far=i[t],e},Re.equals=function(i,t){return i===t||C(i)&&C(t)&&i.near===t.near&&i.far===t.far},Re.clone=function(i,t){if(C(i))return C(t)||(t=new Re),t.near=i.near,t.far=i.far,t},Re.prototype.clone=function(i){return Re.clone(this,i)},Re.prototype.equals=function(i){return Re.equals(this,i)};function Fe(i,t,e,n){this.near=i??0,this.nearValue=t??0,this.far=e??1,this.farValue=n??0}Fe.clone=function(i,t){if(C(i))return C(t)?(t.near=i.near,t.nearValue=i.nearValue,t.far=i.far,t.farValue=i.farValue,t):new Fe(i.near,i.nearValue,i.far,i.farValue)},Fe.packedLength=4,Fe.pack=function(i,t,e){if(!C(i))throw new j("value is required");if(!C(t))throw new j("array is required");return e=e??0,t[e++]=i.near,t[e++]=i.nearValue,t[e++]=i.far,t[e]=i.farValue,t},Fe.unpack=function(i,t,e){if(!C(i))throw new j("array is required");return t=t??0,C(e)||(e=new Fe),e.near=i[t++],e.nearValue=i[t++],e.far=i[t++],e.farValue=i[t],e},Fe.equals=function(i,t){return i===t||C(i)&&C(t)&&i.near===t.near&&i.nearValue===t.nearValue&&i.far===t.far&&i.farValue===t.farValue},Fe.prototype.clone=function(i){return Fe.clone(this,i)},Fe.prototype.equals=function(i){return Fe.equals(this,i)};function gg(i,t){return O.fromDegrees(...i,void 0,t)}const w1=new lt;function v1(i,t){const e=lt.fromCartesian(i,void 0,w1);if(e)return t=t||[0,0,0],t[0]=T.toDegrees(e.longitude),t[1]=T.toDegrees(e.latitude),t[2]=e.height,t}function pg(i,t){return t=t||new tt,t.x=i[0],t.y=i[1],t}function mg(i,t){return t=t||[0,0],t[0]=i.x,t[1]=i.y,t}function _g(i,t){return t=t||new O,t.x=i[0],t.y=i[1],t.z=i[2],t}function yg(i,t){return t=t||[0,0,0],t[0]=i.x,t[1]=i.y,t[2]=i.z,t}function wg(i,t){return t=t||new K,t.x=i[0],t.y=i[1],t.z=i[2],t.w=i[3],t}function vg(i,t){return t=t||[0,0,0,0],t[0]=i.x,t[1]=i.y,t[2]=i.z,t[3]=i.w,t}function Eg(i,t){if(i.length===4)return wg(i,t);if(i.length===3)return _g(i,t);if(i.length===2)return pg(i,t);throw new Error("toCartesian error: should not be here!")}function E1(i,t){if(i instanceof tt)return mg(i,t);if(i instanceof O)return yg(i,t);if(i instanceof K)return vg(i,t);throw new Error("fromCartesian error: should not be here!")}function C1(i,t){return t=t||new lt,t.longitude=T.toRadians(i[0]),t.latitude=T.toRadians(i[1]),t.height=i[2],t}function b1(i,t){return t=t||[0,0,0],t[0]=T.toDegrees(i.longitude),t[1]=T.toDegrees(i.latitude),t[2]=0,t}function x1(i,t){return t=t||new x,t.red=i[0],t.green=i[1],t.blue=i[2],t.alpha=i[3],t}function S1(i,t){return t=t||[0,0,0,0],t[0]=i.red,t[1]=i.green,t[2]=i.blue,t[3]=i.alpha,t}function R1(i,t){return t=t||new Fe,t.near=i[0],t.nearValue=i[1],t.far=i[2],t.farValue=i[3],t}function P1(i,t){return t=t||[0,0,0,0],t[0]=i.near,t[1]=i.nearValue,t[2]=i.far,t[3]=i.farValue,t}function Cg(i,t){return t=t||new Yt,t.heading=T.toRadians(i[0]-90),t.pitch=T.toRadians(i[1]),t.roll=T.toRadians(i[2]),t}function O1(i,t){return t=t||[0,0,0],t[0]=T.toDegrees(i.heading+T.PI_OVER_TWO),t[1]=T.toDegrees(i.pitch),t[2]=T.toDegrees(i.roll),t}function I1(i,t){return t=t||new Re,t.near=i[0],t.far=i[1],t}function T1(i,t){return t=t||[0,0],t[0]=i.near,t[1]=i.far,t}function A1(i,t){return t=t||new H,t.x=i[0],t.y=i[1],t.z=i[2],t.w=i[3],t}function M1(i,t){return t=t||[0,0,0,0],t[0]=i.x,t[1]=i.y,t[2]=i.z,t[3]=i.w,t}const D1=new Yt,F1=new O;function L1(i,t,e){const n=Cg(t,D1),s=gg(i,F1);return ut.headingPitchRollQuaternion(s,n,void 0,void 0,e)}function z1(i,t){return t=t||new nt,t.west=i[0]*Math.PI/180,t.south=i[1]*Math.PI/180,t.east=i[2]*Math.PI/180,t.north=i[3]*Math.PI/180,t}function N1(i,t){return t=t||[0,0,0,0],t[0]=i.west,t[1]=i.south,t[2]=i.east,t[3]=i.north,t}const U1=new O;function j1(i,t){return t=t||new ct,ct.fromCartesian3(O.fromArray(i,void 0,U1),t)}function k1(i,t){return t=t||[0,0,0],t[0]=i.radii.x,t[1]=i.radii.y,t[2]=i.radii.z,t}function W1(i,t){return bg(i,O.UNIT_Y,O.UNIT_Z,O.UNIT_X,t)}function q1(i,t){return bg(i,O.UNIT_X,O.UNIT_Z,new O(0,-1,0),t)}function bg(i,t,e,n,s){const[o,r,a]=i,c=H.fromAxisAngle(e,T.toRadians(-o)),h=H.fromAxisAngle(n,T.toRadians(r)),l=H.fromAxisAngle(t,T.toRadians(a)),u=H.clone(H.IDENTITY,s);return H.multiply(l,u,u),H.multiply(h,u,u),H.multiply(c,u,u),u}function xg(i,t){t=t??new Array(16);for(let e=0;e<16;++e)t[e]=i[e];return t}function sl(i,t){const e=U.clone(U.IDENTITY),{position:n,rotation:s,scale:o,initialRotationMode:r="YForwardZUp"}=i;if(n){const[a,c,h]=n;ut.eastNorthUpToFixedFrame(O.fromDegrees(a,c,h),void 0,e)}if(s){const a=new H;r==="YForwardZUp"?W1(s,a):r==="XForwardZUp"&&q1(s,a);const c=k.fromQuaternion(a);U.multiply(e,U.fromRotationTranslation(c),e)}return o&&U.multiplyByScale(e,Eg(o),e),xg(e,t)}const G1=new U;function Sg(i,t){const e=U.fromArray(i,0,G1);return U.inverse(e,e),xg(e,t)}const V1=new U,B1=new O;function Rg(i,t,e){const[n,s,o]=t,r=O.fromDegrees(n,s,o,void 0,B1),a=U.fromArray(i,0,V1),c=U.multiplyByPoint(a,r,r),{x:h,y:l,z:u}=c;return e=e||[0,0,0],e[0]=h,e[1]=l,e[2]=u,e}const Y1=new U,H1=new O,X1=new lt;function Pg(i,t,e){const[n,s,o]=t,r=O.fromElements(n,s,o,H1),a=U.fromArray(i,0,Y1),c=U.multiplyByPoint(a,r,r),h=lt.fromCartesian(c,void 0,X1);return e=e||[0,0,0],e[0]=T.toDegrees(h.longitude),e[1]=T.toDegrees(h.latitude),e[2]=h.height,e}function Us(i,t){const{originPosition:e,originRotation:n,originScale:s,initialRotationMode:o}=i,r=sl({position:e,rotation:n,scale:s,initialRotationMode:o}),a=Sg(r);return[t.map(h=>Rg(a,h)),r,a]}function Ua(i,t){const{originPosition:e,originRotation:n,originScale:s,initialRotationMode:o}=i,r=sl({position:e,rotation:n,scale:s,initialRotationMode:o});return[t.map(c=>Pg(r,c)),r]}function rl(i,t){return[(i[0]+t[0])/2,(i[1]+t[1])/2,(i[2]+t[2])/2]}class Og extends d.Destroyable{constructor(e,n,s,o){super();R(this,"_pixelsToMetersAt",(e,n,s,o)=>{const r=_t([n,s]),a=e.getPixelFromCoordinate(r);if(!a)return;const c=[a[0]+o,a[1]],h=e.getCoordinateFromPixel(c);if(!h)return;const[l,u]=Kt(h);return Math.abs(d.geoRhumbDistance([n,s,0],[l,u,0]))});const r=e.viewer;if(!r){console.warn("OlCurrentScale: map is undefined");return}const[a,,c]=d.getReactFuncs(n),[,h]=d.getReactFuncs(s),l=()=>{const f=a();if(!f)return;const[g,_]=f,y=this._pixelsToMetersAt(r,g,_,o);y!==void 0&&isFinite(y)&&h([y,y,y])};l(),this.dispose(c.disposableOn(l));const u=()=>l();r.on("postrender",u),this.dispose(()=>r.un("postrender",u))}}function $1(i,t){var e,n;if(i){try{const s=Mi(i);s&&typeof s.destroy=="function"&&s.destroy(),Wa(i,void 0)}catch(s){console.warn("[destroyOlMapHard] extensions cleanup error:",s)}try{i.getOverlays().clear()}catch{}try{i.getLayers().forEach(s=>{const o=s&&typeof s.getSource=="function"?s.getSource():void 0;if(o&&typeof o.clear=="function")try{o.clear()}catch{}if(o&&o.tileCache&&typeof o.tileCache.clear=="function")try{o.tileCache.clear()}catch{}if(typeof s.dispose=="function")try{s.dispose()}catch{}}),i.getLayers().clear()}catch{}try{i.getInteractions().clear()}catch{}try{i.getControls().clear()}catch{}try{const s=(e=i.getViewport)==null?void 0:e.call(i);s&&s.querySelectorAll("canvas").forEach(r=>{const a=r.getContext&&r.getContext("webgl2")||r.getContext&&r.getContext("webgl")||r.getContext&&r.getContext("experimental-webgl");if(a){const c=a.getExtension&&a.getExtension("WEBGL_lose_context");c&&typeof c.loseContext=="function"&&c.loseContext()}try{r.width=1,r.height=1}catch{}})}catch(s){console.warn("[destroyOlMapHard] webgl lose context skipped:",s)}try{i.setTarget(void 0)}catch{}try{(n=i.dispose)==null||n.call(i)}catch{}try{t(void 0)}catch{}}}class Z1 extends d.Destroyable{constructor(t,e,n){super();let s;this.d(()=>{t&&s&&t.removeChild(s)});const o=()=>{e.setStatus("Raw"),e.setStatusLog("");const a=e.viewer;if(a){const c=Mi(a);c&&(c.destroy(),Wa(a,void 0)),$1(a,n)}};this.d(o);const r=this.dv(d.createProcessingFromAsyncFunc(async(a,c)=>{e.setStatus("Creating"),e.setStatusLog("正在创建OpenLayers视口..."),s=document.createElement("div"),s.style.cssText="height: 100%",s.addEventListener("contextmenu",E=>E.preventDefault()),this.d(()=>{s==null||s.removeEventListener("contextmenu",E=>E.preventDefault())}),c.appendChild(s);const l=Gt("EPSG:3857").getExtent(),u=yt(l)/256,f=new Array(19),g=new Array(19);for(let E=0;E<19;++E)f[E]=u/Math.pow(2,E),g[E]=E.toString();const _=new I_({target:s,view:new ni({center:[0,0],zoom:0,enableRotation:!0}),interactions:qd({doubleClickZoom:!1}),controls:zd({zoom:!1,rotate:!1,attribution:!1})});await a.promise(d.sleep(1e3)),_.updateSize(),_.renderSync();const y=new ResizeObserver(()=>{_.updateSize(),_.renderSync()});y.observe(s),this.d(()=>y.disconnect());const w=new Wg(_,e);Wa(_,w),n(_),this.d(()=>n(void 0)),e.setStatus("Created"),e.setStatusLog("成功创建OpenLayers视口!")}));r.start(t),r.errorEvent.don(a=>{console.error(a),e.setStatus("Error"),e.setStatusLog("创建Cesium视口失败!")})}}class K1 extends d.Destroyable{constructor(t){super();const e=()=>{};this.dispose(t.viewDistanceChanged.disposableOn(e)),this.dispose(t.visibleAlphaChanged.disposableOn(e))}}class Q1 extends d.Destroyable{constructor(e){super();R(this,"_debugObjResetting");this._control=e,this._debugObjResetting=this.disposeVar(new d.ObjResettingWithEvent(this._control.debugChanged,()=>{if(this._control.debug)return new K1(this._control)}))}get debugObjResetting(){return this._debugObjResetting}}class Ig extends d.Destroyable{constructor(e,n,s,o){super();R(this,"_visibleAlpha",this.disposeVar(d.react(1)));R(this,"_viewDistance",this.disposeVar(d.react(0)));R(this,"_debug",this.disposeVar(d.react(!1)));R(this,"_viewDistanceDebug",this.disposeVar(new Q1(this)));this._olViewer=e,this._positionReact=s;const[r,,a]=d.getReactFuncs(n),[c,,h]=d.getReactFuncs(this._positionReact),[l,,u]=o?d.getReactFuncs(o):[void 0,void 0,void 0],f=()=>{var w;let _=1,y=Number.NEGATIVE_INFINITY;do{const E=r(),b=c(),P=l?l():0;if(!E||!b)break;const I=(w=this._olViewer.viewer)==null?void 0:w.getView().getCenter();if(console.log(I),!I)break;y=gu({getCoordinates:()=>[I,b],getType:()=>"LineString"})-(P??0);const[D,L,z,q]=E;if(D>L||L>z||z>q){console.error("viewDistanceRange 参数错误: n0 <= n1 <= f1 <= f0");break}y>=L&&y<=z?_=1:y<=D||y>=q?_=0:y>D&&y<L?_=(y-D)/(L-D):y>z&&y<q?_=(q-y)/(q-z):_=1}while(!1);this._viewDistance.value=y,this._visibleAlpha.value=_},g=this.disposeVar(d.createNextAnimateFrameEvent(...[this._olViewer.cameraChanged,a,h,u].filter(Boolean)));this.dispose(g.disposableOn(f)),f()}get visibleAlpha(){return this._visibleAlpha.value}get visibleAlphaChanged(){return this._visibleAlpha.changed}get viewDistance(){return this._viewDistance.value}set viewDistance(e){this._viewDistance.value=e}get viewDistanceChanged(){return this._viewDistance.changed}get debug(){return this._debug.value}set debug(e){this._debug.value=e}get debugChanged(){return this._debug.changed}get positionReact(){return this._positionReact}get olViewer(){return this._olViewer}get viewDistanceDebug(){return this._viewDistanceDebug}}class Tg extends d.Destroyable{constructor(e,n){super();R(this,"_map");R(this,"_view");R(this,"_keys",[]);R(this,"_changed",new d.Event);R(this,"_opts");this._map=e;const s=e.getView();if(!s)throw new Error("OlCameraChanged: map.getView() is undefined");this._view=s,this._opts={usePropertyChange:!0,listenSizeChange:!0,usePostRender:!1,emitImmediately:!0,...n},this._attach(),this.dispose(()=>this._detach()),this._opts.emitImmediately&&this._changed.emit()}get changed(){return this._changed}_on(e,n,s){const o=e.on(n,s);this._keys.push(o)}_attach(){this._opts.usePropertyChange?this._on(this._view,"propertychange",()=>this._changed.emit()):(this._on(this._view,"change:center",()=>this._changed.emit()),this._on(this._view,"change:resolution",()=>this._changed.emit()),this._on(this._view,"change:rotation",()=>this._changed.emit())),this._on(this._map,"moveend",()=>this._changed.emit()),this._opts.listenSizeChange&&this._on(this._map,"change:size",()=>this._changed.emit()),this._opts.usePostRender&&this._on(this._map,"postrender",()=>this._changed.emit())}_detach(){this._keys.forEach(gi),this._keys.length=0}}function al(i,t){return i.left===t.left&&i.top===t.top&&i.right===t.right&&i.bottom===t.bottom&&i.depth===t.depth}class cl extends d.Destroyable{constructor(e,n=!0,s){super();R(this,"_coordinate");R(this,"_winPos",{left:NaN,top:NaN,right:NaN,bottom:NaN,depth:NaN});R(this,"_winPosValid",!1);R(this,"_changedEvent",new d.Event);R(this,"_enabled",!0);R(this,"tooltipElement");this.viewer=e,s=s||this.disposeVar(new Tg(this.viewer,{usePropertyChange:!0,listenSizeChange:!0,usePostRender:!1,emitImmediately:!0})),this.dispose(s.changed.disposableOn(()=>this._updateWinPos())),this.dispose(()=>{this._changedEvent.empty||console.warn("WinPosFromCartesian需要销毁,但是changed事件仍有监听,代码未必有错,但是说明代码不严谨。")}),this._enabled=n,this._updateWinPos()}set enabled(e){this._enabled!==e&&(this._enabled=e,e&&this._updateWinPos())}get enabled(){return this._enabled}set coordinate(e){if(!e){this._coordinate=void 0,this._updateWinPos();return}const n=this.viewer.getView().getProjection(),o=Math.abs(e[0])<=180&&Math.abs(e[1])<=90?co(e,"EPSG:4326",n):e;this._coordinate=[o[0],o[1]],this._updateWinPos()}get coordinate(){return this._coordinate}_updateWinPos(){if(!this._enabled)return;if(!this._coordinate){this._emitInvalidIfNeeded();return}const e=this.viewer.getPixelFromCoordinate(this._coordinate),n=this.viewer.getSize(),s=!!e&&Array.isArray(e)&&isFinite(e[0])&&isFinite(e[1])&&!!n&&e[0]>=0&&e[1]>=0&&e[0]<n[0]&&e[1]<n[1];let o=!1;if(s!==this._winPosValid&&(this._winPosValid=s,o=!0),s){const r={left:e[0],top:e[1],right:e[0],bottom:e[1],depth:0};al(this._winPos,r)||(this._winPos=r,o=!0)}else{const r={left:NaN,top:NaN,right:NaN,bottom:NaN,depth:NaN};al(this._winPos,r)||(this._winPos=r,o=!0)}o&&(this._changedEvent.emit(this._winPosValid,this._winPos),this._syncTooltip())}_emitInvalidIfNeeded(){let e=!1;this._winPosValid&&(this._winPosValid=!1,e=!0);const n={left:NaN,top:NaN,right:NaN,bottom:NaN,depth:NaN};al(this._winPos,n)||(this._winPos=n,e=!0),e&&(this._changedEvent.emit(!1,this._winPos),this._syncTooltip())}_syncTooltip(){this.tooltipElement&&(this._winPosValid?(this.tooltipElement.style.display="block",this.tooltipElement.style.left=`${this._winPos.left}px`,this.tooltipElement.style.top=`${this._winPos.top}px`):this.tooltipElement.style.display="none")}get changed(){return this._changedEvent}get winPosValid(){return this._winPosValid}get winPos(){return this._winPos}}class J1 extends d.Destroyable{constructor(e,n){super();R(this,"_show",this.disposeVar(d.react(!0)));R(this,"_winPosFromCartesian");R(this,"_near",this.disposeVar(d.react(0)));R(this,"_far",this.disposeVar(d.react(Number.POSITIVE_INFINITY)));R(this,"_actualShow",this.disposeVar(d.react(!1)));this._olPoisContext=e;const{viewer:s,cameraChanged:o}=this._olPoisContext;this._winPosFromCartesian=n||this.disposeVar(new cl(s,!0,o));let r=0,a=Number.POSITIVE_INFINITY;this.dispose(this._near.changed.disposableOn(h=>r=h*h)),this.dispose(this._far.changed.disposableOn(h=>a=h*h));const c=this.disposeVar(d.createNextMicroTaskEvent(this._near.changed,this._far.changed,this._show.changed,this._winPosFromCartesian.changed,o.changed));this.dispose(c.disposableOn(()=>{if(!this.show){this._actualShow.value=!1;return}const h=this._winPosFromCartesian.winPosValid,u=this._olPoisContext.viewer.getView().getCenter(),f=this._winPosFromCartesian.coordinate;if(!u||!f){this._actualShow.value=!1;return}const g=f[0]-u[0],_=f[1]-u[1],y=g*g+_*_,w=y>=r&&y<=a;this._actualShow.value=w&&h}))}get actualShowChanged(){return this._actualShow.changed}get actualShow(){return this._actualShow.value}set coordinate(e){this._winPosFromCartesian.coordinate=e}get coordinate(){return this._winPosFromCartesian.coordinate}get tracker(){return this._winPosFromCartesian}set show(e){this._show.value=e}get show(){return this._show.value}set near(e){this._near.value=e}get near(){return this._near.value}set far(e){this._far.value=e}get far(){return this._far.value}}class hl extends J1{constructor(e,n,s){super(n,s);R(this,"_canvasPoi");R(this,"_zOrderChanged");R(this,"_zOrder");R(this,"depth",0);const{canvasPrimitivesContext:o}=this._olPoisContext;this._canvasPoi=this.disposeVar(new e(o));const r=()=>{if(this.actualShow&&this.tracker.winPosValid){const{left:a,top:c,depth:h}=this.tracker.winPos;this._canvasPoi.winPos=[a,c],this.depth=h,this._canvasPoi.depth=this._zOrder??h,this._canvasPoi.show=!0}else this._canvasPoi.show=!1};this.d(this.zOrderChanged.don(()=>{r()})),this.dispose(this.tracker.changed.disposableOn(()=>{r()})),this.dispose(this.actualShowChanged.disposableOn(()=>{r()}))}get canvasPoi(){return this._canvasPoi}set zOrder(e){this._zOrder!==e&&(this._zOrder=e,this.zOrderChanged.emit())}get zOrder(){return this._zOrder}get zOrderChanged(){return this._zOrderChanged||(this._zOrderChanged=new d.Event),this._zOrderChanged}}class Ai extends d.Destroyable{constructor(e,n){super();R(this,"_pickedEvent",this.disposeVar(new d.Event));R(this,"_flyToEvent",this.disposeVar(new d.Event));R(this,"_clickEvent",this.disposeVar(new d.Event));R(this,"_clickOutEvent",this.disposeVar(new d.Event));R(this,"_dblclickEvent",this.disposeVar(new d.Event));R(this,"_dblclickOutEvent",this.disposeVar(new d.Event));R(this,"_canvasPoiClassAndCreateFunc",d.react(void 0));R(this,"_olViewDistanceRangeControl");R(this,"_canvasObj");R(this,"_id",this.disposeVar(d.react(d.createGuid())));n&&(this.id=n),this._olViewDistanceRangeControl=this.disposeVar(new Ig(e,[this,"viewDistanceRange"],[this,"position"])),this.dispose(d.track([this._olViewDistanceRangeControl,"debug"],[this,"viewDistanceDebug"]));const s=e.viewer;if(!s)return;const o=Mi(s);if(!o)return;const{poiContext:r,labelManager:a}=o;a.add(this),this.d(()=>{a.delete(this)}),r&&(this._canvasObj=this.disposeVar(new d.ObjResettingWithEvent(this.canvasPoiClassAndCreateFuncChanged,()=>{if(!this.canvasPoiClassAndCreateFunc)return;const[c,h]=this.canvasPoiClassAndCreateFunc;return new tv(this,c,r,s,h)})))}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}get clickEvent(){return this._clickEvent}get clickOutEvent(){return this._clickOutEvent}get dblclickEvent(){return this._dblclickEvent}get dblclickOutEvent(){return this._dblclickOutEvent}get canvasPoiClassAndCreateFunc(){return this._canvasPoiClassAndCreateFunc.value}set canvasPoiClassAndCreateFunc(e){this._canvasPoiClassAndCreateFunc.value=e}get canvasPoiClassAndCreateFuncChanged(){return this._canvasPoiClassAndCreateFunc.changed}get olViewDistanceRangeControl(){return this._olViewDistanceRangeControl}get visibleAlpha(){return this._olViewDistanceRangeControl.visibleAlpha}get visibleAlphaChanged(){return this._olViewDistanceRangeControl.visibleAlphaChanged}get canvasObj(){var e;return(e=this._canvasObj)==null?void 0:e.obj}get id(){return this._id.value}set id(e){this._id.value=e}get idChanged(){return this._id.changed}}R(Ai,"defaults",{viewDistanceRange:[1e3,1e4,3e4,6e4]}),(i=>{i.createDefaultProps=()=>({show:!0,enabled:!0,position:d.reactArrayWithUndefined(void 0),positionEditing:!1,viewDistanceRange:d.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,zOrder:0})})(Ai||(Ai={})),d.extendClassProps(Ai.prototype,Ai.createDefaultProps);class tv extends d.Destroyable{constructor(e,n,s,o,r){super();R(this,"olCanvasPoi");const a=this.olCanvasPoi=this.disposeVar(new hl(n,s));this.disposeVar(r(a.canvasPoi,e.visibleAlphaChanged));const c=()=>{if(e.position){const u=_t([e.position[0],e.position[1]]);a.coordinate=u}};c(),this.dispose(e.positionChanged.disposableOn(c));const h=()=>{a.show=(e.show??!0)&&!!e.position&&e.visibleAlpha>0};h();const l=this.disposeVar(d.createNextAnimateFrameEvent(e.showChanged,e.positionChanged,e.visibleAlphaChanged));this.dispose(l.disposableOn(h)),this.dispose(e.flyToEvent.disposableOn(()=>{console.warn("flyTo not implemented in OpenLayers")}))}}class ev extends d.Destroyable{constructor(t,e){super();const n=this.disposeVar(d.createNextAnimateFrameEvent(t.showChanged,t.positionChanged,t.fgColorChanged,t.bgColorChanged,t.tooltipChanged,t.tooltipShowChanged,t.titleChanged,t.sizeChanged,t.originRatioAndOffsetChanged,t.opacityChanged,t.scaleChanged)),s=()=>{e.fgColor=t.fgColor??[1,1,1,1],e.bgColor=t.bgColor??[.3,.3,.3,.8],e.tooltip=t.tooltip??"",e.tooltipShow=t.tooltipShow??!0,e.title=t.title??"",e.size=t.size??[32,32],e.originRatioAndOffset=t.originRatioAndOffset??[.5,1,0,0],e.hovered=t.hovered??!1,e.opacity=t.opacity??1,e._scale=t.scale??1};s(),this.dispose(n.disposableOn(s));const o=this.disposeVar(d.ESSceneObject.context.createEnvStrReact([t,"imageUri"],"${earthsdk3-assets-script-dir}/assets/img/location.png")),r=this.disposeVar(d.createProcessingFromAsyncFunc(async(h,l)=>{const u=await h.promise(d.fetchImage(l));e.image=u})),a=()=>{if(!o.value)return;const h=o.value.trim();h!==""&&r.restart(void 0,h)};a(),this.dispose(o.changed.disposableOn(a));const c=this.disposeVar(new d.Event);this.dispose(e.clickEvent.disposableOn((h,l,u,f,g)=>{(t.enabled??!0)&&c.emit(g)})),this.dispose(c.don(h=>{t.clickEvent.emit(h)})),this.dispose(e.clickOutEvent.disposableOn((h,l,u,f,g)=>{(t.enabled??!0)&&t.clickOutEvent.emit(g)})),this.dispose(e.dbclickEvent.disposableOn((h,l,u,f,g)=>{(t.enabled??!0)&&t.dbclickEvent.emit(g)})),this.dispose(e.dbclickOutEvent.disposableOn((h,l,u,f,g)=>{(t.enabled??!0)&&t.dbclickOutEvent.emit(g)})),this.dispose(d.bind([t,"hovered"],[e,"hovered"])),this.ad(d.bind([e,"isHoverZoom"],[t,"isHoverZoom"]))}}function iv(i,t){const e=i.trim();if(e){try{const n=Function('"use strict";return ('+e+")")();if(typeof n=="function")return n}catch(n){console.info(`firstTryFunc get error! ${n}`)}try{const n=`function (${(t??[]).join(", ")}) {
73
- ${e};
74
- }`,s=Function('"use strict";return ('+n+")")();return typeof s=="function"?s:void 0}catch(n){console.error(`optionStr get error! ${n}`);return}}}function ja(i,t=48){return`
68
+ */var $P=ah.exports,a_;function HP(){return a_||(a_=1,(function(n){(function(e,t){n.exports?n.exports=t(GP(),WP(),BP()):e.URI=t(e.punycode,e.IPv6,e.SecondLevelDomains,e)})($P,function(e,t,i,s){var o=s&&s.URI;function r(m,b){var S=arguments.length>=1,L=arguments.length>=2;if(!(this instanceof r))return S?L?new r(m,b):new r(m):new r;if(m===void 0){if(S)throw new TypeError("undefined is not a valid argument for URI");typeof location<"u"?m=location.href+"":m=""}if(m===null&&S)throw new TypeError("null is not a valid argument for URI");return this.href(m),b!==void 0?this.absoluteTo(b):this}function a(m){return/^[0-9]+$/.test(m)}r.version="1.19.11";var l=r.prototype,c=Object.prototype.hasOwnProperty;function h(m){return m.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function u(m){return m===void 0?"Undefined":String(Object.prototype.toString.call(m)).slice(8,-1)}function d(m){return u(m)==="Array"}function f(m,b){var S={},L,N;if(u(b)==="RegExp")S=null;else if(d(b))for(L=0,N=b.length;L<N;L++)S[b[L]]=!0;else S[b]=!0;for(L=0,N=m.length;L<N;L++){var j=S&&S[m[L]]!==void 0||!S&&b.test(m[L]);j&&(m.splice(L,1),N--,L--)}return m}function g(m,b){var S,L;if(d(b)){for(S=0,L=b.length;S<L;S++)if(!g(m,b[S]))return!1;return!0}var N=u(b);for(S=0,L=m.length;S<L;S++)if(N==="RegExp"){if(typeof m[S]=="string"&&m[S].match(b))return!0}else if(m[S]===b)return!0;return!1}function _(m,b){if(!d(m)||!d(b)||m.length!==b.length)return!1;m.sort(),b.sort();for(var S=0,L=m.length;S<L;S++)if(m[S]!==b[S])return!1;return!0}function v(m){var b=/^\/+|\/+$/g;return m.replace(b,"")}r._parts=function(){return{protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null,preventInvalidHostname:r.preventInvalidHostname,duplicateQueryParameters:r.duplicateQueryParameters,escapeQuerySpace:r.escapeQuerySpace}},r.preventInvalidHostname=!1,r.duplicateQueryParameters=!1,r.escapeQuerySpace=!0,r.protocol_expression=/^[a-z][a-z0-9.+-]*$/i,r.idn_expression=/[^a-z0-9\._-]/i,r.punycode_expression=/(xn--)/i,r.ip4_expression=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,r.ip6_expression=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,r.find_uri_expression=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/ig,r.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?«»“”„‘’]+$/,parens:/(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g},r.leading_whitespace_expression=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,r.ascii_tab_whitespace=/[\u0009\u000A\u000D]+/g,r.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},r.hostProtocols=["http","https"],r.invalid_hostname_characters=/[^a-zA-Z0-9\.\-:_]/,r.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src",audio:"src",video:"src"},r.getDomAttribute=function(m){if(!(!m||!m.nodeName)){var b=m.nodeName.toLowerCase();if(!(b==="input"&&m.type!=="image"))return r.domAttributes[b]}};function E(m){return escape(m)}function w(m){return encodeURIComponent(m).replace(/[!'()*]/g,E).replace(/\*/g,"%2A")}r.encode=w,r.decode=decodeURIComponent,r.iso8859=function(){r.encode=escape,r.decode=unescape},r.unicode=function(){r.encode=w,r.decode=decodeURIComponent},r.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/ig,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/ig,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}},urnpath:{encode:{expression:/%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/ig,map:{"%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"=","%40":"@"}},decode:{expression:/[\/\?#:]/g,map:{"/":"%2F","?":"%3F","#":"%23",":":"%3A"}}}},r.encodeQuery=function(m,b){var S=r.encode(m+"");return b===void 0&&(b=r.escapeQuerySpace),b?S.replace(/%20/g,"+"):S},r.decodeQuery=function(m,b){m+="",b===void 0&&(b=r.escapeQuerySpace);try{return r.decode(b?m.replace(/\+/g,"%20"):m)}catch{return m}};var C={encode:"encode",decode:"decode"},P,R=function(m,b){return function(S){try{return r[b](S+"").replace(r.characters[m][b].expression,function(L){return r.characters[m][b].map[L]})}catch{return S}}};for(P in C)r[P+"PathSegment"]=R("pathname",C[P]),r[P+"UrnPathSegment"]=R("urnpath",C[P]);var A=function(m,b,S){return function(L){var N;S?N=function(Z){return r[b](r[S](Z))}:N=r[b];for(var j=(L+"").split(m),U=0,B=j.length;U<B;U++)j[U]=N(j[U]);return j.join(m)}};r.decodePath=A("/","decodePathSegment"),r.decodeUrnPath=A(":","decodeUrnPathSegment"),r.recodePath=A("/","encodePathSegment","decode"),r.recodeUrnPath=A(":","encodeUrnPathSegment","decode"),r.encodeReserved=R("reserved","encode"),r.parse=function(m,b){var S;return b||(b={preventInvalidHostname:r.preventInvalidHostname}),m=m.replace(r.leading_whitespace_expression,""),m=m.replace(r.ascii_tab_whitespace,""),S=m.indexOf("#"),S>-1&&(b.fragment=m.substring(S+1)||null,m=m.substring(0,S)),S=m.indexOf("?"),S>-1&&(b.query=m.substring(S+1)||null,m=m.substring(0,S)),m=m.replace(/^(https?|ftp|wss?)?:+[/\\]*/i,"$1://"),m=m.replace(/^[/\\]{2,}/i,"//"),m.substring(0,2)==="//"?(b.protocol=null,m=m.substring(2),m=r.parseAuthority(m,b)):(S=m.indexOf(":"),S>-1&&(b.protocol=m.substring(0,S)||null,b.protocol&&!b.protocol.match(r.protocol_expression)?b.protocol=void 0:m.substring(S+1,S+3).replace(/\\/g,"/")==="//"?(m=m.substring(S+3),m=r.parseAuthority(m,b)):(m=m.substring(S+1),b.urn=!0))),b.path=m,b},r.parseHost=function(m,b){m||(m=""),m=m.replace(/\\/g,"/");var S=m.indexOf("/"),L,N;if(S===-1&&(S=m.length),m.charAt(0)==="[")L=m.indexOf("]"),b.hostname=m.substring(1,L)||null,b.port=m.substring(L+2,S)||null,b.port==="/"&&(b.port=null);else{var j=m.indexOf(":"),U=m.indexOf("/"),B=m.indexOf(":",j+1);B!==-1&&(U===-1||B<U)?(b.hostname=m.substring(0,S)||null,b.port=null):(N=m.substring(0,S).split(":"),b.hostname=N[0]||null,b.port=N[1]||null)}return b.hostname&&m.substring(S).charAt(0)!=="/"&&(S++,m="/"+m),b.preventInvalidHostname&&r.ensureValidHostname(b.hostname,b.protocol),b.port&&r.ensureValidPort(b.port),m.substring(S)||"/"},r.parseAuthority=function(m,b){return m=r.parseUserinfo(m,b),r.parseHost(m,b)},r.parseUserinfo=function(m,b){var S=m,L=m.indexOf("\\");L!==-1&&(m=m.replace(/\\/g,"/"));var N=m.indexOf("/"),j=m.lastIndexOf("@",N>-1?N:m.length-1),U;return j>-1&&(N===-1||j<N)?(U=m.substring(0,j).split(":"),b.username=U[0]?r.decode(U[0]):null,U.shift(),b.password=U[0]?r.decode(U.join(":")):null,m=S.substring(j+1)):(b.username=null,b.password=null),m},r.parseQuery=function(m,b){if(!m)return{};if(m=m.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,""),!m)return{};for(var S={},L=m.split("&"),N=L.length,j,U,B,Z=0;Z<N;Z++)j=L[Z].split("="),U=r.decodeQuery(j.shift(),b),B=j.length?r.decodeQuery(j.join("="),b):null,U!=="__proto__"&&(c.call(S,U)?((typeof S[U]=="string"||S[U]===null)&&(S[U]=[S[U]]),S[U].push(B)):S[U]=B);return S},r.build=function(m){var b="",S=!1;return m.protocol&&(b+=m.protocol+":"),!m.urn&&(b||m.hostname)&&(b+="//",S=!0),b+=r.buildAuthority(m)||"",typeof m.path=="string"&&(m.path.charAt(0)!=="/"&&S&&(b+="/"),b+=m.path),typeof m.query=="string"&&m.query&&(b+="?"+m.query),typeof m.fragment=="string"&&m.fragment&&(b+="#"+m.fragment),b},r.buildHost=function(m){var b="";if(m.hostname)r.ip6_expression.test(m.hostname)?b+="["+m.hostname+"]":b+=m.hostname;else return"";return m.port&&(b+=":"+m.port),b},r.buildAuthority=function(m){return r.buildUserinfo(m)+r.buildHost(m)},r.buildUserinfo=function(m){var b="";return m.username&&(b+=r.encode(m.username)),m.password&&(b+=":"+r.encode(m.password)),b&&(b+="@"),b},r.buildQuery=function(m,b,S){var L="",N,j,U,B;for(j in m)if(j!=="__proto__"&&c.call(m,j))if(d(m[j]))for(N={},U=0,B=m[j].length;U<B;U++)m[j][U]!==void 0&&N[m[j][U]+""]===void 0&&(L+="&"+r.buildQueryParameter(j,m[j][U],S),b!==!0&&(N[m[j][U]+""]=!0));else m[j]!==void 0&&(L+="&"+r.buildQueryParameter(j,m[j],S));return L.substring(1)},r.buildQueryParameter=function(m,b,S){return r.encodeQuery(m,S)+(b!==null?"="+r.encodeQuery(b,S):"")},r.addQuery=function(m,b,S){if(typeof b=="object")for(var L in b)c.call(b,L)&&r.addQuery(m,L,b[L]);else if(typeof b=="string"){if(m[b]===void 0){m[b]=S;return}else typeof m[b]=="string"&&(m[b]=[m[b]]);d(S)||(S=[S]),m[b]=(m[b]||[]).concat(S)}else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter")},r.setQuery=function(m,b,S){if(typeof b=="object")for(var L in b)c.call(b,L)&&r.setQuery(m,L,b[L]);else if(typeof b=="string")m[b]=S===void 0?null:S;else throw new TypeError("URI.setQuery() accepts an object, string as the name parameter")},r.removeQuery=function(m,b,S){var L,N,j;if(d(b))for(L=0,N=b.length;L<N;L++)m[b[L]]=void 0;else if(u(b)==="RegExp")for(j in m)b.test(j)&&(m[j]=void 0);else if(typeof b=="object")for(j in b)c.call(b,j)&&r.removeQuery(m,j,b[j]);else if(typeof b=="string")S!==void 0?u(S)==="RegExp"?!d(m[b])&&S.test(m[b])?m[b]=void 0:m[b]=f(m[b],S):m[b]===String(S)&&(!d(S)||S.length===1)?m[b]=void 0:d(m[b])&&(m[b]=f(m[b],S)):m[b]=void 0;else throw new TypeError("URI.removeQuery() accepts an object, string, RegExp as the first parameter")},r.hasQuery=function(m,b,S,L){switch(u(b)){case"String":break;case"RegExp":for(var N in m)if(c.call(m,N)&&b.test(N)&&(S===void 0||r.hasQuery(m,N,S)))return!0;return!1;case"Object":for(var j in b)if(c.call(b,j)&&!r.hasQuery(m,j,b[j]))return!1;return!0;default:throw new TypeError("URI.hasQuery() accepts a string, regular expression or object as the name parameter")}switch(u(S)){case"Undefined":return b in m;case"Boolean":var U=!!(d(m[b])?m[b].length:m[b]);return S===U;case"Function":return!!S(m[b],b,m);case"Array":if(!d(m[b]))return!1;var B=L?g:_;return B(m[b],S);case"RegExp":return d(m[b])?L?g(m[b],S):!1:!!(m[b]&&m[b].match(S));case"Number":S=String(S);case"String":return d(m[b])?L?g(m[b],S):!1:m[b]===S;default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter")}},r.joinPaths=function(){for(var m=[],b=[],S=0,L=0;L<arguments.length;L++){var N=new r(arguments[L]);m.push(N);for(var j=N.segment(),U=0;U<j.length;U++)typeof j[U]=="string"&&b.push(j[U]),j[U]&&S++}if(!b.length||!S)return new r("");var B=new r("").segment(b);return(m[0].path()===""||m[0].path().slice(0,1)==="/")&&B.path("/"+B.path()),B.normalize()},r.commonPath=function(m,b){var S=Math.min(m.length,b.length),L;for(L=0;L<S;L++)if(m.charAt(L)!==b.charAt(L)){L--;break}return L<1?m.charAt(0)===b.charAt(0)&&m.charAt(0)==="/"?"/":"":((m.charAt(L)!=="/"||b.charAt(L)!=="/")&&(L=m.substring(0,L).lastIndexOf("/")),m.substring(0,L+1))},r.withinString=function(m,b,S){S||(S={});var L=S.start||r.findUri.start,N=S.end||r.findUri.end,j=S.trim||r.findUri.trim,U=S.parens||r.findUri.parens,B=/[a-z0-9-]=["']?$/i;for(L.lastIndex=0;;){var Z=L.exec(m);if(!Z)break;var G=Z.index;if(S.ignoreHtml){var ae=m.slice(Math.max(G-3,0),G);if(ae&&B.test(ae))continue}for(var ne=G+m.slice(G).search(N),V=m.slice(G,ne),re=-1;;){var se=U.exec(V);if(!se)break;var he=se.index+se[0].length;re=Math.max(re,he)}if(re>-1?V=V.slice(0,re)+V.slice(re).replace(j,""):V=V.replace(j,""),!(V.length<=Z[0].length)&&!(S.ignore&&S.ignore.test(V))){ne=G+V.length;var ye=b(V,G,ne,m);if(ye===void 0){L.lastIndex=ne;continue}ye=String(ye),m=m.slice(0,G)+ye+m.slice(ne),L.lastIndex=G+ye.length}}return L.lastIndex=0,m},r.ensureValidHostname=function(m,b){var S=!!m,L=!!b,N=!1;if(L&&(N=g(r.hostProtocols,b)),N&&!S)throw new TypeError("Hostname cannot be empty, if protocol is "+b);if(m&&m.match(r.invalid_hostname_characters)){if(!e)throw new TypeError('Hostname "'+m+'" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available');if(e.toASCII(m).match(r.invalid_hostname_characters))throw new TypeError('Hostname "'+m+'" contains characters other than [A-Z0-9.-:_]')}},r.ensureValidPort=function(m){if(m){var b=Number(m);if(!(a(b)&&b>0&&b<65536))throw new TypeError('Port "'+m+'" is not a valid port')}},r.noConflict=function(m){if(m){var b={URI:this.noConflict()};return s.URITemplate&&typeof s.URITemplate.noConflict=="function"&&(b.URITemplate=s.URITemplate.noConflict()),s.IPv6&&typeof s.IPv6.noConflict=="function"&&(b.IPv6=s.IPv6.noConflict()),s.SecondLevelDomains&&typeof s.SecondLevelDomains.noConflict=="function"&&(b.SecondLevelDomains=s.SecondLevelDomains.noConflict()),b}else s.URI===this&&(s.URI=o);return this},l.build=function(m){return m===!0?this._deferred_build=!0:(m===void 0||this._deferred_build)&&(this._string=r.build(this._parts),this._deferred_build=!1),this},l.clone=function(){return new r(this)},l.valueOf=l.toString=function(){return this.build(!1)._string};function O(m){return function(b,S){return b===void 0?this._parts[m]||"":(this._parts[m]=b||null,this.build(!S),this)}}function M(m,b){return function(S,L){return S===void 0?this._parts[m]||"":(S!==null&&(S=S+"",S.charAt(0)===b&&(S=S.substring(1))),this._parts[m]=S,this.build(!L),this)}}l.protocol=O("protocol"),l.username=O("username"),l.password=O("password"),l.hostname=O("hostname"),l.port=O("port"),l.query=M("query","?"),l.fragment=M("fragment","#"),l.search=function(m,b){var S=this.query(m,b);return typeof S=="string"&&S.length?"?"+S:S},l.hash=function(m,b){var S=this.fragment(m,b);return typeof S=="string"&&S.length?"#"+S:S},l.pathname=function(m,b){if(m===void 0||m===!0){var S=this._parts.path||(this._parts.hostname?"/":"");return m?(this._parts.urn?r.decodeUrnPath:r.decodePath)(S):S}else return this._parts.urn?this._parts.path=m?r.recodeUrnPath(m):"":this._parts.path=m?r.recodePath(m):"/",this.build(!b),this},l.path=l.pathname,l.href=function(m,b){var S;if(m===void 0)return this.toString();this._string="",this._parts=r._parts();var L=m instanceof r,N=typeof m=="object"&&(m.hostname||m.path||m.pathname);if(m.nodeName){var j=r.getDomAttribute(m);m=m[j]||"",N=!1}if(!L&&N&&m.pathname!==void 0&&(m=m.toString()),typeof m=="string"||m instanceof String)this._parts=r.parse(String(m),this._parts);else if(L||N){var U=L?m._parts:m;for(S in U)S!=="query"&&c.call(this._parts,S)&&(this._parts[S]=U[S]);U.query&&this.query(U.query,!1)}else throw new TypeError("invalid input");return this.build(!b),this},l.is=function(m){var b=!1,S=!1,L=!1,N=!1,j=!1,U=!1,B=!1,Z=!this._parts.urn;switch(this._parts.hostname&&(Z=!1,S=r.ip4_expression.test(this._parts.hostname),L=r.ip6_expression.test(this._parts.hostname),b=S||L,N=!b,j=N&&i&&i.has(this._parts.hostname),U=N&&r.idn_expression.test(this._parts.hostname),B=N&&r.punycode_expression.test(this._parts.hostname)),m.toLowerCase()){case"relative":return Z;case"absolute":return!Z;case"domain":case"name":return N;case"sld":return j;case"ip":return b;case"ip4":case"ipv4":case"inet4":return S;case"ip6":case"ipv6":case"inet6":return L;case"idn":return U;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return B}return null};var z=l.protocol,k=l.port,q=l.hostname;l.protocol=function(m,b){if(m&&(m=m.replace(/:(\/\/)?$/,""),!m.match(r.protocol_expression)))throw new TypeError('Protocol "'+m+`" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]`);return z.call(this,m,b)},l.scheme=l.protocol,l.port=function(m,b){return this._parts.urn?m===void 0?"":this:(m!==void 0&&(m===0&&(m=null),m&&(m+="",m.charAt(0)===":"&&(m=m.substring(1)),r.ensureValidPort(m))),k.call(this,m,b))},l.hostname=function(m,b){if(this._parts.urn)return m===void 0?"":this;if(m!==void 0){var S={preventInvalidHostname:this._parts.preventInvalidHostname},L=r.parseHost(m,S);if(L!=="/")throw new TypeError('Hostname "'+m+'" contains characters other than [A-Z0-9.-]');m=S.hostname,this._parts.preventInvalidHostname&&r.ensureValidHostname(m,this._parts.protocol)}return q.call(this,m,b)},l.origin=function(m,b){if(this._parts.urn)return m===void 0?"":this;if(m===void 0){var S=this.protocol(),L=this.authority();return L?(S?S+"://":"")+this.authority():""}else{var N=r(m);return this.protocol(N.protocol()).authority(N.authority()).build(!b),this}},l.host=function(m,b){if(this._parts.urn)return m===void 0?"":this;if(m===void 0)return this._parts.hostname?r.buildHost(this._parts):"";var S=r.parseHost(m,this._parts);if(S!=="/")throw new TypeError('Hostname "'+m+'" contains characters other than [A-Z0-9.-]');return this.build(!b),this},l.authority=function(m,b){if(this._parts.urn)return m===void 0?"":this;if(m===void 0)return this._parts.hostname?r.buildAuthority(this._parts):"";var S=r.parseAuthority(m,this._parts);if(S!=="/")throw new TypeError('Hostname "'+m+'" contains characters other than [A-Z0-9.-]');return this.build(!b),this},l.userinfo=function(m,b){if(this._parts.urn)return m===void 0?"":this;if(m===void 0){var S=r.buildUserinfo(this._parts);return S&&S.substring(0,S.length-1)}else return m[m.length-1]!=="@"&&(m+="@"),r.parseUserinfo(m,this._parts),this.build(!b),this},l.resource=function(m,b){var S;return m===void 0?this.path()+this.search()+this.hash():(S=r.parse(m),this._parts.path=S.path,this._parts.query=S.query,this._parts.fragment=S.fragment,this.build(!b),this)},l.subdomain=function(m,b){if(this._parts.urn)return m===void 0?"":this;if(m===void 0){if(!this._parts.hostname||this.is("IP"))return"";var S=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,S)||""}else{var L=this._parts.hostname.length-this.domain().length,N=this._parts.hostname.substring(0,L),j=new RegExp("^"+h(N));if(m&&m.charAt(m.length-1)!=="."&&(m+="."),m.indexOf(":")!==-1)throw new TypeError("Domains cannot contain colons");return m&&r.ensureValidHostname(m,this._parts.protocol),this._parts.hostname=this._parts.hostname.replace(j,m),this.build(!b),this}},l.domain=function(m,b){if(this._parts.urn)return m===void 0?"":this;if(typeof m=="boolean"&&(b=m,m=void 0),m===void 0){if(!this._parts.hostname||this.is("IP"))return"";var S=this._parts.hostname.match(/\./g);if(S&&S.length<2)return this._parts.hostname;var L=this._parts.hostname.length-this.tld(b).length-1;return L=this._parts.hostname.lastIndexOf(".",L-1)+1,this._parts.hostname.substring(L)||""}else{if(!m)throw new TypeError("cannot set domain empty");if(m.indexOf(":")!==-1)throw new TypeError("Domains cannot contain colons");if(r.ensureValidHostname(m,this._parts.protocol),!this._parts.hostname||this.is("IP"))this._parts.hostname=m;else{var N=new RegExp(h(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(N,m)}return this.build(!b),this}},l.tld=function(m,b){if(this._parts.urn)return m===void 0?"":this;if(typeof m=="boolean"&&(b=m,m=void 0),m===void 0){if(!this._parts.hostname||this.is("IP"))return"";var S=this._parts.hostname.lastIndexOf("."),L=this._parts.hostname.substring(S+1);return b!==!0&&i&&i.list[L.toLowerCase()]&&i.get(this._parts.hostname)||L}else{var N;if(m)if(m.match(/[^a-zA-Z0-9-]/))if(i&&i.is(m))N=new RegExp(h(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(N,m);else throw new TypeError('TLD "'+m+'" contains characters other than [A-Z0-9]');else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");N=new RegExp(h(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(N,m)}else throw new TypeError("cannot set TLD empty");return this.build(!b),this}},l.directory=function(m,b){if(this._parts.urn)return m===void 0?"":this;if(m===void 0||m===!0){if(!this._parts.path&&!this._parts.hostname)return"";if(this._parts.path==="/")return"/";var S=this._parts.path.length-this.filename().length-1,L=this._parts.path.substring(0,S)||(this._parts.hostname?"/":"");return m?r.decodePath(L):L}else{var N=this._parts.path.length-this.filename().length,j=this._parts.path.substring(0,N),U=new RegExp("^"+h(j));return this.is("relative")||(m||(m="/"),m.charAt(0)!=="/"&&(m="/"+m)),m&&m.charAt(m.length-1)!=="/"&&(m+="/"),m=r.recodePath(m),this._parts.path=this._parts.path.replace(U,m),this.build(!b),this}},l.filename=function(m,b){if(this._parts.urn)return m===void 0?"":this;if(typeof m!="string"){if(!this._parts.path||this._parts.path==="/")return"";var S=this._parts.path.lastIndexOf("/"),L=this._parts.path.substring(S+1);return m?r.decodePathSegment(L):L}else{var N=!1;m.charAt(0)==="/"&&(m=m.substring(1)),m.match(/\.?\//)&&(N=!0);var j=new RegExp(h(this.filename())+"$");return m=r.recodePath(m),this._parts.path=this._parts.path.replace(j,m),N?this.normalizePath(b):this.build(!b),this}},l.suffix=function(m,b){if(this._parts.urn)return m===void 0?"":this;if(m===void 0||m===!0){if(!this._parts.path||this._parts.path==="/")return"";var S=this.filename(),L=S.lastIndexOf("."),N,j;return L===-1?"":(N=S.substring(L+1),j=/^[a-z0-9%]+$/i.test(N)?N:"",m?r.decodePathSegment(j):j)}else{m.charAt(0)==="."&&(m=m.substring(1));var U=this.suffix(),B;if(U)m?B=new RegExp(h(U)+"$"):B=new RegExp(h("."+U)+"$");else{if(!m)return this;this._parts.path+="."+r.recodePath(m)}return B&&(m=r.recodePath(m),this._parts.path=this._parts.path.replace(B,m)),this.build(!b),this}},l.segment=function(m,b,S){var L=this._parts.urn?":":"/",N=this.path(),j=N.substring(0,1)==="/",U=N.split(L);if(m!==void 0&&typeof m!="number"&&(S=b,b=m,m=void 0),m!==void 0&&typeof m!="number")throw new Error('Bad segment "'+m+'", must be 0-based integer');if(j&&U.shift(),m<0&&(m=Math.max(U.length+m,0)),b===void 0)return m===void 0?U:U[m];if(m===null||U[m]===void 0)if(d(b)){U=[];for(var B=0,Z=b.length;B<Z;B++)!b[B].length&&(!U.length||!U[U.length-1].length)||(U.length&&!U[U.length-1].length&&U.pop(),U.push(v(b[B])))}else(b||typeof b=="string")&&(b=v(b),U[U.length-1]===""?U[U.length-1]=b:U.push(b));else b?U[m]=v(b):U.splice(m,1);return j&&U.unshift(""),this.path(U.join(L),S)},l.segmentCoded=function(m,b,S){var L,N,j;if(typeof m!="number"&&(S=b,b=m,m=void 0),b===void 0){if(L=this.segment(m,b,S),!d(L))L=L!==void 0?r.decode(L):void 0;else for(N=0,j=L.length;N<j;N++)L[N]=r.decode(L[N]);return L}if(!d(b))b=typeof b=="string"||b instanceof String?r.encode(b):b;else for(N=0,j=b.length;N<j;N++)b[N]=r.encode(b[N]);return this.segment(m,b,S)};var Y=l.query;return l.query=function(m,b){if(m===!0)return r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if(typeof m=="function"){var S=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace),L=m.call(this,S);return this._parts.query=r.buildQuery(L||S,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!b),this}else return m!==void 0&&typeof m!="string"?(this._parts.query=r.buildQuery(m,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!b),this):Y.call(this,m,b)},l.setQuery=function(m,b,S){var L=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if(typeof m=="string"||m instanceof String)L[m]=b!==void 0?b:null;else if(typeof m=="object")for(var N in m)c.call(m,N)&&(L[N]=m[N]);else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");return this._parts.query=r.buildQuery(L,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof m!="string"&&(S=b),this.build(!S),this},l.addQuery=function(m,b,S){var L=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return r.addQuery(L,m,b===void 0?null:b),this._parts.query=r.buildQuery(L,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof m!="string"&&(S=b),this.build(!S),this},l.removeQuery=function(m,b,S){var L=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return r.removeQuery(L,m,b),this._parts.query=r.buildQuery(L,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof m!="string"&&(S=b),this.build(!S),this},l.hasQuery=function(m,b,S){var L=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return r.hasQuery(L,m,b,S)},l.setSearch=l.setQuery,l.addSearch=l.addQuery,l.removeSearch=l.removeQuery,l.hasSearch=l.hasQuery,l.normalize=function(){return this._parts.urn?this.normalizeProtocol(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build():this.normalizeProtocol(!1).normalizeHostname(!1).normalizePort(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build()},l.normalizeProtocol=function(m){return typeof this._parts.protocol=="string"&&(this._parts.protocol=this._parts.protocol.toLowerCase(),this.build(!m)),this},l.normalizeHostname=function(m){return this._parts.hostname&&(this.is("IDN")&&e?this._parts.hostname=e.toASCII(this._parts.hostname):this.is("IPv6")&&t&&(this._parts.hostname=t.best(this._parts.hostname)),this._parts.hostname=this._parts.hostname.toLowerCase(),this.build(!m)),this},l.normalizePort=function(m){return typeof this._parts.protocol=="string"&&this._parts.port===r.defaultPorts[this._parts.protocol]&&(this._parts.port=null,this.build(!m)),this},l.normalizePath=function(m){var b=this._parts.path;if(!b)return this;if(this._parts.urn)return this._parts.path=r.recodeUrnPath(this._parts.path),this.build(!m),this;if(this._parts.path==="/")return this;b=r.recodePath(b);var S,L="",N,j;for(b.charAt(0)!=="/"&&(S=!0,b="/"+b),(b.slice(-3)==="/.."||b.slice(-2)==="/.")&&(b+="/"),b=b.replace(/(\/(\.\/)+)|(\/\.$)/g,"/").replace(/\/{2,}/g,"/"),S&&(L=b.substring(1).match(/^(\.\.\/)+/)||"",L&&(L=L[0]));N=b.search(/\/\.\.(\/|$)/),N!==-1;){if(N===0){b=b.substring(3);continue}j=b.substring(0,N).lastIndexOf("/"),j===-1&&(j=N),b=b.substring(0,j)+b.substring(N+3)}return S&&this.is("relative")&&(b=L+b.substring(1)),this._parts.path=b,this.build(!m),this},l.normalizePathname=l.normalizePath,l.normalizeQuery=function(m){return typeof this._parts.query=="string"&&(this._parts.query.length?this.query(r.parseQuery(this._parts.query,this._parts.escapeQuerySpace)):this._parts.query=null,this.build(!m)),this},l.normalizeFragment=function(m){return this._parts.fragment||(this._parts.fragment=null,this.build(!m)),this},l.normalizeSearch=l.normalizeQuery,l.normalizeHash=l.normalizeFragment,l.iso8859=function(){var m=r.encode,b=r.decode;r.encode=escape,r.decode=decodeURIComponent;try{this.normalize()}finally{r.encode=m,r.decode=b}return this},l.unicode=function(){var m=r.encode,b=r.decode;r.encode=w,r.decode=unescape;try{this.normalize()}finally{r.encode=m,r.decode=b}return this},l.readable=function(){var m=this.clone();m.username("").password("").normalize();var b="";if(m._parts.protocol&&(b+=m._parts.protocol+"://"),m._parts.hostname&&(m.is("punycode")&&e?(b+=e.toUnicode(m._parts.hostname),m._parts.port&&(b+=":"+m._parts.port)):b+=m.host()),m._parts.hostname&&m._parts.path&&m._parts.path.charAt(0)!=="/"&&(b+="/"),b+=m.path(!0),m._parts.query){for(var S="",L=0,N=m._parts.query.split("&"),j=N.length;L<j;L++){var U=(N[L]||"").split("=");S+="&"+r.decodeQuery(U[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"),U[1]!==void 0&&(S+="="+r.decodeQuery(U[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}b+="?"+S.substring(1)}return b+=r.decodeQuery(m.hash(),!0),b},l.absoluteTo=function(m){var b=this.clone(),S=["protocol","username","password","hostname","port"],L,N,j;if(this._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(m instanceof r||(m=new r(m)),b._parts.protocol||(b._parts.protocol=m._parts.protocol,this._parts.hostname))return b;for(N=0;j=S[N];N++)b._parts[j]=m._parts[j];return b._parts.path?(b._parts.path.substring(-2)===".."&&(b._parts.path+="/"),b.path().charAt(0)!=="/"&&(L=m.directory(),L=L||(m.path().indexOf("/")===0?"/":""),b._parts.path=(L?L+"/":"")+b._parts.path,b.normalizePath())):(b._parts.path=m._parts.path,b._parts.query||(b._parts.query=m._parts.query)),b.build(),b},l.relativeTo=function(m){var b=this.clone().normalize(),S,L,N,j,U;if(b._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(m=new r(m).normalize(),S=b._parts,L=m._parts,j=b.path(),U=m.path(),j.charAt(0)!=="/")throw new Error("URI is already relative");if(U.charAt(0)!=="/")throw new Error("Cannot calculate a URI relative to another relative URI");if(S.protocol===L.protocol&&(S.protocol=null),S.username!==L.username||S.password!==L.password||S.protocol!==null||S.username!==null||S.password!==null)return b.build();if(S.hostname===L.hostname&&S.port===L.port)S.hostname=null,S.port=null;else return b.build();if(j===U)return S.path="",b.build();if(N=r.commonPath(j,U),!N)return b.build();var B=L.path.substring(N.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../");return S.path=B+S.path.substring(N.length)||"./",b.build()},l.equals=function(m){var b=this.clone(),S=new r(m),L={},N={},j={},U,B,Z;if(b.normalize(),S.normalize(),b.toString()===S.toString())return!0;if(U=b.query(),B=S.query(),b.query(""),S.query(""),b.toString()!==S.toString()||U.length!==B.length)return!1;L=r.parseQuery(U,this._parts.escapeQuerySpace),N=r.parseQuery(B,this._parts.escapeQuerySpace);for(Z in L)if(c.call(L,Z)){if(d(L[Z])){if(!_(L[Z],N[Z]))return!1}else if(L[Z]!==N[Z])return!1;j[Z]=!0}for(Z in N)if(c.call(N,Z)&&!j[Z])return!1;return!0},l.preventInvalidHostname=function(m){return this._parts.preventInvalidHostname=!!m,this},l.duplicateQueryParameters=function(m){return this._parts.duplicateQueryParameters=!!m,this},l.escapeQuerySpace=function(m){return this._parts.escapeQuerySpace=!!m,this},r})})(ah)),ah.exports}var XP=HP();const Ms=My(XP);function YP(n){return(n.length===0||n[n.length-1]!=="/")&&(n=`${n}/`),n}function mr(n,e){if(n===null||typeof n!="object")return n;e=e??!1;const t=new n.constructor;for(const i in n)if(n.hasOwnProperty(i)){let s=n[i];e&&(s=mr(s,e)),t[i]=s}return t}function Ds(n,e,t){t=t??!1;const i={},s=x(n),o=x(e);let r,a,l;if(s)for(r in n)n.hasOwnProperty(r)&&(a=n[r],o&&t&&typeof a=="object"&&e.hasOwnProperty(r)?(l=e[r],typeof l=="object"?i[r]=Ds(a,l,t):i[r]=a):i[r]=a);if(o)for(r in e)e.hasOwnProperty(r)&&!i.hasOwnProperty(r)&&(l=e[r],i[r]=l);return i}function Va(){let n,e;const t=new Promise(function(i,s){n=i,e=s});return{resolve:n,reject:e,promise:t}}function Ba(n,e){let t;return typeof document<"u"&&(t=document),Ba._implementation(n,e,t)}Ba._implementation=function(n,e,t){if(!x(n))throw new $("relative uri is required.");if(!x(e)){if(typeof t>"u")return n;e=t.baseURI??t.location.href}const i=new Ms(n);return i.scheme()!==""?i.toString():i.absoluteTo(e).toString()};function ZP(n,e){if(!x(n))throw new $("uri is required.");let t="";const i=n.lastIndexOf("/");return i!==-1&&(t=n.substring(0,i+1)),e&&(n=new Ms(n),n.query().length!==0&&(t+=`?${n.query()}`),n.fragment().length!==0&&(t+=`#${n.fragment()}`)),t}function KP(n){if(!x(n))throw new $("uri is required.");const e=new Ms(n);e.normalize();let t=e.path(),i=t.lastIndexOf("/");return i!==-1&&(t=t.substr(i+1)),i=t.lastIndexOf("."),i===-1?t="":t=t.substr(i+1),t}const l_={};function c_(n,e,t){x(e)||(e=n.width),x(t)||(t=n.height);let i=l_[e];x(i)||(i={},l_[e]=i);let s=i[t];if(!x(s)){const o=document.createElement("canvas");o.width=e,o.height=t,s=o.getContext("2d",{willReadFrequently:!0}),s.globalCompositeOperation="copy",i[t]=s}return s.drawImage(n,0,0,e,t),s.getImageData(0,0,e,t).data}const QP=/^blob:/i;function h_(n){return y.typeOf.string("uri",n),QP.test(n)}let wi;function JP(n){x(wi)||(wi=document.createElement("a")),wi.href=window.location.href;const e=wi.host,t=wi.protocol;return wi.href=n,wi.href=wi.href,t!==wi.protocol||e!==wi.host}const eS=/^data:/i;function u_(n){return y.typeOf.string("uri",n),eS.test(n)}function tS(n){const e=document.createElement("script");return e.async=!0,e.src=n,new Promise((t,i)=>{window.crossOriginIsolated&&e.setAttribute("crossorigin","anonymous");const s=document.getElementsByTagName("head")[0];e.onload=function(){e.onload=void 0,s.removeChild(e),t()},e.onerror=function(o){i(o)},s.appendChild(e)})}function nS(n){if(!x(n))throw new $("obj is required.");let e="";for(const t in n)if(n.hasOwnProperty(t)){const i=n[t],s=`${encodeURIComponent(t)}=`;if(Array.isArray(i))for(let o=0,r=i.length;o<r;++o)e+=`${s+encodeURIComponent(i[o])}&`;else e+=`${s+encodeURIComponent(i)}&`}return e=e.slice(0,-1),e}function iS(n){if(!x(n))throw new $("queryString is required.");const e={};if(n==="")return e;const t=n.replace(/\+/g,"%20").split(/[&;]/);for(let i=0,s=t.length;i<s;++i){const o=t[i].split("="),r=decodeURIComponent(o[0]);let a=o[1];x(a)?a=decodeURIComponent(a):a="";const l=e[r];typeof l=="string"?e[r]=[l,a]:Array.isArray(l)?l.push(a):e[r]=a}return e}const bt=Object.freeze({UNISSUED:0,ISSUED:1,ACTIVE:2,RECEIVED:3,CANCELLED:4,FAILED:5}),sS=Object.freeze({TERRAIN:0,IMAGERY:1,TILES3D:2,OTHER:3});function hh(n){n=n??_i.EMPTY_OBJECT;const e=n.throttleByServer??!1,t=n.throttle??!1;this.url=n.url,this.requestFunction=n.requestFunction,this.cancelFunction=n.cancelFunction,this.priorityFunction=n.priorityFunction,this.priority=n.priority??0,this.throttle=t,this.throttleByServer=e,this.type=n.type??sS.OTHER,this.serverKey=n.serverKey,this.state=bt.UNISSUED,this.deferred=void 0,this.cancelled=!1}hh.prototype.cancel=function(){this.cancelled=!0},hh.prototype.clone=function(n){return x(n)?(n.url=this.url,n.requestFunction=this.requestFunction,n.cancelFunction=this.cancelFunction,n.priorityFunction=this.priorityFunction,n.priority=this.priority,n.throttle=this.throttle,n.throttleByServer=this.throttleByServer,n.type=this.type,n.serverKey=this.serverKey,n.state=bt.UNISSUED,n.deferred=void 0,n.cancelled=!1,n):new hh(this)};function oS(n){const e={};if(!n)return e;const t=n.split(`\r
69
+ `);for(let i=0;i<t.length;++i){const s=t[i],o=s.indexOf(": ");if(o>0){const r=s.substring(0,o),a=s.substring(o+2);e[r]=a}}return e}function $a(n,e,t){this.statusCode=n,this.response=e,this.responseHeaders=t,typeof this.responseHeaders=="string"&&(this.responseHeaders=oS(this.responseHeaders))}$a.prototype.toString=function(){let n="Request has failed.";return x(this.statusCode)&&(n+=` Status Code: ${this.statusCode}`),n};function Ha(){this._listeners=new Map,this._toRemove=new Map,this._toAdd=new Map,this._invokingListeners=!1,this._listenerCount=0}Object.defineProperties(Ha.prototype,{numberOfListeners:{get:function(){return this._listenerCount}}}),Ha.prototype.addEventListener=function(n,e){y.typeOf.func("listener",n);const t=this,i=t._invokingListeners?t._toAdd:t._listeners;return Tf(this,i,n,e)&&t._listenerCount++,function(){t.removeEventListener(n,e)}};function Tf(n,e,t,i){e.has(t)||e.set(t,new Set);const s=e.get(t);return s.has(i)?!1:(s.add(i),!0)}Ha.prototype.removeEventListener=function(n,e){y.typeOf.func("listener",n);const t=If(this,this._listeners,n,e),i=If(this,this._toAdd,n,e),s=t||i;return s&&this._listenerCount--,s};function If(n,e,t,i){const s=e.get(t);if(!s||!s.has(i))return!1;if(n._invokingListeners){if(!Tf(n,n._toRemove,t,i))return!1}else s.delete(i),s.size===0&&e.delete(t);return!0}Ha.prototype.raiseEvent=function(){this._invokingListeners=!0;for(const[n,e]of this._listeners.entries())if(x(n))for(const t of e)n.apply(t,arguments);this._invokingListeners=!1;for(const[n,e]of this._toAdd.entries())for(const t of e)Tf(this,this._listeners,n,t);this._toAdd.clear();for(const[n,e]of this._toRemove.entries())for(const t of e)If(this,this._listeners,n,t);this._toRemove.clear()};function yo(n){y.typeOf.object("options",n),y.defined("options.comparator",n.comparator),this._comparator=n.comparator,this._array=[],this._length=0,this._maximumLength=void 0}Object.defineProperties(yo.prototype,{length:{get:function(){return this._length}},internalArray:{get:function(){return this._array}},maximumLength:{get:function(){return this._maximumLength},set:function(n){y.typeOf.number.greaterThanOrEquals("maximumLength",n,0);const e=this._length;if(n<e){const t=this._array;for(let i=n;i<e;++i)t[i]=void 0;this._length=n,t.length=n}this._maximumLength=n}},comparator:{get:function(){return this._comparator}}});function Of(n,e,t){const i=n[e];n[e]=n[t],n[t]=i}yo.prototype.reserve=function(n){n=n??this._length,this._array.length=n},yo.prototype.heapify=function(n){n=n??0;const e=this._length,t=this._comparator,i=this._array;let s=-1,o=!0;for(;o;){const r=2*(n+1),a=r-1;a<e&&t(i[a],i[n])<0?s=a:s=n,r<e&&t(i[r],i[s])<0&&(s=r),s!==n?(Of(i,s,n),n=s):o=!1}},yo.prototype.resort=function(){const n=this._length;for(let e=Math.ceil(n/2);e>=0;--e)this.heapify(e)},yo.prototype.insert=function(n){y.defined("element",n);const e=this._array,t=this._comparator,i=this._maximumLength;let s=this._length++;for(s<e.length?e[s]=n:e.push(n);s!==0;){const r=Math.floor((s-1)/2);if(t(e[s],e[r])<0)Of(e,s,r),s=r;else break}let o;return x(i)&&this._length>i&&(o=e[i],this._length=i),o},yo.prototype.pop=function(n){if(n=n??0,this._length===0)return;y.typeOf.number.lessThan("index",n,this._length);const e=this._array,t=e[n];return Of(e,n,--this._length),this.heapify(n),e[this._length]=void 0,t};function rS(n,e){return n.priority-e.priority}const We={numberOfAttemptedRequests:0,numberOfActiveRequests:0,numberOfCancelledRequests:0,numberOfCancelledActiveRequests:0,numberOfFailedRequests:0,numberOfActiveRequestsEver:0,lastNumberOfActiveRequests:0};let yr=20;const Zt=new yo({comparator:rS});Zt.maximumLength=yr,Zt.reserve(yr);const vi=[];let Hi={};const aS=typeof document<"u"?new Ms(document.location.href):new Ms,uh=new Ha;function Je(){}Je.maximumRequests=50,Je.maximumRequestsPerServer=18,Je.requestsByServer={},Je.throttleRequests=!0,Je.debugShowStatistics=!1,Je.requestCompletedEvent=uh,Object.defineProperties(Je,{statistics:{get:function(){return We}},priorityHeapLength:{get:function(){return yr},set:function(n){if(n<yr)for(;Zt.length>n;){const e=Zt.pop();_o(e)}yr=n,Zt.maximumLength=n,Zt.reserve(n)}}});function d_(n){x(n.priorityFunction)&&(n.priority=n.priorityFunction())}Je.serverHasOpenSlots=function(n,e){e=e??1;const t=Je.requestsByServer[n]??Je.maximumRequestsPerServer;return Hi[n]+e<=t},Je.heapHasOpenSlots=function(n){return Zt.length+n<=yr};function f_(n){return n.state===bt.UNISSUED&&(n.state=bt.ISSUED,n.deferred=Va()),n.deferred.promise}function lS(n){return function(e){if(n.state===bt.CANCELLED)return;const t=n.deferred;--We.numberOfActiveRequests,--Hi[n.serverKey],uh.raiseEvent(),n.state=bt.RECEIVED,n.deferred=void 0,t.resolve(e)}}function cS(n){return function(e){n.state!==bt.CANCELLED&&(++We.numberOfFailedRequests,--We.numberOfActiveRequests,--Hi[n.serverKey],uh.raiseEvent(e),n.state=bt.FAILED,n.deferred.reject(e))}}function p_(n){const e=f_(n);return n.state=bt.ACTIVE,vi.push(n),++We.numberOfActiveRequests,++We.numberOfActiveRequestsEver,++Hi[n.serverKey],n.requestFunction().then(lS(n)).catch(cS(n)),e}function _o(n){const e=n.state===bt.ACTIVE;if(n.state=bt.CANCELLED,++We.numberOfCancelledRequests,x(n.deferred)){const t=n.deferred;n.deferred=void 0,t.reject()}e&&(--We.numberOfActiveRequests,--Hi[n.serverKey],++We.numberOfCancelledActiveRequests),x(n.cancelFunction)&&n.cancelFunction()}Je.update=function(){let n,e,t=0;const i=vi.length;for(n=0;n<i;++n){if(e=vi[n],e.cancelled&&_o(e),e.state!==bt.ACTIVE){++t;continue}t>0&&(vi[n-t]=e)}vi.length-=t;const s=Zt.internalArray,o=Zt.length;for(n=0;n<o;++n)d_(s[n]);Zt.resort();const r=Math.max(Je.maximumRequests-vi.length,0);let a=0;for(;a<r&&Zt.length>0;){if(e=Zt.pop(),e.cancelled){_o(e);continue}if(e.throttleByServer&&!Je.serverHasOpenSlots(e.serverKey)){_o(e);continue}p_(e),++a}hS()},Je.getServerKey=function(n){y.typeOf.string("url",n);let e=new Ms(n);e.scheme()===""&&(e=e.absoluteTo(aS),e.normalize());let t=e.authority();/:/.test(t)||(t=`${t}:${e.scheme()==="https"?"443":"80"}`);const i=Hi[t];return x(i)||(Hi[t]=0),t},Je.request=function(n){if(y.typeOf.object("request",n),y.typeOf.string("request.url",n.url),y.typeOf.func("request.requestFunction",n.requestFunction),u_(n.url)||h_(n.url))return uh.raiseEvent(),n.state=bt.RECEIVED,n.requestFunction();if(++We.numberOfAttemptedRequests,x(n.serverKey)||(n.serverKey=Je.getServerKey(n.url)),Je.throttleRequests&&n.throttleByServer&&!Je.serverHasOpenSlots(n.serverKey))return;if(!Je.throttleRequests||!n.throttle)return p_(n);if(vi.length>=Je.maximumRequests)return;d_(n);const e=Zt.insert(n);if(x(e)){if(e===n)return;_o(e)}return f_(n)};function hS(){Je.debugShowStatistics&&(We.numberOfActiveRequests===0&&We.lastNumberOfActiveRequests>0&&(We.numberOfAttemptedRequests>0&&(console.log(`Number of attempted requests: ${We.numberOfAttemptedRequests}`),We.numberOfAttemptedRequests=0),We.numberOfCancelledRequests>0&&(console.log(`Number of cancelled requests: ${We.numberOfCancelledRequests}`),We.numberOfCancelledRequests=0),We.numberOfCancelledActiveRequests>0&&(console.log(`Number of cancelled active requests: ${We.numberOfCancelledActiveRequests}`),We.numberOfCancelledActiveRequests=0),We.numberOfFailedRequests>0&&(console.log(`Number of failed requests: ${We.numberOfFailedRequests}`),We.numberOfFailedRequests=0)),We.lastNumberOfActiveRequests=We.numberOfActiveRequests)}Je.clearForSpecs=function(){for(;Zt.length>0;){const e=Zt.pop();_o(e)}const n=vi.length;for(let e=0;e<n;++e)_o(vi[e]);vi.length=0,Hi={},We.numberOfAttemptedRequests=0,We.numberOfActiveRequests=0,We.numberOfCancelledRequests=0,We.numberOfCancelledActiveRequests=0,We.numberOfFailedRequests=0,We.numberOfActiveRequestsEver=0,We.lastNumberOfActiveRequests=0},Je.numberOfActiveRequestsByServer=function(n){return Hi[n]},Je.requestHeap=Zt;const _r={};let wr={};_r.add=function(n,e){if(!x(n))throw new $("host is required.");if(!x(e)||e<=0)throw new $("port is required to be greater than 0.");const t=`${n.toLowerCase()}:${e}`;x(wr[t])||(wr[t]=!0)},_r.remove=function(n,e){if(!x(n))throw new $("host is required.");if(!x(e)||e<=0)throw new $("port is required to be greater than 0.");const t=`${n.toLowerCase()}:${e}`;x(wr[t])&&delete wr[t]};function uS(n){const e=new Ms(n);e.normalize();let t=e.authority();if(t.length!==0){if(e.authority(t),t.indexOf("@")!==-1&&(t=t.split("@")[1]),t.indexOf(":")===-1){let i=e.scheme();if(i.length===0&&(i=window.location.protocol,i=i.substring(0,i.length-1)),i==="http")t+=":80";else if(i==="https")t+=":443";else return}return t}}_r.contains=function(n){if(!x(n))throw new $("url is required.");const e=uS(n);return!!(x(e)&&x(wr[e]))},_r.clear=function(){wr={}};const g_=(function(){try{const n=new XMLHttpRequest;return n.open("GET","#",!0),n.responseType="blob",n.responseType==="blob"}catch{return!1}})();function te(n){n=n??_i.EMPTY_OBJECT,typeof n=="string"&&(n={url:n}),y.typeOf.string("options.url",n.url),this._url=void 0,this._templateValues=bi(n.templateValues,{}),this._queryParameters=bi(n.queryParameters,{}),this.headers=bi(n.headers,{}),this.request=n.request??new hh,this.proxy=n.proxy,this.retryCallback=n.retryCallback,this.retryAttempts=n.retryAttempts??0,this._retryCount=0,n.parseUrl??!0?this.parseUrl(n.url,!0,!0):this._url=n.url,this._credits=n.credits}function bi(n,e){return x(n)?mr(n):e}te.createIfNeeded=function(n){return n instanceof te?n.getDerivedResource({request:n.request}):typeof n!="string"?n:new te({url:n})};let vr;te.supportsImageBitmapOptions=function(){return x(vr)?vr:typeof createImageBitmap!="function"?(vr=Promise.resolve(!1),vr):(vr=te.fetchBlob({url:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAABGdBTUEAAE4g3rEiDgAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADElEQVQI12Ng6GAAAAEUAIngE3ZiAAAAAElFTkSuQmCC"}).then(function(e){const t={imageOrientation:"flipY",premultiplyAlpha:"none",colorSpaceConversion:"none"};return Promise.all([createImageBitmap(e,t),createImageBitmap(e)])}).then(function(e){const t=c_(e[0]),i=c_(e[1]);return t[1]!==i[1]}).catch(function(){return!1}),vr)},Object.defineProperties(te,{isBlobSupported:{get:function(){return g_}}}),Object.defineProperties(te.prototype,{queryParameters:{get:function(){return this._queryParameters}},templateValues:{get:function(){return this._templateValues}},url:{get:function(){return this.getUrlComponent(!0,!0)},set:function(n){this.parseUrl(n,!1,!1)}},extension:{get:function(){return KP(this._url)}},isDataUri:{get:function(){return u_(this._url)}},isBlobUri:{get:function(){return h_(this._url)}},isCrossOriginUrl:{get:function(){return JP(this._url)}},hasHeaders:{get:function(){return Object.keys(this.headers).length>0}},credits:{get:function(){return this._credits}}}),te.prototype.toString=function(){return this.getUrlComponent(!0,!0)},te.prototype.parseUrl=function(n,e,t,i){let s=new Ms(n);const o=dS(s.query());this._queryParameters=e?dh(o,this.queryParameters,t):o,s.search(""),s.fragment(""),x(i)&&s.scheme()===""&&(s=s.absoluteTo(Ba(i))),this._url=s.toString()};function dS(n){return n.length===0?{}:n.indexOf("=")===-1?{[n]:void 0}:iS(n)}function dh(n,e,t){if(!t)return Ds(n,e);const i=mr(n,!0);for(const s in e)if(e.hasOwnProperty(s)){let o=i[s];const r=e[s];x(o)?(Array.isArray(o)||(o=i[s]=[o]),i[s]=o.concat(r)):i[s]=Array.isArray(r)?r.slice():r}return i}te.prototype.getUrlComponent=function(n,e){if(this.isDataUri)return this._url;let t=this._url;n&&(t=`${t}${fS(this.queryParameters)}`),t=t.replace(/%7B/g,"{").replace(/%7D/g,"}");const i=this._templateValues;return Object.keys(i).length>0&&(t=t.replace(/{(.*?)}/g,function(s,o){const r=i[o];return x(r)?encodeURIComponent(r):s})),e&&x(this.proxy)&&(t=this.proxy.getURL(t)),t};function fS(n){const e=Object.keys(n);return e.length===0?"":e.length===1&&!x(n[e[0]])?`?${e[0]}`:`?${nS(n)}`}te.prototype.setQueryParameters=function(n,e){e?this._queryParameters=dh(this._queryParameters,n,!1):this._queryParameters=dh(n,this._queryParameters,!1)},te.prototype.appendQueryParameters=function(n){this._queryParameters=dh(n,this._queryParameters,!0)},te.prototype.setTemplateValues=function(n,e){e?this._templateValues=Ds(this._templateValues,n):this._templateValues=Ds(n,this._templateValues)},te.prototype.getDerivedResource=function(n){const e=this.clone();if(e._retryCount=0,x(n.url)){const t=n.preserveQueryParameters??!1;e.parseUrl(n.url,!0,t,this._url)}return x(n.queryParameters)&&(e._queryParameters=Ds(n.queryParameters,e.queryParameters)),x(n.templateValues)&&(e._templateValues=Ds(n.templateValues,e.templateValues)),x(n.headers)&&(e.headers=Ds(n.headers,e.headers)),x(n.proxy)&&(e.proxy=n.proxy),x(n.request)&&(e.request=n.request),x(n.retryCallback)&&(e.retryCallback=n.retryCallback),x(n.retryAttempts)&&(e.retryAttempts=n.retryAttempts),e},te.prototype.retryOnError=function(n){const e=this.retryCallback;if(typeof e!="function"||this._retryCount>=this.retryAttempts)return Promise.resolve(!1);const t=this;return Promise.resolve(e(this,n)).then(function(i){return++t._retryCount,i})},te.prototype.clone=function(n){return x(n)?(n._url=this._url,n._queryParameters=mr(this._queryParameters),n._templateValues=mr(this._templateValues),n.headers=mr(this.headers),n.proxy=this.proxy,n.retryCallback=this.retryCallback,n.retryAttempts=this.retryAttempts,n._retryCount=0,n.request=this.request.clone(),n):new te({url:this._url,queryParameters:this.queryParameters,templateValues:this.templateValues,headers:this.headers,proxy:this.proxy,retryCallback:this.retryCallback,retryAttempts:this.retryAttempts,request:this.request.clone(),parseUrl:!1,credits:x(this.credits)?this.credits.slice():void 0})},te.prototype.getBaseUri=function(n){return ZP(this.getUrlComponent(n),n)},te.prototype.appendForwardSlash=function(){this._url=YP(this._url)},te.prototype.fetchArrayBuffer=function(){return this.fetch({responseType:"arraybuffer"})},te.fetchArrayBuffer=function(n){return new te(n).fetchArrayBuffer()},te.prototype.fetchBlob=function(){return this.fetch({responseType:"blob"})},te.fetchBlob=function(n){return new te(n).fetchBlob()},te.prototype.fetchImage=function(n){n=n??_i.EMPTY_OBJECT;const e=n.preferImageBitmap??!1,t=n.preferBlob??!1,i=n.flipY??!1,s=n.skipColorSpaceConversion??!1;if(Af(this.request),!g_||this.isDataUri||this.isBlobUri||!this.hasHeaders&&!t)return this._fetchImage({resource:this,flipY:i,skipColorSpaceConversion:s,preferImageBitmap:e});const o=this.fetchBlob();if(!x(o))return;let r,a,l,c;return te.supportsImageBitmapOptions().then(function(h){return r=h,a=r&&e,o}).then(function(h){if(!x(h))return;if(c=h,a)return te.createImageBitmapFromBlob(h,{flipY:i,premultiplyAlpha:!1,skipColorSpaceConversion:s});const u=window.URL.createObjectURL(h);return l=new te({url:u}),l._fetchImage({flipY:i,skipColorSpaceConversion:s,preferImageBitmap:!1})}).then(function(h){if(x(h))return h.blob=c,a||window.URL.revokeObjectURL(l.url),h}).catch(function(h){return x(l)&&window.URL.revokeObjectURL(l.url),h.blob=c,Promise.reject(h)})},te.prototype._fetchImage=function(n){const e=this,t=n.flipY,i=n.skipColorSpaceConversion,s=n.preferImageBitmap,o=e.request;o.url=e.url,o.requestFunction=function(){let a=!1;!e.isDataUri&&!e.isBlobUri&&(a=e.isCrossOriginUrl);const l=Va();return te._Implementations.createImage(o,a,l,t,i,s),l.promise};const r=Je.request(o);if(x(r))return r.catch(function(a){return o.state!==bt.FAILED?Promise.reject(a):e.retryOnError(a).then(function(l){return l?(o.state=bt.UNISSUED,o.deferred=void 0,e._fetchImage({flipY:t,skipColorSpaceConversion:i,preferImageBitmap:s})):Promise.reject(a)})})},te.fetchImage=function(n){return new te(n).fetchImage({flipY:n.flipY,skipColorSpaceConversion:n.skipColorSpaceConversion,preferBlob:n.preferBlob,preferImageBitmap:n.preferImageBitmap})},te.prototype.fetchText=function(){return this.fetch({responseType:"text"})},te.fetchText=function(n){return new te(n).fetchText()},te.prototype.fetchJson=function(){const n=this.fetch({responseType:"text",headers:{Accept:"application/json,*/*;q=0.01"}});if(x(n))return n.then(function(e){if(x(e))return JSON.parse(e)})},te.fetchJson=function(n){return new te(n).fetchJson()},te.prototype.fetchXML=function(){return this.fetch({responseType:"document",overrideMimeType:"text/xml"})},te.fetchXML=function(n){return new te(n).fetchXML()},te.prototype.fetchJsonp=function(n){n=n??"callback",Af(this.request);let e;do e=`loadJsonp${F.nextRandomNumber().toString().substring(2,8)}`;while(x(window[e]));return m_(this,n,e)};function m_(n,e,t){const i={};i[e]=t,n.setQueryParameters(i);const s=n.request,o=n.url;s.url=o,s.requestFunction=function(){const a=Va();return window[t]=function(l){a.resolve(l);try{delete window[t]}catch{window[t]=void 0}},te._Implementations.loadAndExecuteScript(o,t,a),a.promise};const r=Je.request(s);if(x(r))return r.catch(function(a){return s.state!==bt.FAILED?Promise.reject(a):n.retryOnError(a).then(function(l){return l?(s.state=bt.UNISSUED,s.deferred=void 0,m_(n,e,t)):Promise.reject(a)})})}te.fetchJsonp=function(n){return new te(n).fetchJsonp(n.callbackParameterName)},te.prototype._makeRequest=function(n){const e=this;Af(e.request);const t=e.request,i=e.url;t.url=i,t.requestFunction=function(){const o=n.responseType,r=Ds(n.headers,e.headers),a=n.overrideMimeType,l=n.method,c=n.data,h=Va(),u=te._Implementations.loadWithXhr(i,o,l,c,r,h,a);return x(u)&&x(u.abort)&&(t.cancelFunction=function(){u.abort()}),h.promise};const s=Je.request(t);if(x(s))return s.then(function(o){return t.cancelFunction=void 0,o}).catch(function(o){return t.cancelFunction=void 0,t.state!==bt.FAILED?Promise.reject(o):e.retryOnError(o).then(function(r){return r?(t.state=bt.UNISSUED,t.deferred=void 0,e.fetch(n)):Promise.reject(o)})})};function Af(n){if(n.state===bt.ISSUED||n.state===bt.ACTIVE)throw new Fn("The Resource is already being fetched.");n.state=bt.UNISSUED,n.deferred=void 0}const pS=/^data:(.*?)(;base64)?,(.*)$/;function fh(n,e){const t=decodeURIComponent(e);return n?atob(t):t}function y_(n,e){const t=fh(n,e),i=new ArrayBuffer(t.length),s=new Uint8Array(i);for(let o=0;o<t.length;o++)s[o]=t.charCodeAt(o);return i}function gS(n,e){e=e??"";const t=n[1],i=!!n[2],s=n[3];let o,r;switch(e){case"":case"text":return fh(i,s);case"arraybuffer":return y_(i,s);case"blob":return o=y_(i,s),new Blob([o],{type:t});case"document":return r=new DOMParser,r.parseFromString(fh(i,s),t);case"json":return JSON.parse(fh(i,s));default:throw new $(`Unhandled responseType: ${e}`)}}te.prototype.fetch=function(n){return n=bi(n,{}),n.method="GET",this._makeRequest(n)},te.fetch=function(n){return new te(n).fetch({responseType:n.responseType,overrideMimeType:n.overrideMimeType})},te.prototype.delete=function(n){return n=bi(n,{}),n.method="DELETE",this._makeRequest(n)},te.delete=function(n){return new te(n).delete({responseType:n.responseType,overrideMimeType:n.overrideMimeType,data:n.data})},te.prototype.head=function(n){return n=bi(n,{}),n.method="HEAD",this._makeRequest(n)},te.head=function(n){return new te(n).head({responseType:n.responseType,overrideMimeType:n.overrideMimeType})},te.prototype.options=function(n){return n=bi(n,{}),n.method="OPTIONS",this._makeRequest(n)},te.options=function(n){return new te(n).options({responseType:n.responseType,overrideMimeType:n.overrideMimeType})},te.prototype.post=function(n,e){return y.defined("data",n),e=bi(e,{}),e.method="POST",e.data=n,this._makeRequest(e)},te.post=function(n){return new te(n).post(n.data,{responseType:n.responseType,overrideMimeType:n.overrideMimeType})},te.prototype.put=function(n,e){return y.defined("data",n),e=bi(e,{}),e.method="PUT",e.data=n,this._makeRequest(e)},te.put=function(n){return new te(n).put(n.data,{responseType:n.responseType,overrideMimeType:n.overrideMimeType})},te.prototype.patch=function(n,e){return y.defined("data",n),e=bi(e,{}),e.method="PATCH",e.data=n,this._makeRequest(e)},te.patch=function(n){return new te(n).patch(n.data,{responseType:n.responseType,overrideMimeType:n.overrideMimeType})},te._Implementations={},te._Implementations.loadImageElement=function(n,e,t){const i=new Image;i.onload=function(){i.naturalWidth===0&&i.naturalHeight===0&&i.width===0&&i.height===0&&(i.width=300,i.height=150),t.resolve(i)},i.onerror=function(s){t.reject(s)},e&&(_r.contains(n)?i.crossOrigin="use-credentials":i.crossOrigin=""),i.src=n},te._Implementations.createImage=function(n,e,t,i,s,o,r){const a=n.url;te.supportsImageBitmapOptions().then(function(l){if(!(l&&o)){te._Implementations.loadImageElement(a,e,t);return}const c="blob",h="GET",u=Va(),d=te._Implementations.loadWithXhr(a,c,h,void 0,r,u,void 0,void 0,void 0);return x(d)&&x(d.abort)&&(n.cancelFunction=function(){d.abort()}),u.promise.then(function(f){if(!x(f)){t.reject(new Fn(`Successfully retrieved ${a} but it contained no content.`));return}return te.createImageBitmapFromBlob(f,{flipY:i,premultiplyAlpha:!1,skipColorSpaceConversion:s})}).then(function(f){t.resolve(f)})}).catch(function(l){t.reject(l)})},te.createImageBitmapFromBlob=function(n,e){return y.defined("options",e),y.typeOf.bool("options.flipY",e.flipY),y.typeOf.bool("options.premultiplyAlpha",e.premultiplyAlpha),y.typeOf.bool("options.skipColorSpaceConversion",e.skipColorSpaceConversion),createImageBitmap(n,{imageOrientation:e.flipY?"flipY":"none",premultiplyAlpha:e.premultiplyAlpha?"premultiply":"none",colorSpaceConversion:e.skipColorSpaceConversion?"none":"default"})};function mS(n,e,t,i,s,o,r){fetch(n,{method:t,headers:s}).then(async a=>{if(!a.ok){const l={};a.headers.forEach((c,h)=>{l[h]=c}),o.reject(new $a(a.status,a,l));return}switch(e){case"text":o.resolve(a.text());break;case"json":o.resolve(a.json());break;default:o.resolve(new Uint8Array(await a.arrayBuffer()).buffer);break}}).catch(()=>{o.reject(new $a)})}const yS=typeof XMLHttpRequest>"u";te._Implementations.loadWithXhr=function(n,e,t,i,s,o,r){const a=pS.exec(n);if(a!==null){o.resolve(gS(a,e));return}if(yS){mS(n,e,t,i,s,o);return}const l=new XMLHttpRequest;if(_r.contains(n)&&(l.withCredentials=!0),l.open(t,n,!0),x(r)&&x(l.overrideMimeType)&&l.overrideMimeType(r),x(s))for(const h in s)s.hasOwnProperty(h)&&l.setRequestHeader(h,s[h]);x(e)&&(l.responseType=e);let c=!1;return typeof n=="string"&&(c=n.indexOf("file://")===0||typeof window<"u"&&window.location.origin==="file://"),l.onload=function(){if((l.status<200||l.status>=300)&&!(c&&l.status===0)){o.reject(new $a(l.status,l.response,l.getAllResponseHeaders()));return}const h=l.response,u=l.responseType;if(t==="HEAD"||t==="OPTIONS"){const f=l.getAllResponseHeaders().trim().split(/[\r\n]+/),g={};f.forEach(function(_){const v=_.split(": "),E=v.shift();g[E]=v.join(": ")}),o.resolve(g);return}if(l.status===204)o.resolve(void 0);else if(x(h)&&(!x(e)||u===e))o.resolve(h);else if(e==="json"&&typeof h=="string")try{o.resolve(JSON.parse(h))}catch(d){o.reject(d)}else(u===""||u==="document")&&x(l.responseXML)&&l.responseXML.hasChildNodes()?o.resolve(l.responseXML):(u===""||u==="text")&&x(l.responseText)?o.resolve(l.responseText):o.reject(new Fn("Invalid XMLHttpRequest response type."))},l.onerror=function(h){o.reject(new $a)},l.send(i),l},te._Implementations.loadAndExecuteScript=function(n,e,t){return tS(n).catch(function(i){t.reject(i)})},te._DefaultImplementations={},te._DefaultImplementations.createImage=te._Implementations.createImage,te._DefaultImplementations.loadWithXhr=te._Implementations.loadWithXhr,te._DefaultImplementations.loadAndExecuteScript=te._Implementations.loadAndExecuteScript,te.DEFAULT=Object.freeze(new te({url:typeof document>"u"?"":document.location.href.split("?")[0]}));function Xa(n){n=n??_i.EMPTY_OBJECT,this._dates=void 0,this._samples=void 0,this._dateColumn=-1,this._xPoleWanderRadiansColumn=-1,this._yPoleWanderRadiansColumn=-1,this._ut1MinusUtcSecondsColumn=-1,this._xCelestialPoleOffsetRadiansColumn=-1,this._yCelestialPoleOffsetRadiansColumn=-1,this._taiMinusUtcSecondsColumn=-1,this._columnCount=0,this._lastIndex=-1,this._addNewLeapSeconds=n.addNewLeapSeconds??!0,x(n.data)?__(this,n.data):__(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})}Xa.fromUrl=async function(n,e){y.defined("url",n),e=e??_i.EMPTY_OBJECT;const t=te.createIfNeeded(n);let i;try{i=await t.fetchJson()}catch{throw new Fn(`An error occurred while retrieving the EOP data from the URL ${t.url}.`)}return new Xa({addNewLeapSeconds:e.addNewLeapSeconds,data:i})},Xa.NONE=Object.freeze({compute:function(n,e){return x(e)?(e.xPoleWander=0,e.yPoleWander=0,e.xPoleOffset=0,e.yPoleOffset=0,e.ut1MinusUtc=0):e=new Ef(0,0,0,0,0),e}}),Xa.prototype.compute=function(n,e){if(!x(this._samples))return;if(x(e)||(e=new Ef(0,0,0,0,0)),this._samples.length===0)return e.xPoleWander=0,e.yPoleWander=0,e.xPoleOffset=0,e.yPoleOffset=0,e.ut1MinusUtc=0,e;const t=this._dates,i=this._lastIndex;let s=0,o=0;if(x(i)){const a=t[i],l=t[i+1],c=J.lessThanOrEquals(a,n),h=!x(l),u=h||J.greaterThanOrEquals(l,n);if(c&&u)return s=i,!h&&l.equals(n)&&++s,o=s+1,v_(this,t,this._samples,n,s,o,e),e}let r=qa(t,n,J.compare,this._dateColumn);return r>=0?(r<t.length-1&&t[r+1].equals(n)&&++r,s=r,o=r):(o=~r,s=o-1,s<0&&(s=0)),this._lastIndex=s,v_(this,t,this._samples,n,s,o,e),e};function _S(n,e){return J.compare(n.julianDate,e)}function __(n,e){if(!x(e.columnNames))throw new Fn("Error in loaded EOP data: The columnNames property is required.");if(!x(e.samples))throw new Fn("Error in loaded EOP data: The samples property is required.");const t=e.columnNames.indexOf("modifiedJulianDateUtc"),i=e.columnNames.indexOf("xPoleWanderRadians"),s=e.columnNames.indexOf("yPoleWanderRadians"),o=e.columnNames.indexOf("ut1MinusUtcSeconds"),r=e.columnNames.indexOf("xCelestialPoleOffsetRadians"),a=e.columnNames.indexOf("yCelestialPoleOffsetRadians"),l=e.columnNames.indexOf("taiMinusUtcSeconds");if(t<0||i<0||s<0||o<0||r<0||a<0||l<0)throw new Fn("Error in loaded EOP data: The columnNames property must include modifiedJulianDateUtc, xPoleWanderRadians, yPoleWanderRadians, ut1MinusUtcSeconds, xCelestialPoleOffsetRadians, yCelestialPoleOffsetRadians, and taiMinusUtcSeconds columns");const c=n._samples=e.samples,h=n._dates=[];n._dateColumn=t,n._xPoleWanderRadiansColumn=i,n._yPoleWanderRadiansColumn=s,n._ut1MinusUtcSecondsColumn=o,n._xCelestialPoleOffsetRadiansColumn=r,n._yCelestialPoleOffsetRadiansColumn=a,n._taiMinusUtcSecondsColumn=l,n._columnCount=e.columnNames.length,n._lastIndex=void 0;let u;const d=n._addNewLeapSeconds;for(let f=0,g=c.length;f<g;f+=n._columnCount){const _=c[f+t],v=c[f+l],E=_+ut.MODIFIED_JULIAN_DATE_DIFFERENCE,w=new J(E,v,ze.TAI);if(h.push(w),d){if(v!==u&&x(u)){const C=J.leapSeconds,P=qa(C,w,_S);if(P<0){const R=new Ye(w,v);C.splice(~P,0,R)}}u=v}}}function w_(n,e,t,i,s){const o=t*i;s.xPoleWander=e[o+n._xPoleWanderRadiansColumn],s.yPoleWander=e[o+n._yPoleWanderRadiansColumn],s.xPoleOffset=e[o+n._xCelestialPoleOffsetRadiansColumn],s.yPoleOffset=e[o+n._yCelestialPoleOffsetRadiansColumn],s.ut1MinusUtc=e[o+n._ut1MinusUtcSecondsColumn]}function Ya(n,e,t){return e+n*(t-e)}function v_(n,e,t,i,s,o,r){const a=n._columnCount;if(o>e.length-1)return r.xPoleWander=0,r.yPoleWander=0,r.xPoleOffset=0,r.yPoleOffset=0,r.ut1MinusUtc=0,r;const l=e[s],c=e[o];if(l.equals(c)||i.equals(l))return w_(n,t,s,a,r),r;if(i.equals(c))return w_(n,t,o,a,r),r;const h=J.secondsDifference(i,l)/J.secondsDifference(c,l),u=s*a,d=o*a;let f=t[u+n._ut1MinusUtcSecondsColumn],g=t[d+n._ut1MinusUtcSecondsColumn];const _=g-f;if(_>.5||_<-.5){const v=t[u+n._taiMinusUtcSecondsColumn],E=t[d+n._taiMinusUtcSecondsColumn];v!==E&&(c.equals(i)?f=g:g-=E-v)}return r.xPoleWander=Ya(h,t[u+n._xPoleWanderRadiansColumn],t[d+n._xPoleWanderRadiansColumn]),r.yPoleWander=Ya(h,t[u+n._yPoleWanderRadiansColumn],t[d+n._yPoleWanderRadiansColumn]),r.xPoleOffset=Ya(h,t[u+n._xCelestialPoleOffsetRadiansColumn],t[d+n._xCelestialPoleOffsetRadiansColumn]),r.yPoleOffset=Ya(h,t[u+n._yCelestialPoleOffsetRadiansColumn],t[d+n._yCelestialPoleOffsetRadiansColumn]),r.ut1MinusUtc=Ya(h,f,g),r}function Rt(n,e,t){this.heading=n??0,this.pitch=e??0,this.roll=t??0}Rt.fromQuaternion=function(n,e){if(!x(n))throw new $("quaternion is required");x(e)||(e=new Rt);const t=2*(n.w*n.y-n.z*n.x),i=1-2*(n.x*n.x+n.y*n.y),s=2*(n.w*n.x+n.y*n.z),o=1-2*(n.y*n.y+n.z*n.z),r=2*(n.w*n.z+n.x*n.y);return e.heading=-Math.atan2(r,o),e.roll=Math.atan2(s,i),e.pitch=-F.asinClamped(t),e},Rt.fromDegrees=function(n,e,t,i){if(!x(n))throw new $("heading is required");if(!x(e))throw new $("pitch is required");if(!x(t))throw new $("roll is required");return x(i)||(i=new Rt),i.heading=n*F.RADIANS_PER_DEGREE,i.pitch=e*F.RADIANS_PER_DEGREE,i.roll=t*F.RADIANS_PER_DEGREE,i},Rt.clone=function(n,e){if(x(n))return x(e)?(e.heading=n.heading,e.pitch=n.pitch,e.roll=n.roll,e):new Rt(n.heading,n.pitch,n.roll)},Rt.equals=function(n,e){return n===e||x(n)&&x(e)&&n.heading===e.heading&&n.pitch===e.pitch&&n.roll===e.roll},Rt.equalsEpsilon=function(n,e,t,i){return n===e||x(n)&&x(e)&&F.equalsEpsilon(n.heading,e.heading,t,i)&&F.equalsEpsilon(n.pitch,e.pitch,t,i)&&F.equalsEpsilon(n.roll,e.roll,t,i)},Rt.prototype.clone=function(n){return Rt.clone(this,n)},Rt.prototype.equals=function(n){return Rt.equals(this,n)},Rt.prototype.equalsEpsilon=function(n,e,t){return Rt.equalsEpsilon(this,n,e,t)},Rt.prototype.toString=function(){return`(${this.heading}, ${this.pitch}, ${this.roll})`};const b_=/((?:.*\/)|^)Cesium\.js(?:\?|\#|$)/;function wS(){const n=document.getElementsByTagName("script");for(let e=0,t=n.length;e<t;++e){const i=n[e].getAttribute("src"),s=b_.exec(i);if(s!==null)return s[1]}}let ph;function E_(n){return typeof document>"u"?n:(x(ph)||(ph=document.createElement("a")),ph.href=n,ph.href)}let wo;function C_(){if(x(wo))return wo;let n;if(typeof CESIUM_BASE_URL<"u"?n=CESIUM_BASE_URL:x(qo&&qo.tagName.toUpperCase()==="SCRIPT"&&qo.src||new URL("earthsdk3-ol.iife.js",document.baseURI).href)?n=Ba(".",qo&&qo.tagName.toUpperCase()==="SCRIPT"&&qo.src||new URL("earthsdk3-ol.iife.js",document.baseURI).href):typeof define=="object"&&x(define.amd)&&!define.amd.toUrlUndefined&&x(require.toUrl)?n=Ba("..",vo("Core/buildModuleUrl.js")):n=wS(),!x(n))throw new $("Unable to determine Cesium base URL automatically, try defining a global variable called CESIUM_BASE_URL.");return wo=new te({url:E_(n)}),wo.appendForwardSlash(),wo}function vS(n){return E_(require.toUrl(`../${n}`))}function x_(n){return C_().getDerivedResource({url:n}).url}let gh;function vo(n){return x(gh)||(typeof define=="object"&&x(define.amd)&&!define.amd.toUrlUndefined&&x(require.toUrl)?gh=vS:gh=x_),gh(n)}vo._cesiumScriptRegex=b_,vo._buildModuleUrlFromBaseUrl=x_,vo._clearBaseResource=function(){wo=void 0},vo.setBaseUrl=function(n){wo=te.DEFAULT.getDerivedResource({url:n})},vo.getCesiumBaseUrl=C_;function P_(n,e,t){this.x=n,this.y=e,this.s=t}function Mf(n){n=n??_i.EMPTY_OBJECT,this._xysFileUrlTemplate=te.createIfNeeded(n.xysFileUrlTemplate),this._interpolationOrder=n.interpolationOrder??9,this._sampleZeroJulianEphemerisDate=n.sampleZeroJulianEphemerisDate??24423965e-1,this._sampleZeroDateTT=new J(this._sampleZeroJulianEphemerisDate,0,ze.TAI),this._stepSizeDays=n.stepSizeDays??1,this._samplesPerXysFile=n.samplesPerXysFile??1e3,this._totalSamples=n.totalSamples??27426,this._samples=new Array(this._totalSamples*3),this._chunkDownloadsInProgress=[];const e=this._interpolationOrder,t=this._denominators=new Array(e+1),i=this._xTable=new Array(e+1),s=Math.pow(this._stepSizeDays,e);for(let o=0;o<=e;++o){t[o]=s,i[o]=o*this._stepSizeDays;for(let r=0;r<=e;++r)r!==o&&(t[o]*=o-r);t[o]=1/t[o]}this._work=new Array(e+1),this._coef=new Array(e+1)}const bS=new J(0,0,ze.TAI);function Df(n,e,t){const i=bS;return i.dayNumber=e,i.secondsOfDay=t,J.daysDifference(i,n._sampleZeroDateTT)}Mf.prototype.preload=function(n,e,t,i){const s=Df(this,n,e),o=Df(this,t,i);let r=s/this._stepSizeDays-this._interpolationOrder/2|0;r<0&&(r=0);let a=o/this._stepSizeDays-this._interpolationOrder/2|0+this._interpolationOrder;a>=this._totalSamples&&(a=this._totalSamples-1);const l=r/this._samplesPerXysFile|0,c=a/this._samplesPerXysFile|0,h=[];for(let u=l;u<=c;++u)h.push(Ff(this,u));return Promise.all(h)},Mf.prototype.computeXysRadians=function(n,e,t){const i=Df(this,n,e);if(i<0)return;const s=i/this._stepSizeDays|0;if(s>=this._totalSamples)return;const o=this._interpolationOrder;let r=s-(o/2|0);r<0&&(r=0);let a=r+o;a>=this._totalSamples&&(a=this._totalSamples-1,r=a-o,r<0&&(r=0));let l=!1;const c=this._samples;if(x(c[r*3])||(Ff(this,r/this._samplesPerXysFile|0),l=!0),x(c[a*3])||(Ff(this,a/this._samplesPerXysFile|0),l=!0),l)return;x(t)?(t.x=0,t.y=0,t.s=0):t=new P_(0,0,0);const h=i-r*this._stepSizeDays,u=this._work,d=this._denominators,f=this._coef,g=this._xTable;let _,v;for(_=0;_<=o;++_)u[_]=h-g[_];for(_=0;_<=o;++_){for(f[_]=1,v=0;v<=o;++v)v!==_&&(f[_]*=u[v]);f[_]*=d[_];let E=(r+_)*3;t.x+=f[_]*c[E++],t.y+=f[_]*c[E++],t.s+=f[_]*c[E]}return t};function Ff(n,e){if(n._chunkDownloadsInProgress[e])return n._chunkDownloadsInProgress[e];let t;const i=n._xysFileUrlTemplate;x(i)?t=i.getDerivedResource({templateValues:{0:e}}):t=new te({url:vo(`Assets/IAU2006_XYS/IAU2006_XYS_${e}.json`)});const s=t.fetchJson().then(function(o){n._chunkDownloadsInProgress[e]=!1;const r=n._samples,a=o.samples,l=e*n._samplesPerXysFile*3;for(let c=0,h=a.length;c<h;++c)r[l+c]=a[c]});return n._chunkDownloadsInProgress[e]=s,s}function K(n,e,t,i){this.x=n??0,this.y=e??0,this.z=t??0,this.w=i??0}let Za=new D;K.fromAxisAngle=function(n,e,t){y.typeOf.object("axis",n),y.typeOf.number("angle",e);const i=e/2,s=Math.sin(i);Za=D.normalize(n,Za);const o=Za.x*s,r=Za.y*s,a=Za.z*s,l=Math.cos(i);return x(t)?(t.x=o,t.y=r,t.z=a,t.w=l,t):new K(o,r,a,l)};const ES=[1,2,0],CS=new Array(3);K.fromRotationMatrix=function(n,e){y.typeOf.object("matrix",n);let t,i,s,o,r;const a=n[H.COLUMN0ROW0],l=n[H.COLUMN1ROW1],c=n[H.COLUMN2ROW2],h=a+l+c;if(h>0)t=Math.sqrt(h+1),r=.5*t,t=.5/t,i=(n[H.COLUMN1ROW2]-n[H.COLUMN2ROW1])*t,s=(n[H.COLUMN2ROW0]-n[H.COLUMN0ROW2])*t,o=(n[H.COLUMN0ROW1]-n[H.COLUMN1ROW0])*t;else{const u=ES;let d=0;l>a&&(d=1),c>a&&c>l&&(d=2);const f=u[d],g=u[f];t=Math.sqrt(n[H.getElementIndex(d,d)]-n[H.getElementIndex(f,f)]-n[H.getElementIndex(g,g)]+1);const _=CS;_[d]=.5*t,t=.5/t,r=(n[H.getElementIndex(g,f)]-n[H.getElementIndex(f,g)])*t,_[f]=(n[H.getElementIndex(f,d)]+n[H.getElementIndex(d,f)])*t,_[g]=(n[H.getElementIndex(g,d)]+n[H.getElementIndex(d,g)])*t,i=-_[0],s=-_[1],o=-_[2]}return x(e)?(e.x=i,e.y=s,e.z=o,e.w=r,e):new K(i,s,o,r)};const S_=new K;let R_=new K,Lf=new K,T_=new K;K.fromHeadingPitchRoll=function(n,e){return y.typeOf.object("headingPitchRoll",n),T_=K.fromAxisAngle(D.UNIT_X,n.roll,S_),Lf=K.fromAxisAngle(D.UNIT_Y,-n.pitch,e),e=K.multiply(Lf,T_,Lf),R_=K.fromAxisAngle(D.UNIT_Z,-n.heading,S_),K.multiply(R_,e,e)};const mh=new D,zf=new D,ei=new K,I_=new K,yh=new K;K.packedLength=4,K.pack=function(n,e,t){return y.typeOf.object("value",n),y.defined("array",e),t=t??0,e[t++]=n.x,e[t++]=n.y,e[t++]=n.z,e[t]=n.w,e},K.unpack=function(n,e,t){return y.defined("array",n),e=e??0,x(t)||(t=new K),t.x=n[e],t.y=n[e+1],t.z=n[e+2],t.w=n[e+3],t},K.packedInterpolationLength=3,K.convertPackedArrayForInterpolation=function(n,e,t,i){K.unpack(n,t*4,yh),K.conjugate(yh,yh);for(let s=0,o=t-e+1;s<o;s++){const r=s*3;K.unpack(n,(e+s)*4,ei),K.multiply(ei,yh,ei),ei.w<0&&K.negate(ei,ei),K.computeAxis(ei,mh);const a=K.computeAngle(ei);x(i)||(i=[]),i[r]=mh.x*a,i[r+1]=mh.y*a,i[r+2]=mh.z*a}},K.unpackInterpolationResult=function(n,e,t,i,s){x(s)||(s=new K),D.fromArray(n,0,zf);const o=D.magnitude(zf);return K.unpack(e,i*4,I_),o===0?K.clone(K.IDENTITY,ei):K.fromAxisAngle(zf,o,ei),K.multiply(ei,I_,s)},K.clone=function(n,e){if(x(n))return x(e)?(e.x=n.x,e.y=n.y,e.z=n.z,e.w=n.w,e):new K(n.x,n.y,n.z,n.w)},K.conjugate=function(n,e){return y.typeOf.object("quaternion",n),y.typeOf.object("result",e),e.x=-n.x,e.y=-n.y,e.z=-n.z,e.w=n.w,e},K.magnitudeSquared=function(n){return y.typeOf.object("quaternion",n),n.x*n.x+n.y*n.y+n.z*n.z+n.w*n.w},K.magnitude=function(n){return Math.sqrt(K.magnitudeSquared(n))},K.normalize=function(n,e){y.typeOf.object("result",e);const t=1/K.magnitude(n),i=n.x*t,s=n.y*t,o=n.z*t,r=n.w*t;return e.x=i,e.y=s,e.z=o,e.w=r,e},K.inverse=function(n,e){y.typeOf.object("result",e);const t=K.magnitudeSquared(n);return e=K.conjugate(n,e),K.multiplyByScalar(e,1/t,e)},K.add=function(n,e,t){return y.typeOf.object("left",n),y.typeOf.object("right",e),y.typeOf.object("result",t),t.x=n.x+e.x,t.y=n.y+e.y,t.z=n.z+e.z,t.w=n.w+e.w,t},K.subtract=function(n,e,t){return y.typeOf.object("left",n),y.typeOf.object("right",e),y.typeOf.object("result",t),t.x=n.x-e.x,t.y=n.y-e.y,t.z=n.z-e.z,t.w=n.w-e.w,t},K.negate=function(n,e){return y.typeOf.object("quaternion",n),y.typeOf.object("result",e),e.x=-n.x,e.y=-n.y,e.z=-n.z,e.w=-n.w,e},K.dot=function(n,e){return y.typeOf.object("left",n),y.typeOf.object("right",e),n.x*e.x+n.y*e.y+n.z*e.z+n.w*e.w},K.multiply=function(n,e,t){y.typeOf.object("left",n),y.typeOf.object("right",e),y.typeOf.object("result",t);const i=n.x,s=n.y,o=n.z,r=n.w,a=e.x,l=e.y,c=e.z,h=e.w,u=r*a+i*h+s*c-o*l,d=r*l-i*c+s*h+o*a,f=r*c+i*l-s*a+o*h,g=r*h-i*a-s*l-o*c;return t.x=u,t.y=d,t.z=f,t.w=g,t},K.multiplyByScalar=function(n,e,t){return y.typeOf.object("quaternion",n),y.typeOf.number("scalar",e),y.typeOf.object("result",t),t.x=n.x*e,t.y=n.y*e,t.z=n.z*e,t.w=n.w*e,t},K.divideByScalar=function(n,e,t){return y.typeOf.object("quaternion",n),y.typeOf.number("scalar",e),y.typeOf.object("result",t),t.x=n.x/e,t.y=n.y/e,t.z=n.z/e,t.w=n.w/e,t},K.computeAxis=function(n,e){y.typeOf.object("quaternion",n),y.typeOf.object("result",e);const t=n.w;if(Math.abs(t-1)<F.EPSILON6||Math.abs(t+1)<F.EPSILON6)return e.x=1,e.y=e.z=0,e;const i=1/Math.sqrt(1-t*t);return e.x=n.x*i,e.y=n.y*i,e.z=n.z*i,e},K.computeAngle=function(n){return y.typeOf.object("quaternion",n),Math.abs(n.w-1)<F.EPSILON6?0:2*Math.acos(n.w)};let Nf=new K;K.lerp=function(n,e,t,i){return y.typeOf.object("start",n),y.typeOf.object("end",e),y.typeOf.number("t",t),y.typeOf.object("result",i),Nf=K.multiplyByScalar(e,t,Nf),i=K.multiplyByScalar(n,1-t,i),K.add(Nf,i,i)};let O_=new K,kf=new K,jf=new K;K.slerp=function(n,e,t,i){y.typeOf.object("start",n),y.typeOf.object("end",e),y.typeOf.number("t",t),y.typeOf.object("result",i);let s=K.dot(n,e),o=e;if(s<0&&(s=-s,o=O_=K.negate(e,O_)),1-s<F.EPSILON6)return K.lerp(n,o,t,i);const r=Math.acos(s);return kf=K.multiplyByScalar(n,Math.sin((1-t)*r),kf),jf=K.multiplyByScalar(o,Math.sin(t*r),jf),i=K.add(kf,jf,i),K.multiplyByScalar(i,1/Math.sin(r),i)},K.log=function(n,e){y.typeOf.object("quaternion",n),y.typeOf.object("result",e);const t=F.acosClamped(n.w);let i=0;return t!==0&&(i=t/Math.sin(t)),D.multiplyByScalar(n,i,e)},K.exp=function(n,e){y.typeOf.object("cartesian",n),y.typeOf.object("result",e);const t=D.magnitude(n);let i=0;return t!==0&&(i=Math.sin(t)/t),e.x=n.x*i,e.y=n.y*i,e.z=n.z*i,e.w=Math.cos(t),e};const xS=new D,PS=new D,Ka=new K,br=new K;K.computeInnerQuadrangle=function(n,e,t,i){y.typeOf.object("q0",n),y.typeOf.object("q1",e),y.typeOf.object("q2",t),y.typeOf.object("result",i);const s=K.conjugate(e,Ka);K.multiply(s,t,br);const o=K.log(br,xS);K.multiply(s,n,br);const r=K.log(br,PS);return D.add(o,r,o),D.multiplyByScalar(o,.25,o),D.negate(o,o),K.exp(o,Ka),K.multiply(e,Ka,i)},K.squad=function(n,e,t,i,s,o){y.typeOf.object("q0",n),y.typeOf.object("q1",e),y.typeOf.object("s0",t),y.typeOf.object("s1",i),y.typeOf.number("t",s),y.typeOf.object("result",o);const r=K.slerp(n,e,s,Ka),a=K.slerp(t,i,s,br);return K.slerp(r,a,2*s*(1-s),o)};const SS=new K,A_=1.9011074535173003,_h=Yt.supportsTypedArrays()?new Float32Array(8):[],wh=Yt.supportsTypedArrays()?new Float32Array(8):[],Xi=Yt.supportsTypedArrays()?new Float32Array(8):[],Yi=Yt.supportsTypedArrays()?new Float32Array(8):[];for(let n=0;n<7;++n){const e=n+1,t=2*e+1;_h[n]=1/(e*t),wh[n]=e/t}_h[7]=A_/136,wh[7]=A_*8/17,K.fastSlerp=function(n,e,t,i){y.typeOf.object("start",n),y.typeOf.object("end",e),y.typeOf.number("t",t),y.typeOf.object("result",i);let s=K.dot(n,e),o;s>=0?o=1:(o=-1,s=-s);const r=s-1,a=1-t,l=t*t,c=a*a;for(let f=7;f>=0;--f)Xi[f]=(_h[f]*l-wh[f])*r,Yi[f]=(_h[f]*c-wh[f])*r;const h=o*t*(1+Xi[0]*(1+Xi[1]*(1+Xi[2]*(1+Xi[3]*(1+Xi[4]*(1+Xi[5]*(1+Xi[6]*(1+Xi[7])))))))),u=a*(1+Yi[0]*(1+Yi[1]*(1+Yi[2]*(1+Yi[3]*(1+Yi[4]*(1+Yi[5]*(1+Yi[6]*(1+Yi[7])))))))),d=K.multiplyByScalar(n,u,SS);return K.multiplyByScalar(e,h,i),K.add(d,i,i)},K.fastSquad=function(n,e,t,i,s,o){y.typeOf.object("q0",n),y.typeOf.object("q1",e),y.typeOf.object("s0",t),y.typeOf.object("s1",i),y.typeOf.number("t",s),y.typeOf.object("result",o);const r=K.fastSlerp(n,e,s,Ka),a=K.fastSlerp(t,i,s,br);return K.fastSlerp(r,a,2*s*(1-s),o)},K.equals=function(n,e){return n===e||x(n)&&x(e)&&n.x===e.x&&n.y===e.y&&n.z===e.z&&n.w===e.w},K.equalsEpsilon=function(n,e,t){return t=t??0,n===e||x(n)&&x(e)&&Math.abs(n.x-e.x)<=t&&Math.abs(n.y-e.y)<=t&&Math.abs(n.z-e.z)<=t&&Math.abs(n.w-e.w)<=t},K.ZERO=Object.freeze(new K(0,0,0,0)),K.IDENTITY=Object.freeze(new K(0,0,0,1)),K.prototype.clone=function(n){return K.clone(this,n)},K.prototype.equals=function(n){return K.equals(this,n)},K.prototype.equalsEpsilon=function(n,e){return K.equalsEpsilon(this,n,e)},K.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z}, ${this.w})`};const xe={},Uf={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},Er={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},Gf={},dn={east:new D,north:new D,up:new D,west:new D,south:new D,down:new D};let Fs=new D,Ls=new D,zs=new D;xe.localFrameToFixedFrameGenerator=function(n,e){if(!Uf.hasOwnProperty(n)||!Uf[n].hasOwnProperty(e))throw new $("firstAxis and secondAxis must be east, north, up, west, south or down.");const t=Uf[n][e];let i;const s=n+e;return x(Gf[s])?i=Gf[s]:(i=function(o,r,a){if(!x(o))throw new $("origin is required.");if(isNaN(o.x)||isNaN(o.y)||isNaN(o.z))throw new $("origin has a NaN component");if(x(a)||(a=new W),D.equalsEpsilon(o,D.ZERO,F.EPSILON14))D.unpack(Er[n],0,Fs),D.unpack(Er[e],0,Ls),D.unpack(Er[t],0,zs);else if(F.equalsEpsilon(o.x,0,F.EPSILON14)&&F.equalsEpsilon(o.y,0,F.EPSILON14)){const l=F.sign(o.z);D.unpack(Er[n],0,Fs),n!=="east"&&n!=="west"&&D.multiplyByScalar(Fs,l,Fs),D.unpack(Er[e],0,Ls),e!=="east"&&e!=="west"&&D.multiplyByScalar(Ls,l,Ls),D.unpack(Er[t],0,zs),t!=="east"&&t!=="west"&&D.multiplyByScalar(zs,l,zs)}else{r=r??ve.default,r.geodeticSurfaceNormal(o,dn.up);const l=dn.up,c=dn.east;c.x=-o.y,c.y=o.x,c.z=0,D.normalize(c,dn.east),D.cross(l,c,dn.north),D.multiplyByScalar(dn.up,-1,dn.down),D.multiplyByScalar(dn.east,-1,dn.west),D.multiplyByScalar(dn.north,-1,dn.south),Fs=dn[n],Ls=dn[e],zs=dn[t]}return a[0]=Fs.x,a[1]=Fs.y,a[2]=Fs.z,a[3]=0,a[4]=Ls.x,a[5]=Ls.y,a[6]=Ls.z,a[7]=0,a[8]=zs.x,a[9]=zs.y,a[10]=zs.z,a[11]=0,a[12]=o.x,a[13]=o.y,a[14]=o.z,a[15]=1,a},Gf[s]=i),i},xe.eastNorthUpToFixedFrame=xe.localFrameToFixedFrameGenerator("east","north"),xe.northEastDownToFixedFrame=xe.localFrameToFixedFrameGenerator("north","east"),xe.northUpEastToFixedFrame=xe.localFrameToFixedFrameGenerator("north","up"),xe.northWestUpToFixedFrame=xe.localFrameToFixedFrameGenerator("north","west");const RS=new K,TS=new D(1,1,1),IS=new W;xe.headingPitchRollToFixedFrame=function(n,e,t,i,s){y.typeOf.object("HeadingPitchRoll",e),i=i??xe.eastNorthUpToFixedFrame;const o=K.fromHeadingPitchRoll(e,RS),r=W.fromTranslationQuaternionRotationScale(D.ZERO,o,TS,IS);return s=i(n,t,s),W.multiply(s,r,s)};const OS=new W,AS=new H;xe.headingPitchRollQuaternion=function(n,e,t,i,s){y.typeOf.object("HeadingPitchRoll",e);const o=xe.headingPitchRollToFixedFrame(n,e,t,i,OS),r=W.getMatrix3(o,AS);return K.fromRotationMatrix(r,s)};const MS=new D(1,1,1),DS=new D,M_=new W,FS=new W,LS=new H,zS=new K;xe.fixedFrameToHeadingPitchRoll=function(n,e,t,i){y.defined("transform",n),e=e??ve.default,t=t??xe.eastNorthUpToFixedFrame,x(i)||(i=new Rt);const s=W.getTranslation(n,DS);if(D.equals(s,D.ZERO))return i.heading=0,i.pitch=0,i.roll=0,i;let o=W.inverseTransformation(t(s,e,M_),M_),r=W.setScale(n,MS,FS);r=W.setTranslation(r,D.ZERO,r),o=W.multiply(o,r,o);let a=K.fromRotationMatrix(W.getMatrix3(o,LS),zS);return a=K.normalize(a,a),Rt.fromQuaternion(a,i)};const NS=6*3600+2460+50.54841,kS=8640184812866e-6,jS=.093104,US=-62e-7,GS=11772758384668e-32,qS=72921158553e-15,WS=F.TWO_PI/86400;let vh=new J;xe.computeIcrfToCentralBodyFixedMatrix=function(n,e){let t=xe.computeIcrfToFixedMatrix(n,e);return x(t)||(t=xe.computeTemeToPseudoFixedMatrix(n,e)),t},xe.computeTemeToPseudoFixedMatrix=function(n,e){if(!x(n))throw new $("date is required.");vh=J.addSeconds(n,-J.computeTaiMinusUtc(n),vh);const t=vh.dayNumber,i=vh.secondsOfDay;let s;const o=t-2451545;i>=43200?s=(o+.5)/ut.DAYS_PER_JULIAN_CENTURY:s=(o-.5)/ut.DAYS_PER_JULIAN_CENTURY;const a=(NS+s*(kS+s*(jS+s*US)))*WS%F.TWO_PI,l=qS+GS*(t-24515455e-1),c=(i+ut.SECONDS_PER_DAY*.5)%ut.SECONDS_PER_DAY,h=a+l*c,u=Math.cos(h),d=Math.sin(h);return x(e)?(e[0]=u,e[1]=-d,e[2]=0,e[3]=d,e[4]=u,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e):new H(u,d,0,-d,u,0,0,0,1)},xe.iau2006XysData=new Mf,xe.earthOrientationParameters=Xa.NONE;const qf=32.184,VS=2451545;xe.preloadIcrfFixed=function(n){const e=n.start.dayNumber,t=n.start.secondsOfDay+qf,i=n.stop.dayNumber,s=n.stop.secondsOfDay+qf;return xe.iau2006XysData.preload(e,t,i,s)},xe.computeIcrfToFixedMatrix=function(n,e){if(!x(n))throw new $("date is required.");x(e)||(e=new H);const t=xe.computeFixedToIcrfMatrix(n,e);if(x(t))return H.transpose(t,e)};const BS=32.184,$S=2451545,bh=new Rt,HS=new H,XS=new J;xe.computeMoonFixedToIcrfMatrix=function(n,e){if(!x(n))throw new $("date is required.");const t=J.addSeconds(n,BS,XS),i=J.totalDays(t)-$S,s=F.toRadians(12.112)-F.toRadians(.052992)*i,o=F.toRadians(24.224)-F.toRadians(.105984)*i,r=F.toRadians(227.645)+F.toRadians(13.012)*i,a=F.toRadians(261.105)+F.toRadians(13.340716)*i,l=F.toRadians(358)+F.toRadians(.9856)*i;return bh.pitch=F.toRadians(180)-F.toRadians(3.878)*Math.sin(s)-F.toRadians(.12)*Math.sin(o)+F.toRadians(.07)*Math.sin(r)-F.toRadians(.017)*Math.sin(a),bh.roll=F.toRadians(-23.47)+F.toRadians(1.543)*Math.cos(s)+F.toRadians(.24)*Math.cos(o)-F.toRadians(.028)*Math.cos(r)+F.toRadians(.007)*Math.cos(a),bh.heading=F.toRadians(154.375)+F.toRadians(13.17635831)*i+F.toRadians(3.558)*Math.sin(s)+F.toRadians(.121)*Math.sin(o)-F.toRadians(.064)*Math.sin(r)+F.toRadians(.016)*Math.sin(a)+F.toRadians(.025)*Math.sin(l),H.fromHeadingPitchRoll(bh,HS)},xe.computeIcrfToMoonFixedMatrix=function(n,e){if(!x(n))throw new $("date is required.");x(e)||(e=new H);const t=xe.computeMoonFixedToIcrfMatrix(n,e);if(x(t))return H.transpose(t,e)};const YS=new P_(0,0,0),ZS=new Ef(0,0,0,0,0),Wf=new H,Vf=new H;xe.computeFixedToIcrfMatrix=function(n,e){if(!x(n))throw new $("date is required.");x(e)||(e=new H);const t=xe.earthOrientationParameters.compute(n,ZS);if(!x(t))return;const i=n.dayNumber,s=n.secondsOfDay+qf,o=xe.iau2006XysData.computeXysRadians(i,s,YS);if(!x(o))return;const r=o.x+t.xPoleOffset,a=o.y+t.yPoleOffset,l=1/(1+Math.sqrt(1-r*r-a*a)),c=Wf;c[0]=1-l*r*r,c[3]=-l*r*a,c[6]=r,c[1]=-l*r*a,c[4]=1-l*a*a,c[7]=a,c[2]=-r,c[5]=-a,c[8]=1-l*(r*r+a*a);const h=H.fromRotationZ(-o.s,Vf),u=H.multiply(c,h,Wf),d=n.dayNumber,f=n.secondsOfDay-J.computeTaiMinusUtc(n)+t.ut1MinusUtc,g=d-2451545,_=f/ut.SECONDS_PER_DAY;let v=.779057273264+_+.00273781191135448*(g+_);v=v%1*F.TWO_PI;const E=H.fromRotationZ(v,Vf),w=H.multiply(u,E,Wf),C=Math.cos(t.xPoleWander),P=Math.cos(t.yPoleWander),R=Math.sin(t.xPoleWander),A=Math.sin(t.yPoleWander);let O=i-VS+s/ut.SECONDS_PER_DAY;O/=36525;const M=-47e-6*O*F.RADIANS_PER_DEGREE/3600,z=Math.cos(M),k=Math.sin(M),q=Vf;return q[0]=C*z,q[1]=C*k,q[2]=R,q[3]=-P*k+A*R*z,q[4]=P*z+A*R*k,q[5]=-A*C,q[6]=-A*k-P*R*z,q[7]=A*z-P*R*k,q[8]=P*C,H.multiply(w,q,e)};const KS=new ce;xe.pointToWindowCoordinates=function(n,e,t,i){return i=xe.pointToGLWindowCoordinates(n,e,t,i),i.y=2*e[5]-i.y,i},xe.pointToGLWindowCoordinates=function(n,e,t,i){if(!x(n))throw new $("modelViewProjectionMatrix is required.");if(!x(e))throw new $("viewportTransformation is required.");if(!x(t))throw new $("point is required.");x(i)||(i=new me);const s=KS;return W.multiplyByVector(n,ce.fromElements(t.x,t.y,t.z,1,s),s),ce.multiplyByScalar(s,1/s.w,s),W.multiplyByVector(e,s,s),me.fromCartesian4(s,i)};const QS=new D,JS=new D,eR=new D;xe.rotationMatrixFromPositionVelocity=function(n,e,t,i){if(!x(n))throw new $("position is required.");if(!x(e))throw new $("velocity is required.");const s=(t??ve.default).geodeticSurfaceNormal(n,QS);let o=D.cross(e,s,JS);D.equalsEpsilon(o,D.ZERO,F.EPSILON6)&&(o=D.clone(D.UNIT_X,o));const r=D.cross(o,e,eR);return D.normalize(r,r),D.cross(e,r,o),D.negate(o,o),D.normalize(o,o),x(i)||(i=new H),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=o.x,i[4]=o.y,i[5]=o.z,i[6]=r.x,i[7]=r.y,i[8]=r.z,i},xe.SWIZZLE_3D_TO_2D_MATRIX=Object.freeze(new W(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1));const D_=new Oe,Bf=new D,tR=new D,nR=new H,$f=new W,F_=new W;xe.basisTo2D=function(n,e,t){if(!x(n))throw new $("projection is required.");if(!x(e))throw new $("matrix is required.");if(!x(t))throw new $("result is required.");const i=W.getTranslation(e,tR),s=n.ellipsoid;let o;if(D.equals(i,D.ZERO))o=D.clone(D.ZERO,Bf);else{const h=s.cartesianToCartographic(i,D_);o=n.project(h,Bf),D.fromElements(o.z,o.x,o.y,o)}const r=xe.eastNorthUpToFixedFrame(i,s,$f),a=W.inverseTransformation(r,F_),l=W.getMatrix3(e,nR),c=W.multiplyByMatrix3(a,l,t);return W.multiply(xe.SWIZZLE_3D_TO_2D_MATRIX,c,t),W.setTranslation(t,o,t),t},xe.ellipsoidTo2DModelMatrix=function(n,e,t){if(!x(n))throw new $("projection is required.");if(!x(e))throw new $("center is required.");if(!x(t))throw new $("result is required.");const i=n.ellipsoid,s=xe.eastNorthUpToFixedFrame(e,i,$f),o=W.inverseTransformation(s,F_),r=i.cartesianToCartographic(e,D_),a=n.project(r,Bf);D.fromElements(a.z,a.x,a.y,a);const l=W.fromTranslation(a,$f);return W.multiply(xe.SWIZZLE_3D_TO_2D_MATRIX,o,t),W.multiply(l,t,t),t};function ge(n,e,t,i){this.west=n??0,this.south=e??0,this.east=t??0,this.north=i??0}Object.defineProperties(ge.prototype,{width:{get:function(){return ge.computeWidth(this)}},height:{get:function(){return ge.computeHeight(this)}}}),ge.packedLength=4,ge.pack=function(n,e,t){return y.typeOf.object("value",n),y.defined("array",e),t=t??0,e[t++]=n.west,e[t++]=n.south,e[t++]=n.east,e[t]=n.north,e},ge.unpack=function(n,e,t){return y.defined("array",n),e=e??0,x(t)||(t=new ge),t.west=n[e++],t.south=n[e++],t.east=n[e++],t.north=n[e],t},ge.computeWidth=function(n){y.typeOf.object("rectangle",n);let e=n.east;const t=n.west;return e<t&&(e+=F.TWO_PI),e-t},ge.computeHeight=function(n){return y.typeOf.object("rectangle",n),n.north-n.south},ge.fromDegrees=function(n,e,t,i,s){return n=F.toRadians(n??0),e=F.toRadians(e??0),t=F.toRadians(t??0),i=F.toRadians(i??0),x(s)?(s.west=n,s.south=e,s.east=t,s.north=i,s):new ge(n,e,t,i)},ge.fromRadians=function(n,e,t,i,s){return x(s)?(s.west=n??0,s.south=e??0,s.east=t??0,s.north=i??0,s):new ge(n,e,t,i)},ge.fromCartographicArray=function(n,e){y.defined("cartographics",n);let t=Number.MAX_VALUE,i=-Number.MAX_VALUE,s=Number.MAX_VALUE,o=-Number.MAX_VALUE,r=Number.MAX_VALUE,a=-Number.MAX_VALUE;for(let l=0,c=n.length;l<c;l++){const h=n[l];t=Math.min(t,h.longitude),i=Math.max(i,h.longitude),r=Math.min(r,h.latitude),a=Math.max(a,h.latitude);const u=h.longitude>=0?h.longitude:h.longitude+F.TWO_PI;s=Math.min(s,u),o=Math.max(o,u)}return i-t>o-s&&(t=s,i=o,i>F.PI&&(i=i-F.TWO_PI),t>F.PI&&(t=t-F.TWO_PI)),x(e)?(e.west=t,e.south=r,e.east=i,e.north=a,e):new ge(t,r,i,a)},ge.fromCartesianArray=function(n,e,t){y.defined("cartesians",n),e=e??ve.default;let i=Number.MAX_VALUE,s=-Number.MAX_VALUE,o=Number.MAX_VALUE,r=-Number.MAX_VALUE,a=Number.MAX_VALUE,l=-Number.MAX_VALUE;for(let c=0,h=n.length;c<h;c++){const u=e.cartesianToCartographic(n[c]);i=Math.min(i,u.longitude),s=Math.max(s,u.longitude),a=Math.min(a,u.latitude),l=Math.max(l,u.latitude);const d=u.longitude>=0?u.longitude:u.longitude+F.TWO_PI;o=Math.min(o,d),r=Math.max(r,d)}return s-i>r-o&&(i=o,s=r,s>F.PI&&(s=s-F.TWO_PI),i>F.PI&&(i=i-F.TWO_PI)),x(t)?(t.west=i,t.south=a,t.east=s,t.north=l,t):new ge(i,a,s,l)};const iR=new D,sR=new D,oR=new D,rR=new D,aR=new D,Hf=new Array(5);for(let n=0;n<Hf.length;++n)Hf[n]=new D;ge.fromBoundingSphere=function(n,e,t){y.typeOf.object("boundingSphere",n);const i=n.center,s=n.radius;if(x(e)||(e=ve.default),x(t)||(t=new ge),D.equals(i,D.ZERO))return ge.clone(ge.MAX_VALUE,t),t;const o=xe.eastNorthUpToFixedFrame(i,e,iR),r=W.multiplyByPointAsVector(o,D.UNIT_X,sR);D.normalize(r,r);const a=W.multiplyByPointAsVector(o,D.UNIT_Y,oR);D.normalize(a,a),D.multiplyByScalar(a,s,a),D.multiplyByScalar(r,s,r);const l=D.negate(a,aR),c=D.negate(r,rR),h=Hf;let u=h[0];return D.add(i,a,u),u=h[1],D.add(i,c,u),u=h[2],D.add(i,l,u),u=h[3],D.add(i,r,u),h[4]=i,ge.fromCartesianArray(h,e,t)},ge.clone=function(n,e){if(x(n))return x(e)?(e.west=n.west,e.south=n.south,e.east=n.east,e.north=n.north,e):new ge(n.west,n.south,n.east,n.north)},ge.equalsEpsilon=function(n,e,t){return t=t??0,n===e||x(n)&&x(e)&&Math.abs(n.west-e.west)<=t&&Math.abs(n.south-e.south)<=t&&Math.abs(n.east-e.east)<=t&&Math.abs(n.north-e.north)<=t},ge.prototype.clone=function(n){return ge.clone(this,n)},ge.prototype.equals=function(n){return ge.equals(this,n)},ge.equals=function(n,e){return n===e||x(n)&&x(e)&&n.west===e.west&&n.south===e.south&&n.east===e.east&&n.north===e.north},ge.prototype.equalsEpsilon=function(n,e){return ge.equalsEpsilon(this,n,e)},ge._validate=function(n){y.typeOf.object("rectangle",n);const e=n.north;y.typeOf.number.greaterThanOrEquals("north",e,-F.PI_OVER_TWO),y.typeOf.number.lessThanOrEquals("north",e,F.PI_OVER_TWO);const t=n.south;y.typeOf.number.greaterThanOrEquals("south",t,-F.PI_OVER_TWO),y.typeOf.number.lessThanOrEquals("south",t,F.PI_OVER_TWO);const i=n.west;y.typeOf.number.greaterThanOrEquals("west",i,-Math.PI),y.typeOf.number.lessThanOrEquals("west",i,Math.PI);const s=n.east;y.typeOf.number.greaterThanOrEquals("east",s,-Math.PI),y.typeOf.number.lessThanOrEquals("east",s,Math.PI)},ge.southwest=function(n,e){return y.typeOf.object("rectangle",n),x(e)?(e.longitude=n.west,e.latitude=n.south,e.height=0,e):new Oe(n.west,n.south)},ge.northwest=function(n,e){return y.typeOf.object("rectangle",n),x(e)?(e.longitude=n.west,e.latitude=n.north,e.height=0,e):new Oe(n.west,n.north)},ge.northeast=function(n,e){return y.typeOf.object("rectangle",n),x(e)?(e.longitude=n.east,e.latitude=n.north,e.height=0,e):new Oe(n.east,n.north)},ge.southeast=function(n,e){return y.typeOf.object("rectangle",n),x(e)?(e.longitude=n.east,e.latitude=n.south,e.height=0,e):new Oe(n.east,n.south)},ge.center=function(n,e){y.typeOf.object("rectangle",n);let t=n.east;const i=n.west;t<i&&(t+=F.TWO_PI);const s=F.negativePiToPi((i+t)*.5),o=(n.south+n.north)*.5;return x(e)?(e.longitude=s,e.latitude=o,e.height=0,e):new Oe(s,o)},ge.intersection=function(n,e,t){y.typeOf.object("rectangle",n),y.typeOf.object("otherRectangle",e);let i=n.east,s=n.west,o=e.east,r=e.west;i<s&&o>0?i+=F.TWO_PI:o<r&&i>0&&(o+=F.TWO_PI),i<s&&r<0?r+=F.TWO_PI:o<r&&s<0&&(s+=F.TWO_PI);const a=F.negativePiToPi(Math.max(s,r)),l=F.negativePiToPi(Math.min(i,o));if((n.west<n.east||e.west<e.east)&&l<=a)return;const c=Math.max(n.south,e.south),h=Math.min(n.north,e.north);if(!(c>=h))return x(t)?(t.west=a,t.south=c,t.east=l,t.north=h,t):new ge(a,c,l,h)},ge.simpleIntersection=function(n,e,t){y.typeOf.object("rectangle",n),y.typeOf.object("otherRectangle",e);const i=Math.max(n.west,e.west),s=Math.max(n.south,e.south),o=Math.min(n.east,e.east),r=Math.min(n.north,e.north);if(!(s>=r||i>=o))return x(t)?(t.west=i,t.south=s,t.east=o,t.north=r,t):new ge(i,s,o,r)},ge.union=function(n,e,t){y.typeOf.object("rectangle",n),y.typeOf.object("otherRectangle",e),x(t)||(t=new ge);let i=n.east,s=n.west,o=e.east,r=e.west;i<s&&o>0?i+=F.TWO_PI:o<r&&i>0&&(o+=F.TWO_PI),i<s&&r<0?r+=F.TWO_PI:o<r&&s<0&&(s+=F.TWO_PI);const a=F.negativePiToPi(Math.min(s,r)),l=F.negativePiToPi(Math.max(i,o));return t.west=a,t.south=Math.min(n.south,e.south),t.east=l,t.north=Math.max(n.north,e.north),t},ge.expand=function(n,e,t){return y.typeOf.object("rectangle",n),y.typeOf.object("cartographic",e),x(t)||(t=new ge),t.west=Math.min(n.west,e.longitude),t.south=Math.min(n.south,e.latitude),t.east=Math.max(n.east,e.longitude),t.north=Math.max(n.north,e.latitude),t},ge.contains=function(n,e){y.typeOf.object("rectangle",n),y.typeOf.object("cartographic",e);let t=e.longitude;const i=e.latitude,s=n.west;let o=n.east;return o<s&&(o+=F.TWO_PI,t<0&&(t+=F.TWO_PI)),(t>s||F.equalsEpsilon(t,s,F.EPSILON14))&&(t<o||F.equalsEpsilon(t,o,F.EPSILON14))&&i>=n.south&&i<=n.north};const lR=new Oe;ge.subsample=function(n,e,t,i){y.typeOf.object("rectangle",n),e=e??ve.default,t=t??0,x(i)||(i=[]);let s=0;const o=n.north,r=n.south,a=n.east,l=n.west,c=lR;c.height=t,c.longitude=l,c.latitude=o,i[s]=e.cartographicToCartesian(c,i[s]),s++,c.longitude=a,i[s]=e.cartographicToCartesian(c,i[s]),s++,c.latitude=r,i[s]=e.cartographicToCartesian(c,i[s]),s++,c.longitude=l,i[s]=e.cartographicToCartesian(c,i[s]),s++,o<0?c.latitude=o:r>0?c.latitude=r:c.latitude=0;for(let h=1;h<8;++h)c.longitude=-Math.PI+h*F.PI_OVER_TWO,ge.contains(n,c)&&(i[s]=e.cartographicToCartesian(c,i[s]),s++);return c.latitude===0&&(c.longitude=l,i[s]=e.cartographicToCartesian(c,i[s]),s++,c.longitude=a,i[s]=e.cartographicToCartesian(c,i[s]),s++),i.length=s,i},ge.subsection=function(n,e,t,i,s,o){if(y.typeOf.object("rectangle",n),y.typeOf.number.greaterThanOrEquals("westLerp",e,0),y.typeOf.number.lessThanOrEquals("westLerp",e,1),y.typeOf.number.greaterThanOrEquals("southLerp",t,0),y.typeOf.number.lessThanOrEquals("southLerp",t,1),y.typeOf.number.greaterThanOrEquals("eastLerp",i,0),y.typeOf.number.lessThanOrEquals("eastLerp",i,1),y.typeOf.number.greaterThanOrEquals("northLerp",s,0),y.typeOf.number.lessThanOrEquals("northLerp",s,1),y.typeOf.number.lessThanOrEquals("westLerp",e,i),y.typeOf.number.lessThanOrEquals("southLerp",t,s),x(o)||(o=new ge),n.west<=n.east){const a=n.east-n.west;o.west=n.west+e*a,o.east=n.west+i*a}else{const a=F.TWO_PI+n.east-n.west;o.west=F.negativePiToPi(n.west+e*a),o.east=F.negativePiToPi(n.west+i*a)}const r=n.north-n.south;return o.south=n.south+t*r,o.north=n.south+s*r,e===1&&(o.west=n.east),i===1&&(o.east=n.east),t===1&&(o.south=n.north),s===1&&(o.north=n.north),o},ge.MAX_VALUE=Object.freeze(new ge(-Math.PI,-F.PI_OVER_TWO,Math.PI,F.PI_OVER_TWO));function vn(n,e){n=n??0,this._near=n,e=e??Number.MAX_VALUE,this._far=e}Object.defineProperties(vn.prototype,{near:{get:function(){return this._near},set:function(n){this._near=n}},far:{get:function(){return this._far},set:function(n){this._far=n}}}),vn.packedLength=2,vn.pack=function(n,e,t){if(!x(n))throw new $("value is required");if(!x(e))throw new $("array is required");return t=t??0,e[t++]=n.near,e[t]=n.far,e},vn.unpack=function(n,e,t){if(!x(n))throw new $("array is required");return e=e??0,x(t)||(t=new vn),t.near=n[e++],t.far=n[e],t},vn.equals=function(n,e){return n===e||x(n)&&x(e)&&n.near===e.near&&n.far===e.far},vn.clone=function(n,e){if(x(n))return x(e)||(e=new vn),e.near=n.near,e.far=n.far,e},vn.prototype.clone=function(n){return vn.clone(this,n)},vn.prototype.equals=function(n){return vn.equals(this,n)};function zn(n,e,t,i){this.near=n??0,this.nearValue=e??0,this.far=t??1,this.farValue=i??0}zn.clone=function(n,e){if(x(n))return x(e)?(e.near=n.near,e.nearValue=n.nearValue,e.far=n.far,e.farValue=n.farValue,e):new zn(n.near,n.nearValue,n.far,n.farValue)},zn.packedLength=4,zn.pack=function(n,e,t){if(!x(n))throw new $("value is required");if(!x(e))throw new $("array is required");return t=t??0,e[t++]=n.near,e[t++]=n.nearValue,e[t++]=n.far,e[t]=n.farValue,e},zn.unpack=function(n,e,t){if(!x(n))throw new $("array is required");return e=e??0,x(t)||(t=new zn),t.near=n[e++],t.nearValue=n[e++],t.far=n[e++],t.farValue=n[e],t},zn.equals=function(n,e){return n===e||x(n)&&x(e)&&n.near===e.near&&n.nearValue===e.nearValue&&n.far===e.far&&n.farValue===e.farValue},zn.prototype.clone=function(n){return zn.clone(this,n)},zn.prototype.equals=function(n){return zn.equals(this,n)};function L_(n,e){return D.fromDegrees(...n,void 0,e)}const cR=new Oe;function hR(n,e){const t=Oe.fromCartesian(n,void 0,cR);if(t)return e=e||[0,0,0],e[0]=F.toDegrees(t.longitude),e[1]=F.toDegrees(t.latitude),e[2]=t.height,e}function z_(n,e){return e=e||new me,e.x=n[0],e.y=n[1],e}function N_(n,e){return e=e||[0,0],e[0]=n.x,e[1]=n.y,e}function k_(n,e){return e=e||new D,e.x=n[0],e.y=n[1],e.z=n[2],e}function j_(n,e){return e=e||[0,0,0],e[0]=n.x,e[1]=n.y,e[2]=n.z,e}function U_(n,e){return e=e||new ce,e.x=n[0],e.y=n[1],e.z=n[2],e.w=n[3],e}function G_(n,e){return e=e||[0,0,0,0],e[0]=n.x,e[1]=n.y,e[2]=n.z,e[3]=n.w,e}function q_(n,e){if(n.length===4)return U_(n,e);if(n.length===3)return k_(n,e);if(n.length===2)return z_(n,e);throw new Error("toCartesian error: should not be here!")}function uR(n,e){if(n instanceof me)return N_(n,e);if(n instanceof D)return j_(n,e);if(n instanceof ce)return G_(n,e);throw new Error("fromCartesian error: should not be here!")}function dR(n,e){return e=e||new Oe,e.longitude=F.toRadians(n[0]),e.latitude=F.toRadians(n[1]),e.height=n[2],e}function fR(n,e){return e=e||[0,0,0],e[0]=F.toDegrees(n.longitude),e[1]=F.toDegrees(n.latitude),e[2]=0,e}function pR(n,e){return e=e||new T,e.red=n[0],e.green=n[1],e.blue=n[2],e.alpha=n[3],e}function gR(n,e){return e=e||[0,0,0,0],e[0]=n.red,e[1]=n.green,e[2]=n.blue,e[3]=n.alpha,e}function mR(n,e){return e=e||new zn,e.near=n[0],e.nearValue=n[1],e.far=n[2],e.farValue=n[3],e}function yR(n,e){return e=e||[0,0,0,0],e[0]=n.near,e[1]=n.nearValue,e[2]=n.far,e[3]=n.farValue,e}function W_(n,e){return e=e||new Rt,e.heading=F.toRadians(n[0]-90),e.pitch=F.toRadians(n[1]),e.roll=F.toRadians(n[2]),e}function _R(n,e){return e=e||[0,0,0],e[0]=F.toDegrees(n.heading+F.PI_OVER_TWO),e[1]=F.toDegrees(n.pitch),e[2]=F.toDegrees(n.roll),e}function wR(n,e){return e=e||new vn,e.near=n[0],e.far=n[1],e}function vR(n,e){return e=e||[0,0],e[0]=n.near,e[1]=n.far,e}function bR(n,e){return e=e||new K,e.x=n[0],e.y=n[1],e.z=n[2],e.w=n[3],e}function ER(n,e){return e=e||[0,0,0,0],e[0]=n.x,e[1]=n.y,e[2]=n.z,e[3]=n.w,e}const CR=new Rt,xR=new D;function PR(n,e,t){const i=W_(e,CR),s=L_(n,xR);return xe.headingPitchRollQuaternion(s,i,void 0,void 0,t)}function SR(n,e){return e=e||new ge,e.west=n[0]*Math.PI/180,e.south=n[1]*Math.PI/180,e.east=n[2]*Math.PI/180,e.north=n[3]*Math.PI/180,e}function RR(n,e){return e=e||[0,0,0,0],e[0]=n.west,e[1]=n.south,e[2]=n.east,e[3]=n.north,e}const TR=new D;function IR(n,e){return e=e||new ve,ve.fromCartesian3(D.fromArray(n,void 0,TR),e)}function OR(n,e){return e=e||[0,0,0],e[0]=n.radii.x,e[1]=n.radii.y,e[2]=n.radii.z,e}function AR(n,e){return V_(n,D.UNIT_Y,D.UNIT_Z,D.UNIT_X,e)}function MR(n,e){return V_(n,D.UNIT_X,D.UNIT_Z,new D(0,-1,0),e)}function V_(n,e,t,i,s){const[o,r,a]=n,l=K.fromAxisAngle(t,F.toRadians(-o)),c=K.fromAxisAngle(i,F.toRadians(r)),h=K.fromAxisAngle(e,F.toRadians(a)),u=K.clone(K.IDENTITY,s);return K.multiply(h,u,u),K.multiply(c,u,u),K.multiply(l,u,u),u}function B_(n,e){e=e??new Array(16);for(let t=0;t<16;++t)e[t]=n[t];return e}function Xf(n,e){const t=W.clone(W.IDENTITY),{position:i,rotation:s,scale:o,initialRotationMode:r="YForwardZUp"}=n;if(i){const[a,l,c]=i;xe.eastNorthUpToFixedFrame(D.fromDegrees(a,l,c),void 0,t)}if(s){const a=new K;r==="YForwardZUp"?AR(s,a):r==="XForwardZUp"&&MR(s,a);const l=H.fromQuaternion(a);W.multiply(t,W.fromRotationTranslation(l),t)}return o&&W.multiplyByScale(t,q_(o),t),B_(t,e)}const DR=new W;function $_(n,e){const t=W.fromArray(n,0,DR);return W.inverse(t,t),B_(t,e)}const FR=new W,LR=new D;function H_(n,e,t){const[i,s,o]=e,r=D.fromDegrees(i,s,o,void 0,LR),a=W.fromArray(n,0,FR),l=W.multiplyByPoint(a,r,r),{x:c,y:h,z:u}=l;return t=t||[0,0,0],t[0]=c,t[1]=h,t[2]=u,t}const zR=new W,NR=new D,kR=new Oe;function X_(n,e,t){const[i,s,o]=e,r=D.fromElements(i,s,o,NR),a=W.fromArray(n,0,zR),l=W.multiplyByPoint(a,r,r),c=Oe.fromCartesian(l,void 0,kR);return t=t||[0,0,0],t[0]=F.toDegrees(c.longitude),t[1]=F.toDegrees(c.latitude),t[2]=c.height,t}function Cr(n,e){const{originPosition:t,originRotation:i,originScale:s,initialRotationMode:o}=n,r=Xf({position:t,rotation:i,scale:s,initialRotationMode:o}),a=$_(r);return[e.map(c=>H_(a,c)),r,a]}function Eh(n,e){const{originPosition:t,originRotation:i,originScale:s,initialRotationMode:o}=n,r=Xf({position:t,rotation:i,scale:s,initialRotationMode:o});return[e.map(l=>X_(r,l)),r]}function Yf(n,e){return[(n[0]+e[0])/2,(n[1]+e[1])/2,(n[2]+e[2])/2]}class Y_ extends p.Destroyable{constructor(t,i,s,o){super();I(this,"_pixelsToMetersAt",(t,i,s,o)=>{const r=Me([i,s]),a=t.getPixelFromCoordinate(r);if(!a)return;const l=[a[0]+o,a[1]],c=t.getCoordinateFromPixel(l);if(!c)return;const[h,u]=Ft(c);return Math.abs(p.geoRhumbDistance([i,s,0],[h,u,0]))});const r=t.viewer;if(!r){console.warn("OlCurrentScale: map is undefined");return}const[a,,l]=p.getReactFuncs(i),[,c]=p.getReactFuncs(s),h=()=>{const d=a();if(!d)return;const[f,g]=d,_=this._pixelsToMetersAt(r,f,g,o);_!==void 0&&isFinite(_)&&c([_,_,_])};h(),this.dispose(l.disposableOn(h));const u=()=>h();r.on("postrender",u),this.dispose(()=>r.un("postrender",u))}}function jR(n,e){var t,i;if(n){try{const s=Ki(n);s&&typeof s.destroy=="function"&&s.destroy(),Sh(n,void 0)}catch(s){console.warn("[destroyOlMapHard] extensions cleanup error:",s)}try{n.getOverlays().clear()}catch{}try{n.getLayers().forEach(s=>{const o=s&&typeof s.getSource=="function"?s.getSource():void 0;if(o&&typeof o.clear=="function")try{o.clear()}catch{}if(o&&o.tileCache&&typeof o.tileCache.clear=="function")try{o.tileCache.clear()}catch{}if(typeof s.dispose=="function")try{s.dispose()}catch{}}),n.getLayers().clear()}catch{}try{n.getInteractions().clear()}catch{}try{n.getControls().clear()}catch{}try{const s=(t=n.getViewport)==null?void 0:t.call(n);s&&s.querySelectorAll("canvas").forEach(r=>{const a=r.getContext&&r.getContext("webgl2")||r.getContext&&r.getContext("webgl")||r.getContext&&r.getContext("experimental-webgl");if(a){const l=a.getExtension&&a.getExtension("WEBGL_lose_context");l&&typeof l.loseContext=="function"&&l.loseContext()}try{r.width=1,r.height=1}catch{}})}catch(s){console.warn("[destroyOlMapHard] webgl lose context skipped:",s)}try{n.setTarget(void 0)}catch{}try{(i=n.dispose)==null||i.call(n)}catch{}try{e(void 0)}catch{}}}class UR extends p.Destroyable{constructor(e,t,i){super();let s;this.d(()=>{e&&s&&e.removeChild(s)});const o=()=>{t.setStatus("Raw"),t.setStatusLog("");const a=t.viewer;if(a){const l=Ki(a);l&&(l.destroy(),Sh(a,void 0)),jR(a,i)}};this.d(o);const r=this.dv(p.createProcessingFromAsyncFunc(async(a,l)=>{t.setStatus("Creating"),t.setStatusLog("正在创建OpenLayers视口..."),s=document.createElement("div"),s.style.cssText="height: 100%",s.addEventListener("contextmenu",E=>E.preventDefault()),this.d(()=>{s==null||s.removeEventListener("contextmenu",E=>E.preventDefault())}),l.appendChild(s);const h=Ne("EPSG:3857").getExtent(),u=Ie(h)/256,d=new Array(19),f=new Array(19);for(let E=0;E<19;++E)d[E]=u/Math.pow(2,E),f[E]=E.toString();const g=new yy({target:s,view:new yi({center:[0,0],zoom:0,enableRotation:!0}),interactions:py({doubleClickZoom:!1}),controls:ly({zoom:!1,rotate:!1,attribution:!1})});await a.promise(p.sleep(1e3)),g.updateSize(),g.renderSync();const _=new ResizeObserver(()=>{g.updateSize(),g.renderSync()});_.observe(s),this.d(()=>_.disconnect());const v=new lw(g,t);Sh(g,v),i(g),this.d(()=>i(void 0)),t.setStatus("Created"),t.setStatusLog("成功创建OpenLayers视口!")}));r.start(e),r.errorEvent.don(a=>{console.error(a),t.setStatus("Error"),t.setStatusLog("创建Cesium视口失败!")})}}class GR extends p.Destroyable{constructor(e){super();const t=()=>{};this.dispose(e.viewDistanceChanged.disposableOn(t)),this.dispose(e.visibleAlphaChanged.disposableOn(t))}}class qR extends p.Destroyable{constructor(t){super();I(this,"_debugObjResetting");this._control=t,this._debugObjResetting=this.disposeVar(new p.ObjResettingWithEvent(this._control.debugChanged,()=>{if(this._control.debug)return new GR(this._control)}))}get debugObjResetting(){return this._debugObjResetting}}class Z_ extends p.Destroyable{constructor(t,i,s,o){super();I(this,"_visibleAlpha",this.disposeVar(p.react(1)));I(this,"_viewDistance",this.disposeVar(p.react(0)));I(this,"_debug",this.disposeVar(p.react(!1)));I(this,"_viewDistanceDebug",this.disposeVar(new qR(this)));this._olViewer=t,this._positionReact=s;const[r,,a]=p.getReactFuncs(i),[l,,c]=p.getReactFuncs(this._positionReact),[h,,u]=o?p.getReactFuncs(o):[void 0,void 0,void 0],d=()=>{var v;let g=1,_=Number.NEGATIVE_INFINITY;do{const E=r(),w=l(),C=h?h():0;if(!E||!w)break;const P=(v=this._olViewer.viewer)==null?void 0:v.getView().getCenter();if(console.log(P),!P)break;_=om({getCoordinates:()=>[P,w],getType:()=>"LineString"})-(C??0);const[A,O,M,z]=E;if(A>O||O>M||M>z){console.error("viewDistanceRange 参数错误: n0 <= n1 <= f1 <= f0");break}_>=O&&_<=M?g=1:_<=A||_>=z?g=0:_>A&&_<O?g=(_-A)/(O-A):_>M&&_<z?g=(z-_)/(z-M):g=1}while(!1);this._viewDistance.value=_,this._visibleAlpha.value=g},f=this.disposeVar(p.createNextAnimateFrameEvent(...[this._olViewer.cameraChanged,a,c,u].filter(Boolean)));this.dispose(f.disposableOn(d)),d()}get visibleAlpha(){return this._visibleAlpha.value}get visibleAlphaChanged(){return this._visibleAlpha.changed}get viewDistance(){return this._viewDistance.value}set viewDistance(t){this._viewDistance.value=t}get viewDistanceChanged(){return this._viewDistance.changed}get debug(){return this._debug.value}set debug(t){this._debug.value=t}get debugChanged(){return this._debug.changed}get positionReact(){return this._positionReact}get olViewer(){return this._olViewer}get viewDistanceDebug(){return this._viewDistanceDebug}}class K_ extends p.Destroyable{constructor(t,i){super();I(this,"_map");I(this,"_view");I(this,"_keys",[]);I(this,"_changed",new p.Event);I(this,"_opts");this._map=t;const s=t.getView();if(!s)throw new Error("OlCameraChanged: map.getView() is undefined");this._view=s,this._opts={usePropertyChange:!0,listenSizeChange:!0,usePostRender:!1,emitImmediately:!0,...i},this._attach(),this.dispose(()=>this._detach()),this._opts.emitImmediately&&this._changed.emit()}get changed(){return this._changed}_on(t,i,s){const o=t.on(i,s);this._keys.push(o)}_attach(){this._opts.usePropertyChange?this._on(this._view,"propertychange",()=>this._changed.emit()):(this._on(this._view,"change:center",()=>this._changed.emit()),this._on(this._view,"change:resolution",()=>this._changed.emit()),this._on(this._view,"change:rotation",()=>this._changed.emit())),this._on(this._map,"moveend",()=>this._changed.emit()),this._opts.listenSizeChange&&this._on(this._map,"change:size",()=>this._changed.emit()),this._opts.usePostRender&&this._on(this._map,"postrender",()=>this._changed.emit())}_detach(){this._keys.forEach(ui),this._keys.length=0}}function Zf(n,e){return n.left===e.left&&n.top===e.top&&n.right===e.right&&n.bottom===e.bottom&&n.depth===e.depth}class Kf extends p.Destroyable{constructor(t,i=!0,s){super();I(this,"_coordinate");I(this,"_winPos",{left:NaN,top:NaN,right:NaN,bottom:NaN,depth:NaN});I(this,"_winPosValid",!1);I(this,"_changedEvent",new p.Event);I(this,"_enabled",!0);I(this,"tooltipElement");this.viewer=t,s=s||this.disposeVar(new K_(this.viewer,{usePropertyChange:!0,listenSizeChange:!0,usePostRender:!1,emitImmediately:!0})),this.dispose(s.changed.disposableOn(()=>this._updateWinPos())),this.dispose(()=>{this._changedEvent.empty||console.warn("WinPosFromCartesian需要销毁,但是changed事件仍有监听,代码未必有错,但是说明代码不严谨。")}),this._enabled=i,this._updateWinPos()}set enabled(t){this._enabled!==t&&(this._enabled=t,t&&this._updateWinPos())}get enabled(){return this._enabled}set coordinate(t){if(!t){this._coordinate=void 0,this._updateWinPos();return}const i=this.viewer.getView().getProjection(),o=Math.abs(t[0])<=180&&Math.abs(t[1])<=90?Zo(t,"EPSG:4326",i):t;this._coordinate=[o[0],o[1]],this._updateWinPos()}get coordinate(){return this._coordinate}_updateWinPos(){if(!this._enabled)return;if(!this._coordinate){this._emitInvalidIfNeeded();return}const t=this.viewer.getPixelFromCoordinate(this._coordinate),i=this.viewer.getSize(),s=!!t&&Array.isArray(t)&&isFinite(t[0])&&isFinite(t[1])&&!!i&&t[0]>=0&&t[1]>=0&&t[0]<i[0]&&t[1]<i[1];let o=!1;if(s!==this._winPosValid&&(this._winPosValid=s,o=!0),s){const r={left:t[0],top:t[1],right:t[0],bottom:t[1],depth:0};Zf(this._winPos,r)||(this._winPos=r,o=!0)}else{const r={left:NaN,top:NaN,right:NaN,bottom:NaN,depth:NaN};Zf(this._winPos,r)||(this._winPos=r,o=!0)}o&&(this._changedEvent.emit(this._winPosValid,this._winPos),this._syncTooltip())}_emitInvalidIfNeeded(){let t=!1;this._winPosValid&&(this._winPosValid=!1,t=!0);const i={left:NaN,top:NaN,right:NaN,bottom:NaN,depth:NaN};Zf(this._winPos,i)||(this._winPos=i,t=!0),t&&(this._changedEvent.emit(!1,this._winPos),this._syncTooltip())}_syncTooltip(){this.tooltipElement&&(this._winPosValid?(this.tooltipElement.style.display="block",this.tooltipElement.style.left=`${this._winPos.left}px`,this.tooltipElement.style.top=`${this._winPos.top}px`):this.tooltipElement.style.display="none")}get changed(){return this._changedEvent}get winPosValid(){return this._winPosValid}get winPos(){return this._winPos}}class WR extends p.Destroyable{constructor(t,i){super();I(this,"_show",this.disposeVar(p.react(!0)));I(this,"_winPosFromCartesian");I(this,"_near",this.disposeVar(p.react(0)));I(this,"_far",this.disposeVar(p.react(Number.POSITIVE_INFINITY)));I(this,"_actualShow",this.disposeVar(p.react(!1)));this._olPoisContext=t;const{viewer:s,cameraChanged:o}=this._olPoisContext;this._winPosFromCartesian=i||this.disposeVar(new Kf(s,!0,o));let r=0,a=Number.POSITIVE_INFINITY;this.dispose(this._near.changed.disposableOn(c=>r=c*c)),this.dispose(this._far.changed.disposableOn(c=>a=c*c));const l=this.disposeVar(p.createNextMicroTaskEvent(this._near.changed,this._far.changed,this._show.changed,this._winPosFromCartesian.changed,o.changed));this.dispose(l.disposableOn(()=>{if(!this.show){this._actualShow.value=!1;return}const c=this._winPosFromCartesian.winPosValid,u=this._olPoisContext.viewer.getView().getCenter(),d=this._winPosFromCartesian.coordinate;if(!u||!d){this._actualShow.value=!1;return}const f=d[0]-u[0],g=d[1]-u[1],_=f*f+g*g,v=_>=r&&_<=a;this._actualShow.value=v&&c}))}get actualShowChanged(){return this._actualShow.changed}get actualShow(){return this._actualShow.value}set coordinate(t){this._winPosFromCartesian.coordinate=t}get coordinate(){return this._winPosFromCartesian.coordinate}get tracker(){return this._winPosFromCartesian}set show(t){this._show.value=t}get show(){return this._show.value}set near(t){this._near.value=t}get near(){return this._near.value}set far(t){this._far.value=t}get far(){return this._far.value}}class Qf extends WR{constructor(t,i,s){super(i,s);I(this,"_canvasPoi");I(this,"_zOrderChanged");I(this,"_zOrder");I(this,"depth",0);const{canvasPrimitivesContext:o}=this._olPoisContext;this._canvasPoi=this.disposeVar(new t(o));const r=()=>{if(this.actualShow&&this.tracker.winPosValid){const{left:a,top:l,depth:c}=this.tracker.winPos;this._canvasPoi.winPos=[a,l],this.depth=c,this._canvasPoi.depth=this._zOrder??c,this._canvasPoi.show=!0}else this._canvasPoi.show=!1};this.d(this.zOrderChanged.don(()=>{r()})),this.dispose(this.tracker.changed.disposableOn(()=>{r()})),this.dispose(this.actualShowChanged.disposableOn(()=>{r()}))}get canvasPoi(){return this._canvasPoi}set zOrder(t){this._zOrder!==t&&(this._zOrder=t,this.zOrderChanged.emit())}get zOrder(){return this._zOrder}get zOrderChanged(){return this._zOrderChanged||(this._zOrderChanged=new p.Event),this._zOrderChanged}}class Zi extends p.Destroyable{constructor(t,i){super();I(this,"_pickedEvent",this.disposeVar(new p.Event));I(this,"_flyToEvent",this.disposeVar(new p.Event));I(this,"_clickEvent",this.disposeVar(new p.Event));I(this,"_clickOutEvent",this.disposeVar(new p.Event));I(this,"_dblclickEvent",this.disposeVar(new p.Event));I(this,"_dblclickOutEvent",this.disposeVar(new p.Event));I(this,"_canvasPoiClassAndCreateFunc",p.react(void 0));I(this,"_olViewDistanceRangeControl");I(this,"_canvasObj");I(this,"_id",this.disposeVar(p.react(p.createGuid())));i&&(this.id=i),this._olViewDistanceRangeControl=this.disposeVar(new Z_(t,[this,"viewDistanceRange"],[this,"position"])),this.dispose(p.track([this._olViewDistanceRangeControl,"debug"],[this,"viewDistanceDebug"]));const s=t.viewer;if(!s)return;const o=Ki(s);if(!o)return;const{poiContext:r,labelManager:a}=o;a.add(this),this.d(()=>{a.delete(this)}),r&&(this._canvasObj=this.disposeVar(new p.ObjResettingWithEvent(this.canvasPoiClassAndCreateFuncChanged,()=>{if(!this.canvasPoiClassAndCreateFunc)return;const[l,c]=this.canvasPoiClassAndCreateFunc;return new VR(this,l,r,s,c)})))}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}get clickEvent(){return this._clickEvent}get clickOutEvent(){return this._clickOutEvent}get dblclickEvent(){return this._dblclickEvent}get dblclickOutEvent(){return this._dblclickOutEvent}get canvasPoiClassAndCreateFunc(){return this._canvasPoiClassAndCreateFunc.value}set canvasPoiClassAndCreateFunc(t){this._canvasPoiClassAndCreateFunc.value=t}get canvasPoiClassAndCreateFuncChanged(){return this._canvasPoiClassAndCreateFunc.changed}get olViewDistanceRangeControl(){return this._olViewDistanceRangeControl}get visibleAlpha(){return this._olViewDistanceRangeControl.visibleAlpha}get visibleAlphaChanged(){return this._olViewDistanceRangeControl.visibleAlphaChanged}get canvasObj(){var t;return(t=this._canvasObj)==null?void 0:t.obj}get id(){return this._id.value}set id(t){this._id.value=t}get idChanged(){return this._id.changed}}I(Zi,"defaults",{viewDistanceRange:[1e3,1e4,3e4,6e4]}),(n=>{n.createDefaultProps=()=>({show:!0,enabled:!0,position:p.reactArrayWithUndefined(void 0),positionEditing:!1,viewDistanceRange:p.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,zOrder:0})})(Zi||(Zi={})),p.extendClassProps(Zi.prototype,Zi.createDefaultProps);class VR extends p.Destroyable{constructor(t,i,s,o,r){super();I(this,"olCanvasPoi");const a=this.olCanvasPoi=this.disposeVar(new Qf(i,s));this.disposeVar(r(a.canvasPoi,t.visibleAlphaChanged));const l=()=>{if(t.position){const u=Me([t.position[0],t.position[1]]);a.coordinate=u}};l(),this.dispose(t.positionChanged.disposableOn(l));const c=()=>{a.show=(t.show??!0)&&!!t.position&&t.visibleAlpha>0};c();const h=this.disposeVar(p.createNextAnimateFrameEvent(t.showChanged,t.positionChanged,t.visibleAlphaChanged));this.dispose(h.disposableOn(c)),this.dispose(t.flyToEvent.disposableOn(()=>{console.warn("flyTo not implemented in OpenLayers")}))}}class BR extends p.Destroyable{constructor(e,t){super();const i=this.disposeVar(p.createNextAnimateFrameEvent(e.showChanged,e.positionChanged,e.fgColorChanged,e.bgColorChanged,e.tooltipChanged,e.tooltipShowChanged,e.titleChanged,e.sizeChanged,e.originRatioAndOffsetChanged,e.opacityChanged,e.scaleChanged)),s=()=>{t.fgColor=e.fgColor??[1,1,1,1],t.bgColor=e.bgColor??[.3,.3,.3,.8],t.tooltip=e.tooltip??"",t.tooltipShow=e.tooltipShow??!0,t.title=e.title??"",t.size=e.size??[32,32],t.originRatioAndOffset=e.originRatioAndOffset??[.5,1,0,0],t.hovered=e.hovered??!1,t.opacity=e.opacity??1,t._scale=e.scale??1};s(),this.dispose(i.disposableOn(s));const o=this.disposeVar(p.ESSceneObject.context.createEnvStrReact([e,"imageUri"],"${earthsdk3-assets-script-dir}/assets/img/location.png")),r=this.disposeVar(p.createProcessingFromAsyncFunc(async(c,h)=>{const u=await c.promise(p.fetchImage(h));t.image=u})),a=()=>{if(!o.value)return;const c=o.value.trim();c!==""&&r.restart(void 0,c)};a(),this.dispose(o.changed.disposableOn(a));const l=this.disposeVar(new p.Event);this.dispose(t.clickEvent.disposableOn((c,h,u,d,f)=>{(e.enabled??!0)&&l.emit(f)})),this.dispose(l.don(c=>{e.clickEvent.emit(c)})),this.dispose(t.clickOutEvent.disposableOn((c,h,u,d,f)=>{(e.enabled??!0)&&e.clickOutEvent.emit(f)})),this.dispose(t.dbclickEvent.disposableOn((c,h,u,d,f)=>{(e.enabled??!0)&&e.dbclickEvent.emit(f)})),this.dispose(t.dbclickOutEvent.disposableOn((c,h,u,d,f)=>{(e.enabled??!0)&&e.dbclickOutEvent.emit(f)})),this.dispose(p.bind([e,"hovered"],[t,"hovered"])),this.ad(p.bind([t,"isHoverZoom"],[e,"isHoverZoom"]))}}function $R(n,e){const t=n.trim();if(t){try{const i=Function('"use strict";return ('+t+")")();if(typeof i=="function")return i}catch(i){console.info(`firstTryFunc get error! ${i}`)}try{const i=`function (${(e??[]).join(", ")}) {
70
+ ${t};
71
+ }`,s=Function('"use strict";return ('+i+")")();return typeof s=="function"?s:void 0}catch(i){console.error(`optionStr get error! ${i}`);return}}}function Ch(n,e=48){return`
75
72
  <div style="
76
73
  background: rgba(0, 0, 0, 0.6);
77
74
  color: white;
@@ -81,7 +78,7 @@ ${e};
81
78
  white-space: nowrap;
82
79
  pointer-events: none;
83
80
  ">
84
- ${i.split(`
81
+ ${n.split(`
85
82
  `).map(s=>`
86
83
  <div style="height: 24px; line-height: 24px">
87
84
  ${s}
@@ -89,13 +86,13 @@ ${e};
89
86
  `).join(" ")}
90
87
  </div>
91
88
  <div style="
92
- height: ${t}px;
89
+ height: ${e}px;
93
90
  width: 2px;
94
91
  background: rgba(0, 0, 0, 0.6);
95
92
  margin: auto;
96
93
  ">
97
94
  </div>
98
- `}function Ag(i){return Math.abs(i)<1e3?`${i.toFixed(2)} m`:`${(i/1e3).toFixed(2)} km`}function ka(i,t=!1){const e=i<0?"-":"",n=Math.abs(i),s=n|0,o=(n-s)*60;if(t)return`${e}${s}°${o.toFixed(3)}′`;const r=o|0,c=((o-r)*60).toFixed(3);return`${e}${s}°${r}′${c}″`}function ll(i,t){if(i)return Object.prototype.hasOwnProperty.call(i,t)?i[t]!=null?Object.assign({},i[t]):void 0:ll(i.childPickedInfo,t)}function Mg(i,t){const[e]=d.getReactFuncs(t);return d.bind(i,t,n=>{const[s,o,r]=n??[0,0,0];return[s+90,o,r]},n=>{const[s,o,r]=n??[0,0,0];if(!(!e()&&s===-90&&o===0&&r===0))return[Math.abs(s-90)<1e-9?0:s-90,o,r]})}function nv(i,t){const[e,n,s]=t,o=`${e}-${n}-${s}`;let r=d.getExtProp(i,o);return r||(r=d.imageToCanvas(i),d.setCanvasUniformColor(r,t),d.setExtProp(i,o,r)),r}class sv extends d.CanvasPoi{constructor(e,n,s=[32,32],o=[.5,1,0,0],r="#F00F"){super(e);R(this,"_tooltip","");R(this,"_title","");R(this,"__scale",[1,1]);R(this,"_tooltipAlpha",0);R(this,"_bgColor",[.3,.3,.3,.8]);R(this,"_bgColorHexStr",d.getColorHexStr(this._bgColor));R(this,"_fgColor",[1,1,1,1]);R(this,"_fgColorHexStr",d.getColorHexStr(this._fgColor));R(this,"_tooltipShow",this.disposeVar(d.react(!0)));R(this,"_isHoverZoom",this.disposeVar(d.react(!1)));this._image=n,this._size=s,this._originRatioAndOffset=o,this._defaultColorStr=r;const a=new d.Transition(100),c=new d.Transition(100);this.dispose(()=>{a.destroy(),c.destroy()});const h=()=>{this._clickEvent&&!this._clickEvent.empty&&(this.isHoverZoom&&(this.hovered?(this._scale[0]*=1.5,this._scale[1]*=1.5):(this._scale[0]/=1.5,this._scale[1]/=1.5)),this._tooltipAlpha=a.current)};this.dispose(this.activedChanged.disposableOn(u=>{c.target=u?1:0,this.needRedraw()}));const l=()=>{const u=this.tooltipShow&&this.hovered;a.target=u?1:0,h(),this.needRedraw()};this.dispose(this.hoveredChanged.disposableOn(l)),this.dispose(this.tooltipShowChanged.disposableOn(l)),this.dispose(this.selectedChanged.disposableOn(()=>{this.needRedraw()}))}get tooltipShow(){return this._tooltipShow.value}set tooltipShow(e){this._tooltipShow.value=e}get tooltipShowChanged(){return this._tooltipShow.changed}get isHoverZoom(){return this._isHoverZoom.value}set isHoverZoom(e){this._isHoverZoom.value=e}get isHoverZoomChanged(){return this._isHoverZoom.changed}set size(e){const[n,s]=e,[o,r]=this._size;(o!==n||r!==s)&&(this._size[0]=n,this._size[1]=s,this.needRedraw(),this.needPickRedraw())}get size(){return this._size}set _scale(e){const[n,s]=e,[o,r]=this.__scale;(o!==n||r!==s)&&(this.__scale[0]=n,this.__scale[1]=s,this.needRedraw(),this.needPickRedraw())}get _scale(){return this.__scale}set fgColor(e){if(!this._fgColor.every((n,s)=>e[s]===n)){const[n,s,o,r]=e;this._fgColor.splice(0,4,n,s,o,r),this._fgColorHexStr=d.getColorHexStr(this._fgColor),this.needRedraw()}}get fgColor(){return this._fgColor}set bgColor(e){if(!this._bgColor.every((n,s)=>e[s]===n)){const[n,s,o,r]=e;this._bgColor.splice(0,4,n,s,o,r),this._bgColorHexStr=d.getColorHexStr(this._bgColor),this.needRedraw()}}get bgColor(){return this._bgColor}set originRatioAndOffset(e){const[n,s,o,r]=this._originRatioAndOffset,[a,c,h,l]=e;(n!==a||s!==c||o!==h||r!==l)&&(this._originRatioAndOffset.splice(0,4,a,c,h,l),this.needRedraw(),this.needPickRedraw())}get originRatioAndOffset(){return this._originRatioAndOffset}set image(e){this._image!==e&&(this._image=e,this.needRedraw())}get image(){return this._image}set defaultColorStr(e){this._defaultColorStr!==e&&(this._defaultColorStr=e,this.needRedraw())}get defaultColorStr(){return this._defaultColorStr}set tooltip(e){this._tooltip!==e&&(this._tooltip=e,this.needRedraw())}get tooltip(){return this._tooltip}set title(e){this._title!==e&&(this._title=e,this.needRedraw())}get title(){return this._title}draw(e){if(!this._show)return;const[n,s]=this._winPos,o=this._size[0]*this.__scale[0],r=this._size[1]*this.__scale[1],{left:a,top:c,right:h,bottom:l}=d.getDrawRect([n,s],this._size,this.__scale,this._originRatioAndOffset),u=e.globalAlpha;if(e.globalAlpha=this.opacity,this._image){if(this.selected){const f=nv(this._image,[1,0,0]),{left:g,top:_}=d.getDrawRect([n,s],[o+6,r+6],[1,1],this._originRatioAndOffset);e.drawImage(f,g,_,o+6,r+6)}e.drawImage(this._image,a,c,o,r)}else e.fillStyle=this._fgColorHexStr,e.fillRect(a,c,o,r);if(this._title!==""&&d.drawTextBlock(e,n+20,s-16,[0,.5,0,0],this._title,"14px Arial",4,this._fgColorHexStr,this._bgColorHexStr),e.globalAlpha=u,this._hovered&&this._tooltip!==""){const f=e.globalAlpha;e.globalAlpha=this._tooltipAlpha,d.drawTextBlock(e,(a+h)*.5,c-5,[.5,1,0,0],this._tooltip,"12px Arial",4,this._fgColorHexStr,this._bgColorHexStr),e.globalAlpha=f}}drawForPick(e,n){if(!this._show)return;const[s,o]=this._winPos,r=n("default"),a=this._size[0]*this.__scale[0],c=this._size[1]*this.__scale[1],{left:h,top:l}=d.getDrawRect([s,o],this._size,this.__scale,this._originRatioAndOffset);e.fillStyle=r,e.fillRect(h,l,a,c)}}class li extends d.Destroyable{constructor(e){var r;super();R(this,"_pickedEvent",this.disposeVar(new d.Event));R(this,"_flyToEvent",this.disposeVar(new d.Event));R(this,"_clickEvent",this.disposeVar(new d.Event));R(this,"_clickOutEvent",this.disposeVar(new d.Event));R(this,"_dbclickEvent",this.disposeVar(new d.Event));R(this,"_dbclickOutEvent",this.disposeVar(new d.Event));R(this,"_clickFunc",this.disposeVar(d.react(void 0)));R(this,"_clickFuncInit",(()=>{this.dispose(this.clickEvent.disposableOn(e=>this.clickFunc&&this.clickFunc(e)))})());R(this,"_geoCanvasPoi");if(!((r=e.extensions)==null?void 0:r.poiContext)){console.warn("poiContext is missing!");return}if(this._geoCanvasPoi=this.disposeVar(new Ai(e)),!e.viewer)return;const{geoCanvasPoi:o}=this;o.canvasPoiClassAndCreateFunc=[sv,a=>new ev(this,a)],this.dispose(d.bind([o,"show"],[this,"show"])),this.dispose(d.bind([o,"enabled"],[this,"enabled"])),this.dispose(d.bind([o,"position"],[this,"position"])),this.dispose(d.bind([o,"positionEditing"],[this,"positionEditing"])),this.dispose(d.track([o,"viewDistanceRange"],[this,"viewDistanceRange"])),this.dispose(d.track([o,"viewDistanceDebug"],[this,"viewDistanceDebug"])),this.dispose(d.track([o,"zOrder"],[this,"zOrder"])),this.dispose(this.flyToEvent.disposableOn(a=>{o.flyTo(a)})),this.dispose(this._clickEvent.disposableOn(a=>{this.pickOnClick&&this.pickedEvent.emit(new d.ESJPickedResult({type:"viewerPicking",pointerEvent:a}))}));{const a=()=>{const c=iv(this.clickFuncStr,["event"]);c&&(this.clickFunc=c)};a(),this.dispose(this.clickFuncStrChanged.disposableOn(a))}}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}get clickEvent(){return this._clickEvent}get clickOutEvent(){return this._clickOutEvent}get dbclickEvent(){return this._dbclickEvent}get dbclickOutEvent(){return this._dbclickOutEvent}get clickFunc(){return this._clickFunc.value}set clickFunc(e){this._clickFunc.value=e}get clickFuncChanged(){return this._clickFunc.changed}get geoCanvasPoi(){return this._geoCanvasPoi}}R(li,"defaults",{viewDistanceRange:[1e3,1e4,3e4,6e4],scale:[1,1]}),(i=>{i.createDefaultProps=()=>({show:!0,enabled:!0,position:d.reactArrayWithUndefined(void 0),positionEditing:!1,fgColor:d.reactArray([1,1,1,1]),bgColor:d.reactArray([0,0,0,0]),tooltip:"",tooltipShow:!0,title:"",size:d.reactArray([32,32]),scale:d.reactArray([1,1]),originRatioAndOffset:d.reactArray([.5,1,0,0]),hovered:!1,imageUri:d.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/img/location.png"),opacity:1,viewDistanceRange:d.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,pickOnClick:!1,clickFuncStr:"",zOrder:0,isHoverZoom:!1})})(li||(li={})),d.extendClassProps(li.prototype,li.createDefaultProps);class ul extends d.Destroyable{constructor(e,n,s,o){super();R(this,"_divPoi");R(this,"_show",!0);R(this,"_winPosFromCoordinate");R(this,"_zOrderChanged");R(this,"_zOrder");R(this,"depth",0);this._olPoisContext=n;const{viewer:r,divContainer:a,cameraChanged:c}=n;this._winPosFromCoordinate=o||this.disposeVar(new cl(r)),this._winPosFromCoordinate.coordinate=s,this._divPoi=new d.DivPoi(e,a),this.d(()=>this._divPoi.destroy()),this.d(this._winPosFromCoordinate.changed.disposableOn((h,l)=>{const{left:u,top:f,depth:g}=l,{floatDiv:_}=this._divPoi;_.winPos=[u,f],this.depth=Math.round((1-g)*1e11),_.element.style.zIndex=`${this.zOrder??this.depth}`,this._updateShow(h)})),this.d(this.zOrderChanged.don(()=>{const{floatDiv:h}=this._divPoi;h.element.style.zIndex=`${this.zOrder??this.depth}`,this._updateShow(this._winPosFromCoordinate.winPosValid)}))}_updateShow(e){this._divPoi.show=this._show&&e}get divPoi(){return this._divPoi}set coordinate(e){this._winPosFromCoordinate.coordinate=e}get coordinate(){return this._winPosFromCoordinate.coordinate}get winPosFromCoordinate(){return this._winPosFromCoordinate}set show(e){this._show!==e&&(this._show=e,this._updateShow(this._winPosFromCoordinate.winPosValid))}get show(){return this._show}set zOrder(e){this._zOrder!==e&&(this._zOrder=e,this.zOrderChanged.emit())}get zOrder(){return this._zOrder}get zOrderChanged(){return this._zOrderChanged||(this._zOrderChanged=new d.Event),this._zOrderChanged}}class ov extends d.Destroyable{constructor(e,n,s,o,r){super();R(this,"_olCanvasPoi");R(this,"_olDivPoi");R(this,"_show",!0);R(this,"_winPosFromCoordinate");R(this,"_switchTransition");R(this,"_status","Canvas");R(this,"_statusChanged");this._olPoisContext=s;const{viewer:a}=this._olPoisContext;this._winPosFromCoordinate=r||this.disposeVar(new cl(a)),this._winPosFromCoordinate.coordinate=o,this._olCanvasPoi=new hl(e,this._olPoisContext,this._winPosFromCoordinate),this.dispose(()=>this._olCanvasPoi.destroy()),this._olDivPoi=new ul(n,this._olPoisContext,o,this._winPosFromCoordinate),this.dispose(()=>this._olDivPoi.destroy()),this._switchTransition=new d.Transition(300),this.dispose(this._switchTransition.currentChanged.disposableOn((c,h)=>{this._updateShow(),this._olCanvasPoi.canvasPoi.opacity=1-h,this._olDivPoi.divPoi.floatDiv.opacity=h})),this._updateShow()}_updateShow(){this._olCanvasPoi.show=this._show&&this._switchTransition.current<1,this._olDivPoi.show=this._show&&this._switchTransition.current>0}set show(e){this._show!==e&&(this._show=e,this._updateShow())}get show(){return this._show}set coordinate(e){this._winPosFromCoordinate.coordinate=e}get coordinate(){return this._winPosFromCoordinate.coordinate}get winPosFromCoordinate(){return this._winPosFromCoordinate}set status(e){var n;this._status!==e&&(this._status=e,this._switchTransition.target=this._status==="Canvas"?0:1,(n=this._statusChanged)==null||n.emit(this._status))}get status(){return this._status}get statusChanged(){return this._statusChanged||(this._statusChanged=new d.Event),this._statusChanged}get olCanvasPoi(){return this._olCanvasPoi}get olDivPoi(){return this._olDivPoi}}class Dg extends d.Destroyable{constructor(e,n=!0){super();R(this,"_divContainer");R(this,"_canvasPrimitivesContext");R(this,"_cameraChanged");R(this,"_clickEvent",this.disposeVar(new d.Event));R(this,"_dbclickEvent",this.disposeVar(new d.Event));R(this,"_downEvent",this.disposeVar(new d.Event));R(this,"_upEvent",this.disposeVar(new d.Event));R(this,"_moveEvent",this.disposeVar(new d.Event));R(this,"_outEvent",this.disposeVar(new d.Event));R(this,"_poiClickedEvent");this._viewer=e,this._useInnerInteraction=n,this._cameraChanged=this.disposeVar(new Tg(this._viewer));const s=e.getViewport();this._divContainer=s;const o=document.createElement("div");o.style.position="absolute",o.style.left="0",o.style.top="0",o.style.width="100%",o.style.height="100%",o.style.pointerEvents="none",o.id="xcx",o.style.backgroundColor="rgba(0,0,0,0)",s.appendChild(o),this.dispose(()=>s.removeChild(o));const r=new d.CanvasPrimitivesContext;this._canvasPrimitivesContext=r,o.appendChild(r.element),this.dispose(()=>r.destroy());const a=r.element,c=()=>{const y=a.clientWidth||a.getBoundingClientRect().width||1,E=(a.width||y)/y;return Math.max(1,E)};let h=c();const l=new ResizeObserver(()=>{h=c()});l.observe(a),this.dispose(()=>l.disconnect());const u=y=>{const w=s.getBoundingClientRect();return[y.clientX-w.left,y.clientY-w.top]};let f,g;const _=y=>{f!==y&&(f&&(f.hovered=!1),f=y,f&&(f.hovered=!0))};if(this.dispose(this._moveEvent.disposableOn((y,w,E)=>{const b=r.pick(y*h,w*h,1,1),P=b.length>0?b[0].poi:void 0;_(P)})),this.dispose(this._outEvent.disposableOn((y,w,E)=>{_(void 0)})),this.dispose(this._downEvent.disposableOn((y,w,E)=>{g&&(g.actived=!1);const b=r.pick(y*h,w*h,1,1);if(b.length>0){const P=b[0].poi;P instanceof d.CanvasPrimitive&&(P.actived=!0,g=P)}})),this.dispose(this._upEvent.disposableOn((y,w,E)=>{g&&(g.actived=!1,g=void 0)})),this.dispose(this._clickEvent.disposableOn((y,w,E)=>{var P,I;const b=r.pick(y*h,w*h,1,1);if(b.length>0){(P=this._poiClickedEvent)==null||P.emit(!0);const{poi:M,tag:D}=b[0];for(const L of r.pois)L===M?L.hasClickEvent()&&L.clickEvent.emit(y,w,D,L,E):L.hasClickOutEvent()&&L.clickOutEvent.emit(y,w,"",L,E)}else{(I=this._poiClickedEvent)==null||I.emit(!1);for(const M of r.pois)M.hasClickOutEvent()&&M.clickOutEvent.emit(y,w,"",M,E)}})),this.dispose(this._dbclickEvent.disposableOn((y,w,E)=>{var P,I,M,D,L;const b=r.pick(y*h,w*h,1,1);if(b.length>0){(P=this._poiClickedEvent)==null||P.emit(!0);const{poi:z,tag:q}=b[0];for(const Y of r.pois)Y===z?(I=Y.hasDbclickEvent)!=null&&I.call(Y)&&Y.dbclickEvent.emit(y,w,q,Y,E):(M=Y.hasDbclickOutEvent)!=null&&M.call(Y)&&Y.dbclickOutEvent.emit(y,w,"",Y,E)}else{(D=this._poiClickedEvent)==null||D.emit(!1);for(const z of r.pois)(L=z.hasDbclickOutEvent)!=null&&L.call(z)&&z.dbclickOutEvent.emit(y,w,"",z,E)}})),this._useInnerInteraction){const y=this.disposeVar(new d.PointerClick),w=this.disposeVar(new d.PointerHover),E=s,b=this.disposeVar(d.DomElementEvent.create(E,"pointerdown")),P=this.disposeVar(d.DomElementEvent.create(E,"pointermove")),I=this.disposeVar(d.DomElementEvent.create(E,"pointerup")),M=this.disposeVar(d.DomElementEvent.create(E,"pointerout"));this.dispose(b.disposableOn(D=>{y.pointerDown(D),w.pointerDown(D);const[L,z]=u(D);this._downEvent.emit(L,z,D)})),this.dispose(P.disposableOn(D=>{y.pointerMove(D),w.pointerMove(D);const[L,z]=u(D);this._moveEvent.emit(L,z,D)})),this.dispose(I.disposableOn(D=>{y.pointerUp(D),w.pointerUp(D);const[L,z]=u(D);this._upEvent.emit(L,z,D)})),this.dispose(M.disposableOn(D=>{y.pointerOut(D),w.pointerOut(D);const[L,z]=u(D);this._outEvent.emit(L,z,D)})),this.dispose(y.clickEvent.disposableOn(D=>{const[L,z]=u(D);this._clickEvent.emit(L,z,D)})),this.dispose(y.dbclickEvent.disposableOn(D=>{const[L,z]=u(D);this._dbclickEvent.emit(L,z,D)}))}}get useInnerInteraction(){return this._useInnerInteraction}get divContainer(){return this._divContainer}get canvasPrimitivesContext(){return this._canvasPrimitivesContext}get poiClickedEvent(){return this._poiClickedEvent||(this._poiClickedEvent=new d.Event),this._poiClickedEvent}get viewer(){return this._viewer}get cameraChanged(){return this._cameraChanged}pointerClick(...e){this._useInnerInteraction?console.warn("当前使用内置交互(useInnerInteraction=true),请勿手动调用!"):this._clickEvent.emit(...e)}pointerDbclick(...e){this._useInnerInteraction?console.warn("当前使用内置交互(useInnerInteraction=true),请勿手动调用!"):this._dbclickEvent.emit(...e)}pointerDown(...e){this._useInnerInteraction?console.warn("当前使用内置交互(useInnerInteraction=true),请勿手动调用!"):this._downEvent.emit(...e)}pointerUp(...e){this._useInnerInteraction?console.warn("当前使用内置交互(useInnerInteraction=true),请勿手动调用!"):this._upEvent.emit(...e)}pointerMove(...e){this._useInnerInteraction?console.warn("当前使用内置交互(useInnerInteraction=true),请勿手动调用!"):this._moveEvent.emit(...e)}pointerOut(...e){this._useInnerInteraction?console.warn("当前使用内置交互(useInnerInteraction=true),请勿手动调用!"):this._outEvent.emit(...e)}}class js extends d.Destroyable{constructor(e){super();R(this,"_flyToEvent",this.disposeVar(new d.Event));R(this,"_commandEvent",this.disposeVar(new d.Event));R(this,"_dbclickEvent",this.disposeVar(new d.Event));const n=this;let s=Number.POSITIVE_INFINITY;this.dispose(this.enabledChanged.disposableOn(b=>{s=b??!1?Date.now():Number.POSITIVE_INFINITY}));const o=this.disposeVar(new d.Transition(100));o.reset(0);const r=this.disposeVar(d.createTimeoutWithStartValues(()=>o.target=0,500)),a=this.disposeVar(d.createTimeoutWithStartValues(()=>o.target=1,500));let c=0,h=null;const l=120,u=b=>{b?(c++,h&&(clearTimeout(h),h=null),r.cancel()):(c=Math.max(0,c-1),h&&clearTimeout(h),h=setTimeout(()=>{c===0&&r.restart(),h=null},l))},f=this.disposeVar(new li(e));f.originRatioAndOffset=[.5,.5,0,0],this.dispose(d.track([f,"tooltip"],[n,"title"]));{const b=()=>{f.size=this.mainPoiSize??[12,12]};b(),this.dispose(this.mainPoiSizeChanged.disposableOn(b))}{const b=()=>{f.fgColor=this.mainPoiFgColor??[1,1,1,1]};b(),this.dispose(this.mainPoiFgColorChanged.disposableOn(b))}{const b=()=>{f.bgColor=this.mainPoiBgColor??[0,0,0,.6]};b(),this.dispose(this.mainPoiBgColorChanged.disposableOn(b))}const g=this.disposeVar(d.createNextAnimateFrameEvent(n.showChanged,n.positionChanged,n.descriptionChanged,n.titleChanged,n.imageUriChanged)),_=()=>{f.show=n.show??!0,f.imageUri=n.imageUri??d.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/img/point-yellow.png"),f.position=n.position};_(),this.dispose(g.disposableOn(_)),this.dispose(d.bind([f,"position"],[this,"position"])),this.dispose(d.bind([f,"positionEditing"],[this,"positionEditing"])),this.dispose(this._flyToEvent.disposableOn(b=>f.flyTo(b)));const y=[],w=()=>{y.forEach(b=>{b.destroy()}),y.length=0};this.dispose(w);const E=()=>{w();const{commands:b}=n;if(!b)return;const P=b.length,I=50,M=0,D=-(P*I*Math.PI/180)*.5;for(let L=0;L<P;++L){const[z,q,Y,X]=b[L],Q=D+I*(L+.5)*Math.PI/180,m=Math.sin(Q)*M,v=Math.cos(Q)*M,S=new li(e);S.imageUri=X,S.tooltip=q,S.bgColor=[0,0,0,.6],S.fgColor=[1,1,1,1],S.size=[24,24],S.dispose(d.track([S,"position"],[n,"position"])),S.originRatioAndOffset=[.5,.5,-m,v],S.show=!1,S.opacity=0,S.dispose(S.opacityChanged.disposableOn(A=>S.show=(A??1)>0)),S.dispose(o.currentChanged.disposableOn(A=>S.enabled=A>0)),S.dispose(S.clickEvent.disposableOn(A=>n.commandEvent.emit(z,A))),S.dispose(S.hoveredChanged.disposableOn(u)),y.push(S)}};E(),this.dispose(n.commandsChanged.disposableOn(E)),this.dispose(f.hoveredChanged.disposableOn(u)),this.dispose(f.hoveredChanged.disposableOn(b=>b?n.enabled&&a.restart():a.cancel())),this.dispose(o.currentChanged.disposableOn(b=>{const P=y.length,I=50,M=b*35,D=-(P*I*Math.PI/180)*.5;for(let L=0;L<P;++L){const z=D+I*(L+.5)*Math.PI/180,q=Math.sin(z)*M,Y=Math.cos(z)*M;y[L].originRatioAndOffset=[.5,.5,-q,Y],y[L].opacity=b}})),this.dispose(f.clickEvent.disposableOn(b=>{if(!n.enabled)return;const P=b.__xbsj_listenerTime__;if(!(P!==void 0&&s>P))if(b.button===0)if(n.clickCommandName)n.commandEvent.emit(n.clickCommandName,b);else{if(o.current>0&&o.current<1)return;o.target=o.target===1?0:1}else b.button===2&&n.rightClickCommandName&&n.commandEvent.emit(n.rightClickCommandName,b)})),this.dispose(f.clickOutEvent.disposableOn(()=>{n.enabled&&(o.target=0)})),this.dispose(n.commandEvent.disposableOn(()=>o.target=0)),this.dispose(f.dbclickEvent.disposableOn(b=>{if(!n.enabled)return;const P=b.__xbsj_listenerTime__;P!==void 0&&s>P||(n.dbclickEvent.emit(b),a.isRunning&&r.cancel(),o.target=0)})),this.dispose(o.targetChanged.disposableOn(b=>{b===1&&c===0?r.restart():r.cancel()})),this.dispose(o.targetChanged.disposableOn(b=>b===1&&a.cancel())),this.dispose(o.targetChanged.disposableOn(b=>f.tooltipShow=b===0))}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}get commandEvent(){return this._commandEvent}get dbclickEvent(){return this._dbclickEvent}}(i=>{i.createDefaultProps=()=>({show:!0,enabled:!0,position:d.reactArrayWithUndefined(void 0),positionEditing:!1,title:"",description:"",imageUri:d.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/img/point-yellow.png"),commands:d.reactDeepArrayWithUndefined(void 0,(t,e)=>t.every((n,s)=>n===e[s]),t=>[...t]),clickCommandName:"",rightClickCommandName:"",mainPoiSize:d.reactArrayWithUndefined(void 0),mainPoiBgColor:d.reactArrayWithUndefined(void 0),mainPoiFgColor:d.reactArrayWithUndefined(void 0)})})(js||(js={})),d.extendClassProps(js.prototype,js.createDefaultProps);const dl=`class OLDiv {
95
+ `}function Q_(n){return Math.abs(n)<1e3?`${n.toFixed(2)} m`:`${(n/1e3).toFixed(2)} km`}function xh(n,e=!1){const t=n<0?"-":"",i=Math.abs(n),s=i|0,o=(i-s)*60;if(e)return`${t}${s}°${o.toFixed(3)}′`;const r=o|0,l=((o-r)*60).toFixed(3);return`${t}${s}°${r}′${l}″`}function Jf(n,e){if(n)return Object.prototype.hasOwnProperty.call(n,e)?n[e]!=null?Object.assign({},n[e]):void 0:Jf(n.childPickedInfo,e)}function J_(n,e){const[t]=p.getReactFuncs(e);return p.bind(n,e,i=>{const[s,o,r]=i??[0,0,0];return[s+90,o,r]},i=>{const[s,o,r]=i??[0,0,0];if(!(!t()&&s===-90&&o===0&&r===0))return[Math.abs(s-90)<1e-9?0:s-90,o,r]})}function HR(n,e){const[t,i,s]=e,o=`${t}-${i}-${s}`;let r=p.getExtProp(n,o);return r||(r=p.imageToCanvas(n),p.setCanvasUniformColor(r,e),p.setExtProp(n,o,r)),r}class XR extends p.CanvasPoi{constructor(t,i,s=[32,32],o=[.5,1,0,0],r="#F00F"){super(t);I(this,"_tooltip","");I(this,"_title","");I(this,"__scale",[1,1]);I(this,"_tooltipAlpha",0);I(this,"_bgColor",[.3,.3,.3,.8]);I(this,"_bgColorHexStr",p.getColorHexStr(this._bgColor));I(this,"_fgColor",[1,1,1,1]);I(this,"_fgColorHexStr",p.getColorHexStr(this._fgColor));I(this,"_tooltipShow",this.disposeVar(p.react(!0)));I(this,"_isHoverZoom",this.disposeVar(p.react(!1)));this._image=i,this._size=s,this._originRatioAndOffset=o,this._defaultColorStr=r;const a=new p.Transition(100),l=new p.Transition(100);this.dispose(()=>{a.destroy(),l.destroy()});const c=()=>{this._clickEvent&&!this._clickEvent.empty&&(this.isHoverZoom&&(this.hovered?(this._scale[0]*=1.5,this._scale[1]*=1.5):(this._scale[0]/=1.5,this._scale[1]/=1.5)),this._tooltipAlpha=a.current)};this.dispose(this.activedChanged.disposableOn(u=>{l.target=u?1:0,this.needRedraw()}));const h=()=>{const u=this.tooltipShow&&this.hovered;a.target=u?1:0,c(),this.needRedraw()};this.dispose(this.hoveredChanged.disposableOn(h)),this.dispose(this.tooltipShowChanged.disposableOn(h)),this.dispose(this.selectedChanged.disposableOn(()=>{this.needRedraw()}))}get tooltipShow(){return this._tooltipShow.value}set tooltipShow(t){this._tooltipShow.value=t}get tooltipShowChanged(){return this._tooltipShow.changed}get isHoverZoom(){return this._isHoverZoom.value}set isHoverZoom(t){this._isHoverZoom.value=t}get isHoverZoomChanged(){return this._isHoverZoom.changed}set size(t){const[i,s]=t,[o,r]=this._size;(o!==i||r!==s)&&(this._size[0]=i,this._size[1]=s,this.needRedraw(),this.needPickRedraw())}get size(){return this._size}set _scale(t){const[i,s]=t,[o,r]=this.__scale;(o!==i||r!==s)&&(this.__scale[0]=i,this.__scale[1]=s,this.needRedraw(),this.needPickRedraw())}get _scale(){return this.__scale}set fgColor(t){if(!this._fgColor.every((i,s)=>t[s]===i)){const[i,s,o,r]=t;this._fgColor.splice(0,4,i,s,o,r),this._fgColorHexStr=p.getColorHexStr(this._fgColor),this.needRedraw()}}get fgColor(){return this._fgColor}set bgColor(t){if(!this._bgColor.every((i,s)=>t[s]===i)){const[i,s,o,r]=t;this._bgColor.splice(0,4,i,s,o,r),this._bgColorHexStr=p.getColorHexStr(this._bgColor),this.needRedraw()}}get bgColor(){return this._bgColor}set originRatioAndOffset(t){const[i,s,o,r]=this._originRatioAndOffset,[a,l,c,h]=t;(i!==a||s!==l||o!==c||r!==h)&&(this._originRatioAndOffset.splice(0,4,a,l,c,h),this.needRedraw(),this.needPickRedraw())}get originRatioAndOffset(){return this._originRatioAndOffset}set image(t){this._image!==t&&(this._image=t,this.needRedraw())}get image(){return this._image}set defaultColorStr(t){this._defaultColorStr!==t&&(this._defaultColorStr=t,this.needRedraw())}get defaultColorStr(){return this._defaultColorStr}set tooltip(t){this._tooltip!==t&&(this._tooltip=t,this.needRedraw())}get tooltip(){return this._tooltip}set title(t){this._title!==t&&(this._title=t,this.needRedraw())}get title(){return this._title}draw(t){if(!this._show)return;const[i,s]=this._winPos,o=this._size[0]*this.__scale[0],r=this._size[1]*this.__scale[1],{left:a,top:l,right:c,bottom:h}=p.getDrawRect([i,s],this._size,this.__scale,this._originRatioAndOffset),u=t.globalAlpha;if(t.globalAlpha=this.opacity,this._image){if(this.selected){const d=HR(this._image,[1,0,0]),{left:f,top:g}=p.getDrawRect([i,s],[o+6,r+6],[1,1],this._originRatioAndOffset);t.drawImage(d,f,g,o+6,r+6)}t.drawImage(this._image,a,l,o,r)}else t.fillStyle=this._fgColorHexStr,t.fillRect(a,l,o,r);if(this._title!==""&&p.drawTextBlock(t,i+20,s-16,[0,.5,0,0],this._title,"14px Arial",4,this._fgColorHexStr,this._bgColorHexStr),t.globalAlpha=u,this._hovered&&this._tooltip!==""){const d=t.globalAlpha;t.globalAlpha=this._tooltipAlpha,p.drawTextBlock(t,(a+c)*.5,l-5,[.5,1,0,0],this._tooltip,"12px Arial",4,this._fgColorHexStr,this._bgColorHexStr),t.globalAlpha=d}}drawForPick(t,i){if(!this._show)return;const[s,o]=this._winPos,r=i("default"),a=this._size[0]*this.__scale[0],l=this._size[1]*this.__scale[1],{left:c,top:h}=p.getDrawRect([s,o],this._size,this.__scale,this._originRatioAndOffset);t.fillStyle=r,t.fillRect(c,h,a,l)}}class Ei extends p.Destroyable{constructor(t){var r;super();I(this,"_pickedEvent",this.disposeVar(new p.Event));I(this,"_flyToEvent",this.disposeVar(new p.Event));I(this,"_clickEvent",this.disposeVar(new p.Event));I(this,"_clickOutEvent",this.disposeVar(new p.Event));I(this,"_dbclickEvent",this.disposeVar(new p.Event));I(this,"_dbclickOutEvent",this.disposeVar(new p.Event));I(this,"_clickFunc",this.disposeVar(p.react(void 0)));I(this,"_clickFuncInit",(()=>{this.dispose(this.clickEvent.disposableOn(t=>this.clickFunc&&this.clickFunc(t)))})());I(this,"_geoCanvasPoi");if(!((r=t.extensions)==null?void 0:r.poiContext)){console.warn("poiContext is missing!");return}if(this._geoCanvasPoi=this.disposeVar(new Zi(t)),!t.viewer)return;const{geoCanvasPoi:o}=this;o.canvasPoiClassAndCreateFunc=[XR,a=>new BR(this,a)],this.dispose(p.bind([o,"show"],[this,"show"])),this.dispose(p.bind([o,"enabled"],[this,"enabled"])),this.dispose(p.bind([o,"position"],[this,"position"])),this.dispose(p.bind([o,"positionEditing"],[this,"positionEditing"])),this.dispose(p.track([o,"viewDistanceRange"],[this,"viewDistanceRange"])),this.dispose(p.track([o,"viewDistanceDebug"],[this,"viewDistanceDebug"])),this.dispose(p.track([o,"zOrder"],[this,"zOrder"])),this.dispose(this.flyToEvent.disposableOn(a=>{o.flyTo(a)})),this.dispose(this._clickEvent.disposableOn(a=>{this.pickOnClick&&this.pickedEvent.emit(new p.ESJPickedResult({type:"viewerPicking",pointerEvent:a}))}));{const a=()=>{const l=$R(this.clickFuncStr,["event"]);l&&(this.clickFunc=l)};a(),this.dispose(this.clickFuncStrChanged.disposableOn(a))}}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}get clickEvent(){return this._clickEvent}get clickOutEvent(){return this._clickOutEvent}get dbclickEvent(){return this._dbclickEvent}get dbclickOutEvent(){return this._dbclickOutEvent}get clickFunc(){return this._clickFunc.value}set clickFunc(t){this._clickFunc.value=t}get clickFuncChanged(){return this._clickFunc.changed}get geoCanvasPoi(){return this._geoCanvasPoi}}I(Ei,"defaults",{viewDistanceRange:[1e3,1e4,3e4,6e4],scale:[1,1]}),(n=>{n.createDefaultProps=()=>({show:!0,enabled:!0,position:p.reactArrayWithUndefined(void 0),positionEditing:!1,fgColor:p.reactArray([1,1,1,1]),bgColor:p.reactArray([0,0,0,0]),tooltip:"",tooltipShow:!0,title:"",size:p.reactArray([32,32]),scale:p.reactArray([1,1]),originRatioAndOffset:p.reactArray([.5,1,0,0]),hovered:!1,imageUri:p.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/img/location.png"),opacity:1,viewDistanceRange:p.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,pickOnClick:!1,clickFuncStr:"",zOrder:0,isHoverZoom:!1})})(Ei||(Ei={})),p.extendClassProps(Ei.prototype,Ei.createDefaultProps);class ep extends p.Destroyable{constructor(t,i,s,o){super();I(this,"_divPoi");I(this,"_show",!0);I(this,"_winPosFromCoordinate");I(this,"_zOrderChanged");I(this,"_zOrder");I(this,"depth",0);this._olPoisContext=i;const{viewer:r,divContainer:a,cameraChanged:l}=i;this._winPosFromCoordinate=o||this.disposeVar(new Kf(r)),this._winPosFromCoordinate.coordinate=s,this._divPoi=new p.DivPoi(t,a),this.d(()=>this._divPoi.destroy()),this.d(this._winPosFromCoordinate.changed.disposableOn((c,h)=>{const{left:u,top:d,depth:f}=h,{floatDiv:g}=this._divPoi;g.winPos=[u,d],this.depth=Math.round((1-f)*1e11),g.element.style.zIndex=`${this.zOrder??this.depth}`,this._updateShow(c)})),this.d(this.zOrderChanged.don(()=>{const{floatDiv:c}=this._divPoi;c.element.style.zIndex=`${this.zOrder??this.depth}`,this._updateShow(this._winPosFromCoordinate.winPosValid)}))}_updateShow(t){this._divPoi.show=this._show&&t}get divPoi(){return this._divPoi}set coordinate(t){this._winPosFromCoordinate.coordinate=t}get coordinate(){return this._winPosFromCoordinate.coordinate}get winPosFromCoordinate(){return this._winPosFromCoordinate}set show(t){this._show!==t&&(this._show=t,this._updateShow(this._winPosFromCoordinate.winPosValid))}get show(){return this._show}set zOrder(t){this._zOrder!==t&&(this._zOrder=t,this.zOrderChanged.emit())}get zOrder(){return this._zOrder}get zOrderChanged(){return this._zOrderChanged||(this._zOrderChanged=new p.Event),this._zOrderChanged}}class YR extends p.Destroyable{constructor(t,i,s,o,r){super();I(this,"_olCanvasPoi");I(this,"_olDivPoi");I(this,"_show",!0);I(this,"_winPosFromCoordinate");I(this,"_switchTransition");I(this,"_status","Canvas");I(this,"_statusChanged");this._olPoisContext=s;const{viewer:a}=this._olPoisContext;this._winPosFromCoordinate=r||this.disposeVar(new Kf(a)),this._winPosFromCoordinate.coordinate=o,this._olCanvasPoi=new Qf(t,this._olPoisContext,this._winPosFromCoordinate),this.dispose(()=>this._olCanvasPoi.destroy()),this._olDivPoi=new ep(i,this._olPoisContext,o,this._winPosFromCoordinate),this.dispose(()=>this._olDivPoi.destroy()),this._switchTransition=new p.Transition(300),this.dispose(this._switchTransition.currentChanged.disposableOn((l,c)=>{this._updateShow(),this._olCanvasPoi.canvasPoi.opacity=1-c,this._olDivPoi.divPoi.floatDiv.opacity=c})),this._updateShow()}_updateShow(){this._olCanvasPoi.show=this._show&&this._switchTransition.current<1,this._olDivPoi.show=this._show&&this._switchTransition.current>0}set show(t){this._show!==t&&(this._show=t,this._updateShow())}get show(){return this._show}set coordinate(t){this._winPosFromCoordinate.coordinate=t}get coordinate(){return this._winPosFromCoordinate.coordinate}get winPosFromCoordinate(){return this._winPosFromCoordinate}set status(t){var i;this._status!==t&&(this._status=t,this._switchTransition.target=this._status==="Canvas"?0:1,(i=this._statusChanged)==null||i.emit(this._status))}get status(){return this._status}get statusChanged(){return this._statusChanged||(this._statusChanged=new p.Event),this._statusChanged}get olCanvasPoi(){return this._olCanvasPoi}get olDivPoi(){return this._olDivPoi}}class ew extends p.Destroyable{constructor(t,i=!0){super();I(this,"_divContainer");I(this,"_canvasPrimitivesContext");I(this,"_cameraChanged");I(this,"_clickEvent",this.disposeVar(new p.Event));I(this,"_dbclickEvent",this.disposeVar(new p.Event));I(this,"_downEvent",this.disposeVar(new p.Event));I(this,"_upEvent",this.disposeVar(new p.Event));I(this,"_moveEvent",this.disposeVar(new p.Event));I(this,"_outEvent",this.disposeVar(new p.Event));I(this,"_poiClickedEvent");this._viewer=t,this._useInnerInteraction=i,this._cameraChanged=this.disposeVar(new K_(this._viewer));const s=t.getViewport();this._divContainer=s;const o=document.createElement("div");o.style.position="absolute",o.style.left="0",o.style.top="0",o.style.width="100%",o.style.height="100%",o.style.pointerEvents="none",o.id="xcx",o.style.backgroundColor="rgba(0,0,0,0)",s.appendChild(o),this.dispose(()=>s.removeChild(o));const r=new p.CanvasPrimitivesContext;this._canvasPrimitivesContext=r,o.appendChild(r.element),this.dispose(()=>r.destroy());const a=r.element,l=()=>{const _=a.clientWidth||a.getBoundingClientRect().width||1,E=(a.width||_)/_;return Math.max(1,E)};let c=l();const h=new ResizeObserver(()=>{c=l()});h.observe(a),this.dispose(()=>h.disconnect());const u=_=>{const v=s.getBoundingClientRect();return[_.clientX-v.left,_.clientY-v.top]};let d,f;const g=_=>{d!==_&&(d&&(d.hovered=!1),d=_,d&&(d.hovered=!0))};if(this.dispose(this._moveEvent.disposableOn((_,v,E)=>{const w=r.pick(_*c,v*c,1,1),C=w.length>0?w[0].poi:void 0;g(C)})),this.dispose(this._outEvent.disposableOn((_,v,E)=>{g(void 0)})),this.dispose(this._downEvent.disposableOn((_,v,E)=>{f&&(f.actived=!1);const w=r.pick(_*c,v*c,1,1);if(w.length>0){const C=w[0].poi;C instanceof p.CanvasPrimitive&&(C.actived=!0,f=C)}})),this.dispose(this._upEvent.disposableOn((_,v,E)=>{f&&(f.actived=!1,f=void 0)})),this.dispose(this._clickEvent.disposableOn((_,v,E)=>{var C,P;const w=r.pick(_*c,v*c,1,1);if(w.length>0){(C=this._poiClickedEvent)==null||C.emit(!0);const{poi:R,tag:A}=w[0];for(const O of r.pois)O===R?O.hasClickEvent()&&O.clickEvent.emit(_,v,A,O,E):O.hasClickOutEvent()&&O.clickOutEvent.emit(_,v,"",O,E)}else{(P=this._poiClickedEvent)==null||P.emit(!1);for(const R of r.pois)R.hasClickOutEvent()&&R.clickOutEvent.emit(_,v,"",R,E)}})),this.dispose(this._dbclickEvent.disposableOn((_,v,E)=>{var C,P,R,A,O;const w=r.pick(_*c,v*c,1,1);if(w.length>0){(C=this._poiClickedEvent)==null||C.emit(!0);const{poi:M,tag:z}=w[0];for(const k of r.pois)k===M?(P=k.hasDbclickEvent)!=null&&P.call(k)&&k.dbclickEvent.emit(_,v,z,k,E):(R=k.hasDbclickOutEvent)!=null&&R.call(k)&&k.dbclickOutEvent.emit(_,v,"",k,E)}else{(A=this._poiClickedEvent)==null||A.emit(!1);for(const M of r.pois)(O=M.hasDbclickOutEvent)!=null&&O.call(M)&&M.dbclickOutEvent.emit(_,v,"",M,E)}})),this._useInnerInteraction){const _=this.disposeVar(new p.PointerClick),v=this.disposeVar(new p.PointerHover),E=s,w=this.disposeVar(p.DomElementEvent.create(E,"pointerdown")),C=this.disposeVar(p.DomElementEvent.create(E,"pointermove")),P=this.disposeVar(p.DomElementEvent.create(E,"pointerup")),R=this.disposeVar(p.DomElementEvent.create(E,"pointerout"));this.dispose(w.disposableOn(A=>{_.pointerDown(A),v.pointerDown(A);const[O,M]=u(A);this._downEvent.emit(O,M,A)})),this.dispose(C.disposableOn(A=>{_.pointerMove(A),v.pointerMove(A);const[O,M]=u(A);this._moveEvent.emit(O,M,A)})),this.dispose(P.disposableOn(A=>{_.pointerUp(A),v.pointerUp(A);const[O,M]=u(A);this._upEvent.emit(O,M,A)})),this.dispose(R.disposableOn(A=>{_.pointerOut(A),v.pointerOut(A);const[O,M]=u(A);this._outEvent.emit(O,M,A)})),this.dispose(_.clickEvent.disposableOn(A=>{const[O,M]=u(A);this._clickEvent.emit(O,M,A)})),this.dispose(_.dbclickEvent.disposableOn(A=>{const[O,M]=u(A);this._dbclickEvent.emit(O,M,A)}))}}get useInnerInteraction(){return this._useInnerInteraction}get divContainer(){return this._divContainer}get canvasPrimitivesContext(){return this._canvasPrimitivesContext}get poiClickedEvent(){return this._poiClickedEvent||(this._poiClickedEvent=new p.Event),this._poiClickedEvent}get viewer(){return this._viewer}get cameraChanged(){return this._cameraChanged}pointerClick(...t){this._useInnerInteraction?console.warn("当前使用内置交互(useInnerInteraction=true),请勿手动调用!"):this._clickEvent.emit(...t)}pointerDbclick(...t){this._useInnerInteraction?console.warn("当前使用内置交互(useInnerInteraction=true),请勿手动调用!"):this._dbclickEvent.emit(...t)}pointerDown(...t){this._useInnerInteraction?console.warn("当前使用内置交互(useInnerInteraction=true),请勿手动调用!"):this._downEvent.emit(...t)}pointerUp(...t){this._useInnerInteraction?console.warn("当前使用内置交互(useInnerInteraction=true),请勿手动调用!"):this._upEvent.emit(...t)}pointerMove(...t){this._useInnerInteraction?console.warn("当前使用内置交互(useInnerInteraction=true),请勿手动调用!"):this._moveEvent.emit(...t)}pointerOut(...t){this._useInnerInteraction?console.warn("当前使用内置交互(useInnerInteraction=true),请勿手动调用!"):this._outEvent.emit(...t)}}class xr extends p.Destroyable{constructor(t){super();I(this,"_flyToEvent",this.disposeVar(new p.Event));I(this,"_commandEvent",this.disposeVar(new p.Event));I(this,"_dbclickEvent",this.disposeVar(new p.Event));const i=this;let s=Number.POSITIVE_INFINITY;this.dispose(this.enabledChanged.disposableOn(w=>{s=w??!1?Date.now():Number.POSITIVE_INFINITY}));const o=this.disposeVar(new p.Transition(100));o.reset(0);const r=this.disposeVar(p.createTimeoutWithStartValues(()=>o.target=0,500)),a=this.disposeVar(p.createTimeoutWithStartValues(()=>o.target=1,500));let l=0,c=null;const h=120,u=w=>{w?(l++,c&&(clearTimeout(c),c=null),r.cancel()):(l=Math.max(0,l-1),c&&clearTimeout(c),c=setTimeout(()=>{l===0&&r.restart(),c=null},h))},d=this.disposeVar(new Ei(t));d.originRatioAndOffset=[.5,.5,0,0],this.dispose(p.track([d,"tooltip"],[i,"title"]));{const w=()=>{d.size=this.mainPoiSize??[12,12]};w(),this.dispose(this.mainPoiSizeChanged.disposableOn(w))}{const w=()=>{d.fgColor=this.mainPoiFgColor??[1,1,1,1]};w(),this.dispose(this.mainPoiFgColorChanged.disposableOn(w))}{const w=()=>{d.bgColor=this.mainPoiBgColor??[0,0,0,.6]};w(),this.dispose(this.mainPoiBgColorChanged.disposableOn(w))}const f=this.disposeVar(p.createNextAnimateFrameEvent(i.showChanged,i.positionChanged,i.descriptionChanged,i.titleChanged,i.imageUriChanged)),g=()=>{d.show=i.show??!0,d.imageUri=i.imageUri??p.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/img/point-yellow.png"),d.position=i.position};g(),this.dispose(f.disposableOn(g)),this.dispose(p.bind([d,"position"],[this,"position"])),this.dispose(p.bind([d,"positionEditing"],[this,"positionEditing"])),this.dispose(this._flyToEvent.disposableOn(w=>d.flyTo(w)));const _=[],v=()=>{_.forEach(w=>{w.destroy()}),_.length=0};this.dispose(v);const E=()=>{v();const{commands:w}=i;if(!w)return;const C=w.length,P=50,R=0,A=-(C*P*Math.PI/180)*.5;for(let O=0;O<C;++O){const[M,z,k,q]=w[O],Y=A+P*(O+.5)*Math.PI/180,m=Math.sin(Y)*R,b=Math.cos(Y)*R,S=new Ei(t);S.imageUri=q,S.tooltip=z,S.bgColor=[0,0,0,.6],S.fgColor=[1,1,1,1],S.size=[24,24],S.dispose(p.track([S,"position"],[i,"position"])),S.originRatioAndOffset=[.5,.5,-m,b],S.show=!1,S.opacity=0,S.dispose(S.opacityChanged.disposableOn(L=>S.show=(L??1)>0)),S.dispose(o.currentChanged.disposableOn(L=>S.enabled=L>0)),S.dispose(S.clickEvent.disposableOn(L=>i.commandEvent.emit(M,L))),S.dispose(S.hoveredChanged.disposableOn(u)),_.push(S)}};E(),this.dispose(i.commandsChanged.disposableOn(E)),this.dispose(d.hoveredChanged.disposableOn(u)),this.dispose(d.hoveredChanged.disposableOn(w=>w?i.enabled&&a.restart():a.cancel())),this.dispose(o.currentChanged.disposableOn(w=>{const C=_.length,P=50,R=w*35,A=-(C*P*Math.PI/180)*.5;for(let O=0;O<C;++O){const M=A+P*(O+.5)*Math.PI/180,z=Math.sin(M)*R,k=Math.cos(M)*R;_[O].originRatioAndOffset=[.5,.5,-z,k],_[O].opacity=w}})),this.dispose(d.clickEvent.disposableOn(w=>{if(!i.enabled)return;const C=w.__xbsj_listenerTime__;if(!(C!==void 0&&s>C))if(w.button===0)if(i.clickCommandName)i.commandEvent.emit(i.clickCommandName,w);else{if(o.current>0&&o.current<1)return;o.target=o.target===1?0:1}else w.button===2&&i.rightClickCommandName&&i.commandEvent.emit(i.rightClickCommandName,w)})),this.dispose(d.clickOutEvent.disposableOn(()=>{i.enabled&&(o.target=0)})),this.dispose(i.commandEvent.disposableOn(()=>o.target=0)),this.dispose(d.dbclickEvent.disposableOn(w=>{if(!i.enabled)return;const C=w.__xbsj_listenerTime__;C!==void 0&&s>C||(i.dbclickEvent.emit(w),a.isRunning&&r.cancel(),o.target=0)})),this.dispose(o.targetChanged.disposableOn(w=>{w===1&&l===0?r.restart():r.cancel()})),this.dispose(o.targetChanged.disposableOn(w=>w===1&&a.cancel())),this.dispose(o.targetChanged.disposableOn(w=>d.tooltipShow=w===0))}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}get commandEvent(){return this._commandEvent}get dbclickEvent(){return this._dbclickEvent}}(n=>{n.createDefaultProps=()=>({show:!0,enabled:!0,position:p.reactArrayWithUndefined(void 0),positionEditing:!1,title:"",description:"",imageUri:p.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/img/point-yellow.png"),commands:p.reactDeepArrayWithUndefined(void 0,(e,t)=>e.every((i,s)=>i===t[s]),e=>[...e]),clickCommandName:"",rightClickCommandName:"",mainPoiSize:p.reactArrayWithUndefined(void 0),mainPoiBgColor:p.reactArrayWithUndefined(void 0),mainPoiFgColor:p.reactArrayWithUndefined(void 0)})})(xr||(xr={})),p.extendClassProps(xr.prototype,xr.createDefaultProps);const tp=`class OLDiv {
99
96
  // container是Poi的div
100
97
  // olCustomDivPoi指向当前的OLGeoCustomDivPoi场景对象
101
98
  // viewer指定当前的视口
@@ -130,19 +127,19 @@ ${e};
130
127
  destroy() {
131
128
  this._container.removeChild(this._div);
132
129
  }
133
- }`,Fg=`OL版示例代码:
130
+ }`,tw=`OL版示例代码:
134
131
  \`\`\`
135
- ${dl}
132
+ ${tp}
136
133
  \`\`\`
137
- `,Lg=`<div style="width: 300px; height: 80px; background: rgba(255, 255, 255, 0.9); color: #333; font-size: 14px; line-height: 20px; border: 1px solid #ddd; border-radius: 4px; padding: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.15);">
134
+ `,nw=`<div style="width: 300px; height: 80px; background: rgba(255, 255, 255, 0.9); color: #333; font-size: 14px; line-height: 20px; border: 1px solid #ddd; border-radius: 4px; padding: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.15);">
138
135
  <h3 style="margin:0 0 10px 0;font-size:16px;">Office Label</h3>
139
136
  <p style="margin:0;">Professional business information display</p>
140
137
  </div>
141
- `,rv=`OL版示例代码:
138
+ `,ZR=`OL版示例代码:
142
139
  \`\`\`
143
- ${Lg}
140
+ ${nw}
144
141
  \`\`\`
145
- `;class Qt extends d.Destroyable{constructor(e,n){super();R(this,"_updateEvent",this.disposeVar(new d.Event));R(this,"_instanceClassReact",this.disposeVar(d.react(void 0)));R(this,"_flyToEvent",this.disposeVar(new d.Event));R(this,"_pickedEvent",this.disposeVar(new d.Event));R(this,"_innerHtmlMounted",this.disposeVar(new d.Event));R(this,"_olDivPoi");R(this,"_objResetting");R(this,"_olViewVisibleDistanceRangeControl");this._olViewVisibleDistanceRangeControl=this.disposeVar(new Ig(e,[this,"viewDistanceRange"],[this,"position"])),this.dispose(d.track([this._olViewVisibleDistanceRangeControl,"debug"],[this,"viewDistanceDebug"]));const s=e.viewer;if(!s)return;const o=Mi(s);if(!o)return;const{poiContext:r,labelManager:a}=o;a.add(this),this.ad(()=>{a.delete(this)});const c=this.position?[this.position[0],this.position[1]]:[0,0];console.log(c,"OlGeoCustomDivPoi initialCoord");const h=this._olDivPoi=this.disposeVar(new ul(d.PosFloatDiv,r,c));{const E=()=>{const{contentDiv:b}=h.divPoi.floatDiv;b.style.all=this.cssAllInitial?"initial":"unset"};E(),this.dispose(this.cssAllInitialChanged.disposableOn(E))}const l=this.disposeVar(d.createNextAnimateFrameEvent(this.instanceClassChanged,this.shadowDomChanged)),u=this.disposeVar(new d.ObjResettingWithEvent(l,()=>{const{instanceClass:E}=this;if(!E)return;let{contentDiv:b}=h.divPoi.floatDiv;return b.firstElementChild&&b.removeChild(b.firstElementChild),this.shadowDom&&(b=b.appendChild(document.createElement("div")).attachShadow({mode:"open"}).appendChild(document.createElement("div"))),new E(b,this,e)}));this._objResetting=u;const{_updateEvent:f}=this;this.dispose(f.disposableOn(E=>{if(u.obj)try{E(u.obj,this,e)}catch(b){console.error(`OLCustomDiv update error! ${b}`)}}));const g=()=>{h.divPoi.floatDiv.opacity=(this.opacity??1)*this.visibleAlpha};g(),this.dispose(this.opacityChanged.disposableOn(g)),this.dispose(this.visibleAlphaChanged.disposableOn(g));const _=()=>{const[E,b,P,I]=this.originRatioAndOffset??[.5,1,0,0];h.divPoi.floatDiv.originRatioX=E,h.divPoi.floatDiv.originRatioY=b,h.divPoi.floatDiv.originOffsetX=P,h.divPoi.floatDiv.originOffsetY=I};_(),this.dispose(this.originRatioAndOffsetChanged.disposableOn(_));const y=()=>{if(this.position){const E=_t([this.position[0],this.position[1]]);h.coordinate=E}h.show=(this.show??!0)&&!!this.position&&this.visibleAlpha>0};y(),this.dispose(this.positionChanged.disposableOn(y)),this.dispose(this.showChanged.disposableOn(y)),this.dispose(this.visibleAlphaChanged.disposableOn(y));{const{contentDiv:E}=h.divPoi.floatDiv;E.addEventListener("mouseenter",b=>{(this.allowPicking??!1)&&this.pickFromDiv(E,{pointerEvent:b})}),E.addEventListener("mouseleave",b=>{(this.allowPicking??!1)&&this.pickFromDiv(E,{pointerEvent:b})}),E.addEventListener("mousedown",b=>{(this.allowPicking??!1)&&this.pickFromDiv(E,{pointerEvent:b})}),E.oncontextmenu=b=>{b.preventDefault()}}this.dispose(this.flyToEvent.disposableOn(E=>{if(!this.position){console.warn("OLGeoPoint当前没有位置信息,无法飞入!");return}let b=1e3;if(this.viewDistanceRange){const[P,I,M,D]=this.viewDistanceRange;P>I||I>M||M>D?console.error("viewDistanceRange存在问题,需要满足逐级增大的条件,否则不生效!"):b=(I+M)*.5}Ri(e,this.position,b,void 0,E)}));const w=()=>{try{this.instanceClass=this.instanceClassStr&&Function(`"use strict";return (${this.instanceClassStr})`)()}catch{this.instanceClass=void 0}};w(),this.dispose(this.instanceClassStrChanged.disposableOn(w));{const E=()=>{if(this.innerHTML===void 0){this.instanceClassStr=void 0;return}const b=`class OLDiv {
142
+ `;class kt extends p.Destroyable{constructor(t,i){super();I(this,"_updateEvent",this.disposeVar(new p.Event));I(this,"_instanceClassReact",this.disposeVar(p.react(void 0)));I(this,"_flyToEvent",this.disposeVar(new p.Event));I(this,"_pickedEvent",this.disposeVar(new p.Event));I(this,"_innerHtmlMounted",this.disposeVar(new p.Event));I(this,"_olDivPoi");I(this,"_objResetting");I(this,"_olViewVisibleDistanceRangeControl");this._olViewVisibleDistanceRangeControl=this.disposeVar(new Z_(t,[this,"viewDistanceRange"],[this,"position"])),this.dispose(p.track([this._olViewVisibleDistanceRangeControl,"debug"],[this,"viewDistanceDebug"]));const s=t.viewer;if(!s)return;const o=Ki(s);if(!o)return;const{poiContext:r,labelManager:a}=o;a.add(this),this.ad(()=>{a.delete(this)});const l=this.position?[this.position[0],this.position[1]]:[0,0];console.log(l,"OlGeoCustomDivPoi initialCoord");const c=this._olDivPoi=this.disposeVar(new ep(p.PosFloatDiv,r,l));{const E=()=>{const{contentDiv:w}=c.divPoi.floatDiv;w.style.all=this.cssAllInitial?"initial":"unset"};E(),this.dispose(this.cssAllInitialChanged.disposableOn(E))}const h=this.disposeVar(p.createNextAnimateFrameEvent(this.instanceClassChanged,this.shadowDomChanged)),u=this.disposeVar(new p.ObjResettingWithEvent(h,()=>{const{instanceClass:E}=this;if(!E)return;let{contentDiv:w}=c.divPoi.floatDiv;return w.firstElementChild&&w.removeChild(w.firstElementChild),this.shadowDom&&(w=w.appendChild(document.createElement("div")).attachShadow({mode:"open"}).appendChild(document.createElement("div"))),new E(w,this,t)}));this._objResetting=u;const{_updateEvent:d}=this;this.dispose(d.disposableOn(E=>{if(u.obj)try{E(u.obj,this,t)}catch(w){console.error(`OLCustomDiv update error! ${w}`)}}));const f=()=>{c.divPoi.floatDiv.opacity=(this.opacity??1)*this.visibleAlpha};f(),this.dispose(this.opacityChanged.disposableOn(f)),this.dispose(this.visibleAlphaChanged.disposableOn(f));const g=()=>{const[E,w,C,P]=this.originRatioAndOffset??[.5,1,0,0];c.divPoi.floatDiv.originRatioX=E,c.divPoi.floatDiv.originRatioY=w,c.divPoi.floatDiv.originOffsetX=C,c.divPoi.floatDiv.originOffsetY=P};g(),this.dispose(this.originRatioAndOffsetChanged.disposableOn(g));const _=()=>{if(this.position){const E=Me([this.position[0],this.position[1]]);c.coordinate=E}c.show=(this.show??!0)&&!!this.position&&this.visibleAlpha>0};_(),this.dispose(this.positionChanged.disposableOn(_)),this.dispose(this.showChanged.disposableOn(_)),this.dispose(this.visibleAlphaChanged.disposableOn(_));{const{contentDiv:E}=c.divPoi.floatDiv;E.addEventListener("mouseenter",w=>{(this.allowPicking??!1)&&this.pickFromDiv(E,{pointerEvent:w})}),E.addEventListener("mouseleave",w=>{(this.allowPicking??!1)&&this.pickFromDiv(E,{pointerEvent:w})}),E.addEventListener("mousedown",w=>{(this.allowPicking??!1)&&this.pickFromDiv(E,{pointerEvent:w})}),E.oncontextmenu=w=>{w.preventDefault()}}this.dispose(this.flyToEvent.disposableOn(E=>{if(!this.position){console.warn("OLGeoPoint当前没有位置信息,无法飞入!");return}let w=1e3;if(this.viewDistanceRange){const[C,P,R,A]=this.viewDistanceRange;C>P||P>R||R>A?console.error("viewDistanceRange存在问题,需要满足逐级增大的条件,否则不生效!"):w=(P+R)*.5}Bi(t,this.position,w,void 0,E)}));const v=()=>{try{this.instanceClass=this.instanceClassStr&&Function(`"use strict";return (${this.instanceClassStr})`)()}catch{this.instanceClass=void 0}};v(),this.dispose(this.instanceClassStrChanged.disposableOn(v));{const E=()=>{if(this.innerHTML===void 0){this.instanceClassStr=void 0;return}const w=`class OLDiv {
146
143
  constructor(container, olCustomDivPoi, viewer) {
147
144
  this._container = container;
148
145
  this._div = document.createElement('div');
@@ -155,11 +152,21 @@ ${Lg}
155
152
  destroy() {
156
153
  this._container.removeChild(this._div);
157
154
  }
158
- }`;this.instanceClassStr=b};E(),this.dispose(this.innerHTMLChanged.disposableOn(E))}}update(e){this._updateEvent.emit(e)}get instanceClass(){return this._instanceClassReact.value}set instanceClass(e){this._instanceClassReact.value=e}get instanceClassChanged(){return this._instanceClassReact.changed}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}get pickedEvent(){return this._pickedEvent}pickFromDiv(e,n){(this.allowPicking??!1)&&this.pickedEvent.emit(new d.ESJPickedResult({element:e,...n}))}get innerHtmlMounted(){return this._innerHtmlMounted}get olDivPoi(){return this._olDivPoi}set olDivPoi(e){this._olDivPoi=e}get objResetting(){return this._objResetting}get olViewerVisibleDistanceRangeControl(){return this._olViewVisibleDistanceRangeControl}get visibleAlpha(){return this._olViewVisibleDistanceRangeControl.visibleAlpha}get visibleAlphaChanged(){return this._olViewVisibleDistanceRangeControl.visibleAlphaChanged}}R(Qt,"defaultOLInstanceClassStr",dl),R(Qt,"olInstanceClassStrReadMe",Fg),R(Qt,"defaults",{position:[116.39,39.9,0],instanceClassStr:dl,instanceClassStrReadMe:Fg,innerHTML:Lg,innerHTMLReadMe:rv,viewDistanceRange:[1e3,1e4,3e4,6e4],zOrder:0}),(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,opacity:1,position:d.reactArrayWithUndefined(void 0),originRatioAndOffset:d.reactArray([.5,1,0,0]),instanceClassStr:void 0,innerHTML:void 0,viewDistanceRange:d.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,shadowDom:!1,cssAllInitial:!1,zOrder:0})})(Qt||(Qt={})),d.extendClassProps(Qt.prototype,Qt.createDefaultProps);class av extends d.Destroyable{constructor(t,e,n){super(),this._container=t}}const nc=class nc extends d.Destroyable{constructor(e,n){super();R(this,"_pickedEvent",this.disposeVar(new d.Event));R(this,"_divEvent",this.disposeVar(new d.Event));R(this,"_divCreatedEvent",this.disposeVar(new d.Event));R(this,"_divToDestroyEvent",this.disposeVar(new d.Event));R(this,"_pc",this.disposeVar(new d.PointerClick));R(this,"_flyToEvent",this.disposeVar(new d.Event));R(this,"_customDivPoi");this._customDivPoi=this.disposeVar(new Qt(e,n));const s=this,o=this._customDivPoi;this.dispose(this.flyToEvent.disposableOn(r=>{o.flyTo(r)})),this.dispose(d.bind([o,"show"],[this,"show"])),this.dispose(d.bind([o,"position"],[this,"position"])),this.dispose(d.bind([o,"originRatioAndOffset"],[this,"originRatioAndOffset"])),this.dispose(d.bind([o,"opacity"],[this,"opacity"])),this.dispose(d.bind([o,"viewDistanceRange"],[this,"viewDistanceRange"])),this.dispose(d.bind([o,"viewDistanceDebug"],[this,"viewDistanceDebug"])),this.dispose(d.bind([o,"shadowDom"],[this,"shadowDom"])),this.dispose(d.bind([o,"cssAllInitial"],[this,"cssAllInitial"])),this.dispose(d.bind([o,"allowPicking"],[this,"pickOnClick"])),this.d(d.bind([o,"zOrder"],[this,"zOrder"]));{class r extends av{constructor(c,h,l){super(c,h,l);const u=document.createElement("div");u.style.overflow="hidden",u.style.whiteSpace="nowrap",u.addEventListener("mouseover",()=>{s.divEvent.emit(!0)}),u.addEventListener("mouseout",()=>{s.divEvent.emit(!1)});{{const g=()=>{o.show=s.show??!0,u.style.pointerEvents="all",s.width===void 0?u.style.width="auto":u.style.width=`${s.width}px`,s.height===void 0?u.style.height="auto":u.style.height=`${s.height}px`,s.text!==void 0?u.innerHTML=`${s.text.replace(/\n/g,"<br/>")??"请输入文字"}`:u.innerHTML="请输入文字",u.style.fontSize=`${s.fontSize??14}px`,u.style.fontFamily=`${s.fontFamily??nc.defaults.fontFamily}`;const y=s.borderRadius??[6,6,6,6];u.style.borderRadius=`${y[0]}px ${y[1]}px ${y[2]}px ${y[3]}px`;const w=s.color??[1,1,1,1];u.style.color=`rgba(${w[0]*255},${w[1]*255},${w[2]*255},${w[3]})`;const E=s.backgroundColor??[0,0,0,.8];u.style.backgroundColor=`rgba(${E[0]*255},${E[1]*255},${E[2]*255},${E[3]})`;const b=s.padding??[5,5,5,5];u.style.padding=`${b[0]}px ${b[1]}px ${b[2]}px ${b[3]}px`,u.style.borderWidth=`${s.borderWidth??0}px`;const P=s.borderColor??[1,1,1,1];u.style.borderColor=`rgba(${P[0]*255},${P[1]*255},${P[2]*255},${P[3]})`,u.style.borderStyle=`${s.borderStyle??"solid"}`,u.style.textAlign=`${s.textAlign??"left"}`,u.style.transform=`scale(${s.scale[0]??1},${s.scale[1]??1}) rotate(${s.rotate??0}deg)`};g();const _=this.disposeVar(d.createNextAnimateFrameEvent(s.showChanged,s.widthChanged,s.heightChanged,s.textChanged,s.fontSizeChanged,s.borderRadiusChanged,s.colorChanged,s.backgroundColorChanged,s.paddingChanged,s.borderWidthChanged,s.borderColorChanged,s.borderStyleChanged,s.fontFamilyChanged,s.textAlignChanged,s.scaleChanged,s.rotateChanged));this.dispose(_.disposableOn(g))}{const g=()=>{s.textEditing?(u.contentEditable="true",u.focus(),document.execCommand("selectAll",!1,null)):(u.contentEditable="false",document.execCommand("unselect",!1,null))};g(),this.dispose(s.textEditingChanged.disposableOn(g))}{const g=()=>{s.textEditingInteraction||(s.positionEditing??!1?u.style.pointerEvents="none":u.style.pointerEvents="all")};g(),this.dispose(s.positionEditingChanged.disposableOn(g))}let f=null;this.dispose(()=>clearInterval(f));{const g=()=>{u.ondblclick=()=>{s.positionEditing&&(s.positionEditing=!1),s.textEditingInteraction&&(s.textEditing=!0)},u.onblur=()=>{s.text=u.innerText,s.textEditingInteraction&&(f&&clearTimeout(f),f=setTimeout(()=>{s.textEditing=!1},100))},u.addEventListener("keydown",function(_){s.textEditingInteraction&&(_.code==="Enter"&&!_.shiftKey&&u.blur(),_.code==="Escape"&&u.blur())})};g(),this.dispose(s.textEditingInteractionChanged.disposableOn(g))}}this._container.appendChild(u),this.dispose(()=>{this._container.removeChild(u)}),s._divCreatedEvent.emit(u),this.dispose(()=>s._divToDestroyEvent.emit(u))}}o.instanceClass=r}this.dispose(o.pickedEvent.don(r=>{(o.allowPicking??!1)&&s.pickedEvent.emit(r)}))}get pickedEvent(){return this._pickedEvent}get divEvent(){return this._divEvent}get divCreatedEvent(){return this._divCreatedEvent}get divToDestroyEvent(){return this._divToDestroyEvent}get pc(){return this._pc}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}get customDivPoi(){return this._customDivPoi}};R(nc,"defaults",{width:80,height:28,text:"请输入文字",borderStyle:"solid",fontFamily:"",viewDistanceRange:[1e3,1e4,3e4,6e4],scale:[1,1],zOrder:0});let pn=nc;(i=>{i.createDefaultProps=()=>({show:!0,position:d.reactArrayWithUndefined(void 0),text:void 0,width:void 0,height:void 0,fontFamily:void 0,positionEditing:!1,textEditing:!1,textEditingInteraction:!1,originRatioAndOffset:d.reactArray([.5,1,0,0]),opacity:1,fontSize:14,textAlign:"left",color:d.reactArray([1,1,1,1]),backgroundColor:d.reactArray([0,0,0,.8]),padding:d.reactArray([5,5,5,5]),borderRadius:d.reactArray([6,6,6,6]),borderWidth:0,borderColor:d.reactArray([1,1,1,1]),borderStyle:"solid",viewDistanceRange:d.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,pickOnClick:!1,shadowDom:!1,cssAllInitial:!1,scale:d.reactArray([1,1]),zOrder:0,rotate:0})})(pn||(pn={})),d.extendClassProps(pn.prototype,pn.createDefaultProps);class zg extends d.Destroyable{constructor(e){super();R(this,"_enabled",this.disposeVar(d.react(!1)));R(this,"_cursorPosition",d.react(void 0));R(this,"quickPickPosition",!0);let n=new d.Destroyable;const s=()=>{n&&(n.destroy(),n=void 0)};this.dispose(s);const o=()=>{var f;if(s(),!this._enabled.value||!e)return;const r=Mi(e);if(!r)return;n=new d.Destroyable;const a=n.disposeVar(d.react(void 0)),c=n.disposeVar(d.createNextAnimateFrameEvent(a.changed)),h=(f=e.getTargetElement)==null?void 0:f.call(e);if(!h)return;const l=g=>{const _=d.getDomEventCurrentTargetPos(g);a.value=_};h.addEventListener("mousemove",l),n.dispose(()=>h.removeEventListener("mousemove",l));const u=n.disposeVar(d.createProcessingFromAsyncFunc(async g=>{const _=r.pickingManager;if(!_||!a.value)return;const y=a.value,w=this.quickPickPosition?await g.promise(d.createCancelablePromise(_.quickPickPosition(y))):await g.promise(d.createCancelablePromise(_.pickPosition(y)));this._cursorPosition.value=w}));n.dispose(c.disposableOn(()=>{u.restart()}))};o(),this.dispose(this._enabled.changed.disposableOn(o))}get enabled(){return this._enabled.value}set enabled(e){this._enabled.value=e}get enabledChanged(){return this._enabled.changed}get cursorPosition(){return this._cursorPosition.value}get cursorPositionChanged(){return this._cursorPosition.changed}}class Ng extends d.Destroyable{constructor(e){super();R(this,"_baseLayers",new Set);R(this,"_imageryGroup",new sn({zIndex:-9999,visible:!0}));this._map=e,this._map.addLayer(this._imageryGroup),this.d(()=>this._map.removeLayer(this._imageryGroup))}get baseLayers(){return this._baseLayers}get map(){return this._map}add(e){if(this._baseLayers.has(e)){console.warn("imageriesManager add error: has already added!",e);return}this._imageryGroup.getLayers().push(e),this._baseLayers.add(e)}delete(e){if(!this._baseLayers.has(e)){console.warn("imageriesManager delete error: has not added!",e);return}this._imageryGroup.getLayers().remove(e),this._baseLayers.delete(e)}setZindex(e,n){if(!this._baseLayers.has(e)){console.warn("imageriesManager setZindex error: has not added!",e);return}e.setZIndex(n-9999)}}class Ug extends d.Destroyable{constructor(e){super();R(this,"_labelMap",{div:new globalThis.Map,canvas:new globalThis.Map});this._map=e;const n=e.getView(),s=[];s.push(n.on("change:center",()=>this._updateZOrder())),s.push(n.on("change:resolution",()=>this._updateZOrder())),s.push(n.on("change:rotation",()=>this._updateZOrder())),s.push(e.on("moveend",()=>this._updateZOrder())),this.dispose(()=>gi(s))}add(e){const n=e instanceof Qt?"div":"canvas";if(this._labelMap[n].has(e)){console.warn(`Label already exists in ${n} map`,e);return}const s=new d.Destroyable;{const o=s.dv(d.createNextAnimateFrameEvent(e.zOrderChanged,e.positionChanged));s.dispose(o.don(()=>this._updateZOrder()))}this._labelMap[n].set(e,()=>s.destroy()),this._updateZOrder()}delete(e){const n=e instanceof Qt?"div":"canvas";if(!this._labelMap[n].has(e)){console.warn(`Label not found in ${n} map`,e);return}const s=this._labelMap[n].get(e);s==null||s(),this._labelMap[n].delete(e),this._updateZOrder()}_updateZOrder(){for(const e in this._labelMap)Object.prototype.hasOwnProperty.call(this._labelMap,e)&&this._updateLabelZOrder(this._labelMap[e],e)}_updateLabelZOrder(e,n){var a;const s={};for(const c of e.keys()){const h=c.zOrder.toString();s[h]||(s[h]=new globalThis.Map);const l=c instanceof Qt&&c.olDivPoi?c.olDivPoi.depth:c instanceof Ai&&c.canvasObj&&((a=c.canvasObj.olCanvasPoi)==null?void 0:a.depth)||0;s[h].set(c,l)}const o=Object.keys(s).sort((c,h)=>n==="div"?Number(h)-Number(c):Number(c)-Number(h));let r=e.size;o.forEach(c=>{new globalThis.Map([...s[c]].sort((l,u)=>u[1]-l[1])).forEach((l,u)=>{var f;u instanceof Qt&&u.olDivPoi?u.olDivPoi.zOrder=r:u instanceof Ai&&((f=u.canvasObj)!=null&&f.olCanvasPoi)&&(u.canvasObj.olCanvasPoi.zOrder=r),r--})})}}class jg extends Jc{constructor(t){super(t),this.image_=null}getImage(){return this.image_?this.image_.getImage():null}prepareFrame(t){const e=t.layerStatesArray[t.layerIndex],n=t.pixelRatio,s=t.viewState,o=s.resolution,r=this.getLayer().getSource(),a=t.viewHints;let c=t.extent;if(e.extent!==void 0&&(c=An(c,_i(e.extent,s.projection))),!a[Bt.ANIMATING]&&!a[Bt.INTERACTING]&&!Xi(c))if(r){const h=s.projection,l=r.getImage(c,o,n,h);l&&(this.loadImage(l)?this.image_=l:l.getState()===ot.EMPTY&&(this.image_=null))}else this.image_=null;return!!this.image_}getData(t){const e=this.frameState;if(!e)return null;const n=this.getLayer(),s=Ut(e.pixelToCoordinateTransform,t.slice()),o=n.getExtent();if(o&&!so(o,s))return null;const r=this.image_.getExtent(),a=this.getImage(),c=yt(r),h=Math.floor(a.width*((s[0]-r[0])/c));if(h<0||h>=a.width)return null;const l=Ht(r),u=Math.floor(a.height*((r[3]-s[1])/l));return u<0||u>=a.height?null:this.getImageData(a,h,u)}renderFrame(t,e){const n=this.image_,s=n.getExtent(),o=n.getResolution(),r=n.getPixelRatio(),a=t.layerStatesArray[t.layerIndex],c=t.pixelRatio,h=t.viewState,l=h.center,u=h.resolution,f=c*o/(u*r),g=t.extent,_=h.resolution,y=h.rotation,w=Math.round(yt(g)/_*c),E=Math.round(Ht(g)/_*c);qe(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/c,1/c,y,-w/2,-E/2),Or(this.inversePixelTransform,this.pixelTransform);const b=fc(this.pixelTransform);this.useContainer(e,b,this.getBackground(t));const P=this.context,I=P.canvas;I.width!=w||I.height!=E?(I.width=w,I.height=E):this.containerReused||P.clearRect(0,0,w,E);let M=!1,D=!0;if(a.extent){const X=_i(a.extent,h.projection);D=te(X,t.extent),M=D&&!Tn(X,t.extent),M&&this.clipUnrotated(P,t,X)}const L=this.getImage(),z=qe(this.tempTransform,w/2,E/2,f,f,0,r*(s[0]-l[0])/o,r*(l[1]-s[3])/o);this.renderedResolution=o*c/r;const q=L.width*z[0],Y=L.height*z[3];if(this.getLayer().getSource().getInterpolate()||(P.imageSmoothingEnabled=!1),this.preRender(P,t),D&&q>=.5&&Y>=.5){const X=z[4],Q=z[5],m=a.opacity;let v;m!==1&&(v=P.globalAlpha,P.globalAlpha=m),P.drawImage(L,0,0,+L.width,+L.height,X,Q,q,Y),m!==1&&(P.globalAlpha=v)}return this.postRender(P,t),M&&P.restore(),P.imageSmoothingEnabled=!0,b!==I.style.transform&&(I.style.transform=b),this.container}}class cv extends jg{constructor(t){super(t),this.vectorRenderer_=new Pd(t),this.layerImageRatio_=t.getImageRatio(),this.coordinateToVectorPixelTransform_=be(),this.renderedPixelToCoordinateTransform_=null}disposeInternal(){this.vectorRenderer_.dispose(),super.disposeInternal()}getFeatures(t){if(!this.vectorRenderer_)return Promise.resolve([]);const e=Ut(this.coordinateToVectorPixelTransform_,Ut(this.renderedPixelToCoordinateTransform_,t.slice()));return this.vectorRenderer_.getFeatures(e)}handleFontsChanged(){this.vectorRenderer_.handleFontsChanged()}prepareFrame(t){const e=t.pixelRatio,n=t.viewState,s=n.resolution,o=t.viewHints,r=this.vectorRenderer_;let a=t.extent;this.layerImageRatio_!==1&&(a=a.slice(0),em(a,this.layerImageRatio_));const c=yt(a)/s,h=Ht(a)/s;if(!o[Bt.ANIMATING]&&!o[Bt.INTERACTING]&&!Xi(a)){r.useContainer(null,null);const l=r.context,u=t.layerStatesArray[t.layerIndex],f=Object.assign({},u,{opacity:1}),g=Object.assign({},t,{declutterTree:new Xc(9),extent:a,size:[c,h],viewState:Object.assign({},t.viewState,{rotation:0}),layerStatesArray:[f],layerIndex:0});let _=!0;const y=new Md(a,s,e,l.canvas,function(w){r.prepareFrame(g)&&r.replayGroupChanged&&(r.clipping=!1,r.renderFrame(g,null)&&(r.renderDeclutter(g),_=!1),w())});y.addEventListener(ht.CHANGE,()=>{if(y.getState()!==ot.LOADED)return;this.image_=_?null:y;const w=y.getResolution(),E=y.getPixelRatio(),b=w*e/E;this.renderedResolution=b,this.coordinateToVectorPixelTransform_=qe(this.coordinateToVectorPixelTransform_,c/2,h/2,1/b,-1/b,0,-n.center[0],-n.center[1])}),y.load()}return this.image_&&(this.renderedPixelToCoordinateTransform_=t.pixelToCoordinateTransform.slice()),!!this.image_}preRender(){}postRender(){}renderDeclutter(){}forEachFeatureAtCoordinate(t,e,n,s,o){return this.vectorRenderer_?this.vectorRenderer_.forEachFeatureAtCoordinate(t,e,n,s,o):super.forEachFeatureAtCoordinate(t,e,n,s,o)}}class hv extends dd{constructor(t){t=t||{};const e=Object.assign({},t);delete e.imageRatio,super(e),this.imageRatio_=t.imageRatio!==void 0?t.imageRatio:1}getImageRatio(){return this.imageRatio_}createRenderer(){return new cv(this)}}class kg extends d.Destroyable{constructor(e){super();R(this,"_map");this._map=e.viewer}async pickPosition(e){return new Promise(n=>{try{if(!this._map)return n(void 0);const s=this._map.getCoordinateFromPixel(e),[o,r]=Kt(s);n([o,r,0])}catch(s){return console.error(s),n(void 0)}})}async quickPickPosition(e){return await this.pickPosition(e)}async pick(e,n,s){return new Promise(o=>{try{if(!this._map)return o(void 0);const r=[];this._map.forEachFeatureAtPixel(e,(g,_)=>{console.log("forEachFeatureAtPixel",g,_),r.push([g,_])}),console.log("pickedObjects",r);const a=r.length>0?r[0]:void 0;if(!a)return o(void 0);const c=a[0].getId();if(!c)return o(void 0);let h=d.ESSceneObject.getSceneObjectById(c.toString());if(h&&h.parentID&&(h=d.ESSceneObject.getSceneObjectById(h.parentID)),!h)return o(void 0);console.log("sceneObject:",h);const l=new d.ESJPickedResult(a,h,void 0,void 0,s,e);return h&&Reflect.has(h,"allowPicking")&&Reflect.has(h,"pickedEvent")&&(h.allowPicking??!1)&&h.pickedEvent.emit(l),h&&Reflect.has(h,"allowPicking")&&!(h.allowPicking??!1)?o(new d.ESJPickedResult):o(l)}catch(r){return console.error(r),o(void 0)}})}_layerPickable(e){return!e||e instanceof sn?!1:e instanceof oi||e instanceof hv}_resolveSceneObject(e,n){var a,c;let s;const o=(a=e==null?void 0:e.get)==null?void 0:a.call(e,"ESSceneObjectID");if(typeof o=="string"&&(s=o),!s){const h=(c=n==null?void 0:n.get)==null?void 0:c.call(n,"ESSceneObjectID");typeof h=="string"&&(s=h)}let r=s?d.ESSceneObject.getSceneObject(s):void 0;return r&&r.parentID&&(r=d.ESSceneObject.getSceneObject(r.parentID)),r}_buildGeoJsonPickInfo(e,n,s){var l;const o=e.getGeometry(),r=((l=o==null?void 0:o.getType)==null?void 0:l.call(o))??"Point",a=e.getProperties?e.getProperties():{},{geometry:c,...h}=a||{};return r==="Point"?{type:"Point",coordinates:[n,s,0],properties:h}:{type:r,coordinates:void 0,properties:h}}}function Mi(i){return d.getExtProp(i,"_viewerExtensions")}function Wa(i,t){d.setExtProp(i,"_viewerExtensions",t)}class Wg extends d.Destroyable{constructor(e,n){super();R(this,"_imageriesManager");R(this,"_labelManager");R(this,"_pickingManager");R(this,"_poiContext");R(this,"_cursorPositionInfo");this._viewer=e,this._olViewer=n,this._imageriesManager=this.dv(new Ng(e)),this._labelManager=this.dv(new Ug(e)),this._poiContext=this.disposeVar(new Dg(this._viewer)),this._cursorPositionInfo=this.dv(new zg(e)),this.ad(n.viewerChanged.don(()=>{this._pickingManager=this.dv(new kg(n))}))}get viewer(){return this._viewer}get olViewer(){return this._olViewer}get imageriesManager(){return this._imageriesManager}get labelManager(){return this._labelManager}get pickingManager(){return this._pickingManager}get poiContext(){return this._poiContext}get cursorPositionInfo(){return this._cursorPositionInfo}}class lv extends d.Destroyable{constructor(t,e){super(),this._olViewer=t,this._viewer=e;const n=this._viewer,s=n.getView();{let o=this._olViewer.disabledInputStack===0;const r=()=>{var c;const a=this._olViewer.disabledInputStack===0;a!==o&&(o=a,a?this._olViewer.restoreMapInteraction():(this._olViewer.changeToMap(),(c=s.cancelAnimations)==null||c.call(s),this._olViewer.suspendMapInteraction()))};r(),this.dispose(this._olViewer.disabledInputStackChanged.don(r))}{const o=()=>{this._olViewer.cameraChanged.emit()},r=s.on("change:center",()=>o()),a=s.on("change:resolution",()=>o()),c=s.on("change:rotation",()=>o());this.d(()=>{gi([r,a,c])})}{let o=performance.now(),r=0;const a=()=>{var u;const h=performance.now();r++;const l=h-o;l>1e3&&(((u=this._olViewer._fps)==null?void 0:u.value)!==void 0&&(this._olViewer._fps.value=r*1e3/l|0),o=h,r=0)},c=n.on("postrender",a);this.d(()=>gi(c))}}get olViewer(){return this._olViewer}get viewer(){return this._viewer}}const Xs=class Xs extends d.ESViewer{constructor(e){super(e);R(this,"_viewer",this.dv(d.react(void 0)));R(this,"orbitController",null);R(this,"_fpsMonitor",null);R(this,"wasdController",null);R(this,"_disabledInputStack",this.disposeVar(d.react(0)));R(this,"_interactionBackup",null);R(this,"_notSupportEditingCount",this.disposeVar(d.react(0)));R(this,"_editingSystem",this.ad(Tp()));if(e.type!==Xs.type)throw new Error("option.type must be ESOlViewer");this.d(this._viewer.changed.don(n=>{this.viewerChanged.emit(n)})),this.dv(new d.ObjResettingWithEvent(this.viewerChanged,()=>{if(this.viewer)return new lv(this,this.viewer)})),this.dv(new d.ObjResettingWithEvent(this.subContainerChanged,()=>{if(this.setStatus("Raw"),this.setStatusLog(""),!!this.subContainer)return new Z1(this.subContainer,this,n=>this._viewer.value=n)}))}get viewer(){return this._viewer.value}get extensions(){return this.viewer&&Mi(this.viewer)}get disabledInputStack(){return this._disabledInputStack.value}set disabledInputStack(e){this._disabledInputStack.value=e}get disabledInputStackChanged(){return this._disabledInputStack.changed}incrementDisabledInputStack(){++this._disabledInputStack.value}decrementDisabledInputStack(){--this._disabledInputStack.value}_suspendMapInteraction(){!this.viewer||this._interactionBackup||(this._interactionBackup=this.viewer.getInteractions().getArray().slice(),this.viewer.getInteractions().clear())}_restoreMapInteraction(){!this.viewer||!this._interactionBackup||(this._interactionBackup.forEach(e=>{var n;return(n=this.viewer)==null?void 0:n.getInteractions().push(e)}),this._interactionBackup=null)}restoreMapInteraction(){this._restoreMapInteraction()}suspendMapInteraction(){this._suspendMapInteraction()}_func(e=!1){return console.warn("ESOlViewer 暂未实现该方法!"),Promise.resolve(void 0)}setRotation(e){if(!this.viewer)return;this.viewer.getView().setRotation(e*Math.PI/180)}async pick(e,n,s){if(!this.extensions)return;const{pickingManager:o}=this.extensions;return await o.pick(e,void 0,n)}async pickPosition(e){if(!this.extensions)return;const{pickingManager:n}=this.extensions;return await n.pickPosition(e)}async quickPickPosition(e){if(!this.extensions)return;const{pickingManager:n}=this.extensions;return await n.quickPickPosition(e)}flyIn(e,n,s){if(!this.viewer)return;const o=kn(e[2]);this.viewer.getView().animate({center:_t([e[0],e[1]]),zoom:o,duration:(s??1)*1e3})}flyTo(e,n){if(!this.viewer)return;const s=kn(e.distance);this.viewer.getView().animate({center:_t([n[0],n[1]]),zoom:s,duration:(e.flyDuration??1)*1e3})}flyToBoundingSphere(e,n,s){if(!this.viewer)return;const o={_duration:(s??1)*1e3};console.log(e);const r=_t([e[0],e[1]]),a=_t([e[2],e[3]]);this.viewer.getView().fit(Fc([r[0],r[1],a[0],a[1]]),{duration:o._duration,easing:Pn,padding:[10,10,10,10]})}async getTerrainHeight(e){return console.warn("openlayers不支持获取地形高度!"),0}getCurrentCameraInfo(){if(!this.viewer)return;const e=this.viewer.getView().getZoom();if(!e)return;const n=Io(e),s=this.viewer.getView().getCenter();if(!s)return;const o=Kt(s),r=this.viewer.getView().getRotation();return{position:[o[0],o[1],n],rotation:[0,r/(Math.PI/180),0]}}transformFlyParam(e,n){}calcFlyToParam(e){const n=this.getCurrentCameraInfo();if(!n)return;const{position:s,rotation:o}=n,r=d.geoRhumbDistance(s,e),a=e[0]-s[0],c=e[1]-s[1],l=Math.atan2(a,c)*180/Math.PI,u=e[2]-s[2],g=Math.atan2(u,r)*180/Math.PI,_=l+90;return{distance:r,heading:_,pitch:g,flyDuration:1,hDelta:-(o[0]-_),pDelta:o[1]-g}}getLengthInPixel(){if(this.viewer)return this.viewer.getView().getResolution()}changeToWalk(e){this.viewer&&(this.changeToMap(),this.container&&(this.wasdController=this.dv(new Kd(this.container,this.viewer,[e[0],e[1]]))))}changeToMap(){var e;this.wasdController&&(this.wasdController.destroy(),this.wasdController=null),this.orbitController&&(this.orbitController.stop(),this.orbitController=null,(e=this.viewer)==null||e.getView().setRotation(0))}changeToRotateGlobe(e,n,s){this.changeToMap(),console.warn("Openlayers引擎暂不支持全球旋转,已切换为Map模式")}changeToLine(e,n,s,o,r,a){this._func()}changeToUserDefined(e){this.changeToMap(),console.warn("Openlayers引擎暂不支持自定义漫游,已切换为Map模式")}changeToRotatePoint(e,n=5e4,s=60,o=90,r=0){if(!this.viewer)return;const a=this.viewer.getView();this.changeToMap();const c={_distance:n,_orbitPeriod:s*1e3,heading:o},h=kn(c._distance);a.setZoom(h),this.orbitController=Zd(this.viewer,{center:[e[0],e[1]],orbitPeriod:c._orbitPeriod,heading:c.heading})}changeToFollow(e,n,s,o){this._func()}getFPS(){return this.viewer&&!this._fpsMonitor&&(this._fpsMonitor=this.dv(new Qd(this.viewer))),this._fpsMonitor?this._fpsMonitor.getFPS():0}async getVersion(){const e=window.g_XE3CopyRights??{};return e.openlayers=Up,e}getHeightByLonLat(e,n,s){return console.warn("getHeightByLonLat is not supported in OpenLayers"),Promise.resolve(0)}getHeightsByLonLats(e,n){return console.warn("getHeightsByLonLats is not supported in OpenLayers"),Promise.resolve([])}async capture(e,n){if(this.viewer)return await $d(this.viewer,e,n)}lonLatAltToScreenPosition(e){var r;const n=[e[0],e[1]],s=_t(n),o=(r=this.viewer)==null?void 0:r.getPixelFromCoordinate(s);return o?Promise.resolve([o[0],o[1]]):Promise.resolve(void 0)}getBoundSphere(e){return this._func()}get notSupportEditingCount(){return this._notSupportEditingCount.value}set notSupportEditingCount(e){this._notSupportEditingCount.value=e}get notSupportEditingCountChanged(){return this._notSupportEditingCount.changed}startEditing(e,n,s){s=Object.assign({useKeyToSwitch:!0,callSource:"outer"},s);const o=e.components.main??e;o&&n!=null&&(o.editingID=`${s.callSource}_${d.createGuid()}`,this._editingSystem.restart(void 0,this,o,n,s.useKeyToSwitch))}stopEditing(){this._editingSystem.isRunning&&this._editingSystem.cancel()}moveObjects(e){this._func()}getViewExtent(){if(!this.viewer)return console.warn("ESOlViewer: OpenLayers viewer not initialized."),Promise.resolve(void 0);const n=this.viewer.getView().calculateExtent(this.viewer.getSize());if(console.log(n),!n)return Promise.resolve(void 0);const s=Kt([n[0],n[1]]),o=Kt([n[2],n[3]]),r=[s[0],s[1],o[0],o[1]];return console.log(r),Promise.resolve(r)}};R(Xs,"type",Xs.register("ESOlViewer",Xs));let ui=Xs;(i=>{i.createDefaultProps=()=>({...d.ESViewer.createDefaultProps()})})(ui||(ui={})),d.extendClassProps(ui.prototype,ui.createDefaultProps);class uv extends yo{constructor(t){t=t||{},super(t)}}class fl extends uv{constructor(t){super(t)}createRenderer(){return new jg(this)}getData(t){return super.getData(t)}}const qa={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class dv extends yo{constructor(t){t=t||{};const e=Object.assign({},t);delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.setPreload(t.preload!==void 0?t.preload:0),this.setUseInterimTilesOnError(t.useInterimTilesOnError!==void 0?t.useInterimTilesOnError:!0)}getPreload(){return this.get(qa.PRELOAD)}setPreload(t){this.set(qa.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(qa.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(qa.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}}const qg=.5,fv=10,Gg=.25;class Vg{constructor(t,e,n,s,o,r){this.sourceProj_=t,this.targetProj_=e;let a={};const c=Fn(this.targetProj_,this.sourceProj_);this.transformInv_=function(b){const P=b[0]+"/"+b[1];return a[P]||(a[P]=c(b)),a[P]},this.maxSourceExtent_=s,this.errorThresholdSquared_=o*o,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&yt(s)>=yt(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?yt(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?yt(this.targetProj_.getExtent()):null;const h=Ae(n),l=Mr(n),u=Ar(n),f=Tr(n),g=this.transformInv_(h),_=this.transformInv_(l),y=this.transformInv_(u),w=this.transformInv_(f),E=fv+(r?Math.max(0,Math.ceil(Math.log2(mc(n)/(r*r*256*256)))):0);if(this.addQuad_(h,l,u,f,g,_,y,w,E),this.wrapsXInSource_){let b=1/0;this.triangles_.forEach(function(P,I,M){b=Math.min(b,P.source[0][0],P.source[1][0],P.source[2][0])}),this.triangles_.forEach(P=>{if(Math.max(P.source[0][0],P.source[1][0],P.source[2][0])-b>this.sourceWorldWidth_/2){const I=[[P.source[0][0],P.source[0][1]],[P.source[1][0],P.source[1][1]],[P.source[2][0],P.source[2][1]]];I[0][0]-b>this.sourceWorldWidth_/2&&(I[0][0]-=this.sourceWorldWidth_),I[1][0]-b>this.sourceWorldWidth_/2&&(I[1][0]-=this.sourceWorldWidth_),I[2][0]-b>this.sourceWorldWidth_/2&&(I[2][0]-=this.sourceWorldWidth_);const M=Math.min(I[0][0],I[1][0],I[2][0]);Math.max(I[0][0],I[1][0],I[2][0])-M<this.sourceWorldWidth_/2&&(P.source=I)}})}a={}}addTriangle_(t,e,n,s,o,r){this.triangles_.push({source:[s,o,r],target:[t,e,n]})}addQuad_(t,e,n,s,o,r,a,c,h){const l=Ir([o,r,a,c]),u=this.sourceWorldWidth_?yt(l)/this.sourceWorldWidth_:null,f=this.sourceWorldWidth_,g=this.sourceProj_.canWrapX()&&u>.5&&u<1;let _=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const w=Ir([t,e,n,s]);_=yt(w)/this.targetWorldWidth_>Gg||_}!g&&this.sourceProj_.isGlobal()&&u&&(_=u>Gg||_)}if(!_&&this.maxSourceExtent_&&isFinite(l[0])&&isFinite(l[1])&&isFinite(l[2])&&isFinite(l[3])&&!te(l,this.maxSourceExtent_))return;let y=0;if(!_&&(!isFinite(o[0])||!isFinite(o[1])||!isFinite(r[0])||!isFinite(r[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(c[0])||!isFinite(c[1]))){if(h>0)_=!0;else if(y=(!isFinite(o[0])||!isFinite(o[1])?8:0)+(!isFinite(r[0])||!isFinite(r[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(c[0])||!isFinite(c[1])?1:0),y!=1&&y!=2&&y!=4&&y!=8)return}if(h>0){if(!_){const w=[(t[0]+n[0])/2,(t[1]+n[1])/2],E=this.transformInv_(w);let b;g?b=($i(o[0],f)+$i(a[0],f))/2-$i(E[0],f):b=(o[0]+a[0])/2-E[0];const P=(o[1]+a[1])/2-E[1];_=b*b+P*P>this.errorThresholdSquared_}if(_){if(Math.abs(t[0]-n[0])<=Math.abs(t[1]-n[1])){const w=[(e[0]+n[0])/2,(e[1]+n[1])/2],E=this.transformInv_(w),b=[(s[0]+t[0])/2,(s[1]+t[1])/2],P=this.transformInv_(b);this.addQuad_(t,e,w,b,o,r,E,P,h-1),this.addQuad_(b,w,n,s,P,E,a,c,h-1)}else{const w=[(t[0]+e[0])/2,(t[1]+e[1])/2],E=this.transformInv_(w),b=[(n[0]+s[0])/2,(n[1]+s[1])/2],P=this.transformInv_(b);this.addQuad_(t,w,b,s,o,E,P,c,h-1),this.addQuad_(w,e,n,b,E,r,a,P,h-1)}return}}if(g){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(y&11)==0&&this.addTriangle_(t,n,s,o,a,c),(y&14)==0&&this.addTriangle_(t,n,e,o,a,r),y&&((y&13)==0&&this.addTriangle_(e,s,t,r,c,o),(y&7)==0&&this.addTriangle_(e,s,n,r,c,a))}calculateSourceExtent(){const t=Te();return this.triangles_.forEach(function(e,n,s){const o=e.source;ro(t,o[0]),ro(t,o[1]),ro(t,o[2])}),t}getTriangles(){return this.triangles_}}let gl;const ks=[];function Bg(i,t,e,n,s){i.beginPath(),i.moveTo(0,0),i.lineTo(t,e),i.lineTo(n,s),i.closePath(),i.save(),i.clip(),i.fillRect(0,0,Math.max(t,n)+1,Math.max(e,s)),i.restore()}function pl(i,t){return Math.abs(i[t*4]-210)>2||Math.abs(i[t*4+3]-191.25)>2}function gv(){if(gl===void 0){const i=Vt(6,6,ks);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",Bg(i,4,5,4,0),Bg(i,4,5,0,5);const t=i.getImageData(0,0,3,3).data;gl=pl(t,0)||pl(t,4)||pl(t,8),Gr(i),ks.push(i.canvas)}return gl}function Ga(i,t,e,n){const s=co(e,t,i);let o=wu(t,n,e);const r=t.getMetersPerUnit();r!==void 0&&(o*=r);const a=i.getMetersPerUnit();a!==void 0&&(o/=a);const c=i.getExtent();if(!c||so(c,s)){const h=wu(i,o,s)/o;isFinite(h)&&h>0&&(o/=h)}return o}function pv(i,t,e,n){const s=Hi(e);let o=Ga(i,t,s,n);return(!isFinite(o)||o<=0)&&au(e,function(r){return o=Ga(i,t,r,n),isFinite(o)&&o>0}),o}function Yg(i,t,e,n,s,o,r,a,c,h,l,u){const f=Vt(Math.round(e*i),Math.round(e*t),ks);if(u||(f.imageSmoothingEnabled=!1),c.length===0)return f.canvas;f.scale(e,e);function g(I){return Math.round(I*e)/e}f.globalCompositeOperation="lighter";const _=Te();c.forEach(function(I,M,D){Kp(_,I.extent)});const y=yt(_),w=Ht(_),E=Vt(Math.round(e*y/n),Math.round(e*w/n),ks);u||(E.imageSmoothingEnabled=!1);const b=e/n;c.forEach(function(I,M,D){const L=I.extent[0]-_[0],z=-(I.extent[3]-_[3]),q=yt(I.extent),Y=Ht(I.extent);I.image.width>0&&I.image.height>0&&E.drawImage(I.image,h,h,I.image.width-2*h,I.image.height-2*h,L*b,z*b,q*b,Y*b)});const P=Ae(r);return a.getTriangles().forEach(function(I,M,D){const L=I.source,z=I.target;let q=L[0][0],Y=L[0][1],X=L[1][0],Q=L[1][1],m=L[2][0],v=L[2][1];const S=g((z[0][0]-P[0])/o),A=g(-(z[0][1]-P[1])/o),F=g((z[1][0]-P[0])/o),N=g(-(z[1][1]-P[1])/o),G=g((z[2][0]-P[0])/o),V=g(-(z[2][1]-P[1])/o),Z=q,B=Y;q=0,Y=0,X-=Z,Q-=B,m-=Z,v-=B;const at=[[X,Q,0,0,F-S],[m,v,0,0,G-S],[0,0,X,Q,N-A],[0,0,m,v,V-A]],et=pm(at);if(et){if(f.save(),f.beginPath(),gv()||!u){f.moveTo(F,N);const it=4,gt=S-F,wt=A-N;for(let dt=0;dt<it;dt++)f.lineTo(F+g((dt+1)*gt/it),N+g(dt*wt/(it-1))),dt!=it-1&&f.lineTo(F+g((dt+1)*gt/it),N+g((dt+1)*wt/(it-1)));f.lineTo(G,V)}else f.moveTo(F,N),f.lineTo(S,A),f.lineTo(G,V);f.clip(),f.transform(et[0],et[2],et[1],et[3],S,A),f.translate(_[0]-Z,_[3]-B),f.scale(n/e,-n/e),f.drawImage(E.canvas,0,0),f.restore()}}),Gr(E),ks.push(E.canvas),l&&(f.save(),f.globalCompositeOperation="source-over",f.strokeStyle="black",f.lineWidth=1,a.getTriangles().forEach(function(I,M,D){const L=I.target,z=(L[0][0]-P[0])/o,q=-(L[0][1]-P[1])/o,Y=(L[1][0]-P[0])/o,X=-(L[1][1]-P[1])/o,Q=(L[2][0]-P[0])/o,m=-(L[2][1]-P[1])/o;f.beginPath(),f.moveTo(Y,X),f.lineTo(z,q),f.lineTo(Q,m),f.closePath(),f.stroke()}),f.restore()),f.canvas}class ml extends Dd{constructor(t,e,n,s,o,r,a,c,h,l,u,f){super(o,rt.IDLE,{interpolate:!!f}),this.renderEdges_=u!==void 0?u:!1,this.pixelRatio_=a,this.gutter_=c,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=s,this.wrappedTileCoord_=r||o,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;const g=s.getTileCoordExtent(this.wrappedTileCoord_),_=this.targetTileGrid_.getExtent();let y=this.sourceTileGrid_.getExtent();const w=_?An(g,_):g;if(mc(w)===0){this.state=rt.EMPTY;return}const E=t.getExtent();E&&(y?y=An(y,E):y=E);const b=s.getResolution(this.wrappedTileCoord_[0]),P=pv(t,n,w,b);if(!isFinite(P)||P<=0){this.state=rt.EMPTY;return}const I=l!==void 0?l:qg;if(this.triangulation_=new Vg(t,n,w,y,P*I,b),this.triangulation_.getTriangles().length===0){this.state=rt.EMPTY;return}this.sourceZ_=e.getZForResolution(P);let M=this.triangulation_.calculateSourceExtent();if(y&&(t.canWrapX()?(M[1]=qt(M[1],y[1],y[3]),M[3]=qt(M[3],y[1],y[3])):M=An(M,y)),!mc(M))this.state=rt.EMPTY;else{const D=e.getTileRangeForExtentAndZ(M,this.sourceZ_);for(let L=D.minX;L<=D.maxX;L++)for(let z=D.minY;z<=D.maxY;z++){const q=h(this.sourceZ_,L,z,a);q&&this.sourceTiles_.push(q)}this.sourceTiles_.length===0&&(this.state=rt.EMPTY)}}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{e&&e.getState()==rt.LOADED&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})}),this.sourceTiles_.length=0,t.length===0)this.state=rt.ERROR;else{const e=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(e),s=typeof n=="number"?n:n[0],o=typeof n=="number"?n:n[1],r=this.targetTileGrid_.getResolution(e),a=this.sourceTileGrid_.getResolution(this.sourceZ_),c=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Yg(s,o,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),r,c,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=rt.LOADED}this.changed()}load(){if(this.state==rt.IDLE){this.state=rt.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(e=>{const n=e.getState();if(n==rt.IDLE||n==rt.LOADING){t++;const s=Ct(e,ht.CHANGE,function(o){const r=e.getState();(r==rt.LOADED||r==rt.ERROR||r==rt.EMPTY)&&(Mt(s),t--,t===0&&(this.unlistenSources_(),this.reproject_()))},this);this.sourcesListenerKeys_.push(s)}}),t===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function(e,n,s){e.getState()==rt.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(Mt),this.sourcesListenerKeys_=null}release(){this.canvas_&&(Gr(this.canvas_.getContext("2d")),ks.push(this.canvas_),this.canvas_=null),super.release()}}class mv extends Jc{constructor(t){super(t),this.extentChanged=!0,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedRevision,this.renderedTiles=[],this.newTiles_=!1,this.tmpExtent=Te(),this.tmpTileRange_=new dh(0,0,0,0)}isDrawableTile(t){const e=this.getLayer(),n=t.getState(),s=e.getUseInterimTilesOnError();return n==rt.LOADED||n==rt.EMPTY||n==rt.ERROR&&!s}getTile(t,e,n,s){const o=s.pixelRatio,r=s.viewState.projection,a=this.getLayer();let h=a.getSource().getTile(t,e,n,o,r);return h.getState()==rt.ERROR&&a.getUseInterimTilesOnError()&&a.getPreload()>0&&(this.newTiles_=!0),this.isDrawableTile(h)||(h=h.getInterimTile()),h}getData(t){const e=this.frameState;if(!e)return null;const n=this.getLayer(),s=Ut(e.pixelToCoordinateTransform,t.slice()),o=n.getExtent();if(o&&!so(o,s))return null;const r=e.pixelRatio,a=e.viewState.projection,c=e.viewState,h=n.getRenderSource(),l=h.getTileGridForProjection(c.projection),u=h.getTilePixelRatio(e.pixelRatio);for(let f=l.getZForResolution(c.resolution);f>=l.getMinZoom();--f){const g=l.getTileCoordForCoordAndZ(s,f),_=h.getTile(f,g[1],g[2],r,a);if(!(_ instanceof Fd||_ instanceof ml)||_ instanceof ml&&_.getState()===rt.EMPTY)return null;if(_.getState()!==rt.LOADED)continue;const y=l.getOrigin(f),w=fe(l.getTileSize(f)),E=l.getResolution(f),b=Math.floor(u*((s[0]-y[0])/E-g[1]*w[0])),P=Math.floor(u*((y[1]-s[1])/E-g[2]*w[1])),I=Math.round(u*h.getGutterForProjection(c.projection));return this.getImageData(_.getImage(),b+I,P+I)}return null}loadedTileCallback(t,e,n){return this.isDrawableTile(n)?super.loadedTileCallback(t,e,n):!1}prepareFrame(t){return!!this.getLayer().getSource()}renderFrame(t,e){const n=t.layerStatesArray[t.layerIndex],s=t.viewState,o=s.projection,r=s.resolution,a=s.center,c=s.rotation,h=t.pixelRatio,l=this.getLayer(),u=l.getSource(),f=u.getRevision(),g=u.getTileGridForProjection(o),_=g.getZForResolution(r,u.zDirection),y=g.getResolution(_);let w=t.extent;const E=t.viewState.resolution,b=u.getTilePixelRatio(h),P=Math.round(yt(w)/E*h),I=Math.round(Ht(w)/E*h),M=n.extent&&_i(n.extent);M&&(w=An(w,_i(n.extent)));const D=y*P/2/b,L=y*I/2/b,z=[a[0]-D,a[1]-L,a[0]+D,a[1]+L],q=g.getTileRangeForExtentAndZ(w,_),Y={};Y[_]={};const X=this.createLoadedTileFinder(u,o,Y),Q=this.tmpExtent,m=this.tmpTileRange_;this.newTiles_=!1;const v=c?yc(s.center,E,c,t.size):void 0;for(let at=q.minX;at<=q.maxX;++at)for(let et=q.minY;et<=q.maxY;++et){if(c&&!g.tileCoordIntersectsViewport([_,at,et],v))continue;const it=this.getTile(_,at,et,t);if(this.isDrawableTile(it)){const dt=St(this);if(it.getState()==rt.LOADED){Y[_][it.tileCoord.toString()]=it;let Et=it.inTransition(dt);Et&&n.opacity!==1&&(it.endTransition(dt),Et=!1),!this.newTiles_&&(Et||!this.renderedTiles.includes(it))&&(this.newTiles_=!0)}if(it.getAlpha(dt,t.time)===1)continue}const gt=g.getTileCoordChildTileRange(it.tileCoord,m,Q);let wt=!1;gt&&(wt=X(_+1,gt)),wt||g.forEachTileCoordParentTileRange(it.tileCoord,X,m,Q)}const S=y/r*h/b;qe(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/h,1/h,c,-P/2,-I/2);const A=fc(this.pixelTransform);this.useContainer(e,A,this.getBackground(t));const F=this.context,N=F.canvas;Or(this.inversePixelTransform,this.pixelTransform),qe(this.tempTransform,P/2,I/2,S,S,0,-P/2,-I/2),N.width!=P||N.height!=I?(N.width=P,N.height=I):this.containerReused||F.clearRect(0,0,P,I),M&&this.clipUnrotated(F,t,M),u.getInterpolate()||(F.imageSmoothingEnabled=!1),this.preRender(F,t),this.renderedTiles.length=0;let G=Object.keys(Y).map(Number);G.sort(On);let V,Z,B;n.opacity===1&&(!this.containerReused||u.getOpaque(t.viewState.projection))?G=G.reverse():(V=[],Z=[]);for(let at=G.length-1;at>=0;--at){const et=G[at],it=u.getTilePixelSize(et,h,o),wt=g.getResolution(et)/y,dt=it[0]*wt*S,Et=it[1]*wt*S,ft=g.getTileCoordForCoordAndZ(Ae(z),et),xt=g.getTileCoordExtent(ft),Ft=Ut(this.tempTransform,[b*(xt[0]-z[0])/y,b*(z[3]-xt[3])/y]),kt=b*u.getGutterForProjection(o),Wt=Y[et];for(const he in Wt){const ye=Wt[he],ns=ye.tileCoord,we=ft[1]-ns[1],En=Math.round(Ft[0]-(we-1)*dt),Cn=ft[2]-ns[2],bn=Math.round(Ft[1]-(Cn-1)*Et),ae=Math.round(Ft[0]-we*dt),ve=Math.round(Ft[1]-Cn*Et),Oe=En-ae,Ne=bn-ve,ki=_===et,fi=ki&&ye.getAlpha(St(this),t.time)!==1;let Rt=!1;if(!fi)if(V){B=[ae,ve,ae+Oe,ve,ae+Oe,ve+Ne,ae,ve+Ne];for(let Ee=0,Ze=V.length;Ee<Ze;++Ee)if(_!==et&&et<Z[Ee]){const At=V[Ee];te([ae,ve,ae+Oe,ve+Ne],[At[0],At[3],At[4],At[7]])&&(Rt||(F.save(),Rt=!0),F.beginPath(),F.moveTo(B[0],B[1]),F.lineTo(B[2],B[3]),F.lineTo(B[4],B[5]),F.lineTo(B[6],B[7]),F.moveTo(At[6],At[7]),F.lineTo(At[4],At[5]),F.lineTo(At[2],At[3]),F.lineTo(At[0],At[1]),F.clip())}V.push(B),Z.push(et)}else F.clearRect(ae,ve,Oe,Ne);this.drawTileImage(ye,t,ae,ve,Oe,Ne,kt,ki),V&&!fi?(Rt&&F.restore(),this.renderedTiles.unshift(ye)):this.renderedTiles.push(ye),this.updateUsedTiles(t.usedTiles,u,ye)}}return this.renderedRevision=f,this.renderedResolution=y,this.extentChanged=!this.renderedExtent_||!Yi(this.renderedExtent_,z),this.renderedExtent_=z,this.renderedPixelRatio=h,this.renderedProjection=o,this.manageTilePyramid(t,u,g,h,o,w,_,l.getPreload()),this.scheduleExpireCache(t,u),this.postRender(F,t),n.extent&&F.restore(),F.imageSmoothingEnabled=!0,A!==N.style.transform&&(N.style.transform=A),this.container}drawTileImage(t,e,n,s,o,r,a,c){const h=this.getTileImage(t);if(!h)return;const l=St(this),u=e.layerStatesArray[e.layerIndex],f=u.opacity*(c?t.getAlpha(l,e.time):1),g=f!==this.context.globalAlpha;g&&(this.context.save(),this.context.globalAlpha=f),this.context.drawImage(h,a,a,h.width-2*a,h.height-2*a,n,s,o,r),g&&this.context.restore(),f!==u.opacity?e.animate=!0:c&&t.endTransition(l)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}scheduleExpireCache(t,e){if(e.canExpireCache()){const n=(function(s,o,r){const a=St(s);a in r.usedTiles&&s.expireCache(r.viewState.projection,r.usedTiles[a])}).bind(null,e);t.postRenderFunctions.push(n)}}updateUsedTiles(t,e,n){const s=St(e);s in t||(t[s]={}),t[s][n.getKey()]=!0}manageTilePyramid(t,e,n,s,o,r,a,c,h){const l=St(e);l in t.wantedTiles||(t.wantedTiles[l]={});const u=t.wantedTiles[l],f=t.tileQueue,g=n.getMinZoom(),_=t.viewState.rotation,y=_?yc(t.viewState.center,t.viewState.resolution,_,t.size):void 0;let w=0,E,b,P,I,M,D;for(D=g;D<=a;++D)for(b=n.getTileRangeForExtentAndZ(r,D,b),P=n.getResolution(D),I=b.minX;I<=b.maxX;++I)for(M=b.minY;M<=b.maxY;++M)_&&!n.tileCoordIntersectsViewport([D,I,M],y)||(a-D<=c?(++w,E=e.getTile(D,I,M,s,o),E.getState()==rt.IDLE&&(u[E.getKey()]=!0,f.isKeyQueued(E.getKey())||f.enqueue([E,l,n.getTileCoordCenter(E.tileCoord),P])),h!==void 0&&h(E)):e.useTile(D,I,M,o));e.updateCacheSize(w,o)}}class Va extends dv{constructor(t){super(t)}createRenderer(){return new mv(this)}}class _v extends Kc{constructor(t,e,n,s,o,r,a){let c=t.getExtent();c&&t.canWrapX()&&(c=c.slice(),c[0]=-1/0,c[2]=1/0);let h=e.getExtent();h&&e.canWrapX()&&(h=h.slice(),h[0]=-1/0,h[2]=1/0);const l=h?An(n,h):n,u=Hi(l),f=Ga(t,e,u,s),g=qg,_=new Vg(t,e,l,c,f*g,s),y=_.calculateSourceExtent(),w=Xi(y)?null:r(y,f,o),E=w?ot.IDLE:ot.EMPTY,b=w?w.getPixelRatio():1;super(n,s,b,E),this.targetProj_=e,this.maxSourceExtent_=c,this.triangulation_=_,this.targetResolution_=s,this.targetExtent_=n,this.sourceImage_=w,this.sourcePixelRatio_=b,this.interpolate_=a,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==ot.LOADING&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const t=this.sourceImage_.getState();if(t==ot.LOADED){const e=yt(this.targetExtent_)/this.targetResolution_,n=Ht(this.targetExtent_)/this.targetResolution_;this.canvas_=Yg(e,n,this.sourcePixelRatio_,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==ot.IDLE){this.state=ot.LOADING,this.changed();const t=this.sourceImage_.getState();t==ot.LOADED||t==ot.ERROR?this.reproject_():(this.sourceListenerKey_=Ct(this.sourceImage_,ht.CHANGE,function(e){const n=this.sourceImage_.getState();(n==ot.LOADED||n==ot.ERROR)&&(this.unlistenSource_(),this.reproject_())},this),this.sourceImage_.load())}}unlistenSource_(){Mt(this.sourceListenerKey_),this.sourceListenerKey_=null}}const _l={IMAGELOADSTART:"imageloadstart",IMAGELOADEND:"imageloadend",IMAGELOADERROR:"imageloaderror"};class yv extends We{constructor(t,e){super(t),this.image=e}}class yl extends Ro{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.resolutions_=t.resolutions!==void 0?t.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0}getResolutions(){return this.resolutions_}setResolutions(t){this.resolutions_=t}findNearestResolution(t){const e=this.getResolutions();if(e){const n=Sr(e,t,0);t=e[n]}return t}getImage(t,e,n,s){const o=this.getProjection();if(!o||!s||Zi(o,s))return o&&(s=o),this.getImageInternal(t,e,n,s);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&Zi(this.reprojectedImage_.getProjection(),s)&&this.reprojectedImage_.getResolution()==e&&Yi(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new _v(o,s,t,e,n,(r,a,c)=>this.getImageInternal(r,a,c,o),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(t,e,n,s){return vt()}handleImageChange(t){const e=t.target;let n;switch(e.getState()){case ot.LOADING:this.loading=!0,n=_l.IMAGELOADSTART;break;case ot.LOADED:this.loading=!1,n=_l.IMAGELOADEND;break;case ot.ERROR:this.loading=!1,n=_l.IMAGELOADERROR;break;default:return}this.hasListener(n)&&this.dispatchEvent(new yv(n,e))}}function wv(i,t){i.getImage().src=t}class Hg extends yl{constructor(t){const e=t.crossOrigin!==void 0?t.crossOrigin:null,n=t.imageLoadFunction!==void 0?t.imageLoadFunction:wv;super({attributions:t.attributions,interpolate:t.interpolate,projection:Gt(t.projection)}),this.url_=t.url,this.imageExtent_=t.imageExtent,this.image_=new E0(this.imageExtent_,void 0,1,this.url_,e,n,Vt(1,1)),this.imageSize_=t.imageSize?t.imageSize:null,this.image_.addEventListener(ht.CHANGE,this.handleImageChange.bind(this))}getImageExtent(){return this.imageExtent_}getImageInternal(t,e,n,s){return te(t,this.image_.getExtent())?this.image_:null}getUrl(){return this.url_}handleImageChange(t){if(this.image_.getState()==ot.LOADED){const e=this.image_.getExtent(),n=this.image_.getImage();let s,o;this.imageSize_?(s=this.imageSize_[0],o=this.imageSize_[1]):(s=n.width,o=n.height);const r=yt(e),a=Ht(e),c=r/s,h=a/o;let l=s,u=o;if(c>h?l=Math.round(r/h):u=Math.round(a/c),l!==s||u!==o){const f=Vt(l,u);this.getInterpolate()||(f.imageSmoothingEnabled=!1);const g=f.canvas;f.drawImage(n,0,0,s,o,0,0,g.width,g.height),this.image_.setImage(g)}}super.handleImageChange(t)}}const Ws=[0,0,0],mn=5;class qs{constructor(t){this.minZoom=t.minZoom!==void 0?t.minZoom:0,this.resolutions_=t.resolutions,pt(Lp(this.resolutions_,function(s,o){return o-s}),17);let e;if(!t.origins){for(let s=0,o=this.resolutions_.length-1;s<o;++s)if(!e)e=this.resolutions_[s]/this.resolutions_[s+1];else if(this.resolutions_[s]/this.resolutions_[s+1]!==e){e=void 0;break}}this.zoomFactor_=e,this.maxZoom=this.resolutions_.length-1,this.origin_=t.origin!==void 0?t.origin:null,this.origins_=null,t.origins!==void 0&&(this.origins_=t.origins,pt(this.origins_.length==this.resolutions_.length,20));const n=t.extent;n!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=Ae(n)),pt(!this.origin_&&this.origins_||this.origin_&&!this.origins_,18),this.tileSizes_=null,t.tileSizes!==void 0&&(this.tileSizes_=t.tileSizes,pt(this.tileSizes_.length==this.resolutions_.length,19)),this.tileSize_=t.tileSize!==void 0?t.tileSize:this.tileSizes_?null:Wc,pt(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,22),this.extent_=n!==void 0?n:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],t.sizes!==void 0?this.fullTileRanges_=t.sizes.map(function(s,o){const r=new dh(Math.min(0,s[0]),Math.max(s[0]-1,-1),Math.min(0,s[1]),Math.max(s[1]-1,-1));if(n){const a=this.getTileRangeForExtentAndZ(n,o);r.minX=Math.max(a.minX,r.minX),r.maxX=Math.min(a.maxX,r.maxX),r.minY=Math.max(a.minY,r.minY),r.maxY=Math.min(a.maxY,r.maxY)}return r},this):n&&this.calculateTileRanges_(n)}forEachTileCoord(t,e,n){const s=this.getTileRangeForExtentAndZ(t,e);for(let o=s.minX,r=s.maxX;o<=r;++o)for(let a=s.minY,c=s.maxY;a<=c;++a)n([e,o,a])}forEachTileCoordParentTileRange(t,e,n,s){let o,r,a,c=null,h=t[0]-1;for(this.zoomFactor_===2?(r=t[1],a=t[2]):c=this.getTileCoordExtent(t,s);h>=this.minZoom;){if(this.zoomFactor_===2?(r=Math.floor(r/2),a=Math.floor(a/2),o=xs(r,r,a,a,n)):o=this.getTileRangeForExtentAndZ(c,h,n),e(h,o))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,n){if(t[0]<this.maxZoom){if(this.zoomFactor_===2){const o=t[1]*2,r=t[2]*2;return xs(o,o+1,r,r+1,e)}const s=this.getTileCoordExtent(t,n||this.tmpExtent_);return this.getTileRangeForExtentAndZ(s,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,n){if(e>this.maxZoom||e<this.minZoom)return null;const s=t[0],o=t[1],r=t[2];if(e===s)return xs(o,r,o,r,n);if(this.zoomFactor_){const c=Math.pow(this.zoomFactor_,e-s),h=Math.floor(o*c),l=Math.floor(r*c);if(e<s)return xs(h,h,l,l,n);const u=Math.floor(c*(o+1))-1,f=Math.floor(c*(r+1))-1;return xs(h,u,l,f,n)}const a=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,e,n)}getTileRangeForExtentAndZ(t,e,n){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,Ws);const s=Ws[1],o=Ws[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,Ws);const r=Ws[1],a=Ws[2];return xs(s,r,o,a,n)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),n=this.getResolution(t[0]),s=fe(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*s[0]*n,e[1]-(t[2]+.5)*s[1]*n]}getTileCoordExtent(t,e){const n=this.getOrigin(t[0]),s=this.getResolution(t[0]),o=fe(this.getTileSize(t[0]),this.tmpSize_),r=n[0]+t[1]*o[0]*s,a=n[1]-(t[2]+1)*o[1]*s,c=r+o[0]*s,h=a+o[1]*s;return pi(r,a,c,h,e)}getTileCoordForCoordAndResolution(t,e,n){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,n)}getTileCoordForXYAndResolution_(t,e,n,s,o){const r=this.getZForResolution(n),a=n/this.getResolution(r),c=this.getOrigin(r),h=fe(this.getTileSize(r),this.tmpSize_);let l=a*(t-c[0])/n/h[0],u=a*(c[1]-e)/n/h[1];return s?(l=zr(l,mn)-1,u=zr(u,mn)-1):(l=Lr(l,mn),u=Lr(u,mn)),Bd(r,l,u,o)}getTileCoordForXYAndZ_(t,e,n,s,o){const r=this.getOrigin(n),a=this.getResolution(n),c=fe(this.getTileSize(n),this.tmpSize_);let h=(t-r[0])/a/c[0],l=(r[1]-e)/a/c[1];return s?(h=zr(h,mn)-1,l=zr(l,mn)-1):(h=Lr(h,mn),l=Lr(l,mn)),Bd(n,h,l,o)}getTileCoordForCoordAndZ(t,e,n){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,n)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){const n=Sr(this.resolutions_,t,e||0);return qt(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return zu(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,n=new Array(e);for(let s=this.minZoom;s<e;++s)n[s]=this.getTileRangeForExtentAndZ(t,s);this.fullTileRanges_=n}}function Xg(i){let t=i.getDefaultTileGrid();return t||(t=Cv(i),i.setDefaultTileGrid(t)),t}function vv(i,t,e){const n=t[0],s=i.getTileCoordCenter(t),o=wl(e);if(!so(o,s)){const r=yt(o),a=Math.ceil((o[0]-s[0])/r);return s[0]+=r*a,i.getTileCoordForCoordAndZ(s,n)}return t}function Ev(i,t,e,n){n=n!==void 0?n:"top-left";const s=Zg(i,t,e);return new qs({extent:i,origin:Jp(i,n),resolutions:s,tileSize:e})}function $g(i){const t=i||{},e=t.extent||Gt("EPSG:3857").getExtent(),n={extent:e,minZoom:t.minZoom,tileSize:t.tileSize,resolutions:Zg(e,t.maxZoom,t.tileSize,t.maxResolution)};return new qs(n)}function Zg(i,t,e,n){t=t!==void 0?t:n0,e=fe(e!==void 0?e:Wc);const s=Ht(i),o=yt(i);n=n>0?n:Math.max(o/e[0],s/e[1]);const r=t+1,a=new Array(r);for(let c=0;c<r;++c)a[c]=n/Math.pow(2,c);return a}function Cv(i,t,e,n){const s=wl(i);return Ev(s,t,e,n)}function wl(i){i=Gt(i);let t=i.getExtent();if(!t){const e=180*wc.degrees/i.getMetersPerUnit();t=pi(-e,-e,e,e)}return t}class Kg extends Ro{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:t.projection,state:t.state,wrapX:t.wrapX,interpolate:t.interpolate}),this.on,this.once,this.un,this.opaque_=t.opaque!==void 0?t.opaque:!1,this.tilePixelRatio_=t.tilePixelRatio!==void 0?t.tilePixelRatio:1,this.tileGrid=t.tileGrid!==void 0?t.tileGrid:null;const e=[256,256];this.tileGrid&&fe(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tileCache=new Xd(t.cacheSize||0),this.tmpSize=[0,0],this.key_=t.key||"",this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}canExpireCache(){return this.tileCache.canExpireCache()}expireCache(t,e){const n=this.getTileCacheForProjection(t);n&&n.expireCache(e)}forEachLoadedTile(t,e,n,s){const o=this.getTileCacheForProjection(t);if(!o)return!1;let r=!0,a,c,h;for(let l=n.minX;l<=n.maxX;++l)for(let u=n.minY;u<=n.maxY;++u)c=na(e,l,u),h=!1,o.containsKey(c)&&(a=o.get(c),h=a.getState()===rt.LOADED,h&&(h=s(a)!==!1)),h||(r=!1);return r}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getOpaque(t){return this.opaque_}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,n,s,o){return vt()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:Xg(t)}getTileCacheForProjection(t){const e=this.getProjection();return pt(e===null||Zi(e,t),68),this.tileCache}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,n){const s=this.getTileGridForProjection(n),o=this.getTilePixelRatio(e),r=fe(s.getTileSize(t),this.tmpSize);return o==1?r:Vu(r,o,this.tmpSize)}getTileCoordForTileUrlFunction(t,e){e=e!==void 0?e:this.getProjection();const n=this.getTileGridForProjection(e);return this.getWrapX()&&e.isGlobal()&&(t=vv(n,t,e)),D_(t,n)?t:null}clear(){this.tileCache.clear()}refresh(){this.clear(),super.refresh()}updateCacheSize(t,e){const n=this.getTileCacheForProjection(e);t>n.highWaterMark&&(n.highWaterMark=t)}useTile(t,e,n,s){}}class bv extends We{constructor(t,e){super(t),this.tile=e}}let Qg=!0;try{new ImageData(10,10)}catch{Qg=!1}let vl;function xv(i,t,e){if(Qg)return new ImageData(i,t,e);vl||(vl=document.createElement("canvas").getContext("2d"));const n=vl.createImageData(t,e);return n.data.set(i),n}function Jg(i){let t=!0;try{new ImageData(10,10)}catch{t=!1}function e(n,s,o){return t?new ImageData(n,s,o):{data:n,width:s,height:o}}return function(n){const s=n.buffers,o=n.meta,r=n.imageOps,a=n.width,c=n.height,h=s.length,l=s[0].byteLength;if(r){const _=new Array(h);for(let w=0;w<h;++w)_[w]=e(new Uint8ClampedArray(s[w]),a,c);return i(_,o).data.buffer}const u=new Uint8ClampedArray(l),f=new Array(h),g=new Array(h);for(let _=0;_<h;++_)f[_]=new Uint8ClampedArray(s[_]),g[_]=[0,0,0,0];for(let _=0;_<l;_+=4){for(let w=0;w<h;++w){const E=f[w];g[w][0]=E[_],g[w][1]=E[_+1],g[w][2]=E[_+2],g[w][3]=E[_+3]}const y=i(g,o);u[_]=y[0],u[_+1]=y[1],u[_+2]=y[2],u[_+3]=y[3]}return u.buffer}}function Sv(i,t){const n=Object.keys(i.lib||{}).map(function(o){return"const "+o+" = "+i.lib[o].toString()+";"}).concat(["const __minion__ = ("+Jg.toString()+")(",i.operation.toString(),");",'self.addEventListener("message", function(event) {'," const buffer = __minion__(event.data);"," self.postMessage({buffer: buffer, meta: event.data.meta}, [buffer]);","});"]),s=new Worker(typeof Blob>"u"?"data:text/javascript;base64,"+Buffer.from(n.join(`
159
- `),"binary").toString("base64"):URL.createObjectURL(new Blob(n,{type:"text/javascript"})));return s.addEventListener("message",t),s}function Rv(i,t){const e=Jg(i.operation);let n=!1;return{postMessage:function(s){setTimeout(function(){n||t({data:{buffer:e(s),meta:s.meta}})},0)},terminate:function(){n=!0}}}class Pv extends xr{constructor(t){super(),this._imageOps=!!t.imageOps;let e;t.threads===0?e=0:this._imageOps?e=1:e=t.threads||1;const n=new Array(e);if(e)for(let s=0;s<e;++s)n[s]=Sv(t,this._onWorkerMessage.bind(this,s));else n[0]=Rv(t,this._onWorkerMessage.bind(this,0));this._workers=n,this._queue=[],this._maxQueueLength=t.queue||1/0,this._running=0,this._dataLookup={},this._job=null}process(t,e,n){this._enqueue({inputs:t,meta:e,callback:n}),this._dispatch()}_enqueue(t){for(this._queue.push(t);this._queue.length>this._maxQueueLength;)this._queue.shift().callback(null,null)}_dispatch(){if(this._running||this._queue.length===0)return;const t=this._queue.shift();this._job=t;const e=t.inputs[0].width,n=t.inputs[0].height,s=t.inputs.map(function(c){return c.data.buffer}),o=this._workers.length;if(this._running=o,o===1){this._workers[0].postMessage({buffers:s,meta:t.meta,imageOps:this._imageOps,width:e,height:n},s);return}const r=t.inputs[0].data.length,a=4*Math.ceil(r/4/o);for(let c=0;c<o;++c){const h=c*a,l=[];for(let u=0,f=s.length;u<f;++u)l.push(s[u].slice(h,h+a));this._workers[c].postMessage({buffers:l,meta:t.meta,imageOps:this._imageOps,width:e,height:n},l)}}_onWorkerMessage(t,e){this.disposed||(this._dataLookup[t]=e.data,--this._running,this._running===0&&this._resolveJob())}_resolveJob(){const t=this._job,e=this._workers.length;let n,s;if(e===1)n=new Uint8ClampedArray(this._dataLookup[0].buffer),s=this._dataLookup[0].meta;else{const o=t.inputs[0].data.length;n=new Uint8ClampedArray(o),s=new Array(e);const r=4*Math.ceil(o/4/e);for(let a=0;a<e;++a){const c=this._dataLookup[a].buffer,h=a*r;n.set(new Uint8ClampedArray(c),h),s[a]=this._dataLookup[a].meta}}this._job=null,this._dataLookup={},t.callback(null,xv(n,t.inputs[0].width,t.inputs[0].height),s),this._dispatch()}disposeInternal(){for(let t=0;t<this._workers.length;++t)this._workers[t].terminate();this._workers.length=0}}const tp={BEFOREOPERATIONS:"beforeoperations",AFTEROPERATIONS:"afteroperations"};class ep extends We{constructor(t,e,n){super(t),this.extent=e.extent,this.resolution=e.viewState.resolution/e.pixelRatio,this.data=n}}class El extends yl{constructor(t){super({projection:null}),this.on,this.once,this.un,this.processor_=null,this.operationType_=t.operationType!==void 0?t.operationType:"pixel",this.threads_=t.threads!==void 0?t.threads:1,this.layers_=Tv(t.sources);const e=this.changed.bind(this);for(let n=0,s=this.layers_.length;n<s;++n)this.layers_[n].addEventListener(ht.CHANGE,e);this.useResolutions_=t.resolutions!==null,this.tileQueue_=new Ld(function(){return 1},this.processSources_.bind(this)),this.requestedFrameState_,this.renderedImageCanvas_=null,this.renderedRevision_,this.frameState_={animate:!1,coordinateToPixelTransform:be(),declutterTree:null,extent:null,index:0,layerIndex:0,layerStatesArray:Iv(this.layers_),pixelRatio:1,pixelToCoordinateTransform:be(),postRenderFunctions:[],size:[0,0],tileQueue:this.tileQueue_,time:Date.now(),usedTiles:{},viewState:{rotation:0},viewHints:[],wantedTiles:{},mapId:St(this),renderTargets:{}},this.setAttributions(function(n){const s=[];for(let o=0,r=t.sources.length;o<r;++o){const a=t.sources[o],c=a instanceof Ro?a:a.getSource();if(!c)continue;const h=c.getAttributions();if(typeof h=="function"){const l=h(n);s.push.apply(s,l)}}return s.length!==0?s:null}),t.operation!==void 0&&this.setOperation(t.operation,t.lib)}setOperation(t,e){this.processor_&&this.processor_.dispose(),this.processor_=new Pv({operation:t,imageOps:this.operationType_==="image",queue:1,lib:e,threads:this.threads_}),this.changed()}updateFrameState_(t,e,n){const s=Object.assign({},this.frameState_);s.viewState=Object.assign({},s.viewState);const o=Hi(t);s.size[0]=Math.ceil(yt(t)/e),s.size[1]=Math.ceil(Ht(t)/e),s.extent=[o[0]-s.size[0]*e/2,o[1]-s.size[1]*e/2,o[0]+s.size[0]*e/2,o[1]+s.size[1]*e/2],s.time=Date.now();const r=s.viewState;return r.center=o,r.projection=n,r.resolution=e,s}allSourcesReady_(){let t=!0,e;for(let n=0,s=this.layers_.length;n<s;++n)if(e=this.layers_[n].getSource(),!e||e.getState()!=="ready"){t=!1;break}return t}getImage(t,e,n,s){if(!this.allSourcesReady_())return null;this.tileQueue_.loadMoreTiles(16,16),e=this.findNearestResolution(e);const o=this.updateFrameState_(t,e,s);if(this.requestedFrameState_=o,this.renderedImageCanvas_){const r=this.renderedImageCanvas_.getResolution(),a=this.renderedImageCanvas_.getExtent();(e!==r||!Yi(o.extent,a))&&(this.renderedImageCanvas_=null)}return(!this.renderedImageCanvas_||this.getRevision()!==this.renderedRevision_)&&this.processSources_(),o.animate&&requestAnimationFrame(this.changed.bind(this)),this.renderedImageCanvas_}processSources_(){const t=this.requestedFrameState_,e=this.layers_.length,n=new Array(e);for(let o=0;o<e;++o){t.layerIndex=o,t.renderTargets={};const r=Ov(this.layers_[o],t);if(r)n[o]=r;else return}const s={};this.dispatchEvent(new ep(tp.BEFOREOPERATIONS,t,s)),this.processor_.process(n,s,this.onWorkerComplete_.bind(this,t))}onWorkerComplete_(t,e,n,s){if(e||!n)return;const o=t.extent,r=t.viewState.resolution;if(r!==this.requestedFrameState_.viewState.resolution||!Yi(o,this.requestedFrameState_.extent))return;let a;if(this.renderedImageCanvas_)a=this.renderedImageCanvas_.getImage().getContext("2d");else{const c=Math.round(yt(o)/r),h=Math.round(Ht(o)/r);a=Vt(c,h),this.renderedImageCanvas_=new Md(o,r,1,a.canvas)}a.putImageData(n,0,0),t.animate?requestAnimationFrame(this.changed.bind(this)):this.changed(),this.renderedRevision_=this.getRevision(),this.dispatchEvent(new ep(tp.AFTEROPERATIONS,t,s))}getResolutions(t){if(!this.useResolutions_)return null;let e=super.getResolutions();if(!e)for(let n=0,s=this.layers_.length;n<s&&(e=this.layers_[n].getSource().getResolutions(t),!e);++n);return e}disposeInternal(){this.processor_&&this.processor_.dispose(),super.disposeInternal()}}El.prototype.dispose;let Yn=null;function Ov(i,t){const e=i.getRenderer();if(!e)throw new Error("Unsupported layer type: "+i);if(!e.prepareFrame(t))return null;const n=t.size[0],s=t.size[1];if(n===0||s===0)return null;const o=e.renderFrame(t,null);let r;if(o instanceof HTMLCanvasElement)r=o;else{if(o&&(r=o.firstElementChild),!(r instanceof HTMLCanvasElement))throw new Error("Unsupported rendered element: "+r);if(r.width===n&&r.height===s)return r.getContext("2d").getImageData(0,0,n,s)}if(!Yn)Yn=Vt(n,s,void 0,{willReadFrequently:!0});else{const a=Yn.canvas;a.width!==n||a.height!==s?Yn=Vt(n,s,void 0,{willReadFrequently:!0}):Yn.clearRect(0,0,n,s)}return Yn.drawImage(r,0,0,n,s),Yn.getImageData(0,0,n,s)}function Iv(i){return i.map(function(t){return t.getLayerState()})}function Tv(i){const t=i.length,e=new Array(t);for(let n=0;n<t;++n)e[n]=Av(i[n]);return e}function Av(i){let t;return i instanceof Ro?i instanceof Kg?t=new Va({source:i}):i instanceof yl&&(t=new fl({source:i})):t=i,t}const Cl={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};function Mv(i,t){const e=/\{z\}/g,n=/\{x\}/g,s=/\{y\}/g,o=/\{-y\}/g;return function(r,a,c){if(r)return i.replace(e,r[0].toString()).replace(n,r[1].toString()).replace(s,r[2].toString()).replace(o,function(){const h=r[0],l=t.getFullTileRange(h);return pt(l,55),(l.getHeight()-r[2]-1).toString()})}}function Dv(i,t){const e=i.length,n=new Array(e);for(let s=0;s<e;++s)n[s]=Mv(i[s],t);return bl(n)}function bl(i){return i.length===1?i[0]:function(t,e,n){if(!t)return;const s=Hd(t),o=$i(s,i.length);return i[o](t,e,n)}}function ip(i){const t=[];let e=/\{([a-z])-([a-z])\}/.exec(i);if(e){const n=e[1].charCodeAt(0),s=e[2].charCodeAt(0);let o;for(o=n;o<=s;++o)t.push(i.replace(e[0],String.fromCharCode(o)));return t}if(e=/\{(\d+)-(\d+)\}/.exec(i),e){const n=parseInt(e[2],10);for(let s=parseInt(e[1],10);s<=n;s++)t.push(i.replace(e[0],s.toString()));return t}return t.push(i),t}class xl extends Kg{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===xl.prototype.tileUrlFunction,this.tileLoadFunction=t.tileLoadFunction,t.tileUrlFunction&&(this.tileUrlFunction=t.tileUrlFunction),this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(t){const e=t.target,n=St(e),s=e.getState();let o;s==rt.LOADING?(this.tileLoadingKeys_[n]=!0,o=Cl.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],o=s==rt.ERROR?Cl.TILELOADERROR:s==rt.LOADED?Cl.TILELOADEND:void 0),o!=null&&this.dispatchEvent(new bv(o,e))}setTileLoadFunction(t){this.tileCache.clear(),this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,this.tileCache.pruneExceptNewestZ(),typeof e<"u"?this.setKey(e):this.changed()}setUrl(t){const e=ip(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join(`
160
- `);this.generateTileUrlFunction_?this.setTileUrlFunction(Dv(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,n){}useTile(t,e,n){const s=na(t,e,n);this.tileCache.containsKey(s)&&this.tileCache.get(s)}}class Sl extends xl{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:Fv,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate!==void 0?t.interpolate:!0,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=t.crossOrigin!==void 0?t.crossOrigin:null,this.tileClass=t.tileClass!==void 0?t.tileClass:Fd,this.tileCacheForProjection={},this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}canExpireCache(){if(this.tileCache.canExpireCache())return!0;for(const t in this.tileCacheForProjection)if(this.tileCacheForProjection[t].canExpireCache())return!0;return!1}expireCache(t,e){const n=this.getTileCacheForProjection(t);this.tileCache.expireCache(this.tileCache==n?e:{});for(const s in this.tileCacheForProjection){const o=this.tileCacheForProjection[s];o.expireCache(o==n?e:{})}}getGutterForProjection(t){return this.getProjection()&&t&&!Zi(this.getProjection(),t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getOpaque(t){return this.getProjection()&&t&&!Zi(this.getProjection(),t)?!1:super.getOpaque(t)}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||Zi(e,t)))return this.tileGrid;const n=St(t);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=Xg(t)),this.tileGridForProjection[n]}getTileCacheForProjection(t){const e=this.getProjection();if(!e||Zi(e,t))return this.tileCache;const n=St(t);return n in this.tileCacheForProjection||(this.tileCacheForProjection[n]=new Xd(this.tileCache.highWaterMark)),this.tileCacheForProjection[n]}createTile_(t,e,n,s,o,r){const a=[t,e,n],c=this.getTileCoordForTileUrlFunction(a,o),h=c?this.tileUrlFunction(c,s,o):void 0,l=new this.tileClass(a,h!==void 0?rt.IDLE:rt.EMPTY,h!==void 0?h:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return l.key=r,l.addEventListener(ht.CHANGE,this.handleTileChange.bind(this)),l}getTile(t,e,n,s,o){const r=this.getProjection();if(!r||!o||Zi(r,o))return this.getTileInternal(t,e,n,s,r||o);const a=this.getTileCacheForProjection(o),c=[t,e,n];let h;const l=Yd(c);a.containsKey(l)&&(h=a.get(l));const u=this.getKey();if(h&&h.key==u)return h;const f=this.getTileGridForProjection(r),g=this.getTileGridForProjection(o),_=this.getTileCoordForTileUrlFunction(c,o),y=new ml(r,f,o,g,c,_,this.getTilePixelRatio(s),this.getGutter(),(w,E,b,P)=>this.getTileInternal(w,E,b,P,r),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.getInterpolate());return y.key=u,h?(y.interimTile=h,y.refreshInterimChain(),a.replace(l,y)):a.set(l,y),y}getTileInternal(t,e,n,s,o){let r=null;const a=na(t,e,n),c=this.getKey();if(!this.tileCache.containsKey(a))r=this.createTile_(t,e,n,s,o,c),this.tileCache.set(a,r);else if(r=this.tileCache.get(a),r.key!=c){const h=r;r=this.createTile_(t,e,n,s,o,c),h.getState()==rt.IDLE?r.interimTile=h.interimTile:r.interimTile=h,r.refreshInterimChain(),this.tileCache.replace(a,r)}return r}setRenderReprojectionEdges(t){if(this.renderReprojectionEdges_!=t){this.renderReprojectionEdges_=t;for(const e in this.tileCacheForProjection)this.tileCacheForProjection[e].clear();this.changed()}}setTileGridForProjection(t,e){const n=Gt(t);if(n){const s=St(n);s in this.tileGridForProjection||(this.tileGridForProjection[s]=e)}}clear(){super.clear();for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear()}}function Fv(i,t){i.getImage().src=t}const Ba="1.3.0";function Ya(i,t){const e=[];Object.keys(t).forEach(function(s){t[s]!==null&&t[s]!==void 0&&e.push(s+"="+encodeURIComponent(t[s]))});const n=e.join("&");return i=i.replace(/[?&]$/,""),i+=i.includes("?")?"&":"?",i+n}class Lv extends Sl{constructor(t){t=t||{};const e=Object.assign({},t.params),n="TRANSPARENT"in e?e.TRANSPARENT:!0;super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,opaque:!n,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction,url:t.url,urls:t.urls,wrapX:t.wrapX!==void 0?t.wrapX:!0,transition:t.transition,zDirection:t.zDirection}),this.gutter_=t.gutter!==void 0?t.gutter:0,this.params_=e,this.v13_=!0,this.serverType_=t.serverType,this.hidpi_=t.hidpi!==void 0?t.hidpi:!0,this.tmpExtent_=Te(),this.updateV13_(),this.setKey(this.getKeyForParams_())}getFeatureInfoUrl(t,e,n,s){const o=Gt(n),r=this.getProjection();let a=this.getTileGrid();a||(a=this.getTileGridForProjection(o));const c=a.getZForResolution(e,this.zDirection),h=a.getTileCoordForCoordAndZ(t,c);if(a.getResolutions().length<=h[0])return;let l=a.getResolution(h[0]),u=a.getTileCoordExtent(h,this.tmpExtent_),f=fe(a.getTileSize(h[0]),this.tmpSize);const g=this.gutter_;g!==0&&(f=qu(f,g,this.tmpSize),u=io(u,l*g,u)),r&&r!==o&&(l=Ga(r,o,t,l),u=bu(u,o,r),t=co(t,o,r));const _={SERVICE:"WMS",VERSION:Ba,REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};Object.assign(_,this.params_,s);const y=Math.floor((t[0]-u[0])/l),w=Math.floor((u[3]-t[1])/l);return _[this.v13_?"I":"X"]=y,_[this.v13_?"J":"Y"]=w,this.getRequestUrl_(h,f,u,1,r||o,_)}getLegendUrl(t,e){if(this.urls[0]===void 0)return;const n={SERVICE:"WMS",VERSION:Ba,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(e===void 0||e.LAYER===void 0){const s=this.params_.LAYERS;if(!(!Array.isArray(s)||s.length===1))return;n.LAYER=s}if(t!==void 0){const s=this.getProjection()?this.getProjection().getMetersPerUnit():1,o=28e-5;n.SCALE=t*s/o}return Object.assign(n,e),Ya(this.urls[0],n)}getGutter(){return this.gutter_}getParams(){return this.params_}getRequestUrl_(t,e,n,s,o,r){const a=this.urls;if(!a)return;if(r.WIDTH=e[0],r.HEIGHT=e[1],r[this.v13_?"CRS":"SRS"]=o.getCode(),"STYLES"in this.params_||(r.STYLES=""),s!=1)switch(this.serverType_){case"geoserver":const u=90*s+.5|0;"FORMAT_OPTIONS"in r?r.FORMAT_OPTIONS+=";dpi:"+u:r.FORMAT_OPTIONS="dpi:"+u;break;case"mapserver":r.MAP_RESOLUTION=90*s;break;case"carmentaserver":case"qgis":r.DPI=90*s;break;default:pt(!1,52);break}const c=o.getAxisOrientation(),h=n;if(this.v13_&&c.substr(0,2)=="ne"){let u;u=n[0],h[0]=n[1],h[1]=u,u=n[2],h[2]=n[3],h[3]=u}r.BBOX=h.join(",");let l;if(a.length==1)l=a[0];else{const u=$i(Hd(t),a.length);l=a[u]}return Ya(l,r)}getTilePixelRatio(t){return!this.hidpi_||this.serverType_===void 0?1:t}getKeyForParams_(){let t=0;const e=[];for(const n in this.params_)e[t++]=n+"-"+this.params_[n];return e.join("/")}updateParams(t){Object.assign(this.params_,t),this.updateV13_(),this.setKey(this.getKeyForParams_())}updateV13_(){const t=this.params_.VERSION||Ba;this.v13_=mm(t,"1.3")>=0}tileUrlFunction(t,e,n){let s=this.getTileGrid();if(s||(s=this.getTileGridForProjection(n)),s.getResolutions().length<=t[0])return;e!=1&&(!this.hidpi_||this.serverType_===void 0)&&(e=1);const o=s.getResolution(t[0]);let r=s.getTileCoordExtent(t,this.tmpExtent_),a=fe(s.getTileSize(t[0]),this.tmpSize);const c=this.gutter_;c!==0&&(a=qu(a,c,this.tmpSize),r=io(r,o*c,r)),e!=1&&(a=Vu(a,e,this.tmpSize));const h={SERVICE:"WMS",VERSION:Ba,REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};return Object.assign(h,this.params_),this.getRequestUrl_(t,a,r,e,n,h)}}class zv extends qs{constructor(t){super({extent:t.extent,origin:t.origin,origins:t.origins,resolutions:t.resolutions,tileSize:t.tileSize,tileSizes:t.tileSizes,sizes:t.sizes}),this.matrixIds_=t.matrixIds}getMatrixId(t){return this.matrixIds_[t]}getMatrixIds(){return this.matrixIds_}}class Nv extends Sl{constructor(t){const e=t.requestEncoding!==void 0?t.requestEncoding:"KVP",n=t.tileGrid;let s=t.urls;s===void 0&&t.url!==void 0&&(s=ip(t.url)),super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:n,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,urls:s,wrapX:t.wrapX!==void 0?t.wrapX:!1,transition:t.transition,zDirection:t.zDirection}),this.version_=t.version!==void 0?t.version:"1.0.0",this.format_=t.format!==void 0?t.format:"image/jpeg",this.dimensions_=t.dimensions!==void 0?t.dimensions:{},this.layer_=t.layer,this.matrixSet_=t.matrixSet,this.style_=t.style,this.requestEncoding_=e,this.setKey(this.getKeyForDimensions_()),s&&s.length>0&&(this.tileUrlFunction=bl(s.map(this.createFromWMTSTemplate.bind(this))))}setUrls(t){this.urls=t;const e=t.join(`
161
- `);this.setTileUrlFunction(bl(t.map(this.createFromWMTSTemplate.bind(this))),e)}getDimensions(){return this.dimensions_}getFormat(){return this.format_}getLayer(){return this.layer_}getMatrixSet(){return this.matrixSet_}getRequestEncoding(){return this.requestEncoding_}getStyle(){return this.style_}getVersion(){return this.version_}getKeyForDimensions_(){const t=this.urls?this.urls.slice(0):[];for(const e in this.dimensions_)t.push(e+"-"+this.dimensions_[e]);return t.join("/")}updateDimensions(t){Object.assign(this.dimensions_,t),this.setKey(this.getKeyForDimensions_())}createFromWMTSTemplate(t){const e=this.requestEncoding_,n={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};e=="KVP"&&Object.assign(n,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),t=e=="KVP"?Ya(t,n):t.replace(/\{(\w+?)\}/g,function(r,a){return a.toLowerCase()in n?n[a.toLowerCase()]:r});const s=this.tileGrid,o=this.dimensions_;return function(r,a,c){if(!r)return;const h={TileMatrix:s.getMatrixId(r[0]),TileCol:r[1],TileRow:r[2]};Object.assign(h,o);let l=t;return e=="KVP"?l=Ya(l,h):l=l.replace(/\{(\w+?)\}/g,function(u,f){return h[f]}),l}}}class Ha extends Sl{constructor(t){t=t||{};const e=t.projection!==void 0?t.projection:"EPSG:3857",n=t.tileGrid!==void 0?t.tileGrid:$g({extent:wl(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,opaque:t.opaque,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:n,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX!==void 0?t.wrapX:!0,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.gutter_=t.gutter!==void 0?t.gutter:0}getGutter(){return this.gutter_}}class np extends d.Destroyable{constructor(e,n){super();R(this,"_imageriesManager");R(this,"_map");R(this,"_raster");R(this,"_layer",this.dv(d.react(void 0)));R(this,"_rShow",this.dv(d.react(!0)));R(this,"_rAlpha",this.dv(d.react(1)));R(this,"_rZIndex",this.dv(d.react(0)));R(this,"_rRectangle",this.dv(d.react(void 0)));R(this,"_rSplitDirection",this.dv(d.react("NONE")));R(this,"_rBrightness",this.dv(d.react(1)));R(this,"_rContrast",this.dv(d.react(1)));R(this,"_rHue",this.dv(d.react(0)));R(this,"_rSaturation",this.dv(d.react(1)));R(this,"_rGamma",this.dv(d.react(1)));R(this,"_raf");this.id=n;const s=e.viewer;if(!s)return;this._map=s;const o=Mi(s);if(!o)return;const{imageriesManager:r}=o;this._imageriesManager=r,this.d(()=>this._destroyLayer())}get layer(){return this._layer.value}set layer(e){this._layer.value=e}get layerChanged(){return this._layer.changed}get show(){return this._rShow.value}get alpha(){return this._rAlpha.value}get zIndex(){return this._rZIndex.value}get rectangle(){return this._rRectangle.value}get splitDirection(){return this._rSplitDirection.value}get brightness(){return this._rBrightness.value}get contrast(){return this._rContrast.value}get hue(){return this._rHue.value}get saturation(){return this._rSaturation.value}get gamma(){return this._rGamma.value}get showChanged(){return this._rShow.changed}get alphaChanged(){return this._rAlpha.changed}get zIndexChanged(){return this._rZIndex.changed}get rectangleChanged(){return this._rRectangle.changed}get splitDirectionChanged(){return this._rSplitDirection.changed}get brightnessChanged(){return this._rBrightness.changed}get contrastChanged(){return this._rContrast.changed}get hueChanged(){return this._rHue.changed}get saturationChanged(){return this._rSaturation.changed}get gammaChanged(){return this._rGamma.changed}set show(e){var s;const n=e??!0;this._rShow.value=n,(s=this._layer.value)==null||s.setVisible(n)}set alpha(e){var s;const n=e??1;this._rAlpha.value=n,(s=this._layer.value)==null||s.setOpacity(n)}set zIndex(e){const n=e??0;this._rZIndex.value=n,this._layer.value&&this._imageriesManager&&this._imageriesManager.setZindex(this._layer.value,n)}set rectangle(e){this._rRectangle.value=e}set splitDirection(e){this._rSplitDirection.value=e??"NONE"}set brightness(e){this._rBrightness.value=e??1,this._applyColorAdjustments()}set contrast(e){this._rContrast.value=e??1,this._applyColorAdjustments()}set hue(e){this._rHue.value=e??0,this._applyColorAdjustments()}set saturation(e){this._rSaturation.value=e??1,this._applyColorAdjustments()}set gamma(e){this._rGamma.value=e??1,this._applyColorAdjustments()}_applyColorAdjustments(){this._raf||(this._raf=requestAnimationFrame(()=>{var s,o,r;this._raf=void 0;const e=this._layer.value,n=(s=e==null?void 0:e.getSource)==null?void 0:s.call(e);(r=(o=this._raster)==null?void 0:o.changed)==null||r.call(o),n!=null&&n.refresh?n.refresh():e!=null&&e.changed&&e.changed()}))}set imageryProvider(e){this._createFromProvider(e)}flyTo(e){}_destroyLayer(){var n,s,o;const e=(n=this._layer)==null?void 0:n.value;this._map&&e&&this._imageriesManager&&this._imageriesManager.delete(e),this._raf&&(cancelAnimationFrame(this._raf),this._raf=void 0),(o=(s=this._raster)==null?void 0:s.dispose)==null||o.call(s),this._raster=void 0,this._layer.value=void 0}_wrapWithRaster(e){const n=Math.min(4,Math.max(1,(typeof navigator<"u"&&navigator.hardwareConcurrency||4)-1)),s=new El({sources:[e],operationType:"pixel",threads:n,operation:function(o,r){function a(y,w,E){return .2126*y+.7152*w+.0722*E}function c(y,w,E,b,P){const I=.299*y+.587*w+.114*E,M=.595716*y-.274453*w-.321263*E,D=.211456*y-.522591*w+.311135*E,L=M*b-D*P,z=M*P+D*b;let q=I+.9563*L+.621*z,Y=I-.2721*L-.6474*z,X=I-1.107*L+1.7046*z;const Q=m=>m<0?0:m>1?1:m;return[Q(q),Q(Y),Q(X)]}const h=o[0];let l=h[0]/255,u=h[1]/255,f=h[2]/255;const g=h[3]/255;if(r.hueCos!==1||r.hueSin!==0){const y=c(l,u,f,r.hueCos,r.hueSin);l=y[0],u=y[1],f=y[2]}if(r.saturation!==1){const y=a(l,u,f);l=y+(l-y)*r.saturation,u=y+(u-y)*r.saturation,f=y+(f-y)*r.saturation}r.brightness!==1&&(l*=r.brightness,u*=r.brightness,f*=r.brightness),r.contrast!==1&&(l=(l-.5)*r.contrast+.5,u=(u-.5)*r.contrast+.5,f=(f-.5)*r.contrast+.5),r.gammaInv!==1&&(l=Math.pow(Math.max(l,0),r.gammaInv),u=Math.pow(Math.max(u,0),r.gammaInv),f=Math.pow(Math.max(f,0),r.gammaInv));const _=y=>Math.max(0,Math.min(255,Math.round(y*255)));return h[0]=_(l),h[1]=_(u),h[2]=_(f),h[3]=_(g),h}});return s.on("beforeoperations",o=>{const r=this._rHue.value??0;o.data.brightness=this._rBrightness.value??1,o.data.contrast=this._rContrast.value??1,o.data.saturation=this._rSaturation.value??1,o.data.gammaInv=1/Math.max(1e-4,this._rGamma.value??1),o.data.hueCos=Math.cos(r),o.data.hueSin=Math.sin(r)}),this._raster=s,s}_makeLayerForSource(e){return e instanceof El?new fl({source:e}):e instanceof Hg?new fl({source:e}):new Va({source:e})}_createFromProvider(e){var _,y;if(!this._map)return;this._destroyLayer();const s=Gt("EPSG:3857").getExtent(),o=yt(s)/256,r=e,a=r.crossOrigin??"anonymous",c=Math.max((r.maximumLevel??18)+1,19),h=Array.from({length:c},(w,E)=>o/Math.pow(2,E));Array.from({length:c},(w,E)=>E.toString());const l=(w,E)=>{if(!E)return{url:w};const b=Array.isArray(E)?E:E.split("");return b.length?w.includes("{s}")?{urls:b.map(P=>w.replace("{s}",P))}:{url:w}:{url:w}},u=w=>typeof w=="string"?w:w&&w.url||"",f=r.minimumLevel??0,g=r.maximumLevel??18;switch(e.type){case"UrlTemplateImageryProvider":{const w=e,E=u(w.url),b=l(E,w.subdomains),P=new Ha({...b.urls?{urls:b.urls}:{url:b.url},attributions:r.attributions,crossOrigin:a,wrapX:!0,minZoom:f,maxZoom:g,transition:0}),I=this._wrapWithRaster(P);this._layer.value=this._makeLayerForSource(I);break}case"WebMapTileServiceImageryProvider":{const w=e,E=(w.matrixSet??w.tileMatrixSetID??"EPSG:3857").toUpperCase(),b=E==="EPSG:4326",P=(w.minimumLevel??f)|0,I=(w.maximumLevel??g)|0,M=w.tileMatrixLabels||w.TileMatrixLabels,D=b?Array.from({length:22},(N,G)=>`${E}:${G}`):Array.from({length:22},(N,G)=>String(G)),L=M&&M.length?M:D,z=L.length,q=Math.max(0,Math.min(P,z-1)),Y=Math.max(q,Math.min(I,z-1)),X=Math.max(1,Y-q+1),Q=L.slice(q,q+X),m=256;let v,S,A;if(b){S=[-180,-90,180,90],v=Ae(S);const N=360/(m*2);A=Array.from({length:X},(G,V)=>N/Math.pow(2,q+V))}else{S=s,v=Ae(S);const N=yt(S)/m;A=Array.from({length:X},(G,V)=>N/Math.pow(2,q+V))}const F=new Nv({url:u(w.url),layer:w.layer,matrixSet:E,format:w.format??"image/png",style:w.style??"default",tileGrid:w.tileGrid??new zv({origin:v,extent:S,resolutions:A,matrixIds:Q,tileSize:m}),requestEncoding:w.requestEncoding||w.requestencoding||"KVP",...b?{projection:Gt("EPSG:4326")}:{},attributions:r.attributions,crossOrigin:a,wrapX:!0,transition:0,tileLoadFunction:(N,G)=>{const V=new Image;V.crossOrigin=a||"anonymous",V.onload=()=>{var ki,fi;const Z=this._rBrightness.value??1,B=this._rContrast.value??1,at=this._rSaturation.value??1,et=this._rHue.value??0,it=this._rGamma.value??1;if(et===0&&at===1&&Z===1&&B===1&&it===1){const Rt=(ki=N.getImage)==null?void 0:ki.call(N);if(Rt){Rt.src=G;return}}const gt=V.naturalWidth||V.width,wt=V.naturalHeight||V.height;if(!gt||!wt){N.getImage().src=G;return}const dt=document.createElement("canvas");dt.width=gt,dt.height=wt;const Et=dt.getContext("2d",{willReadFrequently:!0});Et.drawImage(V,0,0);const ft=Et.getImageData(0,0,gt,wt),xt=ft.data,Ft=Math.cos(et),kt=Math.sin(et),Wt=[[.299,.587,.114],[.595716,-.274453,-.321263],[.211456,-.522591,.311135]],he=[[1,.9563,.621],[1,-.2721,-.6474],[1,-1.107,1.7046]],ye=[[1,0,0],[0,Ft,-kt],[0,kt,Ft]],ns=(Rt,Ee)=>{const Ze=Array.from({length:3},()=>[0,0,0]);for(let At=0;At<3;At++)for(let Ue=0;Ue<3;Ue++)Ze[At][Ue]=Rt[At][0]*Ee[0][Ue]+Rt[At][1]*Ee[1][Ue]+Rt[At][2]*Ee[2][Ue];return Ze},we=ns(he,ns(ye,Wt)),En=.5-.5*B,Cn=1/Math.max(1e-4,it),bn=new Uint8ClampedArray(256);for(let Rt=0;Rt<256;Rt++)bn[Rt]=Math.max(0,Math.min(255,Math.round(Math.pow(Rt/255,Cn)*255)));const ae=.2126,ve=.7152,Oe=.0722;for(let Rt=0;Rt<xt.length;Rt+=4){let Ee=xt[Rt]/255,Ze=xt[Rt+1]/255,At=xt[Rt+2]/255;const Ue=xt[Rt+3],ac=we[0][0]*Ee+we[0][1]*Ze+we[0][2]*At,cc=we[1][0]*Ee+we[1][1]*Ze+we[1][2]*At,Er=we[2][0]*Ee+we[2][1]*Ze+we[2][2]*At,Wi=ae*ac+ve*cc+Oe*Er,Cr=Wi+(ac-Wi)*at,hc=Wi+(cc-Wi)*at,br=Wi+(Er-Wi)*at,ss=Cr*Z,os=hc*Z,rs=br*Z;let xn=ss*B+En,Sn=os*B+En,$t=rs*B+En;xn=xn<0?0:xn>1?1:xn,Sn=Sn<0?0:Sn>1?1:Sn,$t=$t<0?0:$t>1?1:$t,xt[Rt]=bn[Math.round(xn*255)],xt[Rt+1]=bn[Math.round(Sn*255)],xt[Rt+2]=bn[Math.round($t*255)],xt[Rt+3]=Ue}Et.putImageData(ft,0,0);const Ne=(fi=N.setImage)==null?void 0:fi.bind(N);Ne?Ne(dt):N.getImage().src=dt.toDataURL("image/png")},V.onerror=()=>{N.getImage().src=G},V.src=G}});this._layer.value=new Va({source:F});break}case"WebMapServiceImageryProvider":{const w=e,E={LAYERS:w.layers,TILED:!0,VERSION:((_=w.parameters)==null?void 0:_.VERSION)??((y=w.parameters)==null?void 0:y.version)??"1.3.0",...w.parameters},b=new Lv({url:u(w.url),params:E,attributions:r.attributions,crossOrigin:a,transition:0}),P=this._wrapWithRaster(b);this._layer.value=this._makeLayerForSource(P);break}case"TileMapServiceImageryProvider":{const w=e,E=w.url?u(w.url):"",b=E.includes("{-y}"),P=/4326/.test(E)?"EPSG:4326":"EPSG:3857",I=Gt(P),M=b?$g({extent:I.getExtent(),minZoom:f,maxZoom:g,tileSize:256}):void 0,D=w.url?u(w.url):"",L=new Ha({url:D,attributions:r.attributions,crossOrigin:a,wrapX:!0,minZoom:f,maxZoom:g,tileGrid:new qs({origin:Ae(s),resolutions:h.slice(f,g+1)}),zDirection:-1,transition:0,...M?{tileGrid:M}:{}}),z=this._wrapWithRaster(L);this._layer.value=this._makeLayerForSource(z);break}case"OpenStreetMapImageryProvider":{const w=e,E=new Ha({url:w.url,attributions:r.attributions,crossOrigin:a,wrapX:!0,transition:0}),b=this._wrapWithRaster(E);this._layer.value=this._makeLayerForSource(b);break}case"SingleTileImageryProvider":{const w=e,E=typeof w.url=="string"?w.url:w.url.url,b=w.rectangle?bu(w.rectangle,"EPSG:4326","EPSG:3857"):s,P=new Hg({url:E,imageExtent:b,attributions:r.attributions,crossOrigin:a,interpolate:!0}),I=this._wrapWithRaster(P);this._layer.value=this._makeLayerForSource(I);break}default:{console.warn("[OlImagery] 未实现的 provider.type:",e.type,e);return}}this._layer.value.setOpacity(this._rAlpha.value),this._layer.value.setVisible(this._rShow.value),this._imageriesManager&&this._imageriesManager.add(this._layer.value),this._imageriesManager&&this._imageriesManager.setZindex(this._layer.value,this._rZIndex.value)}}const sc=class sc extends d.Destroyable{constructor(e,n){super();R(this,"_pickedEvent",this.disposeVar(new d.Event));R(this,"_flyToEvent",this.disposeVar(new d.Event));R(this,"_clickEvent",this.disposeVar(new d.Event));R(this,"_hovered",this.disposeVar(d.react(!1)));R(this,"_feature");R(this,"_source");R(this,"_layer");R(this,"_initialized",!1);const s=new Ge([]);this._feature=new Je({geometry:s}),this._feature.setId(n??d.createGuid());const o=e.viewer;if(!o)return;this._source=new Si,this.dispose(()=>{var h;return(h=this._source)==null?void 0:h.dispose()}),this._layer=new oi({source:this._source}),this.dispose(()=>{var h;return(h=this._layer)==null?void 0:h.dispose()});const r=()=>{var h;(h=this._layer)==null||h.setVisible(this.show??!0)};this.d(d.createEventsCallFunc(this.showChanged,r,{immediate:!0})),o.addLayer(this._layer),this.dispose(()=>o.removeLayer(this._layer));const a=()=>{if(!this._source||!this._feature||(this._source.clear(),!this.position))return;const h=_t([this.position[0][0],this.position[0][1]]);s.setCoordinates(h);const l=this.radius??5,u=this.strokeWidth??2,f=this.fillColor??[255,255,255,1],g=this.strokeColor??[0,153/255,1,1],_=new de({color:`rgba(${f.map(E=>E*255).join(",")})`}),y=new Se({color:`rgba(${g.map(E=>E*255).join(",")})`,width:u}),w=new Xt({image:new ii({radius:l,fill:_,stroke:y})});this._feature.setStyle(w),this._source.addFeature(this._feature)};a();const c=this.disposeVar(d.createNextAnimateFrameEvent(this.positionChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged));this.dispose(c.disposableOn(a)),this.dispose(this.flyToEvent.disposableOn(h=>{this.position&&Ri(e,this.position)})),this.dispose(this.positionChanged.disposableOn(()=>{!this._initialized&&this.position&&(this._initializePoint(),this._initialized=!0)}))}get typeName(){return"OlPoint"}get defaultProps(){return sc.createDefaultProps()}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}get clickEvent(){return this._clickEvent}get hovered(){return this._hovered.value}set hovered(e){this._hovered.value=e}get feature(){return this._feature}_initializePoint(){const e=()=>{var g;if(!this.position)return;const s=_t([this.position[0],this.position[1]]);if(!this._feature)return;this._feature.getGeometry().setCoordinates(s);const r=this.radius??5,a=this.strokeWidth??2,c=this.fillColor??[1,1,1,1],h=this.strokeColor??[0,153/255,1,1],l=new de({color:`rgba(${c.map(_=>_*255).join(",")})`}),u=new Se({color:`rgba(${h.map(_=>_*255).join(",")})`,width:a}),f=new Xt({image:new ii({radius:r,fill:l,stroke:u})});this._feature.setStyle(f),this._feature.set("visible",this.show??!0),(g=this._source)==null||g.addFeature(this._feature)};e();const n=d.createNextAnimateFrameEvent(this.positionChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged);this.dispose(n.disposableOn(e))}};R(sc,"defaults",{position:[],width:2,loop:!1,color:[1,1,1,.5],outlineColor:[0,0,0,1],show:!0,allowPicking:!1,strokeColor:[0,.6,1,1],fillColor:[1,1,1,1],strokeWidth:2,radius:5});let Xe=sc;(i=>{i.createDefaultProps=()=>({show:void 0,position:d.reactArrayWithUndefined(void 0),editting:void 0,allowPicking:!1,pixelSize:void 0,color:d.reactArrayWithUndefined(void 0),outlineColor:d.reactArrayWithUndefined(void 0),outlineWidth:void 0,fillColor:d.reactArrayWithUndefined(void 0),strokeColor:d.reactArrayWithUndefined(void 0),strokeWidth:void 0,radius:void 0,zIndex:void 0})})(Xe||(Xe={})),d.extendClassProps(Xe.prototype,Xe.createDefaultProps);const oc=class oc extends d.Destroyable{constructor(e,n){super();R(this,"_flyToEvent",this.disposeVar(new d.Event));R(this,"_layer");R(this,"_feature");R(this,"_source");R(this,"_lineString");const s=new wi([]);this._lineString=s,this.d(()=>{var h;return(h=this._lineString)==null?void 0:h.dispose()}),this._feature=new Je({geometry:s}),this._feature.setId(n??d.createGuid()),this.d(()=>{var h;return(h=this._feature)==null?void 0:h.dispose()}),this._source=new Si,this.d(()=>{var h;return(h=this._source)==null?void 0:h.dispose()}),this._layer=new oi({zIndex:0,source:this._source}),this.d(()=>{var h;return(h=this._layer)==null?void 0:h.dispose()});const o=e.viewer;if(!o)return;o.addLayer(this._layer),this.d(()=>o.removeLayer(this._layer));const r=()=>{var h;(h=this._layer)==null||h.setVisible(this.show??!0)};r(),this.ad(this.showChanged.don(r)),this.d(d.createEventsCallFunc(this.zIndexChanged,()=>{var h;(h=this._layer)==null||h.setZIndex(this.zIndex)},{immediate:!0}));const a=()=>{if(!this._source||!this._feature||(this._source.clear(),!this.positions||this.positions.length<2))return;const h=this.positions.map(f=>_t([f[0],f[1]]));this.loop&&h.length>=3&&h.push(h[0]),this._feature.getGeometry().setCoordinates(h);const u=(f,g)=>{const _=[],y=new Se({color:`rgba(${this.color[0]*255}, ${this.color[1]*255}, ${this.color[2]*255}, ${this.color[3]})`,width:this.width??2,lineDash:this.hasDash?[this.dashLength??16,(this.dashLength??16)/2]:void 0});if(_.push(new Xt({stroke:y})),this.hasArrow&&h.length>=2){const[w,E]=h[h.length-2],[b,P]=h[h.length-1],I=Uv(b-w,P-E);_.push(new Xt({geometry:new Ge([b,P]),image:new mo({points:3,radius:8,rotation:I,rotateWithView:!0,fill:new de({color:`rgba(${this.color[0]*255}, ${this.color[1]*255}, ${this.color[2]*255}, ${this.color[3]})`})})}))}return _};this._feature.setStyle(u),this._source.addFeature(this._feature)};a();const c=this.disposeVar(d.createNextAnimateFrameEvent(this.positionsChanged,this.loopChanged,this.widthChanged,this.colorChanged,this.hasDashChanged,this.dashLengthChanged,this.hasArrowChanged,this.showChanged));this.d(c.disposableOn(a)),this.d(this.flyToEvent.disposableOn(h=>{if(!this.positions||this.positions.length===0)return;const l=this.positions[Math.floor(this.positions.length/2)];Ri(e,l)}))}get typeName(){return"OlPolyline"}get defaultProps(){return oc.createDefaultProps()}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}};R(oc,"defaults",{positions:[],width:2,loop:!1,color:[1,1,1,1],hasDash:!1,dashLength:16,hasArrow:!1});let Jt=oc;(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:d.reactPositions(void 0),loop:!1,width:2,color:d.reactArray([1,1,1,1]),hasDash:!1,dashLength:16,hasArrow:!1,arcType:"GEODESIC",depthTest:!1,zIndex:0,dashPattern:255,gapColor:d.reactArray([0,0,0,0])})})(Jt||(Jt={})),d.extendClassProps(Jt.prototype,Jt.createDefaultProps);function Uv(i,t){const e=Math.atan2(t,i);return(Math.PI/2-e+2*Math.PI)%(2*Math.PI)}class jv extends d.Destroyable{constructor(e,n){super();R(this,"_geoPoint");R(this,"_geoAxis");this._geoPoint=this.disposeVar(new Xe(n,e.id)),this._geoAxis=this.disposeVar(new Jt(n,e.id)),this._geoAxis.width=6,this._geoAxis.color=[1,1,0,.7]}get geoPoint(){return this._geoPoint}get geoAxis(){return this._geoAxis}}const Ni=class Ni extends d.Destroyable{constructor(e,n){super();R(this,"_captureEvent",this.disposeVar(new d.Event));R(this,"_id",this.disposeVar(d.react(d.createGuid())));if(this._olViewer=e,n&&(this.id=n),!e.viewer)return;this.disposeVar(new d.ObjResettingWithEvent(this.showChanged,()=>{if(this.show&&this.position)return new jv(this,e)})),this.default&&this.flyTo(void 0,!1);const o=this.disposeVar(d.createProcessingFromAsyncFunc(async a=>{const{position:c,rotation:h,viewDistance:l,duration:u=1e3}=this;if(c){const f=Ri(this._olViewer,c,l,h,u,()=>{this.enabled=!1});f&&await a.promise(f),this.enabled=!1}}));this.dispose(this.enabledChanged.disposableOn(()=>{o.isRunning&&o.cancel(),this.enabled&&o.restart()}));const r=this.disposeVar(d.createProcessingFromAsyncFunc(async(a,c,h)=>{var f,g;const l=(g=(f=this._olViewer).capture)==null?void 0:g.call(f,c,h);if(!l)return;const u=await a.promise(l);u&&(this.thumbnail=u)}));this.dispose(this.captureEvent.disposableOn((a,c)=>{r.restart(void 0,a??Ni.defaults.thumbnailWidth,c??Ni.defaults.thumbnailHeight)}))}get captureEvent(){return this._captureEvent}capture(e,n){this._captureEvent.emit(e,n)}get id(){return this._id.value}set id(e){this._id.value=e}get idChanged(){return this._id.changed}resetWithCurrentCamera(e){if(!this._olViewer.actived)return;const n=this._olViewer.getCurrentCameraInfo();n&&(e&Ni.ResetFlag.Position&&(this.position=n.position),e&Ni.ResetFlag.Rotation&&(this.rotation=n.rotation),e&Ni.ResetFlag.ViewDistance&&(this.viewDistance=0))}flyTo(e,n){if((n??!0)&&!this._olViewer.actived)return;const{position:s,rotation:o,viewDistance:r,duration:a}=this;s&&Ri(this._olViewer,s,r,o,e??a)}};R(Ni,"ResetFlag",{Position:1,Rotation:2,ViewDistance:4,Zoom:10}),R(Ni,"defaults",{thumbnailWidth:64,thumbnailHeight:64,enabled:!0,show:!1,position:[116.39,39.9,100],duration:1e3,default:!1,thumbnail:""});let Hn=Ni;(i=>{i.createDefaultProps=()=>({enabled:!0,position:d.reactArrayWithUndefined(void 0),positionEditing:!1,show:!1,rotation:d.reactArray([0,0,0]),viewDistance:0,duration:void 0,default:!1,thumbnail:""})})(Hn||(Hn={})),d.extendClassProps(Hn.prototype,Hn.createDefaultProps);class Di extends d.Destroyable{constructor(e,n){super();R(this,"_flyToEvent",this.disposeVar(new d.Event));R(this,"_feature");R(this,"_layer");R(this,"_source");const s=new ps([[]]);this._feature=new Je({geometry:s}),this._feature.setId(n??d.createGuid());const o=e.viewer;if(!o)return;this._source=new Si,this.dispose(()=>{var h;return(h=this._source)==null?void 0:h.dispose()}),this._layer=new oi({source:this._source}),this.dispose(()=>{var h;return(h=this._layer)==null?void 0:h.dispose()}),o.addLayer(this._layer),this.dispose(()=>o.removeLayer(this._layer));const r=()=>{var h,l;(h=this._layer)==null||h.setVisible(this.show??!0),(l=this._layer)==null||l.setZIndex(this.zIndex)};this.d(d.createEventsCallFunc([this.showChanged,this.zIndexChanged],r,{immediate:!0}));const a=()=>{if(!this._source||!this._feature||(this._source.clear(),!this.positions||this.positions.length<3))return;const h=op(this.positions);if(h.length<4)return;this._feature.getGeometry().setCoordinates([h]);const l=this.filled?this.fillColor:[0,0,0,0],u=this.stroked?this.outlineColor:[0,0,0,0];this._feature.setStyle(new Xt({fill:new de({color:sp(l)}),stroke:new Se({color:sp(u),width:this.outlineWidth??1.5,lineDash:this.hasDash?[this.dashLength??16,(this.dashLength??16)/2]:void 0})})),this._source.addFeature(this._feature)};a();const c=this.disposeVar(d.createNextAnimateFrameEvent(this.positionsChanged,this.fillColorChanged,this.outlineColorChanged,this.outlineWidthChanged,this.hasDashChanged,this.dashLengthChanged,this.strokedChanged,this.filledChanged));this.dispose(c.disposableOn(a)),this.dispose(this.flyToEvent.disposableOn(h=>{if(!this.positions||this.positions.length===0)return;const l=op(this.positions),[u,f]=kv(l),[g,_]=Kt([u,f]);Ri(e,[g,_,0])}))}get typeName(){return"OlPolygon"}get defaultProps(){return Di.createDefaultProps()}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}}(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:d.reactJsonWithUndefined(void 0),fillColor:d.reactArray([1,1,1,.4]),outlineColor:d.reactArray([1,1,1,1]),outlineWidth:1.5,hasDash:!1,dashLength:16,zIndex:0,stroked:!0,filled:!0})})(Di||(Di={})),d.extendClassProps(Di.prototype,Di.createDefaultProps);function sp(i){return`rgba(${i[0]*255}, ${i[1]*255}, ${i[2]*255}, ${i[3]})`}function op(i){const t=i.map(s=>_t([s[0],s[1]])),e=t[0],n=t[t.length-1];return(!e||!n||e[0]!==n[0]||e[1]!==n[1])&&t.push(e),t}function kv(i){let t=0,e=0,n=0;for(let s=0,o=i.length-1;s<i.length;o=s++){const[r,a]=i[o],[c,h]=i[s],l=r*h-c*a;t+=l,e+=(r+c)*l,n+=(a+h)*l}return t*=.5,Math.abs(t)<1e-9?i[0]:(e/=6*t,n/=6*t,[e,n])}class Rl extends gs{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){this.flatCoordinates?In(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.changed()}clone(){const t=new Rl(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,n,s){if(s<no(this.getExtent(),t,e))return s;const o=this.flatCoordinates,r=this.stride;for(let a=0,c=o.length;a<c;a+=r){const h=Dn(t,e,o[a],o[a+1]);if(h<s){s=h;for(let l=0;l<r;++l)n[l]=o[a+l];n.length=r}}return s}getCoordinates(){return Ki(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){const e=this.flatCoordinates?this.flatCoordinates.length/this.stride:0;return t<0||e<=t?null:new Ge(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){const t=this.flatCoordinates,e=this.layout,n=this.stride,s=[];for(let o=0,r=t.length;o<r;o+=n){const a=new Ge(t.slice(o,o+n),e);s.push(a)}return s}getType(){return"MultiPoint"}intersectsExtent(t){const e=this.flatCoordinates,n=this.stride;for(let s=0,o=e.length;s<o;s+=n){const r=e[s],a=e[s+1];if(gc(t,r,a))return!0}return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Ur(this.flatCoordinates,0,t,this.stride),this.changed()}}const rc=class rc extends d.Destroyable{constructor(e,n){super();R(this,"_pickedEvent",this.disposeVar(new d.Event));R(this,"_flyToEvent",this.disposeVar(new d.Event));R(this,"_clickEvent",this.disposeVar(new d.Event));R(this,"_hovered",this.disposeVar(d.react(!1)));R(this,"_feature");R(this,"_source");R(this,"_layer");R(this,"_initialized",!1);const s=new Rl([]);this._feature=new Je({geometry:s}),this._feature.setId(n??d.createGuid());const o=e.viewer;if(!o)return;this._source=new Si,this.dispose(()=>{var h;return(h=this._source)==null?void 0:h.dispose()}),this._layer=new oi({source:this._source}),this.dispose(()=>{var h;return(h=this._layer)==null?void 0:h.dispose()});const r=()=>{var h;(h=this._layer)==null||h.setVisible(this.show??!0)};r(),this.ad(this.showChanged.don(r)),o.addLayer(this._layer),this.dispose(()=>o.removeLayer(this._layer));const a=()=>{if(!this._source||!this._feature||(this._source.clear(),!this.points))return;const h=this.points.map(b=>_t([b[0],b[1]]));if(!this._feature)return;const l=this._feature.getGeometry();l&&l.setCoordinates(h);const u=this.radius??5,f=this.strokeWidth??2,g=this.fillColor??[255,255,255,1],_=this.strokeColor??[0,153/255,1,1],y=new de({color:`rgba(${g.map(b=>b*255).join(",")})`}),w=new Se({color:`rgba(${_.map(b=>b*255).join(",")})`,width:f}),E=new Xt({image:new ii({radius:u,fill:y,stroke:w})});this._feature.setStyle(E),this._source.addFeature(this._feature)};a();const c=this.disposeVar(d.createNextAnimateFrameEvent(this.pointsChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged));this.dispose(c.disposableOn(a)),this.dispose(this.pointsChanged.don(()=>{!this._initialized&&this.points&&(this._initializePoint(),this._initialized=!0)}))}get typeName(){return"OlMultiPoint"}get defaultProps(){return rc.createDefaultProps()}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}get clickEvent(){return this._clickEvent}get hovered(){return this._hovered.value}set hovered(e){this._hovered.value=e}get feature(){return this._feature}_initializePoint(){const e=()=>{var g;if(!this.points)return;const s=this.points.map(_=>_t([_[0],_[1]]));if(!this._feature)return;const o=this._feature.getGeometry();o&&o.setCoordinates(s);const r=this.radius??5,a=this.strokeWidth??2,c=this.fillColor??[1,1,1,1],h=this.strokeColor??[0,153/255,1,1],l=new de({color:`rgba(${c.map(_=>_*255).join(",")})`}),u=new Se({color:`rgba(${h.map(_=>_*255).join(",")})`,width:a}),f=new Xt({image:new ii({radius:r,fill:l,stroke:u})});this._feature.setStyle(f),this._feature.set("visible",this.show??!0),(g=this._source)==null||g.addFeature(this._feature)};e();const n=d.createNextAnimateFrameEvent(this.pointsChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged);this.dispose(n.disposableOn(e))}};R(rc,"defaults",{position:[],width:2,loop:!1,color:[1,1,1,.5],outlineColor:[0,0,0,1],show:!0,allowPicking:!1,strokeColor:[0,.6,1,1],fillColor:[1,1,1,1],strokeWidth:2,radius:5});let _n=rc;(i=>{i.createDefaultProps=()=>({show:void 0,points:d.reactPositions(void 0),editting:void 0,allowPicking:!1,pixelSize:void 0,color:d.reactArrayWithUndefined(void 0),outlineColor:d.reactArrayWithUndefined(void 0),outlineWidth:void 0,fillColor:d.reactArrayWithUndefined(void 0),strokeColor:d.reactArrayWithUndefined(void 0),strokeWidth:void 0,radius:void 0,zIndex:void 0})})(_n||(_n={})),d.extendClassProps(_n.prototype,_n.createDefaultProps);class Xa extends d.EngineObject{constructor(t,e){if(super(t,e),!e.viewer){console.warn("map is undefined!");return}this.d(t.flyToEvent.don((s,o)=>this.flyTo(s,o))),this.d(t.flyInEvent.don((s,o)=>this.flyIn(s,o))),this.dispose(t.calcFlyInParamEvent.disposableOn(()=>{if(!e.actived)return;const s=e.getCurrentCameraInfo();if(!s)return;const{position:o,rotation:r}=s;t.flyInParam={position:o,rotation:r,flyDuration:1}})),this.dispose(t.calcFlyToParamEvent.disposableOn(()=>{t.useCalcFlyToParamInESObjectWithLocation||console.warn("calcFlyToParam无法调用,该对象缺少position属性!")}))}flyToWithPromise(t,e,n,s,o,r,a){const{sceneObject:c,olViewer:h}=this;h.flyTo({distance:n??0,heading:s?s[0]:0,pitch:s?s[1]:0,flyDuration:o??1,hDelta:r??0,pDelta:a??0},e)}flyTo(t,e){const{sceneObject:n,olViewer:s}=this;return s.actived?(n.flyToParam&&(n.useCalcFlyToParamInESObjectWithLocation||console.warn("flyToParam无法使用,该对象缺少position属性,若飞行失败,请清空flyToParam后重试!")),n.flyInParam?this.flyIn(t,e):!1):!1}flyIn(t,e){const{sceneObject:n,olViewer:s}=this;if(!s.actived)return!1;if(n.flyInParam){const{position:o,rotation:r,flyDuration:a}=n.flyInParam,c=t??a;return this.olViewer.flyIn(o,r,c),!0}return!1}get olViewer(){return this.viewer}}class Go extends Xa{constructor(e,n){super(e,n);R(this,"_smoothMoving");this._smoothMoving=this.dv(new d.SmoothMoveController(n)),this.d(this._smoothMoving.currentPositionChanged.don(o=>{o&&(e.position=o)})),this.d(this._smoothMoving.currentRotationChanged.don(o=>{o&&this._smoothMoving.isRotating&&(e.rotation=o)})),this.d(this._smoothMoving.currentHeadingChanged.don(o=>{if(o!==void 0&&!this._smoothMoving.isRotating){const r=e.rotation;e.rotation=[o-90,r[1],r[2]]}})),this.d(e.smoothMoveEvent.don((o,r)=>this.smoothMove(o,r*1e3))),this.d(e.smoothMoveWithRotationEvent.don((o,r,a)=>this.smoothMoveWithRotation(o,r,a*1e3))),this.d(e.smoothMoveOnGroundEvent.don((o,r,a)=>this.smoothMoveOnGround(o,r,a*1e3))),this.d(e.smoothMoveWithRotationOnGroundEvent.don((o,r,a,c)=>this.smoothMoveWithRotationOnGround(o,r,a,c*1e3))),this.d(e.calcFlyToParamEvent.don(()=>{if(!e.useCalcFlyToParamInESObjectWithLocation||!e.position)return;const o=n.calcFlyToParam(e.position);if(!o){console.warn("olViewer.calcFlyToParam failed.");return}console.log("olViewer.calcFlyToParam success.",o),e.flyToParam=o})),this.d(e.automaticLandingEvent.don(async()=>{console.warn("ESOlViewer automaticLandingEvent is not supported.")}));const s=this.dv(d.createNextAnimateFrameEvent(e.minVisibleDistanceChanged,e.maxVisibleDistanceChanged));this.d(s.don(()=>this.visibleDistance(e,n))),this.d(n.cameraChanged.don(()=>this.visibleDistance(e,n)))}smoothMove(e,n){this._smoothMoving.isGround=!1,this._smoothMoving.isRotating=!1,this._smoothMoving.restart(this.sceneObject.position,this.sceneObject.rotation,0),this._smoothMoving.restart(e,this.sceneObject.rotation,n)}smoothMoveWithRotation(e,n,s){this._smoothMoving.isGround=!1,this._smoothMoving.isRotating=!0,this._smoothMoving.restart(this.sceneObject.position,this.sceneObject.rotation,0),this._smoothMoving.restart(e,n,s)}async smoothMoveOnGround(e,n,s){const o=await this.olViewer.getTerrainHeight([e,n])??0;this._smoothMoving.isGround=!0,this._smoothMoving.isRotating=!1,this._smoothMoving.restart(this.sceneObject.position,this.sceneObject.rotation,0),this._smoothMoving.restart([e,n,o],this.sceneObject.rotation,s)}async smoothMoveWithRotationOnGround(e,n,s,o){const r=await this.olViewer.getTerrainHeight([n,s])??0;this._smoothMoving.isGround=!0,this._smoothMoving.isRotating=!0,this._smoothMoving.restart(this.sceneObject.position,this.sceneObject.rotation,0),this._smoothMoving.restart([n,s,r],e,o)}visibleDistance(e,n){if(!e.show||!e.position)return;const s=d.getDistancesFromPositions([e.position,ef(n)],"NONE")[0];e.minVisibleDistance<e.maxVisibleDistance?s>e.minVisibleDistance&&s<e.maxVisibleDistance:e.maxVisibleDistance===0&&s>e.minVisibleDistance}flyTo(e,n){const{sceneObject:s,olViewer:o}=this;if(!o.actived||!o.viewer)return!1;if(s.flyToParam&&s.position){const{position:r,flyToParam:a}=s,{distance:c,heading:h,pitch:l,flyDuration:u,hDelta:f,pDelta:g}=a;return this.flyToWithPromise(n,r,c,[h,l,0],e??u,f,g),!0}else return fh(o.viewer,s.position,e),!0}flyIn(e,n){const{sceneObject:s,olViewer:o}=this;return!o.actived||!o.viewer?!1:!super.flyIn(e,n)&&s.position?(fh(o.viewer,s.position,e),!0):!1}}class Pl extends Go{constructor(e,n){super(e,n);R(this,"_lastHoverResult",this.dv(d.react(void 0)));if(!n.viewer){console.warn("viewer is undefined!");return}this.ad(d.createProcessingFromAsyncFunc(async(o,r)=>{const a=await o.promise(n.pick(r.screenPosition,"innerHoverEvent"));this.lastHoverResult=Object.assign({},a,r)}))}get lastHoverResult(){return this._lastHoverResult.value}set lastHoverResult(e){this._lastHoverResult.value=e}get lastHoverResultChanged(){return this._lastHoverResult.changed}}const Wv=i=>{const t=[];if(i){const e=i.length;let n=0;for(let s=0;s<e;++s){const o=(s+1)%e,r=d.geoDistance(i[s],i[o]),a=Math.abs(i[s][2]-i[o][2]),c=Math.sqrt(r*r+a*a);n+=c,t.push(n)}}return t},qv=i=>{let t;return i?(i.length<3?t=0:t=d.geoArea(i),t):0},Gv=i=>{let t;return i?(i.length<3?t=void 0:t=d.geoCenterOfMass(i),t):void 0},Ko=class Ko extends Xa{constructor(t,e){if(super(t,e),!e.viewer){console.warn("viewer is undefined!");return}}flyIn(t,e){if(!super.flyIn(t,e)){if(!this.olViewer.actived||!this.olViewer.viewer)return!1;const s=this.sceneObject.points;if(!s||s.length===0)return!1;const o=sa(s);return To(this.olViewer.viewer,o,t),console.log("OlESGeoVector flyIn"),!0}return!0}flyTo(t,e){if(!super.flyTo(t,e)){if(!this.olViewer.actived||!this.olViewer.viewer)return!1;const s=this.sceneObject.points;if(!s||s.length===0)return!1;const o=sa(s);return To(this.olViewer.viewer,o,t),console.log("OlESGeoVector flyTo"),!0}return!0}};R(Ko,"type",Ko.register("ESOlViewer",d.ESGeoVector.type,Ko));let Gs=Ko;class Xn extends d.Destroyable{constructor(e,n){super();R(this,"_flyToEvent",this.disposeVar(new d.Event));if(!e.viewer)return;const o=this.ad(new Di(e,n)),r=this.ad(new Jt(e,n));r.loop=!0,this.ad(d.bind([r,"depthTest"],[this,"depthTest"])),this.d(d.track([o,"allowPicking"],[this,"allowPicking"]));const a=()=>{r.show=!!(this.show&&this.outline),o.show=!!(this.show&&this.fill),r.positions=this.positions,o.positions=o.show?this.positions||[]:[],r.color=this.outlineColor,r.width=this.outlineWidth;const[h=1,l=1,u=1,f=.5]=this.color||[1,1,1,.5];o.fillColor=[h,l,u,f]};a();const c=this.disposeVar(d.createNextAnimateFrameEvent(this.showChanged,this.outlineChanged,this.outlineColorChanged,this.outlineWidthChanged,this.fillChanged,this.colorChanged,this.positionsChanged));this.d(c.disposableOn(a)),this.d(this.flyToEvent.disposableOn(h=>{o.show?o.flyTo(h):r.show&&r.flyTo(h)}))}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}}R(Xn,"defaults",{viewDistanceRange:[1e3,1e4,3e4,6e4],positions:[]}),(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,outline:!0,strokeGround:!1,outlineColor:d.reactArray([1,1,1,1]),outlineWidth:2,ground:!1,fill:!0,color:d.reactArray([1,1,1,.5]),positions:d.reactPositions(void 0),viewDistanceRange:d.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,depthTest:!1})})(Xn||(Xn={})),d.extendClassProps(Xn.prototype,Xn.createDefaultProps);const Qo=class Qo extends Gs{constructor(e,n){super(e,n);R(this,"_geoPolygon");if(!n.viewer){console.warn("viewer is undefined!");return}this._geoPolygon=this.ad(new Di(this.olViewer,e.id));const o=this.geoPolygon;o&&(this.d(d.track([o,"show"],[e,"show"])),this.d(d.track([o,"allowPicking"],[e,"allowPicking"])),this.d(d.bind([o,"positions"],[e,"points"])),this.d(d.track([o,"stroked"],[e,"stroked"])),this.d(d.track([o,"outlineColor"],[e,"strokeColor"])),this.d(d.track([o,"outlineWidth"],[e,"strokeWidth"])),this.d(d.track([o,"filled"],[e,"filled"])),this.d(d.track([o,"fillColor"],[e,"fillColor"])))}get geoPolygon(){return this._geoPolygon}};R(Qo,"type",Qo.register("ESOlViewer",d.ESGeoPolygon.type,Qo));let $a=Qo;function Vo(i){var e;const t=(e=ll(i,"pickResult"))==null?void 0:e.pointerEvent;return(t==null?void 0:t.buttons)!=0?(t==null?void 0:t.button)??0:-1}function Vv(i,t,e){const n=[];for(const s of e)switch(s){case"SquareMeter_SquareKilometer":i>=1e6?n.push(`面积:${(i/1e6).toFixed(2)} km²`):n.push(`面积:${i.toFixed(2)} m²`);break;case"MU_Hectare":const o=i*(1/666.7);if(o>=15){const r=o/15;n.push(`面积:${r.toFixed(2)} 公顷`)}else n.push(`面积:${o.toFixed(2)} 亩`);break;case"PerimeterMeter_PerimeterKilometer":t>=1e3?n.push(`周长:${(t/1e3).toFixed(2)} km`):n.push(`周长:${t.toFixed(2)} m`);break}return n}class Vs extends d.Destroyable{constructor(e,n){super();R(this,"_pickedEvent",this.dv(new d.Event));R(this,"_flyToEvent",this.dv(new d.Event));R(this,"_area",this.dv(d.react(0)));R(this,"_centerOfMass",this.dv(d.reactArrayWithUndefined(void 0)));R(this,"_distances",this.dv(d.reactArray([])));R(this,"_geoPolyline");R(this,"_id",this.dv(d.react(d.createGuid())));n&&(this.id=n);{const s=()=>{this._distances.value=Wv(this.positions),this._area.value=qv(this.positions),this._centerOfMass.value=Gv(this.positions)};s();const o=this.dv(d.createNextAnimateFrameEvent(this.positionsChanged));this.dispose(o.disposableOn(s))}{const s=this._geoPolyline=this.dv(new Jt(e,n));s.loop=!0,s.arcType="GEODESIC",this.dispose(d.bind([s,"color"],[this,"color"])),this.dispose(d.bind([s,"dashLength"],[this,"dashLength"])),this.dispose(d.bind([s,"dashPattern"],[this,"dashPattern"])),this.dispose(d.bind([s,"gapColor"],[this,"gapColor"])),this.dispose(d.bind([s,"hasArrow"],[this,"hasArrow"])),this.dispose(d.bind([s,"hasDash"],[this,"hasDash"])),this.dispose(d.bind([s,"positions"],[this,"positions"])),this.dispose(d.bind([s,"show"],[this,"show"])),this.dispose(d.bind([s,"allowPicking"],[this,"allowPicking"])),this.dispose(d.bind([s,"width"],[this,"width"])),this.dispose(d.bind([s,"depthTest"],[this,"depthTest"]))}{const s=this.dv(new Xn(e,n));s.outline=!1;const o=()=>{s.positions=this.positions};o(),this.dispose(this.positionsChanged.disposableOn(o));const r=()=>{const a=this.fillColor;s.color=[a[0],a[1],a[2],a[3]*.5]};r(),this.dispose(this.fillColorChanged.disposableOn(r)),this.dispose(d.track([s,"show"],[this,"show"])),this.dispose(d.track([s,"ground"],[this,"ground"])),this.dispose(d.track([s,"allowPicking"],[this,"allowPicking"])),this.dispose(d.bind([s,"depthTest"],[this,"depthTest"])),this.d(this.flyToEvent.don(a=>{s.flyTo(a)}))}{const s=this.dv(new Qt(e,n)),o=this.dv(d.createNextAnimateFrameEvent(this.areaChanged,this.centerOfMassChanged,this.distancesChanged,this.unitsChanged)),r=()=>{if(this.distances.length===0){s.innerHTML="";return}const a=Vv(this.area,this.distances[this.distances.length-1],this.units);s.innerHTML=ja([...a].join(`
162
- `))};r(),this.dispose(o.disposableOn(r)),this.dispose(d.track([s,"show"],[this,"show"])),this.dispose(d.track([s,"allowPicking"],[this,"allowPicking"])),this.dispose(d.bind([s,"shadowDom"],[this,"shadowDom"])),this.dispose(d.bind([s,"cssAllInitial"],[this,"cssAllInitial"])),this.dispose(d.track([s,"position"],[this,"centerOfMass"])),this.ad(s.pickedEvent.don(a=>{Vo(a)===0&&this.pickedEvent.emit(a)}))}}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}get area(){return this._area.value}get areaChanged(){return this._area.changed}get centerOfMass(){return this._centerOfMass.value}get centerOfMassChanged(){return this._centerOfMass.changed}get distances(){return this._distances.value}get distancesChanged(){return this._distances.changed}get geoPolyline(){return this._geoPolyline}get id(){return this._id.value}set id(e){this._id.value=e}get idChanged(){return this._id.changed}}R(Vs,"defaults",{positions:[]}),(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:d.reactPositions(void 0),width:2,color:d.reactArray([1,1,1,.5]),fillColor:d.reactArray([1,1,1,.5]),hasDash:!1,gapColor:d.reactArray([0,0,0,0]),dashLength:16,dashPattern:255,hasArrow:void 0,depthTest:!1,shadowDom:!1,cssAllInitial:!1,strokeGround:!0,ground:!0,units:d.reactArray(["SquareMeter_SquareKilometer","MU_Hectare","PerimeterMeter_PerimeterKilometer"])})})(Vs||(Vs={})),d.extendClassProps(Vs.prototype,Vs.createDefaultProps);const Jo=class Jo extends $a{constructor(e,n){super(e,n);R(this,"_olAreaMeasurement");if(this._olAreaMeasurement=this.disposeVar(new Vs(n,e.id)),!n.viewer){console.warn("viewer is undefined!");return}e.strokeGround=!1,e.fillGround=!1;const o=this._olAreaMeasurement;this.dispose(d.track([o,"show"],[e,"show"])),this.dispose(d.track([o,"units"],[e,"units"])),this.dispose(d.track([o,"allowPicking"],[e,"allowPicking"])),this.dispose(d.bind([o,"positions"],[e,"points"])),this.dispose(d.bind([o,"strokeGround"],[e,"strokeGround"])),this.d(d.bind([o,"ground"],[e,"fillGround"]));{const r=()=>{if(e.stroked)o.width=e.strokeWidth;else{o.width=0;return}o.color=e.strokeColor;const h=e.strokeStyle;if(h.material==="hasDash"&&h.materialParams)try{const u=h.materialParams;Reflect.has(u,"gapColor")&&(o.gapColor=u.gapColor??[0,0,0,0]),Reflect.has(u,"dashLength")&&(o.dashLength=u.dashLength),Reflect.has(u,"dashPattern")&&(o.dashPattern=u.dashPattern)}catch(u){console.error(u)}else o.gapColor=[0,0,0,0],o.dashLength=0,o.dashPattern=0;const l=e.strokeMaterial??"normal";l==="hasDash"?(o.hasDash=!0,o.hasArrow=!1):l==="hasArrow"?(o.hasDash=!1,o.hasArrow=!0):(o.hasDash=!1,o.hasArrow=!1)};r();const a=this.disposeVar(d.createNextAnimateFrameEvent(e.strokeStyleChanged,e.strokedChanged));this.dispose(a.disposableOn(r))}{const r=()=>{if(e.filled)o.fillColor=e.fillColor;else{o.fillColor=[1,1,1,0];return}};r();const a=this.disposeVar(d.createNextAnimateFrameEvent(e.fillStyleChanged,e.filledChanged));this.dispose(a.disposableOn(r))}this.dispose(o.pickedEvent.disposableOn(r=>{(e.allowPicking??!1)&&e.pickedEvent.emit(r)}))}get olAreaMeasurement(){return this._olAreaMeasurement}};R(Jo,"type",Jo.register("ESOlViewer",d.ESAreaMeasurement.type,Jo));let Ol=Jo;const Qn=class Qn extends d.Destroyable{constructor(e,n){super();R(this,"_pickedEvent",this.disposeVar(new d.Event));R(this,"_flyToEvent",this.disposeVar(new d.Event));R(this,"_heading",this.disposeVar(d.react(0)));R(this,"_textFunc",this.disposeVar(d.react(void 0)));const s=this;{const a=()=>{if(this.positions&&this.positions.length>=2){let h=0;this.arcType===void 0||this.arcType==="GEODESIC"?h=d.geoHeading(this.positions[0],this.positions[1]):this.arcType==="RHUMB"?h=d.geoRhumbHeading(this.positions[0],this.positions[1]):this.arcType==="NONE"?h=d.geoHeading(this.positions[0],this.positions[1]):console.warn(`未知的arcType: ${this.arcType},导致距离无法计算!`),this._heading.value=this.angleMode==="-180~180"?d.clampN180_180(h):d.clamp0_360(h)}};a();const c=this.disposeVar(d.createNextAnimateFrameEvent(this.positionsChanged,this.arcTypeChanged,this.angleModeChanged));this.dispose(c.disposableOn(a))}const o=this.disposeVar(new Jt(e,n));o.loop=!1,this.dispose(d.track([o,"allowPicking"],[s,"allowPicking"])),this.dispose(d.bind([o,"arcType"],[s,"arcType"])),this.dispose(d.bind([o,"color"],[s,"color"])),this.dispose(d.bind([o,"dashLength"],[s,"dashLength"])),this.dispose(d.bind([o,"dashPattern"],[s,"dashPattern"])),this.dispose(d.bind([o,"gapColor"],[s,"gapColor"])),this.dispose(d.bind([o,"hasArrow"],[s,"hasArrow"])),this.dispose(d.bind([o,"hasDash"],[s,"hasDash"])),this.dispose(d.bind([o,"positions"],[s,"positions"])),this.dispose(d.bind([o,"show"],[s,"show"])),this.dispose(d.bind([o,"width"],[s,"width"])),this.dispose(d.bind([o,"depthTest"],[s,"depthTest"])),this.dispose(s.flyToEvent.disposableOn(a=>{e.actived&&o.flyTo(a)}));const r=this.disposeVar(new Qt(e,n));this.dispose(d.bind([r,"shadowDom"],[s,"shadowDom"])),this.dispose(d.bind([r,"cssAllInitial"],[s,"cssAllInitial"])),this.dispose(d.bind([r,"show"],[s,"show"]));{const a=()=>{s.positions&&s.positions.length>=2?r.position=s.positions[1]:r.position=void 0};a(),this.dispose(s.positionsChanged.disposableOn(a))}{const a=()=>{const{heading:h}=s,l=(s.textFunc??Qn.defaultTextFunc_度格式)(h);r.innerHTML=ja(`方向: ${l}`,24)};a();const c=this.disposeVar(d.createNextAnimateFrameEvent(s.headingChanged,s.textFuncChanged));this.dispose(c.disposableOn(a))}this.ad(r.pickedEvent.don(a=>{Vo(a)===0&&this.pickedEvent.emit(a)}))}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}get heading(){return this._heading.value}get headingChanged(){return this._heading.changed}get textFunc(){return this._textFunc.value}set textFunc(e){this._textFunc.value=e}get textFuncChanged(){return this._textFunc.changed}};R(Qn,"defaultTextFunc_度格式",e=>`${e.toFixed(5)}°`),R(Qn,"defaultTextFunc_度分格式",e=>`${ka(e,!0)}`),R(Qn,"defaultTextFunc_度分秒格式",e=>`${ka(e,!1)}`),R(Qn,"defaults",{positions:[]});let $n=Qn;(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:d.reactPositions(void 0),width:4,color:d.reactArray([1,1,1,1]),hasDash:!1,gapColor:d.reactArray([0,0,0,0]),dashLength:16,dashPattern:255,hasArrow:!0,arcType:"GEODESIC",depthTest:!1,shadowDom:!1,cssAllInitial:!1,angleMode:"-180~180",strokeGround:!1})})($n||($n={})),d.extendClassProps($n.prototype,$n.createDefaultProps);const tr=class tr extends Gs{constructor(e,n){super(e,n);R(this,"_olDirectionMeasurement");if(this._olDirectionMeasurement=this.disposeVar(new $n(n,e.id)),!n.viewer){console.warn("viewer is undefined!");return}const o=this._olDirectionMeasurement;o.angleMode="0~360",this.dispose(d.track([o,"show"],[e,"show"])),this.dispose(d.track([o,"allowPicking"],[e,"allowPicking"])),this.dispose(d.bind([o,"positions"],[e,"points"])),this.dispose(d.bind([o,"strokeGround"],[e,"strokeGround"]));{const r=()=>{if(e.stroked)o.width=e.strokeWidth;else{o.width=0;return}o.width=e.strokeWidth,o.color=e.strokeColor;const h=e.strokeMaterial??"normal";h==="hasDash"?(o.hasDash=!0,o.hasArrow=!1):h==="hasArrow"?(o.hasDash=!1,o.hasArrow=!0):h==="normal"?(o.hasDash=!1,o.hasArrow=!1):(o.hasDash=!1,o.hasArrow=!0);const l=e.strokeStyle;if(l.material==="hasDash"&&l.materialParams)try{const u=l.materialParams;Reflect.has(u,"gapColor")&&(o.gapColor=u.gapColor??[0,0,0,0]),Reflect.has(u,"dashLength")&&(o.dashLength=u.dashLength),Reflect.has(u,"dashPattern")&&(o.dashPattern=u.dashPattern)}catch(u){console.error(u)}else o.gapColor=[0,0,0,0],o.dashLength=0,o.dashPattern=0};r();const a=this.disposeVar(d.createNextAnimateFrameEvent(e.strokeStyleChanged,e.strokedChanged));this.dispose(a.disposableOn(r))}this.dispose(o.pickedEvent.disposableOn(r=>{Vo(r)===0&&(e.allowPicking??!1)&&e.pickedEvent.emit(r)}))}get olDirectionMeasurement(){return this._olDirectionMeasurement}};R(tr,"type",tr.register("ESOlViewer",d.ESDirectionMeasurement.type,tr));let Il=tr;function rp(i,t,e,n){const s=new Qt(e,n);return s.innerHTML=ja(i),s.position=t,s.show=!0,s}class Bs extends d.Destroyable{constructor(e,n){super();R(this,"_pickedEvent",this.disposeVar(new d.Event));R(this,"_flyToEvent",this.disposeVar(new d.Event));R(this,"_distances",this.disposeVar(d.reactArray([])));const s=async()=>{this._distances.value=d.getDistancesFromPositions(this.positions??[],this.arcType)};s();const o=this.disposeVar(d.createNextAnimateFrameEvent(this.positionsChanged,this.arcTypeChanged,this.strokeGroundChanged));this.dispose(o.disposableOn(s));const r=this.disposeVar(new Jt(e,n));r.loop=!1,this.dispose(d.track([r,"allowPicking"],[this,"allowPicking"])),this.dispose(d.bind([r,"arcType"],[this,"arcType"])),this.dispose(d.bind([r,"color"],[this,"color"])),this.dispose(d.bind([r,"dashLength"],[this,"dashLength"])),this.dispose(d.bind([r,"dashPattern"],[this,"dashPattern"])),this.dispose(d.bind([r,"gapColor"],[this,"gapColor"])),this.dispose(d.bind([r,"hasArrow"],[this,"hasArrow"])),this.dispose(d.bind([r,"hasDash"],[this,"hasDash"])),this.dispose(d.bind([r,"positions"],[this,"positions"])),this.dispose(d.bind([r,"show"],[this,"show"])),this.dispose(d.bind([r,"width"],[this,"width"])),this.dispose(d.bind([r,"depthTest"],[this,"depthTest"])),this.dispose(this.flyToEvent.disposableOn(a=>{e.actived&&r.flyTo(a)}));{const a=[],c=()=>{for(let l of a)l.destroy();a.length=0};this.dispose(c);const h=()=>{if(c(),!this.positions)return;if(this.positions.length>0&&this.distances.length>0){const u=rp("起点",this.positions[0],e,n);u.dispose(d.track([u,"show"],[this,"show"])),u.dispose(d.track([u,"shadowDom"],[this,"shadowDom"])),u.dispose(d.track([u,"cssAllInitial"],[this,"cssAllInitial"])),a.push(u)}const l=this.distances.length;for(let u=0;u<l;++u){const f=this.distances[u],g=this.positions[u+1],_=rp(`长度: ${Ag(f)}`,g,e,n);_.dispose(d.track([_,"show"],[this,"show"])),_.dispose(d.track([_,"shadowDom"],[this,"shadowDom"])),_.dispose(d.track([_,"cssAllInitial"],[this,"cssAllInitial"])),this.ad(_.pickedEvent.don(y=>{Vo(y)===0&&this.pickedEvent.emit(y)})),a.push(_)}};h(),this.dispose(this.distancesChanged.disposableOn(()=>d.inOrderRunning(h)))}}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}get distances(){return this._distances.value}get distancesChanged(){return this._distances.changed}}R(Bs,"defaults",{positions:[]}),(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:d.reactPositions(void 0),width:1,color:d.reactArray([1,1,1,1]),hasDash:!1,gapColor:d.reactArray([0,0,0,0]),dashLength:16,dashPattern:255,hasArrow:!1,arcType:"GEODESIC",depthTest:!1,shadowDom:!1,cssAllInitial:!1,strokeGround:!1})})(Bs||(Bs={})),d.extendClassProps(Bs.prototype,Bs.createDefaultProps);const er=class er extends Gs{constructor(e,n){super(e,n);R(this,"_geoPolyline");if(this._geoPolyline=this.disposeVar(new Jt(n,e.id)),!n.viewer){console.warn("viewer is undefined!");return}const o=this._geoPolyline;console.log(o.positions),console.log(e.points),this.dispose(d.track([o,"allowPicking"],[e,"allowPicking"])),this.dispose(d.bind([o,"positions"],[e,"points"])),this.dispose(d.track([o,"width"],[e,"strokeWidth"])),this.dispose(d.track([o,"color"],[e,"strokeColor"])),this.dispose(d.track([o,"show"],[e,"show"]));{const r=()=>{o.show=e.show&&e.stroked};r();const a=this.disposeVar(d.createNextAnimateFrameEvent(e.showChanged,e.strokedChanged));this.dispose(a.disposableOn(r))}}get geoPolyline(){return this._geoPolyline}};R(er,"type",er.register("ESOlViewer",d.ESGeoLineString.type,er));let Bo=er;const ir=class ir extends Bo{constructor(e,n){super(e,n);R(this,"_olDistanceMeasurement");if(console.log("OlESDistanceMeasurement constructor",n.viewer),this._olDistanceMeasurement=this.disposeVar(new Bs(n,e.id)),!n.viewer){console.warn("viewer is undefined!");return}const{olDistanceMeasurement:o}=this;this.dispose(d.track([o,"show"],[e,"show"])),this.dispose(d.track([o,"allowPicking"],[e,"allowPicking"])),this.dispose(d.bind([o,"positions"],[e,"points"])),this.dispose(d.bind([o,"strokeGround"],[e,"strokeGround"]));{const r=()=>{if(e.stroked)o.width=e.strokeWidth;else{o.width=0;return}o.width=e.strokeWidth,o.color=e.strokeColor;const h=e.strokeMaterial??"normal";h==="hasDash"?(o.hasDash=!0,o.hasArrow=!1):h==="hasArrow"?(o.hasDash=!1,o.hasArrow=!0):(o.hasDash=!1,o.hasArrow=!1);const l=e.strokeStyle;if(l.material==="hasDash"&&l.materialParams)try{const u=l.materialParams;Reflect.has(u,"gapColor")&&(o.gapColor=u.gapColor??[0,0,0,0]),Reflect.has(u,"dashLength")&&(o.dashLength=u.dashLength),Reflect.has(u,"dashPattern")&&(o.dashPattern=u.dashPattern)}catch(u){console.error(u)}else o.gapColor=[0,0,0,0],o.dashLength=0,o.dashPattern=0};r();const a=this.disposeVar(d.createNextAnimateFrameEvent(e.strokeStyleChanged,e.strokedChanged));this.dispose(a.disposableOn(r))}this.dispose(o.pickedEvent.disposableOn(r=>{Vo(r)===0&&(e.allowPicking??!1)&&e.pickedEvent.emit(r)}))}get olDistanceMeasurement(){return this._olDistanceMeasurement}};R(ir,"type",ir.register("ESOlViewer",d.ESDistanceMeasurement.type,ir));let Tl=ir;function ap(i){const t=d.min(d.objsIterator(i,["0"])),e=d.min(d.objsIterator(i,["1"])),n=d.max(d.objsIterator(i,["0"])),s=d.max(d.objsIterator(i,["1"]));return{minPos:[t,e],maxPos:[n,s]}}function Bv(i){const t=i.map(o=>_t(o)),{minPos:e,maxPos:n}=ap(t),s=[.5*(e[0]+n[0]),.5*(e[1]+n[1])];return Kt(s)}function Yv(i,t,e){const n=_t(e),s=_t(t),o=[s[0]-n[0],s[1]-n[1]];return i.map(c=>_t(c)).map(c=>[c[0]+o[0],c[1]+o[1]]).map(c=>Kt(c))}const cp=d.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/img/location.png"),Jn=class Jn extends d.ESObjectWithLocation{getESProperties(){const t={...super.getESProperties()};return{...t,basic:[...t.basic,new d.StringProperty([this,"url"],"URL",cp),new d.Number2Property([this,"size_m"],"大小(米)",[10,10]),new d.Number2Property([this,"minmaxScale"],"缩放范围",[0,2])]}}constructor(t){super(t)}};R(Jn,"createDefaultProps",()=>({...d.ESObjectWithLocation.createDefaultProps(),url:cp,size_m:[10,10],minmaxScale:[0,2]})),R(Jn,"type",Jn.register("ESGeoIcon",Jn,{chsName:"地理图标",tags:["ESObjects","_ES_Impl_Openlayers"],description:"地理图标"})),R(Jn,"supportEditingModes",[...d.ESObjectWithLocation.supportEditingModes]);let Za=Jn;class Yo extends gs{constructor(t,e,n){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(t[0]))this.setCoordinates(t,e);else if(e!==void 0&&n)this.setFlatCoordinates(e,t),this.ends_=n;else{let s=this.getLayout();const o=t,r=[],a=[];for(let c=0,h=o.length;c<h;++c){const l=o[c];c===0&&(s=l.getLayout()),In(r,l.getFlatCoordinates()),a.push(r.length)}this.setFlatCoordinates(s,r),this.ends_=a}}appendLineString(t){this.flatCoordinates?In(this.flatCoordinates,t.getFlatCoordinates().slice()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Yo(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,n,s){return s<no(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Iu(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Tu(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,t,e,n,s))}getCoordinateAtM(t,e,n){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(e=e!==void 0?e:!1,n=n!==void 0?n:!1,km(this.flatCoordinates,0,this.ends_,this.stride,t,e,n))}getCoordinates(){return ho(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new wi(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLineStrings(){const t=this.flatCoordinates,e=this.ends_,n=this.layout,s=[];let o=0;for(let r=0,a=e.length;r<a;++r){const c=e[r],h=new wi(t.slice(o,c),n);s.push(h),o=c}return s}getFlatMidpoints(){const t=[],e=this.flatCoordinates;let n=0;const s=this.ends_,o=this.stride;for(let r=0,a=s.length;r<a;++r){const c=s[r],h=ku(e,n,c,o,.5);In(t,h),n=c}return t}getSimplifiedGeometryInternal(t){const e=[],n=[];return e.length=Im(this.flatCoordinates,0,this.ends_,this.stride,t,e,0,n),new Yo(e,"XY",n)}getType(){return"MultiLineString"}intersectsExtent(t){return Lm(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const n=Au(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}}const nr=class nr extends Go{constructor(t,e){super(t,e);const n=e.viewer;if(!n)return;const s=new Si,o=new Rn.Feature({geometry:new Ge(_t([t.position[0]??0,t.position[1]??0]))});s.addFeature(o),o.setId(t.id),this.d(t.positionChanged.don(g=>{const _=_t([g[0],g[1]]),y=o.getGeometry();y==null||y.setCoordinates(_)}));const r=new oi({source:s});n.addLayer(r),this.d(()=>n.removeLayer(r));let a=64,c=64;{const g=new Image;g.onload=()=>{console.log("Image loaded",g.width),a=g.width,c=g.height},g.src=t.url,this.d(t.urlChanged.don(()=>{const _=d.ESSceneObject.context.getStrFromEnv(d.rpToap(t.url));g.src=_}))}function h(g,_,y){const w=d.ESSceneObject.context.getStrFromEnv(d.rpToap(g)),E=a*_[0],b=c*_[1],P=y*Math.PI/180;return new Xt({image:new vs({src:w,width:E,height:b,anchor:[.5,1],anchorXUnits:"fraction",anchorYUnits:"fraction",rotation:P})})}let l=h(t.url,[1,1],t.rotation[0]??0);const u=()=>{const g=n.getView().getResolution();if(!g)return;const{size_m:[_,y],minmaxScale:[w,E]}=t;let b=_/g/a,P=y/g/c;b=Math.max(w,Math.min(E,b)),P=Math.max(w,Math.min(E,P)),l=h(t.url,[b,P],t.rotation[0]??0),o.setStyle(l),o.changed()};this.d(d.createEventsCallFunc([t.size_mChanged,t.urlChanged,t.minmaxScaleChanged,t.rotationChanged],u)),u();const f=n.getView().on("change:resolution",()=>{u()});this.d(()=>gi(f))}};R(nr,"type",nr.register("ESOlViewer",Za.type,nr));let Al=nr;const ts=class ts extends d.ESObjectWithLocation{getESProperties(){const t={...super.getESProperties()};return{...t,coordinate:[...t.coordinate,new d.NumberProperty([this,"distance"],"长度",0,!1,!0)],style:[new d.DivideProperty("点样式"),new d.BooleanProperty([this,"pointed"],"开启",!1),new d.NumberProperty([this,"pointSize"],"点大小",1),new d.EnumProperty([this,"pointSizeType"],[["screen","screen"],["world","world"]],"点类型","screen"),new d.ColorProperty([this,"pointColor"],"点颜色",[1,1,1,1])],basic:[...t.basic,new d.EnumProperty([this,"mode"],[["柱状警告","cylinder"],["圆形警告","circle"]],"模式","cylinder"),new d.NumberProperty([this,"radius"],"半径",10)]}}constructor(t){super(t)}};R(ts,"createDefaultProps",()=>({...d.ESObjectWithLocation.createDefaultProps(),pointed:!0,pointStyle:d.reactJson({size:1,sizeType:"screen",color:[1,1,1,1],material:"",materialParams:{},outlineColor:[1,0,0,1],outlineWidth:2})})),R(ts,"type",ts.register("ESGeoPoint",ts,{chsName:"地理点",tags:["ESObjects","_ES_Impl_Openlayers"],description:"地理点"})),R(ts,"supportEditingModes",[...d.ESObjectWithLocation.supportEditingModes]);let Ka=ts;const $s=class $s extends d.ESVisualObject{getESProperties(){const t={...super.getESProperties()};return{...t,basic:[...t.basic,new d.NumberProperty([this,"zIndex"],"层级序号",0),new d.JsonProperty([this,"url"],"影像服务地址")]}}constructor(t){super(t)}};R($s,"createDefaultProps",()=>({...d.ESVisualObject.createDefaultProps(),attributions:d.reactArrayWithUndefined(void 0),attributionsCollapsible:void 0,cacheSize:void 0,crossOrigin:void 0,interpolate:void 0,projection:d.reactJsonWithUndefined(void 0),reprojectionErrorThreshold:void 0,maxZoom:void 0,minZoom:void 0,opaque:void 0,maxResolution:void 0,tileSize:void 0,gutter:void 0,tileUrlFunction:void 0,tileGrid:d.reactJsonWithUndefined(void 0),tileLoadFunction:void 0,tilePixelRatio:void 0,url:void 0,urls:d.reactArrayWithUndefined(void 0),wrapX:void 0,transition:void 0,zDirection:void 0,zIndex:void 0})),R($s,"type",$s.register("ESXYZLayer",$s,{chsName:"OL简单xyz图层",tags:[],description:"ESXYZLayer"}));let Qa=$s;const ce=Math.PI,hp=6378245,lp=.006693421622965943;function up(i,t){let e=Hv(i-105,t-35),n=Xv(i-105,t-35);const s=t/180*ce;let o=Math.sin(s);o=1-lp*o*o;const r=Math.sqrt(o);return e=e*180/(hp*(1-lp)/(o*r)*ce),n=n*180/(hp/r*Math.cos(s)*ce),[n,e]}function dp(i,t){return i<72.004||i>137.8347||t<.8293||t>55.8271}function Hv(i,t){let e=-100+2*i+3*t+.2*t*t+.1*i*t+.2*Math.sqrt(Math.abs(i));return e+=(20*Math.sin(6*i*ce)+20*Math.sin(2*i*ce))*2/3,e+=(20*Math.sin(t*ce)+40*Math.sin(t/3*ce))*2/3,e+=(160*Math.sin(t/12*ce)+320*Math.sin(t*ce/30))*2/3,e}function Xv(i,t){let e=300+i+2*t+.1*i*i+.1*i*t+.1*Math.sqrt(Math.abs(i));return e+=(20*Math.sin(6*i*ce)+20*Math.sin(2*i*ce))*2/3,e+=(20*Math.sin(i*ce)+40*Math.sin(i/3*ce))*2/3,e+=(150*Math.sin(i/12*ce)+300*Math.sin(i/30*ce))*2/3,e}const fp=function(i){return function(t,e,n){const s=t.length,o=n||2;let r;e?r=e:o!==2?r=t.slice():r=new Array(s);for(let a=0;a<s;a+=o)i(t,r,a);return r}},Ja={toWGS84:fp(function(i,t,e){let n=i[e],s=i[e+1];if(!dp(n,s)){const o=up(n,s);n=n-o[0],s=s-o[1]}t[e]=n,t[e+1]=s}),fromWGS84:fp(function(i,t,e){let n=i[e],s=i[e+1];if(!dp(n,s)){const o=up(n,s);n=n+o[0],s=s+o[1]}t[e]=n,t[e+1]=s})},_e={ll2smerc:Fn("EPSG:4326","EPSG:3857"),smerc2ll:Fn("EPSG:3857","EPSG:4326")};_e.ll2gmerc=function(i,t,e){const n=Ja.fromWGS84(i,t,e);return _e.ll2smerc(n,n,e)},_e.gmerc2ll=function(i,t,e){const n=_e.smerc2ll(i,i,e);return Ja.toWGS84(n,t,e)},_e.smerc2gmerc=function(i,t,e){let n=_e.smerc2ll(i,i,e);return n=Ja.fromWGS84(n,n,e),_e.ll2smerc(n,n,e)},_e.gmerc2smerc=function(i,t,e){let n=_e.smerc2ll(i,i,e);return n=Ja.toWGS84(n,n,e),_e.ll2smerc(n,n,e)};const Ml=new vc({code:"GCJ-02",extent:[-20037508342789244e-9,-20037508342789244e-9,20037508342789244e-9,20037508342789244e-9],units:"m"});yu(Ml),Cu("EPSG:4326",Ml,_e.ll2gmerc,_e.gmerc2ll),Cu("EPSG:3857",Ml,_e.smerc2gmerc,_e.gmerc2smerc);class $v extends d.Destroyable{constructor(t,e){super();const n=e.viewer;if(!n){console.warn("map is undefined!");return}const s=Mi(n);if(!s)return;const{imageriesManager:o}=s,r=Gt("EPSG:3857");if(!r)return;const a=r.getExtent(),c=yt(a)/256,h=new Array(19),l=new Array(19);for(let g=0;g<19;++g)h[g]=c/Math.pow(2,g),l[g]=g;const u=new Ha({tileGrid:new qs(t.tileGrid??{origin:Ae(a),resolutions:h,matrixIds:l}),url:t.url,urls:t.urls,attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin??"anonymous",interpolate:t.interpolate,projection:t.projection??r,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tilePixelRatio:t.tilePixelRatio,tileLoadFunction:t.tileLoadFunction&&Function('"use strict";return ('+t.tileLoadFunction+")")(),wrapX:t.wrapX,transition:t.transition,zDirection:t.zDirection,maxZoom:t.maxZoom,minZoom:t.minZoom,opaque:t.opaque,maxResolution:t.maxResolution,tileSize:t.tileSize,gutter:t.gutter,tileUrlFunction:t.tileUrlFunction&&Function('"use strict";return ('+t.tileUrlFunction+")")()});this.dispose(()=>u.dispose());const f=new Va({source:u});o.add(f),this.dispose(()=>o.delete(f)),f.setVisible(t.show??!0),this.dispose(()=>f.dispose()),this.dispose(t.showChanged.disposableOn(g=>{f.setVisible(g??!0)})),this.d(d.createEventsCallFunc(t.zIndexChanged,()=>{o.setZindex(f,t.zIndex??0)},{immediate:!0}));{const g=()=>{u.tileGrid=new qs(t.tileGrid??{origin:Ae(a),resolutions:h,matrixIds:l}),t.attributions&&u.setAttributions(t.attributions),t.tileLoadFunction&&u.setTileLoadFunction(Function('"use strict";return ('+t.tileLoadFunction+")")()),t.tileUrlFunction&&u.setTileUrlFunction(Function('"use strict";return ('+t.tileUrlFunction+")")())},_=this.disposeVar(d.createNextAnimateFrameEvent(t.attributionsChanged,t.tileGridChanged,t.tileLoadFunctionChanged,t.tileUrlFunctionChanged));this.dispose(_.disposableOn(g))}t.urlChanged.disposableOn(g=>{u.setUrl(g??"")}),t.urlsChanged.disposableOn(g=>{u.setUrls(g??[])})}}const sr=class sr extends Xa{constructor(t,e){super(t,e);let n;this.dispose(()=>n&&n.destroy());{const s=()=>{n&&n.destroy(),n=new $v(t,e)};s();const o=this.disposeVar(d.createNextAnimateFrameEvent(t.attributionsCollapsibleChanged,t.cacheSizeChanged,t.crossOriginChanged,t.interpolateChanged,t.projectionChanged,t.reprojectionErrorThresholdChanged,t.tilePixelRatioChanged,t.wrapXChanged,t.transitionChanged,t.zDirectionChanged,t.maxZoomChanged,t.minZoomChanged,t.opaqueChanged,t.maxResolutionChanged,t.tileSizeChanged,t.gutterChanged));this.dispose(o.disposableOn(s))}}};R(sr,"type",sr.register(ui.type,Qa.type,sr));let Dl=sr;const or=class or extends Go{constructor(e,n){super(e,n);R(this,"_geoPoint");if(this._geoPoint=this.disposeVar(new Xe(n,e.id)),!n.viewer){console.warn("viewer is undefined!");return}const o=this._geoPoint;this.d(d.track([o,"allowPicking"],[e,"allowPicking"])),this.d(d.bind([o,"position"],[e,"position"])),this.d(d.track([o,"show"],[e,"show"]));{const r=()=>{o.show=e.show&&e.pointed};r();const a=this.dv(d.createNextAnimateFrameEvent(e.showChanged,e.pointedChanged));this.d(a.don(r))}}get geoPoint(){return this._geoPoint}};R(or,"type",or.register("ESOlViewer",Ka.type,or));let Fl=or;const rr=class rr extends Gs{constructor(e,n){super(e,n);R(this,"_geoPoints");const s=this.dv(new _n(n,e.id));if(this._geoPoints=s,!n.viewer){console.warn("viewer is undefined!");return}this.d(d.track([s,"allowPicking"],[e,"allowPicking"])),this.d(d.bind([s,"points"],[e,"points"]));{const r=()=>{s.show=e.show&&e.pointed};this.d(d.createEventsCallFunc([e.showChanged,e.pointedChanged],r,{immediate:!0}))}}get geoPoints(){return this._geoPoints}};R(rr,"type",rr.register("ESOlViewer",d.ESGeoPoints.type,rr));let Ll=rr;class gp extends d.Destroyable{constructor(e,n){super();R(this,"_olGeoCanvasImagePoi");R(this,"flyTo",(e,n)=>{if(this.olGeoCanvasImagePoi.position){Ri(this.olViewer,this.olGeoCanvasImagePoi.position,1e3,Jd,e);return}this.olGeoCanvasImagePoi.flyTo(e&&e*1e3)});this.sceneObject=e,this.olViewer=n,this._olGeoCanvasImagePoi=this.dv(new li(n));const s=this._olGeoCanvasImagePoi;s.pickOnClick=!0,this.d(s.pickedEvent.don(o=>{(e.allowPicking??!1)&&e.pickedEvent.emit(o)}));{const o=l=>{let u=l;return l.includes("inner://")&&(u="${earthsdk3-assets-script-dir}/assets/img/points/"+l.split("inner://")[1]),d.ESSceneObject.context.getStrFromEnv(d.rpToap(u))},r=()=>{const l=o(typeof e.url=="string"?e.url:e.url.url);if(s.imageUri=l,e.sizeByContent){const f=new Image;f.src=l,f.onload=()=>{s.size=[f.width,f.height]}}else{const f=e.size;s.size=[...f]}},a=this.disposeVar(d.createNextAnimateFrameEvent(e.urlChanged,e.sizeByContentChanged,e.sizeChanged));this.d(a.don(()=>r())),r(),this.d(d.track([s,"zOrder"],[e,"zOrder"])),this.d(d.track([s,"show"],[e,"show"])),this.d(d.bind([s,"position"],[e,"position"])),this.ad(d.bind([s,"isHoverZoom"],[e,"isHoverZoom"]));{const l=()=>{s.scale=[e.scale[1],e.scale[2]]};l(),this.d(e.scaleChanged.don(l))}const c=()=>{const l=e.anchor,u=e.offset;l?s.originRatioAndOffset=[...l,-u[0],-u[1]]:s.originRatioAndOffset=[0,0,0,0]},h=this.ad(d.createNextAnimateFrameEvent(e.anchorChanged,e.offsetChanged));this.d(h.don(()=>c())),c(),this.d(s.clickEvent.don(l=>{const{offsetX:u,offsetY:f}=l,_={type:l.button===0?"leftClick":l.button===2?"rightClick":void 0,add:{mousePos:[u,f]}};e.widgetEvent.emit(_)})),this.d(s.hoveredChanged.don(l=>{if(l===void 0)return;const u={type:l?"mouseEnter":"mouseLeave"};e.widgetEvent.emit(u)}))}}get olGeoCanvasImagePoi(){return this._olGeoCanvasImagePoi}}const ar=class ar extends Pl{constructor(e,n){super(e,n);R(this,"_resetting");if(!n.viewer){console.warn("viewer is undefined!");return}const o=this.dv(d.createNextAnimateFrameEvent(this.sceneObject.urlChanged,this.sceneObject.screenRenderChanged,this.sceneObject.sizeByContentChanged,this.sceneObject.sizeChanged));this._resetting=this.dv(new d.ObjResettingWithEvent(o,()=>new gp(this.sceneObject,this.olViewer)))}get resetting(){return this._resetting}flyTo(e,n){const{sceneObject:s,olViewer:o,resetting:r}=this;return o.actived?s.flyToParam||s.flyInParam?super.flyTo(e,n):(r&&r.obj&&r.obj.flyTo(e,n),s.flyOverEvent.emit(n,"over",o),!0):!1}};R(ar,"type",ar.register("ESOlViewer",d.ESImageLabel.type,ar));let zl=ar;function pp(i){switch(i){case"wms":return"WebMapServiceImageryProvider";case"tms":return"TileMapServiceImageryProvider";case"wmts":return"WebMapTileServiceImageryProvider";case"xyz":return"UrlTemplateImageryProvider";case"ion":return"IonImageryProvider";case"auto":default:return"auto"}}const cr=class cr extends Xa{constructor(e,n){super(e,n);R(this,"_olImagery");if(!n.viewer){console.warn("viewer is undefined!");return}const o=this.dv(new np(n,e.id));this._olImagery=o;const r=this.ad(d.reactJson(""));{const l=()=>{if(typeof e.url=="string")r.value=d.ESSceneObject.context.getStrFromEnv(e.url);else{const u=e.url;u.url=d.ESSceneObject.context.getStrFromEnv(u.url),r.value=u}};l(),this.ad(e.urlChanged.don(l))}const a=()=>{var w,E;if(!r.value)return;const l=(((w=e.options)==null?void 0:w.type)??"auto").toLowerCase(),u=e.options??{};let f={type:"UrlTemplateImageryProvider",url:r.value,rectangle:e.rectangle,maximumLevel:e.maximumLevel,minimumLevel:e.minimumLevel,...u},g=r.value,_=typeof g=="string"?g:g.url;const y=_.toLowerCase();if(pp(l)==="auto")if(y.startsWith("ion://")){const P=+y.substring(6);f={...u,assetId:P,type:"IonImageryProvider"}}else if(y.includes("{x}")||y.includes("{y}")||y.includes("{z}"))f.type="UrlTemplateImageryProvider";else if(y.includes("wmts"))f.type="WebMapTileServiceImageryProvider";else if(y.includes("wms"))f.type="WebMapServiceImageryProvider";else{if(_.includes("/tilemapresource.xml")){const b=_.split("/tilemapresource.xml").join("");typeof g=="string"?g=b:g.url=b,f.url=g}f.type="TileMapServiceImageryProvider"}else{if(l==="tms"&&_.includes("/tilemapresource.xml")){const P=_.split("/tilemapresource.xml").join("");typeof g=="string"?g=P:g.url=P,f.url=g}else if(l==="ion"&&y.startsWith("ion://")){const I=+_.substring(6);f={...u,assetId:I,type:"IonImageryProvider"}}const b=pp(l);b!=="auto"&&(f.type=b)}if(f.type==="WebMapTileServiceImageryProvider"){let b=typeof g=="string"?g:g.url;const P=b.indexOf("?");if(P>=0){const z=new URLSearchParams(b.substring(P+1)),q=z.get("format")||z.get("Format")||f.format;f.format=q||"image/png",b=b.substring(0,P)}else f.format=f.format??"image/png";const I=(E=/\/wmts\/rest\/([^/]+)\//i.exec(b))==null?void 0:E[1];I?f.layer=f.layer??f.layers??I:f.layer=f.layer??f.layers??"";const M=f.tileMatrixSetID||f.TileMatrixSet||"EPSG:4326";let D=f.tileMatrixLabels||f.TileMatrixLabels;(!D||!Array.isArray(D)||D.length===0)&&(D=Array.from({length:22},(z,q)=>`${M}:${q}`)),f.tileMatrixSetID=M,f.tileMatrixLabels=D,f.style=f.style??"default";const L=b.toLowerCase().indexOf("/wmts/");if(L>=0){const z=b.substring(0,L);f.url=`${z}/wmts`;const q=typeof g=="string"?g:g.url,Y=/\/wmts\/rest\/([^/]+)\//i.exec(q);Y&&Y[1]&&(f.layer=Y[1]),f._rawUrl=q}else{f.url=b;const z=typeof g=="string"?g:g.url,q=/\/wmts\/rest\/([^/]+)\//i.exec(z);q&&q[1]&&(f.layer=q[1]),f._rawUrl=z}f.requestEncoding="KVP",f.requestencoding="KVP",f.params=void 0}else if(f.type==="WebMapServiceImageryProvider"){const b=f.layer??f.layers??"",P=f.style??"",I=f.format??"image/png";f.params={...f.params??{},LAYERS:b,STYLES:P,FORMAT:I,TILED:!0,TRANSPARENT:!0}}else f.type==="TileMapServiceImageryProvider"?f.yReverse=f.yReverse??!0:f.type==="IonImageryProvider"&&console.warn("[OlESImageryLayer] 在 OL 侧使用 ion:// 可能无效,请在外部将 ion 转换为可用的 xyz/wmts/wms/tms 源 URL。");o.imageryProvider=f};a();const c=[r.changed,e.maximumLevelChanged,e.minimumLevelChanged,e.optionsChanged,e.rectangleChanged],h=this.dv(d.createNextAnimateFrameEvent(...c));this.d(h.don(a)),this.d(d.track([o,"show"],[e,"show"])),this.d(d.track([o,"splitDirection"],[e,"splitDirection"])),this.d(d.track([o,"brightness"],[e,"czmBrightness"])),this.d(d.track([o,"contrast"],[e,"czmContrast"])),this.d(d.track([o,"hue"],[e,"czmHue"])),this.d(d.track([o,"saturation"],[e,"czmSaturation"])),this.d(d.track([o,"gamma"],[e,"czmGamma"])),this.d(d.track([o,"rectangle"],[e,"rectangle"])),this.d(d.track([o,"zIndex"],[e,"zIndex"])),this.d(d.bind([o,"alpha"],[e,"opacity"])),this.d(d.bind([o,"alpha"],[e,"czmAlpha"]))}get olImagery(){return this._olImagery}flyTo(e,n){const{sceneObject:s,olViewer:o,olImagery:r}=this;return o.actived?s.flyToParam||s.flyInParam?super.flyTo(e,n):(r.flyTo(e&&e),s.flyOverEvent.emit(n,"over",o),!0):!1}flyIn(e,n){const{sceneObject:s,olViewer:o,olImagery:r}=this;return o.actived?s.flyInParam?super.flyIn(e,n):(r.flyTo(e&&e),s.flyOverEvent.emit(n,"over",o),!0):!1}};R(cr,"type",cr.register("ESOlViewer",d.ESImageryLayer.type,cr));let Nl=cr;function mp(i,t=!1){const e=ka(i[0],t),n=ka(i[1],t),s=Ag(i[2]);return[e,n,s]}const ze=class ze extends Go{constructor(e,n){super(e,n);R(this,"_geoCustomDivPoi");R(this,"_textFunc",this.disposeVar(d.react(void 0)));if(!n.viewer){console.warn("viewer is undefined!");return}this._geoCustomDivPoi=this.disposeVar(new Qt(n,e.id));const o=this.geoCustomDivPoi;this.dispose(d.track([o,"show"],[e,"show"])),this.dispose(d.bind([o,"position"],[e,"position"])),this.dispose(d.track([o,"allowPicking"],[e,"allowPicking"]));{this.dispose(o.pickedEvent.disposableOn(r=>{(e.allowPicking??d.ESLocationMeasurement.defaults.allowPicking)&&e.pickedEvent.emit(r)})),this.dispose(o.innerHtmlMounted.disposableOn(r=>{const a=r.firstElementChild;a&&(a.style.pointerEvents="auto",a.style.cursor="default",a.onclick=c=>o.pickFromDiv(a,{type:"viewerPicking",pointerEvent:c}))}));{const r=()=>{if(!e.position)return;const c=(this.textFunc??ze.defaultTextFunc_度格式)(e.position);o.innerHTML=ja(c)};r();const a=this.disposeVar(d.createNextAnimateFrameEvent(e.positionChanged,this.textFuncChanged));this.dispose(a.disposableOn(r))}{const r=()=>{n.lonLatFormat??(n.lonLatFormat="DECIMAL_DEGREE"),this.textFunc=n.lonLatFormat=="DECIMAL_DEGREE"?ze.defaultTextFunc_度格式:n.lonLatFormat=="DEGREES_DECIMAL_MINUTES"?ze.defaultTextFunc_度分格式:ze.defaultTextFunc_度分秒格式};r(),this.d(n.lonLatFormatChanged.don(()=>{r()}))}}}get geoCustomDivPoi(){return this._geoCustomDivPoi}get textFunc(){return this._textFunc.value}set textFunc(e){this._textFunc.value=e}get textFuncChanged(){return this._textFunc.changed}flyTo(e,n){const{sceneObject:s,olViewer:o,geoCustomDivPoi:r}=this;return o.actived?s.flyToParam||s.flyInParam?super.flyTo(e,n):(r.flyTo(e),s.flyOverEvent.emit(n,"over",o),!0):!1}flyIn(e,n){const{sceneObject:s,olViewer:o,geoCustomDivPoi:r}=this;return o.actived?s.flyInParam?super.flyIn(e,n):(r.flyTo(e),s.flyOverEvent.emit(n,"over",o),!0):!1}};R(ze,"type",ze.register("ESOlViewer",d.ESLocationMeasurement.type,ze)),R(ze,"defaultTextFunc_度格式",e=>{if(!e)return"";const[n=0,s=0,o=0]=e;return`经度: ${n.toFixed(5)}°
163
- 纬度: ${s.toFixed(5)}°`}),R(ze,"defaultTextFunc_度分格式",e=>{if(!e)return"";const[n,s,o]=mp(e,!0);return`经度: ${n}
164
- 纬度: ${s}`}),R(ze,"defaultTextFunc_度分秒格式",e=>{if(!e)return"";const[n,s,o]=mp(e);return`经度: ${n}
165
- 纬度: ${s}`});let Ul=ze;function Ho(i,t){const[e,n]=i,[s,o]=t;return Math.sqrt(Math.pow(e-s,2)+Math.pow(n-o,2))}function Xo(i,t,e){const[n,s]=i,o=Math.cos(t*Math.PI/180)*e+n,r=Math.sin(t*Math.PI/180)*e+s;return[o,r]}const tc=(i,t=!1)=>{const[[e=0,n=0],[s=0,o=0]]=i;return t?Math.atan2(o-n,s-e)*180/Math.PI:Math.atan2(o-n,s-e)};function Zv(i,t,e){let n=1/0,s=0,o=0,r=0;for(let g=0;g<i.length-1;g++){const[_,y]=i[g],[w,E]=i[g+1],[b,P]=t,I=b-_,M=P-y,D=w-_,L=E-y,z=I*D+M*L,q=D*D+L*L;let Y=q!==0?z/q:-1,X,Q;Y<0?(X=_,Q=y,Y=0):Y>1?(X=w,Q=E,Y=1):(X=_+Y*D,Q=y+Y*L);const m=Math.sqrt((b-X)*(b-X)+(P-Q)*(P-Q));m<n&&(n=m,s=g,o=Y)}for(let g=0;g<s;g++)r+=Ho(i[g],i[g+1]);r+=o*Ho(i[s],i[s+1]);const a=r+e;let c=0;for(let g=0;g<i.length-1;g++)c+=Ho(i[g],i[g+1]);let h=0;if(a<=0){const g=tc([i[0],i[1]],!0);return{point:Xo(i[0],g+180,Math.abs(a)),angle:g,isValid:!1}}for(let g=0;g<i.length-1;g++){const _=Ho(i[g],i[g+1]);if(h+_>=a){const w=(a-h)/_,[E,b]=i[g],[P,I]=i[g+1],M=[E+w*(P-E),b+w*(I-b)],D=tc([i[g],i[g+1]],!0);return{point:M,angle:D,isValid:!0}}h+=_}const l=i.length-1,u=tc([i[l-1],i[l]],!0),f=a-h;return{point:Xo(i[l],u,f),angle:u,isValid:!1}}function _p(i,t,e,n,s){let o=Ho(i,t),r=tc([i,t],!0);const a=s-n;if(a>0&&o>a){const[c,h]=Xo(i,r,a);return e.push([c,h,r,!0]),_p([c,h],t,e,0,s)}else return o+n}function yp(i,t,e){const n=[];let s=0;s+=Math.max(0,t%e);for(let o=0,r=i.length-1;o<r;o++){const[a,c]=[i[o],i[o+1]];n.push([...a,0,!1]),s=_p(a,c,n,s,e),s=s%e,n.push([...c,0,!1])}return n}const hr=class hr extends Bo{constructor(e,n){super(e,n);R(this,"animationId",null);R(this,"options",{ARROWS_PER_GROUP:6,ARROW_LINE_COLOR:"white",SPEED_MULTIPLIER:.1,ARROW_LINE_WIDTH_RATIO:.2,ARROW_SPACING_RATIO:.4,ARROW_OFFSET_RATIO:5});R(this,"offset",this.sceneObject.strokeWidth*this.options.ARROW_OFFSET_RATIO*window.devicePixelRatio);R(this,"eventsKey",null);const s=n.viewer;if(!s)return;const o=this.geoPolyline._layer;this.d(()=>this.clear()),this.d(d.createEventsCallFunc([e.materialModeChanged,e.showChanged,e.speedChanged,e.strokedChanged,e.strokeWidthChanged],()=>{if(this.clear(),!(e.show&&e.stroked)||e.materialMode==="pureColor")return;const{SPEED_MULTIPLIER:r}=this.options;this.eventsKey=o.on("postrender",c=>{e.materialMode==="singleArrow"?this._rendererSingleArrows(c):this._rendererArrows(c)});const a=c=>{const h=(e.speed??1)*r,l=Math.max(.1,h);this.offset-=l,this.offset<=0&&(this.offset=this.sceneObject.strokeWidth*this.options.ARROW_OFFSET_RATIO*window.devicePixelRatio),s.render(),this.animationId=requestAnimationFrame(a)};this.animationId=requestAnimationFrame(a)},{immediate:!0}))}clear(){this.animationId&&cancelAnimationFrame(this.animationId),this.animationId=null,this.eventsKey&&gi(this.eventsKey),this.eventsKey=null,this.offset=this.sceneObject.strokeWidth*this.options.ARROW_OFFSET_RATIO*window.devicePixelRatio}_rendererSingleArrows(e){var f;const{ARROW_LINE_WIDTH_RATIO:n,ARROW_OFFSET_RATIO:s,ARROW_LINE_COLOR:o}=this.options,r=Ad(e),a=e.target,c=r.transform_,h=r.context_,l=a.getSource(),u=(f=e.frameState)==null?void 0:f.extent;e.frameState&&(e.frameState.animate=!0),!(!l||!u)&&l.forEachFeatureInExtent(u,g=>{const _=g.getGeometry();let y;_ instanceof Yo?y=_.getLineStrings():_ instanceof wi&&(y=[_]),y&&y.forEach(w=>{const E=w.getFlatCoordinates(),b=yi(E,0,E.length,2,c,[]);let P=[];for(let M=0;M<b.length;M+=2){const D=b[M],L=b[M+1];P.push([D,L])}const I=yp(P,this.offset,this.sceneObject.strokeWidth*s*window.devicePixelRatio);h.lineWidth=this.sceneObject.strokeWidth*n*window.devicePixelRatio,h.strokeStyle=o,I.filter(M=>M[3]).forEach(M=>{const[D,L,z]=M,q=Xo([D,L],z-180,5),Y=this.sceneObject.strokeWidth*.5*window.devicePixelRatio,X=Math.atan2(L-q[1],D-q[0]),Q=D-Y*Math.cos(X+45*Math.PI/180),m=L-Y*Math.sin(X+45*Math.PI/180),v=D-Y*Math.cos(X-45*Math.PI/180),S=L-Y*Math.sin(X-45*Math.PI/180);h.beginPath(),h.moveTo(Q,m),h.lineTo(D,L),h.lineTo(v,S),h.stroke()})})})}_rendererArrows(e){var _;const{ARROW_OFFSET_RATIO:n,ARROW_LINE_WIDTH_RATIO:s,ARROW_LINE_COLOR:o,ARROWS_PER_GROUP:r,ARROW_SPACING_RATIO:a}=this.options,c=Ad(e),h=e.target,l=c.transform_,u=c.context_,f=h.getSource(),g=(_=e.frameState)==null?void 0:_.extent;e.frameState&&(e.frameState.animate=!0),!(!f||!g)&&f.forEachFeatureInExtent(g,y=>{const w=y.getGeometry();let E;w instanceof Yo?E=w.getLineStrings():w instanceof wi&&(E=[w]),E&&E.forEach(b=>{const P=b.getFlatCoordinates(),I=yi(P,0,P.length,2,l,[]);let M=[];for(let L=0;L<I.length;L+=2){const z=I[L],q=I[L+1];M.push([z,q])}const D=yp(M,this.offset,this.sceneObject.strokeWidth*n*window.devicePixelRatio);u.lineWidth=this.sceneObject.strokeWidth*s*window.devicePixelRatio,u.strokeStyle=o,D.filter(L=>L[3]).forEach(L=>{const[z,q,Y]=L;for(let X=0;X<r;X++){const Q=(X-(r-1)/2)*this.sceneObject.strokeWidth*a*window.devicePixelRatio,m=Zv(M,[z,q],Q);if(!m.isValid)continue;const[v,S]=m.point,A=m.angle,F=Xo([v,S],A-180,5),N=this.sceneObject.strokeWidth*.5*window.devicePixelRatio,G=Math.atan2(S-F[1],v-F[0]),V=v-N*Math.cos(G+45*Math.PI/180),Z=S-N*Math.sin(G+45*Math.PI/180),B=v-N*Math.cos(G-45*Math.PI/180),at=S-N*Math.sin(G-45*Math.PI/180);u.beginPath(),u.moveTo(V,Z),u.lineTo(v,S),u.lineTo(B,at),u.stroke()}})})})}};R(hr,"type",hr.register(ui.type,d.ESPath.type,hr));let jl=hr;const lr=class lr extends Pl{constructor(e,n){super(e,n);R(this,"_olTextLabel");this._olTextLabel=this.disposeVar(new pn(n,e.id));const s=this._olTextLabel,o=()=>{const a=e.anchor,c=e.offset;a?s.originRatioAndOffset=[...a,-c[0],-c[1]]:s.originRatioAndOffset=[0,0,0,0]},r=this.ad(d.createNextAnimateFrameEvent(e.anchorChanged,e.offsetChanged));this.dispose(r.disposableOn(()=>o())),o(),this.dispose(d.track([s,"zOrder"],[e,"zOrder"])),this.dispose(d.track([s,"show"],[e,"show"])),this.dispose(d.bind([s,"text"],[e,"text"])),this.dispose(d.track([s,"color"],[e,"color"])),this.dispose(d.track([s,"backgroundColor"],[e,"backgroundColor"])),this.dispose(d.bind([s,"textEditingInteraction"],[e,"textEditingInteraction"])),this.dispose(d.bind([s,"textEditing"],[e,"textEditing"])),this.dispose(d.bind([s,"position"],[e,"position"])),this.dispose(d.track([s,"width"],[e,"width"])),this.dispose(d.track([s,"opacity"],[e,"opacity"])),this.dispose(d.track([s,"padding"],[e,"padding"])),this.dispose(d.track([s,"borderRadius"],[e,"borderRadius"])),this.dispose(d.track([s,"borderColor"],[e,"borderColor"])),this.dispose(d.track([s,"borderWidth"],[e,"borderWidth"])),this.dispose(d.track([s,"textAlign"],[e,"textAlign"])),this.dispose(d.track([s,"fontSize"],[e,"fontSize"])),this.dispose(d.track([s,"borderStyle"],[e,"borderStyle"])),this.dispose(d.track([s,"pickOnClick"],[e,"allowPicking"])),this.dispose(d.track([s,"rotate"],[e,"rotate"]));{const a=()=>{s.scale=[e.scale[1],e.scale[2]]};a(),this.dispose(e.scaleChanged.don(a))}{const a=()=>{e.sizeByContent?(s.width=void 0,s.height=void 0):(s.width=e.size[0],s.height=e.size[1])};a(),this.dispose(e.sizeByContentChanged.don(a)),this.dispose(e.sizeChanged.don(a))}this.d(s.pickedEvent.don(a=>{var l;const c=(l=ll(a,"pickResult"))==null?void 0:l.pointerEvent;if(!c)return;const h={type:c.buttons!=0&&c.button==0?"leftClick":c.button==2?"rightClick":void 0,add:{mousePos:[c.offsetX,c.offsetY]}};h.type==null&&(h.type=c.type),e.widgetEvent.emit(h)}));{let a;const c=h=>{h&&(a=h),a&&(a.style.pointerEvents=e.editing?"none":"all")};this.d(e.editingChanged.don(()=>c(void 0))),this.ad(this._olTextLabel.divCreatedEvent.don(h=>c(h)))}}get olTextLabel(){return this._olTextLabel}};R(lr,"type",lr.register(ui.type,d.ESTextLabel.type,lr));let kl=lr;const es=class es extends le{constructor(e){super();R(this,"_config",this.disposeVar(d.react(es.defaultConfig)));R(this,"_overEvent",this.disposeVar(new d.Event));R(this,"_pointerEventFilterFunc",this.disposeVar(d.react(es.defaultPointerEventFilterFunc)));if(!!e.viewer){{const n=()=>{const{config:s}=this;s.clickEnabled!==void 0&&(this.clickEnabled=s.clickEnabled),s.dblClickEnabled!==void 0&&(this.dblClickEnabled=s.dblClickEnabled)};n(),this.dispose(this.configChanged.disposableOn(n))}{const n=this.ad(new Xe(e));n.pixelSize=4,n.outlineColor=[0,0,.8,1],n.outlineWidth=2,n.allowPicking=!1;{const s=()=>{if(!this.position)return;const o=[...this.position];n.position=o,n.show=!!this.position};s(),this.dispose(this.positionChanged.disposableOn(s))}}this.ad(new d.ObjResettingWithEvent(this.enabledChanged,()=>this.enabled?new Kv(e,this):void 0))}}get config(){return this._config.value}set config(e){this._config.value=e}get configChanged(){return this._config.changed}get overEvent(){return this._overEvent}over(){this._overEvent.emit()}get pointerEventFilterFunc(){return this._pointerEventFilterFunc.value}set pointerEventFilterFunc(e){this._pointerEventFilterFunc.value=e}get pointerEventFilterFuncChanged(){return this._pointerEventFilterFunc.changed}};R(es,"defaultConfig",{clickEnabled:!0,dblClickEnabled:!0}),R(es,"defaultPointerEventFilterFunc",e=>e.button===0),R(es,"defaults",{...le.defaults,position:[116.39,39.9,0]});let Fi=es;(i=>{i.createDefaultProps=()=>({...le.createDefaultProps(),position:d.reactArrayWithUndefined(void 0),virtualHeight:void 0,clickEnabled:!0,dblClickEnabled:!1})})(Fi||(Fi={})),d.extendClassProps(Fi.prototype,Fi.createDefaultProps);class Kv extends d.Destroyable{constructor(e,n){super();R(this,"_doings",[]);R(this,"initDoings",this.ad(()=>{this._doings.forEach(e=>e.destroy()),this._doings.length=0}));this._olViewer=e,this._placeEditing=n;{const s=(o,r)=>{r=="click"&&(!n.clickEnabled||!n.pointerEventFilterFunc(o))||r=="dblclick"&&(!n.dblClickEnabled||!n.pointerEventFilterFunc(o))||(n.over(),n.enabled=!1)};this.ad(e.clickEvent.don(o=>{o.pointerEvent&&s(o.pointerEvent,"click")})),this.ad(e.dblclickEvent.don(o=>{o.pointerEvent&&s(o.pointerEvent,"dblclick")}))}this.ad(e.pointerMoveEvent.don(s=>{if(!s.pointerEvent)return;const o=new Qv(this,s.pointerEvent,r=>{const a=[...r];e.editingHeightOffset&&(a[2]+=e.editingHeightOffset),n.position=a,this._doings.splice(0,this._doings.indexOf(o)+1).forEach(h=>h.destroy())});this._doings.push(o)}))}get olViewer(){return this._olViewer.viewer}get placeEditing(){return this._placeEditing}}class Qv extends d.Destroyable{constructor(t,e,n){super(),this._owner=t;const{olViewer:s}=this._owner;if(!s)return;const o=nf(s,e,this._owner.placeEditing.virtualHeight),[r]=d.getEventFromPromise(o);this.dispose(r.disposableOn(n))}}class Pe extends le{constructor(){super()}}R(Pe,"defaults",{...le.defaults,position:[116.39,39.9,0]}),(i=>{i.createDefaultProps=()=>({...le.createDefaultProps(),position:d.reactArrayWithUndefined(void 0)})})(Pe||(Pe={})),d.extendClassProps(Pe.prototype,Pe.createDefaultProps);function wp(i,t){const e=new Jt(i);return e.hasArrow=!0,e.arcType="RHUMB",e.width=4,e.color=t,e}const Ui=class Ui extends d.Destroyable{constructor(t){if(super(),!t.viewer)return;const e=this.disposeVar(wp(t,Ui.defaults.xAxisColor)),n=this.disposeVar(wp(t,Ui.defaults.yAxisColor));{const s=()=>{e.show=this.xAxisShow&&this.show,n.show=this.yAxisShow&&this.show};s();const o=this.ad(d.createNextAnimateFrameEvent(this.showChanged,this.xAxisShowChanged,this.yAxisShowChanged));this.dispose(o.disposableOn(s))}{const s=()=>{var g;const{position:r=Ui.defaults.position,heading:a=Ui.defaults.heading}=this,l=((g=t.viewer)==null?void 0:g.getView().getResolution())*65,u=d.geoRhumbDestination(r,l,90+a),f=d.geoRhumbDestination(r,l,0+a);u&&(e.positions=[r,u]),f&&(n.positions=[r,f])};s();const o=this.disposeVar(d.createNextAnimateFrameEvent(this.positionChanged,this.dimensionsChanged,this.headingChanged));this.dispose(o.disposableOn(s))}{const s=()=>{e.color=this.xAxisColor??Ui.defaults.xAxisColor,n.color=this.yAxisColor??Ui.defaults.yAxisColor};s();const o=this.disposeVar(d.createNextAnimateFrameEvent(this.xAxisColorChanged,this.yAxisColorChanged));this.dispose(o.disposableOn(s))}}};R(Ui,"defaults",{position:[116.39,39.9,0],heading:0,dimensions:[1e3,1e3,1e3],xAxisColor:[1,0,0,1],yAxisColor:[0,1,0,1],zAxisColor:[0,0,1,1]});let yn=Ui;(i=>{i.createDefaultProps=()=>({show:!0,position:d.reactArrayWithUndefined(void 0),heading:0,dimensions:d.reactArray([1e3,1e3,1e3]),xAxisColor:d.reactArray([1,0,0,1]),yAxisColor:d.reactArray([0,1,0,1]),xAxisShow:!0,yAxisShow:!0})})(yn||(yn={})),d.extendClassProps(yn.prototype,yn.createDefaultProps);class di extends d.Destroyable{constructor(e,n){super();R(this,"_flyToEvent",this.disposeVar(new d.Event));R(this,"_layer");R(this,"_source");const s=e.viewer;if(!s)return;this._source=new Si,this._layer=new oi({source:this._source}),s.addLayer(this._layer),this.dispose(()=>s.removeLayer(this._layer)),this.dispose(()=>{var a;return(a=this._source)==null?void 0:a.clear(!0)}),this.dispose(()=>{var a;return(a=this._layer)==null?void 0:a.dispose()});const o=()=>{var a;if(this._source&&(this._source.clear(),!!this.positions)){for(const c of this.positions){if(!c||c.length<2)continue;const h=c.map(f=>_t([f[0],f[1]]));this.loop&&h.length>=3&&h.push(h[0]);const l=new wi(h),u=new Je({geometry:l});u.setId(d.createGuid()),u.setStyle(new Xt({stroke:new Se({color:`rgba(${this.color[0]*255}, ${this.color[1]*255}, ${this.color[2]*255}, ${this.color[3]})`,width:this.width??2,lineDash:this.hasDash?[this.dashLength??16,(this.dashLength??16)/2]:void 0})})),this._source.addFeature(u)}(a=this._layer)==null||a.setVisible(this.show??!0)}};o();const r=this.disposeVar(d.createNextAnimateFrameEvent(this.positionsChanged,this.showChanged,this.colorChanged,this.loopChanged,this.hasDashChanged,this.dashLengthChanged,this.widthChanged));this.dispose(r.disposableOn(o)),this.dispose(this.flyToEvent.disposableOn(a=>{if(!this.positions||this.positions.length===0)return;const c=this.positions.flat();if(c.length===0)return;const h=c[Math.floor(c.length/2)];Ri(e,h)}))}get typeName(){return"OlPolylines"}get defaultProps(){return di.createDefaultProps()}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}}(i=>{i.createDefaultProps=()=>({show:!0,positions:d.reactPositionsSet(void 0),width:2,color:d.reactArray([1,1,1,1]),loop:!1,hasDash:!1,dashLength:16,arcType:"GEODESIC",topOrBottom:"none"})})(di||(di={})),d.extendClassProps(di.prototype,di.createDefaultProps);const vn=class vn extends Pe{constructor(e){super();R(this,"_opInfo",{step:this.ad(d.react(!1)),moved:this.ad(d.react(!1)),constraintMode:this.ad(d.react("none")),originPosition:this.disposeVar(d.reactArray(Pe.defaults.position)),originHeading:this.disposeVar(d.react(0)),originDimensions:this.disposeVar(d.reactArray([1,1,1])),draggingStartPosition:this.disposeVar(d.reactArray([0,0,0])),movingPosition:this.disposeVar(d.reactArray([0,0,0])),targetPosition:this.disposeVar(d.reactArray([0,0,0])),targetHeading:this.disposeVar(d.react(0))});R(this,"_createCoordinates",e=>{const n=this.ad(new yn(e));this.dispose(this._opInfo.step.changed.disposableOn(()=>{vp(n,this._opInfo.constraintMode.value,this._opInfo.step.value)}));{const s=()=>{const r=[...this.position??vn.defaults.position];n.position=r};s(),this.dispose(this.positionChanged.disposableOn(s))}{const s=()=>{n.heading=this.heading??0};s(),this.dispose(this.headingChanged.disposableOn(s))}{const s=()=>{n.dimensions=this._opInfo.originDimensions.value};s(),this.dispose(this._opInfo.originDimensions.changed.disposableOn(s))}return n});R(this,"_createOriginCoordinates",e=>{const n=this.ad(new yn(e));n.xAxisColor=[1,0,0,.5],n.yAxisColor=[0,1,0,.5];const{originPosition:s,originHeading:o,originDimensions:r}=this._opInfo;{const a=()=>{n.position=s.value};a(),this.dispose(s.changed.disposableOn(a))}{const a=()=>{n.heading=o.value??0};a(),this.dispose(o.changed.disposableOn(a))}{const a=()=>{n.dimensions=r.value};a(),this.dispose(r.changed.disposableOn(a))}return n});R(this,"_createGrid",e=>{const n=this.ad(new di(e));{const s=()=>{var f;const r=this._opInfo.originPosition.value,a=this._opInfo.originHeading.value,h=((f=e.viewer)==null?void 0:f.getView().getResolution())*15,l=h*5,u=[];for(let g=-4;g<5;++g){const _=d.geoRhumbDestination(r,g*h,a+90);if(_){const y=d.geoRhumbDestination(_,l,a+180),w=d.geoRhumbDestination(_,l,a);y&&w&&u.push([y,_,w])}}for(let g=-4;g<5;++g){const _=d.geoRhumbDestination(r,g*h,a);if(_){const y=d.geoRhumbDestination(_,l,a-90),w=d.geoRhumbDestination(_,l,a+90);y&&w&&u.push([y,_,w])}}n.positions=u};s();const o=this.disposeVar(d.createNextAnimateFrameEvent(this._opInfo.originPosition.changed,this._opInfo.originHeading.changed,this._opInfo.originDimensions.changed));this.dispose(o.disposableOn(s))}return n});R(this,"_createHelpLine",e=>{const n=this.ad(new Jt(e));n.hasDash=!0,n.arcType="RHUMB",n.color=[1,1,0,.99];{const s=()=>{n.positions=[this._opInfo.originPosition.value,this._opInfo.targetPosition.value]},o=this.ad(d.createNextAnimateFrameEvent(this._opInfo.originPosition.changed,this._opInfo.targetPosition.changed));this.ad(o.don(s))}return n});R(this,"_createCircle",e=>{const n=this.ad(new di(e));n.arcType="RHUMB",n.width=2,n.hasDash=!0,n.loop=!1,n.color=[1,1,0,1],n.show=!0;const s=this.disposeVar(d.createNextAnimateFrameEvent(this._opInfo.originPosition.changed,this._opInfo.originDimensions.changed)),o=()=>{var u;const r=this._opInfo.originPosition.value,c=((u=e.viewer)==null?void 0:u.getView().getResolution())*70,h=[],l=32;for(let f=0;f<=l;++f){const g=f*360/l,_=d.geoRhumbDestination(r,c,g);_&&h.push(_)}h.length>0&&h.push(h[0]),n.positions=[h]};return o(),this.dispose(s.disposableOn(o)),n});R(this,"_pickingXYProcessing",e=>this.ad(new d.Processing((n,s,o)=>{const r=[0,0,0];return e.pointerMoveEvent.don(a=>{if(!a.pointerEvent||!e.viewer)return;const c=e.viewer.getEventPixel(a.pointerEvent);if(!c)return;const h=e.viewer.getCoordinateFromPixel(c);if(!h)return;const l=Kt(h);if(r[0]=l[0],r[1]=l[1],r[2]=this._opInfo.originPosition.value[2],this._opInfo.constraintMode.value==="x")an(this._opInfo.originPosition.value,this._opInfo.originHeading.value+90,r,r);else if(this._opInfo.constraintMode.value==="y")an(this._opInfo.originPosition.value,this._opInfo.originHeading.value,r,r);else if(this._opInfo.constraintMode.value!=="xy"){console.warn("should not be here!");return}this._opInfo.movingPosition.value=r;const u=[0,0,0];d.geoRhumbDestination(r,o,s,u),this._opInfo.targetPosition.value=u})})));if(!e.viewer)return;const n=this.ad(d.reactArray([1,1,1]));this.ad(e.dblclickEvent.don(()=>this.enabled=!1)),this.ad(new af(e.viewer,this.positionReact,n,this.axisPixelSize));{this.ad(this._opInfo.targetPosition.changed.don(o=>{if(this._opInfo.moved){const r=[...o];this.position=r}})),this.ad(this._opInfo.targetHeading.changed.don(o=>this._opInfo.moved&&(this.heading=o)));const s=()=>{if(this._opInfo.constraintMode.value==="none"){this._opInfo.moved.value=!1;return}if(this._opInfo.originHeading.value!==this._opInfo.targetHeading.value){this._opInfo.moved.value=!0;return}if(!this._opInfo.originPosition.value.every((o,r)=>o===this._opInfo.targetPosition.value[r])){this._opInfo.moved.value=!0;return}};s(),this.dispose(this._opInfo.originHeading.changed.disposableOn(s)),this.dispose(this._opInfo.originPosition.changed.disposableOn(s)),this.dispose(this._opInfo.targetHeading.changed.disposableOn(s)),this.dispose(this._opInfo.targetPosition.changed.disposableOn(s))}{const s=this._createCoordinates(e),o=this._createOriginCoordinates(e),r=this._createGrid(e),a=this._createHelpLine(e),c=this._createCircle(e);{const f=()=>{c.show=r.show=this.enabled&&this.showCircle,a.show=this.enabled&&this.showCircle&&this._opInfo.moved.value,s.show=this.enabled&&this.showCoordinates,o.show=this.enabled&&this.showCoordinates&&this._opInfo.moved.value};f();const g=this.ad(d.createNextAnimateFrameEvent(this.enabledChanged,this.showCircleChanged,this.showCoordinatesChanged,this._opInfo.moved.changed));this.ad(g.don(f))}{const f=()=>{s.xAxisShow=o.xAxisShow=this.xAxisShow,s.yAxisShow=o.yAxisShow=this.yAxisShow};f();const g=this.ad(d.createNextAnimateFrameEvent(this.xAxisShowChanged,this.yAxisShowChanged));this.ad(g.don(f))}{const f=()=>{r.color=this._opInfo.constraintMode.value!=="none"?[1,1,0,.6]:[1,1,0,.3],vp(s,this._opInfo.constraintMode.value,this._opInfo.step.value)};f(),this.dispose(this._opInfo.constraintMode.changed.disposableOn(f))}const h=this._pickingXYProcessing(e),l=this.ad(d.createProcessingFromAsyncFunc(async f=>{do this._opInfo.step.value=!0,this._opInfo.constraintMode.value="none",f.disposer.dispose(()=>{this._opInfo.constraintMode.value="none"}),await d.step(f,async g=>{const _=()=>{const P=[...this.position??vn.defaults.position];this._opInfo.targetPosition.value=this._opInfo.originPosition.value=P},y=()=>this._opInfo.targetHeading.value=this._opInfo.originHeading.value=this.heading,w=()=>this._opInfo.originDimensions.value=n.value;g.disposer.dispose((_(),this.positionChanged.don(_))),g.disposer.dispose((y(),this.headingChanged.don(y))),g.disposer.dispose((w(),n.changed.don(w)));const E={constraintMode:"none",startDragPos:[0,0,0]},b=P=>{const I={position:s.position??vn.defaults.position,heading:s.heading??vn.defaults.heading,dimensions:s.dimensions??vn.defaults.dimensions};e.viewer&&sf(P,e.viewer,I,this.axisSnapPixelSize,E,{x:this.disableX,y:this.disableY,xy:this.disableXY}),this._opInfo.constraintMode.value=E.constraintMode,this._opInfo.movingPosition.value=this._opInfo.draggingStartPosition.value=E.startDragPos};g.disposer.dispose(e.pointerMoveEvent.don(P=>{P.pointerEvent&&b(P.pointerEvent)})),await d.step(g,P=>new Promise((I,M)=>{P.disposer.dispose(M),P.disposer.dispose(e.pointerDownEvent.don(D=>{D.pointerEvent&&b(D.pointerEvent),D.pointerEvent&&D.pointerEvent.button===0&&E.constraintMode!=="none"&&I()}))}))}),this._opInfo.step.value=!1,await d.step(f,async g=>{if(e.incrementDisabledInputStack(),console.log("检查地图交互编辑模式",e.disabledInputStack),g.disposer.dispose(()=>{e.decrementDisabledInputStack()}),["xy","x","y"].includes(this._opInfo.constraintMode.value)){const _=d.geoRhumbHeading(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value),y=d.geoRhumbDistance(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value);h.restart(void 0,_,y),g.disposer.dispose(()=>h.cancel())}else console.warn(`pickingInfo.constraintMode error! ${this._opInfo.constraintMode.value}`);await d.step(g,_=>new Promise((y,w)=>{_.disposer.dispose(w),_.disposer.dispose(e.pointerUpEvent.don(()=>{y()})),_.disposer.dispose(e.pointerOutEvent.don(()=>y()))}))});while(!0)})),u=()=>{this.enabled?l.restart():l.isRunning&&l.cancel()};u(),this.ad(this.enabledChanged.don(u))}}};R(vn,"defaults",{...Pe.defaults,heading:0,dimensions:[200,200,200],xAxisColor:[1,0,0,1],yAxisColor:[0,1,0,1]});let Li=vn;(i=>{i.createDefaultProps=()=>({...Pe.createDefaultProps(),heading:0,axisPixelSize:100,axisSnapPixelSize:100,showCoordinates:!0,showCircle:!0,disableX:!1,disableY:!1,disableZ:!1,disableXY:!1,disableZAxis:!1,xAxisShow:!0,yAxisShow:!0})})(Li||(Li={})),d.extendClassProps(Li.prototype,Li.createDefaultProps);function vp(i,t,e){i.xAxisColor=[1,0,0,.99],i.yAxisColor=[0,1,0,.99],t==="x"?i.xAxisColor=e?[1,1,0,.8]:[1,1,0,.99]:t==="y"?i.yAxisColor=e?[1,1,0,.8]:[1,1,0,.99]:t==="xy"&&(i.xAxisColor=e?[1,1,0,.8]:[1,1,0,.99],i.yAxisColor=e?[1,1,0,.8]:[1,1,0,.99])}class Ys extends d.Destroyable{constructor(e){super();R(this,"_vectorLayer");R(this,"_feature");R(this,"_circleCanvas");R(this,"_debugFeature");e.viewer&&(this._createCircleCanvas(),this._createVectorLayer(e),this._createDebugFeature(e))}get vectorLayer(){return this._vectorLayer}get feature(){return this._feature}get circleCanvas(){return this._circleCanvas}get debugFeature(){return this._debugFeature}_createCircleCanvas(){this._circleCanvas=document.createElement("canvas"),this._circleCanvas.width=256,this._circleCanvas.height=256;const e=()=>{var l,u,f;const s=(l=this._circleCanvas)==null?void 0:l.getContext("2d");if(!s)return;const o=this.color,r=`rgba(${o[0]*255|0}, ${o[1]*255|0}, ${o[2]*255|0}, ${o[3]})`;s.clearRect(0,0,256,256),s.lineWidth=6,s.beginPath(),s.arc(128,128,64,0,Math.PI*2,!1),s.strokeStyle=`rgba(0,0,0,${o[3]})`,s.stroke(),s.lineWidth=4,s.beginPath(),s.arc(128,128,64,0,Math.PI*2,!1),s.strokeStyle=r,s.stroke();let a=this.circleRotation*Math.PI/180;a=Math.atan2(Math.sin(a),Math.cos(a));const c=a<0;s.lineWidth=3,s.beginPath(),s.moveTo(128,128),s.arc(128,128,64,0,a,c),s.lineTo(128,128),s.fillStyle=`rgba(${o[0]*255|0}, ${o[1]*255|0}, ${o[2]*255|0}, 0.5)`,s.fill(),s.save(),s.font="16px console",s.textBaseline="middle",s.textAlign="center";const h=`${this.circleRotation.toFixed(1)}°`;s.translate(128,128),s.rotate(Math.PI*.5),s.rotate(a*.5),s.translate(-128,-128),s.fillStyle="white",s.fillText(h,128,54),s.restore(),(f=(u=this._feature)==null?void 0:u.changed)==null||f.call(u)};e();const n=this.ad(d.createNextAnimateFrameEvent(this.colorChanged,this.circleRotationChanged,this.circleStartRotationChanged,this.circleEndRotationChanged));this.ad(n.don(e))}_createVectorLayer(e){var o;const n=new Si;this._feature=new Je({geometry:new Ge([0,0])});const s=()=>this._circleCanvas?new Xt({image:new vs({img:this._circleCanvas,imgSize:[256,256],anchor:[.5,.5],anchorXUnits:"fraction",anchorYUnits:"fraction",scale:(this.pixelSize??300)/256}),text:new _o({text:"",font:"0px console"})}):new Xt;this._feature.setStyle(s),n.addFeature(this._feature),this._vectorLayer=new oi({source:n,zIndex:1e3});{const r=()=>{if(!this.position||!this._feature)return;const a=_t([this.position[0],this.position[1]]),c=this._feature.getGeometry();c==null||c.setCoordinates(a)};r(),this.dispose(this.positionChanged.disposableOn(r))}{const r=()=>{this._vectorLayer&&this._vectorLayer.setVisible(this.show)};r(),this.dispose(this.showChanged.disposableOn(r))}{const r=()=>{this._feature&&this._feature.setStyle(s)};r(),this.dispose(this.colorChanged.disposableOn(r)),this.dispose(this.circleRotationChanged.disposableOn(r)),this.dispose(this.pixelSizeChanged.disposableOn(r))}(o=e.viewer)==null||o.addLayer(this._vectorLayer),this.d(()=>{var r;return(r=e.viewer)==null?void 0:r.removeLayer(this._vectorLayer)})}_createDebugFeature(e){var o;const n=new Si;this._debugFeature=new Je({geometry:new Ge([0,0])}),this._debugFeature.setStyle(new Xt({image:new ii({radius:5,fill:new de({color:"red"})})})),n.addFeature(this._debugFeature);const s=new oi({source:n,zIndex:1001});{const r=()=>{s.setVisible(this.debug)};r(),this.dispose(this.debugChanged.disposableOn(r))}{const r=()=>{if(!this.position||!this._debugFeature)return;const a=_t([this.position[0],this.position[1]]),c=this._debugFeature.getGeometry();c==null||c.setCoordinates(a)};r(),this.dispose(this.positionChanged.disposableOn(r))}(o=e.viewer)==null||o.addLayer(s),this.d(()=>{var r;return(r=e.viewer)==null?void 0:r.removeLayer(s)})}}R(Ys,"defaults",{position:[116.39,39.9,0]}),(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,editing:!1,position:d.reactArrayWithUndefined(void 0),rotation:d.reactArray([0,0,0]),selfRotation:d.reactArray([0,0,0]),pixelSize:300,color:d.reactArray([1,1,1,1]),circleRotation:0,circleStartRotation:0,circleEndRotation:0,debug:!1})})(Ys||(Ys={})),d.extendClassProps(Ys.prototype,Ys.createDefaultProps);function Ep(i,t){const n=i.getViewport().getBoundingClientRect();return[t.clientX-n.left,t.clientY-n.top]}class Jv extends d.HasOwner{constructor(t){super(t);const{olViewer:e}=this.owner;let n;this.dispose(()=>this.owner.hoveredPlaneType="none");const s=this._createRotatorMoveProcessing();this.dispose(e.pointerMoveEvent.disposableOn(o=>{const r=n=this._getStartInfo(o.pointerEvent);this.owner.hoveredPlaneType=(r==null?void 0:r.currentPlaneType)??"none"})),this.dispose(e.pointerDownEvent.disposableOn(o=>{n&&n.currentPlaneType!=="none"&&(s.restart(void 0,e,n),n=void 0)})),this.dispose(e.dblclickEvent.disposableOn(o=>{const r=this._getStartInfo(o.pointerEvent);r&&r.currentPlaneType!=="none"||(this.owner.enabled=!1)}))}_createRotatorMoveProcessing(){return this.ad(d.createProcessingFromAsyncFunc(async(t,e,n)=>{const s=this.owner.circle;e.incrementDisabledInputStack(),t.disposer.dispose(()=>e.decrementDisabledInputStack()),this.owner.movingPlaneType=n.currentPlaneType,t.disposer.dispose(()=>{this.owner.movingPlaneType="none"});const o=n.pointerId;t.disposer.dispose(e.pointerMoveEvent.don(c=>{if(!n||!c.pointerEvent)return;const h=e.viewer,l=[];h.getInteractions().forEach(P=>{var M,D,L;const I=(M=P==null?void 0:P.constructor)==null?void 0:M.name;(I==="DragPan"||I==="MouseWheelZoom"||I==="DoubleClickZoom"||I==="PinchZoom"||I==="DragRotate"||I==="PinchRotate")&&(l.push([P,((D=P.getActive)==null?void 0:D.call(P))??!0]),(L=P.setActive)==null||L.call(P,!1))}),t.disposer.dispose(()=>l.forEach(([P,I])=>{var M;return(M=P.setActive)==null?void 0:M.call(P,I)}));let u=n.startAngle,f=0;const g=c.pointerEvent,_=Ep(e.viewer,g);if(n.currentPlaneType==="none")return;const y=this._calculateAngle(_);if(y===null)return;let w=y-u;w>180&&(w-=360),w<-180&&(w+=360),f+=w,u=y;let E=n.startRotation+f;E>360&&(E=360),E<-360&&(E=-360),this.owner.previewRotation=E;const b=this.owner.circle;b.circleStartRotation=0,b.circleEndRotation=0})),t.disposer.dispose(()=>{s.circleStartRotation=0,s.circleEndRotation=0}),await d.step(t,c=>new Promise((h,l)=>{c.disposer.dispose(l),c.disposer.dispose(e.pointerUpEvent.don(u=>{u.pointerEvent.pointerId===o&&h()})),c.disposer.dispose(e.pointerOutEvent.don(u=>{u.pointerEvent.pointerId===o&&h()}))}));const[,r,a]=this.owner.selfRotation;this.owner.selfRotation=[this.owner.previewRotation,r,a]}))}_calculateAngle(t){const{olViewer:e}=this.owner,n=e.viewer;if(!n||!this.owner.position)return null;const s=_t([this.owner.position[0],this.owner.position[1]]),o=n.getPixelFromCoordinate(s);if(!o)return null;const r=t[0]-o[0],a=t[1]-o[1],c=Math.sqrt(r*r+a*a),h=this.owner.pixelSize/4;if(c<h*.8||c>h*1.2)return null;let l=Math.atan2(a,r);return l=(l*180/Math.PI+360)%360,l}_getStartInfo(t){const{olViewer:e}=this.owner;if(!this.owner.position)return;const n=Ep(this.owner.olViewer.viewer,t),s=t.pointerId,o=this._calculateAngle(n);return{currentPlaneType:o!==null?"heading":"none",startRotation:this.owner.selfRotation[0],startAngle:o||0,pointerId:s}}}class wn extends Pe{constructor(e){super();R(this,"_hoveredPlaneType",this.disposeVar(d.react("none")));R(this,"_movingPlaneType",this.disposeVar(d.react("none")));R(this,"_previewRotation",this.disposeVar(d.react(0)));R(this,"_circle");R(this,"_rotatorRunningResetting");this._olViewer=e;const n=this._olViewer;this._rotatorRunningResetting=this.disposeVar(new d.ObjResettingWithEvent(this.enabledChanged,()=>{if(this.enabled)return new Jv(this)})),this._circle=this._createRotatorCircle(n);const s=()=>{var o;this.previewRotation=((o=this.selfRotation)==null?void 0:o[0])??0};s(),this.dispose(this.selfRotationChanged.disposableOn(s)),this.dispose(this.enabledChanged.disposableOn(o=>{o&&s()}));{const o=()=>{this.circle.show=this.enabled};o(),this.dispose(this.enabledChanged.disposableOn(o))}}get hoveredPlaneType(){return this._hoveredPlaneType.value}set hoveredPlaneType(e){this._hoveredPlaneType.value=e}get hoveredPlaneTypeChanged(){return this._hoveredPlaneType.changed}get movingPlaneType(){return this._movingPlaneType.value}set movingPlaneType(e){this._movingPlaneType.value=e}get movingPlaneTypeChanged(){return this._movingPlaneType.changed}get previewRotation(){return this._previewRotation.value}set previewRotation(e){this._previewRotation.value=e}get previewRotationChanged(){return this._previewRotation.changed}get circle(){return this._circle}get olViewer(){return this._olViewer}get rotatorRunningResetting(){return this._rotatorRunningResetting}_createRotatorCircle(e){const n=this.ad(new Ys(e));this.dispose(d.track([n,"position"],[this,"position"])),this.dispose(d.track([n,"pixelSize"],[this,"pixelSize"])),this.dispose(d.track([n,"debug"],[this,"debug"]));{const s=()=>{n.circleRotation=this.previewRotation};s(),this.dispose(this.previewRotationChanged.disposableOn(s))}{const s=()=>{const o=this.movingPlaneType==="heading",r=this.hoveredPlaneType==="heading",c=[0,0,1,o||r?1:.8];n.color=c};s(),this.dispose(this.movingPlaneTypeChanged.disposableOn(s)),this.dispose(this.hoveredPlaneTypeChanged.disposableOn(s))}return n}}R(wn,"rotationNum",{heading:0}),R(wn,"rotationFuncs",{heading:([e,n,s])=>[0,n,s]}),(i=>{i.createDefaultProps=()=>({...Pe.createDefaultProps(),rotation:d.reactArray([0,0,0]),selfRotation:d.reactArray([0,0,0]),pixelSize:300,showHelper:!1,debug:!1})})(wn||(wn={})),d.extendClassProps(wn.prototype,wn.createDefaultProps);const is=class is extends d.Destroyable{get startPosition(){return this.positions&&this.positions[0]}set startPosition(t){this.positions=[t??is.defaults.positions[0],this.stopPosition??is.defaults.positions[1]]}get startPositionChanged(){return this.positionsChanged}get stopPosition(){return this.positions&&this.positions[1]}set stopPosition(t){this.positions=[this.startPosition??is.defaults.positions[0],t??is.defaults.positions[1]]}get stopPositionChanged(){return this.positionsChanged}constructor(t,e){if(super(),!t.viewer)return;const s=this.ad(new Jt(t,e));s.arcType="RHUMB";const o=this.ad(new Xe(t,e));this.ad(d.track([s,"allowPicking"],[this,"allowPicking"])),this.ad(d.track([o,"allowPicking"],[this,"allowPicking"]));{const r=()=>{s.show=o.show=this.show};r(),this.ad(this.showChanged.don(r))}{const r=()=>{s.width=this.width/2,o.pixelSize=this.width};r(),this.ad(this.widthChanged.don(r))}{const r=()=>{s.color=o.color=this.color};r(),this.ad(this.colorChanged.don(r))}{const r=()=>{s.positions=this.positions,o.position=this.stopPosition};r(),this.dispose(this.startPositionChanged.disposableOn(r)),this.dispose(this.stopPositionChanged.disposableOn(r))}}};R(is,"defaults",{positions:[[0,0,0],[0,0,1e6]]});let Zn=is;(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:d.reactPositions(i.defaults.positions),width:10,color:d.reactArray([1,0,0,1])})})(Zn||(Zn={})),d.extendClassProps(Zn.prototype,Zn.createDefaultProps);class zi extends Pe{constructor(e){super();R(this,"_lastPosition");R(this,"_opInfo",{step:this.ad(d.react(!1)),moved:this.ad(d.react(!1)),constraintMode:this.disposeVar(d.react("none")),originPosition:this.disposeVar(d.reactArray([0,0,0])),originHeading:this.disposeVar(d.react(0)),originDimensions:this.disposeVar(d.reactArray([1,1,1])),draggingStartPosition:this.disposeVar(d.reactArray([0,0,0])),movingPosition:this.disposeVar(d.reactArray([0,0,0])),targetPosition:this.disposeVar(d.reactArray([0,0,0])),targetHeading:this.disposeVar(d.react(0))});R(this,"_scaleAxis");R(this,"_pickingXYProcessing",e=>this.disposeVar(new d.Processing((n,s,o)=>{const r=[0,0,0];return e.pointerMoveEvent.disposableOn(a=>{if(!a.pointerEvent||!e.viewer)return;const c=e.viewer.getEventPixel(a.pointerEvent),h=e.viewer.getCoordinateFromPixel(c);if(!h)return;const[l,u]=Kt(h);r[0]=l,r[1]=u,r[2]=0,this._opInfo.constraintMode.value==="x"?an(this._opInfo.originPosition.value,this._opInfo.originHeading.value+90,r,r):this._opInfo.constraintMode.value==="y"?an(this._opInfo.originPosition.value,this._opInfo.originHeading.value,r,r):this._opInfo.constraintMode.value==="xy"||console.warn("should not be here!"),this._opInfo.movingPosition.value=r,this._lastPosition||(this._lastPosition=[...this._opInfo.draggingStartPosition.value]);const f=[0,0,0];if(d.geoRhumbDestination(r,o,s,f),this._opInfo.targetPosition.value=f,!this._axisPixelInfo)return;const g=this._axisPixelInfo,_=e.viewer.getEventPixel(a.pointerEvent),y=g.len*g.len,w=((_[0]-g.a[0])*g.v[0]+(_[1]-g.a[1])*g.v[1])/y,E=Math.max(-2,Math.min(2,w)),b=E===0?0:E>0?1:-1;let P=0;b===0?P=0:b===g.sideStart||g.sideStart===0?P=Math.max(0,Math.abs(E)-Math.abs(g.tStart)):P=Math.abs(E);const I=(E>=0?1:-1)*P,M=this.scaleSensitivity??.6,D=Math.max(.1,1+M*I),[L,z,q]=g.baseScale;let Y=L,X=z;g.mode==="y"?Y=Math.max(.01,L*D):g.mode==="x"&&(X=Math.max(.01,z*D)),this.scale=[Y,X,q??0]})})));R(this,"_axisPixelInfo");console.log("here ScaleEditing constructor",e.viewer);const n=e.viewer;if(n){this.ad(new Og(e,this.positionReact,this._opInfo.originDimensions,this.axisPixelSize)),this.ad(e.dblclickEvent.don(()=>{this.enabled=!1})),this._scaleAxis={yAxis:this._createScaleAxis(e,"yAxis"),xAxis:this._createScaleAxis(e,"xAxis")};{const s=()=>{if(!this._scaleAxis)return;const{yAxis:o,xAxis:r}=this._scaleAxis,a=this._opInfo.constraintMode.value,c=this._opInfo.step.value;o.color=[0,1,0,.99],r.color=[1,0,0,.99],a==="x"?r.color=c?[1,1,0,.8]:[1,1,0,.99]:a==="y"&&(o.color=c?[1,1,0,.8]:[1,1,0,.99])};s(),this.dispose(this._opInfo.constraintMode.changed.disposableOn(s)),this.dispose(this._opInfo.step.changed.disposableOn(s))}{const s=()=>{if(!this._scaleAxis)return;const{position:r=zi.defaults.position}=this;console.log("ScaleEditing.defaults.position",r);const{yAxis:a,xAxis:c}=this._scaleAxis;c.startPosition=a.startPosition=r;const h=d.geoRhumbDestination(r,this._opInfo.originDimensions.value[0],90);h&&(c.stopPosition=h);const l=d.geoRhumbDestination(r,this._opInfo.originDimensions.value[1],0);l&&(a.stopPosition=l)};s();const o=this.ad(d.createNextAnimateFrameEvent(this.positionChanged,this._opInfo.originDimensions.changed));this.ad(o.don(s))}{const s=()=>{if(this._opInfo.constraintMode.value==="none"){this._opInfo.moved.value=!1;return}if(this._opInfo.originHeading.value!==this._opInfo.targetHeading.value){this._opInfo.moved.value=!0;return}if(!this._opInfo.originPosition.value.every((o,r)=>o===this._opInfo.targetPosition.value[r])){this._opInfo.moved.value=!0;return}};s(),this.dispose(this._opInfo.originHeading.changed.disposableOn(s)),this.dispose(this._opInfo.originPosition.changed.disposableOn(s)),this.dispose(this._opInfo.targetHeading.changed.disposableOn(s)),this.dispose(this._opInfo.targetPosition.changed.disposableOn(s))}{const s=this._pickingXYProcessing(e),o=()=>{const l=[...this.position??zi.defaults.position];e.editingHeightOffset&&(l[2]-=e.editingHeightOffset),this._opInfo.targetPosition.value=this._opInfo.originPosition.value=l},r={constraintMode:"none",startDragPos:[0,0,0]},a=l=>{if(!this.position||!this._scaleAxis)return;const u={position:this.position,dimensions:this._opInfo.originDimensions.value,heading:this._opInfo.originHeading.value||0};rf(n,l,u,this.axisSnapPixelSize,r);const f=n.getView().getProjection(),g=n.getEventPixel(l),_=q=>n.getPixelFromCoordinate(_t([q[0],q[1]],f)),{xAxis:y,yAxis:w}=this._scaleAxis,E=_(y.startPosition),b=_(y.stopPosition),P=_(w.startPosition),I=_(w.stopPosition),M=Cp(g,E,b),D=Cp(g,P,I),L=this.axisSnapPixelSize??10;let z="none";if((M.dist<=L||D.dist<=L)&&(z=M.dist<=D.dist?"x":"y"),this._opInfo.constraintMode.value=z,r.constraintMode=z,z==="x"||z==="y"){const q=n.getCoordinateFromPixel(g);if(q){const[Y,X]=Kt(q),Q=[Y,X,this._opInfo.originPosition.value[2]??0];z==="x"?an(this._opInfo.originPosition.value,this._opInfo.originHeading.value+90,Q,Q):an(this._opInfo.originPosition.value,this._opInfo.originHeading.value,Q,Q),r.startDragPos=Q,this._opInfo.movingPosition.value=this._opInfo.draggingStartPosition.value=Q}}else r.startDragPos=[0,0,0],this._opInfo.movingPosition.value=this._opInfo.draggingStartPosition.value=[0,0,0]},c=this.disposeVar(d.createProcessingFromAsyncFunc(async l=>{this._opInfo.step.value=!0,this._opInfo.constraintMode.value="none",l.disposer.dispose(()=>{this._opInfo.constraintMode.value="none"}),await d.step(l,async u=>{u.disposer.dispose((o(),this.positionChanged.disposableOn(o))),u.disposer.dispose(e.pointerMoveEvent.disposableOn(f=>{f.pointerEvent&&a(f.pointerEvent)})),await d.step(u,f=>new Promise((g,_)=>{f.disposer.dispose(_),f.disposer.dispose(e.pointerDownEvent.don(y=>{if(y.pointerEvent&&a(y.pointerEvent),y.pointerEvent&&y.pointerEvent.button===0&&this._opInfo.constraintMode.value!=="none"){{const w=r.constraintMode==="x"?"x":"y",{xAxis:E,yAxis:b}=this._scaleAxis,P=w==="x"?E:b,I=n.getView().getProjection(),M=v=>n.getPixelFromCoordinate(_t([v[0],v[1]],I)),D=M(P.startPosition),L=M(P.stopPosition),z=[L[0]-D[0],L[1]-D[1]],q=Math.hypot(z[0],z[1])||1,Y=n.getEventPixel(y.pointerEvent),X=((Y[0]-D[0])*z[0]+(Y[1]-D[1])*z[1])/(q*q),Q=Math.max(-1,Math.min(1,X)),m=Q===0?0:Q>0?1:-1;this._axisPixelInfo={a:D,v:z,len:q,tStart:Q,sideStart:m,mode:w,baseScale:[this.scale[0]??1,this.scale[1]??1,this.scale[2]??0]}}g()}}))}))}),this._opInfo.step.value=!1,await d.step(l,async u=>{if(e.incrementDisabledInputStack(),u.disposer.dispose(()=>e.decrementDisabledInputStack()),this.dispose(this.enabledChanged.disposableOn(f=>{if(!f&&e.disabledInputStack>0)for(;e.disabledInputStack>0;)e.decrementDisabledInputStack()})),["x","y"].includes(this._opInfo.constraintMode.value)){const f=d.geoRhumbHeading(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value),g=d.geoRhumbDistance(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value);s.restart(void 0,f,g),u.disposer.dispose(()=>s.cancel())}await d.step(u,f=>new Promise((g,_)=>{f.disposer.dispose(_),f.disposer.dispose(e.pointerUpEvent.don(()=>{g()})),f.disposer.dispose(e.pointerOutEvent.don(()=>{g()}))})),this._lastPosition=void 0,this._axisPixelInfo=void 0}),c.restart()})),h=()=>{this.enabled?c.restart():c.isRunning&&c.cancel()};h(),this.dispose(this.enabledChanged.disposableOn(h))}}}get scaleAxis(){return this._scaleAxis}_createScaleAxis(e,n){const s=this.ad(new Zn(e));return s.width=10,this.ad(d.track([s,"show"],[this,"enabled"])),s}}(i=>{i.createDefaultProps=()=>({...Pe.createDefaultProps(),scale:d.reactArray([1,1,0]),axisPixelSize:100,axisSnapPixelSize:10,scaleSensitivity:.8})})(zi||(zi={})),d.extendClassProps(zi.prototype,zi.createDefaultProps);function Cp(i,t,e){const n=e[0]-t[0],s=e[1]-t[1],o=i[0]-t[0],r=i[1]-t[1],a=n*o+s*r,c=n*n+s*s;let h=c>0?Math.max(0,Math.min(1,a/c)):0;const l=t[0]+h*n,u=t[1]+h*s,f=i[0]-l,g=i[1]-u;return{dist:Math.hypot(f,g),t:h}}const ji=class ji extends le{constructor(e){super();R(this,"_editingPoints",this.disposeVar(new d.ObservableArray));R(this,"_cancelEvent",this.disposeVar(new d.Event));R(this,"_currentProcess");R(this,"_menuPoiEnabled",this.disposeVar(d.react(!1)));R(this,"_status",this.disposeVar(d.react("None")));R(this,"_positionsChanged",this.ad(new d.Event));R(this,"_cursorInfo");this._olViewer=e,console.log("imgaeUrl:",ji.baseImageUrl+"point-green.png"),this.enabled=!1,this.createPolyline(e),this._createCursorInfo(e),this.dispose(()=>this.resetPositions()),this.dispose(()=>this.editingPoints.length=0),this.dispose(this.editingPoints.changedEvent.disposableOn(()=>this.positionsChanged.emit())),this.dispose(this.editingPoints.toChangeEvent.disposableOn(n=>{for(let{start:s,deleteCount:o,items:r}of n){for(const a of r)a.menuPoi.enabled=this.menuPoiEnabled??!1;for(let a=s;a<s+o;++a)this.editingPoints.get(a).destroy()}})),this.dispose(this.menuPoiEnabledChanged.disposableOn(()=>{for(let n of this.editingPoints)n.menuPoi.enabled=this.menuPoiEnabled??!1})),this.dispose(e.dblclickEvent.don(n=>{this.ad(d.nextAnimateFrame(()=>{var s;((s=n.pointerEvent)==null?void 0:s.button)===0&&this.enabled&&this.currentProcess&&this.currentProcess.cancel()}))})),this.dispose(this.enabledChanged.disposableOn(n=>{this._currentProcess&&(n?this._currentProcess.restart():this._currentProcess.isRunning&&this._currentProcess.cancel())}));{const n=()=>{this.polylineShow=this.olViewer.editingLineShow};n(),this.ad(this.olViewer.editingLineShowChanged.don(n))}}get editingPoints(){return this._editingPoints}get cancelEvent(){return this._cancelEvent}cancel(){this._cancelEvent.emit()}get currentProcess(){return this._currentProcess}set currentProcess(e){this._currentProcess=e}get menuPoiEnabled(){return this._menuPoiEnabled.value}set menuPoiEnabled(e){this._menuPoiEnabled.value=e}get menuPoiEnabledChanged(){return this._menuPoiEnabled.changed}get status(){return this._status.value}get statusChanged(){return this._status.changed}set status(e){this._status.value=e}getPositions(){const e=[];for(let n of this._editingPoints)n.position&&e.push([...n.position]);return e}resetPositions(e){if(this.enabled??ji.defaults.enabled)return console.warn("MultiPointsEditing.resetPositions error: this.enabled === true"),!1;const n=e||[];return!(n.length===this.editingPoints.length&&n.every((s,o)=>s.every((r,a)=>{const c=this.editingPoints.get(o);return c.position&&c.position[a]===r})))}forceResetPositions(e){(this.enabled??ji.defaults.enabled)&&(this.enabled=!1),this.resetPositions(e)}get positions(){return this.getPositions()}set positions(e){this.resetPositions(e)}get positionsChanged(){return this._positionsChanged}get olViewer(){return this._olViewer}get cursorInfo(){return this._cursorInfo}createPolyline(e){const n=this.ad(new Jt(e));this.ad(d.track([n,"color"],[this,"polylineColor"])),this.ad(d.track([n,"width"],[this,"polylineWidth"])),this.ad(d.track([n,"show"],[this,"polylineShow"])),this.ad(d.track([n,"arcType"],[this,"polylineArcType"])),this.ad(d.track([n,"loop"],[this,"loop"]));{const s=()=>{const o=[];for(const r of this.getPositions())r[2]-=e.editingHeightOffset??0,o.push(r);n.positions=o};s(),this.ad(this.positionsChanged.don(s))}}_createCursorInfo(e){const n=this._cursorInfo=this.ad(new d.CursorInfo(e.container,d.CursorFloatDiv));this.dispose(this.statusChanged.disposableOn(()=>{const s=this.status;if(n){if(!this.hideCursorInfo){n.show=!1;return}s==="Adding"?(n.text="右键/BackSpace键:删除上一个控制点;Esc键或左键双击:退出添加状态,进入修改状态",n.show=!0):s==="Modifying"||s==="Modifying_Point"?(n.text="Esc键或左键双击:退出编辑状态",n.show=!0):s==="None"&&(n.text="",n.show=!1)}}))}};R(ji,"baseImageUrl",d.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/img/")),R(ji,"defaults",{...le.defaults,debug:!1,polylineShow:!1,polylineWidth:1,polylineColor:[1,1,1,1],polylineArcType:"GEODESIC",maxPointsNum:Number.MAX_SAFE_INTEGER,loop:!1,firstControlPointImageUrl:ji.baseImageUrl+"point-green.png",otherControlPointImageUrl:ji.baseImageUrl+"point-yellow.png"});let Le=ji;(i=>{i.createDefaultProps=()=>({...le.createDefaultProps(),loop:!1,debug:!1,polylineShow:!0,polylineWidth:1,polylineColor:d.reactArray([1,1,1,1]),polylineArcType:"GEODESIC",maxPointsNum:Number.MAX_SAFE_INTEGER,firstControlPointImageUrl:i.baseImageUrl+"point-green.png",otherControlPointImageUrl:i.baseImageUrl+"point-yellow.png",hideCursorInfo:!1,middlePointShow:!0})})(Le||(Le={})),d.extendClassProps(Le.prototype,Le.createDefaultProps);let tE=0;class Wl extends d.Destroyable{constructor(e,n){super();R(this,"_position",this.disposeVar(d.reactArrayWithUndefined(void 0)));R(this,"_id",tE++);R(this,"_menuPoi");n&&(this.position=n),e.debug&&console.log(`PolylinePositionEditor creating! ${this.id}`),this.dispose(()=>{e.debug&&console.log(`PolylinePositionEditor destroying! ${this.id}`)});const s=this._menuPoi=this.ad(new js(e.olViewer));s.enabled=!1,this.ad(d.track([s,"show"],[e,"enabled"]));{const o=()=>{if(this.position===void 0){s.position=void 0;return}const r=[...this.position];r[2]=0,s.position=r,e.positionsChanged.emit()};o(),this.d(this.positionChanged.don(o))}{const o=()=>{const r=e.editingPoints.indexOf(this)+1;r!==0&&(s.title=`控制点${r}`,r===1?s.imageUri=e.firstControlPointImageUrl??Le.defaults.firstControlPointImageUrl:s.imageUri=e.otherControlPointImageUrl??Le.defaults.otherControlPointImageUrl)};o(),this.dispose(e.editingPoints.changedEvent.disposableOn(o))}}get position(){return this._position.value}set position(e){this._position.value=e}get positionChanged(){return this._position.changed}get id(){return this._id}get menuPoi(){return this._menuPoi}}class ql extends Wl{constructor(t,e){super(t,e)}}class jt extends Le{constructor(e){super(e);R(this,"_deletePreviousPointWhileAddingEvent",this.disposeVar(new d.Event));R(this,"placeEditing");if(!e.viewer)return;const n=this.placeEditing=this.ad(new Fi(e));n.enabled=!1,this.currentProcess=this.disposeVar(d.createProcessingFromAsyncFunc(async s=>{s.disposer.dispose(()=>{(this.debug??jt.defaults.debug)&&console.log("---editing canceled~~~"),this.status="None",this.enabled=!1}),(this.debug??jt.defaults.debug)&&console.log("直接进入Adding状态"),this.status="Adding",await s.promise(d.step(s,async o=>{const r=o.disposer,a=r.ad(this._addingEditingProcessing());r.dispose(()=>"adding canceled!"),r.dispose(this.cancelEvent.disposableOn(()=>a.cancel())),await o.promise(new Promise(c=>{r.dispose(a.completeEvent.disposableOnce(c))}))}))})),this.dispose(e.clickEvent.don(s=>{var o;((o=s.pointerEvent)==null?void 0:o.button)===2&&this.deletePreviousPointWhileAdding()}))}deletePreviousPointWhileAdding(){this._deletePreviousPointWhileAddingEvent.emit()}resetPositions(e){if(!super.resetPositions(e))return!0;const n=e?e.map(s=>new ql(this,s)):[];return this.editingPoints.splice(0,this.editingPoints.length,...n),!0}_addingEditingProcessing(){const e=()=>{if(this.maxPointsNum!==void 0)return this.editingPoints.length>=this.maxPointsNum&&(this.debug??jt.defaults.debug)&&console.log("impl.positionEditors.length >= impl.maxPointsNum"),this.editingPoints.length>=this.maxPointsNum},n=d.createProcessingFromAsyncFunc(async s=>{let o=this.editingPoints.length;this.menuPoiEnabled=!1;do if(!await s.promise(d.step(s,async a=>{let c;!e()&&(c=a.disposer.disposeVar(new bp(this,o)));const l=a.disposer.disposeVar(new Sp(this,o));return a.disposer.dispose(this._deletePreviousPointWhileAddingEvent.disposableOn(()=>l.do())),await a.promise(new Promise(u=>{c&&a.disposer.dispose(c.overEvent.disposableOnce(f=>{f?(o++,u(!0)):u(!1)})),a.disposer.dispose(l.overEvent.disposableOnce(f=>{f?(o--,u(!0)):u(!1)})),a.disposer.dispose(this.cancelEvent.disposableOn(()=>u(!1)))}))})))break;while(!0)});return n.start(),n}}(i=>{i.createDefaultProps=()=>({...Le.createDefaultProps()})})(jt||(jt={})),d.extendClassProps(jt.prototype,jt.createDefaultProps);class bp extends d.Destroyable{constructor(e,n){super();R(this,"_overEvent",this.disposeVar(new d.Event));const{placeEditing:s}=e;let o=new ql(e,void 0);e.editingPoints.splice(n,0,o);const r=()=>{(e.debug??jt.defaults.debug)&&console.log("delete currentPosEditor");const h=e.editingPoints.indexOf(o);if(h===-1)throw new Error("currentPosEditor not found");e.editingPoints.splice(h,1)};if(s.enabled??!1)throw console.error("placeEditing.enabled is true!"),new Error("placeEditing.enabled is true!");this.dispose(d.track([o,"position"],[s,"position"])),s.enabled=!0;let a=!1;const c=()=>{r(),this._overEvent.emit(!1)};this.dispose(()=>{s.enabled=!1,!a&&c()}),this.dispose(s.overEvent.disposableOnce(()=>{a=!0,o.position===void 0?c():this._overEvent.emit(!0)})),(e.debug??jt.defaults.debug)&&console.log(`PointAdding creating! index(${n})`),this.dispose(()=>{(e.debug??jt.defaults.debug)&&console.log(`PointAdding destroying! index(${n})`)})}get overEvent(){return this._overEvent}}function xp(i,t){const e=i.editingPoints,n=t-1;return n<0?(console.warn("previousIndex < 0, cannot delete the point!"),!1):(e.splice(n,1),!0)}class Sp extends d.Destroyable{constructor(e,n){super();R(this,"_overEvent",this.disposeVar(new d.Event));R(this,"_doEvent",this.disposeVar(new d.Event));this.dispose(this._doEvent.disposableOn(()=>this._overEvent.emit(xp(e,n)))),(e.debug??jt.defaults.debug)&&console.log(`PreviousPointDeleting creating! currentIndex(${n})`),this.dispose(()=>{(e.debug??jt.defaults.debug)&&console.log(`PreviousPointDeleting destroying! currentIndex(${n})`)})}get overEvent(){return this._overEvent}do(){return this._doEvent.emit()}}class Rp extends jt{constructor(t){super(t),this.loop=!1}}class Pp extends jt{constructor(t){super(t),this.loop=!0}}class ec extends Wl{constructor(t,e){super(t,e);{const{menuPoi:n}=this;n.commands=[["add","增加控制点","",Ot.baseImageUrl+"add.png"],["delete","删除当前控制点","",Ot.baseImageUrl+"delete.png"],["modify","修改当前控制点","",Ot.baseImageUrl+"modify.png"]],n.clickCommandName="modify",n.rightClickCommandName="delete",this.dispose(n.commandEvent.disposableOn(s=>{t.menuPoiCommand(this,s)})),this.dispose(n.dbclickEvent.disposableOn(()=>{t.menuPoiCommand(this,"dbClick")}))}if(t.middlePointShow){const n=this.ad(new li(t.olViewer));{n.imageUri=t.firstControlPointImageUrl??Ot.defaults.firstControlPointImageUrl,n.tooltip="点击增加一个控制点",n.bgColor=[0,0,0,.6],n.fgColor=[1,1,1,1],n.size=[8,8],n.originRatioAndOffset=[.5,.5,0,0];{const s=()=>{if(!(t.enabled??Ot.defaults.enabled)){n.enabled=!1,n.show=!1;return}do{const r=t.editingPoints.indexOf(this);if(r===-1)break;const a=t.editingPoints.length;if(a===0){console.error("impl.positionEditors.length === 0!");break}if(!(t.loop??Ot.defaults.loop)&&r+1>=a)break;const h=this.position;if(!h)break;let l=(r+1)%a;const f=t.editingPoints.get(l).position;if(!f)break;const g=rl(h,f);if(!g)break;g[2]-=t.olViewer.editingHeightOffset??0,n.position=g;const _=t.editingPoints.length<(t.maxPointsNum??Ot.defaults.maxPointsNum);n.enabled=_,n.show=_;return}while(!1);n.enabled=!1,n.show=!1};s(),this.dispose(t.positionsChanged.disposableOn(s)),this.dispose(t.loopChanged.disposableOn(s)),this.dispose(t.enabledChanged.disposableOn(s))}this.dispose(n.clickEvent.disposableOn(s=>{if(s.button!==0||t.editingPoints.length>=(t.maxPointsNum??Ot.defaults.maxPointsNum))return;const o=t.editingPoints.indexOf(this);if(o===-1)return;const r=n.position?[...n.position]:void 0;r&&(r[2]+=t.olViewer.editingHeightOffset??0);let a=new ec(t,r);t.editingPoints.splice(o+1,0,a),t.modify(a)}))}}}}class Ot extends Le{constructor(e){super(e);R(this,"_menuPoiCommand",this.disposeVar(new d.Event));R(this,"_forceModifyPosEditorEvent",this.disposeVar(new d.Event));R(this,"_overEvent",this.disposeVar(new d.Event));R(this,"translationEditing");console.log("这是多点修改编辑器");{const s=this.ad(d.createNextAnimateFrameEvent(this.moveWithFirstPositionChanged,this.editingPoints.changedEvent));this.ad(new d.ObjResettingWithEvent(s,()=>{if(!(!this.moveWithFirstPosition||this.editingPoints.length<=1))return new eE(this.editingPoints.get(0),this)}))}const n=this.translationEditing=this.disposeVar(new Li(e));n.enabled=!1,this.currentProcess=this.disposeVar(d.createProcessingFromAsyncFunc(async s=>{s.disposer.dispose(()=>{(this.debug??Ot.defaults.debug)&&console.log("---editing canceled~~~"),this.status="None",this.enabled=!1});let o=-1;do if((this.debug??Ot.defaults.debug)&&console.log("进入Modifying修改状态"),this.status="Modifying",o=await s.promise(d.step(s,async r=>{const a=r.disposer,c=a.ad(new iE(this));return a.dispose(()=>"modifying canceled!"),this.editingPoints.length>0&&c.modify(this.editingPoints.get(o===-1||o>=this.editingPoints.length?0:o)),a.dispose(this.cancelEvent.disposableOn(()=>c.cancel())),a.dispose(this._forceModifyPosEditorEvent.disposableOn(l=>c.modify(l))),await r.promise(new Promise(l=>{a.dispose(c.overEvent.disposableOnce(u=>{l(u)}))}))})),o===-1){(this.debug??Ot.defaults.debug)&&console.log("退出编辑状态");break}else{if(this.editingPoints.length>=(this.maxPointsNum??Ot.defaults.maxPointsNum))return;if(this.editingPoints.length===0){console.error("impl.positionEditors.length === 0!");return}this.loop??Ot.defaults.loop;const a=this.editingPoints.get(o-1).position;if(!a)return;let c=o%this.editingPoints.length;const l=this.editingPoints.get(c).position;if(!l)return;const u=rl(a,l);if(!u)return;u&&(u[2]+=this.olViewer.editingHeightOffset??0);let f=new ec(this,u);this.editingPoints.splice(o,0,f)}while(!0);this.status="None",this.enabled=!1}))}menuPoiCommand(e,n){this._menuPoiCommand.emit(e,n)}modify(e){this._forceModifyPosEditorEvent.emit(e)}resetPositions(e){if(!super.resetPositions(e))return!0;const n=e?e.map(s=>new ec(this,s)):[];return this.editingPoints.splice(0,this.editingPoints.length,...n),!0}get overEvent(){return this._overEvent}}(i=>{i.createDefaultProps=()=>({...Le.createDefaultProps(),moveWithFirstPosition:!1})})(Ot||(Ot={})),d.extendClassProps(Ot.prototype,Ot.createDefaultProps);class eE extends d.Destroyable{constructor(t,e){super(),this._firstPositionEditor=t,this.multiPointsModifyEditing=e,this._firstPositionEditor.positionChanged.disposableOn((n,s)=>{if(n===void 0||s===void 0)return;var o=[n[0]-s[0],n[1]-s[1],n[2]-s[2]];const r=this.multiPointsModifyEditing.editingPoints.length;for(let a=1;a<r;a++){const c=this.multiPointsModifyEditing.editingPoints.get(a),h=c.position;h!==void 0&&(c.position=[h[0]+o[0],h[1]+o[1],h[2]+o[2]])}})}}class iE extends d.Destroyable{constructor(e){super();R(this,"_overEvent",this.disposeVar(new d.Event));R(this,"_cancelEvent",this.disposeVar(new d.Event));R(this,"_forceModifyPosEditorEvent",this.disposeVar(new d.Event));e.menuPoiEnabled=!0,this.dispose(()=>e.menuPoiEnabled=!1);let n;const s=()=>{n==null||n.destroy(),n=void 0,e.status="Modifying"};this.dispose(s);const o=r=>{s(),e.status="Modifying_Point",n=new nE(e,r),n.dispose(n.overEvent.disposableOn(()=>{s()}))};this.dispose(this._forceModifyPosEditorEvent.disposableOn(o)),this.dispose(e._menuPoiCommand.disposableOn((r,a)=>{if(a==="delete"){if(e.editingPoints.length<=2)return;const c=e.editingPoints.indexOf(r);if(c===-1)throw console.error("posEditor not found"),new Error("posEditor not found");e.editingPoints.splice(c,1)}else if(a==="modify")o(r);else if(a==="add"){const c=e.editingPoints.indexOf(r);if(c===-1)throw console.error("posEditor not found"),new Error("posEditor not found");this._overEvent.emit(c+1)}else a==="dbClick"?this._overEvent.emit(-1):alert(`未知的commandName(${a})`)})),this.dispose(this._cancelEvent.disposableOn(()=>{this._overEvent.emit(-1)}))}get overEvent(){return this._overEvent}cancel(){this._cancelEvent.emit()}modify(e){this._forceModifyPosEditorEvent.emit(e)}}class nE extends d.Destroyable{constructor(e,n){super();R(this,"_overEvent",this.disposeVar(new d.Event));this._modifying=e,this._posEditor=n,this.dispose(this._posEditor.toDestroyEvent.disposableOn(()=>{this._overEvent.emit()}));const{translationEditing:s}=this._modifying;if(s.enabled=!0,s.heading=0,this.dispose(()=>{s.enabled=!1}),!this._posEditor.position)throw console.error("!this._posEditor.position"),new Error("!this._posEditor.position");s.position=this._posEditor.position,this.dispose(d.track([this._posEditor,"position"],[s,"position"])),this.dispose(s.enabledChanged.disposableOnce(o=>{o||this._overEvent.emit()}))}get overEvent(){return this._overEvent}}class Op extends Ot{constructor(t){super(t),this.loop=!1}}class Ip extends Ot{constructor(t){super(t),this.loop=!0}}class Hs extends jt{init(){const t=this.startPosition;if(!t)return;const e=this.distance,n=this.rotation,s=e*Math.cos(n[1]*Math.PI/180),o=d.geoDestination(t,s,n[0]);if(!o){this.positions=[t];return}const r=e*Math.sin(n[1]*Math.PI/180);o[2]+=r,this.positions=[t,o],this.editingPoints.length==2&&(this.editingPoints.get(0).position=t,this.editingPoints.get(1).position=o)}constructor(t){super(t),this.loop=!0,this.maxPointsNum=2;{const e=()=>{if(!this.positions||this.positions.length==0){this.distance=1,this.rotation=[90,0,0],this.startPosition=[0,0,0];return}if(this.positions.length==1){this.distance=1,this.rotation=[90,0,0];return}this.startPosition=this.positions[0],this.endPosition=this.positions[1];const n=d.geoHeading(this.startPosition,this.endPosition),s=d.geoDistance(this.startPosition,this.endPosition);if(s<=0){this.rotation=[90,0,0],this.distance=1;return}const o=this.endPosition[2]-this.startPosition[2],r=Math.atan(o/s)*180/Math.PI,a=Math.sqrt(s*s+o*o);this.rotation=[n,r,0],this.distance=a};e(),this.ad(this.positionsChanged.don(e))}}}(i=>{i.createDefaultProps=()=>({...jt.createDefaultProps(),startPosition:d.reactArrayWithUndefined(void 0),endPosition:d.reactArrayWithUndefined(void 0),rotation:d.reactArray([90,0,0]),distance:d.react(1)})})(Hs||(Hs={})),d.extendClassProps(Hs.prototype,Hs.createDefaultProps);class Kn extends Ot{init(){const t=this.startPosition;if(!t)return;const e=this.distance,n=this.rotation,s=e*Math.cos(n[1]*Math.PI/180),o=d.geoDestination(t,s,n[0]);if(!o){this.positions=[t];return}const r=e*Math.sin(n[1]*Math.PI/180);o[2]+=r,this.positions=[t,o],this.editingPoints.length==2&&(this.editingPoints.get(0).position=t,this.editingPoints.get(1).position=o)}constructor(t){super(t),this.loop=!0,this.maxPointsNum=2,this.middlePointShow=!1,this.moveWithFirstPosition=!0;{const e=()=>{do{if(!this.positions||this.positions.length==0){this.distance=1,this.rotation=[90,0,0],this.startPosition=[0,0,0];break}if(this.startPosition=this.positions[0],this.positions.length==1){this.editingPoints.get(0).menuPoi.commands=[["add","增加控制点","",Ot.baseImageUrl+"add.png"],["delete","删除当前控制点","",Ot.baseImageUrl+"delete.png"],["modify","修改当前控制点","",Ot.baseImageUrl+"modify.png"]],this.rotation=[90,0,0],this.distance=1;break}this.endPosition=this.positions[1];for(let c of this.editingPoints)c.menuPoi.commands=[["delete","删除当前控制点","",Ot.baseImageUrl+"delete.png"],["modify","修改当前控制点","",Ot.baseImageUrl+"modify.png"]];const n=d.geoHeading(this.startPosition,this.endPosition),s=d.geoDistance(this.startPosition,this.endPosition);if(Math.abs(s)<=0){this.rotation=[90,0,0],this.distance=1;return}const o=this.endPosition[2]-this.startPosition[2],r=Math.atan(o/s)*180/Math.PI,a=Math.sqrt(s*s+o*o);this.rotation=[n,r,0],this.distance=a}while(!1)};this.ad(this.positionsChanged.don(e))}}}(i=>{i.createDefaultProps=()=>({...Ot.createDefaultProps(),startPosition:d.reactArrayWithUndefined(void 0),endPosition:d.reactArrayWithUndefined(void 0),rotation:d.reactArray([0,0,0]),distance:d.react(0)})})(Kn||(Kn={})),d.extendClassProps(Kn.prototype,Kn.createDefaultProps);class sE extends jt{constructor(t){super(t),this.loop=!1,this.polylineShow=!1}}class oE extends Ot{constructor(t){super(t),this.loop=!1,this.polylineShow=!1,this.middlePointShow=!1}}class $o extends jt{constructor(t){super(t),t.viewer||(this.loop=!1);{const e=()=>{if(!this.positions||this.positions.length<2){this.visibilityPositions=void 0;return}const n=[...this.positions[0]];n[2]-=t.editingHeightOffset??0,this.visibilityPositions=this.positions.map(s=>(s[2]-=t.editingHeightOffset??0,[n,s]))};e(),this.ad(this.positionsChanged.don(e))}}createPolyline(t){const e=this.ad(new di(t));e.topOrBottom="bottom",this.ad(d.track([e,"color"],[this,"polylineColor"])),this.ad(d.track([e,"width"],[this,"polylineWidth"])),this.ad(d.track([e,"show"],[this,"polylineShow"])),this.ad(d.track([e,"arcType"],[this,"polylineArcType"])),this.ad(d.track([e,"loop"],[this,"loop"])),this.ad(d.track([e,"positions"],[this,"visibilityPositions"]))}}(i=>{i.createDefaultProps=()=>({...jt.createDefaultProps(),visibilityPositions:d.reactPositionsSet(void 0)})})($o||($o={})),d.extendClassProps($o.prototype,$o.createDefaultProps);class Zo extends Ot{constructor(t){if(super(t),!!t.viewer){this.loop=!1,this.middlePointShow=!1;{const e=()=>{if(!this.positions||this.positions.length<2)return;const n=[...this.positions[0]];n[2]-=t.editingHeightOffset??0,this.visibilityPositions=this.positions.map(s=>(s[2]-=t.editingHeightOffset??0,[n,s]))};e(),this.ad(this.positionsChanged.don(e))}}}createPolyline(t){const e=this.ad(new di(t));e.topOrBottom="bottom",this.ad(d.track([e,"color"],[this,"polylineColor"])),this.ad(d.track([e,"width"],[this,"polylineWidth"])),this.ad(d.track([e,"show"],[this,"polylineShow"])),this.ad(d.track([e,"arcType"],[this,"polylineArcType"])),this.ad(d.track([e,"loop"],[this,"loop"])),this.ad(d.track([e,"positions"],[this,"visibilityPositions"]))}}(i=>{i.createDefaultProps=()=>({...Ot.createDefaultProps(),visibilityPositions:d.reactPositionsSet(void 0)})})(Zo||(Zo={})),d.extendClassProps(Zo.prototype,Zo.createDefaultProps);class rE extends Kn{constructor(t){super(t),this.firstControlPointImageUrl=this.otherControlPointImageUrl,this.translationEditing.xAxisShow=!1,this.translationEditing.yAxisShow=!1,this.translationEditing.showCircle=!1,this.rotation=[0,90,0]}}class $e extends d.EngineObject{constructor(e,n,s){super(e,n,s??!0);R(this,"_supportEditing",this.disposeVar(d.react(!0)));R(this,"_currentEditing",this.disposeVar(d.react(void 0)));this.ad(this.supportEditingChanged.don(()=>{this.destroy()}))}get supportEditing(){return this._supportEditing.value}set supportEditing(e){this._supportEditing.value=e}get supportEditingChanged(){return this._supportEditing.changed}get currentEditing(){return this._currentEditing.value}set currentEditing(e){this._currentEditing.value=e}get currentEditingChanged(){return this._currentEditing.changed}}const ur=class ur extends $e{constructor(t,e){super(Array.isArray(t)?t[0]:t,e,!0);const n=this.currentEditing=this.ad(new Li(e));if(this.ad(n.enabledChanged.don(s=>{s||this.ad(d.nextAnimateFrame(()=>this.destroy()))})),Array.isArray(t)){const s=[];for(let o=0;o<t.length;o++){const r=t[o];Reflect.has(r,"position")?s.push(r.position):r.points&&s.push(...r.points)}n.position=d.getMinMaxCorner(s).center,this.ad(n.positionChanged.disposableOn((o,r)=>{if(!o||!r)return;const a=Us({originPosition:r},[o])[0][0];t.forEach(c=>{if(Reflect.has(c,"position")){const h=Us({originPosition:r},[c.position])[0][0];c.position=Ua({originPosition:r},[[h[0]+a[0],h[1]+a[1],h[2]+a[2]]])[0][0]}else if(Reflect.has(c,"points")&&c.points){const h=Us({originPosition:r},c.points)[0];c.points=Ua({originPosition:r},h.map(l=>[l[0]+a[0],l[1]+a[1],l[2]+a[2]]))[0]}})}));return}if(Reflect.has(t,"position")){this.ad(d.bind([n,"position"],[t,"position"]));return}if(Reflect.has(t,"points")){const s=t;if(s.points===void 0||s.points.length===0){this.destroy();return}n.position=d.getMinMaxCorner(s.points).center,this.ad(n.positionChanged.disposableOn((o,r)=>{if(o===void 0||r===void 0||s.points===void 0||s.points.length===0){this.destroy();return}const a=Us({originPosition:r},[o])[0][0],c=Us({originPosition:r},s.points)[0];s.points=Ua({originPosition:r},c.map(h=>[h[0]+a[0],h[1]+a[1],h[2]+a[2]]))[0]}));return}this.supportEditing=!1}};R(ur,"type",ur.registerEditing("ESOlViewer",d.ESJEditingMode.Translation,ur));let ic=ur;function Tp(){const i=d.createProcessingFromAsyncFunc(async(t,e,n,s,o=!0)=>{const r=Array.isArray(s)?[...s]:[s];if(r.length===0){console.warn("无有效编辑模式,editingModes 为:",r);return}const a=n.editingID;console.log("编辑模式为:editingModes",r),e.editingEvent.emit({objectIDs:[n.parentID],editingID:a,type:"start",add:{modes:r}});const c=()=>{e.notSupportEditingCount=0,e.editingEvent.emit({objectIDs:[n.parentID],editingID:a,type:"end",add:{modes:r}}),i.isRunning&&i.cancel()};t.disposer.ad(c),t.disposer.ad(n.toDestroyEvent.don(c));const h=u=>{u.code==="Escape"&&c()};document.body.addEventListener("keydown",h),t.disposer.ad(()=>document.body.removeEventListener("keydown",h));const l=async u=>{if(!i.isRunning)return;const f=r[u%r.length],g=await d.step(t,async y=>{const w=y.disposer,E=d.EngineObject.contextEditing.getEngineObjConstructor(f,e.typeName);if(!E||!n.supportEditingModes().includes(f))return console.log(`未找到编辑模式或不支持当前编辑模式 ${f},已跳过,请检查输入`),e.editingEvent.emit({objectIDs:[n.parentID],editingID:a,type:"changedFailed",add:{cMode:f,cIndex:u}}),e.notSupportEditingCount++,"next";const b=new E(n,e);if(w.ad(()=>{!b.isDestroyed()&&b.destroy()}),b.supportEditing)e.editingEvent.emit({objectIDs:[n.parentID],editingID:a,type:"changed",add:{cMode:f,cIndex:u}}),e.notSupportEditingCount=0;else return console.log(`编辑模式 ${f} 不支持,已跳过`),e.editingEvent.emit({objectIDs:[n.parentID],editingID:a,type:"changedFailed",add:{cMode:f,cIndex:u}}),e.notSupportEditingCount++,"next";return await y.promise(new Promise(I=>{if(b.isDestroyed())return I("next");if(w.ad(b.toDestroyEvent.don(()=>{console.log(`编辑模式 ${f} 结束`),I("next")})),o){const M=D=>{D.code==="Space"&&(console.log(`编辑模式 ${f} 切换到下一模式`),I("next"))};document.body.addEventListener("keydown",M),w.ad(()=>document.body.removeEventListener("keydown",M)),w.ad(e.dblclickEvent.don(()=>I("done")))}else w.ad(e.dblclickEvent.don(()=>I("done")))}))});if(e.notSupportEditingCount===r.length||g==="done")return;const _=o?(u+1)%r.length:u+1;if(!(!o&&_>=r.length))return await Promise.resolve(),l(_)};await l(0)});return i}function aE(){const i=d.createProcessingFromAsyncFunc(async(t,e,n,s)=>{e.editingEvent.emit({objectIDs:n.map(c=>c.parentID),editingID:s,type:"start"});const o=()=>{e.editingEvent.emit({objectIDs:n.map(c=>c.parentID),editingID:s,type:"end"}),i.isRunning&&i.cancel()};t.disposer.ad(o);const r=c=>{c.code=="Escape"&&o()};document.body.addEventListener("keydown",r),t.disposer.ad(()=>document.body.removeEventListener("keydown",r));const a=new ic(n,e);t.disposer.ad(()=>{!a.isDestroyed()&&a.destroy()}),await t.promise(new Promise(c=>{a.isDestroyed()&&c(),t.disposer.ad(a.toDestroyEvent.don(()=>{console.log("移动结束"),c()})),t.disposer.ad(e.dblclickEvent.don(()=>c()))}))});return i}const dr=class dr extends $e{constructor(t,e){super(t,e,!0);const n=this.currentEditing=this.ad(new Fi(e));this.ad(e.clickEvent.don(s=>{var o;((o=s.pointerEvent)==null?void 0:o.button)==2&&(n.enabled=!0)})),Reflect.has(t,"position")?(this.ad(d.bind([n,"position"],[t,"position"])),n.enabled=!n.position||d.equalsN3(n.position,[0,0,0])):this.supportEditing=!1}};R(dr,"type",dr.registerEditing("ESOlViewer",d.ESJEditingMode.Place,dr));let Gl=dr;const fr=class fr extends $e{constructor(t,e){super(t,e,!0);const n=this.currentEditing=this.ad(new zi(e));if(this.ad(n.enabledChanged.don(s=>{!s&&this.ad(d.nextAnimateFrame(()=>{this.destroy()}))})),Reflect.has(t,"position")&&Reflect.has(t,"scale")){const s=t;this.ad(d.bind([n,"position"],[s,"position"])),this.ad(d.bind([n,"scale"],[s,"scale"]))}else throw new Error(`ScaleEditingWrapper:${t.typeName} 缩放属性无法绑定缩放编辑`)}};R(fr,"type",fr.registerEditing("ESOlViewer",d.ESJEditingMode.Scale,fr));let Vl=fr;const gr=class gr extends $e{constructor(t,e){super(t,e,!0);const n=this.currentEditing=this.ad(new Rp(e));if(this.ad(n.enabledChanged.don(s=>{s||this.ad(d.nextAnimateFrame(()=>this.destroy()))})),Reflect.has(t,"points")){const s=()=>n.positions=t.points??[];s(),this.ad(t.pointsChanged.don(()=>{n.enabled||s()})),n.enabled=!0,this.ad(d.track([t,"points"],[n,"positions"]))}else this.supportEditing=!1}};R(gr,"type",gr.registerEditing("ESOlViewer",d.ESJEditingMode.LineStringAppend,gr));let Bl=gr;const pr=class pr extends $e{constructor(t,e){super(t,e,!0);const n=this.currentEditing=this.ad(new Op(e));if(this.ad(n.enabledChanged.don(s=>{s||this.ad(d.nextAnimateFrame(()=>this.destroy()))})),Reflect.has(t,"points")){const s=()=>{n.positions=t.points??[]};s(),this.ad(t.pointsChanged.don(()=>{n.enabled||s()})),n.enabled=!0,this.ad(d.track([t,"points"],[n,"positions"]))}else this.supportEditing=!1}};R(pr,"type",pr.registerEditing("ESOlViewer",d.ESJEditingMode.LineStringInsert,pr));let Yl=pr;const mr=class mr extends $e{constructor(t,e){super(t,e,!0);const n=this.currentEditing=this.ad(new Pp(e));if(this.ad(n.enabledChanged.don(s=>{!s&&this.ad(d.nextAnimateFrame(()=>{this.destroy()}))})),Reflect.has(t,"points")){const s=()=>{n.positions=t.points??[]};s(),this.ad(t.pointsChanged.don(()=>{n.enabled||s()})),n.enabled=!0,this.ad(d.track([t,"points"],[n,"positions"]))}else this.supportEditing=!1}};R(mr,"type",mr.registerEditing("ESOlViewer",d.ESJEditingMode.CircularAppend,mr));let Hl=mr;const _r=class _r extends $e{constructor(t,e){super(t,e,!0);const n=this.currentEditing=this.ad(new Ip(e));if(this.ad(n.enabledChanged.don(s=>{!s&&this.ad(d.nextAnimateFrame(()=>{this.destroy()}))})),Reflect.has(t,"points")){const s=()=>n.positions=t.points??[];s(),this.ad(t.pointsChanged.don(()=>!n.enabled&&s())),n.enabled=!0,this.ad(d.track([t,"points"],[n,"positions"]))}else this.supportEditing=!1}};R(_r,"type",_r.registerEditing("ESOlViewer",d.ESJEditingMode.CircularInsert,_r));let Xl=_r;const yr=class yr extends $e{constructor(t,e){super(t,e,!0);const n=this.currentEditing=this.ad(new Hs(e));if(this.ad(n.enabledChanged.don(s=>{!s&&this.ad(d.nextAnimateFrame(()=>{this.destroy()}))})),Reflect.has(t,"position")){const s=t;if(this.ad(d.bind([n,"startPosition"],[s,"position"])),this.ad(Mg([n,"rotation"],[s,"rotation"])),Reflect.has(s,"far"))this.ad(d.bind([n,"distance"],[s,"far"]));else if(Reflect.has(s,"radius"))this.ad(d.bind([n,"distance"],[s,"radius"]));else if(Reflect.has(s,"distance"))this.ad(d.bind([n,"distance"],[s,"distance"]));else{const o=e.viewer,r=o==null?void 0:o.getView(),a=(r==null?void 0:r.getResolution())??1;n.distance=Math.max(1,a*100)}}else if(Reflect.has(t,"points")){const s=t,o=()=>n.positions=s.points??[];o(),this.ad(s.pointsChanged.don(()=>!n.enabled&&o())),this.ad(d.track([s,"points"],[n,"positions"]))}else throw new Error(`DoublePointsAppendEditingWrapper:${t.typeName} 坐标属性无法绑定双点追加编辑`);n.startPosition&&!d.equalsN3(n.startPosition,[0,0,0])&&n.init(),n.enabled=!0}};R(yr,"type",yr.registerEditing("ESOlViewer",d.ESJEditingMode.DoublePointsAppend,yr));let $l=yr;const wr=class wr extends $e{constructor(t,e){var r;super(t,e,!0);const n=e.viewer;if(!n)return;const s=this.currentEditing=this.ad(new Kn(e));if(Reflect.has(t,"position")){const a=t;if(this.ad(d.bind([s,"startPosition"],[a,"position"])),this.ad(Mg([s,"rotation"],[a,"rotation"])),Reflect.has(a,"far"))this.ad(d.bind([s,"distance"],[a,"far"]));else if(Reflect.has(a,"radius"))this.ad(d.bind([s,"distance"],[a,"radius"]));else if(Reflect.has(a,"distance"))this.ad(d.bind([s,"distance"],[a,"distance"]));else{const c=((r=n.getView())==null?void 0:r.getResolution())??1;s.distance=Math.max(1,c*100)}}else if(Reflect.has(t,"points")){const a=t;if(!a.points||a.points.length!==2)throw new Error(`DoublePointsModifyEditingWrapper:${t.typeName} 坐标属性无法绑定双点修改编辑`);s.moveWithFirstPosition=!1;const c=()=>s.positions=a.points??[];c(),this.ad(a.pointsChanged.don(()=>!s.enabled&&c())),this.ad(d.track([a,"points"],[s,"positions"]))}else throw new Error(`DoublePointsModifyEditingWrapper:${t.typeName} 坐标属性无法绑定双点修改编辑`);s.init(),s.enabled=!0;const o=this.ad(d.createNextAnimateFrameEvent(s.enabledChanged,s.startPositionChanged));this.ad(o.don(()=>{(!s.enabled||!s.startPosition||d.equalsN3(s.startPosition,[0,0,0]))&&this.destroy()}))}};R(wr,"type",wr.registerEditing("ESOlViewer",d.ESJEditingMode.DoublePointsModify,wr));let Zl=wr;const vr=class vr extends $e{constructor(t,e){super(t,e,!0);const n=this.currentEditing=this.ad(new wn(e));if(n.rotation=[90,0,0],this.ad(n.enabledChanged.don(s=>{s||this.ad(d.nextAnimateFrame(()=>this.destroy()))})),Reflect.has(t,"position")&&Reflect.has(t,"rotation")){const s=t;this.ad(d.bind([n,"position"],[s,"position"])),this.ad(d.bind([n,"selfRotation"],[s,"rotation"]));return}else throw new Error(`OlRotationEditingWrapper:${t.typeName} 旋转属性无法绑定旋转编辑`)}};R(vr,"type",vr.registerEditing("ESOlViewer",d.ESJEditingMode.Rotation,vr));let Kl=vr;return W.AddEditingPoint=ql,W.BaseEditingWrapper=$e,W.CircularAppendEditing=Pp,W.CircularAppendEditingWrapper=Hl,W.CircularInsertEditing=Ip,W.CircularInsertEditingWrapper=Xl,W.CurrentScale=Og,W.DoublePointsAppendEditing=Hs,W.DoublePointsAppendEditingWrapper=$l,W.DoublePointsModifyEditing=Kn,W.DoublePointsModifyEditingWrapper=Zl,W.ESGeoIcon=Za,W.ESGeoPoint=Ka,W.ESOlViewer=ui,W.ESXYZLayer=Qa,W.EditingPoint=Wl,W.FPSMonitor=Qd,W.GeoCanvasPoi=Ai,W.HeightModifyEditing=rE,W.ImageLabel2D=gp,W.LineStringAppendEditing=Rp,W.LineStringAppendEditingWrapper=Bl,W.LineStringInsertEditing=Op,W.LineStringInsertEditingWrapper=Yl,W.MultiPointsAppendEditing=jt,W.OLCurrentScale=af,W.OlCanvasAndDivSwitchPoi=ov,W.OlCanvasPoi=hl,W.OlCursorPositionInfo=zg,W.OlDivPoi=ul,W.OlESAreaMeasurement=Ol,W.OlESDirectionMeasurement=Il,W.OlESDistanceMeasurement=Tl,W.OlESGeoIcon=Al,W.OlESGeoLineString=Bo,W.OlESGeoPoint=Fl,W.OlESGeoPoints=Ll,W.OlESGeoPolygon=$a,W.OlESGeoPolygonImpl=Xn,W.OlESImageLabel=zl,W.OlESImageryLayer=Nl,W.OlESLabel=Pl,W.OlESLocationMeasurement=Ul,W.OlESObjectWithLocation=Go,W.OlESPath=jl,W.OlESTextLabel=kl,W.OlESXYZLayer=Dl,W.OlGeoCanvasImagePoi=li,W.OlGeoCanvasMenuPoi=js,W.OlGeoCustomDivPoi=Qt,W.OlGeoDivTextPoi=pn,W.OlImageriesManager=Ng,W.OlImagery=np,W.OlLabelManager=Ug,W.OlMultiPoint=_n,W.OlPickingManager=kg,W.OlPoint=Xe,W.OlPoisContext=Dg,W.OlPolygon=Di,W.OlPolyline=Jt,W.OlRotationEditing=wn,W.OlRotationEditingWrapper=Kl,W.OlView=Hn,W.OlViewChanged=U_,W.OlViewerExtensions=Wg,W.PlaceEditing=Fi,W.PlaceEditingWrapper=Gl,W.PointAdding=bp,W.PreviousPointDeleting=Sp,W.ScaleEditing=zi,W.ScaleEditingWrapper=Vl,W.ScatterAppendEditing=sE,W.ScatterModifyEditing=oE,W.TranslationEditing=Li,W.TranslationEditingWrapper=ic,W.VisibilityAppendEditing=$o,W.VisibilityModifyEditing=Zo,W.WASDController=Kd,W.capture=$d,W.cesiumHeightToOlZoom=kn,W.compute2DPickingConstraint=G_,W.compute2DPickingInfoWithCoordinates=rf,W.computePickingInfoWithCoordinates2D=sf,W.createEditingSystemProcessing=Tp,W.createHelperLine=W_,W.createMoveObjectsProcessing=aE,W.defaultFlyToRotation=Jd,W.deletePreviousPoint=xp,W.flyExtent=To,W.flyTo=Ri,W.flyToWithParam=N_,W.flyToWithPosition=fh,W.flyToWithPositions=z_,W.fromCartesian=E1,W.fromCartesian2=mg,W.fromCartesian3=yg,W.fromCartesian4=vg,W.fromCartographic=b1,W.fromColor=S1,W.fromDistanceDisplayCondition=T1,W.fromEllipsoid=k1,W.fromHeadingPitchRoll=O1,W.fromNearFarScalar=P1,W.fromQuaternion=M1,W.fromRectangle=N1,W.geoNeareastPointOnRhumbLine=an,W.geoNeareastPointOnRhumbLine2=q_,W.getCameraPosition=ef,W.getCenterFromPositions=Bv,W.getFlatMidPoint=rl,W.getInverseModelMatrix=Sg,W.getMinMaxCoordinates=ap,W.getModelMatrixFromPosition=sl,W.getOlZoomFromCesiumHeight=L_,W.getPointsExtent=sa,W.getViewerExtensions=Mi,W.localPositionToPosition=Pg,W.localPositionsToPositions=Ua,W.moveAllPositionsWithCenter=Yv,W.olFlyTo=tf,W.olZoomToCesiumHeight=Io,W.orbitAroundPoint=Zd,W.pickOlPosition=nf,W.positionAndRotationToQuaternion=L1,W.positionFromCartesian=v1,W.positionToCartesian=gg,W.positionToLocalPosition=Rg,W.positionsToLocalPositions=Us,W.setViewerExtensions=Wa,W.toCartesian=Eg,W.toCartesian2=pg,W.toCartesian3=_g,W.toCartesian4=wg,W.toCartographic=C1,W.toColor=x1,W.toDistanceDisplayCondition=I1,W.toEllipsoid=j1,W.toHeadingPitchRoll=Cg,W.toNearFarScalar=R1,W.toQuaternion=A1,W.toRectangle=z1,W.visualizeCenterPoint=F_,Object.defineProperty(W,Symbol.toStringTag,{value:"Module"}),W}({},EarthSDK3,ol);
155
+ }`;this.instanceClassStr=w};E(),this.dispose(this.innerHTMLChanged.disposableOn(E))}}update(t){this._updateEvent.emit(t)}get instanceClass(){return this._instanceClassReact.value}set instanceClass(t){this._instanceClassReact.value=t}get instanceClassChanged(){return this._instanceClassReact.changed}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}get pickedEvent(){return this._pickedEvent}pickFromDiv(t,i){(this.allowPicking??!1)&&this.pickedEvent.emit(new p.ESJPickedResult({element:t,...i}))}get innerHtmlMounted(){return this._innerHtmlMounted}get olDivPoi(){return this._olDivPoi}set olDivPoi(t){this._olDivPoi=t}get objResetting(){return this._objResetting}get olViewerVisibleDistanceRangeControl(){return this._olViewVisibleDistanceRangeControl}get visibleAlpha(){return this._olViewVisibleDistanceRangeControl.visibleAlpha}get visibleAlphaChanged(){return this._olViewVisibleDistanceRangeControl.visibleAlphaChanged}}I(kt,"defaultOLInstanceClassStr",tp),I(kt,"olInstanceClassStrReadMe",tw),I(kt,"defaults",{position:[116.39,39.9,0],instanceClassStr:tp,instanceClassStrReadMe:tw,innerHTML:nw,innerHTMLReadMe:ZR,viewDistanceRange:[1e3,1e4,3e4,6e4],zOrder:0}),(n=>{n.createDefaultProps=()=>({show:!0,allowPicking:!1,opacity:1,position:p.reactArrayWithUndefined(void 0),originRatioAndOffset:p.reactArray([.5,1,0,0]),instanceClassStr:void 0,innerHTML:void 0,viewDistanceRange:p.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,shadowDom:!1,cssAllInitial:!1,zOrder:0})})(kt||(kt={})),p.extendClassProps(kt.prototype,kt.createDefaultProps);class KR extends p.Destroyable{constructor(e,t,i){super(),this._container=e}}const Ru=class Ru extends p.Destroyable{constructor(t,i){super();I(this,"_pickedEvent",this.disposeVar(new p.Event));I(this,"_divEvent",this.disposeVar(new p.Event));I(this,"_divCreatedEvent",this.disposeVar(new p.Event));I(this,"_divToDestroyEvent",this.disposeVar(new p.Event));I(this,"_pc",this.disposeVar(new p.PointerClick));I(this,"_flyToEvent",this.disposeVar(new p.Event));I(this,"_customDivPoi");this._customDivPoi=this.disposeVar(new kt(t,i));const s=this,o=this._customDivPoi;this.dispose(this.flyToEvent.disposableOn(r=>{o.flyTo(r)})),this.dispose(p.bind([o,"show"],[this,"show"])),this.dispose(p.bind([o,"position"],[this,"position"])),this.dispose(p.bind([o,"originRatioAndOffset"],[this,"originRatioAndOffset"])),this.dispose(p.bind([o,"opacity"],[this,"opacity"])),this.dispose(p.bind([o,"viewDistanceRange"],[this,"viewDistanceRange"])),this.dispose(p.bind([o,"viewDistanceDebug"],[this,"viewDistanceDebug"])),this.dispose(p.bind([o,"shadowDom"],[this,"shadowDom"])),this.dispose(p.bind([o,"cssAllInitial"],[this,"cssAllInitial"])),this.dispose(p.bind([o,"allowPicking"],[this,"pickOnClick"])),this.d(p.bind([o,"zOrder"],[this,"zOrder"]));{class r extends KR{constructor(l,c,h){super(l,c,h);const u=document.createElement("div");u.style.overflow="hidden",u.style.whiteSpace="nowrap",u.addEventListener("mouseover",()=>{s.divEvent.emit(!0)}),u.addEventListener("mouseout",()=>{s.divEvent.emit(!1)});{{const f=()=>{o.show=s.show??!0,u.style.pointerEvents="all",s.width===void 0?u.style.width="auto":u.style.width=`${s.width}px`,s.height===void 0?u.style.height="auto":u.style.height=`${s.height}px`,s.text!==void 0?u.innerHTML=`${s.text.replace(/\n/g,"<br/>")??"请输入文字"}`:u.innerHTML="请输入文字",u.style.fontSize=`${s.fontSize??14}px`,u.style.fontFamily=`${s.fontFamily??Ru.defaults.fontFamily}`;const _=s.borderRadius??[6,6,6,6];u.style.borderRadius=`${_[0]}px ${_[1]}px ${_[2]}px ${_[3]}px`;const v=s.color??[1,1,1,1];u.style.color=`rgba(${v[0]*255},${v[1]*255},${v[2]*255},${v[3]})`;const E=s.backgroundColor??[0,0,0,.8];u.style.backgroundColor=`rgba(${E[0]*255},${E[1]*255},${E[2]*255},${E[3]})`;const w=s.padding??[5,5,5,5];u.style.padding=`${w[0]}px ${w[1]}px ${w[2]}px ${w[3]}px`,u.style.borderWidth=`${s.borderWidth??0}px`;const C=s.borderColor??[1,1,1,1];u.style.borderColor=`rgba(${C[0]*255},${C[1]*255},${C[2]*255},${C[3]})`,u.style.borderStyle=`${s.borderStyle??"solid"}`,u.style.textAlign=`${s.textAlign??"left"}`,u.style.transform=`scale(${s.scale[0]??1},${s.scale[1]??1}) rotate(${s.rotate??0}deg)`};f();const g=this.disposeVar(p.createNextAnimateFrameEvent(s.showChanged,s.widthChanged,s.heightChanged,s.textChanged,s.fontSizeChanged,s.borderRadiusChanged,s.colorChanged,s.backgroundColorChanged,s.paddingChanged,s.borderWidthChanged,s.borderColorChanged,s.borderStyleChanged,s.fontFamilyChanged,s.textAlignChanged,s.scaleChanged,s.rotateChanged));this.dispose(g.disposableOn(f))}{const f=()=>{s.textEditing?(u.contentEditable="true",u.focus(),document.execCommand("selectAll",!1,null)):(u.contentEditable="false",document.execCommand("unselect",!1,null))};f(),this.dispose(s.textEditingChanged.disposableOn(f))}{const f=()=>{s.textEditingInteraction||(s.positionEditing??!1?u.style.pointerEvents="none":u.style.pointerEvents="all")};f(),this.dispose(s.positionEditingChanged.disposableOn(f))}let d=null;this.dispose(()=>clearInterval(d));{const f=()=>{u.ondblclick=()=>{s.positionEditing&&(s.positionEditing=!1),s.textEditingInteraction&&(s.textEditing=!0)},u.onblur=()=>{s.text=u.innerText,s.textEditingInteraction&&(d&&clearTimeout(d),d=setTimeout(()=>{s.textEditing=!1},100))},u.addEventListener("keydown",function(g){s.textEditingInteraction&&(g.code==="Enter"&&!g.shiftKey&&u.blur(),g.code==="Escape"&&u.blur())})};f(),this.dispose(s.textEditingInteractionChanged.disposableOn(f))}}this._container.appendChild(u),this.dispose(()=>{this._container.removeChild(u)}),s._divCreatedEvent.emit(u),this.dispose(()=>s._divToDestroyEvent.emit(u))}}o.instanceClass=r}this.dispose(o.pickedEvent.don(r=>{(o.allowPicking??!1)&&s.pickedEvent.emit(r)}))}get pickedEvent(){return this._pickedEvent}get divEvent(){return this._divEvent}get divCreatedEvent(){return this._divCreatedEvent}get divToDestroyEvent(){return this._divToDestroyEvent}get pc(){return this._pc}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}get customDivPoi(){return this._customDivPoi}};I(Ru,"defaults",{width:80,height:28,text:"请输入文字",borderStyle:"solid",fontFamily:"",viewDistanceRange:[1e3,1e4,3e4,6e4],scale:[1,1],zOrder:0});let Ns=Ru;(n=>{n.createDefaultProps=()=>({show:!0,position:p.reactArrayWithUndefined(void 0),text:void 0,width:void 0,height:void 0,fontFamily:void 0,positionEditing:!1,textEditing:!1,textEditingInteraction:!1,originRatioAndOffset:p.reactArray([.5,1,0,0]),opacity:1,fontSize:14,textAlign:"left",color:p.reactArray([1,1,1,1]),backgroundColor:p.reactArray([0,0,0,.8]),padding:p.reactArray([5,5,5,5]),borderRadius:p.reactArray([6,6,6,6]),borderWidth:0,borderColor:p.reactArray([1,1,1,1]),borderStyle:"solid",viewDistanceRange:p.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,pickOnClick:!1,shadowDom:!1,cssAllInitial:!1,scale:p.reactArray([1,1]),zOrder:0,rotate:0})})(Ns||(Ns={})),p.extendClassProps(Ns.prototype,Ns.createDefaultProps);class iw extends p.Destroyable{constructor(t){super();I(this,"_enabled",this.disposeVar(p.react(!1)));I(this,"_cursorPosition",p.react(void 0));I(this,"quickPickPosition",!0);let i=new p.Destroyable;const s=()=>{i&&(i.destroy(),i=void 0)};this.dispose(s);const o=()=>{var d;if(s(),!this._enabled.value||!t)return;const r=Ki(t);if(!r)return;i=new p.Destroyable;const a=i.disposeVar(p.react(void 0)),l=i.disposeVar(p.createNextAnimateFrameEvent(a.changed)),c=(d=t.getTargetElement)==null?void 0:d.call(t);if(!c)return;const h=f=>{const g=p.getDomEventCurrentTargetPos(f);a.value=g};c.addEventListener("mousemove",h),i.dispose(()=>c.removeEventListener("mousemove",h));const u=i.disposeVar(p.createProcessingFromAsyncFunc(async f=>{const g=r.pickingManager;if(!g||!a.value)return;const _=a.value,v=this.quickPickPosition?await f.promise(p.createCancelablePromise(g.quickPickPosition(_))):await f.promise(p.createCancelablePromise(g.pickPosition(_)));this._cursorPosition.value=v}));i.dispose(l.disposableOn(()=>{u.restart()}))};o(),this.dispose(this._enabled.changed.disposableOn(o))}get enabled(){return this._enabled.value}set enabled(t){this._enabled.value=t}get enabledChanged(){return this._enabled.changed}get cursorPosition(){return this._cursorPosition.value}get cursorPositionChanged(){return this._cursorPosition.changed}}class sw extends p.Destroyable{constructor(t){super();I(this,"_baseLayers",new Set);I(this,"_imageryGroup",new Ts({zIndex:-9999,visible:!0}));this._map=t,this._map.addLayer(this._imageryGroup),this.d(()=>this._map.removeLayer(this._imageryGroup))}get baseLayers(){return this._baseLayers}get map(){return this._map}add(t){if(this._baseLayers.has(t)){console.warn("imageriesManager add error: has already added!",t);return}this._imageryGroup.getLayers().push(t),this._baseLayers.add(t)}delete(t){if(!this._baseLayers.has(t)){console.warn("imageriesManager delete error: has not added!",t);return}this._imageryGroup.getLayers().remove(t),this._baseLayers.delete(t)}setZindex(t,i){if(!this._baseLayers.has(t)){console.warn("imageriesManager setZindex error: has not added!",t);return}t.setZIndex(i-9999)}}class ow extends p.Destroyable{constructor(t){super();I(this,"_labelMap",{div:new globalThis.Map,canvas:new globalThis.Map});this._map=t;const i=t.getView(),s=[];s.push(i.on("change:center",()=>this._updateZOrder())),s.push(i.on("change:resolution",()=>this._updateZOrder())),s.push(i.on("change:rotation",()=>this._updateZOrder())),s.push(t.on("moveend",()=>this._updateZOrder())),this.dispose(()=>ui(s))}add(t){const i=t instanceof kt?"div":"canvas";if(this._labelMap[i].has(t)){console.warn(`Label already exists in ${i} map`,t);return}const s=new p.Destroyable;{const o=s.dv(p.createNextAnimateFrameEvent(t.zOrderChanged,t.positionChanged));s.dispose(o.don(()=>this._updateZOrder()))}this._labelMap[i].set(t,()=>s.destroy()),this._updateZOrder()}delete(t){const i=t instanceof kt?"div":"canvas";if(!this._labelMap[i].has(t)){console.warn(`Label not found in ${i} map`,t);return}const s=this._labelMap[i].get(t);s==null||s(),this._labelMap[i].delete(t),this._updateZOrder()}_updateZOrder(){for(const t in this._labelMap)Object.prototype.hasOwnProperty.call(this._labelMap,t)&&this._updateLabelZOrder(this._labelMap[t],t)}_updateLabelZOrder(t,i){var a;const s={};for(const l of t.keys()){const c=l.zOrder.toString();s[c]||(s[c]=new globalThis.Map);const h=l instanceof kt&&l.olDivPoi?l.olDivPoi.depth:l instanceof Zi&&l.canvasObj&&((a=l.canvasObj.olCanvasPoi)==null?void 0:a.depth)||0;s[c].set(l,h)}const o=Object.keys(s).sort((l,c)=>i==="div"?Number(c)-Number(l):Number(l)-Number(c));let r=t.size;o.forEach(l=>{new globalThis.Map([...s[l]].sort((h,u)=>u[1]-h[1])).forEach((h,u)=>{var d;u instanceof kt&&u.olDivPoi?u.olDivPoi.zOrder=r:u instanceof Zi&&((d=u.canvasObj)!=null&&d.olCanvasPoi)&&(u.canvasObj.olCanvasPoi.zOrder=r),r--})})}}function Ph(n){return Array.isArray(n)?Math.min(...n):n}class rw extends Nd{constructor(e){super(e),this.image=null,this.renderedSourceRevision_=0}getImage(){return this.image?this.image.getImage():null}prepareFrame(e){const t=e.layerStatesArray[e.layerIndex],i=e.pixelRatio,s=e.viewState,o=s.resolution,r=this.getLayer().getSource(),a=e.viewHints;let l=e.extent;if(t.extent!==void 0&&(l=Bn(l,fi(t.extent,s.projection))),!a[ot.ANIMATING]&&!a[ot.INTERACTING]&&!zi(l))if(r){!this.getLayer().rendered&&this.renderedSourceRevision_!==r.getRevision()&&(this.image=null),this.renderedSourceRevision_=r.getRevision();const c=s.projection,h=r.getImage(l,o,i,c);h&&(this.loadImage(h)?this.image=h:h.getState()===le.EMPTY&&(this.image=null))}else this.image=null;return!!this.image}getData(e){const t=this.frameState;if(!t)return null;const i=this.getLayer(),s=_t(t.pixelToCoordinateTransform,e.slice()),o=i.getExtent();if(o&&!Zs(o,s))return null;const r=this.image.getExtent(),a=this.image.getImage(),l=Ie(r),c=Math.floor(a.width*((s[0]-r[0])/l));if(c<0||c>=a.width)return null;const h=lt(r),u=Math.floor(a.height*((r[3]-s[1])/h));return u<0||u>=a.height?null:this.getImageData(a,c,u)}renderFrame(e,t){const i=this.image,s=i.getExtent(),o=i.getResolution(),[r,a]=Array.isArray(o)?o:[o,o],l=i.getPixelRatio(),c=e.layerStatesArray[e.layerIndex],h=e.pixelRatio,u=e.viewState,d=u.center,f=u.resolution,g=h*r/(f*l),_=h*a/(f*l);this.prepareContainer(e,t);const v=this.context.canvas.width,E=this.context.canvas.height,w=this.getRenderContext(e);let C=!1,P=!0;if(c.extent){const z=fi(c.extent,u.projection);P=pt(z,e.extent),C=P&&!Di(z,e.extent),C&&this.clipUnrotated(w,e,z)}const R=i.getImage(),A=Hn(this.tempTransform,v/2,E/2,g,_,0,l*(s[0]-d[0])/r,l*(d[1]-s[3])/a);this.renderedResolution=a*h/l;const O=R.width*A[0],M=R.height*A[3];if(this.getLayer().getSource().getInterpolate()||(w.imageSmoothingEnabled=!1),this.preRender(w,e),P&&O>=.5&&M>=.5){const z=A[4],k=A[5],q=c.opacity;q!==1&&(w.save(),w.globalAlpha=q),w.drawImage(R,0,0,+R.width,+R.height,z,k,O,M),q!==1&&w.restore()}return this.postRender(this.context,e),C&&w.restore(),w.imageSmoothingEnabled=!0,this.container}}class QR extends rw{constructor(e){super(e),this.vectorRenderer_=new k0(e),this.layerImageRatio_=e.getImageRatio(),this.coordinateToVectorPixelTransform_=Kt(),this.renderedPixelToCoordinateTransform_=null}disposeInternal(){this.vectorRenderer_.dispose(),super.disposeInternal()}getFeatures(e){if(!this.vectorRenderer_)return Promise.resolve([]);const t=_t(this.coordinateToVectorPixelTransform_,_t(this.renderedPixelToCoordinateTransform_,e.slice()));return this.vectorRenderer_.getFeatures(t)}handleFontsChanged(){this.vectorRenderer_.handleFontsChanged()}prepareFrame(e){var h;const t=e.pixelRatio,i=e.viewState,s=i.resolution,o=e.viewHints,r=this.vectorRenderer_;let a=e.extent;this.layerImageRatio_!==1&&(a=a.slice(0),Ov(a,this.layerImageRatio_));const l=Ie(a)/s,c=lt(a)/s;if(!o[ot.ANIMATING]&&!o[ot.INTERACTING]&&!zi(a)){r.useContainer(null,null);const u=r.context,d=e.layerStatesArray[e.layerIndex],f=Object.assign({},d,{opacity:1}),g=Object.assign({},e,{extent:a,size:[l,c],viewState:Object.assign({},e.viewState,{rotation:0}),layerStatesArray:[f],layerIndex:0,declutter:null}),_=this.getLayer().getDeclutter();_&&(g.declutter={[_]:new Od(9)});const v=new oy(a,s,t,u.canvas,function(E){r.prepareFrame(g)&&r.replayGroupChanged&&(r.clipping=!1,r.renderFrame(g,null),r.renderDeclutter(g),r.renderDeferred(g),E())});v.addEventListener(we.CHANGE,()=>{if(v.getState()!==le.LOADED)return;this.image=v;const E=v.getPixelRatio(),w=Ph(v.getResolution())*t/E;this.renderedResolution=w,this.coordinateToVectorPixelTransform_=Hn(this.coordinateToVectorPixelTransform_,l/2,c/2,1/w,-1/w,0,-i.center[0],-i.center[1])}),v.load()}return this.image&&(this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice()),!((h=this.getLayer().getSource())!=null&&h.loading)&&!!this.image}preRender(){}postRender(){}renderDeclutter(){}forEachFeatureAtCoordinate(e,t,i,s,o){return this.vectorRenderer_?this.vectorRenderer_.forEachFeatureAtCoordinate(e,t,i,s,o):super.forEachFeatureAtCoordinate(e,t,i,s,o)}}class JR extends Uc{constructor(e){e=e||{};const t=Object.assign({},e);delete t.imageRatio,super(t),this.imageRatio_=e.imageRatio!==void 0?e.imageRatio:1}getImageRatio(){return this.imageRatio_}createRenderer(){return new QR(this)}}class aw extends p.Destroyable{constructor(t){super();I(this,"_map");this._map=t.viewer}async pickPosition(t){return new Promise(i=>{try{if(!this._map)return i(void 0);const s=this._map.getCoordinateFromPixel(t),[o,r]=Ft(s);i([o,r,0])}catch(s){return console.error(s),i(void 0)}})}async quickPickPosition(t){return await this.pickPosition(t)}async pick(t,i,s){return new Promise(o=>{try{if(!this._map)return o(void 0);const r=[];this._map.forEachFeatureAtPixel(t,(f,g)=>{console.log("forEachFeatureAtPixel",f,g),r.push([f,g])}),console.log("pickedObjects",r);const a=r.length>0?r[0]:void 0;if(!a)return o(void 0);const l=a[0].getId();if(!l)return o(void 0);let c=p.ESSceneObject.getSceneObjectById(l.toString());if(c&&c.parentID&&(c=p.ESSceneObject.getSceneObjectById(c.parentID)),!c)return o(void 0);console.log("sceneObject:",c);const h=new p.ESJPickedResult(a,c,void 0,void 0,s,t);return c&&Reflect.has(c,"allowPicking")&&Reflect.has(c,"pickedEvent")&&(c.allowPicking??!1)&&c.pickedEvent.emit(h),c&&Reflect.has(c,"allowPicking")&&!(c.allowPicking??!1)?o(new p.ESJPickedResult):o(h)}catch(r){return console.error(r),o(void 0)}})}_layerPickable(t){return!t||t instanceof Ts?!1:t instanceof Mn||t instanceof JR}_resolveSceneObject(t,i){var a,l;let s;const o=(a=t==null?void 0:t.get)==null?void 0:a.call(t,"ESSceneObjectID");if(typeof o=="string"&&(s=o),!s){const c=(l=i==null?void 0:i.get)==null?void 0:l.call(i,"ESSceneObjectID");typeof c=="string"&&(s=c)}let r=s?p.ESSceneObject.getSceneObject(s):void 0;return r&&r.parentID&&(r=p.ESSceneObject.getSceneObject(r.parentID)),r}_buildGeoJsonPickInfo(t,i,s){var h;const o=t.getGeometry(),r=((h=o==null?void 0:o.getType)==null?void 0:h.call(o))??"Point",a=t.getProperties?t.getProperties():{},{geometry:l,...c}=a||{};return r==="Point"?{type:"Point",coordinates:[i,s,0],properties:c}:{type:r,coordinates:void 0,properties:c}}}function Ki(n){return p.getExtProp(n,"_viewerExtensions")}function Sh(n,e){p.setExtProp(n,"_viewerExtensions",e)}class lw extends p.Destroyable{constructor(t,i){super();I(this,"_imageriesManager");I(this,"_labelManager");I(this,"_pickingManager");I(this,"_poiContext");I(this,"_cursorPositionInfo");this._viewer=t,this._olViewer=i,this._imageriesManager=this.dv(new sw(t)),this._labelManager=this.dv(new ow(t)),this._poiContext=this.disposeVar(new ew(this._viewer)),this._cursorPositionInfo=this.dv(new iw(t)),this.ad(i.viewerChanged.don(()=>{this._pickingManager=this.dv(new aw(i))}))}get viewer(){return this._viewer}get olViewer(){return this._olViewer}get imageriesManager(){return this._imageriesManager}get labelManager(){return this._labelManager}get pickingManager(){return this._pickingManager}get poiContext(){return this._poiContext}get cursorPositionInfo(){return this._cursorPositionInfo}}class eT extends p.Destroyable{constructor(e,t){super(),this._olViewer=e,this._viewer=t;const i=this._viewer,s=i.getView();{let o=this._olViewer.disabledInputStack===0;const r=()=>{var l;const a=this._olViewer.disabledInputStack===0;a!==o&&(o=a,a?this._olViewer.restoreMapInteraction():(this._olViewer.changeToMap(),(l=s.cancelAnimations)==null||l.call(s),this._olViewer.suspendMapInteraction()))};r(),this.dispose(this._olViewer.disabledInputStackChanged.don(r))}{const o=()=>{this._olViewer.cameraChanged.emit()},r=s.on("change:center",()=>o()),a=s.on("change:resolution",()=>o()),l=s.on("change:rotation",()=>o());this.d(()=>{ui([r,a,l])})}{let o=performance.now(),r=0;const a=()=>{var u;const c=performance.now();r++;const h=c-o;h>1e3&&(((u=this._olViewer._fps)==null?void 0:u.value)!==void 0&&(this._olViewer._fps.value=r*1e3/h|0),o=c,r=0)},l=i.on("postrender",a);this.d(()=>ui(l))}}get olViewer(){return this._olViewer}get viewer(){return this._viewer}}const Br=class Br extends p.ESViewer{constructor(t){super(t);I(this,"_viewer",this.dv(p.react(void 0)));I(this,"orbitController",null);I(this,"_fpsMonitor",null);I(this,"wasdController",null);I(this,"_disabledInputStack",this.disposeVar(p.react(0)));I(this,"_interactionBackup",null);I(this,"_notSupportEditingCount",this.disposeVar(p.react(0)));I(this,"_editingSystem",this.ad(_v()));if(t.type!==Br.type)throw new Error("option.type must be ESOlViewer");this.d(this._viewer.changed.don(i=>{this.viewerChanged.emit(i)})),this.dv(new p.ObjResettingWithEvent(this.viewerChanged,()=>{if(this.viewer)return new eT(this,this.viewer)})),this.dv(new p.ObjResettingWithEvent(this.subContainerChanged,()=>{if(this.setStatus("Raw"),this.setStatusLog(""),!!this.subContainer)return new UR(this.subContainer,this,i=>this._viewer.value=i)}))}get viewer(){return this._viewer.value}get extensions(){return this.viewer&&Ki(this.viewer)}get disabledInputStack(){return this._disabledInputStack.value}set disabledInputStack(t){this._disabledInputStack.value=t}get disabledInputStackChanged(){return this._disabledInputStack.changed}incrementDisabledInputStack(){++this._disabledInputStack.value}decrementDisabledInputStack(){--this._disabledInputStack.value}_suspendMapInteraction(){!this.viewer||this._interactionBackup||(this._interactionBackup=this.viewer.getInteractions().getArray().slice(),this.viewer.getInteractions().clear())}_restoreMapInteraction(){!this.viewer||!this._interactionBackup||(this._interactionBackup.forEach(t=>{var i;return(i=this.viewer)==null?void 0:i.getInteractions().push(t)}),this._interactionBackup=null)}restoreMapInteraction(){this._restoreMapInteraction()}suspendMapInteraction(){this._suspendMapInteraction()}_func(t=!1){return console.warn("ESOlViewer 暂未实现该方法!"),Promise.resolve(void 0)}setRotation(t){if(!this.viewer)return;this.viewer.getView().setRotation(t*Math.PI/180)}async pick(t,i,s){if(!this.extensions)return;const{pickingManager:o}=this.extensions;return await o.pick(t,void 0,i)}async pickPosition(t){if(!this.extensions)return;const{pickingManager:i}=this.extensions;return await i.pickPosition(t)}async quickPickPosition(t){if(!this.extensions)return;const{pickingManager:i}=this.extensions;return await i.quickPickPosition(t)}flyIn(t,i,s){if(!this.viewer)return;const o=mo(t[2]);this.viewer.getView().animate({center:Me([t[0],t[1]]),zoom:o,duration:(s??1)*1e3})}flyTo(t,i){if(!this.viewer)return;const s=mo(t.distance);this.viewer.getView().animate({center:Me([i[0],i[1]]),zoom:s,duration:(t.flyDuration??1)*1e3})}flyToBoundingSphere(t,i,s){if(!this.viewer)return;const o={_duration:(s??1)*1e3};console.log(t);const r=Me([t[0],t[1]]),a=Me([t[2],t[3]]);this.viewer.getView().fit(ud([r[0],r[1],a[0],a[1]]),{duration:o._duration,easing:Xs,padding:[10,10,10,10]})}async getTerrainHeight(t){return console.warn("openlayers不支持获取地形高度!"),0}getCurrentCameraInfo(){if(!this.viewer)return;const t=this.viewer.getView().getZoom();if(!t)return;const i=ka(t),s=this.viewer.getView().getCenter();if(!s)return;const o=Ft(s),r=this.viewer.getView().getRotation();return{position:[o[0],o[1],i],rotation:[0,r/(Math.PI/180),0]}}transformFlyParam(t,i){}calcFlyToParam(t){const i=this.getCurrentCameraInfo();if(!i)return;const{position:s,rotation:o}=i,r=p.geoRhumbDistance(s,t),a=t[0]-s[0],l=t[1]-s[1],h=Math.atan2(a,l)*180/Math.PI,u=t[2]-s[2],f=Math.atan2(u,r)*180/Math.PI,g=h+90;return{distance:r,heading:g,pitch:f,flyDuration:1,hDelta:-(o[0]-g),pDelta:o[1]-f}}getLengthInPixel(){if(this.viewer)return this.viewer.getView().getResolution()}changeToWalk(t){this.viewer&&(this.changeToMap(),this.container&&(this.wasdController=this.dv(new by(this.container,this.viewer,[t[0],t[1]]))))}changeToMap(){var t;this.wasdController&&(this.wasdController.destroy(),this.wasdController=null),this.orbitController&&(this.orbitController.stop(),this.orbitController=null,(t=this.viewer)==null||t.getView().setRotation(0))}changeToRotateGlobe(t,i,s){this.changeToMap(),console.warn("Openlayers引擎暂不支持全球旋转,已切换为Map模式")}changeToLine(t,i,s,o,r,a){this._func()}changeToUserDefined(t){this.changeToMap(),console.warn("Openlayers引擎暂不支持自定义漫游,已切换为Map模式")}changeToRotatePoint(t,i=5e4,s=60,o=90,r=0){if(!this.viewer)return;const a=this.viewer.getView();this.changeToMap();const l={_distance:i,_orbitPeriod:s*1e3,heading:o},c=mo(l._distance);a.setZoom(c),this.orbitController=vy(this.viewer,{center:[t[0],t[1]],orbitPeriod:l._orbitPeriod,heading:l.heading})}changeToFollow(t,i,s,o){this._func()}getFPS(){return this.viewer&&!this._fpsMonitor&&(this._fpsMonitor=this.dv(new Ey(this.viewer))),this._fpsMonitor?this._fpsMonitor.getFPS():0}async getVersion(){const t=window.g_XE3CopyRights??{};return t.openlayers=Lv,t}getHeightByLonLat(t,i,s){return console.warn("getHeightByLonLat is not supported in OpenLayers"),Promise.resolve(0)}getHeightsByLonLats(t,i){return console.warn("getHeightsByLonLats is not supported in OpenLayers"),Promise.resolve([])}async capture(t,i){if(this.viewer)return await wy(this.viewer,t,i)}lonLatAltToScreenPosition(t){var r;const i=[t[0],t[1]],s=Me(i),o=(r=this.viewer)==null?void 0:r.getPixelFromCoordinate(s);return o?Promise.resolve([o[0],o[1]]):Promise.resolve(void 0)}getBoundSphere(t){return this._func()}get notSupportEditingCount(){return this._notSupportEditingCount.value}set notSupportEditingCount(t){this._notSupportEditingCount.value=t}get notSupportEditingCountChanged(){return this._notSupportEditingCount.changed}startEditing(t,i,s){s=Object.assign({useKeyToSwitch:!0,callSource:"outer"},s);const o=t.components.main??t;o&&i!=null&&(o.editingID=`${s.callSource}_${p.createGuid()}`,this._editingSystem.restart(void 0,this,o,i,s.useKeyToSwitch))}stopEditing(){this._editingSystem.isRunning&&this._editingSystem.cancel()}moveObjects(t){this._func()}getViewExtent(){if(!this.viewer)return console.warn("ESOlViewer: OpenLayers viewer not initialized."),Promise.resolve(void 0);const i=this.viewer.getView().calculateExtent(this.viewer.getSize());if(console.log(i),!i)return Promise.resolve(void 0);const s=Ft([i[0],i[1]]),o=Ft([i[2],i[3]]),r=[s[0],s[1],o[0],o[1]];return console.log(r),Promise.resolve(r)}};I(Br,"type",Br.register("ESOlViewer",Br));let Ci=Br;(n=>{n.createDefaultProps=()=>({...p.ESViewer.createDefaultProps()})})(Ci||(Ci={})),p.extendClassProps(Ci.prototype,Ci.createDefaultProps);class tT extends Da{constructor(e){e=e||{},super(e)}}class np extends tT{constructor(e){super(e)}createRenderer(){return new rw(this)}getData(e){return super.getData(e)}}function ip(n){return n instanceof Image||n instanceof HTMLCanvasElement||n instanceof HTMLVideoElement||n instanceof ImageBitmap?n:null}const nT=new Error("disposed"),iT=[256,256];class cw extends Fa{constructor(e){const t=oe.IDLE;super(e.tileCoord,t,{transition:e.transition,interpolate:e.interpolate}),this.loader_=e.loader,this.data_=null,this.error_=null,this.size_=e.size||null,this.controller_=e.controller||null}getSize(){if(this.size_)return this.size_;const e=ip(this.data_);return e?[e.width,e.height]:iT}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==oe.IDLE&&this.state!==oe.ERROR)return;this.state=oe.LOADING,this.changed();const e=this;this.loader_().then(function(t){e.data_=t,e.state=oe.LOADED,e.changed()}).catch(function(t){e.error_=t,e.state=oe.ERROR,e.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(nT),this.controller_=null),super.disposeInternal()}}let sp;const Pr=[];function hw(n,e,t,i,s){n.beginPath(),n.moveTo(0,0),n.lineTo(e,t),n.lineTo(i,s),n.closePath(),n.save(),n.clip(),n.fillRect(0,0,Math.max(e,i)+1,Math.max(t,s)),n.restore()}function op(n,e){return Math.abs(n[e*4]-210)>2||Math.abs(n[e*4+3]-191.25)>2}function sT(){if(sp===void 0){const n=ht(6,6,Pr);n.globalCompositeOperation="lighter",n.fillStyle="rgba(210, 0, 0, 0.75)",hw(n,4,5,4,0),hw(n,4,5,0,5);const e=n.getImageData(0,0,3,3).data;sp=op(e,0)||op(e,4)||op(e,8),ca(n),Pr.push(n.canvas)}return sp}function Rh(n,e,t,i){const s=Zo(t,e,n);let o=Cm(e,i,t);const r=e.getMetersPerUnit();r!==void 0&&(o*=r);const a=n.getMetersPerUnit();a!==void 0&&(o/=a);const l=n.getExtent();if(!l||Zs(l,s)){const c=Cm(n,o,s)/o;isFinite(c)&&c>0&&(o/=c)}return o}function oT(n,e,t,i){const s=xn(t);let o=Rh(n,e,s,i);return(!isFinite(o)||o<=0)&&Kg(t,function(r){return o=Rh(n,e,r,i),isFinite(o)&&o>0}),o}function uw(n,e,t,i,s,o,r,a,l,c,h,u,d,f){const g=ht(Math.round(t*n),Math.round(t*e),Pr);if(u||(g.imageSmoothingEnabled=!1),l.length===0)return g.canvas;g.scale(t,t);function _(R){return Math.round(R*t)/t}g.globalCompositeOperation="lighter";const v=gn();l.forEach(function(R,A,O){Yg(v,R.extent)});let E;const w=t/i,C=(u?1:1+Math.pow(2,-24))/w;if(!d||l.length!==1||c!==0){if(E=ht(Math.round(Ie(v)*w),Math.round(lt(v)*w),Pr),u||(E.imageSmoothingEnabled=!1),s&&f){const R=(s[0]-v[0])*w,A=-(s[3]-v[3])*w,O=Ie(s)*w,M=lt(s)*w;E.rect(R,A,O,M),E.clip()}l.forEach(function(R,A,O){if(R.image.width>0&&R.image.height>0){if(R.clipExtent){E.save();const Y=(R.clipExtent[0]-v[0])*w,m=-(R.clipExtent[3]-v[3])*w,b=Ie(R.clipExtent)*w,S=lt(R.clipExtent)*w;E.rect(u?Y:Math.round(Y),u?m:Math.round(m),u?b:Math.round(Y+b)-Math.round(Y),u?S:Math.round(m+S)-Math.round(m)),E.clip()}const M=(R.extent[0]-v[0])*w,z=-(R.extent[3]-v[3])*w,k=Ie(R.extent)*w,q=lt(R.extent)*w;E.drawImage(R.image,c,c,R.image.width-2*c,R.image.height-2*c,u?M:Math.round(M),u?z:Math.round(z),u?k:Math.round(M+k)-Math.round(M),u?q:Math.round(z+q)-Math.round(z)),R.clipExtent&&E.restore()}})}const P=rn(r);return a.getTriangles().forEach(function(R,A,O){const M=R.source,z=R.target;let k=M[0][0],q=M[0][1],Y=M[1][0],m=M[1][1],b=M[2][0],S=M[2][1];const L=_((z[0][0]-P[0])/o),N=_(-(z[0][1]-P[1])/o),j=_((z[1][0]-P[0])/o),U=_(-(z[1][1]-P[1])/o),B=_((z[2][0]-P[0])/o),Z=_(-(z[2][1]-P[1])/o),G=k,ae=q;k=0,q=0,Y-=G,m-=ae,b-=G,S-=ae;const ne=[[Y,m,0,0,j-L],[b,S,0,0,B-L],[0,0,Y,m,U-N],[0,0,b,S,Z-N]],V=Dv(ne);if(!V)return;if(g.save(),g.beginPath(),sT()||!u){g.moveTo(j,U);const se=4,he=L-j,ye=N-U;for(let pe=0;pe<se;pe++)g.lineTo(j+_((pe+1)*he/se),U+_(pe*ye/(se-1))),pe!=se-1&&g.lineTo(j+_((pe+1)*he/se),U+_((pe+1)*ye/(se-1)));g.lineTo(B,Z)}else g.moveTo(j,U),g.lineTo(L,N),g.lineTo(B,Z);g.clip(),g.transform(V[0],V[2],V[1],V[3],L,N),g.translate(v[0]-G,v[3]-ae);let re;if(E)re=E.canvas,g.scale(C,-C);else{const se=l[0],he=se.extent;re=se.image,g.scale(Ie(he)/re.width,-lt(he)/re.height)}g.drawImage(re,0,0),g.restore()}),E&&(ca(E),Pr.push(E.canvas)),h&&(g.save(),g.globalCompositeOperation="source-over",g.strokeStyle="black",g.lineWidth=1,a.getTriangles().forEach(function(R,A,O){const M=R.target,z=(M[0][0]-P[0])/o,k=-(M[0][1]-P[1])/o,q=(M[1][0]-P[0])/o,Y=-(M[1][1]-P[1])/o,m=(M[2][0]-P[0])/o,b=-(M[2][1]-P[1])/o;g.beginPath(),g.moveTo(q,Y),g.lineTo(z,k),g.lineTo(m,b),g.closePath(),g.stroke()}),g.restore()),g.canvas}const rT=10,dw=.25;class fw{constructor(e,t,i,s,o,r,a){this.sourceProj_=e,this.targetProj_=t;let l={};const c=a?Hu(C=>_t(a,Zo(C,this.targetProj_,this.sourceProj_))):Ni(this.targetProj_,this.sourceProj_);this.transformInv_=function(C){const P=C[0]+"/"+C[1];return l[P]||(l[P]=c(C)),l[P]},this.maxSourceExtent_=s,this.errorThresholdSquared_=o*o,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&Ie(s)>=Ie(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Ie(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?Ie(this.targetProj_.getExtent()):null;const h=rn(i),u=Ql(i),d=Zl(i),f=Yl(i),g=this.transformInv_(h),_=this.transformInv_(u),v=this.transformInv_(d),E=this.transformInv_(f),w=rT+(r?Math.max(0,Math.ceil(Math.log2(Fu(i)/(r*r*256*256)))):0);if(this.addQuad_(h,u,d,f,g,_,v,E,w),this.wrapsXInSource_){let C=1/0;this.triangles_.forEach(function(P,R,A){C=Math.min(C,P.source[0][0],P.source[1][0],P.source[2][0])}),this.triangles_.forEach(P=>{if(Math.max(P.source[0][0],P.source[1][0],P.source[2][0])-C>this.sourceWorldWidth_/2){const R=[[P.source[0][0],P.source[0][1]],[P.source[1][0],P.source[1][1]],[P.source[2][0],P.source[2][1]]];R[0][0]-C>this.sourceWorldWidth_/2&&(R[0][0]-=this.sourceWorldWidth_),R[1][0]-C>this.sourceWorldWidth_/2&&(R[1][0]-=this.sourceWorldWidth_),R[2][0]-C>this.sourceWorldWidth_/2&&(R[2][0]-=this.sourceWorldWidth_);const A=Math.min(R[0][0],R[1][0],R[2][0]);Math.max(R[0][0],R[1][0],R[2][0])-A<this.sourceWorldWidth_/2&&(P.source=R)}})}l={}}addTriangle_(e,t,i,s,o,r){this.triangles_.push({source:[s,o,r],target:[e,t,i]})}addQuad_(e,t,i,s,o,r,a,l,c){const h=Hr([o,r,a,l]),u=this.sourceWorldWidth_?Ie(h)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,f=this.sourceProj_.canWrapX()&&u>.5&&u<1;let g=!1;if(c>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const v=Hr([e,t,i,s]);g=Ie(v)/this.targetWorldWidth_>dw||g}!f&&this.sourceProj_.isGlobal()&&u&&(g=u>dw||g)}if(!g&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3])&&!pt(h,this.maxSourceExtent_))return;let _=0;if(!g&&(!isFinite(o[0])||!isFinite(o[1])||!isFinite(r[0])||!isFinite(r[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(c>0)g=!0;else if(_=(!isFinite(o[0])||!isFinite(o[1])?8:0)+(!isFinite(r[0])||!isFinite(r[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),_!=1&&_!=2&&_!=4&&_!=8)return}if(c>0){if(!g){const v=[(e[0]+i[0])/2,(e[1]+i[1])/2],E=this.transformInv_(v);let w;f?w=(fs(o[0],d)+fs(a[0],d))/2-fs(E[0],d):w=(o[0]+a[0])/2-E[0];const C=(o[1]+a[1])/2-E[1];g=w*w+C*C>this.errorThresholdSquared_}if(g){if(Math.abs(e[0]-i[0])<=Math.abs(e[1]-i[1])){const v=[(t[0]+i[0])/2,(t[1]+i[1])/2],E=this.transformInv_(v),w=[(s[0]+e[0])/2,(s[1]+e[1])/2],C=this.transformInv_(w);this.addQuad_(e,t,v,w,o,r,E,C,c-1),this.addQuad_(w,v,i,s,C,E,a,l,c-1)}else{const v=[(e[0]+t[0])/2,(e[1]+t[1])/2],E=this.transformInv_(v),w=[(i[0]+s[0])/2,(i[1]+s[1])/2],C=this.transformInv_(w);this.addQuad_(e,v,w,s,o,E,C,l,c-1),this.addQuad_(v,t,i,w,E,r,a,C,c-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(_&11)==0&&this.addTriangle_(e,i,s,o,a,l),(_&14)==0&&this.addTriangle_(e,i,t,o,a,r),_&&((_&13)==0&&this.addTriangle_(t,s,e,r,l,o),(_&7)==0&&this.addTriangle_(t,s,i,r,l,a))}calculateSourceExtent(){const e=gn();return this.triangles_.forEach(function(t,i,s){const o=t.source;Xr(e,o[0]),Xr(e,o[1]),Xr(e,o[2])}),e}getTriangles(){return this.triangles_}}const pw=.5;class gw extends Fa{constructor(e,t,i,s,o,r,a,l,c,h,u,d){super(o,oe.IDLE,d),this.renderEdges_=u!==void 0?u:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=t,this.targetTileGrid_=s,this.wrappedTileCoord_=r||o,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=e.canWrapX()?e.getExtent():void 0;const f=s.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let _=this.sourceTileGrid_.getExtent();const v=g?Bn(f,g):f;if(Fu(v)===0){this.state=oe.EMPTY;return}const E=e.getExtent();E&&(_?_=Bn(_,E):_=E);const w=s.getResolution(this.wrappedTileCoord_[0]),C=oT(e,i,v,w);if(!isFinite(C)||C<=0){this.state=oe.EMPTY;return}const P=h!==void 0?h:pw;if(this.triangulation_=new fw(e,i,v,_,C*P,w),this.triangulation_.getTriangles().length===0){this.state=oe.EMPTY;return}this.sourceZ_=t.getZForResolution(C);let R=this.triangulation_.calculateSourceExtent();if(_&&(e.canWrapX()?(R[1]=ct(R[1],_[1],_[3]),R[3]=ct(R[3],_[1],_[3])):R=Bn(R,_)),!Fu(R))this.state=oe.EMPTY;else{let A=0,O=0;e.canWrapX()&&(A=Ie(E),O=Math.floor((R[0]-E[0])/A)),tm(R.slice(),e,!0).forEach(z=>{const k=t.getTileRangeForExtentAndZ(z,this.sourceZ_);for(let q=k.minX;q<=k.maxX;q++)for(let Y=k.minY;Y<=k.maxY;Y++){const m=O*A;this.sourceTiles_.push({getTile:()=>c(this.sourceZ_,q,Y,a),offset:m})}++O}),this.sourceTiles_.length===0&&(this.state=oe.EMPTY)}}getImage(){return this.canvas_}reproject_(){const e=[];if(this.sourceTiles_.forEach(t=>{var s;const i=t.tile;if(i&&i.getState()==oe.LOADED){const o=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);o[0]+=t.offset,o[2]+=t.offset;const r=(s=this.clipExtent_)==null?void 0:s.slice();r&&(r[0]+=t.offset,r[2]+=t.offset),e.push({extent:o,clipExtent:r,image:i.getImage()})}}),this.sourceTiles_.length=0,e.length===0)this.state=oe.ERROR;else{const t=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(t),s=typeof i=="number"?i:i[0],o=typeof i=="number"?i:i[1],r=this.targetTileGrid_.getResolution(t),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=uw(s,o,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),r,l,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=oe.LOADED}this.changed()}load(){for(const e of this.sourceTiles_)e.tile=e.getTile();if(this.state==oe.IDLE){this.state=oe.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:t})=>{const i=t.getState();if(i==oe.IDLE||i==oe.LOADING){e++;const s=qe(t,we.CHANGE,o=>{const r=t.getState();(r==oe.LOADED||r==oe.ERROR||r==oe.EMPTY)&&(st(s),e--,e===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(s)}}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:t},i,s){t.getState()==oe.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(st),this.sourcesListenerKeys_=null}release(){this.canvas_&&(ca(this.canvas_.getContext("2d")),Pr.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}}class mw{constructor(e){this.highWaterMark=e!==void 0?e:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const e=this.pop();e instanceof Zr&&e.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){const i=this.entries_[e];return Be(i!==void 0,"Tried to get a value for a key that does not exist in the cache"),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_}remove(e){const t=this.entries_[e];return Be(t!==void 0,"Tried to get a value for a key that does not exist in the cache"),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){const e=new Array(this.count_);let t=0,i;for(i=this.newest_;i;i=i.older)e[t++]=i.key_;return e}getValues(){const e=new Array(this.count_);let t=0,i;for(i=this.newest_;i;i=i.older)e[t++]=i.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){var t;return(t=this.entries_[e])==null?void 0:t.value_}pop(){const e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){Be(!(e in this.entries_),"Tried to set a value for a key that is used already");const i={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[e]=i,++this.count_}setSize(e){this.highWaterMark=e}}function Th(n,e,t,i){return i!==void 0?(i[0]=n,i[1]=e,i[2]=t,i):[n,e,t]}function aT(n,e,t){return n+"/"+e+"/"+t}function Ih(n,e,t,i,s){return`${Re(n)},${e},${aT(t,i,s)}`}function yw(n){return lT(n[0],n[1],n[2])}function lT(n,e,t){return(e<<n)+t}function cT(n,e){const t=n[0],i=n[1],s=n[2];if(e.getMinZoom()>t||t>e.getMaxZoom())return!1;const o=e.getFullTileRange(t);return o?o.containsXY(i,s):!0}function rp(n,e,t){if(!(t in n))return n[t]=new Set([e]),!0;const i=n[t],s=i.has(e);return s||i.add(e),!s}function hT(n,e,t){const i=n[t];return i?i.delete(e):!1}function _w(n,e){const t=n.layerStatesArray[n.layerIndex];t.extent&&(e=Bn(e,fi(t.extent,n.viewState.projection)));const i=t.layer.getRenderSource();if(!i.getWrapX()){const s=i.getTileGridForProjection(n.viewState.projection).getExtent();s&&(e=Bn(e,s))}return e}class ww extends Nd{constructor(e,t){super(e),t=t||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=gn(),this.tempTileRange_=new sf(0,0,0,0),this.tempTileCoord_=Th(0,0,0);const i=t.cacheSize!==void 0?t.cacheSize:512;this.tileCache_=new mw(i),this.sourceTileCache_=null,this.maxStaleKeys=i*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new mw(512)),this.sourceTileCache_}getOrCreateTile(e,t,i,s){const o=this.tileCache_,a=this.getLayer().getSource(),l=Ih(a,a.getKey(),e,t,i);let c;if(o.containsKey(l))c=o.get(l);else{const h=s.viewState.projection,u=a.getProjection();if(c=a.getTile(e,t,i,s.pixelRatio,h,!u||Wt(u,h)?void 0:this.getSourceTileCache()),!c)return null;o.set(l,c)}return c}getTile(e,t,i,s){const o=this.getOrCreateTile(e,t,i,s);return o||null}getData(e){const t=this.frameState;if(!t)return null;const i=this.getLayer(),s=_t(t.pixelToCoordinateTransform,e.slice()),o=i.getExtent();if(o&&!Zs(o,s))return null;const r=t.viewState,a=i.getRenderSource(),l=a.getTileGridForProjection(r.projection),c=a.getTilePixelRatio(t.pixelRatio);for(let h=l.getZForResolution(r.resolution);h>=l.getMinZoom();--h){const u=l.getTileCoordForCoordAndZ(s,h),d=this.getTile(h,u[1],u[2],t);if(!d||d.getState()!==oe.LOADED)continue;const f=l.getOrigin(h),g=Bt(l.getTileSize(h)),_=l.getResolution(h);let v;if(d instanceof ry||d instanceof gw)v=d.getImage();else if(d instanceof cw){if(v=ip(d.getData()),!v)continue}else continue;const E=Math.floor(c*((s[0]-f[0])/_-u[1]*g[0])),w=Math.floor(c*((f[1]-s[1])/_-u[2]*g[1])),C=Math.round(c*a.getGutterForProjection(r.projection));return this.getImageData(v,E+C,w+C)}return null}prepareFrame(e){var s;this.renderedProjection?e.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=e.viewState.projection):this.renderedProjection=e.viewState.projection;const t=this.getLayer().getSource();if(!t)return!1;const i=t.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==i&&(this.renderedSourceRevision_=i,this.renderedSourceKey_===t.getKey()&&(this.tileCache_.clear(),(s=this.sourceTileCache_)==null||s.clear())):this.renderedSourceRevision_=i,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(e,t,i,s,o){const r=e.viewState,a=this.getLayer(),l=a.getRenderSource(),c=l.getTileGridForProjection(r.projection),h=Re(l);h in e.wantedTiles||(e.wantedTiles[h]={});const u=e.wantedTiles[h],d=a.getMapInternal(),f=Math.max(i-o,c.getMinZoom(),c.getZForResolution(Math.min(a.getMaxResolution(),d?d.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):c.getResolution(0)),l.zDirection)),g=r.rotation,_=g?Qg(r.center,r.resolution,g,e.size):void 0;for(let v=i;v>=f;--v){const E=c.getTileRangeForExtentAndZ(t,v,this.tempTileRange_),w=c.getResolution(v);for(let C=E.minX;C<=E.maxX;++C)for(let P=E.minY;P<=E.maxY;++P){if(g&&!c.tileCoordIntersectsViewport([v,C,P],_))continue;const R=this.getTile(v,C,P,e);if(!R||!rp(s,R,v))continue;const O=R.getKey();if(u[O]=!0,R.getState()===oe.IDLE&&!e.tileQueue.isKeyQueued(O)){const M=Th(v,C,P,this.tempTileCoord_);e.tileQueue.enqueue([R,h,c.getTileCoordCenter(M),w])}}}}findStaleTile_(e,t){const i=this.tileCache_,s=e[0],o=e[1],r=e[2],a=this.getStaleKeys();for(let l=0;l<a.length;++l){const c=Ih(this.getLayer().getSource(),a[l],s,o,r);if(i.containsKey(c)){const h=i.peek(c);if(h.getState()===oe.LOADED)return h.endTransition(Re(this)),rp(t,h,s),!0}}return!1}findAltTiles_(e,t,i,s){const o=e.getTileRangeForTileCoordAndZ(t,i,this.tempTileRange_);if(!o)return!1;let r=!0;const a=this.tileCache_,l=this.getLayer().getRenderSource(),c=l.getKey();for(let h=o.minX;h<=o.maxX;++h)for(let u=o.minY;u<=o.maxY;++u){const d=Ih(l,c,i,h,u);let f=!1;if(a.containsKey(d)){const g=a.peek(d);g.getState()===oe.LOADED&&(rp(s,g,i),f=!0)}f||(r=!1)}return r}renderFrame(e,t){this.renderComplete=!0;const i=e.layerStatesArray[e.layerIndex],s=e.viewState,o=s.projection,r=s.resolution,a=s.center,l=e.pixelRatio,c=this.getLayer(),h=c.getSource(),u=h.getTileGridForProjection(o),d=u.getZForResolution(r,h.zDirection),f=u.getResolution(d),g=h.getKey();this.renderedSourceKey_?this.renderedSourceKey_!==g&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=g):this.renderedSourceKey_=g;let _=e.extent;const v=h.getTilePixelRatio(l);this.prepareContainer(e,t);const E=this.context.canvas.width,w=this.context.canvas.height,C=i.extent&&fi(i.extent);C&&(_=Bn(_,fi(i.extent)));const P=f*E/2/v,R=f*w/2/v,A=[a[0]-P,a[1]-R,a[0]+P,a[1]+R],O={};this.renderedTiles.length=0;const M=c.getPreload();if(e.nextExtent&&this.enqueueTilesForNextExtent()){const j=u.getZForResolution(s.nextResolution,h.zDirection),U=_w(e,e.nextExtent);this.enqueueTiles(e,U,j,O,M)}const z=_w(e,_);if(this.enqueueTiles(e,z,d,O,0),M>0&&setTimeout(()=>{this.enqueueTiles(e,z,d-1,O,M-1)},0),!(d in O))return this.container;const k=Re(this),q=e.time;for(const j of O[d]){const U=j.getState();if(U===oe.EMPTY)continue;const B=j.tileCoord;if(U===oe.LOADED&&j.getAlpha(k,q)===1){j.endTransition(k);continue}if(U!==oe.ERROR&&(this.renderComplete=!1),this.findStaleTile_(B,O)){hT(O,j,d),e.animate=!0;continue}if(this.findAltTiles_(u,B,d+1,O))continue;const ae=u.getMinZoom();for(let ne=d-1;ne>=ae&&!this.findAltTiles_(u,B,ne,O);--ne);}const Y=f/r*l/v,m=this.getRenderContext(e);Hn(this.tempTransform,E/2,w/2,Y,Y,0,-E/2,-w/2),i.extent&&this.clipUnrotated(m,e,C),h.getInterpolate()||(m.imageSmoothingEnabled=!1),this.preRender(m,e);const b=Object.keys(O).map(Number);b.sort(li);let S;const L=[],N=[];for(let j=b.length-1;j>=0;--j){const U=b[j],B=h.getTilePixelSize(U,l,o),G=u.getResolution(U)/f,ae=B[0]*G*Y,ne=B[1]*G*Y,V=u.getTileCoordForCoordAndZ(rn(A),U),re=u.getTileCoordExtent(V),se=_t(this.tempTransform,[v*(re[0]-A[0])/f,v*(A[3]-re[3])/f]),he=v*h.getGutterForProjection(o);for(const ye of O[U]){if(ye.getState()!==oe.LOADED)continue;const pe=ye.tileCoord,Fe=V[1]-pe[1],je=Math.round(se[0]-(Fe-1)*ae),ee=V[2]-pe[2],ft=Math.round(se[1]-(ee-1)*ne),rt=Math.round(se[0]-Fe*ae),_e=Math.round(se[1]-ee*ne),tn=je-rt,Ut=ft-_e,yt=b.length===1;let At=!1;S=[rt,_e,rt+tn,_e,rt+tn,_e+Ut,rt,_e+Ut];for(let et=0,jn=L.length;et<jn;++et)if(!yt&&U<N[et]){const nt=L[et];pt([rt,_e,rt+tn,_e+Ut],[nt[0],nt[3],nt[4],nt[7]])&&(At||(m.save(),At=!0),m.beginPath(),m.moveTo(S[0],S[1]),m.lineTo(S[2],S[3]),m.lineTo(S[4],S[5]),m.lineTo(S[6],S[7]),m.moveTo(nt[6],nt[7]),m.lineTo(nt[4],nt[5]),m.lineTo(nt[2],nt[3]),m.lineTo(nt[0],nt[1]),m.clip())}L.push(S),N.push(U),this.drawTile(ye,e,rt,_e,tn,Ut,he,yt),At&&m.restore(),this.renderedTiles.unshift(ye),this.updateUsedTiles(e.usedTiles,h,ye)}}if(this.renderedResolution=f,this.extentChanged=!this.renderedExtent_||!Li(this.renderedExtent_,A),this.renderedExtent_=A,this.renderedPixelRatio=l,this.postRender(this.context,e),i.extent&&m.restore(),m.imageSmoothingEnabled=!0,this.renderComplete){const j=(U,B)=>{var ne;const Z=Re(h),G=B.wantedTiles[Z],ae=G?Object.keys(G).length:0;this.updateCacheSize(ae),this.tileCache_.expireCache(),(ne=this.sourceTileCache_)==null||ne.expireCache()};e.postRenderFunctions.push(j)}return this.container}updateCacheSize(e){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,e*2)}drawTile(e,t,i,s,o,r,a,l){let c;if(e instanceof cw){if(c=ip(e.getData()),!c)throw new Error("Rendering array data is not yet supported")}else c=this.getTileImage(e);if(!c)return;const h=this.getRenderContext(t),u=Re(this),d=t.layerStatesArray[t.layerIndex],f=d.opacity*(l?e.getAlpha(u,t.time):1),g=f!==h.globalAlpha;g&&(h.save(),h.globalAlpha=f),h.drawImage(c,a,a,c.width-2*a,c.height-2*a,i,s,o,r),g&&h.restore(),f!==d.opacity?t.animate=!0:l&&e.endTransition(u)}getImage(){const e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}updateUsedTiles(e,t,i){const s=Re(t);s in e||(e[s]={}),e[s][i.getKey()]=!0}}const ks={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class uT extends Da{constructor(e){e=e||{};const t=Object.assign({},e),i=e.cacheSize;delete e.cacheSize,delete t.preload,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=i,this.setPreload(e.preload!==void 0?e.preload:0),this.setUseInterimTilesOnError(e.useInterimTilesOnError!==void 0?e.useInterimTilesOnError:!0)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(ks.PRELOAD)}setPreload(e){this.set(ks.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(ks.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(ks.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}}class Oh extends uT{constructor(e){super(e)}createRenderer(){return new ww(this,{cacheSize:this.getCacheSize()})}}class dT extends vc{constructor(e,t,i,s,o,r,a){let l=e.getExtent();l&&e.canWrapX()&&(l=l.slice(),l[0]=-1/0,l[2]=1/0);let c=t.getExtent();c&&t.canWrapX()&&(c=c.slice(),c[0]=-1/0,c[2]=1/0);const h=c?Bn(i,c):i,u=xn(h),d=Rh(e,t,u,s),f=pw,g=new fw(e,t,h,l,d*f,s),_=g.calculateSourceExtent(),v=zi(_)?null:r(_,d,o),E=v?le.IDLE:le.EMPTY,w=v?v.getPixelRatio():1;super(i,s,w,E),this.targetProj_=t,this.maxSourceExtent_=l,this.triangulation_=g,this.targetResolution_=s,this.targetExtent_=i,this.sourceImage_=v,this.sourcePixelRatio_=w,this.interpolate_=a,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==le.LOADING&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const e=this.sourceImage_.getState();if(e==le.LOADED){const t=Ie(this.targetExtent_)/this.targetResolution_,i=lt(this.targetExtent_)/this.targetResolution_;this.canvas_=uw(t,i,this.sourcePixelRatio_,Ph(this.sourceImage_.getResolution()),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.interpolate_,!0)}this.state=e,this.changed()}load(){if(this.state==le.IDLE){this.state=le.LOADING,this.changed();const e=this.sourceImage_.getState();e==le.LOADED||e==le.ERROR?this.reproject_():(this.sourceListenerKey_=qe(this.sourceImage_,we.CHANGE,t=>{const i=this.sourceImage_.getState();(i==le.LOADED||i==le.ERROR)&&(this.unlistenSource_(),this.reproject_())}),this.sourceImage_.load())}}unlistenSource_(){st(this.sourceListenerKey_),this.sourceListenerKey_=null}}const Sr=4,ap={IMAGELOADSTART:"imageloadstart",IMAGELOADEND:"imageloadend",IMAGELOADERROR:"imageloaderror"};class fT extends $n{constructor(e,t){super(e),this.image=t}}class lp extends Ca{constructor(e){super({attributions:e.attributions,projection:e.projection,state:e.state,interpolate:e.interpolate!==void 0?e.interpolate:!0}),this.on,this.once,this.un,this.loader=e.loader||null,this.resolutions_=e.resolutions!==void 0?e.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0,this.image=null,this.wantedExtent_,this.wantedResolution_,this.static_=e.loader?e.loader.length===0:!1,this.wantedProjection_=null}getResolutions(){return this.resolutions_}setResolutions(e){this.resolutions_=e}findNearestResolution(e){const t=this.getResolutions();if(t){const i=Xl(t,e,0);e=t[i]}return e}getImage(e,t,i,s){const o=this.getProjection();if(!o||!s||Wt(o,s))return o&&(s=o),this.getImageInternal(e,t,i,s);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&Wt(this.reprojectedImage_.getProjection(),s)&&this.reprojectedImage_.getResolution()==t&&Li(this.reprojectedImage_.getExtent(),e))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new dT(o,s,e,t,i,(r,a,l)=>this.getImageInternal(r,a,l,o),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(e,t,i,s){if(this.loader){const o=gT(e,t,i,1),r=this.findNearestResolution(t);if(this.image&&(this.static_||this.wantedProjection_===s&&(this.wantedExtent_&&Di(this.wantedExtent_,o)||Di(this.image.getExtent(),o))&&(this.wantedResolution_&&Ph(this.wantedResolution_)===r||Ph(this.image.getResolution())===r)))return this.image;this.wantedProjection_=s,this.wantedExtent_=o,this.wantedResolution_=r,this.image=new vc(o,r,i,this.loader),this.image.addEventListener(we.CHANGE,this.handleImageChange.bind(this))}return this.image}handleImageChange(e){const t=e.target;let i;switch(t.getState()){case le.LOADING:this.loading=!0,i=ap.IMAGELOADSTART;break;case le.LOADED:this.loading=!1,i=ap.IMAGELOADEND;break;case le.ERROR:this.loading=!1,i=ap.IMAGELOADERROR;break;default:return}this.hasListener(i)&&this.dispatchEvent(new fT(i,t))}}function pT(n,e){n.getImage().src=e}function gT(n,e,t,i){const s=e/t,o=xn(n),r=ps(Ie(n)/s,Sr),a=ps(lt(n)/s,Sr),l=ps((i-1)*r/2,Sr),c=r+2*l,h=ps((i-1)*a/2,Sr),u=a+2*h;return Kl(o,s,0,[c,u])}function mT(n){const e=n.load||Jm,t=n.imageExtent,i=n.crossOrigin??null;return()=>{const s=new Image;return s.crossOrigin=i,n.referrerPolicy!==void 0&&(s.referrerPolicy=n.referrerPolicy),e(s,n.url).then(o=>{const r=Ie(t)/o.width,a=lt(t)/o.height;return{image:o,extent:t,resolution:r!==a?[r,a]:a,pixelRatio:1}})}}class vw extends lp{constructor(e){const t=e.crossOrigin!==void 0?e.crossOrigin:null,i=e.imageLoadFunction!==void 0?e.imageLoadFunction:pT;super({attributions:e.attributions,interpolate:e.interpolate,projection:Ne(e.projection)}),this.url_=e.url,this.imageExtent_=e.imageExtent,this.image=null,this.image=new vc(this.imageExtent_,void 0,1,mT({url:e.url,imageExtent:e.imageExtent,crossOrigin:t,referrerPolicy:e.referrerPolicy,load:(s,o)=>(this.image.setImage(s),i(this.image,o),Jm(s))})),this.image.addEventListener(we.CHANGE,this.handleImageChange.bind(this))}getImageExtent(){return this.imageExtent_}getImageInternal(e,t,i,s){return pt(e,this.image.getExtent())?this.image:null}getUrl(){return this.url_}}const Rr=[0,0,0],js=5;class Us{constructor(e){this.minZoom=e.minZoom!==void 0?e.minZoom:0,this.resolutions_=e.resolutions,Be(Pv(this.resolutions_,(s,o)=>o-s),"`resolutions` must be sorted in descending order");let t;if(!e.origins){for(let s=0,o=this.resolutions_.length-1;s<o;++s)if(!t)t=this.resolutions_[s]/this.resolutions_[s+1];else if(this.resolutions_[s]/this.resolutions_[s+1]!==t){t=void 0;break}}this.zoomFactor_=t,this.maxZoom=this.resolutions_.length-1,this.origin_=e.origin!==void 0?e.origin:null,this.origins_=null,e.origins!==void 0&&(this.origins_=e.origins,Be(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const i=e.extent;i!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=rn(i)),Be(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,e.tileSizes!==void 0&&(this.tileSizes_=e.tileSizes,Be(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=e.tileSize!==void 0?e.tileSize:this.tileSizes_?null:$d,Be(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=i!==void 0?i:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],e.sizes!==void 0?this.fullTileRanges_=e.sizes.map((s,o)=>{const r=new sf(Math.min(0,s[0]),Math.max(s[0]-1,-1),Math.min(0,s[1]),Math.max(s[1]-1,-1));if(i){const a=this.getTileRangeForExtentAndZ(i,o);r.minX=Math.max(a.minX,r.minX),r.maxX=Math.min(a.maxX,r.maxX),r.minY=Math.max(a.minY,r.minY),r.maxY=Math.min(a.maxY,r.maxY)}return r}):i&&this.calculateTileRanges_(i)}forEachTileCoord(e,t,i){const s=this.getTileRangeForExtentAndZ(e,t);for(let o=s.minX,r=s.maxX;o<=r;++o)for(let a=s.minY,l=s.maxY;a<=l;++a)i([t,o,a])}forEachTileCoordParentTileRange(e,t,i,s){let o,r,a,l=null,c=e[0]-1;for(this.zoomFactor_===2?(r=e[1],a=e[2]):l=this.getTileCoordExtent(e,s);c>=this.minZoom;){if(r!==void 0&&a!==void 0?(r=Math.floor(r/2),a=Math.floor(a/2),o=cr(r,r,a,a,i)):o=this.getTileRangeForExtentAndZ(l,c,i),t(c,o))return!0;--c}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_[e]}getOrigins(){return this.origins_}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,t,i){if(e[0]<this.maxZoom){if(this.zoomFactor_===2){const o=e[1]*2,r=e[2]*2;return cr(o,o+1,r,r+1,t)}const s=this.getTileCoordExtent(e,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(s,e[0]+1,t)}return null}getTileRangeForTileCoordAndZ(e,t,i){if(t>this.maxZoom||t<this.minZoom)return null;const s=e[0],o=e[1],r=e[2];if(t===s)return cr(o,r,o,r,i);if(this.zoomFactor_){const l=Math.pow(this.zoomFactor_,t-s),c=Math.floor(o*l),h=Math.floor(r*l);if(t<s)return cr(c,c,h,h,i);const u=Math.floor(l*(o+1))-1,d=Math.floor(l*(r+1))-1;return cr(c,u,h,d,i)}const a=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,t,i)}getTileRangeForExtentAndZ(e,t,i){this.getTileCoordForXYAndZ_(e[0],e[3],t,!1,Rr);const s=Rr[1],o=Rr[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,Rr);const r=Rr[1],a=Rr[2];return cr(s,r,o,a,i)}getTileCoordCenter(e){const t=this.getOrigin(e[0]),i=this.getResolution(e[0]),s=Bt(this.getTileSize(e[0]),this.tmpSize_);return[t[0]+(e[1]+.5)*s[0]*i,t[1]-(e[2]+.5)*s[1]*i]}getTileCoordExtent(e,t){const i=this.getOrigin(e[0]),s=this.getResolution(e[0]),o=Bt(this.getTileSize(e[0]),this.tmpSize_),r=i[0]+e[1]*o[0]*s,a=i[1]-(e[2]+1)*o[1]*s,l=r+o[0]*s,c=a+o[1]*s;return Fi(r,a,l,c,t)}getTileCoordForCoordAndResolution(e,t,i){return this.getTileCoordForXYAndResolution_(e[0],e[1],t,!1,i)}getTileCoordForXYAndResolution_(e,t,i,s,o){const r=this.getZForResolution(i),a=i/this.getResolution(r),l=this.getOrigin(r),c=Bt(this.getTileSize(r),this.tmpSize_);let h=a*(e-l[0])/i/c[0],u=a*(l[1]-t)/i/c[1];return s?(h=ps(h,js)-1,u=ps(u,js)-1):(h=Jl(h,js),u=Jl(u,js)),Th(r,h,u,o)}getTileCoordForXYAndZ_(e,t,i,s,o){const r=this.getOrigin(i),a=this.getResolution(i),l=Bt(this.getTileSize(i),this.tmpSize_);let c=(e-r[0])/a/l[0],h=(r[1]-t)/a/l[1];return s?(c=ps(c,js)-1,h=ps(h,js)-1):(c=Jl(c,js),h=Jl(h,js)),Th(i,c,h,o)}getTileCoordForCoordAndZ(e,t,i){return this.getTileCoordForXYAndZ_(e[0],e[1],t,!1,i)}getTileCoordResolution(e){return this.resolutions_[e[0]]}getTileSize(e){return this.tileSize_?this.tileSize_:this.tileSizes_[e]}getFullTileRange(e){return this.fullTileRanges_?this.fullTileRanges_[e]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,e):null}getZForResolution(e,t){const i=Xl(this.resolutions_,e,t||0);return ct(i,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return Um(t,0,t.length,2,this.getTileCoordExtent(e))}calculateTileRanges_(e){const t=this.resolutions_.length,i=new Array(t);for(let s=this.minZoom;s<t;++s)i[s]=this.getTileRangeForExtentAndZ(e,s);this.fullTileRanges_=i}}class yT extends Us{constructor(e){super({extent:e.extent,origin:e.origin,origins:e.origins,resolutions:e.resolutions,tileSize:e.tileSize,tileSizes:e.tileSizes,sizes:e.sizes}),this.matrixIds_=e.matrixIds}getMatrixId(e){return this.matrixIds_[e]}getMatrixIds(){return this.matrixIds_}}function cp(n){let e=n.getDefaultTileGrid();return e||(e=vT(n),n.setDefaultTileGrid(e)),e}function _T(n,e,t){const i=e[0],s=n.getTileCoordCenter(e),o=Qa(t);if(!Zs(o,s)){const r=Ie(o),a=Math.ceil((o[0]-s[0])/r);return s[0]+=r*a,n.getTileCoordForCoordAndZ(s,i)}return e}function wT(n,e,t,i){i=i!==void 0?i:"top-left";const s=bw(n,e,t);return new Us({extent:n,origin:Tv(n,i),resolutions:s,tileSize:t})}function Tr(n){const e=n||{},t=e.extent||Ne("EPSG:3857").getExtent(),i={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:bw(t,e.maxZoom,e.tileSize,e.maxResolution)};return new Us(i)}function bw(n,e,t,i){e=e!==void 0?e:ny,t=Bt(t!==void 0?t:$d);const s=lt(n),o=Ie(n);i=i>0?i:Math.max(o/t[0],s/t[1]);const r=e+1,a=new Array(r);for(let l=0;l<r;++l)a[l]=i/Math.pow(2,l);return a}function vT(n,e,t,i){const s=Qa(n);return wT(s,e,t,i)}function Qa(n){n=Ne(n);let e=n.getExtent();if(!e){const t=180*ic.degrees/n.getMetersPerUnit();e=Fi(-t,-t,t,t)}return e}class Ew extends Ca{constructor(e){super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX,interpolate:e.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=e.tilePixelRatio!==void 0?e.tilePixelRatio:1,this.tileGrid=e.tileGrid!==void 0?e.tileGrid:null;const t=[256,256];this.tileGrid&&Bt(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),t),this.tmpSize=[0,0],this.key_=e.key||Re(this),this.tileOptions={transition:e.transition,interpolate:e.interpolate},this.zDirection=e.zDirection?e.zDirection:0}getGutterForProjection(e){return 0}getKey(){return this.key_}setKey(e){this.key_!==e&&(this.key_=e,this.changed())}getResolutions(e){const t=e?this.getTileGridForProjection(e):this.tileGrid;return t?t.getResolutions():null}getTile(e,t,i,s,o,r){return be()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:cp(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,i){const s=this.getTileGridForProjection(i),o=this.getTilePixelRatio(t),r=Bt(s.getTileSize(e),this.tmpSize);return o==1?r:DE(r,o,this.tmpSize)}getTileCoordForTileUrlFunction(e,t){const i=t!==void 0?t:this.getProjection(),s=t!==void 0?this.getTileGridForProjection(i):this.tileGrid||this.getTileGridForProjection(i);return this.getWrapX()&&i.isGlobal()&&(e=_T(s,e,i)),cT(e,s)?e:null}clear(){}refresh(){this.clear(),super.refresh()}}class bT extends $n{constructor(e,t){super(e),this.tile=t}}function Cw(n){return function(e){const t=e.buffers,i=e.meta,s=e.imageOps,o=e.width,r=e.height,a=t.length,l=t[0].byteLength;if(s){const d=new Array(a);for(let g=0;g<a;++g)d[g]=new ImageData(new Uint8ClampedArray(t[g]),o,r);return n(d,i).data.buffer}const c=new Uint8ClampedArray(l),h=new Array(a),u=new Array(a);for(let d=0;d<a;++d)h[d]=new Uint8ClampedArray(t[d]),u[d]=[0,0,0,0];for(let d=0;d<l;d+=4){for(let g=0;g<a;++g){const _=h[g];u[g][0]=_[d],u[g][1]=_[d+1],u[g][2]=_[d+2],u[g][3]=_[d+3]}const f=n(u,i);c[d]=f[0],c[d+1]=f[1],c[d+2]=f[2],c[d+3]=f[3]}return c.buffer}}function ET(n,e){const i=Object.keys(n.lib||{}).map(function(o){return"const "+o+" = "+n.lib[o].toString()+";"}).concat(["const __minion__ = ("+Cw.toString()+")(",n.operation.toString(),");",'self.addEventListener("message", function(event) {'," const buffer = __minion__(event.data);"," self.postMessage({buffer: buffer, meta: event.data.meta}, [buffer]);","});"]),s=new Worker(typeof Blob>"u"?"data:text/javascript;base64,"+Buffer.from(i.join(`
156
+ `),"binary").toString("base64"):URL.createObjectURL(new Blob(i,{type:"text/javascript"})));return s.addEventListener("message",e),s}function CT(n,e){const t=Cw(n.operation);let i=!1;return{postMessage:function(s){setTimeout(function(){i||e({data:{buffer:t(s),meta:s.meta}})},0)},terminate:function(){i=!0}}}class xT extends Zr{constructor(e){super(),this.imageOps_=!!e.imageOps;let t;e.threads===0?t=0:this.imageOps_?t=1:t=e.threads||1;const i=new Array(t);if(t)for(let s=0;s<t;++s)i[s]=ET(e,this.onWorkerMessage_.bind(this,s));else i[0]=CT(e,this.onWorkerMessage_.bind(this,0));this.workers_=i,this.queue_=[],this.maxQueueLength_=e.queue||1/0,this.running_=0,this.dataLookup_={},this.job_=null}process(e,t,i){this.enqueue_({inputs:e,meta:t,callback:i}),this.dispatch_()}enqueue_(e){for(this.queue_.push(e);this.queue_.length>this.maxQueueLength_;)this.queue_.shift().callback(null,null)}dispatch_(){if(this.running_||this.queue_.length===0)return;const e=this.queue_.shift();this.job_=e;const t=e.inputs[0].width,i=e.inputs[0].height,s=e.inputs.map(function(l){return l.data.buffer}),o=this.workers_.length;if(this.running_=o,o===1){this.workers_[0].postMessage({buffers:s,meta:e.meta,imageOps:this.imageOps_,width:t,height:i},s);return}const r=e.inputs[0].data.length,a=4*Math.ceil(r/4/o);for(let l=0;l<o;++l){const c=l*a,h=[];for(let u=0,d=s.length;u<d;++u)h.push(s[u].slice(c,c+a));this.workers_[l].postMessage({buffers:h,meta:e.meta,imageOps:this.imageOps_,width:t,height:i},h)}}onWorkerMessage_(e,t){this.disposed||(this.dataLookup_[e]=t.data,--this.running_,this.running_===0&&this.resolveJob_())}resolveJob_(){const e=this.job_,t=this.workers_.length;let i,s;if(t===1)i=new Uint8ClampedArray(this.dataLookup_[0].buffer),s=this.dataLookup_[0].meta;else{const o=e.inputs[0].data.length;i=new Uint8ClampedArray(o),s=new Array(t);const r=4*Math.ceil(o/4/t);for(let a=0;a<t;++a){const l=this.dataLookup_[a].buffer,c=a*r;i.set(new Uint8ClampedArray(l),c),s[a]=this.dataLookup_[a].meta}}this.job_=null,this.dataLookup_={},e.callback(null,new ImageData(i,e.inputs[0].width,e.inputs[0].height),s),this.dispatch_()}disposeInternal(){for(let e=0;e<this.workers_.length;++e)this.workers_[e].terminate();this.workers_.length=0}}const xw={BEFOREOPERATIONS:"beforeoperations",AFTEROPERATIONS:"afteroperations"};class Pw extends $n{constructor(e,t,i){super(e),this.extent=t.extent,this.resolution=t.viewState.resolution/t.pixelRatio,this.data=i}}class hp extends lp{constructor(e){super({projection:null}),this.on,this.once,this.un,this.processor_=null,this.operationType_=e.operationType!==void 0?e.operationType:"pixel",this.threads_=e.threads!==void 0?e.threads:1,this.layers_=RT(e.sources);const t=this.changed.bind(this);for(let i=0,s=this.layers_.length;i<s;++i)this.layers_[i].addEventListener(we.CHANGE,t);this.useResolutions_=e.resolutions!==null,this.tileQueue_=new ay(function(){return 1},this.processSources_.bind(this)),this.requestedFrameState_,this.renderedImageCanvas_=null,this.renderedRevision_,this.frameState_={animate:!1,coordinateToPixelTransform:Kt(),declutter:null,extent:null,index:0,layerIndex:0,layerStatesArray:ST(this.layers_),pixelRatio:1,pixelToCoordinateTransform:Kt(),postRenderFunctions:[],size:[0,0],tileQueue:this.tileQueue_,time:Date.now(),usedTiles:{},viewState:{rotation:0},viewHints:[],wantedTiles:{},mapId:Re(this),renderTargets:{}},this.setAttributions(function(i){var o;const s=[];for(let r=0,a=e.sources.length;r<a;++r){const l=e.sources[r],c=l instanceof Ca?l:l.getSource();if(!c)continue;const h=(o=c.getAttributions())==null?void 0:o(i);typeof h=="string"?s.push(h):h!==void 0&&s.push(...h)}return s}),e.operation!==void 0&&this.setOperation(e.operation,e.lib)}setOperation(e,t){this.processor_&&this.processor_.dispose(),this.processor_=new xT({operation:e,imageOps:this.operationType_==="image",queue:1,lib:t,threads:this.threads_}),this.changed()}updateFrameState_(e,t,i){const s=Object.assign({},this.frameState_);s.viewState=Object.assign({},s.viewState);const o=xn(e);s.size[0]=Math.ceil(Ie(e)/t),s.size[1]=Math.ceil(lt(e)/t),s.extent=[o[0]-s.size[0]*t/2,o[1]-s.size[1]*t/2,o[0]+s.size[0]*t/2,o[1]+s.size[1]*t/2],s.time=Date.now();const r=s.viewState;return r.center=o,r.projection=i,r.resolution=t,s}allSourcesReady_(){let e=!0,t;for(let i=0,s=this.layers_.length;i<s;++i)if(t=this.layers_[i].getSource(),!t||t.getState()!=="ready"){e=!1;break}return e}getImage(e,t,i,s){if(!this.allSourcesReady_())return null;this.tileQueue_.loadMoreTiles(16,16),t=this.findNearestResolution(t);const o=this.updateFrameState_(e,t,s);if(this.requestedFrameState_=o,this.renderedImageCanvas_){const r=this.renderedImageCanvas_.getResolution(),a=this.renderedImageCanvas_.getExtent();(t!==r||!Li(o.extent,a))&&(this.renderedImageCanvas_=null)}return(!this.renderedImageCanvas_||this.getRevision()!==this.renderedRevision_)&&this.processSources_(),o.animate&&requestAnimationFrame(this.changed.bind(this)),this.renderedImageCanvas_}processSources_(){const e=this.requestedFrameState_,t=this.layers_.length,i=new Array(t);for(let o=0;o<t;++o){e.layerIndex=o,e.renderTargets={};const r=PT(this.layers_[o],e);if(r)i[o]=r;else return}const s={};this.dispatchEvent(new Pw(xw.BEFOREOPERATIONS,e,s)),this.processor_.process(i,s,this.onWorkerComplete_.bind(this,e))}onWorkerComplete_(e,t,i,s){if(t||!i)return;const o=e.extent,r=e.viewState.resolution;if(r!==this.requestedFrameState_.viewState.resolution||!Li(o,this.requestedFrameState_.extent))return;let a;if(this.renderedImageCanvas_)a=this.renderedImageCanvas_.getImage().getContext("2d");else{const l=Math.round(Ie(o)/r),c=Math.round(lt(o)/r);a=ht(l,c),this.renderedImageCanvas_=new oy(o,r,1,a.canvas)}a.putImageData(i,0,0),e.animate?requestAnimationFrame(this.changed.bind(this)):this.changed(),this.renderedRevision_=this.getRevision(),this.dispatchEvent(new Pw(xw.AFTEROPERATIONS,e,s))}getResolutions(e){if(!this.useResolutions_)return null;let t=super.getResolutions();if(!t)for(let i=0,s=this.layers_.length;i<s&&(t=this.layers_[i].getSource().getResolutions(e),!t);++i);return t}disposeInternal(){this.processor_&&this.processor_.dispose(),super.disposeInternal()}}hp.prototype.dispose;let bo=null;function PT(n,e){const t=n.getRenderer();if(!t)throw new Error("Unsupported layer type: "+n);if(!t.prepareFrame(e))return null;const i=e.size[0],s=e.size[1];if(i===0||s===0)return null;const o=t.renderFrame(e,null);let r;if(o instanceof HTMLCanvasElement)r=o;else{if(o&&(r=o.firstElementChild),!(r instanceof HTMLCanvasElement))throw new Error("Unsupported rendered element: "+r);if(r.width===i&&r.height===s)return r.getContext("2d").getImageData(0,0,i,s)}if(!bo)bo=ht(i,s,void 0,{willReadFrequently:!0});else{const a=bo.canvas;a.width!==i||a.height!==s?bo=ht(i,s,void 0,{willReadFrequently:!0}):bo.clearRect(0,0,i,s)}return bo.drawImage(r,0,0,i,s),bo.getImageData(0,0,i,s)}function ST(n){return n.map(function(e){return e.getLayerState()})}function RT(n){const e=n.length,t=new Array(e);for(let i=0;i<e;++i)t[i]=TT(n[i]);return t}function TT(n){let e;return n instanceof Ca?n instanceof Ew?e=new Oh({source:n}):n instanceof lp&&(e=new np({source:n})):e=n,e}function Ah(n,e){const t=[];Object.keys(e).forEach(function(s){e[s]!==null&&e[s]!==void 0&&t.push(s+"="+encodeURIComponent(e[s]))});const i=t.join("&");return n=n.replace(/[?&]$/,""),n+=n.includes("?")?"&":"?",n+i}const IT=/\{z\}/g,OT=/\{x\}/g,AT=/\{y\}/g,MT=/\{-y\}/g;function DT(n,e,t,i,s){return n.replace(IT,e.toString()).replace(OT,t.toString()).replace(AT,i.toString()).replace(MT,function(){if(s===void 0)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(s-i).toString()})}function Sw(n){const e=[];let t=/\{([a-z])-([a-z])\}/.exec(n);if(t){const i=t[1].charCodeAt(0),s=t[2].charCodeAt(0);let o;for(o=i;o<=s;++o)e.push(n.replace(t[0],String.fromCharCode(o)));return e}if(t=/\{(\d+)-(\d+)\}/.exec(n),t){const i=parseInt(t[2],10);for(let s=parseInt(t[1],10);s<=i;s++)e.push(n.replace(t[0],s.toString()));return e}return e.push(n),e}function FT(n,e){return(function(t,i,s){if(!t)return;let o;const r=t[0];if(e){const a=e.getFullTileRange(r);a&&(o=a.getHeight()-1)}return DT(n,r,t[1],t[2],o)})}function Rw(n,e){const t=n.length,i=new Array(t);for(let s=0;s<t;++s)i[s]=FT(n[s],e);return up(i)}function up(n){return n.length===1?n[0]:(function(e,t,i){if(!e)return;const s=yw(e),o=fs(s,n.length);return n[o](e,t,i)})}const dp={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};class Mh extends Ew{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tilePixelRatio:e.tilePixelRatio,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===Mh.prototype.tileUrlFunction,this.tileLoadFunction=e.tileLoadFunction,e.tileUrlFunction&&(this.tileUrlFunction=e.tileUrlFunction),this.urls=null,e.urls?this.setUrls(e.urls):e.url&&this.setUrl(e.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(e){const t=e.target,i=Re(t),s=t.getState();let o;s==oe.LOADING?(this.tileLoadingKeys_[i]=!0,o=dp.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],o=s==oe.ERROR?dp.TILELOADERROR:s==oe.LOADED?dp.TILELOADEND:void 0),o!=null&&this.dispatchEvent(new bT(o,t))}setTileLoadFunction(e){this.tileLoadFunction=e,this.changed()}setTileUrlFunction(e,t){this.tileUrlFunction=e,typeof t<"u"?this.setKey(t):this.changed()}setUrl(e){const t=Sw(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;const t=e.join(`
157
+ `);this.generateTileUrlFunction_?this.setTileUrlFunction(Rw(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,i){}}class Dh extends Mh{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:LT,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate!==void 0?e.interpolate:!0,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.crossOrigin=e.crossOrigin!==void 0?e.crossOrigin:null,this.referrerPolicy=e.referrerPolicy,this.tileClass=e.tileClass!==void 0?e.tileClass:ry,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!Wt(this.getProjection(),e)?0:this.getGutter()}getGutter(){return 0}getKey(){let e=super.getKey();return this.getInterpolate()||(e+=":disable-interpolation"),e}getTileGridForProjection(e){const t=this.getProjection();if(this.tileGrid&&(!t||Wt(t,e)))return this.tileGrid;const i=Re(e);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=cp(e)),this.tileGridForProjection[i]}createTile_(e,t,i,s,o,r){const a=[e,t,i],l=this.getTileCoordForTileUrlFunction(a,o),c=l?this.tileUrlFunction(l,s,o):void 0,h=new this.tileClass(a,c!==void 0?oe.IDLE:oe.EMPTY,c!==void 0?c:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return h.key=r,h.addEventListener(we.CHANGE,this.handleTileChange.bind(this)),h}getTile(e,t,i,s,o,r){const a=this.getProjection();if(!a||!o||Wt(a,o))return this.getTileInternal(e,t,i,s,a||o);const l=[e,t,i],c=this.getKey(),h=this.getTileGridForProjection(a),u=this.getTileGridForProjection(o),d=this.getTileCoordForTileUrlFunction(l,o),f=new gw(a,h,o,u,l,d,this.getTilePixelRatio(s),this.getGutter(),(g,_,v,E)=>this.getTileInternal(g,_,v,E,a,r),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return f.key=c,f}getTileInternal(e,t,i,s,o,r){const a=this.getKey(),l=Ih(this,a,e,t,i);if(r&&r.containsKey(l))return r.get(l);const c=this.createTile_(e,t,i,s,o,a);return r==null||r.set(l,c),c}setRenderReprojectionEdges(e){this.renderReprojectionEdges_!=e&&(this.renderReprojectionEdges_=e,this.changed())}setTileGridForProjection(e,t){const i=Ne(e);if(i){const s=Re(i);s in this.tileGridForProjection||(this.tileGridForProjection[s]=t)}}}function LT(n,e){if(ln){const t=n.getCrossOrigin();let i="same-origin",s="same-origin";t==="anonymous"||t===""?(i="cors",s="omit"):t==="use-credentials"&&(i="cors",s="include");const o={mode:i,credentials:s,referrerPolicy:n.getReferrerPolicy()};fetch(e,o).then(r=>{if(!r.ok)throw new Error(`HTTP ${r.status}`);return r.blob()}).then(r=>createImageBitmap(r)).then(r=>{var c;const a=n.getImage();a.width=r.width,a.height=r.height,a.getContext("2d").drawImage(r,0,0),(c=r.close)==null||c.call(r),a.dispatchEvent(new Event("load"))}).catch(()=>{n.getImage().dispatchEvent(new Event("error"))});return}n.getImage().src=e}const fp="1.3.0";function zT(n,e,t,i,s){s.WIDTH=t[0],s.HEIGHT=t[1];const o=i.getAxisOrientation(),r=cm(s.VERSION,"1.3")>=0;s[r?"CRS":"SRS"]=i.getCode();const a=r&&o.startsWith("ne")?[e[1],e[0],e[3],e[2]]:e;return s.BBOX=a.join(","),Ah(n,s)}function NT(n,e,t,i,s,o,r){o=Object.assign({REQUEST:"GetMap"},o);const a=e/t,l=[im(Ie(n)/a,Sr),im(lt(n)/a,Sr)];if(t!=1)switch(r){case"geoserver":const h=90*t+.5|0;"FORMAT_OPTIONS"in o?o.FORMAT_OPTIONS+=";dpi:"+h:o.FORMAT_OPTIONS="dpi:"+h;break;case"mapserver":o.MAP_RESOLUTION=90*t;break;case"carmentaserver":case"qgis":o.DPI=90*t;break;default:throw new Error("Unknown `serverType` configured")}return zT(s,n,l,i,o)}function Tw(n,e){return Object.assign({REQUEST:e,SERVICE:"WMS",VERSION:fp,FORMAT:"image/png",STYLES:"",TRANSPARENT:"TRUE"},n)}class kT extends Dh{constructor(e){e=e||{};const t=Object.assign({},e.params);super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,projection:e.projection,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileClass:e.tileClass,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction,url:e.url,urls:e.urls,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,zDirection:e.zDirection}),this.gutter_=e.gutter!==void 0?e.gutter:0,this.params_=t,this.v13_=!0,this.serverType_=e.serverType,this.hidpi_=e.hidpi!==void 0?e.hidpi:!0,this.tmpExtent_=gn(),this.updateV13_(),this.setKey(this.getKeyForParams_())}getFeatureInfoUrl(e,t,i,s){const o=Ne(i),r=this.getProjection()||o;let a=this.getTileGrid();a||(a=this.getTileGridForProjection(r));const l=Zo(e,o,r),c=Rh(r,o,e,t),h=a.getZForResolution(c,this.zDirection),u=a.getResolution(h),d=a.getTileCoordForCoordAndZ(l,h);if(a.getResolutions().length<=d[0])return;let f=a.getTileCoordExtent(d,this.tmpExtent_);const g=this.gutter_;g!==0&&(f=hi(f,u*g,f));const _={QUERY_LAYERS:this.params_.LAYERS};Object.assign(_,Tw(this.params_,"GetFeatureInfo"),s);const v=Math.floor((l[0]-f[0])/u),E=Math.floor((f[3]-l[1])/u);return _[this.v13_?"I":"X"]=v,_[this.v13_?"J":"Y"]=E,this.getRequestUrl_(d,f,1,r||o,_)}getLegendUrl(e,t){if(this.urls[0]===void 0)return;const i={SERVICE:"WMS",VERSION:fp,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(t===void 0||t.LAYER===void 0){const s=this.params_.LAYERS;if(!(!Array.isArray(s)||s.length===1))return;i.LAYER=s}if(e!==void 0){const s=this.getProjection()?this.getProjection().getMetersPerUnit():1,o=28e-5;i.SCALE=e*s/o}return Object.assign(i,t),Ah(this.urls[0],i)}getGutter(){return this.gutter_}getParams(){return this.params_}getRequestUrl_(e,t,i,s,o){const r=this.urls;if(!r)return;let a;if(r.length==1)a=r[0];else{const l=fs(yw(e),r.length);a=r[l]}return NT(t,(this.tileGrid||this.getTileGridForProjection(s)).getResolution(e[0]),i,s,a,o,this.serverType_)}getTilePixelRatio(e){return!this.hidpi_||this.serverType_===void 0?1:e}getKeyForParams_(){let e=0;const t=[];for(const i in this.params_)t[e++]=i+"-"+this.params_[i];return t.join("/")}setParams_(e){this.params_=e,this.updateV13_(),this.setKey(this.getKeyForParams_())}setParams(e){this.setParams_(Object.assign({},e))}updateParams(e){this.setParams_(Object.assign(this.params_,e))}updateV13_(){const e=this.params_.VERSION||fp;this.v13_=cm(e,"1.3")>=0}tileUrlFunction(e,t,i){let s=this.getTileGrid();if(s||(s=this.getTileGridForProjection(i)),s.getResolutions().length<=e[0])return;t!=1&&(!this.hidpi_||this.serverType_===void 0)&&(t=1);const o=s.getResolution(e[0]);let r=s.getTileCoordExtent(e,this.tmpExtent_);const a=this.gutter_;a!==0&&(r=hi(r,o*a,r));const l=Object.assign({},Tw(this.params_,"GetMap"));return this.getRequestUrl_(e,r,t,i,l)}}class jT extends Dh{constructor(e){const t=e.requestEncoding!==void 0?e.requestEncoding:"KVP",i=e.tileGrid;let s=e.urls;s===void 0&&e.url!==void 0&&(s=Sw(e.url)),super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,referrerPolicy:e.referrerPolicy,interpolate:e.interpolate,projection:e.projection,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileClass:e.tileClass,tileGrid:i,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,urls:s,wrapX:e.wrapX!==void 0?e.wrapX:!1,transition:e.transition,zDirection:e.zDirection}),this.version_=e.version!==void 0?e.version:"1.0.0",this.format_=e.format!==void 0?e.format:"image/jpeg",this.dimensions_=e.dimensions!==void 0?e.dimensions:{},this.layer_=e.layer,this.matrixSet_=e.matrixSet,this.style_=e.style,this.requestEncoding_=t,this.setKey(this.getKeyForDimensions_()),s&&s.length>0&&(this.tileUrlFunction=up(s.map(this.createFromWMTSTemplate.bind(this))))}setUrls(e){this.urls=e;const t=e.join(`
158
+ `);this.setTileUrlFunction(up(e.map(this.createFromWMTSTemplate.bind(this))),t)}getDimensions(){return this.dimensions_}getFormat(){return this.format_}getLayer(){return this.layer_}getMatrixSet(){return this.matrixSet_}getRequestEncoding(){return this.requestEncoding_}getStyle(){return this.style_}getVersion(){return this.version_}getKeyForDimensions_(){const e=this.urls?this.urls.slice(0):[];for(const t in this.dimensions_)e.push(t+"-"+this.dimensions_[t]);return e.join("/")}updateDimensions(e){Object.assign(this.dimensions_,e),this.setKey(this.getKeyForDimensions_())}createFromWMTSTemplate(e){const t=this.requestEncoding_,i={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};t=="KVP"&&Object.assign(i,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),e=t=="KVP"?Ah(e,i):e.replace(/\{(\w+?)\}/g,function(r,a){return a.toLowerCase()in i?i[a.toLowerCase()]:r});const s=this.tileGrid,o=this.dimensions_;return(function(r,a,l){if(!r)return;const c={TileMatrix:s.getMatrixId(r[0]),TileCol:r[1],TileRow:r[2]};Object.assign(c,o);let h=e;return t=="KVP"?h=Ah(h,c):h=h.replace(/\{(\w+?)\}/g,function(u,d){return encodeURIComponent(c[d])}),h})}}class Fh extends Dh{constructor(e){e=e||{};const t=e.projection!==void 0?e.projection:"EPSG:3857",i=e.tileGrid!==void 0?e.tileGrid:Tr({extent:Qa(t),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize});super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,referrerPolicy:e.referrerPolicy,interpolate:e.interpolate,projection:t,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.gutter_=e.gutter!==void 0?e.gutter:0}getGutter(){return this.gutter_}}const UT={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},Iw={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};class GT extends ww{constructor(e,t){super(e,t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=Kt(),this.tileClipContexts_=null}enqueueTilesForNextExtent(){return this.getLayer().getRenderMode()!=="vector"}drawTile(e,t,i,s,o,r,a,l){this.updateExecutorGroup_(e,t.pixelRatio,t.viewState.projection),this.tileImageNeedsRender_(e)&&this.renderTileImage_(e,t),super.drawTile(e,t,i,s,o,r,a,l)}getTile(e,t,i,s){const o=this.getOrCreateTile(e,t,i,s);if(!o)return null;const r=s.viewState,a=r.resolution,l=s.viewHints,c=this.getLayer().getSource(),h=c.getTileGridForProjection(r.projection),u=!(l[ot.ANIMATING]||l[ot.INTERACTING]),d=h.getZForResolution(a,c.zDirection)===e;return u&&d?o.wantedResolution=a:o.wantedResolution||(o.wantedResolution=h.getResolution(e)),o}prepareFrame(e){const t=this.getLayer().getRevision();return this.renderedLayerRevision_!==t&&(this.renderedLayerRevision_=t,this.renderedTiles.length=0),super.prepareFrame(e)}updateExecutorGroup_(e,t,i){const s=this.getLayer(),o=s.getRevision(),r=s.getRenderOrder()||null,a=e.wantedResolution,l=e.getReplayState(s);if(!l.dirty&&l.renderedResolution===a&&l.renderedRevision==o&&l.renderedPixelRatio===t&&l.renderedRenderOrder==r)return;const c=s.getSource(),h=!!s.getDeclutter(),u=c.getTileGrid(),f=c.getTileGridForProjection(i).getTileCoordExtent(e.wrappedTileCoord),g=c.getSourceTiles(t,i,e),_=Re(s);delete e.hitDetectionImageData[_],e.executorGroups[_]=[],l.dirty=!1;for(let v=0,E=g.length;v<E;++v){const w=g[v];if(w.getState()!=oe.LOADED)continue;const C=c.getProjection(),P=w.tileCoord;let R=u.getTileCoordExtent(P);i&&C&&!Wt(i,C)&&(R=oa(R,C,i,32));const A=Bn(f,R),O=hi(A,s.getRenderBuffer()*a,this.tempExtent),M=Li(R,A)?null:O,z=new R0(0,A,a,t),k=Pc(a,t),q=function(L,N){let j;const U=L.getStyleFunction()||s.getStyleFunction();if(U&&(j=U(L,a)),j){const B=this.renderFeature(L,k,j,z,h,N);l.dirty=l.dirty||B}},Y=w.getFeatures();r&&r!==l.renderedRenderOrder&&Y.sort(r);for(let L=0,N=Y.length;L<N;++L){let j=Y[L];i&&w.projection&&!Wt(i,w.projection)&&(j=j.clone(),j.getGeometry().applyTransform(Ni(w.projection,i))),(!M||pt(M,j.getGeometry().getExtent()))&&q.call(this,j,L)}const m=z.finish(),b=s.getRenderMode()!=="vector"&&h&&g.length===1?null:A,S=new M0(b,a,t,c.getOverlaps(),m,s.getRenderBuffer(),!0);e.executorGroups[_].push(S)}l.renderedRevision=o,l.renderedPixelRatio=t,l.renderedRenderOrder=r,l.renderedResolution=a}forEachFeatureAtCoordinate(e,t,i,s,o){var C,P;const r=t.viewState.resolution,a=t.viewState.rotation;i=i??0;const l=this.getLayer(),h=l.getSource().getTileGridForProjection(t.viewState.projection),u=Hr([e]);hi(u,r*i,u);const d={},f=function(R,A,O){let M=R.getId();M===void 0&&(M=Re(R));const z=d[M];if(z){if(z!==!0&&O<z.distanceSq){if(O===0)return d[M]=!0,o.splice(o.lastIndexOf(z),1),s(R,l,A);z.geometry=A,z.distanceSq=O}}else{if(O===0)return d[M]=!0,s(R,l,A);o.push(d[M]={feature:R,layer:l,geometry:A,distanceSq:O,callback:s})}},g=this.renderedTiles,_=Re(l),v=l.getDeclutter(),E=v?(P=(C=t.declutter)==null?void 0:C[v])==null?void 0:P.all().map(R=>R.value):null;let w;e:for(let R=0,A=g.length;R<A;++R){const O=g[R],M=h.getTileCoordExtent(O.wrappedTileCoord);if(!pt(M,u))continue;const z=O.executorGroups[_];for(let k=0,q=z.length;k<q;++k)if(w=z[k].forEachFeatureAtCoordinate(e,r,a,i,f,E),w)break e}return w}getFeatures(e){return this.renderedTiles.length===0?Promise.resolve([]):new Promise((t,i)=>{const s=this.getLayer(),o=s.getSource(),r=this.renderedProjection,a=r.getExtent(),l=this.renderedResolution,c=o.getTileGridForProjection(r),h=_t(this.renderedPixelToCoordinateTransform_,e.slice()),u=c.getTileCoordForCoordAndResolution(h,l).toString(),d=this.renderedTiles.find(C=>C.tileCoord.toString()===u&&C.getState()===oe.LOADED);if(!d||d.loadingSourceTiles>0){t([]);return}o.getWrapX()&&r.canWrapX()&&!Di(a,c.getTileCoordExtent(d.tileCoord))&&ju(h,r);const f=Re(s),g=c.getTileCoordExtent(d.wrappedTileCoord),_=rn(g),v=[(h[0]-_[0])/l,(_[1]-h[1])/l],E=d.getSourceTiles().reduce((C,P)=>C.concat(P.getFeatures()),[]);let w=d.hitDetectionImageData[f];if(!w){const C=Bt(c.getTileSize(c.getZForResolution(l,o.zDirection))),P=this.renderedRotation_,R=[this.getRenderTransform(c.getTileCoordCenter(d.wrappedTileCoord),l,0,wn,C[0]*wn,C[1]*wn,0)];w=F0(C,R,E,s.getStyleFunction(),c.getTileCoordExtent(d.wrappedTileCoord),d.getReplayState(s).renderedResolution,P),d.hitDetectionImageData[f]=w}t(L0(v,E,w))})}getFeaturesInExtent(e){const t=[],i=this.getTileCache();if(i.getCount()===0)return t;const o=this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),r=o.getZForResolution(this.renderedResolution),a={};return i.forEach(l=>{if(l.tileCoord[0]!==r||l.getState()!==oe.LOADED)return;const c=l.getSourceTiles();for(let h=0,u=c.length;h<u;++h){const d=c[h],f=d.getKey();if(f in a)continue;a[f]=!0;const g=d.tileCoord;if(pt(e,o.getTileCoordExtent(g))){const _=d.getFeatures();if(_)for(let v=0,E=_.length;v<E;++v){const w=_[v],C=w.getGeometry();pt(e,C.getExtent())&&t.push(w)}}}}),t}handleFontsChanged(){const e=this.getLayer();e.getVisible()&&this.renderedLayerRevision_!==void 0&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}renderDeclutter(e,t){var d;const i=this.context,s=i.globalAlpha;i.globalAlpha=t.opacity;const o=e.viewHints,r=!(o[ot.ANIMATING]||o[ot.INTERACTING]),a=[this.context.canvas.width,this.context.canvas.height],l=this.getLayer().getDeclutter(),c=l?(d=e.declutter)==null?void 0:d[l]:void 0,h=Re(this.getLayer()),u=this.renderedTiles;for(let f=0,g=u.length;f<g;++f){const _=u[f],v=_.executorGroups[h];if(v)for(let E=v.length-1;E>=0;--E)v[E].execute(this.context,a,this.getTileRenderTransform(_,e),e.viewState.rotation,r,Dc,c)}i.globalAlpha=s}renderDeferredInternal(e){const t=this.renderedTiles,i=Re(this.getLayer()),s=t.reduce((l,c,h)=>(c.executorGroups[i].forEach(u=>l.push({executorGroup:u,index:h})),l),[]),o=s.map(({executorGroup:l})=>l.getDeferredZIndexContexts()),r={};for(let l=0,c=s.length;l<c;++l){const h=s[l].executorGroup.getDeferredZIndexContexts();for(const u in h)r[u]=!0}Object.keys(r).map(Number).sort(li).forEach(l=>{o.forEach((c,h)=>{c[l]&&(c[l].forEach(u=>{const{executorGroup:d,index:f}=s[h],g=d.getRenderedContext(),_=g.globalAlpha;g.globalAlpha=this.renderedOpacity_;const v=this.tileClipContexts_[f];v&&v.draw(g),u.draw(g),v&&g.restore(),g.globalAlpha=_,u.clear()}),c[l].length=0)})})}getTileRenderTransform(e,t){const i=t.pixelRatio,s=t.viewState,o=s.center,r=s.resolution,a=s.rotation,l=t.size,c=Math.round(l[0]*i),h=Math.round(l[1]*i),d=this.getLayer().getSource().getTileGridForProjection(t.viewState.projection),f=e.tileCoord,g=d.getTileCoordExtent(e.wrappedTileCoord),_=d.getTileCoordExtent(f,this.tempExtent)[0]-g[0];return hc(Qu(this.inversePixelTransform.slice(),1/i,1/i),this.getRenderTransform(o,r,a,i,c,h,_))}postRender(e,t){var R;const i=t.viewHints,s=!(i[ot.ANIMATING]||i[ot.INTERACTING]);this.renderedPixelToCoordinateTransform_=t.pixelToCoordinateTransform.slice(),this.renderedRotation_=t.viewState.rotation,this.renderedOpacity_=t.layerStatesArray[t.layerIndex].opacity;const o=this.getLayer(),r=o.getRenderMode(),a=e.globalAlpha;e.globalAlpha=this.renderedOpacity_;const l=o.getDeclutter(),c=l?Iw[r].filter(A=>!Dc.includes(A)):Iw[r],h=t.viewState,u=h.rotation,d=o.getSource(),g=d.getTileGridForProjection(h.projection).getZForResolution(h.resolution,d.zDirection),_=this.renderedTiles,v=[],E=[],w=[],C=Re(o);let P=!0;for(let A=_.length-1;A>=0;--A){const O=_[A];P=P&&!O.getReplayState(o).dirty;const M=O.executorGroups[C].filter(S=>S.hasExecutors(c));if(M.length===0)continue;const z=this.getTileRenderTransform(O,t),k=O.tileCoord[0];let q=!1;const Y=M[0].getClipCoords(z);let m=e,b;if(Y){b=new Fd,m=b.getContext();for(let S=0,L=v.length;S<L;++S)if(g!==k&&k<E[S]){const N=v[S];pt([Y[0],Y[3],Y[4],Y[7]],[N[0],N[3],N[4],N[7]])&&(q||(m.save(),q=!0),m.beginPath(),m.moveTo(Y[0],Y[1]),m.lineTo(Y[2],Y[3]),m.lineTo(Y[4],Y[5]),m.lineTo(Y[6],Y[7]),m.moveTo(N[6],N[7]),m.lineTo(N[4],N[5]),m.lineTo(N[2],N[3]),m.lineTo(N[0],N[1]),m.clip())}v.push(Y),E.push(k)}for(let S=0,L=M.length;S<L;++S)M[S].execute(e,[e.canvas.width,e.canvas.height],z,u,s,c,(R=t.declutter)==null?void 0:R[l]);q&&(m===e?m.restore():w[A]=b)}e.globalAlpha=a,this.ready=P,this.tileClipContexts_=w,t.declutter||this.renderDeferredInternal(t),super.postRender(e,t)}renderFeature(e,t,i,s,o,r){if(!i)return!1;let a=!1;if(Array.isArray(i))for(let l=0,c=i.length;l<c;++l)a=Sc(s,e,i[l],t,this.boundHandleStyleImageChange_,void 0,o,r)||a;else a=Sc(s,e,i,t,this.boundHandleStyleImageChange_,void 0,o,r);return a}tileImageNeedsRender_(e){const t=this.getLayer();if(t.getRenderMode()==="vector")return!1;const i=e.getReplayState(t),s=t.getRevision(),o=e.wantedResolution;return i.renderedTileResolution!==o||i.renderedTileRevision!==s}renderTileImage_(e,t){const i=this.getLayer(),s=e.getReplayState(i),o=i.getRevision(),r=e.executorGroups[Re(i)];s.renderedTileRevision=o;const a=e.wrappedTileCoord,l=a[0],c=i.getSource();let h=t.pixelRatio;const d=t.viewState.projection,f=c.getTileGridForProjection(d),g=f.getResolution(e.tileCoord[0]),_=t.pixelRatio/e.wantedResolution*g,v=f.getResolution(l),E=e.getContext();h=Math.round(Math.max(h,_/h));const w=c.getTilePixelSize(l,h,d);E.canvas.width=w[0],E.canvas.height=w[1];const C=h/_;if(C!==1){const O=Rm(this.tmpTransform_);Qu(O,C,C),E.setTransform.apply(E,O)}const P=f.getTileCoordExtent(a,this.tempExtent),R=_/v,A=Rm(this.tmpTransform_);Qu(A,R,-R),_b(A,-P[0],-P[3]);for(let O=0,M=r.length;O<M;++O)r[O].execute(E,[E.canvas.width*C,E.canvas.height*C],A,0,!0,UT[i.getRenderMode()],null);s.renderedTileResolution=e.wantedResolution}}class Lh extends Uc{constructor(e){e=e||{};const t=Object.assign({},e);delete t.preload;const i=e.cacheSize===void 0?0:e.cacheSize;delete e.cacheSize,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=i;const s=e.renderMode||"hybrid";Be(s=="hybrid"||s=="vector","`renderMode` must be `'hybrid'` or `'vector'`"),this.renderMode_=s,this.setPreload(e.preload?e.preload:0),this.setUseInterimTilesOnError(e.useInterimTilesOnError!==void 0?e.useInterimTilesOnError:!0),this.getBackground,this.setBackground}createRenderer(){return new GT(this,{cacheSize:this.cacheSize_})}getFeatures(e){return super.getFeatures(e)}getFeaturesInExtent(e){return this.getRenderer().getFeaturesInExtent(e)}getRenderMode(){return this.renderMode_}getPreload(){return this.get(ks.PRELOAD)}getUseInterimTilesOnError(){return this.get(ks.USE_INTERIM_TILES_ON_ERROR)}setPreload(e){this.set(ks.PRELOAD,e)}setUseInterimTilesOnError(e){this.set(ks.USE_INTERIM_TILES_ON_ERROR,e)}}class pp extends Mh{constructor(e){const t=e.projection||"EPSG:3857",i=e.extent||Qa(t),s=e.tileGrid||Tr({extent:i,maxResolution:e.maxResolution,maxZoom:e.maxZoom!==void 0?e.maxZoom:22,minZoom:e.minZoom,tileSize:e.tileSize||512});super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,interpolate:!0,projection:t,state:e.state,tileGrid:s,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:Ow,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX===void 0?!0:e.wrapX,transition:e.transition,zDirection:e.zDirection===void 0?1:e.zDirection}),this.format_=e.format?e.format:null,this.tileKeysBySourceTileUrl_={},this.sourceTiles_={},this.overlaps_=e.overlaps==null?!0:e.overlaps,this.tileClass=e.tileClass?e.tileClass:xx,this.tileGrids_={}}getOverlaps(){return this.overlaps_}getSourceTiles(e,t,i){if(i.getState()===oe.IDLE){i.setState(oe.LOADING);const s=i.wrappedTileCoord,o=this.getTileGridForProjection(t);let r=o.getTileCoordExtent(s);const a=s[0],l=o.getResolution(a);hi(r,-l,r);const c=this.projection;t&&this.projection&&!Wt(t,c)&&(r=oa(r,t,c));const h=this.tileGrid,u=h.getExtent();u&&Bn(r,u,r);let d=l;t&&c&&!Wt(t,c)&&(d=l/c.getMetersPerUnit()/t.getMetersPerUnit());const f=h.getZForResolution(d,this.zDirection);h.forEachTileCoord(r,f,g=>{const _=this.tileUrlFunction(g,e,t);this.sourceTiles_[_]||(this.sourceTiles_[_]=new this.tileClass(g,_?oe.IDLE:oe.EMPTY,_,this.format_,this.tileLoadFunction));const v=this.sourceTiles_[_];i.sourceTiles.push(v),this.tileKeysBySourceTileUrl_[_]||(this.tileKeysBySourceTileUrl_[_]=[]),this.tileKeysBySourceTileUrl_[_].push(i.getKey());const E=v.getState();if(E<oe.LOADED){const w=C=>{this.handleTileChange(C);const P=v.getState();if(P===oe.LOADED||P===oe.ERROR){const R=v.getKey();R in i.errorTileKeys?v.getState()===oe.LOADED&&delete i.errorTileKeys[R]:i.loadingSourceTiles--,P===oe.ERROR?i.errorTileKeys[R]=!0:v.removeEventListener(we.CHANGE,w),i.loadingSourceTiles===0&&i.setState(gs(i.errorTileKeys)?oe.LOADED:oe.ERROR)}};v.addEventListener(we.CHANGE,w),i.loadingSourceTiles++}E===oe.IDLE&&(v.extent=h.getTileCoordExtent(g),v.projection=this.projection,v.resolution=h.getResolution(g[0]),v.load())}),i.loadingSourceTiles||i.setState(i.sourceTiles.some(g=>g.getState()===oe.ERROR)?oe.ERROR:oe.LOADED)}return i.sourceTiles}removeSourceTiles(e){const t=e.getKey(),i=e.sourceTiles;for(let s=0,o=i.length;s<o;++s){const r=i[s].getTileUrl();if(!this.tileKeysBySourceTileUrl_[r])return;const a=this.tileKeysBySourceTileUrl_[r].indexOf(t);a!==-1&&(this.tileKeysBySourceTileUrl_[r].splice(a,1),this.tileKeysBySourceTileUrl_[r].length===0&&(delete this.tileKeysBySourceTileUrl_[r],delete this.sourceTiles_[r]))}}getTile(e,t,i,s,o){const r=[e,t,i];let a=this.getTileCoordForTileUrlFunction(r,o);const l=this.getTileGrid().getExtent(),c=this.projection,h=this.getTileGridForProjection(o);if(a&&l){const f=h.getTileCoordExtent(a);hi(f,-h.getResolution(e),f),pt(l,!o||!c||Wt(o,c)?f:oa(f,o,c))||(a=null)}let u=!0;if(a!==null){const f=this.tileGrid,g=h.getResolution(e);let _=g;o&&c&&!Wt(o,c)&&(_=g/c.getMetersPerUnit()/o.getMetersPerUnit());const v=f.getZForResolution(_,1),E=h.getTileCoordExtent(a);hi(E,-g,E),f.forEachTileCoord(!o||!c||Wt(o,c)?E:oa(E,o,c),v,w=>{u=u&&!this.tileUrlFunction(w,s,c)})}const d=new Cx(r,u?oe.EMPTY:oe.IDLE,a,this.getSourceTiles.bind(this,s,o),this.removeSourceTiles.bind(this));return d.key=this.getKey(),d}getTileGridForProjection(e){const t=e.getCode();let i=this.tileGrids_[t];if(!i){const s=this.projection;if(s!==null&&!Wt(s,e))return cp(e);const o=this.tileGrid,r=o.getResolutions().slice(),a=r.map(function(h,u){return o.getOrigin(u)}),l=r.map(function(h,u){return o.getTileSize(u)}),c=ny+1;for(let h=r.length;h<c;++h)r.push(r[h-1]/2),a.push(a[h-1]),l.push(l[h-1]);i=new Us({extent:o.getExtent(),origins:a,resolutions:r,tileSizes:l}),this.tileGrids_[t]=i}return i}getTilePixelRatio(e){return e}getTilePixelSize(e,t,i){const s=this.getTileGridForProjection(i),o=Bt(s.getTileSize(e),this.tmpSize);return[Math.round(o[0]*t),Math.round(o[1]*t)]}setOverlaps(e){this.overlaps_=e,this.changed()}}function Ow(n,e){n.setLoader(function(t,i,s){p0(e,n.getFormat(),t,i,s,n.onLoad.bind(n),n.onError.bind(n))})}const gp=65536*65536,Aw=1/gp,qT=12,Mw=typeof TextDecoder>"u"?null:new TextDecoder("utf-8"),mp=0,zh=1,Ja=2,Nh=5;class WT{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,t,i=this.length){for(;this.pos<i;){const s=this.readVarint(),o=s>>3,r=this.pos;this.type=s&7,e(o,t,this),this.pos===r&&this.skip(s)}return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*gp;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*gp;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const t=this.buf;let i,s;return s=t[this.pos++],i=s&127,s<128||(s=t[this.pos++],i|=(s&127)<<7,s<128)||(s=t[this.pos++],i|=(s&127)<<14,s<128)||(s=t[this.pos++],i|=(s&127)<<21,s<128)?i:(s=t[this.pos],i|=(s&15)<<28,VT(i,e,this))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2===1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){const e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=qT&&Mw?Mw.decode(this.buf.subarray(t,e)):i2(this.buf,t,e)}readBytes(){const e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===Ja?this.readVarint()+this.pos:this.pos+1}skip(e){const t=e&7;if(t===mp)for(;this.buf[this.pos++]>127;);else if(t===Ja)this.pos=this.readVarint()+this.pos;else if(t===Nh)this.pos+=4;else if(t===zh)this.pos+=8;else throw new Error(`Unimplemented type: ${t}`)}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){const i=new Uint8Array(t);i.set(this.buf),this.buf=i,this.dataView=new DataView(i.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Aw),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Aw),!0),this.pos+=8}writeVarint(e){if(e=+e||0,e>268435455||e<0){BT(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))}writeSVarint(e){this.writeVarint(e<0?-e*2-1:e*2)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(e.length*4),this.pos++;const t=this.pos;this.pos=s2(this.buf,e,this.pos);const i=this.pos-t;i>=128&&Dw(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const t=e.length;this.writeVarint(t),this.realloc(t);for(let i=0;i<t;i++)this.buf[this.pos++]=e[i]}writeRawMessage(e,t){this.pos++;const i=this.pos;e(t,this);const s=this.pos-i;s>=128&&Dw(i,s,this),this.pos=i-1,this.writeVarint(s),this.pos+=s}writeMessage(e,t,i){this.writeTag(e,Ja),this.writeRawMessage(t,i)}writePackedVarint(e,t){t.length&&this.writeMessage(e,XT,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,YT,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,QT,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,ZT,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,KT,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,JT,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,e2,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,t2,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,n2,t)}writeBytesField(e,t){this.writeTag(e,Ja),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,Nh),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,Nh),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,zh),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,zh),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,mp),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,mp),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,Ja),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,Nh),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,zh),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}}function VT(n,e,t){const i=t.buf;let s,o;if(o=i[t.pos++],s=(o&112)>>4,o<128||(o=i[t.pos++],s|=(o&127)<<3,o<128)||(o=i[t.pos++],s|=(o&127)<<10,o<128)||(o=i[t.pos++],s|=(o&127)<<17,o<128)||(o=i[t.pos++],s|=(o&127)<<24,o<128)||(o=i[t.pos++],s|=(o&1)<<31,o<128))return Ir(n,s,e);throw new Error("Expected varint not more than 10 bytes")}function Ir(n,e,t){return t?e*4294967296+(n>>>0):(e>>>0)*4294967296+(n>>>0)}function BT(n,e){let t,i;if(n>=0?(t=n%4294967296|0,i=n/4294967296|0):(t=~(-n%4294967296),i=~(-n/4294967296),t^4294967295?t=t+1|0:(t=0,i=i+1|0)),n>=18446744073709552e3||n<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),$T(t,i,e),HT(i,e)}function $T(n,e,t){t.buf[t.pos++]=n&127|128,n>>>=7,t.buf[t.pos++]=n&127|128,n>>>=7,t.buf[t.pos++]=n&127|128,n>>>=7,t.buf[t.pos++]=n&127|128,n>>>=7,t.buf[t.pos]=n&127}function HT(n,e){const t=(n&7)<<4;e.buf[e.pos++]|=t|((n>>>=3)?128:0),n&&(e.buf[e.pos++]=n&127|((n>>>=7)?128:0),n&&(e.buf[e.pos++]=n&127|((n>>>=7)?128:0),n&&(e.buf[e.pos++]=n&127|((n>>>=7)?128:0),n&&(e.buf[e.pos++]=n&127|((n>>>=7)?128:0),n&&(e.buf[e.pos++]=n&127)))))}function Dw(n,e,t){const i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));t.realloc(i);for(let s=t.pos-1;s>=n;s--)t.buf[s+i]=t.buf[s]}function XT(n,e){for(let t=0;t<n.length;t++)e.writeVarint(n[t])}function YT(n,e){for(let t=0;t<n.length;t++)e.writeSVarint(n[t])}function ZT(n,e){for(let t=0;t<n.length;t++)e.writeFloat(n[t])}function KT(n,e){for(let t=0;t<n.length;t++)e.writeDouble(n[t])}function QT(n,e){for(let t=0;t<n.length;t++)e.writeBoolean(n[t])}function JT(n,e){for(let t=0;t<n.length;t++)e.writeFixed32(n[t])}function e2(n,e){for(let t=0;t<n.length;t++)e.writeSFixed32(n[t])}function t2(n,e){for(let t=0;t<n.length;t++)e.writeFixed64(n[t])}function n2(n,e){for(let t=0;t<n.length;t++)e.writeSFixed64(n[t])}function i2(n,e,t){let i="",s=e;for(;s<t;){const o=n[s];let r=null,a=o>239?4:o>223?3:o>191?2:1;if(s+a>t)break;let l,c,h;a===1?o<128&&(r=o):a===2?(l=n[s+1],(l&192)===128&&(r=(o&31)<<6|l&63,r<=127&&(r=null))):a===3?(l=n[s+1],c=n[s+2],(l&192)===128&&(c&192)===128&&(r=(o&15)<<12|(l&63)<<6|c&63,(r<=2047||r>=55296&&r<=57343)&&(r=null))):a===4&&(l=n[s+1],c=n[s+2],h=n[s+3],(l&192)===128&&(c&192)===128&&(h&192)===128&&(r=(o&15)<<18|(l&63)<<12|(c&63)<<6|h&63,(r<=65535||r>=1114112)&&(r=null))),r===null?(r=65533,a=1):r>65535&&(r-=65536,i+=String.fromCharCode(r>>>10&1023|55296),r=56320|r&1023),i+=String.fromCharCode(r),s+=a}return i}function s2(n,e,t){for(let i=0,s,o;i<e.length;i++){if(s=e.charCodeAt(i),s>55295&&s<57344)if(o)if(s<56320){n[t++]=239,n[t++]=191,n[t++]=189,o=s;continue}else s=o-55296<<10|s-56320|65536,o=null;else{s>56319||i+1===e.length?(n[t++]=239,n[t++]=191,n[t++]=189):o=s;continue}else o&&(n[t++]=239,n[t++]=191,n[t++]=189,o=null);s<128?n[t++]=s:(s<2048?n[t++]=s>>6|192:(s<65536?n[t++]=s>>12|224:(n[t++]=s>>18|240,n[t++]=s>>12&63|128),n[t++]=s>>6&63|128),n[t++]=s&63|128)}return t}class Fw{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=Rn,this.supportedMediaTypes=null}getReadOptions(e,t){if(t){let i=t.dataProjection?Ne(t.dataProjection):this.readProjection(e);t.extent&&i&&i.getUnits()==="tile-pixels"&&(i=Ne(i),i.setWorldExtent(t.extent)),t={dataProjection:i,featureProjection:t.featureProjection}}return this.adaptOptions(t)}adaptOptions(e){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},e)}getType(){return be()}readFeature(e,t){return be()}readFeatures(e,t){return be()}readGeometry(e,t){return be()}readProjection(e){return be()}writeFeature(e,t){return be()}writeFeatures(e,t){return be()}writeGeometry(e,t){return be()}}function kh(n,e,t){const i=t?Ne(t.featureProjection):null,s=t?Ne(t.dataProjection):null;let o=n;if(i&&s&&!Wt(i,s)){e&&(o=n.clone());const r=e?i:s,a=e?s:i;r.getUnits()==="tile-pixels"?o.transform(r,a):o.applyTransform(Ni(r,a))}if(e&&t&&t.decimals!==void 0){const r=Math.pow(10,t.decimals),a=function(l){for(let c=0,h=l.length;c<h;++c)l[c]=Math.round(l[c]*r)/r;return l};o===n&&(o=n.clone()),o.applyTransform(a)}return o}const o2={Point:yn,LineString:Yn,Polygon:Xn,MultiPoint:Jo,MultiLineString:co,MultiPolygon:wa};function r2(n,e,t){return Array.isArray(e[0])?(qm(n,0,e,t)||(n=n.slice(),hd(n,0,e,t)),n):(cd(n,0,e,t)||(n=n.slice(),pc(n,0,e,t)),n)}function Lw(n,e){var o;const t=n.geometry;if(!t)return[];if(Array.isArray(t))return t.map(r=>Lw({...n,geometry:r})).flat();const i=t.type==="MultiPolygon"?"Polygon":t.type;if(i==="GeometryCollection"||i==="Circle")throw new Error("Unsupported geometry type: "+i);const s=t.layout.length;return kh(new Vt(i,i==="Polygon"?r2(t.flatCoordinates,t.ends,s):t.flatCoordinates,(o=t.ends)==null?void 0:o.flat(),s,n.properties||{},n.id).enableSimplifyTransformed(),!1,e)}function yp(n,e){if(!n)return null;if(Array.isArray(n)){const i=n.map(s=>yp(s,e));return new Rc(i)}const t=o2[n.type];return kh(new t(n.flatCoordinates,n.layout||"XY",n.ends),!1,e)}class _p extends Fw{constructor(e){super(),e=e||{},this.dataProjection=new na({code:"",units:"tile-pixels"}),this.featureClass=e.featureClass?e.featureClass:Vt,this.geometryName_=e.geometryName,this.layerName_=e.layerName?e.layerName:"layer",this.layers_=e.layers?e.layers:null,this.idProperty_=e.idProperty,this.supportedMediaTypes=["application/vnd.mapbox-vector-tile","application/x-protobuf"]}readRawGeometry_(e,t,i,s){e.pos=t.geometry;const o=e.readVarint()+e.pos;let r=1,a=0,l=0,c=0,h=0,u=0;for(;e.pos<o;){if(!a){const d=e.readVarint();r=d&7,a=d>>3}if(a--,r===1||r===2)l+=e.readSVarint(),c+=e.readSVarint(),r===1&&h>u&&(s.push(h),u=h),i.push(l,c),h+=2;else if(r===7)h>u&&(i.push(i[u],i[u+1]),h+=2);else throw new Error("Invalid command found in the PBF")}h>u&&(s.push(h),u=h)}createFeature_(e,t,i){const s=t.type;if(s===0)return null;let o;const r=t.properties;let a;this.idProperty_?(a=r[this.idProperty_],delete r[this.idProperty_]):a=t.id,r[this.layerName_]=t.layer.name;const l=[],c=[];this.readRawGeometry_(e,t,l,c);const h=u2(s,c.length);if(this.featureClass===Vt)o=new this.featureClass(h,l,c,2,r,a),o.transform(i.dataProjection);else{let u;if(h=="Polygon"){const g=Wm(l,c);u=g.length>1?new wa(l,"XY",g):new Xn(l,"XY",c)}else u=h==="Point"?new yn(l,"XY"):h==="LineString"?new Yn(l,"XY"):h==="MultiPoint"?new Jo(l,"XY"):h==="MultiLineString"?new co(l,"XY",c):null;const d=this.featureClass;o=new d,this.geometryName_&&o.setGeometryName(this.geometryName_);const f=kh(u,!1,i);o.setGeometry(f),a!==void 0&&o.setId(a),o.setProperties(r,!0)}return o}getType(){return"arraybuffer"}readFeatures(e,t){const i=this.layers_;t=this.adaptOptions(t);const s=Ne(t.dataProjection);s.setWorldExtent(t.extent),t.dataProjection=s;const o=new WT(e),r=o.readFields(a2,{}),a=[];for(const l in r){if(i&&!i.includes(l))continue;const c=r[l],h=c?[0,0,c.extent,c.extent]:null;s.setExtent(h);for(let u=0,d=c.length;u<d;++u){const f=h2(o,c,u),g=this.createFeature_(o,f,t);g!==null&&a.push(g)}}return a}readProjection(e){return this.dataProjection}setLayers(e){this.layers_=e}}function a2(n,e,t){if(n===3){const i={keys:[],values:[],features:[]},s=t.readVarint()+t.pos;t.readFields(l2,i,s),i.length=i.features.length,i.length&&(e[i.name]=i)}}function l2(n,e,t){if(n===15)e.version=t.readVarint();else if(n===1)e.name=t.readString();else if(n===5)e.extent=t.readVarint();else if(n===2)e.features.push(t.pos);else if(n===3)e.keys.push(t.readString());else if(n===4){let i=null;const s=t.readVarint()+t.pos;for(;t.pos<s;)n=t.readVarint()>>3,i=n===1?t.readString():n===2?t.readFloat():n===3?t.readDouble():n===4?t.readVarint64():n===5?t.readVarint():n===6?t.readSVarint():n===7?t.readBoolean():null;e.values.push(i)}}function c2(n,e,t){if(n==1)e.id=t.readVarint();else if(n==2){const i=t.readVarint()+t.pos;for(;t.pos<i;){const s=e.layer.keys[t.readVarint()],o=e.layer.values[t.readVarint()];e.properties[s]=o}}else n==3?e.type=t.readVarint():n==4&&(e.geometry=t.pos)}function h2(n,e,t){n.pos=e.features[t];const i=n.readVarint()+n.pos,s={layer:e,type:0,properties:{}};return n.readFields(c2,s,i),s}function u2(n,e){let t;return n===1?t=e===1?"Point":"MultiPoint":n===2?t=e===1?"LineString":"MultiLineString":n===3&&(t="Polygon"),t}var d2=8,f2={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},p2={"*":{type:"source"}},g2=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],m2={type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},y2={type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},_2={type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},w2={type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},v2={type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},b2={type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},E2={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},C2=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],x2={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},P2={"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},S2={"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},R2={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},T2={"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},I2={"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},O2={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},A2={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},M2={type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},D2={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},F2={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},L2={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},z2={type:"array",value:"expression_name",minimum:1},N2={anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},k2={"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},j2={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},U2={type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},G2=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],q2={"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},W2={"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},V2={"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},B2={"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},$2={"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},H2={"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},X2={"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},Y2={"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},Z2={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},K2={"*":{type:"string"}},Q2={type:"array",value:"interpolation_name",minimum:1},J2={type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}},eI={$version:d2,$root:f2,sources:p2,source:g2,source_vector:m2,source_raster:y2,source_raster_dem:_2,source_geojson:w2,source_video:v2,source_image:b2,layer:E2,layout:C2,layout_background:x2,layout_fill:P2,layout_circle:S2,layout_heatmap:R2,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:T2,layout_symbol:I2,layout_raster:O2,layout_hillshade:A2,"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:M2,filter_operator:D2,geometry_type:F2,function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:L2,expression:z2,light:N2,sky:k2,terrain:j2,projection:U2,paint:G2,paint_fill:q2,"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:W2,paint_circle:V2,paint_heatmap:B2,paint_symbol:$2,paint_raster:H2,paint_hillshade:X2,"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:Y2,transition:Z2,"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:K2,interpolation:Q2,interpolation_name:J2};const tI=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function nI(n,e){const t={};for(const i in n)i!=="ref"&&(t[i]=n[i]);return tI.forEach(i=>{i in e&&(t[i]=e[i])}),t}function iI(n){n=n.slice();const e=Object.create(null);for(let t=0;t<n.length;t++)e[n[t].id]=n[t];for(let t=0;t<n.length;t++)"ref"in n[t]&&(n[t]=nI(n[t],e[n[t].ref]));return n}class xi extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class wp{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[i,s]of t)this.bindings[i]=s}concat(e){return new wp(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}}const jh={kind:"null"},ie={kind:"number"},Ce={kind:"string"},Ae={kind:"boolean"},Pi={kind:"color"},Uh={kind:"projectionDefinition"},Eo={kind:"object"},Te={kind:"value"},sI={kind:"error"},Gh={kind:"collator"},qh={kind:"formatted"},Wh={kind:"padding"},el={kind:"colorArray"},Vh={kind:"numberArray"},tl={kind:"resolvedImage"},Bh={kind:"variableAnchorOffsetCollection"};function Jt(n,e){return{kind:"array",itemType:n,N:e}}function dt(n){if(n.kind==="array"){const e=dt(n.itemType);return typeof n.N=="number"?`array<${e}, ${n.N}>`:n.itemType.kind==="value"?"array":`array<${e}>`}else return n.kind}const oI=[jh,ie,Ce,Ae,Pi,Uh,qh,Eo,Jt(Te),Wh,Vh,el,tl,Bh];function nl(n,e){if(e.kind==="error")return null;if(n.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!nl(n.itemType,e.itemType))&&(typeof n.N!="number"||n.N===e.N))return null}else{if(n.kind===e.kind)return null;if(n.kind==="value"){for(const t of oI)if(!nl(t,e))return null}}return`Expected ${dt(n)} but found ${dt(e)} instead.`}function vp(n,e){return e.some(t=>t.kind===n.kind)}function Co(n,e){return e.some(t=>t==="null"?n===null:t==="array"?Array.isArray(n):t==="object"?n&&!Array.isArray(n)&&typeof n=="object":t===typeof n)}function Gs(n,e){return n.kind==="array"&&e.kind==="array"?n.itemType.kind===e.itemType.kind&&typeof n.N=="number":n.kind===e.kind}const zw=.96422,Nw=1,kw=.82521,jw=4/29,Or=6/29,Uw=3*Or*Or,rI=Or*Or*Or,aI=Math.PI/180,lI=180/Math.PI;function Gw(n){return n=n%360,n<0&&(n+=360),n}function qw([n,e,t,i]){n=bp(n),e=bp(e),t=bp(t);let s,o;const r=Ep((.2225045*n+.7168786*e+.0606169*t)/Nw);n===e&&e===t?s=o=r:(s=Ep((.4360747*n+.3850649*e+.1430804*t)/zw),o=Ep((.0139322*n+.0971045*e+.7141733*t)/kw));const a=116*r-16;return[a<0?0:a,500*(s-r),200*(r-o),i]}function bp(n){return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function Ep(n){return n>rI?Math.pow(n,.3333333333333333):n/Uw+jw}function Ww([n,e,t,i]){let s=(n+16)/116,o=isNaN(e)?s:s+e/500,r=isNaN(t)?s:s-t/200;return s=Nw*xp(s),o=zw*xp(o),r=kw*xp(r),[Cp(3.1338561*o-1.6168667*s-.4906146*r),Cp(-.9787684*o+1.9161415*s+.033454*r),Cp(.0719453*o-.2289914*s+1.4052427*r),i]}function Cp(n){return n=n<=.00304?12.92*n:1.055*Math.pow(n,.4166666666666667)-.055,n<0?0:n>1?1:n}function xp(n){return n>Or?n*n*n:Uw*(n-jw)}function cI(n){const[e,t,i,s]=qw(n),o=Math.sqrt(t*t+i*i);return[Math.round(o*1e4)?Gw(Math.atan2(i,t)*lI):NaN,o,e,s]}function hI([n,e,t,i]){return n=isNaN(n)?0:n*aI,Ww([t,Math.cos(n)*e,Math.sin(n)*e,i])}function uI([n,e,t,i]){n=Gw(n),e/=100,t/=100;function s(o){const r=(o+n/30)%12,a=e*Math.min(t,1-t);return t-a*Math.max(-1,Math.min(r-3,9-r,1))}return[s(0),s(8),s(4),i]}const dI=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function Vw(n,e){return dI(n,e)?n[e]:void 0}function fI(n){if(n=n.toLowerCase().trim(),n==="transparent")return[0,0,0,0];const e=Vw(pI,n);if(e){const[s,o,r]=e;return[s/255,o/255,r/255,1]}if(n.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(n)){const o=n.length<6?1:2;let r=1;return[$h(n.slice(r,r+=o)),$h(n.slice(r,r+=o)),$h(n.slice(r,r+=o)),$h(n.slice(r,r+o)||"ff")]}if(n.startsWith("rgb")){const s=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,o=n.match(s);if(o){const[r,a,l,c,h,u,d,f,g,_,v,E]=o,w=[c||" ",d||" ",_].join("");if(w===" "||w===" /"||w===",,"||w===",,,"){const C=[l,u,g].join(""),P=C==="%%%"?100:C===""?255:0;if(P){const R=[Ar(+a/P,0,1),Ar(+h/P,0,1),Ar(+f/P,0,1),v?Bw(+v,E):1];if($w(R))return R}}return}}const t=/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,i=n.match(t);if(i){const[s,o,r,a,l,c,h,u,d]=i,f=[r||" ",l||" ",h].join("");if(f===" "||f===" /"||f===",,"||f===",,,"){const g=[+o,Ar(+a,0,100),Ar(+c,0,100),u?Bw(+u,d):1];if($w(g))return uI(g)}}}function $h(n){return parseInt(n.padEnd(2,n),16)/255}function Bw(n,e){return Ar(e?n/100:n,0,1)}function Ar(n,e,t){return Math.min(Math.max(e,n),t)}function $w(n){return!n.some(Number.isNaN)}const pI={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function xo(n,e,t){return n+t*(e-n)}function il(n,e,t){return n.map((i,s)=>xo(i,e[s],t))}class Ue{constructor(e,t,i,s=1,o=!0){this.r=e,this.g=t,this.b=i,this.a=s,o||(this.r*=s,this.g*=s,this.b*=s,s||this.overwriteGetter("rgb",[e,t,i,s]))}static parse(e){if(e instanceof Ue)return e;if(typeof e!="string")return;const t=fI(e);if(t)return new Ue(...t,!1)}get rgb(){const{r:e,g:t,b:i,a:s}=this,o=s||1/0;return this.overwriteGetter("rgb",[e/o,t/o,i/o,s])}get hcl(){return this.overwriteGetter("hcl",cI(this.rgb))}get lab(){return this.overwriteGetter("lab",qw(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){const[e,t,i,s]=this.rgb;return`rgba(${[e,t,i].map(o=>Math.round(o*255)).join(",")},${s})`}static interpolate(e,t,i,s="rgb"){switch(s){case"rgb":{const[o,r,a,l]=il(e.rgb,t.rgb,i);return new Ue(o,r,a,l,!1)}case"hcl":{const[o,r,a,l]=e.hcl,[c,h,u,d]=t.hcl;let f,g;if(!isNaN(o)&&!isNaN(c)){let C=c-o;c>o&&C>180?C-=360:c<o&&o-c>180&&(C+=360),f=o+i*C}else isNaN(o)?isNaN(c)?f=NaN:(f=c,(a===1||a===0)&&(g=h)):(f=o,(u===1||u===0)&&(g=r));const[_,v,E,w]=hI([f,g??xo(r,h,i),xo(a,u,i),xo(l,d,i)]);return new Ue(_,v,E,w,!1)}case"lab":{const[o,r,a,l]=Ww(il(e.lab,t.lab,i));return new Ue(o,r,a,l,!1)}}}}Ue.black=new Ue(0,0,0,1),Ue.white=new Ue(1,1,1,1),Ue.transparent=new Ue(0,0,0,0),Ue.red=new Ue(1,0,0,1);class Pp{constructor(e,t,i){e?this.sensitivity=t?"variant":"case":this.sensitivity=t?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const gI=["bottom","center","top"];class Sp{constructor(e,t,i,s,o,r){this.text=e,this.image=t,this.scale=i,this.fontStack=s,this.textColor=o,this.verticalAlign=r}}class Qi{constructor(e){this.sections=e}static fromString(e){return new Qi([new Sp(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0?!0:!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof Qi?e:Qi.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class ti{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof ti)return e;if(typeof e=="number")return new ti([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const t of e)if(typeof t!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]];break}return new ti(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){return new ti(il(e.values,t.values,i))}}class ni{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof ni)return e;if(typeof e=="number")return new ni([e]);if(Array.isArray(e)){for(const t of e)if(typeof t!="number")return;return new ni(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){return new ni(il(e.values,t.values,i))}}class bn{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof bn)return e;if(typeof e=="string"){const i=Ue.parse(e);return i?new bn([i]):void 0}if(!Array.isArray(e))return;const t=[];for(const i of e){if(typeof i!="string")return;const s=Ue.parse(i);if(!s)return;t.push(s)}return new bn(t)}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i,s="rgb"){const o=[];if(e.values.length!=t.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${t.values.length}), cannot interpolate.`);for(let r=0;r<e.values.length;r++)o.push(Ue.interpolate(e.values[r],t.values[r],i,s));return new bn(o)}}class mt extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}}const mI=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Si{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Si)return e;if(!(!Array.isArray(e)||e.length<1||e.length%2!==0)){for(let t=0;t<e.length;t+=2){const i=e[t],s=e[t+1];if(typeof i!="string"||!mI.has(i)||!Array.isArray(s)||s.length!==2||typeof s[0]!="number"||typeof s[1]!="number")return}return new Si(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){const s=e.values,o=t.values;if(s.length!==o.length)throw new mt(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${t.toString()}`);const r=[];for(let a=0;a<s.length;a+=2){if(s[a]!==o[a])throw new mt(`Cannot interpolate values containing mismatched anchors. from[${a}]: ${s[a]}, to[${a}]: ${o[a]}`);r.push(s[a]);const[l,c]=s[a+1],[h,u]=o[a+1];r.push([xo(l,h,i),xo(c,u,i)])}return new Si(r)}}class qs{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new qs({name:e,available:!1}):null}}class ii{constructor(e,t,i){this.from=e,this.to=t,this.transition=i}static interpolate(e,t,i){return new ii(e,t,i)}static parse(e){if(e instanceof ii)return e;if(Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number")return new ii(e[0],e[1],e[2]);if(typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number")return new ii(e.from,e.to,e.transition);if(typeof e=="string")return new ii(e,e,1)}}function Hw(n,e,t,i){return typeof n=="number"&&n>=0&&n<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255?typeof i>"u"||typeof i=="number"&&i>=0&&i<=1?null:`Invalid rgba value [${[n,e,t,i].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof i=="number"?[n,e,t,i]:[n,e,t]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function sl(n){if(n===null||typeof n=="string"||typeof n=="boolean"||typeof n=="number"||n instanceof ii||n instanceof Ue||n instanceof Pp||n instanceof Qi||n instanceof ti||n instanceof ni||n instanceof bn||n instanceof Si||n instanceof qs)return!0;if(Array.isArray(n)){for(const e of n)if(!sl(e))return!1;return!0}else if(typeof n=="object"){for(const e in n)if(!sl(n[e]))return!1;return!0}else return!1}function Tt(n){if(n===null)return jh;if(typeof n=="string")return Ce;if(typeof n=="boolean")return Ae;if(typeof n=="number")return ie;if(n instanceof Ue)return Pi;if(n instanceof ii)return Uh;if(n instanceof Pp)return Gh;if(n instanceof Qi)return qh;if(n instanceof ti)return Wh;if(n instanceof ni)return Vh;if(n instanceof bn)return el;if(n instanceof Si)return Bh;if(n instanceof qs)return tl;if(Array.isArray(n)){const e=n.length;let t;for(const i of n){const s=Tt(i);if(!t)t=s;else{if(t===s)continue;t=Te;break}}return Jt(t||Te,e)}else return Eo}function rl(n){const e=typeof n;return n===null?"":e==="string"||e==="number"||e==="boolean"?String(n):n instanceof Ue||n instanceof ii||n instanceof Qi||n instanceof ti||n instanceof ni||n instanceof bn||n instanceof Si||n instanceof qs?n.toString():JSON.stringify(n)}class Mr{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(e.length!==2)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!sl(e[1]))return t.error("invalid value");const i=e[1];let s=Tt(i);const o=t.expectedType;return s.kind==="array"&&s.N===0&&o&&o.kind==="array"&&(typeof o.N!="number"||o.N===0)&&(s=o),new Mr(s,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Hh={string:Ce,number:ie,boolean:Ae,object:Eo};class si{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i=1,s;const o=e[0];if(o==="array"){let a;if(e.length>2){const c=e[1];if(typeof c!="string"||!(c in Hh)||c==="object")return t.error('The item type argument of "array" must be one of string, number, boolean',1);a=Hh[c],i++}else a=Te;let l;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);l=e[2],i++}s=Jt(a,l)}else{if(!Hh[o])throw new Error(`Types doesn't contain name = ${o}`);s=Hh[o]}const r=[];for(;i<e.length;i++){const a=t.parse(e[i],i,Te);if(!a)return null;r.push(a)}return new si(s,r)}evaluate(e){for(let t=0;t<this.args.length;t++){const i=this.args[t].evaluate(e);if(nl(this.type,Tt(i))){if(t===this.args.length-1)throw new mt(`Expected value to be of type ${dt(this.type)}, but found ${dt(Tt(i))} instead.`)}else return i}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Xw={"to-boolean":Ae,"to-color":Pi,"to-number":ie,"to-string":Ce};class Ws{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[0];if(!Xw[i])throw new Error(`Can't parse ${i} as it is not part of the known types`);if((i==="to-boolean"||i==="to-string")&&e.length!==2)return t.error("Expected one argument.");const s=Xw[i],o=[];for(let r=1;r<e.length;r++){const a=t.parse(e[r],r,Te);if(!a)return null;o.push(a)}return new Ws(s,o)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let t,i;for(const s of this.args){if(t=s.evaluate(e),i=null,t instanceof Ue)return t;if(typeof t=="string"){const o=e.parseColor(t);if(o)return o}else if(Array.isArray(t)&&(t.length<3||t.length>4?i=`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:i=Hw(t[0],t[1],t[2],t[3]),!i))return new Ue(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new mt(i||`Could not parse color from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"padding":{let t;for(const i of this.args){t=i.evaluate(e);const s=ti.parse(t);if(s)return s}throw new mt(`Could not parse padding from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"numberArray":{let t;for(const i of this.args){t=i.evaluate(e);const s=ni.parse(t);if(s)return s}throw new mt(`Could not parse numberArray from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"colorArray":{let t;for(const i of this.args){t=i.evaluate(e);const s=bn.parse(t);if(s)return s}throw new mt(`Could not parse colorArray from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(const i of this.args){t=i.evaluate(e);const s=Si.parse(t);if(s)return s}throw new mt(`Could not parse variableAnchorOffsetCollection from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(const i of this.args){if(t=i.evaluate(e),t===null)return 0;const s=Number(t);if(!isNaN(s))return s}throw new mt(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return Qi.fromString(rl(this.args[0].evaluate(e)));case"resolvedImage":return qs.fromString(rl(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return rl(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const yI=["Unknown","Point","LineString","Polygon"];class Yw{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?yI[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let t=this._parseColorCache.get(e);return t||(t=Ue.parse(e),this._parseColorCache.set(e,t)),t}}class Xh{constructor(e,t,i=[],s,o=new wp,r=[]){this.registry=e,this.path=i,this.key=i.map(a=>`[${a}]`).join(""),this.scope=o,this.errors=r,this.expectedType=s,this._isConstant=t}parse(e,t,i,s,o={}){return t?this.concat(t,i,s)._parse(e,o):this._parse(e,o)}_parse(e,t){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);function i(s,o,r){return r==="assert"?new si(o,[s]):r==="coerce"?new Ws(o,[s]):s}if(Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const s=e[0];if(typeof s!="string")return this.error(`Expression name must be a string, but found ${typeof s} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const o=this.registry[s];if(o){let r=o.parse(e,this);if(!r)return null;if(this.expectedType){const a=this.expectedType,l=r.type;if((a.kind==="string"||a.kind==="number"||a.kind==="boolean"||a.kind==="object"||a.kind==="array")&&l.kind==="value")r=i(r,a,t.typeAnnotation||"assert");else if(a.kind==="projectionDefinition"&&["string","array"].includes(l.kind)||["color","formatted","resolvedImage"].includes(a.kind)&&["value","string"].includes(l.kind)||["padding","numberArray"].includes(a.kind)&&["value","number","array"].includes(l.kind)||a.kind==="colorArray"&&["value","string","array"].includes(l.kind)||a.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(l.kind))r=i(r,a,t.typeAnnotation||"coerce");else if(this.checkSubtype(a,l))return null}if(!(r instanceof Mr)&&r.type.kind!=="resolvedImage"&&this._isConstant(r)){const a=new Yw;try{r=new Mr(r.type,r.evaluate(a))}catch(l){return this.error(l.message),null}}return r}return this.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0)}else return typeof e>"u"?this.error("'undefined' value invalid. Use null instead."):typeof e=="object"?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,t,i){const s=typeof e=="number"?this.path.concat(e):this.path,o=i?this.scope.concat(i):this.scope;return new Xh(this.registry,this._isConstant,s,t||null,o,this.errors)}error(e,...t){const i=`${this.key}${t.map(s=>`[${s}]`).join("")}`;this.errors.push(new xi(i,e))}checkSubtype(e,t){const i=nl(e,t);return i&&this.error(i),i}}class Yh{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const i=[];for(let o=1;o<e.length-1;o+=2){const r=e[o];if(typeof r!="string")return t.error(`Expected string, but found ${typeof r} instead.`,o);if(/[^a-zA-Z0-9_]/.test(r))return t.error("Variable names must contain only alphanumeric characters or '_'.",o);const a=t.parse(e[o+1],o+1);if(!a)return null;i.push([r,a])}const s=t.parse(e[e.length-1],e.length-1,t.expectedType,i);return s?new Yh(i,s):null}outputDefined(){return this.result.outputDefined()}}class Zh{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(e.length!==2||typeof e[1]!="string")return t.error("'var' expression requires exactly one string literal argument.");const i=e[1];return t.scope.has(i)?new Zh(i,t.scope.get(i)):t.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Rp{constructor(e,t,i){this.type=e,this.index=t,this.input=i}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,ie),s=t.parse(e[2],2,Jt(t.expectedType||Te));if(!i||!s)return null;const o=s.type;return new Rp(o.itemType,i,s)}evaluate(e){const t=this.index.evaluate(e),i=this.input.evaluate(e);if(t<0)throw new mt(`Array index out of bounds: ${t} < 0.`);if(t>=i.length)throw new mt(`Array index out of bounds: ${t} > ${i.length-1}.`);if(t!==Math.floor(t))throw new mt(`Array index must be an integer, but found ${t} instead.`);return i[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class Tp{constructor(e,t){this.type=Ae,this.needle=e,this.haystack=t}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Te),s=t.parse(e[2],2,Te);return!i||!s?null:vp(i.type,[Ae,Ce,ie,jh,Te])?new Tp(i,s):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${dt(i.type)} instead`)}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!i)return!1;if(!Co(t,["boolean","string","number","null"]))throw new mt(`Expected first argument to be of type boolean, string, number or null, but found ${dt(Tt(t))} instead.`);if(!Co(i,["string","array"]))throw new mt(`Expected second argument to be of type array or string, but found ${dt(Tt(i))} instead.`);return i.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Kh{constructor(e,t,i){this.type=ie,this.needle=e,this.haystack=t,this.fromIndex=i}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Te),s=t.parse(e[2],2,Te);if(!i||!s)return null;if(!vp(i.type,[Ae,Ce,ie,jh,Te]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${dt(i.type)} instead`);if(e.length===4){const o=t.parse(e[3],3,ie);return o?new Kh(i,s,o):null}else return new Kh(i,s)}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!Co(t,["boolean","string","number","null"]))throw new mt(`Expected first argument to be of type boolean, string, number or null, but found ${dt(Tt(t))} instead.`);let s;if(this.fromIndex&&(s=this.fromIndex.evaluate(e)),Co(i,["string"])){const o=i.indexOf(t,s);return o===-1?-1:[...i.slice(0,o)].length}else{if(Co(i,["array"]))return i.indexOf(t,s);throw new mt(`Expected second argument to be of type array or string, but found ${dt(Tt(i))} instead.`)}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class Ip{constructor(e,t,i,s,o,r){this.inputType=e,this.type=t,this.input=i,this.cases=s,this.outputs=o,this.otherwise=r}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!==1)return t.error("Expected an even number of arguments.");let i,s;t.expectedType&&t.expectedType.kind!=="value"&&(s=t.expectedType);const o={},r=[];for(let c=2;c<e.length-1;c+=2){let h=e[c];const u=e[c+1];Array.isArray(h)||(h=[h]);const d=t.concat(c);if(h.length===0)return d.error("Expected at least one branch label.");for(const g of h){if(typeof g!="number"&&typeof g!="string")return d.error("Branch labels must be numbers or strings.");if(typeof g=="number"&&Math.abs(g)>Number.MAX_SAFE_INTEGER)return d.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof g=="number"&&Math.floor(g)!==g)return d.error("Numeric branch labels must be integer values.");if(!i)i=Tt(g);else if(d.checkSubtype(i,Tt(g)))return null;if(typeof o[String(g)]<"u")return d.error("Branch labels must be unique.");o[String(g)]=r.length}const f=t.parse(u,c,s);if(!f)return null;s=s||f.type,r.push(f)}const a=t.parse(e[1],1,Te);if(!a)return null;const l=t.parse(e[e.length-1],e.length-1,s);return!l||a.type.kind!=="value"&&t.concat(1).checkSubtype(i,a.type)?null:new Ip(i,s,a,o,r,l)}evaluate(e){const t=this.input.evaluate(e);return(Tt(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class Op{constructor(e,t,i){this.type=e,this.branches=t,this.otherwise=i}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!==0)return t.error("Expected an odd number of arguments.");let i;t.expectedType&&t.expectedType.kind!=="value"&&(i=t.expectedType);const s=[];for(let r=1;r<e.length-1;r+=2){const a=t.parse(e[r],r,Ae);if(!a)return null;const l=t.parse(e[r+1],r+1,i);if(!l)return null;s.push([a,l]),i=i||l.type}const o=t.parse(e[e.length-1],e.length-1,i);if(!o)return null;if(!i)throw new Error("Can't infer output type");return new Op(i,s,o)}evaluate(e){for(const[t,i]of this.branches)if(t.evaluate(e))return i.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,i]of this.branches)e(t),e(i);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}}class Qh{constructor(e,t,i,s){this.type=e,this.input=t,this.beginIndex=i,this.endIndex=s}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Te),s=t.parse(e[2],2,ie);if(!i||!s)return null;if(!vp(i.type,[Jt(Te),Ce,Te]))return t.error(`Expected first argument to be of type array or string, but found ${dt(i.type)} instead`);if(e.length===4){const o=t.parse(e[3],3,ie);return o?new Qh(i.type,i,s,o):null}else return new Qh(i.type,i,s)}evaluate(e){const t=this.input.evaluate(e),i=this.beginIndex.evaluate(e);let s;if(this.endIndex&&(s=this.endIndex.evaluate(e)),Co(t,["string"]))return[...t].slice(i,s).join("");if(Co(t,["array"]))return t.slice(i,s);throw new mt(`Expected first argument to be of type array or string, but found ${dt(Tt(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Zw(n,e){const t=n.length-1;let i=0,s=t,o=0,r,a;for(;i<=s;)if(o=Math.floor((i+s)/2),r=n[o],a=n[o+1],r<=e){if(o===t||e<a)return o;i=o+1}else if(r>e)s=o-1;else throw new mt("Input is not a number.");return 0}class Jh{constructor(e,t,i){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[s,o]of i)this.labels.push(s),this.outputs.push(o)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return t.error("Expected an even number of arguments.");const i=t.parse(e[1],1,ie);if(!i)return null;const s=[];let o=null;t.expectedType&&t.expectedType.kind!=="value"&&(o=t.expectedType);for(let r=1;r<e.length;r+=2){const a=r===1?-1/0:e[r],l=e[r+1],c=r,h=r+1;if(typeof a!="number")return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',c);if(s.length&&s[s.length-1][0]>=a)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',c);const u=t.parse(l,h,o);if(!u)return null;o=o||u.type,s.push([a,u])}return new Jh(o,i,s)}evaluate(e){const t=this.labels,i=this.outputs;if(t.length===1)return i[0].evaluate(e);const s=this.input.evaluate(e);if(s<=t[0])return i[0].evaluate(e);const o=t.length;if(s>=t[o-1])return i[o-1].evaluate(e);const r=Zw(t,s);return i[r].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function _I(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ap,Kw;function wI(){if(Kw)return Ap;Kw=1,Ap=n;function n(e,t,i,s){this.cx=3*e,this.bx=3*(i-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(s-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=s}return n.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var i=e,s=0;s<8;s++){var o=this.sampleCurveX(i)-e;if(Math.abs(o)<t)return i;var r=this.sampleCurveDerivativeX(i);if(Math.abs(r)<1e-6)break;i=i-o/r}var a=0,l=1;for(i=e,s=0;s<20&&(o=this.sampleCurveX(i),!(Math.abs(o-e)<t));s++)e>o?a=i:l=i,i=(l-a)*.5+a;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},Ap}var vI=wI(),bI=_I(vI);class Ri{constructor(e,t,i,s,o){this.type=e,this.operator=t,this.interpolation=i,this.input=s,this.labels=[],this.outputs=[];for(const[r,a]of o)this.labels.push(r),this.outputs.push(a)}static interpolationFactor(e,t,i,s){let o=0;if(e.name==="exponential")o=Mp(t,e.base,i,s);else if(e.name==="linear")o=Mp(t,1,i,s);else if(e.name==="cubic-bezier"){const r=e.controlPoints;o=new bI(r[0],r[1],r[2],r[3]).solve(Mp(t,1,i,s))}return o}static parse(e,t){let[i,s,o,...r]=e;if(!Array.isArray(s)||s.length===0)return t.error("Expected an interpolation type expression.",1);if(s[0]==="linear")s={name:"linear"};else if(s[0]==="exponential"){const c=s[1];if(typeof c!="number")return t.error("Exponential interpolation requires a numeric base.",1,1);s={name:"exponential",base:c}}else if(s[0]==="cubic-bezier"){const c=s.slice(1);if(c.length!==4||c.some(h=>typeof h!="number"||h<0||h>1))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);s={name:"cubic-bezier",controlPoints:c}}else return t.error(`Unknown interpolation type ${String(s[0])}`,1,0);if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return t.error("Expected an even number of arguments.");if(o=t.parse(o,2,ie),!o)return null;const a=[];let l=null;(i==="interpolate-hcl"||i==="interpolate-lab")&&t.expectedType!=el?l=Pi:t.expectedType&&t.expectedType.kind!=="value"&&(l=t.expectedType);for(let c=0;c<r.length;c+=2){const h=r[c],u=r[c+1],d=c+3,f=c+4;if(typeof h!="number")return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',d);if(a.length&&a[a.length-1][0]>=h)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',d);const g=t.parse(u,f,l);if(!g)return null;l=l||g.type,a.push([h,g])}return!Gs(l,ie)&&!Gs(l,Uh)&&!Gs(l,Pi)&&!Gs(l,Wh)&&!Gs(l,Vh)&&!Gs(l,el)&&!Gs(l,Bh)&&!Gs(l,Jt(ie))?t.error(`Type ${dt(l)} is not interpolatable.`):new Ri(l,i,s,o,a)}evaluate(e){const t=this.labels,i=this.outputs;if(t.length===1)return i[0].evaluate(e);const s=this.input.evaluate(e);if(s<=t[0])return i[0].evaluate(e);const o=t.length;if(s>=t[o-1])return i[o-1].evaluate(e);const r=Zw(t,s),a=t[r],l=t[r+1],c=Ri.interpolationFactor(this.interpolation,s,a,l),h=i[r].evaluate(e),u=i[r+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return xo(h,u,c);case"color":return Ue.interpolate(h,u,c);case"padding":return ti.interpolate(h,u,c);case"colorArray":return bn.interpolate(h,u,c);case"numberArray":return ni.interpolate(h,u,c);case"variableAnchorOffsetCollection":return Si.interpolate(h,u,c);case"array":return il(h,u,c);case"projectionDefinition":return ii.interpolate(h,u,c)}case"interpolate-hcl":switch(this.type.kind){case"color":return Ue.interpolate(h,u,c,"hcl");case"colorArray":return bn.interpolate(h,u,c,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Ue.interpolate(h,u,c,"lab");case"colorArray":return bn.interpolate(h,u,c,"lab")}}}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Mp(n,e,t,i){const s=i-t,o=n-t;return s===0?0:e===1?o/s:(Math.pow(e,o)-1)/(Math.pow(e,s)-1)}class al{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i=null;const s=t.expectedType;s&&s.kind!=="value"&&(i=s);const o=[];for(const a of e.slice(1)){const l=t.parse(a,1+o.length,i,void 0,{typeAnnotation:"omit"});if(!l)return null;i=i||l.type,o.push(l)}if(!i)throw new Error("No output type");return s&&o.some(a=>nl(s,a.type))?new al(Te,o):new al(i,o)}evaluate(e){let t=null,i=0,s;for(const o of this.args)if(i++,t=o.evaluate(e),t&&t instanceof qs&&!t.available&&(s||(s=t.name),t=null,i===this.args.length&&(t=s)),t!==null)break;return t}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}function Qw(n,e){return n==="=="||n==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function EI(n,e,t){return e===t}function CI(n,e,t){return e!==t}function xI(n,e,t){return e<t}function PI(n,e,t){return e>t}function SI(n,e,t){return e<=t}function RI(n,e,t){return e>=t}function Jw(n,e,t,i){return i.compare(e,t)===0}function TI(n,e,t,i){return!Jw(n,e,t,i)}function II(n,e,t,i){return i.compare(e,t)<0}function OI(n,e,t,i){return i.compare(e,t)>0}function AI(n,e,t,i){return i.compare(e,t)<=0}function MI(n,e,t,i){return i.compare(e,t)>=0}function Dr(n,e,t){const i=n!=="=="&&n!=="!=";return class wv{constructor(o,r,a){this.type=Ae,this.lhs=o,this.rhs=r,this.collator=a,this.hasUntypedArgument=o.type.kind==="value"||r.type.kind==="value"}static parse(o,r){if(o.length!==3&&o.length!==4)return r.error("Expected two or three arguments.");const a=o[0];let l=r.parse(o[1],1,Te);if(!l)return null;if(!Qw(a,l.type))return r.concat(1).error(`"${a}" comparisons are not supported for type '${dt(l.type)}'.`);let c=r.parse(o[2],2,Te);if(!c)return null;if(!Qw(a,c.type))return r.concat(2).error(`"${a}" comparisons are not supported for type '${dt(c.type)}'.`);if(l.type.kind!==c.type.kind&&l.type.kind!=="value"&&c.type.kind!=="value")return r.error(`Cannot compare types '${dt(l.type)}' and '${dt(c.type)}'.`);i&&(l.type.kind==="value"&&c.type.kind!=="value"?l=new si(c.type,[l]):l.type.kind!=="value"&&c.type.kind==="value"&&(c=new si(l.type,[c])));let h=null;if(o.length===4){if(l.type.kind!=="string"&&c.type.kind!=="string"&&l.type.kind!=="value"&&c.type.kind!=="value")return r.error("Cannot use collator to compare non-string types.");if(h=r.parse(o[3],3,Gh),!h)return null}return new wv(l,c,h)}evaluate(o){const r=this.lhs.evaluate(o),a=this.rhs.evaluate(o);if(i&&this.hasUntypedArgument){const l=Tt(r),c=Tt(a);if(l.kind!==c.kind||!(l.kind==="string"||l.kind==="number"))throw new mt(`Expected arguments for "${n}" to be (string, string) or (number, number), but found (${l.kind}, ${c.kind}) instead.`)}if(this.collator&&!i&&this.hasUntypedArgument){const l=Tt(r),c=Tt(a);if(l.kind!=="string"||c.kind!=="string")return e(o,r,a)}return this.collator?t(o,r,a,this.collator.evaluate(o)):e(o,r,a)}eachChild(o){o(this.lhs),o(this.rhs),this.collator&&o(this.collator)}outputDefined(){return!0}}}const DI=Dr("==",EI,Jw),FI=Dr("!=",CI,TI),LI=Dr("<",xI,II),zI=Dr(">",PI,OI),NI=Dr("<=",SI,AI),kI=Dr(">=",RI,MI);class eu{constructor(e,t,i){this.type=Gh,this.locale=i,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(e.length!==2)return t.error("Expected one argument.");const i=e[1];if(typeof i!="object"||Array.isArray(i))return t.error("Collator options argument must be an object.");const s=t.parse(i["case-sensitive"]===void 0?!1:i["case-sensitive"],1,Ae);if(!s)return null;const o=t.parse(i["diacritic-sensitive"]===void 0?!1:i["diacritic-sensitive"],1,Ae);if(!o)return null;let r=null;return i.locale&&(r=t.parse(i.locale,1,Ce),!r)?null:new eu(s,o,r)}evaluate(e){return new Pp(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class Dp{constructor(e,t,i,s,o,r){this.type=Ce,this.number=e,this.locale=t,this.currency=i,this.unit=s,this.minFractionDigits=o,this.maxFractionDigits=r}static parse(e,t){if(e.length!==3)return t.error("Expected two arguments.");const i=t.parse(e[1],1,ie);if(!i)return null;const s=e[2];if(typeof s!="object"||Array.isArray(s))return t.error("NumberFormat options argument must be an object.");let o=null;if(s.locale&&(o=t.parse(s.locale,1,Ce),!o))return null;let r=null;if(s.currency&&(r=t.parse(s.currency,1,Ce),!r))return null;let a=null;if(s.unit&&(a=t.parse(s.unit,1,Ce),!a))return null;if(r&&a)return t.error("NumberFormat options `currency` and `unit` are mutually exclusive");let l=null;if(s["min-fraction-digits"]&&(l=t.parse(s["min-fraction-digits"],1,ie),!l))return null;let c=null;return s["max-fraction-digits"]&&(c=t.parse(s["max-fraction-digits"],1,ie),!c)?null:new Dp(i,o,r,a,l,c)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class Fp{constructor(e){this.type=qh,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[1];if(!Array.isArray(i)&&typeof i=="object")return t.error("First argument must be an image or text section.");const s=[];let o=!1;for(let r=1;r<=e.length-1;++r){const a=e[r];if(o&&typeof a=="object"&&!Array.isArray(a)){o=!1;let l=null;if(a["font-scale"]&&(l=t.parse(a["font-scale"],1,ie),!l))return null;let c=null;if(a["text-font"]&&(c=t.parse(a["text-font"],1,Jt(Ce)),!c))return null;let h=null;if(a["text-color"]&&(h=t.parse(a["text-color"],1,Pi),!h))return null;let u=null;if(a["vertical-align"]){if(typeof a["vertical-align"]=="string"&&!gI.includes(a["vertical-align"]))return t.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${a["vertical-align"]}' instead.`);if(u=t.parse(a["vertical-align"],1,Ce),!u)return null}const d=s[s.length-1];d.scale=l,d.font=c,d.textColor=h,d.verticalAlign=u}else{const l=t.parse(e[r],1,Te);if(!l)return null;const c=l.type.kind;if(c!=="string"&&c!=="value"&&c!=="null"&&c!=="resolvedImage")return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");o=!0,s.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Fp(s)}evaluate(e){const t=i=>{const s=i.content.evaluate(e);return Tt(s)===tl?new Sp("",s,null,null,null,i.verticalAlign?i.verticalAlign.evaluate(e):null):new Sp(rl(s),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null,i.verticalAlign?i.verticalAlign.evaluate(e):null)};return new Qi(this.sections.map(t))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor),t.verticalAlign&&e(t.verticalAlign)}outputDefined(){return!1}}class Lp{constructor(e){this.type=tl,this.input=e}static parse(e,t){if(e.length!==2)return t.error("Expected two arguments.");const i=t.parse(e[1],1,Ce);return i?new Lp(i):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),i=qs.fromString(t);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(t)>-1),i}eachChild(e){e(this.input)}outputDefined(){return!1}}class zp{constructor(e){this.type=ie,this.input=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const i=t.parse(e[1],1);return i?i.type.kind!=="array"&&i.type.kind!=="string"&&i.type.kind!=="value"?t.error(`Expected argument of type string or array, but found ${dt(i.type)} instead.`):new zp(i):null}evaluate(e){const t=this.input.evaluate(e);if(typeof t=="string")return[...t].length;if(Array.isArray(t))return t.length;throw new mt(`Expected value to be of type string or array, but found ${dt(Tt(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Ti=8192;function jI(n,e){const t=UI(n[0]),i=qI(n[1]),s=Math.pow(2,e.z);return[Math.round(t*s*Ti),Math.round(i*s*Ti)]}function Np(n,e){const t=Math.pow(2,e.z),i=(n[0]/Ti+e.x)/t,s=(n[1]/Ti+e.y)/t;return[GI(i),WI(s)]}function UI(n){return(180+n)/360}function GI(n){return n*360-180}function qI(n){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n*Math.PI/360)))/360}function WI(n){return 360/Math.PI*Math.atan(Math.exp((180-n*360)*Math.PI/180))-90}function ll(n,e){n[0]=Math.min(n[0],e[0]),n[1]=Math.min(n[1],e[1]),n[2]=Math.max(n[2],e[0]),n[3]=Math.max(n[3],e[1])}function cl(n,e){return!(n[0]<=e[0]||n[2]>=e[2]||n[1]<=e[1]||n[3]>=e[3])}function VI(n,e,t){return e[1]>n[1]!=t[1]>n[1]&&n[0]<(t[0]-e[0])*(n[1]-e[1])/(t[1]-e[1])+e[0]}function BI(n,e,t){const i=n[0]-e[0],s=n[1]-e[1],o=n[0]-t[0],r=n[1]-t[1];return i*r-o*s===0&&i*o<=0&&s*r<=0}function tu(n,e,t,i){const s=[e[0]-n[0],e[1]-n[1]],o=[i[0]-t[0],i[1]-t[1]];return YI(o,s)===0?!1:!!(t1(n,e,t,i)&&t1(t,i,n,e))}function $I(n,e,t){for(const i of t)for(let s=0;s<i.length-1;++s)if(tu(n,e,i[s],i[s+1]))return!0;return!1}function Fr(n,e,t=!1){let i=!1;for(const s of e)for(let o=0;o<s.length-1;o++){if(BI(n,s[o],s[o+1]))return t;VI(n,s[o],s[o+1])&&(i=!i)}return i}function HI(n,e){for(const t of e)if(Fr(n,t))return!0;return!1}function e1(n,e){for(const t of n)if(!Fr(t,e))return!1;for(let t=0;t<n.length-1;++t)if($I(n[t],n[t+1],e))return!1;return!0}function XI(n,e){for(const t of e)if(e1(n,t))return!0;return!1}function YI(n,e){return n[0]*e[1]-n[1]*e[0]}function t1(n,e,t,i){const s=n[0]-t[0],o=n[1]-t[1],r=e[0]-t[0],a=e[1]-t[1],l=i[0]-t[0],c=i[1]-t[1],h=s*c-l*o,u=r*c-l*a;return h>0&&u<0||h<0&&u>0}function kp(n,e,t){const i=[];for(let s=0;s<n.length;s++){const o=[];for(let r=0;r<n[s].length;r++){const a=jI(n[s][r],t);ll(e,a),o.push(a)}i.push(o)}return i}function n1(n,e,t){const i=[];for(let s=0;s<n.length;s++){const o=kp(n[s],e,t);i.push(o)}return i}function i1(n,e,t,i){if(n[0]<t[0]||n[0]>t[2]){const s=i*.5;let o=n[0]-t[0]>s?-i:t[0]-n[0]>s?i:0;o===0&&(o=n[0]-t[2]>s?-i:t[2]-n[0]>s?i:0),n[0]+=o}ll(e,n)}function ZI(n){n[0]=n[1]=1/0,n[2]=n[3]=-1/0}function s1(n,e,t,i){const s=Math.pow(2,i.z)*Ti,o=[i.x*Ti,i.y*Ti],r=[];for(const a of n)for(const l of a){const c=[l.x+o[0],l.y+o[1]];i1(c,e,t,s),r.push(c)}return r}function o1(n,e,t,i){const s=Math.pow(2,i.z)*Ti,o=[i.x*Ti,i.y*Ti],r=[];for(const a of n){const l=[];for(const c of a){const h=[c.x+o[0],c.y+o[1]];ll(e,h),l.push(h)}r.push(l)}if(e[2]-e[0]<=s/2){ZI(e);for(const a of r)for(const l of a)i1(l,e,t,s)}return r}function KI(n,e){const t=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],s=n.canonicalID();if(e.type==="Polygon"){const o=kp(e.coordinates,i,s),r=s1(n.geometry(),t,i,s);if(!cl(t,i))return!1;for(const a of r)if(!Fr(a,o))return!1}if(e.type==="MultiPolygon"){const o=n1(e.coordinates,i,s),r=s1(n.geometry(),t,i,s);if(!cl(t,i))return!1;for(const a of r)if(!HI(a,o))return!1}return!0}function QI(n,e){const t=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],s=n.canonicalID();if(e.type==="Polygon"){const o=kp(e.coordinates,i,s),r=o1(n.geometry(),t,i,s);if(!cl(t,i))return!1;for(const a of r)if(!e1(a,o))return!1}if(e.type==="MultiPolygon"){const o=n1(e.coordinates,i,s),r=o1(n.geometry(),t,i,s);if(!cl(t,i))return!1;for(const a of r)if(!XI(a,o))return!1}return!0}class Po{constructor(e,t){this.type=Ae,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(sl(e[1])){const i=e[1];if(i.type==="FeatureCollection"){const s=[];for(const o of i.features){const{type:r,coordinates:a}=o.geometry;r==="Polygon"&&s.push(a),r==="MultiPolygon"&&s.push(...a)}if(s.length){const o={type:"MultiPolygon",coordinates:s};return new Po(i,o)}}else if(i.type==="Feature"){const s=i.geometry.type;if(s==="Polygon"||s==="MultiPolygon")return new Po(i,i.geometry)}else if(i.type==="Polygon"||i.type==="MultiPolygon")return new Po(i,i)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return KI(e,this.geometries);if(e.geometryType()==="LineString")return QI(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class r1{constructor(e=[],t=(i,s)=>i<s?-1:i>s?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:i}=this,s=t[e];for(;e>0;){const o=e-1>>1,r=t[o];if(i(s,r)>=0)break;t[e]=r,e=o}t[e]=s}_down(e){const{data:t,compare:i}=this,s=this.length>>1,o=t[e];for(;e<s;){let r=(e<<1)+1;const a=r+1;if(a<this.length&&i(t[a],t[r])<0&&(r=a),i(t[r],o)>=0)break;t[e]=t[r],e=r}t[e]=o}}function JI(n,e){if(n.length<=1)return[n];const i=[];let s,o;for(const r of n){const a=eO(r);a!==0&&(r.area=Math.abs(a),o===void 0&&(o=a<0),o===a<0?(s&&i.push(s),s=[r]):s.push(r))}return s&&i.push(s),i}function eO(n){let e=0;for(let t=0,i=n.length,s=i-1,o,r;t<i;s=t++)o=n[t],r=n[s],e+=(r.x-o.x)*(o.y+r.y);return e}const tO=6378.137,a1=1/298.257223563,l1=a1*(2-a1),c1=Math.PI/180;class jp{constructor(e){const t=c1*tO*1e3,i=Math.cos(e*c1),s=1/(1-l1*(1-i*i)),o=Math.sqrt(s);this.kx=t*o*i,this.ky=t*o*s*(1-l1)}distance(e,t){const i=this.wrap(e[0]-t[0])*this.kx,s=(e[1]-t[1])*this.ky;return Math.sqrt(i*i+s*s)}pointOnLine(e,t){let i=1/0,s,o,r,a;for(let l=0;l<e.length-1;l++){let c=e[l][0],h=e[l][1],u=this.wrap(e[l+1][0]-c)*this.kx,d=(e[l+1][1]-h)*this.ky,f=0;(u!==0||d!==0)&&(f=(this.wrap(t[0]-c)*this.kx*u+(t[1]-h)*this.ky*d)/(u*u+d*d),f>1?(c=e[l+1][0],h=e[l+1][1]):f>0&&(c+=u/this.kx*f,h+=d/this.ky*f)),u=this.wrap(t[0]-c)*this.kx,d=(t[1]-h)*this.ky;const g=u*u+d*d;g<i&&(i=g,s=c,o=h,r=l,a=f)}return{point:[s,o],index:r,t:Math.max(0,Math.min(1,a))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}const Up=100,Gp=50;function h1(n,e){return e[0]-n[0]}function nu(n){return n[1]-n[0]+1}function Ji(n,e){return n[1]>=n[0]&&n[1]<e}function qp(n,e){if(n[0]>n[1])return[null,null];const t=nu(n);if(e){if(t===2)return[n,null];const s=Math.floor(t/2);return[[n[0],n[0]+s],[n[0]+s,n[1]]]}if(t===1)return[n,null];const i=Math.floor(t/2)-1;return[[n[0],n[0]+i],[n[0]+i+1,n[1]]]}function Wp(n,e){if(!Ji(e,n.length))return[1/0,1/0,-1/0,-1/0];const t=[1/0,1/0,-1/0,-1/0];for(let i=e[0];i<=e[1];++i)ll(t,n[i]);return t}function Vp(n){const e=[1/0,1/0,-1/0,-1/0];for(const t of n)for(const i of t)ll(e,i);return e}function u1(n){return n[0]!==-1/0&&n[1]!==-1/0&&n[2]!==1/0&&n[3]!==1/0}function Bp(n,e,t){if(!u1(n)||!u1(e))return NaN;let i=0,s=0;return n[2]<e[0]&&(i=e[0]-n[2]),n[0]>e[2]&&(i=n[0]-e[2]),n[1]>e[3]&&(s=n[1]-e[3]),n[3]<e[1]&&(s=e[1]-n[3]),t.distance([0,0],[i,s])}function So(n,e,t){const i=t.pointOnLine(e,n);return t.distance(n,i.point)}function $p(n,e,t,i,s){const o=Math.min(So(n,[t,i],s),So(e,[t,i],s)),r=Math.min(So(t,[n,e],s),So(i,[n,e],s));return Math.min(o,r)}function nO(n,e,t,i,s){if(!(Ji(e,n.length)&&Ji(i,t.length)))return 1/0;let r=1/0;for(let a=e[0];a<e[1];++a){const l=n[a],c=n[a+1];for(let h=i[0];h<i[1];++h){const u=t[h],d=t[h+1];if(tu(l,c,u,d))return 0;r=Math.min(r,$p(l,c,u,d,s))}}return r}function iO(n,e,t,i,s){if(!(Ji(e,n.length)&&Ji(i,t.length)))return NaN;let r=1/0;for(let a=e[0];a<=e[1];++a)for(let l=i[0];l<=i[1];++l)if(r=Math.min(r,s.distance(n[a],t[l])),r===0)return r;return r}function sO(n,e,t){if(Fr(n,e,!0))return 0;let i=1/0;for(const s of e){const o=s[0],r=s[s.length-1];if(o!==r&&(i=Math.min(i,So(n,[r,o],t)),i===0))return i;const a=t.pointOnLine(s,n);if(i=Math.min(i,t.distance(n,a.point)),i===0)return i}return i}function oO(n,e,t,i){if(!Ji(e,n.length))return NaN;for(let o=e[0];o<=e[1];++o)if(Fr(n[o],t,!0))return 0;let s=1/0;for(let o=e[0];o<e[1];++o){const r=n[o],a=n[o+1];for(const l of t)for(let c=0,h=l.length,u=h-1;c<h;u=c++){const d=l[u],f=l[c];if(tu(r,a,d,f))return 0;s=Math.min(s,$p(r,a,d,f,i))}}return s}function d1(n,e){for(const t of n)for(const i of t)if(Fr(i,e,!0))return!0;return!1}function rO(n,e,t,i=1/0){const s=Vp(n),o=Vp(e);if(i!==1/0&&Bp(s,o,t)>=i)return i;if(cl(s,o)){if(d1(n,e))return 0}else if(d1(e,n))return 0;let r=1/0;for(const a of n)for(let l=0,c=a.length,h=c-1;l<c;h=l++){const u=a[h],d=a[l];for(const f of e)for(let g=0,_=f.length,v=_-1;g<_;v=g++){const E=f[v],w=f[g];if(tu(u,d,E,w))return 0;r=Math.min(r,$p(u,d,E,w,t))}}return r}function f1(n,e,t,i,s,o){if(!o)return;const r=Bp(Wp(i,o),s,t);r<e&&n.push([r,o,[0,0]])}function iu(n,e,t,i,s,o,r){if(!o||!r)return;const a=Bp(Wp(i,o),Wp(s,r),t);a<e&&n.push([a,o,r])}function su(n,e,t,i,s=1/0){let o=Math.min(i.distance(n[0],t[0][0]),s);if(o===0)return o;const r=new r1([[0,[0,n.length-1],[0,0]]],h1),a=Vp(t);for(;r.length>0;){const l=r.pop();if(l[0]>=o)continue;const c=l[1],h=e?Gp:Up;if(nu(c)<=h){if(!Ji(c,n.length))return NaN;if(e){const u=oO(n,c,t,i);if(isNaN(u)||u===0)return u;o=Math.min(o,u)}else for(let u=c[0];u<=c[1];++u){const d=sO(n[u],t,i);if(o=Math.min(o,d),o===0)return 0}}else{const u=qp(c,e);f1(r,o,i,n,a,u[0]),f1(r,o,i,n,a,u[1])}}return o}function ou(n,e,t,i,s,o=1/0){let r=Math.min(o,s.distance(n[0],t[0]));if(r===0)return r;const a=new r1([[0,[0,n.length-1],[0,t.length-1]]],h1);for(;a.length>0;){const l=a.pop();if(l[0]>=r)continue;const c=l[1],h=l[2],u=e?Gp:Up,d=i?Gp:Up;if(nu(c)<=u&&nu(h)<=d){if(!Ji(c,n.length)&&Ji(h,t.length))return NaN;let f;if(e&&i)f=nO(n,c,t,h,s),r=Math.min(r,f);else if(e&&!i){const g=n.slice(c[0],c[1]+1);for(let _=h[0];_<=h[1];++_)if(f=So(t[_],g,s),r=Math.min(r,f),r===0)return r}else if(!e&&i){const g=t.slice(h[0],h[1]+1);for(let _=c[0];_<=c[1];++_)if(f=So(n[_],g,s),r=Math.min(r,f),r===0)return r}else f=iO(n,c,t,h,s),r=Math.min(r,f)}else{const f=qp(c,e),g=qp(h,i);iu(a,r,s,n,t,f[0],g[0]),iu(a,r,s,n,t,f[0],g[1]),iu(a,r,s,n,t,f[1],g[0]),iu(a,r,s,n,t,f[1],g[1])}}return r}function aO(n,e){const t=n.geometry(),i=t.flat().map(r=>Np([r.x,r.y],n.canonical));if(t.length===0)return NaN;const s=new jp(i[0][1]);let o=1/0;for(const r of e){switch(r.type){case"Point":o=Math.min(o,ou(i,!1,[r.coordinates],!1,s,o));break;case"LineString":o=Math.min(o,ou(i,!1,r.coordinates,!0,s,o));break;case"Polygon":o=Math.min(o,su(i,!1,r.coordinates,s,o));break}if(o===0)return o}return o}function lO(n,e){const t=n.geometry(),i=t.flat().map(r=>Np([r.x,r.y],n.canonical));if(t.length===0)return NaN;const s=new jp(i[0][1]);let o=1/0;for(const r of e){switch(r.type){case"Point":o=Math.min(o,ou(i,!0,[r.coordinates],!1,s,o));break;case"LineString":o=Math.min(o,ou(i,!0,r.coordinates,!0,s,o));break;case"Polygon":o=Math.min(o,su(i,!0,r.coordinates,s,o));break}if(o===0)return o}return o}function cO(n,e){const t=n.geometry();if(t.length===0||t[0].length===0)return NaN;const i=JI(t).map(r=>r.map(a=>a.map(l=>Np([l.x,l.y],n.canonical)))),s=new jp(i[0][0][0][1]);let o=1/0;for(const r of e)for(const a of i){switch(r.type){case"Point":o=Math.min(o,su([r.coordinates],!1,a,s,o));break;case"LineString":o=Math.min(o,su(r.coordinates,!0,a,s,o));break;case"Polygon":o=Math.min(o,rO(a,r.coordinates,s,o));break}if(o===0)return o}return o}function Hp(n){return n.type==="MultiPolygon"?n.coordinates.map(e=>({type:"Polygon",coordinates:e})):n.type==="MultiLineString"?n.coordinates.map(e=>({type:"LineString",coordinates:e})):n.type==="MultiPoint"?n.coordinates.map(e=>({type:"Point",coordinates:e})):[n]}class Ro{constructor(e,t){this.type=ie,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(sl(e[1])){const i=e[1];if(i.type==="FeatureCollection")return new Ro(i,i.features.map(s=>Hp(s.geometry)).flat());if(i.type==="Feature")return new Ro(i,Hp(i.geometry));if("type"in i&&"coordinates"in i)return new Ro(i,Hp(i))}return t.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return aO(e,this.geometries);if(e.geometryType()==="LineString")return lO(e,this.geometries);if(e.geometryType()==="Polygon")return cO(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class hl{constructor(e){this.type=Te,this.key=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const i=e[1];return i==null?t.error("Global state property must be defined."):typeof i!="string"?t.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new hl(i)}evaluate(e){var t;const i=(t=e.globals)===null||t===void 0?void 0:t.globalState;return!i||Object.keys(i).length===0?null:Vw(i,this.key)}eachChild(){}outputDefined(){return!1}}const ru={"==":DI,"!=":FI,">":zI,"<":LI,">=":kI,"<=":NI,array:si,at:Rp,boolean:si,case:Op,coalesce:al,collator:eu,format:Fp,image:Lp,in:Tp,"index-of":Kh,interpolate:Ri,"interpolate-hcl":Ri,"interpolate-lab":Ri,length:zp,let:Yh,literal:Mr,match:Ip,number:si,"number-format":Dp,object:si,slice:Qh,step:Jh,string:si,"to-boolean":Ws,"to-color":Ws,"to-number":Ws,"to-string":Ws,var:Zh,within:Po,distance:Ro,"global-state":hl};class En{constructor(e,t,i,s){this.name=e,this.type=t,this._evaluate=i,this.args=s}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){const i=e[0],s=En.definitions[i];if(!s)return t.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const o=Array.isArray(s)?s[0]:s.type,r=Array.isArray(s)?[[s[1],s[2]]]:s.overloads,a=r.filter(([c])=>!Array.isArray(c)||c.length===e.length-1);let l=null;for(const[c,h]of a){l=new Xh(t.registry,au,t.path,null,t.scope);const u=[];let d=!1;for(let f=1;f<e.length;f++){const g=e[f],_=Array.isArray(c)?c[f-1]:c.type,v=l.parse(g,1+u.length,_);if(!v){d=!0;break}u.push(v)}if(!d){if(Array.isArray(c)&&c.length!==u.length){l.error(`Expected ${c.length} arguments, but found ${u.length} instead.`);continue}for(let f=0;f<u.length;f++){const g=Array.isArray(c)?c[f]:c.type,_=u[f];l.concat(f+1).checkSubtype(g,_.type)}if(l.errors.length===0)return new En(i,o,h,u)}}if(a.length===1)t.errors.push(...l.errors);else{const h=(a.length?a:r).map(([d])=>uO(d)).join(" | "),u=[];for(let d=1;d<e.length;d++){const f=t.parse(e[d],1+u.length);if(!f)return null;u.push(dt(f.type))}t.error(`Expected arguments of type ${h}, but found (${u.join(", ")}) instead.`)}return null}static register(e,t){En.definitions=t;for(const i in t)e[i]=En}}function p1(n,[e,t,i,s]){e=e.evaluate(n),t=t.evaluate(n),i=i.evaluate(n);const o=s?s.evaluate(n):1,r=Hw(e,t,i,o);if(r)throw new mt(r);return new Ue(e/255,t/255,i/255,o,!1)}function g1(n,e){return n in e}function Xp(n,e){const t=e[n];return typeof t>"u"?null:t}function hO(n,e,t,i){for(;t<=i;){const s=t+i>>1;if(e[s]===n)return!0;e[s]>n?i=s-1:t=s+1}return!1}function To(n){return{type:n}}En.register(ru,{error:[sI,[Ce],(n,[e])=>{throw new mt(e.evaluate(n))}],typeof:[Ce,[Te],(n,[e])=>dt(Tt(e.evaluate(n)))],"to-rgba":[Jt(ie,4),[Pi],(n,[e])=>{const[t,i,s,o]=e.evaluate(n).rgb;return[t*255,i*255,s*255,o]}],rgb:[Pi,[ie,ie,ie],p1],rgba:[Pi,[ie,ie,ie,ie],p1],has:{type:Ae,overloads:[[[Ce],(n,[e])=>g1(e.evaluate(n),n.properties())],[[Ce,Eo],(n,[e,t])=>g1(e.evaluate(n),t.evaluate(n))]]},get:{type:Te,overloads:[[[Ce],(n,[e])=>Xp(e.evaluate(n),n.properties())],[[Ce,Eo],(n,[e,t])=>Xp(e.evaluate(n),t.evaluate(n))]]},"feature-state":[Te,[Ce],(n,[e])=>Xp(e.evaluate(n),n.featureState||{})],properties:[Eo,[],n=>n.properties()],"geometry-type":[Ce,[],n=>n.geometryType()],id:[Te,[],n=>n.id()],zoom:[ie,[],n=>n.globals.zoom],"heatmap-density":[ie,[],n=>n.globals.heatmapDensity||0],elevation:[ie,[],n=>n.globals.elevation||0],"line-progress":[ie,[],n=>n.globals.lineProgress||0],accumulated:[Te,[],n=>n.globals.accumulated===void 0?null:n.globals.accumulated],"+":[ie,To(ie),(n,e)=>{let t=0;for(const i of e)t+=i.evaluate(n);return t}],"*":[ie,To(ie),(n,e)=>{let t=1;for(const i of e)t*=i.evaluate(n);return t}],"-":{type:ie,overloads:[[[ie,ie],(n,[e,t])=>e.evaluate(n)-t.evaluate(n)],[[ie],(n,[e])=>-e.evaluate(n)]]},"/":[ie,[ie,ie],(n,[e,t])=>e.evaluate(n)/t.evaluate(n)],"%":[ie,[ie,ie],(n,[e,t])=>e.evaluate(n)%t.evaluate(n)],ln2:[ie,[],()=>Math.LN2],pi:[ie,[],()=>Math.PI],e:[ie,[],()=>Math.E],"^":[ie,[ie,ie],(n,[e,t])=>Math.pow(e.evaluate(n),t.evaluate(n))],sqrt:[ie,[ie],(n,[e])=>Math.sqrt(e.evaluate(n))],log10:[ie,[ie],(n,[e])=>Math.log(e.evaluate(n))/Math.LN10],ln:[ie,[ie],(n,[e])=>Math.log(e.evaluate(n))],log2:[ie,[ie],(n,[e])=>Math.log(e.evaluate(n))/Math.LN2],sin:[ie,[ie],(n,[e])=>Math.sin(e.evaluate(n))],cos:[ie,[ie],(n,[e])=>Math.cos(e.evaluate(n))],tan:[ie,[ie],(n,[e])=>Math.tan(e.evaluate(n))],asin:[ie,[ie],(n,[e])=>Math.asin(e.evaluate(n))],acos:[ie,[ie],(n,[e])=>Math.acos(e.evaluate(n))],atan:[ie,[ie],(n,[e])=>Math.atan(e.evaluate(n))],min:[ie,To(ie),(n,e)=>Math.min(...e.map(t=>t.evaluate(n)))],max:[ie,To(ie),(n,e)=>Math.max(...e.map(t=>t.evaluate(n)))],abs:[ie,[ie],(n,[e])=>Math.abs(e.evaluate(n))],round:[ie,[ie],(n,[e])=>{const t=e.evaluate(n);return t<0?-Math.round(-t):Math.round(t)}],floor:[ie,[ie],(n,[e])=>Math.floor(e.evaluate(n))],ceil:[ie,[ie],(n,[e])=>Math.ceil(e.evaluate(n))],"filter-==":[Ae,[Ce,Te],(n,[e,t])=>n.properties()[e.value]===t.value],"filter-id-==":[Ae,[Te],(n,[e])=>n.id()===e.value],"filter-type-==":[Ae,[Ce],(n,[e])=>n.geometryType()===e.value],"filter-<":[Ae,[Ce,Te],(n,[e,t])=>{const i=n.properties()[e.value],s=t.value;return typeof i==typeof s&&i<s}],"filter-id-<":[Ae,[Te],(n,[e])=>{const t=n.id(),i=e.value;return typeof t==typeof i&&t<i}],"filter->":[Ae,[Ce,Te],(n,[e,t])=>{const i=n.properties()[e.value],s=t.value;return typeof i==typeof s&&i>s}],"filter-id->":[Ae,[Te],(n,[e])=>{const t=n.id(),i=e.value;return typeof t==typeof i&&t>i}],"filter-<=":[Ae,[Ce,Te],(n,[e,t])=>{const i=n.properties()[e.value],s=t.value;return typeof i==typeof s&&i<=s}],"filter-id-<=":[Ae,[Te],(n,[e])=>{const t=n.id(),i=e.value;return typeof t==typeof i&&t<=i}],"filter->=":[Ae,[Ce,Te],(n,[e,t])=>{const i=n.properties()[e.value],s=t.value;return typeof i==typeof s&&i>=s}],"filter-id->=":[Ae,[Te],(n,[e])=>{const t=n.id(),i=e.value;return typeof t==typeof i&&t>=i}],"filter-has":[Ae,[Te],(n,[e])=>e.value in n.properties()],"filter-has-id":[Ae,[],n=>n.id()!==null&&n.id()!==void 0],"filter-type-in":[Ae,[Jt(Ce)],(n,[e])=>e.value.indexOf(n.geometryType())>=0],"filter-id-in":[Ae,[Jt(Te)],(n,[e])=>e.value.indexOf(n.id())>=0],"filter-in-small":[Ae,[Ce,Jt(Te)],(n,[e,t])=>t.value.indexOf(n.properties()[e.value])>=0],"filter-in-large":[Ae,[Ce,Jt(Te)],(n,[e,t])=>hO(n.properties()[e.value],t.value,0,t.value.length-1)],all:{type:Ae,overloads:[[[Ae,Ae],(n,[e,t])=>e.evaluate(n)&&t.evaluate(n)],[To(Ae),(n,e)=>{for(const t of e)if(!t.evaluate(n))return!1;return!0}]]},any:{type:Ae,overloads:[[[Ae,Ae],(n,[e,t])=>e.evaluate(n)||t.evaluate(n)],[To(Ae),(n,e)=>{for(const t of e)if(t.evaluate(n))return!0;return!1}]]},"!":[Ae,[Ae],(n,[e])=>!e.evaluate(n)],"is-supported-script":[Ae,[Ce],(n,[e])=>{const t=n.globals&&n.globals.isSupportedScript;return t?t(e.evaluate(n)):!0}],upcase:[Ce,[Ce],(n,[e])=>e.evaluate(n).toUpperCase()],downcase:[Ce,[Ce],(n,[e])=>e.evaluate(n).toLowerCase()],concat:[Ce,To(Te),(n,e)=>e.map(t=>rl(t.evaluate(n))).join("")],split:[Jt(Ce),[Ce,Ce],(n,[e,t])=>e.evaluate(n).split(t.evaluate(n))],join:[Ce,[Jt(Ce),Ce],(n,[e,t])=>e.evaluate(n).join(t.evaluate(n))],"resolved-locale":[Ce,[Gh],(n,[e])=>e.evaluate(n).resolvedLocale()]});function uO(n){return Array.isArray(n)?`(${n.map(dt).join(", ")})`:`(${dt(n.type)}...)`}function au(n){if(n instanceof Zh)return au(n.boundExpression);if(n instanceof En&&n.name==="error")return!1;if(n instanceof eu)return!1;if(n instanceof Po)return!1;if(n instanceof Ro)return!1;if(n instanceof hl)return!1;const e=n instanceof Ws||n instanceof si;let t=!0;return n.eachChild(i=>{e?t=t&&au(i):t=t&&i instanceof Mr}),t?Yp(n)&&Kp(n,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function Yp(n){if(n instanceof En){if(n.name==="get"&&n.args.length===1)return!1;if(n.name==="feature-state")return!1;if(n.name==="has"&&n.args.length===1)return!1;if(n.name==="properties"||n.name==="geometry-type"||n.name==="id")return!1;if(/^filter-/.test(n.name))return!1}if(n instanceof Po||n instanceof Ro)return!1;let e=!0;return n.eachChild(t=>{e&&!Yp(t)&&(e=!1)}),e}function Zp(n){if(n instanceof En&&n.name==="feature-state")return!1;let e=!0;return n.eachChild(t=>{e&&!Zp(t)&&(e=!1)}),e}function Kp(n,e){if(n instanceof En&&e.indexOf(n.name)>=0)return!1;let t=!0;return n.eachChild(i=>{t&&!Kp(i,e)&&(t=!1)}),t}function Qp(n){return{result:"success",value:n}}function Lr(n){return{result:"error",value:n}}function dO(n){return n["property-type"]==="data-driven"||n["property-type"]==="cross-faded-data-driven"}function fO(n){return!!n.expression&&n.expression.parameters.indexOf("zoom")>-1}function pO(n){return!!n.expression&&n.expression.interpolated}function lu(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)&&Tt(n)===Eo}class gO{constructor(e,t,i){this.expression=e,this._warningHistory={},this._evaluator=new Yw,this._defaultValue=t?yO(t):null,this._enumValues=t&&t.type==="enum"?t.values:null,this._globalState=i}evaluateWithoutErrorHandling(e,t,i,s,o,r){return this._globalState&&(e=zr(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=i,this._evaluator.canonical=s,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=r,this.expression.evaluate(this._evaluator)}evaluate(e,t,i,s,o,r){this._globalState&&(e=zr(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=i||null,this._evaluator.canonical=s,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=r||null;try{const a=this.expression.evaluate(this._evaluator);if(a==null||typeof a=="number"&&a!==a)return this._defaultValue;if(this._enumValues&&!(a in this._enumValues))throw new mt(`Expected value to be one of ${Object.keys(this._enumValues).map(l=>JSON.stringify(l)).join(", ")}, but found ${JSON.stringify(a)} instead.`);return a}catch(a){return this._warningHistory[a.message]||(this._warningHistory[a.message]=!0,typeof console<"u"&&console.warn(a.message)),this._defaultValue}}}function cu(n){return Array.isArray(n)&&n.length>0&&typeof n[0]=="string"&&n[0]in ru}function m1(n,e,t){const i=new Xh(ru,au,[],e?mO(e):void 0),s=i.parse(n,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?Qp(new gO(s,e,t)):Lr(i.errors)}class y1{constructor(e,t,i){this.kind=e,this._styleExpression=t,this.isStateDependent=e!=="constant"&&!Zp(t.expression),this.globalStateRefs=uu(t.expression),this._globalState=i}evaluateWithoutErrorHandling(e,t,i,s,o,r){return this._globalState&&(e=zr(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,i,s,o,r)}evaluate(e,t,i,s,o,r){return this._globalState&&(e=zr(e,this._globalState)),this._styleExpression.evaluate(e,t,i,s,o,r)}}class _1{constructor(e,t,i,s,o){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent=e!=="camera"&&!Zp(t.expression),this.globalStateRefs=uu(t.expression),this.interpolationType=s,this._globalState=o}evaluateWithoutErrorHandling(e,t,i,s,o,r){return this._globalState&&(e=zr(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,i,s,o,r)}evaluate(e,t,i,s,o,r){return this._globalState&&(e=zr(e,this._globalState)),this._styleExpression.evaluate(e,t,i,s,o,r)}interpolationFactor(e,t,i){return this.interpolationType?Ri.interpolationFactor(this.interpolationType,e,t,i):0}}function w1(n,e,t){const i=m1(n,e,t);if(i.result==="error")return i;const s=i.value.expression,o=Yp(s);if(!o&&!dO(e))return Lr([new xi("","data expressions not supported")]);const r=Kp(s,["zoom"]);if(!r&&!fO(e))return Lr([new xi("","zoom expressions not supported")]);const a=hu(s);if(!a&&!r)return Lr([new xi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(a instanceof xi)return Lr([a]);if(a instanceof Ri&&!pO(e))return Lr([new xi("",'"interpolate" expressions cannot be used with this property')]);if(!a)return Qp(o?new y1("constant",i.value,t):new y1("source",i.value,t));const l=a instanceof Ri?a.interpolation:void 0;return Qp(o?new _1("camera",i.value,a.labels,l,t):new _1("composite",i.value,a.labels,l,t))}function hu(n){let e=null;if(n instanceof Yh)e=hu(n.result);else if(n instanceof al){for(const t of n.args)if(e=hu(t),e)break}else(n instanceof Jh||n instanceof Ri)&&n.input instanceof En&&n.input.name==="zoom"&&(e=n);return e instanceof xi||n.eachChild(t=>{const i=hu(t);i instanceof xi?e=i:!e&&i?e=new xi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new xi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function uu(n,e=new Set){return n instanceof hl&&e.add(n.key),n.eachChild(t=>{uu(t,e)}),e}function mO(n){const e={color:Pi,string:Ce,number:ie,enum:Ce,boolean:Ae,formatted:qh,padding:Wh,numberArray:Vh,colorArray:el,projectionDefinition:Uh,resolvedImage:tl,variableAnchorOffsetCollection:Bh};return n.type==="array"?Jt(e[n.value]||Te,n.length):e[n.type]}function yO(n){if(n.type==="color"&&lu(n.default))return new Ue(0,0,0,0);switch(n.type){case"color":return Ue.parse(n.default)||null;case"padding":return ti.parse(n.default)||null;case"numberArray":return ni.parse(n.default)||null;case"colorArray":return bn.parse(n.default)||null;case"variableAnchorOffsetCollection":return Si.parse(n.default)||null;case"projectionDefinition":return ii.parse(n.default)||null;default:return n.default===void 0?null:n.default}}function zr(n,e){const{zoom:t,heatmapDensity:i,elevation:s,lineProgress:o,isSupportedScript:r,accumulated:a}=n??{};return{zoom:t,heatmapDensity:i,elevation:s,lineProgress:o,isSupportedScript:r,accumulated:a,globalState:e}}function v1(n){if(n===!0||n===!1)return!0;if(!Array.isArray(n)||n.length===0)return!1;switch(n[0]){case"has":return n.length>=2&&n[1]!=="$id"&&n[1]!=="$type";case"in":return n.length>=3&&(typeof n[1]!="string"||Array.isArray(n[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return n.length!==3||Array.isArray(n[1])||Array.isArray(n[2]);case"any":case"all":for(const e of n.slice(1))if(!v1(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const _O={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function wO(n,e){if(n==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};v1(n)||(n=du(n));const t=m1(n,_O,e);if(t.result==="error")throw new Error(t.value.map(i=>`${i.key}: ${i.message}`).join(", "));{const i=b1(n);return{filter:(s,o,r)=>t.value.evaluate(s,o,{},r),needGeometry:i,getGlobalStateRefs:()=>uu(t.value.expression)}}}function vO(n,e){return n<e?-1:n>e?1:0}function b1(n){if(!Array.isArray(n))return!1;if(n[0]==="within"||n[0]==="distance")return!0;for(let e=1;e<n.length;e++)if(b1(n[e]))return!0;return!1}function du(n){if(!n)return!0;const e=n[0];return n.length<=1?e!=="any":e==="=="?Jp(n[1],n[2],"=="):e==="!="?fu(Jp(n[1],n[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Jp(n[1],n[2],e):e==="any"?bO(n.slice(1)):e==="all"?["all"].concat(n.slice(1).map(du)):e==="none"?["all"].concat(n.slice(1).map(du).map(fu)):e==="in"?E1(n[1],n.slice(2)):e==="!in"?fu(E1(n[1],n.slice(2))):e==="has"?C1(n[1]):e==="!has"?fu(C1(n[1])):!0}function Jp(n,e,t){switch(n){case"$type":return[`filter-type-${t}`,e];case"$id":return[`filter-id-${t}`,e];default:return[`filter-${t}`,n,e]}}function bO(n){return["any"].concat(n.map(du))}function E1(n,e){if(e.length===0)return!1;switch(n){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(t=>typeof t!=typeof e[0])?["filter-in-large",n,["literal",e.sort(vO)]]:["filter-in-small",n,["literal",e]]}}function C1(n){switch(n){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",n]}}function fu(n){return["!",n]}function ul(n){return typeof n=="object"?["literal",n]:n}function x1(n,e){let t=n.stops;if(!t)return EO(n,e);const i=t&&typeof t[0][0]=="object",s=i||n.property!==void 0,o=i||!s;return t=t.map(r=>!s&&e.tokens&&typeof r[1]=="string"?[r[0],SO(r[1])]:[r[0],ul(r[1])]),i?CO(n,e,t):o?PO(n,e,t):tg(n,e,t)}function EO(n,e){const t=["get",n.property];if(n.default===void 0)return e.type==="string"?["string",t]:t;if(e.type==="enum")return["match",t,Object.keys(e.values),t,n.default];{const i=[e.type==="color"?"to-color":e.type,t,ul(n.default)];return e.type==="array"&&i.splice(1,0,e.value,e.length||null),i}}function eg(n){switch(n.colorSpace){case"hcl":return"interpolate-hcl";case"lab":return"interpolate-lab";default:return"interpolate"}}function CO(n,e,t){const i={},s={},o=[];for(let a=0;a<t.length;a++){const l=t[a],c=l[0].zoom;i[c]===void 0&&(i[c]={zoom:c,type:n.type,property:n.property,default:n.default},s[c]=[],o.push(c)),s[c].push([l[0].value,l[1]])}if(ig({},e)==="exponential"){const a=[eg(n),["linear"],["zoom"]];for(const l of o){const c=tg(i[l],e,s[l]);Nr(a,l,c,!1)}return a}else{const a=["step",["zoom"]];for(const l of o){const c=tg(i[l],e,s[l]);Nr(a,l,c,!0)}return ng(a),a}}function xO(n,e){if(n!==void 0)return n;if(e!==void 0)return e}function P1(n,e){const t=ul(xO(n.default,e.default));return t===void 0&&e.type==="resolvedImage"?"":t}function tg(n,e,t){const i=ig(n,e),s=["get",n.property];if(i==="categorical"&&typeof t[0][0]=="boolean"){const o=["case"];for(const r of t)o.push(["==",s,r[0]],r[1]);return o.push(P1(n,e)),o}else if(i==="categorical"){const o=["match",s];for(const r of t)Nr(o,r[0],r[1],!1);return o.push(P1(n,e)),o}else if(i==="interval"){const o=["step",["number",s]];for(const r of t)Nr(o,r[0],r[1],!0);return ng(o),n.default===void 0?o:["case",["==",["typeof",s],"number"],o,ul(n.default)]}else if(i==="exponential"){const o=n.base!==void 0?n.base:1,r=[eg(n),o===1?["linear"]:["exponential",o],["number",s]];for(const a of t)Nr(r,a[0],a[1],!1);return n.default===void 0?r:["case",["==",["typeof",s],"number"],r,ul(n.default)]}else throw new Error(`Unknown property function type ${i}`)}function PO(n,e,t,i=["zoom"]){const s=ig(n,e);let o,r=!1;if(s==="interval")o=["step",i],r=!0;else if(s==="exponential"){const a=n.base!==void 0?n.base:1;o=[eg(n),a===1?["linear"]:["exponential",a],i]}else throw new Error(`Unknown zoom function type "${s}"`);for(const a of t)Nr(o,a[0],a[1],r);return ng(o),o}function ng(n){n[0]==="step"&&n.length===3&&(n.push(0),n.push(n[3]))}function Nr(n,e,t,i){n.length>3&&e===n[n.length-2]||(i&&n.length===2||n.push(e),n.push(t))}function ig(n,e){return n.type?n.type:e.expression.interpolated?"exponential":"interval"}function SO(n){const e=["concat"],t=/{([^{}]+)}/g;let i=0;for(let s=t.exec(n);s!==null;s=t.exec(n)){const o=n.slice(i,t.lastIndex-s[0].length);i=t.lastIndex,o.length>0&&e.push(o),e.push(["get",s[1]])}if(e.length===1)return n;if(i<n.length)e.push(n.slice(i));else if(e.length===2)return["to-string",e[1]];return e}const S1=eI;var R1={thin:100,hairline:100,"ultra-light":200,"extra-light":200,light:300,book:300,regular:400,normal:400,plain:400,roman:400,standard:400,medium:500,"semi-bold":600,"demi-bold":600,bold:700,"extra-bold":800,"ultra-bold":800,heavy:900,black:900,"heavy-black":900,fat:900,poster:900,"ultra-black":950,"extra-black":950},dl=" ",T1=/(italic|oblique)$/i,I1={};function sg(n,e,t){var i=I1[n];if(!i){Array.isArray(n)||(n=[n]);for(var s=400,o="normal",r=[],a,l,c=0,h=n.length;c<h;++c){var u=n[c],d=u.split(" "),f=d[d.length-1].toLowerCase();f=="normal"||f=="italic"||f=="oblique"?(o=l?o:f,l=!0,d.pop(),f=d[d.length-1].toLowerCase()):T1.test(f)&&(f=f.replace(T1,""),o=l?o:d[d.length-1].replace(f,""),l=!0);for(var g in R1){var _=d.length>1?d[d.length-2].toLowerCase():"";if(f==g||f==g.replace("-","")||_+"-"+f==g){s=a?s:R1[g],d.pop(),_&&g.startsWith(_)&&d.pop();break}}!a&&typeof f=="number"&&(s=f,a=!0);var v=d.join(dl).replace("Klokantech Noto Sans","Noto Sans").replace("DIN Pro","Barlow").replace("Arial Unicode MS","Arial");v.indexOf(dl)!==-1&&(v='"'+v+'"'),r.push(v)}i=I1[n]=[o,s,r]}return i[0]+dl+i[1]+dl+e+"px"+(t?"/"+t:"")+dl+i[2]}function O1(n,[e,t,i,s]){e=e.evaluate(n),t=t.evaluate(n),i=i.evaluate(n);const o=s?s.evaluate(n):1;return Ue.parse(`hsla(${e}, ${t}%, ${i}%, ${o})`)}function RO(n){const e=n[0]/255,t=n[1]/255,i=n[2]/255,s=n[3],o=Math.max(e,t,i),r=Math.min(e,t,i),a=(o+r)/2;let l,c;if(o===r)l=0,c=0;else{const h=o-r;switch(c=a>.5?h/(2-o-r):h/(o+r),o){case e:l=(t-i)/h+(t<i?6:0);break;case t:l=(i-e)/h+2;break;case i:l=(e-t)/h+4;break;default:l=0}l/=6}return[l*360,c*100,a*100,s]}function pu(n){if(Array.isArray(n)){if(n.length===0)return n;const e=n[0];if(e==="literal")return n;if(e==="image"&&n.length===3&&typeof n[2]=="object"&&n[2]!==null&&!Array.isArray(n[2]))return["image-config",pu(n[1]),["literal",n[2]]];const t=n.length;for(let i=1;i<t;++i){const s=n[i],o=pu(s);if(o!==s){const r=[e];for(let a=1;a<i;++a)r.push(n[a]);r.push(o);for(let a=i+1;a<t;++a)r.push(pu(n[a]));return r}}}return n}const A1={},Io={zoom:0,distanceFromCenter:0};En.register(ru,{...En.definitions,pitch:[{kind:"number"},[],n=>Io.pitch||0],"distance-from-center":[{kind:"number"},[],n=>Io.distanceFromCenter||0],"to-hsla":[{kind:"array",itemType:{kind:"number"},N:4},[{kind:"string"}],(n,[e])=>RO(wc(e.evaluate(n)))],hsl:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"}],O1],hsla:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"},{kind:"number"}],O1],"image-config":[{kind:"value"},[{kind:"string"},{kind:"value"}],(n,[e,t])=>e.evaluate(n)],"measure-light":[{kind:"number"},[{kind:"value"}],()=>1],config:[{kind:"value"},[{kind:"string"}],(n,[e])=>{const t=A1[e.evaluate(n)];return t===void 0?{}:t}]});const M1="https://api.mapbox.com";function og(n){const e="mapbox://";return n.indexOf(e)!==0?"":n.slice(e.length)}function TO(n,e,t){if(typeof n=="string")return[{id:"default",url:D1(n,e,t)}];for(const i of n)i.url=D1(i.url,e,t);return n}function D1(n,e,t){const i=og(n);if(!i)return decodeURI(new URL(n,t).href);const s="sprites/";if(i.indexOf(s)!==0)throw new Error(`unexpected sprites url: ${n}`);const o=i.slice(s.length);return`${M1}/styles/v1/${o}/sprite?access_token=${e}`}function F1(n,e){const t=og(n);if(!t)return decodeURI(new URL(n,location.href).href);const i="styles/";if(t.indexOf(i)!==0)throw new Error(`unexpected style url: ${n}`);const s=t.slice(i.length);return`${M1}/styles/v1/${s}?&access_token=${e}`}const IO=["a","b","c","d"];function gu(n,e,t,i){const s=new URL(n,i||location.href),o=og(n);if(!o)return e?(s.searchParams.has(t)||s.searchParams.set(t,e),[decodeURI(s.href)]):[decodeURI(s.href)];if(o==="mapbox.satellite"){const r=window.devicePixelRatio>=1.5?"@2x":"";return[`https://api.mapbox.com/v4/${o}/{z}/{x}/{y}${r}.webp?access_token=${e}`]}return IO.map(r=>`https://${r}.tiles.mapbox.com/v4/${o}/{z}/{x}/{y}.vector.pbf?access_token=${e}`)}const rg=Object.freeze({}),L1={},z1={};let OO=0;function ag(n){return n.id||(n.id=OO++),n.id}function AO(n,e){return ag(n)+"."+Re(e)}function MO(n){let e=L1[n.id];return e||(e={},L1[ag(n)]=e),e}function DO(n){let e=z1[n.id];return e||(e={},z1[ag(n)]=e),e}function lg(n){return n*Math.PI/180}const cg=(function(){const n=[];for(let e=78271.51696402048;n.length<=24;e/=2)n.push(e);return n})();function mu(n,e){if(typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof OffscreenCanvas<"u")return new OffscreenCanvas(n,e);const t=document.createElement("canvas");return t.width=n,t.height=e,t}function FO(n,e){let t=0;const i=e.length;for(;t<i;++t)if(e[t]<n&&t+1<i){const o=e[t]/e[t+1];return t+Math.log(e[t]/n)/Math.log(o)}return i-1}function LO(n,e){const t=Math.floor(n),i=Math.pow(2,n-t);return e[t]/i}const kr={};function jr(n,e,t={},i){if(e in kr)return i&&(i.url=kr[e][0].url),kr[e][1];const s=t.transformRequest&&t.transformRequest(e,n)||e,o=function(l){return delete kr[e],Promise.reject(new Error("Error fetching source "+e))},r=function(l){return delete kr[e],l.ok?l.json():Promise.reject(new Error("Error fetching source "+e))},a=Bo(()=>s).then(l=>l instanceof Response?(i&&(i.url=l.url),r(l)):(l instanceof Request||(l=new Request(l)),l.headers.get("Accept")||l.headers.set("Accept","application/json"),i&&(i.url=l.url),fetch(l).then(r).catch(o))).catch(o);return kr[e]=[s,a],a}function zO(n,e){if(typeof n=="string")if(n.trim().startsWith("{"))try{const t=JSON.parse(n);return Promise.resolve(t)}catch(t){return Promise.reject(t)}else return n=F1(n,e.accessToken),jr("Style",n,e);else return Promise.resolve(n)}const N1={};function NO(n,e,t={}){const i=[e,JSON.stringify(n)].toString();let s=N1[i];if(!s||t.transformRequest){let o;t.transformRequest&&(o=(a,l)=>{const c=t.transformRequest&&t.transformRequest(l,"Tiles")||l;if(a instanceof Mi.VectorTile)a.setLoader((h,u,d)=>{const f=function(g){g.arrayBuffer().then(_=>{const E=a.getFormat().readFeatures(_,{extent:h,featureProjection:d});a.setFeatures(E)})};Bo(()=>c).then(g=>{if(g instanceof Response)return f(g);fetch(g).then(f).catch(_=>a.setState(oe.ERROR))}).catch(g=>a.setState(oe.ERROR))});else{const h=a.getImage();Bo(()=>c).then(u=>{if(typeof u=="string"){h.src=u;return}const d=f=>f.blob().then(g=>{const _=URL.createObjectURL(g);h.addEventListener("load",()=>URL.revokeObjectURL(_)),h.addEventListener("error",()=>URL.revokeObjectURL(_)),h.src=_});if(u instanceof Response)return d(u);fetch(u).then(d).catch(f=>a.setState(oe.ERROR))}).catch(u=>a.setState(oe.ERROR))}});const r=n.url;if(r&&!n.tiles){const a=gu(r,t.accessToken,t.accessTokenParam||"access_token",e||location.href);if(r.startsWith("mapbox://"))s=Promise.resolve({tileJson:Object.assign({},n,{url:void 0,tiles:a}),tileLoadFunction:o});else{const l={};s=jr("Source",a[0],t,l).then(function(c){return c.tiles=c.tiles.map(function(h){return c.scheme==="tms"&&(h=h.replace("{y}","{-y}")),gu(h,t.accessToken,t.accessTokenParam||"access_token",l.url)[0]}),Promise.resolve({tileJson:c,tileLoadFunction:o})})}}else n.tiles?(n=Object.assign({},n,{tiles:n.tiles.map(function(a){return n.scheme==="tms"&&(a=a.replace("{y}","{-y}")),gu(a,t.accessToken,t.accessTokenParam||"access_token",e||location.href)[0]})}),s=Promise.resolve({tileJson:Object.assign({},n),tileLoadFunction:o})):s=Promise.reject(new Error("source has no `tiles` nor `url`"));N1[i]=s}return s}function k1(n,e,t,i){const s=[2*t*e.pixelRatio+e.width,2*t*e.pixelRatio+e.height],o=mu(s[0],s[1]),r=o.getContext("2d");r.drawImage(n,e.x,e.y,e.width,e.height,t*e.pixelRatio,t*e.pixelRatio,e.width,e.height);const a=r.getImageData(0,0,s[0],s[1]);r.globalCompositeOperation="destination-over",r.fillStyle=`rgba(${i.r*255},${i.g*255},${i.b*255},${i.a})`;const l=a.data;for(let c=0,h=a.width;c<h;++c)for(let u=0,d=a.height;u<d;++u){const f=(u*h+c)*4;l[f+3]>0&&r.arc(c,u,t*e.pixelRatio,0,2*Math.PI)}return r.fill(),o}function kO(n,e,t){const i=Math.max(0,Math.min(1,(t-n)/(e-n)));return i*i*(3-2*i)}function j1(n,e,t){const i=mu(e.width,e.height),s=i.getContext("2d");s.drawImage(n,e.x,e.y,e.width,e.height,0,0,e.width,e.height);const o=s.getImageData(0,0,e.width,e.height),r=o.data;for(let a=0,l=o.width;a<l;++a)for(let c=0,h=o.height;c<h;++c){const u=(c*l+a)*4,d=r[u+3]/255,f=.75,g=.1,_=kO(f-g,f+g,d);_>0?(r[u+0]=Math.round(255*t.r*_),r[u+1]=Math.round(255*t.g*_),r[u+2]=Math.round(255*t.b*_),r[u+3]=Math.round(255*_)):r[u+3]=0}return s.putImageData(o,0,0),i}const jO=Array(256).join(" ");function hg(n,e){if(e>=.05){let t="";const i=n.split(`
159
+ `),s=jO.slice(0,Math.round(e/.1));for(let o=0,r=i.length;o<r;++o)o>0&&(t+=`
160
+ `),t+=i[o].split("").join(s);return t}return n}let ug;function U1(){return ug||(ug=mu(1,1).getContext("2d")),ug}function UO(n,e){if(/\d+ \d+/.test(n)){const[t,i]=n.split(" ").map(Number);return t<=e&&e<=i}return n==e}function Oo(n,e){return U1().measureText(n).width+(n.length-1)*e}const yu={};lo.on("propertychange",()=>{for(const n in yu)delete yu[n]});function dg(n,e,t,i){if(n.indexOf(`
161
+ `)!==-1){const r=n.split(`
162
+ `),a=[];for(let l=0,c=r.length;l<c;++l)a.push(dg(r[l],e,t,i));return a.join(`
163
+ `)}const s=t+","+e+","+n+","+i;let o=yu[s];if(!o){const r=n.split(" ");if(r.length>1){const a=U1();a.font=e;const c=a.measureText("M").width*t;let h="";const u=[];for(let d=0,f=r.length;d<f;++d){const g=r[d],_=h+(h?" ":"")+g;Oo(_,i)<=c?h=_:(h&&u.push(h),h=g)}h&&u.push(h);for(let d=0,f=u.length;d<f&&f>1;++d){const g=u[d];if(Oo(g,i)<c*.35){const _=d>0?Oo(u[d-1],i):1/0,v=d<f-1?Oo(u[d+1],i):1/0;u.splice(d,1),f-=1,_<v?(u[d-1]+=" "+g,d-=1):u[d]=g+" "+u[d]}}for(let d=0,f=u.length-1;d<f;++d){const g=u[d],_=u[d+1];if(Oo(g,i)>c*.7&&Oo(_,i)<c*.6){const v=g.split(" "),E=v.pop();Oo(E,i)<c*.2&&(u[d]=v.join(" "),u[d+1]=E+" "+_),f-=1}}o=u.join(`
164
+ `)}else o=n;o=hg(o,i),yu[s]=o}return o}const GO=["Arial","Courier New","Times New Roman","Verdana","sans-serif","serif","monospace","cursive","fantasy"],G1={};function qO(n,e="https://cdn.jsdelivr.net/npm/@fontsource/{font-family}/{fontweight}{-fontstyle}.css"){if(ln)return n;let t;for(let i=0,s=n.length;i<s;++i){const o=n[i];if(o in G1)continue;G1[o]=!0;const a=sg(o,16).split(" ");t||(t=[]),t.push([a.slice(3).join(" ").replace(/"/g,""),a[1],a[0]])}return t&&(async()=>{await document.fonts.ready;for(let i=0,s=t.length;i<s;++i){const o=t[i],r=o[0];if(GO.includes(r))continue;const a=o[1],l=o[2];if(!(await document.fonts.load(`${l} ${a} 16px "${r}"`)).some(h=>h.family.replace(/^['"]|['"]$/g,"").toLowerCase()===r.toLowerCase()&&UO(h.weight,a)&&h.style===l)){const h=e.replace("{font-family}",r.replace(/ /g,"-").toLowerCase()).replace("{Font+Family}",r.replace(/ /g,"+")).replace("{fontweight}",a).replace("{-fontstyle}",l.replace("normal","").replace(/(.+)/,"-$1")).replace("{fontstyle}",l);if(!document.querySelector('link[href="'+h+'"]')){const u=document.createElement("link");u.href=h,u.rel="stylesheet",document.head.appendChild(u)}}}})(),n}const WO={Point:1,MultiPoint:1,LineString:2,MultiLineString:2,Polygon:3,MultiPolygon:3},VO={center:[.5,.5],left:[0,.5],right:[1,.5],top:[.5,0],bottom:[.5,1],"top-left":[0,0],"top-right":[1,0],"bottom-left":[0,1],"bottom-right":[1,1]},q1=function(n,e){let t=w1(n,e);if(t.result==="error"){const i=pu(n);i!==n&&(t=w1(i,e))}if(t.result==="error"){const i=t.value[0];return console.error("Error parsing expression:",n,i.key,i.message),{evaluate:()=>e.default}}return t.value};let _u,fg;function ue(n,e,t,i,s,o){const r=n.id;s||(s={},console.warn("No functionCache provided to getValue()")),s[r]||(s[r]={});const a=s[r];if(!a[t]){let l=(n[e]||rg)[t];const c=S1[`${e}_${n.type}`]&&S1[`${e}_${n.type}`][t];l===void 0&&c&&(l=c.default);let h=cu(l);if(!h&&lu(l)&&(l=x1(l,c),h=!0),h){const u=q1(l,c);a[t]=u.evaluate.bind(u)}else{const u=c?c.type:typeof l;(u==="color"||u==="colorArray")&&(l=Ue.parse(l));let d=!1;if(u==="array")for(let f=0;f<l.length;++f){const g=l[f];if(cu(g)||lu(g)){d=!0;break}}if(d){const f=Object.assign({},c,{type:c.value}),g=[];for(let _=0;_<l.length;++_){let v=l[_];if(!cu(v)&&lu(v)&&(v=x1(v,f)),cu(v)){const E=q1(v,f);g.push(E.evaluate.bind(E))}else g.push(function(){return v})}a[t]=function(_,v,E){const w=[];for(let C=0;C<g.length;++C)w[C]=g[C](_,v,E);return w}}else a[t]=function(){return l}}}return a[t](Io,i,o)}function W1(n,e,t,i){return ue(n,"layout",`${t}-allow-overlap`,e,i)?ue(n,"layout",`${t}-ignore-placement`,e,i)?"none":"obstacle":"declutter"}function BO(n,e,t,i){if(i||console.warn("No filterCache provided to evaluateFilter()"),!(n in i))try{i[n]=wO(e).filter}catch(s){console.warn("Filter will evaluate to false: "+s.message),i[n]=function(){return!1}}return i[n](Io,t)}function Ao(n,e){if(n){if(n.a===0||e===0)return;const t=n.a;return e=e===void 0?1:e,t===0?"transparent":"rgba("+Math.round(n.r*255/t)+","+Math.round(n.g*255/t)+","+Math.round(n.b*255/t)+","+t*e+")"}return n}const $O=/\{[^{}}]*\}/g;function pg(n,e){return n.replace($O,function(t){return e[t.slice(1,-1)]||""})}function V1(n,e){let t=n.split(":")[0];return t===n&&(t="default"),e[t]}const HO={};function XO(n,e,t,i=cg,s=void 0,o=void 0,r=void 0,a=void 0){if(typeof e=="string"&&(e=JSON.parse(e)),e.schema)for(const C in e.schema){const P=e.schema[C];"default"in P&&(A1[C]=P.default)}if(e.version!=8)throw new Error("glStyle version 8 required.");HO[AO(e,n)]=Array.from(arguments);const l={};(typeof o=="string"||o instanceof Request||o instanceof Response||o instanceof Promise)&&(o={default:o});for(const C in o){const P=o[C];Bo(()=>P).then(async R=>{let A;if(typeof Image<"u"){const O=new Image;if(typeof R=="string")O.crossOrigin="anonymous",O.src=R;else{let M;R instanceof Request?M=await fetch(R):R instanceof Response&&(M=R);const z=await M.blob();A=URL.createObjectURL(z),O.src=A}O.addEventListener("load",function M(){O.removeEventListener("load",M),l[C]={image:O,size:[O.width,O.height]},n.changed(),A&&URL.revokeObjectURL(A)}),O.addEventListener("error",function M(){URL.revokeObjectURL(A),O.removeEventListener("error",M)})}else if(typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope){const O=self;O.postMessage({action:"loadImage",src:R}),O.addEventListener("message",function(z){z.data.action==="imageLoaded"&&z.data.src===R&&(l[C]={image:z.data.image,size:[z.data.image.width,z.data.image.height]})})}})}const c=iI(e.layers),h={},u=[],d={},f={},g=MO(e),_=DO(e);let v;for(let C=0,P=c.length;C<P;++C){const R=c[C],A=R.id;if(typeof t=="string"&&R.source==t||Array.isArray(t)&&t.indexOf(A)!==-1){const O=R["source-layer"];if(v){if(R.source!==v)throw new Error(`Layer "${A}" does not use source "${v}`)}else{v=R.source;const z=e.sources[v];if(!z)throw new Error(`Source "${v}" is not defined`);const k=z.type;if(k!=="vector"&&k!=="geojson")throw new Error(`Source "${v}" is not of type "vector" or "geojson", but "${k}"`)}let M=h[O];M||(M=[],h[O]=M),M.push({layer:R,index:C}),u.push(A)}}const E=[],w=function(C,P,R){var L,N,j;const A=((j=(N=(L=n.getSource)==null?void 0:L.call(n))==null?void 0:N.format_)==null?void 0:j.layerName_)??"mvt:layer",O=C.getProperties(),M=h[O[A]];if(!M)return;let z=i.indexOf(P);z==-1&&(z=FO(P,i)),Io.zoom=z,Io.distanceFromCenter=0;const k=C.getGeometry(),q=WO[k.getType()],Y=n.get("map");if(Y&&Y instanceof yy&&q===1){const U=Y.getSize();if(U){const B=Y.getView().getCenter(),Z=xn(k.getExtent());Io.distanceFromCenter=jv(B,Z)/P/U[1]}}const m={id:C.getId(),properties:O,type:q},b=n.get("mapbox-featurestate")[C.getId()];let S=-1;for(let U=0,B=M.length;U<B;++U){const Z=M[U],G=Z.layer,ae=G.id;if(R!==void 0&&R!==ae)continue;const ne=G.layout||rg,V=G.paint||rg;if(ue(G,"layout","visibility",m,g,b)==="none"||"minzoom"in G&&z<G.minzoom||"maxzoom"in G&&z>=G.maxzoom)continue;const se=G.filter;if(!se||BO(ae,se,m,_)){let he,ye,pe,Fe,je,ee;const ft=Z.index;if(q==3&&(G.type=="fill"||G.type=="fill-extrusion")){if(ye=ue(G,"paint",G.type+"-opacity",m,g,b),G.type+"-pattern"in V){const Ve=ue(G,"paint",G.type+"-pattern",m,g,b);if(Ve){const Ge=typeof Ve=="string"?pg(Ve,O):Ve.toString(),Le=V1(Ge,l);if(s&&s[Ge]&&Le){++S,ee=E[S],(!ee||!ee.getFill()||ee.getStroke()||ee.getText())&&(ee=new Xe({fill:new wt}),E[S]=ee),pe=ee.getFill(),ee.setZIndex(ft);const de=Ge+"."+ye;let Qe=f[de];if(!Qe){const Pe=s[Ge],Se=mu(Pe.width,Pe.height),He=Se.getContext("2d");He.globalAlpha=ye,He.drawImage(Le.image,Pe.x,Pe.y,Pe.width,Pe.height,0,0,Pe.width,Pe.height),Qe=He.createPattern(Se,"repeat"),f[de]=Qe}pe.setColor(Qe)}}}else if(he=Ao(ue(G,"paint",G.type+"-color",m,g,b),ye),G.type+"-outline-color"in V&&(je=Ao(ue(G,"paint",G.type+"-outline-color",m,g,b),ye)),je||(je=he),he||je){if(++S,ee=E[S],(!ee||he&&!ee.getFill()||!he&&ee.getFill()||je&&!ee.getStroke()||!je&&ee.getStroke()||ee.getText())&&(ee=new Xe({fill:he?new wt:void 0,stroke:je?new St:void 0}),E[S]=ee),he&&(pe=ee.getFill(),pe.setColor(he)),G.type==="fill-extrusion"){const Ve=ue(G,"paint","fill-extrusion-height",m,g,b);if(Ve>0){const Ge=Math.max(.1,.9-Math.min(Ve,225)/280);if(je&&je!=="transparent"){const Le=Ue.parse(je);je=`rgba(${Math.round(Le.r*255*Ge)},${Math.round(Le.g*255*Ge)},${Math.round(Le.b*255*Ge)},${Le.a})`}}}je&&(Fe=ee.getStroke(),Fe.setColor(je),Fe.setWidth(.5)),ee.setZIndex(ft)}}if(q!=1&&G.type=="line"){"line-pattern"in V?he=void 0:he=Ao(ue(G,"paint","line-color",m,g,b),ue(G,"paint","line-opacity",m,g,b));const Ve=ue(G,"paint","line-width",m,g,b);he&&Ve>0&&(++S,ee=E[S],(!ee||!ee.getStroke()||ee.getFill()||ee.getText())&&(ee=new Xe({stroke:new St}),E[S]=ee),Fe=ee.getStroke(),Fe.setLineCap(ue(G,"layout","line-cap",m,g,b)),Fe.setLineJoin(ue(G,"layout","line-join",m,g,b)),Fe.setMiterLimit(ue(G,"layout","line-miter-limit",m,g,b)),Fe.setColor(he),Fe.setWidth(Ve),Fe.setLineDash(V["line-dasharray"]?ue(G,"paint","line-dasharray",m,g,b).map(function(Ge){return Ge*Ve}):null),Fe.setOffset(ue(G,"paint","line-offset",m,g,b)),ee.setZIndex(ft))}let rt=!1,_e=null,tn=0,Ut,yt,At;if((q==1||q==2)&&"icon-image"in ne){const Ve=ue(G,"layout","icon-image",m,g,b);if(Ve){Ut=typeof Ve=="string"?pg(Ve,O):Ve.toString();let Ge;const Le=a?a(n,Ut):void 0,de=V1(Ut,l);if(s&&s[Ut]&&de||Le){const Qe=ue(G,"layout","icon-rotation-alignment",m,g,b);if(q==2){const Pe=C.getGeometry();if(Pe.getFlatMidpoint||Pe.getFlatMidpoints){const Se=Pe.getExtent();if(Math.sqrt(Math.max(Math.pow((Se[2]-Se[0])/P,2),Math.pow((Se[3]-Se[1])/P,2)))>150){const Et=Pe.getType()==="MultiLineString"?Pe.getFlatMidpoints():Pe.getFlatMidpoint();if(fg||(_u=[NaN,NaN],fg=new Vt("Point",_u,[],2,{},void 0)),Ge=fg,_u[0]=Et[0],_u[1]=Et[1],ue(G,"layout","symbol-placement",m,g,b)==="line"&&Qe==="map"){const Gt=Pe.getStride(),at=Pe.getFlatCoordinates();for(let Mt=0,it=at.length-Gt;Mt<it;Mt+=Gt){const qt=at[Mt],Lt=at[Mt+1],Pt=at[Mt+Gt],tt=at[Mt+Gt+1],It=Math.min(qt,Pt),Oi=Math.max(qt,Pt),qn=Et[0],pn=Et[1],as=(tt-Lt)*(qn-qt)-(Pt-qt)*(pn-Lt);if(Math.abs(as)<.001&&qn<=Oi&&qn>=It){tn=Math.atan2(Lt-tt,Pt-qt);break}}}}}}if(q!==2||Ge){const Pe=ue(G,"layout","icon-size",m,g,b),Se=V["icon-color"]!==void 0?ue(G,"paint","icon-color",m,g,b):null;if(!Se||Se.a!==0){const He=ue(G,"paint","icon-halo-color",m,g,b),Et=ue(G,"paint","icon-halo-width",m,g,b);let nn=`${Ut}.${Pe}.${Et}.${He}`;if(Se!==null&&(nn+=`.${Se}`),yt=d[nn],!yt){const Gt=W1(G,m,"icon",g);let at;"icon-offset"in ne&&(at=ue(G,"layout","icon-offset",m,g,b).slice(0),at[0]*=Pe,at[1]*=-Pe);let Mt=Se?[Se.r*255,Se.g*255,Se.b*255,Se.a]:void 0;if(Le){const it={color:Mt,rotateWithView:Qe==="map",displacement:at,declutterMode:Gt,scale:Pe};typeof Le=="string"?it.src=Le:(it.img=Le,it.imgSize=[Le.width,Le.height]),yt=new Es(it)}else{const it=s[Ut];let qt,Lt,Pt;if(Et)it.sdf?(qt=k1(j1(de.image,it,Se||[0,0,0,1]),{x:0,y:0,width:it.width,height:it.height,pixelRatio:it.pixelRatio},Et,He),Mt=void 0):qt=k1(de.image,it,Et,He);else{if(it.sdf&&!de.unSDFed){const tt=j1(de.image,{x:0,y:0,width:de.size[0],height:de.size[1]},{r:1,g:1,b:1});de.image=tt,de.unSDFed=!0}qt=de.image,Lt=[it.width,it.height],Pt=[it.x,it.y]}yt=new Es({color:Mt,img:qt,imgSize:de.size,size:Lt,offset:Pt,rotateWithView:Qe==="map",scale:Pe/it.pixelRatio,displacement:at,declutterMode:Gt})}d[nn]=yt}}yt&&(++S,ee=E[S],(!ee||!ee.getImage()||ee.getFill()||ee.getStroke())&&(ee=new Xe,E[S]=ee),ee.setGeometry(Ge),yt.setRotation(tn+lg(ue(G,"layout","icon-rotate",m,g,b))),yt.setOpacity(ue(G,"paint","icon-opacity",m,g,b)),yt.setAnchor(VO[ue(G,"layout","icon-anchor",m,g,b)]),ee.setImage(yt),_e=ee.getText(),ee.setText(void 0),ee.setZIndex(ft),rt=!0,At=!1)}else At=!0}}}if(q==1&&G.type==="circle"){++S,ee=E[S],(!ee||!ee.getImage()||ee.getFill()||ee.getStroke())&&(ee=new Xe,E[S]=ee);const Ve="circle-radius"in V?ue(G,"paint","circle-radius",m,g,b):5,Ge=Ao(ue(G,"paint","circle-stroke-color",m,g,b),ue(G,"paint","circle-stroke-opacity",m,g,b)),Le=ue(G,"paint","circle-translate",m,g,b),de=Ao(ue(G,"paint","circle-color",m,g,b),ue(G,"paint","circle-opacity",m,g,b)),Qe=ue(G,"paint","circle-stroke-width",m,g,b),Pe=Ve+"."+Ge+"."+de+"."+Qe+"."+Le[0]+"."+Le[1];yt=d[Pe],yt||(yt=new An({radius:Ve,displacement:[Le[0],-Le[1]],stroke:Ge&&Qe>0?new St({width:Qe,color:Ge}):void 0,fill:de?new wt({color:de}):void 0,declutterMode:"none"}),d[Pe]=yt),ee.setImage(yt),_e=ee.getText(),ee.setText(void 0),ee.setGeometry(void 0),ee.setZIndex(ft),rt=!0}let et,jn,nt,Un,Gn,ai;if("text-field"in ne){Un=Math.round(ue(G,"layout","text-size",m,g,b));const Ve=ue(G,"layout","text-font",m,g,b);nt=ue(G,"layout","text-line-height",m,g,b),jn=sg(r?r(Ve,e.metadata?e.metadata["ol:webfonts"]:void 0):Ve,Un,nt),jn.includes("sans-serif")||(jn+=",sans-serif"),Gn=ue(G,"layout","text-letter-spacing",m,g,b),ai=ue(G,"layout","text-max-width",m,g,b);const Ge=ue(G,"layout","text-field",m,g,b);typeof Ge=="object"&&Ge.sections?Ge.sections.length===1?et=Ge.toString():et=Ge.sections.reduce((Le,de,Qe)=>{const Pe=de.fontStack?de.fontStack.split(","):Ve,Se=sg(r?r(Pe):Pe,Un*(de.scale||1),nt);let He=de.text;if(He===`
165
+ `)return Le.push(`
166
+ `,""),Le;if(q==2)return Le.push(hg(He,Gn),Se),Le;He=dg(He,Se,ai,Gn).split(`
167
+ `);for(let Et=0,nn=He.length;Et<nn;++Et)Et>0&&Le.push(`
168
+ `,""),Le.push(He[Et],Se);return Le},[]):et=pg(Ge,O).trim(),ye=ue(G,"paint","text-opacity",m,g,b)}if(et&&ye&&!At){rt||(++S,ee=E[S],(!ee||!ee.getText()||ee.getFill()||ee.getStroke())&&(ee=new Xe,E[S]=ee),ee.setImage(void 0),ee.setGeometry(void 0));const Ve=W1(G,m,"text",g);ee.getText()||ee.setText(_e),_e=ee.getText(),(!_e||"getDeclutterMode"in _e&&_e.getDeclutterMode()!==Ve)&&(_e=new nr({padding:[2,2,2,2],declutterMode:Ve}),ee.setText(_e));const Ge=ue(G,"layout","text-transform",m,g,b);Ge=="uppercase"?et=Array.isArray(et)?et.map((tt,It)=>It%2?tt:tt.toUpperCase()):et.toUpperCase():Ge=="lowercase"&&(et=Array.isArray(et)?et.map((tt,It)=>It%2?tt:tt.toLowerCase()):et.toLowerCase());const Le=Array.isArray(et)?et:q==2?hg(et,Gn):dg(et,jn,ai,Gn);if(_e.setText(Le),_e.setFont(jn),_e.setRotation(lg(ue(G,"layout","text-rotate",m,g,b))),typeof _e.setKeepUpright=="function"){const tt=ue(G,"layout","text-keep-upright",m,g,b);_e.setKeepUpright(tt)}const de=ue(G,"layout","text-anchor",m,g,b),Qe=rt||q==1?"point":ue(G,"layout","symbol-placement",m,g,b);let Pe;if(Qe==="line-center"?(_e.setPlacement("line"),Pe="center"):_e.setPlacement(Qe),Qe==="line"&&typeof _e.setRepeat=="function"){const tt=ue(G,"layout","symbol-spacing",m,g,b);_e.setRepeat(tt*2)}_e.setOverflow(Qe==="point");let Se=ue(G,"paint","text-halo-width",m,g,b);const He=ue(G,"layout","text-offset",m,g,b),Et=ue(G,"paint","text-translate",m,g,b);let nn=0,Gt=0;if(Qe=="point"){Pe="center",de.indexOf("left")!==-1?(Pe="left",Gt=Se):de.indexOf("right")!==-1&&(Pe="right",Gt=-Se);const tt=ue(G,"layout","text-rotation-alignment",m,g,b);_e.setRotateWithView(tt=="map")}else _e.setMaxAngle(lg(ue(G,"layout","text-max-angle",m,g,b))*et.length/Le.length),_e.setRotateWithView(!1);_e.setTextAlign(Pe);let at="middle";de.indexOf("bottom")==0?(at="bottom",nn=-Se-.5*(nt-1)*Un):de.indexOf("top")==0&&(at="top",nn=Se+.5*(nt-1)*Un),_e.setTextBaseline(at);const Mt=ue(G,"layout","text-justify",m,g,b);_e.setJustify(Mt==="auto"?void 0:Mt),_e.setOffsetX(He[0]*Un+Gt+Et[0]),_e.setOffsetY(He[1]*Un+nn+Et[1]);const it=_e.getFill()||new wt;it.setColor(Ao(ue(G,"paint","text-color",m,g,b),ye)),_e.setFill(it);const qt=Ao(ue(G,"paint","text-halo-color",m,g,b),ye);if(qt&&Se>0){const tt=_e.getStroke()||new St;tt.setColor(qt),Se*=2;const It=.5*Un;tt.setWidth(Se<=It?Se:It),_e.setStroke(tt)}else _e.setStroke(void 0);const Lt=ue(G,"layout","text-padding",m,g,b),Pt=_e.getPadding();Lt!==Pt[0]&&(Pt[0]=Lt,Pt[1]=Lt,Pt[2]=Lt,Pt[3]=Lt),ee.setZIndex(ft)}}}if(S>-1)return E.length=S+1,E};return n.setStyle(w),n.set("mapbox-layers",u),n.set("mapbox-source",v),n.set("mapbox-featurestate",n.get("mapbox-featurestate")||{}),w}class YO extends Fw{constructor(){super()}getType(){return"json"}readFeature(e,t){return this.readFeatureFromObject(wu(e),this.getReadOptions(e,t))}readFeatures(e,t){return this.readFeaturesFromObject(wu(e),this.getReadOptions(e,t))}readFeatureFromObject(e,t){return be()}readFeaturesFromObject(e,t){return be()}readGeometry(e,t){return this.readGeometryFromObject(wu(e),this.getReadOptions(e,t))}readGeometryFromObject(e,t){return be()}readProjection(e){return this.readProjectionFromObject(wu(e))}readProjectionFromObject(e){return be()}writeFeature(e,t){return JSON.stringify(this.writeFeatureObject(e,t))}writeFeatureObject(e,t){return be()}writeFeatures(e,t){return JSON.stringify(this.writeFeaturesObject(e,t))}writeFeaturesObject(e,t){return be()}writeGeometry(e,t){return JSON.stringify(this.writeGeometryObject(e,t))}writeGeometryObject(e,t){return be()}}function wu(n){if(typeof n=="string"){const e=JSON.parse(n);return e||null}return n!==null?n:null}class B1 extends YO{constructor(e){e=e||{},super(),this.dataProjection=Ne(e.dataProjection?e.dataProjection:"EPSG:4326"),e.featureProjection&&(this.defaultFeatureProjection=Ne(e.featureProjection)),e.featureClass&&(this.featureClass=e.featureClass),this.geometryName_=e.geometryName,this.extractGeometryName_=e.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(e,t){let i=null;e.type==="Feature"?i=e:i={type:"Feature",geometry:e,properties:null};const s=gg(i.geometry);if(this.featureClass===Vt)return Lw({geometry:s,id:i.id,properties:i.properties},t);const o=new Rn;return this.geometryName_?o.setGeometryName(this.geometryName_):this.extractGeometryName_&&i.geometry_name&&o.setGeometryName(i.geometry_name),o.setGeometry(yp(s,t)),"id"in i&&o.setId(i.id),i.properties&&o.setProperties(i.properties,!0),o}readFeaturesFromObject(e,t){const i=e;let s=null;if(i.type==="FeatureCollection"){const o=e;s=[];const r=o.features;for(let a=0,l=r.length;a<l;++a){const c=this.readFeatureFromObject(r[a],t);c&&s.push(c)}}else s=[this.readFeatureFromObject(e,t)];return s.flat()}readGeometryFromObject(e,t){return ZO(e,t)}readProjectionFromObject(e){const t=e.crs;let i;if(t)if(t.type=="name")i=Ne(t.properties.name);else if(t.type==="EPSG")i=Ne("EPSG:"+t.properties.code);else throw new Error("Unknown SRS type");else i=this.dataProjection;return i}writeFeatureObject(e,t){t=this.adaptOptions(t);const i={type:"Feature",geometry:null,properties:null},s=e.getId();if(s!==void 0&&(i.id=s),!e.hasProperties())return i;const o=e.getProperties(),r=e.getGeometry();return r&&(i.geometry=mg(r,t),delete o[e.getGeometryName()]),gs(o)||(i.properties=o),i}writeFeaturesObject(e,t){t=this.adaptOptions(t);const i=[];for(let s=0,o=e.length;s<o;++s)i.push(this.writeFeatureObject(e[s],t));return{type:"FeatureCollection",features:i}}writeGeometryObject(e,t){return mg(e,this.adaptOptions(t))}}function gg(n,e){if(!n)return null;let t;switch(n.type){case"Point":{t=QO(n);break}case"LineString":{t=JO(n);break}case"Polygon":{t=iA(n);break}case"MultiPoint":{t=tA(n);break}case"MultiLineString":{t=eA(n);break}case"MultiPolygon":{t=nA(n);break}case"GeometryCollection":{t=KO(n);break}default:throw new Error("Unsupported GeoJSON type: "+n.type)}return t}function ZO(n,e){const t=gg(n);return yp(t,e)}function KO(n,e){return n.geometries.map(function(i){return gg(i)})}function QO(n){const e=n.coordinates;return{type:"Point",flatCoordinates:e,layout:no(e.length)}}function JO(n){var i;const e=n.coordinates,t=e.flat();return{type:"LineString",flatCoordinates:t,ends:[t.length],layout:no(((i=e[0])==null?void 0:i.length)||2)}}function eA(n){var o,r;const e=n.coordinates,t=((r=(o=e[0])==null?void 0:o[0])==null?void 0:r.length)||2,i=[],s=ra(i,0,e,t);return{type:"MultiLineString",flatCoordinates:i,ends:s,layout:no(t)}}function tA(n){var t;const e=n.coordinates;return{type:"MultiPoint",flatCoordinates:e.flat(),layout:no(((t=e[0])==null?void 0:t.length)||2)}}function nA(n){var o,r;const e=n.coordinates,t=[],i=((r=(o=e[0])==null?void 0:o[0])==null?void 0:r[0].length)||2,s=zm(t,0,e,i);return{type:"MultiPolygon",flatCoordinates:t,ends:s,layout:no(i)}}function iA(n){var o,r;const e=n.coordinates,t=[],i=(r=(o=e[0])==null?void 0:o[0])==null?void 0:r.length,s=ra(t,0,e,i);return{type:"Polygon",flatCoordinates:t,ends:s,layout:no(i)}}function mg(n,e){n=kh(n,!0,e);const t=n.getType();let i;switch(t){case"Point":{i=cA(n);break}case"LineString":{i=oA(n);break}case"Polygon":{i=hA(n,e);break}case"MultiPoint":{i=aA(n);break}case"MultiLineString":{i=rA(n);break}case"MultiPolygon":{i=lA(n,e);break}case"GeometryCollection":{i=sA(n,e);break}case"Circle":{i={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+t)}return i}function sA(n,e){return e=Object.assign({},e),delete e.featureProjection,{type:"GeometryCollection",geometries:n.getGeometriesArray().map(function(i){return mg(i,e)})}}function oA(n,e){return{type:"LineString",coordinates:n.getCoordinates()}}function rA(n,e){return{type:"MultiLineString",coordinates:n.getCoordinates()}}function aA(n,e){return{type:"MultiPoint",coordinates:n.getCoordinates()}}function lA(n,e){let t;return e&&(t=e.rightHanded),{type:"MultiPolygon",coordinates:n.getCoordinates(t)}}function cA(n,e){return{type:"Point",coordinates:n.getCoordinates()}}function hA(n,e){let t;return e&&(t=e.rightHanded),{type:"Polygon",coordinates:n.getCoordinates(t)}}function uA(n,e,t,i){const s=document.createElement("script"),o="olc_"+Re(e);function r(){delete window[o],s.parentNode.removeChild(s)}s.async=!0,s.src=n+(n.includes("?")?"&":"?")+"callback="+o;const a=setTimeout(function(){r(),t&&t()},1e4);window[o]=function(l){clearTimeout(a),r(),e(l)},document.head.appendChild(s)}class dA extends Dh{constructor(e){if(super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,projection:Ne("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:"loading",tileLoadFunction:e.tileLoadFunction,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,zDirection:e.zDirection}),this.tileJSON_=null,this.tileSize_=e.tileSize,e.url)if(e.jsonp)uA(e.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{const t=new XMLHttpRequest;t.addEventListener("load",this.onXHRLoad_.bind(this)),t.addEventListener("error",this.onXHRError_.bind(this)),t.open("GET",e.url),t.send()}else if(e.tileJSON)this.handleTileJSONResponse(e.tileJSON);else throw new Error("Either `url` or `tileJSON` options must be provided")}onXHRLoad_(e){const t=e.target;if(!t.status||t.status>=200&&t.status<300){let i;try{i=JSON.parse(t.responseText)}catch{this.handleTileJSONError();return}this.handleTileJSONResponse(i)}else this.handleTileJSONError()}onXHRError_(e){this.handleTileJSONError()}getTileJSON(){return this.tileJSON_}handleTileJSONResponse(e){const t=Ne("EPSG:4326"),i=this.getProjection();let s;if(e.bounds!==void 0){const c=sa(t,i);s=Jg(e.bounds,c)}const o=Qa(i),r=e.minzoom||0,a=e.maxzoom||22,l=Tr({extent:o,maxZoom:a,minZoom:r,tileSize:this.tileSize_});if(this.tileGrid=l,this.tileUrlFunction=Rw(e.tiles,l),e.attribution&&!this.getAttributions()){const c=s!==void 0?s:o;this.setAttributions(function(h){return pt(c,h.extent)?[e.attribution]:null})}this.tileJSON_=e,this.setState("ready")}handleTileJSONError(){this.setState("error")}}Ue.parse("#000000"),Ue.parse("#FFFFFF"),Ue.parse("#000000");function fA(n,e=512){return n.getExtent()?Tr({extent:n.getExtent(),tileSize:e,maxZoom:22}).getResolutions():cg}function pA(n,e){return e.accessToken||(e=Object.assign({},e),new URL(n).searchParams.forEach((i,s)=>{e.accessToken=i,e.accessTokenParam=s})),e}function gA(n,e,t="",i={},s=void 0){let o,r,a,l,c=!0;return typeof t!="string"&&!Array.isArray(t)?(a=t,l=a.source||a.layers,i=a):l=t,typeof i=="string"?(o=i,a={}):(o=i.styleUrl,a=i),a.updateSource===!1&&(c=!1),s||(s=a.resolutions),!o&&typeof e=="string"&&!e.trim().startsWith("{")&&(o=e),o&&(o=o.startsWith("data:")?location.href:F1(o,a.accessToken),a=pA(o,a)),new Promise(function(h,u){zO(e,a).then(function(d){if(d.version!=8)return u(new Error("glStyle version 8 required."));if(!(n instanceof Mn||n instanceof Lh))return u(new Error("Can only apply to VectorLayer or VectorTileLayer"));const f=n instanceof Lh?"vector":"geojson";if(l?Array.isArray(l)?r=d.layers.find(function(P){return P.id===l[0]}).source:r=l:(r=d.layers.find(function(P){return P.source&&d.sources[P.source].type===f}).source,l=r),!r)return u(new Error(`No ${f} source found in the glStyle.`));function g(){if(!c)return Promise.resolve();if(n instanceof Lh)return _A(d.sources[r],o,a).then(function(O){const M=n.getSource();M?O!==M&&(M.setTileUrlFunction(O.getTileUrlFunction()),typeof M.setUrls=="function"&&typeof O.getUrls=="function"&&M.setUrls(O.getUrls()),M.format_||(M.format_=O.format_),M.getAttributions()||M.setAttributions(O.getAttributions()),M.getTileLoadFunction()===Ow&&M.setTileLoadFunction(O.getTileLoadFunction()),Wt(M.getProjection(),O.getProjection())&&(M.tileGrid=O.getTileGrid())):n.setSource(O);const z=n.getSource().getTileGrid();!isFinite(n.getMaxResolution())&&!isFinite(n.getMinZoom())&&z.getMinZoom()>0&&n.setMaxResolution(LO(Math.max(0,z.getMinZoom()-1e-12),z.getResolutions()))});const P=d.sources[r];let R=n.getSource();(!R||R.get("mapbox-source")!==P)&&(R=vA(P,o,a));const A=n.getSource();return A?R!==A&&(A.getAttributions()||A.setAttributions(R.getAttributions()),A.format_||(A.format_=R.getFormat()),A.url_=R.getUrl()):n.setSource(R),Promise.resolve()}let _,v;const E={},w={};function C(){if(!v&&(!d.sprite||E)){if(a.projection&&!s){const O=Ne(a.projection).getUnits();O!=="m"&&(s=cg.map(M=>M/ic[O]))}let P;const R=n.getSource();R instanceof pp&&R.format_ instanceof _p&&(P=R.format_.layerName_),v=XO(n,d,l,s,E,w,(A,O=a.webfonts)=>qO(A,O),a.getImage,P),n.getStyle()?g().then(h).catch(u):u(new Error(`Nothing to show for source [${r}]`))}else v?(n.setStyle(v),g().then(h).catch(u)):u(new Error("Something went wrong trying to apply style."))}if(d.sprite){const P=TO(d.sprite,a.accessToken,o||location.href);_=ln?1:window.devicePixelRatio>=1.5?.5:1;const R=_==.5?"@2x":"";Promise.all(P.map(function(A){const O=new URL(A.url);let M=O.origin+O.pathname+R+".json"+O.search;return new Promise(function(z,k){jr("Sprite",M,a).then(z).catch(function(q){M=O.origin+O.pathname+".json"+O.search,jr("Sprite",M,a).then(z).catch(k)})}).then(function(z){z===void 0&&u(new Error("No sprites found."));let k;if(k=O.origin+O.pathname+R+".png"+O.search,a.transformRequest){const q=a.transformRequest(k,"SpriteImage")||k;(q instanceof Request||q instanceof Promise)&&(k=q)}w[A.id]=k;for(const q in z){const Y=A.id=="default"?q:`${A.id}:${q}`;E[Y]=z[q]}}).catch(function(z){u(new Error(`Sprites cannot be loaded: ${M}: ${z.message}`))})})).then(C).catch(u)}else C()}).catch(u)})}function mA(n,e){const t=n.bounds;if(t){const i=Me([t[0],t[1]],e),s=Me([t[2],t[3]],e);return[i[0],i[1],s[0],s[1]]}return Ne(e).getExtent()}function yA(n,e,t){const i=new dA({tileJSON:e,tileSize:n.tileSize||e.tileSize||512}),s=i.getTileJSON(),o=i.getTileGrid(),r=Ne(t.projection||"EPSG:3857"),a=mA(s,r),l=r.getExtent(),c=s.minzoom||0,h=s.maxzoom||22,u={attributions:i.getAttributions(),projection:r,tileGrid:new Us({origin:l?rn(l):o.getOrigin(0),extent:a||o.getExtent(),minZoom:c,resolutions:fA(r,e.tileSize).slice(0,h+1),tileSize:o.getTileSize(0)})};return Array.isArray(s.tiles)?u.urls=s.tiles:u.url=s.tiles,u}function _A(n,e,t){return new Promise(function(i,s){NO(n,e,t).then(function({tileJson:o,tileLoadFunction:r}){const a=yA(n,o,t);a.tileLoadFunction=r,a.format=new _p({layerName:"mvt:layer"});const l=new pp(a);l.set("mapbox-source",n),i(l)}).catch(s)})}function wA(n){return`{bbox-${(n?n.getCode():"EPSG:3857").toLowerCase().replace(/[^a-z0-9]/g,"-")}}`}function vA(n,e,t){const i=t.projection?new B1({dataProjection:t.projection}):new B1,s=n.data,o={};if(typeof s=="string"){const[a]=gu(s,t.accessToken,t.accessTokenParam||"access_token",e||location.href);if(/\{bbox-[0-9a-z-]+\}/.test(a)){const c=(u,d,f)=>{const g=wA(f);return a.replace(g,`${u.join(",")}`)},h=new _n({attributions:n.attribution,format:i,loader:(u,d,f,g,_)=>{const v=typeof c=="function"?c(u,d,f):c;jr("GeoJSON",v,t).then(E=>{const w=h.getFormat().readFeatures(E,{featureProjection:f});h.addFeatures(w),g(w)}).catch(E=>{h.removeLoadedExtent(u),_()})},strategy:SE});return h.set("mapbox-source",n),h}const l=new _n({attributions:n.attribution,format:i,url:a,loader:(c,h,u,d,f)=>{jr("GeoJSON",a,t).then(g=>{const _=l.getFormat().readFeatures(g,{featureProjection:u});l.addFeatures(_),d(_)}).catch(g=>{l.removeLoadedExtent(c),f()})}});return l}o.features=i.readFeatures(s,{featureProjection:"EPSG:3857"});const r=new _n(Object.assign({attributions:n.attribution,format:i},o));return r.set("mapbox-source",n),r}class yg extends p.Destroyable{constructor(t,i){super();I(this,"_imageriesManager");I(this,"_map");I(this,"_raster");I(this,"_layer",this.dv(p.react(void 0)));I(this,"_rShow",this.dv(p.react(!0)));I(this,"_rAlpha",this.dv(p.react(1)));I(this,"_rZIndex",this.dv(p.react(0)));I(this,"_rRectangle",this.dv(p.react(void 0)));I(this,"_rSplitDirection",this.dv(p.react("NONE")));I(this,"_rBrightness",this.dv(p.react(1)));I(this,"_rContrast",this.dv(p.react(1)));I(this,"_rHue",this.dv(p.react(0)));I(this,"_rSaturation",this.dv(p.react(1)));I(this,"_rGamma",this.dv(p.react(1)));I(this,"_raf");this.id=i;const s=t.viewer;if(!s)return;this._map=s;const o=Ki(s);if(!o)return;const{imageriesManager:r}=o;this._imageriesManager=r,this.d(()=>this._destroyLayer())}get layer(){return this._layer.value}set layer(t){this._layer.value=t}get layerChanged(){return this._layer.changed}get show(){return this._rShow.value}get alpha(){return this._rAlpha.value}get zIndex(){return this._rZIndex.value}get rectangle(){return this._rRectangle.value}get splitDirection(){return this._rSplitDirection.value}get brightness(){return this._rBrightness.value}get contrast(){return this._rContrast.value}get hue(){return this._rHue.value}get saturation(){return this._rSaturation.value}get gamma(){return this._rGamma.value}get showChanged(){return this._rShow.changed}get alphaChanged(){return this._rAlpha.changed}get zIndexChanged(){return this._rZIndex.changed}get rectangleChanged(){return this._rRectangle.changed}get splitDirectionChanged(){return this._rSplitDirection.changed}get brightnessChanged(){return this._rBrightness.changed}get contrastChanged(){return this._rContrast.changed}get hueChanged(){return this._rHue.changed}get saturationChanged(){return this._rSaturation.changed}get gammaChanged(){return this._rGamma.changed}set show(t){var s;const i=t??!0;this._rShow.value=i,(s=this._layer.value)==null||s.setVisible(i)}set alpha(t){var s;const i=t??1;this._rAlpha.value=i,(s=this._layer.value)==null||s.setOpacity(i)}set zIndex(t){const i=t??0;this._rZIndex.value=i,this._layer.value&&this._imageriesManager&&this._imageriesManager.setZindex(this._layer.value,i)}set rectangle(t){this._rRectangle.value=t}set splitDirection(t){this._rSplitDirection.value=t??"NONE"}set brightness(t){this._rBrightness.value=t??1,this._applyColorAdjustments()}set contrast(t){this._rContrast.value=t??1,this._applyColorAdjustments()}set hue(t){this._rHue.value=t??0,this._applyColorAdjustments()}set saturation(t){this._rSaturation.value=t??1,this._applyColorAdjustments()}set gamma(t){this._rGamma.value=t??1,this._applyColorAdjustments()}_applyColorAdjustments(){this._raf||(this._raf=requestAnimationFrame(()=>{var s,o,r;this._raf=void 0;const t=this._layer.value,i=(s=t==null?void 0:t.getSource)==null?void 0:s.call(t);(r=(o=this._raster)==null?void 0:o.changed)==null||r.call(o),i!=null&&i.refresh?i.refresh():t!=null&&t.changed&&t.changed()}))}set imageryProvider(t){this._createFromProvider(t)}flyTo(t){}_destroyLayer(){var i,s,o;const t=(i=this._layer)==null?void 0:i.value;this._map&&t&&this._imageriesManager&&this._imageriesManager.delete(t),this._raf&&(cancelAnimationFrame(this._raf),this._raf=void 0),(o=(s=this._raster)==null?void 0:s.dispose)==null||o.call(s),this._raster=void 0,this._layer.value=void 0}_wrapWithRaster(t){const i=Math.min(4,Math.max(1,(typeof navigator<"u"&&navigator.hardwareConcurrency||4)-1)),s=new hp({sources:[t],operationType:"pixel",threads:i,operation:function(o,r){function a(_,v,E){return .2126*_+.7152*v+.0722*E}function l(_,v,E,w,C){const P=.299*_+.587*v+.114*E,R=.595716*_-.274453*v-.321263*E,A=.211456*_-.522591*v+.311135*E,O=R*w-A*C,M=R*C+A*w;let z=P+.9563*O+.621*M,k=P-.2721*O-.6474*M,q=P-1.107*O+1.7046*M;const Y=m=>m<0?0:m>1?1:m;return[Y(z),Y(k),Y(q)]}const c=o[0];let h=c[0]/255,u=c[1]/255,d=c[2]/255;const f=c[3]/255;if(r.hueCos!==1||r.hueSin!==0){const _=l(h,u,d,r.hueCos,r.hueSin);h=_[0],u=_[1],d=_[2]}if(r.saturation!==1){const _=a(h,u,d);h=_+(h-_)*r.saturation,u=_+(u-_)*r.saturation,d=_+(d-_)*r.saturation}r.brightness!==1&&(h*=r.brightness,u*=r.brightness,d*=r.brightness),r.contrast!==1&&(h=(h-.5)*r.contrast+.5,u=(u-.5)*r.contrast+.5,d=(d-.5)*r.contrast+.5),r.gammaInv!==1&&(h=Math.pow(Math.max(h,0),r.gammaInv),u=Math.pow(Math.max(u,0),r.gammaInv),d=Math.pow(Math.max(d,0),r.gammaInv));const g=_=>Math.max(0,Math.min(255,Math.round(_*255)));return c[0]=g(h),c[1]=g(u),c[2]=g(d),c[3]=g(f),c}});return s.on("beforeoperations",o=>{const r=this._rHue.value??0;o.data.brightness=this._rBrightness.value??1,o.data.contrast=this._rContrast.value??1,o.data.saturation=this._rSaturation.value??1,o.data.gammaInv=1/Math.max(1e-4,this._rGamma.value??1),o.data.hueCos=Math.cos(r),o.data.hueSin=Math.sin(r)}),this._raster=s,s}_makeLayerForSource(t){return t instanceof hp?new np({source:t}):t instanceof vw?new np({source:t}):new Oh({source:t})}_createFromProvider(t){var g,_,v,E;if(!this._map)return;this._destroyLayer();const s=Ne("EPSG:3857").getExtent(),o=Ie(s)/256,r=t,a=r.crossOrigin??"anonymous",l=Math.max((r.maximumLevel??18)+1,19),c=Array.from({length:l},(w,C)=>o/Math.pow(2,C));Array.from({length:l},(w,C)=>C.toString());const h=(w,C)=>{if(!C)return{url:w};const P=Array.isArray(C)?C:C.split("");return P.length?w.includes("{s}")?{urls:P.map(R=>w.replace("{s}",R))}:{url:w}:{url:w}},u=w=>typeof w=="string"?w:w&&w.url||"",d=r.minimumLevel??0,f=r.maximumLevel??18;switch(t.type){case"UrlTemplateImageryProvider":{const w=t,C=u(w.url),P=h(C,w.subdomains),R=new Fh({...P.urls?{urls:P.urls}:{url:P.url},attributions:r.attributions,crossOrigin:a,wrapX:!0,minZoom:d,maxZoom:f,transition:0}),A=this._wrapWithRaster(R);this._layer.value=this._makeLayerForSource(A);break}case"WebMapTileServiceImageryProvider":{const w=t,C=(w.matrixSet??w.tileMatrixSetID??"EPSG:3857").toUpperCase(),P=C==="EPSG:4326",R=(w.minimumLevel??d)|0,A=(w.maximumLevel??f)|0,O=w.tileMatrixLabels||w.TileMatrixLabels,M=P?Array.from({length:22},(B,Z)=>`${C}:${Z}`):Array.from({length:22},(B,Z)=>String(Z)),z=O&&O.length?O:M,k=z.length,q=Math.max(0,Math.min(R,k-1)),Y=Math.max(q,Math.min(A,k-1)),m=Math.max(1,Y-q+1),b=z.slice(q,q+m),S=256;let L,N,j;if(P){N=[-180,-90,180,90],L=rn(N);const B=360/(S*2);j=Array.from({length:m},(Z,G)=>B/Math.pow(2,q+G))}else{N=s,L=rn(N);const B=Ie(N)/S;j=Array.from({length:m},(Z,G)=>B/Math.pow(2,q+G))}const U=new jT({url:u(w.url),layer:w.layer,matrixSet:C,format:w.format??"image/png",style:w.style??"default",tileGrid:w.tileGrid??new yT({origin:L,extent:N,resolutions:j,matrixIds:b,tileSize:S}),requestEncoding:w.requestEncoding||w.requestencoding||"KVP",...P?{projection:Ne("EPSG:4326")}:{},attributions:r.attributions,crossOrigin:a,wrapX:!0,transition:0,tileLoadFunction:(B,Z)=>{const G=new Image;G.crossOrigin=a||"anonymous",G.onload=()=>{var Ge,Le;const ae=this._rBrightness.value??1,ne=this._rContrast.value??1,V=this._rSaturation.value??1,re=this._rHue.value??0,se=this._rGamma.value??1;if(re===0&&V===1&&ae===1&&ne===1&&se===1){const de=(Ge=B.getImage)==null?void 0:Ge.call(B);if(de){de.src=Z;return}}const he=G.naturalWidth||G.width,ye=G.naturalHeight||G.height;if(!he||!ye){B.getImage().src=Z;return}const pe=document.createElement("canvas");pe.width=he,pe.height=ye;const Fe=pe.getContext("2d",{willReadFrequently:!0});Fe.drawImage(G,0,0);const je=Fe.getImageData(0,0,he,ye),ee=je.data,ft=Math.cos(re),rt=Math.sin(re),_e=[[.299,.587,.114],[.595716,-.274453,-.321263],[.211456,-.522591,.311135]],tn=[[1,.9563,.621],[1,-.2721,-.6474],[1,-1.107,1.7046]],Ut=[[1,0,0],[0,ft,-rt],[0,rt,ft]],yt=(de,Qe)=>{const Pe=Array.from({length:3},()=>[0,0,0]);for(let Se=0;Se<3;Se++)for(let He=0;He<3;He++)Pe[Se][He]=de[Se][0]*Qe[0][He]+de[Se][1]*Qe[1][He]+de[Se][2]*Qe[2][He];return Pe},At=yt(tn,yt(Ut,_e)),et=.5-.5*ne,jn=1/Math.max(1e-4,se),nt=new Uint8ClampedArray(256);for(let de=0;de<256;de++)nt[de]=Math.max(0,Math.min(255,Math.round(Math.pow(de/255,jn)*255)));const Un=.2126,Gn=.7152,ai=.0722;for(let de=0;de<ee.length;de+=4){let Qe=ee[de]/255,Pe=ee[de+1]/255,Se=ee[de+2]/255;const He=ee[de+3],Et=At[0][0]*Qe+At[0][1]*Pe+At[0][2]*Se,nn=At[1][0]*Qe+At[1][1]*Pe+At[1][2]*Se,Gt=At[2][0]*Qe+At[2][1]*Pe+At[2][2]*Se,at=Un*Et+Gn*nn+ai*Gt,Mt=at+(Et-at)*V,it=at+(nn-at)*V,qt=at+(Gt-at)*V,Lt=Mt*ae,Pt=it*ae,tt=qt*ae;let It=Lt*ne+et,Oi=Pt*ne+et,qn=tt*ne+et;It=It<0?0:It>1?1:It,Oi=Oi<0?0:Oi>1?1:Oi,qn=qn<0?0:qn>1?1:qn,ee[de]=nt[Math.round(It*255)],ee[de+1]=nt[Math.round(Oi*255)],ee[de+2]=nt[Math.round(qn*255)],ee[de+3]=He}Fe.putImageData(je,0,0);const Ve=(Le=B.setImage)==null?void 0:Le.bind(B);Ve?Ve(pe):B.getImage().src=pe.toDataURL("image/png")},G.onerror=()=>{B.getImage().src=Z},G.src=Z}});this._layer.value=new Oh({source:U});break}case"WebMapServiceImageryProvider":{const w=t,C={LAYERS:w.layers,TILED:!0,VERSION:((g=w.parameters)==null?void 0:g.VERSION)??((_=w.parameters)==null?void 0:_.version)??"1.3.0",...w.parameters},P=new kT({url:u(w.url),params:C,attributions:r.attributions,crossOrigin:a,transition:0}),R=this._wrapWithRaster(P);this._layer.value=this._makeLayerForSource(R);break}case"TileMapServiceImageryProvider":{const w=t,C=w.url?u(w.url):"",P=C.includes("{-y}"),R=/4326/.test(C)?"EPSG:4326":"EPSG:3857",A=Ne(R),O=P?Tr({extent:A.getExtent(),minZoom:d,maxZoom:f,tileSize:256}):void 0,M=w.url?u(w.url):"",z=new Fh({url:M,attributions:r.attributions,crossOrigin:a,wrapX:!0,minZoom:d,maxZoom:f,tileGrid:new Us({origin:rn(s),resolutions:c.slice(d,f+1)}),zDirection:-1,transition:0,...O?{tileGrid:O}:{}}),k=this._wrapWithRaster(z);this._layer.value=this._makeLayerForSource(k);break}case"OpenStreetMapImageryProvider":{const w=t,C=new Fh({url:w.url,attributions:r.attributions,crossOrigin:a,wrapX:!0,transition:0}),P=this._wrapWithRaster(C);this._layer.value=this._makeLayerForSource(P);break}case"SingleTileImageryProvider":{const w=t,C=typeof w.url=="string"?w.url:w.url.url,P=w.rectangle?oa(w.rectangle,"EPSG:4326","EPSG:3857"):s,R=new vw({url:C,imageExtent:P,attributions:r.attributions,crossOrigin:a,interpolate:!0}),A=this._wrapWithRaster(R);this._layer.value=this._makeLayerForSource(A);break}case"MVTImageryProvider":{(async()=>{var B,Z,G,ae;const w=t;if(!w.url)return;let C,P=[],R,A,O=null,M,z;const k=async ne=>{if(!ne)return{};if(typeof ne=="string"){const V=ne.toLowerCase();if(V.endsWith(".json")||V.includes("tilejson")||V.includes(".json?"))try{const re=await fetch(ne);if(re.ok){const se=await re.json(),he=se.minzoom,ye=se.maxzoom;if(se.tiles&&se.tiles.length>0)return{url:se.tiles[0],minzoom:he,maxzoom:ye};if(se.url)return{url:se.url,minzoom:he,maxzoom:ye}}}catch{}return{url:ne}}if(typeof ne=="object"){const V=ne,re=V.minzoom,se=V.maxzoom;if(V.tiles&&V.tiles.length>0)return{url:V.tiles[0],minzoom:re,maxzoom:se};if(V.url)return{url:V.url,minzoom:re,maxzoom:se}}return{}},q=ne=>{const V=ne.toLowerCase();return V.includes("style.json")||V.endsWith(".json")&&!V.includes("{z}")&&!V.includes("{x}")&&!V.includes("{y}")};let Y="customSource";if(typeof w.url=="string")if(q(w.url))try{const ne=await fetch(w.url);if(!ne.ok){console.warn(`[OlImagery] MVT: fetch style.json 失败: ${ne.status}`);return}O=await ne.json();const V=O.sources||{};for(const re in V)if(Object.prototype.hasOwnProperty.call(V,re)){const se=V[re];if(se.type==="vector"){if(Y=re,se.minzoom!==void 0&&(M=M===void 0?se.minzoom:Math.min(M,se.minzoom)),se.maxzoom!==void 0&&(z=z===void 0?se.maxzoom:Math.max(z,se.maxzoom)),se.tiles&&se.tiles.length>0){C=se.tiles[0];break}if(se.url){const he=await k(se.url);if(C=he.url,he.minzoom!==void 0&&(M=M===void 0?he.minzoom:Math.min(M,he.minzoom)),he.maxzoom!==void 0&&(z=z===void 0?he.maxzoom:Math.max(z,he.maxzoom)),C)break}}}if(!C){console.warn("[OlImagery] MVT: style.json 中未找到有效的 tile URL");return}P=(B=w.style)!=null&&B.length?w.style:O.layers||[],R=O.glyphs,A=O.sprite}catch(ne){console.warn("[OlImagery] MVT: fetch style.json 出错:",ne);return}else{const ne=await k(w.url);C=ne.url,M=ne.minzoom,z=ne.maxzoom,P=w.style||[],R=w.glyphs,A=w.sprite}else if(w.url&&typeof w.url=="object"){O=w.url;const ne=O.sources||{};for(const V in ne)if(Object.prototype.hasOwnProperty.call(ne,V)){const re=ne[V];if(re.type==="vector"){if(Y=V,re.minzoom!==void 0&&(M=M===void 0?re.minzoom:Math.min(M,re.minzoom)),re.maxzoom!==void 0&&(z=z===void 0?re.maxzoom:Math.max(z,re.maxzoom)),re.tiles&&re.tiles.length>0){C=re.tiles[0];break}if(re.url){const se=await k(re.url);if(C=se.url,se.minzoom!==void 0&&(M=M===void 0?se.minzoom:Math.min(M,se.minzoom)),se.maxzoom!==void 0&&(z=z===void 0?se.maxzoom:Math.max(z,se.maxzoom)),C)break}}}if(!C){console.warn("[OlImagery] MVT: 未在 style JSON 中找到有效的 tile URL");return}P=(Z=w.style)!=null&&Z.length?w.style:O.layers||[],R=O.glyphs,A=O.sprite}else return;if(C&&w.accessToken&&C.includes("mapbox")&&!C.includes("access_token")){const ne=C.includes("?")?"&":"?";C+=`${ne}access_token=${w.accessToken}`}const m=Math.max(w.minimumLevel??0,M??0),b=Math.min(w.maximumLevel??18,z??18),S=w.tileSize||512,L=w.scheme||"xyz",N=((G=O==null?void 0:O.metadata)==null?void 0:G["mapbox:projection"])||((ae=O==null?void 0:O.metadata)==null?void 0:ae.projection)||"EPSG:3857",j=new pp({url:C,format:new _p,tileGrid:Tr({tileSize:S,minZoom:m,maxZoom:b}),...L==="tms"?{zDirection:-1}:{},attributions:O==null?void 0:O.attribution});N!=="EPSG:3857"&&(j.dataProjection=N),j.on("tileloaderror",ne=>{console.error("[OlImagery] MVT: 瓦片加载失败",ne)});const U=new Lh({source:j,declutter:!0});if(P.length>0)try{const ne="https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf",V={version:8,name:"MVT Style",sources:{[Y]:{type:"vector",tiles:[C],minzoom:m,maxzoom:b}},layers:P,glyphs:R||ne,sprite:A},re={source:Y,...typeof w.url=="string"&&w.url.toLowerCase().includes("style.json")?{styleUrl:w.url}:{}};await gA(U,V,re)}catch(ne){console.warn("[OlImagery] MVT: ol-mapbox-style 应用样式失败,使用默认样式",ne),U.setStyle(function(V){var ye;const re=V.getGeometry(),se=((ye=re==null?void 0:re.getType)==null?void 0:ye.call(re))||"",he=[];return se==="LineString"||se==="MultiLineString"?he.push(new Xe({stroke:new St({color:"#ff0000",width:3})})):se==="Polygon"||se==="MultiPolygon"?he.push(new Xe({fill:new wt({color:"rgba(100, 100, 100, 0.5)"}),stroke:new St({color:"#333333",width:1})})):(se==="Point"||se==="MultiPoint")&&he.push(new Xe({image:new An({radius:5,fill:new wt({color:"#ff0000"})})})),he})}this._layer.value=U,this._layer.value.setOpacity(this._rAlpha.value),this._layer.value.setVisible(this._rShow.value),this.layer&&(this._imageriesManager&&this._imageriesManager.add(this.layer),this._imageriesManager&&this._imageriesManager.setZindex(this.layer,this._rZIndex.value))})();break}default:{console.warn("[OlImagery] 未实现的 provider.type:",t.type,t);return}}(v=this._layer.value)==null||v.setOpacity(this._rAlpha.value),(E=this._layer.value)==null||E.setVisible(this._rShow.value),this.layer&&(this._imageriesManager&&this._imageriesManager.add(this.layer),this._imageriesManager&&this._imageriesManager.setZindex(this.layer,this._rZIndex.value))}}const Tu=class Tu extends p.Destroyable{constructor(t,i){super();I(this,"_pickedEvent",this.disposeVar(new p.Event));I(this,"_flyToEvent",this.disposeVar(new p.Event));I(this,"_clickEvent",this.disposeVar(new p.Event));I(this,"_hovered",this.disposeVar(p.react(!1)));I(this,"_feature");I(this,"_source");I(this,"_layer");I(this,"_initialized",!1);const s=new yn([]);this._feature=new Rn({geometry:s}),this._feature.setId(i??p.createGuid());const o=t.viewer;if(!o)return;this._source=new _n,this.dispose(()=>{var c;return(c=this._source)==null?void 0:c.dispose()}),this._layer=new Mn({source:this._source}),this.dispose(()=>{var c;return(c=this._layer)==null?void 0:c.dispose()});const r=()=>{var c;(c=this._layer)==null||c.setVisible(this.show??!0)};this.d(p.createEventsCallFunc(this.showChanged,r,{immediate:!0})),o.addLayer(this._layer),this.dispose(()=>o.removeLayer(this._layer));const a=()=>{if(!this._source||!this._feature||(this._source.clear(),!this.position))return;const c=Me([this.position[0][0],this.position[0][1]]);s.setCoordinates(c);const h=this.radius??5,u=this.strokeWidth??2,d=this.fillColor??[255,255,255,1],f=this.strokeColor??[0,153/255,1,1],g=new wt({color:`rgba(${d.map(E=>E*255).join(",")})`}),_=new St({color:`rgba(${f.map(E=>E*255).join(",")})`,width:u}),v=new Xe({image:new An({radius:h,fill:g,stroke:_})});this._feature.setStyle(v),this._source.addFeature(this._feature)};a();const l=this.disposeVar(p.createNextAnimateFrameEvent(this.positionChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged));this.dispose(l.disposableOn(a)),this.dispose(this.flyToEvent.disposableOn(c=>{this.position&&Bi(t,this.position)})),this.dispose(this.positionChanged.disposableOn(()=>{!this._initialized&&this.position&&(this._initializePoint(),this._initialized=!0)}))}get typeName(){return"OlPoint"}get defaultProps(){return Tu.createDefaultProps()}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}get clickEvent(){return this._clickEvent}get hovered(){return this._hovered.value}set hovered(t){this._hovered.value=t}get feature(){return this._feature}_initializePoint(){const t=()=>{var f;if(!this.position)return;const s=Me([this.position[0],this.position[1]]);if(!this._feature)return;this._feature.getGeometry().setCoordinates(s);const r=this.radius??5,a=this.strokeWidth??2,l=this.fillColor??[1,1,1,1],c=this.strokeColor??[0,153/255,1,1],h=new wt({color:`rgba(${l.map(g=>g*255).join(",")})`}),u=new St({color:`rgba(${c.map(g=>g*255).join(",")})`,width:a}),d=new Xe({image:new An({radius:r,fill:h,stroke:u})});this._feature.setStyle(d),this._feature.set("visible",this.show??!0),(f=this._source)==null||f.addFeature(this._feature)};t();const i=p.createNextAnimateFrameEvent(this.positionChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged);this.dispose(i.disposableOn(t))}};I(Tu,"defaults",{position:[],width:2,loop:!1,color:[1,1,1,.5],outlineColor:[0,0,0,1],show:!0,allowPicking:!1,strokeColor:[0,.6,1,1],fillColor:[1,1,1,1],strokeWidth:2,radius:5});let oi=Tu;(n=>{n.createDefaultProps=()=>({show:void 0,position:p.reactArrayWithUndefined(void 0),editting:void 0,allowPicking:!1,pixelSize:void 0,color:p.reactArrayWithUndefined(void 0),outlineColor:p.reactArrayWithUndefined(void 0),outlineWidth:void 0,fillColor:p.reactArrayWithUndefined(void 0),strokeColor:p.reactArrayWithUndefined(void 0),strokeWidth:void 0,radius:void 0,zIndex:void 0})})(oi||(oi={})),p.extendClassProps(oi.prototype,oi.createDefaultProps);const Iu=class Iu extends p.Destroyable{constructor(t,i){super();I(this,"_flyToEvent",this.disposeVar(new p.Event));I(this,"_layer");I(this,"_feature");I(this,"_source");I(this,"_lineString");const s=new Yn([]);this._lineString=s,this.d(()=>{var c;return(c=this._lineString)==null?void 0:c.dispose()}),this._feature=new Rn({geometry:s}),this._feature.setId(i??p.createGuid()),this.d(()=>{var c;return(c=this._feature)==null?void 0:c.dispose()}),this._source=new _n,this.d(()=>{var c;return(c=this._source)==null?void 0:c.dispose()}),this._layer=new Mn({zIndex:0,source:this._source}),this.d(()=>{var c;return(c=this._layer)==null?void 0:c.dispose()});const o=t.viewer;if(!o)return;o.addLayer(this._layer),this.d(()=>o.removeLayer(this._layer));const r=()=>{var c;(c=this._layer)==null||c.setVisible(this.show??!0)};r(),this.ad(this.showChanged.don(r)),this.d(p.createEventsCallFunc(this.zIndexChanged,()=>{var c;(c=this._layer)==null||c.setZIndex(this.zIndex)},{immediate:!0}));const a=()=>{if(!this._source||!this._feature||(this._source.clear(),!this.positions||this.positions.length<2))return;const c=this.positions.map(d=>Me([d[0],d[1]]));this.loop&&c.length>=3&&c.push(c[0]),this._feature.getGeometry().setCoordinates(c);const u=(d,f)=>{const g=[],_=new St({color:`rgba(${this.color[0]*255}, ${this.color[1]*255}, ${this.color[2]*255}, ${this.color[3]})`,width:this.width??2,lineDash:this.hasDash?[this.dashLength??16,(this.dashLength??16)/2]:void 0});if(g.push(new Xe({stroke:_})),this.hasArrow&&c.length>=2){const[v,E]=c[c.length-2],[w,C]=c[c.length-1],P=bA(w-v,C-E);g.push(new Xe({geometry:new yn([w,C]),image:new xa({points:3,radius:8,rotation:P,rotateWithView:!0,fill:new wt({color:`rgba(${this.color[0]*255}, ${this.color[1]*255}, ${this.color[2]*255}, ${this.color[3]})`})})}))}return g};this._feature.setStyle(u),this._source.addFeature(this._feature)};a();const l=this.disposeVar(p.createNextAnimateFrameEvent(this.positionsChanged,this.loopChanged,this.widthChanged,this.colorChanged,this.hasDashChanged,this.dashLengthChanged,this.hasArrowChanged,this.showChanged));this.d(l.disposableOn(a)),this.d(this.flyToEvent.disposableOn(c=>{if(!this.positions||this.positions.length===0)return;const h=this.positions[Math.floor(this.positions.length/2)];Bi(t,h)}))}get typeName(){return"OlPolyline"}get defaultProps(){return Iu.createDefaultProps()}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}};I(Iu,"defaults",{positions:[],width:2,loop:!1,color:[1,1,1,1],hasDash:!1,dashLength:16,hasArrow:!1});let jt=Iu;(n=>{n.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:p.reactPositions(void 0),loop:!1,width:2,color:p.reactArray([1,1,1,1]),hasDash:!1,dashLength:16,hasArrow:!1,arcType:"GEODESIC",depthTest:!1,zIndex:0,dashPattern:255,gapColor:p.reactArray([0,0,0,0])})})(jt||(jt={})),p.extendClassProps(jt.prototype,jt.createDefaultProps);function bA(n,e){const t=Math.atan2(e,n);return(Math.PI/2-t+2*Math.PI)%(2*Math.PI)}class EA extends p.Destroyable{constructor(t,i){super();I(this,"_geoPoint");I(this,"_geoAxis");this._geoPoint=this.disposeVar(new oi(i,t.id)),this._geoAxis=this.disposeVar(new jt(i,t.id)),this._geoAxis.width=6,this._geoAxis.color=[1,1,0,.7]}get geoPoint(){return this._geoPoint}get geoAxis(){return this._geoAxis}}const ss=class ss extends p.Destroyable{constructor(t,i){super();I(this,"_captureEvent",this.disposeVar(new p.Event));I(this,"_id",this.disposeVar(p.react(p.createGuid())));if(this._olViewer=t,i&&(this.id=i),!t.viewer)return;this.disposeVar(new p.ObjResettingWithEvent(this.showChanged,()=>{if(this.show&&this.position)return new EA(this,t)})),this.default&&this.flyTo(void 0,!1);const o=this.disposeVar(p.createProcessingFromAsyncFunc(async a=>{const{position:l,rotation:c,viewDistance:h,duration:u=1e3}=this;if(l){const d=Bi(this._olViewer,l,h,c,u,()=>{this.enabled=!1});d&&await a.promise(d),this.enabled=!1}}));this.dispose(this.enabledChanged.disposableOn(()=>{o.isRunning&&o.cancel(),this.enabled&&o.restart()}));const r=this.disposeVar(p.createProcessingFromAsyncFunc(async(a,l,c)=>{var d,f;const h=(f=(d=this._olViewer).capture)==null?void 0:f.call(d,l,c);if(!h)return;const u=await a.promise(h);u&&(this.thumbnail=u)}));this.dispose(this.captureEvent.disposableOn((a,l)=>{r.restart(void 0,a??ss.defaults.thumbnailWidth,l??ss.defaults.thumbnailHeight)}))}get captureEvent(){return this._captureEvent}capture(t,i){this._captureEvent.emit(t,i)}get id(){return this._id.value}set id(t){this._id.value=t}get idChanged(){return this._id.changed}resetWithCurrentCamera(t){if(!this._olViewer.actived)return;const i=this._olViewer.getCurrentCameraInfo();i&&(t&ss.ResetFlag.Position&&(this.position=i.position),t&ss.ResetFlag.Rotation&&(this.rotation=i.rotation),t&ss.ResetFlag.ViewDistance&&(this.viewDistance=0))}flyTo(t,i){if((i??!0)&&!this._olViewer.actived)return;const{position:s,rotation:o,viewDistance:r,duration:a}=this;s&&Bi(this._olViewer,s,r,o,t??a)}};I(ss,"ResetFlag",{Position:1,Rotation:2,ViewDistance:4,Zoom:10}),I(ss,"defaults",{thumbnailWidth:64,thumbnailHeight:64,enabled:!0,show:!1,position:[116.39,39.9,100],duration:1e3,default:!1,thumbnail:""});let Mo=ss;(n=>{n.createDefaultProps=()=>({enabled:!0,position:p.reactArrayWithUndefined(void 0),positionEditing:!1,show:!1,rotation:p.reactArray([0,0,0]),viewDistance:0,duration:void 0,default:!1,thumbnail:""})})(Mo||(Mo={})),p.extendClassProps(Mo.prototype,Mo.createDefaultProps);class es extends p.Destroyable{constructor(t,i){super();I(this,"_flyToEvent",this.disposeVar(new p.Event));I(this,"_feature");I(this,"_layer");I(this,"_source");const s=new Xn([[]]);this._feature=new Rn({geometry:s}),this._feature.setId(i??p.createGuid());const o=t.viewer;if(!o)return;this._source=new _n,this.dispose(()=>{var c;return(c=this._source)==null?void 0:c.dispose()}),this._layer=new Mn({source:this._source}),this.dispose(()=>{var c;return(c=this._layer)==null?void 0:c.dispose()}),o.addLayer(this._layer),this.dispose(()=>o.removeLayer(this._layer));const r=()=>{var c,h;(c=this._layer)==null||c.setVisible(this.show??!0),(h=this._layer)==null||h.setZIndex(this.zIndex)};this.d(p.createEventsCallFunc([this.showChanged,this.zIndexChanged],r,{immediate:!0}));const a=()=>{if(!this._source||!this._feature||(this._source.clear(),!this.positions||this.positions.length<3))return;const c=H1(this.positions);if(c.length<4)return;this._feature.getGeometry().setCoordinates([c]);const h=this.filled?this.fillColor:[0,0,0,0],u=this.stroked?this.outlineColor:[0,0,0,0];this._feature.setStyle(new Xe({fill:new wt({color:$1(h)}),stroke:new St({color:$1(u),width:this.outlineWidth??1.5,lineDash:this.hasDash?[this.dashLength??16,(this.dashLength??16)/2]:void 0})})),this._source.addFeature(this._feature)};a();const l=this.disposeVar(p.createNextAnimateFrameEvent(this.positionsChanged,this.fillColorChanged,this.outlineColorChanged,this.outlineWidthChanged,this.hasDashChanged,this.dashLengthChanged,this.strokedChanged,this.filledChanged));this.dispose(l.disposableOn(a)),this.dispose(this.flyToEvent.disposableOn(c=>{if(!this.positions||this.positions.length===0)return;const h=H1(this.positions),[u,d]=CA(h),[f,g]=Ft([u,d]);Bi(t,[f,g,0])}))}get typeName(){return"OlPolygon"}get defaultProps(){return es.createDefaultProps()}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}}(n=>{n.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:p.reactJsonWithUndefined(void 0),fillColor:p.reactArray([1,1,1,.4]),outlineColor:p.reactArray([1,1,1,1]),outlineWidth:1.5,hasDash:!1,dashLength:16,zIndex:0,stroked:!0,filled:!0})})(es||(es={})),p.extendClassProps(es.prototype,es.createDefaultProps);function $1(n){return`rgba(${n[0]*255}, ${n[1]*255}, ${n[2]*255}, ${n[3]})`}function H1(n){const e=n.map(s=>Me([s[0],s[1]])),t=e[0],i=e[e.length-1];return(!t||!i||t[0]!==i[0]||t[1]!==i[1])&&e.push(t),e}function CA(n){let e=0,t=0,i=0;for(let s=0,o=n.length-1;s<n.length;o=s++){const[r,a]=n[o],[l,c]=n[s],h=r*c-l*a;e+=h,t+=(r+l)*h,i+=(a+c)*h}return e*=.5,Math.abs(e)<1e-9?n[0]:(t/=6*e,i/=6*e,[t,i])}const Ou=class Ou extends p.Destroyable{constructor(t,i){super();I(this,"_pickedEvent",this.disposeVar(new p.Event));I(this,"_flyToEvent",this.disposeVar(new p.Event));I(this,"_clickEvent",this.disposeVar(new p.Event));I(this,"_hovered",this.disposeVar(p.react(!1)));I(this,"_feature");I(this,"_source");I(this,"_layer");I(this,"_initialized",!1);const s=new Jo([]);this._feature=new Rn({geometry:s}),this._feature.setId(i??p.createGuid());const o=t.viewer;if(!o)return;this._source=new _n,this.dispose(()=>{var c;return(c=this._source)==null?void 0:c.dispose()}),this._layer=new Mn({source:this._source}),this.dispose(()=>{var c;return(c=this._layer)==null?void 0:c.dispose()});const r=()=>{var c;(c=this._layer)==null||c.setVisible(this.show??!0)};r(),this.ad(this.showChanged.don(r)),o.addLayer(this._layer),this.dispose(()=>o.removeLayer(this._layer));const a=()=>{if(!this._source||!this._feature||(this._source.clear(),!this.points))return;const c=this.points.map(w=>Me([w[0],w[1]]));if(!this._feature)return;const h=this._feature.getGeometry();h&&h.setCoordinates(c);const u=this.radius??5,d=this.strokeWidth??2,f=this.fillColor??[255,255,255,1],g=this.strokeColor??[0,153/255,1,1],_=new wt({color:`rgba(${f.map(w=>w*255).join(",")})`}),v=new St({color:`rgba(${g.map(w=>w*255).join(",")})`,width:d}),E=new Xe({image:new An({radius:u,fill:_,stroke:v})});this._feature.setStyle(E),this._source.addFeature(this._feature)};a();const l=this.disposeVar(p.createNextAnimateFrameEvent(this.pointsChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged));this.dispose(l.disposableOn(a)),this.dispose(this.pointsChanged.don(()=>{!this._initialized&&this.points&&(this._initializePoint(),this._initialized=!0)}))}get typeName(){return"OlMultiPoint"}get defaultProps(){return Ou.createDefaultProps()}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}get clickEvent(){return this._clickEvent}get hovered(){return this._hovered.value}set hovered(t){this._hovered.value=t}get feature(){return this._feature}_initializePoint(){const t=()=>{var f;if(!this.points)return;const s=this.points.map(g=>Me([g[0],g[1]]));if(!this._feature)return;const o=this._feature.getGeometry();o&&o.setCoordinates(s);const r=this.radius??5,a=this.strokeWidth??2,l=this.fillColor??[1,1,1,1],c=this.strokeColor??[0,153/255,1,1],h=new wt({color:`rgba(${l.map(g=>g*255).join(",")})`}),u=new St({color:`rgba(${c.map(g=>g*255).join(",")})`,width:a}),d=new Xe({image:new An({radius:r,fill:h,stroke:u})});this._feature.setStyle(d),this._feature.set("visible",this.show??!0),(f=this._source)==null||f.addFeature(this._feature)};t();const i=p.createNextAnimateFrameEvent(this.pointsChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged);this.dispose(i.disposableOn(t))}};I(Ou,"defaults",{position:[],width:2,loop:!1,color:[1,1,1,.5],outlineColor:[0,0,0,1],show:!0,allowPicking:!1,strokeColor:[0,.6,1,1],fillColor:[1,1,1,1],strokeWidth:2,radius:5});let Vs=Ou;(n=>{n.createDefaultProps=()=>({show:void 0,points:p.reactPositions(void 0),editting:void 0,allowPicking:!1,pixelSize:void 0,color:p.reactArrayWithUndefined(void 0),outlineColor:p.reactArrayWithUndefined(void 0),outlineWidth:void 0,fillColor:p.reactArrayWithUndefined(void 0),strokeColor:p.reactArrayWithUndefined(void 0),strokeWidth:void 0,radius:void 0,zIndex:void 0})})(Vs||(Vs={})),p.extendClassProps(Vs.prototype,Vs.createDefaultProps);class fl extends p.EngineObject{constructor(e,t){if(super(e,t),!t.viewer){console.warn("map is undefined!");return}this.d(e.flyToEvent.don((s,o)=>this.flyTo(s,o))),this.d(e.flyInEvent.don((s,o)=>this.flyIn(s,o))),this.dispose(e.calcFlyInParamEvent.disposableOn(()=>{if(!t.actived)return;const s=t.getCurrentCameraInfo();if(!s)return;const{position:o,rotation:r}=s;e.flyInParam={position:o,rotation:r,flyDuration:1}})),this.dispose(e.calcFlyToParamEvent.disposableOn(()=>{e.useCalcFlyToParamInESObjectWithLocation||console.warn("calcFlyToParam无法调用,该对象缺少position属性!")}))}flyToWithPromise(e,t,i,s,o,r,a){const{sceneObject:l,olViewer:c}=this;c.flyTo({distance:i??0,heading:s?s[0]:0,pitch:s?s[1]:0,flyDuration:o??1,hDelta:r??0,pDelta:a??0},t)}flyTo(e,t){const{sceneObject:i,olViewer:s}=this;return s.actived?(i.flyToParam&&(i.useCalcFlyToParamInESObjectWithLocation||console.warn("flyToParam无法使用,该对象缺少position属性,若飞行失败,请清空flyToParam后重试!")),i.flyInParam?this.flyIn(e,t):!1):!1}flyIn(e,t){const{sceneObject:i,olViewer:s}=this;if(!s.actived)return!1;if(i.flyInParam){const{position:o,rotation:r,flyDuration:a}=i.flyInParam,l=e??a;return this.olViewer.flyIn(o,r,l),!0}return!1}get olViewer(){return this.viewer}}class pl extends fl{constructor(t,i){super(t,i);I(this,"_smoothMoving");this._smoothMoving=this.dv(new p.SmoothMoveController(i)),this.d(this._smoothMoving.currentPositionChanged.don(o=>{o&&(t.position=o)})),this.d(this._smoothMoving.currentRotationChanged.don(o=>{o&&this._smoothMoving.isRotating&&(t.rotation=o)})),this.d(this._smoothMoving.currentHeadingChanged.don(o=>{if(o!==void 0&&!this._smoothMoving.isRotating){const r=t.rotation;t.rotation=[o-90,r[1],r[2]]}})),this.d(t.smoothMoveEvent.don((o,r)=>this.smoothMove(o,r*1e3))),this.d(t.smoothMoveWithRotationEvent.don((o,r,a)=>this.smoothMoveWithRotation(o,r,a*1e3))),this.d(t.smoothMoveOnGroundEvent.don((o,r,a)=>this.smoothMoveOnGround(o,r,a*1e3))),this.d(t.smoothMoveWithRotationOnGroundEvent.don((o,r,a,l)=>this.smoothMoveWithRotationOnGround(o,r,a,l*1e3))),this.d(t.calcFlyToParamEvent.don(()=>{if(!t.useCalcFlyToParamInESObjectWithLocation||!t.position)return;const o=i.calcFlyToParam(t.position);if(!o){console.warn("olViewer.calcFlyToParam failed.");return}console.log("olViewer.calcFlyToParam success.",o),t.flyToParam=o})),this.d(t.automaticLandingEvent.don(async()=>{console.warn("ESOlViewer automaticLandingEvent is not supported.")}));const s=this.dv(p.createNextAnimateFrameEvent(t.minVisibleDistanceChanged,t.maxVisibleDistanceChanged));this.d(s.don(()=>this.visibleDistance(t,i))),this.d(i.cameraChanged.don(()=>this.visibleDistance(t,i)))}smoothMove(t,i){this._smoothMoving.isGround=!1,this._smoothMoving.isRotating=!1,this._smoothMoving.restart(this.sceneObject.position,this.sceneObject.rotation,0),this._smoothMoving.restart(t,this.sceneObject.rotation,i)}smoothMoveWithRotation(t,i,s){this._smoothMoving.isGround=!1,this._smoothMoving.isRotating=!0,this._smoothMoving.restart(this.sceneObject.position,this.sceneObject.rotation,0),this._smoothMoving.restart(t,i,s)}async smoothMoveOnGround(t,i,s){const o=await this.olViewer.getTerrainHeight([t,i])??0;this._smoothMoving.isGround=!0,this._smoothMoving.isRotating=!1,this._smoothMoving.restart(this.sceneObject.position,this.sceneObject.rotation,0),this._smoothMoving.restart([t,i,o],this.sceneObject.rotation,s)}async smoothMoveWithRotationOnGround(t,i,s,o){const r=await this.olViewer.getTerrainHeight([i,s])??0;this._smoothMoving.isGround=!0,this._smoothMoving.isRotating=!0,this._smoothMoving.restart(this.sceneObject.position,this.sceneObject.rotation,0),this._smoothMoving.restart([i,s,r],t,o)}visibleDistance(t,i){if(!t.show||!t.position)return;const s=p.getDistancesFromPositions([t.position,Py(i)],"NONE")[0];t.minVisibleDistance<t.maxVisibleDistance?s>t.minVisibleDistance&&s<t.maxVisibleDistance:t.maxVisibleDistance===0&&s>t.minVisibleDistance}flyTo(t,i){const{sceneObject:s,olViewer:o}=this;if(!o.actived||!o.viewer)return!1;if(s.flyToParam&&s.position){const{position:r,flyToParam:a}=s,{distance:l,heading:c,pitch:h,flyDuration:u,hDelta:d,pDelta:f}=a;return this.flyToWithPromise(i,r,l,[c,h,0],t??u,d,f),!0}else return of(o.viewer,s.position,t),!0}flyIn(t,i){const{sceneObject:s,olViewer:o}=this;return!o.actived||!o.viewer?!1:!super.flyIn(t,i)&&s.position?(of(o.viewer,s.position,t),!0):!1}}class _g extends pl{constructor(t,i){super(t,i);I(this,"_lastHoverResult",this.dv(p.react(void 0)));if(!i.viewer){console.warn("viewer is undefined!");return}this.ad(p.createProcessingFromAsyncFunc(async(o,r)=>{const a=await o.promise(i.pick(r.screenPosition,"innerHoverEvent"));this.lastHoverResult=Object.assign({},a,r)}))}get lastHoverResult(){return this._lastHoverResult.value}set lastHoverResult(t){this._lastHoverResult.value=t}get lastHoverResultChanged(){return this._lastHoverResult.changed}}const xA=n=>{const e=[];if(n){const t=n.length;let i=0;for(let s=0;s<t;++s){const o=(s+1)%t,r=p.geoDistance(n[s],n[o]),a=Math.abs(n[s][2]-n[o][2]),l=Math.sqrt(r*r+a*a);i+=l,e.push(i)}}return e},PA=n=>{let e;return n?(n.length<3?e=0:e=p.geoArea(n),e):0},SA=n=>{let e;return n?(n.length<3?e=void 0:e=p.geoCenterOfMass(n),e):void 0},El=class El extends fl{constructor(e,t){if(super(e,t),!t.viewer){console.warn("viewer is undefined!");return}}flyIn(e,t){if(!super.flyIn(e,t)){if(!this.olViewer.actived||!this.olViewer.viewer)return!1;const s=this.sceneObject.points;if(!s||s.length===0)return!1;const o=qc(s);return ja(this.olViewer.viewer,o,e),console.log("OlESGeoVector flyIn"),!0}return!0}flyTo(e,t){if(!super.flyTo(e,t)){if(!this.olViewer.actived||!this.olViewer.viewer)return!1;const s=this.sceneObject.points;if(!s||s.length===0)return!1;const o=qc(s);return ja(this.olViewer.viewer,o,e),console.log("OlESGeoVector flyTo"),!0}return!0}};I(El,"type",El.register("ESOlViewer",p.ESGeoVector.type,El));let Ur=El;class Do extends p.Destroyable{constructor(t,i){super();I(this,"_flyToEvent",this.disposeVar(new p.Event));if(!t.viewer)return;const o=this.ad(new es(t,i)),r=this.ad(new jt(t,i));r.loop=!0,this.ad(p.bind([r,"depthTest"],[this,"depthTest"])),this.d(p.track([o,"allowPicking"],[this,"allowPicking"]));const a=()=>{r.show=!!(this.show&&this.outline),o.show=!!(this.show&&this.fill),r.positions=this.positions,o.positions=o.show?this.positions||[]:[],r.color=this.outlineColor,r.width=this.outlineWidth;const[c=1,h=1,u=1,d=.5]=this.color||[1,1,1,.5];o.fillColor=[c,h,u,d]};a();const l=this.disposeVar(p.createNextAnimateFrameEvent(this.showChanged,this.outlineChanged,this.outlineColorChanged,this.outlineWidthChanged,this.fillChanged,this.colorChanged,this.positionsChanged));this.d(l.disposableOn(a)),this.d(this.flyToEvent.disposableOn(c=>{o.show?o.flyTo(c):r.show&&r.flyTo(c)}))}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}}I(Do,"defaults",{viewDistanceRange:[1e3,1e4,3e4,6e4],positions:[]}),(n=>{n.createDefaultProps=()=>({show:!0,allowPicking:!1,outline:!0,strokeGround:!1,outlineColor:p.reactArray([1,1,1,1]),outlineWidth:2,ground:!1,fill:!0,color:p.reactArray([1,1,1,.5]),positions:p.reactPositions(void 0),viewDistanceRange:p.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,depthTest:!1})})(Do||(Do={})),p.extendClassProps(Do.prototype,Do.createDefaultProps);const Cl=class Cl extends Ur{constructor(t,i){super(t,i);I(this,"_geoPolygon");if(!i.viewer){console.warn("viewer is undefined!");return}this._geoPolygon=this.ad(new es(this.olViewer,t.id));const o=this.geoPolygon;o&&(this.d(p.track([o,"show"],[t,"show"])),this.d(p.track([o,"allowPicking"],[t,"allowPicking"])),this.d(p.bind([o,"positions"],[t,"points"])),this.d(p.track([o,"stroked"],[t,"stroked"])),this.d(p.track([o,"outlineColor"],[t,"strokeColor"])),this.d(p.track([o,"outlineWidth"],[t,"strokeWidth"])),this.d(p.track([o,"filled"],[t,"filled"])),this.d(p.track([o,"fillColor"],[t,"fillColor"])))}get geoPolygon(){return this._geoPolygon}};I(Cl,"type",Cl.register("ESOlViewer",p.ESGeoPolygon.type,Cl));let gl=Cl;function ml(n){var t;const e=(t=Jf(n,"pickResult"))==null?void 0:t.pointerEvent;return(e==null?void 0:e.buttons)!=0?(e==null?void 0:e.button)??0:-1}function RA(n,e,t){const i=[];for(const s of t)switch(s){case"SquareMeter_SquareKilometer":n>=1e6?i.push(`面积:${(n/1e6).toFixed(2)} km²`):i.push(`面积:${n.toFixed(2)} m²`);break;case"MU_Hectare":const o=n*(1/666.7);if(o>=15){const r=o/15;i.push(`面积:${r.toFixed(2)} 公顷`)}else i.push(`面积:${o.toFixed(2)} 亩`);break;case"PerimeterMeter_PerimeterKilometer":e>=1e3?i.push(`周长:${(e/1e3).toFixed(2)} km`):i.push(`周长:${e.toFixed(2)} m`);break}return i}class Gr extends p.Destroyable{constructor(t,i){super();I(this,"_pickedEvent",this.dv(new p.Event));I(this,"_flyToEvent",this.dv(new p.Event));I(this,"_area",this.dv(p.react(0)));I(this,"_centerOfMass",this.dv(p.reactArrayWithUndefined(void 0)));I(this,"_distances",this.dv(p.reactArray([])));I(this,"_geoPolyline");I(this,"_id",this.dv(p.react(p.createGuid())));i&&(this.id=i);{const s=()=>{this._distances.value=xA(this.positions),this._area.value=PA(this.positions),this._centerOfMass.value=SA(this.positions)};s();const o=this.dv(p.createNextAnimateFrameEvent(this.positionsChanged));this.dispose(o.disposableOn(s))}{const s=this._geoPolyline=this.dv(new jt(t,i));s.loop=!0,s.arcType="GEODESIC",this.dispose(p.bind([s,"color"],[this,"color"])),this.dispose(p.bind([s,"dashLength"],[this,"dashLength"])),this.dispose(p.bind([s,"dashPattern"],[this,"dashPattern"])),this.dispose(p.bind([s,"gapColor"],[this,"gapColor"])),this.dispose(p.bind([s,"hasArrow"],[this,"hasArrow"])),this.dispose(p.bind([s,"hasDash"],[this,"hasDash"])),this.dispose(p.bind([s,"positions"],[this,"positions"])),this.dispose(p.bind([s,"show"],[this,"show"])),this.dispose(p.bind([s,"allowPicking"],[this,"allowPicking"])),this.dispose(p.bind([s,"width"],[this,"width"])),this.dispose(p.bind([s,"depthTest"],[this,"depthTest"]))}{const s=this.dv(new Do(t,i));s.outline=!1;const o=()=>{s.positions=this.positions};o(),this.dispose(this.positionsChanged.disposableOn(o));const r=()=>{const a=this.fillColor;s.color=[a[0],a[1],a[2],a[3]*.5]};r(),this.dispose(this.fillColorChanged.disposableOn(r)),this.dispose(p.track([s,"show"],[this,"show"])),this.dispose(p.track([s,"ground"],[this,"ground"])),this.dispose(p.track([s,"allowPicking"],[this,"allowPicking"])),this.dispose(p.bind([s,"depthTest"],[this,"depthTest"])),this.d(this.flyToEvent.don(a=>{s.flyTo(a)}))}{const s=this.dv(new kt(t,i)),o=this.dv(p.createNextAnimateFrameEvent(this.areaChanged,this.centerOfMassChanged,this.distancesChanged,this.unitsChanged)),r=()=>{if(this.distances.length===0){s.innerHTML="";return}const a=RA(this.area,this.distances[this.distances.length-1],this.units);s.innerHTML=Ch([...a].join(`
169
+ `))};r(),this.dispose(o.disposableOn(r)),this.dispose(p.track([s,"show"],[this,"show"])),this.dispose(p.track([s,"allowPicking"],[this,"allowPicking"])),this.dispose(p.bind([s,"shadowDom"],[this,"shadowDom"])),this.dispose(p.bind([s,"cssAllInitial"],[this,"cssAllInitial"])),this.dispose(p.track([s,"position"],[this,"centerOfMass"])),this.ad(s.pickedEvent.don(a=>{ml(a)===0&&this.pickedEvent.emit(a)}))}}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}get area(){return this._area.value}get areaChanged(){return this._area.changed}get centerOfMass(){return this._centerOfMass.value}get centerOfMassChanged(){return this._centerOfMass.changed}get distances(){return this._distances.value}get distancesChanged(){return this._distances.changed}get geoPolyline(){return this._geoPolyline}get id(){return this._id.value}set id(t){this._id.value=t}get idChanged(){return this._id.changed}}I(Gr,"defaults",{positions:[]}),(n=>{n.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:p.reactPositions(void 0),width:2,color:p.reactArray([1,1,1,.5]),fillColor:p.reactArray([1,1,1,.5]),hasDash:!1,gapColor:p.reactArray([0,0,0,0]),dashLength:16,dashPattern:255,hasArrow:void 0,depthTest:!1,shadowDom:!1,cssAllInitial:!1,strokeGround:!0,ground:!0,units:p.reactArray(["SquareMeter_SquareKilometer","MU_Hectare","PerimeterMeter_PerimeterKilometer"])})})(Gr||(Gr={})),p.extendClassProps(Gr.prototype,Gr.createDefaultProps);const xl=class xl extends gl{constructor(t,i){super(t,i);I(this,"_olAreaMeasurement");if(this._olAreaMeasurement=this.disposeVar(new Gr(i,t.id)),!i.viewer){console.warn("viewer is undefined!");return}t.strokeGround=!1,t.fillGround=!1;const o=this._olAreaMeasurement;this.dispose(p.track([o,"show"],[t,"show"])),this.dispose(p.track([o,"units"],[t,"units"])),this.dispose(p.track([o,"allowPicking"],[t,"allowPicking"])),this.dispose(p.bind([o,"positions"],[t,"points"])),this.dispose(p.bind([o,"strokeGround"],[t,"strokeGround"])),this.d(p.bind([o,"ground"],[t,"fillGround"]));{const r=()=>{if(t.stroked)o.width=t.strokeWidth;else{o.width=0;return}o.color=t.strokeColor;const c=t.strokeStyle;if(c.material==="hasDash"&&c.materialParams)try{const u=c.materialParams;Reflect.has(u,"gapColor")&&(o.gapColor=u.gapColor??[0,0,0,0]),Reflect.has(u,"dashLength")&&(o.dashLength=u.dashLength),Reflect.has(u,"dashPattern")&&(o.dashPattern=u.dashPattern)}catch(u){console.error(u)}else o.gapColor=[0,0,0,0],o.dashLength=0,o.dashPattern=0;const h=t.strokeMaterial??"normal";h==="hasDash"?(o.hasDash=!0,o.hasArrow=!1):h==="hasArrow"?(o.hasDash=!1,o.hasArrow=!0):(o.hasDash=!1,o.hasArrow=!1)};r();const a=this.disposeVar(p.createNextAnimateFrameEvent(t.strokeStyleChanged,t.strokedChanged));this.dispose(a.disposableOn(r))}{const r=()=>{if(t.filled)o.fillColor=t.fillColor;else{o.fillColor=[1,1,1,0];return}};r();const a=this.disposeVar(p.createNextAnimateFrameEvent(t.fillStyleChanged,t.filledChanged));this.dispose(a.disposableOn(r))}this.dispose(o.pickedEvent.disposableOn(r=>{(t.allowPicking??!1)&&t.pickedEvent.emit(r)}))}get olAreaMeasurement(){return this._olAreaMeasurement}};I(xl,"type",xl.register("ESOlViewer",p.ESAreaMeasurement.type,xl));let wg=xl;const No=class No extends p.Destroyable{constructor(t,i){super();I(this,"_pickedEvent",this.disposeVar(new p.Event));I(this,"_flyToEvent",this.disposeVar(new p.Event));I(this,"_heading",this.disposeVar(p.react(0)));I(this,"_textFunc",this.disposeVar(p.react(void 0)));const s=this;{const a=()=>{if(this.positions&&this.positions.length>=2){let c=0;this.arcType===void 0||this.arcType==="GEODESIC"?c=p.geoHeading(this.positions[0],this.positions[1]):this.arcType==="RHUMB"?c=p.geoRhumbHeading(this.positions[0],this.positions[1]):this.arcType==="NONE"?c=p.geoHeading(this.positions[0],this.positions[1]):console.warn(`未知的arcType: ${this.arcType},导致距离无法计算!`),this._heading.value=this.angleMode==="-180~180"?p.clampN180_180(c):p.clamp0_360(c)}};a();const l=this.disposeVar(p.createNextAnimateFrameEvent(this.positionsChanged,this.arcTypeChanged,this.angleModeChanged));this.dispose(l.disposableOn(a))}const o=this.disposeVar(new jt(t,i));o.loop=!1,this.dispose(p.track([o,"allowPicking"],[s,"allowPicking"])),this.dispose(p.bind([o,"arcType"],[s,"arcType"])),this.dispose(p.bind([o,"color"],[s,"color"])),this.dispose(p.bind([o,"dashLength"],[s,"dashLength"])),this.dispose(p.bind([o,"dashPattern"],[s,"dashPattern"])),this.dispose(p.bind([o,"gapColor"],[s,"gapColor"])),this.dispose(p.bind([o,"hasArrow"],[s,"hasArrow"])),this.dispose(p.bind([o,"hasDash"],[s,"hasDash"])),this.dispose(p.bind([o,"positions"],[s,"positions"])),this.dispose(p.bind([o,"show"],[s,"show"])),this.dispose(p.bind([o,"width"],[s,"width"])),this.dispose(p.bind([o,"depthTest"],[s,"depthTest"])),this.dispose(s.flyToEvent.disposableOn(a=>{t.actived&&o.flyTo(a)}));const r=this.disposeVar(new kt(t,i));this.dispose(p.bind([r,"shadowDom"],[s,"shadowDom"])),this.dispose(p.bind([r,"cssAllInitial"],[s,"cssAllInitial"])),this.dispose(p.bind([r,"show"],[s,"show"]));{const a=()=>{s.positions&&s.positions.length>=2?r.position=s.positions[1]:r.position=void 0};a(),this.dispose(s.positionsChanged.disposableOn(a))}{const a=()=>{const{heading:c}=s,h=(s.textFunc??No.defaultTextFunc_度格式)(c);r.innerHTML=Ch(`方向: ${h}`,24)};a();const l=this.disposeVar(p.createNextAnimateFrameEvent(s.headingChanged,s.textFuncChanged));this.dispose(l.disposableOn(a))}this.ad(r.pickedEvent.don(a=>{ml(a)===0&&this.pickedEvent.emit(a)}))}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}get heading(){return this._heading.value}get headingChanged(){return this._heading.changed}get textFunc(){return this._textFunc.value}set textFunc(t){this._textFunc.value=t}get textFuncChanged(){return this._textFunc.changed}};I(No,"defaultTextFunc_度格式",t=>`${t.toFixed(5)}°`),I(No,"defaultTextFunc_度分格式",t=>`${xh(t,!0)}`),I(No,"defaultTextFunc_度分秒格式",t=>`${xh(t,!1)}`),I(No,"defaults",{positions:[]});let Fo=No;(n=>{n.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:p.reactPositions(void 0),width:4,color:p.reactArray([1,1,1,1]),hasDash:!1,gapColor:p.reactArray([0,0,0,0]),dashLength:16,dashPattern:255,hasArrow:!0,arcType:"GEODESIC",depthTest:!1,shadowDom:!1,cssAllInitial:!1,angleMode:"-180~180",strokeGround:!1})})(Fo||(Fo={})),p.extendClassProps(Fo.prototype,Fo.createDefaultProps);const Pl=class Pl extends Ur{constructor(t,i){super(t,i);I(this,"_olDirectionMeasurement");if(this._olDirectionMeasurement=this.disposeVar(new Fo(i,t.id)),!i.viewer){console.warn("viewer is undefined!");return}const o=this._olDirectionMeasurement;o.angleMode="0~360",this.dispose(p.track([o,"show"],[t,"show"])),this.dispose(p.track([o,"allowPicking"],[t,"allowPicking"])),this.dispose(p.bind([o,"positions"],[t,"points"])),this.dispose(p.bind([o,"strokeGround"],[t,"strokeGround"]));{const r=()=>{if(t.stroked)o.width=t.strokeWidth;else{o.width=0;return}o.width=t.strokeWidth,o.color=t.strokeColor;const c=t.strokeMaterial??"normal";c==="hasDash"?(o.hasDash=!0,o.hasArrow=!1):c==="hasArrow"?(o.hasDash=!1,o.hasArrow=!0):c==="normal"?(o.hasDash=!1,o.hasArrow=!1):(o.hasDash=!1,o.hasArrow=!0);const h=t.strokeStyle;if(h.material==="hasDash"&&h.materialParams)try{const u=h.materialParams;Reflect.has(u,"gapColor")&&(o.gapColor=u.gapColor??[0,0,0,0]),Reflect.has(u,"dashLength")&&(o.dashLength=u.dashLength),Reflect.has(u,"dashPattern")&&(o.dashPattern=u.dashPattern)}catch(u){console.error(u)}else o.gapColor=[0,0,0,0],o.dashLength=0,o.dashPattern=0};r();const a=this.disposeVar(p.createNextAnimateFrameEvent(t.strokeStyleChanged,t.strokedChanged));this.dispose(a.disposableOn(r))}this.dispose(o.pickedEvent.disposableOn(r=>{ml(r)===0&&(t.allowPicking??!1)&&t.pickedEvent.emit(r)}))}get olDirectionMeasurement(){return this._olDirectionMeasurement}};I(Pl,"type",Pl.register("ESOlViewer",p.ESDirectionMeasurement.type,Pl));let vg=Pl;function X1(n,e,t,i){const s=new kt(t,i);return s.innerHTML=Ch(n),s.position=e,s.show=!0,s}class qr extends p.Destroyable{constructor(t,i){super();I(this,"_pickedEvent",this.disposeVar(new p.Event));I(this,"_flyToEvent",this.disposeVar(new p.Event));I(this,"_distances",this.disposeVar(p.reactArray([])));const s=async()=>{this._distances.value=p.getDistancesFromPositions(this.positions??[],this.arcType)};s();const o=this.disposeVar(p.createNextAnimateFrameEvent(this.positionsChanged,this.arcTypeChanged,this.strokeGroundChanged));this.dispose(o.disposableOn(s));const r=this.disposeVar(new jt(t,i));r.loop=!1,this.dispose(p.track([r,"allowPicking"],[this,"allowPicking"])),this.dispose(p.bind([r,"arcType"],[this,"arcType"])),this.dispose(p.bind([r,"color"],[this,"color"])),this.dispose(p.bind([r,"dashLength"],[this,"dashLength"])),this.dispose(p.bind([r,"dashPattern"],[this,"dashPattern"])),this.dispose(p.bind([r,"gapColor"],[this,"gapColor"])),this.dispose(p.bind([r,"hasArrow"],[this,"hasArrow"])),this.dispose(p.bind([r,"hasDash"],[this,"hasDash"])),this.dispose(p.bind([r,"positions"],[this,"positions"])),this.dispose(p.bind([r,"show"],[this,"show"])),this.dispose(p.bind([r,"width"],[this,"width"])),this.dispose(p.bind([r,"depthTest"],[this,"depthTest"])),this.dispose(this.flyToEvent.disposableOn(a=>{t.actived&&r.flyTo(a)}));{const a=[],l=()=>{for(let h of a)h.destroy();a.length=0};this.dispose(l);const c=()=>{if(l(),!this.positions)return;if(this.positions.length>0&&this.distances.length>0){const u=X1("起点",this.positions[0],t,i);u.dispose(p.track([u,"show"],[this,"show"])),u.dispose(p.track([u,"shadowDom"],[this,"shadowDom"])),u.dispose(p.track([u,"cssAllInitial"],[this,"cssAllInitial"])),a.push(u)}const h=this.distances.length;for(let u=0;u<h;++u){const d=this.distances[u],f=this.positions[u+1],g=X1(`长度: ${Q_(d)}`,f,t,i);g.dispose(p.track([g,"show"],[this,"show"])),g.dispose(p.track([g,"shadowDom"],[this,"shadowDom"])),g.dispose(p.track([g,"cssAllInitial"],[this,"cssAllInitial"])),this.ad(g.pickedEvent.don(_=>{ml(_)===0&&this.pickedEvent.emit(_)})),a.push(g)}};c(),this.dispose(this.distancesChanged.disposableOn(()=>p.inOrderRunning(c)))}}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}get distances(){return this._distances.value}get distancesChanged(){return this._distances.changed}}I(qr,"defaults",{positions:[]}),(n=>{n.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:p.reactPositions(void 0),width:1,color:p.reactArray([1,1,1,1]),hasDash:!1,gapColor:p.reactArray([0,0,0,0]),dashLength:16,dashPattern:255,hasArrow:!1,arcType:"GEODESIC",depthTest:!1,shadowDom:!1,cssAllInitial:!1,strokeGround:!1})})(qr||(qr={})),p.extendClassProps(qr.prototype,qr.createDefaultProps);const Sl=class Sl extends Ur{constructor(t,i){super(t,i);I(this,"_geoPolyline");if(this._geoPolyline=this.disposeVar(new jt(i,t.id)),!i.viewer){console.warn("viewer is undefined!");return}const o=this._geoPolyline;console.log(o.positions),console.log(t.points),this.dispose(p.track([o,"allowPicking"],[t,"allowPicking"])),this.dispose(p.bind([o,"positions"],[t,"points"])),this.dispose(p.track([o,"width"],[t,"strokeWidth"])),this.dispose(p.track([o,"color"],[t,"strokeColor"])),this.dispose(p.track([o,"show"],[t,"show"]));{const r=()=>{o.show=t.show&&t.stroked};r();const a=this.disposeVar(p.createNextAnimateFrameEvent(t.showChanged,t.strokedChanged));this.dispose(a.disposableOn(r))}}get geoPolyline(){return this._geoPolyline}};I(Sl,"type",Sl.register("ESOlViewer",p.ESGeoLineString.type,Sl));let yl=Sl;const Rl=class Rl extends yl{constructor(t,i){super(t,i);I(this,"_olDistanceMeasurement");if(console.log("OlESDistanceMeasurement constructor",i.viewer),this._olDistanceMeasurement=this.disposeVar(new qr(i,t.id)),!i.viewer){console.warn("viewer is undefined!");return}const{olDistanceMeasurement:o}=this;this.dispose(p.track([o,"show"],[t,"show"])),this.dispose(p.track([o,"allowPicking"],[t,"allowPicking"])),this.dispose(p.bind([o,"positions"],[t,"points"])),this.dispose(p.bind([o,"strokeGround"],[t,"strokeGround"]));{const r=()=>{if(t.stroked)o.width=t.strokeWidth;else{o.width=0;return}o.width=t.strokeWidth,o.color=t.strokeColor;const c=t.strokeMaterial??"normal";c==="hasDash"?(o.hasDash=!0,o.hasArrow=!1):c==="hasArrow"?(o.hasDash=!1,o.hasArrow=!0):(o.hasDash=!1,o.hasArrow=!1);const h=t.strokeStyle;if(h.material==="hasDash"&&h.materialParams)try{const u=h.materialParams;Reflect.has(u,"gapColor")&&(o.gapColor=u.gapColor??[0,0,0,0]),Reflect.has(u,"dashLength")&&(o.dashLength=u.dashLength),Reflect.has(u,"dashPattern")&&(o.dashPattern=u.dashPattern)}catch(u){console.error(u)}else o.gapColor=[0,0,0,0],o.dashLength=0,o.dashPattern=0};r();const a=this.disposeVar(p.createNextAnimateFrameEvent(t.strokeStyleChanged,t.strokedChanged));this.dispose(a.disposableOn(r))}this.dispose(o.pickedEvent.disposableOn(r=>{ml(r)===0&&(t.allowPicking??!1)&&t.pickedEvent.emit(r)}))}get olDistanceMeasurement(){return this._olDistanceMeasurement}};I(Rl,"type",Rl.register("ESOlViewer",p.ESDistanceMeasurement.type,Rl));let bg=Rl;function Y1(n){const e=p.min(p.objsIterator(n,["0"])),t=p.min(p.objsIterator(n,["1"])),i=p.max(p.objsIterator(n,["0"])),s=p.max(p.objsIterator(n,["1"]));return{minPos:[e,t],maxPos:[i,s]}}function TA(n){const e=n.map(o=>Me(o)),{minPos:t,maxPos:i}=Y1(e),s=[.5*(t[0]+i[0]),.5*(t[1]+i[1])];return Ft(s)}function IA(n,e,t){const i=Me(t),s=Me(e),o=[s[0]-i[0],s[1]-i[1]];return n.map(l=>Me(l)).map(l=>[l[0]+o[0],l[1]+o[1]]).map(l=>Ft(l))}const Z1=p.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/img/location.png"),ko=class ko extends p.ESObjectWithLocation{getESProperties(){const e={...super.getESProperties()};return{...e,basic:[...e.basic,new p.StringProperty([this,"url"],"URL",Z1),new p.Number2Property([this,"size_m"],"大小(米)",[10,10]),new p.Number2Property([this,"minmaxScale"],"缩放范围",[0,2])]}}constructor(e){super(e)}};I(ko,"createDefaultProps",()=>({...p.ESObjectWithLocation.createDefaultProps(),url:Z1,size_m:[10,10],minmaxScale:[0,2]})),I(ko,"type",ko.register("ESGeoIcon",ko,{chsName:"地理图标",tags:["ESObjects","_ES_Impl_Openlayers"],description:"地理图标"})),I(ko,"supportEditingModes",[...p.ESObjectWithLocation.supportEditingModes]);let vu=ko;const Tl=class Tl extends pl{constructor(e,t){super(e,t);const i=t.viewer;if(!i)return;const s=new _n,o=new Mi.Feature({geometry:new yn(Me([e.position[0]??0,e.position[1]??0]))});s.addFeature(o),o.setId(e.id),this.d(e.positionChanged.don(f=>{const g=Me([f[0],f[1]]),_=o.getGeometry();_==null||_.setCoordinates(g)}));const r=new Mn({source:s});i.addLayer(r),this.d(()=>i.removeLayer(r));let a=64,l=64;{const f=new Image;f.onload=()=>{console.log("Image loaded",f.width),a=f.width,l=f.height},f.src=e.url,this.d(e.urlChanged.don(()=>{const g=p.ESSceneObject.context.getStrFromEnv(p.rpToap(e.url));f.src=g}))}function c(f,g,_){const v=p.ESSceneObject.context.getStrFromEnv(p.rpToap(f)),E=a*g[0],w=l*g[1],C=_*Math.PI/180;return new Xe({image:new Es({src:v,width:E,height:w,anchor:[.5,1],anchorXUnits:"fraction",anchorYUnits:"fraction",rotation:C})})}let h=c(e.url,[1,1],e.rotation[0]??0);const u=()=>{const f=i.getView().getResolution();if(!f)return;const{size_m:[g,_],minmaxScale:[v,E]}=e;let w=g/f/a,C=_/f/l;w=Math.max(v,Math.min(E,w)),C=Math.max(v,Math.min(E,C)),h=c(e.url,[w,C],e.rotation[0]??0),o.setStyle(h),o.changed()};this.d(p.createEventsCallFunc([e.size_mChanged,e.urlChanged,e.minmaxScaleChanged,e.rotationChanged],u)),u();const d=i.getView().on("change:resolution",()=>{u()});this.d(()=>ui(d))}};I(Tl,"type",Tl.register("ESOlViewer",vu.type,Tl));let Eg=Tl;const jo=class jo extends p.ESObjectWithLocation{getESProperties(){const e={...super.getESProperties()};return{...e,coordinate:[...e.coordinate,new p.NumberProperty([this,"distance"],"长度",0,!1,!0)],style:[new p.DivideProperty("点样式"),new p.BooleanProperty([this,"pointed"],"开启",!1),new p.NumberProperty([this,"pointSize"],"点大小",1),new p.EnumProperty([this,"pointSizeType"],[["screen","screen"],["world","world"]],"点类型","screen"),new p.ColorProperty([this,"pointColor"],"点颜色",[1,1,1,1])],basic:[...e.basic,new p.EnumProperty([this,"mode"],[["柱状警告","cylinder"],["圆形警告","circle"]],"模式","cylinder"),new p.NumberProperty([this,"radius"],"半径",10)]}}constructor(e){super(e)}};I(jo,"createDefaultProps",()=>({...p.ESObjectWithLocation.createDefaultProps(),pointed:!0,pointStyle:p.reactJson({size:1,sizeType:"screen",color:[1,1,1,1],material:"",materialParams:{},outlineColor:[1,0,0,1],outlineWidth:2})})),I(jo,"type",jo.register("ESGeoPoint",jo,{chsName:"地理点",tags:["ESObjects","_ES_Impl_Openlayers"],description:"地理点"})),I(jo,"supportEditingModes",[...p.ESObjectWithLocation.supportEditingModes]);let bu=jo;const $r=class $r extends p.ESVisualObject{getESProperties(){const e={...super.getESProperties()};return{...e,basic:[...e.basic,new p.NumberProperty([this,"zIndex"],"层级序号",0),new p.JsonProperty([this,"url"],"影像服务地址")]}}constructor(e){super(e)}};I($r,"createDefaultProps",()=>({...p.ESVisualObject.createDefaultProps(),attributions:p.reactArrayWithUndefined(void 0),attributionsCollapsible:void 0,cacheSize:void 0,crossOrigin:void 0,interpolate:void 0,projection:p.reactJsonWithUndefined(void 0),reprojectionErrorThreshold:void 0,maxZoom:void 0,minZoom:void 0,opaque:void 0,maxResolution:void 0,tileSize:void 0,gutter:void 0,tileUrlFunction:void 0,tileGrid:p.reactJsonWithUndefined(void 0),tileLoadFunction:void 0,tilePixelRatio:void 0,url:void 0,urls:p.reactArrayWithUndefined(void 0),wrapX:void 0,transition:void 0,zDirection:void 0,zIndex:void 0})),I($r,"type",$r.register("ESXYZLayer",$r,{chsName:"OL简单xyz图层",tags:[],description:"ESXYZLayer"}));let Eu=$r;const en=Math.PI,K1=6378245,Q1=.006693421622965943;function J1(n,e){let t=OA(n-105,e-35),i=AA(n-105,e-35);const s=e/180*en;let o=Math.sin(s);o=1-Q1*o*o;const r=Math.sqrt(o);return t=t*180/(K1*(1-Q1)/(o*r)*en),i=i*180/(K1/r*Math.cos(s)*en),[i,t]}function ev(n,e){return n<72.004||n>137.8347||e<.8293||e>55.8271}function OA(n,e){let t=-100+2*n+3*e+.2*e*e+.1*n*e+.2*Math.sqrt(Math.abs(n));return t+=(20*Math.sin(6*n*en)+20*Math.sin(2*n*en))*2/3,t+=(20*Math.sin(e*en)+40*Math.sin(e/3*en))*2/3,t+=(160*Math.sin(e/12*en)+320*Math.sin(e*en/30))*2/3,t}function AA(n,e){let t=300+n+2*e+.1*n*n+.1*n*e+.1*Math.sqrt(Math.abs(n));return t+=(20*Math.sin(6*n*en)+20*Math.sin(2*n*en))*2/3,t+=(20*Math.sin(n*en)+40*Math.sin(n/3*en))*2/3,t+=(150*Math.sin(n/12*en)+300*Math.sin(n/30*en))*2/3,t}const tv=function(n){return function(e,t,i){const s=e.length,o=i||2;let r;t?r=t:o!==2?r=e.slice():r=new Array(s);for(let a=0;a<s;a+=o)n(e,r,a);return r}},Cu={toWGS84:tv(function(n,e,t){let i=n[t],s=n[t+1];if(!ev(i,s)){const o=J1(i,s);i=i-o[0],s=s-o[1]}e[t]=i,e[t+1]=s}),fromWGS84:tv(function(n,e,t){let i=n[t],s=n[t+1];if(!ev(i,s)){const o=J1(i,s);i=i+o[0],s=s+o[1]}e[t]=i,e[t+1]=s})},fn={ll2smerc:Ni("EPSG:4326","EPSG:3857"),smerc2ll:Ni("EPSG:3857","EPSG:4326")};fn.ll2gmerc=function(n,e,t){const i=Cu.fromWGS84(n,e,t);return fn.ll2smerc(i,i,t)},fn.gmerc2ll=function(n,e,t){const i=fn.smerc2ll(n,n,t);return Cu.toWGS84(i,e,t)},fn.smerc2gmerc=function(n,e,t){let i=fn.smerc2ll(n,n,t);return i=Cu.fromWGS84(i,i,t),fn.ll2smerc(i,i,t)},fn.gmerc2smerc=function(n,e,t){let i=fn.smerc2ll(n,n,t);return i=Cu.toWGS84(i,i,t),fn.ll2smerc(i,i,t)};const Cg=new na({code:"GCJ-02",extent:[-20037508342789244e-9,-20037508342789244e-9,20037508342789244e-9,20037508342789244e-9],units:"m"});cc(Cg),Pm("EPSG:4326",Cg,fn.ll2gmerc,fn.gmerc2ll),Pm("EPSG:3857",Cg,fn.smerc2gmerc,fn.gmerc2smerc);class MA extends p.Destroyable{constructor(e,t){super();const i=t.viewer;if(!i){console.warn("map is undefined!");return}const s=Ki(i);if(!s)return;const{imageriesManager:o}=s,r=Ne("EPSG:3857");if(!r)return;const a=r.getExtent(),l=Ie(a)/256,c=new Array(19),h=new Array(19);for(let f=0;f<19;++f)c[f]=l/Math.pow(2,f),h[f]=f;const u=new Fh({tileGrid:new Us(e.tileGrid??{origin:rn(a),resolutions:c,matrixIds:h}),url:e.url,urls:e.urls,attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin??"anonymous",interpolate:e.interpolate,projection:e.projection??r,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tilePixelRatio:e.tilePixelRatio,tileLoadFunction:e.tileLoadFunction&&Function('"use strict";return ('+e.tileLoadFunction+")")(),wrapX:e.wrapX,transition:e.transition,zDirection:e.zDirection,maxZoom:e.maxZoom,minZoom:e.minZoom,opaque:e.opaque,maxResolution:e.maxResolution,tileSize:e.tileSize,gutter:e.gutter,tileUrlFunction:e.tileUrlFunction&&Function('"use strict";return ('+e.tileUrlFunction+")")()});this.dispose(()=>u.dispose());const d=new Oh({source:u});o.add(d),this.dispose(()=>o.delete(d)),d.setVisible(e.show??!0),this.dispose(()=>d.dispose()),this.dispose(e.showChanged.disposableOn(f=>{d.setVisible(f??!0)})),this.d(p.createEventsCallFunc(e.zIndexChanged,()=>{o.setZindex(d,e.zIndex??0)},{immediate:!0}));{const f=()=>{u.tileGrid=new Us(e.tileGrid??{origin:rn(a),resolutions:c,matrixIds:h}),e.attributions&&u.setAttributions(e.attributions),e.tileLoadFunction&&u.setTileLoadFunction(Function('"use strict";return ('+e.tileLoadFunction+")")()),e.tileUrlFunction&&u.setTileUrlFunction(Function('"use strict";return ('+e.tileUrlFunction+")")())},g=this.disposeVar(p.createNextAnimateFrameEvent(e.attributionsChanged,e.tileGridChanged,e.tileLoadFunctionChanged,e.tileUrlFunctionChanged));this.dispose(g.disposableOn(f))}e.urlChanged.disposableOn(f=>{u.setUrl(f??"")}),e.urlsChanged.disposableOn(f=>{u.setUrls(f??[])})}}const Il=class Il extends fl{constructor(e,t){super(e,t);let i;this.dispose(()=>i&&i.destroy());{const s=()=>{i&&i.destroy(),i=new MA(e,t)};s();const o=this.disposeVar(p.createNextAnimateFrameEvent(e.attributionsCollapsibleChanged,e.cacheSizeChanged,e.crossOriginChanged,e.interpolateChanged,e.projectionChanged,e.reprojectionErrorThresholdChanged,e.tilePixelRatioChanged,e.wrapXChanged,e.transitionChanged,e.zDirectionChanged,e.maxZoomChanged,e.minZoomChanged,e.opaqueChanged,e.maxResolutionChanged,e.tileSizeChanged,e.gutterChanged));this.dispose(o.disposableOn(s))}}};I(Il,"type",Il.register(Ci.type,Eu.type,Il));let xg=Il;const Ol=class Ol extends pl{constructor(t,i){super(t,i);I(this,"_geoPoint");if(this._geoPoint=this.disposeVar(new oi(i,t.id)),!i.viewer){console.warn("viewer is undefined!");return}const o=this._geoPoint;this.d(p.track([o,"allowPicking"],[t,"allowPicking"])),this.d(p.bind([o,"position"],[t,"position"])),this.d(p.track([o,"show"],[t,"show"]));{const r=()=>{o.show=t.show&&t.pointed};r();const a=this.dv(p.createNextAnimateFrameEvent(t.showChanged,t.pointedChanged));this.d(a.don(r))}}get geoPoint(){return this._geoPoint}};I(Ol,"type",Ol.register("ESOlViewer",bu.type,Ol));let Pg=Ol;const Al=class Al extends Ur{constructor(t,i){super(t,i);I(this,"_geoPoints");const s=this.dv(new Vs(i,t.id));if(this._geoPoints=s,!i.viewer){console.warn("viewer is undefined!");return}this.d(p.track([s,"allowPicking"],[t,"allowPicking"])),this.d(p.bind([s,"points"],[t,"points"]));{const r=()=>{s.show=t.show&&t.pointed};this.d(p.createEventsCallFunc([t.showChanged,t.pointedChanged],r,{immediate:!0}))}}get geoPoints(){return this._geoPoints}};I(Al,"type",Al.register("ESOlViewer",p.ESGeoPoints.type,Al));let Sg=Al;const Ml=class Ml extends gl{constructor(t,i){super(t,i);I(this,"_fireLayer");I(this,"_fireFeatures",[]);I(this,"_animationId",null);I(this,"_renderEventsKey",null);I(this,"_flickerPhase",0);if(!i.viewer){console.warn("OlESGeoPolygonWithFire: viewer is undefined!");return}const o=this.geoPolygon;if(o){const r=()=>{o.show=!1};r(),this.d(t.showChanged.don(r)),this.d(t.fireShowChanged.don(r))}this.createFireLayer(i),this.disposeVar(p.createNextAnimateFrameEvent(t.pointsChanged,t.fireShowChanged,t.fireIntensityChanged,t.showChanged))}createFireLayer(t){const i=this.sceneObject;if(!i.points||i.points.length<3)return;const s=t.viewer;if(!s)return;const o=new _n;this._fireLayer=new Mn({source:o,zIndex:999}),s.addLayer(this._fireLayer),this.d(()=>{this._fireLayer&&s.removeLayer(this._fireLayer)}),this.createFireFeatures(i),this.startFlickerAnimation()}createFireFeatures(t){if(!this._fireLayer||!t.points)return;const i=t.points,s=t.fireIntensity??5,o=Math.max(1,Math.min(10,s)),r=this.calculateCentroid(i),a=Me([r[0],r[1]]),l=i.map(g=>Me([g[0],g[1]])),c=l[0],h=l[l.length-1];(c[0]!==h[0]||c[1]!==h[1])&&l.push(c);const u=1+o*.08,d=[{color:[.8,.1,0,.15+o*.01],expand:u*1.3,stroke:!1},{color:[1,.25,0,.2+o*.02],expand:u*1.15,stroke:!1},{color:[1,.4,0,.3+o*.02],expand:u*1,stroke:!1},{color:[1,.6,0,.4+o*.03],expand:u*.85,stroke:!1},{color:[1,.85,.1,.5+o*.03],expand:u*.65,stroke:!1},{color:[1,1,.6,.4+o*.04],expand:u*.4,stroke:!1}],f=this._fireLayer.getSource();if(f){this._fireFeatures=[];for(const g of d){const _=l.map(C=>{const P=C[0]-a[0],R=C[1]-a[1];return[a[0]+P*g.expand,a[1]+R*g.expand]}),v=new Xn([_]),E=new Mi.Feature({geometry:v}),w=new Xe({fill:new wt({color:`rgba(${Math.round(g.color[0]*255)}, ${Math.round(g.color[1]*255)}, ${Math.round(g.color[2]*255)}, ${g.color[3]})`}),stroke:g.stroke?new St({color:`rgba(${Math.round(g.color[0]*255)}, ${Math.round(g.color[1]*255)}, ${Math.round(g.color[2]*255)}, ${g.color[3]*1.5})`,width:2}):void 0});E.setStyle(w),f.addFeature(E),this._fireFeatures.push(E)}}}startFlickerAnimation(){if(!this._fireLayer)return;this.stopFlickerAnimation();const i=this.sceneObject.fireIntensity??5,s=Math.max(1,Math.min(10,i)),o=.05+s*.015;this._renderEventsKey=this._fireLayer.on("postrender",r=>{if(!r.frameState)return;this._flickerPhase+=o,this._flickerPhase>Math.PI*2&&(this._flickerPhase-=Math.PI*2);const l=this._fireFeatures,c=this._flickerPhase;for(let h=0;h<l.length;h++){const d=l[h].getStyle();if(!d)continue;const f=d.getFill();if(!f)continue;const g=[.15+s*.01,.2+s*.02,.3+s*.02,.4+s*.03,.5+s*.03,.4+s*.04],_=h*.7,v=Math.sin(c+_)*.5+.5,E=Math.sin(c*2.3+_*1.5)*.3+.7,w=g[h]*(.6+v*.4)*E,P=f.getColor().match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(P){const R=parseInt(P[1]),A=parseInt(P[2]),O=parseInt(P[3]);f.setColor(`rgba(${R}, ${A}, ${O}, ${w})`)}}})}stopFlickerAnimation(){this._renderEventsKey&&(ui(this._renderEventsKey),this._renderEventsKey=null),this._animationId!==null&&(cancelAnimationFrame(this._animationId),this._animationId=null)}destroyFireLayer(){if(this.stopFlickerAnimation(),this._fireLayer){const t=this.olViewer.viewer;t&&t.removeLayer(this._fireLayer),this._fireLayer.dispose(),this._fireLayer=void 0}this._fireFeatures=[]}calculateCentroid(t){let i=0,s=0,o=0;const r=t.length;for(let a=0,l=r-1;a<r;l=a++){const[c,h]=t[l],[u,d]=t[a],f=c*d-u*h;i+=f,s+=(c+u)*f,o+=(h+d)*f}return i*=.5,Math.abs(i)<1e-9?t[0]:(s/=6*i,o/=6*i,[s,o])}};I(Ml,"type",Ml.register("ESOlViewer",p.ESGeoPolygonWithFire.type,Ml));let Rg=Ml;class nv extends p.Destroyable{constructor(t,i){super();I(this,"_olGeoCanvasImagePoi");I(this,"flyTo",(t,i)=>{if(this.olGeoCanvasImagePoi.position){Bi(this.olViewer,this.olGeoCanvasImagePoi.position,1e3,Cy,t);return}this.olGeoCanvasImagePoi.flyTo(t&&t*1e3)});this.sceneObject=t,this.olViewer=i,this._olGeoCanvasImagePoi=this.dv(new Ei(i));const s=this._olGeoCanvasImagePoi;s.pickOnClick=!0,this.d(s.pickedEvent.don(o=>{(t.allowPicking??!1)&&t.pickedEvent.emit(o)}));{const o=h=>{let u=h;return h.includes("inner://")&&(u="${earthsdk3-assets-script-dir}/assets/img/points/"+h.split("inner://")[1]),p.ESSceneObject.context.getStrFromEnv(p.rpToap(u))},r=()=>{const h=o(typeof t.url=="string"?t.url:t.url.url);if(s.imageUri=h,t.sizeByContent){const d=new Image;d.src=h,d.onload=()=>{s.size=[d.width,d.height]}}else{const d=t.size;s.size=[...d]}},a=this.disposeVar(p.createNextAnimateFrameEvent(t.urlChanged,t.sizeByContentChanged,t.sizeChanged));this.d(a.don(()=>r())),r(),this.d(p.track([s,"zOrder"],[t,"zOrder"])),this.d(p.track([s,"show"],[t,"show"])),this.d(p.bind([s,"position"],[t,"position"])),this.ad(p.bind([s,"isHoverZoom"],[t,"isHoverZoom"]));{const h=()=>{s.scale=[t.scale[1],t.scale[2]]};h(),this.d(t.scaleChanged.don(h))}const l=()=>{const h=t.anchor,u=t.offset;h?s.originRatioAndOffset=[...h,-u[0],-u[1]]:s.originRatioAndOffset=[0,0,0,0]},c=this.ad(p.createNextAnimateFrameEvent(t.anchorChanged,t.offsetChanged));this.d(c.don(()=>l())),l(),this.d(s.clickEvent.don(h=>{const{offsetX:u,offsetY:d}=h,g={type:h.button===0?"leftClick":h.button===2?"rightClick":void 0,add:{mousePos:[u,d]}};t.widgetEvent.emit(g)})),this.d(s.hoveredChanged.don(h=>{if(h===void 0)return;const u={type:h?"mouseEnter":"mouseLeave"};t.widgetEvent.emit(u)}))}}get olGeoCanvasImagePoi(){return this._olGeoCanvasImagePoi}}const Dl=class Dl extends _g{constructor(t,i){super(t,i);I(this,"_resetting");if(!i.viewer){console.warn("viewer is undefined!");return}const o=this.dv(p.createNextAnimateFrameEvent(this.sceneObject.urlChanged,this.sceneObject.screenRenderChanged,this.sceneObject.sizeByContentChanged,this.sceneObject.sizeChanged));this._resetting=this.dv(new p.ObjResettingWithEvent(o,()=>new nv(this.sceneObject,this.olViewer)))}get resetting(){return this._resetting}flyTo(t,i){const{sceneObject:s,olViewer:o,resetting:r}=this;return o.actived?s.flyToParam||s.flyInParam?super.flyTo(t,i):(r&&r.obj&&r.obj.flyTo(t,i),s.flyOverEvent.emit(i,"over",o),!0):!1}};I(Dl,"type",Dl.register("ESOlViewer",p.ESImageLabel.type,Dl));let Tg=Dl;function iv(n){switch(n){case"wms":return"WebMapServiceImageryProvider";case"tms":return"TileMapServiceImageryProvider";case"wmts":return"WebMapTileServiceImageryProvider";case"xyz":return"UrlTemplateImageryProvider";case"ion":return"IonImageryProvider";case"auto":default:return"auto"}}const Fl=class Fl extends fl{constructor(t,i){super(t,i);I(this,"_olImagery");if(!i.viewer){console.warn("viewer is undefined!");return}const o=this.dv(new yg(i,t.id));this._olImagery=o;const r=this.ad(p.reactJson(""));{const h=()=>{if(typeof t.url=="string")r.value=p.ESSceneObject.context.getStrFromEnv(t.url);else{const u=t.url;u.url=p.ESSceneObject.context.getStrFromEnv(u.url),r.value=u}};h(),this.ad(t.urlChanged.don(h))}const a=()=>{var v,E;if(!r.value)return;const h=(((v=t.options)==null?void 0:v.type)??"auto").toLowerCase(),u=t.options??{};let d={type:"UrlTemplateImageryProvider",url:r.value,rectangle:t.rectangle,maximumLevel:t.maximumLevel,minimumLevel:t.minimumLevel,...u},f=r.value,g=typeof f=="string"?f:f.url;const _=g.toLowerCase();if(iv(h)==="auto")if(_.startsWith("ion://")){const C=+_.substring(6);d={...u,assetId:C,type:"IonImageryProvider"}}else if(_.includes("{x}")||_.includes("{y}")||_.includes("{z}"))d.type="UrlTemplateImageryProvider";else if(_.includes("wmts"))d.type="WebMapTileServiceImageryProvider";else if(_.includes("wms"))d.type="WebMapServiceImageryProvider";else{if(g.includes("/tilemapresource.xml")){const w=g.split("/tilemapresource.xml").join("");typeof f=="string"?f=w:f.url=w,d.url=f}d.type="TileMapServiceImageryProvider"}else{if(h==="tms"&&g.includes("/tilemapresource.xml")){const C=g.split("/tilemapresource.xml").join("");typeof f=="string"?f=C:f.url=C,d.url=f}else if(h==="ion"&&_.startsWith("ion://")){const P=+g.substring(6);d={...u,assetId:P,type:"IonImageryProvider"}}const w=iv(h);w!=="auto"&&(d.type=w)}if(d.type==="WebMapTileServiceImageryProvider"){let w=typeof f=="string"?f:f.url;const C=w.indexOf("?");if(C>=0){const M=new URLSearchParams(w.substring(C+1)),z=M.get("format")||M.get("Format")||d.format;d.format=z||"image/png",w=w.substring(0,C)}else d.format=d.format??"image/png";const P=(E=/\/wmts\/rest\/([^/]+)\//i.exec(w))==null?void 0:E[1];P?d.layer=d.layer??d.layers??P:d.layer=d.layer??d.layers??"";const R=d.tileMatrixSetID||d.TileMatrixSet||"EPSG:4326";let A=d.tileMatrixLabels||d.TileMatrixLabels;(!A||!Array.isArray(A)||A.length===0)&&(A=Array.from({length:22},(M,z)=>`${R}:${z}`)),d.tileMatrixSetID=R,d.tileMatrixLabels=A,d.style=d.style??"default";const O=w.toLowerCase().indexOf("/wmts/");if(O>=0){const M=w.substring(0,O);d.url=`${M}/wmts`;const z=typeof f=="string"?f:f.url,k=/\/wmts\/rest\/([^/]+)\//i.exec(z);k&&k[1]&&(d.layer=k[1]),d._rawUrl=z}else{d.url=w;const M=typeof f=="string"?f:f.url,z=/\/wmts\/rest\/([^/]+)\//i.exec(M);z&&z[1]&&(d.layer=z[1]),d._rawUrl=M}d.requestEncoding="KVP",d.requestencoding="KVP",d.params=void 0}else if(d.type==="WebMapServiceImageryProvider"){const w=d.layer??d.layers??"",C=d.style??"",P=d.format??"image/png";d.params={...d.params??{},LAYERS:w,STYLES:C,FORMAT:P,TILED:!0,TRANSPARENT:!0}}else d.type==="TileMapServiceImageryProvider"?d.yReverse=d.yReverse??!0:d.type==="IonImageryProvider"&&console.warn("[OlESImageryLayer] 在 OL 侧使用 ion:// 可能无效,请在外部将 ion 转换为可用的 xyz/wmts/wms/tms 源 URL。");o.imageryProvider=d};a();const l=[r.changed,t.maximumLevelChanged,t.minimumLevelChanged,t.optionsChanged,t.rectangleChanged],c=this.dv(p.createNextAnimateFrameEvent(...l));this.d(c.don(a)),this.d(p.track([o,"show"],[t,"show"])),this.d(p.track([o,"splitDirection"],[t,"splitDirection"])),this.d(p.track([o,"brightness"],[t,"czmBrightness"])),this.d(p.track([o,"contrast"],[t,"czmContrast"])),this.d(p.track([o,"hue"],[t,"czmHue"])),this.d(p.track([o,"saturation"],[t,"czmSaturation"])),this.d(p.track([o,"gamma"],[t,"czmGamma"])),this.d(p.track([o,"rectangle"],[t,"rectangle"])),this.d(p.track([o,"zIndex"],[t,"zIndex"])),this.d(p.bind([o,"alpha"],[t,"opacity"])),this.d(p.bind([o,"alpha"],[t,"czmAlpha"]))}get olImagery(){return this._olImagery}flyTo(t,i){const{sceneObject:s,olViewer:o,olImagery:r}=this;return o.actived?s.flyToParam||s.flyInParam?super.flyTo(t,i):(r.flyTo(t&&t),s.flyOverEvent.emit(i,"over",o),!0):!1}flyIn(t,i){const{sceneObject:s,olViewer:o,olImagery:r}=this;return o.actived?s.flyInParam?super.flyIn(t,i):(r.flyTo(t&&t),s.flyOverEvent.emit(i,"over",o),!0):!1}};I(Fl,"type",Fl.register("ESOlViewer",p.ESImageryLayer.type,Fl));let Ig=Fl;function sv(n,e=!1){const t=xh(n[0],e),i=xh(n[1],e),s=Q_(n[2]);return[t,i,s]}const kn=class kn extends pl{constructor(t,i){super(t,i);I(this,"_geoCustomDivPoi");I(this,"_textFunc",this.disposeVar(p.react(void 0)));if(!i.viewer){console.warn("viewer is undefined!");return}this._geoCustomDivPoi=this.disposeVar(new kt(i,t.id));const o=this.geoCustomDivPoi;this.dispose(p.track([o,"show"],[t,"show"])),this.dispose(p.bind([o,"position"],[t,"position"])),this.dispose(p.track([o,"allowPicking"],[t,"allowPicking"]));{this.dispose(o.pickedEvent.disposableOn(r=>{(t.allowPicking??p.ESLocationMeasurement.defaults.allowPicking)&&t.pickedEvent.emit(r)})),this.dispose(o.innerHtmlMounted.disposableOn(r=>{const a=r.firstElementChild;a&&(a.style.pointerEvents="auto",a.style.cursor="default",a.onclick=l=>o.pickFromDiv(a,{type:"viewerPicking",pointerEvent:l}))}));{const r=()=>{if(!t.position)return;const l=(this.textFunc??kn.defaultTextFunc_度格式)(t.position);o.innerHTML=Ch(l)};r();const a=this.disposeVar(p.createNextAnimateFrameEvent(t.positionChanged,this.textFuncChanged));this.dispose(a.disposableOn(r))}{const r=()=>{i.lonLatFormat??(i.lonLatFormat="DECIMAL_DEGREE"),this.textFunc=i.lonLatFormat=="DECIMAL_DEGREE"?kn.defaultTextFunc_度格式:i.lonLatFormat=="DEGREES_DECIMAL_MINUTES"?kn.defaultTextFunc_度分格式:kn.defaultTextFunc_度分秒格式};r(),this.d(i.lonLatFormatChanged.don(()=>{r()}))}}}get geoCustomDivPoi(){return this._geoCustomDivPoi}get textFunc(){return this._textFunc.value}set textFunc(t){this._textFunc.value=t}get textFuncChanged(){return this._textFunc.changed}flyTo(t,i){const{sceneObject:s,olViewer:o,geoCustomDivPoi:r}=this;return o.actived?s.flyToParam||s.flyInParam?super.flyTo(t,i):(r.flyTo(t),s.flyOverEvent.emit(i,"over",o),!0):!1}flyIn(t,i){const{sceneObject:s,olViewer:o,geoCustomDivPoi:r}=this;return o.actived?s.flyInParam?super.flyIn(t,i):(r.flyTo(t),s.flyOverEvent.emit(i,"over",o),!0):!1}};I(kn,"type",kn.register("ESOlViewer",p.ESLocationMeasurement.type,kn)),I(kn,"defaultTextFunc_度格式",t=>{if(!t)return"";const[i=0,s=0,o=0]=t;return`经度: ${i.toFixed(5)}°
170
+ 纬度: ${s.toFixed(5)}°`}),I(kn,"defaultTextFunc_度分格式",t=>{if(!t)return"";const[i,s]=sv(t,!0);return`经度: ${i}
171
+ 纬度: ${s}`}),I(kn,"defaultTextFunc_度分秒格式",t=>{if(!t)return"";const[i,s]=sv(t);return`经度: ${i}
172
+ 纬度: ${s}`});let Og=kn;function _l(n,e){const[t,i]=n,[s,o]=e;return Math.sqrt(Math.pow(t-s,2)+Math.pow(i-o,2))}function wl(n,e,t){const[i,s]=n,o=Math.cos(e*Math.PI/180)*t+i,r=Math.sin(e*Math.PI/180)*t+s;return[o,r]}const xu=(n,e=!1)=>{const[[t=0,i=0],[s=0,o=0]]=n;return e?Math.atan2(o-i,s-t)*180/Math.PI:Math.atan2(o-i,s-t)};function DA(n,e,t){let i=1/0,s=0,o=0,r=0;for(let f=0;f<n.length-1;f++){const[g,_]=n[f],[v,E]=n[f+1],[w,C]=e,P=w-g,R=C-_,A=v-g,O=E-_,M=P*A+R*O,z=A*A+O*O;let k=z!==0?M/z:-1,q,Y;k<0?(q=g,Y=_,k=0):k>1?(q=v,Y=E,k=1):(q=g+k*A,Y=_+k*O);const m=Math.sqrt((w-q)*(w-q)+(C-Y)*(C-Y));m<i&&(i=m,s=f,o=k)}for(let f=0;f<s;f++)r+=_l(n[f],n[f+1]);r+=o*_l(n[s],n[s+1]);const a=r+t;let l=0;for(let f=0;f<n.length-1;f++)l+=_l(n[f],n[f+1]);let c=0;if(a<=0){const f=xu([n[0],n[1]],!0);return{point:wl(n[0],f+180,Math.abs(a)),angle:f,isValid:!1}}for(let f=0;f<n.length-1;f++){const g=_l(n[f],n[f+1]);if(c+g>=a){const v=(a-c)/g,[E,w]=n[f],[C,P]=n[f+1],R=[E+v*(C-E),w+v*(P-w)],A=xu([n[f],n[f+1]],!0);return{point:R,angle:A,isValid:!0}}c+=g}const h=n.length-1,u=xu([n[h-1],n[h]],!0),d=a-c;return{point:wl(n[h],u,d),angle:u,isValid:!1}}function ov(n,e,t,i,s){let o=_l(n,e),r=xu([n,e],!0);const a=s-i;if(a>0&&o>a){const[l,c]=wl(n,r,a);return t.push([l,c,r,!0]),ov([l,c],e,t,0,s)}else return o+i}function rv(n,e,t){const i=[];let s=0;s+=Math.max(0,e%t);for(let o=0,r=n.length-1;o<r;o++){const[a,l]=[n[o],n[o+1]];i.push([...a,0,!1]),s=ov(a,l,i,s,t),s=s%t,i.push([...l,0,!1])}return i}const Ll=class Ll extends yl{constructor(t,i){super(t,i);I(this,"animationId",null);I(this,"options",{ARROWS_PER_GROUP:6,ARROW_LINE_COLOR:"white",SPEED_MULTIPLIER:.1,ARROW_LINE_WIDTH_RATIO:.2,ARROW_SPACING_RATIO:.4,ARROW_OFFSET_RATIO:5});I(this,"offset",this.sceneObject.strokeWidth*this.options.ARROW_OFFSET_RATIO*window.devicePixelRatio);I(this,"eventsKey",null);const s=i.viewer;if(!s)return;const o=this.geoPolyline._layer;this.d(()=>this.clear()),this.d(p.createEventsCallFunc([t.materialModeChanged,t.showChanged,t.speedChanged,t.strokedChanged,t.strokeWidthChanged],()=>{if(this.clear(),!(t.show&&t.stroked)||t.materialMode==="pureColor")return;const{SPEED_MULTIPLIER:r}=this.options;this.eventsKey=o.on("postrender",l=>{t.materialMode==="singleArrow"?this._rendererSingleArrows(l):this._rendererArrows(l)});const a=l=>{const c=(t.speed??1)*r,h=Math.max(.1,c);this.offset-=h,this.offset<=0&&(this.offset=this.sceneObject.strokeWidth*this.options.ARROW_OFFSET_RATIO*window.devicePixelRatio),s.render(),this.animationId=requestAnimationFrame(a)};this.animationId=requestAnimationFrame(a)},{immediate:!0}))}clear(){this.animationId&&cancelAnimationFrame(this.animationId),this.animationId=null,this.eventsKey&&ui(this.eventsKey),this.eventsKey=null,this.offset=this.sceneObject.strokeWidth*this.options.ARROW_OFFSET_RATIO*window.devicePixelRatio}_rendererSingleArrows(t){var d;const{ARROW_LINE_WIDTH_RATIO:i,ARROW_OFFSET_RATIO:s,ARROW_LINE_COLOR:o}=this.options,r=f0(t),a=t.target,l=r.transform_,c=r.context_,h=a.getSource(),u=(d=t.frameState)==null?void 0:d.extent;t.frameState&&(t.frameState.animate=!0),!(!h||!u)&&h.forEachFeatureInExtent(u,f=>{const g=f.getGeometry();let _;g instanceof co?_=g.getLineStrings():g instanceof Yn&&(_=[g]),_&&_.forEach(v=>{const E=v.getFlatCoordinates(),w=pi(E,0,E.length,2,l,[]);let C=[];for(let R=0;R<w.length;R+=2){const A=w[R],O=w[R+1];C.push([A,O])}const P=rv(C,this.offset,this.sceneObject.strokeWidth*s*window.devicePixelRatio);c.lineWidth=this.sceneObject.strokeWidth*i*window.devicePixelRatio,c.strokeStyle=o,P.filter(R=>R[3]).forEach(R=>{const[A,O,M]=R,z=wl([A,O],M-180,5),k=this.sceneObject.strokeWidth*.5*window.devicePixelRatio,q=Math.atan2(O-z[1],A-z[0]),Y=A-k*Math.cos(q+45*Math.PI/180),m=O-k*Math.sin(q+45*Math.PI/180),b=A-k*Math.cos(q-45*Math.PI/180),S=O-k*Math.sin(q-45*Math.PI/180);c.beginPath(),c.moveTo(Y,m),c.lineTo(A,O),c.lineTo(b,S),c.stroke()})})})}_rendererArrows(t){var g;const{ARROW_OFFSET_RATIO:i,ARROW_LINE_WIDTH_RATIO:s,ARROW_LINE_COLOR:o,ARROWS_PER_GROUP:r,ARROW_SPACING_RATIO:a}=this.options,l=f0(t),c=t.target,h=l.transform_,u=l.context_,d=c.getSource(),f=(g=t.frameState)==null?void 0:g.extent;t.frameState&&(t.frameState.animate=!0),!(!d||!f)&&d.forEachFeatureInExtent(f,_=>{const v=_.getGeometry();let E;v instanceof co?E=v.getLineStrings():v instanceof Yn&&(E=[v]),E&&E.forEach(w=>{const C=w.getFlatCoordinates(),P=pi(C,0,C.length,2,h,[]);let R=[];for(let O=0;O<P.length;O+=2){const M=P[O],z=P[O+1];R.push([M,z])}const A=rv(R,this.offset,this.sceneObject.strokeWidth*i*window.devicePixelRatio);u.lineWidth=this.sceneObject.strokeWidth*s*window.devicePixelRatio,u.strokeStyle=o,A.filter(O=>O[3]).forEach(O=>{const[M,z,k]=O;for(let q=0;q<r;q++){const Y=(q-(r-1)/2)*this.sceneObject.strokeWidth*a*window.devicePixelRatio,m=DA(R,[M,z],Y);if(!m.isValid)continue;const[b,S]=m.point,L=m.angle,N=wl([b,S],L-180,5),j=this.sceneObject.strokeWidth*.5*window.devicePixelRatio,U=Math.atan2(S-N[1],b-N[0]),B=b-j*Math.cos(U+45*Math.PI/180),Z=S-j*Math.sin(U+45*Math.PI/180),G=b-j*Math.cos(U-45*Math.PI/180),ae=S-j*Math.sin(U-45*Math.PI/180);u.beginPath(),u.moveTo(B,Z),u.lineTo(b,S),u.lineTo(G,ae),u.stroke()}})})})}};I(Ll,"type",Ll.register(Ci.type,p.ESPath.type,Ll));let Ag=Ll;const zl=class zl extends _g{constructor(t,i){super(t,i);I(this,"_olTextLabel");this._olTextLabel=this.disposeVar(new Ns(i,t.id));const s=this._olTextLabel,o=()=>{const a=t.anchor,l=t.offset;a?s.originRatioAndOffset=[...a,-l[0],-l[1]]:s.originRatioAndOffset=[0,0,0,0]},r=this.ad(p.createNextAnimateFrameEvent(t.anchorChanged,t.offsetChanged));this.dispose(r.disposableOn(()=>o())),o(),this.dispose(p.track([s,"zOrder"],[t,"zOrder"])),this.dispose(p.track([s,"show"],[t,"show"])),this.dispose(p.bind([s,"text"],[t,"text"])),this.dispose(p.track([s,"color"],[t,"color"])),this.dispose(p.track([s,"backgroundColor"],[t,"backgroundColor"])),this.dispose(p.bind([s,"textEditingInteraction"],[t,"textEditingInteraction"])),this.dispose(p.bind([s,"textEditing"],[t,"textEditing"])),this.dispose(p.bind([s,"position"],[t,"position"])),this.dispose(p.track([s,"width"],[t,"width"])),this.dispose(p.track([s,"opacity"],[t,"opacity"])),this.dispose(p.track([s,"padding"],[t,"padding"])),this.dispose(p.track([s,"borderRadius"],[t,"borderRadius"])),this.dispose(p.track([s,"borderColor"],[t,"borderColor"])),this.dispose(p.track([s,"borderWidth"],[t,"borderWidth"])),this.dispose(p.track([s,"textAlign"],[t,"textAlign"])),this.dispose(p.track([s,"fontSize"],[t,"fontSize"])),this.dispose(p.track([s,"borderStyle"],[t,"borderStyle"])),this.dispose(p.track([s,"pickOnClick"],[t,"allowPicking"])),this.dispose(p.track([s,"rotate"],[t,"rotate"]));{const a=()=>{s.scale=[t.scale[1],t.scale[2]]};a(),this.dispose(t.scaleChanged.don(a))}{const a=()=>{t.sizeByContent?(s.width=void 0,s.height=void 0):(s.width=t.size[0],s.height=t.size[1])};a(),this.dispose(t.sizeByContentChanged.don(a)),this.dispose(t.sizeChanged.don(a))}this.d(s.pickedEvent.don(a=>{var h;const l=(h=Jf(a,"pickResult"))==null?void 0:h.pointerEvent;if(!l)return;const c={type:l.buttons!=0&&l.button==0?"leftClick":l.button==2?"rightClick":void 0,add:{mousePos:[l.offsetX,l.offsetY]}};c.type==null&&(c.type=l.type),t.widgetEvent.emit(c)}));{let a;const l=c=>{c&&(a=c),a&&(a.style.pointerEvents=t.editing?"none":"all")};this.d(t.editingChanged.don(()=>l(void 0))),this.ad(this._olTextLabel.divCreatedEvent.don(c=>l(c)))}}get olTextLabel(){return this._olTextLabel}};I(zl,"type",zl.register(Ci.type,p.ESTextLabel.type,zl));let Mg=zl;const Nl=class Nl extends fl{constructor(t,i){super(t,i);I(this,"_olImagery");if(!i.viewer){console.warn("[OlESMVTLayer] viewer is undefined!");return}const o=this.ad(new yg(i,t.id));this._olImagery=o;const r=this.ad(p.reactJson(""));{const h=async()=>{if(typeof t.url=="string"){const u=p.ESSceneObject.context.getStrFromEnv(t.url);if(FA(u))try{const d=await fetch(u);if(d.ok){const f=await d.json();r.value=f}else r.value=u}catch{r.value=u}else r.value=u}else{const u=t.url;if(typeof u=="object"&&u!==null){const d=Fg(u,p.ESSceneObject.context.getStrFromEnv);r.value=d}else r.value=u}};h(),this.ad(t.urlChanged.don(h))}const a=()=>{var d;const h=r.value;if(!h)return;const u={type:"MVTImageryProvider",url:h,accessToken:t.accessToken||void 0,tileSize:t.tileSize||512,maximumLevel:t.maximumLevel,minimumLevel:t.minimumLevel,rectangle:t.rectangle,style:(d=t.style)!=null&&d.length?t.style:void 0,scheme:t.scheme||"xyz",...typeof h=="object"&&h!==null?{glyphs:h.glyphs,sprite:h.sprite}:{}};o.imageryProvider=u};a();const l=[r.changed,t.maximumLevelChanged,t.minimumLevelChanged,t.tileSizeChanged,t.rectangleChanged,t.styleChanged,t.schemeChanged,t.accessTokenChanged],c=this.dv(p.createNextAnimateFrameEvent(...l));this.d(c.don(a)),this.d(p.track([o,"show"],[t,"show"])),this.d(p.track([o,"zIndex"],[t,"zIndex"])),this.d(p.track([o,"rectangle"],[t,"rectangle"])),this.d(p.bind([o,"alpha"],[t,"opacity"])),this.d(p.bind([o,"alpha"],[t,"czmAlpha"]))}get olImagery(){return this._olImagery}flyTo(t,i){const{sceneObject:s,olViewer:o,olImagery:r}=this;return o.actived?s.flyToParam||s.flyInParam?super.flyTo(t,i):(r==null||r.flyTo(t&&t),s.flyOverEvent.emit(i,"over",o),!0):!1}flyIn(t,i){const{sceneObject:s,olViewer:o,olImagery:r}=this;return o.actived?s.flyInParam?super.flyIn(t,i):(r==null||r.flyTo(t&&t),s.flyOverEvent.emit(i,"over",o),!0):!1}};I(Nl,"type",Nl.register("ESOlViewer",p.ESMVTLayer.type,Nl));let Dg=Nl;function Fg(n,e){if(typeof n=="string")return e(n);if(Array.isArray(n))return n.map(t=>Fg(t,e));if(n&&typeof n=="object"){const t={};for(const[i,s]of Object.entries(n))i==="url"&&typeof s=="string"?t[i]=e(s):t[i]=Fg(s,e);return t}return n}function FA(n){if(!n)return!1;const e=n.toLowerCase();return!!(e.includes("style.json")||e.endsWith(".json")||!e.includes("{z}")&&!e.includes("{x}")&&!e.includes("{y}"))}const Uo=class Uo extends on{constructor(t){super();I(this,"_config",this.disposeVar(p.react(Uo.defaultConfig)));I(this,"_overEvent",this.disposeVar(new p.Event));I(this,"_pointerEventFilterFunc",this.disposeVar(p.react(Uo.defaultPointerEventFilterFunc)));if(!!t.viewer){{const i=()=>{const{config:s}=this;s.clickEnabled!==void 0&&(this.clickEnabled=s.clickEnabled),s.dblClickEnabled!==void 0&&(this.dblClickEnabled=s.dblClickEnabled)};i(),this.dispose(this.configChanged.disposableOn(i))}{const i=this.ad(new oi(t));i.pixelSize=4,i.outlineColor=[0,0,.8,1],i.outlineWidth=2,i.allowPicking=!1;{const s=()=>{if(!this.position)return;const o=[...this.position];i.position=o,i.show=!!this.position};s(),this.dispose(this.positionChanged.disposableOn(s))}}this.ad(new p.ObjResettingWithEvent(this.enabledChanged,()=>this.enabled?new LA(t,this):void 0))}}get config(){return this._config.value}set config(t){this._config.value=t}get configChanged(){return this._config.changed}get overEvent(){return this._overEvent}over(){this._overEvent.emit()}get pointerEventFilterFunc(){return this._pointerEventFilterFunc.value}set pointerEventFilterFunc(t){this._pointerEventFilterFunc.value=t}get pointerEventFilterFuncChanged(){return this._pointerEventFilterFunc.changed}};I(Uo,"defaultConfig",{clickEnabled:!0,dblClickEnabled:!0}),I(Uo,"defaultPointerEventFilterFunc",t=>t.button===0),I(Uo,"defaults",{...on.defaults,position:[116.39,39.9,0]});let ts=Uo;(n=>{n.createDefaultProps=()=>({...on.createDefaultProps(),position:p.reactArrayWithUndefined(void 0),virtualHeight:void 0,clickEnabled:!0,dblClickEnabled:!1})})(ts||(ts={})),p.extendClassProps(ts.prototype,ts.createDefaultProps);class LA extends p.Destroyable{constructor(t,i){super();I(this,"_doings",[]);I(this,"initDoings",this.ad(()=>{this._doings.forEach(t=>t.destroy()),this._doings.length=0}));this._olViewer=t,this._placeEditing=i;{const s=(o,r)=>{r=="click"&&(!i.clickEnabled||!i.pointerEventFilterFunc(o))||r=="dblclick"&&(!i.dblClickEnabled||!i.pointerEventFilterFunc(o))||(i.over(),i.enabled=!1)};this.ad(t.clickEvent.don(o=>{o.pointerEvent&&s(o.pointerEvent,"click")})),this.ad(t.dblclickEvent.don(o=>{o.pointerEvent&&s(o.pointerEvent,"dblclick")}))}this.ad(t.pointerMoveEvent.don(s=>{if(!s.pointerEvent)return;const o=new zA(this,s.pointerEvent,r=>{const a=[...r];t.editingHeightOffset&&(a[2]+=t.editingHeightOffset),i.position=a,this._doings.splice(0,this._doings.indexOf(o)+1).forEach(c=>c.destroy())});this._doings.push(o)}))}get olViewer(){return this._olViewer.viewer}get placeEditing(){return this._placeEditing}}class zA extends p.Destroyable{constructor(e,t,i){super(),this._owner=e;const{olViewer:s}=this._owner;if(!s)return;const o=Sy(s,t,this._owner.placeEditing.virtualHeight),[r]=p.getEventFromPromise(o);this.dispose(r.disposableOn(i))}}class Cn extends on{constructor(){super()}}I(Cn,"defaults",{...on.defaults,position:[116.39,39.9,0]}),(n=>{n.createDefaultProps=()=>({...on.createDefaultProps(),position:p.reactArrayWithUndefined(void 0)})})(Cn||(Cn={})),p.extendClassProps(Cn.prototype,Cn.createDefaultProps);function av(n,e){const t=new jt(n);return t.hasArrow=!0,t.arcType="RHUMB",t.width=4,t.color=e,t}const os=class os extends p.Destroyable{constructor(e){if(super(),!e.viewer)return;const t=this.disposeVar(av(e,os.defaults.xAxisColor)),i=this.disposeVar(av(e,os.defaults.yAxisColor));{const s=()=>{t.show=this.xAxisShow&&this.show,i.show=this.yAxisShow&&this.show};s();const o=this.ad(p.createNextAnimateFrameEvent(this.showChanged,this.xAxisShowChanged,this.yAxisShowChanged));this.dispose(o.disposableOn(s))}{const s=()=>{var f;const{position:r=os.defaults.position,heading:a=os.defaults.heading}=this,h=((f=e.viewer)==null?void 0:f.getView().getResolution())*65,u=p.geoRhumbDestination(r,h,90+a),d=p.geoRhumbDestination(r,h,0+a);u&&(t.positions=[r,u]),d&&(i.positions=[r,d])};s();const o=this.disposeVar(p.createNextAnimateFrameEvent(this.positionChanged,this.dimensionsChanged,this.headingChanged));this.dispose(o.disposableOn(s))}{const s=()=>{t.color=this.xAxisColor??os.defaults.xAxisColor,i.color=this.yAxisColor??os.defaults.yAxisColor};s();const o=this.disposeVar(p.createNextAnimateFrameEvent(this.xAxisColorChanged,this.yAxisColorChanged));this.dispose(o.disposableOn(s))}}};I(os,"defaults",{position:[116.39,39.9,0],heading:0,dimensions:[1e3,1e3,1e3],xAxisColor:[1,0,0,1],yAxisColor:[0,1,0,1],zAxisColor:[0,0,1,1]});let Bs=os;(n=>{n.createDefaultProps=()=>({show:!0,position:p.reactArrayWithUndefined(void 0),heading:0,dimensions:p.reactArray([1e3,1e3,1e3]),xAxisColor:p.reactArray([1,0,0,1]),yAxisColor:p.reactArray([0,1,0,1]),xAxisShow:!0,yAxisShow:!0})})(Bs||(Bs={})),p.extendClassProps(Bs.prototype,Bs.createDefaultProps);class Ii extends p.Destroyable{constructor(t,i){super();I(this,"_flyToEvent",this.disposeVar(new p.Event));I(this,"_layer");I(this,"_source");const s=t.viewer;if(!s)return;this._source=new _n,this._layer=new Mn({source:this._source}),s.addLayer(this._layer),this.dispose(()=>s.removeLayer(this._layer)),this.dispose(()=>{var a;return(a=this._source)==null?void 0:a.clear(!0)}),this.dispose(()=>{var a;return(a=this._layer)==null?void 0:a.dispose()});const o=()=>{var a;if(this._source&&(this._source.clear(),!!this.positions)){for(const l of this.positions){if(!l||l.length<2)continue;const c=l.map(d=>Me([d[0],d[1]]));this.loop&&c.length>=3&&c.push(c[0]);const h=new Yn(c),u=new Rn({geometry:h});u.setId(p.createGuid()),u.setStyle(new Xe({stroke:new St({color:`rgba(${this.color[0]*255}, ${this.color[1]*255}, ${this.color[2]*255}, ${this.color[3]})`,width:this.width??2,lineDash:this.hasDash?[this.dashLength??16,(this.dashLength??16)/2]:void 0})})),this._source.addFeature(u)}(a=this._layer)==null||a.setVisible(this.show??!0)}};o();const r=this.disposeVar(p.createNextAnimateFrameEvent(this.positionsChanged,this.showChanged,this.colorChanged,this.loopChanged,this.hasDashChanged,this.dashLengthChanged,this.widthChanged));this.dispose(r.disposableOn(o)),this.dispose(this.flyToEvent.disposableOn(a=>{if(!this.positions||this.positions.length===0)return;const l=this.positions.flat();if(l.length===0)return;const c=l[Math.floor(l.length/2)];Bi(t,c)}))}get typeName(){return"OlPolylines"}get defaultProps(){return Ii.createDefaultProps()}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}}(n=>{n.createDefaultProps=()=>({show:!0,positions:p.reactPositionsSet(void 0),width:2,color:p.reactArray([1,1,1,1]),loop:!1,hasDash:!1,dashLength:16,arcType:"GEODESIC",topOrBottom:"none"})})(Ii||(Ii={})),p.extendClassProps(Ii.prototype,Ii.createDefaultProps);const Hs=class Hs extends Cn{constructor(t){super();I(this,"_opInfo",{step:this.ad(p.react(!1)),moved:this.ad(p.react(!1)),constraintMode:this.ad(p.react("none")),originPosition:this.disposeVar(p.reactArray(Cn.defaults.position)),originHeading:this.disposeVar(p.react(0)),originDimensions:this.disposeVar(p.reactArray([1,1,1])),draggingStartPosition:this.disposeVar(p.reactArray([0,0,0])),movingPosition:this.disposeVar(p.reactArray([0,0,0])),targetPosition:this.disposeVar(p.reactArray([0,0,0])),targetHeading:this.disposeVar(p.react(0))});I(this,"_createCoordinates",t=>{const i=this.ad(new Bs(t));this.dispose(this._opInfo.step.changed.disposableOn(()=>{lv(i,this._opInfo.constraintMode.value,this._opInfo.step.value)}));{const s=()=>{const r=[...this.position??Hs.defaults.position];i.position=r};s(),this.dispose(this.positionChanged.disposableOn(s))}{const s=()=>{i.heading=this.heading??0};s(),this.dispose(this.headingChanged.disposableOn(s))}{const s=()=>{i.dimensions=this._opInfo.originDimensions.value};s(),this.dispose(this._opInfo.originDimensions.changed.disposableOn(s))}return i});I(this,"_createOriginCoordinates",t=>{const i=this.ad(new Bs(t));i.xAxisColor=[1,0,0,.5],i.yAxisColor=[0,1,0,.5];const{originPosition:s,originHeading:o,originDimensions:r}=this._opInfo;{const a=()=>{i.position=s.value};a(),this.dispose(s.changed.disposableOn(a))}{const a=()=>{i.heading=o.value??0};a(),this.dispose(o.changed.disposableOn(a))}{const a=()=>{i.dimensions=r.value};a(),this.dispose(r.changed.disposableOn(a))}return i});I(this,"_createGrid",t=>{const i=this.ad(new Ii(t));{const s=()=>{var d;const r=this._opInfo.originPosition.value,a=this._opInfo.originHeading.value,c=((d=t.viewer)==null?void 0:d.getView().getResolution())*15,h=c*5,u=[];for(let f=-4;f<5;++f){const g=p.geoRhumbDestination(r,f*c,a+90);if(g){const _=p.geoRhumbDestination(g,h,a+180),v=p.geoRhumbDestination(g,h,a);_&&v&&u.push([_,g,v])}}for(let f=-4;f<5;++f){const g=p.geoRhumbDestination(r,f*c,a);if(g){const _=p.geoRhumbDestination(g,h,a-90),v=p.geoRhumbDestination(g,h,a+90);_&&v&&u.push([_,g,v])}}i.positions=u};s();const o=this.disposeVar(p.createNextAnimateFrameEvent(this._opInfo.originPosition.changed,this._opInfo.originHeading.changed,this._opInfo.originDimensions.changed));this.dispose(o.disposableOn(s))}return i});I(this,"_createHelpLine",t=>{const i=this.ad(new jt(t));i.hasDash=!0,i.arcType="RHUMB",i.color=[1,1,0,.99];{const s=()=>{i.positions=[this._opInfo.originPosition.value,this._opInfo.targetPosition.value]},o=this.ad(p.createNextAnimateFrameEvent(this._opInfo.originPosition.changed,this._opInfo.targetPosition.changed));this.ad(o.don(s))}return i});I(this,"_createCircle",t=>{const i=this.ad(new Ii(t));i.arcType="RHUMB",i.width=2,i.hasDash=!0,i.loop=!1,i.color=[1,1,0,1],i.show=!0;const s=this.disposeVar(p.createNextAnimateFrameEvent(this._opInfo.originPosition.changed,this._opInfo.originDimensions.changed)),o=()=>{var u;const r=this._opInfo.originPosition.value,l=((u=t.viewer)==null?void 0:u.getView().getResolution())*70,c=[],h=32;for(let d=0;d<=h;++d){const f=d*360/h,g=p.geoRhumbDestination(r,l,f);g&&c.push(g)}c.length>0&&c.push(c[0]),i.positions=[c]};return o(),this.dispose(s.disposableOn(o)),i});I(this,"_pickingXYProcessing",t=>this.ad(new p.Processing((i,s,o)=>{const r=[0,0,0];return t.pointerMoveEvent.don(a=>{if(!a.pointerEvent||!t.viewer)return;const l=t.viewer.getEventPixel(a.pointerEvent);if(!l)return;const c=t.viewer.getCoordinateFromPixel(l);if(!c)return;const h=Ft(c);if(r[0]=h[0],r[1]=h[1],r[2]=this._opInfo.originPosition.value[2],this._opInfo.constraintMode.value==="x")Is(this._opInfo.originPosition.value,this._opInfo.originHeading.value+90,r,r);else if(this._opInfo.constraintMode.value==="y")Is(this._opInfo.originPosition.value,this._opInfo.originHeading.value,r,r);else if(this._opInfo.constraintMode.value!=="xy"){console.warn("should not be here!");return}this._opInfo.movingPosition.value=r;const u=[0,0,0];p.geoRhumbDestination(r,o,s,u),this._opInfo.targetPosition.value=u})})));if(!t.viewer)return;const i=this.ad(p.reactArray([1,1,1]));this.ad(t.dblclickEvent.don(()=>this.enabled=!1)),this.ad(new Oy(t.viewer,this.positionReact,i,this.axisPixelSize));{this.ad(this._opInfo.targetPosition.changed.don(o=>{if(this._opInfo.moved){const r=[...o];this.position=r}})),this.ad(this._opInfo.targetHeading.changed.don(o=>this._opInfo.moved&&(this.heading=o)));const s=()=>{if(this._opInfo.constraintMode.value==="none"){this._opInfo.moved.value=!1;return}if(this._opInfo.originHeading.value!==this._opInfo.targetHeading.value){this._opInfo.moved.value=!0;return}if(!this._opInfo.originPosition.value.every((o,r)=>o===this._opInfo.targetPosition.value[r])){this._opInfo.moved.value=!0;return}};s(),this.dispose(this._opInfo.originHeading.changed.disposableOn(s)),this.dispose(this._opInfo.originPosition.changed.disposableOn(s)),this.dispose(this._opInfo.targetHeading.changed.disposableOn(s)),this.dispose(this._opInfo.targetPosition.changed.disposableOn(s))}{const s=this._createCoordinates(t),o=this._createOriginCoordinates(t),r=this._createGrid(t),a=this._createHelpLine(t),l=this._createCircle(t);{const d=()=>{l.show=r.show=this.enabled&&this.showCircle,a.show=this.enabled&&this.showCircle&&this._opInfo.moved.value,s.show=this.enabled&&this.showCoordinates,o.show=this.enabled&&this.showCoordinates&&this._opInfo.moved.value};d();const f=this.ad(p.createNextAnimateFrameEvent(this.enabledChanged,this.showCircleChanged,this.showCoordinatesChanged,this._opInfo.moved.changed));this.ad(f.don(d))}{const d=()=>{s.xAxisShow=o.xAxisShow=this.xAxisShow,s.yAxisShow=o.yAxisShow=this.yAxisShow};d();const f=this.ad(p.createNextAnimateFrameEvent(this.xAxisShowChanged,this.yAxisShowChanged));this.ad(f.don(d))}{const d=()=>{r.color=this._opInfo.constraintMode.value!=="none"?[1,1,0,.6]:[1,1,0,.3],lv(s,this._opInfo.constraintMode.value,this._opInfo.step.value)};d(),this.dispose(this._opInfo.constraintMode.changed.disposableOn(d))}const c=this._pickingXYProcessing(t),h=this.ad(p.createProcessingFromAsyncFunc(async d=>{do this._opInfo.step.value=!0,this._opInfo.constraintMode.value="none",d.disposer.dispose(()=>{this._opInfo.constraintMode.value="none"}),await p.step(d,async f=>{const g=()=>{const C=[...this.position??Hs.defaults.position];this._opInfo.targetPosition.value=this._opInfo.originPosition.value=C},_=()=>this._opInfo.targetHeading.value=this._opInfo.originHeading.value=this.heading,v=()=>this._opInfo.originDimensions.value=i.value;f.disposer.dispose((g(),this.positionChanged.don(g))),f.disposer.dispose((_(),this.headingChanged.don(_))),f.disposer.dispose((v(),i.changed.don(v)));const E={constraintMode:"none",startDragPos:[0,0,0]},w=C=>{const P={position:s.position??Hs.defaults.position,heading:s.heading??Hs.defaults.heading,dimensions:s.dimensions??Hs.defaults.dimensions};t.viewer&&Ry(C,t.viewer,P,this.axisSnapPixelSize,E,{x:this.disableX,y:this.disableY,xy:this.disableXY}),this._opInfo.constraintMode.value=E.constraintMode,this._opInfo.movingPosition.value=this._opInfo.draggingStartPosition.value=E.startDragPos};f.disposer.dispose(t.pointerMoveEvent.don(C=>{C.pointerEvent&&w(C.pointerEvent)})),await p.step(f,C=>new Promise((P,R)=>{C.disposer.dispose(R),C.disposer.dispose(t.pointerDownEvent.don(A=>{A.pointerEvent&&w(A.pointerEvent),A.pointerEvent&&A.pointerEvent.button===0&&E.constraintMode!=="none"&&P()}))}))}),this._opInfo.step.value=!1,await p.step(d,async f=>{if(t.incrementDisabledInputStack(),console.log("检查地图交互编辑模式",t.disabledInputStack),f.disposer.dispose(()=>{t.decrementDisabledInputStack()}),["xy","x","y"].includes(this._opInfo.constraintMode.value)){const g=p.geoRhumbHeading(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value),_=p.geoRhumbDistance(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value);c.restart(void 0,g,_),f.disposer.dispose(()=>c.cancel())}else console.warn(`pickingInfo.constraintMode error! ${this._opInfo.constraintMode.value}`);await p.step(f,g=>new Promise((_,v)=>{g.disposer.dispose(v),g.disposer.dispose(t.pointerUpEvent.don(()=>{_()})),g.disposer.dispose(t.pointerOutEvent.don(()=>_()))}))});while(!0)})),u=()=>{this.enabled?h.restart():h.isRunning&&h.cancel()};u(),this.ad(this.enabledChanged.don(u))}}};I(Hs,"defaults",{...Cn.defaults,heading:0,dimensions:[200,200,200],xAxisColor:[1,0,0,1],yAxisColor:[0,1,0,1]});let ns=Hs;(n=>{n.createDefaultProps=()=>({...Cn.createDefaultProps(),heading:0,axisPixelSize:100,axisSnapPixelSize:100,showCoordinates:!0,showCircle:!0,disableX:!1,disableY:!1,disableZ:!1,disableXY:!1,disableZAxis:!1,xAxisShow:!0,yAxisShow:!0})})(ns||(ns={})),p.extendClassProps(ns.prototype,ns.createDefaultProps);function lv(n,e,t){n.xAxisColor=[1,0,0,.99],n.yAxisColor=[0,1,0,.99],e==="x"?n.xAxisColor=t?[1,1,0,.8]:[1,1,0,.99]:e==="y"?n.yAxisColor=t?[1,1,0,.8]:[1,1,0,.99]:e==="xy"&&(n.xAxisColor=t?[1,1,0,.8]:[1,1,0,.99],n.yAxisColor=t?[1,1,0,.8]:[1,1,0,.99])}class Wr extends p.Destroyable{constructor(t){super();I(this,"_vectorLayer");I(this,"_feature");I(this,"_circleCanvas");I(this,"_debugFeature");t.viewer&&(this._createCircleCanvas(),this._createVectorLayer(t),this._createDebugFeature(t))}get vectorLayer(){return this._vectorLayer}get feature(){return this._feature}get circleCanvas(){return this._circleCanvas}get debugFeature(){return this._debugFeature}_createCircleCanvas(){this._circleCanvas=document.createElement("canvas"),this._circleCanvas.width=256,this._circleCanvas.height=256;const t=()=>{var h,u,d;const s=(h=this._circleCanvas)==null?void 0:h.getContext("2d");if(!s)return;const o=this.color,r=`rgba(${o[0]*255|0}, ${o[1]*255|0}, ${o[2]*255|0}, ${o[3]})`;s.clearRect(0,0,256,256),s.lineWidth=6,s.beginPath(),s.arc(128,128,64,0,Math.PI*2,!1),s.strokeStyle=`rgba(0,0,0,${o[3]})`,s.stroke(),s.lineWidth=4,s.beginPath(),s.arc(128,128,64,0,Math.PI*2,!1),s.strokeStyle=r,s.stroke();let a=this.circleRotation*Math.PI/180;a=Math.atan2(Math.sin(a),Math.cos(a));const l=a<0;s.lineWidth=3,s.beginPath(),s.moveTo(128,128),s.arc(128,128,64,0,a,l),s.lineTo(128,128),s.fillStyle=`rgba(${o[0]*255|0}, ${o[1]*255|0}, ${o[2]*255|0}, 0.5)`,s.fill(),s.save(),s.font="16px console",s.textBaseline="middle",s.textAlign="center";const c=`${this.circleRotation.toFixed(1)}°`;s.translate(128,128),s.rotate(Math.PI*.5),s.rotate(a*.5),s.translate(-128,-128),s.fillStyle="white",s.fillText(c,128,54),s.restore(),(d=(u=this._feature)==null?void 0:u.changed)==null||d.call(u)};t();const i=this.ad(p.createNextAnimateFrameEvent(this.colorChanged,this.circleRotationChanged,this.circleStartRotationChanged,this.circleEndRotationChanged));this.ad(i.don(t))}_createVectorLayer(t){var o;const i=new _n;this._feature=new Rn({geometry:new yn([0,0])});const s=()=>this._circleCanvas?new Xe({image:new Es({img:this._circleCanvas,width:256,height:256,anchor:[.5,.5],anchorXUnits:"fraction",anchorYUnits:"fraction",scale:(this.pixelSize??300)/256}),text:new nr({text:"",font:"0px console"})}):new Xe;this._feature.setStyle(s),i.addFeature(this._feature),this._vectorLayer=new Mn({source:i,zIndex:1e3});{const r=()=>{if(!this.position||!this._feature)return;const a=Me([this.position[0],this.position[1]]),l=this._feature.getGeometry();l==null||l.setCoordinates(a)};r(),this.dispose(this.positionChanged.disposableOn(r))}{const r=()=>{this._vectorLayer&&this._vectorLayer.setVisible(this.show)};r(),this.dispose(this.showChanged.disposableOn(r))}{const r=()=>{this._feature&&this._feature.setStyle(s)};r(),this.dispose(this.colorChanged.disposableOn(r)),this.dispose(this.circleRotationChanged.disposableOn(r)),this.dispose(this.pixelSizeChanged.disposableOn(r))}(o=t.viewer)==null||o.addLayer(this._vectorLayer),this.d(()=>{var r;return(r=t.viewer)==null?void 0:r.removeLayer(this._vectorLayer)})}_createDebugFeature(t){var o;const i=new _n;this._debugFeature=new Rn({geometry:new yn([0,0])}),this._debugFeature.setStyle(new Xe({image:new An({radius:5,fill:new wt({color:"red"})})})),i.addFeature(this._debugFeature);const s=new Mn({source:i,zIndex:1001});{const r=()=>{s.setVisible(this.debug)};r(),this.dispose(this.debugChanged.disposableOn(r))}{const r=()=>{if(!this.position||!this._debugFeature)return;const a=Me([this.position[0],this.position[1]]),l=this._debugFeature.getGeometry();l==null||l.setCoordinates(a)};r(),this.dispose(this.positionChanged.disposableOn(r))}(o=t.viewer)==null||o.addLayer(s),this.d(()=>{var r;return(r=t.viewer)==null?void 0:r.removeLayer(s)})}}I(Wr,"defaults",{position:[116.39,39.9,0]}),(n=>{n.createDefaultProps=()=>({show:!0,allowPicking:!1,editing:!1,position:p.reactArrayWithUndefined(void 0),rotation:p.reactArray([0,0,0]),selfRotation:p.reactArray([0,0,0]),pixelSize:300,color:p.reactArray([1,1,1,1]),circleRotation:0,circleStartRotation:0,circleEndRotation:0,debug:!1})})(Wr||(Wr={})),p.extendClassProps(Wr.prototype,Wr.createDefaultProps);function cv(n,e){const i=n.getViewport().getBoundingClientRect();return[e.clientX-i.left,e.clientY-i.top]}class NA extends p.HasOwner{constructor(e){super(e);const{olViewer:t}=this.owner;let i;this.dispose(()=>this.owner.hoveredPlaneType="none");const s=this._createRotatorMoveProcessing();this.dispose(t.pointerMoveEvent.disposableOn(o=>{const r=i=this._getStartInfo(o.pointerEvent);this.owner.hoveredPlaneType=(r==null?void 0:r.currentPlaneType)??"none"})),this.dispose(t.pointerDownEvent.disposableOn(o=>{i&&i.currentPlaneType!=="none"&&(s.restart(void 0,t,i),i=void 0)})),this.dispose(t.dblclickEvent.disposableOn(o=>{const r=this._getStartInfo(o.pointerEvent);r&&r.currentPlaneType!=="none"||(this.owner.enabled=!1)}))}_createRotatorMoveProcessing(){return this.ad(p.createProcessingFromAsyncFunc(async(e,t,i)=>{const s=this.owner.circle;t.incrementDisabledInputStack(),e.disposer.dispose(()=>t.decrementDisabledInputStack()),this.owner.movingPlaneType=i.currentPlaneType,e.disposer.dispose(()=>{this.owner.movingPlaneType="none"});const o=i.pointerId;e.disposer.dispose(t.pointerMoveEvent.don(l=>{if(!i||!l.pointerEvent)return;const c=t.viewer,h=[];c.getInteractions().forEach(C=>{var R,A,O;const P=(R=C==null?void 0:C.constructor)==null?void 0:R.name;(P==="DragPan"||P==="MouseWheelZoom"||P==="DoubleClickZoom"||P==="PinchZoom"||P==="DragRotate"||P==="PinchRotate")&&(h.push([C,((A=C.getActive)==null?void 0:A.call(C))??!0]),(O=C.setActive)==null||O.call(C,!1))}),e.disposer.dispose(()=>h.forEach(([C,P])=>{var R;return(R=C.setActive)==null?void 0:R.call(C,P)}));let u=i.startAngle,d=0;const f=l.pointerEvent,g=cv(t.viewer,f);if(i.currentPlaneType==="none")return;const _=this._calculateAngle(g);if(_===null)return;let v=_-u;v>180&&(v-=360),v<-180&&(v+=360),d+=v,u=_;let E=i.startRotation+d;E>360&&(E=360),E<-360&&(E=-360),this.owner.previewRotation=E;const w=this.owner.circle;w.circleStartRotation=0,w.circleEndRotation=0})),e.disposer.dispose(()=>{s.circleStartRotation=0,s.circleEndRotation=0}),await p.step(e,l=>new Promise((c,h)=>{l.disposer.dispose(h),l.disposer.dispose(t.pointerUpEvent.don(u=>{u.pointerEvent.pointerId===o&&c()})),l.disposer.dispose(t.pointerOutEvent.don(u=>{u.pointerEvent.pointerId===o&&c()}))}));const[,r,a]=this.owner.selfRotation;this.owner.selfRotation=[this.owner.previewRotation,r,a]}))}_calculateAngle(e){const{olViewer:t}=this.owner,i=t.viewer;if(!i||!this.owner.position)return null;const s=Me([this.owner.position[0],this.owner.position[1]]),o=i.getPixelFromCoordinate(s);if(!o)return null;const r=e[0]-o[0],a=e[1]-o[1],l=Math.sqrt(r*r+a*a),c=this.owner.pixelSize/4;if(l<c*.8||l>c*1.2)return null;let h=Math.atan2(a,r);return h=(h*180/Math.PI+360)%360,h}_getStartInfo(e){const{olViewer:t}=this.owner;if(!this.owner.position)return;const i=cv(this.owner.olViewer.viewer,e),s=e.pointerId,o=this._calculateAngle(i);return{currentPlaneType:o!==null?"heading":"none",startRotation:this.owner.selfRotation[0],startAngle:o||0,pointerId:s}}}class $s extends Cn{constructor(t){super();I(this,"_hoveredPlaneType",this.disposeVar(p.react("none")));I(this,"_movingPlaneType",this.disposeVar(p.react("none")));I(this,"_previewRotation",this.disposeVar(p.react(0)));I(this,"_circle");I(this,"_rotatorRunningResetting");this._olViewer=t;const i=this._olViewer;this._rotatorRunningResetting=this.disposeVar(new p.ObjResettingWithEvent(this.enabledChanged,()=>{if(this.enabled)return new NA(this)})),this._circle=this._createRotatorCircle(i);const s=()=>{var o;this.previewRotation=((o=this.selfRotation)==null?void 0:o[0])??0};s(),this.dispose(this.selfRotationChanged.disposableOn(s)),this.dispose(this.enabledChanged.disposableOn(o=>{o&&s()}));{const o=()=>{this.circle.show=this.enabled};o(),this.dispose(this.enabledChanged.disposableOn(o))}}get hoveredPlaneType(){return this._hoveredPlaneType.value}set hoveredPlaneType(t){this._hoveredPlaneType.value=t}get hoveredPlaneTypeChanged(){return this._hoveredPlaneType.changed}get movingPlaneType(){return this._movingPlaneType.value}set movingPlaneType(t){this._movingPlaneType.value=t}get movingPlaneTypeChanged(){return this._movingPlaneType.changed}get previewRotation(){return this._previewRotation.value}set previewRotation(t){this._previewRotation.value=t}get previewRotationChanged(){return this._previewRotation.changed}get circle(){return this._circle}get olViewer(){return this._olViewer}get rotatorRunningResetting(){return this._rotatorRunningResetting}_createRotatorCircle(t){const i=this.ad(new Wr(t));this.dispose(p.track([i,"position"],[this,"position"])),this.dispose(p.track([i,"pixelSize"],[this,"pixelSize"])),this.dispose(p.track([i,"debug"],[this,"debug"]));{const s=()=>{i.circleRotation=this.previewRotation};s(),this.dispose(this.previewRotationChanged.disposableOn(s))}{const s=()=>{const o=this.movingPlaneType==="heading",r=this.hoveredPlaneType==="heading",l=[0,0,1,o||r?1:.8];i.color=l};s(),this.dispose(this.movingPlaneTypeChanged.disposableOn(s)),this.dispose(this.hoveredPlaneTypeChanged.disposableOn(s))}return i}}I($s,"rotationNum",{heading:0}),I($s,"rotationFuncs",{heading:([t,i,s])=>[0,i,s]}),(n=>{n.createDefaultProps=()=>({...Cn.createDefaultProps(),rotation:p.reactArray([0,0,0]),selfRotation:p.reactArray([0,0,0]),pixelSize:300,showHelper:!1,debug:!1})})($s||($s={})),p.extendClassProps($s.prototype,$s.createDefaultProps);const Go=class Go extends p.Destroyable{get startPosition(){return this.positions&&this.positions[0]}set startPosition(e){this.positions=[e??Go.defaults.positions[0],this.stopPosition??Go.defaults.positions[1]]}get startPositionChanged(){return this.positionsChanged}get stopPosition(){return this.positions&&this.positions[1]}set stopPosition(e){this.positions=[this.startPosition??Go.defaults.positions[0],e??Go.defaults.positions[1]]}get stopPositionChanged(){return this.positionsChanged}constructor(e,t){if(super(),!e.viewer)return;const s=this.ad(new jt(e,t));s.arcType="RHUMB";const o=this.ad(new oi(e,t));this.ad(p.track([s,"allowPicking"],[this,"allowPicking"])),this.ad(p.track([o,"allowPicking"],[this,"allowPicking"]));{const r=()=>{s.show=o.show=this.show};r(),this.ad(this.showChanged.don(r))}{const r=()=>{s.width=this.width/2,o.pixelSize=this.width};r(),this.ad(this.widthChanged.don(r))}{const r=()=>{s.color=o.color=this.color};r(),this.ad(this.colorChanged.don(r))}{const r=()=>{s.positions=this.positions,o.position=this.stopPosition};r(),this.dispose(this.startPositionChanged.disposableOn(r)),this.dispose(this.stopPositionChanged.disposableOn(r))}}};I(Go,"defaults",{positions:[[0,0,0],[0,0,1e6]]});let Lo=Go;(n=>{n.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:p.reactPositions(n.defaults.positions),width:10,color:p.reactArray([1,0,0,1])})})(Lo||(Lo={})),p.extendClassProps(Lo.prototype,Lo.createDefaultProps);class is extends Cn{constructor(t){super();I(this,"_lastPosition");I(this,"_opInfo",{step:this.ad(p.react(!1)),moved:this.ad(p.react(!1)),constraintMode:this.disposeVar(p.react("none")),originPosition:this.disposeVar(p.reactArray([0,0,0])),originHeading:this.disposeVar(p.react(0)),originDimensions:this.disposeVar(p.reactArray([1,1,1])),draggingStartPosition:this.disposeVar(p.reactArray([0,0,0])),movingPosition:this.disposeVar(p.reactArray([0,0,0])),targetPosition:this.disposeVar(p.reactArray([0,0,0])),targetHeading:this.disposeVar(p.react(0))});I(this,"_scaleAxis");I(this,"_pickingXYProcessing",t=>this.disposeVar(new p.Processing((i,s,o)=>{const r=[0,0,0];return t.pointerMoveEvent.disposableOn(a=>{if(!a.pointerEvent||!t.viewer)return;const l=t.viewer.getEventPixel(a.pointerEvent),c=t.viewer.getCoordinateFromPixel(l);if(!c)return;const[h,u]=Ft(c);r[0]=h,r[1]=u,r[2]=0,this._opInfo.constraintMode.value==="x"?Is(this._opInfo.originPosition.value,this._opInfo.originHeading.value+90,r,r):this._opInfo.constraintMode.value==="y"?Is(this._opInfo.originPosition.value,this._opInfo.originHeading.value,r,r):this._opInfo.constraintMode.value==="xy"||console.warn("should not be here!"),this._opInfo.movingPosition.value=r,this._lastPosition||(this._lastPosition=[...this._opInfo.draggingStartPosition.value]);const d=[0,0,0];if(p.geoRhumbDestination(r,o,s,d),this._opInfo.targetPosition.value=d,!this._axisPixelInfo)return;const f=this._axisPixelInfo,g=t.viewer.getEventPixel(a.pointerEvent),_=f.len*f.len,v=((g[0]-f.a[0])*f.v[0]+(g[1]-f.a[1])*f.v[1])/_,E=Math.max(-2,Math.min(2,v)),w=E===0?0:E>0?1:-1;let C=0;w===0?C=0:w===f.sideStart||f.sideStart===0?C=Math.max(0,Math.abs(E)-Math.abs(f.tStart)):C=Math.abs(E);const P=(E>=0?1:-1)*C,R=this.scaleSensitivity??.6,A=Math.max(.1,1+R*P),[O,M,z]=f.baseScale;let k=O,q=M;f.mode==="y"?k=Math.max(.01,O*A):f.mode==="x"&&(q=Math.max(.01,M*A)),this.scale=[k,q,z??0]})})));I(this,"_axisPixelInfo");console.log("here ScaleEditing constructor",t.viewer);const i=t.viewer;if(i){this.ad(new Y_(t,this.positionReact,this._opInfo.originDimensions,this.axisPixelSize)),this.ad(t.dblclickEvent.don(()=>{this.enabled=!1})),this._scaleAxis={yAxis:this._createScaleAxis(t,"yAxis"),xAxis:this._createScaleAxis(t,"xAxis")};{const s=()=>{if(!this._scaleAxis)return;const{yAxis:o,xAxis:r}=this._scaleAxis,a=this._opInfo.constraintMode.value,l=this._opInfo.step.value;o.color=[0,1,0,.99],r.color=[1,0,0,.99],a==="x"?r.color=l?[1,1,0,.8]:[1,1,0,.99]:a==="y"&&(o.color=l?[1,1,0,.8]:[1,1,0,.99])};s(),this.dispose(this._opInfo.constraintMode.changed.disposableOn(s)),this.dispose(this._opInfo.step.changed.disposableOn(s))}{const s=()=>{if(!this._scaleAxis)return;const{position:r=is.defaults.position}=this;console.log("ScaleEditing.defaults.position",r);const{yAxis:a,xAxis:l}=this._scaleAxis;l.startPosition=a.startPosition=r;const c=p.geoRhumbDestination(r,this._opInfo.originDimensions.value[0],90);c&&(l.stopPosition=c);const h=p.geoRhumbDestination(r,this._opInfo.originDimensions.value[1],0);h&&(a.stopPosition=h)};s();const o=this.ad(p.createNextAnimateFrameEvent(this.positionChanged,this._opInfo.originDimensions.changed));this.ad(o.don(s))}{const s=()=>{if(this._opInfo.constraintMode.value==="none"){this._opInfo.moved.value=!1;return}if(this._opInfo.originHeading.value!==this._opInfo.targetHeading.value){this._opInfo.moved.value=!0;return}if(!this._opInfo.originPosition.value.every((o,r)=>o===this._opInfo.targetPosition.value[r])){this._opInfo.moved.value=!0;return}};s(),this.dispose(this._opInfo.originHeading.changed.disposableOn(s)),this.dispose(this._opInfo.originPosition.changed.disposableOn(s)),this.dispose(this._opInfo.targetHeading.changed.disposableOn(s)),this.dispose(this._opInfo.targetPosition.changed.disposableOn(s))}{const s=this._pickingXYProcessing(t),o=()=>{const h=[...this.position??is.defaults.position];t.editingHeightOffset&&(h[2]-=t.editingHeightOffset),this._opInfo.targetPosition.value=this._opInfo.originPosition.value=h},r={constraintMode:"none",startDragPos:[0,0,0]},a=h=>{if(!this.position||!this._scaleAxis)return;const u={position:this.position,dimensions:this._opInfo.originDimensions.value,heading:this._opInfo.originHeading.value||0};Iy(i,h,u,this.axisSnapPixelSize,r);const d=i.getView().getProjection(),f=i.getEventPixel(h),g=z=>i.getPixelFromCoordinate(Me([z[0],z[1]],d)),{xAxis:_,yAxis:v}=this._scaleAxis,E=g(_.startPosition),w=g(_.stopPosition),C=g(v.startPosition),P=g(v.stopPosition),R=hv(f,E,w),A=hv(f,C,P),O=this.axisSnapPixelSize??10;let M="none";if((R.dist<=O||A.dist<=O)&&(M=R.dist<=A.dist?"x":"y"),this._opInfo.constraintMode.value=M,r.constraintMode=M,M==="x"||M==="y"){const z=i.getCoordinateFromPixel(f);if(z){const[k,q]=Ft(z),Y=[k,q,this._opInfo.originPosition.value[2]??0];M==="x"?Is(this._opInfo.originPosition.value,this._opInfo.originHeading.value+90,Y,Y):Is(this._opInfo.originPosition.value,this._opInfo.originHeading.value,Y,Y),r.startDragPos=Y,this._opInfo.movingPosition.value=this._opInfo.draggingStartPosition.value=Y}}else r.startDragPos=[0,0,0],this._opInfo.movingPosition.value=this._opInfo.draggingStartPosition.value=[0,0,0]},l=this.disposeVar(p.createProcessingFromAsyncFunc(async h=>{this._opInfo.step.value=!0,this._opInfo.constraintMode.value="none",h.disposer.dispose(()=>{this._opInfo.constraintMode.value="none"}),await p.step(h,async u=>{u.disposer.dispose((o(),this.positionChanged.disposableOn(o))),u.disposer.dispose(t.pointerMoveEvent.disposableOn(d=>{d.pointerEvent&&a(d.pointerEvent)})),await p.step(u,d=>new Promise((f,g)=>{d.disposer.dispose(g),d.disposer.dispose(t.pointerDownEvent.don(_=>{if(_.pointerEvent&&a(_.pointerEvent),_.pointerEvent&&_.pointerEvent.button===0&&this._opInfo.constraintMode.value!=="none"){{const v=r.constraintMode==="x"?"x":"y",{xAxis:E,yAxis:w}=this._scaleAxis,C=v==="x"?E:w,P=i.getView().getProjection(),R=b=>i.getPixelFromCoordinate(Me([b[0],b[1]],P)),A=R(C.startPosition),O=R(C.stopPosition),M=[O[0]-A[0],O[1]-A[1]],z=Math.hypot(M[0],M[1])||1,k=i.getEventPixel(_.pointerEvent),q=((k[0]-A[0])*M[0]+(k[1]-A[1])*M[1])/(z*z),Y=Math.max(-1,Math.min(1,q)),m=Y===0?0:Y>0?1:-1;this._axisPixelInfo={a:A,v:M,len:z,tStart:Y,sideStart:m,mode:v,baseScale:[this.scale[0]??1,this.scale[1]??1,this.scale[2]??0]}}f()}}))}))}),this._opInfo.step.value=!1,await p.step(h,async u=>{if(t.incrementDisabledInputStack(),u.disposer.dispose(()=>t.decrementDisabledInputStack()),this.dispose(this.enabledChanged.disposableOn(d=>{if(!d&&t.disabledInputStack>0)for(;t.disabledInputStack>0;)t.decrementDisabledInputStack()})),["x","y"].includes(this._opInfo.constraintMode.value)){const d=p.geoRhumbHeading(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value),f=p.geoRhumbDistance(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value);s.restart(void 0,d,f),u.disposer.dispose(()=>s.cancel())}await p.step(u,d=>new Promise((f,g)=>{d.disposer.dispose(g),d.disposer.dispose(t.pointerUpEvent.don(()=>{f()})),d.disposer.dispose(t.pointerOutEvent.don(()=>{f()}))})),this._lastPosition=void 0,this._axisPixelInfo=void 0}),l.restart()})),c=()=>{this.enabled?l.restart():l.isRunning&&l.cancel()};c(),this.dispose(this.enabledChanged.disposableOn(c))}}}get scaleAxis(){return this._scaleAxis}_createScaleAxis(t,i){const s=this.ad(new Lo(t));return s.width=10,this.ad(p.track([s,"show"],[this,"enabled"])),s}}(n=>{n.createDefaultProps=()=>({...Cn.createDefaultProps(),scale:p.reactArray([1,1,0]),axisPixelSize:100,axisSnapPixelSize:10,scaleSensitivity:.8})})(is||(is={})),p.extendClassProps(is.prototype,is.createDefaultProps);function hv(n,e,t){const i=t[0]-e[0],s=t[1]-e[1],o=n[0]-e[0],r=n[1]-e[1],a=i*o+s*r,l=i*i+s*s;let c=l>0?Math.max(0,Math.min(1,a/l)):0;const h=e[0]+c*i,u=e[1]+c*s,d=n[0]-h,f=n[1]-u;return{dist:Math.hypot(d,f),t:c}}const rs=class rs extends on{constructor(t){super();I(this,"_editingPoints",this.disposeVar(new p.ObservableArray));I(this,"_cancelEvent",this.disposeVar(new p.Event));I(this,"_currentProcess");I(this,"_menuPoiEnabled",this.disposeVar(p.react(!1)));I(this,"_status",this.disposeVar(p.react("None")));I(this,"_positionsChanged",this.ad(new p.Event));I(this,"_cursorInfo");this._olViewer=t,console.log("imgaeUrl:",rs.baseImageUrl+"point-green.png"),this.enabled=!1,this.createPolyline(t),this._createCursorInfo(t),this.dispose(()=>this.resetPositions()),this.dispose(()=>this.editingPoints.length=0),this.dispose(this.editingPoints.changedEvent.disposableOn(()=>this.positionsChanged.emit())),this.dispose(this.editingPoints.toChangeEvent.disposableOn(i=>{for(let{start:s,deleteCount:o,items:r}of i){for(const a of r)a.menuPoi.enabled=this.menuPoiEnabled??!1;for(let a=s;a<s+o;++a)this.editingPoints.get(a).destroy()}})),this.dispose(this.menuPoiEnabledChanged.disposableOn(()=>{for(let i of this.editingPoints)i.menuPoi.enabled=this.menuPoiEnabled??!1})),this.dispose(t.dblclickEvent.don(i=>{this.ad(p.nextAnimateFrame(()=>{var s;((s=i.pointerEvent)==null?void 0:s.button)===0&&this.enabled&&this.currentProcess&&this.currentProcess.cancel()}))})),this.dispose(this.enabledChanged.disposableOn(i=>{this._currentProcess&&(i?this._currentProcess.restart():this._currentProcess.isRunning&&this._currentProcess.cancel())}));{const i=()=>{this.polylineShow=this.olViewer.editingLineShow};i(),this.ad(this.olViewer.editingLineShowChanged.don(i))}}get editingPoints(){return this._editingPoints}get cancelEvent(){return this._cancelEvent}cancel(){this._cancelEvent.emit()}get currentProcess(){return this._currentProcess}set currentProcess(t){this._currentProcess=t}get menuPoiEnabled(){return this._menuPoiEnabled.value}set menuPoiEnabled(t){this._menuPoiEnabled.value=t}get menuPoiEnabledChanged(){return this._menuPoiEnabled.changed}get status(){return this._status.value}get statusChanged(){return this._status.changed}set status(t){this._status.value=t}getPositions(){const t=[];for(let i of this._editingPoints)i.position&&t.push([...i.position]);return t}resetPositions(t){if(this.enabled??rs.defaults.enabled)return console.warn("MultiPointsEditing.resetPositions error: this.enabled === true"),!1;const i=t||[];return!(i.length===this.editingPoints.length&&i.every((s,o)=>s.every((r,a)=>{const l=this.editingPoints.get(o);return l.position&&l.position[a]===r})))}forceResetPositions(t){(this.enabled??rs.defaults.enabled)&&(this.enabled=!1),this.resetPositions(t)}get positions(){return this.getPositions()}set positions(t){this.resetPositions(t)}get positionsChanged(){return this._positionsChanged}get olViewer(){return this._olViewer}get cursorInfo(){return this._cursorInfo}createPolyline(t){const i=this.ad(new jt(t));this.ad(p.track([i,"color"],[this,"polylineColor"])),this.ad(p.track([i,"width"],[this,"polylineWidth"])),this.ad(p.track([i,"show"],[this,"polylineShow"])),this.ad(p.track([i,"arcType"],[this,"polylineArcType"])),this.ad(p.track([i,"loop"],[this,"loop"]));{const s=()=>{const o=[];for(const r of this.getPositions())r[2]-=t.editingHeightOffset??0,o.push(r);i.positions=o};s(),this.ad(this.positionsChanged.don(s))}}_createCursorInfo(t){const i=this._cursorInfo=this.ad(new p.CursorInfo(t.container,p.CursorFloatDiv));this.dispose(this.statusChanged.disposableOn(()=>{const s=this.status;if(i){if(!this.hideCursorInfo){i.show=!1;return}s==="Adding"?(i.text="右键/BackSpace键:删除上一个控制点;Esc键或左键双击:退出添加状态,进入修改状态",i.show=!0):s==="Modifying"||s==="Modifying_Point"?(i.text="Esc键或左键双击:退出编辑状态",i.show=!0):s==="None"&&(i.text="",i.show=!1)}}))}};I(rs,"baseImageUrl",p.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/img/")),I(rs,"defaults",{...on.defaults,debug:!1,polylineShow:!1,polylineWidth:1,polylineColor:[1,1,1,1],polylineArcType:"GEODESIC",maxPointsNum:Number.MAX_SAFE_INTEGER,loop:!1,firstControlPointImageUrl:rs.baseImageUrl+"point-green.png",otherControlPointImageUrl:rs.baseImageUrl+"point-yellow.png"});let Nn=rs;(n=>{n.createDefaultProps=()=>({...on.createDefaultProps(),loop:!1,debug:!1,polylineShow:!0,polylineWidth:1,polylineColor:p.reactArray([1,1,1,1]),polylineArcType:"GEODESIC",maxPointsNum:Number.MAX_SAFE_INTEGER,firstControlPointImageUrl:n.baseImageUrl+"point-green.png",otherControlPointImageUrl:n.baseImageUrl+"point-yellow.png",hideCursorInfo:!1,middlePointShow:!0})})(Nn||(Nn={})),p.extendClassProps(Nn.prototype,Nn.createDefaultProps);let kA=0;class Lg extends p.Destroyable{constructor(t,i){super();I(this,"_position",this.disposeVar(p.reactArrayWithUndefined(void 0)));I(this,"_id",kA++);I(this,"_menuPoi");i&&(this.position=i),t.debug&&console.log(`PolylinePositionEditor creating! ${this.id}`),this.dispose(()=>{t.debug&&console.log(`PolylinePositionEditor destroying! ${this.id}`)});const s=this._menuPoi=this.ad(new xr(t.olViewer));s.enabled=!1,this.ad(p.track([s,"show"],[t,"enabled"]));{const o=()=>{if(this.position===void 0){s.position=void 0;return}const r=[...this.position];r[2]=0,s.position=r,t.positionsChanged.emit()};o(),this.d(this.positionChanged.don(o))}{const o=()=>{const r=t.editingPoints.indexOf(this)+1;r!==0&&(s.title=`控制点${r}`,r===1?s.imageUri=t.firstControlPointImageUrl??Nn.defaults.firstControlPointImageUrl:s.imageUri=t.otherControlPointImageUrl??Nn.defaults.otherControlPointImageUrl)};o(),this.dispose(t.editingPoints.changedEvent.disposableOn(o))}}get position(){return this._position.value}set position(t){this._position.value=t}get positionChanged(){return this._position.changed}get id(){return this._id}get menuPoi(){return this._menuPoi}}class zg extends Lg{constructor(e,t){super(e,t)}}class xt extends Nn{constructor(t){super(t);I(this,"_deletePreviousPointWhileAddingEvent",this.disposeVar(new p.Event));I(this,"placeEditing");if(!t.viewer)return;const i=this.placeEditing=this.ad(new ts(t));i.enabled=!1,this.currentProcess=this.disposeVar(p.createProcessingFromAsyncFunc(async s=>{s.disposer.dispose(()=>{(this.debug??xt.defaults.debug)&&console.log("---editing canceled~~~"),this.status="None",this.enabled=!1}),(this.debug??xt.defaults.debug)&&console.log("直接进入Adding状态"),this.status="Adding",await s.promise(p.step(s,async o=>{const r=o.disposer,a=r.ad(this._addingEditingProcessing());r.dispose(()=>"adding canceled!"),r.dispose(this.cancelEvent.disposableOn(()=>a.cancel())),await o.promise(new Promise(l=>{r.dispose(a.completeEvent.disposableOnce(l))}))}))})),this.dispose(t.clickEvent.don(s=>{var o;((o=s.pointerEvent)==null?void 0:o.button)===2&&this.deletePreviousPointWhileAdding()}))}deletePreviousPointWhileAdding(){this._deletePreviousPointWhileAddingEvent.emit()}resetPositions(t){if(!super.resetPositions(t))return!0;const i=t?t.map(s=>new zg(this,s)):[];return this.editingPoints.splice(0,this.editingPoints.length,...i),!0}_addingEditingProcessing(){const t=()=>{if(this.maxPointsNum!==void 0)return this.editingPoints.length>=this.maxPointsNum&&(this.debug??xt.defaults.debug)&&console.log("impl.positionEditors.length >= impl.maxPointsNum"),this.editingPoints.length>=this.maxPointsNum},i=p.createProcessingFromAsyncFunc(async s=>{let o=this.editingPoints.length;this.menuPoiEnabled=!1;do if(!await s.promise(p.step(s,async a=>{let l;!t()&&(l=a.disposer.disposeVar(new uv(this,o)));const h=a.disposer.disposeVar(new fv(this,o));return a.disposer.dispose(this._deletePreviousPointWhileAddingEvent.disposableOn(()=>h.do())),await a.promise(new Promise(u=>{l&&a.disposer.dispose(l.overEvent.disposableOnce(d=>{d?(o++,u(!0)):u(!1)})),a.disposer.dispose(h.overEvent.disposableOnce(d=>{d?(o--,u(!0)):u(!1)})),a.disposer.dispose(this.cancelEvent.disposableOn(()=>u(!1)))}))})))break;while(!0)});return i.start(),i}}(n=>{n.createDefaultProps=()=>({...Nn.createDefaultProps()})})(xt||(xt={})),p.extendClassProps(xt.prototype,xt.createDefaultProps);class uv extends p.Destroyable{constructor(t,i){super();I(this,"_overEvent",this.disposeVar(new p.Event));const{placeEditing:s}=t;let o=new zg(t,void 0);t.editingPoints.splice(i,0,o);const r=()=>{(t.debug??xt.defaults.debug)&&console.log("delete currentPosEditor");const c=t.editingPoints.indexOf(o);if(c===-1)throw new Error("currentPosEditor not found");t.editingPoints.splice(c,1)};if(s.enabled??!1)throw console.error("placeEditing.enabled is true!"),new Error("placeEditing.enabled is true!");this.dispose(p.track([o,"position"],[s,"position"])),s.enabled=!0;let a=!1;const l=()=>{r(),this._overEvent.emit(!1)};this.dispose(()=>{s.enabled=!1,!a&&l()}),this.dispose(s.overEvent.disposableOnce(()=>{a=!0,o.position===void 0?l():this._overEvent.emit(!0)})),(t.debug??xt.defaults.debug)&&console.log(`PointAdding creating! index(${i})`),this.dispose(()=>{(t.debug??xt.defaults.debug)&&console.log(`PointAdding destroying! index(${i})`)})}get overEvent(){return this._overEvent}}function dv(n,e){const t=n.editingPoints,i=e-1;return i<0?(console.warn("previousIndex < 0, cannot delete the point!"),!1):(t.splice(i,1),!0)}class fv extends p.Destroyable{constructor(t,i){super();I(this,"_overEvent",this.disposeVar(new p.Event));I(this,"_doEvent",this.disposeVar(new p.Event));this.dispose(this._doEvent.disposableOn(()=>this._overEvent.emit(dv(t,i)))),(t.debug??xt.defaults.debug)&&console.log(`PreviousPointDeleting creating! currentIndex(${i})`),this.dispose(()=>{(t.debug??xt.defaults.debug)&&console.log(`PreviousPointDeleting destroying! currentIndex(${i})`)})}get overEvent(){return this._overEvent}do(){return this._doEvent.emit()}}class pv extends xt{constructor(e){super(e),this.loop=!1}}class gv extends xt{constructor(e){super(e),this.loop=!0}}class Pu extends Lg{constructor(e,t){super(e,t);{const{menuPoi:i}=this;i.commands=[["add","增加控制点","",Ze.baseImageUrl+"add.png"],["delete","删除当前控制点","",Ze.baseImageUrl+"delete.png"],["modify","修改当前控制点","",Ze.baseImageUrl+"modify.png"]],i.clickCommandName="modify",i.rightClickCommandName="delete",this.dispose(i.commandEvent.disposableOn(s=>{e.menuPoiCommand(this,s)})),this.dispose(i.dbclickEvent.disposableOn(()=>{e.menuPoiCommand(this,"dbClick")}))}if(e.middlePointShow){const i=this.ad(new Ei(e.olViewer));{i.imageUri=e.firstControlPointImageUrl??Ze.defaults.firstControlPointImageUrl,i.tooltip="点击增加一个控制点",i.bgColor=[0,0,0,.6],i.fgColor=[1,1,1,1],i.size=[8,8],i.originRatioAndOffset=[.5,.5,0,0];{const s=()=>{if(!(e.enabled??Ze.defaults.enabled)){i.enabled=!1,i.show=!1;return}do{const r=e.editingPoints.indexOf(this);if(r===-1)break;const a=e.editingPoints.length;if(a===0){console.error("impl.positionEditors.length === 0!");break}if(!(e.loop??Ze.defaults.loop)&&r+1>=a)break;const c=this.position;if(!c)break;let h=(r+1)%a;const d=e.editingPoints.get(h).position;if(!d)break;const f=Yf(c,d);if(!f)break;f[2]-=e.olViewer.editingHeightOffset??0,i.position=f;const g=e.editingPoints.length<(e.maxPointsNum??Ze.defaults.maxPointsNum);i.enabled=g,i.show=g;return}while(!1);i.enabled=!1,i.show=!1};s(),this.dispose(e.positionsChanged.disposableOn(s)),this.dispose(e.loopChanged.disposableOn(s)),this.dispose(e.enabledChanged.disposableOn(s))}this.dispose(i.clickEvent.disposableOn(s=>{if(s.button!==0||e.editingPoints.length>=(e.maxPointsNum??Ze.defaults.maxPointsNum))return;const o=e.editingPoints.indexOf(this);if(o===-1)return;const r=i.position?[...i.position]:void 0;r&&(r[2]+=e.olViewer.editingHeightOffset??0);let a=new Pu(e,r);e.editingPoints.splice(o+1,0,a),e.modify(a)}))}}}}class Ze extends Nn{constructor(t){super(t);I(this,"_menuPoiCommand",this.disposeVar(new p.Event));I(this,"_forceModifyPosEditorEvent",this.disposeVar(new p.Event));I(this,"_overEvent",this.disposeVar(new p.Event));I(this,"translationEditing");console.log("这是多点修改编辑器");{const s=this.ad(p.createNextAnimateFrameEvent(this.moveWithFirstPositionChanged,this.editingPoints.changedEvent));this.ad(new p.ObjResettingWithEvent(s,()=>{if(!(!this.moveWithFirstPosition||this.editingPoints.length<=1))return new jA(this.editingPoints.get(0),this)}))}const i=this.translationEditing=this.disposeVar(new ns(t));i.enabled=!1,this.currentProcess=this.disposeVar(p.createProcessingFromAsyncFunc(async s=>{s.disposer.dispose(()=>{(this.debug??Ze.defaults.debug)&&console.log("---editing canceled~~~"),this.status="None",this.enabled=!1});let o=-1;do if((this.debug??Ze.defaults.debug)&&console.log("进入Modifying修改状态"),this.status="Modifying",o=await s.promise(p.step(s,async r=>{const a=r.disposer,l=a.ad(new UA(this));return a.dispose(()=>"modifying canceled!"),this.editingPoints.length>0&&l.modify(this.editingPoints.get(o===-1||o>=this.editingPoints.length?0:o)),a.dispose(this.cancelEvent.disposableOn(()=>l.cancel())),a.dispose(this._forceModifyPosEditorEvent.disposableOn(h=>l.modify(h))),await r.promise(new Promise(h=>{a.dispose(l.overEvent.disposableOnce(u=>{h(u)}))}))})),o===-1){(this.debug??Ze.defaults.debug)&&console.log("退出编辑状态");break}else{if(this.editingPoints.length>=(this.maxPointsNum??Ze.defaults.maxPointsNum))return;if(this.editingPoints.length===0){console.error("impl.positionEditors.length === 0!");return}this.loop??Ze.defaults.loop;const a=this.editingPoints.get(o-1).position;if(!a)return;let l=o%this.editingPoints.length;const h=this.editingPoints.get(l).position;if(!h)return;const u=Yf(a,h);if(!u)return;u&&(u[2]+=this.olViewer.editingHeightOffset??0);let d=new Pu(this,u);this.editingPoints.splice(o,0,d)}while(!0);this.status="None",this.enabled=!1}))}menuPoiCommand(t,i){this._menuPoiCommand.emit(t,i)}modify(t){this._forceModifyPosEditorEvent.emit(t)}resetPositions(t){if(!super.resetPositions(t))return!0;const i=t?t.map(s=>new Pu(this,s)):[];return this.editingPoints.splice(0,this.editingPoints.length,...i),!0}get overEvent(){return this._overEvent}}(n=>{n.createDefaultProps=()=>({...Nn.createDefaultProps(),moveWithFirstPosition:!1})})(Ze||(Ze={})),p.extendClassProps(Ze.prototype,Ze.createDefaultProps);class jA extends p.Destroyable{constructor(e,t){super(),this._firstPositionEditor=e,this.multiPointsModifyEditing=t,this._firstPositionEditor.positionChanged.disposableOn((i,s)=>{if(i===void 0||s===void 0)return;var o=[i[0]-s[0],i[1]-s[1],i[2]-s[2]];const r=this.multiPointsModifyEditing.editingPoints.length;for(let a=1;a<r;a++){const l=this.multiPointsModifyEditing.editingPoints.get(a),c=l.position;c!==void 0&&(l.position=[c[0]+o[0],c[1]+o[1],c[2]+o[2]])}})}}class UA extends p.Destroyable{constructor(t){super();I(this,"_overEvent",this.disposeVar(new p.Event));I(this,"_cancelEvent",this.disposeVar(new p.Event));I(this,"_forceModifyPosEditorEvent",this.disposeVar(new p.Event));t.menuPoiEnabled=!0,this.dispose(()=>t.menuPoiEnabled=!1);let i;const s=()=>{i==null||i.destroy(),i=void 0,t.status="Modifying"};this.dispose(s);const o=r=>{s(),t.status="Modifying_Point",i=new GA(t,r),i.dispose(i.overEvent.disposableOn(()=>{s()}))};this.dispose(this._forceModifyPosEditorEvent.disposableOn(o)),this.dispose(t._menuPoiCommand.disposableOn((r,a)=>{if(a==="delete"){if(t.editingPoints.length<=2)return;const l=t.editingPoints.indexOf(r);if(l===-1)throw console.error("posEditor not found"),new Error("posEditor not found");t.editingPoints.splice(l,1)}else if(a==="modify")o(r);else if(a==="add"){const l=t.editingPoints.indexOf(r);if(l===-1)throw console.error("posEditor not found"),new Error("posEditor not found");this._overEvent.emit(l+1)}else a==="dbClick"?this._overEvent.emit(-1):alert(`未知的commandName(${a})`)})),this.dispose(this._cancelEvent.disposableOn(()=>{this._overEvent.emit(-1)}))}get overEvent(){return this._overEvent}cancel(){this._cancelEvent.emit()}modify(t){this._forceModifyPosEditorEvent.emit(t)}}class GA extends p.Destroyable{constructor(t,i){super();I(this,"_overEvent",this.disposeVar(new p.Event));this._modifying=t,this._posEditor=i,this.dispose(this._posEditor.toDestroyEvent.disposableOn(()=>{this._overEvent.emit()}));const{translationEditing:s}=this._modifying;if(s.enabled=!0,s.heading=0,this.dispose(()=>{s.enabled=!1}),!this._posEditor.position)throw console.error("!this._posEditor.position"),new Error("!this._posEditor.position");s.position=this._posEditor.position,this.dispose(p.track([this._posEditor,"position"],[s,"position"])),this.dispose(s.enabledChanged.disposableOnce(o=>{o||this._overEvent.emit()}))}get overEvent(){return this._overEvent}}class mv extends Ze{constructor(e){super(e),this.loop=!1}}class yv extends Ze{constructor(e){super(e),this.loop=!0}}class Vr extends xt{init(){const e=this.startPosition;if(!e)return;const t=this.distance,i=this.rotation,s=t*Math.cos(i[1]*Math.PI/180),o=p.geoDestination(e,s,i[0]);if(!o){this.positions=[e];return}const r=t*Math.sin(i[1]*Math.PI/180);o[2]+=r,this.positions=[e,o],this.editingPoints.length==2&&(this.editingPoints.get(0).position=e,this.editingPoints.get(1).position=o)}constructor(e){super(e),this.loop=!0,this.maxPointsNum=2;{const t=()=>{if(!this.positions||this.positions.length==0){this.distance=1,this.rotation=[90,0,0],this.startPosition=[0,0,0];return}if(this.positions.length==1){this.distance=1,this.rotation=[90,0,0];return}this.startPosition=this.positions[0],this.endPosition=this.positions[1];const i=p.geoHeading(this.startPosition,this.endPosition),s=p.geoDistance(this.startPosition,this.endPosition);if(s<=0){this.rotation=[90,0,0],this.distance=1;return}const o=this.endPosition[2]-this.startPosition[2],r=Math.atan(o/s)*180/Math.PI,a=Math.sqrt(s*s+o*o);this.rotation=[i,r,0],this.distance=a};t(),this.ad(this.positionsChanged.don(t))}}}(n=>{n.createDefaultProps=()=>({...xt.createDefaultProps(),startPosition:p.reactArrayWithUndefined(void 0),endPosition:p.reactArrayWithUndefined(void 0),rotation:p.reactArray([90,0,0]),distance:p.react(1)})})(Vr||(Vr={})),p.extendClassProps(Vr.prototype,Vr.createDefaultProps);class zo extends Ze{init(){const e=this.startPosition;if(!e)return;const t=this.distance,i=this.rotation,s=t*Math.cos(i[1]*Math.PI/180),o=p.geoDestination(e,s,i[0]);if(!o){this.positions=[e];return}const r=t*Math.sin(i[1]*Math.PI/180);o[2]+=r,this.positions=[e,o],this.editingPoints.length==2&&(this.editingPoints.get(0).position=e,this.editingPoints.get(1).position=o)}constructor(e){super(e),this.loop=!0,this.maxPointsNum=2,this.middlePointShow=!1,this.moveWithFirstPosition=!0;{const t=()=>{do{if(!this.positions||this.positions.length==0){this.distance=1,this.rotation=[90,0,0],this.startPosition=[0,0,0];break}if(this.startPosition=this.positions[0],this.positions.length==1){this.editingPoints.get(0).menuPoi.commands=[["add","增加控制点","",Ze.baseImageUrl+"add.png"],["delete","删除当前控制点","",Ze.baseImageUrl+"delete.png"],["modify","修改当前控制点","",Ze.baseImageUrl+"modify.png"]],this.rotation=[90,0,0],this.distance=1;break}this.endPosition=this.positions[1];for(let l of this.editingPoints)l.menuPoi.commands=[["delete","删除当前控制点","",Ze.baseImageUrl+"delete.png"],["modify","修改当前控制点","",Ze.baseImageUrl+"modify.png"]];const i=p.geoHeading(this.startPosition,this.endPosition),s=p.geoDistance(this.startPosition,this.endPosition);if(Math.abs(s)<=0){this.rotation=[90,0,0],this.distance=1;return}const o=this.endPosition[2]-this.startPosition[2],r=Math.atan(o/s)*180/Math.PI,a=Math.sqrt(s*s+o*o);this.rotation=[i,r,0],this.distance=a}while(!1)};this.ad(this.positionsChanged.don(t))}}}(n=>{n.createDefaultProps=()=>({...Ze.createDefaultProps(),startPosition:p.reactArrayWithUndefined(void 0),endPosition:p.reactArrayWithUndefined(void 0),rotation:p.reactArray([0,0,0]),distance:p.react(0)})})(zo||(zo={})),p.extendClassProps(zo.prototype,zo.createDefaultProps);class qA extends xt{constructor(e){super(e),this.loop=!1,this.polylineShow=!1}}class WA extends Ze{constructor(e){super(e),this.loop=!1,this.polylineShow=!1,this.middlePointShow=!1}}class vl extends xt{constructor(e){super(e),e.viewer||(this.loop=!1);{const t=()=>{if(!this.positions||this.positions.length<2){this.visibilityPositions=void 0;return}const i=[...this.positions[0]];i[2]-=e.editingHeightOffset??0,this.visibilityPositions=this.positions.map(s=>(s[2]-=e.editingHeightOffset??0,[i,s]))};t(),this.ad(this.positionsChanged.don(t))}}createPolyline(e){const t=this.ad(new Ii(e));t.topOrBottom="bottom",this.ad(p.track([t,"color"],[this,"polylineColor"])),this.ad(p.track([t,"width"],[this,"polylineWidth"])),this.ad(p.track([t,"show"],[this,"polylineShow"])),this.ad(p.track([t,"arcType"],[this,"polylineArcType"])),this.ad(p.track([t,"loop"],[this,"loop"])),this.ad(p.track([t,"positions"],[this,"visibilityPositions"]))}}(n=>{n.createDefaultProps=()=>({...xt.createDefaultProps(),visibilityPositions:p.reactPositionsSet(void 0)})})(vl||(vl={})),p.extendClassProps(vl.prototype,vl.createDefaultProps);class bl extends Ze{constructor(e){if(super(e),!!e.viewer){this.loop=!1,this.middlePointShow=!1;{const t=()=>{if(!this.positions||this.positions.length<2)return;const i=[...this.positions[0]];i[2]-=e.editingHeightOffset??0,this.visibilityPositions=this.positions.map(s=>(s[2]-=e.editingHeightOffset??0,[i,s]))};t(),this.ad(this.positionsChanged.don(t))}}}createPolyline(e){const t=this.ad(new Ii(e));t.topOrBottom="bottom",this.ad(p.track([t,"color"],[this,"polylineColor"])),this.ad(p.track([t,"width"],[this,"polylineWidth"])),this.ad(p.track([t,"show"],[this,"polylineShow"])),this.ad(p.track([t,"arcType"],[this,"polylineArcType"])),this.ad(p.track([t,"loop"],[this,"loop"])),this.ad(p.track([t,"positions"],[this,"visibilityPositions"]))}}(n=>{n.createDefaultProps=()=>({...Ze.createDefaultProps(),visibilityPositions:p.reactPositionsSet(void 0)})})(bl||(bl={})),p.extendClassProps(bl.prototype,bl.createDefaultProps);class VA extends zo{constructor(e){super(e),this.firstControlPointImageUrl=this.otherControlPointImageUrl,this.translationEditing.xAxisShow=!1,this.translationEditing.yAxisShow=!1,this.translationEditing.showCircle=!1,this.rotation=[0,90,0]}}class ri extends p.EngineObject{constructor(t,i,s){super(t,i,s??!0);I(this,"_supportEditing",this.disposeVar(p.react(!0)));I(this,"_currentEditing",this.disposeVar(p.react(void 0)));this.ad(this.supportEditingChanged.don(()=>{this.destroy()}))}get supportEditing(){return this._supportEditing.value}set supportEditing(t){this._supportEditing.value=t}get supportEditingChanged(){return this._supportEditing.changed}get currentEditing(){return this._currentEditing.value}set currentEditing(t){this._currentEditing.value=t}get currentEditingChanged(){return this._currentEditing.changed}}const kl=class kl extends ri{constructor(e,t){super(Array.isArray(e)?e[0]:e,t,!0);const i=this.currentEditing=this.ad(new ns(t));if(this.ad(i.enabledChanged.don(s=>{s||this.ad(p.nextAnimateFrame(()=>this.destroy()))})),Array.isArray(e)){const s=[];for(let o=0;o<e.length;o++){const r=e[o];Reflect.has(r,"position")?s.push(r.position):r.points&&s.push(...r.points)}i.position=p.getMinMaxCorner(s).center,this.ad(i.positionChanged.disposableOn((o,r)=>{if(!o||!r)return;const a=Cr({originPosition:r},[o])[0][0];e.forEach(l=>{if(Reflect.has(l,"position")){const c=Cr({originPosition:r},[l.position])[0][0];l.position=Eh({originPosition:r},[[c[0]+a[0],c[1]+a[1],c[2]+a[2]]])[0][0]}else if(Reflect.has(l,"points")&&l.points){const c=Cr({originPosition:r},l.points)[0];l.points=Eh({originPosition:r},c.map(h=>[h[0]+a[0],h[1]+a[1],h[2]+a[2]]))[0]}})}));return}if(Reflect.has(e,"position")){this.ad(p.bind([i,"position"],[e,"position"]));return}if(Reflect.has(e,"points")){const s=e;if(s.points===void 0||s.points.length===0){this.destroy();return}i.position=p.getMinMaxCorner(s.points).center,this.ad(i.positionChanged.disposableOn((o,r)=>{if(o===void 0||r===void 0||s.points===void 0||s.points.length===0){this.destroy();return}const a=Cr({originPosition:r},[o])[0][0],l=Cr({originPosition:r},s.points)[0];s.points=Eh({originPosition:r},l.map(c=>[c[0]+a[0],c[1]+a[1],c[2]+a[2]]))[0]}));return}this.supportEditing=!1}};I(kl,"type",kl.registerEditing("ESOlViewer",p.ESJEditingMode.Translation,kl));let Su=kl;function _v(){const n=p.createProcessingFromAsyncFunc(async(e,t,i,s,o=!0)=>{const r=Array.isArray(s)?[...s]:[s];if(r.length===0){console.warn("无有效编辑模式,editingModes 为:",r);return}const a=i.editingID;console.log("编辑模式为:editingModes",r),t.editingEvent.emit({objectIDs:[i.parentID],editingID:a,type:"start",add:{modes:r}});const l=()=>{t.notSupportEditingCount=0,t.editingEvent.emit({objectIDs:[i.parentID],editingID:a,type:"end",add:{modes:r}}),n.isRunning&&n.cancel()};e.disposer.ad(l),e.disposer.ad(i.toDestroyEvent.don(l));const c=u=>{u.code==="Escape"&&l()};document.body.addEventListener("keydown",c),e.disposer.ad(()=>document.body.removeEventListener("keydown",c));const h=async u=>{if(!n.isRunning)return;const d=r[u%r.length],f=await p.step(e,async _=>{const v=_.disposer,E=p.EngineObject.contextEditing.getEngineObjConstructor(d,t.typeName);if(!E||!i.supportEditingModes().includes(d))return console.log(`未找到编辑模式或不支持当前编辑模式 ${d},已跳过,请检查输入`),t.editingEvent.emit({objectIDs:[i.parentID],editingID:a,type:"changedFailed",add:{cMode:d,cIndex:u}}),t.notSupportEditingCount++,"next";const w=new E(i,t);if(v.ad(()=>{!w.isDestroyed()&&w.destroy()}),w.supportEditing)t.editingEvent.emit({objectIDs:[i.parentID],editingID:a,type:"changed",add:{cMode:d,cIndex:u}}),t.notSupportEditingCount=0;else return console.log(`编辑模式 ${d} 不支持,已跳过`),t.editingEvent.emit({objectIDs:[i.parentID],editingID:a,type:"changedFailed",add:{cMode:d,cIndex:u}}),t.notSupportEditingCount++,"next";return await _.promise(new Promise(P=>{if(w.isDestroyed())return P("next");if(v.ad(w.toDestroyEvent.don(()=>{console.log(`编辑模式 ${d} 结束`),P("next")})),o){const R=A=>{A.code==="Space"&&(console.log(`编辑模式 ${d} 切换到下一模式`),P("next"))};document.body.addEventListener("keydown",R),v.ad(()=>document.body.removeEventListener("keydown",R)),v.ad(t.dblclickEvent.don(()=>P("done")))}else v.ad(t.dblclickEvent.don(()=>P("done")))}))});if(t.notSupportEditingCount===r.length||f==="done")return;const g=o?(u+1)%r.length:u+1;if(!(!o&&g>=r.length))return await Promise.resolve(),h(g)};await h(0)});return n}function BA(){const n=p.createProcessingFromAsyncFunc(async(e,t,i,s)=>{t.editingEvent.emit({objectIDs:i.map(l=>l.parentID),editingID:s,type:"start"});const o=()=>{t.editingEvent.emit({objectIDs:i.map(l=>l.parentID),editingID:s,type:"end"}),n.isRunning&&n.cancel()};e.disposer.ad(o);const r=l=>{l.code=="Escape"&&o()};document.body.addEventListener("keydown",r),e.disposer.ad(()=>document.body.removeEventListener("keydown",r));const a=new Su(i,t);e.disposer.ad(()=>{!a.isDestroyed()&&a.destroy()}),await e.promise(new Promise(l=>{a.isDestroyed()&&l(),e.disposer.ad(a.toDestroyEvent.don(()=>{console.log("移动结束"),l()})),e.disposer.ad(t.dblclickEvent.don(()=>l()))}))});return n}const jl=class jl extends ri{constructor(e,t){super(e,t,!0);const i=this.currentEditing=this.ad(new ts(t));this.ad(t.clickEvent.don(s=>{var o;((o=s.pointerEvent)==null?void 0:o.button)==2&&(i.enabled=!0)})),Reflect.has(e,"position")?(this.ad(p.bind([i,"position"],[e,"position"])),i.enabled=!i.position||p.equalsN3(i.position,[0,0,0])):this.supportEditing=!1}};I(jl,"type",jl.registerEditing("ESOlViewer",p.ESJEditingMode.Place,jl));let Ng=jl;const Ul=class Ul extends ri{constructor(e,t){super(e,t,!0);const i=this.currentEditing=this.ad(new is(t));if(this.ad(i.enabledChanged.don(s=>{!s&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))})),Reflect.has(e,"position")&&Reflect.has(e,"scale")){const s=e;this.ad(p.bind([i,"position"],[s,"position"])),this.ad(p.bind([i,"scale"],[s,"scale"]))}else throw new Error(`ScaleEditingWrapper:${e.typeName} 缩放属性无法绑定缩放编辑`)}};I(Ul,"type",Ul.registerEditing("ESOlViewer",p.ESJEditingMode.Scale,Ul));let kg=Ul;const Gl=class Gl extends ri{constructor(e,t){super(e,t,!0);const i=this.currentEditing=this.ad(new pv(t));if(this.ad(i.enabledChanged.don(s=>{s||this.ad(p.nextAnimateFrame(()=>this.destroy()))})),Reflect.has(e,"points")){const s=()=>i.positions=e.points??[];s(),this.ad(e.pointsChanged.don(()=>{i.enabled||s()})),i.enabled=!0,this.ad(p.track([e,"points"],[i,"positions"]))}else this.supportEditing=!1}};I(Gl,"type",Gl.registerEditing("ESOlViewer",p.ESJEditingMode.LineStringAppend,Gl));let jg=Gl;const ql=class ql extends ri{constructor(e,t){super(e,t,!0);const i=this.currentEditing=this.ad(new mv(t));if(this.ad(i.enabledChanged.don(s=>{s||this.ad(p.nextAnimateFrame(()=>this.destroy()))})),Reflect.has(e,"points")){const s=()=>{i.positions=e.points??[]};s(),this.ad(e.pointsChanged.don(()=>{i.enabled||s()})),i.enabled=!0,this.ad(p.track([e,"points"],[i,"positions"]))}else this.supportEditing=!1}};I(ql,"type",ql.registerEditing("ESOlViewer",p.ESJEditingMode.LineStringInsert,ql));let Ug=ql;const Wl=class Wl extends ri{constructor(e,t){super(e,t,!0);const i=this.currentEditing=this.ad(new gv(t));if(this.ad(i.enabledChanged.don(s=>{!s&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))})),Reflect.has(e,"points")){const s=()=>{i.positions=e.points??[]};s(),this.ad(e.pointsChanged.don(()=>{i.enabled||s()})),i.enabled=!0,this.ad(p.track([e,"points"],[i,"positions"]))}else this.supportEditing=!1}};I(Wl,"type",Wl.registerEditing("ESOlViewer",p.ESJEditingMode.CircularAppend,Wl));let Gg=Wl;const Vl=class Vl extends ri{constructor(e,t){super(e,t,!0);const i=this.currentEditing=this.ad(new yv(t));if(this.ad(i.enabledChanged.don(s=>{!s&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))})),Reflect.has(e,"points")){const s=()=>i.positions=e.points??[];s(),this.ad(e.pointsChanged.don(()=>!i.enabled&&s())),i.enabled=!0,this.ad(p.track([e,"points"],[i,"positions"]))}else this.supportEditing=!1}};I(Vl,"type",Vl.registerEditing("ESOlViewer",p.ESJEditingMode.CircularInsert,Vl));let qg=Vl;const Bl=class Bl extends ri{constructor(e,t){super(e,t,!0);const i=this.currentEditing=this.ad(new Vr(t));if(this.ad(i.enabledChanged.don(s=>{!s&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))})),Reflect.has(e,"position")){const s=e;if(this.ad(p.bind([i,"startPosition"],[s,"position"])),this.ad(J_([i,"rotation"],[s,"rotation"])),Reflect.has(s,"far"))this.ad(p.bind([i,"distance"],[s,"far"]));else if(Reflect.has(s,"radius"))this.ad(p.bind([i,"distance"],[s,"radius"]));else if(Reflect.has(s,"distance"))this.ad(p.bind([i,"distance"],[s,"distance"]));else{const o=t.viewer,r=o==null?void 0:o.getView(),a=(r==null?void 0:r.getResolution())??1;i.distance=Math.max(1,a*100)}}else if(Reflect.has(e,"points")){const s=e,o=()=>i.positions=s.points??[];o(),this.ad(s.pointsChanged.don(()=>!i.enabled&&o())),this.ad(p.track([s,"points"],[i,"positions"]))}else throw new Error(`DoublePointsAppendEditingWrapper:${e.typeName} 坐标属性无法绑定双点追加编辑`);i.startPosition&&!p.equalsN3(i.startPosition,[0,0,0])&&i.init(),i.enabled=!0}};I(Bl,"type",Bl.registerEditing("ESOlViewer",p.ESJEditingMode.DoublePointsAppend,Bl));let Wg=Bl;const $l=class $l extends ri{constructor(e,t){var r;super(e,t,!0);const i=t.viewer;if(!i)return;const s=this.currentEditing=this.ad(new zo(t));if(Reflect.has(e,"position")){const a=e;if(this.ad(p.bind([s,"startPosition"],[a,"position"])),this.ad(J_([s,"rotation"],[a,"rotation"])),Reflect.has(a,"far"))this.ad(p.bind([s,"distance"],[a,"far"]));else if(Reflect.has(a,"radius"))this.ad(p.bind([s,"distance"],[a,"radius"]));else if(Reflect.has(a,"distance"))this.ad(p.bind([s,"distance"],[a,"distance"]));else{const l=((r=i.getView())==null?void 0:r.getResolution())??1;s.distance=Math.max(1,l*100)}}else if(Reflect.has(e,"points")){const a=e;if(!a.points||a.points.length!==2)throw new Error(`DoublePointsModifyEditingWrapper:${e.typeName} 坐标属性无法绑定双点修改编辑`);s.moveWithFirstPosition=!1;const l=()=>s.positions=a.points??[];l(),this.ad(a.pointsChanged.don(()=>!s.enabled&&l())),this.ad(p.track([a,"points"],[s,"positions"]))}else throw new Error(`DoublePointsModifyEditingWrapper:${e.typeName} 坐标属性无法绑定双点修改编辑`);s.init(),s.enabled=!0;const o=this.ad(p.createNextAnimateFrameEvent(s.enabledChanged,s.startPositionChanged));this.ad(o.don(()=>{(!s.enabled||!s.startPosition||p.equalsN3(s.startPosition,[0,0,0]))&&this.destroy()}))}};I($l,"type",$l.registerEditing("ESOlViewer",p.ESJEditingMode.DoublePointsModify,$l));let Vg=$l;const Hl=class Hl extends ri{constructor(e,t){super(e,t,!0);const i=this.currentEditing=this.ad(new $s(t));if(i.rotation=[90,0,0],this.ad(i.enabledChanged.don(s=>{s||this.ad(p.nextAnimateFrame(()=>this.destroy()))})),Reflect.has(e,"position")&&Reflect.has(e,"rotation")){const s=e;this.ad(p.bind([i,"position"],[s,"position"])),this.ad(p.bind([i,"selfRotation"],[s,"rotation"]));return}else throw new Error(`OlRotationEditingWrapper:${e.typeName} 旋转属性无法绑定旋转编辑`)}};I(Hl,"type",Hl.registerEditing("ESOlViewer",p.ESJEditingMode.Rotation,Hl));let Bg=Hl;return X.AddEditingPoint=zg,X.BaseEditingWrapper=ri,X.CircularAppendEditing=gv,X.CircularAppendEditingWrapper=Gg,X.CircularInsertEditing=yv,X.CircularInsertEditingWrapper=qg,X.CurrentScale=Y_,X.DoublePointsAppendEditing=Vr,X.DoublePointsAppendEditingWrapper=Wg,X.DoublePointsModifyEditing=zo,X.DoublePointsModifyEditingWrapper=Vg,X.ESGeoIcon=vu,X.ESGeoPoint=bu,X.ESOlViewer=Ci,X.ESXYZLayer=Eu,X.EditingPoint=Lg,X.FPSMonitor=Ey,X.GeoCanvasPoi=Zi,X.HeightModifyEditing=VA,X.ImageLabel2D=nv,X.LineStringAppendEditing=pv,X.LineStringAppendEditingWrapper=jg,X.LineStringInsertEditing=mv,X.LineStringInsertEditingWrapper=Ug,X.MultiPointsAppendEditing=xt,X.OLCurrentScale=Oy,X.OlCanvasAndDivSwitchPoi=YR,X.OlCanvasPoi=Qf,X.OlCursorPositionInfo=iw,X.OlDivPoi=ep,X.OlESAreaMeasurement=wg,X.OlESDirectionMeasurement=vg,X.OlESDistanceMeasurement=bg,X.OlESGeoIcon=Eg,X.OlESGeoLineString=yl,X.OlESGeoPoint=Pg,X.OlESGeoPoints=Sg,X.OlESGeoPolygon=gl,X.OlESGeoPolygonImpl=Do,X.OlESGeoPolygonWithFire=Rg,X.OlESImageLabel=Tg,X.OlESImageryLayer=Ig,X.OlESLabel=_g,X.OlESLocationMeasurement=Og,X.OlESMVTLayer=Dg,X.OlESObjectWithLocation=pl,X.OlESPath=Ag,X.OlESTextLabel=Mg,X.OlESXYZLayer=xg,X.OlGeoCanvasImagePoi=Ei,X.OlGeoCanvasMenuPoi=xr,X.OlGeoCustomDivPoi=kt,X.OlGeoDivTextPoi=Ns,X.OlImageriesManager=sw,X.OlImagery=yg,X.OlLabelManager=ow,X.OlMultiPoint=Vs,X.OlPickingManager=aw,X.OlPoint=oi,X.OlPoisContext=ew,X.OlPolygon=es,X.OlPolyline=jt,X.OlRotationEditing=$s,X.OlRotationEditingWrapper=Bg,X.OlView=Mo,X.OlViewChanged=Ix,X.OlViewerExtensions=lw,X.PlaceEditing=ts,X.PlaceEditingWrapper=Ng,X.PointAdding=uv,X.PreviousPointDeleting=fv,X.ScaleEditing=is,X.ScaleEditingWrapper=kg,X.ScatterAppendEditing=qA,X.ScatterModifyEditing=WA,X.TranslationEditing=ns,X.TranslationEditingWrapper=Su,X.VisibilityAppendEditing=vl,X.VisibilityModifyEditing=bl,X.WASDController=by,X.capture=wy,X.cesiumHeightToOlZoom=mo,X.compute2DPickingConstraint=Fx,X.compute2DPickingInfoWithCoordinates=Iy,X.computePickingInfoWithCoordinates2D=Ry,X.createEditingSystemProcessing=_v,X.createHelperLine=Mx,X.createMoveObjectsProcessing=BA,X.defaultFlyToRotation=Cy,X.deletePreviousPoint=dv,X.flyExtent=ja,X.flyTo=Bi,X.flyToWithParam=Tx,X.flyToWithPosition=of,X.flyToWithPositions=Rx,X.fromCartesian=uR,X.fromCartesian2=N_,X.fromCartesian3=j_,X.fromCartesian4=G_,X.fromCartographic=fR,X.fromColor=gR,X.fromDistanceDisplayCondition=vR,X.fromEllipsoid=OR,X.fromHeadingPitchRoll=_R,X.fromNearFarScalar=yR,X.fromQuaternion=ER,X.fromRectangle=RR,X.geoNeareastPointOnRhumbLine=Is,X.geoNeareastPointOnRhumbLine2=Dx,X.getCameraPosition=Py,X.getCenterFromPositions=TA,X.getFlatMidPoint=Yf,X.getInverseModelMatrix=$_,X.getMinMaxCoordinates=Y1,X.getModelMatrixFromPosition=Xf,X.getOlZoomFromCesiumHeight=Sx,X.getPointsExtent=qc,X.getViewerExtensions=Ki,X.localPositionToPosition=X_,X.localPositionsToPositions=Eh,X.moveAllPositionsWithCenter=IA,X.olFlyTo=xy,X.olZoomToCesiumHeight=ka,X.orbitAroundPoint=vy,X.pickOlPosition=Sy,X.positionAndRotationToQuaternion=PR,X.positionFromCartesian=hR,X.positionToCartesian=L_,X.positionToLocalPosition=H_,X.positionsToLocalPositions=Cr,X.setViewerExtensions=Sh,X.toCartesian=q_,X.toCartesian2=z_,X.toCartesian3=k_,X.toCartesian4=U_,X.toCartographic=dR,X.toColor=pR,X.toDistanceDisplayCondition=wR,X.toEllipsoid=IR,X.toHeadingPitchRoll=W_,X.toNearFarScalar=mR,X.toQuaternion=bR,X.toRectangle=SR,X.visualizeCenterPoint=Px,Object.defineProperty(X,Symbol.toStringTag,{value:"Module"}),X})({},EarthSDK3,ol);