earthsdk3-ol 3.5.0-beta.2 → 3.6.0-beta.111

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,f,os){"use strict";var lE=Object.defineProperty;var uE=(W,f,os)=>f in W?lE(W,f,{enumerable:!0,configurable:!0,writable:!0,value:os}):W[f]=os;var S=(W,f,os)=>uE(W,typeof f!="symbol"?f+"":f,os);var rs=typeof document<"u"?document.currentScript:null;W.copyright=void 0;try{const i="earthsdk3-ol",t="3.5.0-beta.2",e="2025-09-26T10:52:01.000Z",n="北京西部世界科技有限公司",s="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",o="7b40a040cc65199eecf98c2e459c001248c933fe",a=((Date.now()-1758883921e3)/36e5).toFixed(1),c=`%c🌏 ${i}%c ${t}.${o.slice(0,8)}.${e} (距今${a}个小时)
1
+ var EarthSDK3_OL=function(W,f,os){"use strict";var uE=Object.defineProperty;var dE=(W,f,os)=>f in W?uE(W,f,{enumerable:!0,configurable:!0,writable:!0,value:os}):W[f]=os;var S=(W,f,os)=>dE(W,typeof f!="symbol"?f+"":f,os);var rs=typeof document<"u"?document.currentScript:null;W.copyright=void 0;try{const i="earthsdk3-ol",t="3.6.0-beta.111",e="2025-11-04T00:57:31.000Z",n="北京西部世界科技有限公司",s="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",o="e01e606acce477f3ffb79a237b21982a606516f4",a=((Date.now()-1762217851e3)/36e5).toFixed(1),c=`%c🌏 ${i}%c ${t}.${o.slice(0,8)}.${e} (距今${a}个小时)
2
2
  %c${s?s+`
3
3
  `:""}当前网站正在使用${i},此软件版权归${n}所有
4
- `;W.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){return OWNERLINK_},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","7b40a040cc65199eecf98c2e459c001248c933fe")},get info(){return c},get date(){return"2025-09-26T10:52:01.000Z"},get author(){return"suplyang"},get version(){return"3.5.0-beta.2"},get name(){return"earthsdk3-ol"},get commitId(){return"7b40a040cc65199eecf98c2e459c001248c933fe"},print(h=!1){!h&&window._xe2_no_copy_print||console.info(this.info,`
4
+ `;W.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){return OWNERLINK_},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","e01e606acce477f3ffb79a237b21982a606516f4")},get info(){return c},get date(){return"2025-11-04T00:57:31.000Z"},get author(){return"suplyang"},get version(){return"3.6.0-beta.111"},get name(){return"earthsdk3-ol"},get commitId(){return"e01e606acce477f3ffb79a237b21982a606516f4"},print(h=!1){!h&&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,22 @@ var EarthSDK3_OL=function(W,f,os){"use strict";var lE=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 f.Destroyable{constructor(){super()}}S(le,"defaults",{enabled:!0}),(i=>{i.createDefaultProps=()=>({enabled:!0})})(le||(le={})),f.extendClassProps(le.prototype,le.createDefaultProps);function $l(i){return Math.pow(i,3)}function Sn(i){return 1-$l(1-i)}function Op(i){return 3*i*i-2*i*i*i}function Ip(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 as={PROPERTYCHANGE:"propertychange"};class Er{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function Tp(i,t,e){let n,s;e=e||Pn;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 Pn(i,t){return i>t?1:i<t?-1:0}function Cr(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 Ap(i,t,e){for(;t<e;){const n=i[t];i[t]=i[e],i[e]=n,++t,--e}}function On(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 qi(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 Mp(i,t,e){const n=t||Pn;return i.every(function(s,o){if(o===0)return!0;const r=n(i[o-1],s);return!(r>0||r===0)})}function $s(){return!0}function br(){return!1}function cs(){}function Dp(i){let t=!1,e,n,s;return function(){const o=Array.prototype.slice.call(arguments);return(!t||this!==s||!qi(o,n))&&(t=!0,s=this,n=o,e=i.apply(this,arguments)),e}}function Zs(i){for(const t in i)delete i[t]}function Ks(i){let t;for(t in i)return!1;return!t}class Qs extends Er{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,cs);delete r[n]}return c}disposeInternal(){this.listeners_&&Zs(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]=cs,++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 xr(i,t,e,n){return Ct(i,t,e,n,!0)}function Mt(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),Zs(i))}class Js extends Qs{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]=xr(this,t[o],e)}else n=xr(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)}}Js.prototype.on,Js.prototype.once,Js.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 wt(){throw new Error("Unimplemented abstract method.")}let Fp=0;function Rt(i){return i.ol_uid||(i.ol_uid=String(++Fp))}const Lp="7.5.2";class Zl extends We{constructor(t,e,n){super(t),this.key=e,this.oldValue=n}}class Ze extends Js{constructor(t){super(),this.on,this.once,this.un,Rt(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 Zl(n,t,e)),n=as.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new Zl(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],Ks(this.values_)&&(this.values_=null),e||this.notify(t,n)}}}const Bi=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",zp=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 Np=Bi.includes("webkit")&&!Bi.includes("edge"),Kl=Bi.includes("macintosh"),Ql=typeof devicePixelRatio<"u"?devicePixelRatio:1,dc=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,Up=typeof Image<"u"&&Image.prototype.decode,Jl=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}(),jp={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 tu extends Error{constructor(t){const e=jp[t];super(e),this.code=t,this.name="AssertionError",this.message=e}}function pt(i,t){if(!i)throw new tu(t)}new Array(6);function be(){return[1,0,0,1,0,0]}function kp(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],d=t[4],p=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*d+s*p+r,i[5]=n*d+o*p+a,i}function Wp(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 qp(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 Gp(i,t,e){return Wp(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 Rr(i,t){const e=Bp(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 Bp(i){return i[0]*i[3]-i[1]*i[2]}let eu;function fc(i){const t="matrix("+i.join(", ")+")";if(dc)return t;const e=eu||(eu=document.createElement("div"));return e.style.transform=t,e.style.transform}const $t={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Sr(i){const t=Te();for(let e=0,n=i.length;e<n;++e)so(t,i[e]);return t}function Vp(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 fi(n,s,o,r,e)}function to(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 iu(i,t){return t?(t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t):i.slice()}function eo(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 io(i,t){return gc(i,t[0],t[1])}function In(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=$t.UNKNOWN;return r<e?c=c|$t.LEFT:r>s&&(c=c|$t.RIGHT),a<n?c=c|$t.BELOW:a>o&&(c=c|$t.ABOVE),c===$t.UNKNOWN&&(c=$t.INTERSECTING),c}function Te(){return[1/0,1/0,-1/0,-1/0]}function fi(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 no(i){return fi(1/0,1/0,-1/0,-1/0,i)}function Yp(i,t){const e=i[0],n=i[1];return fi(e,n,e,n,t)}function Hp(i,t,e,n,s){const o=no(s);return nu(o,i,t,e,n)}function Vi(i,t){return i[0]==t[0]&&i[2]==t[2]&&i[1]==t[1]&&i[3]==t[3]}function Xp(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 so(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 nu(i,t,e,n,s){for(;e<n;e+=s)$p(i,t[e],t[e+1]);return i}function $p(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 su(i,t){let e;return e=t(Pr(i)),e||(e=t(Or(i)),e)||(e=t(Ir(i)),e)||(e=t(Ae(i)),e)?e:!1}function mc(i){let t=0;return Hi(i)||(t=_t(i)*Ht(i)),t}function Pr(i){return[i[0],i[1]]}function Or(i){return[i[2],i[1]]}function Yi(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function Zp(i,t){let e;return t==="bottom-left"?e=Pr(i):t==="bottom-right"?e=Or(i):t==="top-left"?e=Ae(i):t==="top-right"?e=Ir(i):pt(!1,13),e}function _c(i,t,e,n,s){const[o,r,a,c,h,l,u,d]=yc(i,t,e,n);return fi(Math.min(o,a,h,u),Math.min(r,c,l,d),Math.max(o,a,h,u),Math.max(r,c,l,d),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,d=i[0],p=i[1];return[d-c+u,p-h-l,d-c-u,p-h+l,d+c-u,p+h+l,d+c+u,p+h-l,d-c+u,p-h-l]}function Ht(i){return i[3]-i[1]}function Tn(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]):no(n),n}function Ae(i){return[i[0],i[3]]}function Ir(i){return[i[2],i[3]]}function _t(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 Hi(i){return i[2]<i[0]||i[3]<i[1]}function Kp(i,t){return t?(t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t):i}function Qp(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 Jp(i,t,e){let n=!1;const s=pc(i,t),o=pc(i,e);if(s===$t.INTERSECTING||o===$t.INTERSECTING)n=!0;else{const r=i[0],a=i[1],c=i[2],h=i[3],l=t[0],u=t[1],d=e[0],p=e[1],_=(p-u)/(d-l);let y,w;o&$t.ABOVE&&!(s&$t.ABOVE)&&(y=d-(p-h)/_,n=y>=r&&y<=c),!n&&o&$t.RIGHT&&!(s&$t.RIGHT)&&(w=p-(d-c)*_,n=w>=a&&w<=h),!n&&o&$t.BELOW&&!(s&$t.BELOW)&&(y=d-(p-a)/_,n=y>=r&&y<=c),!n&&o&$t.LEFT&&!(s&$t.LEFT)&&(w=p-(d-r)*_,n=w>=a&&w<=h)}return n}function t0(i,t,e,n){if(Hi(i))return no(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 Vp(o,r,e)}function ou(i,t){const e=t.getExtent(),n=Yi(i);if(t.canWrapX()&&(n[0]<e[0]||n[0]>=e[2])){const s=_t(e),r=Math.floor((n[0]-e[0])/s)*s;i[0]-=r,i[2]-=r}return i}function e0(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]]];ou(i,t);const n=_t(e);if(_t(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 oo=6378137,hs=Math.PI*oo,i0=[-hs,-hs,hs,hs],n0=[-180,-85,180,85],Tr=oo*Math.log(Math.tan(Math.PI/2));class ls extends vc{constructor(t){super({code:t,units:"m",extent:i0,global:!0,worldExtent:n0,getPointResolution:function(e,n){return e/Math.cosh(n[1]/oo)}})}}const ru=[new ls("EPSG:3857"),new ls("EPSG:102100"),new ls("EPSG:102113"),new ls("EPSG:900913"),new ls("http://www.opengis.net/def/crs/EPSG/0/3857"),new ls("http://www.opengis.net/gml/srs/epsg.xml#3857")];function s0(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]=hs*i[s]/180;let o=oo*Math.log(Math.tan(Math.PI*(+i[s+1]+90)/360));o>Tr?o=Tr:o<-Tr&&(o=-Tr),t[s+1]=o}return t}function o0(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]/hs,t[s+1]=360*Math.atan(Math.exp(i[s+1]/oo))/Math.PI-90;return t}const r0=6378137,au=[-180,-90,180,90],a0=Math.PI*r0/180;class An extends vc{constructor(t,e){super({code:t,units:"degrees",extent:au,axisOrientation:e,global:!0,metersPerUnit:a0,worldExtent:au})}}const cu=[new An("CRS:84"),new An("EPSG:4326","neu"),new An("urn:ogc:def:crs:OGC:1.3:CRS84"),new An("urn:ogc:def:crs:OGC:2:84"),new An("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new An("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new An("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Ec={};function c0(i){return Ec[i]||Ec[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function h0(i,t){Ec[i]=t}let us={};function ds(i,t,e){const n=i.getCode(),s=t.getCode();n in us||(us[n]={}),us[n][s]=e}function l0(i,t){let e;return i in us&&t in us[i]&&(e=us[i][t]),e}function qt(i,t,e){return Math.min(Math.max(i,t),e)}function u0(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 Mn(i,t,e,n)}function Mn(i,t,e,n){const s=e-i,o=n-t;return s*s+o*o}function d0(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 Ar(i){return i*Math.PI/180}function Xi(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 Mr(i,t){return Math.floor(Cc(i,t))}function Dr(i,t){return Math.ceil(Cc(i,t))}function f0(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 g0(i,t){return i[0]+=+t[0],i[1]+=+t[1],i}function Fr(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 p0(i,t){return i[0]*=t,i[1]*=t,i}function hu(i,t){if(t.canWrapX()){const e=_t(t.getExtent()),n=m0(i,t,e);n&&(i[0]-=n*e)}return i}function m0(i,t,e){const n=t.getExtent();let s=0;return t.canWrapX()&&(i[0]<n[0]||i[0]>n[2])&&(e=e||_t(n),s=Math.floor((i[0]-n[0])/e)),s}const lu=63710088e-1;function xc(i,t,e){e=e||lu;const n=Ar(i[1]),s=Ar(t[1]),o=(s-n)/2,r=Ar(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 Rc(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 uu(i,t){t=t||{};const e=t.radius||lu,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=Rc(r,e);break}case"MultiLineString":case"Polygon":{for(r=i.getCoordinates(),c=0,h=r.length;c<h;++c)o+=Rc(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+=Rc(a[l],e);break}case"GeometryCollection":{const d=i.getGeometries();for(c=0,h=d.length;c<h;++c)o+=uu(d[c],t);break}default:throw new Error("Unsupported geometry type: "+s)}return o}function du(...i){console.warn(...i)}let Sc=!0;function fu(i){Sc=!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 gu(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 pu(i){h0(i.getCode(),i),ds(i,i,Pc)}function _0(i){i.forEach(pu)}function Gt(i){return typeof i=="string"?c0(i):i||null}function mu(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===gu&&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 _u(i){_0(i),i.forEach(function(t){i.forEach(function(e){t!==e&&ds(t,e,Pc)})})}function y0(i,t,e,n){i.forEach(function(s){t.forEach(function(o){ds(s,o,e),ds(o,s,n)})})}function Oc(i,t){return i?typeof i=="string"?Gt(i):i:Gt(t)}function yu(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 wu(i,t,e,n){const s=Gt(i),o=Gt(t);ds(s,o,yu(e)),ds(o,s,yu(n))}function vt(i,t){return fu(),ro(i,"EPSG:4326",t!==void 0?t:"EPSG:3857")}function Zt(i,t){const e=ro(i,"EPSG:3857","EPSG:4326"),n=e[0];return(n<-180||n>180)&&(e[0]=Xi(n+180,360)-180),e}function $i(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=l0(e,n);return s||(s=gu),s}function Dn(i,t){const e=Gt(i),n=Gt(t);return Ic(e,n)}function ro(i,t,e){return Dn(t,e)(i,void 0,i.length)}function vu(i,t,e,n){const s=Dn(t,e);return t0(i,s,void 0)}function Tc(i,t){return i}function gi(i,t){return Sc&&!Fr(i,[0,0])&&i[0]>=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(Sc=!1,du("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i}function Eu(i,t){return i}function pi(i,t){return i}function w0(){_u(ru),_u(cu),y0(cu,ru,s0,o0)}w0();function mi(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 Cu(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 d=t;d<e;d+=n){const p=i[d]-h,_=i[d+1]-l;r[u++]=h+p*a-_*c,r[u++]=l+p*c+_*a;for(let y=d+2;y<d+n;++y)r[u++]=i[y]}return r&&r.length!=u&&(r.length=u),r}function v0(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 d=i[u]-c,p=i[u+1]-h;a[l++]=c+s*d,a[l++]=h+o*p;for(let _=u+2;_<u+n;++_)a[l++]=i[_]}return a&&a.length!=l&&(a.length=l),a}function E0(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 bu=be();class C0 extends Ze{constructor(){super(),this.extent_=Te(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=Dp(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 wt()}closestPointXY(t,e,n,s){return wt()}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 wt()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&no(e),this.extentRevision_=this.getRevision()}return Kp(this.extent_,t)}rotate(t,e){wt()}scale(t,e,n){wt()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return wt()}getType(){return wt()}applyTransform(t){wt()}intersectsExtent(t){return wt()}translate(t,e){wt()}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(bu,h[0],h[3],l,-l,0,0,0),mi(o,0,o.length,a,bu,r),Dn(n,e)(o,r,a)}:Dn(n,e);return this.applyTransform(s),this}}class fs extends C0{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates=null}computeExtent(t){return Hp(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return wt()}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=xu(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){wt()}setLayout(t,e,n){let s;if(t)s=xu(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=b0(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();Cu(n,0,n.length,s,t,e,n),this.changed()}}scale(t,e,n){e===void 0&&(e=t),n||(n=Yi(this.getExtent()));const s=this.getFlatCoordinates();if(s){const o=this.getStride();v0(s,0,s.length,o,t,e,n,s),this.changed()}}translate(t,e){const n=this.getFlatCoordinates();if(n){const s=this.getStride();E0(n,0,n.length,s,t,e,n),this.changed()}}}function b0(i){let t;return i==2?t="XY":i==3?t="XYZ":i==4&&(t="XYZM"),t}function xu(i){let t;return i=="XY"?t=2:i=="XYZ"||i=="XYM"?t=3:i=="XYZM"&&(t=4),t}function x0(i,t,e){const n=i.getFlatCoordinates();if(!n)return null;const s=i.getStride();return mi(n,0,n.length,s,t,e)}function Ru(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 d=((s-a)*h+(o-c)*l)/(h*h+l*l);if(d>1)u=e;else if(d>0){for(let p=0;p<n;++p)r[p]=xe(i[t+p],i[e+p],d);r.length=n;return}else u=t}for(let d=0;d<n;++d)r[d]=i[u+d];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=Mn(o,r,a,c);h>s&&(s=h),o=a,r=c}return s}function Su(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,d;if(s===0){if(d=Mn(r,a,i[t],i[t+1]),d<h){for(u=0;u<n;++u)c[u]=i[t+u];return c.length=n,d}return h}l=l||[NaN,NaN];let p=t+n;for(;p<e;)if(Ru(i,p-n,p,n,r,a,l),d=Mn(r,a,l[0],l[1]),d<h){for(h=d,u=0;u<n;++u)c[u]=l[u];c.length=n,p+=n}else p+=n*Math.max((Math.sqrt(d)-Math.sqrt(h))/s|0,1);if(o&&(Ru(i,e-n,t,n,r,a,l),d=Mn(r,a,l[0],l[1]),d<h)){for(h=d,u=0;u<n;++u)c[u]=l[u];c.length=n}return h}function Pu(i,t,e,n,s,o,r,a,c,h,l){l=l||[NaN,NaN];for(let u=0,d=e.length;u<d;++u){const p=e[u];h=Mc(i,t,p,n,s,o,r,a,c,h,l),t=p}return h}function R0(i,t,e,n){for(let s=0,o=e.length;s<o;++s)i[t++]=e[s];return t}function Lr(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 Ou(i,t,e,n,s){s=s||[];let o=0;for(let r=0,a=e.length;r<a;++r){const c=Lr(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(),d=h.pop();let p=0;const _=i[d],y=i[d+1],w=i[u],E=i[u+1];for(let b=d+n;b<u;b+=n){const P=i[b],I=i[b+1],M=u0(P,I,_,y,w,E);M>p&&(l=b,p=M)}p>s&&(c[(l-t)/n]=1,d+n<l&&h.push(d,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 S0(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 Fn(i,t){return t*Math.round(i/t)}function P0(i,t,e,n,s,o,r){if(t==e)return r;let a=Fn(i[t],s),c=Fn(i[t+1],s);t+=n,o[r++]=a,o[r++]=c;let h,l;do if(h=Fn(i[t],s),l=Fn(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=Fn(i[t],s),d=Fn(i[t+1],s);if(t+=n,u==h&&d==l)continue;const p=h-a,_=l-c,y=u-a,w=d-c;if(p*w==_*y&&(p<0&&y<p||p==y||p>0&&y>p)&&(_<0&&w<_||_==w||_>0&&w>_)){h=u,l=d;continue}o[r++]=h,o[r++]=l,a=h,c=l,h=u,l=d}return o[r++]=h,o[r++]=l,r}function O0(i,t,e,n,s,o,r,a){for(let c=0,h=e.length;c<h;++c){const l=e[c];r=P0(i,t,l,n,s,o,r),a.push(r),t=l}return r}function Zi(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 ao(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++]=Zi(i,t,c,n,s[o]),t=c}return s.length=o,s}function Iu(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?[]:ao(i,t,c,n,s[o]),t=c[c.length-1]}return s.length=o,s}function Tu(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 I0(i,t,e,n){let s=0;for(let o=0,r=e.length;o<r;++o){const a=e[o];s+=Tu(i,t,a,n),t=a}return s}class co extends fs{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 co(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,n,s){return s<eo(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 Tu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Zi(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 co(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Lr(this.flatCoordinates,0,t,this.stride),this.changed()}}class Ke extends fs{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new Ke(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,n,s){const o=this.flatCoordinates,r=Mn(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 Yp(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=R0(this.flatCoordinates,0,t,this.stride),this.changed()}}function T0(i,t,e,n,s){return!su(s,function(r){return!Ln(i,t,e,n,r[0],r[1])})}function Ln(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 Au(i,t,e,n,s,o){if(e.length===0||!Ln(i,t,e[0],n,s,o))return!1;for(let r=1,a=e.length;r<a;++r)if(Ln(i,e[r-1],e[r],n,s,o))return!1;return!0}function A0(i,t,e,n,s,o,r){let a,c,h,l,u,d,p;const _=s[o+1],y=[];for(let b=0,P=e.length;b<P;++b){const I=e[b];for(l=i[I-n],d=i[I-n+1],a=t;a<I;a+=n)u=i[a],p=i[a+1],(_<=d&&p<=_||d<=_&&_<=p)&&(h=(_-d)/(p-d)*(u-l)+l,y.push(h)),l=u,d=p}let w=NaN,E=-1/0;for(y.sort(Pn),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,Au(i,t,e,n,h,_)&&(w=h,E=b)),l=u}return isNaN(w)&&(w=s[o]),[w,_,E]}function Mu(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 zr(i,t,e,n,s){const o=nu(Te(),i,t,e,n);return te(s,o)?In(s,o)||o[0]>=s[0]&&o[2]<=s[2]||o[1]>=s[1]&&o[3]<=s[3]?!0:Mu(i,t,e,n,function(r,a){return Jp(s,r,a)}):!1}function M0(i,t,e,n,s){for(let o=0,r=e.length;o<r;++o){if(zr(i,t,e[o],n,s))return!0;t=e[o]}return!1}function Du(i,t,e,n,s){return!!(zr(i,t,e,n,s)||Ln(i,t,e,n,s[0],s[1])||Ln(i,t,e,n,s[0],s[3])||Ln(i,t,e,n,s[2],s[1])||Ln(i,t,e,n,s[2],s[3]))}function D0(i,t,e,n,s){if(!Du(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(T0(i,e[o-1],e[o],n,s)&&!zr(i,e[o-1],e[o],n,s))return!1;return!0}function F0(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 Fu(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 L0(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=Fu(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 Lu(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=Fu(i,t,a,n);(o===0?s&&c||!s&&!c:s&&!c||!s&&c)&&F0(i,t,a,n),t=a}return t}class gs extends fs{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?On(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new gs(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,n,s){return s<eo(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Su(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Pu(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,n,s))}containsXY(t,e){return Au(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return I0(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),Lu(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,ao(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=Yi(this.getExtent());this.flatInteriorPoint_=A0(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Ke(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new co(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 co(e.slice(o,c),t);s.push(h),o=c}return s}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;L0(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Lu(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],n=[];return e.length=O0(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,n),new gs(e,"XY",n)}getType(){return"Polygon"}intersectsExtent(t){return D0(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const n=Ou(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(Hi(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 gs(o,"XY",[o.length])}const ue={ADD:"add",REMOVE:"remove"},zu={LENGTH:"length"};class Nr extends We{constructor(t,e,n){super(t),this.element=e,this.index=n}}class Qe extends Ze{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(zu.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 Nr(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 Nr(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 Nr(ue.REMOVE,s,t)),this.dispatchEvent(new Nr(ue.ADD,e,t))}updateLength_(){this.set(zu.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 tu(58)}}class Je extends Ze{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?z0(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 z0(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 Nu(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],d=0;const p=[0];for(let w=t+n;w<e;w+=n){const E=i[w],b=i[w+1];d+=Math.sqrt((E-l)*(E-l)+(b-u)*(b-u)),p.push(d),l=E,u=b}const _=s*d,y=Tp(p,_);y<0?(c=(_-p[-y-2])/(p[-y-1]-p[-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 d=a+c>>1;s<i[(d+1)*n-1]?c=d:a=d+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 d=0;d<n-1;++d)r.push(xe(i[(a-1)*n+d],i[a*n+d],u));return r.push(s),r}function N0(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 Uu(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 _i extends fs{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?On(this.flatCoordinates,t):this.flatCoordinates=t.slice(),this.changed()}clone(){const t=new _i(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,n,s){return s<eo(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 Mu(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 Zi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return Nu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return Uu(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 _i(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return zr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Lr(this.flatCoordinates,0,t,this.stride),this.changed()}}class Re{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 Re({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 ju(i,t,e){return e===void 0&&(e=[0,0]),e[0]=i[0]+2*t,e[1]=i[1]+2*t,e}function ku(i){return i[0]>0&&i[1]>0}function Wu(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 Ur{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 Ur({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 wt()}getImage(t){return wt()}getHitDetectionImage(){return wt()}getPixelRatio(t){return 1}getImageState(){return wt()}getImageSize(){return wt()}getOrigin(){return wt()}getSize(){return wt()}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){wt()}load(){wt()}unlistenImageChange(t){wt()}}const U0=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,j0=/^([a-z]*)$|^hsla?\(.*\)$/i;function qu(i){return typeof i=="string"?i:Bu(i)}function k0(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 W0=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=q0(n),t[n]=s,++e}return s}}();function jr(i){return Array.isArray(i)?i:W0(i)}function q0(i){let t,e,n,s,o;if(j0.exec(i)&&(i=k0(i)),U0.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),Gu(o)):i.startsWith("rgb(")?(o=i.slice(4,-1).split(",").map(Number),o.push(1),Gu(o)):pt(!1,14);return o}function Gu(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 Bu(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)?Bu(i):i}function Bt(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 kr(i){const t=i.canvas;t.width=1,t.height=1,i.clearRect(0,0,1,1)}function Vu(i,t){const e=t.parentNode;e&&e.replaceChild(i,t)}function zc(i){return i&&i.parentNode?i.parentNode.removeChild(i):null}function G0(i){for(;i.lastChild;)i.removeChild(i.lastChild)}function B0(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 Wr="ol-hidden",qr="ol-unselectable",Nc="ol-control",Yu="ol-collapsed",V0=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"),Hu=["style","variant","weight","size","lineHeight","family"],Xu=function(i){const t=i.match(V0);if(!t)return null;const e={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"};for(let n=0,s=Hu.length;n<s;++n){const o=t[n+1];o!==void 0&&(e[Hu[n]]=o)}return e.families=e.family.split(/,\s?/),e},$u="10px sans-serif",ge="#000",Gr="round",yi=[],wi=0,ps="round",ho=10,lo="#000",uo="center",Br="middle",zn=[0,0,0,0],fo=1,vi=new Ze;let ms=null,Uc;const jc={},Y0=function(){const t="32px ",e=["monospace","serif"],n=e.length,s="wmytzilWMYTZIL@#/&?$%10";let o,r;function a(h,l,u){let d=!0;for(let p=0;p<n;++p){const _=e[p];if(r=Vr(h+" "+l+" "+t+_,s),u!=_){const y=Vr(h+" "+l+" "+t+u+","+_,s);d=d&&y!=r}}return!!d}function c(){let h=!0;const l=vi.getKeys();for(let u=0,d=l.length;u<d;++u){const p=l[u];vi.get(p)<100&&(a.apply(this,p.split(`
22
- `))?(Zs(jc),ms=null,Uc=void 0,vi.set(p,100)):(vi.set(p,vi.get(p)+1,!0),h=!1))}h&&(clearInterval(o),o=void 0)}return function(h){const l=Xu(h);if(!l)return;const u=l.families;for(let d=0,p=u.length;d<p;++d){const _=u[d],y=l.style+`
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 f.Destroyable{constructor(){super()}}S(le,"defaults",{enabled:!0}),(i=>{i.createDefaultProps=()=>({enabled:!0})})(le||(le={})),f.extendClassProps(le.prototype,le.createDefaultProps);function Kl(i){return Math.pow(i,3)}function Sn(i){return 1-Kl(1-i)}function Tp(i){return 3*i*i-2*i*i*i}function Ap(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 as={PROPERTYCHANGE:"propertychange"};class Er{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function Mp(i,t,e){let n,s;e=e||Pn;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 Pn(i,t){return i>t?1:i<t?-1:0}function Cr(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 Dp(i,t,e){for(;t<e;){const n=i[t];i[t]=i[e],i[e]=n,++t,--e}}function On(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 qi(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 Fp(i,t,e){const n=t||Pn;return i.every(function(s,o){if(o===0)return!0;const r=n(i[o-1],s);return!(r>0||r===0)})}function $s(){return!0}function br(){return!1}function cs(){}function Lp(i){let t=!1,e,n,s;return function(){const o=Array.prototype.slice.call(arguments);return(!t||this!==s||!qi(o,n))&&(t=!0,s=this,n=o,e=i.apply(this,arguments)),e}}function Zs(i){for(const t in i)delete i[t]}function Ks(i){let t;for(t in i)return!1;return!t}class Qs extends Er{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,cs);delete r[n]}return c}disposeInternal(){this.listeners_&&Zs(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]=cs,++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 xr(i,t,e,n){return Ct(i,t,e,n,!0)}function Mt(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),Zs(i))}class Js extends Qs{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]=xr(this,t[o],e)}else n=xr(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)}}Js.prototype.on,Js.prototype.once,Js.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 wt(){throw new Error("Unimplemented abstract method.")}let zp=0;function Rt(i){return i.ol_uid||(i.ol_uid=String(++zp))}const Np="7.5.2";class Ql extends We{constructor(t,e,n){super(t),this.key=e,this.oldValue=n}}class Ze extends Js{constructor(t){super(),this.on,this.once,this.un,Rt(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 Ql(n,t,e)),n=as.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new Ql(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],Ks(this.values_)&&(this.values_=null),e||this.notify(t,n)}}}const Bi=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",Up=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 jp=Bi.includes("webkit")&&!Bi.includes("edge"),Jl=Bi.includes("macintosh"),tu=typeof devicePixelRatio<"u"?devicePixelRatio:1,dc=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,kp=typeof Image<"u"&&Image.prototype.decode,eu=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}(),Wp={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 iu extends Error{constructor(t){const e=Wp[t];super(e),this.code=t,this.name="AssertionError",this.message=e}}function pt(i,t){if(!i)throw new iu(t)}new Array(6);function be(){return[1,0,0,1,0,0]}function qp(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],d=t[4],p=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*d+s*p+r,i[5]=n*d+o*p+a,i}function Gp(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 Vp(i,t,e){return Gp(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 Rr(i,t){const e=Yp(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 Yp(i){return i[0]*i[3]-i[1]*i[2]}let nu;function fc(i){const t="matrix("+i.join(", ")+")";if(dc)return t;const e=nu||(nu=document.createElement("div"));return e.style.transform=t,e.style.transform}const $t={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Sr(i){const t=Te();for(let e=0,n=i.length;e<n;++e)so(t,i[e]);return t}function Hp(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 fi(n,s,o,r,e)}function to(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 su(i,t){return t?(t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t):i.slice()}function eo(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 io(i,t){return gc(i,t[0],t[1])}function In(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=$t.UNKNOWN;return r<e?c=c|$t.LEFT:r>s&&(c=c|$t.RIGHT),a<n?c=c|$t.BELOW:a>o&&(c=c|$t.ABOVE),c===$t.UNKNOWN&&(c=$t.INTERSECTING),c}function Te(){return[1/0,1/0,-1/0,-1/0]}function fi(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 no(i){return fi(1/0,1/0,-1/0,-1/0,i)}function Xp(i,t){const e=i[0],n=i[1];return fi(e,n,e,n,t)}function $p(i,t,e,n,s){const o=no(s);return ou(o,i,t,e,n)}function Vi(i,t){return i[0]==t[0]&&i[2]==t[2]&&i[1]==t[1]&&i[3]==t[3]}function Zp(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 so(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 ou(i,t,e,n,s){for(;e<n;e+=s)Kp(i,t[e],t[e+1]);return i}function Kp(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 ru(i,t){let e;return e=t(Pr(i)),e||(e=t(Or(i)),e)||(e=t(Ir(i)),e)||(e=t(Ae(i)),e)?e:!1}function mc(i){let t=0;return Hi(i)||(t=_t(i)*Ht(i)),t}function Pr(i){return[i[0],i[1]]}function Or(i){return[i[2],i[1]]}function Yi(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function Qp(i,t){let e;return t==="bottom-left"?e=Pr(i):t==="bottom-right"?e=Or(i):t==="top-left"?e=Ae(i):t==="top-right"?e=Ir(i):pt(!1,13),e}function _c(i,t,e,n,s){const[o,r,a,c,h,l,u,d]=yc(i,t,e,n);return fi(Math.min(o,a,h,u),Math.min(r,c,l,d),Math.max(o,a,h,u),Math.max(r,c,l,d),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,d=i[0],p=i[1];return[d-c+u,p-h-l,d-c-u,p-h+l,d+c-u,p+h+l,d+c+u,p+h-l,d-c+u,p-h-l]}function Ht(i){return i[3]-i[1]}function Tn(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]):no(n),n}function Ae(i){return[i[0],i[3]]}function Ir(i){return[i[2],i[3]]}function _t(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 Hi(i){return i[2]<i[0]||i[3]<i[1]}function Jp(i,t){return t?(t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t):i}function t0(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 e0(i,t,e){let n=!1;const s=pc(i,t),o=pc(i,e);if(s===$t.INTERSECTING||o===$t.INTERSECTING)n=!0;else{const r=i[0],a=i[1],c=i[2],h=i[3],l=t[0],u=t[1],d=e[0],p=e[1],_=(p-u)/(d-l);let y,w;o&$t.ABOVE&&!(s&$t.ABOVE)&&(y=d-(p-h)/_,n=y>=r&&y<=c),!n&&o&$t.RIGHT&&!(s&$t.RIGHT)&&(w=p-(d-c)*_,n=w>=a&&w<=h),!n&&o&$t.BELOW&&!(s&$t.BELOW)&&(y=d-(p-a)/_,n=y>=r&&y<=c),!n&&o&$t.LEFT&&!(s&$t.LEFT)&&(w=p-(d-r)*_,n=w>=a&&w<=h)}return n}function i0(i,t,e,n){if(Hi(i))return no(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 Hp(o,r,e)}function au(i,t){const e=t.getExtent(),n=Yi(i);if(t.canWrapX()&&(n[0]<e[0]||n[0]>=e[2])){const s=_t(e),r=Math.floor((n[0]-e[0])/s)*s;i[0]-=r,i[2]-=r}return i}function n0(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]]];au(i,t);const n=_t(e);if(_t(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 oo=6378137,hs=Math.PI*oo,s0=[-hs,-hs,hs,hs],o0=[-180,-85,180,85],Tr=oo*Math.log(Math.tan(Math.PI/2));class ls extends vc{constructor(t){super({code:t,units:"m",extent:s0,global:!0,worldExtent:o0,getPointResolution:function(e,n){return e/Math.cosh(n[1]/oo)}})}}const cu=[new ls("EPSG:3857"),new ls("EPSG:102100"),new ls("EPSG:102113"),new ls("EPSG:900913"),new ls("http://www.opengis.net/def/crs/EPSG/0/3857"),new ls("http://www.opengis.net/gml/srs/epsg.xml#3857")];function r0(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]=hs*i[s]/180;let o=oo*Math.log(Math.tan(Math.PI*(+i[s+1]+90)/360));o>Tr?o=Tr:o<-Tr&&(o=-Tr),t[s+1]=o}return t}function a0(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]/hs,t[s+1]=360*Math.atan(Math.exp(i[s+1]/oo))/Math.PI-90;return t}const c0=6378137,hu=[-180,-90,180,90],h0=Math.PI*c0/180;class An extends vc{constructor(t,e){super({code:t,units:"degrees",extent:hu,axisOrientation:e,global:!0,metersPerUnit:h0,worldExtent:hu})}}const lu=[new An("CRS:84"),new An("EPSG:4326","neu"),new An("urn:ogc:def:crs:OGC:1.3:CRS84"),new An("urn:ogc:def:crs:OGC:2:84"),new An("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new An("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new An("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Ec={};function l0(i){return Ec[i]||Ec[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function u0(i,t){Ec[i]=t}let us={};function ds(i,t,e){const n=i.getCode(),s=t.getCode();n in us||(us[n]={}),us[n][s]=e}function d0(i,t){let e;return i in us&&t in us[i]&&(e=us[i][t]),e}function qt(i,t,e){return Math.min(Math.max(i,t),e)}function f0(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 Mn(i,t,e,n)}function Mn(i,t,e,n){const s=e-i,o=n-t;return s*s+o*o}function g0(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 Ar(i){return i*Math.PI/180}function Xi(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 Mr(i,t){return Math.floor(Cc(i,t))}function Dr(i,t){return Math.ceil(Cc(i,t))}function p0(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 m0(i,t){return i[0]+=+t[0],i[1]+=+t[1],i}function Fr(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 _0(i,t){return i[0]*=t,i[1]*=t,i}function uu(i,t){if(t.canWrapX()){const e=_t(t.getExtent()),n=y0(i,t,e);n&&(i[0]-=n*e)}return i}function y0(i,t,e){const n=t.getExtent();let s=0;return t.canWrapX()&&(i[0]<n[0]||i[0]>n[2])&&(e=e||_t(n),s=Math.floor((i[0]-n[0])/e)),s}const du=63710088e-1;function xc(i,t,e){e=e||du;const n=Ar(i[1]),s=Ar(t[1]),o=(s-n)/2,r=Ar(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 Rc(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 fu(i,t){t=t||{};const e=t.radius||du,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=Rc(r,e);break}case"MultiLineString":case"Polygon":{for(r=i.getCoordinates(),c=0,h=r.length;c<h;++c)o+=Rc(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+=Rc(a[l],e);break}case"GeometryCollection":{const d=i.getGeometries();for(c=0,h=d.length;c<h;++c)o+=fu(d[c],t);break}default:throw new Error("Unsupported geometry type: "+s)}return o}function gu(...i){console.warn(...i)}let Sc=!0;function pu(i){Sc=!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 mu(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 _u(i){u0(i.getCode(),i),ds(i,i,Pc)}function w0(i){i.forEach(_u)}function Gt(i){return typeof i=="string"?l0(i):i||null}function yu(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===mu&&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 wu(i){w0(i),i.forEach(function(t){i.forEach(function(e){t!==e&&ds(t,e,Pc)})})}function v0(i,t,e,n){i.forEach(function(s){t.forEach(function(o){ds(s,o,e),ds(o,s,n)})})}function Oc(i,t){return i?typeof i=="string"?Gt(i):i:Gt(t)}function vu(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 Eu(i,t,e,n){const s=Gt(i),o=Gt(t);ds(s,o,vu(e)),ds(o,s,vu(n))}function vt(i,t){return pu(),ro(i,"EPSG:4326",t!==void 0?t:"EPSG:3857")}function Zt(i,t){const e=ro(i,"EPSG:3857","EPSG:4326"),n=e[0];return(n<-180||n>180)&&(e[0]=Xi(n+180,360)-180),e}function $i(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=d0(e,n);return s||(s=mu),s}function Dn(i,t){const e=Gt(i),n=Gt(t);return Ic(e,n)}function ro(i,t,e){return Dn(t,e)(i,void 0,i.length)}function Cu(i,t,e,n){const s=Dn(t,e);return i0(i,s,void 0)}function Tc(i,t){return i}function gi(i,t){return Sc&&!Fr(i,[0,0])&&i[0]>=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(Sc=!1,gu("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i}function bu(i,t){return i}function pi(i,t){return i}function E0(){wu(cu),wu(lu),v0(lu,cu,r0,a0)}E0();function mi(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 xu(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 d=t;d<e;d+=n){const p=i[d]-h,_=i[d+1]-l;r[u++]=h+p*a-_*c,r[u++]=l+p*c+_*a;for(let y=d+2;y<d+n;++y)r[u++]=i[y]}return r&&r.length!=u&&(r.length=u),r}function C0(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 d=i[u]-c,p=i[u+1]-h;a[l++]=c+s*d,a[l++]=h+o*p;for(let _=u+2;_<u+n;++_)a[l++]=i[_]}return a&&a.length!=l&&(a.length=l),a}function b0(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 x0 extends Ze{constructor(){super(),this.extent_=Te(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=Lp(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 wt()}closestPointXY(t,e,n,s){return wt()}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 wt()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&no(e),this.extentRevision_=this.getRevision()}return Jp(this.extent_,t)}rotate(t,e){wt()}scale(t,e,n){wt()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return wt()}getType(){return wt()}applyTransform(t){wt()}intersectsExtent(t){return wt()}translate(t,e){wt()}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),mi(o,0,o.length,a,Ru,r),Dn(n,e)(o,r,a)}:Dn(n,e);return this.applyTransform(s),this}}class fs extends x0{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates=null}computeExtent(t){return $p(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return wt()}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=Su(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){wt()}setLayout(t,e,n){let s;if(t)s=Su(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=R0(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();xu(n,0,n.length,s,t,e,n),this.changed()}}scale(t,e,n){e===void 0&&(e=t),n||(n=Yi(this.getExtent()));const s=this.getFlatCoordinates();if(s){const o=this.getStride();C0(s,0,s.length,o,t,e,n,s),this.changed()}}translate(t,e){const n=this.getFlatCoordinates();if(n){const s=this.getStride();b0(n,0,n.length,s,t,e,n),this.changed()}}}function R0(i){let t;return i==2?t="XY":i==3?t="XYZ":i==4&&(t="XYZM"),t}function Su(i){let t;return i=="XY"?t=2:i=="XYZ"||i=="XYM"?t=3:i=="XYZM"&&(t=4),t}function S0(i,t,e){const n=i.getFlatCoordinates();if(!n)return null;const s=i.getStride();return mi(n,0,n.length,s,t,e)}function Pu(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 d=((s-a)*h+(o-c)*l)/(h*h+l*l);if(d>1)u=e;else if(d>0){for(let p=0;p<n;++p)r[p]=xe(i[t+p],i[e+p],d);r.length=n;return}else u=t}for(let d=0;d<n;++d)r[d]=i[u+d];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=Mn(o,r,a,c);h>s&&(s=h),o=a,r=c}return s}function Ou(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,d;if(s===0){if(d=Mn(r,a,i[t],i[t+1]),d<h){for(u=0;u<n;++u)c[u]=i[t+u];return c.length=n,d}return h}l=l||[NaN,NaN];let p=t+n;for(;p<e;)if(Pu(i,p-n,p,n,r,a,l),d=Mn(r,a,l[0],l[1]),d<h){for(h=d,u=0;u<n;++u)c[u]=l[u];c.length=n,p+=n}else p+=n*Math.max((Math.sqrt(d)-Math.sqrt(h))/s|0,1);if(o&&(Pu(i,e-n,t,n,r,a,l),d=Mn(r,a,l[0],l[1]),d<h)){for(h=d,u=0;u<n;++u)c[u]=l[u];c.length=n}return h}function Iu(i,t,e,n,s,o,r,a,c,h,l){l=l||[NaN,NaN];for(let u=0,d=e.length;u<d;++u){const p=e[u];h=Mc(i,t,p,n,s,o,r,a,c,h,l),t=p}return h}function P0(i,t,e,n){for(let s=0,o=e.length;s<o;++s)i[t++]=e[s];return t}function Lr(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 Tu(i,t,e,n,s){s=s||[];let o=0;for(let r=0,a=e.length;r<a;++r){const c=Lr(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(),d=h.pop();let p=0;const _=i[d],y=i[d+1],w=i[u],E=i[u+1];for(let b=d+n;b<u;b+=n){const P=i[b],I=i[b+1],M=f0(P,I,_,y,w,E);M>p&&(l=b,p=M)}p>s&&(c[(l-t)/n]=1,d+n<l&&h.push(d,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 O0(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 Fn(i,t){return t*Math.round(i/t)}function I0(i,t,e,n,s,o,r){if(t==e)return r;let a=Fn(i[t],s),c=Fn(i[t+1],s);t+=n,o[r++]=a,o[r++]=c;let h,l;do if(h=Fn(i[t],s),l=Fn(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=Fn(i[t],s),d=Fn(i[t+1],s);if(t+=n,u==h&&d==l)continue;const p=h-a,_=l-c,y=u-a,w=d-c;if(p*w==_*y&&(p<0&&y<p||p==y||p>0&&y>p)&&(_<0&&w<_||_==w||_>0&&w>_)){h=u,l=d;continue}o[r++]=h,o[r++]=l,a=h,c=l,h=u,l=d}return o[r++]=h,o[r++]=l,r}function T0(i,t,e,n,s,o,r,a){for(let c=0,h=e.length;c<h;++c){const l=e[c];r=I0(i,t,l,n,s,o,r),a.push(r),t=l}return r}function Zi(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 ao(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++]=Zi(i,t,c,n,s[o]),t=c}return s.length=o,s}function Au(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?[]:ao(i,t,c,n,s[o]),t=c[c.length-1]}return s.length=o,s}function Mu(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 A0(i,t,e,n){let s=0;for(let o=0,r=e.length;o<r;++o){const a=e[o];s+=Mu(i,t,a,n),t=a}return s}class co extends fs{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 co(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,n,s){return s<eo(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 Mu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Zi(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 co(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Lr(this.flatCoordinates,0,t,this.stride),this.changed()}}class Ke extends fs{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new Ke(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,n,s){const o=this.flatCoordinates,r=Mn(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 Xp(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=P0(this.flatCoordinates,0,t,this.stride),this.changed()}}function M0(i,t,e,n,s){return!ru(s,function(r){return!Ln(i,t,e,n,r[0],r[1])})}function Ln(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 Du(i,t,e,n,s,o){if(e.length===0||!Ln(i,t,e[0],n,s,o))return!1;for(let r=1,a=e.length;r<a;++r)if(Ln(i,e[r-1],e[r],n,s,o))return!1;return!0}function D0(i,t,e,n,s,o,r){let a,c,h,l,u,d,p;const _=s[o+1],y=[];for(let b=0,P=e.length;b<P;++b){const I=e[b];for(l=i[I-n],d=i[I-n+1],a=t;a<I;a+=n)u=i[a],p=i[a+1],(_<=d&&p<=_||d<=_&&_<=p)&&(h=(_-d)/(p-d)*(u-l)+l,y.push(h)),l=u,d=p}let w=NaN,E=-1/0;for(y.sort(Pn),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,Du(i,t,e,n,h,_)&&(w=h,E=b)),l=u}return isNaN(w)&&(w=s[o]),[w,_,E]}function Fu(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 zr(i,t,e,n,s){const o=ou(Te(),i,t,e,n);return te(s,o)?In(s,o)||o[0]>=s[0]&&o[2]<=s[2]||o[1]>=s[1]&&o[3]<=s[3]?!0:Fu(i,t,e,n,function(r,a){return e0(s,r,a)}):!1}function F0(i,t,e,n,s){for(let o=0,r=e.length;o<r;++o){if(zr(i,t,e[o],n,s))return!0;t=e[o]}return!1}function Lu(i,t,e,n,s){return!!(zr(i,t,e,n,s)||Ln(i,t,e,n,s[0],s[1])||Ln(i,t,e,n,s[0],s[3])||Ln(i,t,e,n,s[2],s[1])||Ln(i,t,e,n,s[2],s[3]))}function L0(i,t,e,n,s){if(!Lu(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(M0(i,e[o-1],e[o],n,s)&&!zr(i,e[o-1],e[o],n,s))return!1;return!0}function z0(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 zu(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 N0(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=zu(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 Nu(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=zu(i,t,a,n);(o===0?s&&c||!s&&!c:s&&!c||!s&&c)&&z0(i,t,a,n),t=a}return t}class gs extends fs{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?On(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new gs(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,n,s){return s<eo(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Ou(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Iu(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,n,s))}containsXY(t,e){return Du(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return A0(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),Nu(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,ao(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=Yi(this.getExtent());this.flatInteriorPoint_=D0(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Ke(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new co(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 co(e.slice(o,c),t);s.push(h),o=c}return s}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;N0(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Nu(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],n=[];return e.length=T0(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,n),new gs(e,"XY",n)}getType(){return"Polygon"}intersectsExtent(t){return L0(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const n=Tu(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(Hi(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 gs(o,"XY",[o.length])}const ue={ADD:"add",REMOVE:"remove"},Uu={LENGTH:"length"};class Nr extends We{constructor(t,e,n){super(t),this.element=e,this.index=n}}class Qe extends Ze{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(Uu.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 Nr(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 Nr(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 Nr(ue.REMOVE,s,t)),this.dispatchEvent(new Nr(ue.ADD,e,t))}updateLength_(){this.set(Uu.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 iu(58)}}class Je extends Ze{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?U0(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 U0(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 ju(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],d=0;const p=[0];for(let w=t+n;w<e;w+=n){const E=i[w],b=i[w+1];d+=Math.sqrt((E-l)*(E-l)+(b-u)*(b-u)),p.push(d),l=E,u=b}const _=s*d,y=Mp(p,_);y<0?(c=(_-p[-y-2])/(p[-y-1]-p[-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 d=a+c>>1;s<i[(d+1)*n-1]?c=d:a=d+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 d=0;d<n-1;++d)r.push(xe(i[(a-1)*n+d],i[a*n+d],u));return r.push(s),r}function j0(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 ku(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 _i extends fs{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?On(this.flatCoordinates,t):this.flatCoordinates=t.slice(),this.changed()}clone(){const t=new _i(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,n,s){return s<eo(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 Fu(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 Zi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return ju(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return ku(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 _i(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return zr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Lr(this.flatCoordinates,0,t,this.stride),this.changed()}}class Re{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 Re({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 Wu(i,t,e){return e===void 0&&(e=[0,0]),e[0]=i[0]+2*t,e[1]=i[1]+2*t,e}function qu(i){return i[0]>0&&i[1]>0}function Gu(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 Ur{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 Ur({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 wt()}getImage(t){return wt()}getHitDetectionImage(){return wt()}getPixelRatio(t){return 1}getImageState(){return wt()}getImageSize(){return wt()}getOrigin(){return wt()}getSize(){return wt()}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){wt()}load(){wt()}unlistenImageChange(t){wt()}}const k0=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,W0=/^([a-z]*)$|^hsla?\(.*\)$/i;function Bu(i){return typeof i=="string"?i:Yu(i)}function q0(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 G0=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=B0(n),t[n]=s,++e}return s}}();function jr(i){return Array.isArray(i)?i:G0(i)}function B0(i){let t,e,n,s,o;if(W0.exec(i)&&(i=q0(i)),k0.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),Vu(o)):i.startsWith("rgb(")?(o=i.slice(4,-1).split(",").map(Number),o.push(1),Vu(o)):pt(!1,14);return o}function Vu(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 Yu(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)?Yu(i):i}function Bt(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 kr(i){const t=i.canvas;t.width=1,t.height=1,i.clearRect(0,0,1,1)}function Hu(i,t){const e=t.parentNode;e&&e.replaceChild(i,t)}function zc(i){return i&&i.parentNode?i.parentNode.removeChild(i):null}function V0(i){for(;i.lastChild;)i.removeChild(i.lastChild)}function Y0(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 Wr="ol-hidden",qr="ol-unselectable",Nc="ol-control",Xu="ol-collapsed",H0=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"),$u=["style","variant","weight","size","lineHeight","family"],Zu=function(i){const t=i.match(H0);if(!t)return null;const e={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"};for(let n=0,s=$u.length;n<s;++n){const o=t[n+1];o!==void 0&&(e[$u[n]]=o)}return e.families=e.family.split(/,\s?/),e},Ku="10px sans-serif",ge="#000",Gr="round",yi=[],wi=0,ps="round",ho=10,lo="#000",uo="center",Br="middle",zn=[0,0,0,0],fo=1,vi=new Ze;let ms=null,Uc;const jc={},X0=function(){const t="32px ",e=["monospace","serif"],n=e.length,s="wmytzilWMYTZIL@#/&?$%10";let o,r;function a(h,l,u){let d=!0;for(let p=0;p<n;++p){const _=e[p];if(r=Vr(h+" "+l+" "+t+_,s),u!=_){const y=Vr(h+" "+l+" "+t+u+","+_,s);d=d&&y!=r}}return!!d}function c(){let h=!0;const l=vi.getKeys();for(let u=0,d=l.length;u<d;++u){const p=l[u];vi.get(p)<100&&(a.apply(this,p.split(`
22
+ `))?(Zs(jc),ms=null,Uc=void 0,vi.set(p,100)):(vi.set(p,vi.get(p)+1,!0),h=!1))}h&&(clearInterval(o),o=void 0)}return function(h){const l=Zu(h);if(!l)return;const u=l.families;for(let d=0,p=u.length;d<p;++d){const _=u[d],y=l.style+`
23
23
  `+l.weight+`
24
- `+_;vi.get(y)===void 0&&(vi.set(y,100,!0),a(l.style,l.weight,_)||(vi.set(y,0,!0),o===void 0&&(o=setInterval(c,32))))}}}(),H0=function(){let i;return function(t){let e=jc[t];if(e==null){if(dc){const n=Xu(t),s=Zu(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 Zu(i,t){return ms||(ms=Bt(1,1)),i!=Uc&&(ms.font=i,Uc=ms.font),ms.measureText(t)}function Vr(i,t){return Zu(i,t).width}function Ku(i,t,e){if(t in e)return e[t];const n=t.split(`
25
- `).reduce((s,o)=>Math.max(s,Vr(i,o)),0);return e[t]=n,n}function X0(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 d=t[h+1]||i.font,p=Vr(d,u);e.push(p),r+=p;const _=H0(d);n.push(_),c=Math.max(c,_)}return{width:o,height:a,widths:e,heights:n,lineWidths:s}}function $0(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]),Z0(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 Z0(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 go extends Ur{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 go({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=Bt(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),d=u/c;if(t==="miter"&&d<=n)return d*e;const p=e/2/d,_=e/2*(l/u),w=Math.sqrt((s+p)*(s+p)+_*_)-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=ps,e=0,n=null,s=0,o,r=0;this.stroke_&&(o=this.stroke_.getColor(),o===null&&(o=lo),o=ei(o),r=this.stroke_.getWidth(),r===void 0&&(r=fo),n=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset(),t=this.stroke_.getLineJoin(),t===void 0&&(t=ps),e=this.stroke_.getMiterLimit(),e===void 0&&(e=ho));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=jr(e)),e===null?n=1:Array.isArray(e)&&(n=e.length===4?e[3]:1),n===0){const s=Bt(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 go{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 Kt{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=Qu,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 Kt({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_=Qu,this.geometry_=t}setZIndex(t){this.zIndex_=t}}function K0(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 Q0(i,t){if(!kc){const e=new de({color:"rgba(255,255,255,0.4)"}),n=new Re({color:"#3399CC",width:1.25});kc=[new Kt({image:new ii({fill:e,stroke:n,radius:5}),fill:e,stroke:n})]}return kc}function Qu(i){return i.getGeometry()}const J0="#333";class po{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:J0}),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 po({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 Ju extends Ze{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 wt()}getLayerStatesArray(t){return wt()}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 wt()}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 Vt={ANIMATING:0,INTERACTING:1},Ge={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"},tm=42,Wc=256;function td(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 d=i[0]+c/2+l,p=i[2]-c/2+l,_=i[1]+h/2+u,y=i[3]-h/2+u;d>p&&(d=(p+d)/2,p=d),_>y&&(_=(y+_)/2,y=_);let w=qt(n[0],d,p),E=qt(n[1],_,y);if(r&&e&&s){const b=30*s;w+=-b*Math.log(1+Math.max(0,d-n[0])/b)+b*Math.log(1+Math.max(0,n[0]-p)/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 em(i){return i}function qc(i,t,e,n){const s=_t(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 im(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),d=Math.floor(Cr(i,u,o));return i[d]>l&&d<i.length-1?i[d+1]:i[d]}}}function nm(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,d=Math.ceil(Math.log(t/l)/Math.log(i)-u),p=-a*(.5-u)+.5,_=Math.min(l,r),y=Math.floor(Math.log(t/_)/Math.log(i)+p),w=Math.max(d,y),E=t/Math.pow(i,w);return qt(E,e,l)}}}function ed(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 Bc(i){if(i!==void 0)return 0}function id(i){if(i!==void 0)return i}function sm(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 om(i){return i=i||Ar(5),function(t,e){if(e)return t;if(t!==void 0)return Math.abs(t)<=i?0:t}}const Vc=0;class ni extends Ze{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&&fu(),t.center&&(t.center=gi(t.center,this.projection_)),t.extent&&(t.extent=pi(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const a in Ge)delete e[a];this.setProperties(e,!0);const n=am(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=rm(t),o=n.constraint,r=cm(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=gi(s.center,this.getProjection())),s.anchor&&(s=Object.assign({},s),s.anchor=gi(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&&Yr(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||Op,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 d=Xi(l.rotation-c+Math.PI,2*Math.PI)-Math.PI;u.targetRotation=c+d,c=u.targetRotation}hm(u)?u.complete=!0:o+=u.duration,h.push(u)}this.animations_.push(h),this.setHint(Vt.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[Vt.ANIMATING]>0}getInteracting(){return this.hints_[Vt.INTERACTING]>0}cancelAnimations(){this.setHint(Vt.ANIMATING,-this.hints_[Vt.ANIMATING]);let t;for(let e=0,n=this.animations_.length;e<n;++e){const s=this.animations_[e];if(s[0].callback&&Yr(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 d=c.sourceCenter[0],p=c.sourceCenter[1],_=c.targetCenter[0],y=c.targetCenter[1];this.nextCenter_=c.targetCenter;const w=d+u*(_-d),E=p+u*(y-p);this.targetCenter_=[w,E]}if(c.sourceResolution&&c.targetResolution){const d=u===1?c.targetResolution:c.sourceResolution+u*(c.targetResolution-c.sourceResolution);if(c.anchor){const p=this.getViewportSize_(this.getRotation()),_=this.constraints_.resolution(d,0,p,!0);this.targetCenter_=this.calculateCenterZoom(_,c.anchor)}this.nextResolution_=c.targetResolution,this.targetResolution_=d,this.applyTargetState_(!0)}if(c.sourceRotation!==void 0&&c.targetRotation!==void 0){const d=u===1?Xi(c.targetRotation+Math.PI,2*Math.PI)-Math.PI:c.sourceRotation+u*(c.targetRotation-c.sourceRotation);if(c.anchor){const p=this.constraints_.rotation(d,!0);this.targetCenter_=this.calculateCenterRotate(p,c.anchor)}this.nextRotation_=c.targetRotation,this.targetRotation_=d}if(this.applyTargetState_(!0),e=!0,!c.complete)break}if(o){this.animations_[n]=null,this.setHint(Vt.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const r=s[0].callback;r&&Yr(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()),g0(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(Ge.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 Eu(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(Ge.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(pi(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const n=_t(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(Ge.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=Cr(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(!Hi(t),25);const s=pi(t,this.getProjection());n=Fc(s)}else if(t.getType()==="Circle"){const s=pi(t.getExtent(),this.getProjection());n=Fc(s),n.rotate(this.getRotation(),Yi(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,d=o.length;u<d;u+=r){const p=o[u]*n-o[u+1]*s,_=o[u]*s+o[u+1]*n;a=Math.min(a,p),c=Math.min(c,_),h=Math.max(h,p),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),d=Yi(a);d[0]+=(s[1]-s[3])/2*c,d[1]+=(s[0]-s[2])/2*c;const p=d[0]*u-d[1]*l,_=d[1]*u+d[0]*l,y=this.getConstrainedCenter([p,_],c),w=e.callback?e.callback:cs;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),Yr(w,!0))}centerOn(t,e,n){this.centerOnInternal(gi(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&&gi(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=gi(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&&gi(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(Ge.ROTATION)!==s&&this.set(Ge.ROTATION,s),this.get(Ge.RESOLUTION)!==r&&(this.set(Ge.RESOLUTION,r),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Ge.CENTER)||!Fr(this.get(Ge.CENTER),a))&&this.set(Ge.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()||!Fr(this.getCenterInternal(),c))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:o,center:c,resolution:a,duration:t,easing:Sn,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Vt.INTERACTING,1)}endInteraction(t,e,n){n=n&&gi(n,this.getProjection()),this.endInteractionInternal(t,e,n)}endInteractionInternal(t,e,n){this.getInteracting()&&(this.setHint(Vt.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 Yr(i,t){setTimeout(function(){i(t)},0)}function rm(i){if(i.extent!==void 0){const e=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return td(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,td(e,!1,!1)}return em}function am(i){let t,e,n,r=i.minZoom!==void 0?i.minZoom:Vc,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,d=Oc(i.projection,"EPSG:3857"),p=d.getExtent();let _=i.constrainOnlyCenter,y=i.extent;if(!h&&!y&&d.isGlobal()&&(_=!1,y=p),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=im(w,l,!_&&y,u):t=ed(e,n,l,!_&&y,u)}else{const E=(p?Math.max(_t(p),Ht(p)):360*wc.degrees/d.getMetersPerUnit())/Wc/Math.pow(2,Vc),b=E/Math.pow(2,28-Vc);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=nm(c,e,n,l,!_&&y,u):t=ed(e,n,l,!_&&y,u)}return{constraint:t,maxResolution:e,minResolution:n,minZoom:r,zoomFactor:c}}function cm(i){if(i.enableRotation!==void 0?i.enableRotation:!0){const e=i.constrainRotation;return e===void 0||e===!0?om():e===!1?id:typeof e=="number"?sm(e):id}return Bc}function hm(i){return!(i.sourceCenter&&i.targetCenter&&!Fr(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 mo extends Ju{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 lm(i,t,e,n,s){nd(i,t,e||0,n||i.length-1,s||um)}function nd(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));nd(i,t,l,u,s)}var d=i[t],p=e,_=n;for(_o(i,e,t),s(i[n],d)>0&&_o(i,e,n);p<_;){for(_o(i,p,_),p++,_--;s(i[p],d)<0;)p++;for(;s(i[_],d)>0;)_--}s(i[e],d)===0?_o(i,e,_):(_++,_o(i,_,n)),_<=t&&(e=_+1),t<=_&&(n=_-1)}}function _o(i,t,e){var n=i[t];i[t]=i[e],i[e]=n}function um(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(!Xr(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;Xr(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(!Xr(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(Xr(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=ys([]),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=dm(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=ys(t.slice(e,n+1)),_s(a,this.toBBox),a;s||(s=Math.ceil(Math.log(o)/Math.log(r)),r=Math.ceil(o/Math.pow(r,s-1))),a=ys([]),a.leaf=!1,a.height=s;const c=Math.ceil(o/r),h=c*Math.ceil(Math.sqrt(r));sd(t,e,n,h,this.compareMinX);for(let l=e;l<=n;l+=h){const u=Math.min(l+h-1,n);sd(t,l,u,c,this.compareMinY);for(let d=l;d<=u;d+=c){const p=Math.min(d+c-1,u);a.children.push(this._build(t,d,p,s-1))}}return _s(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=pm(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),wo(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=ys(n.children.splice(r,n.children.length-r));a.height=n.height,a.leaf=n.leaf,_s(n,this.toBBox),_s(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(n,a)}_splitRoot(t,e){this.data=ys([t,e]),this.data.height=t.height+1,this.data.leaf=!1,_s(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=yo(t,0,a,this.toBBox),h=yo(t,a,n,this.toBBox),l=mm(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:fm,o=t.leaf?this.compareMinY:gm,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=yo(t,0,e,o),a=yo(t,n-e,n,o);let c=Hr(r)+Hr(a);for(let h=e;h<n-e;h++){const l=t.children[h];wo(r,t.leaf?o(l):l),c+=Hr(r)}for(let h=n-e-1;h>=e;h--){const l=t.children[h];wo(a,t.leaf?o(l):l),c+=Hr(a)}return c}_adjustParentBBoxes(t,e,n){for(let s=n;s>=0;s--)wo(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():_s(t[e],this.toBBox)}};function dm(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 _s(i,t){yo(i,0,i.children.length,t,i)}function yo(i,t,e,n,s){s||(s=ys(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];wo(s,i.leaf?n(r):r)}return s}function wo(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 fm(i,t){return i.minX-t.minX}function gm(i,t){return i.minY-t.minY}function $c(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function Hr(i){return i.maxX-i.minX+(i.maxY-i.minY)}function pm(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 mm(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 Xr(i,t){return t.minX<=i.maxX&&t.minY<=i.maxY&&t.maxX>=i.minX&&t.maxY>=i.minY}function ys(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function sd(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;lm(i,r,t,e,s),o.push(t,r,r,e)}}class _m{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=od(t,e,n);return s in this.cache_?this.cache_[s]:null}set(t,e,n,s){const o=od(t,e,n);this.cache_[o]=s,++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function od(i,t,e){const n=e?qu(e):"null";return t+":"+i+":"+n}const $r=new _m;class Kc extends Qs{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 wt()}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){wt()}}class ym 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=[xr(n,ht.LOAD,function(){r=!0,o||t()})];return n.src&&Up?(o=!0,n.decode().then(function(){s&&t()}).catch(function(c){s&&(r?t():e())})):a.push(xr(n,ht.ERROR,e)),function(){s=!1,a.forEach(Mt)}}let vo=null;class wm extends Qs{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){vo||(vo=Bt(1,1,void 0,{willReadFrequently:!0})),vo.drawImage(this.image_,0,0);try{vo.getImageData(0,0,1,1),this.tainted_=!1}catch{vo=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=Bt(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=qu(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 vm(i,t,e,n,s,o){let r=$r.get(t,n,o);return r||(r=new wm(i,t,e,n,s,o),$r.set(t,n,o,r)),r}function rd(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 Eo extends Ur{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||Rt(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?jr(t.color):null,this.iconImage_=vm(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 d=()=>{if(this.unlistenImageChange(d),!this.initialOptions_)return;const p=this.iconImage_.getSize();this.setScale(rd(p[0],p[1],t.width,t.height))};this.listenImageChange(d);return}}h!==void 0&&this.setScale(rd(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 Eo({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 ad(i){return new Kt({fill:Co(i,""),stroke:bo(i,""),text:Em(i),image:Cm(i)})}function Co(i,t){const e=i[t+"fill-color"];if(e)return e==="none"?null:new de({color:e})}function bo(i,t){const e=i[t+"stroke-width"],n=i[t+"stroke-color"];if(!(!e&&!n))return new Re({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 Em(i){const t=i["text-value"];return t?new po({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:Co(i,"text-"),backgroundFill:Co(i,"text-background-"),stroke:bo(i,"text-"),backgroundStroke:bo(i,"text-background-")}):void 0}function Cm(i){const t=i["icon-src"],e=i["icon-img"];if(t||e)return new Eo({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 go({points:n,fill:Co(i,o),stroke:bo(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:Co(i,o),stroke:bo(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 cd={RENDER_ORDER:"renderOrder"};class hd extends mo{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(cd.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(cd.RENDER_ORDER,t)}setStyle(t){let e;if(t===void 0)e=Q0;else if(t===null)e=null;else if(typeof t=="function")e=t;else if(t instanceof Kt)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 Kt?s[o]=r:s[o]=ad(r)}e=s}else e=ad(t);this.style_=e,this.styleFunction_=t===null?void 0:K0(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},Zr=[st.FILL],Ki=[st.STROKE],Nn=[st.BEGIN_PATH],ld=[st.CLOSE_PATH];class ud{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 xo extends ud{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],io(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 d=this.tmpCoordinate_;let p=!0,_,y,w;for(_=e+s;_<n;_+=s)d[0]=t[_],d[1]=t[_+1],w=pc(h,d),w!==y?(p&&(a[c++]=l,a[c++]=u,p=!1),a[c++]=d[0],a[c++]=d[1]):w===$t.INTERSECTING?(a[c++]=d[0],a[c++]=d[1],p=!1):p=!0,l=d[0],u=d[1],y=w;return(o&&p||_===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,d;switch(o){case"MultiPolygon":c=t.getOrientedFlatCoordinates(),u=[];const p=t.getEndss();d=0;for(let _=0,y=p.length;_<y;++_){const w=[];d=this.drawCustomCoordinates_(c,d,p[_],r,w),u.push(w)}this.instructions.push([st.CUSTOM,a,u,t,n,Iu]),this.hitDetectionInstructions.push([st.CUSTOM,a,u,t,s||n,Iu]);break;case"Polygon":case"MultiLineString":l=[],c=o=="Polygon"?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),d=this.drawCustomCoordinates_(c,0,t.getEnds(),r,l),this.instructions.push([st.CUSTOM,a,l,t,n,ao]),this.hitDetectionInstructions.push([st.CUSTOM,a,l,t,s||n,ao]);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,Zi]),this.hitDetectionInstructions.push([st.CUSTOM,a,h,t,s||n,Zi]);break;case"MultiPoint":c=t.getFlatCoordinates(),h=this.appendFlatPointCoordinates(c,r),h>a&&(this.instructions.push([st.CUSTOM,a,h,t,n,Zi]),this.hitDetectionInstructions.push([st.CUSTOM,a,h,t,s||n,Zi]));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,Ap(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||lo);const o=e.getLineCap();n.lineCap=o!==void 0?o:Gr;const r=e.getLineDash();n.lineDash=r?r.slice():yi;const a=e.getLineDashOffset();n.lineDashOffset=a||wi;const c=e.getLineJoin();n.lineJoin=c!==void 0?c:ps;const h=e.getWidth();n.lineWidth=h!==void 0?h:fo;const l=e.getMiterLimit();n.miterLimit=l!==void 0?l:ho,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&&!qi(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_=iu(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;to(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class bm extends xo{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 xm extends xo{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,yi,wi],Nn);const r=t.getFlatCoordinates(),a=t.getStride();this.drawFlatCoordinates_(r,0,r.length,a),this.hitDetectionInstructions.push(Ki),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,yi,wi],Nn);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(Ki),this.endGeometry(e)}finish(){const t=this.state;return t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&this.instructions.push(Ki),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(Ki),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(Nn)}}class dd extends xo{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(Nn),this.hitDetectionInstructions.push(Nn);for(let h=0;h<c;++h){const l=n[h],u=this.coordinates.length,d=this.appendFlatLineCoordinates(t,e,l,s,!0,!a),p=[st.MOVE_TO_LINE_TO,u,d];this.instructions.push(p),this.hitDetectionInstructions.push(p),a&&(this.instructions.push(ld),this.hitDetectionInstructions.push(ld)),e=l}return r&&(this.instructions.push(Zr),this.hitDetectionInstructions.push(Zr)),a&&(this.instructions.push(Ki),this.hitDetectionInstructions.push(Ki)),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,yi,wi]);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(Nn,h),this.hitDetectionInstructions.push(Nn,h),n.fillStyle!==void 0&&(this.instructions.push(Zr),this.hitDetectionInstructions.push(Zr)),n.strokeStyle!==void 0&&(this.instructions.push(Ki),this.hitDetectionInstructions.push(Ki)),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,yi,wi]);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,yi,wi]);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]=Fn(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 Rm(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],d=t[r+s+1],p=Math.sqrt((u-h)*(u-h)+(d-l)*(d-l));if(a+=p,a>=i){const _=(i-a+p)/p,y=xe(h,u,_),w=xe(l,d,_);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 _=p-a,y=xe(h,u,_/p),w=xe(l,d,_/p);c.push(y,w),o.push(c),c=[y,w],a=0,r+=s}}return a>0&&o.push(c),o}function Sm(i,t,e,n,s){let o=e,r=e,a=0,c=0,h=e,l,u,d,p,_,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,p=Math.sqrt(b*b+P*P),w!==void 0&&(c+=d,l=Math.acos((w*b+E*P)/(d*p)),l>i&&(c>a&&(a=c,o=h,r=u),c=0,h=u-s)),d=p,w=b,E=P),_=I,y=M}return c+=p,c>a?[h,u]:[o,r]}const Kr={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class Pm extends xo{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 d=o.repeat,p=d?void 0:o.textAlign;let _=0;for(let y=0,w=u.length;y<w;++y){let E;d?E=Rm(d*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(p==null){const z=Sm(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 d=this.appendFlatPointCoordinates(h,l);if(d===a)return;if(u&&(d-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 p=o.padding;if(p!=zn&&(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),p=[E,b,P,I]}const _=this.pixelRatio;this.instructions.push([st.DRAW_IMAGE,a,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,void 0,this.declutterImageWithText_,p==zn?zn:p.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,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[y,y],NaN,void 0,this.declutterImageWithText_,p,!!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||uo,justify:e.justify,textBaseline:e.textBaseline||Br,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=Kr[s.textBaseline],l=this.textOffsetY_*c,u=this.text_,d=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,d*c,u,r,1]),this.hitDetectionInstructions.push([st.DRAW_CHARS,t,e,h,s.overflow,a&&ge,s.maxAngle,1,l,o,d,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()||Gr,o.lineDash=_?_.slice():yi,o.lineDashOffset=y===void 0?wi:y,o.lineJoin=a.getLineJoin()||ps,o.lineWidth=w===void 0?fo:w,o.miterLimit=E===void 0?ho:E,o.strokeStyle=ei(a.getColor()||lo)}n=this.textState_;const c=t.getFont()||$u;Y0(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()||Br,n.backgroundFill=t.getBackgroundFill(),n.backgroundStroke=t.getBackgroundStroke(),n.padding=t.getPadding()||zn,n.scale=h===void 0?[1,1]:h;const l=t.getOffsetX(),u=t.getOffsetY(),d=t.getRotateWithView(),p=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=l===void 0?0:l,this.textOffsetY_=u===void 0?0:u,this.textRotateWithView_=d===void 0?!1:d,this.textRotation_=p===void 0?0:p,this.strokeKey_=o?(typeof o.strokeStyle=="string"?o.strokeStyle:Rt(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:"|"+Rt(s.fillStyle):""}this.declutterImageWithText_=e}}const Om={Circle:dd,Default:xo,Image:bm,LineString:xm,Polygon:dd,Text:Pm};class fd{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=Om[e];o=new r(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),s[e]=o}return o}}class Im extends Js{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.declutterExecutorGroup=null}getFeatures(t){return wt()}getData(t){return null}prepareFrame(t){return wt()}renderFrame(t,e){return wt()}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 gd extends We{constructor(t,e,n,s){super(t),this.inversePixelTransform=e,this.frameState=n,this.context=s}}const pd=[];let ws=null;function Tm(){ws=Bt(1,1,void 0,{willReadFrequently:!0})}class Jc extends Im{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){ws||Tm(),ws.clearRect(0,0,1,1);let s;try{ws.drawImage(t,e,n,1,1,0,0,1,1),s=ws.getImageData(0,0,1,1).data}catch{return ws=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&&qi(jr(t.style.backgroundColor),jr(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=Bt();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=Ir(n),r=Or(n),a=Pr(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 gd(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,d=-t[0]+a,p=-t[1];return qe(this.tempTransform,c,h,l,u,-n,d,p)}disposeInternal(){delete this.frameState,super.disposeInternal()}}function Am(i,t,e,n,s,o,r,a,c,h,l,u){let d=i[t],p=i[t+1],_=0,y=0,w=0,E=0;function b(){_=d,y=p,t+=n,d=i[t],p=i[t+1],E+=w,w=Math.sqrt((d-_)*(d-_)+(p-y)*(p-y))}do b();while(t<e-n&&E+w<o);let P=w===0?0:(o-E)/w;const I=xe(_,d,P),M=xe(y,p,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(_,d,P),Y=xe(y,p,P);let X;if(u){const A=[I,M,q,Y];Cu(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,d=i[t],p=i[t+1];let R;if(v){b(),R=Math.atan2(p-y,d-_),X&&(R+=R>0?-Q:Q);const A=(q+I)/2,F=(Y+M)/2;return m[0]=[A,F,(z-o)/2,R,s],m}s=s.replace(/\n/g," ");for(let A=0,F=s.length;A<F;){b();let N=Math.atan2(p-y,d-_);if(X&&(N+=N>0?-Q:Q),R!==void 0){let et=N-R;if(et+=et>Q?-2*Q:et<-Q?2*Q:0,Math.abs(et)>r)return null}R=N;const G=A;let B=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+B+it/2)break;B+=it}if(A===G)continue;const Z=X?s.substring(F-G,F-A):s.substring(G,A);P=w===0?0:(o+B/2-E)/w;const V=xe(_,d,P),at=xe(y,p,P);m.push([V,at,B/2,N,Z]),o+=B}return m}const vs=Te(),Qi=[],Ei=[],Ci=[],Ji=[];function md(i){return i[3].declutterBox}const _d=new RegExp("[֑-ࣿיִ-﷿ﹰ-ﻼࠀ-࿿-]");function th(i,t){return t==="start"?t=_d.test(i)?"right":"left":t==="end"&&(t=_d.test(i)?"left":"right"),Kr[t]}function Mm(i,t,e){return e>0&&i.push(`
27
- `,""),i.push(t,""),i}class Dm{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),d=c.justify?Kr[c.justify]:th(Array.isArray(t)?t[0]:t,c.textAlign||uo),p=s&&r.lineWidth?r.lineWidth:0,_=u?t:t.split(`
28
- `).reduce(Mm,[]),{width:y,height:w,widths:E,heights:b,lineWidths:P}=X0(c,_),I=y+p,M=[],D=(I+2)*l[0],L=(w+p)*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",p),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-d;let Y=d*I+q*p;const X=[],Q=[];let m=0,v=0,R=0,A=0,F;for(let N=0,G=_.length;N<G;N+=2){const B=_[N];if(B===`
29
- `){v+=m,m=0,Y=d*I+q*p,++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[R]);const V=[B,Y+q*E[R]+d*(E[R]-P[A]),.5*(p+m)+v];Y+=E[R],s&&X.push("strokeText",V),n&&Q.push("fillText",V),++R}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,d,p,_,y,w){a*=d[0],c*=d[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*d[0]+_[1],D=_[0]+I*d[1]+_[2],L=E-_[3],z=b-_[0];(y||u!==0)&&(Qi[0]=L,Ji[0]=L,Qi[1]=z,Ei[1]=z,Ei[0]=L+M,Ci[0]=Ei[0],Ci[1]=z+D,Ji[1]=Ci[1]);let q;return u!==0?(q=qe(be(),n,s,1,1,u,-n,-s),Ut(q,Qi),Ut(q,Ei),Ut(q,Ci),Ut(q,Ji),fi(Math.min(Qi[0],Ei[0],Ci[0],Ji[0]),Math.min(Qi[1],Ei[1],Ci[1],Ji[1]),Math.max(Qi[0],Ei[0],Ci[0],Ji[0]),Math.max(Qi[1],Ei[1],Ci[1],Ji[1]),vs)):fi(Math.min(L,L+M),Math.min(z,z+D),Math.max(L,L+M),Math.max(z,z+D),vs),p&&(E=Math.round(E),b=Math.round(b)),{drawImageX:E,drawImageY:b,drawImageW:P,drawImageH:I,originX:h,originY:l,declutterBox:{minX:vs[0],minY:vs[1],maxX:vs[2],maxY:vs[3],value:w},canvasTransform:q,scale:d}}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,Qi,Ei,Ci,Ji,r,a),$0(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||uo),l=Kr[o.textBaseline||Br],u=a&&a.lineWidth?a.lineWidth:0,d=r.width/c-2*o.scale[0],p=h*d+2*(.5-h)*u,_=l*r.height/c+2*(.5-l)*u;return{label:r,anchorX:p,anchorY:_}}execute_(t,e,n,s,o,r,a,c){let h;this.pixelCoordinates_&&qi(n,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=mi(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),qp(this.renderedTransform_,n));let l=0;const u=s.length;let d=0,p,_,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_,R=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,B,Z;for(;l<u;){const V=s[l];switch(V[0]){case st.BEGIN_GEOMETRY:N=V[1],Z=V[3],N.getGeometry()?a!==void 0&&!te(a,Z.getExtent())?l=V[2]+1:++l:l=V[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:d=V[1];const et=h[d],it=h[d+1],gt=h[d+2],yt=h[d+3],dt=gt-et,Et=yt-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:d=V[1],p=V[2];const xt=V[3],Ft=V[4],kt=V.length==6?V[5]:void 0;A.geometry=xt,A.feature=N,l in m||(m[l]=[]);const Wt=m[l];kt?kt(h,d,p,2,Wt):(Wt[0]=h[d],Wt[1]=h[d+1],Wt.length=2),Ft(Wt,A),++l;break;case st.DRAW_IMAGE:d=V[1],p=V[2],I=V[3],_=V[4],y=V[5];let he=V[6];const ye=V[7],es=V[8],we=V[9],En=V[10];let Cn=V[11];const bn=V[12];let ae=V[13];const ve=V[14],Oe=V[15];if(!I&&V.length>=20){M=V[19],D=V[20],L=V[21],z=V[22];const Xt=this.drawLabelWithPointPlacement_(M,D,L,z);I=Xt.label,V[3]=I;const Xs=V[23];_=(Xt.anchorX-Xs)*this.pixelRatio,V[4]=_;const je=V[24];y=(Xt.anchorY-je)*this.pixelRatio,V[5]=y,he=I.height,V[6]=he,ae=I.width,V[13]=ae}let Ne;V.length>25&&(Ne=V[25]);let Ui,di,St;V.length>17?(Ui=V[16],di=V[17],St=V[18]):(Ui=zn,di=!1,St=!1),En&&R?Cn+=v:!En&&!R&&(Cn-=v);let Ee=0;for(;d<p;d+=2){if(Ne&&Ne[Ee++]<ae/this.pixelRatio)continue;const Xt=this.calculateImageOrLabelDimensions_(I.width,I.height,h[d],h[d+1],ae,he,_,y,es,we,Cn,bn,o,Ui,di||St,N),Xs=[t,e,I,Xt,ye,di?X:null,St?Q:null];if(c){if(ve==="none")continue;if(ve==="obstacle"){c.insert(Xt.declutterBox);continue}else{let je,ki;if(Oe){const Ie=p-d;if(!Oe[Ie]){Oe[Ie]=Xs;continue}if(je=Oe[Ie],delete Oe[Ie],ki=md(je),c.collides(ki))continue}if(c.collides(Xt.declutterBox))continue;je&&(c.insert(ki),this.replayImageOrLabel_.apply(this,je)),c.insert(Xt.declutterBox)}}this.replayImageOrLabel_.apply(this,Xs)}++l;break;case st.DRAW_CHARS:const $e=V[1],At=V[2],Ue=V[3],ac=V[4];z=V[5];const cc=V[6],yr=V[7],ji=V[8];L=V[9];const wr=V[10];M=V[11],D=V[12];const hc=[V[13],V[13]],vr=this.textStates[D],is=vr.font,ns=[vr.scale[0]*yr,vr.scale[1]*yr];let ss;is in this.widths_?ss=this.widths_[is]:(ss={},this.widths_[is]=ss);const xn=Uu(h,$e,At,2),Rn=Math.abs(ns[0])*Ku(is,M,ss);if(ac||Rn<=xn){const Xt=this.textStates[D].textAlign,Xs=(xn-Rn)*th(M,Xt),je=Am(h,$e,At,2,M,Xs,cc,Math.abs(ns[0]),Ku,is,ss,R?0:this.viewRotation_);t:if(je){const ki=[];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]+(ns[0]<0?-wr:wr),y=Ue*Ce.height+(.5-Ue)*2*wr*ns[1]/ns[0]-ji;const Wi=this.calculateImageOrLabelDimensions_(Ce.width,Ce.height,ke[0],ke[1],Ce.width,Ce.height,_,y,0,0,ke[3],hc,!1,zn,!1,N);if(c&&c.collides(Wi.declutterBox))break t;ki.push([t,e,Ce,Wi,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-ji;const Wi=this.calculateImageOrLabelDimensions_(Ce.width,Ce.height,ke[0],ke[1],Ce.width,Ce.height,_,y,0,0,ke[3],hc,!1,zn,!1,N);if(c&&c.collides(Wi.declutterBox))break t;ki.push([t,e,Ce,Wi,1,null,null])}c&&c.load(ki.map(md));for(let Wi=0,hE=ki.length;Wi<hE;++Wi)this.replayImageOrLabel_.apply(this,ki[Wi])}}++l;break;case st.END_GEOMETRY:if(r!==void 0){N=V[1];const Xt=r(N,Z);if(Xt)return Xt}++l;break;case st.FILL:F?q++:this.fill_(t),++l;break;case st.MOVE_TO_LINE_TO:for(d=V[1],p=V[2],G=h[d],B=h[d+1],b=G+.5|0,P=B+.5|0,(b!==w||P!==E)&&(t.moveTo(G,B),w=b,E=P),d+=2;d<p;d+=2)G=h[d],B=h[d+1],b=G+.5|0,P=B+.5|0,(d==p-2||b!==w||P!==E)&&(t.lineTo(G,B),w=b,E=P);++l;break;case st.SET_FILL_STYLE:X=V,this.alignFill_=V[2],q&&(this.fill_(t),q=0,Y&&(t.stroke(),Y=0)),t.fillStyle=V[1],++l;break;case st.SET_STROKE_STYLE:Q=V,Y&&(t.stroke(),Y=0),this.setStrokeStyle_(t,V),++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 yd{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 Dm(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_=Bt(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(),so(u,t),to(u,e*(this.renderBuffer_+s),u));const d=Fm(s);let p;function _(M,D){const L=l.getImageData(0,0,a,a).data;for(let z=0,q=d.length;z<q;z++)if(L[d[z]]>0){if(!r||p!=="Image"&&p!=="Text"||r.includes(M)){const Y=(d[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(Pn);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(p=eh[E],P=b[p],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 mi(a,0,8,2,t,a),a}isEmpty(){return Ks(this.executorsByZIndex_)}execute(t,e,n,s,o,r,a){const c=Object.keys(this.executorsByZIndex_).map(Number);c.sort(Pn),this.maxExtent_&&(t.save(),this.clip(t,n)),r=r||eh;let h,l,u,d,p,_;for(a&&c.reverse(),h=0,l=c.length;h<l;++h){const y=c[h].toString();for(p=this.executorsByZIndex_[y],u=0,d=r.length;u<d;++u){const w=r[u];_=p[w],_!==void 0&&_.execute(t,e,n,s,o,a)}}this.maxExtent_&&t.restore()}}const ih={};function Fm(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 wd extends ud{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=mi(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 d=o[l]-this.imageAnchorX_,p=o[l+1]-this.imageAnchorY_;if(h!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const _=d+this.imageAnchorX_,y=p+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_,d,p,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=mi(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=mi(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=x0(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),qi(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:uo;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||yi;this.strokeState_={lineCap:s!==void 0?s:Gr,lineDash:this.pixelRatio_===1?l:l.map(u=>u*this.pixelRatio_),lineDashOffset:(r||wi)*this.pixelRatio_,lineJoin:a!==void 0?a:ps,lineWidth:(c!==void 0?c:fo)*this.pixelRatio_,miterLimit:h!==void 0?h:ho,strokeStyle:ei(n||lo)}}}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 p=e.getColor();this.textFillState_={fillStyle:ei(p||ge)}}const n=t.getStroke();if(!n)this.textStrokeState_=null;else{const p=n.getColor(),_=n.getLineCap(),y=n.getLineDash(),w=n.getLineDashOffset(),E=n.getLineJoin(),b=n.getWidth(),P=n.getMiterLimit();this.textStrokeState_={lineCap:_!==void 0?_:Gr,lineDash:y||yi,lineDashOffset:w||wi,lineJoin:E!==void 0?E:ps,lineWidth:b!==void 0?b:fo,miterLimit:P!==void 0?P:ho,strokeStyle:ei(p||lo)}}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(),d=t.getTextBaseline();this.textState_={font:s!==void 0?s:$u,textAlign:u!==void 0?u:uo,textBaseline:d!==void 0?d:Br},this.text_=l!==void 0?Array.isArray(l)?l.reduce((p,_,y)=>p+=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 Lm(i,t,e,n,s,o,r){const a=i[0]*si,c=i[1]*si,h=Bt(a,c);h.imageSmoothingEnabled=!1;const l=h.canvas,u=new wd(h,si,s,null,r),d=e.length,p=Math.floor((256*256*256-1)/d),_={};for(let w=1;w<=d;++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*p).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=Bt(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 Eo({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 R=_[v];R||(R={},_[v]=R,R.Polygon=[],R.Circle=[],R.LineString=[],R.Point=[]);const A=q.getType();if(A==="GeometryCollection"){const F=q.getGeometriesArrayRecursive();for(let N=0,G=F.length;N<G;++N){const B=F[N];R[B.getType().replace("Multi","")].push(B,Y)}}else R[A.replace("Multi","")].push(q,Y)}}const y=Object.keys(_).map(Number).sort(Pn);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 zm(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 Nm=.5,vd={Point:Vm,LineString:qm,Polygon:Hm,MultiPoint:Ym,MultiLineString:Gm,MultiPolygon:Bm,GeometryCollection:Wm,Circle:jm};function Um(i,t){return parseInt(Rt(i),10)-parseInt(Rt(t),10)}function Ed(i,t){const e=nh(i,t);return e*e}function nh(i,t){return Nm*i/t}function jm(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 Cd(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 km(i,t,e,n,o,r),a}function km(i,t,e,n,s,o){const r=e.getGeometryFunction()(t);if(!r)return;const a=r.simplifyTransformed(n,s);if(e.getRenderer())bd(i,a,e,t);else{const h=vd[a.getType()];h(i,a,e,t,o)}}function bd(i,t,e,n){if(t.getType()=="GeometryCollection"){const o=t.getGeometries();for(let r=0,a=o.length;r<a;++r)bd(i,o[r],e,n);return}i.getBuilder(e.getZIndex(),"Default").drawCustom(t,n,e.getRenderer(),e.getHitDetectionRenderer())}function Wm(i,t,e,n,s){const o=t.getGeometriesArray();let r,a;for(r=0,a=o.length;r<a;++r){const c=vd[o[r].getType()];c(i,o[r],e,n,s)}}function qm(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 Gm(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 Bm(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 Vm(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 Ym(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 Hm(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 xd 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(),d=e.pixelRatio,p=e.viewHints,_=!(p[Vt.ANIMATING]||p[Vt.INTERACTING]),y=this.compositionContext_,w=Math.round(e.size[0]*d),E=Math.round(e.size[1]*d),b=u.getWrapX()&&c.canWrapX(),P=b?_t(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,d,w,E,M*P);t.execute(y,1,D,h,_,void 0,n)}while(++M<I)}setupCompositionContext_(){if(this.opacity_!==1){const t=Bt(this.context.canvas.width,this.context.canvas.height,pd);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,kr(this.compositionContext_),pd.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];Gp(this.pixelTransform,1/n,1/n),Rr(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),d=Math.round(t.size[1]*n);a.width!=u||a.height!=d?(a.width=u,a.height=d,a.style.transform!==o&&(a.style.transform=o)):this.containerReused||r.clearRect(0,0,u,d),this.preRender(r,t);const p=t.viewState;p.projection,this.opacity_=s.opacity,this.setupCompositionContext_();let _=!1;if(l&&s.extent&&this.clipping){const y=pi(s.extent);l=te(y,t.extent),_=l&&!In(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_!==p.rotation&&(this.renderedRotation_=p.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,d=n[1]*si;l.push(this.getRenderTransform(s,o,r,si,u,d,0).slice());const p=h.getSource(),_=a.getExtent();if(p.getWrapX()&&a.canWrapX()&&!In(_,c)){let y=c[0];const w=_t(_);let E=0,b;for(;y<_[0];)--E,b=w*E,l.push(this.getRenderTransform(s,o,r,si,u,d,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,d,b).slice()),y-=w}this.hitDetectionImageData_=Lm(n,l,this.renderedFeatures_,h.getStyleFunction(),c,o,r)}e(zm(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(p,_,y){const w=Rt(p),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(p,c,_);E.geometry=_,E.distanceSq=y}}else{if(y===0)return h[w]=!0,s(p,c,_);o.push(h[w]={feature:p,layer:c,geometry:_,distanceSq:y,callback:s})}};let u;const d=[this.replayGroup_];return this.declutterExecutorGroup&&d.push(this.declutterExecutorGroup),d.some(p=>u=p.forEachFeatureAtCoordinate(t,r,a,n,l,p===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[Vt.ANIMATING],o=t.viewHints[Vt.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,d=t.pixelRatio,p=e.getRevision(),_=e.getRenderBuffer();let y=e.getRenderOrder();y===void 0&&(y=Um);const w=h.center.slice(),E=to(c,_*u),b=E.slice(),P=[E.slice()],I=l.getExtent();if(n.getWrapX()&&l.canWrapX()&&!In(I,t.extent)){const R=_t(I),A=Math.max(_t(E)/2,R);E[0]=I[0]-A,E[2]=I[2]+A,hu(w,l);const F=ou(P[0],l);F[0]<I[0]&&F[2]<I[2]?P.push([F[0]+R,F[1],F[2]+R,F[3]]):F[0]>I[0]&&F[2]>I[2]&&P.push([F[0]-R,F[1],F[2]-R,F[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==p&&this.renderedRenderOrder_==y&&In(this.wrappedRenderedExtent_,E))return qi(this.renderedExtent_,b)||(this.hitDetectionImageData_=null,this.renderedExtent_=b),this.renderedCenter_=w,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const M=new fd(nh(u,d),E,u,d);let D;this.getLayer().getDeclutter()&&(D=new fd(nh(u,d),E,u,d));let L;for(let R=0,A=P.length;R<A;++R)n.loadFeatures(P[R],u,l);const z=Ed(u,d);let q=!0;const Y=R=>{let A;const F=R.getStyleFunction()||e.getStyleFunction();if(F&&(A=F(R,u)),A){const N=this.renderFeature(R,z,A,M,L,D);q=q&&!N}},X=Eu(E),Q=n.getFeaturesInExtent(X);y&&Q.sort(y);for(let R=0,A=Q.length;R<A;++R)Y(Q[R]);this.renderedFeatures_=Q,this.ready=q;const m=M.finish(),v=new yd(E,u,d,n.getOverlaps(),m,e.getRenderBuffer());return D&&(this.declutterExecutorGroup=new yd(E,u,d,n.getOverlaps(),D.finish(),e.getRenderBuffer())),this.renderedResolution_=u,this.renderedRevision_=p,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=Cd(s,t,n[c],e,this.boundHandleStyleImageChange_,o,r)||a;else a=Cd(s,t,n,e,this.boundHandleStyleImageChange_,o,r);return a}}class bi extends hd{constructor(t){super(t)}createRenderer(){return new xd(this)}}class Rd{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_[Rt(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_[Rt(a)]=c}this.rbush_.load(n)}remove(t){const e=Rt(t),n=this.items_[e];return delete this.items_[e],this.rbush_.remove(n)!==null}update(t,e){const n=this.items_[Rt(e)],s=[n.minX,n.minY,n.maxX,n.maxY];Vi(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 Ks(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return fi(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 Ze{constructor(t){super(),this.projection=Gt(t.projection),this.attributions_=Sd(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_=Sd(t),this.changed()}setState(t){this.state_=t,this.changed()}}function Sd(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 Xm(i,t){return[[-1/0,-1/0,1/0,1/0]]}let $m=!1;function Zm(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=$m,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 Pd(i,t){return function(e,n,s,o,r){const a=this;Zm(i,t,e,n,s,function(c,h){a.addFeatures(c),o!==void 0&&o(c)},r||cs)}}class tn extends We{constructor(t,e,n){super(t),this.feature=e,this.features=n}}class en 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_=cs,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_=Pd(this.url_,this.format_)),this.strategy_=t.strategy!==void 0?t.strategy:Xm;const e=t.useSpatialIndex!==void 0?t.useSpatialIndex:!0;this.featuresRtree_=e?new Rd:null,this.loadedExtentsRtree_=new Rd,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=Rt(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 tn(Be.ADDFEATURE,t))}setupChangeEvents_(t,e){this.featureChangeKeys_[t]=[Ct(e,ht.CHANGE,this.handleFeatureChange_,this),Ct(e,as.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=Rt(a);this.addToIndex_(c,a)&&n.push(a)}for(let o=0,r=n.length;o<r;o++){const a=n[o],c=Rt(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 tn(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 tn(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(),Ks(this.nullGeometryFeatures_)||On(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=e0(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||$s,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 d=Math.sqrt(a);c[0]=n-d,c[1]=s-d,c[2]=n+d,c[3]=s+d}}}),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=Rt(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 tn(Be.CHANGEFEATURE,e))}hasFeature(t){const e=t.getId();return e!==void 0?e in this.idIndex_:Rt(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Ks(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 In(l.extent,c)})||(++this.loadingExtentsCount_,this.dispatchEvent(new tn(Be.FEATURESLOADSTART)),this.loader_.call(this,c,e,n,l=>{--this.loadingExtentsCount_,this.dispatchEvent(new tn(Be.FEATURESLOADEND,void 0,l))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new tn(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(Vi(s.extent,t))return n=s,!0}),n&&e.remove(n)}removeFeature(t){if(!t)return;const e=Rt(t);e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t),this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=Rt(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 tn(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(Pd(t,this.format_))}}function Od(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=kp(i.inversePixelTransform.slice(),s.coordinateToPixelTransform),r=Ed(s.viewState.resolution,n);let a;return new wd(i.context,n,s.extent,o,s.viewState.rotation,r,a)}class Id 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 Td extends Qs{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(){wt()}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:$l(s/this.transition_)}inTransition(t){return this.transition_?this.transitionStarts_[t]!==-1:!1}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}}class Ad extends Td{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_=Km(),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 Km(){const i=Bt(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}class Qm{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 Jm extends Er{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){wt()}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]),Rr(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 d=l.projection,p=hu(t.slice(),d),_=[[0,0]];if(d.canWrapX()&&s){const I=d.getExtent(),M=_t(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()?p: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,$s,this,o,r)!==void 0}getMap(){return this.map_}renderFrame(t){wt()}flushDeclutterItems(t){}scheduleExpireIconCache(t){$r.canExpireCache()&&t.postRenderFunctions.push(t_)}}function t_(i,t){$r.expire()}class e_ extends Jm{constructor(t){super(t),this.fontChangeListenerKey_=Ct(vi,as.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=qr+" 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 gd(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),B0(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 Ju{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);Zs(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,as.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_[Rt(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=Rt(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=Tn(c.extent,s.extent):c.extent=s.extent),c.zIndex===void 0&&(c.zIndex=o)}return e}getSourceState(){return"ready"}}class Es extends We{constructor(t,e,n){super(t),this.map=e,this.frameState=n!==void 0?n:null}}class on extends Es{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 i_ extends Qs{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_,Jl?{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"},Qr=1/0;class n_{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,Zs(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!=Qr?(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==Qr?delete this.queuedElements_[this.keyFunction_(r)]:(n[s]=c,e[s++]=r);e.length=s,n.length=s,this.heapify_()}}class Md extends n_{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 s_(i,t,e,n,s){if(!i||!(e in i.wantedTiles)||!i.wantedTiles[e][t.getKey()])return Qr;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 Ze{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!==cs&&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 o_ 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+" "+qr+" "+Nc+(this.collapsed_&&this.collapsible_?" "+Yu:"")+(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),!qi(e,this.renderedAttributions_)){G0(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(Yu),this.collapsed_?Vu(this.collapseLabel_,this.label_):Vu(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 r_ 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+" "+qr+" "+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(Wr)}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:Sn}):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(Wr);!o&&n===0?this.element.classList.add(Wr):o&&n!==0&&this.element.classList.remove(Wr)}this.label_.style.transform=s}this.rotation_=n}}class a_ 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 d=e+" "+qr+" "+Nc,p=this.element;p.className=d,p.appendChild(l),p.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:Sn})):n.setZoom(o)}}}function Dd(i){i=i||{};const t=new Qe;return(i.zoom!==void 0?i.zoom:!0)&&t.push(new a_(i.zoomOptions)),(i.rotate!==void 0?i.rotate:!0)&&t.push(new r_(i.rotateOptions)),(i.attribution!==void 0?i.attribution:!0)&&t.push(new o_(i.attributionOptions)),t}const Fd={ACTIVE:"active"};class So extends Ze{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(Fd.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(Fd.ACTIVE,t)}setMap(t){this.map_=t}}function c_(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:Ip,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:Sn})}class h_ extends So{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 Po extends So{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 l_=function(i){const t=i.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},u_=function(i){const t=i.map.getTargetElement(),e=i.map.getOwnerDocument().activeElement;return t.contains(e)},Ld=function(i){return i.map.getTargetElement().hasAttribute("tabindex")?u_(i):!0},d_=$s,zd=function(i){const t=i.originalEvent;return t.button==0&&!(Np&&Kl&&t.ctrlKey)},Nd=function(i){const t=i.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},f_=function(i){const t=i.originalEvent;return Kl?t.metaKey:t.ctrlKey},g_=function(i){const t=i.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Ud=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"},p_=function(i){const t=i.originalEvent;return pt(t!==void 0,56),t.isPrimary&&t.button===0};class m_ extends Po{constructor(t){super({stopDown:br}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:hh(Nd,p_);this.condition_=t.onFocusOnly?hh(Ld,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();p0(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:Sn})}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 __ extends Po{constructor(t){t=t||{},super({stopDown:br}),this.condition_=t.condition?t.condition:l_,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===Bc)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)&&zd(t)&&this.condition_(t)?(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}class y_ extends Er{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 gs([s])}getGeometry(){return this.geometry_}}const Jr={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 w_ extends Po{constructor(t){super(),this.on,this.once,this.un,t=t||{},this.box_=new y_(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:zd,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(Jr.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?Jr.BOXEND:Jr.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(Jr.BOXSTART,t.coordinate,t)),!0):!1}onBoxEnd(t){}}class v_ extends w_{constructor(t){t=t||{};const e=t.condition?t.condition:g_;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:Sn})}}const Un={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};class E_ extends So{constructor(t){super(),t=t||{},this.defaultCondition_=function(e){return Nd(e)&&Ud(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==Un.DOWN||s==Un.LEFT||s==Un.RIGHT||s==Un.UP)){const r=t.map.getView(),a=r.getResolution()*this.pixelDelta_;let c=0,h=0;s==Un.DOWN?h=-a:s==Un.LEFT?c=-a:s==Un.RIGHT?c=a:h=a;const l=[c,h];bc(l,r.getRotation()),c_(r,l,this.duration_),n.preventDefault(),e=!0}}return!e}}class C_ extends So{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(e){return!f_(e)&&Ud(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 b_ extends So{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:d_;this.condition_=t.onFocusOnly?hh(Ld,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,zp&&s.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(o/=Ql),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 x_ extends Po{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=br),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!==Bc&&(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 R_ extends Po{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=br),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 jd(i){i=i||{};const t=new Qe,e=new Qm(-.005,.05,100);return(i.altShiftDragRotate!==void 0?i.altShiftDragRotate:!0)&&t.push(new __),(i.doubleClickZoom!==void 0?i.doubleClickZoom:!0)&&t.push(new h_({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan!==void 0?i.dragPan:!0)&&t.push(new m_({onFocusOnly:i.onFocusOnly,kinetic:e})),(i.pinchRotate!==void 0?i.pinchRotate:!0)&&t.push(new x_),(i.pinchZoom!==void 0?i.pinchZoom:!0)&&t.push(new R_({duration:i.zoomDuration})),(i.keyboard!==void 0?i.keyboard:!0)&&(t.push(new E_),t.push(new C_({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom!==void 0?i.mouseWheelZoom:!0)&&t.push(new b_({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom!==void 0?i.shiftDragZoom:!0)&&t.push(new v_({duration:i.zoomDuration})),t}function kd(i){if(i instanceof mo){i.setMapInternal(null);return}i instanceof sn&&i.getLayers().forEach(kd)}function Wd(i,t){if(i instanceof mo){i.setMapInternal(t);return}if(i instanceof sn){const e=i.getLayers().getArray();for(let n=0,s=e.length;n<s;++n)Wd(e[n],t)}}class S_ extends Ze{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=P_(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:Ql,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||Dd(),this.interactions=e.interactions||jd({onFocusOnly:!0}),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new Md(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){Wd(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:$s,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:$s,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=gi(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 s_(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[Vt.ANIMATING]||r[Vt.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 Es(rn.LOADEND,this,t)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Es(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 e_(this)),this.mapBrowserEventHandler_=new i_(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_,Jl?{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,as.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,as.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){kd(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&&ku(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:Rt(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_||!Hi(this.previousExtent_)&&!Vi(o.extent,this.previousExtent_))&&(this.dispatchEvent(new Es(rn.MOVESTART,this,s)),this.previousExtent_=no(this.previousExtent_)),this.previousExtent_&&!o.viewHints[Vt.ANIMATING]&&!o.viewHints[Vt.INTERACTING]&&!Vi(o.extent,this.previousExtent_)&&(this.dispatchEvent(new Es(rn.MOVEEND,this,o)),iu(o.extent,this.previousExtent_))),this.dispatchEvent(new Es(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],!ku(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&du("No map visible because the map container's width or height are 0."))}const n=this.getSize();e&&(!n||!qi(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 P_(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 O_{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 qd(i,t,e,n){return n!==void 0?(n[0]=i,n[1]=t,n[2]=e,n):[i,t,e]}function ta(i,t,e){return i+"/"+t+"/"+e}function Gd(i){return ta(i[0],i[1],i[2])}function I_(i){return i.split("/").map(Number)}function Bd(i){return(i[1]<<i[0])+i[2]}function T_(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 Vd extends O_{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=I_(t)[0];this.forEach(s=>{s.tileCoord[0]!==n&&(this.remove(Gd(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 Cs(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 Yd(i,t=128,e=128,n="map",s=1){return new Promise((o,r)=>{i.once("rendercomplete",()=>{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 p=c.toDataURL("image/png");o(p)}catch(a){r(a)}}),i.renderSync()})}function Hd(i,t){const{center:e,orbitPeriod:n,heading:s=0}=t,o=i.getView(),a=(d=>d*Math.PI/180)(s);let c,h,l=!0;const u=d=>{h||(h=d);const _=(d-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 A_(i,t){const e=vt(t),n=new Je({geometry:new Ke(e)});n.setStyle(new Kt({image:new ii({radius:6,fill:new de({color:"red"}),stroke:new Re({color:"white",width:2})}),text:new po({text:"中心点可视化-测试后删除",font:"14px sans-serif",fill:new de({color:"black"}),stroke:new Re({color:"white",width:3}),offsetY:-15})}));const s=new bi({source:new en({features:[n]})});i.addLayer(s)}class Xd extends f.Destroyable{constructor(e,n,s){super();S(this,"keysPressed",{w:!1,a:!1,s:!1,d:!1});S(this,"animationId",0);S(this,"view");S(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(vt(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 M_(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 Oo(i){return 6378137/Math.pow(2,i-5)}function jn(i){const e=Math.log2(6378137/i)+5+0;return Math.min(28,Math.max(0,e))}class $d extends f.Destroyable{constructor(e){super();S(this,"lastTime",performance.now());S(this,"frameCount",0);S(this,"currentFPS",0);S(this,"map");S(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 Zd=[0,-90,0];function Kd(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,d]=s,p=vt([l,u]),_=(jn==null?void 0:jn(d))??n.getZoom(),w=(((o==null?void 0:o[0])??0)+(a??0))*Math.PI/180,E={center:p,zoom:_,rotation:-w,duration:r};try{return n.animate(E,()=>{}),Promise.resolve(!0)}catch{return h==null||h(),Promise.resolve(!1)}}function xi(i,t,e,n,s,o){return(i==null?void 0:i.viewer)&&Kd(i,{position:t,rotation:n,duration:s&&s*1e3,cancelCallback:o})}function ea(i){const t=i.map(e=>vt([e[0],e[1]]));return Sr(t)}const Io=(i,t,e=1,n=350)=>{i.getView().fit(t,{duration:e*1e3,padding:Array.isArray(n)?n:[n,n,n,n]})},D_=(i,t,e=1,n=350)=>{const s=ea(t);Io(i,s,e,n)},fh=(i,t,e=1,n=350)=>{const s=vt([t[0],t[1]]),o=Sr([s]);Io(i,o,e,n)},F_=(i,t,e)=>{};function Qd(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=(Oo==null?void 0:Oo(o??0))??0;return[s[0],s[1],r]}class L_ extends f.Destroyable{constructor(e,n){super();S(this,"_map");S(this,"_view");S(this,"_enabled",!0);S(this,"_keys",[]);S(this,"_changed",new f.Event);S(this,"_options");S(this,"_rafPending",!1);S(this,"_rafId",null);S(this,"_lastEmit",0);if(this._options={emitImmediately:!0,usePostRender:!1,throttleMs:0,useRaf:!0,...n},e instanceof os.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 Jd(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]=Zt(o),c=e??0;return n?(n[0]=r,n[1]=a,n[2]=c,n):[r,a,c]}function tf(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=Zt(a),h=[c[0],c[1],e.position[2]],l=e.position,u=e.heading,d=z_(t,n,l),p=(_,y)=>{const w=N_(l,h,_),E=f.geoRhumbDistance(l,h);if(w>.98&&E<d&&!(o!=null&&o[y])){s.constraintMode=y;const b=f.geoRhumbDestination(l,E,_);if(b)return s.startDragPos=[b[0],b[1],l[2]],!0}return!1};return p(u+90,"x")||p(u,"y")?!0:!(o!=null&&o.xy)&&f.geoRhumbDistance(l,h)<d?(s.constraintMode="xy",s.startDragPos=h,!0):!1}function z_(i,t,e){const n=i.getPixelFromCoordinate(vt([e[0],e[1]])),s=[n[0]+t,n[1]],o=Zt(i.getCoordinateFromPixel(s));return f.geoRhumbDistance([e[0],e[1],0],[o[0],o[1],0])}function N_(i,t,e){const n=f.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=f.geoRhumbDistance(i,e),o=f.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?f.geoRhumbDestination(i,s,t,n):f.geoRhumbDestination(i,s,t+180,n),[r>0?s:-s,n]}function U_(i,t,e){const n=e*.1,s=[];for(let o=-9;o<10;++o){const r=f.geoRhumbDestination(i,n*o,t);r&&s.push(r)}return s}function j_(i,t){return f.geoNearestPointOnLine(i,t).geometry.coordinates}function k_(i,t,e,n=10){const s={constraintMode:"none",startDragPos:[0,0,0]},o=i.getPixelFromCoordinate(vt([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,d]=Zt(i.getCoordinateFromPixel(r));return s.startDragPos=[u,d,e.position[2]],s}function W_(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]=Zt(o),[c,h]=Zt(t);return Math.abs(f.geoRhumbDistance([c,h,0],[r,a,0]))}function ef(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 d=l/u,p=e+d*r,_=n+d*a;return Math.hypot(i-p,t-_)}function nf(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=vt([e.position[0],e.position[1]]),c=i.getPixelFromCoordinate(a);if(!c)return r;const h=i.getEventPixel(t),[l,u]=h,d=Math.max(1e-6,e.dimensions[0]),p=e.heading,_=f.geoRhumbDestination(e.position,d,p+90),y=f.geoRhumbDestination(e.position,d,p+0);if(!_||!y)return r;const w=a,E=a,b=vt([_[0],_[1]]),P=vt([y[0],y[1]]),I=i.getPixelFromCoordinate(w),M=i.getPixelFromCoordinate(b),D=i.getPixelFromCoordinate(E),L=i.getPixelFromCoordinate(P),z=W_(i,a,n),Y=Math.hypot(l-c[0],u-c[1])<=n,X=ef(l,u,I[0],I[1],M[0],M[1]),Q=ef(l,u,D[0],D[1],L[0],L[1]);if(!(o!=null&&o.zAxis)){const R=d,A=f.geoRhumbDestination(e.position,R,p);if(!A)return r;const F=i.getPixelFromCoordinate(vt([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=Zt(i.getCoordinateFromPixel(h));if(m==="x"||m==="y"){const R=m==="x"?p+90:p+0,[A,F]=an(e.position,R,[v[0],v[1],e.position[2]]);if(A>0&&F&&f.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 sf extends f.Destroyable{constructor(t,e,n,s=100){super();const o=t.getView(),[r,a]=f.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 g={};g.typeOf={};function q_(i){return`${i} is required, actual value was undefined`}function bs(i,t,e){return`Expected ${e} to be typeof ${t}, actual typeof was ${i}`}g.defined=function(i,t){if(!C(t))throw new j(q_(i))},g.typeOf.func=function(i,t){if(typeof t!="function")throw new j(bs(typeof t,"function",i))},g.typeOf.string=function(i,t){if(typeof t!="string")throw new j(bs(typeof t,"string",i))},g.typeOf.number=function(i,t){if(typeof t!="number")throw new j(bs(typeof t,"number",i))},g.typeOf.number.lessThan=function(i,t,e){if(g.typeOf.number(i,t),t>=e)throw new j(`Expected ${i} to be less than ${e}, actual value was ${t}`)},g.typeOf.number.lessThanOrEquals=function(i,t,e){if(g.typeOf.number(i,t),t>e)throw new j(`Expected ${i} to be less than or equal to ${e}, actual value was ${t}`)},g.typeOf.number.greaterThan=function(i,t,e){if(g.typeOf.number(i,t),t<=e)throw new j(`Expected ${i} to be greater than ${e}, actual value was ${t}`)},g.typeOf.number.greaterThanOrEquals=function(i,t,e){if(g.typeOf.number(i,t),t<e)throw new j(`Expected ${i} to be greater than or equal to ${e}, actual value was ${t}`)},g.typeOf.object=function(i,t){if(typeof t!="object")throw new j(bs(typeof t,"object",i))},g.typeOf.bool=function(i,t){if(typeof t!="boolean")throw new j(bs(typeof t,"boolean",i))},g.typeOf.bigint=function(i,t){if(typeof t!="bigint")throw new j(bs(typeof t,"bigint",i))},g.typeOf.number.equals=function(i,t,e,n){if(g.typeOf.number(i,e),g.typeOf.number(t,n),e!==n)throw new j(`${i} must be equal to ${t}, the actual values are ${e} and ${n}`)};var of=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function rf(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var gh,af;function G_(){if(af)return gh;af=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 B_=G_();const cf=rf(B_),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 ia=[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=ia.length;if(i>=t){let e=ia[t-1];for(let n=t;n<=i;n++){const s=e*n;ia.push(s),e=s}}return ia[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 g.typeOf.number("value",i),g.typeOf.number("min",t),g.typeOf.number("max",e),i<t?t:i>e?e:i};let hf=new cf;T.setRandomNumberSeed=function(i){if(!C(i))throw new j("seed is required.");hf=new cf(i)},T.nextRandomNumber=function(){return hf.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 g.typeOf.number("x",i),i*(-.1784*Math.abs(i)-.0663*i*i+1.0301)},T.fastApproximateAtan2=function(i,t){g.typeOf.number("x",i),g.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){g.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 g.typeOf.object("value",i),g.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 g.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){g.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(g.defined("array",i),g.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 g.typeOf.object("cartesian",i),Math.max(i.x,i.y,i.z)},O.minimumComponent=function(i){return g.typeOf.object("cartesian",i),Math.min(i.x,i.y,i.z)},O.minimumByComponent=function(i,t,e){return g.typeOf.object("first",i),g.typeOf.object("second",t),g.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 g.typeOf.object("first",i),g.typeOf.object("second",t),g.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){g.typeOf.object("value",i),g.typeOf.object("min",t),g.typeOf.object("max",e),g.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 g.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 na=new O;O.distance=function(i,t){return g.typeOf.object("left",i),g.typeOf.object("right",t),O.subtract(i,t,na),O.magnitude(na)},O.distanceSquared=function(i,t){return g.typeOf.object("left",i),g.typeOf.object("right",t),O.subtract(i,t,na),O.magnitudeSquared(na)},O.normalize=function(i,t){g.typeOf.object("cartesian",i),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),i.x*t.x+i.y*t.y+i.z*t.z},O.multiplyComponents=function(i,t,e){return g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("cartesian",i),g.typeOf.number("scalar",t),g.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 g.typeOf.object("cartesian",i),g.typeOf.number("scalar",t),g.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 g.typeOf.object("cartesian",i),g.typeOf.object("result",t),t.x=-i.x,t.y=-i.y,t.z=-i.z,t},O.abs=function(i,t){return g.typeOf.object("cartesian",i),g.typeOf.object("result",t),t.x=Math.abs(i.x),t.y=Math.abs(i.y),t.z=Math.abs(i.z),t};const lf=new O;O.lerp=function(i,t,e,n){return g.typeOf.object("start",i),g.typeOf.object("end",t),g.typeOf.number("t",e),g.typeOf.object("result",n),O.multiplyByScalar(t,e,lf),n=O.multiplyByScalar(i,1-e,n),O.add(lf,n,n)};const sa=new O,ph=new O;O.angleBetween=function(i,t){g.typeOf.object("left",i),g.typeOf.object("right",t),O.normalize(i,sa),O.normalize(t,ph);const e=O.dot(sa,ph),n=O.magnitude(O.cross(sa,ph,sa));return Math.atan2(n,e)};const V_=new O;O.mostOrthogonalAxis=function(i,t){g.typeOf.object("cartesian",i),g.typeOf.object("result",t);const e=O.normalize(i,V_);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){g.defined("a",i),g.defined("b",t),g.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){g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.number("longitude",i),g.typeOf.number("latitude",t),i=T.toRadians(i),t=T.toRadians(t),O.fromRadians(i,t,e,n,s)};let Me=new O,xs=new O;O._ellipsoidRadiiSquared=new O(40680631590769,40680631590769,40408299984661445e-3),O.fromRadians=function(i,t,e,n,s){g.typeOf.number("longitude",i),g.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,xs);const a=Math.sqrt(O.dot(Me,xs));return xs=O.divideByScalar(xs,a,xs),Me=O.multiplyByScalar(Me,e,Me),C(s)||(s=new O),O.add(xs,Me,s)},O.fromDegreesArray=function(i,t,e){if(g.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(g.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(g.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(g.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})`};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 g.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 g.typeOf.object("value",i),g.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 g.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){g.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(g.defined("array",i),g.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 g.typeOf.object("cartesian",i),Math.max(i.x,i.y,i.z,i.w)},K.minimumComponent=function(i){return g.typeOf.object("cartesian",i),Math.min(i.x,i.y,i.z,i.w)},K.minimumByComponent=function(i,t,e){return g.typeOf.object("first",i),g.typeOf.object("second",t),g.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 g.typeOf.object("first",i),g.typeOf.object("second",t),g.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){g.typeOf.object("value",i),g.typeOf.object("min",t),g.typeOf.object("max",e),g.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 g.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 oa=new K;K.distance=function(i,t){return g.typeOf.object("left",i),g.typeOf.object("right",t),K.subtract(i,t,oa),K.magnitude(oa)},K.distanceSquared=function(i,t){return g.typeOf.object("left",i),g.typeOf.object("right",t),K.subtract(i,t,oa),K.magnitudeSquared(oa)},K.normalize=function(i,t){g.typeOf.object("cartesian",i),g.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 g.typeOf.object("left",i),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("cartesian",i),g.typeOf.number("scalar",t),g.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 g.typeOf.object("cartesian",i),g.typeOf.number("scalar",t),g.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 g.typeOf.object("cartesian",i),g.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 g.typeOf.object("cartesian",i),g.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 uf=new K;K.lerp=function(i,t,e,n){return g.typeOf.object("start",i),g.typeOf.object("end",t),g.typeOf.number("t",e),g.typeOf.object("result",n),K.multiplyByScalar(t,e,uf),n=K.multiplyByScalar(i,1-e,n),K.add(uf,n,n)};const Y_=new K;K.mostOrthogonalAxis=function(i,t){g.typeOf.object("cartesian",i),g.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 mh=new Float32Array(1),ie=new Uint8Array(mh.buffer),H_=new Uint32Array([287454020]),df=new Uint8Array(H_.buffer)[0]===68;K.packFloat=function(i,t){return g.typeOf.number("value",i),C(t)||(t=new K),mh[0]=i,df?(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 g.typeOf.object("packedFloat",i),df?(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),mh[0]};const oi={};oi.EMPTY_OBJECT=Object.freeze({}),oi.EMPTY_ARRAY=Object.freeze([]);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 g.typeOf.object("value",i),g.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 g.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){g.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(g.defined("array",i),g.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 g.defined("values",i),k.clone(i,t)},k.fromRowMajorArray=function(i,t){return g.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){g.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,d=e-r-h+u,p=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]=d,t[1]=y,t[2]=b,t[3]=p,t[4]=w,t[5]=P,t[6]=_,t[7]=E,t[8]=I,t):new k(d,p,_,y,w,E,b,P,I)},k.fromHeadingPitchRoll=function(i,t){g.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,d=s*n+a*o*r,p=-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]=d,t[5]=y,t[6]=l,t[7]=p,t[8]=w,t):new k(c,h,l,u,d,p,_,y,w)},k.fromScale=function(i,t){return g.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 g.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 g.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){g.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){g.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){g.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 g.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 g.typeOf.number.greaterThanOrEquals("row",t,0),g.typeOf.number.lessThanOrEquals("row",t,2),g.typeOf.number.greaterThanOrEquals("column",i,0),g.typeOf.number.lessThanOrEquals("column",i,2),i*3+t},k.getColumn=function(i,t,e){g.typeOf.object("matrix",i),g.typeOf.number.greaterThanOrEquals("index",t,0),g.typeOf.number.lessThanOrEquals("index",t,2),g.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){g.typeOf.object("matrix",i),g.typeOf.number.greaterThanOrEquals("index",t,0),g.typeOf.number.lessThanOrEquals("index",t,2),g.typeOf.object("cartesian",e),g.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){g.typeOf.object("matrix",i),g.typeOf.number.greaterThanOrEquals("index",t,0),g.typeOf.number.lessThanOrEquals("index",t,2),g.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 g.typeOf.object("matrix",i),g.typeOf.number.greaterThanOrEquals("index",t,0),g.typeOf.number.lessThanOrEquals("index",t,2),g.typeOf.object("cartesian",e),g.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 X_=new O;k.setScale=function(i,t,e){g.typeOf.object("matrix",i),g.typeOf.object("scale",t),g.typeOf.object("result",e);const n=k.getScale(i,X_),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 $_=new O;k.setUniformScale=function(i,t,e){g.typeOf.object("matrix",i),g.typeOf.number("scale",t),g.typeOf.object("result",e);const n=k.getScale(i,$_),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 _h=new O;k.getScale=function(i,t){return g.typeOf.object("matrix",i),g.typeOf.object("result",t),t.x=O.magnitude(O.fromElements(i[0],i[1],i[2],_h)),t.y=O.magnitude(O.fromElements(i[3],i[4],i[5],_h)),t.z=O.magnitude(O.fromElements(i[6],i[7],i[8],_h)),t};const ff=new O;k.getMaximumScale=function(i){return k.getScale(i,ff),O.maximumComponent(ff)};const Z_=new O;k.setRotation=function(i,t,e){g.typeOf.object("matrix",i),g.typeOf.object("result",e);const n=k.getScale(i,Z_);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 K_=new O;k.getRotation=function(i,t){g.typeOf.object("matrix",i),g.typeOf.object("result",t);const e=k.getScale(i,K_);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){g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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){g.typeOf.object("matrix",i),g.typeOf.object("cartesian",t),g.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 g.typeOf.object("matrix",i),g.typeOf.number("scalar",t),g.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 g.typeOf.object("matrix",i),g.typeOf.object("scale",t),g.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 g.typeOf.object("matrix",i),g.typeOf.number("scale",t),g.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 g.typeOf.object("matrix",i),g.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){g.typeOf.object("matrix",i),g.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 Q_(i){let t=0;for(let e=0;e<9;++e){const n=i[e];t+=n*n}return Math.sqrt(t)}const yh=[1,0,0],wh=[2,2,1];function J_(i){let t=0;for(let e=0;e<3;++e){const n=i[k.getElementIndex(wh[e],yh[e])];t+=2*n*n}return Math.sqrt(t)}function ty(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(wh[h],yh[h])]);l>n&&(s=h,n=l)}let o=1,r=0;const a=yh[s],c=wh[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)],d=(h-l)/2/u;let p;d<0?p=-1/(-d+Math.sqrt(1+d*d)):p=1/(d+Math.sqrt(1+d*d)),o=1/Math.sqrt(1+p*p),r=p*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 ra=new k,gf=new k;k.computeEigenDecomposition=function(i,t){g.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*Q_(a);for(;o<n&&J_(a)>c;)ty(a,ra),k.transpose(ra,gf),k.multiply(a,ra,a),k.multiply(gf,a,a),k.multiply(r,ra,r),++s>2&&(++o,s=0);return t},k.abs=function(i,t){return g.typeOf.object("matrix",i),g.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){g.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){g.typeOf.object("matrix",i),g.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 d=1/u;return k.multiplyByScalar(t,d,t)};const ey=new k;k.inverseTranspose=function(i,t){return g.typeOf.object("matrix",i),g.typeOf.object("result",t),k.inverse(k.transpose(i,ey),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]})
24
+ `+_;vi.get(y)===void 0&&(vi.set(y,100,!0),a(l.style,l.weight,_)||(vi.set(y,0,!0),o===void 0&&(o=setInterval(c,32))))}}}(),$0=function(){let i;return function(t){let e=jc[t];if(e==null){if(dc){const n=Zu(t),s=Qu(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 Qu(i,t){return ms||(ms=Bt(1,1)),i!=Uc&&(ms.font=i,Uc=ms.font),ms.measureText(t)}function Vr(i,t){return Qu(i,t).width}function Ju(i,t,e){if(t in e)return e[t];const n=t.split(`
25
+ `).reduce((s,o)=>Math.max(s,Vr(i,o)),0);return e[t]=n,n}function Z0(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 d=t[h+1]||i.font,p=Vr(d,u);e.push(p),r+=p;const _=$0(d);n.push(_),c=Math.max(c,_)}return{width:o,height:a,widths:e,heights:n,lineWidths:s}}function K0(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]),Q0(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 Q0(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 go extends Ur{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 go({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=Bt(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),d=u/c;if(t==="miter"&&d<=n)return d*e;const p=e/2/d,_=e/2*(l/u),w=Math.sqrt((s+p)*(s+p)+_*_)-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=ps,e=0,n=null,s=0,o,r=0;this.stroke_&&(o=this.stroke_.getColor(),o===null&&(o=lo),o=ei(o),r=this.stroke_.getWidth(),r===void 0&&(r=fo),n=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset(),t=this.stroke_.getLineJoin(),t===void 0&&(t=ps),e=this.stroke_.getMiterLimit(),e===void 0&&(e=ho));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=jr(e)),e===null?n=1:Array.isArray(e)&&(n=e.length===4?e[3]:1),n===0){const s=Bt(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 go{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 Kt{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=td,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 Kt({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_=td,this.geometry_=t}setZIndex(t){this.zIndex_=t}}function J0(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 tm(i,t){if(!kc){const e=new de({color:"rgba(255,255,255,0.4)"}),n=new Re({color:"#3399CC",width:1.25});kc=[new Kt({image:new ii({fill:e,stroke:n,radius:5}),fill:e,stroke:n})]}return kc}function td(i){return i.getGeometry()}const em="#333";class po{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:em}),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 po({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 ed extends Ze{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 wt()}getLayerStatesArray(t){return wt()}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 wt()}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 Vt={ANIMATING:0,INTERACTING:1},Ge={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"},im=42,Wc=256;function id(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 d=i[0]+c/2+l,p=i[2]-c/2+l,_=i[1]+h/2+u,y=i[3]-h/2+u;d>p&&(d=(p+d)/2,p=d),_>y&&(_=(y+_)/2,y=_);let w=qt(n[0],d,p),E=qt(n[1],_,y);if(r&&e&&s){const b=30*s;w+=-b*Math.log(1+Math.max(0,d-n[0])/b)+b*Math.log(1+Math.max(0,n[0]-p)/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 nm(i){return i}function qc(i,t,e,n){const s=_t(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 sm(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),d=Math.floor(Cr(i,u,o));return i[d]>l&&d<i.length-1?i[d+1]:i[d]}}}function om(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,d=Math.ceil(Math.log(t/l)/Math.log(i)-u),p=-a*(.5-u)+.5,_=Math.min(l,r),y=Math.floor(Math.log(t/_)/Math.log(i)+p),w=Math.max(d,y),E=t/Math.pow(i,w);return qt(E,e,l)}}}function nd(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 Bc(i){if(i!==void 0)return 0}function sd(i){if(i!==void 0)return i}function rm(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 am(i){return i=i||Ar(5),function(t,e){if(e)return t;if(t!==void 0)return Math.abs(t)<=i?0:t}}const Vc=0;class ni extends Ze{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&&pu(),t.center&&(t.center=gi(t.center,this.projection_)),t.extent&&(t.extent=pi(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const a in Ge)delete e[a];this.setProperties(e,!0);const n=hm(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=cm(t),o=n.constraint,r=lm(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=gi(s.center,this.getProjection())),s.anchor&&(s=Object.assign({},s),s.anchor=gi(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&&Yr(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||Tp,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 d=Xi(l.rotation-c+Math.PI,2*Math.PI)-Math.PI;u.targetRotation=c+d,c=u.targetRotation}um(u)?u.complete=!0:o+=u.duration,h.push(u)}this.animations_.push(h),this.setHint(Vt.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[Vt.ANIMATING]>0}getInteracting(){return this.hints_[Vt.INTERACTING]>0}cancelAnimations(){this.setHint(Vt.ANIMATING,-this.hints_[Vt.ANIMATING]);let t;for(let e=0,n=this.animations_.length;e<n;++e){const s=this.animations_[e];if(s[0].callback&&Yr(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 d=c.sourceCenter[0],p=c.sourceCenter[1],_=c.targetCenter[0],y=c.targetCenter[1];this.nextCenter_=c.targetCenter;const w=d+u*(_-d),E=p+u*(y-p);this.targetCenter_=[w,E]}if(c.sourceResolution&&c.targetResolution){const d=u===1?c.targetResolution:c.sourceResolution+u*(c.targetResolution-c.sourceResolution);if(c.anchor){const p=this.getViewportSize_(this.getRotation()),_=this.constraints_.resolution(d,0,p,!0);this.targetCenter_=this.calculateCenterZoom(_,c.anchor)}this.nextResolution_=c.targetResolution,this.targetResolution_=d,this.applyTargetState_(!0)}if(c.sourceRotation!==void 0&&c.targetRotation!==void 0){const d=u===1?Xi(c.targetRotation+Math.PI,2*Math.PI)-Math.PI:c.sourceRotation+u*(c.targetRotation-c.sourceRotation);if(c.anchor){const p=this.constraints_.rotation(d,!0);this.targetCenter_=this.calculateCenterRotate(p,c.anchor)}this.nextRotation_=c.targetRotation,this.targetRotation_=d}if(this.applyTargetState_(!0),e=!0,!c.complete)break}if(o){this.animations_[n]=null,this.setHint(Vt.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const r=s[0].callback;r&&Yr(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()),m0(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(Ge.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 bu(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(Ge.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(pi(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const n=_t(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(Ge.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=Cr(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(!Hi(t),25);const s=pi(t,this.getProjection());n=Fc(s)}else if(t.getType()==="Circle"){const s=pi(t.getExtent(),this.getProjection());n=Fc(s),n.rotate(this.getRotation(),Yi(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,d=o.length;u<d;u+=r){const p=o[u]*n-o[u+1]*s,_=o[u]*s+o[u+1]*n;a=Math.min(a,p),c=Math.min(c,_),h=Math.max(h,p),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),d=Yi(a);d[0]+=(s[1]-s[3])/2*c,d[1]+=(s[0]-s[2])/2*c;const p=d[0]*u-d[1]*l,_=d[1]*u+d[0]*l,y=this.getConstrainedCenter([p,_],c),w=e.callback?e.callback:cs;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),Yr(w,!0))}centerOn(t,e,n){this.centerOnInternal(gi(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&&gi(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=gi(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&&gi(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(Ge.ROTATION)!==s&&this.set(Ge.ROTATION,s),this.get(Ge.RESOLUTION)!==r&&(this.set(Ge.RESOLUTION,r),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Ge.CENTER)||!Fr(this.get(Ge.CENTER),a))&&this.set(Ge.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()||!Fr(this.getCenterInternal(),c))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:o,center:c,resolution:a,duration:t,easing:Sn,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Vt.INTERACTING,1)}endInteraction(t,e,n){n=n&&gi(n,this.getProjection()),this.endInteractionInternal(t,e,n)}endInteractionInternal(t,e,n){this.getInteracting()&&(this.setHint(Vt.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 Yr(i,t){setTimeout(function(){i(t)},0)}function cm(i){if(i.extent!==void 0){const e=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return id(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,id(e,!1,!1)}return nm}function hm(i){let t,e,n,r=i.minZoom!==void 0?i.minZoom:Vc,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,d=Oc(i.projection,"EPSG:3857"),p=d.getExtent();let _=i.constrainOnlyCenter,y=i.extent;if(!h&&!y&&d.isGlobal()&&(_=!1,y=p),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=sm(w,l,!_&&y,u):t=nd(e,n,l,!_&&y,u)}else{const E=(p?Math.max(_t(p),Ht(p)):360*wc.degrees/d.getMetersPerUnit())/Wc/Math.pow(2,Vc),b=E/Math.pow(2,28-Vc);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=om(c,e,n,l,!_&&y,u):t=nd(e,n,l,!_&&y,u)}return{constraint:t,maxResolution:e,minResolution:n,minZoom:r,zoomFactor:c}}function lm(i){if(i.enableRotation!==void 0?i.enableRotation:!0){const e=i.constrainRotation;return e===void 0||e===!0?am():e===!1?sd:typeof e=="number"?rm(e):sd}return Bc}function um(i){return!(i.sourceCenter&&i.targetCenter&&!Fr(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 mo extends ed{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 dm(i,t,e,n,s){od(i,t,e||0,n||i.length-1,s||fm)}function od(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));od(i,t,l,u,s)}var d=i[t],p=e,_=n;for(_o(i,e,t),s(i[n],d)>0&&_o(i,e,n);p<_;){for(_o(i,p,_),p++,_--;s(i[p],d)<0;)p++;for(;s(i[_],d)>0;)_--}s(i[e],d)===0?_o(i,e,_):(_++,_o(i,_,n)),_<=t&&(e=_+1),t<=_&&(n=_-1)}}function _o(i,t,e){var n=i[t];i[t]=i[e],i[e]=n}function fm(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(!Xr(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;Xr(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(!Xr(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(Xr(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=ys([]),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=gm(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=ys(t.slice(e,n+1)),_s(a,this.toBBox),a;s||(s=Math.ceil(Math.log(o)/Math.log(r)),r=Math.ceil(o/Math.pow(r,s-1))),a=ys([]),a.leaf=!1,a.height=s;const c=Math.ceil(o/r),h=c*Math.ceil(Math.sqrt(r));rd(t,e,n,h,this.compareMinX);for(let l=e;l<=n;l+=h){const u=Math.min(l+h-1,n);rd(t,l,u,c,this.compareMinY);for(let d=l;d<=u;d+=c){const p=Math.min(d+c-1,u);a.children.push(this._build(t,d,p,s-1))}}return _s(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=_m(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),wo(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=ys(n.children.splice(r,n.children.length-r));a.height=n.height,a.leaf=n.leaf,_s(n,this.toBBox),_s(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(n,a)}_splitRoot(t,e){this.data=ys([t,e]),this.data.height=t.height+1,this.data.leaf=!1,_s(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=yo(t,0,a,this.toBBox),h=yo(t,a,n,this.toBBox),l=ym(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:pm,o=t.leaf?this.compareMinY:mm,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=yo(t,0,e,o),a=yo(t,n-e,n,o);let c=Hr(r)+Hr(a);for(let h=e;h<n-e;h++){const l=t.children[h];wo(r,t.leaf?o(l):l),c+=Hr(r)}for(let h=n-e-1;h>=e;h--){const l=t.children[h];wo(a,t.leaf?o(l):l),c+=Hr(a)}return c}_adjustParentBBoxes(t,e,n){for(let s=n;s>=0;s--)wo(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():_s(t[e],this.toBBox)}};function gm(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 _s(i,t){yo(i,0,i.children.length,t,i)}function yo(i,t,e,n,s){s||(s=ys(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];wo(s,i.leaf?n(r):r)}return s}function wo(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 pm(i,t){return i.minX-t.minX}function mm(i,t){return i.minY-t.minY}function $c(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function Hr(i){return i.maxX-i.minX+(i.maxY-i.minY)}function _m(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 ym(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 Xr(i,t){return t.minX<=i.maxX&&t.minY<=i.maxY&&t.maxX>=i.minX&&t.maxY>=i.minY}function ys(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function rd(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;dm(i,r,t,e,s),o.push(t,r,r,e)}}class wm{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=ad(t,e,n);return s in this.cache_?this.cache_[s]:null}set(t,e,n,s){const o=ad(t,e,n);this.cache_[o]=s,++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function ad(i,t,e){const n=e?Bu(e):"null";return t+":"+i+":"+n}const $r=new wm;class Kc extends Qs{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 wt()}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){wt()}}class vm 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=[xr(n,ht.LOAD,function(){r=!0,o||t()})];return n.src&&kp?(o=!0,n.decode().then(function(){s&&t()}).catch(function(c){s&&(r?t():e())})):a.push(xr(n,ht.ERROR,e)),function(){s=!1,a.forEach(Mt)}}let vo=null;class Em extends Qs{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){vo||(vo=Bt(1,1,void 0,{willReadFrequently:!0})),vo.drawImage(this.image_,0,0);try{vo.getImageData(0,0,1,1),this.tainted_=!1}catch{vo=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=Bt(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 Cm(i,t,e,n,s,o){let r=$r.get(t,n,o);return r||(r=new Em(i,t,e,n,s,o),$r.set(t,n,o,r)),r}function cd(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 Eo extends Ur{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||Rt(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?jr(t.color):null,this.iconImage_=Cm(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 d=()=>{if(this.unlistenImageChange(d),!this.initialOptions_)return;const p=this.iconImage_.getSize();this.setScale(cd(p[0],p[1],t.width,t.height))};this.listenImageChange(d);return}}h!==void 0&&this.setScale(cd(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 Eo({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 hd(i){return new Kt({fill:Co(i,""),stroke:bo(i,""),text:bm(i),image:xm(i)})}function Co(i,t){const e=i[t+"fill-color"];if(e)return e==="none"?null:new de({color:e})}function bo(i,t){const e=i[t+"stroke-width"],n=i[t+"stroke-color"];if(!(!e&&!n))return new Re({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 bm(i){const t=i["text-value"];return t?new po({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:Co(i,"text-"),backgroundFill:Co(i,"text-background-"),stroke:bo(i,"text-"),backgroundStroke:bo(i,"text-background-")}):void 0}function xm(i){const t=i["icon-src"],e=i["icon-img"];if(t||e)return new Eo({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 go({points:n,fill:Co(i,o),stroke:bo(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:Co(i,o),stroke:bo(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 ld={RENDER_ORDER:"renderOrder"};class ud extends mo{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(ld.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(ld.RENDER_ORDER,t)}setStyle(t){let e;if(t===void 0)e=tm;else if(t===null)e=null;else if(typeof t=="function")e=t;else if(t instanceof Kt)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 Kt?s[o]=r:s[o]=hd(r)}e=s}else e=hd(t);this.style_=e,this.styleFunction_=t===null?void 0:J0(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},Zr=[st.FILL],Ki=[st.STROKE],Nn=[st.BEGIN_PATH],dd=[st.CLOSE_PATH];class fd{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 xo extends fd{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],io(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 d=this.tmpCoordinate_;let p=!0,_,y,w;for(_=e+s;_<n;_+=s)d[0]=t[_],d[1]=t[_+1],w=pc(h,d),w!==y?(p&&(a[c++]=l,a[c++]=u,p=!1),a[c++]=d[0],a[c++]=d[1]):w===$t.INTERSECTING?(a[c++]=d[0],a[c++]=d[1],p=!1):p=!0,l=d[0],u=d[1],y=w;return(o&&p||_===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,d;switch(o){case"MultiPolygon":c=t.getOrientedFlatCoordinates(),u=[];const p=t.getEndss();d=0;for(let _=0,y=p.length;_<y;++_){const w=[];d=this.drawCustomCoordinates_(c,d,p[_],r,w),u.push(w)}this.instructions.push([st.CUSTOM,a,u,t,n,Au]),this.hitDetectionInstructions.push([st.CUSTOM,a,u,t,s||n,Au]);break;case"Polygon":case"MultiLineString":l=[],c=o=="Polygon"?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),d=this.drawCustomCoordinates_(c,0,t.getEnds(),r,l),this.instructions.push([st.CUSTOM,a,l,t,n,ao]),this.hitDetectionInstructions.push([st.CUSTOM,a,l,t,s||n,ao]);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,Zi]),this.hitDetectionInstructions.push([st.CUSTOM,a,h,t,s||n,Zi]);break;case"MultiPoint":c=t.getFlatCoordinates(),h=this.appendFlatPointCoordinates(c,r),h>a&&(this.instructions.push([st.CUSTOM,a,h,t,n,Zi]),this.hitDetectionInstructions.push([st.CUSTOM,a,h,t,s||n,Zi]));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,Dp(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||lo);const o=e.getLineCap();n.lineCap=o!==void 0?o:Gr;const r=e.getLineDash();n.lineDash=r?r.slice():yi;const a=e.getLineDashOffset();n.lineDashOffset=a||wi;const c=e.getLineJoin();n.lineJoin=c!==void 0?c:ps;const h=e.getWidth();n.lineWidth=h!==void 0?h:fo;const l=e.getMiterLimit();n.miterLimit=l!==void 0?l:ho,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&&!qi(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_=su(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;to(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class Rm extends xo{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 Sm extends xo{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,yi,wi],Nn);const r=t.getFlatCoordinates(),a=t.getStride();this.drawFlatCoordinates_(r,0,r.length,a),this.hitDetectionInstructions.push(Ki),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,yi,wi],Nn);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(Ki),this.endGeometry(e)}finish(){const t=this.state;return t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&this.instructions.push(Ki),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(Ki),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(Nn)}}class gd extends xo{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(Nn),this.hitDetectionInstructions.push(Nn);for(let h=0;h<c;++h){const l=n[h],u=this.coordinates.length,d=this.appendFlatLineCoordinates(t,e,l,s,!0,!a),p=[st.MOVE_TO_LINE_TO,u,d];this.instructions.push(p),this.hitDetectionInstructions.push(p),a&&(this.instructions.push(dd),this.hitDetectionInstructions.push(dd)),e=l}return r&&(this.instructions.push(Zr),this.hitDetectionInstructions.push(Zr)),a&&(this.instructions.push(Ki),this.hitDetectionInstructions.push(Ki)),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,yi,wi]);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(Nn,h),this.hitDetectionInstructions.push(Nn,h),n.fillStyle!==void 0&&(this.instructions.push(Zr),this.hitDetectionInstructions.push(Zr)),n.strokeStyle!==void 0&&(this.instructions.push(Ki),this.hitDetectionInstructions.push(Ki)),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,yi,wi]);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,yi,wi]);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]=Fn(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 Pm(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],d=t[r+s+1],p=Math.sqrt((u-h)*(u-h)+(d-l)*(d-l));if(a+=p,a>=i){const _=(i-a+p)/p,y=xe(h,u,_),w=xe(l,d,_);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 _=p-a,y=xe(h,u,_/p),w=xe(l,d,_/p);c.push(y,w),o.push(c),c=[y,w],a=0,r+=s}}return a>0&&o.push(c),o}function Om(i,t,e,n,s){let o=e,r=e,a=0,c=0,h=e,l,u,d,p,_,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,p=Math.sqrt(b*b+P*P),w!==void 0&&(c+=d,l=Math.acos((w*b+E*P)/(d*p)),l>i&&(c>a&&(a=c,o=h,r=u),c=0,h=u-s)),d=p,w=b,E=P),_=I,y=M}return c+=p,c>a?[h,u]:[o,r]}const Kr={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class Im extends xo{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 d=o.repeat,p=d?void 0:o.textAlign;let _=0;for(let y=0,w=u.length;y<w;++y){let E;d?E=Pm(d*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(p==null){const z=Om(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 d=this.appendFlatPointCoordinates(h,l);if(d===a)return;if(u&&(d-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 p=o.padding;if(p!=zn&&(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),p=[E,b,P,I]}const _=this.pixelRatio;this.instructions.push([st.DRAW_IMAGE,a,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,void 0,this.declutterImageWithText_,p==zn?zn:p.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,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[y,y],NaN,void 0,this.declutterImageWithText_,p,!!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||uo,justify:e.justify,textBaseline:e.textBaseline||Br,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=Kr[s.textBaseline],l=this.textOffsetY_*c,u=this.text_,d=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,d*c,u,r,1]),this.hitDetectionInstructions.push([st.DRAW_CHARS,t,e,h,s.overflow,a&&ge,s.maxAngle,1,l,o,d,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()||Gr,o.lineDash=_?_.slice():yi,o.lineDashOffset=y===void 0?wi:y,o.lineJoin=a.getLineJoin()||ps,o.lineWidth=w===void 0?fo:w,o.miterLimit=E===void 0?ho:E,o.strokeStyle=ei(a.getColor()||lo)}n=this.textState_;const c=t.getFont()||Ku;X0(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()||Br,n.backgroundFill=t.getBackgroundFill(),n.backgroundStroke=t.getBackgroundStroke(),n.padding=t.getPadding()||zn,n.scale=h===void 0?[1,1]:h;const l=t.getOffsetX(),u=t.getOffsetY(),d=t.getRotateWithView(),p=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=l===void 0?0:l,this.textOffsetY_=u===void 0?0:u,this.textRotateWithView_=d===void 0?!1:d,this.textRotation_=p===void 0?0:p,this.strokeKey_=o?(typeof o.strokeStyle=="string"?o.strokeStyle:Rt(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:"|"+Rt(s.fillStyle):""}this.declutterImageWithText_=e}}const Tm={Circle:gd,Default:xo,Image:Rm,LineString:Sm,Polygon:gd,Text:Im};class pd{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=Tm[e];o=new r(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),s[e]=o}return o}}class Am extends Js{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.declutterExecutorGroup=null}getFeatures(t){return wt()}getData(t){return null}prepareFrame(t){return wt()}renderFrame(t,e){return wt()}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 md extends We{constructor(t,e,n,s){super(t),this.inversePixelTransform=e,this.frameState=n,this.context=s}}const _d=[];let ws=null;function Mm(){ws=Bt(1,1,void 0,{willReadFrequently:!0})}class Jc extends Am{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){ws||Mm(),ws.clearRect(0,0,1,1);let s;try{ws.drawImage(t,e,n,1,1,0,0,1,1),s=ws.getImageData(0,0,1,1).data}catch{return ws=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&&qi(jr(t.style.backgroundColor),jr(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=Bt();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=Ir(n),r=Or(n),a=Pr(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 md(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,d=-t[0]+a,p=-t[1];return qe(this.tempTransform,c,h,l,u,-n,d,p)}disposeInternal(){delete this.frameState,super.disposeInternal()}}function Dm(i,t,e,n,s,o,r,a,c,h,l,u){let d=i[t],p=i[t+1],_=0,y=0,w=0,E=0;function b(){_=d,y=p,t+=n,d=i[t],p=i[t+1],E+=w,w=Math.sqrt((d-_)*(d-_)+(p-y)*(p-y))}do b();while(t<e-n&&E+w<o);let P=w===0?0:(o-E)/w;const I=xe(_,d,P),M=xe(y,p,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(_,d,P),Y=xe(y,p,P);let X;if(u){const A=[I,M,q,Y];xu(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,d=i[t],p=i[t+1];let R;if(v){b(),R=Math.atan2(p-y,d-_),X&&(R+=R>0?-Q:Q);const A=(q+I)/2,F=(Y+M)/2;return m[0]=[A,F,(z-o)/2,R,s],m}s=s.replace(/\n/g," ");for(let A=0,F=s.length;A<F;){b();let N=Math.atan2(p-y,d-_);if(X&&(N+=N>0?-Q:Q),R!==void 0){let et=N-R;if(et+=et>Q?-2*Q:et<-Q?2*Q:0,Math.abs(et)>r)return null}R=N;const G=A;let B=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+B+it/2)break;B+=it}if(A===G)continue;const Z=X?s.substring(F-G,F-A):s.substring(G,A);P=w===0?0:(o+B/2-E)/w;const V=xe(_,d,P),at=xe(y,p,P);m.push([V,at,B/2,N,Z]),o+=B}return m}const vs=Te(),Qi=[],Ei=[],Ci=[],Ji=[];function yd(i){return i[3].declutterBox}const wd=new RegExp("[֑-ࣿיִ-﷿ﹰ-ﻼࠀ-࿿-]");function th(i,t){return t==="start"?t=wd.test(i)?"right":"left":t==="end"&&(t=wd.test(i)?"left":"right"),Kr[t]}function Fm(i,t,e){return e>0&&i.push(`
27
+ `,""),i.push(t,""),i}class Lm{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),d=c.justify?Kr[c.justify]:th(Array.isArray(t)?t[0]:t,c.textAlign||uo),p=s&&r.lineWidth?r.lineWidth:0,_=u?t:t.split(`
28
+ `).reduce(Fm,[]),{width:y,height:w,widths:E,heights:b,lineWidths:P}=Z0(c,_),I=y+p,M=[],D=(I+2)*l[0],L=(w+p)*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",p),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-d;let Y=d*I+q*p;const X=[],Q=[];let m=0,v=0,R=0,A=0,F;for(let N=0,G=_.length;N<G;N+=2){const B=_[N];if(B===`
29
+ `){v+=m,m=0,Y=d*I+q*p,++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[R]);const V=[B,Y+q*E[R]+d*(E[R]-P[A]),.5*(p+m)+v];Y+=E[R],s&&X.push("strokeText",V),n&&Q.push("fillText",V),++R}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,d,p,_,y,w){a*=d[0],c*=d[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*d[0]+_[1],D=_[0]+I*d[1]+_[2],L=E-_[3],z=b-_[0];(y||u!==0)&&(Qi[0]=L,Ji[0]=L,Qi[1]=z,Ei[1]=z,Ei[0]=L+M,Ci[0]=Ei[0],Ci[1]=z+D,Ji[1]=Ci[1]);let q;return u!==0?(q=qe(be(),n,s,1,1,u,-n,-s),Ut(q,Qi),Ut(q,Ei),Ut(q,Ci),Ut(q,Ji),fi(Math.min(Qi[0],Ei[0],Ci[0],Ji[0]),Math.min(Qi[1],Ei[1],Ci[1],Ji[1]),Math.max(Qi[0],Ei[0],Ci[0],Ji[0]),Math.max(Qi[1],Ei[1],Ci[1],Ji[1]),vs)):fi(Math.min(L,L+M),Math.min(z,z+D),Math.max(L,L+M),Math.max(z,z+D),vs),p&&(E=Math.round(E),b=Math.round(b)),{drawImageX:E,drawImageY:b,drawImageW:P,drawImageH:I,originX:h,originY:l,declutterBox:{minX:vs[0],minY:vs[1],maxX:vs[2],maxY:vs[3],value:w},canvasTransform:q,scale:d}}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,Qi,Ei,Ci,Ji,r,a),K0(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||uo),l=Kr[o.textBaseline||Br],u=a&&a.lineWidth?a.lineWidth:0,d=r.width/c-2*o.scale[0],p=h*d+2*(.5-h)*u,_=l*r.height/c+2*(.5-l)*u;return{label:r,anchorX:p,anchorY:_}}execute_(t,e,n,s,o,r,a,c){let h;this.pixelCoordinates_&&qi(n,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=mi(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),Bp(this.renderedTransform_,n));let l=0;const u=s.length;let d=0,p,_,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_,R=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,B,Z;for(;l<u;){const V=s[l];switch(V[0]){case st.BEGIN_GEOMETRY:N=V[1],Z=V[3],N.getGeometry()?a!==void 0&&!te(a,Z.getExtent())?l=V[2]+1:++l:l=V[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:d=V[1];const et=h[d],it=h[d+1],gt=h[d+2],yt=h[d+3],dt=gt-et,Et=yt-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:d=V[1],p=V[2];const xt=V[3],Ft=V[4],kt=V.length==6?V[5]:void 0;A.geometry=xt,A.feature=N,l in m||(m[l]=[]);const Wt=m[l];kt?kt(h,d,p,2,Wt):(Wt[0]=h[d],Wt[1]=h[d+1],Wt.length=2),Ft(Wt,A),++l;break;case st.DRAW_IMAGE:d=V[1],p=V[2],I=V[3],_=V[4],y=V[5];let he=V[6];const ye=V[7],es=V[8],we=V[9],En=V[10];let Cn=V[11];const bn=V[12];let ae=V[13];const ve=V[14],Oe=V[15];if(!I&&V.length>=20){M=V[19],D=V[20],L=V[21],z=V[22];const Xt=this.drawLabelWithPointPlacement_(M,D,L,z);I=Xt.label,V[3]=I;const Xs=V[23];_=(Xt.anchorX-Xs)*this.pixelRatio,V[4]=_;const je=V[24];y=(Xt.anchorY-je)*this.pixelRatio,V[5]=y,he=I.height,V[6]=he,ae=I.width,V[13]=ae}let Ne;V.length>25&&(Ne=V[25]);let Ui,di,St;V.length>17?(Ui=V[16],di=V[17],St=V[18]):(Ui=zn,di=!1,St=!1),En&&R?Cn+=v:!En&&!R&&(Cn-=v);let Ee=0;for(;d<p;d+=2){if(Ne&&Ne[Ee++]<ae/this.pixelRatio)continue;const Xt=this.calculateImageOrLabelDimensions_(I.width,I.height,h[d],h[d+1],ae,he,_,y,es,we,Cn,bn,o,Ui,di||St,N),Xs=[t,e,I,Xt,ye,di?X:null,St?Q:null];if(c){if(ve==="none")continue;if(ve==="obstacle"){c.insert(Xt.declutterBox);continue}else{let je,ki;if(Oe){const Ie=p-d;if(!Oe[Ie]){Oe[Ie]=Xs;continue}if(je=Oe[Ie],delete Oe[Ie],ki=yd(je),c.collides(ki))continue}if(c.collides(Xt.declutterBox))continue;je&&(c.insert(ki),this.replayImageOrLabel_.apply(this,je)),c.insert(Xt.declutterBox)}}this.replayImageOrLabel_.apply(this,Xs)}++l;break;case st.DRAW_CHARS:const $e=V[1],At=V[2],Ue=V[3],ac=V[4];z=V[5];const cc=V[6],yr=V[7],ji=V[8];L=V[9];const wr=V[10];M=V[11],D=V[12];const hc=[V[13],V[13]],vr=this.textStates[D],is=vr.font,ns=[vr.scale[0]*yr,vr.scale[1]*yr];let ss;is in this.widths_?ss=this.widths_[is]:(ss={},this.widths_[is]=ss);const xn=ku(h,$e,At,2),Rn=Math.abs(ns[0])*Ju(is,M,ss);if(ac||Rn<=xn){const Xt=this.textStates[D].textAlign,Xs=(xn-Rn)*th(M,Xt),je=Dm(h,$e,At,2,M,Xs,cc,Math.abs(ns[0]),Ju,is,ss,R?0:this.viewRotation_);t:if(je){const ki=[];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]+(ns[0]<0?-wr:wr),y=Ue*Ce.height+(.5-Ue)*2*wr*ns[1]/ns[0]-ji;const Wi=this.calculateImageOrLabelDimensions_(Ce.width,Ce.height,ke[0],ke[1],Ce.width,Ce.height,_,y,0,0,ke[3],hc,!1,zn,!1,N);if(c&&c.collides(Wi.declutterBox))break t;ki.push([t,e,Ce,Wi,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-ji;const Wi=this.calculateImageOrLabelDimensions_(Ce.width,Ce.height,ke[0],ke[1],Ce.width,Ce.height,_,y,0,0,ke[3],hc,!1,zn,!1,N);if(c&&c.collides(Wi.declutterBox))break t;ki.push([t,e,Ce,Wi,1,null,null])}c&&c.load(ki.map(yd));for(let Wi=0,lE=ki.length;Wi<lE;++Wi)this.replayImageOrLabel_.apply(this,ki[Wi])}}++l;break;case st.END_GEOMETRY:if(r!==void 0){N=V[1];const Xt=r(N,Z);if(Xt)return Xt}++l;break;case st.FILL:F?q++:this.fill_(t),++l;break;case st.MOVE_TO_LINE_TO:for(d=V[1],p=V[2],G=h[d],B=h[d+1],b=G+.5|0,P=B+.5|0,(b!==w||P!==E)&&(t.moveTo(G,B),w=b,E=P),d+=2;d<p;d+=2)G=h[d],B=h[d+1],b=G+.5|0,P=B+.5|0,(d==p-2||b!==w||P!==E)&&(t.lineTo(G,B),w=b,E=P);++l;break;case st.SET_FILL_STYLE:X=V,this.alignFill_=V[2],q&&(this.fill_(t),q=0,Y&&(t.stroke(),Y=0)),t.fillStyle=V[1],++l;break;case st.SET_STROKE_STYLE:Q=V,Y&&(t.stroke(),Y=0),this.setStrokeStyle_(t,V),++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 vd{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 Lm(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_=Bt(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(),so(u,t),to(u,e*(this.renderBuffer_+s),u));const d=zm(s);let p;function _(M,D){const L=l.getImageData(0,0,a,a).data;for(let z=0,q=d.length;z<q;z++)if(L[d[z]]>0){if(!r||p!=="Image"&&p!=="Text"||r.includes(M)){const Y=(d[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(Pn);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(p=eh[E],P=b[p],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 mi(a,0,8,2,t,a),a}isEmpty(){return Ks(this.executorsByZIndex_)}execute(t,e,n,s,o,r,a){const c=Object.keys(this.executorsByZIndex_).map(Number);c.sort(Pn),this.maxExtent_&&(t.save(),this.clip(t,n)),r=r||eh;let h,l,u,d,p,_;for(a&&c.reverse(),h=0,l=c.length;h<l;++h){const y=c[h].toString();for(p=this.executorsByZIndex_[y],u=0,d=r.length;u<d;++u){const w=r[u];_=p[w],_!==void 0&&_.execute(t,e,n,s,o,a)}}this.maxExtent_&&t.restore()}}const ih={};function zm(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 Ed extends fd{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=mi(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 d=o[l]-this.imageAnchorX_,p=o[l+1]-this.imageAnchorY_;if(h!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const _=d+this.imageAnchorX_,y=p+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_,d,p,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=mi(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=mi(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=S0(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),qi(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:uo;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||yi;this.strokeState_={lineCap:s!==void 0?s:Gr,lineDash:this.pixelRatio_===1?l:l.map(u=>u*this.pixelRatio_),lineDashOffset:(r||wi)*this.pixelRatio_,lineJoin:a!==void 0?a:ps,lineWidth:(c!==void 0?c:fo)*this.pixelRatio_,miterLimit:h!==void 0?h:ho,strokeStyle:ei(n||lo)}}}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 p=e.getColor();this.textFillState_={fillStyle:ei(p||ge)}}const n=t.getStroke();if(!n)this.textStrokeState_=null;else{const p=n.getColor(),_=n.getLineCap(),y=n.getLineDash(),w=n.getLineDashOffset(),E=n.getLineJoin(),b=n.getWidth(),P=n.getMiterLimit();this.textStrokeState_={lineCap:_!==void 0?_:Gr,lineDash:y||yi,lineDashOffset:w||wi,lineJoin:E!==void 0?E:ps,lineWidth:b!==void 0?b:fo,miterLimit:P!==void 0?P:ho,strokeStyle:ei(p||lo)}}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(),d=t.getTextBaseline();this.textState_={font:s!==void 0?s:Ku,textAlign:u!==void 0?u:uo,textBaseline:d!==void 0?d:Br},this.text_=l!==void 0?Array.isArray(l)?l.reduce((p,_,y)=>p+=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 Nm(i,t,e,n,s,o,r){const a=i[0]*si,c=i[1]*si,h=Bt(a,c);h.imageSmoothingEnabled=!1;const l=h.canvas,u=new Ed(h,si,s,null,r),d=e.length,p=Math.floor((256*256*256-1)/d),_={};for(let w=1;w<=d;++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*p).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=Bt(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 Eo({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 R=_[v];R||(R={},_[v]=R,R.Polygon=[],R.Circle=[],R.LineString=[],R.Point=[]);const A=q.getType();if(A==="GeometryCollection"){const F=q.getGeometriesArrayRecursive();for(let N=0,G=F.length;N<G;++N){const B=F[N];R[B.getType().replace("Multi","")].push(B,Y)}}else R[A.replace("Multi","")].push(q,Y)}}const y=Object.keys(_).map(Number).sort(Pn);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 Um(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 jm=.5,Cd={Point:Hm,LineString:Bm,Polygon:$m,MultiPoint:Xm,MultiLineString:Vm,MultiPolygon:Ym,GeometryCollection:Gm,Circle:Wm};function km(i,t){return parseInt(Rt(i),10)-parseInt(Rt(t),10)}function bd(i,t){const e=nh(i,t);return e*e}function nh(i,t){return jm*i/t}function Wm(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 xd(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 qm(i,t,e,n,o,r),a}function qm(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=Cd[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 Gm(i,t,e,n,s){const o=t.getGeometriesArray();let r,a;for(r=0,a=o.length;r<a;++r){const c=Cd[o[r].getType()];c(i,o[r],e,n,s)}}function Bm(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 Vm(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 Ym(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 Hm(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 Xm(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 $m(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 Sd 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(),d=e.pixelRatio,p=e.viewHints,_=!(p[Vt.ANIMATING]||p[Vt.INTERACTING]),y=this.compositionContext_,w=Math.round(e.size[0]*d),E=Math.round(e.size[1]*d),b=u.getWrapX()&&c.canWrapX(),P=b?_t(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,d,w,E,M*P);t.execute(y,1,D,h,_,void 0,n)}while(++M<I)}setupCompositionContext_(){if(this.opacity_!==1){const t=Bt(this.context.canvas.width,this.context.canvas.height,_d);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,kr(this.compositionContext_),_d.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];Vp(this.pixelTransform,1/n,1/n),Rr(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),d=Math.round(t.size[1]*n);a.width!=u||a.height!=d?(a.width=u,a.height=d,a.style.transform!==o&&(a.style.transform=o)):this.containerReused||r.clearRect(0,0,u,d),this.preRender(r,t);const p=t.viewState;p.projection,this.opacity_=s.opacity,this.setupCompositionContext_();let _=!1;if(l&&s.extent&&this.clipping){const y=pi(s.extent);l=te(y,t.extent),_=l&&!In(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_!==p.rotation&&(this.renderedRotation_=p.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,d=n[1]*si;l.push(this.getRenderTransform(s,o,r,si,u,d,0).slice());const p=h.getSource(),_=a.getExtent();if(p.getWrapX()&&a.canWrapX()&&!In(_,c)){let y=c[0];const w=_t(_);let E=0,b;for(;y<_[0];)--E,b=w*E,l.push(this.getRenderTransform(s,o,r,si,u,d,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,d,b).slice()),y-=w}this.hitDetectionImageData_=Nm(n,l,this.renderedFeatures_,h.getStyleFunction(),c,o,r)}e(Um(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(p,_,y){const w=Rt(p),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(p,c,_);E.geometry=_,E.distanceSq=y}}else{if(y===0)return h[w]=!0,s(p,c,_);o.push(h[w]={feature:p,layer:c,geometry:_,distanceSq:y,callback:s})}};let u;const d=[this.replayGroup_];return this.declutterExecutorGroup&&d.push(this.declutterExecutorGroup),d.some(p=>u=p.forEachFeatureAtCoordinate(t,r,a,n,l,p===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[Vt.ANIMATING],o=t.viewHints[Vt.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,d=t.pixelRatio,p=e.getRevision(),_=e.getRenderBuffer();let y=e.getRenderOrder();y===void 0&&(y=km);const w=h.center.slice(),E=to(c,_*u),b=E.slice(),P=[E.slice()],I=l.getExtent();if(n.getWrapX()&&l.canWrapX()&&!In(I,t.extent)){const R=_t(I),A=Math.max(_t(E)/2,R);E[0]=I[0]-A,E[2]=I[2]+A,uu(w,l);const F=au(P[0],l);F[0]<I[0]&&F[2]<I[2]?P.push([F[0]+R,F[1],F[2]+R,F[3]]):F[0]>I[0]&&F[2]>I[2]&&P.push([F[0]-R,F[1],F[2]-R,F[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==p&&this.renderedRenderOrder_==y&&In(this.wrappedRenderedExtent_,E))return qi(this.renderedExtent_,b)||(this.hitDetectionImageData_=null,this.renderedExtent_=b),this.renderedCenter_=w,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const M=new pd(nh(u,d),E,u,d);let D;this.getLayer().getDeclutter()&&(D=new pd(nh(u,d),E,u,d));let L;for(let R=0,A=P.length;R<A;++R)n.loadFeatures(P[R],u,l);const z=bd(u,d);let q=!0;const Y=R=>{let A;const F=R.getStyleFunction()||e.getStyleFunction();if(F&&(A=F(R,u)),A){const N=this.renderFeature(R,z,A,M,L,D);q=q&&!N}},X=bu(E),Q=n.getFeaturesInExtent(X);y&&Q.sort(y);for(let R=0,A=Q.length;R<A;++R)Y(Q[R]);this.renderedFeatures_=Q,this.ready=q;const m=M.finish(),v=new vd(E,u,d,n.getOverlaps(),m,e.getRenderBuffer());return D&&(this.declutterExecutorGroup=new vd(E,u,d,n.getOverlaps(),D.finish(),e.getRenderBuffer())),this.renderedResolution_=u,this.renderedRevision_=p,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=xd(s,t,n[c],e,this.boundHandleStyleImageChange_,o,r)||a;else a=xd(s,t,n,e,this.boundHandleStyleImageChange_,o,r);return a}}class bi extends ud{constructor(t){super(t)}createRenderer(){return new Sd(this)}}class Pd{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_[Rt(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_[Rt(a)]=c}this.rbush_.load(n)}remove(t){const e=Rt(t),n=this.items_[e];return delete this.items_[e],this.rbush_.remove(n)!==null}update(t,e){const n=this.items_[Rt(e)],s=[n.minX,n.minY,n.maxX,n.maxY];Vi(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 Ks(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return fi(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 Ze{constructor(t){super(),this.projection=Gt(t.projection),this.attributions_=Od(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_=Od(t),this.changed()}setState(t){this.state_=t,this.changed()}}function Od(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 Zm(i,t){return[[-1/0,-1/0,1/0,1/0]]}let Km=!1;function Qm(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=Km,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 Id(i,t){return function(e,n,s,o,r){const a=this;Qm(i,t,e,n,s,function(c,h){a.addFeatures(c),o!==void 0&&o(c)},r||cs)}}class tn extends We{constructor(t,e,n){super(t),this.feature=e,this.features=n}}class en 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_=cs,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_=Id(this.url_,this.format_)),this.strategy_=t.strategy!==void 0?t.strategy:Zm;const e=t.useSpatialIndex!==void 0?t.useSpatialIndex:!0;this.featuresRtree_=e?new Pd:null,this.loadedExtentsRtree_=new Pd,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=Rt(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 tn(Be.ADDFEATURE,t))}setupChangeEvents_(t,e){this.featureChangeKeys_[t]=[Ct(e,ht.CHANGE,this.handleFeatureChange_,this),Ct(e,as.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=Rt(a);this.addToIndex_(c,a)&&n.push(a)}for(let o=0,r=n.length;o<r;o++){const a=n[o],c=Rt(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 tn(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 tn(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(),Ks(this.nullGeometryFeatures_)||On(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=n0(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||$s,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 d=Math.sqrt(a);c[0]=n-d,c[1]=s-d,c[2]=n+d,c[3]=s+d}}}),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=Rt(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 tn(Be.CHANGEFEATURE,e))}hasFeature(t){const e=t.getId();return e!==void 0?e in this.idIndex_:Rt(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Ks(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 In(l.extent,c)})||(++this.loadingExtentsCount_,this.dispatchEvent(new tn(Be.FEATURESLOADSTART)),this.loader_.call(this,c,e,n,l=>{--this.loadingExtentsCount_,this.dispatchEvent(new tn(Be.FEATURESLOADEND,void 0,l))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new tn(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(Vi(s.extent,t))return n=s,!0}),n&&e.remove(n)}removeFeature(t){if(!t)return;const e=Rt(t);e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t),this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=Rt(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 tn(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(Id(t,this.format_))}}function Td(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=qp(i.inversePixelTransform.slice(),s.coordinateToPixelTransform),r=bd(s.viewState.resolution,n);let a;return new Ed(i.context,n,s.extent,o,s.viewState.rotation,r,a)}class Ad 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 Md extends Qs{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(){wt()}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:Kl(s/this.transition_)}inTransition(t){return this.transition_?this.transitionStarts_[t]!==-1:!1}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}}class Dd extends Md{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_=Jm(),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 Jm(){const i=Bt(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}class t_{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 e_ extends Er{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){wt()}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]),Rr(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 d=l.projection,p=uu(t.slice(),d),_=[[0,0]];if(d.canWrapX()&&s){const I=d.getExtent(),M=_t(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()?p: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,$s,this,o,r)!==void 0}getMap(){return this.map_}renderFrame(t){wt()}flushDeclutterItems(t){}scheduleExpireIconCache(t){$r.canExpireCache()&&t.postRenderFunctions.push(i_)}}function i_(i,t){$r.expire()}class n_ extends e_{constructor(t){super(t),this.fontChangeListenerKey_=Ct(vi,as.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=qr+" 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 md(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),Y0(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 ed{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);Zs(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,as.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_[Rt(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=Rt(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=Tn(c.extent,s.extent):c.extent=s.extent),c.zIndex===void 0&&(c.zIndex=o)}return e}getSourceState(){return"ready"}}class Es extends We{constructor(t,e,n){super(t),this.map=e,this.frameState=n!==void 0?n:null}}class on extends Es{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 s_ extends Qs{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_,eu?{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"},Qr=1/0;class o_{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,Zs(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!=Qr?(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==Qr?delete this.queuedElements_[this.keyFunction_(r)]:(n[s]=c,e[s++]=r);e.length=s,n.length=s,this.heapify_()}}class Fd extends o_{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 r_(i,t,e,n,s){if(!i||!(e in i.wantedTiles)||!i.wantedTiles[e][t.getKey()])return Qr;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 Ze{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!==cs&&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 a_ 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+" "+qr+" "+Nc+(this.collapsed_&&this.collapsible_?" "+Xu:"")+(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),!qi(e,this.renderedAttributions_)){V0(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(Xu),this.collapsed_?Hu(this.collapseLabel_,this.label_):Hu(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 c_ 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+" "+qr+" "+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(Wr)}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:Sn}):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(Wr);!o&&n===0?this.element.classList.add(Wr):o&&n!==0&&this.element.classList.remove(Wr)}this.label_.style.transform=s}this.rotation_=n}}class h_ 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 d=e+" "+qr+" "+Nc,p=this.element;p.className=d,p.appendChild(l),p.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:Sn})):n.setZoom(o)}}}function Ld(i){i=i||{};const t=new Qe;return(i.zoom!==void 0?i.zoom:!0)&&t.push(new h_(i.zoomOptions)),(i.rotate!==void 0?i.rotate:!0)&&t.push(new c_(i.rotateOptions)),(i.attribution!==void 0?i.attribution:!0)&&t.push(new a_(i.attributionOptions)),t}const zd={ACTIVE:"active"};class So extends Ze{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(zd.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(zd.ACTIVE,t)}setMap(t){this.map_=t}}function l_(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:Ap,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:Sn})}class u_ extends So{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 Po extends So{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 d_=function(i){const t=i.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},f_=function(i){const t=i.map.getTargetElement(),e=i.map.getOwnerDocument().activeElement;return t.contains(e)},Nd=function(i){return i.map.getTargetElement().hasAttribute("tabindex")?f_(i):!0},g_=$s,Ud=function(i){const t=i.originalEvent;return t.button==0&&!(jp&&Jl&&t.ctrlKey)},jd=function(i){const t=i.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},p_=function(i){const t=i.originalEvent;return Jl?t.metaKey:t.ctrlKey},m_=function(i){const t=i.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},kd=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"},__=function(i){const t=i.originalEvent;return pt(t!==void 0,56),t.isPrimary&&t.button===0};class y_ extends Po{constructor(t){super({stopDown:br}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:hh(jd,__);this.condition_=t.onFocusOnly?hh(Nd,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();_0(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:Sn})}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 w_ extends Po{constructor(t){t=t||{},super({stopDown:br}),this.condition_=t.condition?t.condition:d_,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===Bc)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)&&Ud(t)&&this.condition_(t)?(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}class v_ extends Er{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 gs([s])}getGeometry(){return this.geometry_}}const Jr={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 E_ extends Po{constructor(t){super(),this.on,this.once,this.un,t=t||{},this.box_=new v_(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:Ud,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(Jr.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?Jr.BOXEND:Jr.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(Jr.BOXSTART,t.coordinate,t)),!0):!1}onBoxEnd(t){}}class C_ extends E_{constructor(t){t=t||{};const e=t.condition?t.condition:m_;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:Sn})}}const Un={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};class b_ extends So{constructor(t){super(),t=t||{},this.defaultCondition_=function(e){return jd(e)&&kd(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==Un.DOWN||s==Un.LEFT||s==Un.RIGHT||s==Un.UP)){const r=t.map.getView(),a=r.getResolution()*this.pixelDelta_;let c=0,h=0;s==Un.DOWN?h=-a:s==Un.LEFT?c=-a:s==Un.RIGHT?c=a:h=a;const l=[c,h];bc(l,r.getRotation()),l_(r,l,this.duration_),n.preventDefault(),e=!0}}return!e}}class x_ extends So{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(e){return!p_(e)&&kd(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 So{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:g_;this.condition_=t.onFocusOnly?hh(Nd,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,Up&&s.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(o/=tu),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 S_ extends Po{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=br),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!==Bc&&(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 P_ extends Po{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=br),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 Wd(i){i=i||{};const t=new Qe,e=new t_(-.005,.05,100);return(i.altShiftDragRotate!==void 0?i.altShiftDragRotate:!0)&&t.push(new w_),(i.doubleClickZoom!==void 0?i.doubleClickZoom:!0)&&t.push(new u_({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan!==void 0?i.dragPan:!0)&&t.push(new y_({onFocusOnly:i.onFocusOnly,kinetic:e})),(i.pinchRotate!==void 0?i.pinchRotate:!0)&&t.push(new S_),(i.pinchZoom!==void 0?i.pinchZoom:!0)&&t.push(new P_({duration:i.zoomDuration})),(i.keyboard!==void 0?i.keyboard:!0)&&(t.push(new b_),t.push(new x_({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 C_({duration:i.zoomDuration})),t}function qd(i){if(i instanceof mo){i.setMapInternal(null);return}i instanceof sn&&i.getLayers().forEach(qd)}function Gd(i,t){if(i instanceof mo){i.setMapInternal(t);return}if(i instanceof sn){const e=i.getLayers().getArray();for(let n=0,s=e.length;n<s;++n)Gd(e[n],t)}}let O_=class extends Ze{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=I_(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:tu,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||Ld(),this.interactions=e.interactions||Wd({onFocusOnly:!0}),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new Fd(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){Gd(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:$s,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:$s,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=gi(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 r_(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[Vt.ANIMATING]||r[Vt.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 Es(rn.LOADEND,this,t)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Es(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 n_(this)),this.mapBrowserEventHandler_=new s_(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_,eu?{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,as.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,as.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){qd(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&&qu(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:Rt(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_||!Hi(this.previousExtent_)&&!Vi(o.extent,this.previousExtent_))&&(this.dispatchEvent(new Es(rn.MOVESTART,this,s)),this.previousExtent_=no(this.previousExtent_)),this.previousExtent_&&!o.viewHints[Vt.ANIMATING]&&!o.viewHints[Vt.INTERACTING]&&!Vi(o.extent,this.previousExtent_)&&(this.dispatchEvent(new Es(rn.MOVEEND,this,o)),su(o.extent,this.previousExtent_))),this.dispatchEvent(new Es(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],!qu(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&gu("No map visible because the map container's width or height are 0."))}const n=this.getSize();e&&(!n||!qi(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 I_(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 T_{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 ta(i,t,e){return i+"/"+t+"/"+e}function Vd(i){return ta(i[0],i[1],i[2])}function A_(i){return i.split("/").map(Number)}function Yd(i){return(i[1]<<i[0])+i[2]}function M_(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 Hd extends T_{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=A_(t)[0];this.forEach(s=>{s.tileCoord[0]!==n&&(this.remove(Vd(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 Cs(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 Xd(i,t=128,e=128,n="map",s=1){return new Promise((o,r)=>{i.once("rendercomplete",()=>{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 p=c.toDataURL("image/png");o(p)}catch(a){r(a)}}),i.renderSync()})}function $d(i,t){const{center:e,orbitPeriod:n,heading:s=0}=t,o=i.getView(),a=(d=>d*Math.PI/180)(s);let c,h,l=!0;const u=d=>{h||(h=d);const _=(d-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 D_(i,t){const e=vt(t),n=new Je({geometry:new Ke(e)});n.setStyle(new Kt({image:new ii({radius:6,fill:new de({color:"red"}),stroke:new Re({color:"white",width:2})}),text:new po({text:"中心点可视化-测试后删除",font:"14px sans-serif",fill:new de({color:"black"}),stroke:new Re({color:"white",width:3}),offsetY:-15})}));const s=new bi({source:new en({features:[n]})});i.addLayer(s)}class Zd extends f.Destroyable{constructor(e,n,s){super();S(this,"keysPressed",{w:!1,a:!1,s:!1,d:!1});S(this,"animationId",0);S(this,"view");S(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(vt(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 F_(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 Oo(i){return 6378137/Math.pow(2,i-5)}function jn(i){const e=Math.log2(6378137/i)+5+0;return Math.min(28,Math.max(0,e))}class Kd extends f.Destroyable{constructor(e){super();S(this,"lastTime",performance.now());S(this,"frameCount",0);S(this,"currentFPS",0);S(this,"map");S(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 Qd=[0,-90,0];function Jd(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,d]=s,p=vt([l,u]),_=(jn==null?void 0:jn(d))??n.getZoom(),w=(((o==null?void 0:o[0])??0)+(a??0))*Math.PI/180,E={center:p,zoom:_,rotation:-w,duration:r};try{return n.animate(E,()=>{}),Promise.resolve(!0)}catch{return h==null||h(),Promise.resolve(!1)}}function xi(i,t,e,n,s,o){return(i==null?void 0:i.viewer)&&Jd(i,{position:t,rotation:n,duration:s&&s*1e3,cancelCallback:o})}function ea(i){const t=i.map(e=>vt([e[0],e[1]]));return Sr(t)}const Io=(i,t,e=1,n=350)=>{i.getView().fit(t,{duration:e*1e3,padding:Array.isArray(n)?n:[n,n,n,n]})},L_=(i,t,e=1,n=350)=>{const s=ea(t);Io(i,s,e,n)},fh=(i,t,e=1,n=350)=>{const s=vt([t[0],t[1]]),o=Sr([s]);Io(i,o,e,n)},z_=(i,t,e)=>{};function tf(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=(Oo==null?void 0:Oo(o??0))??0;return[s[0],s[1],r]}class N_ extends f.Destroyable{constructor(e,n){super();S(this,"_map");S(this,"_view");S(this,"_enabled",!0);S(this,"_keys",[]);S(this,"_changed",new f.Event);S(this,"_options");S(this,"_rafPending",!1);S(this,"_rafId",null);S(this,"_lastEmit",0);if(this._options={emitImmediately:!0,usePostRender:!1,throttleMs:0,useRaf:!0,...n},e instanceof os.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 ef(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]=Zt(o),c=e??0;return n?(n[0]=r,n[1]=a,n[2]=c,n):[r,a,c]}function nf(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=Zt(a),h=[c[0],c[1],e.position[2]],l=e.position,u=e.heading,d=U_(t,n,l),p=(_,y)=>{const w=j_(l,h,_),E=f.geoRhumbDistance(l,h);if(w>.98&&E<d&&!(o!=null&&o[y])){s.constraintMode=y;const b=f.geoRhumbDestination(l,E,_);if(b)return s.startDragPos=[b[0],b[1],l[2]],!0}return!1};return p(u+90,"x")||p(u,"y")?!0:!(o!=null&&o.xy)&&f.geoRhumbDistance(l,h)<d?(s.constraintMode="xy",s.startDragPos=h,!0):!1}function U_(i,t,e){const n=i.getPixelFromCoordinate(vt([e[0],e[1]])),s=[n[0]+t,n[1]],o=Zt(i.getCoordinateFromPixel(s));return f.geoRhumbDistance([e[0],e[1],0],[o[0],o[1],0])}function j_(i,t,e){const n=f.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=f.geoRhumbDistance(i,e),o=f.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?f.geoRhumbDestination(i,s,t,n):f.geoRhumbDestination(i,s,t+180,n),[r>0?s:-s,n]}function k_(i,t,e){const n=e*.1,s=[];for(let o=-9;o<10;++o){const r=f.geoRhumbDestination(i,n*o,t);r&&s.push(r)}return s}function W_(i,t){return f.geoNearestPointOnLine(i,t).geometry.coordinates}function q_(i,t,e,n=10){const s={constraintMode:"none",startDragPos:[0,0,0]},o=i.getPixelFromCoordinate(vt([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,d]=Zt(i.getCoordinateFromPixel(r));return s.startDragPos=[u,d,e.position[2]],s}function G_(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]=Zt(o),[c,h]=Zt(t);return Math.abs(f.geoRhumbDistance([c,h,0],[r,a,0]))}function sf(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 d=l/u,p=e+d*r,_=n+d*a;return Math.hypot(i-p,t-_)}function of(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=vt([e.position[0],e.position[1]]),c=i.getPixelFromCoordinate(a);if(!c)return r;const h=i.getEventPixel(t),[l,u]=h,d=Math.max(1e-6,e.dimensions[0]),p=e.heading,_=f.geoRhumbDestination(e.position,d,p+90),y=f.geoRhumbDestination(e.position,d,p+0);if(!_||!y)return r;const w=a,E=a,b=vt([_[0],_[1]]),P=vt([y[0],y[1]]),I=i.getPixelFromCoordinate(w),M=i.getPixelFromCoordinate(b),D=i.getPixelFromCoordinate(E),L=i.getPixelFromCoordinate(P),z=G_(i,a,n),Y=Math.hypot(l-c[0],u-c[1])<=n,X=sf(l,u,I[0],I[1],M[0],M[1]),Q=sf(l,u,D[0],D[1],L[0],L[1]);if(!(o!=null&&o.zAxis)){const R=d,A=f.geoRhumbDestination(e.position,R,p);if(!A)return r;const F=i.getPixelFromCoordinate(vt([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=Zt(i.getCoordinateFromPixel(h));if(m==="x"||m==="y"){const R=m==="x"?p+90:p+0,[A,F]=an(e.position,R,[v[0],v[1],e.position[2]]);if(A>0&&F&&f.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 rf extends f.Destroyable{constructor(t,e,n,s=100){super();const o=t.getView(),[r,a]=f.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 g={};g.typeOf={};function B_(i){return`${i} is required, actual value was undefined`}function bs(i,t,e){return`Expected ${e} to be typeof ${t}, actual typeof was ${i}`}g.defined=function(i,t){if(!C(t))throw new j(B_(i))},g.typeOf.func=function(i,t){if(typeof t!="function")throw new j(bs(typeof t,"function",i))},g.typeOf.string=function(i,t){if(typeof t!="string")throw new j(bs(typeof t,"string",i))},g.typeOf.number=function(i,t){if(typeof t!="number")throw new j(bs(typeof t,"number",i))},g.typeOf.number.lessThan=function(i,t,e){if(g.typeOf.number(i,t),t>=e)throw new j(`Expected ${i} to be less than ${e}, actual value was ${t}`)},g.typeOf.number.lessThanOrEquals=function(i,t,e){if(g.typeOf.number(i,t),t>e)throw new j(`Expected ${i} to be less than or equal to ${e}, actual value was ${t}`)},g.typeOf.number.greaterThan=function(i,t,e){if(g.typeOf.number(i,t),t<=e)throw new j(`Expected ${i} to be greater than ${e}, actual value was ${t}`)},g.typeOf.number.greaterThanOrEquals=function(i,t,e){if(g.typeOf.number(i,t),t<e)throw new j(`Expected ${i} to be greater than or equal to ${e}, actual value was ${t}`)},g.typeOf.object=function(i,t){if(typeof t!="object")throw new j(bs(typeof t,"object",i))},g.typeOf.bool=function(i,t){if(typeof t!="boolean")throw new j(bs(typeof t,"boolean",i))},g.typeOf.bigint=function(i,t){if(typeof t!="bigint")throw new j(bs(typeof t,"bigint",i))},g.typeOf.number.equals=function(i,t,e,n){if(g.typeOf.number(i,e),g.typeOf.number(t,n),e!==n)throw new j(`${i} must be equal to ${t}, the actual values are ${e} and ${n}`)};var af=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function cf(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var gh,hf;function V_(){if(hf)return gh;hf=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 Y_=V_();const lf=cf(Y_),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 ia=[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=ia.length;if(i>=t){let e=ia[t-1];for(let n=t;n<=i;n++){const s=e*n;ia.push(s),e=s}}return ia[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 g.typeOf.number("value",i),g.typeOf.number("min",t),g.typeOf.number("max",e),i<t?t:i>e?e:i};let uf=new lf;T.setRandomNumberSeed=function(i){if(!C(i))throw new j("seed is required.");uf=new lf(i)},T.nextRandomNumber=function(){return uf.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 g.typeOf.number("x",i),i*(-.1784*Math.abs(i)-.0663*i*i+1.0301)},T.fastApproximateAtan2=function(i,t){g.typeOf.number("x",i),g.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){g.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 g.typeOf.object("value",i),g.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 g.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){g.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(g.defined("array",i),g.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 g.typeOf.object("cartesian",i),Math.max(i.x,i.y,i.z)},O.minimumComponent=function(i){return g.typeOf.object("cartesian",i),Math.min(i.x,i.y,i.z)},O.minimumByComponent=function(i,t,e){return g.typeOf.object("first",i),g.typeOf.object("second",t),g.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 g.typeOf.object("first",i),g.typeOf.object("second",t),g.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){g.typeOf.object("value",i),g.typeOf.object("min",t),g.typeOf.object("max",e),g.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 g.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 na=new O;O.distance=function(i,t){return g.typeOf.object("left",i),g.typeOf.object("right",t),O.subtract(i,t,na),O.magnitude(na)},O.distanceSquared=function(i,t){return g.typeOf.object("left",i),g.typeOf.object("right",t),O.subtract(i,t,na),O.magnitudeSquared(na)},O.normalize=function(i,t){g.typeOf.object("cartesian",i),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),i.x*t.x+i.y*t.y+i.z*t.z},O.multiplyComponents=function(i,t,e){return g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("cartesian",i),g.typeOf.number("scalar",t),g.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 g.typeOf.object("cartesian",i),g.typeOf.number("scalar",t),g.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 g.typeOf.object("cartesian",i),g.typeOf.object("result",t),t.x=-i.x,t.y=-i.y,t.z=-i.z,t},O.abs=function(i,t){return g.typeOf.object("cartesian",i),g.typeOf.object("result",t),t.x=Math.abs(i.x),t.y=Math.abs(i.y),t.z=Math.abs(i.z),t};const df=new O;O.lerp=function(i,t,e,n){return g.typeOf.object("start",i),g.typeOf.object("end",t),g.typeOf.number("t",e),g.typeOf.object("result",n),O.multiplyByScalar(t,e,df),n=O.multiplyByScalar(i,1-e,n),O.add(df,n,n)};const sa=new O,ph=new O;O.angleBetween=function(i,t){g.typeOf.object("left",i),g.typeOf.object("right",t),O.normalize(i,sa),O.normalize(t,ph);const e=O.dot(sa,ph),n=O.magnitude(O.cross(sa,ph,sa));return Math.atan2(n,e)};const H_=new O;O.mostOrthogonalAxis=function(i,t){g.typeOf.object("cartesian",i),g.typeOf.object("result",t);const e=O.normalize(i,H_);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){g.defined("a",i),g.defined("b",t),g.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){g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.number("longitude",i),g.typeOf.number("latitude",t),i=T.toRadians(i),t=T.toRadians(t),O.fromRadians(i,t,e,n,s)};let Me=new O,xs=new O;O._ellipsoidRadiiSquared=new O(40680631590769,40680631590769,40408299984661445e-3),O.fromRadians=function(i,t,e,n,s){g.typeOf.number("longitude",i),g.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,xs);const a=Math.sqrt(O.dot(Me,xs));return xs=O.divideByScalar(xs,a,xs),Me=O.multiplyByScalar(Me,e,Me),C(s)||(s=new O),O.add(xs,Me,s)},O.fromDegreesArray=function(i,t,e){if(g.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(g.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(g.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(g.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 X_=new O,$_=new O;function ff(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,d=r*r*h*h,p=a*a*l*l,_=u+d+p,y=Math.sqrt(1/_),w=O.multiplyByScalar(i,y,X_);if(_<n)return isFinite(y)?O.clone(w,s):void 0;const E=e.x,b=e.y,P=e.z,I=$_;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,R,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,R=Q*q,A=m*Y,F=v*X,L=u*Q+d*m+p*v-1,z=u*R*E+d*A*b+p*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 g.typeOf.number("longitude",i),g.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 g.typeOf.number("longitude",i),g.typeOf.number("latitude",t),i=T.toRadians(i),t=T.toRadians(t),lt.fromRadians(i,t,e,n)};const Z_=new O,K_=new O,Q_=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=ff(i,n,s,o,K_);if(!C(r))return;let a=O.multiplyComponents(r,s,Z_);a=O.normalize(a,a);const c=O.subtract(i,r,Q_),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 g.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 g.typeOf.object("value",i),g.defined("array",t),e=e??0,t[e++]=i.x,t[e]=i.y,t},tt.unpack=function(i,t,e){return g.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){g.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(g.defined("array",i),g.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 g.typeOf.object("cartesian",i),Math.max(i.x,i.y)},tt.minimumComponent=function(i){return g.typeOf.object("cartesian",i),Math.min(i.x,i.y)},tt.minimumByComponent=function(i,t,e){return g.typeOf.object("first",i),g.typeOf.object("second",t),g.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 g.typeOf.object("first",i),g.typeOf.object("second",t),g.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){g.typeOf.object("value",i),g.typeOf.object("min",t),g.typeOf.object("max",e),g.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 g.typeOf.object("cartesian",i),i.x*i.x+i.y*i.y},tt.magnitude=function(i){return Math.sqrt(tt.magnitudeSquared(i))};const oa=new tt;tt.distance=function(i,t){return g.typeOf.object("left",i),g.typeOf.object("right",t),tt.subtract(i,t,oa),tt.magnitude(oa)},tt.distanceSquared=function(i,t){return g.typeOf.object("left",i),g.typeOf.object("right",t),tt.subtract(i,t,oa),tt.magnitudeSquared(oa)},tt.normalize=function(i,t){g.typeOf.object("cartesian",i),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),i.x*t.x+i.y*t.y},tt.cross=function(i,t){return g.typeOf.object("left",i),g.typeOf.object("right",t),i.x*t.y-i.y*t.x},tt.multiplyComponents=function(i,t,e){return g.typeOf.object("left",i),g.typeOf.object("right",t),g.typeOf.object("result",e),e.x=i.x*t.x,e.y=i.y*t.y,e},tt.divideComponents=function(i,t,e){return g.typeOf.object("left",i),g.typeOf.object("right",t),g.typeOf.object("result",e),e.x=i.x/t.x,e.y=i.y/t.y,e},tt.add=function(i,t,e){return g.typeOf.object("left",i),g.typeOf.object("right",t),g.typeOf.object("result",e),e.x=i.x+t.x,e.y=i.y+t.y,e},tt.subtract=function(i,t,e){return g.typeOf.object("left",i),g.typeOf.object("right",t),g.typeOf.object("result",e),e.x=i.x-t.x,e.y=i.y-t.y,e},tt.multiplyByScalar=function(i,t,e){return g.typeOf.object("cartesian",i),g.typeOf.number("scalar",t),g.typeOf.object("result",e),e.x=i.x*t,e.y=i.y*t,e},tt.divideByScalar=function(i,t,e){return g.typeOf.object("cartesian",i),g.typeOf.number("scalar",t),g.typeOf.object("result",e),e.x=i.x/t,e.y=i.y/t,e},tt.negate=function(i,t){return g.typeOf.object("cartesian",i),g.typeOf.object("result",t),t.x=-i.x,t.y=-i.y,t},tt.abs=function(i,t){return g.typeOf.object("cartesian",i),g.typeOf.object("result",t),t.x=Math.abs(i.x),t.y=Math.abs(i.y),t};const gf=new tt;tt.lerp=function(i,t,e,n){return g.typeOf.object("start",i),g.typeOf.object("end",t),g.typeOf.number("t",e),g.typeOf.object("result",n),tt.multiplyByScalar(t,e,gf),n=tt.multiplyByScalar(i,1-e,n),tt.add(gf,n,n)};const pf=new tt,mf=new tt;tt.angleBetween=function(i,t){return g.typeOf.object("left",i),g.typeOf.object("right",t),tt.normalize(i,pf),tt.normalize(t,mf),T.acosClamped(tt.dot(pf,mf))};const J_=new tt;tt.mostOrthogonalAxis=function(i,t){g.typeOf.object("cartesian",i),g.typeOf.object("result",t);const e=tt.normalize(i,J_);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 _f(i,t,e,n){t=t??0,e=e??0,n=n??0,g.typeOf.number.greaterThanOrEquals("x",t,0),g.typeOf.number.greaterThanOrEquals("y",e,0),g.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,_f(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)&&_f(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){g.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 g.typeOf.object("value",i),g.defined("array",t),e=e??0,O.pack(i._radii,t,e),t},ct.unpack=function(i,t,e){g.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){g.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(g.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 ty=new O,ey=new O;ct.prototype.cartographicToCartesian=function(i,t){const e=ty,n=ey;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){g.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 iy=new O,ny=new O,sy=new O;ct.prototype.cartesianToCartographic=function(i,t){const e=this.scaleToGeodeticSurface(i,ny);if(!C(e))return;const n=this.geodeticSurfaceNormal(e,iy),s=O.subtract(i,e,sy),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){g.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 ff(i,this._oneOverRadii,this._oneOverRadiiSquared,this._centerToleranceSquared,t)},ct.prototype.scaleToGeocentricSurface=function(i,t){g.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(g.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)");g.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 oy=new O;ct.prototype.getLocalCurvature=function(i,t){g.typeOf.object("surfacePosition",i),C(t)||(t=new tt);const e=this.getSurfaceNormalIntersectionWithZAxis(i,0,oy),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 ry=[.14887433898163,.43339539412925,.67940956829902,.86506336668898,.97390652851717,0],ay=[.29552422471475,.26926671930999,.21908636251598,.14945134915058,.066671344308684,0];function yf(i,t,e){g.typeOf.number("a",i),g.typeOf.number("b",t),g.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*ry[r];o+=ay[r]*(e(n+a)+e(n-a))}return o*=s,o}ct.prototype.surfaceArea=function(i){g.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 yf(n,s,function(l){const u=Math.cos(l),d=Math.sin(l);return Math.cos(l)*yf(t,e,function(p){const _=Math.cos(p),y=Math.sin(p);return Math.sqrt(h*d*d+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 g.typeOf.object("value",i),g.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 g.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){g.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(g.defined("array",i),g.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 g.defined("values",i),k.clone(i,t)},k.fromRowMajorArray=function(i,t){return g.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){g.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,d=e-r-h+u,p=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]=d,t[1]=y,t[2]=b,t[3]=p,t[4]=w,t[5]=P,t[6]=_,t[7]=E,t[8]=I,t):new k(d,p,_,y,w,E,b,P,I)},k.fromHeadingPitchRoll=function(i,t){g.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,d=s*n+a*o*r,p=-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]=d,t[5]=y,t[6]=l,t[7]=p,t[8]=w,t):new k(c,h,l,u,d,p,_,y,w)},k.fromScale=function(i,t){return g.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 g.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 g.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){g.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){g.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){g.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 g.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 g.typeOf.number.greaterThanOrEquals("row",t,0),g.typeOf.number.lessThanOrEquals("row",t,2),g.typeOf.number.greaterThanOrEquals("column",i,0),g.typeOf.number.lessThanOrEquals("column",i,2),i*3+t},k.getColumn=function(i,t,e){g.typeOf.object("matrix",i),g.typeOf.number.greaterThanOrEquals("index",t,0),g.typeOf.number.lessThanOrEquals("index",t,2),g.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){g.typeOf.object("matrix",i),g.typeOf.number.greaterThanOrEquals("index",t,0),g.typeOf.number.lessThanOrEquals("index",t,2),g.typeOf.object("cartesian",e),g.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){g.typeOf.object("matrix",i),g.typeOf.number.greaterThanOrEquals("index",t,0),g.typeOf.number.lessThanOrEquals("index",t,2),g.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 g.typeOf.object("matrix",i),g.typeOf.number.greaterThanOrEquals("index",t,0),g.typeOf.number.lessThanOrEquals("index",t,2),g.typeOf.object("cartesian",e),g.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 cy=new O;k.setScale=function(i,t,e){g.typeOf.object("matrix",i),g.typeOf.object("scale",t),g.typeOf.object("result",e);const n=k.getScale(i,cy),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 hy=new O;k.setUniformScale=function(i,t,e){g.typeOf.object("matrix",i),g.typeOf.number("scale",t),g.typeOf.object("result",e);const n=k.getScale(i,hy),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 g.typeOf.object("matrix",i),g.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 wf=new O;k.getMaximumScale=function(i){return k.getScale(i,wf),O.maximumComponent(wf)};const ly=new O;k.setRotation=function(i,t,e){g.typeOf.object("matrix",i),g.typeOf.object("result",e);const n=k.getScale(i,ly);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 uy=new O;k.getRotation=function(i,t){g.typeOf.object("matrix",i),g.typeOf.object("result",t);const e=k.getScale(i,uy);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){g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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){g.typeOf.object("matrix",i),g.typeOf.object("cartesian",t),g.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 g.typeOf.object("matrix",i),g.typeOf.number("scalar",t),g.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 g.typeOf.object("matrix",i),g.typeOf.object("scale",t),g.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 g.typeOf.object("matrix",i),g.typeOf.number("scale",t),g.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 g.typeOf.object("matrix",i),g.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){g.typeOf.object("matrix",i),g.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 dy(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 fy(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 gy(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)],d=(h-l)/2/u;let p;d<0?p=-1/(-d+Math.sqrt(1+d*d)):p=1/(d+Math.sqrt(1+d*d)),o=1/Math.sqrt(1+p*p),r=p*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 ra=new k,vf=new k;k.computeEigenDecomposition=function(i,t){g.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*dy(a);for(;o<n&&fy(a)>c;)gy(a,ra),k.transpose(ra,vf),k.multiply(a,ra,a),k.multiply(vf,a,a),k.multiply(r,ra,r),++s>2&&(++o,s=0);return t},k.abs=function(i,t){return g.typeOf.object("matrix",i),g.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){g.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){g.typeOf.object("matrix",i),g.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 d=1/u;return k.multiplyByScalar(t,d,t)};const py=new k;k.inverseTranspose=function(i,t){return g.typeOf.object("matrix",i),g.typeOf.object("result",t),k.inverse(k.transpose(i,py),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]})
31
31
  (${this[1]}, ${this[4]}, ${this[7]})
32
- (${this[2]}, ${this[5]}, ${this[8]})`};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,d,p,_,y){this[0]=i??0,this[1]=s??0,this[2]=c??0,this[3]=d??0,this[4]=t??0,this[5]=o??0,this[6]=h??0,this[7]=p??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 g.typeOf.object("value",i),g.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 g.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){g.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(g.defined("array",i),g.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 g.defined("values",i),U.clone(i,t)},U.fromRowMajorArray=function(i,t){return g.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 g.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){g.typeOf.object("translation",i),g.typeOf.object("rotation",t),g.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,d=t.y*t.z,p=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+p),I=2*(c+y),M=-a+u-_+w,D=2*(d-l),L=2*(h-p),z=2*(d+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 g.typeOf.object("translationRotationScale",i),U.fromTranslationQuaternionRotationScale(i.translation,i.rotation,i.scale,t)},U.fromTranslation=function(i,t){return g.typeOf.object("translation",i),U.fromRotationTranslation(k.IDENTITY,i,t)},U.fromScale=function(i,t){return g.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 g.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 g.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 Rs=new O,Ss=new O,To=new O;U.fromCamera=function(i,t){g.typeOf.object("camera",i);const e=i.position,n=i.direction,s=i.up;g.typeOf.object("camera.position",e),g.typeOf.object("camera.direction",n),g.typeOf.object("camera.up",s),O.normalize(n,Rs),O.normalize(O.cross(Rs,s,Ss),Ss),O.normalize(O.cross(Ss,Rs,To),To);const o=Ss.x,r=Ss.y,a=Ss.z,c=Rs.x,h=Rs.y,l=Rs.z,u=To.x,d=To.y,p=To.z,_=e.x,y=e.y,w=e.z,E=o*-_+r*-y+a*-w,b=u*-_+d*-y+p*-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]=d,t[6]=-h,t[7]=0,t[8]=a,t[9]=p,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,d,p,b,-c,-h,-l,P,0,0,0,1)},U.computePerspectiveFieldOfView=function(i,t,e,n,s){g.typeOf.number.greaterThan("fovY",i,0),g.typeOf.number.lessThan("fovY",i,Math.PI),g.typeOf.number.greaterThan("near",e,0),g.typeOf.number.greaterThan("far",n,0),g.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){g.typeOf.number("left",i),g.typeOf.number("right",t),g.typeOf.number("bottom",e),g.typeOf.number("top",n),g.typeOf.number("near",s),g.typeOf.number("far",o),g.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,d=-(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]=d,r[15]=1,r},U.computePerspectiveOffCenter=function(i,t,e,n,s,o,r){g.typeOf.number("left",i),g.typeOf.number("right",t),g.typeOf.number("bottom",e),g.typeOf.number("top",n),g.typeOf.number("near",s),g.typeOf.number("far",o),g.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),d=-1,p=-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]=d,r[12]=0,r[13]=0,r[14]=p,r[15]=0,r},U.computeInfinitePerspectiveOffCenter=function(i,t,e,n,s,o){g.typeOf.number("left",i),g.typeOf.number("right",t),g.typeOf.number("bottom",e),g.typeOf.number("top",n),g.typeOf.number("near",s),g.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,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]=c,o[9]=h,o[10]=l,o[11]=u,o[12]=0,o[13]=0,o[14]=d,o[15]=0,o},U.computeViewportTransformation=function(i,t,e,n){C(n)||(n=new U),i=i??oi.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,d=h,p=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]=d,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=p,n[11]=0,n[12]=_,n[13]=y,n[14]=w,n[15]=E,n},U.computeView=function(i,t,e,n,s){return g.typeOf.object("position",i),g.typeOf.object("direction",t),g.typeOf.object("up",e),g.typeOf.object("right",n),g.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 g.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 g.typeOf.number.greaterThanOrEquals("row",t,0),g.typeOf.number.lessThanOrEquals("row",t,3),g.typeOf.number.greaterThanOrEquals("column",i,0),g.typeOf.number.lessThanOrEquals("column",i,3),i*4+t},U.getColumn=function(i,t,e){g.typeOf.object("matrix",i),g.typeOf.number.greaterThanOrEquals("index",t,0),g.typeOf.number.lessThanOrEquals("index",t,3),g.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){g.typeOf.object("matrix",i),g.typeOf.number.greaterThanOrEquals("index",t,0),g.typeOf.number.lessThanOrEquals("index",t,3),g.typeOf.object("cartesian",e),g.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){g.typeOf.object("matrix",i),g.typeOf.number.greaterThanOrEquals("index",t,0),g.typeOf.number.lessThanOrEquals("index",t,3),g.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 g.typeOf.object("matrix",i),g.typeOf.number.greaterThanOrEquals("index",t,0),g.typeOf.number.lessThanOrEquals("index",t,3),g.typeOf.object("cartesian",e),g.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 g.typeOf.object("matrix",i),g.typeOf.object("translation",t),g.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 iy=new O;U.setScale=function(i,t,e){g.typeOf.object("matrix",i),g.typeOf.object("scale",t),g.typeOf.object("result",e);const n=U.getScale(i,iy),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 ny=new O;U.setUniformScale=function(i,t,e){g.typeOf.object("matrix",i),g.typeOf.number("scale",t),g.typeOf.object("result",e);const n=U.getScale(i,ny),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 g.typeOf.object("matrix",i),g.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 pf=new O;U.getMaximumScale=function(i){return U.getScale(i,pf),O.maximumComponent(pf)};const sy=new O;U.setRotation=function(i,t,e){g.typeOf.object("matrix",i),g.typeOf.object("result",e);const n=U.getScale(i,sy);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 oy=new O;U.getRotation=function(i,t){g.typeOf.object("matrix",i),g.typeOf.object("result",t);const e=U.getScale(i,oy);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){g.typeOf.object("left",i),g.typeOf.object("right",t),g.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],d=i[9],p=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],R=t[12],A=t[13],F=t[14],N=t[15],G=n*P+a*I+u*M+y*D,B=s*P+c*I+d*M+w*D,Z=o*P+h*I+p*M+E*D,V=r*P+l*I+_*M+b*D,at=n*L+a*z+u*q+y*Y,et=s*L+c*z+d*q+w*Y,it=o*L+h*z+p*q+E*Y,gt=r*L+l*z+_*q+b*Y,yt=n*X+a*Q+u*m+y*v,dt=s*X+c*Q+d*m+w*v,Et=o*X+h*Q+p*m+E*v,ft=r*X+l*Q+_*m+b*v,xt=n*R+a*A+u*F+y*N,Ft=s*R+c*A+d*F+w*N,kt=o*R+h*A+p*F+E*N,Wt=r*R+l*A+_*F+b*N;return e[0]=G,e[1]=B,e[2]=Z,e[3]=V,e[4]=at,e[5]=et,e[6]=it,e[7]=gt,e[8]=yt,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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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){g.typeOf.object("left",i),g.typeOf.object("right",t),g.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],d=i[12],p=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,R=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,B=n*z+r*q+h*Y+d,Z=s*z+a*q+l*Y+p,V=o*z+c*q+u*Y+_;return e[0]=X,e[1]=Q,e[2]=m,e[3]=0,e[4]=v,e[5]=R,e[6]=A,e[7]=0,e[8]=F,e[9]=N,e[10]=G,e[11]=0,e[12]=B,e[13]=Z,e[14]=V,e[15]=1,e},U.multiplyByMatrix3=function(i,t,e){g.typeOf.object("matrix",i),g.typeOf.object("rotation",t),g.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],d=t[0],p=t[1],_=t[2],y=t[3],w=t[4],E=t[5],b=t[6],P=t[7],I=t[8],M=n*d+r*p+h*_,D=s*d+a*p+l*_,L=o*d+c*p+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){g.typeOf.object("matrix",i),g.typeOf.object("translation",t),g.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){g.typeOf.object("matrix",i),g.typeOf.object("scale",t),g.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 g.typeOf.object("matrix",i),g.typeOf.number("scale",t),g.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){g.typeOf.object("matrix",i),g.typeOf.object("cartesian",t),g.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){g.typeOf.object("matrix",i),g.typeOf.object("cartesian",t),g.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){g.typeOf.object("matrix",i),g.typeOf.object("cartesian",t),g.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 g.typeOf.object("matrix",i),g.typeOf.number("scalar",t),g.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 g.typeOf.object("matrix",i),g.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){g.typeOf.object("matrix",i),g.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 g.typeOf.object("matrix",i),g.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 g.typeOf.object("matrix",i),g.typeOf.object("result",t),t.x=i[12],t.y=i[13],t.z=i[14],t},U.getMatrix3=function(i,t){return g.typeOf.object("matrix",i),g.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 ry=new k,ay=new k,cy=new K,hy=new K(0,0,0,1);U.inverse=function(i,t){g.typeOf.object("matrix",i),g.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],d=i[10],p=i[14],_=i[3],y=i[7],w=i[11],E=i[15];let b=d*E,P=p*w,I=u*E,M=p*y,D=u*w,L=d*y,z=l*E,q=p*_,Y=l*w,X=d*_,Q=l*y,m=u*_;const v=b*a+M*c+D*h-(P*a+I*c+L*h),R=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),B=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 V=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*d+L*p+P*u-(D*p+b*u+M*d),yt=Y*p+b*l+q*d-(z*d+X*p+P*l),dt=z*u+m*p+M*l-(Q*p+I*l+q*u),Et=Q*d+D*l+X*u-(Y*u+m*d+L*l);let ft=e*v+n*R+s*A+o*F;if(Math.abs(ft)<T.EPSILON21){if(k.equalsEpsilon(U.getMatrix3(i,ry),ay,T.EPSILON7)&&K.equals(U.getRow(i,3,cy),hy))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]=R*ft,t[2]=A*ft,t[3]=F*ft,t[4]=N*ft,t[5]=G*ft,t[6]=B*ft,t[7]=Z*ft,t[8]=V*ft,t[9]=at*ft,t[10]=et*ft,t[11]=it*ft,t[12]=gt*ft,t[13]=yt*ft,t[14]=dt*ft,t[15]=Et*ft,t},U.inverseTransformation=function(i,t){g.typeOf.object("matrix",i),g.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],d=i[13],p=i[14],_=-e*u-n*d-s*p,y=-o*u-r*d-a*p,w=-c*u-h*d-l*p;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 ly=new U;U.inverseTranspose=function(i,t){return g.typeOf.object("matrix",i),g.typeOf.object("result",t),U.inverse(U.transpose(i,ly),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]})
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 g.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 g.typeOf.object("value",i),g.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 g.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){g.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(g.defined("array",i),g.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 g.typeOf.object("cartesian",i),Math.max(i.x,i.y,i.z,i.w)},K.minimumComponent=function(i){return g.typeOf.object("cartesian",i),Math.min(i.x,i.y,i.z,i.w)},K.minimumByComponent=function(i,t,e){return g.typeOf.object("first",i),g.typeOf.object("second",t),g.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 g.typeOf.object("first",i),g.typeOf.object("second",t),g.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){g.typeOf.object("value",i),g.typeOf.object("min",t),g.typeOf.object("max",e),g.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 g.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 aa=new K;K.distance=function(i,t){return g.typeOf.object("left",i),g.typeOf.object("right",t),K.subtract(i,t,aa),K.magnitude(aa)},K.distanceSquared=function(i,t){return g.typeOf.object("left",i),g.typeOf.object("right",t),K.subtract(i,t,aa),K.magnitudeSquared(aa)},K.normalize=function(i,t){g.typeOf.object("cartesian",i),g.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 g.typeOf.object("left",i),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("cartesian",i),g.typeOf.number("scalar",t),g.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 g.typeOf.object("cartesian",i),g.typeOf.number("scalar",t),g.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 g.typeOf.object("cartesian",i),g.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 g.typeOf.object("cartesian",i),g.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 Ef=new K;K.lerp=function(i,t,e,n){return g.typeOf.object("start",i),g.typeOf.object("end",t),g.typeOf.number("t",e),g.typeOf.object("result",n),K.multiplyByScalar(t,e,Ef),n=K.multiplyByScalar(i,1-e,n),K.add(Ef,n,n)};const my=new K;K.mostOrthogonalAxis=function(i,t){g.typeOf.object("cartesian",i),g.typeOf.object("result",t);const e=K.normalize(i,my);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),_y=new Uint32Array([287454020]),Cf=new Uint8Array(_y.buffer)[0]===68;K.packFloat=function(i,t){return g.typeOf.number("value",i),C(t)||(t=new K),wh[0]=i,Cf?(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 g.typeOf.object("packedFloat",i),Cf?(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 oi={};oi.EMPTY_OBJECT=Object.freeze({}),oi.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,d,p,_,y){this[0]=i??0,this[1]=s??0,this[2]=c??0,this[3]=d??0,this[4]=t??0,this[5]=o??0,this[6]=h??0,this[7]=p??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 g.typeOf.object("value",i),g.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 g.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){g.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(g.defined("array",i),g.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 g.defined("values",i),U.clone(i,t)},U.fromRowMajorArray=function(i,t){return g.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 g.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){g.typeOf.object("translation",i),g.typeOf.object("rotation",t),g.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,d=t.y*t.z,p=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+p),I=2*(c+y),M=-a+u-_+w,D=2*(d-l),L=2*(h-p),z=2*(d+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 g.typeOf.object("translationRotationScale",i),U.fromTranslationQuaternionRotationScale(i.translation,i.rotation,i.scale,t)},U.fromTranslation=function(i,t){return g.typeOf.object("translation",i),U.fromRotationTranslation(k.IDENTITY,i,t)},U.fromScale=function(i,t){return g.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 g.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 g.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 Rs=new O,Ss=new O,To=new O;U.fromCamera=function(i,t){g.typeOf.object("camera",i);const e=i.position,n=i.direction,s=i.up;g.typeOf.object("camera.position",e),g.typeOf.object("camera.direction",n),g.typeOf.object("camera.up",s),O.normalize(n,Rs),O.normalize(O.cross(Rs,s,Ss),Ss),O.normalize(O.cross(Ss,Rs,To),To);const o=Ss.x,r=Ss.y,a=Ss.z,c=Rs.x,h=Rs.y,l=Rs.z,u=To.x,d=To.y,p=To.z,_=e.x,y=e.y,w=e.z,E=o*-_+r*-y+a*-w,b=u*-_+d*-y+p*-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]=d,t[6]=-h,t[7]=0,t[8]=a,t[9]=p,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,d,p,b,-c,-h,-l,P,0,0,0,1)},U.computePerspectiveFieldOfView=function(i,t,e,n,s){g.typeOf.number.greaterThan("fovY",i,0),g.typeOf.number.lessThan("fovY",i,Math.PI),g.typeOf.number.greaterThan("near",e,0),g.typeOf.number.greaterThan("far",n,0),g.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){g.typeOf.number("left",i),g.typeOf.number("right",t),g.typeOf.number("bottom",e),g.typeOf.number("top",n),g.typeOf.number("near",s),g.typeOf.number("far",o),g.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,d=-(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]=d,r[15]=1,r},U.computePerspectiveOffCenter=function(i,t,e,n,s,o,r){g.typeOf.number("left",i),g.typeOf.number("right",t),g.typeOf.number("bottom",e),g.typeOf.number("top",n),g.typeOf.number("near",s),g.typeOf.number("far",o),g.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),d=-1,p=-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]=d,r[12]=0,r[13]=0,r[14]=p,r[15]=0,r},U.computeInfinitePerspectiveOffCenter=function(i,t,e,n,s,o){g.typeOf.number("left",i),g.typeOf.number("right",t),g.typeOf.number("bottom",e),g.typeOf.number("top",n),g.typeOf.number("near",s),g.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,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]=c,o[9]=h,o[10]=l,o[11]=u,o[12]=0,o[13]=0,o[14]=d,o[15]=0,o},U.computeViewportTransformation=function(i,t,e,n){C(n)||(n=new U),i=i??oi.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,d=h,p=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]=d,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=p,n[11]=0,n[12]=_,n[13]=y,n[14]=w,n[15]=E,n},U.computeView=function(i,t,e,n,s){return g.typeOf.object("position",i),g.typeOf.object("direction",t),g.typeOf.object("up",e),g.typeOf.object("right",n),g.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 g.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 g.typeOf.number.greaterThanOrEquals("row",t,0),g.typeOf.number.lessThanOrEquals("row",t,3),g.typeOf.number.greaterThanOrEquals("column",i,0),g.typeOf.number.lessThanOrEquals("column",i,3),i*4+t},U.getColumn=function(i,t,e){g.typeOf.object("matrix",i),g.typeOf.number.greaterThanOrEquals("index",t,0),g.typeOf.number.lessThanOrEquals("index",t,3),g.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){g.typeOf.object("matrix",i),g.typeOf.number.greaterThanOrEquals("index",t,0),g.typeOf.number.lessThanOrEquals("index",t,3),g.typeOf.object("cartesian",e),g.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){g.typeOf.object("matrix",i),g.typeOf.number.greaterThanOrEquals("index",t,0),g.typeOf.number.lessThanOrEquals("index",t,3),g.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 g.typeOf.object("matrix",i),g.typeOf.number.greaterThanOrEquals("index",t,0),g.typeOf.number.lessThanOrEquals("index",t,3),g.typeOf.object("cartesian",e),g.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 g.typeOf.object("matrix",i),g.typeOf.object("translation",t),g.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 yy=new O;U.setScale=function(i,t,e){g.typeOf.object("matrix",i),g.typeOf.object("scale",t),g.typeOf.object("result",e);const n=U.getScale(i,yy),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 wy=new O;U.setUniformScale=function(i,t,e){g.typeOf.object("matrix",i),g.typeOf.number("scale",t),g.typeOf.object("result",e);const n=U.getScale(i,wy),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 g.typeOf.object("matrix",i),g.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 bf=new O;U.getMaximumScale=function(i){return U.getScale(i,bf),O.maximumComponent(bf)};const vy=new O;U.setRotation=function(i,t,e){g.typeOf.object("matrix",i),g.typeOf.object("result",e);const n=U.getScale(i,vy);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 Ey=new O;U.getRotation=function(i,t){g.typeOf.object("matrix",i),g.typeOf.object("result",t);const e=U.getScale(i,Ey);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){g.typeOf.object("left",i),g.typeOf.object("right",t),g.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],d=i[9],p=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],R=t[12],A=t[13],F=t[14],N=t[15],G=n*P+a*I+u*M+y*D,B=s*P+c*I+d*M+w*D,Z=o*P+h*I+p*M+E*D,V=r*P+l*I+_*M+b*D,at=n*L+a*z+u*q+y*Y,et=s*L+c*z+d*q+w*Y,it=o*L+h*z+p*q+E*Y,gt=r*L+l*z+_*q+b*Y,yt=n*X+a*Q+u*m+y*v,dt=s*X+c*Q+d*m+w*v,Et=o*X+h*Q+p*m+E*v,ft=r*X+l*Q+_*m+b*v,xt=n*R+a*A+u*F+y*N,Ft=s*R+c*A+d*F+w*N,kt=o*R+h*A+p*F+E*N,Wt=r*R+l*A+_*F+b*N;return e[0]=G,e[1]=B,e[2]=Z,e[3]=V,e[4]=at,e[5]=et,e[6]=it,e[7]=gt,e[8]=yt,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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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){g.typeOf.object("left",i),g.typeOf.object("right",t),g.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],d=i[12],p=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,R=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,B=n*z+r*q+h*Y+d,Z=s*z+a*q+l*Y+p,V=o*z+c*q+u*Y+_;return e[0]=X,e[1]=Q,e[2]=m,e[3]=0,e[4]=v,e[5]=R,e[6]=A,e[7]=0,e[8]=F,e[9]=N,e[10]=G,e[11]=0,e[12]=B,e[13]=Z,e[14]=V,e[15]=1,e},U.multiplyByMatrix3=function(i,t,e){g.typeOf.object("matrix",i),g.typeOf.object("rotation",t),g.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],d=t[0],p=t[1],_=t[2],y=t[3],w=t[4],E=t[5],b=t[6],P=t[7],I=t[8],M=n*d+r*p+h*_,D=s*d+a*p+l*_,L=o*d+c*p+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){g.typeOf.object("matrix",i),g.typeOf.object("translation",t),g.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){g.typeOf.object("matrix",i),g.typeOf.object("scale",t),g.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 g.typeOf.object("matrix",i),g.typeOf.number("scale",t),g.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){g.typeOf.object("matrix",i),g.typeOf.object("cartesian",t),g.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){g.typeOf.object("matrix",i),g.typeOf.object("cartesian",t),g.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){g.typeOf.object("matrix",i),g.typeOf.object("cartesian",t),g.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 g.typeOf.object("matrix",i),g.typeOf.number("scalar",t),g.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 g.typeOf.object("matrix",i),g.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){g.typeOf.object("matrix",i),g.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 g.typeOf.object("matrix",i),g.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 g.typeOf.object("matrix",i),g.typeOf.object("result",t),t.x=i[12],t.y=i[13],t.z=i[14],t},U.getMatrix3=function(i,t){return g.typeOf.object("matrix",i),g.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 Cy=new k,by=new k,xy=new K,Ry=new K(0,0,0,1);U.inverse=function(i,t){g.typeOf.object("matrix",i),g.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],d=i[10],p=i[14],_=i[3],y=i[7],w=i[11],E=i[15];let b=d*E,P=p*w,I=u*E,M=p*y,D=u*w,L=d*y,z=l*E,q=p*_,Y=l*w,X=d*_,Q=l*y,m=u*_;const v=b*a+M*c+D*h-(P*a+I*c+L*h),R=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),B=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 V=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*d+L*p+P*u-(D*p+b*u+M*d),yt=Y*p+b*l+q*d-(z*d+X*p+P*l),dt=z*u+m*p+M*l-(Q*p+I*l+q*u),Et=Q*d+D*l+X*u-(Y*u+m*d+L*l);let ft=e*v+n*R+s*A+o*F;if(Math.abs(ft)<T.EPSILON21){if(k.equalsEpsilon(U.getMatrix3(i,Cy),by,T.EPSILON7)&&K.equals(U.getRow(i,3,xy),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]=R*ft,t[2]=A*ft,t[3]=F*ft,t[4]=N*ft,t[5]=G*ft,t[6]=B*ft,t[7]=Z*ft,t[8]=V*ft,t[9]=at*ft,t[10]=et*ft,t[11]=it*ft,t[12]=gt*ft,t[13]=yt*ft,t[14]=dt*ft,t[15]=Et*ft,t},U.inverseTransformation=function(i,t){g.typeOf.object("matrix",i),g.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],d=i[13],p=i[14],_=-e*u-n*d-s*p,y=-o*u-r*d-a*p,w=-c*u-h*d-l*p;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 Sy=new U;U.inverseTranspose=function(i,t){return g.typeOf.object("matrix",i),g.typeOf.object("result",t),U.inverse(U.transpose(i,Sy),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]})
34
34
  (${this[1]}, ${this[5]}, ${this[9]}, ${this[13]})
35
35
  (${this[2]}, ${this[6]}, ${this[10]}, ${this[14]})
36
- (${this[3]}, ${this[7]}, ${this[11]}, ${this[15]})`};let cn;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(cn))return cn;cn=!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",cn=!0,cn;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,cn=!0):(e=`${o}RequestFullScreen`,typeof i[e]=="function"&&(Lt.requestFullscreen=e,cn=!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 cn},pe.requestFullscreen=function(i,t){pe.supportsFullscreen()&&i[Lt.requestFullscreen]({vrDisplay:t})},pe.exitFullscreen=function(){pe.supportsFullscreen()&&document[Lt.exitFullscreen]()},pe._names=Lt;let ne;typeof navigator<"u"?ne=navigator:ne={};function kn(i){const t=i.split(".");for(let e=0,n=t.length;e<n;++e)t[e]=parseInt(t[e],10);return t}let aa,mf;function Eh(){if(!C(aa)&&(aa=!1,!ua())){const i=/ Chrome\/([\.0-9]+)/.exec(ne.userAgent);i!==null&&(aa=!0,mf=kn(i[1]))}return aa}function uy(){return Eh()&&mf}let ca,_f;function yf(){if(!C(ca)&&(ca=!1,!Eh()&&!ua()&&/ Safari\/[\.0-9]+/.test(ne.userAgent))){const i=/ Version\/([\.0-9]+)/.exec(ne.userAgent);i!==null&&(ca=!0,_f=kn(i[1]))}return ca}function dy(){return yf()&&_f}let ha,Ch;function wf(){if(!C(ha)){ha=!1;const i=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(ne.userAgent);i!==null&&(ha=!0,Ch=kn(i[1]),Ch.isNightly=!!i[2])}return ha}function fy(){return wf()&&Ch}let Ao,bh;function vf(){if(!C(Ao)){Ao=!1;let i;ne.appName==="Microsoft Internet Explorer"?(i=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(ne.userAgent),i!==null&&(Ao=!0,bh=kn(i[1]))):ne.appName==="Netscape"&&(i=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(ne.userAgent),i!==null&&(Ao=!0,bh=kn(i[1])))}return Ao}function gy(){return vf()&&bh}let la,Ef;function ua(){if(!C(la)){la=!1;const i=/ Edg\/([\.0-9]+)/.exec(ne.userAgent);i!==null&&(la=!0,Ef=kn(i[1]))}return la}function py(){return ua()&&Ef}let da,xh;function fa(){if(!C(da)){da=!1;const i=/Firefox\/([\.0-9]+)/.exec(ne.userAgent);i!==null&&(da=!0,xh=kn(i[1]))}return da}let Rh;function my(){return C(Rh)||(Rh=/Windows/i.test(ne.appVersion)),Rh}let Sh;function _y(){return C(Sh)||(Sh=navigator.platform==="iPhone"||navigator.platform==="iPod"||navigator.platform==="iPad"),Sh}function yy(){return fa()&&xh}let Ph;function wy(){return C(Ph)||(Ph=!fa()&&typeof PointerEvent<"u"&&(!C(ne.pointerEnabled)||ne.pointerEnabled)),Ph}let Cf,ga;function bf(){if(!C(ga)){const i=document.createElement("canvas");i.setAttribute("style","image-rendering: -moz-crisp-edges;image-rendering: pixelated;");const t=i.style.imageRendering;ga=C(t)&&t!=="",ga&&(Cf=t)}return ga}function vy(){return bf()?Cf:void 0}function se(){if(!se.initialized)throw new j("You must call FeatureDetection.supportsWebP.initialize and wait for the promise to resolve before calling FeatureDetection.supportsWebP");return se._result}se._promise=void 0,se._result=void 0,se.initialize=function(){return C(se._promise)||(se._promise=new Promise(i=>{const t=new Image;t.onload=function(){se._result=t.width>0&&t.height>0,i(se._result)},t.onerror=function(){se._result=!1,i(se._result)},t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA"})),se._promise},Object.defineProperties(se,{initialized:{get:function(){return C(se._result)}}});const Ps=[];typeof ArrayBuffer<"u"&&(Ps.push(Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array),typeof Uint8ClampedArray<"u"&&Ps.push(Uint8ClampedArray),typeof Uint8ClampedArray<"u"&&Ps.push(Uint8ClampedArray),typeof BigInt64Array<"u"&&Ps.push(BigInt64Array),typeof BigUint64Array<"u"&&Ps.push(BigUint64Array));const oe={isChrome:Eh,chromeVersion:uy,isSafari:yf,safariVersion:dy,isWebkit:wf,webkitVersion:fy,isInternetExplorer:vf,internetExplorerVersion:gy,isEdge:ua,edgeVersion:py,isFirefox:fa,firefoxVersion:yy,isWindows:my,isIPadOrIOS:_y,hardwareConcurrency:ne.hardwareConcurrency??3,supportsPointerEvents:wy,supportsImageRenderingPixelated:bf,supportsWebP:se,imageRenderingValue:vy,typedArrayTypes:Ps};oe.supportsBasis=function(i){return oe.supportsWebAssembly()&&i.context.supportsBasis},oe.supportsFullscreen=function(){return pe.supportsFullscreen()},oe.supportsTypedArrays=function(){return typeof ArrayBuffer<"u"},oe.supportsBigInt64Array=function(){return typeof BigInt64Array<"u"},oe.supportsBigUint64Array=function(){return typeof BigUint64Array<"u"},oe.supportsBigInt=function(){return typeof BigInt<"u"},oe.supportsWebWorkers=function(){return typeof Worker<"u"},oe.supportsWebAssembly=function(){return typeof WebAssembly<"u"},oe.supportsWebgl2=function(i){return g.defined("scene",i),i.context.webgl2},oe.supportsEsmWebWorkers=function(){return!fa()||parseInt(xh)>=114};function Oh(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 g.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 g.typeOf.object("color",i),g.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 Ih,Th,Ri;oe.supportsTypedArrays()&&(Ih=new ArrayBuffer(4),Th=new Uint32Array(Ih),Ri=new Uint8Array(Ih)),x.fromRgba=function(i,t){return Th[0]=i,x.fromBytes(Ri[0],Ri[1],Ri[2],Ri[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=Oh(h,c,i+.3333333333333333),r=Oh(h,c,i),a=Oh(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??oi.EMPTY_OBJECT;let e=i.red;if(!C(e)){const r=i.minimumRed??0,a=i.maximumRed??1;g.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;g.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;g.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;g.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 Ey=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,Cy=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,by=/^rgba?\s*\(\s*([0-9.]+%?)\s*[,\s]+\s*([0-9.]+%?)\s*[,\s]+\s*([0-9.]+%?)(?:\s*[,\s/]+\s*([0-9.]+))?\s*\)$/i,xy=/^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){g.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=Ey.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=Cy.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=by.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=xy.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 g.typeOf.object("value",i),g.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 g.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 Ri[0]=x.floatToByte(this.red),Ri[1]=x.floatToByte(this.green),Ri[2]=x.floatToByte(this.blue),Ri[3]=x.floatToByte(this.alpha),Th[0]},x.prototype.brighten=function(i,t){return g.typeOf.number("magnitude",i),g.typeOf.number.greaterThanOrEquals("magnitude",i,0),g.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 g.typeOf.number("magnitude",i),g.typeOf.number.greaterThanOrEquals("magnitude",i,0),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("start",i),g.typeOf.object("end",t),g.typeOf.number("t",e),g.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 g.typeOf.object("color",i),g.typeOf.number("scalar",t),g.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 g.typeOf.object("color",i),g.typeOf.number("scalar",t),g.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 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 g.typeOf.object("value",i),g.defined("array",t),e=e??0,t[e++]=i.x,t[e]=i.y,t},tt.unpack=function(i,t,e){return g.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){g.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(g.defined("array",i),g.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 g.typeOf.object("cartesian",i),Math.max(i.x,i.y)},tt.minimumComponent=function(i){return g.typeOf.object("cartesian",i),Math.min(i.x,i.y)},tt.minimumByComponent=function(i,t,e){return g.typeOf.object("first",i),g.typeOf.object("second",t),g.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 g.typeOf.object("first",i),g.typeOf.object("second",t),g.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){g.typeOf.object("value",i),g.typeOf.object("min",t),g.typeOf.object("max",e),g.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 g.typeOf.object("cartesian",i),i.x*i.x+i.y*i.y},tt.magnitude=function(i){return Math.sqrt(tt.magnitudeSquared(i))};const pa=new tt;tt.distance=function(i,t){return g.typeOf.object("left",i),g.typeOf.object("right",t),tt.subtract(i,t,pa),tt.magnitude(pa)},tt.distanceSquared=function(i,t){return g.typeOf.object("left",i),g.typeOf.object("right",t),tt.subtract(i,t,pa),tt.magnitudeSquared(pa)},tt.normalize=function(i,t){g.typeOf.object("cartesian",i),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),i.x*t.x+i.y*t.y},tt.cross=function(i,t){return g.typeOf.object("left",i),g.typeOf.object("right",t),i.x*t.y-i.y*t.x},tt.multiplyComponents=function(i,t,e){return g.typeOf.object("left",i),g.typeOf.object("right",t),g.typeOf.object("result",e),e.x=i.x*t.x,e.y=i.y*t.y,e},tt.divideComponents=function(i,t,e){return g.typeOf.object("left",i),g.typeOf.object("right",t),g.typeOf.object("result",e),e.x=i.x/t.x,e.y=i.y/t.y,e},tt.add=function(i,t,e){return g.typeOf.object("left",i),g.typeOf.object("right",t),g.typeOf.object("result",e),e.x=i.x+t.x,e.y=i.y+t.y,e},tt.subtract=function(i,t,e){return g.typeOf.object("left",i),g.typeOf.object("right",t),g.typeOf.object("result",e),e.x=i.x-t.x,e.y=i.y-t.y,e},tt.multiplyByScalar=function(i,t,e){return g.typeOf.object("cartesian",i),g.typeOf.number("scalar",t),g.typeOf.object("result",e),e.x=i.x*t,e.y=i.y*t,e},tt.divideByScalar=function(i,t,e){return g.typeOf.object("cartesian",i),g.typeOf.number("scalar",t),g.typeOf.object("result",e),e.x=i.x/t,e.y=i.y/t,e},tt.negate=function(i,t){return g.typeOf.object("cartesian",i),g.typeOf.object("result",t),t.x=-i.x,t.y=-i.y,t},tt.abs=function(i,t){return g.typeOf.object("cartesian",i),g.typeOf.object("result",t),t.x=Math.abs(i.x),t.y=Math.abs(i.y),t};const xf=new tt;tt.lerp=function(i,t,e,n){return g.typeOf.object("start",i),g.typeOf.object("end",t),g.typeOf.number("t",e),g.typeOf.object("result",n),tt.multiplyByScalar(t,e,xf),n=tt.multiplyByScalar(i,1-e,n),tt.add(xf,n,n)};const Rf=new tt,Sf=new tt;tt.angleBetween=function(i,t){return g.typeOf.object("left",i),g.typeOf.object("right",t),tt.normalize(i,Rf),tt.normalize(t,Sf),T.acosClamped(tt.dot(Rf,Sf))};const Ry=new tt;tt.mostOrthogonalAxis=function(i,t){g.typeOf.object("cartesian",i),g.typeOf.object("result",t);const e=tt.normalize(i,Ry);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})`};const Sy=new O,Py=new O;function Pf(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,d=r*r*h*h,p=a*a*l*l,_=u+d+p,y=Math.sqrt(1/_),w=O.multiplyByScalar(i,y,Sy);if(_<n)return isFinite(y)?O.clone(w,s):void 0;const E=e.x,b=e.y,P=e.z,I=Py;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,R,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,R=Q*q,A=m*Y,F=v*X,L=u*Q+d*m+p*v-1,z=u*R*E+d*A*b+p*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 g.typeOf.number("longitude",i),g.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 g.typeOf.number("longitude",i),g.typeOf.number("latitude",t),i=T.toRadians(i),t=T.toRadians(t),lt.fromRadians(i,t,e,n)};const Oy=new O,Iy=new O,Ty=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=Pf(i,n,s,o,Iy);if(!C(r))return;let a=O.multiplyComponents(r,s,Oy);a=O.normalize(a,a);const c=O.subtract(i,r,Ty),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 g.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 Of(i,t,e,n){t=t??0,e=e??0,n=n??0,g.typeOf.number.greaterThanOrEquals("x",t,0),g.typeOf.number.greaterThanOrEquals("y",e,0),g.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,Of(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)&&Of(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){g.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 g.typeOf.object("value",i),g.defined("array",t),e=e??0,O.pack(i._radii,t,e),t},ct.unpack=function(i,t,e){g.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){g.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(g.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 Ay=new O,My=new O;ct.prototype.cartographicToCartesian=function(i,t){const e=Ay,n=My;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){g.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 Dy=new O,Fy=new O,Ly=new O;ct.prototype.cartesianToCartographic=function(i,t){const e=this.scaleToGeodeticSurface(i,Fy);if(!C(e))return;const n=this.geodeticSurfaceNormal(e,Dy),s=O.subtract(i,e,Ly),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){g.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 Pf(i,this._oneOverRadii,this._oneOverRadiiSquared,this._centerToleranceSquared,t)},ct.prototype.scaleToGeocentricSurface=function(i,t){g.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(g.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)");g.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 zy=new O;ct.prototype.getLocalCurvature=function(i,t){g.typeOf.object("surfacePosition",i),C(t)||(t=new tt);const e=this.getSurfaceNormalIntersectionWithZAxis(i,0,zy),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 Ny=[.14887433898163,.43339539412925,.67940956829902,.86506336668898,.97390652851717,0],Uy=[.29552422471475,.26926671930999,.21908636251598,.14945134915058,.066671344308684,0];function If(i,t,e){g.typeOf.number("a",i),g.typeOf.number("b",t),g.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*Ny[r];o+=Uy[r]*(e(n+a)+e(n-a))}return o*=s,o}ct.prototype.surfaceArea=function(i){g.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 If(n,s,function(l){const u=Math.cos(l),d=Math.sin(l);return Math.cos(l)*If(t,e,function(p){const _=Math.cos(p),y=Math.sin(p);return Math.sqrt(h*d*d+c*(a*_*_+r*y*y)*u*u)})})};function Mo(i,t,e){g.defined("array",i),g.defined("itemToFind",t),g.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 Ah(i,t,e,n,s){this.xPoleWander=i,this.yPoleWander=t,this.xPoleOffset=e,this.yPoleOffset=n,this.ut1MinusUtc=s}function Mh(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 Tf=[31,28,31,30,31,30,31,31,30,31,30,31];function Dh(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(){g.typeOf.number.greaterThanOrEquals("Year",i,1),g.typeOf.number.lessThanOrEquals("Year",i,9999),g.typeOf.number.greaterThanOrEquals("Month",t,1),g.typeOf.number.lessThanOrEquals("Month",t,12),g.typeOf.number.greaterThanOrEquals("Day",e,1),g.typeOf.number.lessThanOrEquals("Day",e,31),g.typeOf.number.greaterThanOrEquals("Hour",n,0),g.typeOf.number.lessThanOrEquals("Hour",n,23),g.typeOf.number.greaterThanOrEquals("Minute",s,0),g.typeOf.number.lessThanOrEquals("Minute",s,59),g.typeOf.bool("IsLeapSecond",a),g.typeOf.number.greaterThanOrEquals("Second",o,0),g.typeOf.number.lessThanOrEquals("Second",o,a?60:59),g.typeOf.number.greaterThanOrEquals("Millisecond",r,0),g.typeOf.number.lessThan("Millisecond",r,1e3)}function w(){const E=t===2&&Mh(i)?Tf[t-1]+1:Tf[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}),Af=new Dh,ma=[31,28,31,30,31,30,31,31,30,31,30,31],_a=29;function Fh(i,t){return $.compare(i.julianDate,t.julianDate)}const Os=new Pt;function ya(i){Os.julianDate=i;const t=$.leapSeconds;let e=Mo(t,Os,Fh);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 Mf(i,t){Os.julianDate=i;const e=$.leapSeconds;let n=Mo(e,Os,Fh);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 hn(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 Lh(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 jy=/^(\d{4})$/,ky=/^(\d{4})-(\d{2})$/,Wy=/^(\d{4})-?(\d{3})$/,qy=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,Gy=/^(\d{4})-?(\d{2})-?(\d{2})$/,zh=/([Z+\-])?(\d{2})?:?(\d{2})?$/,By=/^(\d{2})(\.\d+)?/.source+zh.source,Vy=/^(\d{2}):?(\d{2})(\.\d+)?/.source+zh.source,Yy=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+zh.source,Ve="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,hn(n,t,this),e===mt.UTC&&ya(this)}$.fromGregorianDate=function(i,t){if(!(i instanceof Dh))throw new j("date must be a valid GregorianDate.");const e=Lh(i.year,i.month,i.day,i.hour,i.minute,i.second,i.millisecond);return C(t)?(hn(e[0],e[1],t),ya(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=Lh(i.getUTCFullYear(),i.getUTCMonth()+1,i.getUTCDate(),i.getUTCHours(),i.getUTCMinutes(),i.getUTCSeconds(),i.getUTCMilliseconds());return C(t)?(hn(e[0],e[1],t),ya(t),t):new $(e[0],e[1],mt.UTC)},$.fromIso8601=function(i,t){if(typeof i!="string")throw new j(Ve);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 d,p;if(!C(l))throw new j(Ve);let _;if(e=l.match(Gy),e!==null){if(_=l.split("-").length-1,_>0&&_!==2)throw new j(Ve);n=+e[1],s=+e[2],o=+e[3]}else if(e=l.match(ky),e!==null)n=+e[1],s=+e[2];else if(e=l.match(jy),e!==null)n=+e[1];else{let b;if(e=l.match(Wy),e!==null){if(n=+e[1],b=+e[2],p=Mh(n),b<1||p&&b>366||!p&&b>365)throw new j(Ve)}else if(e=l.match(qy),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(Ve);const M=new Date(Date.UTC(n,0,4));b=P*7+I-M.getUTCDay()-3}else throw new j(Ve);d=new Date(Date.UTC(n,0,1)),d.setUTCDate(b),s=d.getUTCMonth()+1,o=d.getUTCDate()}if(p=Mh(n),s<1||s>12||o<1||(s!==2||!p)&&o>ma[s-1]||p&&s===2&&o>_a)throw new j(Ve);let y;if(C(u)){if(e=u.match(Yy),e!==null){if(_=u.split(":").length-1,_>0&&_!==2&&_!==3)throw new j(Ve);r=+e[1],a=+e[2],c=+e[3],h=+(e[4]||0)*1e3,y=5}else if(e=u.match(Vy),e!==null){if(_=u.split(":").length-1,_>2)throw new j(Ve);r=+e[1],a=+e[2],c=+(e[3]||0)*60,y=4}else if(e=u.match(By),e!==null)r=+e[1],a=+(e[2]||0)*60,y=3;else throw new j(Ve);if(a>=60||c>=61||r>24||r===24&&(a>0||c>0||h>0))throw new j(Ve);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(d=p&&s===2?_a:ma[s-1];o>d;)o-=d,s++,s>12&&(s-=12,n++),d=p&&s===2?_a:ma[s-1];for(;a<0;)a+=60,r--;for(;r<0;)r+=24,o--;for(;o<1;)s--,s<1&&(s+=12,n--),d=p&&s===2?_a:ma[s-1],o+=d;const E=Lh(n,s,o,r,a,c,h);return C(t)?(hn(E[0],E[1],t),ya(t)):t=new $(E[0],E[1],mt.UTC),w&&$.addSeconds(t,1,t),t},$.now=function(i){return $.fromDate(new Date,i)};const wa=new $(0,0,mt.TAI);$.toGregorianDate=function(i,t){if(!C(i))throw new j("julianDate is required.");let e=!1,n=Mf(i,wa);C(n)||($.addSeconds(i,-1,wa),n=Mf(wa,wa),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,d=100*(a-49)+c+r|0;let p=o/Dt.SECONDS_PER_HOUR|0,_=o-p*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 p+=12,p>23&&(p-=24),e&&(w+=1),C(t)?(t.year=d,t.month=u,t.day=l,t.hour=p,t.minute=y,t.second=w,t.millisecond=E,t.isLeapSecond=e,t):new Dh(d,u,l,p,y,w,E,e)},$.toDate=function(i){if(!C(i))throw new j("julianDate is required.");const t=$.toGregorianDate(i,Af);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,Af);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){Os.julianDate=i;const t=$.leapSeconds;let e=Mo(t,Os,Fh);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 hn(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 hn(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 hn(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 hn(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 va={exports:{}},Do={exports:{}};/*! https://mths.be/punycode v1.4.0 by @mathias */var Hy=Do.exports,Df;function Xy(){return Df||(Df=1,function(i,t){(function(e){var n=t&&!t.nodeType&&t,s=i&&!i.nodeType&&i,o=typeof of=="object"&&of;(o.global===o||o.window===o||o.self===o)&&(e=o);var r,a=2147483647,c=36,h=1,l=26,u=38,d=700,p=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(B){throw new RangeError(P[B])}function q(B,Z){for(var V=B.length,at=[];V--;)at[V]=Z(B[V]);return at}function Y(B,Z){var V=B.split("@"),at="";V.length>1&&(at=V[0]+"@",B=V[1]),B=B.replace(b,".");var et=B.split("."),it=q(et,Z).join(".");return at+it}function X(B){for(var Z=[],V=0,at=B.length,et,it;V<at;)et=B.charCodeAt(V++),et>=55296&&et<=56319&&V<at?(it=B.charCodeAt(V++),(it&64512)==56320?Z.push(((et&1023)<<10)+(it&1023)+65536):(Z.push(et),V--)):Z.push(et);return Z}function Q(B){return q(B,function(Z){var V="";return Z>65535&&(Z-=65536,V+=D(Z>>>10&1023|55296),Z=56320|Z&1023),V+=D(Z),V}).join("")}function m(B){return B-48<10?B-22:B-65<26?B-65:B-97<26?B-97:c}function v(B,Z){return B+22+75*(B<26)-((Z!=0)<<5)}function R(B,Z,V){var at=0;for(B=V?M(B/d):B>>1,B+=M(B/Z);B>I*l>>1;at+=c)B=M(B/I);return M(at+(I+1)*B/(B+u))}function A(B){var Z=[],V=B.length,at,et=0,it=_,gt=p,yt,dt,Et,ft,xt,Ft,kt,Wt,he;for(yt=B.lastIndexOf(y),yt<0&&(yt=0),dt=0;dt<yt;++dt)B.charCodeAt(dt)>=128&&z("not-basic"),Z.push(B.charCodeAt(dt));for(Et=yt>0?yt+1:0;Et<V;){for(ft=et,xt=1,Ft=c;Et>=V&&z("invalid-input"),kt=m(B.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=R(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(B){var Z,V,at,et,it,gt,yt,dt,Et,ft,xt,Ft=[],kt,Wt,he,ye;for(B=X(B),kt=B.length,Z=_,V=0,it=p,gt=0;gt<kt;++gt)xt=B[gt],xt<128&&Ft.push(D(xt));for(at=et=Ft.length,et&&Ft.push(y);at<kt;){for(yt=a,gt=0;gt<kt;++gt)xt=B[gt],xt>=Z&&xt<yt&&(yt=xt);for(Wt=at+1,yt-Z>M((a-V)/Wt)&&z("overflow"),V+=(yt-Z)*Wt,Z=yt,gt=0;gt<kt;++gt)if(xt=B[gt],xt<Z&&++V>a&&z("overflow"),xt==Z){for(dt=V,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=R(V,Wt,at==et),V=0,++at}++V,++Z}return Ft.join("")}function N(B){return Y(B,function(Z){return w.test(Z)?A(Z.slice(4).toLowerCase()):Z})}function G(B){return Y(B,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})(Hy)}(Do,Do.exports)),Do.exports}var Ea={exports:{}};/*!
36
+ (${this[3]}, ${this[7]}, ${this[11]}, ${this[15]})`};function Ao(i,t,e){g.defined("array",i),g.defined("itemToFind",t),g.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 xf=[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(){g.typeOf.number.greaterThanOrEquals("Year",i,1),g.typeOf.number.lessThanOrEquals("Year",i,9999),g.typeOf.number.greaterThanOrEquals("Month",t,1),g.typeOf.number.lessThanOrEquals("Month",t,12),g.typeOf.number.greaterThanOrEquals("Day",e,1),g.typeOf.number.lessThanOrEquals("Day",e,31),g.typeOf.number.greaterThanOrEquals("Hour",n,0),g.typeOf.number.lessThanOrEquals("Hour",n,23),g.typeOf.number.greaterThanOrEquals("Minute",s,0),g.typeOf.number.lessThanOrEquals("Minute",s,59),g.typeOf.bool("IsLeapSecond",a),g.typeOf.number.greaterThanOrEquals("Second",o,0),g.typeOf.number.lessThanOrEquals("Second",o,a?60:59),g.typeOf.number.greaterThanOrEquals("Millisecond",r,0),g.typeOf.number.lessThan("Millisecond",r,1e3)}function w(){const E=t===2&&Ch(i)?xf[t-1]+1:xf[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,ca=[31,28,31,30,31,30,31,31,30,31,30,31],ha=29;function xh(i,t){return $.compare(i.julianDate,t.julianDate)}const Ps=new Pt;function la(i){Ps.julianDate=i;const t=$.leapSeconds;let e=Ao(t,Ps,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 Sf(i,t){Ps.julianDate=i;const e=$.leapSeconds;let n=Ao(e,Ps,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 Rh(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 Py=/^(\d{4})$/,Oy=/^(\d{4})-(\d{2})$/,Iy=/^(\d{4})-?(\d{3})$/,Ty=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,Ay=/^(\d{4})-?(\d{2})-?(\d{2})$/,Sh=/([Z+\-])?(\d{2})?:?(\d{2})?$/,My=/^(\d{2})(\.\d+)?/.source+Sh.source,Dy=/^(\d{2}):?(\d{2})(\.\d+)?/.source+Sh.source,Fy=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+Sh.source,Ve="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&&la(this)}$.fromGregorianDate=function(i,t){if(!(i instanceof bh))throw new j("date must be a valid GregorianDate.");const e=Rh(i.year,i.month,i.day,i.hour,i.minute,i.second,i.millisecond);return C(t)?(cn(e[0],e[1],t),la(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=Rh(i.getUTCFullYear(),i.getUTCMonth()+1,i.getUTCDate(),i.getUTCHours(),i.getUTCMinutes(),i.getUTCSeconds(),i.getUTCMilliseconds());return C(t)?(cn(e[0],e[1],t),la(t),t):new $(e[0],e[1],mt.UTC)},$.fromIso8601=function(i,t){if(typeof i!="string")throw new j(Ve);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 d,p;if(!C(l))throw new j(Ve);let _;if(e=l.match(Ay),e!==null){if(_=l.split("-").length-1,_>0&&_!==2)throw new j(Ve);n=+e[1],s=+e[2],o=+e[3]}else if(e=l.match(Oy),e!==null)n=+e[1],s=+e[2];else if(e=l.match(Py),e!==null)n=+e[1];else{let b;if(e=l.match(Iy),e!==null){if(n=+e[1],b=+e[2],p=Ch(n),b<1||p&&b>366||!p&&b>365)throw new j(Ve)}else if(e=l.match(Ty),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(Ve);const M=new Date(Date.UTC(n,0,4));b=P*7+I-M.getUTCDay()-3}else throw new j(Ve);d=new Date(Date.UTC(n,0,1)),d.setUTCDate(b),s=d.getUTCMonth()+1,o=d.getUTCDate()}if(p=Ch(n),s<1||s>12||o<1||(s!==2||!p)&&o>ca[s-1]||p&&s===2&&o>ha)throw new j(Ve);let y;if(C(u)){if(e=u.match(Fy),e!==null){if(_=u.split(":").length-1,_>0&&_!==2&&_!==3)throw new j(Ve);r=+e[1],a=+e[2],c=+e[3],h=+(e[4]||0)*1e3,y=5}else if(e=u.match(Dy),e!==null){if(_=u.split(":").length-1,_>2)throw new j(Ve);r=+e[1],a=+e[2],c=+(e[3]||0)*60,y=4}else if(e=u.match(My),e!==null)r=+e[1],a=+(e[2]||0)*60,y=3;else throw new j(Ve);if(a>=60||c>=61||r>24||r===24&&(a>0||c>0||h>0))throw new j(Ve);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(d=p&&s===2?ha:ca[s-1];o>d;)o-=d,s++,s>12&&(s-=12,n++),d=p&&s===2?ha:ca[s-1];for(;a<0;)a+=60,r--;for(;r<0;)r+=24,o--;for(;o<1;)s--,s<1&&(s+=12,n--),d=p&&s===2?ha:ca[s-1],o+=d;const E=Rh(n,s,o,r,a,c,h);return C(t)?(cn(E[0],E[1],t),la(t)):t=new $(E[0],E[1],mt.UTC),w&&$.addSeconds(t,1,t),t},$.now=function(i){return $.fromDate(new Date,i)};const ua=new $(0,0,mt.TAI);$.toGregorianDate=function(i,t){if(!C(i))throw new j("julianDate is required.");let e=!1,n=Sf(i,ua);C(n)||($.addSeconds(i,-1,ua),n=Sf(ua,ua),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,d=100*(a-49)+c+r|0;let p=o/Dt.SECONDS_PER_HOUR|0,_=o-p*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 p+=12,p>23&&(p-=24),e&&(w+=1),C(t)?(t.year=d,t.month=u,t.day=l,t.hour=p,t.minute=y,t.second=w,t.millisecond=E,t.isLeapSecond=e,t):new bh(d,u,l,p,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){Ps.julianDate=i;const t=$.leapSeconds;let e=Ao(t,Ps,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 da={exports:{}},Mo={exports:{}};/*! https://mths.be/punycode v1.4.0 by @mathias */var Ly=Mo.exports,Pf;function zy(){return Pf||(Pf=1,function(i,t){(function(e){var n=t&&!t.nodeType&&t,s=i&&!i.nodeType&&i,o=typeof af=="object"&&af;(o.global===o||o.window===o||o.self===o)&&(e=o);var r,a=2147483647,c=36,h=1,l=26,u=38,d=700,p=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(B){throw new RangeError(P[B])}function q(B,Z){for(var V=B.length,at=[];V--;)at[V]=Z(B[V]);return at}function Y(B,Z){var V=B.split("@"),at="";V.length>1&&(at=V[0]+"@",B=V[1]),B=B.replace(b,".");var et=B.split("."),it=q(et,Z).join(".");return at+it}function X(B){for(var Z=[],V=0,at=B.length,et,it;V<at;)et=B.charCodeAt(V++),et>=55296&&et<=56319&&V<at?(it=B.charCodeAt(V++),(it&64512)==56320?Z.push(((et&1023)<<10)+(it&1023)+65536):(Z.push(et),V--)):Z.push(et);return Z}function Q(B){return q(B,function(Z){var V="";return Z>65535&&(Z-=65536,V+=D(Z>>>10&1023|55296),Z=56320|Z&1023),V+=D(Z),V}).join("")}function m(B){return B-48<10?B-22:B-65<26?B-65:B-97<26?B-97:c}function v(B,Z){return B+22+75*(B<26)-((Z!=0)<<5)}function R(B,Z,V){var at=0;for(B=V?M(B/d):B>>1,B+=M(B/Z);B>I*l>>1;at+=c)B=M(B/I);return M(at+(I+1)*B/(B+u))}function A(B){var Z=[],V=B.length,at,et=0,it=_,gt=p,yt,dt,Et,ft,xt,Ft,kt,Wt,he;for(yt=B.lastIndexOf(y),yt<0&&(yt=0),dt=0;dt<yt;++dt)B.charCodeAt(dt)>=128&&z("not-basic"),Z.push(B.charCodeAt(dt));for(Et=yt>0?yt+1:0;Et<V;){for(ft=et,xt=1,Ft=c;Et>=V&&z("invalid-input"),kt=m(B.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=R(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(B){var Z,V,at,et,it,gt,yt,dt,Et,ft,xt,Ft=[],kt,Wt,he,ye;for(B=X(B),kt=B.length,Z=_,V=0,it=p,gt=0;gt<kt;++gt)xt=B[gt],xt<128&&Ft.push(D(xt));for(at=et=Ft.length,et&&Ft.push(y);at<kt;){for(yt=a,gt=0;gt<kt;++gt)xt=B[gt],xt>=Z&&xt<yt&&(yt=xt);for(Wt=at+1,yt-Z>M((a-V)/Wt)&&z("overflow"),V+=(yt-Z)*Wt,Z=yt,gt=0;gt<kt;++gt)if(xt=B[gt],xt<Z&&++V>a&&z("overflow"),xt==Z){for(dt=V,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=R(V,Wt,at==et),V=0,++at}++V,++Z}return Ft.join("")}function N(B){return Y(B,function(Z){return w.test(Z)?A(Z.slice(4).toLowerCase()):Z})}function G(B){return Y(B,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})(Ly)}(Mo,Mo.exports)),Mo.exports}var fa={exports:{}};/*!
37
37
  * URI.js - Mutating URLs
38
38
  * IPv6 Support
39
39
  *
@@ -45,7 +45,7 @@ ${this.stack.toString()}`),i};function U(i,t,e,n,s,o,r,a,c,h,l,u,d,p,_,y){this[0
45
45
  * Licensed under
46
46
  * MIT License http://www.opensource.org/licenses/mit-license
47
47
  *
48
- */var $y=Ea.exports,Ff;function Zy(){return Ff||(Ff=1,function(i){(function(t,e){i.exports?i.exports=e():t.IPv6=e(t)})($y,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,d=0;d<h;d++){u=a[d].split("");for(var p=0;p<3&&(u[0]==="0"&&u.length>1);p++)u.splice(0,1);a[d]=u.join("")}var _=-1,y=0,w=0,E=-1,b=!1;for(d=0;d<h;d++)b?a[d]==="0"?w+=1:(b=!1,w>y&&(_=E,y=w)):a[d]==="0"&&(b=!0,E=d,w=1);w>y&&(_=E,y=w),y>1&&a.splice(_,y,""),c=a.length;var P="";for(a[0]===""&&(P=":"),d=0;d<c&&(P+=a[d],d!==c-1);d++)P+=":";return a[c-1]===""&&(P+=":"),P}function s(){return t.IPv6===this&&(t.IPv6=e),this}return{best:n,noConflict:s}})}(Ea)),Ea.exports}var Ca={exports:{}};/*!
48
+ */var Ny=fa.exports,Of;function Uy(){return Of||(Of=1,function(i){(function(t,e){i.exports?i.exports=e():t.IPv6=e(t)})(Ny,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,d=0;d<h;d++){u=a[d].split("");for(var p=0;p<3&&(u[0]==="0"&&u.length>1);p++)u.splice(0,1);a[d]=u.join("")}var _=-1,y=0,w=0,E=-1,b=!1;for(d=0;d<h;d++)b?a[d]==="0"?w+=1:(b=!1,w>y&&(_=E,y=w)):a[d]==="0"&&(b=!0,E=d,w=1);w>y&&(_=E,y=w),y>1&&a.splice(_,y,""),c=a.length;var P="";for(a[0]===""&&(P=":"),d=0;d<c&&(P+=a[d],d!==c-1);d++)P+=":";return a[c-1]===""&&(P+=":"),P}function s(){return t.IPv6===this&&(t.IPv6=e),this}return{best:n,noConflict:s}})}(fa)),fa.exports}var ga={exports:{}};/*!
49
49
  * URI.js - Mutating URLs
50
50
  * Second Level Domain (SLD) Support
51
51
  *
@@ -57,7 +57,7 @@ ${this.stack.toString()}`),i};function U(i,t,e,n,s,o,r,a,c,h,l,u,d,p,_,y){this[0
57
57
  * Licensed under
58
58
  * MIT License http://www.opensource.org/licenses/mit-license
59
59
  *
60
- */var Ky=Ca.exports,Lf;function Qy(){return Lf||(Lf=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})}(Ca)),Ca.exports}/*!
60
+ */var jy=ga.exports,If;function ky(){return If||(If=1,function(i){(function(t,e){i.exports?i.exports=e():t.SecondLevelDomains=e(t)})(jy,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})}(ga)),ga.exports}/*!
61
61
  * URI.js - Mutating URLs
62
62
  *
63
63
  * Version: 1.19.11
@@ -68,8 +68,8 @@ ${this.stack.toString()}`),i};function U(i,t,e,n,s,o,r,a,c,h,l,u,d,p,_,y){this[0
68
68
  * Licensed under
69
69
  * MIT License http://www.opensource.org/licenses/mit-license
70
70
  *
71
- */var Jy=va.exports,zf;function tw(){return zf||(zf=1,function(i){(function(t,e){i.exports?i.exports=e(Xy(),Zy(),Qy()):t.URI=e(t.punycode,t.IPv6,t.SecondLevelDomains,t)})(Jy,function(t,e,n,s){var o=s&&s.URI;function r(m,v){var R=arguments.length>=1,A=arguments.length>=2;if(!(this instanceof r))return R?A?new r(m,v):new r(m):new r;if(m===void 0){if(R)throw new TypeError("undefined is not a valid argument for URI");typeof location<"u"?m=location.href+"":m=""}if(m===null&&R)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 d(m){return u(m)==="Array"}function p(m,v){var R={},A,F;if(u(v)==="RegExp")R=null;else if(d(v))for(A=0,F=v.length;A<F;A++)R[v[A]]=!0;else R[v]=!0;for(A=0,F=m.length;A<F;A++){var N=R&&R[m[A]]!==void 0||!R&&v.test(m[A]);N&&(m.splice(A,1),F--,A--)}return m}function _(m,v){var R,A;if(d(v)){for(R=0,A=v.length;R<A;R++)if(!_(m,v[R]))return!1;return!0}var F=u(v);for(R=0,A=m.length;R<A;R++)if(F==="RegExp"){if(typeof m[R]=="string"&&m[R].match(v))return!0}else if(m[R]===v)return!0;return!1}function y(m,v){if(!d(m)||!d(v)||m.length!==v.length)return!1;m.sort(),v.sort();for(var R=0,A=m.length;R<A;R++)if(m[R]!==v[R])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 R=r.encode(m+"");return v===void 0&&(v=r.escapeQuerySpace),v?R.replace(/%20/g,"+"):R},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(R){try{return r[v](R+"").replace(r.characters[m][v].expression,function(A){return r.characters[m][v].map[A]})}catch{return R}}};for(I in P)r[I+"PathSegment"]=M("pathname",P[I]),r[I+"UrnPathSegment"]=M("urnpath",P[I]);var D=function(m,v,R){return function(A){var F;R?F=function(Z){return r[v](r[R](Z))}:F=r[v];for(var N=(A+"").split(m),G=0,B=N.length;G<B;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 R;return v||(v={preventInvalidHostname:r.preventInvalidHostname}),m=m.replace(r.leading_whitespace_expression,""),m=m.replace(r.ascii_tab_whitespace,""),R=m.indexOf("#"),R>-1&&(v.fragment=m.substring(R+1)||null,m=m.substring(0,R)),R=m.indexOf("?"),R>-1&&(v.query=m.substring(R+1)||null,m=m.substring(0,R)),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)):(R=m.indexOf(":"),R>-1&&(v.protocol=m.substring(0,R)||null,v.protocol&&!v.protocol.match(r.protocol_expression)?v.protocol=void 0:m.substring(R+1,R+3).replace(/\\/g,"/")==="//"?(m=m.substring(R+3),m=r.parseAuthority(m,v)):(m=m.substring(R+1),v.urn=!0))),v.path=m,v},r.parseHost=function(m,v){m||(m=""),m=m.replace(/\\/g,"/");var R=m.indexOf("/"),A,F;if(R===-1&&(R=m.length),m.charAt(0)==="[")A=m.indexOf("]"),v.hostname=m.substring(1,A)||null,v.port=m.substring(A+2,R)||null,v.port==="/"&&(v.port=null);else{var N=m.indexOf(":"),G=m.indexOf("/"),B=m.indexOf(":",N+1);B!==-1&&(G===-1||B<G)?(v.hostname=m.substring(0,R)||null,v.port=null):(F=m.substring(0,R).split(":"),v.hostname=F[0]||null,v.port=F[1]||null)}return v.hostname&&m.substring(R).charAt(0)!=="/"&&(R++,m="/"+m),v.preventInvalidHostname&&r.ensureValidHostname(v.hostname,v.protocol),v.port&&r.ensureValidPort(v.port),m.substring(R)||"/"},r.parseAuthority=function(m,v){return m=r.parseUserinfo(m,v),r.parseHost(m,v)},r.parseUserinfo=function(m,v){var R=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=R.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 R={},A=m.split("&"),F=A.length,N,G,B,Z=0;Z<F;Z++)N=A[Z].split("="),G=r.decodeQuery(N.shift(),v),B=N.length?r.decodeQuery(N.join("="),v):null,G!=="__proto__"&&(h.call(R,G)?((typeof R[G]=="string"||R[G]===null)&&(R[G]=[R[G]]),R[G].push(B)):R[G]=B);return R},r.build=function(m){var v="",R=!1;return m.protocol&&(v+=m.protocol+":"),!m.urn&&(v||m.hostname)&&(v+="//",R=!0),v+=r.buildAuthority(m)||"",typeof m.path=="string"&&(m.path.charAt(0)!=="/"&&R&&(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,R){var A="",F,N,G,B;for(N in m)if(N!=="__proto__"&&h.call(m,N))if(d(m[N]))for(F={},G=0,B=m[N].length;G<B;G++)m[N][G]!==void 0&&F[m[N][G]+""]===void 0&&(A+="&"+r.buildQueryParameter(N,m[N][G],R),v!==!0&&(F[m[N][G]+""]=!0));else m[N]!==void 0&&(A+="&"+r.buildQueryParameter(N,m[N],R));return A.substring(1)},r.buildQueryParameter=function(m,v,R){return r.encodeQuery(m,R)+(v!==null?"="+r.encodeQuery(v,R):"")},r.addQuery=function(m,v,R){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]=R;return}else typeof m[v]=="string"&&(m[v]=[m[v]]);d(R)||(R=[R]),m[v]=(m[v]||[]).concat(R)}else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter")},r.setQuery=function(m,v,R){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]=R===void 0?null:R;else throw new TypeError("URI.setQuery() accepts an object, string as the name parameter")},r.removeQuery=function(m,v,R){var A,F,N;if(d(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")R!==void 0?u(R)==="RegExp"?!d(m[v])&&R.test(m[v])?m[v]=void 0:m[v]=p(m[v],R):m[v]===String(R)&&(!d(R)||R.length===1)?m[v]=void 0:d(m[v])&&(m[v]=p(m[v],R)):m[v]=void 0;else throw new TypeError("URI.removeQuery() accepts an object, string, RegExp as the first parameter")},r.hasQuery=function(m,v,R,A){switch(u(v)){case"String":break;case"RegExp":for(var F in m)if(h.call(m,F)&&v.test(F)&&(R===void 0||r.hasQuery(m,F,R)))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(R)){case"Undefined":return v in m;case"Boolean":var G=!!(d(m[v])?m[v].length:m[v]);return R===G;case"Function":return!!R(m[v],v,m);case"Array":if(!d(m[v]))return!1;var B=A?_:y;return B(m[v],R);case"RegExp":return d(m[v])?A?_(m[v],R):!1:!!(m[v]&&m[v].match(R));case"Number":R=String(R);case"String":return d(m[v])?A?_(m[v],R):!1:m[v]===R;default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter")}},r.joinPaths=function(){for(var m=[],v=[],R=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]&&R++}if(!v.length||!R)return new r("");var B=new r("").segment(v);return(m[0].path()===""||m[0].path().slice(0,1)==="/")&&B.path("/"+B.path()),B.normalize()},r.commonPath=function(m,v){var R=Math.min(m.length,v.length),A;for(A=0;A<R;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,R){R||(R={});var A=R.start||r.findUri.start,F=R.end||r.findUri.end,N=R.trim||r.findUri.trim,G=R.parens||r.findUri.parens,B=/[a-z0-9-]=["']?$/i;for(A.lastIndex=0;;){var Z=A.exec(m);if(!Z)break;var V=Z.index;if(R.ignoreHtml){var at=m.slice(Math.max(V-3,0),V);if(at&&B.test(at))continue}for(var et=V+m.slice(V).search(F),it=m.slice(V,et),gt=-1;;){var yt=G.exec(it);if(!yt)break;var dt=yt.index+yt[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)&&!(R.ignore&&R.ignore.test(it))){et=V+it.length;var Et=v(it,V,et,m);if(Et===void 0){A.lastIndex=et;continue}Et=String(Et),m=m.slice(0,V)+Et+m.slice(et),A.lastIndex=V+Et.length}}return A.lastIndex=0,m},r.ensureValidHostname=function(m,v){var R=!!m,A=!!v,F=!1;if(A&&(F=_(r.hostProtocols,v)),F&&!R)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,R){return v===void 0?this._parts[m]||"":(this._parts[m]=v||null,this.build(!R),this)}}function z(m,v){return function(R,A){return R===void 0?this._parts[m]||"":(R!==null&&(R=R+"",R.charAt(0)===v&&(R=R.substring(1))),this._parts[m]=R,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 R=this.query(m,v);return typeof R=="string"&&R.length?"?"+R:R},c.hash=function(m,v){var R=this.fragment(m,v);return typeof R=="string"&&R.length?"#"+R:R},c.pathname=function(m,v){if(m===void 0||m===!0){var R=this._parts.path||(this._parts.hostname?"/":"");return m?(this._parts.urn?r.decodeUrnPath:r.decodePath)(R):R}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 R;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(R in G)R!=="query"&&h.call(this._parts,R)&&(this._parts[R]=G[R]);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,R=!1,A=!1,F=!1,N=!1,G=!1,B=!1,Z=!this._parts.urn;switch(this._parts.hostname&&(Z=!1,R=r.ip4_expression.test(this._parts.hostname),A=r.ip6_expression.test(this._parts.hostname),v=R||A,F=!v,N=F&&n&&n.has(this._parts.hostname),G=F&&r.idn_expression.test(this._parts.hostname),B=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 R;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 B}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 R={preventInvalidHostname:this._parts.preventInvalidHostname},A=r.parseHost(m,R);if(A!=="/")throw new TypeError('Hostname "'+m+'" contains characters other than [A-Z0-9.-]');m=R.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 R=this.protocol(),A=this.authority();return A?(R?R+"://":"")+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 R=r.parseHost(m,this._parts);if(R!=="/")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 R=r.parseAuthority(m,this._parts);if(R!=="/")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 R=r.buildUserinfo(this._parts);return R&&R.substring(0,R.length-1)}else return m[m.length-1]!=="@"&&(m+="@"),r.parseUserinfo(m,this._parts),this.build(!v),this},c.resource=function(m,v){var R;return m===void 0?this.path()+this.search()+this.hash():(R=r.parse(m),this._parts.path=R.path,this._parts.query=R.query,this._parts.fragment=R.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 R=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,R)||""}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 R=this._parts.hostname.match(/\./g);if(R&&R.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 R=this._parts.hostname.lastIndexOf("."),A=this._parts.hostname.substring(R+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 R=this._parts.path.length-this.filename().length-1,A=this._parts.path.substring(0,R)||(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 R=this._parts.path.lastIndexOf("/"),A=this._parts.path.substring(R+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 R=this.filename(),A=R.lastIndexOf("."),F,N;return A===-1?"":(F=R.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(),B;if(G)m?B=new RegExp(l(G)+"$"):B=new RegExp(l("."+G)+"$");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(!v),this}},c.segment=function(m,v,R){var A=this._parts.urn?":":"/",F=this.path(),N=F.substring(0,1)==="/",G=F.split(A);if(m!==void 0&&typeof m!="number"&&(R=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(d(v)){G=[];for(var B=0,Z=v.length;B<Z;B++)!v[B].length&&(!G.length||!G[G.length-1].length)||(G.length&&!G[G.length-1].length&&G.pop(),G.push(w(v[B])))}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),R)},c.segmentCoded=function(m,v,R){var A,F,N;if(typeof m!="number"&&(R=v,v=m,m=void 0),v===void 0){if(A=this.segment(m,v,R),!d(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(!d(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,R)};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 R=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace),A=m.call(this,R);return this._parts.query=r.buildQuery(A||R,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,R){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"&&(R=v),this.build(!R),this},c.addQuery=function(m,v,R){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"&&(R=v),this.build(!R),this},c.removeQuery=function(m,v,R){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"&&(R=v),this.build(!R),this},c.hasQuery=function(m,v,R){var A=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return r.hasQuery(A,m,v,R)},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 R,A="",F,N;for(v.charAt(0)!=="/"&&(R=!0,v="/"+v),(v.slice(-3)==="/.."||v.slice(-2)==="/.")&&(v+="/"),v=v.replace(/(\/(\.\/)+)|(\/\.$)/g,"/").replace(/\/{2,}/g,"/"),R&&(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 R&&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 R="",A=0,F=m._parts.query.split("&"),N=F.length;A<N;A++){var G=(F[A]||"").split("=");R+="&"+r.decodeQuery(G[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"),G[1]!==void 0&&(R+="="+r.decodeQuery(G[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}v+="?"+R.substring(1)}return v+=r.decodeQuery(m.hash(),!0),v},c.absoluteTo=function(m){var v=this.clone(),R=["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=R[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(),R,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(),R=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(R.protocol===A.protocol&&(R.protocol=null),R.username!==A.username||R.password!==A.password||R.protocol!==null||R.username!==null||R.password!==null)return v.build();if(R.hostname===A.hostname&&R.port===A.port)R.hostname=null,R.port=null;else return v.build();if(N===G)return R.path="",v.build();if(F=r.commonPath(N,G),!F)return v.build();var B=A.path.substring(F.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../");return R.path=B+R.path.substring(F.length)||"./",v.build()},c.equals=function(m){var v=this.clone(),R=new r(m),A={},F={},N={},G,B,Z;if(v.normalize(),R.normalize(),v.toString()===R.toString())return!0;if(G=v.query(),B=R.query(),v.query(""),R.query(""),v.toString()!==R.toString()||G.length!==B.length)return!1;A=r.parseQuery(G,this._parts.escapeQuerySpace),F=r.parseQuery(B,this._parts.escapeQuerySpace);for(Z in A)if(h.call(A,Z)){if(d(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})}(va)),va.exports}var ew=tw();const ln=rf(ew);function iw(i){return(i.length===0||i[i.length-1]!=="/")&&(i=`${i}/`),i}function Is(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=Is(s,t)),e[n]=s}return e}function un(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]=un(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 ln(i);return n.scheme()!==""?n.toString():n.absoluteTo(t).toString()};function nw(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 ln(i),i.query().length!==0&&(e+=`?${i.query()}`),i.fragment().length!==0&&(e+=`#${i.fragment()}`)),e}function sw(i){if(!C(i))throw new j("uri is required.");const t=new ln(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 Nf={};function Uf(i,t,e){C(t)||(t=i.width),C(e)||(e=i.height);let n=Nf[t];C(n)||(n={},Nf[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 ow=/^blob:/i;function jf(i){return g.typeOf.string("uri",i),ow.test(i)}let ri;function rw(i){C(ri)||(ri=document.createElement("a")),ri.href=window.location.href;const t=ri.host,e=ri.protocol;return ri.href=i,ri.href=ri.href,e!==ri.protocol||t!==ri.host}const aw=/^data:/i;function kf(i){return g.typeOf.string("uri",i),aw.test(i)}function cw(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 hw(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 lw(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}),uw=Object.freeze({TERRAIN:0,IMAGERY:1,TILES3D:2,OTHER:3});function ba(i){i=i??oi.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??uw.OTHER,this.serverKey=i.serverKey,this.state=Nt.UNISSUED,this.deferred=void 0,this.cancelled=!1}ba.prototype.cancel=function(){this.cancelled=!0},ba.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 ba(this)};function dw(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=dw(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=[],this._scopes=[],this._toRemove=[],this._insideRaiseEvent=!1}Object.defineProperties(No.prototype,{numberOfListeners:{get:function(){return this._listeners.length-this._toRemove.length}}}),No.prototype.addEventListener=function(i,t){g.typeOf.func("listener",i),this._listeners.push(i),this._scopes.push(t);const e=this;return function(){e.removeEventListener(i,t)}},No.prototype.removeEventListener=function(i,t){g.typeOf.func("listener",i);const e=this._listeners,n=this._scopes;let s=-1;for(let o=0;o<e.length;o++)if(e[o]===i&&n[o]===t){s=o;break}return s!==-1?(this._insideRaiseEvent?(this._toRemove.push(s),e[s]=void 0,n[s]=void 0):(e.splice(s,1),n.splice(s,1)),!0):!1};function fw(i,t){return t-i}No.prototype.raiseEvent=function(){this._insideRaiseEvent=!0;let i;const t=this._listeners,e=this._scopes;let n=t.length;for(i=0;i<n;i++){const o=t[i];C(o)&&t[i].apply(e[i],arguments)}const s=this._toRemove;if(n=s.length,n>0){for(s.sort(fw),i=0;i<n;i++){const o=s[i];t.splice(o,1),e.splice(o,1)}s.length=0}this._insideRaiseEvent=!1};function Wn(i){g.typeOf.object("options",i),g.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){g.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 Nh(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?(Nh(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){g.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)Nh(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;g.typeOf.number.lessThan("index",i,this._length);const t=this._array,e=t[i];return Nh(t,i,--this._length),this.heapify(i),t[this._length]=void 0,e};function gw(i,t){return i.priority-t.priority}const bt={numberOfAttemptedRequests:0,numberOfActiveRequests:0,numberOfCancelledRequests:0,numberOfCancelledActiveRequests:0,numberOfFailedRequests:0,numberOfActiveRequestsEver:0,lastNumberOfActiveRequests:0};let Ts=20;const re=new Wn({comparator:gw});re.maximumLength=Ts,re.reserve(Ts);const ai=[];let Si={};const pw=typeof document<"u"?new ln(document.location.href):new ln,xa=new No;function Tt(){}Tt.maximumRequests=50,Tt.maximumRequestsPerServer=18,Tt.requestsByServer={},Tt.throttleRequests=!0,Tt.debugShowStatistics=!1,Tt.requestCompletedEvent=xa,Object.defineProperties(Tt,{statistics:{get:function(){return bt}},priorityHeapLength:{get:function(){return Ts},set:function(i){if(i<Ts)for(;re.length>i;){const t=re.pop();qn(t)}Ts=i,re.maximumLength=i,re.reserve(i)}}});function Wf(i){C(i.priorityFunction)&&(i.priority=i.priorityFunction())}Tt.serverHasOpenSlots=function(i,t){t=t??1;const e=Tt.requestsByServer[i]??Tt.maximumRequestsPerServer;return Si[i]+t<=e},Tt.heapHasOpenSlots=function(i){return re.length+i<=Ts};function qf(i){return i.state===Nt.UNISSUED&&(i.state=Nt.ISSUED,i.deferred=Fo()),i.deferred.promise}function mw(i){return function(t){if(i.state===Nt.CANCELLED)return;const e=i.deferred;--bt.numberOfActiveRequests,--Si[i.serverKey],xa.raiseEvent(),i.state=Nt.RECEIVED,i.deferred=void 0,e.resolve(t)}}function _w(i){return function(t){i.state!==Nt.CANCELLED&&(++bt.numberOfFailedRequests,--bt.numberOfActiveRequests,--Si[i.serverKey],xa.raiseEvent(t),i.state=Nt.FAILED,i.deferred.reject(t))}}function Gf(i){const t=qf(i);return i.state=Nt.ACTIVE,ai.push(i),++bt.numberOfActiveRequests,++bt.numberOfActiveRequestsEver,++Si[i.serverKey],i.requestFunction().then(mw(i)).catch(_w(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,--Si[i.serverKey],++bt.numberOfCancelledActiveRequests),C(i.cancelFunction)&&i.cancelFunction()}Tt.update=function(){let i,t,e=0;const n=ai.length;for(i=0;i<n;++i){if(t=ai[i],t.cancelled&&qn(t),t.state!==Nt.ACTIVE){++e;continue}e>0&&(ai[i-e]=t)}ai.length-=e;const s=re.internalArray,o=re.length;for(i=0;i<o;++i)Wf(s[i]);re.resort();const r=Math.max(Tt.maximumRequests-ai.length,0);let a=0;for(;a<r&&re.length>0;){if(t=re.pop(),t.cancelled){qn(t);continue}if(t.throttleByServer&&!Tt.serverHasOpenSlots(t.serverKey)){qn(t);continue}Gf(t),++a}yw()},Tt.getServerKey=function(i){g.typeOf.string("url",i);let t=new ln(i);t.scheme()===""&&(t=t.absoluteTo(pw),t.normalize());let e=t.authority();/:/.test(e)||(e=`${e}:${t.scheme()==="https"?"443":"80"}`);const n=Si[e];return C(n)||(Si[e]=0),e},Tt.request=function(i){if(g.typeOf.object("request",i),g.typeOf.string("request.url",i.url),g.typeOf.func("request.requestFunction",i.requestFunction),kf(i.url)||jf(i.url))return xa.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 Gf(i);if(ai.length>=Tt.maximumRequests)return;Wf(i);const t=re.insert(i);if(C(t)){if(t===i)return;qn(t)}return qf(i)};function yw(){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(;re.length>0;){const t=re.pop();qn(t)}const i=ai.length;for(let t=0;t<i;++t)qn(ai[t]);ai.length=0,Si={},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 Si[i]},Tt.requestHeap=re;const As={};let Ms={};As.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(Ms[e])||(Ms[e]=!0)},As.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(Ms[e])&&delete Ms[e]};function ww(i){const t=new ln(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}}As.contains=function(i){if(!C(i))throw new j("url is required.");const t=ww(i);return!!(C(t)&&C(Ms[t]))},As.clear=function(){Ms={}};const Bf=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??oi.EMPTY_OBJECT,typeof i=="string"&&(i={url:i}),g.typeOf.string("options.url",i.url),this._url=void 0,this._templateValues=ci(i.templateValues,{}),this._queryParameters=ci(i.queryParameters,{}),this.headers=ci(i.headers,{}),this.request=i.request??new ba,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 ci(i,t){return C(i)?Is(i):t}J.createIfNeeded=function(i){return i instanceof J?i.getDerivedResource({request:i.request}):typeof i!="string"?i:new J({url:i})};let Ds;J.supportsImageBitmapOptions=function(){return C(Ds)?Ds:typeof createImageBitmap!="function"?(Ds=Promise.resolve(!1),Ds):(Ds=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=Uf(t[0]),n=Uf(t[1]);return e[1]!==n[1]}).catch(function(){return!1}),Ds)},Object.defineProperties(J,{isBlobSupported:{get:function(){return Bf}}}),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 sw(this._url)}},isDataUri:{get:function(){return kf(this._url)}},isBlobUri:{get:function(){return jf(this._url)}},isCrossOriginUrl:{get:function(){return rw(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 ln(i);const o=vw(s.query());this._queryParameters=t?Ra(o,this.queryParameters,e):o,s.search(""),s.fragment(""),C(n)&&s.scheme()===""&&(s=s.absoluteTo(Lo(n))),this._url=s.toString()};function vw(i){return i.length===0?{}:i.indexOf("=")===-1?{[i]:void 0}:lw(i)}function Ra(i,t,e){if(!e)return un(i,t);const n=Is(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}${Ew(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 Ew(i){const t=Object.keys(i);return t.length===0?"":t.length===1&&!C(i[t[0]])?`?${t[0]}`:`?${hw(i)}`}J.prototype.setQueryParameters=function(i,t){t?this._queryParameters=Ra(this._queryParameters,i,!1):this._queryParameters=Ra(i,this._queryParameters,!1)},J.prototype.appendQueryParameters=function(i){this._queryParameters=Ra(i,this._queryParameters,!0)},J.prototype.setTemplateValues=function(i,t){t?this._templateValues=un(this._templateValues,i):this._templateValues=un(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=un(i.queryParameters,t.queryParameters)),C(i.templateValues)&&(t._templateValues=un(i.templateValues,t.templateValues)),C(i.headers)&&(t.headers=un(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=Is(this._queryParameters),i._templateValues=Is(this._templateValues),i.headers=Is(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 nw(this.getUrlComponent(i),i)},J.prototype.appendForwardSlash=function(){this._url=iw(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??oi.EMPTY_OBJECT;const t=i.preferImageBitmap??!1,e=i.preferBlob??!1,n=i.flipY??!1,s=i.skipColorSpaceConversion??!1;if(jh(this.request),!Bf||this.isDataUri||this.isBlobUri||!this.hasHeaders&&!e)return Uh({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}),Uh({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 Uh(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,Uh({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",jh(this.request);let t;do t=`loadJsonp${T.nextRandomNumber().toString().substring(2,8)}`;while(C(window[t]));return Vf(this,i,t)};function Vf(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,Vf(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;jh(t.request);const e=t.request,n=t.url;e.url=n,e.requestFunction=function(){const o=i.responseType,r=un(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 jh(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 Cw=/^data:(.*?)(;base64)?,(.*)$/;function Sa(i,t){const e=decodeURIComponent(t);return i?atob(e):e}function Yf(i,t){const e=Sa(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 bw(i,t){t=t??"";const e=i[1],n=!!i[2],s=i[3];let o,r;switch(t){case"":case"text":return Sa(n,s);case"arraybuffer":return Yf(n,s);case"blob":return o=Yf(n,s),new Blob([o],{type:e});case"document":return r=new DOMParser,r.parseFromString(Sa(n,s),e);case"json":return JSON.parse(Sa(n,s));default:throw new j(`Unhandled responseType: ${t}`)}}J.prototype.fetch=function(i){return i=ci(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=ci(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=ci(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=ci(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 g.defined("data",i),t=ci(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 g.defined("data",i),t=ci(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 g.defined("data",i),t=ci(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&&(As.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(d){if(!C(d)){e.reject(new De(`Successfully retrieved ${r} but it contained no content.`));return}return J.createImageBitmapFromBlob(d,{flipY:n,premultiplyAlpha:!1,skipColorSpaceConversion:s})}).then(function(d){e.resolve(d)})}).catch(function(a){e.reject(a)})},J.createImageBitmapFromBlob=function(i,t){return g.defined("options",t),g.typeOf.bool("options.flipY",t.flipY),g.typeOf.bool("options.premultiplyAlpha",t.premultiplyAlpha),g.typeOf.bool("options.skipColorSpaceConversion",t.skipColorSpaceConversion),createImageBitmap(i,{imageOrientation:t.flipY?"flipY":"from-image",premultiplyAlpha:t.premultiplyAlpha?"premultiply":"none",colorSpaceConversion:t.skipColorSpaceConversion?"none":"default"})};function xw(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 Rw=typeof XMLHttpRequest>"u";J._Implementations.loadWithXhr=function(i,t,e,n,s,o,r){const a=Cw.exec(i);if(a!==null){o.resolve(bw(a,t));return}if(Rw){xw(i,t,e,n,s,o);return}const c=new XMLHttpRequest;if(As.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 p=c.getAllResponseHeaders().trim().split(/[\r\n]+/),_={};p.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(d){o.reject(d)}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 cw(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??oi.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)?Hf(this,i.data):Hf(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})}Uo.fromUrl=async function(i,t){g.defined("url",i),t=t??oi.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 Ah(0,0,0,0,0),t}}),Uo.prototype.compute=function(i,t){if(!C(this._samples))return;if(C(t)||(t=new Ah(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,$f(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,$f(this,e,this._samples,i,s,o,t),t};function Sw(i,t){return $.compare(i.julianDate,t)}function Hf(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 d=i._addNewLeapSeconds;for(let p=0,_=h.length;p<_;p+=i._columnCount){const y=h[p+e],w=h[p+c],E=y+Dt.MODIFIED_JULIAN_DATE_DIFFERENCE,b=new $(E,w,mt.TAI);if(l.push(b),d){if(w!==u&&C(u)){const P=$.leapSeconds,I=Mo(P,b,Sw);if(I<0){const M=new Pt(b,w);P.splice(~I,0,M)}}u=w}}}function Xf(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 $f(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 Xf(i,e,s,a,r),r;if(n.equals(h))return Xf(i,e,o,a,r),r;const l=$.secondsDifference(n,c)/$.secondsDifference(h,c),u=s*a,d=o*a;let p=e[u+i._ut1MinusUtcSecondsColumn],_=e[d+i._ut1MinusUtcSecondsColumn];const y=_-p;if(y>.5||y<-.5){const w=e[u+i._taiMinusUtcSecondsColumn],E=e[d+i._taiMinusUtcSecondsColumn];w!==E&&(h.equals(n)?p=_:_-=E-w)}return r.xPoleWander=jo(l,e[u+i._xPoleWanderRadiansColumn],e[d+i._xPoleWanderRadiansColumn]),r.yPoleWander=jo(l,e[u+i._yPoleWanderRadiansColumn],e[d+i._yPoleWanderRadiansColumn]),r.xPoleOffset=jo(l,e[u+i._xCelestialPoleOffsetRadiansColumn],e[d+i._xCelestialPoleOffsetRadiansColumn]),r.yPoleOffset=jo(l,e[u+i._yCelestialPoleOffsetRadiansColumn],e[d+i._yCelestialPoleOffsetRadiansColumn]),r.ut1MinusUtc=jo(l,p,_),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 Zf=/((?:.*\/)|^)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=Zf.exec(n);if(s!==null)return s[1]}}let Pa;function Kf(i){return typeof document>"u"?i:(C(Pa)||(Pa=document.createElement("a")),Pa.href=i,Pa.href)}let Gn;function Qf(){if(C(Gn))return Gn;let i;if(typeof CESIUM_BASE_URL<"u"?i=CESIUM_BASE_URL:C(rs&&rs.tagName.toUpperCase()==="SCRIPT"&&rs.src||new URL("earthsdk3-ol.iife.js",document.baseURI).href)?i=Lo(".",rs&&rs.tagName.toUpperCase()==="SCRIPT"&&rs.src||new URL("earthsdk3-ol.iife.js",document.baseURI).href):typeof define=="object"&&C(define.amd)&&!define.amd.toUrlUndefined&&C(require.toUrl)?i=Lo("..",Bn("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:Kf(i)}),Gn.appendForwardSlash(),Gn}function Ow(i){return Kf(require.toUrl(`../${i}`))}function Jf(i){return Qf().getDerivedResource({url:i}).url}let Oa;function Bn(i){return C(Oa)||(typeof define=="object"&&C(define.amd)&&!define.amd.toUrlUndefined&&C(require.toUrl)?Oa=Ow:Oa=Jf),Oa(i)}Bn._cesiumScriptRegex=Zf,Bn._buildModuleUrlFromBaseUrl=Jf,Bn._clearBaseResource=function(){Gn=void 0},Bn.setBaseUrl=function(i){Gn=J.DEFAULT.getDerivedResource({url:i})},Bn.getCesiumBaseUrl=Qf;function tg(i,t,e){this.x=i,this.y=t,this.s=e}function kh(i){i=i??oi.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 Iw=new $(0,0,mt.TAI);function Wh(i,t,e){const n=Iw;return n.dayNumber=t,n.secondsOfDay=e,$.daysDifference(n,i._sampleZeroDateTT)}kh.prototype.preload=function(i,t,e,n){const s=Wh(this,i,t),o=Wh(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(qh(this,u));return Promise.all(l)},kh.prototype.computeXysRadians=function(i,t,e){const n=Wh(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])||(qh(this,r/this._samplesPerXysFile|0),c=!0),C(h[a*3])||(qh(this,a/this._samplesPerXysFile|0),c=!0),c)return;C(e)?(e.x=0,e.y=0,e.s=0):e=new tg(0,0,0);const l=n-r*this._stepSizeDays,u=this._work,d=this._denominators,p=this._coef,_=this._xTable;let y,w;for(y=0;y<=o;++y)u[y]=l-_[y];for(y=0;y<=o;++y){for(p[y]=1,w=0;w<=o;++w)w!==y&&(p[y]*=u[w]);p[y]*=d[y];let E=(r+y)*3;e.x+=p[y]*h[E++],e.y+=p[y]*h[E++],e.s+=p[y]*h[E]}return e};function qh(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:Bn(`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}function H(i,t,e,n){this.x=i??0,this.y=t??0,this.z=e??0,this.w=n??0}let ko=new O;H.fromAxisAngle=function(i,t,e){g.typeOf.object("axis",i),g.typeOf.number("angle",t);const n=t/2,s=Math.sin(n);ko=O.normalize(i,ko);const o=ko.x*s,r=ko.y*s,a=ko.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 Tw=[1,2,0],Aw=new Array(3);H.fromRotationMatrix=function(i,t){g.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=Tw;let d=0;c>a&&(d=1),h>a&&h>c&&(d=2);const p=u[d],_=u[p];e=Math.sqrt(i[k.getElementIndex(d,d)]-i[k.getElementIndex(p,p)]-i[k.getElementIndex(_,_)]+1);const y=Aw;y[d]=.5*e,e=.5/e,r=(i[k.getElementIndex(_,p)]-i[k.getElementIndex(p,_)])*e,y[p]=(i[k.getElementIndex(p,d)]+i[k.getElementIndex(d,p)])*e,y[_]=(i[k.getElementIndex(_,d)]+i[k.getElementIndex(d,_)])*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 eg=new H;let ig=new H,Gh=new H,ng=new H;H.fromHeadingPitchRoll=function(i,t){return g.typeOf.object("headingPitchRoll",i),ng=H.fromAxisAngle(O.UNIT_X,i.roll,eg),Gh=H.fromAxisAngle(O.UNIT_Y,-i.pitch,t),t=H.multiply(Gh,ng,Gh),ig=H.fromAxisAngle(O.UNIT_Z,-i.heading,eg),H.multiply(ig,t,t)};const Ia=new O,Bh=new O,Ye=new H,sg=new H,Ta=new H;H.packedLength=4,H.pack=function(i,t,e){return g.typeOf.object("value",i),g.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 g.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,Ta),H.conjugate(Ta,Ta);for(let s=0,o=e-t+1;s<o;s++){const r=s*3;H.unpack(i,(t+s)*4,Ye),H.multiply(Ye,Ta,Ye),Ye.w<0&&H.negate(Ye,Ye),H.computeAxis(Ye,Ia);const a=H.computeAngle(Ye);C(n)||(n=[]),n[r]=Ia.x*a,n[r+1]=Ia.y*a,n[r+2]=Ia.z*a}},H.unpackInterpolationResult=function(i,t,e,n,s){C(s)||(s=new H),O.fromArray(i,0,Bh);const o=O.magnitude(Bh);return H.unpack(t,n*4,sg),o===0?H.clone(H.IDENTITY,Ye):H.fromAxisAngle(Bh,o,Ye),H.multiply(Ye,sg,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 g.typeOf.object("quaternion",i),g.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 g.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){g.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){g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("quaternion",i),g.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 g.typeOf.object("left",i),g.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){g.typeOf.object("left",i),g.typeOf.object("right",t),g.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,d=r*c-n*h+s*l+o*a,p=r*h+n*c-s*a+o*l,_=r*l-n*a-s*c-o*h;return e.x=u,e.y=d,e.z=p,e.w=_,e},H.multiplyByScalar=function(i,t,e){return g.typeOf.object("quaternion",i),g.typeOf.number("scalar",t),g.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 g.typeOf.object("quaternion",i),g.typeOf.number("scalar",t),g.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){g.typeOf.object("quaternion",i),g.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 g.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 g.typeOf.object("start",i),g.typeOf.object("end",t),g.typeOf.number("t",e),g.typeOf.object("result",n),Vh=H.multiplyByScalar(t,e,Vh),n=H.multiplyByScalar(i,1-e,n),H.add(Vh,n,n)};let og=new H,Yh=new H,Hh=new H;H.slerp=function(i,t,e,n){g.typeOf.object("start",i),g.typeOf.object("end",t),g.typeOf.number("t",e),g.typeOf.object("result",n);let s=H.dot(i,t),o=t;if(s<0&&(s=-s,o=og=H.negate(t,og)),1-s<T.EPSILON6)return H.lerp(i,o,e,n);const r=Math.acos(s);return Yh=H.multiplyByScalar(i,Math.sin((1-e)*r),Yh),Hh=H.multiplyByScalar(o,Math.sin(e*r),Hh),n=H.add(Yh,Hh,n),H.multiplyByScalar(n,1/Math.sin(r),n)},H.log=function(i,t){g.typeOf.object("quaternion",i),g.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){g.typeOf.object("cartesian",i),g.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 Mw=new O,Dw=new O,Wo=new H,Fs=new H;H.computeInnerQuadrangle=function(i,t,e,n){g.typeOf.object("q0",i),g.typeOf.object("q1",t),g.typeOf.object("q2",e),g.typeOf.object("result",n);const s=H.conjugate(t,Wo);H.multiply(s,e,Fs);const o=H.log(Fs,Mw);H.multiply(s,i,Fs);const r=H.log(Fs,Dw);return O.add(o,r,o),O.multiplyByScalar(o,.25,o),O.negate(o,o),H.exp(o,Wo),H.multiply(t,Wo,n)},H.squad=function(i,t,e,n,s,o){g.typeOf.object("q0",i),g.typeOf.object("q1",t),g.typeOf.object("s0",e),g.typeOf.object("s1",n),g.typeOf.number("t",s),g.typeOf.object("result",o);const r=H.slerp(i,t,s,Wo),a=H.slerp(e,n,s,Fs);return H.slerp(r,a,2*s*(1-s),o)};const Fw=new H,rg=1.9011074535173003,Aa=oe.supportsTypedArrays()?new Float32Array(8):[],Ma=oe.supportsTypedArrays()?new Float32Array(8):[],Pi=oe.supportsTypedArrays()?new Float32Array(8):[],Oi=oe.supportsTypedArrays()?new Float32Array(8):[];for(let i=0;i<7;++i){const t=i+1,e=2*t+1;Aa[i]=1/(t*e),Ma[i]=t/e}Aa[7]=rg/136,Ma[7]=rg*8/17,H.fastSlerp=function(i,t,e,n){g.typeOf.object("start",i),g.typeOf.object("end",t),g.typeOf.number("t",e),g.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 p=7;p>=0;--p)Pi[p]=(Aa[p]*c-Ma[p])*r,Oi[p]=(Aa[p]*h-Ma[p])*r;const l=o*e*(1+Pi[0]*(1+Pi[1]*(1+Pi[2]*(1+Pi[3]*(1+Pi[4]*(1+Pi[5]*(1+Pi[6]*(1+Pi[7])))))))),u=a*(1+Oi[0]*(1+Oi[1]*(1+Oi[2]*(1+Oi[3]*(1+Oi[4]*(1+Oi[5]*(1+Oi[6]*(1+Oi[7])))))))),d=H.multiplyByScalar(i,u,Fw);return H.multiplyByScalar(t,l,n),H.add(d,n,n)},H.fastSquad=function(i,t,e,n,s,o){g.typeOf.object("q0",i),g.typeOf.object("q1",t),g.typeOf.object("s0",e),g.typeOf.object("s1",n),g.typeOf.number("t",s),g.typeOf.object("result",o);const r=H.fastSlerp(i,t,s,Wo),a=H.fastSlerp(e,n,s,Fs);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={},Xh={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"}},Ls={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},$h={},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(!Xh.hasOwnProperty(i)||!Xh[i].hasOwnProperty(t))throw new j("firstAxis and secondAxis must be east, north, up, west, south or down.");const e=Xh[i][t];let n;const s=i+t;return C($h[s])?n=$h[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(Ls[i],0,dn),O.unpack(Ls[t],0,fn),O.unpack(Ls[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(Ls[i],0,dn),i!=="east"&&i!=="west"&&O.multiplyByScalar(dn,c,dn),O.unpack(Ls[t],0,fn),t!=="east"&&t!=="west"&&O.multiplyByScalar(fn,c,fn),O.unpack(Ls[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},$h[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 Lw=new H,zw=new O(1,1,1),Nw=new U;ut.headingPitchRollToFixedFrame=function(i,t,e,n,s){g.typeOf.object("HeadingPitchRoll",t),n=n??ut.eastNorthUpToFixedFrame;const o=H.fromHeadingPitchRoll(t,Lw),r=U.fromTranslationQuaternionRotationScale(O.ZERO,o,zw,Nw);return s=n(i,e,s),U.multiply(s,r,s)};const Uw=new U,jw=new k;ut.headingPitchRollQuaternion=function(i,t,e,n,s){g.typeOf.object("HeadingPitchRoll",t);const o=ut.headingPitchRollToFixedFrame(i,t,e,n,Uw),r=U.getMatrix3(o,jw);return H.fromRotationMatrix(r,s)};const kw=new O(1,1,1),Ww=new O,ag=new U,qw=new U,Gw=new k,Bw=new H;ut.fixedFrameToHeadingPitchRoll=function(i,t,e,n){g.defined("transform",i),t=t??ct.default,e=e??ut.eastNorthUpToFixedFrame,C(n)||(n=new Yt);const s=U.getTranslation(i,Ww);if(O.equals(s,O.ZERO))return n.heading=0,n.pitch=0,n.roll=0,n;let o=U.inverseTransformation(e(s,t,ag),ag),r=U.setScale(i,kw,qw);r=U.setTranslation(r,O.ZERO,r),o=U.multiply(o,r,o);let a=H.fromRotationMatrix(U.getMatrix3(o,Gw),Bw);return a=H.normalize(a,a),Yt.fromQuaternion(a,n)};const Vw=6*3600+41*60+50.54841,Yw=8640184812866e-6,Hw=.093104,Xw=-62e-7,$w=11772758384668e-32,Zw=72921158553e-15,Kw=T.TWO_PI/86400;let Da=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.");Da=$.addSeconds(i,-$.computeTaiMinusUtc(i),Da);const e=Da.dayNumber,n=Da.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=(Vw+s*(Yw+s*(Hw+s*Xw)))*Kw%T.TWO_PI,c=Zw+$w*(e-24515455e-1),h=(n+Dt.SECONDS_PER_DAY*.5)%Dt.SECONDS_PER_DAY,l=a+c*h,u=Math.cos(l),d=Math.sin(l);return C(t)?(t[0]=u,t[1]=-d,t[2]=0,t[3]=d,t[4]=u,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new k(u,d,0,-d,u,0,0,0,1)},ut.iau2006XysData=new kh,ut.earthOrientationParameters=Uo.NONE;const Zh=32.184,Qw=2451545;ut.preloadIcrfFixed=function(i){const t=i.start.dayNumber,e=i.start.secondsOfDay+Zh,n=i.stop.dayNumber,s=i.stop.secondsOfDay+Zh;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 Jw=32.184,t1=2451545,Fa=new Yt,e1=new k,i1=new $;ut.computeMoonFixedToIcrfMatrix=function(i,t){if(!C(i))throw new j("date is required.");const e=$.addSeconds(i,Jw,i1),n=$.totalDays(e)-t1,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 Fa.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),Fa.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),Fa.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(Fa,e1)},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 n1=new tg(0,0,0),s1=new Ah(0,0,0,0,0),Kh=new k,Qh=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,s1);if(!C(e))return;const n=i.dayNumber,s=i.secondsOfDay+Zh,o=ut.iau2006XysData.computeXysRadians(n,s,n1);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=Kh;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,Qh),u=k.multiply(h,l,Kh),d=i.dayNumber,p=i.secondsOfDay-$.computeTaiMinusUtc(i)+e.ut1MinusUtc,_=d-2451545,y=p/Dt.SECONDS_PER_DAY;let w=.779057273264+y+.00273781191135448*(_+y);w=w%1*T.TWO_PI;const E=k.fromRotationZ(w,Qh),b=k.multiply(u,E,Kh),P=Math.cos(e.xPoleWander),I=Math.cos(e.yPoleWander),M=Math.sin(e.xPoleWander),D=Math.sin(e.yPoleWander);let L=n-Qw+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=Qh;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 o1=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=o1;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 r1=new O,a1=new O,c1=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,r1);let o=O.cross(t,s,a1);O.equalsEpsilon(o,O.ZERO,T.EPSILON6)&&(o=O.clone(O.UNIT_X,o));const r=O.cross(o,t,c1);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 cg=new U(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1),hg=new lt,Jh=new O,h1=new O,l1=new k,tl=new U,lg=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,h1),s=i.ellipsoid;let o;if(O.equals(n,O.ZERO))o=O.clone(O.ZERO,Jh);else{const l=s.cartesianToCartographic(n,hg);o=i.project(l,Jh),O.fromElements(o.z,o.x,o.y,o)}const r=ut.eastNorthUpToFixedFrame(n,s,tl),a=U.inverseTransformation(r,lg),c=U.getMatrix3(t,l1),h=U.multiplyByMatrix3(a,c,e);return U.multiply(cg,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,tl),o=U.inverseTransformation(s,lg),r=n.cartesianToCartographic(t,hg),a=i.project(r,Jh);O.fromElements(a.z,a.x,a.y,a);const c=U.fromTranslation(a,tl);return U.multiply(cg,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 g.typeOf.object("value",i),g.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 g.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){g.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 g.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){g.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){g.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 d=u.longitude>=0?u.longitude:u.longitude+T.TWO_PI;o=Math.min(o,d),r=Math.max(r,d)}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 u1=new O,d1=new O,f1=new O,g1=new O,p1=new O,el=new Array(5);for(let i=0;i<el.length;++i)el[i]=new O;nt.fromBoundingSphere=function(i,t,e){g.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,u1),r=U.multiplyByPointAsVector(o,O.UNIT_X,d1);O.normalize(r,r);const a=U.multiplyByPointAsVector(o,O.UNIT_Y,f1);O.normalize(a,a),O.multiplyByScalar(a,s,a),O.multiplyByScalar(r,s,r);const c=O.negate(a,p1),h=O.negate(r,g1),l=el;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){g.typeOf.object("rectangle",i);const t=i.north;g.typeOf.number.greaterThanOrEquals("north",t,-T.PI_OVER_TWO),g.typeOf.number.lessThanOrEquals("north",t,T.PI_OVER_TWO);const e=i.south;g.typeOf.number.greaterThanOrEquals("south",e,-T.PI_OVER_TWO),g.typeOf.number.lessThanOrEquals("south",e,T.PI_OVER_TWO);const n=i.west;g.typeOf.number.greaterThanOrEquals("west",n,-Math.PI),g.typeOf.number.lessThanOrEquals("west",n,Math.PI);const s=i.east;g.typeOf.number.greaterThanOrEquals("east",s,-Math.PI),g.typeOf.number.lessThanOrEquals("east",s,Math.PI)},nt.southwest=function(i,t){return g.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 g.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 g.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 g.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){g.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){g.typeOf.object("rectangle",i),g.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){g.typeOf.object("rectangle",i),g.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){g.typeOf.object("rectangle",i),g.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 g.typeOf.object("rectangle",i),g.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){g.typeOf.object("rectangle",i),g.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 m1=new lt;nt.subsample=function(i,t,e,n){g.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=m1;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(g.typeOf.object("rectangle",i),g.typeOf.number.greaterThanOrEquals("westLerp",t,0),g.typeOf.number.lessThanOrEquals("westLerp",t,1),g.typeOf.number.greaterThanOrEquals("southLerp",e,0),g.typeOf.number.lessThanOrEquals("southLerp",e,1),g.typeOf.number.greaterThanOrEquals("eastLerp",n,0),g.typeOf.number.lessThanOrEquals("eastLerp",n,1),g.typeOf.number.greaterThanOrEquals("northLerp",s,0),g.typeOf.number.lessThanOrEquals("northLerp",s,1),g.typeOf.number.lessThanOrEquals("westLerp",t,n),g.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 Se(i,t){i=i??0,this._near=i,t=t??Number.MAX_VALUE,this._far=t}Object.defineProperties(Se.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}}}),Se.packedLength=2,Se.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},Se.unpack=function(i,t,e){if(!C(i))throw new j("array is required");return t=t??0,C(e)||(e=new Se),e.near=i[t++],e.far=i[t],e},Se.equals=function(i,t){return i===t||C(i)&&C(t)&&i.near===t.near&&i.far===t.far},Se.clone=function(i,t){if(C(i))return C(t)||(t=new Se),t.near=i.near,t.far=i.far,t},Se.prototype.clone=function(i){return Se.clone(this,i)},Se.prototype.equals=function(i){return Se.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 ug(i,t){return O.fromDegrees(...i,void 0,t)}const _1=new lt;function y1(i,t){const e=lt.fromCartesian(i,void 0,_1);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 dg(i,t){return t=t||new tt,t.x=i[0],t.y=i[1],t}function fg(i,t){return t=t||[0,0],t[0]=i.x,t[1]=i.y,t}function gg(i,t){return t=t||new O,t.x=i[0],t.y=i[1],t.z=i[2],t}function pg(i,t){return t=t||[0,0,0],t[0]=i.x,t[1]=i.y,t[2]=i.z,t}function mg(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 _g(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 yg(i,t){if(i.length===4)return mg(i,t);if(i.length===3)return gg(i,t);if(i.length===2)return dg(i,t);throw new Error("toCartesian error: should not be here!")}function w1(i,t){if(i instanceof tt)return fg(i,t);if(i instanceof O)return pg(i,t);if(i instanceof K)return _g(i,t);throw new Error("fromCartesian error: should not be here!")}function v1(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 E1(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 C1(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 b1(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 x1(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 R1(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 wg(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 S1(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 P1(i,t){return t=t||new Se,t.near=i[0],t.far=i[1],t}function O1(i,t){return t=t||[0,0],t[0]=i.near,t[1]=i.far,t}function I1(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 T1(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 A1=new Yt,M1=new O;function D1(i,t,e){const n=wg(t,A1),s=ug(i,M1);return ut.headingPitchRollQuaternion(s,n,void 0,void 0,e)}function F1(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 L1(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 z1=new O;function N1(i,t){return t=t||new ct,ct.fromCartesian3(O.fromArray(i,void 0,z1),t)}function U1(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 j1(i,t){return vg(i,O.UNIT_Y,O.UNIT_Z,O.UNIT_X,t)}function k1(i,t){return vg(i,O.UNIT_X,O.UNIT_Z,new O(0,-1,0),t)}function vg(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 Eg(i,t){t=t??new Array(16);for(let e=0;e<16;++e)t[e]=i[e];return t}function il(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"?j1(s,a):r==="XForwardZUp"&&k1(s,a);const c=k.fromQuaternion(a);U.multiply(e,U.fromRotationTranslation(c),e)}return o&&U.multiplyByScale(e,yg(o),e),Eg(e,t)}const W1=new U;function Cg(i,t){const e=U.fromArray(i,0,W1);return U.inverse(e,e),Eg(e,t)}const q1=new U,G1=new O;function bg(i,t,e){const[n,s,o]=t,r=O.fromDegrees(n,s,o,void 0,G1),a=U.fromArray(i,0,q1),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 B1=new U,V1=new O,Y1=new lt;function xg(i,t,e){const[n,s,o]=t,r=O.fromElements(n,s,o,V1),a=U.fromArray(i,0,B1),c=U.multiplyByPoint(a,r,r),h=lt.fromCartesian(c,void 0,Y1);return e=e||[0,0,0],e[0]=T.toDegrees(h.longitude),e[1]=T.toDegrees(h.latitude),e[2]=h.height,e}function zs(i,t){const{originPosition:e,originRotation:n,originScale:s,initialRotationMode:o}=i,r=il({position:e,rotation:n,scale:s,initialRotationMode:o}),a=Cg(r);return[t.map(h=>bg(a,h)),r,a]}function La(i,t){const{originPosition:e,originRotation:n,originScale:s,initialRotationMode:o}=i,r=il({position:e,rotation:n,scale:s,initialRotationMode:o});return[t.map(c=>xg(r,c)),r]}function nl(i,t){return[(i[0]+t[0])/2,(i[1]+t[1])/2,(i[2]+t[2])/2]}class Rg extends f.Destroyable{constructor(e,n,s,o){super();S(this,"_pixelsToMetersAt",(e,n,s,o)=>{const r=vt([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]=Zt(h);return Math.abs(f.geoRhumbDistance([n,s,0],[l,u,0]))});const r=e.viewer;if(!r){console.warn("OlCurrentScale: map is undefined");return}const[a,,c]=f.getReactFuncs(n),[,h]=f.getReactFuncs(s),l=()=>{const d=a();if(!d)return;const[p,_]=d,y=this._pixelsToMetersAt(r,p,_,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 H1(i,t){var e,n;if(i){try{const s=Ti(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 X1 extends f.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=Ti(a);c&&(c.destroy(),Wa(a,void 0)),H1(a,n)}};this.d(o);const r=this.dv(f.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=_t(l)/256,d=new Array(19),p=new Array(19);for(let E=0;E<19;++E)d[E]=u/Math.pow(2,E),p[E]=E.toString();const _=new S_({target:s,view:new ni({center:[0,0],zoom:0,enableRotation:!1}),interactions:jd({doubleClickZoom:!1}),controls:Dd({zoom:!1,rotate:!1,attribution:!1})});await a.promise(f.sleep(1e3)),_.updateSize(),_.renderSync();const y=new ResizeObserver(()=>{_.updateSize(),_.renderSync()});y.observe(s),this.d(()=>y.disconnect());const w=new jg(_,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 $1 extends f.Destroyable{constructor(t){super();const e=()=>{};this.dispose(t.viewDistanceChanged.disposableOn(e)),this.dispose(t.visibleAlphaChanged.disposableOn(e))}}class Z1 extends f.Destroyable{constructor(e){super();S(this,"_debugObjResetting");this._control=e,this._debugObjResetting=this.disposeVar(new f.ObjResettingWithEvent(this._control.debugChanged,()=>{if(this._control.debug)return new $1(this._control)}))}get debugObjResetting(){return this._debugObjResetting}}class Sg extends f.Destroyable{constructor(e,n,s,o){super();S(this,"_visibleAlpha",this.disposeVar(f.react(1)));S(this,"_viewDistance",this.disposeVar(f.react(0)));S(this,"_debug",this.disposeVar(f.react(!1)));S(this,"_viewDistanceDebug",this.disposeVar(new Z1(this)));this._olViewer=e,this._positionReact=s;const[r,,a]=f.getReactFuncs(n),[c,,h]=f.getReactFuncs(this._positionReact),[l,,u]=o?f.getReactFuncs(o):[void 0,void 0,void 0],d=()=>{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=uu({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=_},p=this.disposeVar(f.createNextAnimateFrameEvent(...[this._olViewer.cameraChanged,a,h,u].filter(Boolean)));this.dispose(p.disposableOn(d)),d()}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 Pg extends f.Destroyable{constructor(e,n){super();S(this,"_map");S(this,"_view");S(this,"_keys",[]);S(this,"_changed",new f.Event);S(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 sl(i,t){return i.left===t.left&&i.top===t.top&&i.right===t.right&&i.bottom===t.bottom&&i.depth===t.depth}class rl extends f.Destroyable{constructor(e,n=!0,s){super();S(this,"_coordinate");S(this,"_winPos",{left:NaN,top:NaN,right:NaN,bottom:NaN,depth:NaN});S(this,"_winPosValid",!1);S(this,"_changedEvent",new f.Event);S(this,"_enabled",!0);S(this,"tooltipElement");this.viewer=e,s=s||this.disposeVar(new Pg(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?ro(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};sl(this._winPos,r)||(this._winPos=r,o=!0)}else{const r={left:NaN,top:NaN,right:NaN,bottom:NaN,depth:NaN};sl(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};sl(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 K1 extends f.Destroyable{constructor(e,n){super();S(this,"_show",this.disposeVar(f.react(!0)));S(this,"_winPosFromCartesian");S(this,"_near",this.disposeVar(f.react(0)));S(this,"_far",this.disposeVar(f.react(Number.POSITIVE_INFINITY)));S(this,"_actualShow",this.disposeVar(f.react(!1)));this._olPoisContext=e;const{viewer:s,cameraChanged:o}=this._olPoisContext;this._winPosFromCartesian=n||this.disposeVar(new rl(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(f.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(),d=this._winPosFromCartesian.coordinate;if(!u||!d){this._actualShow.value=!1;return}const p=d[0]-u[0],_=d[1]-u[1],y=p*p+_*_,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 al extends K1{constructor(e,n,s){super(n,s);S(this,"_canvasPoi");S(this,"_zOrderChanged");S(this,"_zOrder");S(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 f.Event),this._zOrderChanged}}class Ii extends f.Destroyable{constructor(e,n){super();S(this,"_pickedEvent",this.disposeVar(new f.Event));S(this,"_flyToEvent",this.disposeVar(new f.Event));S(this,"_clickEvent",this.disposeVar(new f.Event));S(this,"_clickOutEvent",this.disposeVar(new f.Event));S(this,"_dblclickEvent",this.disposeVar(new f.Event));S(this,"_dblclickOutEvent",this.disposeVar(new f.Event));S(this,"_canvasPoiClassAndCreateFunc",f.react(void 0));S(this,"_olViewDistanceRangeControl");S(this,"_canvasObj");S(this,"_id",this.disposeVar(f.react(f.createGuid())));n&&(this.id=n),this._olViewDistanceRangeControl=this.disposeVar(new Sg(e,[this,"viewDistanceRange"],[this,"position"])),this.dispose(f.track([this._olViewDistanceRangeControl,"debug"],[this,"viewDistanceDebug"]));const s=e.viewer;if(!s)return;const o=Ti(s);if(!o)return;const{poiContext:r,labelManager:a}=o;a.add(this),this.d(()=>{a.delete(this)}),r&&(this._canvasObj=this.disposeVar(new f.ObjResettingWithEvent(this.canvasPoiClassAndCreateFuncChanged,()=>{if(!this.canvasPoiClassAndCreateFunc)return;const[c,h]=this.canvasPoiClassAndCreateFunc;return new Q1(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}}S(Ii,"defaults",{viewDistanceRange:[1e3,1e4,3e4,6e4]}),(i=>{i.createDefaultProps=()=>({show:!0,enabled:!0,position:f.reactArrayWithUndefined(void 0),positionEditing:!1,viewDistanceRange:f.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,zOrder:0})})(Ii||(Ii={})),f.extendClassProps(Ii.prototype,Ii.createDefaultProps);class Q1 extends f.Destroyable{constructor(e,n,s,o,r){super();S(this,"olCanvasPoi");const a=this.olCanvasPoi=this.disposeVar(new al(n,s));this.disposeVar(r(a.canvasPoi,e.visibleAlphaChanged));const c=()=>{if(e.position){const u=vt([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(f.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 J1 extends f.Destroyable{constructor(t,e){super();const n=this.disposeVar(f.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(f.ESSceneObject.context.createEnvStrReact([t,"imageUri"],"${earthsdk3-assets-script-dir}/assets/img/location.png")),r=this.disposeVar(f.createProcessingFromAsyncFunc(async(h,l)=>{const u=await h.promise(f.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 f.Event);this.dispose(e.clickEvent.disposableOn((h,l,u,d,p)=>{(t.enabled??!0)&&c.emit(p)})),this.dispose(c.don(h=>{t.clickEvent.emit(h)})),this.dispose(e.clickOutEvent.disposableOn((h,l,u,d,p)=>{(t.enabled??!0)&&t.clickOutEvent.emit(p)})),this.dispose(e.dbclickEvent.disposableOn((h,l,u,d,p)=>{(t.enabled??!0)&&t.dbclickEvent.emit(p)})),this.dispose(e.dbclickOutEvent.disposableOn((h,l,u,d,p)=>{(t.enabled??!0)&&t.dbclickOutEvent.emit(p)})),this.dispose(f.bind([t,"hovered"],[e,"hovered"])),this.ad(f.bind([e,"isHoverZoom"],[t,"isHoverZoom"]))}}function tv(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(", ")}) {
71
+ */var Wy=da.exports,Tf;function qy(){return Tf||(Tf=1,function(i){(function(t,e){i.exports?i.exports=e(zy(),Uy(),ky()):t.URI=e(t.punycode,t.IPv6,t.SecondLevelDomains,t)})(Wy,function(t,e,n,s){var o=s&&s.URI;function r(m,v){var R=arguments.length>=1,A=arguments.length>=2;if(!(this instanceof r))return R?A?new r(m,v):new r(m):new r;if(m===void 0){if(R)throw new TypeError("undefined is not a valid argument for URI");typeof location<"u"?m=location.href+"":m=""}if(m===null&&R)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 d(m){return u(m)==="Array"}function p(m,v){var R={},A,F;if(u(v)==="RegExp")R=null;else if(d(v))for(A=0,F=v.length;A<F;A++)R[v[A]]=!0;else R[v]=!0;for(A=0,F=m.length;A<F;A++){var N=R&&R[m[A]]!==void 0||!R&&v.test(m[A]);N&&(m.splice(A,1),F--,A--)}return m}function _(m,v){var R,A;if(d(v)){for(R=0,A=v.length;R<A;R++)if(!_(m,v[R]))return!1;return!0}var F=u(v);for(R=0,A=m.length;R<A;R++)if(F==="RegExp"){if(typeof m[R]=="string"&&m[R].match(v))return!0}else if(m[R]===v)return!0;return!1}function y(m,v){if(!d(m)||!d(v)||m.length!==v.length)return!1;m.sort(),v.sort();for(var R=0,A=m.length;R<A;R++)if(m[R]!==v[R])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 R=r.encode(m+"");return v===void 0&&(v=r.escapeQuerySpace),v?R.replace(/%20/g,"+"):R},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(R){try{return r[v](R+"").replace(r.characters[m][v].expression,function(A){return r.characters[m][v].map[A]})}catch{return R}}};for(I in P)r[I+"PathSegment"]=M("pathname",P[I]),r[I+"UrnPathSegment"]=M("urnpath",P[I]);var D=function(m,v,R){return function(A){var F;R?F=function(Z){return r[v](r[R](Z))}:F=r[v];for(var N=(A+"").split(m),G=0,B=N.length;G<B;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 R;return v||(v={preventInvalidHostname:r.preventInvalidHostname}),m=m.replace(r.leading_whitespace_expression,""),m=m.replace(r.ascii_tab_whitespace,""),R=m.indexOf("#"),R>-1&&(v.fragment=m.substring(R+1)||null,m=m.substring(0,R)),R=m.indexOf("?"),R>-1&&(v.query=m.substring(R+1)||null,m=m.substring(0,R)),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)):(R=m.indexOf(":"),R>-1&&(v.protocol=m.substring(0,R)||null,v.protocol&&!v.protocol.match(r.protocol_expression)?v.protocol=void 0:m.substring(R+1,R+3).replace(/\\/g,"/")==="//"?(m=m.substring(R+3),m=r.parseAuthority(m,v)):(m=m.substring(R+1),v.urn=!0))),v.path=m,v},r.parseHost=function(m,v){m||(m=""),m=m.replace(/\\/g,"/");var R=m.indexOf("/"),A,F;if(R===-1&&(R=m.length),m.charAt(0)==="[")A=m.indexOf("]"),v.hostname=m.substring(1,A)||null,v.port=m.substring(A+2,R)||null,v.port==="/"&&(v.port=null);else{var N=m.indexOf(":"),G=m.indexOf("/"),B=m.indexOf(":",N+1);B!==-1&&(G===-1||B<G)?(v.hostname=m.substring(0,R)||null,v.port=null):(F=m.substring(0,R).split(":"),v.hostname=F[0]||null,v.port=F[1]||null)}return v.hostname&&m.substring(R).charAt(0)!=="/"&&(R++,m="/"+m),v.preventInvalidHostname&&r.ensureValidHostname(v.hostname,v.protocol),v.port&&r.ensureValidPort(v.port),m.substring(R)||"/"},r.parseAuthority=function(m,v){return m=r.parseUserinfo(m,v),r.parseHost(m,v)},r.parseUserinfo=function(m,v){var R=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=R.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 R={},A=m.split("&"),F=A.length,N,G,B,Z=0;Z<F;Z++)N=A[Z].split("="),G=r.decodeQuery(N.shift(),v),B=N.length?r.decodeQuery(N.join("="),v):null,G!=="__proto__"&&(h.call(R,G)?((typeof R[G]=="string"||R[G]===null)&&(R[G]=[R[G]]),R[G].push(B)):R[G]=B);return R},r.build=function(m){var v="",R=!1;return m.protocol&&(v+=m.protocol+":"),!m.urn&&(v||m.hostname)&&(v+="//",R=!0),v+=r.buildAuthority(m)||"",typeof m.path=="string"&&(m.path.charAt(0)!=="/"&&R&&(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,R){var A="",F,N,G,B;for(N in m)if(N!=="__proto__"&&h.call(m,N))if(d(m[N]))for(F={},G=0,B=m[N].length;G<B;G++)m[N][G]!==void 0&&F[m[N][G]+""]===void 0&&(A+="&"+r.buildQueryParameter(N,m[N][G],R),v!==!0&&(F[m[N][G]+""]=!0));else m[N]!==void 0&&(A+="&"+r.buildQueryParameter(N,m[N],R));return A.substring(1)},r.buildQueryParameter=function(m,v,R){return r.encodeQuery(m,R)+(v!==null?"="+r.encodeQuery(v,R):"")},r.addQuery=function(m,v,R){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]=R;return}else typeof m[v]=="string"&&(m[v]=[m[v]]);d(R)||(R=[R]),m[v]=(m[v]||[]).concat(R)}else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter")},r.setQuery=function(m,v,R){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]=R===void 0?null:R;else throw new TypeError("URI.setQuery() accepts an object, string as the name parameter")},r.removeQuery=function(m,v,R){var A,F,N;if(d(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")R!==void 0?u(R)==="RegExp"?!d(m[v])&&R.test(m[v])?m[v]=void 0:m[v]=p(m[v],R):m[v]===String(R)&&(!d(R)||R.length===1)?m[v]=void 0:d(m[v])&&(m[v]=p(m[v],R)):m[v]=void 0;else throw new TypeError("URI.removeQuery() accepts an object, string, RegExp as the first parameter")},r.hasQuery=function(m,v,R,A){switch(u(v)){case"String":break;case"RegExp":for(var F in m)if(h.call(m,F)&&v.test(F)&&(R===void 0||r.hasQuery(m,F,R)))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(R)){case"Undefined":return v in m;case"Boolean":var G=!!(d(m[v])?m[v].length:m[v]);return R===G;case"Function":return!!R(m[v],v,m);case"Array":if(!d(m[v]))return!1;var B=A?_:y;return B(m[v],R);case"RegExp":return d(m[v])?A?_(m[v],R):!1:!!(m[v]&&m[v].match(R));case"Number":R=String(R);case"String":return d(m[v])?A?_(m[v],R):!1:m[v]===R;default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter")}},r.joinPaths=function(){for(var m=[],v=[],R=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]&&R++}if(!v.length||!R)return new r("");var B=new r("").segment(v);return(m[0].path()===""||m[0].path().slice(0,1)==="/")&&B.path("/"+B.path()),B.normalize()},r.commonPath=function(m,v){var R=Math.min(m.length,v.length),A;for(A=0;A<R;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,R){R||(R={});var A=R.start||r.findUri.start,F=R.end||r.findUri.end,N=R.trim||r.findUri.trim,G=R.parens||r.findUri.parens,B=/[a-z0-9-]=["']?$/i;for(A.lastIndex=0;;){var Z=A.exec(m);if(!Z)break;var V=Z.index;if(R.ignoreHtml){var at=m.slice(Math.max(V-3,0),V);if(at&&B.test(at))continue}for(var et=V+m.slice(V).search(F),it=m.slice(V,et),gt=-1;;){var yt=G.exec(it);if(!yt)break;var dt=yt.index+yt[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)&&!(R.ignore&&R.ignore.test(it))){et=V+it.length;var Et=v(it,V,et,m);if(Et===void 0){A.lastIndex=et;continue}Et=String(Et),m=m.slice(0,V)+Et+m.slice(et),A.lastIndex=V+Et.length}}return A.lastIndex=0,m},r.ensureValidHostname=function(m,v){var R=!!m,A=!!v,F=!1;if(A&&(F=_(r.hostProtocols,v)),F&&!R)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,R){return v===void 0?this._parts[m]||"":(this._parts[m]=v||null,this.build(!R),this)}}function z(m,v){return function(R,A){return R===void 0?this._parts[m]||"":(R!==null&&(R=R+"",R.charAt(0)===v&&(R=R.substring(1))),this._parts[m]=R,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 R=this.query(m,v);return typeof R=="string"&&R.length?"?"+R:R},c.hash=function(m,v){var R=this.fragment(m,v);return typeof R=="string"&&R.length?"#"+R:R},c.pathname=function(m,v){if(m===void 0||m===!0){var R=this._parts.path||(this._parts.hostname?"/":"");return m?(this._parts.urn?r.decodeUrnPath:r.decodePath)(R):R}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 R;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(R in G)R!=="query"&&h.call(this._parts,R)&&(this._parts[R]=G[R]);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,R=!1,A=!1,F=!1,N=!1,G=!1,B=!1,Z=!this._parts.urn;switch(this._parts.hostname&&(Z=!1,R=r.ip4_expression.test(this._parts.hostname),A=r.ip6_expression.test(this._parts.hostname),v=R||A,F=!v,N=F&&n&&n.has(this._parts.hostname),G=F&&r.idn_expression.test(this._parts.hostname),B=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 R;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 B}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 R={preventInvalidHostname:this._parts.preventInvalidHostname},A=r.parseHost(m,R);if(A!=="/")throw new TypeError('Hostname "'+m+'" contains characters other than [A-Z0-9.-]');m=R.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 R=this.protocol(),A=this.authority();return A?(R?R+"://":"")+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 R=r.parseHost(m,this._parts);if(R!=="/")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 R=r.parseAuthority(m,this._parts);if(R!=="/")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 R=r.buildUserinfo(this._parts);return R&&R.substring(0,R.length-1)}else return m[m.length-1]!=="@"&&(m+="@"),r.parseUserinfo(m,this._parts),this.build(!v),this},c.resource=function(m,v){var R;return m===void 0?this.path()+this.search()+this.hash():(R=r.parse(m),this._parts.path=R.path,this._parts.query=R.query,this._parts.fragment=R.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 R=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,R)||""}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 R=this._parts.hostname.match(/\./g);if(R&&R.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 R=this._parts.hostname.lastIndexOf("."),A=this._parts.hostname.substring(R+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 R=this._parts.path.length-this.filename().length-1,A=this._parts.path.substring(0,R)||(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 R=this._parts.path.lastIndexOf("/"),A=this._parts.path.substring(R+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 R=this.filename(),A=R.lastIndexOf("."),F,N;return A===-1?"":(F=R.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(),B;if(G)m?B=new RegExp(l(G)+"$"):B=new RegExp(l("."+G)+"$");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(!v),this}},c.segment=function(m,v,R){var A=this._parts.urn?":":"/",F=this.path(),N=F.substring(0,1)==="/",G=F.split(A);if(m!==void 0&&typeof m!="number"&&(R=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(d(v)){G=[];for(var B=0,Z=v.length;B<Z;B++)!v[B].length&&(!G.length||!G[G.length-1].length)||(G.length&&!G[G.length-1].length&&G.pop(),G.push(w(v[B])))}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),R)},c.segmentCoded=function(m,v,R){var A,F,N;if(typeof m!="number"&&(R=v,v=m,m=void 0),v===void 0){if(A=this.segment(m,v,R),!d(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(!d(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,R)};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 R=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace),A=m.call(this,R);return this._parts.query=r.buildQuery(A||R,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,R){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"&&(R=v),this.build(!R),this},c.addQuery=function(m,v,R){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"&&(R=v),this.build(!R),this},c.removeQuery=function(m,v,R){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"&&(R=v),this.build(!R),this},c.hasQuery=function(m,v,R){var A=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return r.hasQuery(A,m,v,R)},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 R,A="",F,N;for(v.charAt(0)!=="/"&&(R=!0,v="/"+v),(v.slice(-3)==="/.."||v.slice(-2)==="/.")&&(v+="/"),v=v.replace(/(\/(\.\/)+)|(\/\.$)/g,"/").replace(/\/{2,}/g,"/"),R&&(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 R&&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 R="",A=0,F=m._parts.query.split("&"),N=F.length;A<N;A++){var G=(F[A]||"").split("=");R+="&"+r.decodeQuery(G[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"),G[1]!==void 0&&(R+="="+r.decodeQuery(G[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}v+="?"+R.substring(1)}return v+=r.decodeQuery(m.hash(),!0),v},c.absoluteTo=function(m){var v=this.clone(),R=["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=R[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(),R,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(),R=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(R.protocol===A.protocol&&(R.protocol=null),R.username!==A.username||R.password!==A.password||R.protocol!==null||R.username!==null||R.password!==null)return v.build();if(R.hostname===A.hostname&&R.port===A.port)R.hostname=null,R.port=null;else return v.build();if(N===G)return R.path="",v.build();if(F=r.commonPath(N,G),!F)return v.build();var B=A.path.substring(F.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../");return R.path=B+R.path.substring(F.length)||"./",v.build()},c.equals=function(m){var v=this.clone(),R=new r(m),A={},F={},N={},G,B,Z;if(v.normalize(),R.normalize(),v.toString()===R.toString())return!0;if(G=v.query(),B=R.query(),v.query(""),R.query(""),v.toString()!==R.toString()||G.length!==B.length)return!1;A=r.parseQuery(G,this._parts.escapeQuerySpace),F=r.parseQuery(B,this._parts.escapeQuerySpace);for(Z in A)if(h.call(A,Z)){if(d(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})}(da)),da.exports}var Gy=qy();const hn=cf(Gy);function By(i){return(i.length===0||i[i.length-1]!=="/")&&(i=`${i}/`),i}function Os(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=Os(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 Do(){let i,t;const e=new Promise(function(n,s){i=n,t=s});return{resolve:i,reject:t,promise:e}}function Fo(i,t){let e;return typeof document<"u"&&(e=document),Fo._implementation(i,t,e)}Fo._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 Vy(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 Yy(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 Af={};function Mf(i,t,e){C(t)||(t=i.width),C(e)||(e=i.height);let n=Af[t];C(n)||(n={},Af[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 Hy=/^blob:/i;function Df(i){return g.typeOf.string("uri",i),Hy.test(i)}let ri;function Xy(i){C(ri)||(ri=document.createElement("a")),ri.href=window.location.href;const t=ri.host,e=ri.protocol;return ri.href=i,ri.href=ri.href,e!==ri.protocol||t!==ri.host}const $y=/^data:/i;function Ff(i){return g.typeOf.string("uri",i),$y.test(i)}function Zy(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 Ky(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 Qy(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}),Jy=Object.freeze({TERRAIN:0,IMAGERY:1,TILES3D:2,OTHER:3});function pa(i){i=i??oi.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??Jy.OTHER,this.serverKey=i.serverKey,this.state=Nt.UNISSUED,this.deferred=void 0,this.cancelled=!1}pa.prototype.cancel=function(){this.cancelled=!0},pa.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 pa(this)};function tw(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 Lo(i,t,e){this.statusCode=i,this.response=t,this.responseHeaders=e,typeof this.responseHeaders=="string"&&(this.responseHeaders=tw(this.responseHeaders))}Lo.prototype.toString=function(){let i="Request has failed.";return C(this.statusCode)&&(i+=` Status Code: ${this.statusCode}`),i};function zo(){this._listeners=new Map,this._toRemove=new Map,this._toAdd=new Map,this._invokingListeners=!1,this._listenerCount=0}Object.defineProperties(zo.prototype,{numberOfListeners:{get:function(){return this._listenerCount}}}),zo.prototype.addEventListener=function(i,t){g.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)}zo.prototype.removeEventListener=function(i,t){g.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}zo.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 kn(i){g.typeOf.object("options",i),g.defined("options.comparator",i.comparator),this._comparator=i.comparator,this._array=[],this._length=0,this._maximumLength=void 0}Object.defineProperties(kn.prototype,{length:{get:function(){return this._length}},internalArray:{get:function(){return this._array}},maximumLength:{get:function(){return this._maximumLength},set:function(i){g.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}kn.prototype.reserve=function(i){i=i??this._length,this._array.length=i},kn.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}},kn.prototype.resort=function(){const i=this._length;for(let t=Math.ceil(i/2);t>=0;--t)this.heapify(t)},kn.prototype.insert=function(i){g.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},kn.prototype.pop=function(i){if(i=i??0,this._length===0)return;g.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 ew(i,t){return i.priority-t.priority}const bt={numberOfAttemptedRequests:0,numberOfActiveRequests:0,numberOfCancelledRequests:0,numberOfCancelledActiveRequests:0,numberOfFailedRequests:0,numberOfActiveRequestsEver:0,lastNumberOfActiveRequests:0};let Is=20;const ne=new kn({comparator:ew});ne.maximumLength=Is,ne.reserve(Is);const ai=[];let Ri={};const iw=typeof document<"u"?new hn(document.location.href):new hn,ma=new zo;function Tt(){}Tt.maximumRequests=50,Tt.maximumRequestsPerServer=18,Tt.requestsByServer={},Tt.throttleRequests=!0,Tt.debugShowStatistics=!1,Tt.requestCompletedEvent=ma,Object.defineProperties(Tt,{statistics:{get:function(){return bt}},priorityHeapLength:{get:function(){return Is},set:function(i){if(i<Is)for(;ne.length>i;){const t=ne.pop();Wn(t)}Is=i,ne.maximumLength=i,ne.reserve(i)}}});function Lf(i){C(i.priorityFunction)&&(i.priority=i.priorityFunction())}Tt.serverHasOpenSlots=function(i,t){t=t??1;const e=Tt.requestsByServer[i]??Tt.maximumRequestsPerServer;return Ri[i]+t<=e},Tt.heapHasOpenSlots=function(i){return ne.length+i<=Is};function zf(i){return i.state===Nt.UNISSUED&&(i.state=Nt.ISSUED,i.deferred=Do()),i.deferred.promise}function nw(i){return function(t){if(i.state===Nt.CANCELLED)return;const e=i.deferred;--bt.numberOfActiveRequests,--Ri[i.serverKey],ma.raiseEvent(),i.state=Nt.RECEIVED,i.deferred=void 0,e.resolve(t)}}function sw(i){return function(t){i.state!==Nt.CANCELLED&&(++bt.numberOfFailedRequests,--bt.numberOfActiveRequests,--Ri[i.serverKey],ma.raiseEvent(t),i.state=Nt.FAILED,i.deferred.reject(t))}}function Nf(i){const t=zf(i);return i.state=Nt.ACTIVE,ai.push(i),++bt.numberOfActiveRequests,++bt.numberOfActiveRequestsEver,++Ri[i.serverKey],i.requestFunction().then(nw(i)).catch(sw(i)),t}function Wn(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,--Ri[i.serverKey],++bt.numberOfCancelledActiveRequests),C(i.cancelFunction)&&i.cancelFunction()}Tt.update=function(){let i,t,e=0;const n=ai.length;for(i=0;i<n;++i){if(t=ai[i],t.cancelled&&Wn(t),t.state!==Nt.ACTIVE){++e;continue}e>0&&(ai[i-e]=t)}ai.length-=e;const s=ne.internalArray,o=ne.length;for(i=0;i<o;++i)Lf(s[i]);ne.resort();const r=Math.max(Tt.maximumRequests-ai.length,0);let a=0;for(;a<r&&ne.length>0;){if(t=ne.pop(),t.cancelled){Wn(t);continue}if(t.throttleByServer&&!Tt.serverHasOpenSlots(t.serverKey)){Wn(t);continue}Nf(t),++a}ow()},Tt.getServerKey=function(i){g.typeOf.string("url",i);let t=new hn(i);t.scheme()===""&&(t=t.absoluteTo(iw),t.normalize());let e=t.authority();/:/.test(e)||(e=`${e}:${t.scheme()==="https"?"443":"80"}`);const n=Ri[e];return C(n)||(Ri[e]=0),e},Tt.request=function(i){if(g.typeOf.object("request",i),g.typeOf.string("request.url",i.url),g.typeOf.func("request.requestFunction",i.requestFunction),Ff(i.url)||Df(i.url))return ma.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 Nf(i);if(ai.length>=Tt.maximumRequests)return;Lf(i);const t=ne.insert(i);if(C(t)){if(t===i)return;Wn(t)}return zf(i)};function ow(){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();Wn(t)}const i=ai.length;for(let t=0;t<i;++t)Wn(ai[t]);ai.length=0,Ri={},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 Ri[i]},Tt.requestHeap=ne;const Ts={};let As={};Ts.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(As[e])||(As[e]=!0)},Ts.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(As[e])&&delete As[e]};function rw(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}}Ts.contains=function(i){if(!C(i))throw new j("url is required.");const t=rw(i);return!!(C(t)&&C(As[t]))},Ts.clear=function(){As={}};const Uf=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??oi.EMPTY_OBJECT,typeof i=="string"&&(i={url:i}),g.typeOf.string("options.url",i.url),this._url=void 0,this._templateValues=ci(i.templateValues,{}),this._queryParameters=ci(i.queryParameters,{}),this.headers=ci(i.headers,{}),this.request=i.request??new pa,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 ci(i,t){return C(i)?Os(i):t}J.createIfNeeded=function(i){return i instanceof J?i.getDerivedResource({request:i.request}):typeof i!="string"?i:new J({url:i})};let Ms;J.supportsImageBitmapOptions=function(){return C(Ms)?Ms:typeof createImageBitmap!="function"?(Ms=Promise.resolve(!1),Ms):(Ms=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=Mf(t[0]),n=Mf(t[1]);return e[1]!==n[1]}).catch(function(){return!1}),Ms)},Object.defineProperties(J,{isBlobSupported:{get:function(){return Uf}}}),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 Yy(this._url)}},isDataUri:{get:function(){return Ff(this._url)}},isBlobUri:{get:function(){return Df(this._url)}},isCrossOriginUrl:{get:function(){return Xy(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=aw(s.query());this._queryParameters=t?_a(o,this.queryParameters,e):o,s.search(""),s.fragment(""),C(n)&&s.scheme()===""&&(s=s.absoluteTo(Fo(n))),this._url=s.toString()};function aw(i){return i.length===0?{}:i.indexOf("=")===-1?{[i]:void 0}:Qy(i)}function _a(i,t,e){if(!e)return ln(i,t);const n=Os(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}${cw(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 cw(i){const t=Object.keys(i);return t.length===0?"":t.length===1&&!C(i[t[0]])?`?${t[0]}`:`?${Ky(i)}`}J.prototype.setQueryParameters=function(i,t){t?this._queryParameters=_a(this._queryParameters,i,!1):this._queryParameters=_a(i,this._queryParameters,!1)},J.prototype.appendQueryParameters=function(i){this._queryParameters=_a(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=Os(this._queryParameters),i._templateValues=Os(this._templateValues),i.headers=Os(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 Vy(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??oi.EMPTY_OBJECT;const t=i.preferImageBitmap??!1,e=i.preferBlob??!1,n=i.flipY??!1,s=i.skipColorSpaceConversion??!1;if(Ah(this.request),!Uf||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=Do();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 jf(this,i,t)};function jf(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=Do();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,jf(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=Do(),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 hw=/^data:(.*?)(;base64)?,(.*)$/;function ya(i,t){const e=decodeURIComponent(t);return i?atob(e):e}function kf(i,t){const e=ya(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 lw(i,t){t=t??"";const e=i[1],n=!!i[2],s=i[3];let o,r;switch(t){case"":case"text":return ya(n,s);case"arraybuffer":return kf(n,s);case"blob":return o=kf(n,s),new Blob([o],{type:e});case"document":return r=new DOMParser,r.parseFromString(ya(n,s),e);case"json":return JSON.parse(ya(n,s));default:throw new j(`Unhandled responseType: ${t}`)}}J.prototype.fetch=function(i){return i=ci(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=ci(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=ci(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=ci(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 g.defined("data",i),t=ci(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 g.defined("data",i),t=ci(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 g.defined("data",i),t=ci(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&&(Ts.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=Do(),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(d){if(!C(d)){e.reject(new De(`Successfully retrieved ${r} but it contained no content.`));return}return J.createImageBitmapFromBlob(d,{flipY:n,premultiplyAlpha:!1,skipColorSpaceConversion:s})}).then(function(d){e.resolve(d)})}).catch(function(a){e.reject(a)})},J.createImageBitmapFromBlob=function(i,t){return g.defined("options",t),g.typeOf.bool("options.flipY",t.flipY),g.typeOf.bool("options.premultiplyAlpha",t.premultiplyAlpha),g.typeOf.bool("options.skipColorSpaceConversion",t.skipColorSpaceConversion),createImageBitmap(i,{imageOrientation:t.flipY?"flipY":"none",premultiplyAlpha:t.premultiplyAlpha?"premultiply":"none",colorSpaceConversion:t.skipColorSpaceConversion?"none":"default"})};function uw(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 Lo(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 Lo)})}const dw=typeof XMLHttpRequest>"u";J._Implementations.loadWithXhr=function(i,t,e,n,s,o,r){const a=hw.exec(i);if(a!==null){o.resolve(lw(a,t));return}if(dw){uw(i,t,e,n,s,o);return}const c=new XMLHttpRequest;if(Ts.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 Lo(c.status,c.response,c.getAllResponseHeaders()));return}const l=c.response,u=c.responseType;if(e==="HEAD"||e==="OPTIONS"){const p=c.getAllResponseHeaders().trim().split(/[\r\n]+/),_={};p.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(d){o.reject(d)}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 Lo)},c.send(n),c},J._Implementations.loadAndExecuteScript=function(i,t,e){return Zy(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 No(i){i=i??oi.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)?Wf(this,i.data):Wf(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})}No.fromUrl=async function(i,t){g.defined("url",i),t=t??oi.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 No({addNewLeapSeconds:t.addNewLeapSeconds,data:n})},No.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}}),No.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,Gf(this,e,this._samples,i,s,o,t),t}let r=Ao(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,Gf(this,e,this._samples,i,s,o,t),t};function fw(i,t){return $.compare(i.julianDate,t)}function Wf(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 d=i._addNewLeapSeconds;for(let p=0,_=h.length;p<_;p+=i._columnCount){const y=h[p+e],w=h[p+c],E=y+Dt.MODIFIED_JULIAN_DATE_DIFFERENCE,b=new $(E,w,mt.TAI);if(l.push(b),d){if(w!==u&&C(u)){const P=$.leapSeconds,I=Ao(P,b,fw);if(I<0){const M=new Pt(b,w);P.splice(~I,0,M)}}u=w}}}function qf(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 Uo(i,t,e){return t+i*(e-t)}function Gf(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 qf(i,e,s,a,r),r;if(n.equals(h))return qf(i,e,o,a,r),r;const l=$.secondsDifference(n,c)/$.secondsDifference(h,c),u=s*a,d=o*a;let p=e[u+i._ut1MinusUtcSecondsColumn],_=e[d+i._ut1MinusUtcSecondsColumn];const y=_-p;if(y>.5||y<-.5){const w=e[u+i._taiMinusUtcSecondsColumn],E=e[d+i._taiMinusUtcSecondsColumn];w!==E&&(h.equals(n)?p=_:_-=E-w)}return r.xPoleWander=Uo(l,e[u+i._xPoleWanderRadiansColumn],e[d+i._xPoleWanderRadiansColumn]),r.yPoleWander=Uo(l,e[u+i._yPoleWanderRadiansColumn],e[d+i._yPoleWanderRadiansColumn]),r.xPoleOffset=Uo(l,e[u+i._xCelestialPoleOffsetRadiansColumn],e[d+i._xCelestialPoleOffsetRadiansColumn]),r.yPoleOffset=Uo(l,e[u+i._yCelestialPoleOffsetRadiansColumn],e[d+i._yCelestialPoleOffsetRadiansColumn]),r.ut1MinusUtc=Uo(l,p,_),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 gw(){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 wa;function Vf(i){return typeof document>"u"?i:(C(wa)||(wa=document.createElement("a")),wa.href=i,wa.href)}let qn;function Yf(){if(C(qn))return qn;let i;if(typeof CESIUM_BASE_URL<"u"?i=CESIUM_BASE_URL:C(rs&&rs.tagName.toUpperCase()==="SCRIPT"&&rs.src||new URL("earthsdk3-ol.iife.js",document.baseURI).href)?i=Fo(".",rs&&rs.tagName.toUpperCase()==="SCRIPT"&&rs.src||new URL("earthsdk3-ol.iife.js",document.baseURI).href):typeof define=="object"&&C(define.amd)&&!define.amd.toUrlUndefined&&C(require.toUrl)?i=Fo("..",Gn("Core/buildModuleUrl.js")):i=gw(),!C(i))throw new j("Unable to determine Cesium base URL automatically, try defining a global variable called CESIUM_BASE_URL.");return qn=new J({url:Vf(i)}),qn.appendForwardSlash(),qn}function pw(i){return Vf(require.toUrl(`../${i}`))}function Hf(i){return Yf().getDerivedResource({url:i}).url}let va;function Gn(i){return C(va)||(typeof define=="object"&&C(define.amd)&&!define.amd.toUrlUndefined&&C(require.toUrl)?va=pw:va=Hf),va(i)}Gn._cesiumScriptRegex=Bf,Gn._buildModuleUrlFromBaseUrl=Hf,Gn._clearBaseResource=function(){qn=void 0},Gn.setBaseUrl=function(i){qn=J.DEFAULT.getDerivedResource({url:i})},Gn.getCesiumBaseUrl=Yf;function Xf(i,t,e){this.x=i,this.y=t,this.s=e}function Mh(i){i=i??oi.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 mw=new $(0,0,mt.TAI);function Dh(i,t,e){const n=mw;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 Xf(0,0,0);const l=n-r*this._stepSizeDays,u=this._work,d=this._denominators,p=this._coef,_=this._xTable;let y,w;for(y=0;y<=o;++y)u[y]=l-_[y];for(y=0;y<=o;++y){for(p[y]=1,w=0;w<=o;++w)w!==y&&(p[y]*=u[w]);p[y]*=d[y];let E=(r+y)*3;e.x+=p[y]*h[E++],e.y+=p[y]*h[E++],e.s+=p[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:Gn(`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 Ea,$f;function Lh(){if(!C(Ea)&&(Ea=!1,!Ra())){const i=/ Chrome\/([\.0-9]+)/.exec(se.userAgent);i!==null&&(Ea=!0,$f=Bn(i[1]))}return Ea}function _w(){return Lh()&&$f}let Ca,Zf;function Kf(){if(!C(Ca)&&(Ca=!1,!Lh()&&!Ra()&&/ Safari\/[\.0-9]+/.test(se.userAgent))){const i=/ Version\/([\.0-9]+)/.exec(se.userAgent);i!==null&&(Ca=!0,Zf=Bn(i[1]))}return Ca}function yw(){return Kf()&&Zf}let ba,zh;function Qf(){if(!C(ba)){ba=!1;const i=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(se.userAgent);i!==null&&(ba=!0,zh=Bn(i[1]),zh.isNightly=!!i[2])}return ba}function ww(){return Qf()&&zh}let jo,Nh;function Jf(){if(!C(jo)){jo=!1;let i;se.appName==="Microsoft Internet Explorer"?(i=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(se.userAgent),i!==null&&(jo=!0,Nh=Bn(i[1]))):se.appName==="Netscape"&&(i=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(se.userAgent),i!==null&&(jo=!0,Nh=Bn(i[1])))}return jo}function vw(){return Jf()&&Nh}let xa,tg;function Ra(){if(!C(xa)){xa=!1;const i=/ Edg\/([\.0-9]+)/.exec(se.userAgent);i!==null&&(xa=!0,tg=Bn(i[1]))}return xa}function Ew(){return Ra()&&tg}let Sa,Uh;function Pa(){if(!C(Sa)){Sa=!1;const i=/Firefox\/([\.0-9]+)/.exec(se.userAgent);i!==null&&(Sa=!0,Uh=Bn(i[1]))}return Sa}let jh;function Cw(){return C(jh)||(jh=/Windows/i.test(se.appVersion)),jh}let kh;function bw(){return C(kh)||(kh=navigator.platform==="iPhone"||navigator.platform==="iPod"||navigator.platform==="iPad"),kh}function xw(){return Pa()&&Uh}let Wh;function Rw(){return C(Wh)||(Wh=!Pa()&&typeof PointerEvent<"u"&&(!C(se.pointerEnabled)||se.pointerEnabled)),Wh}let eg,Oa;function ig(){if(!C(Oa)){const i=document.createElement("canvas");i.setAttribute("style","image-rendering: -moz-crisp-edges;image-rendering: pixelated;");const t=i.style.imageRendering;Oa=C(t)&&t!=="",Oa&&(eg=t)}return Oa}function Sw(){return ig()?eg: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 Ds=[];typeof ArrayBuffer<"u"&&(Ds.push(Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array),typeof Uint8ClampedArray<"u"&&Ds.push(Uint8ClampedArray),typeof Uint8ClampedArray<"u"&&Ds.push(Uint8ClampedArray),typeof BigInt64Array<"u"&&Ds.push(BigInt64Array),typeof BigUint64Array<"u"&&Ds.push(BigUint64Array));const re={isChrome:Lh,chromeVersion:_w,isSafari:Kf,safariVersion:yw,isWebkit:Qf,webkitVersion:ww,isInternetExplorer:Jf,internetExplorerVersion:vw,isEdge:Ra,edgeVersion:Ew,isFirefox:Pa,firefoxVersion:xw,isWindows:Cw,isIPadOrIOS:bw,hardwareConcurrency:se.hardwareConcurrency??3,supportsPointerEvents:Rw,supportsImageRenderingPixelated:ig,supportsWebP:oe,imageRenderingValue:Sw,typedArrayTypes:Ds};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 g.defined("scene",i),i.context.webgl2},re.supportsEsmWebWorkers=function(){return!Pa()||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 ko=new O;H.fromAxisAngle=function(i,t,e){g.typeOf.object("axis",i),g.typeOf.number("angle",t);const n=t/2,s=Math.sin(n);ko=O.normalize(i,ko);const o=ko.x*s,r=ko.y*s,a=ko.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 Pw=[1,2,0],Ow=new Array(3);H.fromRotationMatrix=function(i,t){g.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=Pw;let d=0;c>a&&(d=1),h>a&&h>c&&(d=2);const p=u[d],_=u[p];e=Math.sqrt(i[k.getElementIndex(d,d)]-i[k.getElementIndex(p,p)]-i[k.getElementIndex(_,_)]+1);const y=Ow;y[d]=.5*e,e=.5/e,r=(i[k.getElementIndex(_,p)]-i[k.getElementIndex(p,_)])*e,y[p]=(i[k.getElementIndex(p,d)]+i[k.getElementIndex(d,p)])*e,y[_]=(i[k.getElementIndex(_,d)]+i[k.getElementIndex(d,_)])*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 ng=new H;let sg=new H,qh=new H,og=new H;H.fromHeadingPitchRoll=function(i,t){return g.typeOf.object("headingPitchRoll",i),og=H.fromAxisAngle(O.UNIT_X,i.roll,ng),qh=H.fromAxisAngle(O.UNIT_Y,-i.pitch,t),t=H.multiply(qh,og,qh),sg=H.fromAxisAngle(O.UNIT_Z,-i.heading,ng),H.multiply(sg,t,t)};const Ia=new O,Gh=new O,Ye=new H,rg=new H,Ta=new H;H.packedLength=4,H.pack=function(i,t,e){return g.typeOf.object("value",i),g.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 g.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,Ta),H.conjugate(Ta,Ta);for(let s=0,o=e-t+1;s<o;s++){const r=s*3;H.unpack(i,(t+s)*4,Ye),H.multiply(Ye,Ta,Ye),Ye.w<0&&H.negate(Ye,Ye),H.computeAxis(Ye,Ia);const a=H.computeAngle(Ye);C(n)||(n=[]),n[r]=Ia.x*a,n[r+1]=Ia.y*a,n[r+2]=Ia.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,rg),o===0?H.clone(H.IDENTITY,Ye):H.fromAxisAngle(Gh,o,Ye),H.multiply(Ye,rg,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 g.typeOf.object("quaternion",i),g.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 g.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){g.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){g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("quaternion",i),g.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 g.typeOf.object("left",i),g.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){g.typeOf.object("left",i),g.typeOf.object("right",t),g.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,d=r*c-n*h+s*l+o*a,p=r*h+n*c-s*a+o*l,_=r*l-n*a-s*c-o*h;return e.x=u,e.y=d,e.z=p,e.w=_,e},H.multiplyByScalar=function(i,t,e){return g.typeOf.object("quaternion",i),g.typeOf.number("scalar",t),g.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 g.typeOf.object("quaternion",i),g.typeOf.number("scalar",t),g.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){g.typeOf.object("quaternion",i),g.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 g.typeOf.object("quaternion",i),Math.abs(i.w-1)<T.EPSILON6?0:2*Math.acos(i.w)};let Bh=new H;H.lerp=function(i,t,e,n){return g.typeOf.object("start",i),g.typeOf.object("end",t),g.typeOf.number("t",e),g.typeOf.object("result",n),Bh=H.multiplyByScalar(t,e,Bh),n=H.multiplyByScalar(i,1-e,n),H.add(Bh,n,n)};let ag=new H,Vh=new H,Yh=new H;H.slerp=function(i,t,e,n){g.typeOf.object("start",i),g.typeOf.object("end",t),g.typeOf.number("t",e),g.typeOf.object("result",n);let s=H.dot(i,t),o=t;if(s<0&&(s=-s,o=ag=H.negate(t,ag)),1-s<T.EPSILON6)return H.lerp(i,o,e,n);const r=Math.acos(s);return Vh=H.multiplyByScalar(i,Math.sin((1-e)*r),Vh),Yh=H.multiplyByScalar(o,Math.sin(e*r),Yh),n=H.add(Vh,Yh,n),H.multiplyByScalar(n,1/Math.sin(r),n)},H.log=function(i,t){g.typeOf.object("quaternion",i),g.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){g.typeOf.object("cartesian",i),g.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 Iw=new O,Tw=new O,Wo=new H,Fs=new H;H.computeInnerQuadrangle=function(i,t,e,n){g.typeOf.object("q0",i),g.typeOf.object("q1",t),g.typeOf.object("q2",e),g.typeOf.object("result",n);const s=H.conjugate(t,Wo);H.multiply(s,e,Fs);const o=H.log(Fs,Iw);H.multiply(s,i,Fs);const r=H.log(Fs,Tw);return O.add(o,r,o),O.multiplyByScalar(o,.25,o),O.negate(o,o),H.exp(o,Wo),H.multiply(t,Wo,n)},H.squad=function(i,t,e,n,s,o){g.typeOf.object("q0",i),g.typeOf.object("q1",t),g.typeOf.object("s0",e),g.typeOf.object("s1",n),g.typeOf.number("t",s),g.typeOf.object("result",o);const r=H.slerp(i,t,s,Wo),a=H.slerp(e,n,s,Fs);return H.slerp(r,a,2*s*(1-s),o)};const Aw=new H,cg=1.9011074535173003,Aa=re.supportsTypedArrays()?new Float32Array(8):[],Ma=re.supportsTypedArrays()?new Float32Array(8):[],Si=re.supportsTypedArrays()?new Float32Array(8):[],Pi=re.supportsTypedArrays()?new Float32Array(8):[];for(let i=0;i<7;++i){const t=i+1,e=2*t+1;Aa[i]=1/(t*e),Ma[i]=t/e}Aa[7]=cg/136,Ma[7]=cg*8/17,H.fastSlerp=function(i,t,e,n){g.typeOf.object("start",i),g.typeOf.object("end",t),g.typeOf.number("t",e),g.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 p=7;p>=0;--p)Si[p]=(Aa[p]*c-Ma[p])*r,Pi[p]=(Aa[p]*h-Ma[p])*r;const l=o*e*(1+Si[0]*(1+Si[1]*(1+Si[2]*(1+Si[3]*(1+Si[4]*(1+Si[5]*(1+Si[6]*(1+Si[7])))))))),u=a*(1+Pi[0]*(1+Pi[1]*(1+Pi[2]*(1+Pi[3]*(1+Pi[4]*(1+Pi[5]*(1+Pi[6]*(1+Pi[7])))))))),d=H.multiplyByScalar(i,u,Aw);return H.multiplyByScalar(t,l,n),H.add(d,n,n)},H.fastSquad=function(i,t,e,n,s,o){g.typeOf.object("q0",i),g.typeOf.object("q1",t),g.typeOf.object("s0",e),g.typeOf.object("s1",n),g.typeOf.number("t",s),g.typeOf.object("result",o);const r=H.fastSlerp(i,t,s,Wo),a=H.fastSlerp(e,n,s,Fs);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"}},Ls={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(Ls[i],0,dn),O.unpack(Ls[t],0,fn),O.unpack(Ls[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(Ls[i],0,dn),i!=="east"&&i!=="west"&&O.multiplyByScalar(dn,c,dn),O.unpack(Ls[t],0,fn),t!=="east"&&t!=="west"&&O.multiplyByScalar(fn,c,fn),O.unpack(Ls[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 Mw=new H,Dw=new O(1,1,1),Fw=new U;ut.headingPitchRollToFixedFrame=function(i,t,e,n,s){g.typeOf.object("HeadingPitchRoll",t),n=n??ut.eastNorthUpToFixedFrame;const o=H.fromHeadingPitchRoll(t,Mw),r=U.fromTranslationQuaternionRotationScale(O.ZERO,o,Dw,Fw);return s=n(i,e,s),U.multiply(s,r,s)};const Lw=new U,zw=new k;ut.headingPitchRollQuaternion=function(i,t,e,n,s){g.typeOf.object("HeadingPitchRoll",t);const o=ut.headingPitchRollToFixedFrame(i,t,e,n,Lw),r=U.getMatrix3(o,zw);return H.fromRotationMatrix(r,s)};const Nw=new O(1,1,1),Uw=new O,hg=new U,jw=new U,kw=new k,Ww=new H;ut.fixedFrameToHeadingPitchRoll=function(i,t,e,n){g.defined("transform",i),t=t??ct.default,e=e??ut.eastNorthUpToFixedFrame,C(n)||(n=new Yt);const s=U.getTranslation(i,Uw);if(O.equals(s,O.ZERO))return n.heading=0,n.pitch=0,n.roll=0,n;let o=U.inverseTransformation(e(s,t,hg),hg),r=U.setScale(i,Nw,jw);r=U.setTranslation(r,O.ZERO,r),o=U.multiply(o,r,o);let a=H.fromRotationMatrix(U.getMatrix3(o,kw),Ww);return a=H.normalize(a,a),Yt.fromQuaternion(a,n)};const qw=6*3600+41*60+50.54841,Gw=8640184812866e-6,Bw=.093104,Vw=-62e-7,Yw=11772758384668e-32,Hw=72921158553e-15,Xw=T.TWO_PI/86400;let Da=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.");Da=$.addSeconds(i,-$.computeTaiMinusUtc(i),Da);const e=Da.dayNumber,n=Da.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=(qw+s*(Gw+s*(Bw+s*Vw)))*Xw%T.TWO_PI,c=Hw+Yw*(e-24515455e-1),h=(n+Dt.SECONDS_PER_DAY*.5)%Dt.SECONDS_PER_DAY,l=a+c*h,u=Math.cos(l),d=Math.sin(l);return C(t)?(t[0]=u,t[1]=-d,t[2]=0,t[3]=d,t[4]=u,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new k(u,d,0,-d,u,0,0,0,1)},ut.iau2006XysData=new Mh,ut.earthOrientationParameters=No.NONE;const $h=32.184,$w=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 Zw=32.184,Kw=2451545,Fa=new Yt,Qw=new k,Jw=new $;ut.computeMoonFixedToIcrfMatrix=function(i,t){if(!C(i))throw new j("date is required.");const e=$.addSeconds(i,Zw,Jw),n=$.totalDays(e)-Kw,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 Fa.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),Fa.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),Fa.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(Fa,Qw)},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 t1=new Xf(0,0,0),e1=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,e1);if(!C(e))return;const n=i.dayNumber,s=i.secondsOfDay+$h,o=ut.iau2006XysData.computeXysRadians(n,s,t1);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),d=i.dayNumber,p=i.secondsOfDay-$.computeTaiMinusUtc(i)+e.ut1MinusUtc,_=d-2451545,y=p/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-$w+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 i1=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=i1;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 n1=new O,s1=new O,o1=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,n1);let o=O.cross(t,s,s1);O.equalsEpsilon(o,O.ZERO,T.EPSILON6)&&(o=O.clone(O.UNIT_X,o));const r=O.cross(o,t,o1);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 lg=new U(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1),ug=new lt,Qh=new O,r1=new O,a1=new k,Jh=new U,dg=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,r1),s=i.ellipsoid;let o;if(O.equals(n,O.ZERO))o=O.clone(O.ZERO,Qh);else{const l=s.cartesianToCartographic(n,ug);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,dg),c=U.getMatrix3(t,a1),h=U.multiplyByMatrix3(a,c,e);return U.multiply(lg,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,dg),r=n.cartesianToCartographic(t,ug),a=i.project(r,Qh);O.fromElements(a.z,a.x,a.y,a);const c=U.fromTranslation(a,Jh);return U.multiply(lg,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 g.typeOf.object("value",i),g.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 g.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){g.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 g.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){g.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){g.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 d=u.longitude>=0?u.longitude:u.longitude+T.TWO_PI;o=Math.min(o,d),r=Math.max(r,d)}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 c1=new O,h1=new O,l1=new O,u1=new O,d1=new O,tl=new Array(5);for(let i=0;i<tl.length;++i)tl[i]=new O;nt.fromBoundingSphere=function(i,t,e){g.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,c1),r=U.multiplyByPointAsVector(o,O.UNIT_X,h1);O.normalize(r,r);const a=U.multiplyByPointAsVector(o,O.UNIT_Y,l1);O.normalize(a,a),O.multiplyByScalar(a,s,a),O.multiplyByScalar(r,s,r);const c=O.negate(a,d1),h=O.negate(r,u1),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){g.typeOf.object("rectangle",i);const t=i.north;g.typeOf.number.greaterThanOrEquals("north",t,-T.PI_OVER_TWO),g.typeOf.number.lessThanOrEquals("north",t,T.PI_OVER_TWO);const e=i.south;g.typeOf.number.greaterThanOrEquals("south",e,-T.PI_OVER_TWO),g.typeOf.number.lessThanOrEquals("south",e,T.PI_OVER_TWO);const n=i.west;g.typeOf.number.greaterThanOrEquals("west",n,-Math.PI),g.typeOf.number.lessThanOrEquals("west",n,Math.PI);const s=i.east;g.typeOf.number.greaterThanOrEquals("east",s,-Math.PI),g.typeOf.number.lessThanOrEquals("east",s,Math.PI)},nt.southwest=function(i,t){return g.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 g.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 g.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 g.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){g.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){g.typeOf.object("rectangle",i),g.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){g.typeOf.object("rectangle",i),g.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){g.typeOf.object("rectangle",i),g.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 g.typeOf.object("rectangle",i),g.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){g.typeOf.object("rectangle",i),g.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 f1=new lt;nt.subsample=function(i,t,e,n){g.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=f1;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(g.typeOf.object("rectangle",i),g.typeOf.number.greaterThanOrEquals("westLerp",t,0),g.typeOf.number.lessThanOrEquals("westLerp",t,1),g.typeOf.number.greaterThanOrEquals("southLerp",e,0),g.typeOf.number.lessThanOrEquals("southLerp",e,1),g.typeOf.number.greaterThanOrEquals("eastLerp",n,0),g.typeOf.number.lessThanOrEquals("eastLerp",n,1),g.typeOf.number.greaterThanOrEquals("northLerp",s,0),g.typeOf.number.lessThanOrEquals("northLerp",s,1),g.typeOf.number.lessThanOrEquals("westLerp",t,n),g.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 g.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 g.typeOf.object("color",i),g.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,Oi;re.supportsTypedArrays()&&(il=new ArrayBuffer(4),nl=new Uint32Array(il),Oi=new Uint8Array(il)),x.fromRgba=function(i,t){return nl[0]=i,x.fromBytes(Oi[0],Oi[1],Oi[2],Oi[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??oi.EMPTY_OBJECT;let e=i.red;if(!C(e)){const r=i.minimumRed??0,a=i.maximumRed??1;g.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;g.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;g.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;g.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 g1=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,p1=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,m1=/^rgba?\s*\(\s*([0-9.]+%?)\s*[,\s]+\s*([0-9.]+%?)\s*[,\s]+\s*([0-9.]+%?)(?:\s*[,\s/]+\s*([0-9.]+))?\s*\)$/i,_1=/^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){g.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=g1.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=p1.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=m1.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=_1.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 g.typeOf.object("value",i),g.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 g.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 Oi[0]=x.floatToByte(this.red),Oi[1]=x.floatToByte(this.green),Oi[2]=x.floatToByte(this.blue),Oi[3]=x.floatToByte(this.alpha),nl[0]},x.prototype.brighten=function(i,t){return g.typeOf.number("magnitude",i),g.typeOf.number.greaterThanOrEquals("magnitude",i,0),g.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 g.typeOf.number("magnitude",i),g.typeOf.number.greaterThanOrEquals("magnitude",i,0),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("left",i),g.typeOf.object("right",t),g.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 g.typeOf.object("start",i),g.typeOf.object("end",t),g.typeOf.number("t",e),g.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 g.typeOf.object("color",i),g.typeOf.number("scalar",t),g.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 g.typeOf.object("color",i),g.typeOf.number("scalar",t),g.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 Se(i,t){i=i??0,this._near=i,t=t??Number.MAX_VALUE,this._far=t}Object.defineProperties(Se.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}}}),Se.packedLength=2,Se.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},Se.unpack=function(i,t,e){if(!C(i))throw new j("array is required");return t=t??0,C(e)||(e=new Se),e.near=i[t++],e.far=i[t],e},Se.equals=function(i,t){return i===t||C(i)&&C(t)&&i.near===t.near&&i.far===t.far},Se.clone=function(i,t){if(C(i))return C(t)||(t=new Se),t.near=i.near,t.far=i.far,t},Se.prototype.clone=function(i){return Se.clone(this,i)},Se.prototype.equals=function(i){return Se.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 fg(i,t){return O.fromDegrees(...i,void 0,t)}const y1=new lt;function w1(i,t){const e=lt.fromCartesian(i,void 0,y1);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 gg(i,t){return t=t||new tt,t.x=i[0],t.y=i[1],t}function pg(i,t){return t=t||[0,0],t[0]=i.x,t[1]=i.y,t}function mg(i,t){return t=t||new O,t.x=i[0],t.y=i[1],t.z=i[2],t}function _g(i,t){return t=t||[0,0,0],t[0]=i.x,t[1]=i.y,t[2]=i.z,t}function yg(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 wg(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 vg(i,t){if(i.length===4)return yg(i,t);if(i.length===3)return mg(i,t);if(i.length===2)return gg(i,t);throw new Error("toCartesian error: should not be here!")}function v1(i,t){if(i instanceof tt)return pg(i,t);if(i instanceof O)return _g(i,t);if(i instanceof K)return wg(i,t);throw new Error("fromCartesian error: should not be here!")}function E1(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 C1(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 b1(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 x1(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 S1(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 Eg(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 P1(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 O1(i,t){return t=t||new Se,t.near=i[0],t.far=i[1],t}function I1(i,t){return t=t||[0,0],t[0]=i.near,t[1]=i.far,t}function T1(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 A1(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 M1=new Yt,D1=new O;function F1(i,t,e){const n=Eg(t,M1),s=fg(i,D1);return ut.headingPitchRollQuaternion(s,n,void 0,void 0,e)}function L1(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 z1(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 N1=new O;function U1(i,t){return t=t||new ct,ct.fromCartesian3(O.fromArray(i,void 0,N1),t)}function j1(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 k1(i,t){return Cg(i,O.UNIT_Y,O.UNIT_Z,O.UNIT_X,t)}function W1(i,t){return Cg(i,O.UNIT_X,O.UNIT_Z,new O(0,-1,0),t)}function Cg(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 bg(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"?k1(s,a):r==="XForwardZUp"&&W1(s,a);const c=k.fromQuaternion(a);U.multiply(e,U.fromRotationTranslation(c),e)}return o&&U.multiplyByScale(e,vg(o),e),bg(e,t)}const q1=new U;function xg(i,t){const e=U.fromArray(i,0,q1);return U.inverse(e,e),bg(e,t)}const G1=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,G1),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 V1=new U,Y1=new O,H1=new lt;function Sg(i,t,e){const[n,s,o]=t,r=O.fromElements(n,s,o,Y1),a=U.fromArray(i,0,V1),c=U.multiplyByPoint(a,r,r),h=lt.fromCartesian(c,void 0,H1);return e=e||[0,0,0],e[0]=T.toDegrees(h.longitude),e[1]=T.toDegrees(h.latitude),e[2]=h.height,e}function zs(i,t){const{originPosition:e,originRotation:n,originScale:s,initialRotationMode:o}=i,r=sl({position:e,rotation:n,scale:s,initialRotationMode:o}),a=xg(r);return[t.map(h=>Rg(a,h)),r,a]}function La(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=>Sg(r,c)),r]}function rl(i,t){return[(i[0]+t[0])/2,(i[1]+t[1])/2,(i[2]+t[2])/2]}class Pg extends f.Destroyable{constructor(e,n,s,o){super();S(this,"_pixelsToMetersAt",(e,n,s,o)=>{const r=vt([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]=Zt(h);return Math.abs(f.geoRhumbDistance([n,s,0],[l,u,0]))});const r=e.viewer;if(!r){console.warn("OlCurrentScale: map is undefined");return}const[a,,c]=f.getReactFuncs(n),[,h]=f.getReactFuncs(s),l=()=>{const d=a();if(!d)return;const[p,_]=d,y=this._pixelsToMetersAt(r,p,_,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 X1(i,t){var e,n;if(i){try{const s=Ti(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 $1 extends f.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=Ti(a);c&&(c.destroy(),Wa(a,void 0)),X1(a,n)}};this.d(o);const r=this.dv(f.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=_t(l)/256,d=new Array(19),p=new Array(19);for(let E=0;E<19;++E)d[E]=u/Math.pow(2,E),p[E]=E.toString();const _=new O_({target:s,view:new ni({center:[0,0],zoom:0,enableRotation:!0}),interactions:Wd({doubleClickZoom:!1}),controls:Ld({zoom:!1,rotate:!1,attribution:!1})});await a.promise(f.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 Z1 extends f.Destroyable{constructor(t){super();const e=()=>{};this.dispose(t.viewDistanceChanged.disposableOn(e)),this.dispose(t.visibleAlphaChanged.disposableOn(e))}}class K1 extends f.Destroyable{constructor(e){super();S(this,"_debugObjResetting");this._control=e,this._debugObjResetting=this.disposeVar(new f.ObjResettingWithEvent(this._control.debugChanged,()=>{if(this._control.debug)return new Z1(this._control)}))}get debugObjResetting(){return this._debugObjResetting}}class Og extends f.Destroyable{constructor(e,n,s,o){super();S(this,"_visibleAlpha",this.disposeVar(f.react(1)));S(this,"_viewDistance",this.disposeVar(f.react(0)));S(this,"_debug",this.disposeVar(f.react(!1)));S(this,"_viewDistanceDebug",this.disposeVar(new K1(this)));this._olViewer=e,this._positionReact=s;const[r,,a]=f.getReactFuncs(n),[c,,h]=f.getReactFuncs(this._positionReact),[l,,u]=o?f.getReactFuncs(o):[void 0,void 0,void 0],d=()=>{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=fu({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=_},p=this.disposeVar(f.createNextAnimateFrameEvent(...[this._olViewer.cameraChanged,a,h,u].filter(Boolean)));this.dispose(p.disposableOn(d)),d()}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 Ig extends f.Destroyable{constructor(e,n){super();S(this,"_map");S(this,"_view");S(this,"_keys",[]);S(this,"_changed",new f.Event);S(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 f.Destroyable{constructor(e,n=!0,s){super();S(this,"_coordinate");S(this,"_winPos",{left:NaN,top:NaN,right:NaN,bottom:NaN,depth:NaN});S(this,"_winPosValid",!1);S(this,"_changedEvent",new f.Event);S(this,"_enabled",!0);S(this,"tooltipElement");this.viewer=e,s=s||this.disposeVar(new Ig(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?ro(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 Q1 extends f.Destroyable{constructor(e,n){super();S(this,"_show",this.disposeVar(f.react(!0)));S(this,"_winPosFromCartesian");S(this,"_near",this.disposeVar(f.react(0)));S(this,"_far",this.disposeVar(f.react(Number.POSITIVE_INFINITY)));S(this,"_actualShow",this.disposeVar(f.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(f.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(),d=this._winPosFromCartesian.coordinate;if(!u||!d){this._actualShow.value=!1;return}const p=d[0]-u[0],_=d[1]-u[1],y=p*p+_*_,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 Q1{constructor(e,n,s){super(n,s);S(this,"_canvasPoi");S(this,"_zOrderChanged");S(this,"_zOrder");S(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 f.Event),this._zOrderChanged}}class Ii extends f.Destroyable{constructor(e,n){super();S(this,"_pickedEvent",this.disposeVar(new f.Event));S(this,"_flyToEvent",this.disposeVar(new f.Event));S(this,"_clickEvent",this.disposeVar(new f.Event));S(this,"_clickOutEvent",this.disposeVar(new f.Event));S(this,"_dblclickEvent",this.disposeVar(new f.Event));S(this,"_dblclickOutEvent",this.disposeVar(new f.Event));S(this,"_canvasPoiClassAndCreateFunc",f.react(void 0));S(this,"_olViewDistanceRangeControl");S(this,"_canvasObj");S(this,"_id",this.disposeVar(f.react(f.createGuid())));n&&(this.id=n),this._olViewDistanceRangeControl=this.disposeVar(new Og(e,[this,"viewDistanceRange"],[this,"position"])),this.dispose(f.track([this._olViewDistanceRangeControl,"debug"],[this,"viewDistanceDebug"]));const s=e.viewer;if(!s)return;const o=Ti(s);if(!o)return;const{poiContext:r,labelManager:a}=o;a.add(this),this.d(()=>{a.delete(this)}),r&&(this._canvasObj=this.disposeVar(new f.ObjResettingWithEvent(this.canvasPoiClassAndCreateFuncChanged,()=>{if(!this.canvasPoiClassAndCreateFunc)return;const[c,h]=this.canvasPoiClassAndCreateFunc;return new J1(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}}S(Ii,"defaults",{viewDistanceRange:[1e3,1e4,3e4,6e4]}),(i=>{i.createDefaultProps=()=>({show:!0,enabled:!0,position:f.reactArrayWithUndefined(void 0),positionEditing:!1,viewDistanceRange:f.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,zOrder:0})})(Ii||(Ii={})),f.extendClassProps(Ii.prototype,Ii.createDefaultProps);class J1 extends f.Destroyable{constructor(e,n,s,o,r){super();S(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=vt([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(f.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 tv extends f.Destroyable{constructor(t,e){super();const n=this.disposeVar(f.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(f.ESSceneObject.context.createEnvStrReact([t,"imageUri"],"${earthsdk3-assets-script-dir}/assets/img/location.png")),r=this.disposeVar(f.createProcessingFromAsyncFunc(async(h,l)=>{const u=await h.promise(f.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 f.Event);this.dispose(e.clickEvent.disposableOn((h,l,u,d,p)=>{(t.enabled??!0)&&c.emit(p)})),this.dispose(c.don(h=>{t.clickEvent.emit(h)})),this.dispose(e.clickOutEvent.disposableOn((h,l,u,d,p)=>{(t.enabled??!0)&&t.clickOutEvent.emit(p)})),this.dispose(e.dbclickEvent.disposableOn((h,l,u,d,p)=>{(t.enabled??!0)&&t.dbclickEvent.emit(p)})),this.dispose(e.dbclickOutEvent.disposableOn((h,l,u,d,p)=>{(t.enabled??!0)&&t.dbclickOutEvent.emit(p)})),this.dispose(f.bind([t,"hovered"],[e,"hovered"])),this.ad(f.bind([e,"isHoverZoom"],[t,"isHoverZoom"]))}}function ev(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
73
  ${e};
74
74
  }`,s=Function('"use strict";return ('+n+")")();return typeof s=="function"?s:void 0}catch(n){console.error(`optionStr get error! ${n}`);return}}}function za(i,t=48){return`
75
75
  <div style="
@@ -95,7 +95,7 @@ ${e};
95
95
  margin: auto;
96
96
  ">
97
97
  </div>
98
- `}function Og(i){return Math.abs(i)<1e3?`${i.toFixed(2)} m`:`${(i/1e3).toFixed(2)} km`}function Na(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 cl(i,t){if(i)return Object.prototype.hasOwnProperty.call(i,t)?i[t]!=null?Object.assign({},i[t]):void 0:cl(i.childPickedInfo,t)}function Ig(i,t){const[e]=f.getReactFuncs(t);return f.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 Ua(i,t,e,n){const[s,o]=i,[r,a,c,h]=n,l=t[0]*e[0],u=t[1]*e[1],d=s-(l*r+c),p=o-(u*a+h);return{left:d,top:p,right:d+l,bottom:p+u}}function ev(i,t,e,n,s,o){i.beginPath(),i.moveTo(t+o,e),i.lineTo(t+n-o,e),i.arcTo(t+n,e,t+n,e+o,o),i.lineTo(t+n,e+s-o),i.arcTo(t+n,e+s,t+n-o,e+s,o),i.lineTo(t+o,e+s),i.arcTo(t,e+s,t,e+s-o,o),i.lineTo(t,e+o),i.arcTo(t,e,t+o,e,o)}function iv(i){const{width:t,height:e}=i,n=t instanceof SVGAnimatedLength?t.baseVal.SVG_LENGTHTYPE_PX:t,s=e instanceof SVGAnimatedLength?e.baseVal.SVG_LENGTHTYPE_PX:e,o=document.createElement("canvas");o.width=n,o.height=s;const r=o.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("!cavnasCtx");return r.drawImage(i,0,0,n,s),o}function nv(i,t){const{width:e,height:n}=i,s=i.getContext("2d",{willReadFrequently:!0});if(!s)throw new Error("!cavnasCtx");const[o,r,a]=t.map(u=>u*255|0),c=s.getImageData(0,0,e,n),h=c.data;for(var l=0;l<h.length;l+=4)h[l]=o,h[l+1]=r,h[l+2]=a;s.putImageData(c,0,0)}function Tg(i,t,e,n=[.5,1,0,0],s,o="12px Arial",r=2,a="#FFF",c="#000A"){i.font=o;const h=i.measureText(s),l=h.actualBoundingBoxLeft+h.actualBoundingBoxRight,u=h.fontBoundingBoxAscent+h.fontBoundingBoxDescent,d=t,p=e,_=l+r*2,y=u+r*2,{left:w,top:E,bottom:b}=Ua([d,p],[_,y],[1,1],n);i.fillStyle=c,ev(i,w,E,_,y,r),i.fill(),i.fillStyle=a,i.fillText(s,w+r,b-r-h.fontBoundingBoxDescent)}function ja(i){return("00"+i.toString(16).toUpperCase()).substr(-2)}function ka(i){const[t,e,n,s]=i.map(o=>o*255|0);return`#${ja(t)}${ja(e)}${ja(n)}${ja(s)}`}function sv(i,t){const[e,n,s]=t,o=`${e}-${n}-${s}`;let r=f.getExtProp(i,o);return r||(r=iv(i),nv(r,t),f.setExtProp(i,o,r)),r}class ov extends f.CanvasPoi{constructor(e,n,s=[32,32],o=[.5,1,0,0],r="#F00F"){super(e);S(this,"_tooltip","");S(this,"_title","");S(this,"__scale",[1,1]);S(this,"_tooltipAlpha",0);S(this,"_bgColor",[.3,.3,.3,.8]);S(this,"_bgColorHexStr",ka(this._bgColor));S(this,"_fgColor",[1,1,1,1]);S(this,"_fgColorHexStr",ka(this._fgColor));S(this,"_tooltipShow",this.disposeVar(f.react(!0)));S(this,"_isHoverZoom",this.disposeVar(f.react(!1)));this._image=n,this._size=s,this._originRatioAndOffset=o,this._defaultColorStr=r;const a=new f.Transition(100),c=new f.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=ka(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=ka(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}=Ua([n,s],this._size,this.__scale,this._originRatioAndOffset),l=e.globalAlpha;if(e.globalAlpha=this.opacity,this._image){if(this.selected){const u=sv(this._image,[1,0,0]),{left:d,top:p}=Ua([n,s],[o+6,r+6],[1,1],this._originRatioAndOffset);e.drawImage(u,d,p,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!==""&&Tg(e,n+20,s-16,[0,.5,0,0],this._title,"14px Arial",4,this._fgColorHexStr,this._bgColorHexStr),e.globalAlpha=l,this._hovered&&this._tooltip!==""){const u=e.globalAlpha;e.globalAlpha=this._tooltipAlpha,Tg(e,(a+h)*.5,c-5,[.5,1,0,0],this._tooltip,"12px Arial",4,this._fgColorHexStr,this._bgColorHexStr),e.globalAlpha=u}}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}=Ua([s,o],this._size,this.__scale,this._originRatioAndOffset);e.fillStyle=r,e.fillRect(h,l,a,c)}}class hi extends f.Destroyable{constructor(e){var r;super();S(this,"_pickedEvent",this.disposeVar(new f.Event));S(this,"_flyToEvent",this.disposeVar(new f.Event));S(this,"_clickEvent",this.disposeVar(new f.Event));S(this,"_clickOutEvent",this.disposeVar(new f.Event));S(this,"_dbclickEvent",this.disposeVar(new f.Event));S(this,"_dbclickOutEvent",this.disposeVar(new f.Event));S(this,"_clickFunc",this.disposeVar(f.react(void 0)));S(this,"_clickFuncInit",(()=>{this.dispose(this.clickEvent.disposableOn(e=>this.clickFunc&&this.clickFunc(e)))})());S(this,"_geoCanvasPoi");if(!((r=e.extensions)==null?void 0:r.poiContext)){console.warn("poiContext is missing!");return}if(this._geoCanvasPoi=this.disposeVar(new Ii(e)),!e.viewer)return;const{geoCanvasPoi:o}=this;o.canvasPoiClassAndCreateFunc=[ov,a=>new J1(this,a)],this.dispose(f.bind([o,"show"],[this,"show"])),this.dispose(f.bind([o,"enabled"],[this,"enabled"])),this.dispose(f.bind([o,"position"],[this,"position"])),this.dispose(f.bind([o,"positionEditing"],[this,"positionEditing"])),this.dispose(f.track([o,"viewDistanceRange"],[this,"viewDistanceRange"])),this.dispose(f.track([o,"viewDistanceDebug"],[this,"viewDistanceDebug"])),this.dispose(f.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 f.ESJPickedResult({type:"viewerPicking",pointerEvent:a}))}));{const a=()=>{const c=tv(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}}S(hi,"defaults",{viewDistanceRange:[1e3,1e4,3e4,6e4],scale:[1,1]}),(i=>{i.createDefaultProps=()=>({show:!0,enabled:!0,position:f.reactArrayWithUndefined(void 0),positionEditing:!1,fgColor:f.reactArray([1,1,1,1]),bgColor:f.reactArray([0,0,0,0]),tooltip:"",tooltipShow:!0,title:"",size:f.reactArray([32,32]),scale:f.reactArray([1,1]),originRatioAndOffset:f.reactArray([.5,1,0,0]),hovered:!1,imageUri:f.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/img/location.png"),opacity:1,viewDistanceRange:f.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,pickOnClick:!1,clickFuncStr:"",zOrder:0,isHoverZoom:!1})})(hi||(hi={})),f.extendClassProps(hi.prototype,hi.createDefaultProps);class hl extends f.Destroyable{constructor(e,n,s,o){super();S(this,"_divPoi");S(this,"_show",!0);S(this,"_winPosFromCoordinate");S(this,"_zOrderChanged");S(this,"_zOrder");S(this,"depth",0);this._olPoisContext=n;const{viewer:r,divContainer:a,cameraChanged:c}=n;this._winPosFromCoordinate=o||this.disposeVar(new rl(r)),this._winPosFromCoordinate.coordinate=s,this._divPoi=new f.DivPoi(e,a),this.d(()=>this._divPoi.destroy()),this.d(this._winPosFromCoordinate.changed.disposableOn((h,l)=>{const{left:u,top:d,depth:p}=l,{floatDiv:_}=this._divPoi;_.winPos=[u,d],this.depth=Math.round((1-p)*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 f.Event),this._zOrderChanged}}class rv extends f.Destroyable{constructor(e,n,s,o,r){super();S(this,"_olCanvasPoi");S(this,"_olDivPoi");S(this,"_show",!0);S(this,"_winPosFromCoordinate");S(this,"_switchTransition");S(this,"_status","Canvas");S(this,"_statusChanged");this._olPoisContext=s;const{viewer:a}=this._olPoisContext;this._winPosFromCoordinate=r||this.disposeVar(new rl(a)),this._winPosFromCoordinate.coordinate=o,this._olCanvasPoi=new al(e,this._olPoisContext,this._winPosFromCoordinate),this.dispose(()=>this._olCanvasPoi.destroy()),this._olDivPoi=new hl(n,this._olPoisContext,o,this._winPosFromCoordinate),this.dispose(()=>this._olDivPoi.destroy()),this._switchTransition=new f.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 f.Event),this._statusChanged}get olCanvasPoi(){return this._olCanvasPoi}get olDivPoi(){return this._olDivPoi}}class Ag extends f.Destroyable{constructor(e,n=!0){super();S(this,"_divContainer");S(this,"_canvasPrimitivesContext");S(this,"_cameraChanged");S(this,"_clickEvent",this.disposeVar(new f.Event));S(this,"_dbclickEvent",this.disposeVar(new f.Event));S(this,"_downEvent",this.disposeVar(new f.Event));S(this,"_upEvent",this.disposeVar(new f.Event));S(this,"_moveEvent",this.disposeVar(new f.Event));S(this,"_outEvent",this.disposeVar(new f.Event));S(this,"_poiClickedEvent");this._viewer=e,this._useInnerInteraction=n,this._cameraChanged=this.disposeVar(new Pg(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 f.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 d,p;const _=y=>{d!==y&&(d&&(d.hovered=!1),d=y,d&&(d.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)=>{p&&(p.actived=!1);const b=r.pick(y*h,w*h,1,1);if(b.length>0){const P=b[0].poi;P instanceof f.CanvasPrimitive&&(P.actived=!0,p=P)}})),this.dispose(this._upEvent.disposableOn((y,w,E)=>{p&&(p.actived=!1,p=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 f.PointerClick),w=this.disposeVar(new f.PointerHover),E=s,b=this.disposeVar(f.DomElementEvent.create(E,"pointerdown")),P=this.disposeVar(f.DomElementEvent.create(E,"pointermove")),I=this.disposeVar(f.DomElementEvent.create(E,"pointerup")),M=this.disposeVar(f.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 f.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 Ns extends f.Destroyable{constructor(e){super();S(this,"_flyToEvent",this.disposeVar(new f.Event));S(this,"_commandEvent",this.disposeVar(new f.Event));S(this,"_dbclickEvent",this.disposeVar(new f.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 f.Transition(100));o.reset(0);const r=this.disposeVar(f.createTimeoutWithStartValues(()=>o.target=0,500)),a=this.disposeVar(f.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))},d=this.disposeVar(new hi(e));d.originRatioAndOffset=[.5,.5,0,0],this.dispose(f.track([d,"tooltip"],[n,"title"]));{const b=()=>{d.size=this.mainPoiSize??[12,12]};b(),this.dispose(this.mainPoiSizeChanged.disposableOn(b))}{const b=()=>{d.fgColor=this.mainPoiFgColor??[1,1,1,1]};b(),this.dispose(this.mainPoiFgColorChanged.disposableOn(b))}{const b=()=>{d.bgColor=this.mainPoiBgColor??[0,0,0,.6]};b(),this.dispose(this.mainPoiBgColorChanged.disposableOn(b))}const p=this.disposeVar(f.createNextAnimateFrameEvent(n.showChanged,n.positionChanged,n.descriptionChanged,n.titleChanged,n.imageUriChanged)),_=()=>{d.show=n.show??!0,d.imageUri=n.imageUri??f.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/img/point-yellow.png"),d.position=n.position};_(),this.dispose(p.disposableOn(_)),this.dispose(f.bind([d,"position"],[this,"position"])),this.dispose(f.bind([d,"positionEditing"],[this,"positionEditing"])),this.dispose(this._flyToEvent.disposableOn(b=>d.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,R=new hi(e);R.imageUri=X,R.tooltip=q,R.bgColor=[0,0,0,.6],R.fgColor=[1,1,1,1],R.size=[24,24],R.dispose(f.track([R,"position"],[n,"position"])),R.originRatioAndOffset=[.5,.5,-m,v],R.show=!1,R.opacity=0,R.dispose(R.opacityChanged.disposableOn(A=>R.show=(A??1)>0)),R.dispose(o.currentChanged.disposableOn(A=>R.enabled=A>0)),R.dispose(R.clickEvent.disposableOn(A=>n.commandEvent.emit(z,A))),R.dispose(R.hoveredChanged.disposableOn(u)),y.push(R)}};E(),this.dispose(n.commandsChanged.disposableOn(E)),this.dispose(d.hoveredChanged.disposableOn(u)),this.dispose(d.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(d.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(d.clickOutEvent.disposableOn(()=>{n.enabled&&(o.target=0)})),this.dispose(n.commandEvent.disposableOn(()=>o.target=0)),this.dispose(d.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=>d.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:f.reactArrayWithUndefined(void 0),positionEditing:!1,title:"",description:"",imageUri:f.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/img/point-yellow.png"),commands:f.reactDeepArrayWithUndefined(void 0,(t,e)=>t.every((n,s)=>n===e[s]),t=>[...t]),clickCommandName:"",rightClickCommandName:"",mainPoiSize:f.reactArrayWithUndefined(void 0),mainPoiBgColor:f.reactArrayWithUndefined(void 0),mainPoiFgColor:f.reactArrayWithUndefined(void 0)})})(Ns||(Ns={})),f.extendClassProps(Ns.prototype,Ns.createDefaultProps);const ll=`class OLDiv {
98
+ `}function Tg(i){return Math.abs(i)<1e3?`${i.toFixed(2)} m`:`${(i/1e3).toFixed(2)} km`}function Na(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 Ag(i,t){const[e]=f.getReactFuncs(t);return f.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 Ua(i,t,e,n){const[s,o]=i,[r,a,c,h]=n,l=t[0]*e[0],u=t[1]*e[1],d=s-(l*r+c),p=o-(u*a+h);return{left:d,top:p,right:d+l,bottom:p+u}}function iv(i,t,e,n,s,o){i.beginPath(),i.moveTo(t+o,e),i.lineTo(t+n-o,e),i.arcTo(t+n,e,t+n,e+o,o),i.lineTo(t+n,e+s-o),i.arcTo(t+n,e+s,t+n-o,e+s,o),i.lineTo(t+o,e+s),i.arcTo(t,e+s,t,e+s-o,o),i.lineTo(t,e+o),i.arcTo(t,e,t+o,e,o)}function nv(i){const{width:t,height:e}=i,n=t instanceof SVGAnimatedLength?t.baseVal.SVG_LENGTHTYPE_PX:t,s=e instanceof SVGAnimatedLength?e.baseVal.SVG_LENGTHTYPE_PX:e,o=document.createElement("canvas");o.width=n,o.height=s;const r=o.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("!cavnasCtx");return r.drawImage(i,0,0,n,s),o}function sv(i,t){const{width:e,height:n}=i,s=i.getContext("2d",{willReadFrequently:!0});if(!s)throw new Error("!cavnasCtx");const[o,r,a]=t.map(u=>u*255|0),c=s.getImageData(0,0,e,n),h=c.data;for(var l=0;l<h.length;l+=4)h[l]=o,h[l+1]=r,h[l+2]=a;s.putImageData(c,0,0)}function Mg(i,t,e,n=[.5,1,0,0],s,o="12px Arial",r=2,a="#FFF",c="#000A"){i.font=o;const h=i.measureText(s),l=h.actualBoundingBoxLeft+h.actualBoundingBoxRight,u=h.fontBoundingBoxAscent+h.fontBoundingBoxDescent,d=t,p=e,_=l+r*2,y=u+r*2,{left:w,top:E,bottom:b}=Ua([d,p],[_,y],[1,1],n);i.fillStyle=c,iv(i,w,E,_,y,r),i.fill(),i.fillStyle=a,i.fillText(s,w+r,b-r-h.fontBoundingBoxDescent)}function ja(i){return("00"+i.toString(16).toUpperCase()).substr(-2)}function ka(i){const[t,e,n,s]=i.map(o=>o*255|0);return`#${ja(t)}${ja(e)}${ja(n)}${ja(s)}`}function ov(i,t){const[e,n,s]=t,o=`${e}-${n}-${s}`;let r=f.getExtProp(i,o);return r||(r=nv(i),sv(r,t),f.setExtProp(i,o,r)),r}class rv extends f.CanvasPoi{constructor(e,n,s=[32,32],o=[.5,1,0,0],r="#F00F"){super(e);S(this,"_tooltip","");S(this,"_title","");S(this,"__scale",[1,1]);S(this,"_tooltipAlpha",0);S(this,"_bgColor",[.3,.3,.3,.8]);S(this,"_bgColorHexStr",ka(this._bgColor));S(this,"_fgColor",[1,1,1,1]);S(this,"_fgColorHexStr",ka(this._fgColor));S(this,"_tooltipShow",this.disposeVar(f.react(!0)));S(this,"_isHoverZoom",this.disposeVar(f.react(!1)));this._image=n,this._size=s,this._originRatioAndOffset=o,this._defaultColorStr=r;const a=new f.Transition(100),c=new f.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=ka(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=ka(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}=Ua([n,s],this._size,this.__scale,this._originRatioAndOffset),l=e.globalAlpha;if(e.globalAlpha=this.opacity,this._image){if(this.selected){const u=ov(this._image,[1,0,0]),{left:d,top:p}=Ua([n,s],[o+6,r+6],[1,1],this._originRatioAndOffset);e.drawImage(u,d,p,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!==""&&Mg(e,n+20,s-16,[0,.5,0,0],this._title,"14px Arial",4,this._fgColorHexStr,this._bgColorHexStr),e.globalAlpha=l,this._hovered&&this._tooltip!==""){const u=e.globalAlpha;e.globalAlpha=this._tooltipAlpha,Mg(e,(a+h)*.5,c-5,[.5,1,0,0],this._tooltip,"12px Arial",4,this._fgColorHexStr,this._bgColorHexStr),e.globalAlpha=u}}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}=Ua([s,o],this._size,this.__scale,this._originRatioAndOffset);e.fillStyle=r,e.fillRect(h,l,a,c)}}class hi extends f.Destroyable{constructor(e){var r;super();S(this,"_pickedEvent",this.disposeVar(new f.Event));S(this,"_flyToEvent",this.disposeVar(new f.Event));S(this,"_clickEvent",this.disposeVar(new f.Event));S(this,"_clickOutEvent",this.disposeVar(new f.Event));S(this,"_dbclickEvent",this.disposeVar(new f.Event));S(this,"_dbclickOutEvent",this.disposeVar(new f.Event));S(this,"_clickFunc",this.disposeVar(f.react(void 0)));S(this,"_clickFuncInit",(()=>{this.dispose(this.clickEvent.disposableOn(e=>this.clickFunc&&this.clickFunc(e)))})());S(this,"_geoCanvasPoi");if(!((r=e.extensions)==null?void 0:r.poiContext)){console.warn("poiContext is missing!");return}if(this._geoCanvasPoi=this.disposeVar(new Ii(e)),!e.viewer)return;const{geoCanvasPoi:o}=this;o.canvasPoiClassAndCreateFunc=[rv,a=>new tv(this,a)],this.dispose(f.bind([o,"show"],[this,"show"])),this.dispose(f.bind([o,"enabled"],[this,"enabled"])),this.dispose(f.bind([o,"position"],[this,"position"])),this.dispose(f.bind([o,"positionEditing"],[this,"positionEditing"])),this.dispose(f.track([o,"viewDistanceRange"],[this,"viewDistanceRange"])),this.dispose(f.track([o,"viewDistanceDebug"],[this,"viewDistanceDebug"])),this.dispose(f.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 f.ESJPickedResult({type:"viewerPicking",pointerEvent:a}))}));{const a=()=>{const c=ev(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}}S(hi,"defaults",{viewDistanceRange:[1e3,1e4,3e4,6e4],scale:[1,1]}),(i=>{i.createDefaultProps=()=>({show:!0,enabled:!0,position:f.reactArrayWithUndefined(void 0),positionEditing:!1,fgColor:f.reactArray([1,1,1,1]),bgColor:f.reactArray([0,0,0,0]),tooltip:"",tooltipShow:!0,title:"",size:f.reactArray([32,32]),scale:f.reactArray([1,1]),originRatioAndOffset:f.reactArray([.5,1,0,0]),hovered:!1,imageUri:f.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/img/location.png"),opacity:1,viewDistanceRange:f.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,pickOnClick:!1,clickFuncStr:"",zOrder:0,isHoverZoom:!1})})(hi||(hi={})),f.extendClassProps(hi.prototype,hi.createDefaultProps);class ul extends f.Destroyable{constructor(e,n,s,o){super();S(this,"_divPoi");S(this,"_show",!0);S(this,"_winPosFromCoordinate");S(this,"_zOrderChanged");S(this,"_zOrder");S(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 f.DivPoi(e,a),this.d(()=>this._divPoi.destroy()),this.d(this._winPosFromCoordinate.changed.disposableOn((h,l)=>{const{left:u,top:d,depth:p}=l,{floatDiv:_}=this._divPoi;_.winPos=[u,d],this.depth=Math.round((1-p)*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 f.Event),this._zOrderChanged}}class av extends f.Destroyable{constructor(e,n,s,o,r){super();S(this,"_olCanvasPoi");S(this,"_olDivPoi");S(this,"_show",!0);S(this,"_winPosFromCoordinate");S(this,"_switchTransition");S(this,"_status","Canvas");S(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 f.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 f.Event),this._statusChanged}get olCanvasPoi(){return this._olCanvasPoi}get olDivPoi(){return this._olDivPoi}}class Dg extends f.Destroyable{constructor(e,n=!0){super();S(this,"_divContainer");S(this,"_canvasPrimitivesContext");S(this,"_cameraChanged");S(this,"_clickEvent",this.disposeVar(new f.Event));S(this,"_dbclickEvent",this.disposeVar(new f.Event));S(this,"_downEvent",this.disposeVar(new f.Event));S(this,"_upEvent",this.disposeVar(new f.Event));S(this,"_moveEvent",this.disposeVar(new f.Event));S(this,"_outEvent",this.disposeVar(new f.Event));S(this,"_poiClickedEvent");this._viewer=e,this._useInnerInteraction=n,this._cameraChanged=this.disposeVar(new Ig(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 f.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 d,p;const _=y=>{d!==y&&(d&&(d.hovered=!1),d=y,d&&(d.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)=>{p&&(p.actived=!1);const b=r.pick(y*h,w*h,1,1);if(b.length>0){const P=b[0].poi;P instanceof f.CanvasPrimitive&&(P.actived=!0,p=P)}})),this.dispose(this._upEvent.disposableOn((y,w,E)=>{p&&(p.actived=!1,p=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 f.PointerClick),w=this.disposeVar(new f.PointerHover),E=s,b=this.disposeVar(f.DomElementEvent.create(E,"pointerdown")),P=this.disposeVar(f.DomElementEvent.create(E,"pointermove")),I=this.disposeVar(f.DomElementEvent.create(E,"pointerup")),M=this.disposeVar(f.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 f.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 Ns extends f.Destroyable{constructor(e){super();S(this,"_flyToEvent",this.disposeVar(new f.Event));S(this,"_commandEvent",this.disposeVar(new f.Event));S(this,"_dbclickEvent",this.disposeVar(new f.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 f.Transition(100));o.reset(0);const r=this.disposeVar(f.createTimeoutWithStartValues(()=>o.target=0,500)),a=this.disposeVar(f.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))},d=this.disposeVar(new hi(e));d.originRatioAndOffset=[.5,.5,0,0],this.dispose(f.track([d,"tooltip"],[n,"title"]));{const b=()=>{d.size=this.mainPoiSize??[12,12]};b(),this.dispose(this.mainPoiSizeChanged.disposableOn(b))}{const b=()=>{d.fgColor=this.mainPoiFgColor??[1,1,1,1]};b(),this.dispose(this.mainPoiFgColorChanged.disposableOn(b))}{const b=()=>{d.bgColor=this.mainPoiBgColor??[0,0,0,.6]};b(),this.dispose(this.mainPoiBgColorChanged.disposableOn(b))}const p=this.disposeVar(f.createNextAnimateFrameEvent(n.showChanged,n.positionChanged,n.descriptionChanged,n.titleChanged,n.imageUriChanged)),_=()=>{d.show=n.show??!0,d.imageUri=n.imageUri??f.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/img/point-yellow.png"),d.position=n.position};_(),this.dispose(p.disposableOn(_)),this.dispose(f.bind([d,"position"],[this,"position"])),this.dispose(f.bind([d,"positionEditing"],[this,"positionEditing"])),this.dispose(this._flyToEvent.disposableOn(b=>d.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,R=new hi(e);R.imageUri=X,R.tooltip=q,R.bgColor=[0,0,0,.6],R.fgColor=[1,1,1,1],R.size=[24,24],R.dispose(f.track([R,"position"],[n,"position"])),R.originRatioAndOffset=[.5,.5,-m,v],R.show=!1,R.opacity=0,R.dispose(R.opacityChanged.disposableOn(A=>R.show=(A??1)>0)),R.dispose(o.currentChanged.disposableOn(A=>R.enabled=A>0)),R.dispose(R.clickEvent.disposableOn(A=>n.commandEvent.emit(z,A))),R.dispose(R.hoveredChanged.disposableOn(u)),y.push(R)}};E(),this.dispose(n.commandsChanged.disposableOn(E)),this.dispose(d.hoveredChanged.disposableOn(u)),this.dispose(d.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(d.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(d.clickOutEvent.disposableOn(()=>{n.enabled&&(o.target=0)})),this.dispose(n.commandEvent.disposableOn(()=>o.target=0)),this.dispose(d.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=>d.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:f.reactArrayWithUndefined(void 0),positionEditing:!1,title:"",description:"",imageUri:f.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/img/point-yellow.png"),commands:f.reactDeepArrayWithUndefined(void 0,(t,e)=>t.every((n,s)=>n===e[s]),t=>[...t]),clickCommandName:"",rightClickCommandName:"",mainPoiSize:f.reactArrayWithUndefined(void 0),mainPoiBgColor:f.reactArrayWithUndefined(void 0),mainPoiFgColor:f.reactArrayWithUndefined(void 0)})})(Ns||(Ns={})),f.extendClassProps(Ns.prototype,Ns.createDefaultProps);const dl=`class OLDiv {
99
99
  // container是Poi的div
100
100
  // olCustomDivPoi指向当前的OLGeoCustomDivPoi场景对象
101
101
  // viewer指定当前的视口
@@ -130,19 +130,19 @@ ${e};
130
130
  destroy() {
131
131
  this._container.removeChild(this._div);
132
132
  }
133
- }`,Mg=`OL版示例代码:
133
+ }`,Fg=`OL版示例代码:
134
134
  \`\`\`
135
- ${ll}
135
+ ${dl}
136
136
  \`\`\`
137
- `,Dg=`<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);">
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);">
138
138
  <h3 style="margin:0 0 10px 0;font-size:16px;">Office Label</h3>
139
139
  <p style="margin:0;">Professional business information display</p>
140
140
  </div>
141
- `,av=`OL版示例代码:
141
+ `,cv=`OL版示例代码:
142
142
  \`\`\`
143
- ${Dg}
143
+ ${Lg}
144
144
  \`\`\`
145
- `;class Qt extends f.Destroyable{constructor(e,n){super();S(this,"_updateEvent",this.disposeVar(new f.Event));S(this,"_instanceClassReact",this.disposeVar(f.react(void 0)));S(this,"_flyToEvent",this.disposeVar(new f.Event));S(this,"_pickedEvent",this.disposeVar(new f.Event));S(this,"_innerHtmlMounted",this.disposeVar(new f.Event));S(this,"_olDivPoi");S(this,"_objResetting");S(this,"_olViewVisibleDistanceRangeControl");this._olViewVisibleDistanceRangeControl=this.disposeVar(new Sg(e,[this,"viewDistanceRange"],[this,"position"])),this.dispose(f.track([this._olViewVisibleDistanceRangeControl,"debug"],[this,"viewDistanceDebug"]));const s=e.viewer;if(!s)return;const o=Ti(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 hl(f.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(f.createNextAnimateFrameEvent(this.instanceClassChanged,this.shadowDomChanged)),u=this.disposeVar(new f.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:d}=this;this.dispose(d.disposableOn(E=>{if(u.obj)try{E(u.obj,this,e)}catch(b){console.error(`OLCustomDiv update error! ${b}`)}}));const p=()=>{h.divPoi.floatDiv.opacity=(this.opacity??1)*this.visibleAlpha};p(),this.dispose(this.opacityChanged.disposableOn(p)),this.dispose(this.visibleAlphaChanged.disposableOn(p));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=vt([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}xi(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 {
145
+ `;class Qt extends f.Destroyable{constructor(e,n){super();S(this,"_updateEvent",this.disposeVar(new f.Event));S(this,"_instanceClassReact",this.disposeVar(f.react(void 0)));S(this,"_flyToEvent",this.disposeVar(new f.Event));S(this,"_pickedEvent",this.disposeVar(new f.Event));S(this,"_innerHtmlMounted",this.disposeVar(new f.Event));S(this,"_olDivPoi");S(this,"_objResetting");S(this,"_olViewVisibleDistanceRangeControl");this._olViewVisibleDistanceRangeControl=this.disposeVar(new Og(e,[this,"viewDistanceRange"],[this,"position"])),this.dispose(f.track([this._olViewVisibleDistanceRangeControl,"debug"],[this,"viewDistanceDebug"]));const s=e.viewer;if(!s)return;const o=Ti(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(f.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(f.createNextAnimateFrameEvent(this.instanceClassChanged,this.shadowDomChanged)),u=this.disposeVar(new f.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:d}=this;this.dispose(d.disposableOn(E=>{if(u.obj)try{E(u.obj,this,e)}catch(b){console.error(`OLCustomDiv update error! ${b}`)}}));const p=()=>{h.divPoi.floatDiv.opacity=(this.opacity??1)*this.visibleAlpha};p(),this.dispose(this.opacityChanged.disposableOn(p)),this.dispose(this.visibleAlphaChanged.disposableOn(p));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=vt([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}xi(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 {
146
146
  constructor(container, olCustomDivPoi, viewer) {
147
147
  this._container = container;
148
148
  this._div = document.createElement('div');
@@ -155,11 +155,11 @@ ${Dg}
155
155
  destroy() {
156
156
  this._container.removeChild(this._div);
157
157
  }
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 f.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}}S(Qt,"defaultOLInstanceClassStr",ll),S(Qt,"olInstanceClassStrReadMe",Mg),S(Qt,"defaults",{position:[116.39,39.9,0],instanceClassStr:ll,instanceClassStrReadMe:Mg,innerHTML:Dg,innerHTMLReadMe:av,viewDistanceRange:[1e3,1e4,3e4,6e4],zOrder:0}),(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,opacity:1,position:f.reactArrayWithUndefined(void 0),originRatioAndOffset:f.reactArray([.5,1,0,0]),instanceClassStr:void 0,innerHTML:void 0,viewDistanceRange:f.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,shadowDom:!1,cssAllInitial:!1,zOrder:0})})(Qt||(Qt={})),f.extendClassProps(Qt.prototype,Qt.createDefaultProps);class cv extends f.Destroyable{constructor(t,e,n){super(),this._container=t}}const nc=class nc extends f.Destroyable{constructor(e,n){super();S(this,"_pickedEvent",this.disposeVar(new f.Event));S(this,"_divEvent",this.disposeVar(new f.Event));S(this,"_divCreatedEvent",this.disposeVar(new f.Event));S(this,"_divToDestroyEvent",this.disposeVar(new f.Event));S(this,"_pc",this.disposeVar(new f.PointerClick));S(this,"_flyToEvent",this.disposeVar(new f.Event));S(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(f.bind([o,"show"],[this,"show"])),this.dispose(f.bind([o,"position"],[this,"position"])),this.dispose(f.bind([o,"originRatioAndOffset"],[this,"originRatioAndOffset"])),this.dispose(f.bind([o,"opacity"],[this,"opacity"])),this.dispose(f.bind([o,"viewDistanceRange"],[this,"viewDistanceRange"])),this.dispose(f.bind([o,"viewDistanceDebug"],[this,"viewDistanceDebug"])),this.dispose(f.bind([o,"shadowDom"],[this,"shadowDom"])),this.dispose(f.bind([o,"cssAllInitial"],[this,"cssAllInitial"])),this.dispose(f.bind([o,"allowPicking"],[this,"pickOnClick"])),this.d(f.bind([o,"zOrder"],[this,"zOrder"]));{class r extends cv{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 p=()=>{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})`};p();const _=this.disposeVar(f.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));this.dispose(_.disposableOn(p))}{const p=()=>{s.textEditing?(u.contentEditable="true",u.focus(),document.execCommand("selectAll",!1,null)):(u.contentEditable="false",document.execCommand("unselect",!1,null))};p(),this.dispose(s.textEditingChanged.disposableOn(p))}{const p=()=>{s.textEditingInteraction||(s.positionEditing??!1?u.style.pointerEvents="none":u.style.pointerEvents="all")};p(),this.dispose(s.positionEditingChanged.disposableOn(p))}let d=null;this.dispose(()=>clearInterval(d));{const p=()=>{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(_){s.textEditingInteraction&&(_.code==="Enter"&&!_.shiftKey&&u.blur(),_.code==="Escape"&&u.blur())})};p(),this.dispose(s.textEditingInteractionChanged.disposableOn(p))}}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}};S(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:f.reactArrayWithUndefined(void 0),text:void 0,width:void 0,height:void 0,fontFamily:void 0,positionEditing:!1,textEditing:!1,textEditingInteraction:!1,originRatioAndOffset:f.reactArray([.5,1,0,0]),opacity:1,fontSize:14,textAlign:"left",color:f.reactArray([1,1,1,1]),backgroundColor:f.reactArray([0,0,0,.8]),padding:f.reactArray([5,5,5,5]),borderRadius:f.reactArray([6,6,6,6]),borderWidth:0,borderColor:f.reactArray([1,1,1,1]),borderStyle:"solid",viewDistanceRange:f.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,pickOnClick:!1,shadowDom:!1,cssAllInitial:!1,scale:f.reactArray([1,1]),zOrder:0})})(pn||(pn={})),f.extendClassProps(pn.prototype,pn.createDefaultProps);class Fg extends f.Destroyable{constructor(e){super();S(this,"_enabled",this.disposeVar(f.react(!1)));S(this,"_cursorPosition",f.react(void 0));S(this,"quickPickPosition",!0);let n=new f.Destroyable;const s=()=>{n&&(n.destroy(),n=void 0)};this.dispose(s);const o=()=>{var d;if(s(),!this._enabled.value||!e)return;const r=Ti(e);if(!r)return;n=new f.Destroyable;const a=n.disposeVar(f.react(void 0)),c=n.disposeVar(f.createNextAnimateFrameEvent(a.changed)),h=(d=e.getTargetElement)==null?void 0:d.call(e);if(!h)return;const l=p=>{const _=f.getDomEventCurrentTargetPos(p);a.value=_};h.addEventListener("mousemove",l),n.dispose(()=>h.removeEventListener("mousemove",l));const u=n.disposeVar(f.createProcessingFromAsyncFunc(async p=>{const _=r.pickingManager;if(!_||!a.value)return;const y=a.value,w=this.quickPickPosition?await p.promise(f.createCancelablePromise(_.quickPickPosition(y))):await p.promise(f.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 Lg extends f.Destroyable{constructor(e){super();S(this,"_baseLayers",new Set);S(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 zg extends f.Destroyable{constructor(e){super();S(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 f.Destroyable;{const o=s.dv(f.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 Ii&&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 d;u instanceof Qt&&u.olDivPoi?u.olDivPoi.zOrder=r:u instanceof Ii&&((d=u.canvasObj)!=null&&d.olCanvasPoi)&&(u.canvasObj.olCanvasPoi.zOrder=r),r--})})}}class Ng 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=Tn(c,pi(e.extent,s.projection))),!a[Vt.ANIMATING]&&!a[Vt.INTERACTING]&&!Hi(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&&!io(o,s))return null;const r=this.image_.getExtent(),a=this.getImage(),c=_t(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,d=c*o/(u*r),p=t.extent,_=h.resolution,y=h.rotation,w=Math.round(_t(p)/_*c),E=Math.round(Ht(p)/_*c);qe(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/c,1/c,y,-w/2,-E/2),Rr(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=pi(a.extent,h.projection);D=te(X,t.extent),M=D&&!In(X,t.extent),M&&this.clipUnrotated(P,t,X)}const L=this.getImage(),z=qe(this.tempTransform,w/2,E/2,d,d,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 hv extends Ng{constructor(t){super(t),this.vectorRenderer_=new xd(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),Qp(a,this.layerImageRatio_));const c=_t(a)/s,h=Ht(a)/s;if(!o[Vt.ANIMATING]&&!o[Vt.INTERACTING]&&!Hi(a)){r.useContainer(null,null);const l=r.context,u=t.layerStatesArray[t.layerIndex],d=Object.assign({},u,{opacity:1}),p=Object.assign({},t,{declutterTree:new Xc(9),extent:a,size:[c,h],viewState:Object.assign({},t.viewState,{rotation:0}),layerStatesArray:[d],layerIndex:0});let _=!0;const y=new Id(a,s,e,l.canvas,function(w){r.prepareFrame(p)&&r.replayGroupChanged&&(r.clipping=!1,r.renderFrame(p,null)&&(r.renderDeclutter(p),_=!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 lv extends hd{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 hv(this)}}class Ug extends f.Destroyable{constructor(e){super();S(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]=Zt(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,(p,_)=>{console.log("forEachFeatureAtPixel",p,_),r.push([p,_])}),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=f.ESSceneObject.getSceneObjectById(c.toString());if(h&&h.parentID&&(h=f.ESSceneObject.getSceneObjectById(h.parentID)),!h)return o(void 0);console.log("sceneObject:",h);const l=new f.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 f.ESJPickedResult):o(l)}catch(r){return console.error(r),o(void 0)}})}_layerPickable(e){return!e||e instanceof sn?!1:e instanceof bi||e instanceof lv}_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?f.ESSceneObject.getSceneObject(s):void 0;return r&&r.parentID&&(r=f.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 Ti(i){return f.getExtProp(i,"_viewerExtensions")}function Wa(i,t){f.setExtProp(i,"_viewerExtensions",t)}class jg extends f.Destroyable{constructor(e,n){super();S(this,"_imageriesManager");S(this,"_labelManager");S(this,"_pickingManager");S(this,"_poiContext");S(this,"_cursorPositionInfo");this._viewer=e,this._olViewer=n,this._imageriesManager=this.dv(new Lg(e)),this._labelManager=this.dv(new zg(e)),this._poiContext=this.disposeVar(new Ag(this._viewer)),this._cursorPositionInfo=this.dv(new Fg(e)),this.ad(n.viewerChanged.don(()=>{this._pickingManager=this.dv(new Ug(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 uv extends f.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 Ys=class Ys extends f.ESViewer{constructor(e){super(e);S(this,"_viewer",this.dv(f.react(void 0)));S(this,"orbitController",null);S(this,"_fpsMonitor",null);S(this,"wasdController",null);S(this,"_disabledInputStack",this.disposeVar(f.react(0)));S(this,"_interactionBackup",null);S(this,"_notSupportEditingCount",this.disposeVar(f.react(0)));S(this,"_editingSystem",this.ad(Pp()));if(e.type!==Ys.type)throw new Error("option.type must be ESOlViewer");this.d(this._viewer.changed.don(n=>{this.viewerChanged.emit(n)})),this.dv(new f.ObjResettingWithEvent(this.viewerChanged,()=>{if(this.viewer)return new uv(this,this.viewer)})),this.dv(new f.ObjResettingWithEvent(this.subContainerChanged,()=>{if(this.setStatus("Raw"),this.setStatusLog(""),!!this.subContainer)return new X1(this.subContainer,this,n=>this._viewer.value=n)}))}get viewer(){return this._viewer.value}get extensions(){return this.viewer&&Ti(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)}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=jn(e[2]);this.viewer.getView().animate({center:vt([e[0],e[1]]),zoom:o,rotation:0,duration:(s??1)*1e3})}flyTo(e,n){if(!this.viewer)return;const s=jn(e.distance);this.viewer.getView().animate({center:vt([n[0],n[1]]),zoom:s,rotation:0,duration:(e.flyDuration??1)*1e3})}flyToBoundingSphere(e,n,s){if(!this.viewer)return;const o={_duration:(s??1)*1e3};console.log(e);const r=vt([e[0],e[1]]),a=vt([e[2],e[3]]);this.viewer.getView().fit(Fc([r[0],r[1],a[0],a[1]]),{duration:o._duration,easing:Sn,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=Oo(e),s=this.viewer.getView().getCenter();if(!s)return;const o=Zt(s),a={position:[o[0],o[1],n],rotation:[0,-90,0]};return console.log("视图中心点:",a),a}calcFlyToParam(e){const n=this.getCurrentCameraInfo();if(!n)return;const{position:s,rotation:o}=n,r=f.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],p=Math.atan2(u,r)*180/Math.PI,_=l+90;return{distance:r,heading:_,pitch:p,flyDuration:1,hDelta:-(o[0]-_),pDelta:o[1]-p}}getLengthInPixel(){if(this.viewer)return this.viewer.getView().getResolution()}changeToWalk(e){this.viewer&&(this.changeToMap(),this.container&&(this.wasdController=this.dv(new Xd(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=jn(c._distance);a.setZoom(h),this.orbitController=Hd(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 $d(this.viewer))),this._fpsMonitor?this._fpsMonitor.getFPS():0}async getVersion(){const e=window.g_XE3CopyRights??{};return e.openlayers=Lp,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 Yd(this.viewer,e,n)}lonLatAltToScreenPosition(e){return this._func()}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}_${f.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=Zt([n[0],n[1]]),o=Zt([n[2],n[3]]),r=[s[0],s[1],o[0],o[1]];return console.log(r),Promise.resolve(r)}};S(Ys,"type",Ys.register("ESOlViewer",Ys));let li=Ys;(i=>{i.createDefaultProps=()=>({...f.ESViewer.createDefaultProps()})})(li||(li={})),f.extendClassProps(li.prototype,li.createDefaultProps);class dv extends mo{constructor(t){t=t||{},super(t)}}class ul extends dv{constructor(t){super(t)}createRenderer(){return new Ng(this)}getData(t){return super.getData(t)}}const qa={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class fv extends mo{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 kg=.5,gv=10,Wg=.25;class qg{constructor(t,e,n,s,o,r){this.sourceProj_=t,this.targetProj_=e;let a={};const c=Dn(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()&&_t(s)>=_t(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?_t(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?_t(this.targetProj_.getExtent()):null;const h=Ae(n),l=Ir(n),u=Or(n),d=Pr(n),p=this.transformInv_(h),_=this.transformInv_(l),y=this.transformInv_(u),w=this.transformInv_(d),E=gv+(r?Math.max(0,Math.ceil(Math.log2(mc(n)/(r*r*256*256)))):0);if(this.addQuad_(h,l,u,d,p,_,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=Sr([o,r,a,c]),u=this.sourceWorldWidth_?_t(l)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,p=this.sourceProj_.canWrapX()&&u>.5&&u<1;let _=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const w=Sr([t,e,n,s]);_=_t(w)/this.targetWorldWidth_>Wg||_}!p&&this.sourceProj_.isGlobal()&&u&&(_=u>Wg||_)}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;p?b=(Xi(o[0],d)+Xi(a[0],d))/2-Xi(E[0],d):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(p){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;so(t,o[0]),so(t,o[1]),so(t,o[2])}),t}getTriangles(){return this.triangles_}}let dl;const Us=[];function Gg(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 fl(i,t){return Math.abs(i[t*4]-210)>2||Math.abs(i[t*4+3]-191.25)>2}function pv(){if(dl===void 0){const i=Bt(6,6,Us);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",Gg(i,4,5,4,0),Gg(i,4,5,0,5);const t=i.getImageData(0,0,3,3).data;dl=fl(t,0)||fl(t,4)||fl(t,8),kr(i),Us.push(i.canvas)}return dl}function Ga(i,t,e,n){const s=ro(e,t,i);let o=mu(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||io(c,s)){const h=mu(i,o,s)/o;isFinite(h)&&h>0&&(o/=h)}return o}function mv(i,t,e,n){const s=Yi(e);let o=Ga(i,t,s,n);return(!isFinite(o)||o<=0)&&su(e,function(r){return o=Ga(i,t,r,n),isFinite(o)&&o>0}),o}function Bg(i,t,e,n,s,o,r,a,c,h,l,u){const d=Bt(Math.round(e*i),Math.round(e*t),Us);if(u||(d.imageSmoothingEnabled=!1),c.length===0)return d.canvas;d.scale(e,e);function p(I){return Math.round(I*e)/e}d.globalCompositeOperation="lighter";const _=Te();c.forEach(function(I,M,D){Xp(_,I.extent)});const y=_t(_),w=Ht(_),E=Bt(Math.round(e*y/n),Math.round(e*w/n),Us);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=_t(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 R=p((z[0][0]-P[0])/o),A=p(-(z[0][1]-P[1])/o),F=p((z[1][0]-P[0])/o),N=p(-(z[1][1]-P[1])/o),G=p((z[2][0]-P[0])/o),B=p(-(z[2][1]-P[1])/o),Z=q,V=Y;q=0,Y=0,X-=Z,Q-=V,m-=Z,v-=V;const at=[[X,Q,0,0,F-R],[m,v,0,0,G-R],[0,0,X,Q,N-A],[0,0,m,v,B-A]],et=d0(at);if(et){if(d.save(),d.beginPath(),pv()||!u){d.moveTo(F,N);const it=4,gt=R-F,yt=A-N;for(let dt=0;dt<it;dt++)d.lineTo(F+p((dt+1)*gt/it),N+p(dt*yt/(it-1))),dt!=it-1&&d.lineTo(F+p((dt+1)*gt/it),N+p((dt+1)*yt/(it-1)));d.lineTo(G,B)}else d.moveTo(F,N),d.lineTo(R,A),d.lineTo(G,B);d.clip(),d.transform(et[0],et[2],et[1],et[3],R,A),d.translate(_[0]-Z,_[3]-V),d.scale(n/e,-n/e),d.drawImage(E.canvas,0,0),d.restore()}}),kr(E),Us.push(E.canvas),l&&(d.save(),d.globalCompositeOperation="source-over",d.strokeStyle="black",d.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;d.beginPath(),d.moveTo(Y,X),d.lineTo(z,q),d.lineTo(Q,m),d.closePath(),d.stroke()}),d.restore()),d.canvas}class gl extends Td{constructor(t,e,n,s,o,r,a,c,h,l,u,d){super(o,rt.IDLE,{interpolate:!!d}),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 p=s.getTileCoordExtent(this.wrappedTileCoord_),_=this.targetTileGrid_.getExtent();let y=this.sourceTileGrid_.getExtent();const w=_?Tn(p,_):p;if(mc(w)===0){this.state=rt.EMPTY;return}const E=t.getExtent();E&&(y?y=Tn(y,E):y=E);const b=s.getResolution(this.wrappedTileCoord_[0]),P=mv(t,n,w,b);if(!isFinite(P)||P<=0){this.state=rt.EMPTY;return}const I=l!==void 0?l:kg;if(this.triangulation_=new qg(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=Tn(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_=Bg(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_&&(kr(this.canvas_.getContext("2d")),Us.push(this.canvas_),this.canvas_=null),super.release()}}class _v 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&&!io(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 d=l.getZForResolution(c.resolution);d>=l.getMinZoom();--d){const p=l.getTileCoordForCoordAndZ(s,d),_=h.getTile(d,p[1],p[2],r,a);if(!(_ instanceof Ad||_ instanceof gl)||_ instanceof gl&&_.getState()===rt.EMPTY)return null;if(_.getState()!==rt.LOADED)continue;const y=l.getOrigin(d),w=fe(l.getTileSize(d)),E=l.getResolution(d),b=Math.floor(u*((s[0]-y[0])/E-p[1]*w[0])),P=Math.floor(u*((y[1]-s[1])/E-p[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(),d=u.getRevision(),p=u.getTileGridForProjection(o),_=p.getZForResolution(r,u.zDirection),y=p.getResolution(_);let w=t.extent;const E=t.viewState.resolution,b=u.getTilePixelRatio(h),P=Math.round(_t(w)/E*h),I=Math.round(Ht(w)/E*h),M=n.extent&&pi(n.extent);M&&(w=Tn(w,pi(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=p.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&&!p.tileCoordIntersectsViewport([_,at,et],v))continue;const it=this.getTile(_,at,et,t);if(this.isDrawableTile(it)){const dt=Rt(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=p.getTileCoordChildTileRange(it.tileCoord,m,Q);let yt=!1;gt&&(yt=X(_+1,gt)),yt||p.forEachTileCoordParentTileRange(it.tileCoord,X,m,Q)}const R=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;Rr(this.inversePixelTransform,this.pixelTransform),qe(this.tempTransform,P/2,I/2,R,R,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(Pn);let B,Z,V;n.opacity===1&&(!this.containerReused||u.getOpaque(t.viewState.projection))?G=G.reverse():(B=[],Z=[]);for(let at=G.length-1;at>=0;--at){const et=G[at],it=u.getTilePixelSize(et,h,o),yt=p.getResolution(et)/y,dt=it[0]*yt*R,Et=it[1]*yt*R,ft=p.getTileCoordForCoordAndZ(Ae(z),et),xt=p.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],es=ye.tileCoord,we=ft[1]-es[1],En=Math.round(Ft[0]-(we-1)*dt),Cn=ft[2]-es[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,Ui=_===et,di=Ui&&ye.getAlpha(Rt(this),t.time)!==1;let St=!1;if(!di)if(B){V=[ae,ve,ae+Oe,ve,ae+Oe,ve+Ne,ae,ve+Ne];for(let Ee=0,$e=B.length;Ee<$e;++Ee)if(_!==et&&et<Z[Ee]){const At=B[Ee];te([ae,ve,ae+Oe,ve+Ne],[At[0],At[3],At[4],At[7]])&&(St||(F.save(),St=!0),F.beginPath(),F.moveTo(V[0],V[1]),F.lineTo(V[2],V[3]),F.lineTo(V[4],V[5]),F.lineTo(V[6],V[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())}B.push(V),Z.push(et)}else F.clearRect(ae,ve,Oe,Ne);this.drawTileImage(ye,t,ae,ve,Oe,Ne,kt,Ui),B&&!di?(St&&F.restore(),this.renderedTiles.unshift(ye)):this.renderedTiles.push(ye),this.updateUsedTiles(t.usedTiles,u,ye)}}return this.renderedRevision=d,this.renderedResolution=y,this.extentChanged=!this.renderedExtent_||!Vi(this.renderedExtent_,z),this.renderedExtent_=z,this.renderedPixelRatio=h,this.renderedProjection=o,this.manageTilePyramid(t,u,p,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=Rt(this),u=e.layerStatesArray[e.layerIndex],d=u.opacity*(c?t.getAlpha(l,e.time):1),p=d!==this.context.globalAlpha;p&&(this.context.save(),this.context.globalAlpha=d),this.context.drawImage(h,a,a,h.width-2*a,h.height-2*a,n,s,o,r),p&&this.context.restore(),d!==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=Rt(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=Rt(e);s in t||(t[s]={}),t[s][n.getKey()]=!0}manageTilePyramid(t,e,n,s,o,r,a,c,h){const l=Rt(e);l in t.wantedTiles||(t.wantedTiles[l]={});const u=t.wantedTiles[l],d=t.tileQueue,p=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=p;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,d.isKeyQueued(E.getKey())||d.enqueue([E,l,n.getTileCoordCenter(E.tileCoord),P])),h!==void 0&&h(E)):e.useTile(D,I,M,o));e.updateCacheSize(w,o)}}class Ba extends fv{constructor(t){super(t)}createRenderer(){return new _v(this)}}class yv 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?Tn(n,h):n,u=Yi(l),d=Ga(t,e,u,s),p=kg,_=new qg(t,e,l,c,d*p,s),y=_.calculateSourceExtent(),w=Hi(y)?null:r(y,d,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=_t(this.targetExtent_)/this.targetResolution_,n=Ht(this.targetExtent_)/this.targetResolution_;this.canvas_=Bg(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 pl={IMAGELOADSTART:"imageloadstart",IMAGELOADEND:"imageloadend",IMAGELOADERROR:"imageloaderror"};class wv extends We{constructor(t,e){super(t),this.image=e}}class ml 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=Cr(e,t,0);t=e[n]}return t}getImage(t,e,n,s){const o=this.getProjection();if(!o||!s||$i(o,s))return o&&(s=o),this.getImageInternal(t,e,n,s);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&$i(this.reprojectedImage_.getProjection(),s)&&this.reprojectedImage_.getResolution()==e&&Vi(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new yv(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 wt()}handleImageChange(t){const e=t.target;let n;switch(e.getState()){case ot.LOADING:this.loading=!0,n=pl.IMAGELOADSTART;break;case ot.LOADED:this.loading=!1,n=pl.IMAGELOADEND;break;case ot.ERROR:this.loading=!1,n=pl.IMAGELOADERROR;break;default:return}this.hasListener(n)&&this.dispatchEvent(new wv(n,e))}}function vv(i,t){i.getImage().src=t}class Vg extends ml{constructor(t){const e=t.crossOrigin!==void 0?t.crossOrigin:null,n=t.imageLoadFunction!==void 0?t.imageLoadFunction:vv;super({attributions:t.attributions,interpolate:t.interpolate,projection:Gt(t.projection)}),this.url_=t.url,this.imageExtent_=t.imageExtent,this.image_=new ym(this.imageExtent_,void 0,1,this.url_,e,n,Bt(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=_t(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 d=Bt(l,u);this.getInterpolate()||(d.imageSmoothingEnabled=!1);const p=d.canvas;d.drawImage(n,0,0,s,o,0,0,p.width,p.height),this.image_.setImage(p)}}super.handleImageChange(t)}}const js=[0,0,0],mn=5;class ks{constructor(t){this.minZoom=t.minZoom!==void 0?t.minZoom:0,this.resolutions_=t.resolutions,pt(Mp(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=Cs(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 Cs(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 Cs(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 Cs(h,h,l,l,n);const u=Math.floor(c*(o+1))-1,d=Math.floor(c*(r+1))-1;return Cs(h,u,l,d,n)}const a=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,e,n)}getTileRangeForExtentAndZ(t,e,n){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,js);const s=js[1],o=js[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,js);const r=js[1],a=js[2];return Cs(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 fi(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=Dr(l,mn)-1,u=Dr(u,mn)-1):(l=Mr(l,mn),u=Mr(u,mn)),qd(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=Dr(h,mn)-1,l=Dr(l,mn)-1):(h=Mr(h,mn),l=Mr(l,mn)),qd(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=Cr(this.resolutions_,t,e||0);return qt(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return Du(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 Yg(i){let t=i.getDefaultTileGrid();return t||(t=bv(i),i.setDefaultTileGrid(t)),t}function Ev(i,t,e){const n=t[0],s=i.getTileCoordCenter(t),o=_l(e);if(!io(o,s)){const r=_t(o),a=Math.ceil((o[0]-s[0])/r);return s[0]+=r*a,i.getTileCoordForCoordAndZ(s,n)}return t}function Cv(i,t,e,n){n=n!==void 0?n:"top-left";const s=Xg(i,t,e);return new ks({extent:i,origin:Zp(i,n),resolutions:s,tileSize:e})}function Hg(i){const t=i||{},e=t.extent||Gt("EPSG:3857").getExtent(),n={extent:e,minZoom:t.minZoom,tileSize:t.tileSize,resolutions:Xg(e,t.maxZoom,t.tileSize,t.maxResolution)};return new ks(n)}function Xg(i,t,e,n){t=t!==void 0?t:tm,e=fe(e!==void 0?e:Wc);const s=Ht(i),o=_t(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 bv(i,t,e,n){const s=_l(i);return Cv(s,t,e,n)}function _l(i){i=Gt(i);let t=i.getExtent();if(!t){const e=180*wc.degrees/i.getMetersPerUnit();t=fi(-e,-e,e,e)}return t}class $g 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 Vd(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=ta(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 wt()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:Yg(t)}getTileCacheForProjection(t){const e=this.getProjection();return pt(e===null||$i(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:Wu(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=Ev(n,t,e)),T_(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 xv extends We{constructor(t,e){super(t),this.tile=e}}let Zg=!0;try{new ImageData(10,10)}catch{Zg=!1}let yl;function Rv(i,t,e){if(Zg)return new ImageData(i,t,e);yl||(yl=document.createElement("canvas").getContext("2d"));const n=yl.createImageData(t,e);return n.data.set(i),n}function Kg(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),d=new Array(h),p=new Array(h);for(let _=0;_<h;++_)d[_]=new Uint8ClampedArray(s[_]),p[_]=[0,0,0,0];for(let _=0;_<l;_+=4){for(let w=0;w<h;++w){const E=d[w];p[w][0]=E[_],p[w][1]=E[_+1],p[w][2]=E[_+2],p[w][3]=E[_+3]}const y=i(p,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__ = ("+Kg.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 Pv(i,t){const e=Kg(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 Ov extends Er{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]=Pv(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,d=s.length;u<d;++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,Rv(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 Qg={BEFOREOPERATIONS:"beforeoperations",AFTEROPERATIONS:"afteroperations"};class Jg extends We{constructor(t,e,n){super(t),this.extent=e.extent,this.resolution=e.viewState.resolution/e.pixelRatio,this.data=n}}class wl extends ml{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_=Av(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 Md(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:Tv(this.layers_),pixelRatio:1,pixelToCoordinateTransform:be(),postRenderFunctions:[],size:[0,0],tileQueue:this.tileQueue_,time:Date.now(),usedTiles:{},viewState:{rotation:0},viewHints:[],wantedTiles:{},mapId:Rt(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 Ov({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=Yi(t);s.size[0]=Math.ceil(_t(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||!Vi(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=Iv(this.layers_[o],t);if(r)n[o]=r;else return}const s={};this.dispatchEvent(new Jg(Qg.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||!Vi(o,this.requestedFrameState_.extent))return;let a;if(this.renderedImageCanvas_)a=this.renderedImageCanvas_.getImage().getContext("2d");else{const c=Math.round(_t(o)/r),h=Math.round(Ht(o)/r);a=Bt(c,h),this.renderedImageCanvas_=new Id(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 Jg(Qg.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()}}wl.prototype.dispose;let Vn=null;function Iv(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(!Vn)Vn=Bt(n,s,void 0,{willReadFrequently:!0});else{const a=Vn.canvas;a.width!==n||a.height!==s?Vn=Bt(n,s,void 0,{willReadFrequently:!0}):Vn.clearRect(0,0,n,s)}return Vn.drawImage(r,0,0,n,s),Vn.getImageData(0,0,n,s)}function Tv(i){return i.map(function(t){return t.getLayerState()})}function Av(i){const t=i.length,e=new Array(t);for(let n=0;n<t;++n)e[n]=Mv(i[n]);return e}function Mv(i){let t;return i instanceof Ro?i instanceof $g?t=new Ba({source:i}):i instanceof ml&&(t=new ul({source:i})):t=i,t}const vl={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};function Dv(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 Fv(i,t){const e=i.length,n=new Array(e);for(let s=0;s<e;++s)n[s]=Dv(i[s],t);return El(n)}function El(i){return i.length===1?i[0]:function(t,e,n){if(!t)return;const s=Bd(t),o=Xi(s,i.length);return i[o](t,e,n)}}function tp(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 Cl extends $g{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===Cl.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=Rt(e),s=e.getState();let o;s==rt.LOADING?(this.tileLoadingKeys_[n]=!0,o=vl.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],o=s==rt.ERROR?vl.TILELOADERROR:s==rt.LOADED?vl.TILELOADEND:void 0),o!=null&&this.dispatchEvent(new xv(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=tp(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join(`
160
- `);this.generateTileUrlFunction_?this.setTileUrlFunction(Fv(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,n){}useTile(t,e,n){const s=ta(t,e,n);this.tileCache.containsKey(s)&&this.tileCache.get(s)}}class bl extends Cl{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:Lv,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:Ad,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&&!$i(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&&!$i(this.getProjection(),t)?!1:super.getOpaque(t)}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||$i(e,t)))return this.tileGrid;const n=Rt(t);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=Yg(t)),this.tileGridForProjection[n]}getTileCacheForProjection(t){const e=this.getProjection();if(!e||$i(e,t))return this.tileCache;const n=Rt(t);return n in this.tileCacheForProjection||(this.tileCacheForProjection[n]=new Vd(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||$i(r,o))return this.getTileInternal(t,e,n,s,r||o);const a=this.getTileCacheForProjection(o),c=[t,e,n];let h;const l=Gd(c);a.containsKey(l)&&(h=a.get(l));const u=this.getKey();if(h&&h.key==u)return h;const d=this.getTileGridForProjection(r),p=this.getTileGridForProjection(o),_=this.getTileCoordForTileUrlFunction(c,o),y=new gl(r,d,o,p,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=ta(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=Rt(n);s in this.tileGridForProjection||(this.tileGridForProjection[s]=e)}}clear(){super.clear();for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear()}}function Lv(i,t){i.getImage().src=t}const Va="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 zv extends bl{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_),d=fe(a.getTileSize(h[0]),this.tmpSize);const p=this.gutter_;p!==0&&(d=ju(d,p,this.tmpSize),u=to(u,l*p,u)),r&&r!==o&&(l=Ga(r,o,t,l),u=vu(u,o,r),t=ro(t,o,r));const _={SERVICE:"WMS",VERSION:Va,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,d,u,1,r||o,_)}getLegendUrl(t,e){if(this.urls[0]===void 0)return;const n={SERVICE:"WMS",VERSION:Va,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=Xi(Bd(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||Va;this.v13_=f0(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=ju(a,c,this.tmpSize),r=to(r,o*c,r)),e!=1&&(a=Wu(a,e,this.tmpSize));const h={SERVICE:"WMS",VERSION:Va,REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};return Object.assign(h,this.params_),this.getRequestUrl_(t,a,r,e,n,h)}}class Nv extends ks{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 Uv extends bl{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=tp(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=El(s.map(this.createFromWMTSTemplate.bind(this))))}setUrls(t){this.urls=t;const e=t.join(`
161
- `);this.setTileUrlFunction(El(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,d){return h[d]}),l}}}class Ha extends bl{constructor(t){t=t||{};const e=t.projection!==void 0?t.projection:"EPSG:3857",n=t.tileGrid!==void 0?t.tileGrid:Hg({extent:_l(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 ep extends f.Destroyable{constructor(e,n){super();S(this,"_imageriesManager");S(this,"_map");S(this,"_raster");S(this,"_layer",this.dv(f.react(void 0)));S(this,"_rShow",this.dv(f.react(!0)));S(this,"_rAlpha",this.dv(f.react(1)));S(this,"_rZIndex",this.dv(f.react(0)));S(this,"_rRectangle",this.dv(f.react(void 0)));S(this,"_rSplitDirection",this.dv(f.react("NONE")));S(this,"_rBrightness",this.dv(f.react(1)));S(this,"_rContrast",this.dv(f.react(1)));S(this,"_rHue",this.dv(f.react(0)));S(this,"_rSaturation",this.dv(f.react(1)));S(this,"_rGamma",this.dv(f.react(1)));S(this,"_raf");this.id=n;const s=e.viewer;if(!s)return;this._map=s;const o=Ti(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 wl({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,d=h[2]/255;const p=h[3]/255;if(r.hueCos!==1||r.hueSin!==0){const y=c(l,u,d,r.hueCos,r.hueSin);l=y[0],u=y[1],d=y[2]}if(r.saturation!==1){const y=a(l,u,d);l=y+(l-y)*r.saturation,u=y+(u-y)*r.saturation,d=y+(d-y)*r.saturation}r.brightness!==1&&(l*=r.brightness,u*=r.brightness,d*=r.brightness),r.contrast!==1&&(l=(l-.5)*r.contrast+.5,u=(u-.5)*r.contrast+.5,d=(d-.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),d=Math.pow(Math.max(d,0),r.gammaInv));const _=y=>Math.max(0,Math.min(255,Math.round(y*255)));return h[0]=_(l),h[1]=_(u),h[2]=_(d),h[3]=_(p),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 wl?new ul({source:e}):e instanceof Vg?new ul({source:e}):new Ba({source:e})}_createFromProvider(e){var _,y;if(!this._map)return;this._destroyLayer();const s=Gt("EPSG:3857").getExtent(),o=_t(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||"",d=r.minimumLevel??0,p=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:d,maxZoom:p,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??d)|0,I=(w.maximumLevel??p)|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,R,A;if(b){R=[-180,-90,180,90],v=Ae(R);const N=360/(m*2);A=Array.from({length:X},(G,B)=>N/Math.pow(2,q+B))}else{R=s,v=Ae(R);const N=_t(R)/m;A=Array.from({length:X},(G,B)=>N/Math.pow(2,q+B))}const F=new Uv({url:u(w.url),layer:w.layer,matrixSet:E,format:w.format??"image/png",style:w.style??"default",tileGrid:w.tileGrid??new Nv({origin:v,extent:R,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 B=new Image;B.crossOrigin=a||"anonymous",B.onload=()=>{var Ui,di;const Z=this._rBrightness.value??1,V=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&&V===1&&it===1){const St=(Ui=N.getImage)==null?void 0:Ui.call(N);if(St){St.src=G;return}}const gt=B.naturalWidth||B.width,yt=B.naturalHeight||B.height;if(!gt||!yt){N.getImage().src=G;return}const dt=document.createElement("canvas");dt.width=gt,dt.height=yt;const Et=dt.getContext("2d",{willReadFrequently:!0});Et.drawImage(B,0,0);const ft=Et.getImageData(0,0,gt,yt),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]],es=(St,Ee)=>{const $e=Array.from({length:3},()=>[0,0,0]);for(let At=0;At<3;At++)for(let Ue=0;Ue<3;Ue++)$e[At][Ue]=St[At][0]*Ee[0][Ue]+St[At][1]*Ee[1][Ue]+St[At][2]*Ee[2][Ue];return $e},we=es(he,es(ye,Wt)),En=.5-.5*V,Cn=1/Math.max(1e-4,it),bn=new Uint8ClampedArray(256);for(let St=0;St<256;St++)bn[St]=Math.max(0,Math.min(255,Math.round(Math.pow(St/255,Cn)*255)));const ae=.2126,ve=.7152,Oe=.0722;for(let St=0;St<xt.length;St+=4){let Ee=xt[St]/255,$e=xt[St+1]/255,At=xt[St+2]/255;const Ue=xt[St+3],ac=we[0][0]*Ee+we[0][1]*$e+we[0][2]*At,cc=we[1][0]*Ee+we[1][1]*$e+we[1][2]*At,yr=we[2][0]*Ee+we[2][1]*$e+we[2][2]*At,ji=ae*ac+ve*cc+Oe*yr,wr=ji+(ac-ji)*at,hc=ji+(cc-ji)*at,vr=ji+(yr-ji)*at,is=wr*Z,ns=hc*Z,ss=vr*Z;let xn=is*V+En,Rn=ns*V+En,Xt=ss*V+En;xn=xn<0?0:xn>1?1:xn,Rn=Rn<0?0:Rn>1?1:Rn,Xt=Xt<0?0:Xt>1?1:Xt,xt[St]=bn[Math.round(xn*255)],xt[St+1]=bn[Math.round(Rn*255)],xt[St+2]=bn[Math.round(Xt*255)],xt[St+3]=Ue}Et.putImageData(ft,0,0);const Ne=(di=N.setImage)==null?void 0:di.bind(N);Ne?Ne(dt):N.getImage().src=dt.toDataURL("image/png")},B.onerror=()=>{N.getImage().src=G},B.src=G}});this._layer.value=new Ba({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 zv({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?Hg({extent:I.getExtent(),minZoom:d,maxZoom:p,tileSize:256}):void 0,D=w.url?u(w.url):"",L=new Ha({url:D,attributions:r.attributions,crossOrigin:a,wrapX:!0,minZoom:d,maxZoom:p,tileGrid:new ks({origin:Ae(s),resolutions:h.slice(d,p+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?vu(w.rectangle,"EPSG:4326","EPSG:3857"):s,P=new Vg({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 f.Destroyable{constructor(e,n){super();S(this,"_pickedEvent",this.disposeVar(new f.Event));S(this,"_flyToEvent",this.disposeVar(new f.Event));S(this,"_clickEvent",this.disposeVar(new f.Event));S(this,"_hovered",this.disposeVar(f.react(!1)));S(this,"_feature");S(this,"_source");S(this,"_layer");S(this,"_initialized",!1);const s=new Ke([]);this._feature=new Je({geometry:s}),this._feature.setId(n??f.createGuid());const o=e.viewer;if(!o)return;this._source=new en,this.dispose(()=>{var h;return(h=this._source)==null?void 0:h.dispose()}),this._layer=new bi({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(f.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=vt([this.position[0][0],this.position[0][1]]);s.setCoordinates(h);const l=this.radius??5,u=this.strokeWidth??2,d=this.fillColor??[255,255,255,1],p=this.strokeColor??[0,153/255,1,1],_=new de({color:`rgba(${d.map(E=>E*255).join(",")})`}),y=new Re({color:`rgba(${p.map(E=>E*255).join(",")})`,width:u}),w=new Kt({image:new ii({radius:l,fill:_,stroke:y})});this._feature.setStyle(w),this._source.addFeature(this._feature)};a();const c=this.disposeVar(f.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&&xi(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 p;if(!this.position)return;const s=vt([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 Re({color:`rgba(${h.map(_=>_*255).join(",")})`,width:a}),d=new Kt({image:new ii({radius:r,fill:l,stroke:u})});this._feature.setStyle(d),this._feature.set("visible",this.show??!0),(p=this._source)==null||p.addFeature(this._feature)};e();const n=f.createNextAnimateFrameEvent(this.positionChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged);this.dispose(n.disposableOn(e))}};S(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 He=sc;(i=>{i.createDefaultProps=()=>({show:void 0,position:f.reactArrayWithUndefined(void 0),editting:void 0,allowPicking:!1,pixelSize:void 0,color:f.reactArrayWithUndefined(void 0),outlineColor:f.reactArrayWithUndefined(void 0),outlineWidth:void 0,fillColor:f.reactArrayWithUndefined(void 0),strokeColor:f.reactArrayWithUndefined(void 0),strokeWidth:void 0,radius:void 0,zIndex:void 0})})(He||(He={})),f.extendClassProps(He.prototype,He.createDefaultProps);const oc=class oc extends f.Destroyable{constructor(e,n){super();S(this,"_flyToEvent",this.disposeVar(new f.Event));S(this,"_layer");S(this,"_feature");S(this,"_source");S(this,"_lineString");const s=new _i([]);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??f.createGuid()),this.d(()=>{var h;return(h=this._feature)==null?void 0:h.dispose()}),this._source=new en,this.d(()=>{var h;return(h=this._source)==null?void 0:h.dispose()}),this._layer=new bi({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(f.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(d=>vt([d[0],d[1]]));this.loop&&h.length>=3&&h.push(h[0]),this._feature.getGeometry().setCoordinates(h);const u=(d,p)=>{const _=[],y=new Re({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 Kt({stroke:y})),this.hasArrow&&h.length>=2){const[w,E]=h[h.length-2],[b,P]=h[h.length-1],I=jv(b-w,P-E);_.push(new Kt({geometry:new Ke([b,P]),image:new go({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(f.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)];xi(e,l)}))}get typeName(){return"OlPolyline"}get defaultProps(){return oc.createDefaultProps()}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}};S(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:f.reactPositions(void 0),loop:!1,width:2,color:f.reactArray([1,1,1,1]),hasDash:!1,dashLength:16,hasArrow:!1,arcType:"GEODESIC",depthTest:!1,zIndex:0,dashPattern:255,gapColor:f.reactArray([0,0,0,0])})})(Jt||(Jt={})),f.extendClassProps(Jt.prototype,Jt.createDefaultProps);function jv(i,t){const e=Math.atan2(t,i);return(Math.PI/2-e+2*Math.PI)%(2*Math.PI)}class kv extends f.Destroyable{constructor(e,n){super();S(this,"_geoPoint");S(this,"_geoAxis");this._geoPoint=this.disposeVar(new He(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 Li=class Li extends f.Destroyable{constructor(e,n){super();S(this,"_captureEvent",this.disposeVar(new f.Event));S(this,"_id",this.disposeVar(f.react(f.createGuid())));if(this._olViewer=e,n&&(this.id=n),!e.viewer)return;this.disposeVar(new f.ObjResettingWithEvent(this.showChanged,()=>{if(this.show&&this.position)return new kv(this,e)})),this.default&&this.flyTo(void 0,!1);const o=this.disposeVar(f.createProcessingFromAsyncFunc(async a=>{const{position:c,rotation:h,viewDistance:l,duration:u=1e3}=this;if(c){const d=xi(this._olViewer,c,l,h,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(f.createProcessingFromAsyncFunc(async(a,c,h)=>{var d,p;const l=(p=(d=this._olViewer).capture)==null?void 0:p.call(d,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??Li.defaults.thumbnailWidth,c??Li.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&Li.ResetFlag.Position&&(this.position=n.position),e&Li.ResetFlag.Rotation&&(this.rotation=n.rotation),e&Li.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&&xi(this._olViewer,s,r,o,e??a)}};S(Li,"ResetFlag",{Position:1,Rotation:2,ViewDistance:4,Zoom:10}),S(Li,"defaults",{thumbnailWidth:64,thumbnailHeight:64,enabled:!0,show:!1,position:[116.39,39.9,100],duration:1e3,default:!1,thumbnail:""});let Yn=Li;(i=>{i.createDefaultProps=()=>({enabled:!0,position:f.reactArrayWithUndefined(void 0),positionEditing:!1,show:!1,rotation:f.reactArray([0,0,0]),viewDistance:0,duration:void 0,default:!1,thumbnail:""})})(Yn||(Yn={})),f.extendClassProps(Yn.prototype,Yn.createDefaultProps);class Ai extends f.Destroyable{constructor(e,n){super();S(this,"_flyToEvent",this.disposeVar(new f.Event));S(this,"_feature");S(this,"_layer");S(this,"_source");const s=new gs([[]]);this._feature=new Je({geometry:s}),this._feature.setId(n??f.createGuid());const o=e.viewer;if(!o)return;this._source=new en,this.dispose(()=>{var h;return(h=this._source)==null?void 0:h.dispose()}),this._layer=new bi({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(f.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=np(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 Kt({fill:new de({color:ip(l)}),stroke:new Re({color:ip(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(f.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=np(this.positions),[u,d]=Wv(l),[p,_]=Zt([u,d]);xi(e,[p,_,0])}))}get typeName(){return"OlPolygon"}get defaultProps(){return Ai.createDefaultProps()}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}}(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:f.reactJsonWithUndefined(void 0),fillColor:f.reactArray([1,1,1,.4]),outlineColor:f.reactArray([1,1,1,1]),outlineWidth:1.5,hasDash:!1,dashLength:16,zIndex:0,stroked:!0,filled:!0})})(Ai||(Ai={})),f.extendClassProps(Ai.prototype,Ai.createDefaultProps);function ip(i){return`rgba(${i[0]*255}, ${i[1]*255}, ${i[2]*255}, ${i[3]})`}function np(i){const t=i.map(s=>vt([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 Wv(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 xl extends fs{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){this.flatCoordinates?On(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.changed()}clone(){const t=new xl(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,n,s){if(s<eo(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=Mn(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 Zi(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 Ke(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 Ke(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=Lr(this.flatCoordinates,0,t,this.stride),this.changed()}}const rc=class rc extends f.Destroyable{constructor(e,n){super();S(this,"_pickedEvent",this.disposeVar(new f.Event));S(this,"_flyToEvent",this.disposeVar(new f.Event));S(this,"_clickEvent",this.disposeVar(new f.Event));S(this,"_hovered",this.disposeVar(f.react(!1)));S(this,"_feature");S(this,"_source");S(this,"_layer");S(this,"_initialized",!1);const s=new xl([]);this._feature=new Je({geometry:s}),this._feature.setId(n??f.createGuid());const o=e.viewer;if(!o)return;this._source=new en,this.dispose(()=>{var h;return(h=this._source)==null?void 0:h.dispose()}),this._layer=new bi({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=>vt([b[0],b[1]]));if(!this._feature)return;const l=this._feature.getGeometry();l&&l.setCoordinates(h);const u=this.radius??5,d=this.strokeWidth??2,p=this.fillColor??[255,255,255,1],_=this.strokeColor??[0,153/255,1,1],y=new de({color:`rgba(${p.map(b=>b*255).join(",")})`}),w=new Re({color:`rgba(${_.map(b=>b*255).join(",")})`,width:d}),E=new Kt({image:new ii({radius:u,fill:y,stroke:w})});this._feature.setStyle(E),this._source.addFeature(this._feature)};a();const c=this.disposeVar(f.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 p;if(!this.points)return;const s=this.points.map(_=>vt([_[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 Re({color:`rgba(${h.map(_=>_*255).join(",")})`,width:a}),d=new Kt({image:new ii({radius:r,fill:l,stroke:u})});this._feature.setStyle(d),this._feature.set("visible",this.show??!0),(p=this._source)==null||p.addFeature(this._feature)};e();const n=f.createNextAnimateFrameEvent(this.pointsChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged);this.dispose(n.disposableOn(e))}};S(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:f.reactPositions(void 0),editting:void 0,allowPicking:!1,pixelSize:void 0,color:f.reactArrayWithUndefined(void 0),outlineColor:f.reactArrayWithUndefined(void 0),outlineWidth:void 0,fillColor:f.reactArrayWithUndefined(void 0),strokeColor:f.reactArrayWithUndefined(void 0),strokeWidth:void 0,radius:void 0,zIndex:void 0})})(_n||(_n={})),f.extendClassProps(_n.prototype,_n.createDefaultProps);class Xa extends f.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 $a extends Xa{constructor(e,n){super(e,n);S(this,"_smoothMoving");this._smoothMoving=this.dv(new f.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(f.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=f.getDistancesFromPositions([e.position,Qd(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:d,pDelta:p}=a;return this.flyToWithPromise(n,r,c,[h,l,0],e??u,d,p),!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 Rl extends $a{constructor(e,n){super(e,n);S(this,"_lastHoverResult",this.dv(f.react(void 0)));if(!n.viewer){console.warn("viewer is undefined!");return}this.ad(f.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 qv=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=f.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},Gv=i=>{let t;return i?(i.length<3?t=0:t=f.geoArea(i),t):0},Bv=i=>{let t;return i?(i.length<3?t=void 0:t=f.geoCenterOfMass(i),t):void 0},$o=class $o 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=ea(s);return Io(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=ea(s);return Io(this.olViewer.viewer,o,t),console.log("OlESGeoVector flyTo"),!0}return!0}};S($o,"type",$o.register("ESOlViewer",f.ESGeoVector.type,$o));let Ws=$o;class Hn extends f.Destroyable{constructor(e,n){super();S(this,"_flyToEvent",this.disposeVar(new f.Event));if(!e.viewer)return;const o=this.ad(new Ai(e,n)),r=this.ad(new Jt(e,n));r.loop=!0,this.ad(f.bind([r,"depthTest"],[this,"depthTest"])),this.d(f.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,d=.5]=this.color||[1,1,1,.5];o.fillColor=[h,l,u,d]};a();const c=this.disposeVar(f.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)}}S(Hn,"defaults",{viewDistanceRange:[1e3,1e4,3e4,6e4],positions:[]}),(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,outline:!0,strokeGround:!1,outlineColor:f.reactArray([1,1,1,1]),outlineWidth:2,ground:!1,fill:!0,color:f.reactArray([1,1,1,.5]),positions:f.reactPositions(void 0),viewDistanceRange:f.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,depthTest:!1})})(Hn||(Hn={})),f.extendClassProps(Hn.prototype,Hn.createDefaultProps);const Zo=class Zo extends Ws{constructor(e,n){super(e,n);S(this,"_geoPolygon");if(!n.viewer){console.warn("viewer is undefined!");return}this._geoPolygon=this.ad(new Ai(this.olViewer,e.id));const o=this.geoPolygon;o&&(this.d(f.track([o,"show"],[e,"show"])),this.d(f.track([o,"allowPicking"],[e,"allowPicking"])),this.d(f.bind([o,"positions"],[e,"points"])),this.d(f.track([o,"stroked"],[e,"stroked"])),this.d(f.track([o,"outlineColor"],[e,"strokeColor"])),this.d(f.track([o,"outlineWidth"],[e,"strokeWidth"])),this.d(f.track([o,"filled"],[e,"filled"])),this.d(f.track([o,"fillColor"],[e,"fillColor"])))}get geoPolygon(){return this._geoPolygon}};S(Zo,"type",Zo.register("ESOlViewer",f.ESGeoPolygon.type,Zo));let Za=Zo;function qo(i){var e;const t=(e=cl(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 qs extends f.Destroyable{constructor(e,n){super();S(this,"_pickedEvent",this.dv(new f.Event));S(this,"_flyToEvent",this.dv(new f.Event));S(this,"_area",this.dv(f.react(0)));S(this,"_centerOfMass",this.dv(f.reactArrayWithUndefined(void 0)));S(this,"_distances",this.dv(f.reactArray([])));S(this,"_geoPolyline");S(this,"_id",this.dv(f.react(f.createGuid())));n&&(this.id=n);{const s=()=>{this._distances.value=qv(this.positions),this._area.value=Gv(this.positions),this._centerOfMass.value=Bv(this.positions)};s();const o=this.dv(f.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(f.bind([s,"color"],[this,"color"])),this.dispose(f.bind([s,"dashLength"],[this,"dashLength"])),this.dispose(f.bind([s,"dashPattern"],[this,"dashPattern"])),this.dispose(f.bind([s,"gapColor"],[this,"gapColor"])),this.dispose(f.bind([s,"hasArrow"],[this,"hasArrow"])),this.dispose(f.bind([s,"hasDash"],[this,"hasDash"])),this.dispose(f.bind([s,"positions"],[this,"positions"])),this.dispose(f.bind([s,"show"],[this,"show"])),this.dispose(f.bind([s,"allowPicking"],[this,"allowPicking"])),this.dispose(f.bind([s,"width"],[this,"width"])),this.dispose(f.bind([s,"depthTest"],[this,"depthTest"]))}{const s=this.dv(new Hn(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(f.track([s,"show"],[this,"show"])),this.dispose(f.track([s,"ground"],[this,"ground"])),this.dispose(f.track([s,"allowPicking"],[this,"allowPicking"])),this.dispose(f.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(f.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=za([...a].join(`
162
- `))};r(),this.dispose(o.disposableOn(r)),this.dispose(f.track([s,"show"],[this,"show"])),this.dispose(f.track([s,"allowPicking"],[this,"allowPicking"])),this.dispose(f.bind([s,"shadowDom"],[this,"shadowDom"])),this.dispose(f.bind([s,"cssAllInitial"],[this,"cssAllInitial"])),this.dispose(f.track([s,"position"],[this,"centerOfMass"])),this.ad(s.pickedEvent.don(a=>{qo(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}}S(qs,"defaults",{positions:[]}),(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:f.reactPositions(void 0),width:2,color:f.reactArray([1,1,1,.5]),fillColor:f.reactArray([1,1,1,.5]),hasDash:!1,gapColor:f.reactArray([0,0,0,0]),dashLength:16,dashPattern:255,hasArrow:void 0,depthTest:!1,shadowDom:!1,cssAllInitial:!1,strokeGround:!0,ground:!0,units:f.reactArray(["SquareMeter_SquareKilometer","MU_Hectare","PerimeterMeter_PerimeterKilometer"])})})(qs||(qs={})),f.extendClassProps(qs.prototype,qs.createDefaultProps);const Ko=class Ko extends Za{constructor(e,n){super(e,n);S(this,"_olAreaMeasurement");if(this._olAreaMeasurement=this.disposeVar(new qs(n,e.id)),!n.viewer){console.warn("viewer is undefined!");return}e.strokeGround=!1,e.fillGround=!1;const o=this._olAreaMeasurement;this.dispose(f.track([o,"show"],[e,"show"])),this.dispose(f.track([o,"units"],[e,"units"])),this.dispose(f.track([o,"allowPicking"],[e,"allowPicking"])),this.dispose(f.bind([o,"positions"],[e,"points"])),this.dispose(f.bind([o,"strokeGround"],[e,"strokeGround"])),this.d(f.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(f.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(f.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}};S(Ko,"type",Ko.register("ESOlViewer",f.ESAreaMeasurement.type,Ko));let Sl=Ko;const Kn=class Kn extends f.Destroyable{constructor(e,n){super();S(this,"_pickedEvent",this.disposeVar(new f.Event));S(this,"_flyToEvent",this.disposeVar(new f.Event));S(this,"_heading",this.disposeVar(f.react(0)));S(this,"_textFunc",this.disposeVar(f.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=f.geoHeading(this.positions[0],this.positions[1]):this.arcType==="RHUMB"?h=f.geoRhumbHeading(this.positions[0],this.positions[1]):this.arcType==="NONE"?h=f.geoHeading(this.positions[0],this.positions[1]):console.warn(`未知的arcType: ${this.arcType},导致距离无法计算!`),this._heading.value=this.angleMode==="-180~180"?f.clampN180_180(h):f.clamp0_360(h)}};a();const c=this.disposeVar(f.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(f.track([o,"allowPicking"],[s,"allowPicking"])),this.dispose(f.bind([o,"arcType"],[s,"arcType"])),this.dispose(f.bind([o,"color"],[s,"color"])),this.dispose(f.bind([o,"dashLength"],[s,"dashLength"])),this.dispose(f.bind([o,"dashPattern"],[s,"dashPattern"])),this.dispose(f.bind([o,"gapColor"],[s,"gapColor"])),this.dispose(f.bind([o,"hasArrow"],[s,"hasArrow"])),this.dispose(f.bind([o,"hasDash"],[s,"hasDash"])),this.dispose(f.bind([o,"positions"],[s,"positions"])),this.dispose(f.bind([o,"show"],[s,"show"])),this.dispose(f.bind([o,"width"],[s,"width"])),this.dispose(f.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(f.bind([r,"shadowDom"],[s,"shadowDom"])),this.dispose(f.bind([r,"cssAllInitial"],[s,"cssAllInitial"])),this.dispose(f.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??Kn.defaultTextFunc_度格式)(h);r.innerHTML=za(`方向: ${l}`,24)};a();const c=this.disposeVar(f.createNextAnimateFrameEvent(s.headingChanged,s.textFuncChanged));this.dispose(c.disposableOn(a))}this.ad(r.pickedEvent.don(a=>{qo(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}};S(Kn,"defaultTextFunc_度格式",e=>`${e.toFixed(5)}°`),S(Kn,"defaultTextFunc_度分格式",e=>`${Na(e,!0)}`),S(Kn,"defaultTextFunc_度分秒格式",e=>`${Na(e,!1)}`),S(Kn,"defaults",{positions:[]});let Xn=Kn;(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:f.reactPositions(void 0),width:4,color:f.reactArray([1,1,1,1]),hasDash:!1,gapColor:f.reactArray([0,0,0,0]),dashLength:16,dashPattern:255,hasArrow:!0,arcType:"GEODESIC",depthTest:!1,shadowDom:!1,cssAllInitial:!1,angleMode:"-180~180",strokeGround:!1})})(Xn||(Xn={})),f.extendClassProps(Xn.prototype,Xn.createDefaultProps);const Qo=class Qo extends Ws{constructor(e,n){super(e,n);S(this,"_olDirectionMeasurement");if(this._olDirectionMeasurement=this.disposeVar(new Xn(n,e.id)),!n.viewer){console.warn("viewer is undefined!");return}const o=this._olDirectionMeasurement;o.angleMode="0~360",this.dispose(f.track([o,"show"],[e,"show"])),this.dispose(f.track([o,"allowPicking"],[e,"allowPicking"])),this.dispose(f.bind([o,"positions"],[e,"points"])),this.dispose(f.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(f.createNextAnimateFrameEvent(e.strokeStyleChanged,e.strokedChanged));this.dispose(a.disposableOn(r))}this.dispose(o.pickedEvent.disposableOn(r=>{qo(r)===0&&(e.allowPicking??!1)&&e.pickedEvent.emit(r)}))}get olDirectionMeasurement(){return this._olDirectionMeasurement}};S(Qo,"type",Qo.register("ESOlViewer",f.ESDirectionMeasurement.type,Qo));let Pl=Qo;function sp(i,t,e,n){const s=new Qt(e,n);return s.innerHTML=za(i),s.position=t,s.show=!0,s}class Gs extends f.Destroyable{constructor(e,n){super();S(this,"_pickedEvent",this.disposeVar(new f.Event));S(this,"_flyToEvent",this.disposeVar(new f.Event));S(this,"_distances",this.disposeVar(f.reactArray([])));const s=async()=>{this._distances.value=f.getDistancesFromPositions(this.positions??[],this.arcType)};s();const o=this.disposeVar(f.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(f.track([r,"allowPicking"],[this,"allowPicking"])),this.dispose(f.bind([r,"arcType"],[this,"arcType"])),this.dispose(f.bind([r,"color"],[this,"color"])),this.dispose(f.bind([r,"dashLength"],[this,"dashLength"])),this.dispose(f.bind([r,"dashPattern"],[this,"dashPattern"])),this.dispose(f.bind([r,"gapColor"],[this,"gapColor"])),this.dispose(f.bind([r,"hasArrow"],[this,"hasArrow"])),this.dispose(f.bind([r,"hasDash"],[this,"hasDash"])),this.dispose(f.bind([r,"positions"],[this,"positions"])),this.dispose(f.bind([r,"show"],[this,"show"])),this.dispose(f.bind([r,"width"],[this,"width"])),this.dispose(f.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=sp("起点",this.positions[0],e,n);u.dispose(f.track([u,"show"],[this,"show"])),u.dispose(f.track([u,"shadowDom"],[this,"shadowDom"])),u.dispose(f.track([u,"cssAllInitial"],[this,"cssAllInitial"])),a.push(u)}const l=this.distances.length;for(let u=0;u<l;++u){const d=this.distances[u],p=this.positions[u+1],_=sp(`长度: ${Og(d)}`,p,e,n);_.dispose(f.track([_,"show"],[this,"show"])),_.dispose(f.track([_,"shadowDom"],[this,"shadowDom"])),_.dispose(f.track([_,"cssAllInitial"],[this,"cssAllInitial"])),this.ad(_.pickedEvent.don(y=>{qo(y)===0&&this.pickedEvent.emit(y)})),a.push(_)}};h(),this.dispose(this.distancesChanged.disposableOn(()=>f.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}}S(Gs,"defaults",{positions:[]}),(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:f.reactPositions(void 0),width:1,color:f.reactArray([1,1,1,1]),hasDash:!1,gapColor:f.reactArray([0,0,0,0]),dashLength:16,dashPattern:255,hasArrow:!1,arcType:"GEODESIC",depthTest:!1,shadowDom:!1,cssAllInitial:!1,strokeGround:!1})})(Gs||(Gs={})),f.extendClassProps(Gs.prototype,Gs.createDefaultProps);const Jo=class Jo extends Ws{constructor(e,n){super(e,n);S(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(f.track([o,"allowPicking"],[e,"allowPicking"])),this.dispose(f.bind([o,"positions"],[e,"points"])),this.dispose(f.track([o,"width"],[e,"strokeWidth"])),this.dispose(f.track([o,"color"],[e,"strokeColor"])),this.dispose(f.track([o,"show"],[e,"show"]));{const r=()=>{o.show=e.show&&e.stroked};r();const a=this.disposeVar(f.createNextAnimateFrameEvent(e.showChanged,e.strokedChanged));this.dispose(a.disposableOn(r))}}get geoPolyline(){return this._geoPolyline}};S(Jo,"type",Jo.register("ESOlViewer",f.ESGeoLineString.type,Jo));let Go=Jo;const tr=class tr extends Go{constructor(e,n){super(e,n);S(this,"_olDistanceMeasurement");if(console.log("OlESDistanceMeasurement constructor",n.viewer),this._olDistanceMeasurement=this.disposeVar(new Gs(n,e.id)),!n.viewer){console.warn("viewer is undefined!");return}const{olDistanceMeasurement:o}=this;this.dispose(f.track([o,"show"],[e,"show"])),this.dispose(f.track([o,"allowPicking"],[e,"allowPicking"])),this.dispose(f.bind([o,"positions"],[e,"points"])),this.dispose(f.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(f.createNextAnimateFrameEvent(e.strokeStyleChanged,e.strokedChanged));this.dispose(a.disposableOn(r))}this.dispose(o.pickedEvent.disposableOn(r=>{qo(r)===0&&(e.allowPicking??!1)&&e.pickedEvent.emit(r)}))}get olDistanceMeasurement(){return this._olDistanceMeasurement}};S(tr,"type",tr.register("ESOlViewer",f.ESDistanceMeasurement.type,tr));let Ol=tr;function op(i){const t=f.min(f.objsIterator(i,["0"])),e=f.min(f.objsIterator(i,["1"])),n=f.max(f.objsIterator(i,["0"])),s=f.max(f.objsIterator(i,["1"]));return{minPos:[t,e],maxPos:[n,s]}}function Yv(i){const t=i.map(o=>vt(o)),{minPos:e,maxPos:n}=op(t),s=[.5*(e[0]+n[0]),.5*(e[1]+n[1])];return Zt(s)}function Hv(i,t,e){const n=vt(e),s=vt(t),o=[s[0]-n[0],s[1]-n[1]];return i.map(c=>vt(c)).map(c=>[c[0]+o[0],c[1]+o[1]]).map(c=>Zt(c))}const Qn=class Qn extends f.ESObjectWithLocation{getESProperties(){const t={...super.getESProperties()};return{...t,coordinate:[...t.coordinate,new f.NumberProperty([this,"distance"],"长度",0,!1,!0)],style:[new f.GroupProperty([],"点样式","点样式集合"),new f.BooleanProperty([this,"pointed"],"开启",!1),new f.NumberProperty([this,"pointSize"],"点大小",1),new f.EnumProperty([this,"pointSizeType"],[["screen","screen"],["world","world"]],"点类型","screen"),new f.ColorProperty([this,"pointColor"],"点颜色",[1,1,1,1])],basic:[...t.basic,new f.EnumProperty([this,"mode"],[["柱状警告","cylinder"],["圆形警告","circle"]],"模式","cylinder"),new f.NumberProperty([this,"radius"],"半径",10)]}}constructor(t){super(t)}};S(Qn,"createDefaultProps",()=>({...f.ESObjectWithLocation.createDefaultProps(),pointed:!0,pointStyle:f.reactJson({size:1,sizeType:"screen",color:[1,1,1,1],material:"",materialParams:{},outlineColor:[1,0,0,1],outlineWidth:2})})),S(Qn,"type",Qn.register("ESGeoPoint",Qn,{chsName:"地理点",tags:["ESObjects","_ES_Impl_Openlayers"],description:"地理点"})),S(Qn,"supportEditingModes",[...f.ESObjectWithLocation.supportEditingModes]);let Ka=Qn;const Hs=class Hs extends f.ESVisualObject{getESProperties(){const t={...super.getESProperties()};return{...t,basic:[...t.basic,new f.NumberProperty([this,"zIndex"],"层级序号",0),new f.JsonProperty([this,"url"],"影像服务地址")]}}constructor(t){super(t)}};S(Hs,"createDefaultProps",()=>({...f.ESVisualObject.createDefaultProps(),attributions:f.reactArrayWithUndefined(void 0),attributionsCollapsible:void 0,cacheSize:void 0,crossOrigin:void 0,interpolate:void 0,projection:f.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:f.reactJsonWithUndefined(void 0),tileLoadFunction:void 0,tilePixelRatio:void 0,url:void 0,urls:f.reactArrayWithUndefined(void 0),wrapX:void 0,transition:void 0,zDirection:void 0,zIndex:void 0})),S(Hs,"type",Hs.register("ESXYZLayer",Hs,{chsName:"OL简单xyz图层",tags:[],description:"ESXYZLayer"}));let Qa=Hs;const ce=Math.PI,rp=6378245,ap=.006693421622965943;function cp(i,t){let e=Xv(i-105,t-35),n=$v(i-105,t-35);const s=t/180*ce;let o=Math.sin(s);o=1-ap*o*o;const r=Math.sqrt(o);return e=e*180/(rp*(1-ap)/(o*r)*ce),n=n*180/(rp/r*Math.cos(s)*ce),[n,e]}function hp(i,t){return i<72.004||i>137.8347||t<.8293||t>55.8271}function Xv(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 $v(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 lp=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:lp(function(i,t,e){let n=i[e],s=i[e+1];if(!hp(n,s)){const o=cp(n,s);n=n-o[0],s=s-o[1]}t[e]=n,t[e+1]=s}),fromWGS84:lp(function(i,t,e){let n=i[e],s=i[e+1];if(!hp(n,s)){const o=cp(n,s);n=n+o[0],s=s+o[1]}t[e]=n,t[e+1]=s})},_e={ll2smerc:Dn("EPSG:4326","EPSG:3857"),smerc2ll:Dn("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 Il=new vc({code:"GCJ-02",extent:[-20037508342789244e-9,-20037508342789244e-9,20037508342789244e-9,20037508342789244e-9],units:"m"});pu(Il),wu("EPSG:4326",Il,_e.ll2gmerc,_e.gmerc2ll),wu("EPSG:3857",Il,_e.smerc2gmerc,_e.gmerc2smerc);class Zv extends f.Destroyable{constructor(t,e){super();const n=e.viewer;if(!n){console.warn("map is undefined!");return}const s=Ti(n);if(!s)return;const{imageriesManager:o}=s,r=Gt("EPSG:3857");if(!r)return;const a=r.getExtent(),c=_t(a)/256,h=new Array(19),l=new Array(19);for(let p=0;p<19;++p)h[p]=c/Math.pow(2,p),l[p]=p;const u=new Ha({tileGrid:new ks(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 d=new Ba({source:u});o.add(d),this.dispose(()=>o.delete(d)),d.setVisible(t.show??!0),this.dispose(()=>d.dispose()),this.dispose(t.showChanged.disposableOn(p=>{d.setVisible(p??!0)})),this.d(f.createEventsCallFunc(t.zIndexChanged,()=>{o.setZindex(d,t.zIndex??0)},{immediate:!0}));{const p=()=>{u.tileGrid=new ks(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(f.createNextAnimateFrameEvent(t.attributionsChanged,t.tileGridChanged,t.tileLoadFunctionChanged,t.tileUrlFunctionChanged));this.dispose(_.disposableOn(p))}t.urlChanged.disposableOn(p=>{u.setUrl(p??"")}),t.urlsChanged.disposableOn(p=>{u.setUrls(p??[])})}}const er=class er extends Xa{constructor(t,e){super(t,e);let n;this.dispose(()=>n&&n.destroy());{const s=()=>{n&&n.destroy(),n=new Zv(t,e)};s();const o=this.disposeVar(f.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))}}};S(er,"type",er.register(li.type,Qa.type,er));let Tl=er;const ir=class ir extends $a{constructor(e,n){super(e,n);S(this,"_geoPoint");if(this._geoPoint=this.disposeVar(new He(n,e.id)),!n.viewer){console.warn("viewer is undefined!");return}const o=this._geoPoint;this.d(f.track([o,"allowPicking"],[e,"allowPicking"])),this.d(f.bind([o,"position"],[e,"position"])),this.d(f.track([o,"show"],[e,"show"]));{const r=()=>{o.show=e.show&&e.pointed};r();const a=this.dv(f.createNextAnimateFrameEvent(e.showChanged,e.pointedChanged));this.d(a.don(r))}}get geoPoint(){return this._geoPoint}};S(ir,"type",ir.register("ESOlViewer",Ka.type,ir));let Al=ir;const nr=class nr extends Ws{constructor(e,n){super(e,n);S(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(f.track([s,"allowPicking"],[e,"allowPicking"])),this.d(f.bind([s,"points"],[e,"points"]));{const r=()=>{s.show=e.show&&e.pointed};this.d(f.createEventsCallFunc([e.showChanged,e.pointedChanged],r,{immediate:!0}))}}get geoPoints(){return this._geoPoints}};S(nr,"type",nr.register("ESOlViewer",f.ESGeoPoints.type,nr));let Ml=nr;class up extends f.Destroyable{constructor(e,n){super();S(this,"_olGeoCanvasImagePoi");S(this,"flyTo",(e,n)=>{if(this.olGeoCanvasImagePoi.position){xi(this.olViewer,this.olGeoCanvasImagePoi.position,1e3,Zd,e);return}this.olGeoCanvasImagePoi.flyTo(e&&e*1e3)});this.sceneObject=e,this.olViewer=n,this._olGeoCanvasImagePoi=this.dv(new hi(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]),f.ESSceneObject.context.getStrFromEnv(f.rpToap(u))},r=()=>{const l=o(typeof e.url=="string"?e.url:e.url.url);if(s.imageUri=l,e.sizeByContent){const d=new Image;d.src=l,d.onload=()=>{s.size=[d.width,d.height]}}else{const d=e.size;s.size=[...d]}},a=this.disposeVar(f.createNextAnimateFrameEvent(e.urlChanged,e.sizeByContentChanged,e.sizeChanged));this.d(a.don(()=>r())),r(),this.d(f.track([s,"zOrder"],[e,"zOrder"])),this.d(f.track([s,"show"],[e,"show"])),this.d(f.bind([s,"position"],[e,"position"])),this.ad(f.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(f.createNextAnimateFrameEvent(e.anchorChanged,e.offsetChanged));this.d(h.don(()=>c())),c(),this.d(s.clickEvent.don(l=>{const{offsetX:u,offsetY:d}=l,_={type:l.button===0?"leftClick":l.button===2?"rightClick":void 0,add:{mousePos:[u,d]}};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 sr=class sr extends Rl{constructor(e,n){super(e,n);S(this,"_resetting");if(!n.viewer){console.warn("viewer is undefined!");return}const o=this.dv(f.createNextAnimateFrameEvent(this.sceneObject.urlChanged,this.sceneObject.screenRenderChanged,this.sceneObject.sizeByContentChanged,this.sceneObject.sizeChanged));this._resetting=this.dv(new f.ObjResettingWithEvent(o,()=>new up(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}};S(sr,"type",sr.register("ESOlViewer",f.ESImageLabel.type,sr));let Dl=sr;function dp(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 or=class or extends Xa{constructor(e,n){super(e,n);S(this,"_olImagery");if(!n.viewer){console.warn("viewer is undefined!");return}const o=this.dv(new ep(n,e.id));this._olImagery=o;const r=this.ad(f.reactJson(""));{const l=()=>{if(typeof e.url=="string")r.value=f.ESSceneObject.context.getStrFromEnv(e.url);else{const u=e.url;u.url=f.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 d={type:"UrlTemplateImageryProvider",url:r.value,rectangle:e.rectangle,maximumLevel:e.maximumLevel,minimumLevel:e.minimumLevel,...u},p=r.value,_=typeof p=="string"?p:p.url;const y=_.toLowerCase();if(dp(l)==="auto")if(y.startsWith("ion://")){const P=+y.substring(6);d={...u,assetId:P,type:"IonImageryProvider"}}else if(y.includes("{x}")||y.includes("{y}")||y.includes("{z}"))d.type="UrlTemplateImageryProvider";else if(y.includes("wmts"))d.type="WebMapTileServiceImageryProvider";else if(y.includes("wms"))d.type="WebMapServiceImageryProvider";else{if(_.includes("/tilemapresource.xml")){const b=_.split("/tilemapresource.xml").join("");typeof p=="string"?p=b:p.url=b,d.url=p}d.type="TileMapServiceImageryProvider"}else{if(l==="tms"&&_.includes("/tilemapresource.xml")){const P=_.split("/tilemapresource.xml").join("");typeof p=="string"?p=P:p.url=P,d.url=p}else if(l==="ion"&&y.startsWith("ion://")){const I=+_.substring(6);d={...u,assetId:I,type:"IonImageryProvider"}}const b=dp(l);b!=="auto"&&(d.type=b)}if(d.type==="WebMapTileServiceImageryProvider"){let b=typeof p=="string"?p:p.url;const P=b.indexOf("?");if(P>=0){const z=new URLSearchParams(b.substring(P+1)),q=z.get("format")||z.get("Format")||d.format;d.format=q||"image/png",b=b.substring(0,P)}else d.format=d.format??"image/png";const I=(E=/\/wmts\/rest\/([^/]+)\//i.exec(b))==null?void 0:E[1];I?d.layer=d.layer??d.layers??I:d.layer=d.layer??d.layers??"";const M=d.tileMatrixSetID||d.TileMatrixSet||"EPSG:4326";let D=d.tileMatrixLabels||d.TileMatrixLabels;(!D||!Array.isArray(D)||D.length===0)&&(D=Array.from({length:22},(z,q)=>`${M}:${q}`)),d.tileMatrixSetID=M,d.tileMatrixLabels=D,d.style=d.style??"default";const L=b.toLowerCase().indexOf("/wmts/");if(L>=0){const z=b.substring(0,L);d.url=`${z}/wmts`;const q=typeof p=="string"?p:p.url,Y=/\/wmts\/rest\/([^/]+)\//i.exec(q);Y&&Y[1]&&(d.layer=Y[1]),d._rawUrl=q}else{d.url=b;const z=typeof p=="string"?p:p.url,q=/\/wmts\/rest\/([^/]+)\//i.exec(z);q&&q[1]&&(d.layer=q[1]),d._rawUrl=z}d.requestEncoding="KVP",d.requestencoding="KVP",d.params=void 0}else if(d.type==="WebMapServiceImageryProvider"){const b=d.layer??d.layers??"",P=d.style??"",I=d.format??"image/png";d.params={...d.params??{},LAYERS:b,STYLES:P,FORMAT:I,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 c=[r.changed,e.maximumLevelChanged,e.minimumLevelChanged,e.optionsChanged,e.rectangleChanged],h=this.dv(f.createNextAnimateFrameEvent(...c));this.d(h.don(a)),this.d(f.track([o,"show"],[e,"show"])),this.d(f.track([o,"splitDirection"],[e,"splitDirection"])),this.d(f.track([o,"brightness"],[e,"czmBrightness"])),this.d(f.track([o,"contrast"],[e,"czmContrast"])),this.d(f.track([o,"hue"],[e,"czmHue"])),this.d(f.track([o,"saturation"],[e,"czmSaturation"])),this.d(f.track([o,"gamma"],[e,"czmGamma"])),this.d(f.track([o,"rectangle"],[e,"rectangle"])),this.d(f.track([o,"zIndex"],[e,"zIndex"])),this.d(f.bind([o,"alpha"],[e,"opacity"])),this.d(f.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}};S(or,"type",or.register("ESOlViewer",f.ESImageryLayer.type,or));let Fl=or;function fp(i,t=!1){const e=Na(i[0],t),n=Na(i[1],t),s=Og(i[2]);return[e,n,s]}const ze=class ze extends $a{constructor(e,n){super(e,n);S(this,"_geoCustomDivPoi");S(this,"_textFunc",this.disposeVar(f.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(f.track([o,"show"],[e,"show"])),this.dispose(f.bind([o,"position"],[e,"position"])),this.dispose(f.track([o,"allowPicking"],[e,"allowPicking"]));{this.dispose(o.pickedEvent.disposableOn(r=>{(e.allowPicking??f.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=za(c)};r();const a=this.disposeVar(f.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}};S(ze,"type",ze.register("ESOlViewer",f.ESLocationMeasurement.type,ze)),S(ze,"defaultTextFunc_度格式",e=>{if(!e)return"";const[n=0,s=0,o=0]=e;return`经度: ${n.toFixed(5)}°
163
- 纬度: ${s.toFixed(5)}°`}),S(ze,"defaultTextFunc_度分格式",e=>{if(!e)return"";const[n,s,o]=fp(e,!0);return`经度: ${n}
164
- 纬度: ${s}`}),S(ze,"defaultTextFunc_度分秒格式",e=>{if(!e)return"";const[n,s,o]=fp(e);return`经度: ${n}
165
- 纬度: ${s}`});let Ll=ze;class Bo extends fs{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()),On(r,l.getFlatCoordinates()),a.push(r.length)}this.setFlatCoordinates(s,r),this.ends_=a}}appendLineString(t){this.flatCoordinates?On(this.flatCoordinates,t.getFlatCoordinates().slice()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Bo(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,n,s){return s<eo(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Su(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Pu(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,N0(this.flatCoordinates,0,this.ends_,this.stride,t,e,n))}getCoordinates(){return ao(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new _i(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 _i(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=Nu(e,n,c,o,.5);On(t,h),n=c}return t}getSimplifiedGeometryInternal(t){const e=[],n=[];return e.length=S0(this.flatCoordinates,0,this.ends_,this.stride,t,e,0,n),new Bo(e,"XY",n)}getType(){return"MultiLineString"}intersectsExtent(t){return M0(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const n=Ou(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}}function Vo(i,t){const[e,n]=i,[s,o]=t;return Math.sqrt(Math.pow(e-s,2)+Math.pow(n-o,2))}function Yo(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 Kv(i,t,e){let n=1/0,s=0,o=0,r=0;for(let p=0;p<i.length-1;p++){const[_,y]=i[p],[w,E]=i[p+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=p,o=Y)}for(let p=0;p<s;p++)r+=Vo(i[p],i[p+1]);r+=o*Vo(i[s],i[s+1]);const a=r+e;let c=0;for(let p=0;p<i.length-1;p++)c+=Vo(i[p],i[p+1]);let h=0;if(a<=0){const p=tc([i[0],i[1]],!0);return{point:Yo(i[0],p+180,Math.abs(a)),angle:p,isValid:!1}}for(let p=0;p<i.length-1;p++){const _=Vo(i[p],i[p+1]);if(h+_>=a){const w=(a-h)/_,[E,b]=i[p],[P,I]=i[p+1],M=[E+w*(P-E),b+w*(I-b)],D=tc([i[p],i[p+1]],!0);return{point:M,angle:D,isValid:!0}}h+=_}const l=i.length-1,u=tc([i[l-1],i[l]],!0),d=a-h;return{point:Yo(i[l],u,d),angle:u,isValid:!1}}function gp(i,t,e,n,s){let o=Vo(i,t),r=tc([i,t],!0);const a=s-n;if(a>0&&o>a){const[c,h]=Yo(i,r,a);return e.push([c,h,r,!0]),gp([c,h],t,e,0,s)}else return o+n}function pp(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=gp(a,c,n,s,e),s=s%e,n.push([...c,0,!1])}return n}const rr=class rr extends Go{constructor(e,n){super(e,n);S(this,"animationId",null);S(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});S(this,"offset",this.sceneObject.strokeWidth*this.options.ARROW_OFFSET_RATIO*window.devicePixelRatio);S(this,"eventsKey",null);const s=n.viewer;if(!s)return;const o=this.geoPolyline._layer;this.d(()=>this.clear()),this.d(f.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 d;const{ARROW_LINE_WIDTH_RATIO:n,ARROW_OFFSET_RATIO:s,ARROW_LINE_COLOR:o}=this.options,r=Od(e),a=e.target,c=r.transform_,h=r.context_,l=a.getSource(),u=(d=e.frameState)==null?void 0:d.extent;e.frameState&&(e.frameState.animate=!0),!(!l||!u)&&l.forEachFeatureInExtent(u,p=>{const _=p.getGeometry();let y;_ instanceof Bo?y=_.getLineStrings():_ instanceof _i&&(y=[_]),y&&y.forEach(w=>{const E=w.getFlatCoordinates(),b=mi(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=pp(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=Yo([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),R=L-Y*Math.sin(X-45*Math.PI/180);h.beginPath(),h.moveTo(Q,m),h.lineTo(D,L),h.lineTo(v,R),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=Od(e),h=e.target,l=c.transform_,u=c.context_,d=h.getSource(),p=(_=e.frameState)==null?void 0:_.extent;e.frameState&&(e.frameState.animate=!0),!(!d||!p)&&d.forEachFeatureInExtent(p,y=>{const w=y.getGeometry();let E;w instanceof Bo?E=w.getLineStrings():w instanceof _i&&(E=[w]),E&&E.forEach(b=>{const P=b.getFlatCoordinates(),I=mi(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=pp(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=Kv(M,[z,q],Q);if(!m.isValid)continue;const[v,R]=m.point,A=m.angle,F=Yo([v,R],A-180,5),N=this.sceneObject.strokeWidth*.5*window.devicePixelRatio,G=Math.atan2(R-F[1],v-F[0]),B=v-N*Math.cos(G+45*Math.PI/180),Z=R-N*Math.sin(G+45*Math.PI/180),V=v-N*Math.cos(G-45*Math.PI/180),at=R-N*Math.sin(G-45*Math.PI/180);u.beginPath(),u.moveTo(B,Z),u.lineTo(v,R),u.lineTo(V,at),u.stroke()}})})})}};S(rr,"type",rr.register(li.type,f.ESPath.type,rr));let zl=rr;const ar=class ar extends Rl{constructor(e,n){super(e,n);S(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(f.createNextAnimateFrameEvent(e.anchorChanged,e.offsetChanged));this.dispose(r.disposableOn(()=>o())),o(),this.dispose(f.track([s,"zOrder"],[e,"zOrder"])),this.dispose(f.track([s,"show"],[e,"show"])),this.dispose(f.bind([s,"text"],[e,"text"])),this.dispose(f.track([s,"color"],[e,"color"])),this.dispose(f.track([s,"backgroundColor"],[e,"backgroundColor"])),this.dispose(f.bind([s,"textEditingInteraction"],[e,"textEditingInteraction"])),this.dispose(f.bind([s,"textEditing"],[e,"textEditing"])),this.dispose(f.bind([s,"position"],[e,"position"])),this.dispose(f.track([s,"width"],[e,"width"])),this.dispose(f.track([s,"opacity"],[e,"opacity"])),this.dispose(f.track([s,"padding"],[e,"padding"])),this.dispose(f.track([s,"borderRadius"],[e,"borderRadius"])),this.dispose(f.track([s,"borderColor"],[e,"borderColor"])),this.dispose(f.track([s,"borderWidth"],[e,"borderWidth"])),this.dispose(f.track([s,"textAlign"],[e,"textAlign"])),this.dispose(f.track([s,"fontSize"],[e,"fontSize"])),this.dispose(f.track([s,"borderStyle"],[e,"borderStyle"])),this.dispose(f.track([s,"pickOnClick"],[e,"allowPicking"]));{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=cl(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}};S(ar,"type",ar.register(li.type,f.ESTextLabel.type,ar));let Nl=ar;const Jn=class Jn extends le{constructor(e){super();S(this,"_config",this.disposeVar(f.react(Jn.defaultConfig)));S(this,"_overEvent",this.disposeVar(new f.Event));S(this,"_pointerEventFilterFunc",this.disposeVar(f.react(Jn.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 He(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 f.ObjResettingWithEvent(this.enabledChanged,()=>this.enabled?new Qv(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}};S(Jn,"defaultConfig",{clickEnabled:!0,dblClickEnabled:!0}),S(Jn,"defaultPointerEventFilterFunc",e=>e.button===0),S(Jn,"defaults",{...le.defaults,position:[116.39,39.9,0]});let Mi=Jn;(i=>{i.createDefaultProps=()=>({...le.createDefaultProps(),position:f.reactArrayWithUndefined(void 0),virtualHeight:void 0,clickEnabled:!0,dblClickEnabled:!1})})(Mi||(Mi={})),f.extendClassProps(Mi.prototype,Mi.createDefaultProps);class Qv extends f.Destroyable{constructor(e,n){super();S(this,"_doings",[]);S(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 Jv(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 Jv extends f.Destroyable{constructor(t,e,n){super(),this._owner=t;const{olViewer:s}=this._owner;if(!s)return;const o=Jd(s,e,this._owner.placeEditing.virtualHeight),[r]=f.getEventFromPromise(o);this.dispose(r.disposableOn(n))}}class Pe extends le{constructor(){super()}}S(Pe,"defaults",{...le.defaults,position:[116.39,39.9,0]}),(i=>{i.createDefaultProps=()=>({...le.createDefaultProps(),position:f.reactArrayWithUndefined(void 0)})})(Pe||(Pe={})),f.extendClassProps(Pe.prototype,Pe.createDefaultProps);function mp(i,t){const e=new Jt(i);return e.hasArrow=!0,e.arcType="RHUMB",e.width=4,e.color=t,e}const zi=class zi extends f.Destroyable{constructor(t){if(super(),!t.viewer)return;const e=this.disposeVar(mp(t,zi.defaults.xAxisColor)),n=this.disposeVar(mp(t,zi.defaults.yAxisColor));{const s=()=>{e.show=this.xAxisShow&&this.show,n.show=this.yAxisShow&&this.show};s();const o=this.ad(f.createNextAnimateFrameEvent(this.showChanged,this.xAxisShowChanged,this.yAxisShowChanged));this.dispose(o.disposableOn(s))}{const s=()=>{var p;const{position:r=zi.defaults.position,heading:a=zi.defaults.heading}=this,l=((p=t.viewer)==null?void 0:p.getView().getResolution())*65,u=f.geoRhumbDestination(r,l,90+a),d=f.geoRhumbDestination(r,l,0+a);u&&(e.positions=[r,u]),d&&(n.positions=[r,d])};s();const o=this.disposeVar(f.createNextAnimateFrameEvent(this.positionChanged,this.dimensionsChanged,this.headingChanged));this.dispose(o.disposableOn(s))}{const s=()=>{e.color=this.xAxisColor??zi.defaults.xAxisColor,n.color=this.yAxisColor??zi.defaults.yAxisColor};s();const o=this.disposeVar(f.createNextAnimateFrameEvent(this.xAxisColorChanged,this.yAxisColorChanged));this.dispose(o.disposableOn(s))}}};S(zi,"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=zi;(i=>{i.createDefaultProps=()=>({show:!0,position:f.reactArrayWithUndefined(void 0),heading:0,dimensions:f.reactArray([1e3,1e3,1e3]),xAxisColor:f.reactArray([1,0,0,1]),yAxisColor:f.reactArray([0,1,0,1]),xAxisShow:!0,yAxisShow:!0})})(yn||(yn={})),f.extendClassProps(yn.prototype,yn.createDefaultProps);class ui extends f.Destroyable{constructor(e,n){super();S(this,"_flyToEvent",this.disposeVar(new f.Event));S(this,"_layer");S(this,"_source");const s=e.viewer;if(!s)return;this._source=new en,this._layer=new bi({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(d=>vt([d[0],d[1]]));this.loop&&h.length>=3&&h.push(h[0]);const l=new _i(h),u=new Je({geometry:l});u.setId(f.createGuid()),u.setStyle(new Kt({stroke:new Re({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(f.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)];xi(e,h)}))}get typeName(){return"OlPolylines"}get defaultProps(){return ui.createDefaultProps()}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}}(i=>{i.createDefaultProps=()=>({show:!0,positions:f.reactPositionsSet(void 0),width:2,color:f.reactArray([1,1,1,1]),loop:!1,hasDash:!1,dashLength:16,arcType:"GEODESIC",topOrBottom:"none"})})(ui||(ui={})),f.extendClassProps(ui.prototype,ui.createDefaultProps);const vn=class vn extends Pe{constructor(e){super();S(this,"_opInfo",{step:this.ad(f.react(!1)),moved:this.ad(f.react(!1)),constraintMode:this.ad(f.react("none")),originPosition:this.disposeVar(f.reactArray(Pe.defaults.position)),originHeading:this.disposeVar(f.react(0)),originDimensions:this.disposeVar(f.reactArray([1,1,1])),draggingStartPosition:this.disposeVar(f.reactArray([0,0,0])),movingPosition:this.disposeVar(f.reactArray([0,0,0])),targetPosition:this.disposeVar(f.reactArray([0,0,0])),targetHeading:this.disposeVar(f.react(0))});S(this,"_createCoordinates",e=>{const n=this.ad(new yn(e));this.dispose(this._opInfo.step.changed.disposableOn(()=>{_p(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});S(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});S(this,"_createGrid",e=>{const n=this.ad(new ui(e));{const s=()=>{var d;const r=this._opInfo.originPosition.value,a=this._opInfo.originHeading.value,h=((d=e.viewer)==null?void 0:d.getView().getResolution())*15,l=h*5,u=[];for(let p=-4;p<5;++p){const _=f.geoRhumbDestination(r,p*h,a+90);if(_){const y=f.geoRhumbDestination(_,l,a+180),w=f.geoRhumbDestination(_,l,a);y&&w&&u.push([y,_,w])}}for(let p=-4;p<5;++p){const _=f.geoRhumbDestination(r,p*h,a);if(_){const y=f.geoRhumbDestination(_,l,a-90),w=f.geoRhumbDestination(_,l,a+90);y&&w&&u.push([y,_,w])}}n.positions=u};s();const o=this.disposeVar(f.createNextAnimateFrameEvent(this._opInfo.originPosition.changed,this._opInfo.originHeading.changed,this._opInfo.originDimensions.changed));this.dispose(o.disposableOn(s))}return n});S(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(f.createNextAnimateFrameEvent(this._opInfo.originPosition.changed,this._opInfo.targetPosition.changed));this.ad(o.don(s))}return n});S(this,"_createCircle",e=>{const n=this.ad(new ui(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(f.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 d=0;d<=l;++d){const p=d*360/l,_=f.geoRhumbDestination(r,c,p);_&&h.push(_)}h.length>0&&h.push(h[0]),n.positions=[h]};return o(),this.dispose(s.disposableOn(o)),n});S(this,"_pickingXYProcessing",e=>this.ad(new f.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=Zt(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];f.geoRhumbDestination(r,o,s,u),this._opInfo.targetPosition.value=u})})));if(!e.viewer)return;const n=this.ad(f.reactArray([1,1,1]));this.ad(e.dblclickEvent.don(()=>this.enabled=!1)),this.ad(new sf(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 d=()=>{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};d();const p=this.ad(f.createNextAnimateFrameEvent(this.enabledChanged,this.showCircleChanged,this.showCoordinatesChanged,this._opInfo.moved.changed));this.ad(p.don(d))}{const d=()=>{s.xAxisShow=o.xAxisShow=this.xAxisShow,s.yAxisShow=o.yAxisShow=this.yAxisShow};d();const p=this.ad(f.createNextAnimateFrameEvent(this.xAxisShowChanged,this.yAxisShowChanged));this.ad(p.don(d))}{const d=()=>{r.color=this._opInfo.constraintMode.value!=="none"?[1,1,0,.6]:[1,1,0,.3],_p(s,this._opInfo.constraintMode.value,this._opInfo.step.value)};d(),this.dispose(this._opInfo.constraintMode.changed.disposableOn(d))}const h=this._pickingXYProcessing(e),l=this.ad(f.createProcessingFromAsyncFunc(async d=>{do this._opInfo.step.value=!0,this._opInfo.constraintMode.value="none",d.disposer.dispose(()=>{this._opInfo.constraintMode.value="none"}),await f.step(d,async p=>{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;p.disposer.dispose((_(),this.positionChanged.don(_))),p.disposer.dispose((y(),this.headingChanged.don(y))),p.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&&tf(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};p.disposer.dispose(e.pointerMoveEvent.don(P=>{P.pointerEvent&&b(P.pointerEvent)})),await f.step(p,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 f.step(d,async p=>{if(e.incrementDisabledInputStack(),console.log("检查地图交互编辑模式",e.disabledInputStack),p.disposer.dispose(()=>{e.decrementDisabledInputStack()}),["xy","x","y"].includes(this._opInfo.constraintMode.value)){const _=f.geoRhumbHeading(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value),y=f.geoRhumbDistance(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value);h.restart(void 0,_,y),p.disposer.dispose(()=>h.cancel())}else console.warn(`pickingInfo.constraintMode error! ${this._opInfo.constraintMode.value}`);await f.step(p,_=>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))}}};S(vn,"defaults",{...Pe.defaults,heading:0,dimensions:[200,200,200],xAxisColor:[1,0,0,1],yAxisColor:[0,1,0,1]});let Di=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})})(Di||(Di={})),f.extendClassProps(Di.prototype,Di.createDefaultProps);function _p(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 Bs extends f.Destroyable{constructor(e){super();S(this,"_vectorLayer");S(this,"_feature");S(this,"_circleCanvas");S(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,d;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(),(d=(u=this._feature)==null?void 0:u.changed)==null||d.call(u)};e();const n=this.ad(f.createNextAnimateFrameEvent(this.colorChanged,this.circleRotationChanged,this.circleStartRotationChanged,this.circleEndRotationChanged));this.ad(n.don(e))}_createVectorLayer(e){var o;const n=new en;this._feature=new Je({geometry:new Ke([0,0])});const s=()=>this._circleCanvas?new Kt({image:new Eo({img:this._circleCanvas,imgSize:[256,256],anchor:[.5,.5],anchorXUnits:"fraction",anchorYUnits:"fraction",scale:(this.pixelSize??300)/256}),text:new po({text:"",font:"0px console"})}):new Kt;this._feature.setStyle(s),n.addFeature(this._feature),this._vectorLayer=new bi({source:n,zIndex:1e3});{const r=()=>{if(!this.position||!this._feature)return;const a=vt([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 en;this._debugFeature=new Je({geometry:new Ke([0,0])}),this._debugFeature.setStyle(new Kt({image:new ii({radius:5,fill:new de({color:"red"})})})),n.addFeature(this._debugFeature);const s=new bi({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=vt([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)})}}S(Bs,"defaults",{position:[116.39,39.9,0]}),(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,editing:!1,position:f.reactArrayWithUndefined(void 0),rotation:f.reactArray([0,0,0]),selfRotation:f.reactArray([0,0,0]),pixelSize:300,color:f.reactArray([1,1,1,1]),circleRotation:0,circleStartRotation:0,circleEndRotation:0,debug:!1})})(Bs||(Bs={})),f.extendClassProps(Bs.prototype,Bs.createDefaultProps);function yp(i,t){const n=i.getViewport().getBoundingClientRect();return[t.clientX-n.left,t.clientY-n.top]}class tE extends f.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(f.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,d=0;const p=c.pointerEvent,_=yp(e.viewer,p);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),d+=w,u=y;let E=n.startRotation+d;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 f.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=vt([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=yp(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();S(this,"_hoveredPlaneType",this.disposeVar(f.react("none")));S(this,"_movingPlaneType",this.disposeVar(f.react("none")));S(this,"_previewRotation",this.disposeVar(f.react(0)));S(this,"_circle");S(this,"_rotatorRunningResetting");this._olViewer=e;const n=this._olViewer;this._rotatorRunningResetting=this.disposeVar(new f.ObjResettingWithEvent(this.enabledChanged,()=>{if(this.enabled)return new tE(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 Bs(e));this.dispose(f.track([n,"position"],[this,"position"])),this.dispose(f.track([n,"pixelSize"],[this,"pixelSize"])),this.dispose(f.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}}S(wn,"rotationNum",{heading:0}),S(wn,"rotationFuncs",{heading:([e,n,s])=>[0,n,s]}),(i=>{i.createDefaultProps=()=>({...Pe.createDefaultProps(),rotation:f.reactArray([0,0,0]),selfRotation:f.reactArray([0,0,0]),pixelSize:300,showHelper:!1,debug:!1})})(wn||(wn={})),f.extendClassProps(wn.prototype,wn.createDefaultProps);const ts=class ts extends f.Destroyable{get startPosition(){return this.positions&&this.positions[0]}set startPosition(t){this.positions=[t??ts.defaults.positions[0],this.stopPosition??ts.defaults.positions[1]]}get startPositionChanged(){return this.positionsChanged}get stopPosition(){return this.positions&&this.positions[1]}set stopPosition(t){this.positions=[this.startPosition??ts.defaults.positions[0],t??ts.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 He(t,e));this.ad(f.track([s,"allowPicking"],[this,"allowPicking"])),this.ad(f.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))}}};S(ts,"defaults",{positions:[[0,0,0],[0,0,1e6]]});let $n=ts;(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:f.reactPositions(i.defaults.positions),width:10,color:f.reactArray([1,0,0,1])})})($n||($n={})),f.extendClassProps($n.prototype,$n.createDefaultProps);class Fi extends Pe{constructor(e){super();S(this,"_lastPosition");S(this,"_opInfo",{step:this.ad(f.react(!1)),moved:this.ad(f.react(!1)),constraintMode:this.disposeVar(f.react("none")),originPosition:this.disposeVar(f.reactArray([0,0,0])),originHeading:this.disposeVar(f.react(0)),originDimensions:this.disposeVar(f.reactArray([1,1,1])),draggingStartPosition:this.disposeVar(f.reactArray([0,0,0])),movingPosition:this.disposeVar(f.reactArray([0,0,0])),targetPosition:this.disposeVar(f.reactArray([0,0,0])),targetHeading:this.disposeVar(f.react(0))});S(this,"_scaleAxis");S(this,"_pickingXYProcessing",e=>this.disposeVar(new f.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]=Zt(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 d=[0,0,0];if(f.geoRhumbDestination(r,o,s,d),this._opInfo.targetPosition.value=d,!this._axisPixelInfo)return;const p=this._axisPixelInfo,_=e.viewer.getEventPixel(a.pointerEvent),y=p.len*p.len,w=((_[0]-p.a[0])*p.v[0]+(_[1]-p.a[1])*p.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===p.sideStart||p.sideStart===0?P=Math.max(0,Math.abs(E)-Math.abs(p.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]=p.baseScale;let Y=L,X=z;p.mode==="y"?Y=Math.max(.01,L*D):p.mode==="x"&&(X=Math.max(.01,z*D)),this.scale=[Y,X,q??0]})})));S(this,"_axisPixelInfo");console.log("here ScaleEditing constructor",e.viewer);const n=e.viewer;if(n){this.ad(new Rg(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=Fi.defaults.position}=this;console.log("ScaleEditing.defaults.position",r);const{yAxis:a,xAxis:c}=this._scaleAxis;c.startPosition=a.startPosition=r;const h=f.geoRhumbDestination(r,this._opInfo.originDimensions.value[0],90);h&&(c.stopPosition=h);const l=f.geoRhumbDestination(r,this._opInfo.originDimensions.value[1],0);l&&(a.stopPosition=l)};s();const o=this.ad(f.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??Fi.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};nf(n,l,u,this.axisSnapPixelSize,r);const d=n.getView().getProjection(),p=n.getEventPixel(l),_=q=>n.getPixelFromCoordinate(vt([q[0],q[1]],d)),{xAxis:y,yAxis:w}=this._scaleAxis,E=_(y.startPosition),b=_(y.stopPosition),P=_(w.startPosition),I=_(w.stopPosition),M=wp(p,E,b),D=wp(p,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(p);if(q){const[Y,X]=Zt(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(f.createProcessingFromAsyncFunc(async l=>{this._opInfo.step.value=!0,this._opInfo.constraintMode.value="none",l.disposer.dispose(()=>{this._opInfo.constraintMode.value="none"}),await f.step(l,async u=>{u.disposer.dispose((o(),this.positionChanged.disposableOn(o))),u.disposer.dispose(e.pointerMoveEvent.disposableOn(d=>{d.pointerEvent&&a(d.pointerEvent)})),await f.step(u,d=>new Promise((p,_)=>{d.disposer.dispose(_),d.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(vt([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]}}p()}}))}))}),this._opInfo.step.value=!1,await f.step(l,async u=>{if(e.incrementDisabledInputStack(),u.disposer.dispose(()=>e.decrementDisabledInputStack()),this.dispose(this.enabledChanged.disposableOn(d=>{if(!d&&e.disabledInputStack>0)for(;e.disabledInputStack>0;)e.decrementDisabledInputStack()})),["x","y"].includes(this._opInfo.constraintMode.value)){const d=f.geoRhumbHeading(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value),p=f.geoRhumbDistance(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value);s.restart(void 0,d,p),u.disposer.dispose(()=>s.cancel())}await f.step(u,d=>new Promise((p,_)=>{d.disposer.dispose(_),d.disposer.dispose(e.pointerUpEvent.don(()=>{p()})),d.disposer.dispose(e.pointerOutEvent.don(()=>{p()}))})),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 $n(e));return s.width=10,this.ad(f.track([s,"show"],[this,"enabled"])),s}}(i=>{i.createDefaultProps=()=>({...Pe.createDefaultProps(),scale:f.reactArray([1,1,0]),axisPixelSize:100,axisSnapPixelSize:10,scaleSensitivity:.8})})(Fi||(Fi={})),f.extendClassProps(Fi.prototype,Fi.createDefaultProps);function wp(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,d=i[0]-l,p=i[1]-u;return{dist:Math.hypot(d,p),t:h}}const Ni=class Ni extends le{constructor(e){super();S(this,"_editingPoints",this.disposeVar(new f.ObservableArray));S(this,"_cancelEvent",this.disposeVar(new f.Event));S(this,"_currentProcess");S(this,"_menuPoiEnabled",this.disposeVar(f.react(!1)));S(this,"_status",this.disposeVar(f.react("None")));S(this,"_positionsChanged",this.ad(new f.Event));S(this,"_cursorInfo");this._olViewer=e,console.log("imgaeUrl:",Ni.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(f.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??Ni.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??Ni.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(f.track([n,"color"],[this,"polylineColor"])),this.ad(f.track([n,"width"],[this,"polylineWidth"])),this.ad(f.track([n,"show"],[this,"polylineShow"])),this.ad(f.track([n,"arcType"],[this,"polylineArcType"])),this.ad(f.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 f.CursorInfo(e.container,f.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)}}))}};S(Ni,"baseImageUrl",f.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/img/")),S(Ni,"defaults",{...le.defaults,debug:!1,polylineShow:!1,polylineWidth:1,polylineColor:[1,1,1,1],polylineArcType:"GEODESIC",maxPointsNum:Number.MAX_SAFE_INTEGER,loop:!1,firstControlPointImageUrl:Ni.baseImageUrl+"point-green.png",otherControlPointImageUrl:Ni.baseImageUrl+"point-yellow.png"});let Le=Ni;(i=>{i.createDefaultProps=()=>({...le.createDefaultProps(),loop:!1,debug:!1,polylineShow:!0,polylineWidth:1,polylineColor:f.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={})),f.extendClassProps(Le.prototype,Le.createDefaultProps);let eE=0;class Ul extends f.Destroyable{constructor(e,n){super();S(this,"_position",this.disposeVar(f.reactArrayWithUndefined(void 0)));S(this,"_id",eE++);S(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 Ns(e.olViewer));s.enabled=!1,this.ad(f.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 jl extends Ul{constructor(t,e){super(t,e)}}class jt extends Le{constructor(e){super(e);S(this,"_deletePreviousPointWhileAddingEvent",this.disposeVar(new f.Event));S(this,"placeEditing");if(!e.viewer)return;const n=this.placeEditing=this.ad(new Mi(e));n.enabled=!1,this.currentProcess=this.disposeVar(f.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(f.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 jl(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=f.createProcessingFromAsyncFunc(async s=>{let o=this.editingPoints.length;this.menuPoiEnabled=!1;do if(!await s.promise(f.step(s,async a=>{let c;!e()&&(c=a.disposer.disposeVar(new vp(this,o)));const l=a.disposer.disposeVar(new Cp(this,o));return a.disposer.dispose(this._deletePreviousPointWhileAddingEvent.disposableOn(()=>l.do())),await a.promise(new Promise(u=>{c&&a.disposer.dispose(c.overEvent.disposableOnce(d=>{d?(o++,u(!0)):u(!1)})),a.disposer.dispose(l.overEvent.disposableOnce(d=>{d?(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={})),f.extendClassProps(jt.prototype,jt.createDefaultProps);class vp extends f.Destroyable{constructor(e,n){super();S(this,"_overEvent",this.disposeVar(new f.Event));const{placeEditing:s}=e;let o=new jl(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(f.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 Ep(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 Cp extends f.Destroyable{constructor(e,n){super();S(this,"_overEvent",this.disposeVar(new f.Event));S(this,"_doEvent",this.disposeVar(new f.Event));this.dispose(this._doEvent.disposableOn(()=>this._overEvent.emit(Ep(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 bp extends jt{constructor(t){super(t),this.loop=!1}}class xp extends jt{constructor(t){super(t),this.loop=!0}}class ec extends Ul{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 hi(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 d=t.editingPoints.get(l).position;if(!d)break;const p=nl(h,d);if(!p)break;p[2]-=t.olViewer.editingHeightOffset??0,n.position=p;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);S(this,"_menuPoiCommand",this.disposeVar(new f.Event));S(this,"_forceModifyPosEditorEvent",this.disposeVar(new f.Event));S(this,"_overEvent",this.disposeVar(new f.Event));S(this,"translationEditing");console.log("这是多点修改编辑器");{const s=this.ad(f.createNextAnimateFrameEvent(this.moveWithFirstPositionChanged,this.editingPoints.changedEvent));this.ad(new f.ObjResettingWithEvent(s,()=>{if(!(!this.moveWithFirstPosition||this.editingPoints.length<=1))return new iE(this.editingPoints.get(0),this)}))}const n=this.translationEditing=this.disposeVar(new Di(e));n.enabled=!1,this.currentProcess=this.disposeVar(f.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(f.step(s,async r=>{const a=r.disposer,c=a.ad(new nE(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=nl(a,l);if(!u)return;u&&(u[2]+=this.olViewer.editingHeightOffset??0);let d=new ec(this,u);this.editingPoints.splice(o,0,d)}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={})),f.extendClassProps(Ot.prototype,Ot.createDefaultProps);class iE extends f.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 nE extends f.Destroyable{constructor(e){super();S(this,"_overEvent",this.disposeVar(new f.Event));S(this,"_cancelEvent",this.disposeVar(new f.Event));S(this,"_forceModifyPosEditorEvent",this.disposeVar(new f.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 sE(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 sE extends f.Destroyable{constructor(e,n){super();S(this,"_overEvent",this.disposeVar(new f.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(f.track([this._posEditor,"position"],[s,"position"])),this.dispose(s.enabledChanged.disposableOnce(o=>{o||this._overEvent.emit()}))}get overEvent(){return this._overEvent}}class Rp extends Ot{constructor(t){super(t),this.loop=!1}}class Sp extends Ot{constructor(t){super(t),this.loop=!0}}class Vs 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=f.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=f.geoHeading(this.startPosition,this.endPosition),s=f.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:f.reactArrayWithUndefined(void 0),endPosition:f.reactArrayWithUndefined(void 0),rotation:f.reactArray([90,0,0]),distance:f.react(1)})})(Vs||(Vs={})),f.extendClassProps(Vs.prototype,Vs.createDefaultProps);class Zn 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=f.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=f.geoHeading(this.startPosition,this.endPosition),s=f.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:f.reactArrayWithUndefined(void 0),endPosition:f.reactArrayWithUndefined(void 0),rotation:f.reactArray([0,0,0]),distance:f.react(0)})})(Zn||(Zn={})),f.extendClassProps(Zn.prototype,Zn.createDefaultProps);class oE extends jt{constructor(t){super(t),this.loop=!1,this.polylineShow=!1}}class rE extends Ot{constructor(t){super(t),this.loop=!1,this.polylineShow=!1,this.middlePointShow=!1}}class Ho 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 ui(t));e.topOrBottom="bottom",this.ad(f.track([e,"color"],[this,"polylineColor"])),this.ad(f.track([e,"width"],[this,"polylineWidth"])),this.ad(f.track([e,"show"],[this,"polylineShow"])),this.ad(f.track([e,"arcType"],[this,"polylineArcType"])),this.ad(f.track([e,"loop"],[this,"loop"])),this.ad(f.track([e,"positions"],[this,"visibilityPositions"]))}}(i=>{i.createDefaultProps=()=>({...jt.createDefaultProps(),visibilityPositions:f.reactPositionsSet(void 0)})})(Ho||(Ho={})),f.extendClassProps(Ho.prototype,Ho.createDefaultProps);class Xo 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 ui(t));e.topOrBottom="bottom",this.ad(f.track([e,"color"],[this,"polylineColor"])),this.ad(f.track([e,"width"],[this,"polylineWidth"])),this.ad(f.track([e,"show"],[this,"polylineShow"])),this.ad(f.track([e,"arcType"],[this,"polylineArcType"])),this.ad(f.track([e,"loop"],[this,"loop"])),this.ad(f.track([e,"positions"],[this,"visibilityPositions"]))}}(i=>{i.createDefaultProps=()=>({...Ot.createDefaultProps(),visibilityPositions:f.reactPositionsSet(void 0)})})(Xo||(Xo={})),f.extendClassProps(Xo.prototype,Xo.createDefaultProps);class aE extends Zn{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 Xe extends f.EngineObject{constructor(e,n,s){super(e,n,s??!0);S(this,"_supportEditing",this.disposeVar(f.react(!0)));S(this,"_currentEditing",this.disposeVar(f.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 cr=class cr extends Xe{constructor(t,e){super(Array.isArray(t)?t[0]:t,e,!0);const n=this.currentEditing=this.ad(new Di(e));if(this.ad(n.enabledChanged.don(s=>{s||this.ad(f.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=f.getMinMaxCorner(s).center,this.ad(n.positionChanged.disposableOn((o,r)=>{if(!o||!r)return;const a=zs({originPosition:r},[o])[0][0];t.forEach(c=>{if(Reflect.has(c,"position")){const h=zs({originPosition:r},[c.position])[0][0];c.position=La({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=zs({originPosition:r},c.points)[0];c.points=La({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(f.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=f.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=zs({originPosition:r},[o])[0][0],c=zs({originPosition:r},s.points)[0];s.points=La({originPosition:r},c.map(h=>[h[0]+a[0],h[1]+a[1],h[2]+a[2]]))[0]}));return}this.supportEditing=!1}};S(cr,"type",cr.registerEditing("ESOlViewer",f.ESJEditingMode.Translation,cr));let ic=cr;function Pp(){const i=f.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 d=r[u%r.length],p=await f.step(t,async y=>{const w=y.disposer,E=f.EngineObject.contextEditing.getEngineObjConstructor(d,e.typeName);if(!E||!n.supportEditingModes().includes(d))return console.log(`未找到编辑模式或不支持当前编辑模式 ${d},已跳过,请检查输入`),e.editingEvent.emit({objectIDs:[n.parentID],editingID:a,type:"changedFailed",add:{cMode:d,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:d,cIndex:u}}),e.notSupportEditingCount=0;else return console.log(`编辑模式 ${d} 不支持,已跳过`),e.editingEvent.emit({objectIDs:[n.parentID],editingID:a,type:"changedFailed",add:{cMode:d,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(`编辑模式 ${d} 结束`),I("next")})),o){const M=D=>{D.code==="Space"&&(console.log(`编辑模式 ${d} 切换到下一模式`),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||p==="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 cE(){const i=f.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 hr=class hr extends Xe{constructor(t,e){super(t,e,!0);const n=this.currentEditing=this.ad(new Mi(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(f.bind([n,"position"],[t,"position"])),n.enabled=!n.position||f.equalsN3(n.position,[0,0,0])):this.supportEditing=!1}};S(hr,"type",hr.registerEditing("ESOlViewer",f.ESJEditingMode.Place,hr));let kl=hr;const lr=class lr extends Xe{constructor(t,e){super(t,e,!0);const n=this.currentEditing=this.ad(new Fi(e));if(this.ad(n.enabledChanged.don(s=>{!s&&this.ad(f.nextAnimateFrame(()=>{this.destroy()}))})),Reflect.has(t,"position")&&Reflect.has(t,"scale")){const s=t;this.ad(f.bind([n,"position"],[s,"position"])),this.ad(f.bind([n,"scale"],[s,"scale"]))}else throw new Error(`ScaleEditingWrapper:${t.typeName} 缩放属性无法绑定缩放编辑`)}};S(lr,"type",lr.registerEditing("ESOlViewer",f.ESJEditingMode.Scale,lr));let Wl=lr;const ur=class ur extends Xe{constructor(t,e){super(t,e,!0);const n=this.currentEditing=this.ad(new bp(e));if(this.ad(n.enabledChanged.don(s=>{s||this.ad(f.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(f.track([t,"points"],[n,"positions"]))}else this.supportEditing=!1}};S(ur,"type",ur.registerEditing("ESOlViewer",f.ESJEditingMode.LineStringAppend,ur));let ql=ur;const dr=class dr extends Xe{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(f.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(f.track([t,"points"],[n,"positions"]))}else this.supportEditing=!1}};S(dr,"type",dr.registerEditing("ESOlViewer",f.ESJEditingMode.LineStringInsert,dr));let Gl=dr;const fr=class fr extends Xe{constructor(t,e){super(t,e,!0);const n=this.currentEditing=this.ad(new xp(e));if(this.ad(n.enabledChanged.don(s=>{!s&&this.ad(f.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(f.track([t,"points"],[n,"positions"]))}else this.supportEditing=!1}};S(fr,"type",fr.registerEditing("ESOlViewer",f.ESJEditingMode.CircularAppend,fr));let Bl=fr;const gr=class gr extends Xe{constructor(t,e){super(t,e,!0);const n=this.currentEditing=this.ad(new Sp(e));if(this.ad(n.enabledChanged.don(s=>{!s&&this.ad(f.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(f.track([t,"points"],[n,"positions"]))}else this.supportEditing=!1}};S(gr,"type",gr.registerEditing("ESOlViewer",f.ESJEditingMode.CircularInsert,gr));let Vl=gr;const pr=class pr extends Xe{constructor(t,e){super(t,e,!0);const n=this.currentEditing=this.ad(new Vs(e));if(this.ad(n.enabledChanged.don(s=>{!s&&this.ad(f.nextAnimateFrame(()=>{this.destroy()}))})),Reflect.has(t,"position")){const s=t;if(this.ad(f.bind([n,"startPosition"],[s,"position"])),this.ad(Ig([n,"rotation"],[s,"rotation"])),Reflect.has(s,"far"))this.ad(f.bind([n,"distance"],[s,"far"]));else if(Reflect.has(s,"radius"))this.ad(f.bind([n,"distance"],[s,"radius"]));else if(Reflect.has(s,"distance"))this.ad(f.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(f.track([s,"points"],[n,"positions"]))}else throw new Error(`DoublePointsAppendEditingWrapper:${t.typeName} 坐标属性无法绑定双点追加编辑`);n.startPosition&&!f.equalsN3(n.startPosition,[0,0,0])&&n.init(),n.enabled=!0}};S(pr,"type",pr.registerEditing("ESOlViewer",f.ESJEditingMode.DoublePointsAppend,pr));let Yl=pr;const mr=class mr extends Xe{constructor(t,e){var r;super(t,e,!0);const n=e.viewer;if(!n)return;const s=this.currentEditing=this.ad(new Zn(e));if(Reflect.has(t,"position")){const a=t;if(this.ad(f.bind([s,"startPosition"],[a,"position"])),this.ad(Ig([s,"rotation"],[a,"rotation"])),Reflect.has(a,"far"))this.ad(f.bind([s,"distance"],[a,"far"]));else if(Reflect.has(a,"radius"))this.ad(f.bind([s,"distance"],[a,"radius"]));else if(Reflect.has(a,"distance"))this.ad(f.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(f.track([a,"points"],[s,"positions"]))}else throw new Error(`DoublePointsModifyEditingWrapper:${t.typeName} 坐标属性无法绑定双点修改编辑`);s.init(),s.enabled=!0;const o=this.ad(f.createNextAnimateFrameEvent(s.enabledChanged,s.startPositionChanged));this.ad(o.don(()=>{(!s.enabled||!s.startPosition||f.equalsN3(s.startPosition,[0,0,0]))&&this.destroy()}))}};S(mr,"type",mr.registerEditing("ESOlViewer",f.ESJEditingMode.DoublePointsModify,mr));let Hl=mr;const _r=class _r extends Xe{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(f.nextAnimateFrame(()=>this.destroy()))})),Reflect.has(t,"position")&&Reflect.has(t,"rotation")){const s=t;this.ad(f.bind([n,"position"],[s,"position"])),this.ad(f.bind([n,"selfRotation"],[s,"rotation"]));return}else throw new Error(`OlRotationEditingWrapper:${t.typeName} 旋转属性无法绑定旋转编辑`)}};S(_r,"type",_r.registerEditing("ESOlViewer",f.ESJEditingMode.Rotation,_r));let Xl=_r;return W.AddEditingPoint=jl,W.BaseEditingWrapper=Xe,W.CircularAppendEditing=xp,W.CircularAppendEditingWrapper=Bl,W.CircularInsertEditing=Sp,W.CircularInsertEditingWrapper=Vl,W.CurrentScale=Rg,W.DoublePointsAppendEditing=Vs,W.DoublePointsAppendEditingWrapper=Yl,W.DoublePointsModifyEditing=Zn,W.DoublePointsModifyEditingWrapper=Hl,W.ESGeoPoint=Ka,W.ESOlViewer=li,W.ESXYZLayer=Qa,W.EditingPoint=Ul,W.FPSMonitor=$d,W.GeoCanvasPoi=Ii,W.HeightModifyEditing=aE,W.ImageLabel2D=up,W.LineStringAppendEditing=bp,W.LineStringAppendEditingWrapper=ql,W.LineStringInsertEditing=Rp,W.LineStringInsertEditingWrapper=Gl,W.MultiPointsAppendEditing=jt,W.OLCurrentScale=sf,W.OlCanvasAndDivSwitchPoi=rv,W.OlCanvasPoi=al,W.OlCursorPositionInfo=Fg,W.OlDivPoi=hl,W.OlESAreaMeasurement=Sl,W.OlESDirectionMeasurement=Pl,W.OlESDistanceMeasurement=Ol,W.OlESGeoLineString=Go,W.OlESGeoPoint=Al,W.OlESGeoPoints=Ml,W.OlESGeoPolygon=Za,W.OlESGeoPolygonImpl=Hn,W.OlESImageLabel=Dl,W.OlESImageryLayer=Fl,W.OlESLabel=Rl,W.OlESLocationMeasurement=Ll,W.OlESObjectWithLocation=$a,W.OlESPath=zl,W.OlESTextLabel=Nl,W.OlESXYZLayer=Tl,W.OlGeoCanvasImagePoi=hi,W.OlGeoCanvasMenuPoi=Ns,W.OlGeoCustomDivPoi=Qt,W.OlGeoDivTextPoi=pn,W.OlImageriesManager=Lg,W.OlImagery=ep,W.OlLabelManager=zg,W.OlMultiPoint=_n,W.OlPickingManager=Ug,W.OlPoint=He,W.OlPoisContext=Ag,W.OlPolygon=Ai,W.OlPolyline=Jt,W.OlRotationEditing=wn,W.OlRotationEditingWrapper=Xl,W.OlView=Yn,W.OlViewChanged=L_,W.OlViewerExtensions=jg,W.PlaceEditing=Mi,W.PlaceEditingWrapper=kl,W.PointAdding=vp,W.PreviousPointDeleting=Cp,W.ScaleEditing=Fi,W.ScaleEditingWrapper=Wl,W.ScatterAppendEditing=oE,W.ScatterModifyEditing=rE,W.TranslationEditing=Di,W.TranslationEditingWrapper=ic,W.VisibilityAppendEditing=Ho,W.VisibilityModifyEditing=Xo,W.WASDController=Xd,W.capture=Yd,W.cesiumHeightToOlZoom=jn,W.compute2DPickingConstraint=k_,W.compute2DPickingInfoWithCoordinates=nf,W.computePickingInfoWithCoordinates2D=tf,W.createEditingSystemProcessing=Pp,W.createHelperLine=U_,W.createMoveObjectsProcessing=cE,W.defaultFlyToRotation=Zd,W.deletePreviousPoint=Ep,W.flyExtent=Io,W.flyTo=xi,W.flyToWithParam=F_,W.flyToWithPosition=fh,W.flyToWithPositions=D_,W.fromCartesian=w1,W.fromCartesian2=fg,W.fromCartesian3=pg,W.fromCartesian4=_g,W.fromCartographic=E1,W.fromColor=b1,W.fromDistanceDisplayCondition=O1,W.fromEllipsoid=U1,W.fromHeadingPitchRoll=S1,W.fromNearFarScalar=R1,W.fromQuaternion=T1,W.fromRectangle=L1,W.geoNeareastPointOnRhumbLine=an,W.geoNeareastPointOnRhumbLine2=j_,W.getCameraPosition=Qd,W.getCenterFromPositions=Yv,W.getFlatMidPoint=nl,W.getInverseModelMatrix=Cg,W.getMinMaxCoordinates=op,W.getModelMatrixFromPosition=il,W.getOlZoomFromCesiumHeight=M_,W.getPointsExtent=ea,W.getViewerExtensions=Ti,W.localPositionToPosition=xg,W.localPositionsToPositions=La,W.moveAllPositionsWithCenter=Hv,W.olFlyTo=Kd,W.olZoomToCesiumHeight=Oo,W.orbitAroundPoint=Hd,W.pickOlPosition=Jd,W.positionAndRotationToQuaternion=D1,W.positionFromCartesian=y1,W.positionToCartesian=ug,W.positionToLocalPosition=bg,W.positionsToLocalPositions=zs,W.setViewerExtensions=Wa,W.toCartesian=yg,W.toCartesian2=dg,W.toCartesian3=gg,W.toCartesian4=mg,W.toCartographic=v1,W.toColor=C1,W.toDistanceDisplayCondition=P1,W.toEllipsoid=N1,W.toHeadingPitchRoll=wg,W.toNearFarScalar=x1,W.toQuaternion=I1,W.toRectangle=F1,W.visualizeCenterPoint=A_,Object.defineProperty(W,Symbol.toStringTag,{value:"Module"}),W}({},EarthSDK3,ol);
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 f.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}}S(Qt,"defaultOLInstanceClassStr",dl),S(Qt,"olInstanceClassStrReadMe",Fg),S(Qt,"defaults",{position:[116.39,39.9,0],instanceClassStr:dl,instanceClassStrReadMe:Fg,innerHTML:Lg,innerHTMLReadMe:cv,viewDistanceRange:[1e3,1e4,3e4,6e4],zOrder:0}),(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,opacity:1,position:f.reactArrayWithUndefined(void 0),originRatioAndOffset:f.reactArray([.5,1,0,0]),instanceClassStr:void 0,innerHTML:void 0,viewDistanceRange:f.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,shadowDom:!1,cssAllInitial:!1,zOrder:0})})(Qt||(Qt={})),f.extendClassProps(Qt.prototype,Qt.createDefaultProps);class hv extends f.Destroyable{constructor(t,e,n){super(),this._container=t}}const nc=class nc extends f.Destroyable{constructor(e,n){super();S(this,"_pickedEvent",this.disposeVar(new f.Event));S(this,"_divEvent",this.disposeVar(new f.Event));S(this,"_divCreatedEvent",this.disposeVar(new f.Event));S(this,"_divToDestroyEvent",this.disposeVar(new f.Event));S(this,"_pc",this.disposeVar(new f.PointerClick));S(this,"_flyToEvent",this.disposeVar(new f.Event));S(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(f.bind([o,"show"],[this,"show"])),this.dispose(f.bind([o,"position"],[this,"position"])),this.dispose(f.bind([o,"originRatioAndOffset"],[this,"originRatioAndOffset"])),this.dispose(f.bind([o,"opacity"],[this,"opacity"])),this.dispose(f.bind([o,"viewDistanceRange"],[this,"viewDistanceRange"])),this.dispose(f.bind([o,"viewDistanceDebug"],[this,"viewDistanceDebug"])),this.dispose(f.bind([o,"shadowDom"],[this,"shadowDom"])),this.dispose(f.bind([o,"cssAllInitial"],[this,"cssAllInitial"])),this.dispose(f.bind([o,"allowPicking"],[this,"pickOnClick"])),this.d(f.bind([o,"zOrder"],[this,"zOrder"]));{class r extends hv{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 p=()=>{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)`};p();const _=this.disposeVar(f.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(p))}{const p=()=>{s.textEditing?(u.contentEditable="true",u.focus(),document.execCommand("selectAll",!1,null)):(u.contentEditable="false",document.execCommand("unselect",!1,null))};p(),this.dispose(s.textEditingChanged.disposableOn(p))}{const p=()=>{s.textEditingInteraction||(s.positionEditing??!1?u.style.pointerEvents="none":u.style.pointerEvents="all")};p(),this.dispose(s.positionEditingChanged.disposableOn(p))}let d=null;this.dispose(()=>clearInterval(d));{const p=()=>{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(_){s.textEditingInteraction&&(_.code==="Enter"&&!_.shiftKey&&u.blur(),_.code==="Escape"&&u.blur())})};p(),this.dispose(s.textEditingInteractionChanged.disposableOn(p))}}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}};S(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:f.reactArrayWithUndefined(void 0),text:void 0,width:void 0,height:void 0,fontFamily:void 0,positionEditing:!1,textEditing:!1,textEditingInteraction:!1,originRatioAndOffset:f.reactArray([.5,1,0,0]),opacity:1,fontSize:14,textAlign:"left",color:f.reactArray([1,1,1,1]),backgroundColor:f.reactArray([0,0,0,.8]),padding:f.reactArray([5,5,5,5]),borderRadius:f.reactArray([6,6,6,6]),borderWidth:0,borderColor:f.reactArray([1,1,1,1]),borderStyle:"solid",viewDistanceRange:f.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,pickOnClick:!1,shadowDom:!1,cssAllInitial:!1,scale:f.reactArray([1,1]),zOrder:0,rotate:0})})(pn||(pn={})),f.extendClassProps(pn.prototype,pn.createDefaultProps);class zg extends f.Destroyable{constructor(e){super();S(this,"_enabled",this.disposeVar(f.react(!1)));S(this,"_cursorPosition",f.react(void 0));S(this,"quickPickPosition",!0);let n=new f.Destroyable;const s=()=>{n&&(n.destroy(),n=void 0)};this.dispose(s);const o=()=>{var d;if(s(),!this._enabled.value||!e)return;const r=Ti(e);if(!r)return;n=new f.Destroyable;const a=n.disposeVar(f.react(void 0)),c=n.disposeVar(f.createNextAnimateFrameEvent(a.changed)),h=(d=e.getTargetElement)==null?void 0:d.call(e);if(!h)return;const l=p=>{const _=f.getDomEventCurrentTargetPos(p);a.value=_};h.addEventListener("mousemove",l),n.dispose(()=>h.removeEventListener("mousemove",l));const u=n.disposeVar(f.createProcessingFromAsyncFunc(async p=>{const _=r.pickingManager;if(!_||!a.value)return;const y=a.value,w=this.quickPickPosition?await p.promise(f.createCancelablePromise(_.quickPickPosition(y))):await p.promise(f.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 f.Destroyable{constructor(e){super();S(this,"_baseLayers",new Set);S(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 f.Destroyable{constructor(e){super();S(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 f.Destroyable;{const o=s.dv(f.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 Ii&&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 d;u instanceof Qt&&u.olDivPoi?u.olDivPoi.zOrder=r:u instanceof Ii&&((d=u.canvasObj)!=null&&d.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=Tn(c,pi(e.extent,s.projection))),!a[Vt.ANIMATING]&&!a[Vt.INTERACTING]&&!Hi(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&&!io(o,s))return null;const r=this.image_.getExtent(),a=this.getImage(),c=_t(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,d=c*o/(u*r),p=t.extent,_=h.resolution,y=h.rotation,w=Math.round(_t(p)/_*c),E=Math.round(Ht(p)/_*c);qe(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/c,1/c,y,-w/2,-E/2),Rr(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=pi(a.extent,h.projection);D=te(X,t.extent),M=D&&!In(X,t.extent),M&&this.clipUnrotated(P,t,X)}const L=this.getImage(),z=qe(this.tempTransform,w/2,E/2,d,d,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 lv extends jg{constructor(t){super(t),this.vectorRenderer_=new Sd(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),t0(a,this.layerImageRatio_));const c=_t(a)/s,h=Ht(a)/s;if(!o[Vt.ANIMATING]&&!o[Vt.INTERACTING]&&!Hi(a)){r.useContainer(null,null);const l=r.context,u=t.layerStatesArray[t.layerIndex],d=Object.assign({},u,{opacity:1}),p=Object.assign({},t,{declutterTree:new Xc(9),extent:a,size:[c,h],viewState:Object.assign({},t.viewState,{rotation:0}),layerStatesArray:[d],layerIndex:0});let _=!0;const y=new Ad(a,s,e,l.canvas,function(w){r.prepareFrame(p)&&r.replayGroupChanged&&(r.clipping=!1,r.renderFrame(p,null)&&(r.renderDeclutter(p),_=!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 uv extends ud{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 lv(this)}}class kg extends f.Destroyable{constructor(e){super();S(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]=Zt(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,(p,_)=>{console.log("forEachFeatureAtPixel",p,_),r.push([p,_])}),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=f.ESSceneObject.getSceneObjectById(c.toString());if(h&&h.parentID&&(h=f.ESSceneObject.getSceneObjectById(h.parentID)),!h)return o(void 0);console.log("sceneObject:",h);const l=new f.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 f.ESJPickedResult):o(l)}catch(r){return console.error(r),o(void 0)}})}_layerPickable(e){return!e||e instanceof sn?!1:e instanceof bi||e instanceof uv}_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?f.ESSceneObject.getSceneObject(s):void 0;return r&&r.parentID&&(r=f.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 Ti(i){return f.getExtProp(i,"_viewerExtensions")}function Wa(i,t){f.setExtProp(i,"_viewerExtensions",t)}class Wg extends f.Destroyable{constructor(e,n){super();S(this,"_imageriesManager");S(this,"_labelManager");S(this,"_pickingManager");S(this,"_poiContext");S(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 dv extends f.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 Ys=class Ys extends f.ESViewer{constructor(e){super(e);S(this,"_viewer",this.dv(f.react(void 0)));S(this,"orbitController",null);S(this,"_fpsMonitor",null);S(this,"wasdController",null);S(this,"_disabledInputStack",this.disposeVar(f.react(0)));S(this,"_interactionBackup",null);S(this,"_notSupportEditingCount",this.disposeVar(f.react(0)));S(this,"_editingSystem",this.ad(Ip()));if(e.type!==Ys.type)throw new Error("option.type must be ESOlViewer");this.d(this._viewer.changed.don(n=>{this.viewerChanged.emit(n)})),this.dv(new f.ObjResettingWithEvent(this.viewerChanged,()=>{if(this.viewer)return new dv(this,this.viewer)})),this.dv(new f.ObjResettingWithEvent(this.subContainerChanged,()=>{if(this.setStatus("Raw"),this.setStatusLog(""),!!this.subContainer)return new $1(this.subContainer,this,n=>this._viewer.value=n)}))}get viewer(){return this._viewer.value}get extensions(){return this.viewer&&Ti(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=jn(e[2]);this.viewer.getView().animate({center:vt([e[0],e[1]]),zoom:o,duration:(s??1)*1e3})}flyTo(e,n){if(!this.viewer)return;const s=jn(e.distance);this.viewer.getView().animate({center:vt([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=vt([e[0],e[1]]),a=vt([e[2],e[3]]);this.viewer.getView().fit(Fc([r[0],r[1],a[0],a[1]]),{duration:o._duration,easing:Sn,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=Oo(e),s=this.viewer.getView().getCenter();if(!s)return;const o=Zt(s),r=this.viewer.getView().getRotation(),c={position:[o[0],o[1],n],rotation:[0,r/(Math.PI/180),0]};return console.log("视图中心点:",c),c}calcFlyToParam(e){const n=this.getCurrentCameraInfo();if(!n)return;const{position:s,rotation:o}=n,r=f.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],p=Math.atan2(u,r)*180/Math.PI,_=l+90;return{distance:r,heading:_,pitch:p,flyDuration:1,hDelta:-(o[0]-_),pDelta:o[1]-p}}getLengthInPixel(){if(this.viewer)return this.viewer.getView().getResolution()}changeToWalk(e){this.viewer&&(this.changeToMap(),this.container&&(this.wasdController=this.dv(new Zd(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=jn(c._distance);a.setZoom(h),this.orbitController=$d(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 Kd(this.viewer))),this._fpsMonitor?this._fpsMonitor.getFPS():0}async getVersion(){const e=window.g_XE3CopyRights??{};return e.openlayers=Np,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 Xd(this.viewer,e,n)}lonLatAltToScreenPosition(e){return this._func()}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}_${f.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=Zt([n[0],n[1]]),o=Zt([n[2],n[3]]),r=[s[0],s[1],o[0],o[1]];return console.log(r),Promise.resolve(r)}};S(Ys,"type",Ys.register("ESOlViewer",Ys));let li=Ys;(i=>{i.createDefaultProps=()=>({...f.ESViewer.createDefaultProps()})})(li||(li={})),f.extendClassProps(li.prototype,li.createDefaultProps);class fv extends mo{constructor(t){t=t||{},super(t)}}class fl extends fv{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 gv extends mo{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,pv=10,Gg=.25;class Bg{constructor(t,e,n,s,o,r){this.sourceProj_=t,this.targetProj_=e;let a={};const c=Dn(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()&&_t(s)>=_t(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?_t(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?_t(this.targetProj_.getExtent()):null;const h=Ae(n),l=Ir(n),u=Or(n),d=Pr(n),p=this.transformInv_(h),_=this.transformInv_(l),y=this.transformInv_(u),w=this.transformInv_(d),E=pv+(r?Math.max(0,Math.ceil(Math.log2(mc(n)/(r*r*256*256)))):0);if(this.addQuad_(h,l,u,d,p,_,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=Sr([o,r,a,c]),u=this.sourceWorldWidth_?_t(l)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,p=this.sourceProj_.canWrapX()&&u>.5&&u<1;let _=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const w=Sr([t,e,n,s]);_=_t(w)/this.targetWorldWidth_>Gg||_}!p&&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;p?b=(Xi(o[0],d)+Xi(a[0],d))/2-Xi(E[0],d):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(p){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;so(t,o[0]),so(t,o[1]),so(t,o[2])}),t}getTriangles(){return this.triangles_}}let gl;const Us=[];function Vg(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 mv(){if(gl===void 0){const i=Bt(6,6,Us);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",Vg(i,4,5,4,0),Vg(i,4,5,0,5);const t=i.getImageData(0,0,3,3).data;gl=pl(t,0)||pl(t,4)||pl(t,8),kr(i),Us.push(i.canvas)}return gl}function Ga(i,t,e,n){const s=ro(e,t,i);let o=yu(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||io(c,s)){const h=yu(i,o,s)/o;isFinite(h)&&h>0&&(o/=h)}return o}function _v(i,t,e,n){const s=Yi(e);let o=Ga(i,t,s,n);return(!isFinite(o)||o<=0)&&ru(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 d=Bt(Math.round(e*i),Math.round(e*t),Us);if(u||(d.imageSmoothingEnabled=!1),c.length===0)return d.canvas;d.scale(e,e);function p(I){return Math.round(I*e)/e}d.globalCompositeOperation="lighter";const _=Te();c.forEach(function(I,M,D){Zp(_,I.extent)});const y=_t(_),w=Ht(_),E=Bt(Math.round(e*y/n),Math.round(e*w/n),Us);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=_t(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 R=p((z[0][0]-P[0])/o),A=p(-(z[0][1]-P[1])/o),F=p((z[1][0]-P[0])/o),N=p(-(z[1][1]-P[1])/o),G=p((z[2][0]-P[0])/o),B=p(-(z[2][1]-P[1])/o),Z=q,V=Y;q=0,Y=0,X-=Z,Q-=V,m-=Z,v-=V;const at=[[X,Q,0,0,F-R],[m,v,0,0,G-R],[0,0,X,Q,N-A],[0,0,m,v,B-A]],et=g0(at);if(et){if(d.save(),d.beginPath(),mv()||!u){d.moveTo(F,N);const it=4,gt=R-F,yt=A-N;for(let dt=0;dt<it;dt++)d.lineTo(F+p((dt+1)*gt/it),N+p(dt*yt/(it-1))),dt!=it-1&&d.lineTo(F+p((dt+1)*gt/it),N+p((dt+1)*yt/(it-1)));d.lineTo(G,B)}else d.moveTo(F,N),d.lineTo(R,A),d.lineTo(G,B);d.clip(),d.transform(et[0],et[2],et[1],et[3],R,A),d.translate(_[0]-Z,_[3]-V),d.scale(n/e,-n/e),d.drawImage(E.canvas,0,0),d.restore()}}),kr(E),Us.push(E.canvas),l&&(d.save(),d.globalCompositeOperation="source-over",d.strokeStyle="black",d.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;d.beginPath(),d.moveTo(Y,X),d.lineTo(z,q),d.lineTo(Q,m),d.closePath(),d.stroke()}),d.restore()),d.canvas}class ml extends Md{constructor(t,e,n,s,o,r,a,c,h,l,u,d){super(o,rt.IDLE,{interpolate:!!d}),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 p=s.getTileCoordExtent(this.wrappedTileCoord_),_=this.targetTileGrid_.getExtent();let y=this.sourceTileGrid_.getExtent();const w=_?Tn(p,_):p;if(mc(w)===0){this.state=rt.EMPTY;return}const E=t.getExtent();E&&(y?y=Tn(y,E):y=E);const b=s.getResolution(this.wrappedTileCoord_[0]),P=_v(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 Bg(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=Tn(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_&&(kr(this.canvas_.getContext("2d")),Us.push(this.canvas_),this.canvas_=null),super.release()}}class yv 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&&!io(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 d=l.getZForResolution(c.resolution);d>=l.getMinZoom();--d){const p=l.getTileCoordForCoordAndZ(s,d),_=h.getTile(d,p[1],p[2],r,a);if(!(_ instanceof Dd||_ instanceof ml)||_ instanceof ml&&_.getState()===rt.EMPTY)return null;if(_.getState()!==rt.LOADED)continue;const y=l.getOrigin(d),w=fe(l.getTileSize(d)),E=l.getResolution(d),b=Math.floor(u*((s[0]-y[0])/E-p[1]*w[0])),P=Math.floor(u*((y[1]-s[1])/E-p[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(),d=u.getRevision(),p=u.getTileGridForProjection(o),_=p.getZForResolution(r,u.zDirection),y=p.getResolution(_);let w=t.extent;const E=t.viewState.resolution,b=u.getTilePixelRatio(h),P=Math.round(_t(w)/E*h),I=Math.round(Ht(w)/E*h),M=n.extent&&pi(n.extent);M&&(w=Tn(w,pi(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=p.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&&!p.tileCoordIntersectsViewport([_,at,et],v))continue;const it=this.getTile(_,at,et,t);if(this.isDrawableTile(it)){const dt=Rt(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=p.getTileCoordChildTileRange(it.tileCoord,m,Q);let yt=!1;gt&&(yt=X(_+1,gt)),yt||p.forEachTileCoordParentTileRange(it.tileCoord,X,m,Q)}const R=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;Rr(this.inversePixelTransform,this.pixelTransform),qe(this.tempTransform,P/2,I/2,R,R,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(Pn);let B,Z,V;n.opacity===1&&(!this.containerReused||u.getOpaque(t.viewState.projection))?G=G.reverse():(B=[],Z=[]);for(let at=G.length-1;at>=0;--at){const et=G[at],it=u.getTilePixelSize(et,h,o),yt=p.getResolution(et)/y,dt=it[0]*yt*R,Et=it[1]*yt*R,ft=p.getTileCoordForCoordAndZ(Ae(z),et),xt=p.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],es=ye.tileCoord,we=ft[1]-es[1],En=Math.round(Ft[0]-(we-1)*dt),Cn=ft[2]-es[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,Ui=_===et,di=Ui&&ye.getAlpha(Rt(this),t.time)!==1;let St=!1;if(!di)if(B){V=[ae,ve,ae+Oe,ve,ae+Oe,ve+Ne,ae,ve+Ne];for(let Ee=0,$e=B.length;Ee<$e;++Ee)if(_!==et&&et<Z[Ee]){const At=B[Ee];te([ae,ve,ae+Oe,ve+Ne],[At[0],At[3],At[4],At[7]])&&(St||(F.save(),St=!0),F.beginPath(),F.moveTo(V[0],V[1]),F.lineTo(V[2],V[3]),F.lineTo(V[4],V[5]),F.lineTo(V[6],V[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())}B.push(V),Z.push(et)}else F.clearRect(ae,ve,Oe,Ne);this.drawTileImage(ye,t,ae,ve,Oe,Ne,kt,Ui),B&&!di?(St&&F.restore(),this.renderedTiles.unshift(ye)):this.renderedTiles.push(ye),this.updateUsedTiles(t.usedTiles,u,ye)}}return this.renderedRevision=d,this.renderedResolution=y,this.extentChanged=!this.renderedExtent_||!Vi(this.renderedExtent_,z),this.renderedExtent_=z,this.renderedPixelRatio=h,this.renderedProjection=o,this.manageTilePyramid(t,u,p,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=Rt(this),u=e.layerStatesArray[e.layerIndex],d=u.opacity*(c?t.getAlpha(l,e.time):1),p=d!==this.context.globalAlpha;p&&(this.context.save(),this.context.globalAlpha=d),this.context.drawImage(h,a,a,h.width-2*a,h.height-2*a,n,s,o,r),p&&this.context.restore(),d!==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=Rt(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=Rt(e);s in t||(t[s]={}),t[s][n.getKey()]=!0}manageTilePyramid(t,e,n,s,o,r,a,c,h){const l=Rt(e);l in t.wantedTiles||(t.wantedTiles[l]={});const u=t.wantedTiles[l],d=t.tileQueue,p=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=p;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,d.isKeyQueued(E.getKey())||d.enqueue([E,l,n.getTileCoordCenter(E.tileCoord),P])),h!==void 0&&h(E)):e.useTile(D,I,M,o));e.updateCacheSize(w,o)}}class Ba extends gv{constructor(t){super(t)}createRenderer(){return new yv(this)}}class wv 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?Tn(n,h):n,u=Yi(l),d=Ga(t,e,u,s),p=qg,_=new Bg(t,e,l,c,d*p,s),y=_.calculateSourceExtent(),w=Hi(y)?null:r(y,d,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=_t(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 vv 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=Cr(e,t,0);t=e[n]}return t}getImage(t,e,n,s){const o=this.getProjection();if(!o||!s||$i(o,s))return o&&(s=o),this.getImageInternal(t,e,n,s);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&$i(this.reprojectedImage_.getProjection(),s)&&this.reprojectedImage_.getResolution()==e&&Vi(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new wv(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 wt()}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 vv(n,e))}}function Ev(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:Ev;super({attributions:t.attributions,interpolate:t.interpolate,projection:Gt(t.projection)}),this.url_=t.url,this.imageExtent_=t.imageExtent,this.image_=new vm(this.imageExtent_,void 0,1,this.url_,e,n,Bt(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=_t(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 d=Bt(l,u);this.getInterpolate()||(d.imageSmoothingEnabled=!1);const p=d.canvas;d.drawImage(n,0,0,s,o,0,0,p.width,p.height),this.image_.setImage(p)}}super.handleImageChange(t)}}const js=[0,0,0],mn=5;class ks{constructor(t){this.minZoom=t.minZoom!==void 0?t.minZoom:0,this.resolutions_=t.resolutions,pt(Fp(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=Cs(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 Cs(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 Cs(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 Cs(h,h,l,l,n);const u=Math.floor(c*(o+1))-1,d=Math.floor(c*(r+1))-1;return Cs(h,u,l,d,n)}const a=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,e,n)}getTileRangeForExtentAndZ(t,e,n){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,js);const s=js[1],o=js[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,js);const r=js[1],a=js[2];return Cs(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 fi(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=Dr(l,mn)-1,u=Dr(u,mn)-1):(l=Mr(l,mn),u=Mr(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=Dr(h,mn)-1,l=Dr(l,mn)-1):(h=Mr(h,mn),l=Mr(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=Cr(this.resolutions_,t,e||0);return qt(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return Lu(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=xv(i),i.setDefaultTileGrid(t)),t}function Cv(i,t,e){const n=t[0],s=i.getTileCoordCenter(t),o=wl(e);if(!io(o,s)){const r=_t(o),a=Math.ceil((o[0]-s[0])/r);return s[0]+=r*a,i.getTileCoordForCoordAndZ(s,n)}return t}function bv(i,t,e,n){n=n!==void 0?n:"top-left";const s=Zg(i,t,e);return new ks({extent:i,origin:Qp(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 ks(n)}function Zg(i,t,e,n){t=t!==void 0?t:im,e=fe(e!==void 0?e:Wc);const s=Ht(i),o=_t(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 xv(i,t,e,n){const s=wl(i);return bv(s,t,e,n)}function wl(i){i=Gt(i);let t=i.getExtent();if(!t){const e=180*wc.degrees/i.getMetersPerUnit();t=fi(-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 Hd(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=ta(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 wt()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:Xg(t)}getTileCacheForProjection(t){const e=this.getProjection();return pt(e===null||$i(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:Gu(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=Cv(n,t,e)),M_(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 Rv extends We{constructor(t,e){super(t),this.tile=e}}let Qg=!0;try{new ImageData(10,10)}catch{Qg=!1}let vl;function Sv(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),d=new Array(h),p=new Array(h);for(let _=0;_<h;++_)d[_]=new Uint8ClampedArray(s[_]),p[_]=[0,0,0,0];for(let _=0;_<l;_+=4){for(let w=0;w<h;++w){const E=d[w];p[w][0]=E[_],p[w][1]=E[_+1],p[w][2]=E[_+2],p[w][3]=E[_+3]}const y=i(p,o);u[_]=y[0],u[_+1]=y[1],u[_+2]=y[2],u[_+3]=y[3]}return u.buffer}}function Pv(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 Ov(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 Iv extends Er{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]=Pv(t,this._onWorkerMessage.bind(this,s));else n[0]=Ov(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,d=s.length;u<d;++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,Sv(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_=Mv(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 Fd(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:Av(this.layers_),pixelRatio:1,pixelToCoordinateTransform:be(),postRenderFunctions:[],size:[0,0],tileQueue:this.tileQueue_,time:Date.now(),usedTiles:{},viewState:{rotation:0},viewHints:[],wantedTiles:{},mapId:Rt(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 Iv({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=Yi(t);s.size[0]=Math.ceil(_t(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||!Vi(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=Tv(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||!Vi(o,this.requestedFrameState_.extent))return;let a;if(this.renderedImageCanvas_)a=this.renderedImageCanvas_.getImage().getContext("2d");else{const c=Math.round(_t(o)/r),h=Math.round(Ht(o)/r);a=Bt(c,h),this.renderedImageCanvas_=new Ad(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 Vn=null;function Tv(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(!Vn)Vn=Bt(n,s,void 0,{willReadFrequently:!0});else{const a=Vn.canvas;a.width!==n||a.height!==s?Vn=Bt(n,s,void 0,{willReadFrequently:!0}):Vn.clearRect(0,0,n,s)}return Vn.drawImage(r,0,0,n,s),Vn.getImageData(0,0,n,s)}function Av(i){return i.map(function(t){return t.getLayerState()})}function Mv(i){const t=i.length,e=new Array(t);for(let n=0;n<t;++n)e[n]=Dv(i[n]);return e}function Dv(i){let t;return i instanceof Ro?i instanceof Kg?t=new Ba({source:i}):i instanceof yl&&(t=new fl({source:i})):t=i,t}const Cl={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};function Fv(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 Lv(i,t){const e=i.length,n=new Array(e);for(let s=0;s<e;++s)n[s]=Fv(i[s],t);return bl(n)}function bl(i){return i.length===1?i[0]:function(t,e,n){if(!t)return;const s=Yd(t),o=Xi(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=Rt(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 Rv(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(Lv(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,n){}useTile(t,e,n){const s=ta(t,e,n);this.tileCache.containsKey(s)&&this.tileCache.get(s)}}class Rl 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:zv,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:Dd,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&&!$i(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&&!$i(this.getProjection(),t)?!1:super.getOpaque(t)}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||$i(e,t)))return this.tileGrid;const n=Rt(t);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=Xg(t)),this.tileGridForProjection[n]}getTileCacheForProjection(t){const e=this.getProjection();if(!e||$i(e,t))return this.tileCache;const n=Rt(t);return n in this.tileCacheForProjection||(this.tileCacheForProjection[n]=new Hd(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||$i(r,o))return this.getTileInternal(t,e,n,s,r||o);const a=this.getTileCacheForProjection(o),c=[t,e,n];let h;const l=Vd(c);a.containsKey(l)&&(h=a.get(l));const u=this.getKey();if(h&&h.key==u)return h;const d=this.getTileGridForProjection(r),p=this.getTileGridForProjection(o),_=this.getTileCoordForTileUrlFunction(c,o),y=new ml(r,d,o,p,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=ta(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=Rt(n);s in this.tileGridForProjection||(this.tileGridForProjection[s]=e)}}clear(){super.clear();for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear()}}function zv(i,t){i.getImage().src=t}const Va="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 Nv extends Rl{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_),d=fe(a.getTileSize(h[0]),this.tmpSize);const p=this.gutter_;p!==0&&(d=Wu(d,p,this.tmpSize),u=to(u,l*p,u)),r&&r!==o&&(l=Ga(r,o,t,l),u=Cu(u,o,r),t=ro(t,o,r));const _={SERVICE:"WMS",VERSION:Va,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,d,u,1,r||o,_)}getLegendUrl(t,e){if(this.urls[0]===void 0)return;const n={SERVICE:"WMS",VERSION:Va,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=Xi(Yd(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||Va;this.v13_=p0(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=Wu(a,c,this.tmpSize),r=to(r,o*c,r)),e!=1&&(a=Gu(a,e,this.tmpSize));const h={SERVICE:"WMS",VERSION:Va,REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};return Object.assign(h,this.params_),this.getRequestUrl_(t,a,r,e,n,h)}}class Uv extends ks{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 jv extends Rl{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,d){return h[d]}),l}}}class Ha extends Rl{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 f.Destroyable{constructor(e,n){super();S(this,"_imageriesManager");S(this,"_map");S(this,"_raster");S(this,"_layer",this.dv(f.react(void 0)));S(this,"_rShow",this.dv(f.react(!0)));S(this,"_rAlpha",this.dv(f.react(1)));S(this,"_rZIndex",this.dv(f.react(0)));S(this,"_rRectangle",this.dv(f.react(void 0)));S(this,"_rSplitDirection",this.dv(f.react("NONE")));S(this,"_rBrightness",this.dv(f.react(1)));S(this,"_rContrast",this.dv(f.react(1)));S(this,"_rHue",this.dv(f.react(0)));S(this,"_rSaturation",this.dv(f.react(1)));S(this,"_rGamma",this.dv(f.react(1)));S(this,"_raf");this.id=n;const s=e.viewer;if(!s)return;this._map=s;const o=Ti(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,d=h[2]/255;const p=h[3]/255;if(r.hueCos!==1||r.hueSin!==0){const y=c(l,u,d,r.hueCos,r.hueSin);l=y[0],u=y[1],d=y[2]}if(r.saturation!==1){const y=a(l,u,d);l=y+(l-y)*r.saturation,u=y+(u-y)*r.saturation,d=y+(d-y)*r.saturation}r.brightness!==1&&(l*=r.brightness,u*=r.brightness,d*=r.brightness),r.contrast!==1&&(l=(l-.5)*r.contrast+.5,u=(u-.5)*r.contrast+.5,d=(d-.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),d=Math.pow(Math.max(d,0),r.gammaInv));const _=y=>Math.max(0,Math.min(255,Math.round(y*255)));return h[0]=_(l),h[1]=_(u),h[2]=_(d),h[3]=_(p),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 Ba({source:e})}_createFromProvider(e){var _,y;if(!this._map)return;this._destroyLayer();const s=Gt("EPSG:3857").getExtent(),o=_t(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||"",d=r.minimumLevel??0,p=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:d,maxZoom:p,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??d)|0,I=(w.maximumLevel??p)|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,R,A;if(b){R=[-180,-90,180,90],v=Ae(R);const N=360/(m*2);A=Array.from({length:X},(G,B)=>N/Math.pow(2,q+B))}else{R=s,v=Ae(R);const N=_t(R)/m;A=Array.from({length:X},(G,B)=>N/Math.pow(2,q+B))}const F=new jv({url:u(w.url),layer:w.layer,matrixSet:E,format:w.format??"image/png",style:w.style??"default",tileGrid:w.tileGrid??new Uv({origin:v,extent:R,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 B=new Image;B.crossOrigin=a||"anonymous",B.onload=()=>{var Ui,di;const Z=this._rBrightness.value??1,V=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&&V===1&&it===1){const St=(Ui=N.getImage)==null?void 0:Ui.call(N);if(St){St.src=G;return}}const gt=B.naturalWidth||B.width,yt=B.naturalHeight||B.height;if(!gt||!yt){N.getImage().src=G;return}const dt=document.createElement("canvas");dt.width=gt,dt.height=yt;const Et=dt.getContext("2d",{willReadFrequently:!0});Et.drawImage(B,0,0);const ft=Et.getImageData(0,0,gt,yt),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]],es=(St,Ee)=>{const $e=Array.from({length:3},()=>[0,0,0]);for(let At=0;At<3;At++)for(let Ue=0;Ue<3;Ue++)$e[At][Ue]=St[At][0]*Ee[0][Ue]+St[At][1]*Ee[1][Ue]+St[At][2]*Ee[2][Ue];return $e},we=es(he,es(ye,Wt)),En=.5-.5*V,Cn=1/Math.max(1e-4,it),bn=new Uint8ClampedArray(256);for(let St=0;St<256;St++)bn[St]=Math.max(0,Math.min(255,Math.round(Math.pow(St/255,Cn)*255)));const ae=.2126,ve=.7152,Oe=.0722;for(let St=0;St<xt.length;St+=4){let Ee=xt[St]/255,$e=xt[St+1]/255,At=xt[St+2]/255;const Ue=xt[St+3],ac=we[0][0]*Ee+we[0][1]*$e+we[0][2]*At,cc=we[1][0]*Ee+we[1][1]*$e+we[1][2]*At,yr=we[2][0]*Ee+we[2][1]*$e+we[2][2]*At,ji=ae*ac+ve*cc+Oe*yr,wr=ji+(ac-ji)*at,hc=ji+(cc-ji)*at,vr=ji+(yr-ji)*at,is=wr*Z,ns=hc*Z,ss=vr*Z;let xn=is*V+En,Rn=ns*V+En,Xt=ss*V+En;xn=xn<0?0:xn>1?1:xn,Rn=Rn<0?0:Rn>1?1:Rn,Xt=Xt<0?0:Xt>1?1:Xt,xt[St]=bn[Math.round(xn*255)],xt[St+1]=bn[Math.round(Rn*255)],xt[St+2]=bn[Math.round(Xt*255)],xt[St+3]=Ue}Et.putImageData(ft,0,0);const Ne=(di=N.setImage)==null?void 0:di.bind(N);Ne?Ne(dt):N.getImage().src=dt.toDataURL("image/png")},B.onerror=()=>{N.getImage().src=G},B.src=G}});this._layer.value=new Ba({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 Nv({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:d,maxZoom:p,tileSize:256}):void 0,D=w.url?u(w.url):"",L=new Ha({url:D,attributions:r.attributions,crossOrigin:a,wrapX:!0,minZoom:d,maxZoom:p,tileGrid:new ks({origin:Ae(s),resolutions:h.slice(d,p+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?Cu(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 f.Destroyable{constructor(e,n){super();S(this,"_pickedEvent",this.disposeVar(new f.Event));S(this,"_flyToEvent",this.disposeVar(new f.Event));S(this,"_clickEvent",this.disposeVar(new f.Event));S(this,"_hovered",this.disposeVar(f.react(!1)));S(this,"_feature");S(this,"_source");S(this,"_layer");S(this,"_initialized",!1);const s=new Ke([]);this._feature=new Je({geometry:s}),this._feature.setId(n??f.createGuid());const o=e.viewer;if(!o)return;this._source=new en,this.dispose(()=>{var h;return(h=this._source)==null?void 0:h.dispose()}),this._layer=new bi({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(f.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=vt([this.position[0][0],this.position[0][1]]);s.setCoordinates(h);const l=this.radius??5,u=this.strokeWidth??2,d=this.fillColor??[255,255,255,1],p=this.strokeColor??[0,153/255,1,1],_=new de({color:`rgba(${d.map(E=>E*255).join(",")})`}),y=new Re({color:`rgba(${p.map(E=>E*255).join(",")})`,width:u}),w=new Kt({image:new ii({radius:l,fill:_,stroke:y})});this._feature.setStyle(w),this._source.addFeature(this._feature)};a();const c=this.disposeVar(f.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&&xi(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 p;if(!this.position)return;const s=vt([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 Re({color:`rgba(${h.map(_=>_*255).join(",")})`,width:a}),d=new Kt({image:new ii({radius:r,fill:l,stroke:u})});this._feature.setStyle(d),this._feature.set("visible",this.show??!0),(p=this._source)==null||p.addFeature(this._feature)};e();const n=f.createNextAnimateFrameEvent(this.positionChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged);this.dispose(n.disposableOn(e))}};S(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 He=sc;(i=>{i.createDefaultProps=()=>({show:void 0,position:f.reactArrayWithUndefined(void 0),editting:void 0,allowPicking:!1,pixelSize:void 0,color:f.reactArrayWithUndefined(void 0),outlineColor:f.reactArrayWithUndefined(void 0),outlineWidth:void 0,fillColor:f.reactArrayWithUndefined(void 0),strokeColor:f.reactArrayWithUndefined(void 0),strokeWidth:void 0,radius:void 0,zIndex:void 0})})(He||(He={})),f.extendClassProps(He.prototype,He.createDefaultProps);const oc=class oc extends f.Destroyable{constructor(e,n){super();S(this,"_flyToEvent",this.disposeVar(new f.Event));S(this,"_layer");S(this,"_feature");S(this,"_source");S(this,"_lineString");const s=new _i([]);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??f.createGuid()),this.d(()=>{var h;return(h=this._feature)==null?void 0:h.dispose()}),this._source=new en,this.d(()=>{var h;return(h=this._source)==null?void 0:h.dispose()}),this._layer=new bi({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(f.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(d=>vt([d[0],d[1]]));this.loop&&h.length>=3&&h.push(h[0]),this._feature.getGeometry().setCoordinates(h);const u=(d,p)=>{const _=[],y=new Re({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 Kt({stroke:y})),this.hasArrow&&h.length>=2){const[w,E]=h[h.length-2],[b,P]=h[h.length-1],I=kv(b-w,P-E);_.push(new Kt({geometry:new Ke([b,P]),image:new go({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(f.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)];xi(e,l)}))}get typeName(){return"OlPolyline"}get defaultProps(){return oc.createDefaultProps()}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}};S(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:f.reactPositions(void 0),loop:!1,width:2,color:f.reactArray([1,1,1,1]),hasDash:!1,dashLength:16,hasArrow:!1,arcType:"GEODESIC",depthTest:!1,zIndex:0,dashPattern:255,gapColor:f.reactArray([0,0,0,0])})})(Jt||(Jt={})),f.extendClassProps(Jt.prototype,Jt.createDefaultProps);function kv(i,t){const e=Math.atan2(t,i);return(Math.PI/2-e+2*Math.PI)%(2*Math.PI)}class Wv extends f.Destroyable{constructor(e,n){super();S(this,"_geoPoint");S(this,"_geoAxis");this._geoPoint=this.disposeVar(new He(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 Li=class Li extends f.Destroyable{constructor(e,n){super();S(this,"_captureEvent",this.disposeVar(new f.Event));S(this,"_id",this.disposeVar(f.react(f.createGuid())));if(this._olViewer=e,n&&(this.id=n),!e.viewer)return;this.disposeVar(new f.ObjResettingWithEvent(this.showChanged,()=>{if(this.show&&this.position)return new Wv(this,e)})),this.default&&this.flyTo(void 0,!1);const o=this.disposeVar(f.createProcessingFromAsyncFunc(async a=>{const{position:c,rotation:h,viewDistance:l,duration:u=1e3}=this;if(c){const d=xi(this._olViewer,c,l,h,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(f.createProcessingFromAsyncFunc(async(a,c,h)=>{var d,p;const l=(p=(d=this._olViewer).capture)==null?void 0:p.call(d,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??Li.defaults.thumbnailWidth,c??Li.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&Li.ResetFlag.Position&&(this.position=n.position),e&Li.ResetFlag.Rotation&&(this.rotation=n.rotation),e&Li.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&&xi(this._olViewer,s,r,o,e??a)}};S(Li,"ResetFlag",{Position:1,Rotation:2,ViewDistance:4,Zoom:10}),S(Li,"defaults",{thumbnailWidth:64,thumbnailHeight:64,enabled:!0,show:!1,position:[116.39,39.9,100],duration:1e3,default:!1,thumbnail:""});let Yn=Li;(i=>{i.createDefaultProps=()=>({enabled:!0,position:f.reactArrayWithUndefined(void 0),positionEditing:!1,show:!1,rotation:f.reactArray([0,0,0]),viewDistance:0,duration:void 0,default:!1,thumbnail:""})})(Yn||(Yn={})),f.extendClassProps(Yn.prototype,Yn.createDefaultProps);class Ai extends f.Destroyable{constructor(e,n){super();S(this,"_flyToEvent",this.disposeVar(new f.Event));S(this,"_feature");S(this,"_layer");S(this,"_source");const s=new gs([[]]);this._feature=new Je({geometry:s}),this._feature.setId(n??f.createGuid());const o=e.viewer;if(!o)return;this._source=new en,this.dispose(()=>{var h;return(h=this._source)==null?void 0:h.dispose()}),this._layer=new bi({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(f.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 Kt({fill:new de({color:sp(l)}),stroke:new Re({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(f.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,d]=qv(l),[p,_]=Zt([u,d]);xi(e,[p,_,0])}))}get typeName(){return"OlPolygon"}get defaultProps(){return Ai.createDefaultProps()}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}}(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:f.reactJsonWithUndefined(void 0),fillColor:f.reactArray([1,1,1,.4]),outlineColor:f.reactArray([1,1,1,1]),outlineWidth:1.5,hasDash:!1,dashLength:16,zIndex:0,stroked:!0,filled:!0})})(Ai||(Ai={})),f.extendClassProps(Ai.prototype,Ai.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=>vt([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 qv(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 Sl extends fs{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){this.flatCoordinates?On(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.changed()}clone(){const t=new Sl(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,n,s){if(s<eo(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=Mn(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 Zi(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 Ke(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 Ke(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=Lr(this.flatCoordinates,0,t,this.stride),this.changed()}}const rc=class rc extends f.Destroyable{constructor(e,n){super();S(this,"_pickedEvent",this.disposeVar(new f.Event));S(this,"_flyToEvent",this.disposeVar(new f.Event));S(this,"_clickEvent",this.disposeVar(new f.Event));S(this,"_hovered",this.disposeVar(f.react(!1)));S(this,"_feature");S(this,"_source");S(this,"_layer");S(this,"_initialized",!1);const s=new Sl([]);this._feature=new Je({geometry:s}),this._feature.setId(n??f.createGuid());const o=e.viewer;if(!o)return;this._source=new en,this.dispose(()=>{var h;return(h=this._source)==null?void 0:h.dispose()}),this._layer=new bi({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=>vt([b[0],b[1]]));if(!this._feature)return;const l=this._feature.getGeometry();l&&l.setCoordinates(h);const u=this.radius??5,d=this.strokeWidth??2,p=this.fillColor??[255,255,255,1],_=this.strokeColor??[0,153/255,1,1],y=new de({color:`rgba(${p.map(b=>b*255).join(",")})`}),w=new Re({color:`rgba(${_.map(b=>b*255).join(",")})`,width:d}),E=new Kt({image:new ii({radius:u,fill:y,stroke:w})});this._feature.setStyle(E),this._source.addFeature(this._feature)};a();const c=this.disposeVar(f.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 p;if(!this.points)return;const s=this.points.map(_=>vt([_[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 Re({color:`rgba(${h.map(_=>_*255).join(",")})`,width:a}),d=new Kt({image:new ii({radius:r,fill:l,stroke:u})});this._feature.setStyle(d),this._feature.set("visible",this.show??!0),(p=this._source)==null||p.addFeature(this._feature)};e();const n=f.createNextAnimateFrameEvent(this.pointsChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged);this.dispose(n.disposableOn(e))}};S(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:f.reactPositions(void 0),editting:void 0,allowPicking:!1,pixelSize:void 0,color:f.reactArrayWithUndefined(void 0),outlineColor:f.reactArrayWithUndefined(void 0),outlineWidth:void 0,fillColor:f.reactArrayWithUndefined(void 0),strokeColor:f.reactArrayWithUndefined(void 0),strokeWidth:void 0,radius:void 0,zIndex:void 0})})(_n||(_n={})),f.extendClassProps(_n.prototype,_n.createDefaultProps);class Xa extends f.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 $a extends Xa{constructor(e,n){super(e,n);S(this,"_smoothMoving");this._smoothMoving=this.dv(new f.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(f.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=f.getDistancesFromPositions([e.position,tf(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:d,pDelta:p}=a;return this.flyToWithPromise(n,r,c,[h,l,0],e??u,d,p),!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 $a{constructor(e,n){super(e,n);S(this,"_lastHoverResult",this.dv(f.react(void 0)));if(!n.viewer){console.warn("viewer is undefined!");return}this.ad(f.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 Gv=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=f.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},Bv=i=>{let t;return i?(i.length<3?t=0:t=f.geoArea(i),t):0},Vv=i=>{let t;return i?(i.length<3?t=void 0:t=f.geoCenterOfMass(i),t):void 0},$o=class $o 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=ea(s);return Io(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=ea(s);return Io(this.olViewer.viewer,o,t),console.log("OlESGeoVector flyTo"),!0}return!0}};S($o,"type",$o.register("ESOlViewer",f.ESGeoVector.type,$o));let Ws=$o;class Hn extends f.Destroyable{constructor(e,n){super();S(this,"_flyToEvent",this.disposeVar(new f.Event));if(!e.viewer)return;const o=this.ad(new Ai(e,n)),r=this.ad(new Jt(e,n));r.loop=!0,this.ad(f.bind([r,"depthTest"],[this,"depthTest"])),this.d(f.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,d=.5]=this.color||[1,1,1,.5];o.fillColor=[h,l,u,d]};a();const c=this.disposeVar(f.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)}}S(Hn,"defaults",{viewDistanceRange:[1e3,1e4,3e4,6e4],positions:[]}),(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,outline:!0,strokeGround:!1,outlineColor:f.reactArray([1,1,1,1]),outlineWidth:2,ground:!1,fill:!0,color:f.reactArray([1,1,1,.5]),positions:f.reactPositions(void 0),viewDistanceRange:f.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,depthTest:!1})})(Hn||(Hn={})),f.extendClassProps(Hn.prototype,Hn.createDefaultProps);const Zo=class Zo extends Ws{constructor(e,n){super(e,n);S(this,"_geoPolygon");if(!n.viewer){console.warn("viewer is undefined!");return}this._geoPolygon=this.ad(new Ai(this.olViewer,e.id));const o=this.geoPolygon;o&&(this.d(f.track([o,"show"],[e,"show"])),this.d(f.track([o,"allowPicking"],[e,"allowPicking"])),this.d(f.bind([o,"positions"],[e,"points"])),this.d(f.track([o,"stroked"],[e,"stroked"])),this.d(f.track([o,"outlineColor"],[e,"strokeColor"])),this.d(f.track([o,"outlineWidth"],[e,"strokeWidth"])),this.d(f.track([o,"filled"],[e,"filled"])),this.d(f.track([o,"fillColor"],[e,"fillColor"])))}get geoPolygon(){return this._geoPolygon}};S(Zo,"type",Zo.register("ESOlViewer",f.ESGeoPolygon.type,Zo));let Za=Zo;function qo(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 Yv(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 qs extends f.Destroyable{constructor(e,n){super();S(this,"_pickedEvent",this.dv(new f.Event));S(this,"_flyToEvent",this.dv(new f.Event));S(this,"_area",this.dv(f.react(0)));S(this,"_centerOfMass",this.dv(f.reactArrayWithUndefined(void 0)));S(this,"_distances",this.dv(f.reactArray([])));S(this,"_geoPolyline");S(this,"_id",this.dv(f.react(f.createGuid())));n&&(this.id=n);{const s=()=>{this._distances.value=Gv(this.positions),this._area.value=Bv(this.positions),this._centerOfMass.value=Vv(this.positions)};s();const o=this.dv(f.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(f.bind([s,"color"],[this,"color"])),this.dispose(f.bind([s,"dashLength"],[this,"dashLength"])),this.dispose(f.bind([s,"dashPattern"],[this,"dashPattern"])),this.dispose(f.bind([s,"gapColor"],[this,"gapColor"])),this.dispose(f.bind([s,"hasArrow"],[this,"hasArrow"])),this.dispose(f.bind([s,"hasDash"],[this,"hasDash"])),this.dispose(f.bind([s,"positions"],[this,"positions"])),this.dispose(f.bind([s,"show"],[this,"show"])),this.dispose(f.bind([s,"allowPicking"],[this,"allowPicking"])),this.dispose(f.bind([s,"width"],[this,"width"])),this.dispose(f.bind([s,"depthTest"],[this,"depthTest"]))}{const s=this.dv(new Hn(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(f.track([s,"show"],[this,"show"])),this.dispose(f.track([s,"ground"],[this,"ground"])),this.dispose(f.track([s,"allowPicking"],[this,"allowPicking"])),this.dispose(f.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(f.createNextAnimateFrameEvent(this.areaChanged,this.centerOfMassChanged,this.distancesChanged,this.unitsChanged)),r=()=>{if(this.distances.length===0){s.innerHTML="";return}const a=Yv(this.area,this.distances[this.distances.length-1],this.units);s.innerHTML=za([...a].join(`
162
+ `))};r(),this.dispose(o.disposableOn(r)),this.dispose(f.track([s,"show"],[this,"show"])),this.dispose(f.track([s,"allowPicking"],[this,"allowPicking"])),this.dispose(f.bind([s,"shadowDom"],[this,"shadowDom"])),this.dispose(f.bind([s,"cssAllInitial"],[this,"cssAllInitial"])),this.dispose(f.track([s,"position"],[this,"centerOfMass"])),this.ad(s.pickedEvent.don(a=>{qo(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}}S(qs,"defaults",{positions:[]}),(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:f.reactPositions(void 0),width:2,color:f.reactArray([1,1,1,.5]),fillColor:f.reactArray([1,1,1,.5]),hasDash:!1,gapColor:f.reactArray([0,0,0,0]),dashLength:16,dashPattern:255,hasArrow:void 0,depthTest:!1,shadowDom:!1,cssAllInitial:!1,strokeGround:!0,ground:!0,units:f.reactArray(["SquareMeter_SquareKilometer","MU_Hectare","PerimeterMeter_PerimeterKilometer"])})})(qs||(qs={})),f.extendClassProps(qs.prototype,qs.createDefaultProps);const Ko=class Ko extends Za{constructor(e,n){super(e,n);S(this,"_olAreaMeasurement");if(this._olAreaMeasurement=this.disposeVar(new qs(n,e.id)),!n.viewer){console.warn("viewer is undefined!");return}e.strokeGround=!1,e.fillGround=!1;const o=this._olAreaMeasurement;this.dispose(f.track([o,"show"],[e,"show"])),this.dispose(f.track([o,"units"],[e,"units"])),this.dispose(f.track([o,"allowPicking"],[e,"allowPicking"])),this.dispose(f.bind([o,"positions"],[e,"points"])),this.dispose(f.bind([o,"strokeGround"],[e,"strokeGround"])),this.d(f.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(f.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(f.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}};S(Ko,"type",Ko.register("ESOlViewer",f.ESAreaMeasurement.type,Ko));let Ol=Ko;const Kn=class Kn extends f.Destroyable{constructor(e,n){super();S(this,"_pickedEvent",this.disposeVar(new f.Event));S(this,"_flyToEvent",this.disposeVar(new f.Event));S(this,"_heading",this.disposeVar(f.react(0)));S(this,"_textFunc",this.disposeVar(f.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=f.geoHeading(this.positions[0],this.positions[1]):this.arcType==="RHUMB"?h=f.geoRhumbHeading(this.positions[0],this.positions[1]):this.arcType==="NONE"?h=f.geoHeading(this.positions[0],this.positions[1]):console.warn(`未知的arcType: ${this.arcType},导致距离无法计算!`),this._heading.value=this.angleMode==="-180~180"?f.clampN180_180(h):f.clamp0_360(h)}};a();const c=this.disposeVar(f.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(f.track([o,"allowPicking"],[s,"allowPicking"])),this.dispose(f.bind([o,"arcType"],[s,"arcType"])),this.dispose(f.bind([o,"color"],[s,"color"])),this.dispose(f.bind([o,"dashLength"],[s,"dashLength"])),this.dispose(f.bind([o,"dashPattern"],[s,"dashPattern"])),this.dispose(f.bind([o,"gapColor"],[s,"gapColor"])),this.dispose(f.bind([o,"hasArrow"],[s,"hasArrow"])),this.dispose(f.bind([o,"hasDash"],[s,"hasDash"])),this.dispose(f.bind([o,"positions"],[s,"positions"])),this.dispose(f.bind([o,"show"],[s,"show"])),this.dispose(f.bind([o,"width"],[s,"width"])),this.dispose(f.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(f.bind([r,"shadowDom"],[s,"shadowDom"])),this.dispose(f.bind([r,"cssAllInitial"],[s,"cssAllInitial"])),this.dispose(f.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??Kn.defaultTextFunc_度格式)(h);r.innerHTML=za(`方向: ${l}`,24)};a();const c=this.disposeVar(f.createNextAnimateFrameEvent(s.headingChanged,s.textFuncChanged));this.dispose(c.disposableOn(a))}this.ad(r.pickedEvent.don(a=>{qo(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}};S(Kn,"defaultTextFunc_度格式",e=>`${e.toFixed(5)}°`),S(Kn,"defaultTextFunc_度分格式",e=>`${Na(e,!0)}`),S(Kn,"defaultTextFunc_度分秒格式",e=>`${Na(e,!1)}`),S(Kn,"defaults",{positions:[]});let Xn=Kn;(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:f.reactPositions(void 0),width:4,color:f.reactArray([1,1,1,1]),hasDash:!1,gapColor:f.reactArray([0,0,0,0]),dashLength:16,dashPattern:255,hasArrow:!0,arcType:"GEODESIC",depthTest:!1,shadowDom:!1,cssAllInitial:!1,angleMode:"-180~180",strokeGround:!1})})(Xn||(Xn={})),f.extendClassProps(Xn.prototype,Xn.createDefaultProps);const Qo=class Qo extends Ws{constructor(e,n){super(e,n);S(this,"_olDirectionMeasurement");if(this._olDirectionMeasurement=this.disposeVar(new Xn(n,e.id)),!n.viewer){console.warn("viewer is undefined!");return}const o=this._olDirectionMeasurement;o.angleMode="0~360",this.dispose(f.track([o,"show"],[e,"show"])),this.dispose(f.track([o,"allowPicking"],[e,"allowPicking"])),this.dispose(f.bind([o,"positions"],[e,"points"])),this.dispose(f.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(f.createNextAnimateFrameEvent(e.strokeStyleChanged,e.strokedChanged));this.dispose(a.disposableOn(r))}this.dispose(o.pickedEvent.disposableOn(r=>{qo(r)===0&&(e.allowPicking??!1)&&e.pickedEvent.emit(r)}))}get olDirectionMeasurement(){return this._olDirectionMeasurement}};S(Qo,"type",Qo.register("ESOlViewer",f.ESDirectionMeasurement.type,Qo));let Il=Qo;function rp(i,t,e,n){const s=new Qt(e,n);return s.innerHTML=za(i),s.position=t,s.show=!0,s}class Gs extends f.Destroyable{constructor(e,n){super();S(this,"_pickedEvent",this.disposeVar(new f.Event));S(this,"_flyToEvent",this.disposeVar(new f.Event));S(this,"_distances",this.disposeVar(f.reactArray([])));const s=async()=>{this._distances.value=f.getDistancesFromPositions(this.positions??[],this.arcType)};s();const o=this.disposeVar(f.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(f.track([r,"allowPicking"],[this,"allowPicking"])),this.dispose(f.bind([r,"arcType"],[this,"arcType"])),this.dispose(f.bind([r,"color"],[this,"color"])),this.dispose(f.bind([r,"dashLength"],[this,"dashLength"])),this.dispose(f.bind([r,"dashPattern"],[this,"dashPattern"])),this.dispose(f.bind([r,"gapColor"],[this,"gapColor"])),this.dispose(f.bind([r,"hasArrow"],[this,"hasArrow"])),this.dispose(f.bind([r,"hasDash"],[this,"hasDash"])),this.dispose(f.bind([r,"positions"],[this,"positions"])),this.dispose(f.bind([r,"show"],[this,"show"])),this.dispose(f.bind([r,"width"],[this,"width"])),this.dispose(f.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(f.track([u,"show"],[this,"show"])),u.dispose(f.track([u,"shadowDom"],[this,"shadowDom"])),u.dispose(f.track([u,"cssAllInitial"],[this,"cssAllInitial"])),a.push(u)}const l=this.distances.length;for(let u=0;u<l;++u){const d=this.distances[u],p=this.positions[u+1],_=rp(`长度: ${Tg(d)}`,p,e,n);_.dispose(f.track([_,"show"],[this,"show"])),_.dispose(f.track([_,"shadowDom"],[this,"shadowDom"])),_.dispose(f.track([_,"cssAllInitial"],[this,"cssAllInitial"])),this.ad(_.pickedEvent.don(y=>{qo(y)===0&&this.pickedEvent.emit(y)})),a.push(_)}};h(),this.dispose(this.distancesChanged.disposableOn(()=>f.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}}S(Gs,"defaults",{positions:[]}),(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:f.reactPositions(void 0),width:1,color:f.reactArray([1,1,1,1]),hasDash:!1,gapColor:f.reactArray([0,0,0,0]),dashLength:16,dashPattern:255,hasArrow:!1,arcType:"GEODESIC",depthTest:!1,shadowDom:!1,cssAllInitial:!1,strokeGround:!1})})(Gs||(Gs={})),f.extendClassProps(Gs.prototype,Gs.createDefaultProps);const Jo=class Jo extends Ws{constructor(e,n){super(e,n);S(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(f.track([o,"allowPicking"],[e,"allowPicking"])),this.dispose(f.bind([o,"positions"],[e,"points"])),this.dispose(f.track([o,"width"],[e,"strokeWidth"])),this.dispose(f.track([o,"color"],[e,"strokeColor"])),this.dispose(f.track([o,"show"],[e,"show"]));{const r=()=>{o.show=e.show&&e.stroked};r();const a=this.disposeVar(f.createNextAnimateFrameEvent(e.showChanged,e.strokedChanged));this.dispose(a.disposableOn(r))}}get geoPolyline(){return this._geoPolyline}};S(Jo,"type",Jo.register("ESOlViewer",f.ESGeoLineString.type,Jo));let Go=Jo;const tr=class tr extends Go{constructor(e,n){super(e,n);S(this,"_olDistanceMeasurement");if(console.log("OlESDistanceMeasurement constructor",n.viewer),this._olDistanceMeasurement=this.disposeVar(new Gs(n,e.id)),!n.viewer){console.warn("viewer is undefined!");return}const{olDistanceMeasurement:o}=this;this.dispose(f.track([o,"show"],[e,"show"])),this.dispose(f.track([o,"allowPicking"],[e,"allowPicking"])),this.dispose(f.bind([o,"positions"],[e,"points"])),this.dispose(f.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(f.createNextAnimateFrameEvent(e.strokeStyleChanged,e.strokedChanged));this.dispose(a.disposableOn(r))}this.dispose(o.pickedEvent.disposableOn(r=>{qo(r)===0&&(e.allowPicking??!1)&&e.pickedEvent.emit(r)}))}get olDistanceMeasurement(){return this._olDistanceMeasurement}};S(tr,"type",tr.register("ESOlViewer",f.ESDistanceMeasurement.type,tr));let Tl=tr;function ap(i){const t=f.min(f.objsIterator(i,["0"])),e=f.min(f.objsIterator(i,["1"])),n=f.max(f.objsIterator(i,["0"])),s=f.max(f.objsIterator(i,["1"]));return{minPos:[t,e],maxPos:[n,s]}}function Hv(i){const t=i.map(o=>vt(o)),{minPos:e,maxPos:n}=ap(t),s=[.5*(e[0]+n[0]),.5*(e[1]+n[1])];return Zt(s)}function Xv(i,t,e){const n=vt(e),s=vt(t),o=[s[0]-n[0],s[1]-n[1]];return i.map(c=>vt(c)).map(c=>[c[0]+o[0],c[1]+o[1]]).map(c=>Zt(c))}const Qn=class Qn extends f.ESObjectWithLocation{getESProperties(){const t={...super.getESProperties()};return{...t,coordinate:[...t.coordinate,new f.NumberProperty([this,"distance"],"长度",0,!1,!0)],style:[new f.GroupProperty([],"点样式","点样式集合"),new f.BooleanProperty([this,"pointed"],"开启",!1),new f.NumberProperty([this,"pointSize"],"点大小",1),new f.EnumProperty([this,"pointSizeType"],[["screen","screen"],["world","world"]],"点类型","screen"),new f.ColorProperty([this,"pointColor"],"点颜色",[1,1,1,1])],basic:[...t.basic,new f.EnumProperty([this,"mode"],[["柱状警告","cylinder"],["圆形警告","circle"]],"模式","cylinder"),new f.NumberProperty([this,"radius"],"半径",10)]}}constructor(t){super(t)}};S(Qn,"createDefaultProps",()=>({...f.ESObjectWithLocation.createDefaultProps(),pointed:!0,pointStyle:f.reactJson({size:1,sizeType:"screen",color:[1,1,1,1],material:"",materialParams:{},outlineColor:[1,0,0,1],outlineWidth:2})})),S(Qn,"type",Qn.register("ESGeoPoint",Qn,{chsName:"地理点",tags:["ESObjects","_ES_Impl_Openlayers"],description:"地理点"})),S(Qn,"supportEditingModes",[...f.ESObjectWithLocation.supportEditingModes]);let Ka=Qn;const Hs=class Hs extends f.ESVisualObject{getESProperties(){const t={...super.getESProperties()};return{...t,basic:[...t.basic,new f.NumberProperty([this,"zIndex"],"层级序号",0),new f.JsonProperty([this,"url"],"影像服务地址")]}}constructor(t){super(t)}};S(Hs,"createDefaultProps",()=>({...f.ESVisualObject.createDefaultProps(),attributions:f.reactArrayWithUndefined(void 0),attributionsCollapsible:void 0,cacheSize:void 0,crossOrigin:void 0,interpolate:void 0,projection:f.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:f.reactJsonWithUndefined(void 0),tileLoadFunction:void 0,tilePixelRatio:void 0,url:void 0,urls:f.reactArrayWithUndefined(void 0),wrapX:void 0,transition:void 0,zDirection:void 0,zIndex:void 0})),S(Hs,"type",Hs.register("ESXYZLayer",Hs,{chsName:"OL简单xyz图层",tags:[],description:"ESXYZLayer"}));let Qa=Hs;const ce=Math.PI,cp=6378245,hp=.006693421622965943;function lp(i,t){let e=$v(i-105,t-35),n=Zv(i-105,t-35);const s=t/180*ce;let o=Math.sin(s);o=1-hp*o*o;const r=Math.sqrt(o);return e=e*180/(cp*(1-hp)/(o*r)*ce),n=n*180/(cp/r*Math.cos(s)*ce),[n,e]}function up(i,t){return i<72.004||i>137.8347||t<.8293||t>55.8271}function $v(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 Zv(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 dp=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:dp(function(i,t,e){let n=i[e],s=i[e+1];if(!up(n,s)){const o=lp(n,s);n=n-o[0],s=s-o[1]}t[e]=n,t[e+1]=s}),fromWGS84:dp(function(i,t,e){let n=i[e],s=i[e+1];if(!up(n,s)){const o=lp(n,s);n=n+o[0],s=s+o[1]}t[e]=n,t[e+1]=s})},_e={ll2smerc:Dn("EPSG:4326","EPSG:3857"),smerc2ll:Dn("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 Al=new vc({code:"GCJ-02",extent:[-20037508342789244e-9,-20037508342789244e-9,20037508342789244e-9,20037508342789244e-9],units:"m"});_u(Al),Eu("EPSG:4326",Al,_e.ll2gmerc,_e.gmerc2ll),Eu("EPSG:3857",Al,_e.smerc2gmerc,_e.gmerc2smerc);class Kv extends f.Destroyable{constructor(t,e){super();const n=e.viewer;if(!n){console.warn("map is undefined!");return}const s=Ti(n);if(!s)return;const{imageriesManager:o}=s,r=Gt("EPSG:3857");if(!r)return;const a=r.getExtent(),c=_t(a)/256,h=new Array(19),l=new Array(19);for(let p=0;p<19;++p)h[p]=c/Math.pow(2,p),l[p]=p;const u=new Ha({tileGrid:new ks(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 d=new Ba({source:u});o.add(d),this.dispose(()=>o.delete(d)),d.setVisible(t.show??!0),this.dispose(()=>d.dispose()),this.dispose(t.showChanged.disposableOn(p=>{d.setVisible(p??!0)})),this.d(f.createEventsCallFunc(t.zIndexChanged,()=>{o.setZindex(d,t.zIndex??0)},{immediate:!0}));{const p=()=>{u.tileGrid=new ks(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(f.createNextAnimateFrameEvent(t.attributionsChanged,t.tileGridChanged,t.tileLoadFunctionChanged,t.tileUrlFunctionChanged));this.dispose(_.disposableOn(p))}t.urlChanged.disposableOn(p=>{u.setUrl(p??"")}),t.urlsChanged.disposableOn(p=>{u.setUrls(p??[])})}}const er=class er extends Xa{constructor(t,e){super(t,e);let n;this.dispose(()=>n&&n.destroy());{const s=()=>{n&&n.destroy(),n=new Kv(t,e)};s();const o=this.disposeVar(f.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))}}};S(er,"type",er.register(li.type,Qa.type,er));let Ml=er;const ir=class ir extends $a{constructor(e,n){super(e,n);S(this,"_geoPoint");if(this._geoPoint=this.disposeVar(new He(n,e.id)),!n.viewer){console.warn("viewer is undefined!");return}const o=this._geoPoint;this.d(f.track([o,"allowPicking"],[e,"allowPicking"])),this.d(f.bind([o,"position"],[e,"position"])),this.d(f.track([o,"show"],[e,"show"]));{const r=()=>{o.show=e.show&&e.pointed};r();const a=this.dv(f.createNextAnimateFrameEvent(e.showChanged,e.pointedChanged));this.d(a.don(r))}}get geoPoint(){return this._geoPoint}};S(ir,"type",ir.register("ESOlViewer",Ka.type,ir));let Dl=ir;const nr=class nr extends Ws{constructor(e,n){super(e,n);S(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(f.track([s,"allowPicking"],[e,"allowPicking"])),this.d(f.bind([s,"points"],[e,"points"]));{const r=()=>{s.show=e.show&&e.pointed};this.d(f.createEventsCallFunc([e.showChanged,e.pointedChanged],r,{immediate:!0}))}}get geoPoints(){return this._geoPoints}};S(nr,"type",nr.register("ESOlViewer",f.ESGeoPoints.type,nr));let Fl=nr;class fp extends f.Destroyable{constructor(e,n){super();S(this,"_olGeoCanvasImagePoi");S(this,"flyTo",(e,n)=>{if(this.olGeoCanvasImagePoi.position){xi(this.olViewer,this.olGeoCanvasImagePoi.position,1e3,Qd,e);return}this.olGeoCanvasImagePoi.flyTo(e&&e*1e3)});this.sceneObject=e,this.olViewer=n,this._olGeoCanvasImagePoi=this.dv(new hi(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]),f.ESSceneObject.context.getStrFromEnv(f.rpToap(u))},r=()=>{const l=o(typeof e.url=="string"?e.url:e.url.url);if(s.imageUri=l,e.sizeByContent){const d=new Image;d.src=l,d.onload=()=>{s.size=[d.width,d.height]}}else{const d=e.size;s.size=[...d]}},a=this.disposeVar(f.createNextAnimateFrameEvent(e.urlChanged,e.sizeByContentChanged,e.sizeChanged));this.d(a.don(()=>r())),r(),this.d(f.track([s,"zOrder"],[e,"zOrder"])),this.d(f.track([s,"show"],[e,"show"])),this.d(f.bind([s,"position"],[e,"position"])),this.ad(f.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(f.createNextAnimateFrameEvent(e.anchorChanged,e.offsetChanged));this.d(h.don(()=>c())),c(),this.d(s.clickEvent.don(l=>{const{offsetX:u,offsetY:d}=l,_={type:l.button===0?"leftClick":l.button===2?"rightClick":void 0,add:{mousePos:[u,d]}};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 sr=class sr extends Pl{constructor(e,n){super(e,n);S(this,"_resetting");if(!n.viewer){console.warn("viewer is undefined!");return}const o=this.dv(f.createNextAnimateFrameEvent(this.sceneObject.urlChanged,this.sceneObject.screenRenderChanged,this.sceneObject.sizeByContentChanged,this.sceneObject.sizeChanged));this._resetting=this.dv(new f.ObjResettingWithEvent(o,()=>new fp(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}};S(sr,"type",sr.register("ESOlViewer",f.ESImageLabel.type,sr));let Ll=sr;function gp(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 or=class or extends Xa{constructor(e,n){super(e,n);S(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(f.reactJson(""));{const l=()=>{if(typeof e.url=="string")r.value=f.ESSceneObject.context.getStrFromEnv(e.url);else{const u=e.url;u.url=f.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 d={type:"UrlTemplateImageryProvider",url:r.value,rectangle:e.rectangle,maximumLevel:e.maximumLevel,minimumLevel:e.minimumLevel,...u},p=r.value,_=typeof p=="string"?p:p.url;const y=_.toLowerCase();if(gp(l)==="auto")if(y.startsWith("ion://")){const P=+y.substring(6);d={...u,assetId:P,type:"IonImageryProvider"}}else if(y.includes("{x}")||y.includes("{y}")||y.includes("{z}"))d.type="UrlTemplateImageryProvider";else if(y.includes("wmts"))d.type="WebMapTileServiceImageryProvider";else if(y.includes("wms"))d.type="WebMapServiceImageryProvider";else{if(_.includes("/tilemapresource.xml")){const b=_.split("/tilemapresource.xml").join("");typeof p=="string"?p=b:p.url=b,d.url=p}d.type="TileMapServiceImageryProvider"}else{if(l==="tms"&&_.includes("/tilemapresource.xml")){const P=_.split("/tilemapresource.xml").join("");typeof p=="string"?p=P:p.url=P,d.url=p}else if(l==="ion"&&y.startsWith("ion://")){const I=+_.substring(6);d={...u,assetId:I,type:"IonImageryProvider"}}const b=gp(l);b!=="auto"&&(d.type=b)}if(d.type==="WebMapTileServiceImageryProvider"){let b=typeof p=="string"?p:p.url;const P=b.indexOf("?");if(P>=0){const z=new URLSearchParams(b.substring(P+1)),q=z.get("format")||z.get("Format")||d.format;d.format=q||"image/png",b=b.substring(0,P)}else d.format=d.format??"image/png";const I=(E=/\/wmts\/rest\/([^/]+)\//i.exec(b))==null?void 0:E[1];I?d.layer=d.layer??d.layers??I:d.layer=d.layer??d.layers??"";const M=d.tileMatrixSetID||d.TileMatrixSet||"EPSG:4326";let D=d.tileMatrixLabels||d.TileMatrixLabels;(!D||!Array.isArray(D)||D.length===0)&&(D=Array.from({length:22},(z,q)=>`${M}:${q}`)),d.tileMatrixSetID=M,d.tileMatrixLabels=D,d.style=d.style??"default";const L=b.toLowerCase().indexOf("/wmts/");if(L>=0){const z=b.substring(0,L);d.url=`${z}/wmts`;const q=typeof p=="string"?p:p.url,Y=/\/wmts\/rest\/([^/]+)\//i.exec(q);Y&&Y[1]&&(d.layer=Y[1]),d._rawUrl=q}else{d.url=b;const z=typeof p=="string"?p:p.url,q=/\/wmts\/rest\/([^/]+)\//i.exec(z);q&&q[1]&&(d.layer=q[1]),d._rawUrl=z}d.requestEncoding="KVP",d.requestencoding="KVP",d.params=void 0}else if(d.type==="WebMapServiceImageryProvider"){const b=d.layer??d.layers??"",P=d.style??"",I=d.format??"image/png";d.params={...d.params??{},LAYERS:b,STYLES:P,FORMAT:I,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 c=[r.changed,e.maximumLevelChanged,e.minimumLevelChanged,e.optionsChanged,e.rectangleChanged],h=this.dv(f.createNextAnimateFrameEvent(...c));this.d(h.don(a)),this.d(f.track([o,"show"],[e,"show"])),this.d(f.track([o,"splitDirection"],[e,"splitDirection"])),this.d(f.track([o,"brightness"],[e,"czmBrightness"])),this.d(f.track([o,"contrast"],[e,"czmContrast"])),this.d(f.track([o,"hue"],[e,"czmHue"])),this.d(f.track([o,"saturation"],[e,"czmSaturation"])),this.d(f.track([o,"gamma"],[e,"czmGamma"])),this.d(f.track([o,"rectangle"],[e,"rectangle"])),this.d(f.track([o,"zIndex"],[e,"zIndex"])),this.d(f.bind([o,"alpha"],[e,"opacity"])),this.d(f.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}};S(or,"type",or.register("ESOlViewer",f.ESImageryLayer.type,or));let zl=or;function pp(i,t=!1){const e=Na(i[0],t),n=Na(i[1],t),s=Tg(i[2]);return[e,n,s]}const ze=class ze extends $a{constructor(e,n){super(e,n);S(this,"_geoCustomDivPoi");S(this,"_textFunc",this.disposeVar(f.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(f.track([o,"show"],[e,"show"])),this.dispose(f.bind([o,"position"],[e,"position"])),this.dispose(f.track([o,"allowPicking"],[e,"allowPicking"]));{this.dispose(o.pickedEvent.disposableOn(r=>{(e.allowPicking??f.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=za(c)};r();const a=this.disposeVar(f.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}};S(ze,"type",ze.register("ESOlViewer",f.ESLocationMeasurement.type,ze)),S(ze,"defaultTextFunc_度格式",e=>{if(!e)return"";const[n=0,s=0,o=0]=e;return`经度: ${n.toFixed(5)}°
163
+ 纬度: ${s.toFixed(5)}°`}),S(ze,"defaultTextFunc_度分格式",e=>{if(!e)return"";const[n,s,o]=pp(e,!0);return`经度: ${n}
164
+ 纬度: ${s}`}),S(ze,"defaultTextFunc_度分秒格式",e=>{if(!e)return"";const[n,s,o]=pp(e);return`经度: ${n}
165
+ 纬度: ${s}`});let Nl=ze;class Bo extends fs{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()),On(r,l.getFlatCoordinates()),a.push(r.length)}this.setFlatCoordinates(s,r),this.ends_=a}}appendLineString(t){this.flatCoordinates?On(this.flatCoordinates,t.getFlatCoordinates().slice()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Bo(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,n,s){return s<eo(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Ou(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Iu(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,j0(this.flatCoordinates,0,this.ends_,this.stride,t,e,n))}getCoordinates(){return ao(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new _i(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 _i(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=ju(e,n,c,o,.5);On(t,h),n=c}return t}getSimplifiedGeometryInternal(t){const e=[],n=[];return e.length=O0(this.flatCoordinates,0,this.ends_,this.stride,t,e,0,n),new Bo(e,"XY",n)}getType(){return"MultiLineString"}intersectsExtent(t){return F0(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const n=Tu(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}}function Vo(i,t){const[e,n]=i,[s,o]=t;return Math.sqrt(Math.pow(e-s,2)+Math.pow(n-o,2))}function Yo(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 Qv(i,t,e){let n=1/0,s=0,o=0,r=0;for(let p=0;p<i.length-1;p++){const[_,y]=i[p],[w,E]=i[p+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=p,o=Y)}for(let p=0;p<s;p++)r+=Vo(i[p],i[p+1]);r+=o*Vo(i[s],i[s+1]);const a=r+e;let c=0;for(let p=0;p<i.length-1;p++)c+=Vo(i[p],i[p+1]);let h=0;if(a<=0){const p=tc([i[0],i[1]],!0);return{point:Yo(i[0],p+180,Math.abs(a)),angle:p,isValid:!1}}for(let p=0;p<i.length-1;p++){const _=Vo(i[p],i[p+1]);if(h+_>=a){const w=(a-h)/_,[E,b]=i[p],[P,I]=i[p+1],M=[E+w*(P-E),b+w*(I-b)],D=tc([i[p],i[p+1]],!0);return{point:M,angle:D,isValid:!0}}h+=_}const l=i.length-1,u=tc([i[l-1],i[l]],!0),d=a-h;return{point:Yo(i[l],u,d),angle:u,isValid:!1}}function mp(i,t,e,n,s){let o=Vo(i,t),r=tc([i,t],!0);const a=s-n;if(a>0&&o>a){const[c,h]=Yo(i,r,a);return e.push([c,h,r,!0]),mp([c,h],t,e,0,s)}else return o+n}function _p(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=mp(a,c,n,s,e),s=s%e,n.push([...c,0,!1])}return n}const rr=class rr extends Go{constructor(e,n){super(e,n);S(this,"animationId",null);S(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});S(this,"offset",this.sceneObject.strokeWidth*this.options.ARROW_OFFSET_RATIO*window.devicePixelRatio);S(this,"eventsKey",null);const s=n.viewer;if(!s)return;const o=this.geoPolyline._layer;this.d(()=>this.clear()),this.d(f.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 d;const{ARROW_LINE_WIDTH_RATIO:n,ARROW_OFFSET_RATIO:s,ARROW_LINE_COLOR:o}=this.options,r=Td(e),a=e.target,c=r.transform_,h=r.context_,l=a.getSource(),u=(d=e.frameState)==null?void 0:d.extent;e.frameState&&(e.frameState.animate=!0),!(!l||!u)&&l.forEachFeatureInExtent(u,p=>{const _=p.getGeometry();let y;_ instanceof Bo?y=_.getLineStrings():_ instanceof _i&&(y=[_]),y&&y.forEach(w=>{const E=w.getFlatCoordinates(),b=mi(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=_p(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=Yo([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),R=L-Y*Math.sin(X-45*Math.PI/180);h.beginPath(),h.moveTo(Q,m),h.lineTo(D,L),h.lineTo(v,R),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=Td(e),h=e.target,l=c.transform_,u=c.context_,d=h.getSource(),p=(_=e.frameState)==null?void 0:_.extent;e.frameState&&(e.frameState.animate=!0),!(!d||!p)&&d.forEachFeatureInExtent(p,y=>{const w=y.getGeometry();let E;w instanceof Bo?E=w.getLineStrings():w instanceof _i&&(E=[w]),E&&E.forEach(b=>{const P=b.getFlatCoordinates(),I=mi(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=_p(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=Qv(M,[z,q],Q);if(!m.isValid)continue;const[v,R]=m.point,A=m.angle,F=Yo([v,R],A-180,5),N=this.sceneObject.strokeWidth*.5*window.devicePixelRatio,G=Math.atan2(R-F[1],v-F[0]),B=v-N*Math.cos(G+45*Math.PI/180),Z=R-N*Math.sin(G+45*Math.PI/180),V=v-N*Math.cos(G-45*Math.PI/180),at=R-N*Math.sin(G-45*Math.PI/180);u.beginPath(),u.moveTo(B,Z),u.lineTo(v,R),u.lineTo(V,at),u.stroke()}})})})}};S(rr,"type",rr.register(li.type,f.ESPath.type,rr));let Ul=rr;const ar=class ar extends Pl{constructor(e,n){super(e,n);S(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(f.createNextAnimateFrameEvent(e.anchorChanged,e.offsetChanged));this.dispose(r.disposableOn(()=>o())),o(),this.dispose(f.track([s,"zOrder"],[e,"zOrder"])),this.dispose(f.track([s,"show"],[e,"show"])),this.dispose(f.bind([s,"text"],[e,"text"])),this.dispose(f.track([s,"color"],[e,"color"])),this.dispose(f.track([s,"backgroundColor"],[e,"backgroundColor"])),this.dispose(f.bind([s,"textEditingInteraction"],[e,"textEditingInteraction"])),this.dispose(f.bind([s,"textEditing"],[e,"textEditing"])),this.dispose(f.bind([s,"position"],[e,"position"])),this.dispose(f.track([s,"width"],[e,"width"])),this.dispose(f.track([s,"opacity"],[e,"opacity"])),this.dispose(f.track([s,"padding"],[e,"padding"])),this.dispose(f.track([s,"borderRadius"],[e,"borderRadius"])),this.dispose(f.track([s,"borderColor"],[e,"borderColor"])),this.dispose(f.track([s,"borderWidth"],[e,"borderWidth"])),this.dispose(f.track([s,"textAlign"],[e,"textAlign"])),this.dispose(f.track([s,"fontSize"],[e,"fontSize"])),this.dispose(f.track([s,"borderStyle"],[e,"borderStyle"])),this.dispose(f.track([s,"pickOnClick"],[e,"allowPicking"])),this.dispose(f.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}};S(ar,"type",ar.register(li.type,f.ESTextLabel.type,ar));let jl=ar;const Jn=class Jn extends le{constructor(e){super();S(this,"_config",this.disposeVar(f.react(Jn.defaultConfig)));S(this,"_overEvent",this.disposeVar(new f.Event));S(this,"_pointerEventFilterFunc",this.disposeVar(f.react(Jn.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 He(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 f.ObjResettingWithEvent(this.enabledChanged,()=>this.enabled?new Jv(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}};S(Jn,"defaultConfig",{clickEnabled:!0,dblClickEnabled:!0}),S(Jn,"defaultPointerEventFilterFunc",e=>e.button===0),S(Jn,"defaults",{...le.defaults,position:[116.39,39.9,0]});let Mi=Jn;(i=>{i.createDefaultProps=()=>({...le.createDefaultProps(),position:f.reactArrayWithUndefined(void 0),virtualHeight:void 0,clickEnabled:!0,dblClickEnabled:!1})})(Mi||(Mi={})),f.extendClassProps(Mi.prototype,Mi.createDefaultProps);class Jv extends f.Destroyable{constructor(e,n){super();S(this,"_doings",[]);S(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 tE(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 tE extends f.Destroyable{constructor(t,e,n){super(),this._owner=t;const{olViewer:s}=this._owner;if(!s)return;const o=ef(s,e,this._owner.placeEditing.virtualHeight),[r]=f.getEventFromPromise(o);this.dispose(r.disposableOn(n))}}class Pe extends le{constructor(){super()}}S(Pe,"defaults",{...le.defaults,position:[116.39,39.9,0]}),(i=>{i.createDefaultProps=()=>({...le.createDefaultProps(),position:f.reactArrayWithUndefined(void 0)})})(Pe||(Pe={})),f.extendClassProps(Pe.prototype,Pe.createDefaultProps);function yp(i,t){const e=new Jt(i);return e.hasArrow=!0,e.arcType="RHUMB",e.width=4,e.color=t,e}const zi=class zi extends f.Destroyable{constructor(t){if(super(),!t.viewer)return;const e=this.disposeVar(yp(t,zi.defaults.xAxisColor)),n=this.disposeVar(yp(t,zi.defaults.yAxisColor));{const s=()=>{e.show=this.xAxisShow&&this.show,n.show=this.yAxisShow&&this.show};s();const o=this.ad(f.createNextAnimateFrameEvent(this.showChanged,this.xAxisShowChanged,this.yAxisShowChanged));this.dispose(o.disposableOn(s))}{const s=()=>{var p;const{position:r=zi.defaults.position,heading:a=zi.defaults.heading}=this,l=((p=t.viewer)==null?void 0:p.getView().getResolution())*65,u=f.geoRhumbDestination(r,l,90+a),d=f.geoRhumbDestination(r,l,0+a);u&&(e.positions=[r,u]),d&&(n.positions=[r,d])};s();const o=this.disposeVar(f.createNextAnimateFrameEvent(this.positionChanged,this.dimensionsChanged,this.headingChanged));this.dispose(o.disposableOn(s))}{const s=()=>{e.color=this.xAxisColor??zi.defaults.xAxisColor,n.color=this.yAxisColor??zi.defaults.yAxisColor};s();const o=this.disposeVar(f.createNextAnimateFrameEvent(this.xAxisColorChanged,this.yAxisColorChanged));this.dispose(o.disposableOn(s))}}};S(zi,"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=zi;(i=>{i.createDefaultProps=()=>({show:!0,position:f.reactArrayWithUndefined(void 0),heading:0,dimensions:f.reactArray([1e3,1e3,1e3]),xAxisColor:f.reactArray([1,0,0,1]),yAxisColor:f.reactArray([0,1,0,1]),xAxisShow:!0,yAxisShow:!0})})(yn||(yn={})),f.extendClassProps(yn.prototype,yn.createDefaultProps);class ui extends f.Destroyable{constructor(e,n){super();S(this,"_flyToEvent",this.disposeVar(new f.Event));S(this,"_layer");S(this,"_source");const s=e.viewer;if(!s)return;this._source=new en,this._layer=new bi({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(d=>vt([d[0],d[1]]));this.loop&&h.length>=3&&h.push(h[0]);const l=new _i(h),u=new Je({geometry:l});u.setId(f.createGuid()),u.setStyle(new Kt({stroke:new Re({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(f.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)];xi(e,h)}))}get typeName(){return"OlPolylines"}get defaultProps(){return ui.createDefaultProps()}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}}(i=>{i.createDefaultProps=()=>({show:!0,positions:f.reactPositionsSet(void 0),width:2,color:f.reactArray([1,1,1,1]),loop:!1,hasDash:!1,dashLength:16,arcType:"GEODESIC",topOrBottom:"none"})})(ui||(ui={})),f.extendClassProps(ui.prototype,ui.createDefaultProps);const vn=class vn extends Pe{constructor(e){super();S(this,"_opInfo",{step:this.ad(f.react(!1)),moved:this.ad(f.react(!1)),constraintMode:this.ad(f.react("none")),originPosition:this.disposeVar(f.reactArray(Pe.defaults.position)),originHeading:this.disposeVar(f.react(0)),originDimensions:this.disposeVar(f.reactArray([1,1,1])),draggingStartPosition:this.disposeVar(f.reactArray([0,0,0])),movingPosition:this.disposeVar(f.reactArray([0,0,0])),targetPosition:this.disposeVar(f.reactArray([0,0,0])),targetHeading:this.disposeVar(f.react(0))});S(this,"_createCoordinates",e=>{const n=this.ad(new yn(e));this.dispose(this._opInfo.step.changed.disposableOn(()=>{wp(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});S(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});S(this,"_createGrid",e=>{const n=this.ad(new ui(e));{const s=()=>{var d;const r=this._opInfo.originPosition.value,a=this._opInfo.originHeading.value,h=((d=e.viewer)==null?void 0:d.getView().getResolution())*15,l=h*5,u=[];for(let p=-4;p<5;++p){const _=f.geoRhumbDestination(r,p*h,a+90);if(_){const y=f.geoRhumbDestination(_,l,a+180),w=f.geoRhumbDestination(_,l,a);y&&w&&u.push([y,_,w])}}for(let p=-4;p<5;++p){const _=f.geoRhumbDestination(r,p*h,a);if(_){const y=f.geoRhumbDestination(_,l,a-90),w=f.geoRhumbDestination(_,l,a+90);y&&w&&u.push([y,_,w])}}n.positions=u};s();const o=this.disposeVar(f.createNextAnimateFrameEvent(this._opInfo.originPosition.changed,this._opInfo.originHeading.changed,this._opInfo.originDimensions.changed));this.dispose(o.disposableOn(s))}return n});S(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(f.createNextAnimateFrameEvent(this._opInfo.originPosition.changed,this._opInfo.targetPosition.changed));this.ad(o.don(s))}return n});S(this,"_createCircle",e=>{const n=this.ad(new ui(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(f.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 d=0;d<=l;++d){const p=d*360/l,_=f.geoRhumbDestination(r,c,p);_&&h.push(_)}h.length>0&&h.push(h[0]),n.positions=[h]};return o(),this.dispose(s.disposableOn(o)),n});S(this,"_pickingXYProcessing",e=>this.ad(new f.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=Zt(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];f.geoRhumbDestination(r,o,s,u),this._opInfo.targetPosition.value=u})})));if(!e.viewer)return;const n=this.ad(f.reactArray([1,1,1]));this.ad(e.dblclickEvent.don(()=>this.enabled=!1)),this.ad(new rf(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 d=()=>{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};d();const p=this.ad(f.createNextAnimateFrameEvent(this.enabledChanged,this.showCircleChanged,this.showCoordinatesChanged,this._opInfo.moved.changed));this.ad(p.don(d))}{const d=()=>{s.xAxisShow=o.xAxisShow=this.xAxisShow,s.yAxisShow=o.yAxisShow=this.yAxisShow};d();const p=this.ad(f.createNextAnimateFrameEvent(this.xAxisShowChanged,this.yAxisShowChanged));this.ad(p.don(d))}{const d=()=>{r.color=this._opInfo.constraintMode.value!=="none"?[1,1,0,.6]:[1,1,0,.3],wp(s,this._opInfo.constraintMode.value,this._opInfo.step.value)};d(),this.dispose(this._opInfo.constraintMode.changed.disposableOn(d))}const h=this._pickingXYProcessing(e),l=this.ad(f.createProcessingFromAsyncFunc(async d=>{do this._opInfo.step.value=!0,this._opInfo.constraintMode.value="none",d.disposer.dispose(()=>{this._opInfo.constraintMode.value="none"}),await f.step(d,async p=>{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;p.disposer.dispose((_(),this.positionChanged.don(_))),p.disposer.dispose((y(),this.headingChanged.don(y))),p.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&&nf(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};p.disposer.dispose(e.pointerMoveEvent.don(P=>{P.pointerEvent&&b(P.pointerEvent)})),await f.step(p,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 f.step(d,async p=>{if(e.incrementDisabledInputStack(),console.log("检查地图交互编辑模式",e.disabledInputStack),p.disposer.dispose(()=>{e.decrementDisabledInputStack()}),["xy","x","y"].includes(this._opInfo.constraintMode.value)){const _=f.geoRhumbHeading(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value),y=f.geoRhumbDistance(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value);h.restart(void 0,_,y),p.disposer.dispose(()=>h.cancel())}else console.warn(`pickingInfo.constraintMode error! ${this._opInfo.constraintMode.value}`);await f.step(p,_=>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))}}};S(vn,"defaults",{...Pe.defaults,heading:0,dimensions:[200,200,200],xAxisColor:[1,0,0,1],yAxisColor:[0,1,0,1]});let Di=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})})(Di||(Di={})),f.extendClassProps(Di.prototype,Di.createDefaultProps);function wp(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 Bs extends f.Destroyable{constructor(e){super();S(this,"_vectorLayer");S(this,"_feature");S(this,"_circleCanvas");S(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,d;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(),(d=(u=this._feature)==null?void 0:u.changed)==null||d.call(u)};e();const n=this.ad(f.createNextAnimateFrameEvent(this.colorChanged,this.circleRotationChanged,this.circleStartRotationChanged,this.circleEndRotationChanged));this.ad(n.don(e))}_createVectorLayer(e){var o;const n=new en;this._feature=new Je({geometry:new Ke([0,0])});const s=()=>this._circleCanvas?new Kt({image:new Eo({img:this._circleCanvas,imgSize:[256,256],anchor:[.5,.5],anchorXUnits:"fraction",anchorYUnits:"fraction",scale:(this.pixelSize??300)/256}),text:new po({text:"",font:"0px console"})}):new Kt;this._feature.setStyle(s),n.addFeature(this._feature),this._vectorLayer=new bi({source:n,zIndex:1e3});{const r=()=>{if(!this.position||!this._feature)return;const a=vt([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 en;this._debugFeature=new Je({geometry:new Ke([0,0])}),this._debugFeature.setStyle(new Kt({image:new ii({radius:5,fill:new de({color:"red"})})})),n.addFeature(this._debugFeature);const s=new bi({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=vt([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)})}}S(Bs,"defaults",{position:[116.39,39.9,0]}),(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,editing:!1,position:f.reactArrayWithUndefined(void 0),rotation:f.reactArray([0,0,0]),selfRotation:f.reactArray([0,0,0]),pixelSize:300,color:f.reactArray([1,1,1,1]),circleRotation:0,circleStartRotation:0,circleEndRotation:0,debug:!1})})(Bs||(Bs={})),f.extendClassProps(Bs.prototype,Bs.createDefaultProps);function vp(i,t){const n=i.getViewport().getBoundingClientRect();return[t.clientX-n.left,t.clientY-n.top]}class eE extends f.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(f.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,d=0;const p=c.pointerEvent,_=vp(e.viewer,p);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),d+=w,u=y;let E=n.startRotation+d;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 f.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=vt([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=vp(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();S(this,"_hoveredPlaneType",this.disposeVar(f.react("none")));S(this,"_movingPlaneType",this.disposeVar(f.react("none")));S(this,"_previewRotation",this.disposeVar(f.react(0)));S(this,"_circle");S(this,"_rotatorRunningResetting");this._olViewer=e;const n=this._olViewer;this._rotatorRunningResetting=this.disposeVar(new f.ObjResettingWithEvent(this.enabledChanged,()=>{if(this.enabled)return new eE(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 Bs(e));this.dispose(f.track([n,"position"],[this,"position"])),this.dispose(f.track([n,"pixelSize"],[this,"pixelSize"])),this.dispose(f.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}}S(wn,"rotationNum",{heading:0}),S(wn,"rotationFuncs",{heading:([e,n,s])=>[0,n,s]}),(i=>{i.createDefaultProps=()=>({...Pe.createDefaultProps(),rotation:f.reactArray([0,0,0]),selfRotation:f.reactArray([0,0,0]),pixelSize:300,showHelper:!1,debug:!1})})(wn||(wn={})),f.extendClassProps(wn.prototype,wn.createDefaultProps);const ts=class ts extends f.Destroyable{get startPosition(){return this.positions&&this.positions[0]}set startPosition(t){this.positions=[t??ts.defaults.positions[0],this.stopPosition??ts.defaults.positions[1]]}get startPositionChanged(){return this.positionsChanged}get stopPosition(){return this.positions&&this.positions[1]}set stopPosition(t){this.positions=[this.startPosition??ts.defaults.positions[0],t??ts.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 He(t,e));this.ad(f.track([s,"allowPicking"],[this,"allowPicking"])),this.ad(f.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))}}};S(ts,"defaults",{positions:[[0,0,0],[0,0,1e6]]});let $n=ts;(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:f.reactPositions(i.defaults.positions),width:10,color:f.reactArray([1,0,0,1])})})($n||($n={})),f.extendClassProps($n.prototype,$n.createDefaultProps);class Fi extends Pe{constructor(e){super();S(this,"_lastPosition");S(this,"_opInfo",{step:this.ad(f.react(!1)),moved:this.ad(f.react(!1)),constraintMode:this.disposeVar(f.react("none")),originPosition:this.disposeVar(f.reactArray([0,0,0])),originHeading:this.disposeVar(f.react(0)),originDimensions:this.disposeVar(f.reactArray([1,1,1])),draggingStartPosition:this.disposeVar(f.reactArray([0,0,0])),movingPosition:this.disposeVar(f.reactArray([0,0,0])),targetPosition:this.disposeVar(f.reactArray([0,0,0])),targetHeading:this.disposeVar(f.react(0))});S(this,"_scaleAxis");S(this,"_pickingXYProcessing",e=>this.disposeVar(new f.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]=Zt(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 d=[0,0,0];if(f.geoRhumbDestination(r,o,s,d),this._opInfo.targetPosition.value=d,!this._axisPixelInfo)return;const p=this._axisPixelInfo,_=e.viewer.getEventPixel(a.pointerEvent),y=p.len*p.len,w=((_[0]-p.a[0])*p.v[0]+(_[1]-p.a[1])*p.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===p.sideStart||p.sideStart===0?P=Math.max(0,Math.abs(E)-Math.abs(p.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]=p.baseScale;let Y=L,X=z;p.mode==="y"?Y=Math.max(.01,L*D):p.mode==="x"&&(X=Math.max(.01,z*D)),this.scale=[Y,X,q??0]})})));S(this,"_axisPixelInfo");console.log("here ScaleEditing constructor",e.viewer);const n=e.viewer;if(n){this.ad(new Pg(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=Fi.defaults.position}=this;console.log("ScaleEditing.defaults.position",r);const{yAxis:a,xAxis:c}=this._scaleAxis;c.startPosition=a.startPosition=r;const h=f.geoRhumbDestination(r,this._opInfo.originDimensions.value[0],90);h&&(c.stopPosition=h);const l=f.geoRhumbDestination(r,this._opInfo.originDimensions.value[1],0);l&&(a.stopPosition=l)};s();const o=this.ad(f.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??Fi.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};of(n,l,u,this.axisSnapPixelSize,r);const d=n.getView().getProjection(),p=n.getEventPixel(l),_=q=>n.getPixelFromCoordinate(vt([q[0],q[1]],d)),{xAxis:y,yAxis:w}=this._scaleAxis,E=_(y.startPosition),b=_(y.stopPosition),P=_(w.startPosition),I=_(w.stopPosition),M=Ep(p,E,b),D=Ep(p,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(p);if(q){const[Y,X]=Zt(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(f.createProcessingFromAsyncFunc(async l=>{this._opInfo.step.value=!0,this._opInfo.constraintMode.value="none",l.disposer.dispose(()=>{this._opInfo.constraintMode.value="none"}),await f.step(l,async u=>{u.disposer.dispose((o(),this.positionChanged.disposableOn(o))),u.disposer.dispose(e.pointerMoveEvent.disposableOn(d=>{d.pointerEvent&&a(d.pointerEvent)})),await f.step(u,d=>new Promise((p,_)=>{d.disposer.dispose(_),d.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(vt([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]}}p()}}))}))}),this._opInfo.step.value=!1,await f.step(l,async u=>{if(e.incrementDisabledInputStack(),u.disposer.dispose(()=>e.decrementDisabledInputStack()),this.dispose(this.enabledChanged.disposableOn(d=>{if(!d&&e.disabledInputStack>0)for(;e.disabledInputStack>0;)e.decrementDisabledInputStack()})),["x","y"].includes(this._opInfo.constraintMode.value)){const d=f.geoRhumbHeading(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value),p=f.geoRhumbDistance(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value);s.restart(void 0,d,p),u.disposer.dispose(()=>s.cancel())}await f.step(u,d=>new Promise((p,_)=>{d.disposer.dispose(_),d.disposer.dispose(e.pointerUpEvent.don(()=>{p()})),d.disposer.dispose(e.pointerOutEvent.don(()=>{p()}))})),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 $n(e));return s.width=10,this.ad(f.track([s,"show"],[this,"enabled"])),s}}(i=>{i.createDefaultProps=()=>({...Pe.createDefaultProps(),scale:f.reactArray([1,1,0]),axisPixelSize:100,axisSnapPixelSize:10,scaleSensitivity:.8})})(Fi||(Fi={})),f.extendClassProps(Fi.prototype,Fi.createDefaultProps);function Ep(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,d=i[0]-l,p=i[1]-u;return{dist:Math.hypot(d,p),t:h}}const Ni=class Ni extends le{constructor(e){super();S(this,"_editingPoints",this.disposeVar(new f.ObservableArray));S(this,"_cancelEvent",this.disposeVar(new f.Event));S(this,"_currentProcess");S(this,"_menuPoiEnabled",this.disposeVar(f.react(!1)));S(this,"_status",this.disposeVar(f.react("None")));S(this,"_positionsChanged",this.ad(new f.Event));S(this,"_cursorInfo");this._olViewer=e,console.log("imgaeUrl:",Ni.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(f.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??Ni.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??Ni.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(f.track([n,"color"],[this,"polylineColor"])),this.ad(f.track([n,"width"],[this,"polylineWidth"])),this.ad(f.track([n,"show"],[this,"polylineShow"])),this.ad(f.track([n,"arcType"],[this,"polylineArcType"])),this.ad(f.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 f.CursorInfo(e.container,f.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)}}))}};S(Ni,"baseImageUrl",f.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/img/")),S(Ni,"defaults",{...le.defaults,debug:!1,polylineShow:!1,polylineWidth:1,polylineColor:[1,1,1,1],polylineArcType:"GEODESIC",maxPointsNum:Number.MAX_SAFE_INTEGER,loop:!1,firstControlPointImageUrl:Ni.baseImageUrl+"point-green.png",otherControlPointImageUrl:Ni.baseImageUrl+"point-yellow.png"});let Le=Ni;(i=>{i.createDefaultProps=()=>({...le.createDefaultProps(),loop:!1,debug:!1,polylineShow:!0,polylineWidth:1,polylineColor:f.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={})),f.extendClassProps(Le.prototype,Le.createDefaultProps);let iE=0;class kl extends f.Destroyable{constructor(e,n){super();S(this,"_position",this.disposeVar(f.reactArrayWithUndefined(void 0)));S(this,"_id",iE++);S(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 Ns(e.olViewer));s.enabled=!1,this.ad(f.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 Wl extends kl{constructor(t,e){super(t,e)}}class jt extends Le{constructor(e){super(e);S(this,"_deletePreviousPointWhileAddingEvent",this.disposeVar(new f.Event));S(this,"placeEditing");if(!e.viewer)return;const n=this.placeEditing=this.ad(new Mi(e));n.enabled=!1,this.currentProcess=this.disposeVar(f.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(f.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 Wl(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=f.createProcessingFromAsyncFunc(async s=>{let o=this.editingPoints.length;this.menuPoiEnabled=!1;do if(!await s.promise(f.step(s,async a=>{let c;!e()&&(c=a.disposer.disposeVar(new Cp(this,o)));const l=a.disposer.disposeVar(new xp(this,o));return a.disposer.dispose(this._deletePreviousPointWhileAddingEvent.disposableOn(()=>l.do())),await a.promise(new Promise(u=>{c&&a.disposer.dispose(c.overEvent.disposableOnce(d=>{d?(o++,u(!0)):u(!1)})),a.disposer.dispose(l.overEvent.disposableOnce(d=>{d?(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={})),f.extendClassProps(jt.prototype,jt.createDefaultProps);class Cp extends f.Destroyable{constructor(e,n){super();S(this,"_overEvent",this.disposeVar(new f.Event));const{placeEditing:s}=e;let o=new Wl(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(f.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 bp(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 xp extends f.Destroyable{constructor(e,n){super();S(this,"_overEvent",this.disposeVar(new f.Event));S(this,"_doEvent",this.disposeVar(new f.Event));this.dispose(this._doEvent.disposableOn(()=>this._overEvent.emit(bp(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 Sp extends jt{constructor(t){super(t),this.loop=!0}}class ec extends kl{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 hi(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 d=t.editingPoints.get(l).position;if(!d)break;const p=rl(h,d);if(!p)break;p[2]-=t.olViewer.editingHeightOffset??0,n.position=p;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);S(this,"_menuPoiCommand",this.disposeVar(new f.Event));S(this,"_forceModifyPosEditorEvent",this.disposeVar(new f.Event));S(this,"_overEvent",this.disposeVar(new f.Event));S(this,"translationEditing");console.log("这是多点修改编辑器");{const s=this.ad(f.createNextAnimateFrameEvent(this.moveWithFirstPositionChanged,this.editingPoints.changedEvent));this.ad(new f.ObjResettingWithEvent(s,()=>{if(!(!this.moveWithFirstPosition||this.editingPoints.length<=1))return new nE(this.editingPoints.get(0),this)}))}const n=this.translationEditing=this.disposeVar(new Di(e));n.enabled=!1,this.currentProcess=this.disposeVar(f.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(f.step(s,async r=>{const a=r.disposer,c=a.ad(new sE(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 d=new ec(this,u);this.editingPoints.splice(o,0,d)}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={})),f.extendClassProps(Ot.prototype,Ot.createDefaultProps);class nE extends f.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 sE extends f.Destroyable{constructor(e){super();S(this,"_overEvent",this.disposeVar(new f.Event));S(this,"_cancelEvent",this.disposeVar(new f.Event));S(this,"_forceModifyPosEditorEvent",this.disposeVar(new f.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 oE(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 oE extends f.Destroyable{constructor(e,n){super();S(this,"_overEvent",this.disposeVar(new f.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(f.track([this._posEditor,"position"],[s,"position"])),this.dispose(s.enabledChanged.disposableOnce(o=>{o||this._overEvent.emit()}))}get overEvent(){return this._overEvent}}class Pp extends Ot{constructor(t){super(t),this.loop=!1}}class Op extends Ot{constructor(t){super(t),this.loop=!0}}class Vs 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=f.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=f.geoHeading(this.startPosition,this.endPosition),s=f.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:f.reactArrayWithUndefined(void 0),endPosition:f.reactArrayWithUndefined(void 0),rotation:f.reactArray([90,0,0]),distance:f.react(1)})})(Vs||(Vs={})),f.extendClassProps(Vs.prototype,Vs.createDefaultProps);class Zn 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=f.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=f.geoHeading(this.startPosition,this.endPosition),s=f.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:f.reactArrayWithUndefined(void 0),endPosition:f.reactArrayWithUndefined(void 0),rotation:f.reactArray([0,0,0]),distance:f.react(0)})})(Zn||(Zn={})),f.extendClassProps(Zn.prototype,Zn.createDefaultProps);class rE extends jt{constructor(t){super(t),this.loop=!1,this.polylineShow=!1}}class aE extends Ot{constructor(t){super(t),this.loop=!1,this.polylineShow=!1,this.middlePointShow=!1}}class Ho 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 ui(t));e.topOrBottom="bottom",this.ad(f.track([e,"color"],[this,"polylineColor"])),this.ad(f.track([e,"width"],[this,"polylineWidth"])),this.ad(f.track([e,"show"],[this,"polylineShow"])),this.ad(f.track([e,"arcType"],[this,"polylineArcType"])),this.ad(f.track([e,"loop"],[this,"loop"])),this.ad(f.track([e,"positions"],[this,"visibilityPositions"]))}}(i=>{i.createDefaultProps=()=>({...jt.createDefaultProps(),visibilityPositions:f.reactPositionsSet(void 0)})})(Ho||(Ho={})),f.extendClassProps(Ho.prototype,Ho.createDefaultProps);class Xo 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 ui(t));e.topOrBottom="bottom",this.ad(f.track([e,"color"],[this,"polylineColor"])),this.ad(f.track([e,"width"],[this,"polylineWidth"])),this.ad(f.track([e,"show"],[this,"polylineShow"])),this.ad(f.track([e,"arcType"],[this,"polylineArcType"])),this.ad(f.track([e,"loop"],[this,"loop"])),this.ad(f.track([e,"positions"],[this,"visibilityPositions"]))}}(i=>{i.createDefaultProps=()=>({...Ot.createDefaultProps(),visibilityPositions:f.reactPositionsSet(void 0)})})(Xo||(Xo={})),f.extendClassProps(Xo.prototype,Xo.createDefaultProps);class cE extends Zn{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 Xe extends f.EngineObject{constructor(e,n,s){super(e,n,s??!0);S(this,"_supportEditing",this.disposeVar(f.react(!0)));S(this,"_currentEditing",this.disposeVar(f.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 cr=class cr extends Xe{constructor(t,e){super(Array.isArray(t)?t[0]:t,e,!0);const n=this.currentEditing=this.ad(new Di(e));if(this.ad(n.enabledChanged.don(s=>{s||this.ad(f.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=f.getMinMaxCorner(s).center,this.ad(n.positionChanged.disposableOn((o,r)=>{if(!o||!r)return;const a=zs({originPosition:r},[o])[0][0];t.forEach(c=>{if(Reflect.has(c,"position")){const h=zs({originPosition:r},[c.position])[0][0];c.position=La({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=zs({originPosition:r},c.points)[0];c.points=La({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(f.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=f.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=zs({originPosition:r},[o])[0][0],c=zs({originPosition:r},s.points)[0];s.points=La({originPosition:r},c.map(h=>[h[0]+a[0],h[1]+a[1],h[2]+a[2]]))[0]}));return}this.supportEditing=!1}};S(cr,"type",cr.registerEditing("ESOlViewer",f.ESJEditingMode.Translation,cr));let ic=cr;function Ip(){const i=f.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 d=r[u%r.length],p=await f.step(t,async y=>{const w=y.disposer,E=f.EngineObject.contextEditing.getEngineObjConstructor(d,e.typeName);if(!E||!n.supportEditingModes().includes(d))return console.log(`未找到编辑模式或不支持当前编辑模式 ${d},已跳过,请检查输入`),e.editingEvent.emit({objectIDs:[n.parentID],editingID:a,type:"changedFailed",add:{cMode:d,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:d,cIndex:u}}),e.notSupportEditingCount=0;else return console.log(`编辑模式 ${d} 不支持,已跳过`),e.editingEvent.emit({objectIDs:[n.parentID],editingID:a,type:"changedFailed",add:{cMode:d,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(`编辑模式 ${d} 结束`),I("next")})),o){const M=D=>{D.code==="Space"&&(console.log(`编辑模式 ${d} 切换到下一模式`),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||p==="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 hE(){const i=f.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 hr=class hr extends Xe{constructor(t,e){super(t,e,!0);const n=this.currentEditing=this.ad(new Mi(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(f.bind([n,"position"],[t,"position"])),n.enabled=!n.position||f.equalsN3(n.position,[0,0,0])):this.supportEditing=!1}};S(hr,"type",hr.registerEditing("ESOlViewer",f.ESJEditingMode.Place,hr));let ql=hr;const lr=class lr extends Xe{constructor(t,e){super(t,e,!0);const n=this.currentEditing=this.ad(new Fi(e));if(this.ad(n.enabledChanged.don(s=>{!s&&this.ad(f.nextAnimateFrame(()=>{this.destroy()}))})),Reflect.has(t,"position")&&Reflect.has(t,"scale")){const s=t;this.ad(f.bind([n,"position"],[s,"position"])),this.ad(f.bind([n,"scale"],[s,"scale"]))}else throw new Error(`ScaleEditingWrapper:${t.typeName} 缩放属性无法绑定缩放编辑`)}};S(lr,"type",lr.registerEditing("ESOlViewer",f.ESJEditingMode.Scale,lr));let Gl=lr;const ur=class ur extends Xe{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(f.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(f.track([t,"points"],[n,"positions"]))}else this.supportEditing=!1}};S(ur,"type",ur.registerEditing("ESOlViewer",f.ESJEditingMode.LineStringAppend,ur));let Bl=ur;const dr=class dr extends Xe{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(f.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(f.track([t,"points"],[n,"positions"]))}else this.supportEditing=!1}};S(dr,"type",dr.registerEditing("ESOlViewer",f.ESJEditingMode.LineStringInsert,dr));let Vl=dr;const fr=class fr extends Xe{constructor(t,e){super(t,e,!0);const n=this.currentEditing=this.ad(new Sp(e));if(this.ad(n.enabledChanged.don(s=>{!s&&this.ad(f.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(f.track([t,"points"],[n,"positions"]))}else this.supportEditing=!1}};S(fr,"type",fr.registerEditing("ESOlViewer",f.ESJEditingMode.CircularAppend,fr));let Yl=fr;const gr=class gr extends Xe{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(f.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(f.track([t,"points"],[n,"positions"]))}else this.supportEditing=!1}};S(gr,"type",gr.registerEditing("ESOlViewer",f.ESJEditingMode.CircularInsert,gr));let Hl=gr;const pr=class pr extends Xe{constructor(t,e){super(t,e,!0);const n=this.currentEditing=this.ad(new Vs(e));if(this.ad(n.enabledChanged.don(s=>{!s&&this.ad(f.nextAnimateFrame(()=>{this.destroy()}))})),Reflect.has(t,"position")){const s=t;if(this.ad(f.bind([n,"startPosition"],[s,"position"])),this.ad(Ag([n,"rotation"],[s,"rotation"])),Reflect.has(s,"far"))this.ad(f.bind([n,"distance"],[s,"far"]));else if(Reflect.has(s,"radius"))this.ad(f.bind([n,"distance"],[s,"radius"]));else if(Reflect.has(s,"distance"))this.ad(f.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(f.track([s,"points"],[n,"positions"]))}else throw new Error(`DoublePointsAppendEditingWrapper:${t.typeName} 坐标属性无法绑定双点追加编辑`);n.startPosition&&!f.equalsN3(n.startPosition,[0,0,0])&&n.init(),n.enabled=!0}};S(pr,"type",pr.registerEditing("ESOlViewer",f.ESJEditingMode.DoublePointsAppend,pr));let Xl=pr;const mr=class mr extends Xe{constructor(t,e){var r;super(t,e,!0);const n=e.viewer;if(!n)return;const s=this.currentEditing=this.ad(new Zn(e));if(Reflect.has(t,"position")){const a=t;if(this.ad(f.bind([s,"startPosition"],[a,"position"])),this.ad(Ag([s,"rotation"],[a,"rotation"])),Reflect.has(a,"far"))this.ad(f.bind([s,"distance"],[a,"far"]));else if(Reflect.has(a,"radius"))this.ad(f.bind([s,"distance"],[a,"radius"]));else if(Reflect.has(a,"distance"))this.ad(f.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(f.track([a,"points"],[s,"positions"]))}else throw new Error(`DoublePointsModifyEditingWrapper:${t.typeName} 坐标属性无法绑定双点修改编辑`);s.init(),s.enabled=!0;const o=this.ad(f.createNextAnimateFrameEvent(s.enabledChanged,s.startPositionChanged));this.ad(o.don(()=>{(!s.enabled||!s.startPosition||f.equalsN3(s.startPosition,[0,0,0]))&&this.destroy()}))}};S(mr,"type",mr.registerEditing("ESOlViewer",f.ESJEditingMode.DoublePointsModify,mr));let $l=mr;const _r=class _r extends Xe{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(f.nextAnimateFrame(()=>this.destroy()))})),Reflect.has(t,"position")&&Reflect.has(t,"rotation")){const s=t;this.ad(f.bind([n,"position"],[s,"position"])),this.ad(f.bind([n,"selfRotation"],[s,"rotation"]));return}else throw new Error(`OlRotationEditingWrapper:${t.typeName} 旋转属性无法绑定旋转编辑`)}};S(_r,"type",_r.registerEditing("ESOlViewer",f.ESJEditingMode.Rotation,_r));let Zl=_r;return W.AddEditingPoint=Wl,W.BaseEditingWrapper=Xe,W.CircularAppendEditing=Sp,W.CircularAppendEditingWrapper=Yl,W.CircularInsertEditing=Op,W.CircularInsertEditingWrapper=Hl,W.CurrentScale=Pg,W.DoublePointsAppendEditing=Vs,W.DoublePointsAppendEditingWrapper=Xl,W.DoublePointsModifyEditing=Zn,W.DoublePointsModifyEditingWrapper=$l,W.ESGeoPoint=Ka,W.ESOlViewer=li,W.ESXYZLayer=Qa,W.EditingPoint=kl,W.FPSMonitor=Kd,W.GeoCanvasPoi=Ii,W.HeightModifyEditing=cE,W.ImageLabel2D=fp,W.LineStringAppendEditing=Rp,W.LineStringAppendEditingWrapper=Bl,W.LineStringInsertEditing=Pp,W.LineStringInsertEditingWrapper=Vl,W.MultiPointsAppendEditing=jt,W.OLCurrentScale=rf,W.OlCanvasAndDivSwitchPoi=av,W.OlCanvasPoi=hl,W.OlCursorPositionInfo=zg,W.OlDivPoi=ul,W.OlESAreaMeasurement=Ol,W.OlESDirectionMeasurement=Il,W.OlESDistanceMeasurement=Tl,W.OlESGeoLineString=Go,W.OlESGeoPoint=Dl,W.OlESGeoPoints=Fl,W.OlESGeoPolygon=Za,W.OlESGeoPolygonImpl=Hn,W.OlESImageLabel=Ll,W.OlESImageryLayer=zl,W.OlESLabel=Pl,W.OlESLocationMeasurement=Nl,W.OlESObjectWithLocation=$a,W.OlESPath=Ul,W.OlESTextLabel=jl,W.OlESXYZLayer=Ml,W.OlGeoCanvasImagePoi=hi,W.OlGeoCanvasMenuPoi=Ns,W.OlGeoCustomDivPoi=Qt,W.OlGeoDivTextPoi=pn,W.OlImageriesManager=Ng,W.OlImagery=np,W.OlLabelManager=Ug,W.OlMultiPoint=_n,W.OlPickingManager=kg,W.OlPoint=He,W.OlPoisContext=Dg,W.OlPolygon=Ai,W.OlPolyline=Jt,W.OlRotationEditing=wn,W.OlRotationEditingWrapper=Zl,W.OlView=Yn,W.OlViewChanged=N_,W.OlViewerExtensions=Wg,W.PlaceEditing=Mi,W.PlaceEditingWrapper=ql,W.PointAdding=Cp,W.PreviousPointDeleting=xp,W.ScaleEditing=Fi,W.ScaleEditingWrapper=Gl,W.ScatterAppendEditing=rE,W.ScatterModifyEditing=aE,W.TranslationEditing=Di,W.TranslationEditingWrapper=ic,W.VisibilityAppendEditing=Ho,W.VisibilityModifyEditing=Xo,W.WASDController=Zd,W.capture=Xd,W.cesiumHeightToOlZoom=jn,W.compute2DPickingConstraint=q_,W.compute2DPickingInfoWithCoordinates=of,W.computePickingInfoWithCoordinates2D=nf,W.createEditingSystemProcessing=Ip,W.createHelperLine=k_,W.createMoveObjectsProcessing=hE,W.defaultFlyToRotation=Qd,W.deletePreviousPoint=bp,W.flyExtent=Io,W.flyTo=xi,W.flyToWithParam=z_,W.flyToWithPosition=fh,W.flyToWithPositions=L_,W.fromCartesian=v1,W.fromCartesian2=pg,W.fromCartesian3=_g,W.fromCartesian4=wg,W.fromCartographic=C1,W.fromColor=x1,W.fromDistanceDisplayCondition=I1,W.fromEllipsoid=j1,W.fromHeadingPitchRoll=P1,W.fromNearFarScalar=S1,W.fromQuaternion=A1,W.fromRectangle=z1,W.geoNeareastPointOnRhumbLine=an,W.geoNeareastPointOnRhumbLine2=W_,W.getCameraPosition=tf,W.getCenterFromPositions=Hv,W.getFlatMidPoint=rl,W.getInverseModelMatrix=xg,W.getMinMaxCoordinates=ap,W.getModelMatrixFromPosition=sl,W.getOlZoomFromCesiumHeight=F_,W.getPointsExtent=ea,W.getViewerExtensions=Ti,W.localPositionToPosition=Sg,W.localPositionsToPositions=La,W.moveAllPositionsWithCenter=Xv,W.olFlyTo=Jd,W.olZoomToCesiumHeight=Oo,W.orbitAroundPoint=$d,W.pickOlPosition=ef,W.positionAndRotationToQuaternion=F1,W.positionFromCartesian=w1,W.positionToCartesian=fg,W.positionToLocalPosition=Rg,W.positionsToLocalPositions=zs,W.setViewerExtensions=Wa,W.toCartesian=vg,W.toCartesian2=gg,W.toCartesian3=mg,W.toCartesian4=yg,W.toCartographic=E1,W.toColor=b1,W.toDistanceDisplayCondition=O1,W.toEllipsoid=U1,W.toHeadingPitchRoll=Eg,W.toNearFarScalar=R1,W.toQuaternion=T1,W.toRectangle=L1,W.visualizeCenterPoint=D_,Object.defineProperty(W,Symbol.toStringTag,{value:"Module"}),W}({},EarthSDK3,ol);