earthsdk3-ol 3.11.2 → 3.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/earthsdk3-ol.iife.js +38 -81
- package/dist/earthsdk3-ol.js +18744 -29663
- package/dist/earthsdk3-ol.umd.cjs +38 -81
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsModifyEditing/HeightModifyEditing.d.ts +1 -1
- package/dist/types/EditingSystem/base/PointEditing/TranslationEditing/index.d.ts +2 -1
- package/dist/types/OlObjects/general/OlESAreaMeasurement/GeoAreaMeasurement.d.ts +1 -1
- package/dist/types/utlis/base/flyTo.d.ts +0 -1
- package/dist/types/utlis/olUtils/calculate.d.ts +4 -19
- package/dist/types/utlis/olUtils/getQuaternion.d.ts +34 -4
- package/dist/types/utlis/olUtils/olConverts.d.ts +79 -32
- package/dist/types/utlis/olUtils/olGeodesy.d.ts +17 -0
- package/dist/types/utlis/olUtils/todo/positionsToLocalPositions.d.ts +8 -6
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(M,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("earthsdk3"),require("ol")):typeof define=="function"&&define.amd?define(["exports","earthsdk3","ol"],f):(M=typeof globalThis<"u"?globalThis:M||self,f(M.EarthSDK3_OL={},M.EarthSDK3,M.ol))})(this,(function(M,f,Hi){"use strict";var ER=Object.defineProperty;var CR=(M,f,Hi)=>f in M?ER(M,f,{enumerable:!0,configurable:!0,writable:!0,value:Hi}):M[f]=Hi;var E=(M,f,Hi)=>CR(M,typeof f!="symbol"?f+"":f,Hi);M.copyright=void 0;try{const n="earthsdk3-ol",t="3.11.2",e="2026-11-20T01:11:49.000Z",i="北京西部世界科技有限公司",s="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",r="b1072091352b6535c27dad12e9911949837fd89e",a=((Date.now()-1795137109e3)/36e5).toFixed(1),l=`%c🌏 ${n}%c ${t}.${r.slice(0,8)}.${e} (距今${a}个小时)
|
|
2
2
|
%c${s?s+`
|
|
3
|
-
`:""}当前网站正在使用${
|
|
4
|
-
`;
|
|
3
|
+
`:""}当前网站正在使用${n},此软件版权归${i}所有
|
|
4
|
+
`;M.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","b1072091352b6535c27dad12e9911949837fd89e")},get info(){return l},get date(){return"2026-11-20T01:11:49.000Z"},get author(){return"suplyang"},get version(){return"3.11.2"},get name(){return"earthsdk3-ol"},get commitId(){return"b1072091352b6535c27dad12e9911949837fd89e"},print(c=!1){!c&&globalThis._xe2_no_copy_print||console.info(this.info,`
|
|
5
5
|
font-size: 18px;
|
|
6
6
|
font-weight: 1000;
|
|
7
7
|
line-height: 1;
|
|
@@ -18,57 +18,14 @@
|
|
|
18
18
|
color: rgb(0, 120, 215);
|
|
19
19
|
padding-bottom: 2px;
|
|
20
20
|
padding-left: 35px;
|
|
21
|
-
`)}}),globalThis.g_XE3CopyRights=globalThis.g_XE3CopyRights||{},globalThis.g_XE3CopyRights[i]=W.copyright,globalThis.g_earthsdk_copyright_print=globalThis.g_earthsdk_copyright_print??!0,globalThis.g_earthsdk_copyright_print&&W.copyright.print()}catch{}class an extends p.Destroyable{constructor(){super()}}T(an,"defaults",{enabled:!0}),(i=>{i.createDefaultProps=()=>({enabled:!0})})(an||(an={})),p.extendClassProps(an.prototype,an.createDefaultProps);function $g(i){return Math.pow(i,3)}function Ks(i){return 1-$g(1-i)}function wv(i){return 3*i*i-2*i*i*i}function vv(i){return i}function bv(i,e,t){let n,s;t=t||di;let o=0,r=i.length,a=!1;for(;o<r;)n=o+(r-o>>1),s=+t(i[n],e),s<0?o=n+1:(r=n,a=!s);return a?o:~o}function di(i,e){return i>e?1:i<e?-1:0}function Ev(i,e){return i<e?1:i>e?-1:0}function Xl(i,e,t){if(i[0]<=e)return 0;const n=i.length;if(e<=i[n-1])return n-1;if(typeof t=="function"){for(let s=1;s<n;++s){const o=i[s];if(o===e)return s;if(o<e)return t(e,i[s-1],o)>0?s-1:s}return n-1}if(t>0){for(let s=1;s<n;++s)if(i[s]<e)return s-1;return n-1}if(t<0){for(let s=1;s<n;++s)if(i[s]<=e)return s;return n-1}for(let s=1;s<n;++s){if(i[s]==e)return s;if(i[s]<e)return i[s-1]-e<e-i[s]?s-1:s}return n-1}function Cv(i,e,t){for(;e<t;){const n=i[e];i[e]=i[t],i[t]=n,++e,--t}}function fi(i,e){const t=Array.isArray(e)?e:[e],n=t.length;for(let s=0;s<n;s++)i[i.length]=t[s]}function ps(i,e){const t=i.length;if(t!==e.length)return!1;for(let n=0;n<t;n++)if(i[n]!==e[n])return!1;return!0}function xv(i,e,t){const n=e||di;return i.every(function(s,o){if(o===0)return!0;const r=n(i[o-1],s);return!(r>0||r===0)})}const Ft={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function $r(i){const e=yn();for(let t=0,n=i.length;t<n;++t)Hr(e,i[t]);return e}function Pv(i,e,t){const n=Math.min.apply(null,i),s=Math.min.apply(null,e),o=Math.max.apply(null,i),r=Math.max.apply(null,e);return ki(n,s,o,r,t)}function pi(i,e,t){return t?(t[0]=i[0]-e,t[1]=i[1]-e,t[2]=i[2]+e,t[3]=i[3]+e,t):[i[0]-e,i[1]-e,i[2]+e,i[3]+e]}function Hg(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i.slice()}function Qs(i,e,t){let n,s;return e<i[0]?n=i[0]-e:i[2]<e?n=e-i[2]:n=0,t<i[1]?s=i[1]-t:i[3]<t?s=t-i[3]:s=0,n*n+s*s}function Js(i,e){return Iu(i,e[0],e[1])}function Ni(i,e){return i[0]<=e[0]&&e[2]<=i[2]&&i[1]<=e[1]&&e[3]<=i[3]}function Iu(i,e,t){return i[0]<=e&&e<=i[2]&&i[1]<=t&&t<=i[3]}function Ou(i,e){const t=i[0],n=i[1],s=i[2],o=i[3],r=e[0],a=e[1];let l=Ft.UNKNOWN;return r<t?l=l|Ft.LEFT:r>s&&(l=l|Ft.RIGHT),a<n?l=l|Ft.BELOW:a>o&&(l=l|Ft.ABOVE),l===Ft.UNKNOWN&&(l=Ft.INTERSECTING),l}function yn(){return[1/0,1/0,-1/0,-1/0]}function ki(i,e,t,n,s){return s?(s[0]=i,s[1]=e,s[2]=t,s[3]=n,s):[i,e,t,n]}function Wo(i){return ki(1/0,1/0,-1/0,-1/0,i)}function Xg(i,e){const t=i[0],n=i[1];return ki(t,n,t,n,e)}function Au(i,e,t,n,s){const o=Wo(s);return Zg(o,i,e,t,n)}function ji(i,e){return i[0]==e[0]&&i[2]==e[2]&&i[1]==e[1]&&i[3]==e[3]}function Yg(i,e){return e[0]<i[0]&&(i[0]=e[0]),e[2]>i[2]&&(i[2]=e[2]),e[1]<i[1]&&(i[1]=e[1]),e[3]>i[3]&&(i[3]=e[3]),i}function Hr(i,e){e[0]<i[0]&&(i[0]=e[0]),e[0]>i[2]&&(i[2]=e[0]),e[1]<i[1]&&(i[1]=e[1]),e[1]>i[3]&&(i[3]=e[1])}function Zg(i,e,t,n,s){for(;t<n;t+=s)Sv(i,e[t],e[t+1]);return i}function Sv(i,e,t){i[0]=Math.min(i[0],e),i[1]=Math.min(i[1],t),i[2]=Math.max(i[2],e),i[3]=Math.max(i[3],t)}function Kg(i,e){let t;return t=e(Yl(i)),t||(t=e(Zl(i)),t)||(t=e(Ql(i)),t)||(t=e(ln(i)),t)?t:!1}function Mu(i){let e=0;return Ui(i)||(e=Te(i)*ft(i)),e}function Yl(i){return[i[0],i[1]]}function Zl(i){return[i[2],i[1]]}function Tn(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function Rv(i,e){let t;if(e==="bottom-left")t=Yl(i);else if(e==="bottom-right")t=Zl(i);else if(e==="top-left")t=ln(i);else if(e==="top-right")t=Ql(i);else throw new Error("Invalid corner");return t}function Kl(i,e,t,n,s){const[o,r,a,l,c,h,u,d]=Qg(i,e,t,n);return ki(Math.min(o,a,c,u),Math.min(r,l,h,d),Math.max(o,a,c,u),Math.max(r,l,h,d),s)}function Qg(i,e,t,n){const s=e*n[0]/2,o=e*n[1]/2,r=Math.cos(t),a=Math.sin(t),l=s*r,c=s*a,h=o*r,u=o*a,d=i[0],f=i[1];return[d-l+u,f-c-h,d-l-u,f-c+h,d+l-u,f+c+h,d+l+u,f+c-h,d-l+u,f-c-h]}function ft(i){return i[3]-i[1]}function Xn(i,e,t){const n=t||yn();return pt(i,e)?(i[0]>e[0]?n[0]=i[0]:n[0]=e[0],i[1]>e[1]?n[1]=i[1]:n[1]=e[1],i[2]<e[2]?n[2]=i[2]:n[2]=e[2],i[3]<e[3]?n[3]=i[3]:n[3]=e[3]):Wo(n),n}function ln(i){return[i[0],i[3]]}function Ql(i){return[i[2],i[3]]}function Te(i){return i[2]-i[0]}function pt(i,e){return i[0]<=e[2]&&i[2]>=e[0]&&i[1]<=e[3]&&i[3]>=e[1]}function Ui(i){return i[2]<i[0]||i[3]<i[1]}function Tv(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i}function Iv(i,e){const t=(i[2]-i[0])/2*(e-1),n=(i[3]-i[1])/2*(e-1);i[0]-=t,i[2]+=t,i[1]-=n,i[3]+=n}function Ov(i,e,t){let n=!1;const s=Ou(i,e),o=Ou(i,t);if(s===Ft.INTERSECTING||o===Ft.INTERSECTING)n=!0;else{const r=i[0],a=i[1],l=i[2],c=i[3],h=e[0],u=e[1],d=t[0],f=t[1],g=(f-u)/(d-h);let _,v;o&Ft.ABOVE&&!(s&Ft.ABOVE)&&(_=d-(f-c)/g,n=_>=r&&_<=l),!n&&o&Ft.RIGHT&&!(s&Ft.RIGHT)&&(v=f-(d-l)*g,n=v>=a&&v<=c),!n&&o&Ft.BELOW&&!(s&Ft.BELOW)&&(_=d-(f-a)/g,n=_>=r&&_<=l),!n&&o&Ft.LEFT&&!(s&Ft.LEFT)&&(v=f-(d-r)*g,n=v>=a&&v<=c)}return n}function Jg(i,e,t,n){if(Ui(i))return Wo(t);let s=[];if(n>1){const a=i[2]-i[0],l=i[3]-i[1];for(let c=0;c<n;++c)s.push(i[0]+a*c/n,i[1],i[2],i[1]+l*c/n,i[2]-a*c/n,i[3],i[0],i[3]-l*c/n)}else s=[i[0],i[1],i[2],i[1],i[2],i[3],i[0],i[3]];e(s,s,2);const o=[],r=[];for(let a=0,l=s.length;a<l;a+=2)o.push(s[a]),r.push(s[a+1]);return Pv(o,r,t)}function em(i,e){const t=e.getExtent(),n=Tn(i);if(e.canWrapX()&&(n[0]<t[0]||n[0]>=t[2])){const s=Te(t),r=Math.floor((n[0]-t[0])/s)*s;i[0]-=r,i[2]-=r}return i}function tm(i,e,t){if(e.canWrapX()){const n=e.getExtent();if(!isFinite(i[0])||!isFinite(i[2]))return[[n[0],i[1],n[2],i[3]]];em(i,e);const s=Te(n);if(Te(i)>s&&!t)return[[n[0],i[1],n[2],i[3]]];if(i[0]<n[0])return[[i[0]+s,i[1],n[2],i[3]],[n[0],i[1],i[2],i[3]]];if(i[2]>n[2])return[[i[0],i[1],n[2],i[3]],[n[0],i[1],i[2]-s,i[3]]]}return[i]}function ct(i,e,t){return Math.min(Math.max(i,e),t)}function Av(i,e,t,n,s,o){const r=s-t,a=o-n;if(r!==0||a!==0){const l=((i-t)*r+(e-n)*a)/(r*r+a*a);l>1?(t=s,n=o):l>0&&(t+=r*l,n+=a*l)}return eo(i,e,t,n)}function eo(i,e,t,n){const s=t-i,o=n-e;return s*s+o*o}function Mv(i){const e=i.length;for(let n=0;n<e;n++){let s=n,o=Math.abs(i[n][n]);for(let a=n+1;a<e;a++){const l=Math.abs(i[a][n]);l>o&&(o=l,s=a)}if(o===0)return null;const r=i[s];i[s]=i[n],i[n]=r;for(let a=n+1;a<e;a++){const l=-i[a][n]/i[n][n];for(let c=n;c<e+1;c++)n==c?i[a][c]=0:i[a][c]+=l*i[n][c]}}const t=new Array(e);for(let n=e-1;n>=0;n--){t[n]=i[n][e]/i[n][n];for(let s=n-1;s>=0;s--)i[s][e]-=i[s][n]*t[n]}return t}function nm(i){return i*180/Math.PI}function gs(i){return i*Math.PI/180}function ms(i,e){const t=i%e;return t*e<0?t+e:t}function _n(i,e,t){return i+t*(e-i)}function Xr(i,e){const t=Math.pow(10,e);return Math.round(i*t)/t}function im(i,e){return Math.round(Xr(i,e))}function Jl(i,e){return Math.floor(Xr(i,e))}function ys(i,e){return Math.ceil(Xr(i,e))}function Du(i,e,t){if(i>=e&&i<t)return i;const n=t-e;return((i-e)%n+n)%n+e}const sm=63710088e-1;function Fu(i,e,t){t=t||sm;const n=gs(i[1]),s=gs(e[1]),o=(s-n)/2,r=gs(e[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*t*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function Lu(i,e){let t=0;for(let n=0,s=i.length;n<s-1;++n)t+=Fu(i[n],i[n+1],e);return t}function om(i,e){e=e||{};const t=e.radius||sm,n=e.projection||"EPSG:3857",s=i.getType();s!=="GeometryCollection"&&(i=i.clone().transform(n,"EPSG:4326"));let o=0,r,a,l,c,h,u;switch(s){case"Point":case"MultiPoint":break;case"LineString":case"LinearRing":{r=i.getCoordinates(),o=Lu(r,t);break}case"MultiLineString":case"Polygon":{for(r=i.getCoordinates(),l=0,c=r.length;l<c;++l)o+=Lu(r[l],t);break}case"MultiPolygon":{for(r=i.getCoordinates(),l=0,c=r.length;l<c;++l)for(a=r[l],h=0,u=a.length;h<u;++h)o+=Lu(a[h],t);break}case"GeometryCollection":{const d=i.getGeometries();for(l=0,c=d.length;l<c;++l)o+=om(d[l],e);break}default:throw new Error("Unsupported geometry type: "+s)}return o}function we(){throw new Error("Unimplemented abstract method.")}let Dv=0;function Pe(i){return i.ol_uid||(i.ol_uid=String(++Dv))}const Fv="10.8.0",Bo={PROPERTYCHANGE:"propertychange"},_e={CHANGE:"change",ERROR:"error",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",TOUCHMOVE:"touchmove",WHEEL:"wheel"};class Yr{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function Zr(){return!0}function ec(){return!1}function Kr(){}function rm(i){let e,t,n;return function(){const s=Array.prototype.slice.call(arguments);return(!t||this!==n||!ps(s,t))&&(n=this,t=s,e=i.apply(this,arguments)),e}}function $o(i){function e(){let t;try{t=i()}catch(n){return Promise.reject(n)}return t instanceof Promise?t:Promise.resolve(t)}return e()}function Qr(i){for(const e in i)delete i[e]}function _s(i){let e;for(e in i)return!1;return!e}class Yn{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}class Jr extends Yr{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;const n=this.listeners_||(this.listeners_={}),s=n[e]||(n[e]=[]);s.includes(t)||s.push(t)}dispatchEvent(e){const t=typeof e=="string",n=t?e:e.type,s=this.listeners_&&this.listeners_[n];if(!s)return;const o=t?new Yn(e):e;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 l;for(let c=0,h=s.length;c<h;++c)if("handleEvent"in s[c]?l=s[c].handleEvent(o):l=s[c].call(this,o),l===!1||o.propagationStopped){l=!1;break}if(--r[n]===0){let c=a[n];for(delete a[n];c--;)this.removeEventListener(n,Kr);delete r[n]}return l}disposeInternal(){this.listeners_&&Qr(this.listeners_)}getListeners(e){return this.listeners_&&this.listeners_[e]||void 0}hasListener(e){return this.listeners_?e?e in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(e,t){if(!this.listeners_)return;const n=this.listeners_[e];if(!n)return;const s=n.indexOf(t);s!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(n[s]=Kr,++this.pendingRemovals_[e]):(n.splice(s,1),n.length===0&&delete this.listeners_[e]))}}function Ue(i,e,t,n,s){if(s){const r=t;t=function(a){return i.removeEventListener(e,t),r.call(n??this,a)}}else n&&n!==i&&(t=t.bind(n));const o={target:i,type:e,listener:t};return i.addEventListener(e,t),o}function tc(i,e,t,n){return Ue(i,e,t,n,!0)}function st(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),Qr(i))}class ea extends Jr{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(_e.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){const n=e.length,s=new Array(n);for(let o=0;o<n;++o)s[o]=Ue(this,e[o],t);return s}return Ue(this,e,t)}onceInternal(e,t){let n;if(Array.isArray(e)){const s=e.length;n=new Array(s);for(let o=0;o<s;++o)n[o]=tc(this,e[o],t)}else n=tc(this,e,t);return t.ol_key=n,n}unInternal(e,t){const n=t.ol_key;if(n)gi(n);else if(Array.isArray(e))for(let s=0,o=e.length;s<o;++s)this.removeEventListener(e[s],t);else this.removeEventListener(e,t)}}ea.prototype.on,ea.prototype.once,ea.prototype.un;function gi(i){if(Array.isArray(i))for(let e=0,t=i.length;e<t;++e)st(i[e]);else st(i)}class am extends Yn{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}}class mi extends ea{constructor(e){super(),this.on,this.once,this.un,Pe(this),this.values_=null,e!==void 0&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(e,t){let n;n=`change:${e}`,this.hasListener(n)&&this.dispatchEvent(new am(n,e,t)),n=Bo.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new am(n,e,t))}addChangeListener(e,t){this.addEventListener(`change:${e}`,t)}removeChangeListener(e,t){this.removeEventListener(`change:${e}`,t)}set(e,t,n){const s=this.values_||(this.values_={});if(n)s[e]=t;else{const o=s[e];s[e]=t,o!==t&&this.notify(e,o)}}setProperties(e,t){for(const n in e)this.set(n,e[n],t)}applyProperties(e){e.values_&&Object.assign(this.values_||(this.values_={}),e.values_)}unset(e,t){if(this.values_&&e in this.values_){const n=this.values_[e];delete this.values_[e],_s(this.values_)&&(this.values_=null),t||this.notify(e,n)}}}function lm(...i){console.warn(...i)}function cm(i,e){const t=(""+i).split("."),n=(""+e).split(".");for(let s=0;s<Math.max(t.length,n.length);s++){const o=parseInt(t[s]||"0",10),r=parseInt(n[s]||"0",10);if(o>r)return 1;if(r>o)return-1}return 0}function Lv(i,e){return i[0]+=+e[0],i[1]+=+e[1],i}function nc(i,e){let t=!0;for(let n=i.length-1;n>=0;--n)if(i[n]!=e[n]){t=!1;break}return t}function zu(i,e){const t=Math.cos(e),n=Math.sin(e),s=i[0]*t-i[1]*n,o=i[1]*t+i[0]*n;return i[0]=s,i[1]=o,i}function zv(i,e){return i[0]*=e,i[1]*=e,i}function Nv(i,e){const t=i[0]-e[0],n=i[1]-e[1];return t*t+n*n}function kv(i,e){return Math.sqrt(Nv(i,e))}function Nu(i,e){if(e.canWrapX()){const t=Te(e.getExtent()),n=jv(i,e,t);n&&(i[0]-=n*t)}return i}function jv(i,e,t){const n=e.getExtent();let s=0;return e.canWrapX()&&(i[0]<n[0]||i[0]>n[2])&&(t=t||Te(n),s=Math.floor((i[0]-n[0])/t)),s}function Uv(i,e,t){const n=Math.sqrt((e[0]-i[0])*(e[0]-i[0])+(e[1]-i[1])*(e[1]-i[1])),s=[(e[0]-i[0])/n,(e[1]-i[1])/n],o=[-s[1],s[0]],r=Math.sqrt((t[0]-i[0])*(t[0]-i[0])+(t[1]-i[1])*(t[1]-i[1])),a=[(t[0]-i[0])/r,(t[1]-i[1])/r];let l=n===0||r===0?0:Math.acos(ct(a[0]*s[0]+a[1]*s[1],-1,1));return l=Math.max(l,1e-5),a[0]*o[0]+a[1]*o[1]>0?l:Math.PI*2-l}const ic={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class ta{constructor(e){this.code_=e.code,this.units_=e.units,this.extent_=e.extent!==void 0?e.extent:null,this.worldExtent_=e.worldExtent!==void 0?e.worldExtent:null,this.axisOrientation_=e.axisOrientation!==void 0?e.axisOrientation:"enu",this.global_=e.global!==void 0?e.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=e.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=e.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||ic[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!!(e&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!!(this.global_&&e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}}const na=6378137,Ho=Math.PI*na,Gv=[-Ho,-Ho,Ho,Ho],qv=[-180,-85,180,85],sc=na*Math.log(Math.tan(Math.PI/2));class Xo extends ta{constructor(e){super({code:e,units:"m",extent:Gv,global:!0,worldExtent:qv,getPointResolution:function(t,n){return t/Math.cosh(n[1]/na)}})}}const hm=[new Xo("EPSG:3857"),new Xo("EPSG:102100"),new Xo("EPSG:102113"),new Xo("EPSG:900913"),new Xo("http://www.opengis.net/def/crs/EPSG/0/3857"),new Xo("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Vv(i,e,t,n){const s=i.length;t=t>1?t:2,n=n??t,e===void 0&&(t>2?e=i.slice():e=new Array(s));for(let o=0;o<s;o+=n){e[o]=Ho*i[o]/180;let r=na*Math.log(Math.tan(Math.PI*(+i[o+1]+90)/360));r>sc?r=sc:r<-sc&&(r=-sc),e[o+1]=r}return e}function Wv(i,e,t,n){const s=i.length;t=t>1?t:2,n=n??t,e===void 0&&(t>2?e=i.slice():e=new Array(s));for(let o=0;o<s;o+=n)e[o]=180*i[o]/Ho,e[o+1]=360*Math.atan(Math.exp(i[o+1]/na))/Math.PI-90;return e}const Bv=6378137,um=[-180,-90,180,90],$v=Math.PI*Bv/180;class to extends ta{constructor(e,t){super({code:e,units:"degrees",extent:um,axisOrientation:t,global:!0,metersPerUnit:$v,worldExtent:um})}}const dm=[new to("CRS:84"),new to("EPSG:4326","neu"),new to("urn:ogc:def:crs:OGC:1.3:CRS84"),new to("urn:ogc:def:crs:OGC:2:84"),new to("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new to("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new to("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let ku={};function Hv(i){return ku[i]||ku[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function Xv(i,e){ku[i]=e}let Yo={};function no(i,e,t){const n=i.getCode(),s=e.getCode();n in Yo||(Yo[n]={}),Yo[n][s]=t}function ju(i,e){return i in Yo&&e in Yo[i]?Yo[i][e]:null}const oc=.9996,In=.00669438,rc=In*In,ac=rc*In,io=In/(1-In),fm=Math.sqrt(1-In),Zo=(1-fm)/(1+fm),pm=Zo*Zo,Uu=pm*Zo,Gu=Uu*Zo,gm=Gu*Zo,mm=1-In/4-3*rc/64-5*ac/256,Yv=3*In/8+3*rc/32+45*ac/1024,Zv=15*rc/256+45*ac/1024,Kv=35*ac/3072,Qv=3/2*Zo-27/32*Uu+269/512*gm,Jv=21/16*pm-55/32*Gu,eb=151/96*Uu-417/128*gm,tb=1097/512*Gu,lc=6378137;function nb(i,e,t){const n=i-5e5,r=(t.north?e:e-1e7)/oc/(lc*mm),a=r+Qv*Math.sin(2*r)+Jv*Math.sin(4*r)+eb*Math.sin(6*r)+tb*Math.sin(8*r),l=Math.sin(a),c=l*l,h=Math.cos(a),u=l/h,d=u*u,f=d*d,g=1-In*c,_=Math.sqrt(1-In*c),v=lc/_,E=(1-In)/g,w=io*h**2,C=w*w,P=n/(v*oc),R=P*P,O=R*P,I=O*P,M=I*P,z=M*P,k=a-u/E*(R/2-I/24*(5+3*d+10*w-4*C-9*io))+z/720*(61+90*d+298*w+45*f-252*io-3*C);let q=(P-O/6*(1+2*d+w)+M/120*(5-2*w+28*d-3*C+8*io+24*f))/h;return q=Du(q+gs(wm(t.number)),-Math.PI,Math.PI),[nm(q),nm(k)]}const ym=-80,_m=84,ib=-180,sb=180;function ob(i,e,t){i=Du(i,ib,sb),e<ym?e=ym:e>_m&&(e=_m);const n=gs(e),s=Math.sin(n),o=Math.cos(n),r=s/o,a=r*r,l=a*a,c=gs(i),h=wm(t.number),u=gs(h),d=lc/Math.sqrt(1-In*s**2),f=io*o**2,g=o*Du(c-u,-Math.PI,Math.PI),_=g*g,v=_*g,E=v*g,w=E*g,C=w*g,P=lc*(mm*n-Yv*Math.sin(2*n)+Zv*Math.sin(4*n)-Kv*Math.sin(6*n)),R=oc*d*(g+v/6*(1-a+f)+w/120*(5-18*a+l+72*f-58*io))+5e5;let O=oc*(P+d*r*(_/2+E/24*(5-a+9*f+4*f**2)+C/720*(61-58*a+l+600*f-330*io)));return t.north||(O+=1e7),[R,O]}function wm(i){return(i-1)*6-180+3}const rb=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function vm(i){let e=0;for(const s of rb){const o=i.match(s);if(o){e=parseInt(o[1]);break}}if(!e)return null;let t=0,n=!1;return e>32700&&e<32761?t=e-32700:e>32600&&e<32661&&(n=!0,t=e-32600),t?{number:t,north:n}:null}function bm(i,e){return function(t,n,s,o){const r=t.length;s=s>1?s:2,o=o??s,n||(s>2?n=t.slice():n=new Array(r));for(let a=0;a<r;a+=o){const l=t[a],c=t[a+1],h=i(l,c,e);n[a]=h[0],n[a+1]=h[1]}return n}}function ab(i){return vm(i)?new ta({code:i,units:"m"}):null}function lb(i){const e=vm(i.getCode());return e?{forward:bm(ob,e),inverse:bm(nb,e)}:null}const cb=[lb],hb=[ab];let qu=!0;function Em(i){qu=!1}function Vu(i,e){if(e!==void 0){for(let t=0,n=i.length;t<n;++t)e[t]=i[t];e=e}else e=i.slice();return e}function cc(i){Xv(i.getCode(),i),no(i,i,Vu)}function ub(i){i.forEach(cc)}function De(i){if(typeof i!="string")return i;const e=Hv(i);if(e)return e;for(const t of hb){const n=t(i);if(n)return n}return null}function Cm(i,e,t,n){i=De(i);let s;const o=i.getPointResolutionFunc();if(o)s=o(e,t);else{const r=i.getUnits();if(r=="degrees"&&!n||n=="degrees")s=e;else{const a=ia(i,De("EPSG:4326"));if(!a&&r!=="degrees")s=e*i.getMetersPerUnit();else{let c=[t[0]-e/2,t[1],t[0]+e/2,t[1],t[0],t[1]-e/2,t[0],t[1]+e/2];c=a(c,c,2);const h=Fu(c.slice(0,2),c.slice(2,4)),u=Fu(c.slice(4,6),c.slice(6,8));s=(h+u)/2}const l=i.getMetersPerUnit();l!==void 0&&(s/=l)}}return s}function xm(i){ub(i),i.forEach(function(e){i.forEach(function(t){e!==t&&no(e,t,Vu)})})}function db(i,e,t,n){i.forEach(function(s){e.forEach(function(o){no(s,o,t),no(o,s,n)})})}function Wu(i,e){return i?typeof i=="string"?De(i):i:De(e)}function Bu(i){return(function(e,t,n,s){const o=e.length;n=n!==void 0?n:2,s=s??n,t=t!==void 0?t:new Array(o);for(let r=0;r<o;r+=s){const a=i(e.slice(r,r+n)),l=a.length;for(let c=0,h=s;c<h;++c)t[r+c]=c>=l?e[r+c]:a[c]}return t})}function Pm(i,e,t,n){const s=De(i),o=De(e);no(s,o,Bu(t)),no(o,s,Bu(n))}function Ie(i,e){return Em(),Ko(i,"EPSG:4326",e!==void 0?e:"EPSG:3857")}function Lt(i,e){const t=Ko(i,"EPSG:3857","EPSG:4326"),n=t[0];return(n<-180||n>180)&&(t[0]=ms(n+180,360)-180),t}function Wt(i,e){if(i===e)return!0;const t=i.getUnits()===e.getUnits();return(i.getCode()===e.getCode()||ia(i,e)===Vu)&&t}function ia(i,e){const t=i.getCode(),n=e.getCode();let s=ju(t,n);if(s)return s;let o=null,r=null;for(const l of cb)o||(o=l(i)),r||(r=l(e));if(!o&&!r)return null;const a="EPSG:4326";if(r)if(o)s=$u(o.inverse,r.forward);else{const l=ju(t,a);l&&(s=$u(l,r.forward))}else{const l=ju(a,n);l&&(s=$u(o.inverse,l))}return s&&(cc(i),cc(e),no(i,e,s)),s}function $u(i,e){return function(t,n,s,o){return n=i(t,n,s,o),e(n,n,s,o)}}function Gi(i,e){const t=De(i),n=De(e);return ia(t,n)}function Ko(i,e,t){const n=Gi(e,t);if(!n){const s=De(e).getCode(),o=De(t).getCode();throw new Error(`No transform available between ${s} and ${o}`)}return n(i,void 0,i.length)}function sa(i,e,t,n){const s=Gi(e,t);return Jg(i,s,void 0,n)}let fb=null;function pb(){return fb}function Hu(i,e){return i}function qi(i,e){return qu&&!nc(i,[0,0])&&i[0]>=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(qu=!1,lm("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i}function Xu(i,e){return i}function yi(i,e){return i}function gb(){xm(hm),xm(dm),db(dm,hm,Vv,Wv)}gb();function Ve(i,e){if(!i)throw new Error(e)}const Sm=new Array(6);function Qt(){return[1,0,0,1,0,0]}function Rm(i){return Yu(i,1,0,0,1,0,0)}function hc(i,e){const t=i[0],n=i[1],s=i[2],o=i[3],r=i[4],a=i[5],l=e[0],c=e[1],h=e[2],u=e[3],d=e[4],f=e[5];return i[0]=t*l+s*c,i[1]=n*l+o*c,i[2]=t*h+s*u,i[3]=n*h+o*u,i[4]=t*d+s*f+r,i[5]=n*d+o*f+a,i}function Yu(i,e,t,n,s,o,r){return i[0]=e,i[1]=t,i[2]=n,i[3]=s,i[4]=o,i[5]=r,i}function mb(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i}function wt(i,e){const t=e[0],n=e[1];return e[0]=i[0]*t+i[2]*n+i[4],e[1]=i[1]*t+i[3]*n+i[5],e}function Zu(i,e,t){return hc(i,Yu(Sm,e,0,0,t,0,0))}function yb(i,e,t){return hc(i,Yu(Sm,1,0,0,1,e,t))}function Zn(i,e,t,n,s,o,r,a){const l=Math.sin(o),c=Math.cos(o);return i[0]=n*c,i[1]=s*l,i[2]=-n*l,i[3]=s*c,i[4]=r*n*c-a*n*l+e,i[5]=r*s*l+a*s*c+t,i}function Tm(i,e){const t=_b(e);Ve(t!==0,"Transformation matrix cannot be inverted");const n=e[0],s=e[1],o=e[2],r=e[3],a=e[4],l=e[5];return i[0]=r/t,i[1]=-s/t,i[2]=-o/t,i[3]=n/t,i[4]=(o*l-r*a)/t,i[5]=-(n*l-s*a)/t,i}function _b(i){return i[0]*i[3]-i[1]*i[2]}const wb=[1e5,1e5,1e5,1e5,2,2];function vb(i){return"matrix("+i.join(", ")+")"}function Ku(i){return i.substring(7,i.length-1).split(",").map(parseFloat)}function bb(i,e){const t=Ku(i),n=Ku(e);for(let s=0;s<6;++s)if(Math.round((t[s]-n[s])*wb[s])!==0)return!1;return!0}function _i(i,e,t,n,s,o,r){o=o||[],r=r||2;let a=0;for(let l=e;l<t;l+=n){const c=i[l],h=i[l+1];o[a++]=s[0]*c+s[2]*h+s[4],o[a++]=s[1]*c+s[3]*h+s[5];for(let u=2;u<r;u++)o[a++]=i[l+u]}return o&&o.length!=a&&(o.length=a),o}function Im(i,e,t,n,s,o,r){r=r||[];const a=Math.cos(s),l=Math.sin(s),c=o[0],h=o[1];let u=0;for(let d=e;d<t;d+=n){const f=i[d]-c,g=i[d+1]-h;r[u++]=c+f*a-g*l,r[u++]=h+f*l+g*a;for(let _=d+2;_<d+n;++_)r[u++]=i[_]}return r&&r.length!=u&&(r.length=u),r}function Eb(i,e,t,n,s,o,r,a){a=a||[];const l=r[0],c=r[1];let h=0;for(let u=e;u<t;u+=n){const d=i[u]-l,f=i[u+1]-c;a[h++]=l+s*d,a[h++]=c+o*f;for(let g=u+2;g<u+n;++g)a[h++]=i[g]}return a&&a.length!=h&&(a.length=h),a}function Cb(i,e,t,n,s,o,r){r=r||[];let a=0;for(let l=e;l<t;l+=n){r[a++]=i[l]+s,r[a++]=i[l+1]+o;for(let c=l+2;c<l+n;++c)r[a++]=i[c]}return r&&r.length!=a&&(r.length=a),r}const Om=Qt(),xb=[NaN,NaN];class Am extends mi{constructor(){super(),this.extent_=yn(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=rm((e,t,n)=>{if(!n)return this.getSimplifiedGeometry(t);const s=this.clone();return s.applyTransform(n),s.getSimplifiedGeometry(t)})}simplifyTransformed(e,t){return this.simplifyTransformedInternal(this.getRevision(),e,t)}clone(){return we()}closestPointXY(e,t,n,s){return we()}containsXY(e,t){return this.closestPointXY(e,t,xb,Number.MIN_VALUE)===0}getClosestPoint(e,t){return t=t||[NaN,NaN],this.closestPointXY(e[0],e[1],t,1/0),t}intersectsCoordinate(e){return this.containsXY(e[0],e[1])}computeExtent(e){return we()}getExtent(e){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&Wo(t),this.extentRevision_=this.getRevision()}return Tv(this.extent_,e)}rotate(e,t){we()}scale(e,t,n){we()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return we()}getType(){return we()}applyTransform(e){we()}intersectsExtent(e){return we()}translate(e,t){we()}transform(e,t){const n=De(e),s=n.getUnits()=="tile-pixels"?function(o,r,a){const l=n.getExtent(),c=n.getWorldExtent(),h=ft(c)/ft(l);Zn(Om,c[0],c[3],h,-h,0,0,0);const u=_i(o,0,o.length,a,Om,r),d=Gi(n,t);return d?d(u,u,a):u}:Gi(n,t);return this.applyTransform(s),this}}class so extends Am{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(e){return Au(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return we()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const t=this.getSimplifiedGeometryInternal(e);return t.getFlatCoordinates().length<this.flatCoordinates.length?t:(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getSimplifiedGeometryInternal(e){return this}getStride(){return this.stride}setFlatCoordinates(e,t){this.stride=Mm(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){we()}setLayout(e,t,n){let s;if(e)s=Mm(e);else{for(let o=0;o<n;++o){if(t.length===0){this.layout="XY",this.stride=2;return}t=t[0]}s=t.length,e=oo(s)}this.layout=e,this.stride=s}applyTransform(e){this.flatCoordinates&&(e(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(e,t){const n=this.getFlatCoordinates();if(n){const s=this.getStride();Im(n,0,n.length,s,e,t,n),this.changed()}}scale(e,t,n){t===void 0&&(t=e),n||(n=Tn(this.getExtent()));const s=this.getFlatCoordinates();if(s){const o=this.getStride();Eb(s,0,s.length,o,e,t,n,s),this.changed()}}translate(e,t){const n=this.getFlatCoordinates();if(n){const s=this.getStride();Cb(n,0,n.length,s,e,t,n),this.changed()}}}function oo(i){let e;return i==2?e="XY":i==3?e="XYZ":i==4&&(e="XYZM"),e}function Mm(i){let e;return i=="XY"?e=2:i=="XYZ"||i=="XYM"?e=3:i=="XYZM"&&(e=4),e}function Pb(i,e,t){const n=i.getFlatCoordinates();if(!n)return null;const s=i.getStride();return _i(n,0,n.length,s,e,t)}function Dm(i,e,t,n){let s=0;const o=i[t-n],r=i[t-n+1];let a=0,l=0;for(;e<t;e+=n){const c=i[e]-o,h=i[e+1]-r;s+=l*c-a*h,a=c,l=h}return s/2}function Fm(i,e,t,n){let s=0;for(let o=0,r=t.length;o<r;++o){const a=t[o];s+=Dm(i,e,a,n),e=a}return s}function Sb(i,e,t,n){let s=0;for(let o=0,r=t.length;o<r;++o){const a=t[o];s+=Fm(i,e,a,n),e=a[a.length-1]}return s}function Lm(i,e,t,n,s,o,r){const a=i[e],l=i[e+1],c=i[t]-a,h=i[t+1]-l;let u;if(c===0&&h===0)u=e;else{const d=((s-a)*c+(o-l)*h)/(c*c+h*h);if(d>1)u=t;else if(d>0){for(let f=0;f<n;++f)r[f]=_n(i[e+f],i[t+f],d);r.length=n;return}else u=e}for(let d=0;d<n;++d)r[d]=i[u+d];r.length=n}function Qu(i,e,t,n,s){let o=i[e],r=i[e+1];for(e+=n;e<t;e+=n){const a=i[e],l=i[e+1],c=eo(o,r,a,l);c>s&&(s=c),o=a,r=l}return s}function Ju(i,e,t,n,s){for(let o=0,r=t.length;o<r;++o){const a=t[o];s=Qu(i,e,a,n,s),e=a}return s}function Rb(i,e,t,n,s){for(let o=0,r=t.length;o<r;++o){const a=t[o];s=Ju(i,e,a,n,s),e=a[a.length-1]}return s}function ed(i,e,t,n,s,o,r,a,l,c,h){if(e==t)return c;let u,d;if(s===0){if(d=eo(r,a,i[e],i[e+1]),d<c){for(u=0;u<n;++u)l[u]=i[e+u];return l.length=n,d}return c}h=h||[NaN,NaN];let f=e+n;for(;f<t;)if(Lm(i,f-n,f,n,r,a,h),d=eo(r,a,h[0],h[1]),d<c){for(c=d,u=0;u<n;++u)l[u]=h[u];l.length=n,f+=n}else f+=n*Math.max((Math.sqrt(d)-Math.sqrt(c))/s|0,1);if(o&&(Lm(i,t-n,e,n,r,a,h),d=eo(r,a,h[0],h[1]),d<c)){for(c=d,u=0;u<n;++u)l[u]=h[u];l.length=n}return c}function td(i,e,t,n,s,o,r,a,l,c,h){h=h||[NaN,NaN];for(let u=0,d=t.length;u<d;++u){const f=t[u];c=ed(i,e,f,n,s,o,r,a,l,c,h),e=f}return c}function Tb(i,e,t,n,s,o,r,a,l,c,h){h=h||[NaN,NaN];for(let u=0,d=t.length;u<d;++u){const f=t[u];c=td(i,e,f,n,s,o,r,a,l,c,h),e=f[f.length-1]}return c}function Ib(i,e,t,n){for(let s=0,o=t.length;s<o;++s)i[e++]=t[s];return e}function uc(i,e,t,n){for(let s=0,o=t.length;s<o;++s){const r=t[s];for(let a=0;a<n;++a)i[e++]=r[a]}return e}function oa(i,e,t,n,s){s=s||[];let o=0;for(let r=0,a=t.length;r<a;++r){const l=uc(i,e,t[r],n);s[o++]=l,e=l}return s.length=o,s}function zm(i,e,t,n,s){s=s||[];let o=0;for(let r=0,a=t.length;r<a;++r){const l=oa(i,e,t[r],n,s[o]);l.length===0&&(l[0]=e),s[o++]=l,e=l[l.length-1]}return s.length=o,s}function ws(i,e,t,n,s){s=s!==void 0?s:[];let o=0;for(let r=e;r<t;r+=n)s[o++]=i.slice(r,r+n);return s.length=o,s}function ra(i,e,t,n,s){s=s!==void 0?s:[];let o=0;for(let r=0,a=t.length;r<a;++r){const l=t[r];s[o++]=ws(i,e,l,n,s[o]),e=l}return s.length=o,s}function nd(i,e,t,n,s){s=s!==void 0?s:[];let o=0;for(let r=0,a=t.length;r<a;++r){const l=t[r];s[o++]=l.length===1&&l[0]===e?[]:ra(i,e,l,n,s[o]),e=l[l.length-1]}return s.length=o,s}function dc(i,e,t,n,s,o,r){const a=(t-e)/n;if(a<3){for(;e<t;e+=n)o[r++]=i[e],o[r++]=i[e+1];return r}const l=new Array(a);l[0]=1,l[a-1]=1;const c=[e,t-n];let h=0;for(;c.length>0;){const u=c.pop(),d=c.pop();let f=0;const g=i[d],_=i[d+1],v=i[u],E=i[u+1];for(let w=d+n;w<u;w+=n){const C=i[w],P=i[w+1],R=Av(C,P,g,_,v,E);R>f&&(h=w,f=R)}f>s&&(l[(h-e)/n]=1,d+n<h&&c.push(d,h),h+n<u&&c.push(h,u))}for(let u=0;u<a;++u)l[u]&&(o[r++]=i[e+u*n],o[r++]=i[e+u*n+1]);return r}function Nm(i,e,t,n,s,o,r,a){for(let l=0,c=t.length;l<c;++l){const h=t[l];r=dc(i,e,h,n,s,o,r),a.push(r),e=h}return r}function ro(i,e){return e*Math.round(i/e)}function Ob(i,e,t,n,s,o,r){if(e==t)return r;let a=ro(i[e],s),l=ro(i[e+1],s);e+=n,o[r++]=a,o[r++]=l;let c,h;do if(c=ro(i[e],s),h=ro(i[e+1],s),e+=n,e==t)return o[r++]=c,o[r++]=h,r;while(c==a&&h==l);for(;e<t;){const u=ro(i[e],s),d=ro(i[e+1],s);if(e+=n,u==c&&d==h)continue;const f=c-a,g=h-l,_=u-a,v=d-l;if(f*v==g*_&&(f<0&&_<f||f==_||f>0&&_>f)&&(g<0&&v<g||g==v||g>0&&v>g)){c=u,h=d;continue}o[r++]=c,o[r++]=h,a=c,l=h,c=u,h=d}return o[r++]=c,o[r++]=h,r}function id(i,e,t,n,s,o,r,a){for(let l=0,c=t.length;l<c;++l){const h=t[l];r=Ob(i,e,h,n,s,o,r),a.push(r),e=h}return r}function Ab(i,e,t,n,s,o,r,a){for(let l=0,c=t.length;l<c;++l){const h=t[l],u=[];r=id(i,e,h,n,s,o,r,u),a.push(u),e=h[h.length-1]}return r}class aa extends so{constructor(e,t){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}clone(){return new aa(this.flatCoordinates.slice(),this.layout)}closestPointXY(e,t,n,s){return s<Qs(this.getExtent(),e,t)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Qu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ed(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,s))}getArea(){return Dm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return ws(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){const t=[];return t.length=dc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new aa(t,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=uc(this.flatCoordinates,0,e,this.stride),this.changed()}}class wn extends so{constructor(e,t){super(),this.setCoordinates(e,t)}clone(){const e=new wn(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,s){const o=this.flatCoordinates,r=eo(e,t,o[0],o[1]);if(r<s){const a=this.stride;for(let l=0;l<a;++l)n[l]=o[l];return n.length=a,r}return s}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(e){return Xg(this.flatCoordinates,e)}getType(){return"Point"}intersectsExtent(e){return Iu(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Ib(this.flatCoordinates,0,e,this.stride),this.changed()}}function Mb(i,e,t,n,s){return!Kg(s,function(r){return!ao(i,e,t,n,r[0],r[1])})}function ao(i,e,t,n,s,o){let r=0,a=i[t-n],l=i[t-n+1];for(;e<t;e+=n){const c=i[e],h=i[e+1];l<=o?h>o&&(c-a)*(o-l)-(s-a)*(h-l)>0&&r++:h<=o&&(c-a)*(o-l)-(s-a)*(h-l)<0&&r--,a=c,l=h}return r!==0}function sd(i,e,t,n,s,o){if(t.length===0||!ao(i,e,t[0],n,s,o))return!1;for(let r=1,a=t.length;r<a;++r)if(ao(i,t[r-1],t[r],n,s,o))return!1;return!0}function Db(i,e,t,n,s,o){if(t.length===0)return!1;for(let r=0,a=t.length;r<a;++r){const l=t[r];if(sd(i,e,l,n,s,o))return!0;e=l[l.length-1]}return!1}function od(i,e,t,n,s,o,r){let a,l,c,h,u,d,f;const g=s[o+1],_=[];for(let w=0,C=t.length;w<C;++w){const P=t[w];for(h=i[P-n],d=i[P-n+1],a=e;a<P;a+=n)u=i[a],f=i[a+1],(g<=d&&f<=g||d<=g&&g<=f)&&(c=(g-d)/(f-d)*(u-h)+h,_.push(c)),h=u,d=f}let v=NaN,E=-1/0;for(_.sort(di),h=_[0],a=1,l=_.length;a<l;++a){u=_[a];const w=Math.abs(u-h);w>E&&(c=(h+u)/2,sd(i,e,t,n,c,g)&&(v=c,E=w)),h=u}return isNaN(v)&&(v=s[o]),r?(r.push(v,g,E),r):[v,g,E]}function km(i,e,t,n,s){let o=[];for(let r=0,a=t.length;r<a;++r){const l=t[r];o=od(i,e,l,n,s,2*r,o),e=l[l.length-1]}return o}function jm(i,e,t,n,s){let o;for(e+=n;e<t;e+=n)if(o=s(i.slice(e-n,e),i.slice(e,e+n)),o)return o;return!1}function fc(i,e,t,n,s,o){return o=o??Zg(yn(),i,e,t,n),pt(s,o)?o[0]>=s[0]&&o[2]<=s[2]||o[1]>=s[1]&&o[3]<=s[3]?!0:jm(i,e,t,n,function(r,a){return Ov(s,r,a)}):!1}function Fb(i,e,t,n,s){for(let o=0,r=t.length;o<r;++o){if(fc(i,e,t[o],n,s))return!0;e=t[o]}return!1}function Um(i,e,t,n,s){return!!(fc(i,e,t,n,s)||ao(i,e,t,n,s[0],s[1])||ao(i,e,t,n,s[0],s[3])||ao(i,e,t,n,s[2],s[1])||ao(i,e,t,n,s[2],s[3]))}function Gm(i,e,t,n,s){if(!Um(i,e,t[0],n,s))return!1;if(t.length===1)return!0;for(let o=1,r=t.length;o<r;++o)if(Mb(i,t[o-1],t[o],n,s)&&!fc(i,t[o-1],t[o],n,s))return!1;return!0}function Lb(i,e,t,n,s){for(let o=0,r=t.length;o<r;++o){const a=t[o];if(Gm(i,e,a,n,s))return!0;e=a[a.length-1]}return!1}function zb(i,e,t,n){for(;e<t-n;){for(let s=0;s<n;++s){const o=i[e+s];i[e+s]=i[t-n+s],i[t-n+s]=o}e+=n,t-=n}}function rd(i,e,t,n){let s=0,o=i[t-n],r=i[t-n+1];for(;e<t;e+=n){const a=i[e],l=i[e+1];s+=(a-o)*(l+r),o=a,r=l}return s===0?void 0:s>0}function ad(i,e,t,n,s){s=s!==void 0?s:!1;for(let o=0,r=t.length;o<r;++o){const a=t[o],l=rd(i,e,a,n);if(o===0){if(s&&l||!s&&!l)return!1}else if(s&&!l||!s&&l)return!1;e=a}return!0}function qm(i,e,t,n,s){for(let o=0,r=t.length;o<r;++o){const a=t[o];if(!ad(i,e,a,n,s))return!1;a.length&&(e=a[a.length-1])}return!0}function pc(i,e,t,n,s){s=s!==void 0?s:!1;for(let o=0,r=t.length;o<r;++o){const a=t[o],l=rd(i,e,a,n);(o===0?s&&l||!s&&!l:s&&!l||!s&&l)&&zb(i,e,a,n),e=a}return e}function ld(i,e,t,n,s){for(let o=0,r=t.length;o<r;++o)e=pc(i,e,t[o],n,s);return e}function Vm(i,e){const t=[];let n=0,s=0,o;for(let r=0,a=e.length;r<a;++r){const l=e[r],c=rd(i,n,l,2);if(o===void 0&&(o=c),c===o)t.push(e.slice(s,r+1));else{if(t.length===0)continue;t[t.length-1].push(e[s])}s=r+1,n=l}return t}class Kn extends so{constructor(e,t,n){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,t!==void 0&&n?(this.setFlatCoordinates(t,e),this.ends_=n):this.setCoordinates(e,t)}appendLinearRing(e){this.flatCoordinates?fi(this.flatCoordinates,e.getFlatCoordinates()):this.flatCoordinates=e.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const e=new Kn(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,n,s){return s<Qs(this.getExtent(),e,t)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Ju(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),td(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,s))}containsXY(e,t){return sd(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return Fm(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),pc(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,ra(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const e=Tn(this.getExtent());this.flatInteriorPoint_=od(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new wn(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new aa(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLinearRings(){const e=this.layout,t=this.flatCoordinates,n=this.ends_,s=[];let o=0;for(let r=0,a=n.length;r<a;++r){const l=n[r],c=new aa(t.slice(o,l),e);s.push(c),o=l}return s}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const e=this.flatCoordinates;ad(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=pc(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){const t=[],n=[];return t.length=id(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),t,0,n),new Kn(t,"XY",n)}getType(){return"Polygon"}intersectsExtent(e){return Gm(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);const n=oa(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}}function cd(i){if(Ui(i))throw new Error("Cannot create polygon from empty extent");const e=i[0],t=i[1],n=i[2],s=i[3],o=[e,t,e,s,n,s,n,t,e,t];return new Kn(o,"XY",[o.length])}const cn={ADD:"add",REMOVE:"remove"},Wm={LENGTH:"length"};class gc extends Yn{constructor(e,t,n){super(e),this.element=t,this.index=n}}class On extends mi{constructor(e,t){if(super(),this.on,this.once,this.un,t=t||{},this.unique_=!!t.unique,this.array_=e??[],this.unique_)for(let n=1,s=this.array_.length;n<s;++n)this.assertUnique_(this.array_[n],n);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(e){for(let t=0,n=e.length;t<n;++t)this.push(e[t]);return this}forEach(e){const t=this.array_;for(let n=0,s=t.length;n<s;++n)e(t[n],n,t)}getArray(){return this.array_}item(e){return this.array_[e]}getLength(){return this.get(Wm.LENGTH)}insertAt(e,t){if(e<0||e>this.getLength())throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new gc(cn.ADD,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){const t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){const t=this.array_;for(let n=0,s=t.length;n<s;++n)if(t[n]===e)return this.removeAt(n)}removeAt(e){if(e<0||e>=this.getLength())return;const t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new gc(cn.REMOVE,t,e)),t}setAt(e,t){const n=this.getLength();if(e>=n){this.insertAt(e,t);return}if(e<0)throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t,e);const s=this.array_[e];this.array_[e]=t,this.dispatchEvent(new gc(cn.REMOVE,s,e)),this.dispatchEvent(new gc(cn.ADD,t,e))}updateLength_(){this.set(Wm.LENGTH,this.array_.length)}assertUnique_(e,t){const n=this.array_;for(let s=0,o=n.length;s<o;++s)if(n[s]===e&&s!==t)throw new Error("Duplicate item added to a unique collection")}}class An extends mi{constructor(e){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),e)if(typeof e.getSimplifiedGeometry=="function"){const t=e;this.setGeometry(t)}else{const t=e;this.setProperties(t)}}clone(){const e=new An(this.hasProperties()?this.getProperties():null);e.setGeometryName(this.getGeometryName());const t=this.getGeometry();t&&e.setGeometry(t.clone());const n=this.getStyle();return n&&e.setStyle(n),e}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(st(this.geometryChangeKey_),this.geometryChangeKey_=null);const e=this.getGeometry();e&&(this.geometryChangeKey_=Ue(e,_e.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?Nb(e):void 0,this.changed()}setId(e){this.id_=e,this.changed()}setGeometryName(e){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=e,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}}function Nb(i){if(typeof i=="function")return i;let e;return Array.isArray(i)?e=i:(Ve(typeof i.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[i]),function(){return e}}function mc(i,e,t,n,s,o,r){let a,l;const c=(t-e)/n;if(c===1)a=e;else if(c===2)a=e,l=s;else if(c!==0){let h=i[e],u=i[e+1],d=0;const f=[0];for(let v=e+n;v<t;v+=n){const E=i[v],w=i[v+1];d+=Math.sqrt((E-h)*(E-h)+(w-u)*(w-u)),f.push(d),h=E,u=w}const g=s*d,_=bv(f,g);_<0?(l=(g-f[-_-2])/(f[-_-1]-f[-_-2]),a=e+(-_-2)*n):a=e+_*n}r=r>1?r:2,o=o||new Array(r);for(let h=0;h<r;++h)o[h]=a===void 0?NaN:l===void 0?i[a+h]:_n(i[a+h],i[a+n+h],l);return o}function hd(i,e,t,n,s,o){if(t==e)return null;let r;if(s<i[e+n-1])return o?(r=i.slice(e,e+n),r[n-1]=s,r):null;if(i[t-1]<s)return o?(r=i.slice(t-n,t),r[n-1]=s,r):null;if(s==i[e+n-1])return i.slice(e,e+n);let a=e/n,l=t/n;for(;a<l;){const d=a+l>>1;s<i[(d+1)*n-1]?l=d:a=d+1}const c=i[a*n-1];if(s==c)return i.slice((a-1)*n,(a-1)*n+n);const h=i[(a+1)*n-1],u=(s-c)/(h-c);r=[];for(let d=0;d<n-1;++d)r.push(_n(i[(a-1)*n+d],i[a*n+d],u));return r.push(s),r}function kb(i,e,t,n,s,o,r){if(r)return hd(i,e,t[t.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 l=0,c=t.length;l<c;++l){const h=t[l];if(e!=h){if(s<i[e+n-1])return null;if(s<=i[h-1])return hd(i,e,h,n,s,!1);e=h}}return null}function ud(i,e,t,n){let s=i[e],o=i[e+1],r=0;for(let a=e+n;a<t;a+=n){const l=i[a],c=i[a+1];r+=Math.sqrt((l-s)*(l-s)+(c-o)*(c-o)),s=l,o=c}return r}class Qn extends so{constructor(e,t){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendCoordinate(e){fi(this.flatCoordinates,e),this.changed()}clone(){const e=new Qn(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,s){return s<Qs(this.getExtent(),e,t)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Qu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ed(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,e,t,n,s))}forEachSegment(e){return jm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinateAtM(e,t){return this.layout!="XYM"&&this.layout!="XYZM"?null:(t=t!==void 0?t:!1,hd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t))}getCoordinates(){return ws(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(e,t){return mc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,this.stride)}getLength(){return ud(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(e){const t=[];return t.length=dc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new Qn(t,"XY")}getType(){return"LineString"}intersectsExtent(e){return fc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,this.getExtent())}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=uc(this.flatCoordinates,0,e,this.stride),this.changed()}}const Mn={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"},lo=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"";lo.includes("safari")&&!lo.includes("chrom")&&(lo.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(lo));const jb=lo.includes("webkit")&&!lo.includes("edge"),Bm=lo.includes("macintosh"),Ub=typeof devicePixelRatio<"u"?devicePixelRatio:1,hn=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,dd=typeof Image<"u"&&Image.prototype.decode,$m=typeof createImageBitmap=="function",Hm=(function(){let i=!1;try{const e=Object.defineProperty({},"passive",{get:function(){i=!0}});globalThis.addEventListener("_",null,e),globalThis.removeEventListener("_",null,e)}catch{}return i})(),le={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function ht(i,e,t,n){let s;return t&&t.length?s=t.shift():hn?s=new class extends OffscreenCanvas{constructor(){super(...arguments);T(this,"style",{})}}(i??300,e??150):s=document.createElement("canvas"),i&&(s.width=i),e&&(s.height=e),s.getContext("2d",n)}let fd;function yc(){return fd||(fd=ht(1,1)),fd}function la(i){const e=i.canvas;e.width=1,e.height=1,i.clearRect(0,0,1,1)}function Xm(i,e){const t=e.parentNode;t&&t.replaceChild(i,e)}function Gb(i){for(;i.lastChild;)i.lastChild.remove()}function qb(i,e){const t=i.childNodes;for(let n=0;;++n){const s=t[n],o=e[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)}}}function Ym(){return new Proxy({childNodes:[],appendChild:function(e){return this.childNodes.push(e),e},remove:function(){},removeChild:function(e){const t=this.childNodes.indexOf(e);if(t===-1)throw new Error("Node to remove was not found");return this.childNodes.splice(t,1),e},insertBefore:function(e,t){const n=this.childNodes.indexOf(t);if(n===-1)throw new Error("Reference node not found");return this.childNodes.splice(n,0,e),e},style:{}},{get(e,t,n){return t==="firstElementChild"?e.childNodes.length>0?e.childNodes[0]:null:Reflect.get(e,t,n)}})}function vs(i){return typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas}const pd=[NaN,NaN,NaN,0];let gd;function Vb(){return gd||(gd=ht(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),gd}const Wb=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Bb=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,$b=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Hb=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function _c(i,e){return i.endsWith("%")?Number(i.substring(0,i.length-1))/e:Number(i)}function ca(i){throw new Error('failed to parse "'+i+'" as color')}function Zm(i){if(i.toLowerCase().startsWith("rgb")){const o=i.match(Bb)||i.match(Wb)||i.match($b);if(o){const r=o[4],a=100/255;return[ct(_c(o[1],a)+.5|0,0,255),ct(_c(o[2],a)+.5|0,0,255),ct(_c(o[3],a)+.5|0,0,255),r!==void 0?ct(_c(r,100),0,1):1]}ca(i)}if(i.startsWith("#")){if(Hb.test(i)){const o=i.substring(1),r=o.length<=4?1:2,a=[0,0,0,255];for(let l=0,c=o.length;l<c;l+=r){let h=parseInt(o.substring(l,l+r),16);r===1&&(h+=h<<4),a[l/r]=h}return a[3]=a[3]/255,a}ca(i)}const e=Vb();e.fillStyle="#abcdef";let t=e.fillStyle;e.fillStyle=i,e.fillStyle===t&&(e.fillStyle="#fedcba",t=e.fillStyle,e.fillStyle=i,e.fillStyle===t&&ca(i));const n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return Zm(n);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);const s=Array.from(e.getImageData(0,0,1,1).data);return s[3]=Xr(s[3]/255,3),s}function Xb(i){return typeof i=="string"?i:bd(i)}const Yb=1024,ha={};let md=0;function Zb(i){if(i.length===4)return i;const e=i.slice();return e[3]=1,e}function yd(i){return i>.0031308?Math.pow(i,1/2.4)*269.025-14.025:i*3294.6}function _d(i){return i>.2068965?Math.pow(i,3):(i-4/29)*(108/841)}function wd(i){return i>10.314724?Math.pow((i+14.025)/269.025,2.4):i/3294.6}function vd(i){return i>.0088564?Math.pow(i,1/3):i/(108/841)+4/29}function Km(i){const e=wd(i[0]),t=wd(i[1]),n=wd(i[2]),s=vd(e*.222488403+t*.716873169+n*.06060791),o=500*(vd(e*.452247074+t*.399439023+n*.148375274)-s),r=200*(s-vd(e*.016863605+t*.117638439+n*.865350722)),a=Math.atan2(r,o)*(180/Math.PI);return[116*s-16,Math.sqrt(o*o+r*r),a<0?a+360:a,i[3]]}function Kb(i){const e=(i[0]+16)/116,t=i[1],n=i[2]*Math.PI/180,s=_d(e),o=_d(e+t/500*Math.cos(n)),r=_d(e-t/200*Math.sin(n)),a=yd(o*3.021973625-s*1.617392459-r*.404875592),l=yd(o*-.943766287+s*1.916279586+r*.027607165),c=yd(o*.069407491-s*.22898585+r*1.159737864);return[ct(a+.5|0,0,255),ct(l+.5|0,0,255),ct(c+.5|0,0,255),i[3]]}function wc(i){if(i==="none")return pd;if(ha.hasOwnProperty(i))return ha[i];if(md>=Yb){let t=0;for(const n in ha)(t++&3)===0&&(delete ha[n],--md)}const e=Zm(i);e.length!==4&&ca(i);for(const t of e)isNaN(t)&&ca(i);return ha[i]=e,++md,e}function co(i){return Array.isArray(i)?i:wc(i)}function bd(i){let e=i[0];e!=(e|0)&&(e=e+.5|0);let t=i[1];t!=(t|0)&&(t=t+.5|0);let n=i[2];n!=(n|0)&&(n=n+.5|0);const s=i[3]===void 0?1:Math.round(i[3]*1e3)/1e3;return"rgba("+e+","+t+","+n+","+s+")"}class vc extends Jr{constructor(e,t,n,s){super(),this.extent=e,this.pixelRatio_=n,this.resolution=t,this.state=typeof s=="function"?le.IDLE:s,this.image_=null,this.loader=typeof s=="function"?s:null}changed(){this.dispatchEvent(_e.CHANGE)}getExtent(){return this.extent}getImage(){return this.image_}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){if(this.state==le.IDLE&&this.loader){this.state=le.LOADING,this.changed();const e=this.getResolution(),t=Array.isArray(e)?e[0]:e;$o(()=>this.loader(this.getExtent(),t,this.getPixelRatio())).then(n=>{"image"in n&&(this.image_=n.image),"extent"in n&&(this.extent=n.extent),"resolution"in n&&(this.resolution=n.resolution),"pixelRatio"in n&&(this.pixelRatio_=n.pixelRatio),(n instanceof HTMLImageElement||$m&&n instanceof ImageBitmap||n instanceof HTMLCanvasElement||n instanceof HTMLVideoElement)&&(this.image_=n),this.state=le.LOADED}).catch(n=>{this.state=le.ERROR,console.error(n)}).finally(()=>this.changed())}}setImage(e){this.image_=e}setResolution(e){this.resolution=e}}function Qb(i,e,t){const n=i;let s=!0,o=!1,r=!1;const a=[tc(n,_e.LOAD,function(){r=!0,o||e()})];return n.src&&dd?(o=!0,n.decode().then(function(){s&&e()}).catch(function(l){s&&(r?e():t())})):a.push(tc(n,_e.ERROR,t)),function(){s=!1,a.forEach(st)}}function Jb(i,e){return new Promise((t,n)=>{function s(){r(),t(i)}function o(){r(),n(new Error("Image load error"))}function r(){i.removeEventListener("load",s),i.removeEventListener("error",o)}i.addEventListener("load",s),i.addEventListener("error",o)})}function Qm(i,e){return e&&(i.src=e),i.src&&dd?new Promise((t,n)=>i.decode().then(()=>t(i)).catch(s=>i.complete&&i.width?t(i):n(s))):Jb(i)}function Jm(i,e){return e&&(i.src=e),i.src&&dd&&$m?i.decode().then(()=>createImageBitmap(i)).catch(t=>{if(i.complete&&i.width)return i;throw t}):Qm(i)}class eE{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let e=0;for(const t in this.cache_){const n=this.cache_[t];(e++&3)===0&&!n.hasListener()&&(delete this.cache_[t],delete this.patternCache_[t],--this.cacheSize_)}}}get(e,t){const n=Ed(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){const n=Ed(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,s){const o=Ed(e,t),r=o in this.cache_;this.cache_[o]=n,s&&(n.getImageState()===le.IDLE&&n.load(),n.getImageState()===le.LOADING?n.ready().then(()=>{this.patternCache_[o]=yc().createPattern(n.getImage(1),"repeat")}):this.patternCache_[o]=yc().createPattern(n.getImage(1),"repeat")),r||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}}function Ed(i,e){const t=e?co(e):"null";return i+":"+t}const Dn=new eE;let ua=null;class e0 extends Jr{constructor(e,t,n,s,o){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=n==null?void 0:n.crossOrigin,this.referrerPolicy_=n==null?void 0:n.referrerPolicy,this.canvas_={},this.color_=o,this.imageState_=s===void 0?le.IDLE:s,this.size_=e&&e.width&&e.height?[e.width,e.height]:null,this.src_=t,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===le.LOADED){ua||(ua=ht(1,1,void 0,{willReadFrequently:!0})),ua.drawImage(this.image_,0,0);try{ua.getImageData(0,0,1,1),this.tainted_=!1}catch{ua=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(_e.CHANGE)}handleImageError_(){this.imageState_=le.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=le.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}setImage(e){this.image_=e}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const e=this.size_[0],t=this.size_[1],n=ht(e,t);n.fillRect(0,0,e,t),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===le.IDLE){this.image_||this.initializeImage_(),this.imageState_=le.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&Qm(this.image_,this.src_).then(e=>{this.image_=e,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==le.LOADED)return;const t=this.image_,n=ht(Math.ceil(t.width*e),Math.ceil(t.height*e)),s=n.canvas;n.scale(e,e),n.drawImage(t,0,0),n.globalCompositeOperation="multiply",n.fillStyle=Xb(this.color_),n.fillRect(0,0,s.width/e,s.height/e),n.globalCompositeOperation="destination-in",n.drawImage(t,0,0),this.canvas_[e]=s}ready(){return this.ready_||(this.ready_=new Promise(e=>{if(this.imageState_===le.LOADED||this.imageState_===le.ERROR)e();else{const t=()=>{(this.imageState_===le.LOADED||this.imageState_===le.ERROR)&&(this.removeEventListener(_e.CHANGE,t),e())};this.addEventListener(_e.CHANGE,t)}})),this.ready_}}function da(i,e,t,n,s,o){let r=e===void 0?void 0:Dn.get(e,s);return r||(r=new e0(i,i&&"src"in i?i.src||void 0:e,t,n,s),Dn.set(e,s,r,o)),o&&r&&!Dn.getPattern(e,s)&&Dn.set(e,s,r,o),r}function wi(i){return i?Array.isArray(i)?bd(i):typeof i=="object"&&"src"in i?tE(i):i:null}function tE(i){if(!i.offset||!i.size)return Dn.getPattern(i.src,i.color);const e=i.src+":"+i.offset,t=Dn.getPattern(e,i.color);if(t)return t;const n=Dn.get(i.src,null);if(n.getImageState()!==le.LOADED)return null;const s=ht(i.size[0],i.size[1]);return s.drawImage(n.getImage(1),i.offset[0],i.offset[1],i.size[0],i.size[1],0,0,i.size[0],i.size[1]),da(s.canvas,e,void 0,le.LOADED,i.color,!0),Dn.getPattern(e,i.color)}function nE(i,e,t,n,s,o){s=s??[],o=o??e;const r=i[0],a=i[1],l=i[i.length-4],c=i[i.length-3];let h,u,d,f,g,_,v,E,w=0;for(let C=0;C<i.length;C+=e){d=h,f=u,g=void 0,_=void 0,C+e<i.length&&(g=i[C+e],_=i[C+e+1]),n&&C===0&&(d=l,f=c),n&&C===i.length-2&&(g=r,_=a),h=i[C],u=i[C+1],[v,E]=bc(h,u,d,f,g,_,t),s[w++]=v,s[w++]=E;for(let P=2;P<o;P++)s[w++]=i[C+P]}return s.length!=w&&(s.length=w),s}function bc(i,e,t,n,s,o,r){let a,l;t!==void 0&&n!==void 0?(a=i-t,l=e-n):s!==void 0&&o!==void 0?(a=s-i,l=o-e):(a=1,l=0);const c=Math.hypot(a,l),h=a/c,u=l/c;if(a=-u,l=h,t===void 0||n===void 0)return[i+a*r,e+l*r];if(s===void 0||o===void 0)return[i+a*r,e+l*r];const d=Uv([i,e],[t,n],[s,o]);if(Math.cos(d)>.998)return[i+h*r,e+u*r];const f=Math.cos(d/2),g=Math.sin(d/2),_=g*a+f*l,v=-f*a+g*l,E=_*(1/g),w=v*(1/g);return[i+E*r,e+w*r]}class t0{drawCustom(e,t,n,s,o){}drawGeometry(e){}setStyle(e){}drawCircle(e,t,n){}drawFeature(e,t,n){}drawGeometryCollection(e,t,n){}drawLineString(e,t,n){}drawMultiLineString(e,t,n){}drawMultiPoint(e,t,n){}drawMultiPolygon(e,t,n){}drawPoint(e,t,n){}drawPolygon(e,t,n){}drawText(e,t,n){}setFillStrokeStyle(e,t){}setImageStyle(e,t){}setTextStyle(e,t){}}const Ec="ol-hidden",Cc="ol-unselectable",Cd="ol-control",n0="ol-collapsed",iE=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z0-9]+?)\\s*$`].join(""),"i"),i0=["style","variant","weight","size","lineHeight","family"],xd={normal:400,bold:700},Pd=function(i){const e=i.match(iE);if(!e)return null;const t={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let n=0,s=i0.length;n<s;++n){const o=e[n+1];o!==void 0&&(t[i0[n]]=typeof o=="string"?o.trim():o)}return isNaN(Number(t.weight))&&t.weight in xd&&(t.weight=xd[t.weight]),t.families=t.family.split(/,\s?/).map(n=>n.trim().replace(/^['"]|['"]$/g,"")),t},s0="10px sans-serif",un="#000",Qo="round",Vi=[],Wi=0,Jo="round",fa=10,sE=0,pa="#000",ga="center",xc="middle",ho=[0,0,0,0],ma=1,uo=new mi;let ya=null,o0;const Sd={},oE=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function rE(i,e,t){return`${i} ${e} 16px "${t}"`}const aE=(function(){let e,t;async function n(o){await t.ready;const r=await t.load(o);if(r.length===0)return!1;const a=Pd(o),l=a.families[0].toLowerCase(),c=a.weight;return r.some(h=>{const u=h.family.replace(/^['"]|['"]$/g,"").toLowerCase(),d=xd[h.weight]||h.weight;return u===l&&h.style===a.style&&d==c})}async function s(){await t.ready;let o=!0;const r=uo.getProperties(),a=Object.keys(r).filter(l=>r[l]<100);for(let l=a.length-1;l>=0;--l){const c=a[l];let h=r[c];h<100&&(await n(c)?(Qr(Sd),uo.set(c,100)):(h+=10,uo.set(c,h,!0),h<100&&(o=!1)))}e=void 0,o||(e=setTimeout(s,100))}return async function(o){t||(t=hn?self.fonts:document.fonts);const r=Pd(o);if(!r)return;const a=r.families;let l=!1;for(const c of a){if(oE.has(c))continue;const h=rE(r.style,r.weight,c);uo.get(h)===void 0&&(uo.set(h,0,!0),l=!0)}l&&(clearTimeout(e),e=setTimeout(s,100))}})(),lE=(function(){let i;return function(e){let t=Sd[e];if(t==null){if(hn){const n=Pd(e),s=r0(e,"Žg");t=(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=e,document.body.appendChild(i),t=i.offsetHeight,document.body.removeChild(i);Sd[e]=t}return t}})();function r0(i,e){return ya||(ya=ht(1,1)),i!=o0&&(ya.font=i,o0=ya.font),ya.measureText(e)}function a0(i,e){return r0(i,e).width}function l0(i,e,t){if(e in t)return t[e];const n=e.split(`
|
|
22
|
-
`).reduce((s,
|
|
23
|
-
`||c===h){o=Math.max(o,r),s.push(r),r=0,a+=l,l=0;continue}const d=e[c+1]||i.font,f=a0(d,u);t.push(f),r+=f;const g=lE(d);n.push(g),l=Math.max(l,g)}return{width:o,height:a,widths:t,heights:n,lineWidths:s}}function hE(i,e,t,n,s,o,r,a,l,c,h){i.save(),t!==1&&(i.globalAlpha===void 0?i.globalAlpha=u=>u.globalAlpha*=t:i.globalAlpha*=t),e&&i.transform.apply(i,e),n.contextInstructions?(i.translate(l,c),i.scale(h[0],h[1]),uE(n,i)):h[0]<0||h[1]<0?(i.translate(l,c),i.scale(h[0],h[1]),i.drawImage(n,s,o,r,a,0,0,r,a)):i.drawImage(n,s,o,r,a,l,c,r*h[0],a*h[1]),i.restore()}function uE(i,e){const t=i.contextInstructions;for(let n=0,s=t.length;n<s;n+=2)Array.isArray(t[n+1])?e[t[n]].apply(e,t[n+1]):e[t[n]]=t[n+1]}class c0 extends t0{constructor(e,t,n,s,o,r,a){super(),this.context_=e,this.pixelRatio_=t,this.extent_=n,this.transform_=s,this.transformRotation_=s?Xr(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_=Qt()}drawImages_(e,t,n,s){if(!this.image_)return;const o=_i(e,t,n,s,this.transform_,this.pixelCoordinates_),r=this.context_,a=this.tmpLocalTransform_,l=r.globalAlpha;this.imageOpacity_!=1&&(r.globalAlpha=l*this.imageOpacity_);let c=this.imageRotation_;this.transformRotation_===0&&(c-=this.viewRotation_),this.imageRotateWithView_&&(c+=this.viewRotation_);for(let h=0,u=o.length;h<u;h+=2){const d=o[h]-this.imageAnchorX_,f=o[h+1]-this.imageAnchorY_;if(c!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const g=d+this.imageAnchorX_,_=f+this.imageAnchorY_;Zn(a,g,_,1,1,c,-g,-_),r.save(),r.transform.apply(r,a),r.translate(g,_),r.scale(this.imageScale_[0],this.imageScale_[1]),r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),r.restore()}else r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,d,f,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(r.globalAlpha=l)}drawText_(e,t,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=_i(e,t,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_);t<n;t+=s){const l=o[t]+this.textOffsetX_,c=o[t+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(r.save(),r.translate(l-this.textOffsetX_,c-this.textOffsetY_),r.rotate(a),r.translate(this.textOffsetX_,this.textOffsetY_),r.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&r.strokeText(this.text_,0,0),this.textFillState_&&r.fillText(this.text_,0,0),r.restore()):(this.textStrokeState_&&r.strokeText(this.text_,l,c),this.textFillState_&&r.fillText(this.text_,l,c))}}moveToLineTo_(e,t,n,s,o,r){const a=this.context_;let l=_i(e,t,n,s,this.transform_,this.pixelCoordinates_);Math.abs(r)>0&&(l=nE(l,s,r,o,l)),a.moveTo(l[0],l[1]);let c=l.length;o&&(c-=2);for(let h=2;h<c;h+=2)a.lineTo(l[h],l[h+1]);return o&&a.closePath(),n}drawRings_(e,t,n,s,o){for(let r=0,a=n.length;r<a;++r)t=this.moveToLineTo_(e,t,n[r],s,!0,o);return t}drawCircle(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!pt(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=Pb(e,this.transform_,this.pixelCoordinates_),n=t[2]-t[0],s=t[3]-t[1],o=Math.sqrt(n*n+s*s),r=this.context_;r.beginPath(),r.arc(t[0],t[1],o,0,2*Math.PI),this.fillState_&&r.fill(),this.strokeState_&&r.stroke()}this.text_!==""&&this.drawText_(e.getCenter(),0,2,2)}}setStyle(e){this.setFillStrokeStyle(e.getFill(),e.getStroke()),this.setImageStyle(e.getImage()),this.setTextStyle(e.getText())}setTransform(e){this.transform_=e}drawGeometry(e){switch(e.getType()){case"Point":this.drawPoint(e);break;case"LineString":this.drawLineString(e);break;case"Polygon":this.drawPolygon(e);break;case"MultiPoint":this.drawMultiPoint(e);break;case"MultiLineString":this.drawMultiLineString(e);break;case"MultiPolygon":this.drawMultiPolygon(e);break;case"GeometryCollection":this.drawGeometryCollection(e);break;case"Circle":this.drawCircle(e);break}}drawFeature(e,t){const n=t.getGeometryFunction()(e);n&&(this.setStyle(t),this.drawGeometry(n))}drawGeometryCollection(e){const t=e.getGeometriesArray();for(let n=0,s=t.length;n<s;++n)this.drawGeometry(t[n])}drawPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),this.text_!==""&&this.drawText_(t,0,t.length,n)}drawMultiPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),this.text_!==""&&this.drawText_(t,0,t.length,n)}drawLineString(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!pt(this.extent_,e.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const t=this.context_,n=e.getFlatCoordinates();t.beginPath(),this.moveToLineTo_(n,0,n.length,e.getStride(),!1,this.strokeState_.strokeOffset),t.stroke()}if(this.text_!==""){const t=e.getFlatMidpoint();this.drawText_(t,0,2,2)}}}drawMultiLineString(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getExtent();if(pt(this.extent_,t)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const n=this.context_,s=e.getFlatCoordinates();let o=0;const r=e.getEnds(),a=e.getStride();n.beginPath();for(let l=0,c=r.length;l<c;++l)o=this.moveToLineTo_(s,o,r[l],a,!1,this.strokeState_.strokeOffset);n.stroke()}if(this.text_!==""){const n=e.getFlatMidpoints();this.drawText_(n,0,n.length,2)}}}drawPolygon(e){var t;if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!pt(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const n=this.context_;n.beginPath(),this.drawRings_(e.getOrientedFlatCoordinates(),0,e.getEnds(),e.getStride(),(t=this.strokeState_)==null?void 0:t.strokeOffset),this.fillState_&&n.fill(),this.strokeState_&&n.stroke()}if(this.text_!==""){const n=e.getFlatInteriorPoint();this.drawText_(n,0,2,2)}}}drawMultiPolygon(e){var t;if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!pt(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const n=this.context_,s=e.getOrientedFlatCoordinates();let o=0;const r=e.getEndss(),a=e.getStride();n.beginPath();for(let l=0,c=r.length;l<c;++l){const h=r[l];o=this.drawRings_(s,o,h,a,(t=this.strokeState_)==null?void 0:t.strokeOffset)}this.fillState_&&n.fill(),this.strokeState_&&n.stroke()}if(this.text_!==""){const n=e.getFlatInteriorPoints();this.drawText_(n,0,n.length,2)}}}setContextFillState_(e){const t=this.context_,n=this.contextFillState_;n?n.fillStyle!=e.fillStyle&&(n.fillStyle=e.fillStyle,t.fillStyle=e.fillStyle):(t.fillStyle=e.fillStyle,this.contextFillState_={fillStyle:e.fillStyle})}setContextStrokeState_(e){const t=this.context_,n=this.contextStrokeState_;n?(n.lineCap!=e.lineCap&&(n.lineCap=e.lineCap,t.lineCap=e.lineCap),ps(n.lineDash,e.lineDash)||t.setLineDash(n.lineDash=e.lineDash),n.lineDashOffset!=e.lineDashOffset&&(n.lineDashOffset=e.lineDashOffset,t.lineDashOffset=e.lineDashOffset),n.lineJoin!=e.lineJoin&&(n.lineJoin=e.lineJoin,t.lineJoin=e.lineJoin),n.lineWidth!=e.lineWidth&&(n.lineWidth=e.lineWidth,t.lineWidth=e.lineWidth),n.miterLimit!=e.miterLimit&&(n.miterLimit=e.miterLimit,t.miterLimit=e.miterLimit),n.strokeStyle!=e.strokeStyle&&(n.strokeStyle=e.strokeStyle,t.strokeStyle=e.strokeStyle)):(t.lineCap=e.lineCap,t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset,t.lineJoin=e.lineJoin,t.lineWidth=e.lineWidth,t.miterLimit=e.miterLimit,t.strokeStyle=e.strokeStyle,this.contextStrokeState_={lineCap:e.lineCap,lineDash:e.lineDash,lineDashOffset:e.lineDashOffset,lineJoin:e.lineJoin,lineWidth:e.lineWidth,miterLimit:e.miterLimit,strokeStyle:e.strokeStyle})}setContextTextState_(e){const t=this.context_,n=this.contextTextState_,s=e.textAlign?e.textAlign:ga;n?(n.font!=e.font&&(n.font=e.font,t.font=e.font),n.textAlign!=s&&(n.textAlign=s,t.textAlign=s),n.textBaseline!=e.textBaseline&&(n.textBaseline=e.textBaseline,t.textBaseline=e.textBaseline)):(t.font=e.font,t.textAlign=s,t.textBaseline=e.textBaseline,this.contextTextState_={font:e.font,textAlign:s,textBaseline:e.textBaseline})}setFillStrokeStyle(e,t){if(!e)this.fillState_=null;else{const n=e.getColor();this.fillState_={fillStyle:wi(n||un)}}if(!t)this.strokeState_=null;else{const n=t.getColor(),s=t.getLineCap(),o=t.getLineDash(),r=t.getLineDashOffset(),a=t.getLineJoin(),l=t.getWidth(),c=t.getMiterLimit(),h=o||Vi,u=t.getOffset();this.strokeState_={lineCap:s!==void 0?s:Qo,lineDash:this.pixelRatio_===1?h:h.map(d=>d*this.pixelRatio_),lineDashOffset:(r||Wi)*this.pixelRatio_,lineJoin:a!==void 0?a:Jo,lineWidth:(l!==void 0?l:ma)*this.pixelRatio_,miterLimit:c!==void 0?c:fa,strokeStyle:wi(n||pa),strokeOffset:(u??0)*this.pixelRatio_}}}setImageStyle(e){let t;if(!e||!(t=e.getSize())){this.image_=null;return}const n=e.getPixelRatio(this.pixelRatio_),s=e.getAnchor(),o=e.getOrigin();this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=s[0]*n,this.imageAnchorY_=s[1]*n,this.imageHeight_=t[1]*n,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=o[0],this.imageOriginY_=o[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();const r=e.getScaleArray();this.imageScale_=[r[0]*this.pixelRatio_/n,r[1]*this.pixelRatio_/n],this.imageWidth_=t[0]*n}setTextStyle(e){if(!e)this.text_="";else{const t=e.getFill();if(!t)this.textFillState_=null;else{const f=t.getColor();this.textFillState_={fillStyle:wi(f||un)}}const n=e.getStroke();if(!n)this.textStrokeState_=null;else{const f=n.getColor(),g=n.getLineCap(),_=n.getLineDash(),v=n.getLineDashOffset(),E=n.getLineJoin(),w=n.getWidth(),C=n.getMiterLimit();this.textStrokeState_={lineCap:g!==void 0?g:Qo,lineDash:_||Vi,lineDashOffset:v||Wi,lineJoin:E!==void 0?E:Jo,lineWidth:w!==void 0?w:ma,miterLimit:C!==void 0?C:fa,strokeStyle:wi(f||pa)}}const s=e.getFont(),o=e.getOffsetX(),r=e.getOffsetY(),a=e.getRotateWithView(),l=e.getRotation(),c=e.getScaleArray(),h=e.getText(),u=e.getTextAlign(),d=e.getTextBaseline();this.textState_={font:s!==void 0?s:s0,textAlign:u!==void 0?u:ga,textBaseline:d!==void 0?d:xc},this.text_=h!==void 0?Array.isArray(h)?h.reduce((f,g,_)=>f+=_%2?" ":g,""):h:"",this.textOffsetX_=o!==void 0?this.pixelRatio_*o:0,this.textOffsetY_=r!==void 0?this.pixelRatio_*r:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*c[0],this.pixelRatio_*c[1]]}}}const dE=.5,h0={Point:vE,LineString:yE,Polygon:EE,MultiPoint:bE,MultiLineString:_E,MultiPolygon:wE,GeometryCollection:mE,Circle:pE};function fE(i,e){return parseInt(Pe(i),10)-parseInt(Pe(e),10)}function Pc(i,e){const t=u0(i,e);return t*t}function u0(i,e){return dE*i/e}function pE(i,e,t,n,s){const o=t.getFill(),r=t.getStroke();if(o||r){const l=i.getBuilder(t.getZIndex(),"Circle");l.setFillStrokeStyle(o,r),l.drawCircle(e,n,s)}const a=t.getText();if(a&&a.getText()){const l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n)}}function Sc(i,e,t,n,s,o,r,a){const l=[],c=t.getImage();if(c){let d=!0;const f=c.getImageState();f==le.LOADED||f==le.ERROR?d=!1:f==le.IDLE&&c.load(),d&&l.push(c.ready())}const h=t.getFill();h&&h.loading()&&l.push(h.ready());const u=l.length>0;return u&&Promise.all(l).then(()=>s(null)),gE(i,e,t,n,o,r,a),u}function gE(i,e,t,n,s,o,r){const a=t.getGeometryFunction()(e);if(!a)return;const l=a.simplifyTransformed(n,s);if(t.getRenderer())d0(i,l,t,e,r);else{const h=h0[l.getType()];h(i,l,t,e,r,o)}}function d0(i,e,t,n,s){if(e.getType()=="GeometryCollection"){const r=e.getGeometries();for(let a=0,l=r.length;a<l;++a)d0(i,r[a],t,n,s);return}i.getBuilder(t.getZIndex(),"Default").drawCustom(e,n,t.getRenderer(),t.getHitDetectionRenderer(),s)}function mE(i,e,t,n,s,o){const r=e.getGeometriesArray();let a,l;for(a=0,l=r.length;a<l;++a){const c=h0[r[a].getType()];c(i,r[a],t,n,s,o)}}function yE(i,e,t,n,s){const o=t.getStroke();if(o){const a=i.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,o),a.drawLineString(e,n,s)}const r=t.getText();if(r&&r.getText()){const a=i.getBuilder(t.getZIndex(),"Text");a.setTextStyle(r),a.drawText(e,n,s)}}function _E(i,e,t,n,s){const o=t.getStroke();if(o){const a=i.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,o),a.drawMultiLineString(e,n,s)}const r=t.getText();if(r&&r.getText()){const a=i.getBuilder(t.getZIndex(),"Text");a.setTextStyle(r),a.drawText(e,n,s)}}function wE(i,e,t,n,s){const o=t.getFill(),r=t.getStroke();if(r||o){const l=i.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(o,r),l.drawMultiPolygon(e,n,s)}const a=t.getText();if(a&&a.getText()){const l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,s)}}function vE(i,e,t,n,s,o){const r=t.getImage(),a=t.getText(),l=a&&a.getText(),c=o&&r&&l?{}:void 0;if(r){if(r.getImageState()!=le.LOADED)return;const h=i.getBuilder(t.getZIndex(),"Image");h.setImageStyle(r,c),h.drawPoint(e,n,s)}if(l){const h=i.getBuilder(t.getZIndex(),"Text");h.setTextStyle(a,c),h.drawText(e,n,s)}}function bE(i,e,t,n,s,o){const r=t.getImage(),a=r&&r.getOpacity()!==0,l=t.getText(),c=l&&l.getText(),h=o&&a&&c?{}:void 0;if(a){if(r.getImageState()!=le.LOADED)return;const u=i.getBuilder(t.getZIndex(),"Image");u.setImageStyle(r,h),u.drawMultiPoint(e,n,s)}if(c){const u=i.getBuilder(t.getZIndex(),"Text");u.setTextStyle(l,h),u.drawText(e,n,s)}}function EE(i,e,t,n,s){const o=t.getFill(),r=t.getStroke();if(o||r){const l=i.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(o,r),l.drawPolygon(e,n,s)}const a=t.getText();if(a&&a.getText()){const l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,s)}}function f0(i){if(!(i.context instanceof CanvasRenderingContext2D))throw new Error("Only works for render events from Canvas 2D layers");const e=i.inversePixelTransform[0],t=i.inversePixelTransform[1],n=Math.sqrt(e*e+t*t),s=i.frameState,o=hc(i.inversePixelTransform.slice(),s.coordinateToPixelTransform),r=Pc(s.viewState.resolution,n);let a;return new c0(i.context,n,s.extent,o,s.viewState.rotation,r,a)}let CE=!1;function p0(i,e,t,n,s,o,r){const a=new XMLHttpRequest;a.open("GET",typeof i=="function"?i(t,n,s):i,!0),e.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=CE,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){const c=e.getType();try{let h;c=="text"||c=="json"?h=a.responseText:c=="xml"?h=a.responseXML||a.responseText:c=="arraybuffer"&&(h=a.response),h?o(e.readFeatures(h,{extent:t,featureProjection:s}),e.readProjection(h)):r()}catch{r()}}else r()},a.onerror=r,a.send()}function g0(i,e){return function(t,n,s,o,r){p0(i,e,t,n,s,(a,l)=>{this.addFeatures(a),o!==void 0&&o(a)},()=>{this.changed(),r!==void 0&&r()})}}function xE(i,e){return[[-1/0,-1/0,1/0,1/0]]}function PE(i,e){return[i]}function m0(i,e,t,n){const s=[];let o=yn();for(let r=0,a=t.length;r<a;++r){const l=t[r];o=Au(i,e,l[0],n),s.push((o[0]+o[2])/2,(o[1]+o[3])/2),e=l[l.length-1]}return s}class Rc extends Am{constructor(e){super(),this.geometries_=e,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(st),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const e=this.geometries_;for(let t=0,n=e.length;t<n;++t)this.changeEventsKeys_.push(Ue(e[t],_e.CHANGE,this.changed,this))}clone(){const e=new Rc(Rd(this.geometries_));return e.applyProperties(this),e}closestPointXY(e,t,n,s){if(s<Qs(this.getExtent(),e,t))return s;const o=this.geometries_;for(let r=0,a=o.length;r<a;++r)s=o[r].closestPointXY(e,t,n,s);return s}containsXY(e,t){const n=this.geometries_;for(let s=0,o=n.length;s<o;++s)if(n[s].containsXY(e,t))return!0;return!1}computeExtent(e){Wo(e);const t=this.geometries_;for(let n=0,s=t.length;n<s;++n)Yg(e,t[n].getExtent());return e}getGeometries(){return Rd(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let e=[];const t=this.geometries_;for(let n=0,s=t.length;n<s;++n)t[n].getType()===this.getType()?e=e.concat(t[n].getGeometriesArrayRecursive()):e.push(t[n]);return e}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<this.simplifiedGeometryMaxMinSquaredTolerance)return this;const t=[],n=this.geometries_;let s=!1;for(let o=0,r=n.length;o<r;++o){const a=n[o],l=a.getSimplifiedGeometry(e);t.push(l),l!==a&&(s=!0)}return s?new Rc(t):(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getType(){return"GeometryCollection"}intersectsExtent(e){const t=this.geometries_;for(let n=0,s=t.length;n<s;++n)if(t[n].intersectsExtent(e))return!0;return!1}isEmpty(){return this.geometries_.length===0}rotate(e,t){const n=this.geometries_;for(let s=0,o=n.length;s<o;++s)n[s].rotate(e,t);this.changed()}scale(e,t,n){n||(n=Tn(this.getExtent()));const s=this.geometries_;for(let o=0,r=s.length;o<r;++o)s[o].scale(e,t,n);this.changed()}setGeometries(e){this.setGeometriesArray(Rd(e))}setGeometriesArray(e){this.unlistenGeometriesChange_(),this.geometries_=e,this.listenGeometriesChange_(),this.changed()}applyTransform(e){const t=this.geometries_;for(let n=0,s=t.length;n<s;++n)t[n].applyTransform(e);this.changed()}translate(e,t){const n=this.geometries_;for(let s=0,o=n.length;s<o;++s)n[s].translate(e,t);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function Rd(i){return i.map(e=>e.clone())}class fo extends so{constructor(e,t,n){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(e[0]))this.setCoordinates(e,t);else if(t!==void 0&&n)this.setFlatCoordinates(t,e),this.ends_=n;else{const s=e,o=[],r=[];for(let l=0,c=s.length;l<c;++l){const h=s[l];fi(o,h.getFlatCoordinates()),r.push(o.length)}const a=s.length===0?this.getLayout():s[0].getLayout();this.setFlatCoordinates(a,o),this.ends_=r}}appendLineString(e){fi(this.flatCoordinates,e.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const e=new fo(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,n,s){return s<Qs(this.getExtent(),e,t)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Ju(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),td(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,e,t,n,s))}getCoordinateAtM(e,t,n){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(t=t!==void 0?t:!1,n=n!==void 0?n:!1,kb(this.flatCoordinates,0,this.ends_,this.stride,e,t,n))}getCoordinates(){return ra(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(e){return e<0||this.ends_.length<=e?null:new Qn(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLineStrings(){const e=this.flatCoordinates,t=this.ends_,n=this.layout,s=[];let o=0;for(let r=0,a=t.length;r<a;++r){const l=t[r],c=new Qn(e.slice(o,l),n);s.push(c),o=l}return s}getLength(){const e=this.ends_;let t=0,n=0;for(let s=0,o=e.length;s<o;++s)n+=ud(this.flatCoordinates,t,e[s],this.stride),t=e[s];return n}getFlatMidpoints(){const e=[],t=this.flatCoordinates;let n=0;const s=this.ends_,o=this.stride;for(let r=0,a=s.length;r<a;++r){const l=s[r],c=mc(t,n,l,o,.5);fi(e,c),n=l}return e}getSimplifiedGeometryInternal(e){const t=[],n=[];return t.length=Nm(this.flatCoordinates,0,this.ends_,this.stride,e,t,0,n),new fo(t,"XY",n)}getType(){return"MultiLineString"}intersectsExtent(e){return Fb(this.flatCoordinates,0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);const n=oa(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}}class er extends so{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){fi(this.flatCoordinates,e.getFlatCoordinates()),this.changed()}clone(){const e=new er(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,s){if(s<Qs(this.getExtent(),e,t))return s;const o=this.flatCoordinates,r=this.stride;for(let a=0,l=o.length;a<l;a+=r){const c=eo(e,t,o[a],o[a+1]);if(c<s){s=c;for(let h=0;h<r;++h)n[h]=o[a+h];n.length=r}}return s}getCoordinates(){return ws(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){const t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new wn(this.flatCoordinates.slice(e*this.stride,(e+1)*this.stride),this.layout)}getPoints(){const e=this.flatCoordinates,t=this.layout,n=this.stride,s=[];for(let o=0,r=e.length;o<r;o+=n){const a=new wn(e.slice(o,o+n),t);s.push(a)}return s}getType(){return"MultiPoint"}intersectsExtent(e){const t=this.flatCoordinates,n=this.stride;for(let s=0,o=t.length;s<o;s+=n){const r=t[s],a=t[s+1];if(Iu(e,r,a))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=uc(this.flatCoordinates,0,e,this.stride),this.changed()}}class _a extends so{constructor(e,t,n){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!n&&!Array.isArray(e[0])){const s=e,o=[],r=[];for(let a=0,l=s.length;a<l;++a){const c=s[a],h=o.length,u=c.getEnds();for(let d=0,f=u.length;d<f;++d)u[d]+=h;fi(o,c.getFlatCoordinates()),r.push(u)}t=s.length===0?this.getLayout():s[0].getLayout(),e=o,n=r}t!==void 0&&n?(this.setFlatCoordinates(t,e),this.endss_=n):this.setCoordinates(e,t)}appendPolygon(e){let t;if(!this.flatCoordinates)this.flatCoordinates=e.getFlatCoordinates().slice(),t=e.getEnds().slice(),this.endss_.push();else{const n=this.flatCoordinates.length;fi(this.flatCoordinates,e.getFlatCoordinates()),t=e.getEnds().slice();for(let s=0,o=t.length;s<o;++s)t[s]+=n}this.endss_.push(t),this.changed()}clone(){const e=this.endss_.length,t=new Array(e);for(let s=0;s<e;++s)t[s]=this.endss_[s].slice();const n=new _a(this.flatCoordinates.slice(),this.layout,t);return n.applyProperties(this),n}closestPointXY(e,t,n,s){return s<Qs(this.getExtent(),e,t)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Rb(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Tb(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,n,s))}containsXY(e,t){return Db(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return Sb(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),ld(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,nd(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const e=m0(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=km(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new er(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const e=this.flatCoordinates;qm(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=ld(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){const t=[],n=[];return t.length=Ab(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(e),t,0,n),new _a(t,"XY",n)}getPolygon(e){if(e<0||this.endss_.length<=e)return null;let t;if(e===0)t=0;else{const o=this.endss_[e-1];t=o[o.length-1]}const n=this.endss_[e].slice(),s=n[n.length-1];if(t!==0)for(let o=0,r=n.length;o<r;++o)n[o]-=t;return new Kn(this.flatCoordinates.slice(t,s),this.layout,n)}getPolygons(){const e=this.layout,t=this.flatCoordinates,n=this.endss_,s=[];let o=0;for(let r=0,a=n.length;r<a;++r){const l=n[r].slice(),c=l[l.length-1];if(o!==0)for(let u=0,d=l.length;u<d;++u)l[u]-=o;const h=new Kn(t.slice(o,c),e,l);s.push(h),o=c}return s}getType(){return"MultiPolygon"}intersectsExtent(e){return Lb(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);const n=zm(this.flatCoordinates,0,e,this.stride,this.endss_);if(n.length===0)this.flatCoordinates.length=0;else{const s=n[n.length-1];this.flatCoordinates.length=s.length===0?0:s[s.length-1]}this.changed()}}const y0=Qt();class Bt{constructor(e,t,n,s,o,r){this.styleFunction,this.extent_,this.id_=r,this.type_=e,this.flatCoordinates_=t,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=n||null,this.properties_=o,this.squaredTolerance_,this.stride_=s,this.simplifiedGeometry_}get(e){return this.properties_[e]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?Xg(this.flatCoordinates_):Au(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const e=Tn(this.getExtent());this.flatInteriorPoints_=od(this.flatCoordinates_,0,this.ends_,2,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const e=Vm(this.flatCoordinates_,this.ends_),t=m0(this.flatCoordinates_,0,e,2);this.flatInteriorPoints_=km(this.flatCoordinates_,0,e,2,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=mc(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const e=this.flatCoordinates_;let t=0;const n=this.ends_;for(let s=0,o=n.length;s<o;++s){const r=n[s],a=mc(e,t,r,2,.5);fi(this.flatMidpoints_,a),t=r}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(e){return this}simplifyTransformed(e,t){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(e){e=De(e);const t=e.getExtent(),n=e.getWorldExtent();if(t&&n){const s=ft(n)/ft(t);Zn(y0,n[0],n[3],s,-s,0,0,0),_i(this.flatCoordinates_,0,this.flatCoordinates_.length,2,y0,this.flatCoordinates_)}}applyTransform(e){e(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){var e;return new Bt(this.type_,this.flatCoordinates_.slice(),(e=this.ends_)==null?void 0:e.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=rm((e,t)=>{if(e===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),t&&this.simplifiedGeometry_.applyTransform(t);const n=this.simplifiedGeometry_.getFlatCoordinates();let s;switch(this.type_){case"LineString":n.length=dc(n,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,n,0),s=[n.length];break;case"MultiLineString":s=[],n.length=Nm(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,n,0,s);break;case"Polygon":s=[],n.length=id(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(e),n,0,s);break}return s&&(this.simplifiedGeometry_=new Bt(this.type_,n,s,2,this.properties_,this.id_)),this.squaredTolerance_=e,this.simplifiedGeometry_}),this}}Bt.prototype.getFlatCoordinates=Bt.prototype.getOrientedFlatCoordinates;function _0(i,e,t=0,n=i.length-1,s=SE){for(;n>t;){if(n-t>600){const l=n-t+1,c=e-t+1,h=Math.log(l),u=.5*Math.exp(2*h/3),d=.5*Math.sqrt(h*u*(l-u)/l)*(c-l/2<0?-1:1),f=Math.max(t,Math.floor(e-c*u/l+d)),g=Math.min(n,Math.floor(e+(l-c)*u/l+d));_0(i,e,f,g,s)}const o=i[e];let r=t,a=n;for(wa(i,t,e),s(i[n],o)>0&&wa(i,t,n);r<a;){for(wa(i,r,a),r++,a--;s(i[r],o)<0;)r++;for(;s(i[a],o)>0;)a--}s(i[t],o)===0?wa(i,t,a):(a++,wa(i,a,n)),a<=e&&(t=a+1),e<=a&&(n=a-1)}}function wa(i,e,t){const n=i[e];i[e]=i[t],i[t]=n}function SE(i,e){return i<e?-1:i>e?1:0}let Td=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data;const n=[];if(!Ic(e,t))return n;const s=this.toBBox,o=[];for(;t;){for(let r=0;r<t.children.length;r++){const a=t.children[r],l=t.leaf?s(a):a;Ic(e,l)&&(t.leaf?n.push(a):Od(e,l)?this._all(a,n):o.push(a))}t=o.pop()}return n}collides(e){let t=this.data;if(!Ic(e,t))return!1;const n=[];for(;t;){for(let s=0;s<t.children.length;s++){const o=t.children[s],r=t.leaf?this.toBBox(o):o;if(Ic(e,r)){if(t.leaf||Od(e,r))return!0;n.push(o)}}t=n.pop()}return!1}load(e){if(!(e&&e.length))return this;if(e.length<this._minEntries){for(let n=0;n<e.length;n++)this.insert(e[n]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(!this.data.children.length)this.data=t;else if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){const n=this.data;this.data=t,t=n}this._insert(t,this.data.height-t.height-1,!0)}return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=nr([]),this}remove(e,t){if(!e)return this;let n=this.data;const s=this.toBBox(e),o=[],r=[];let a,l,c;for(;n||o.length;){if(n||(n=o.pop(),l=o[o.length-1],a=r.pop(),c=!0),n.leaf){const h=RE(e,n.children,t);if(h!==-1)return n.children.splice(h,1),o.push(n),this._condense(o),this}!c&&!n.leaf&&Od(n,s)?(o.push(n),r.push(a),a=0,l=n,n=n.children[0]):l?(a++,n=l.children[a],c=!1):n=null}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){const n=[];for(;e;)e.leaf?t.push(...e.children):n.push(...e.children),e=n.pop();return t}_build(e,t,n,s){const o=n-t+1;let r=this._maxEntries,a;if(o<=r)return a=nr(e.slice(t,n+1)),tr(a,this.toBBox),a;s||(s=Math.ceil(Math.log(o)/Math.log(r)),r=Math.ceil(o/Math.pow(r,s-1))),a=nr([]),a.leaf=!1,a.height=s;const l=Math.ceil(o/r),c=l*Math.ceil(Math.sqrt(r));w0(e,t,n,c,this.compareMinX);for(let h=t;h<=n;h+=c){const u=Math.min(h+c-1,n);w0(e,h,u,l,this.compareMinY);for(let d=h;d<=u;d+=l){const f=Math.min(d+l-1,u);a.children.push(this._build(e,d,f,s-1))}}return tr(a,this.toBBox),a}_chooseSubtree(e,t,n,s){for(;s.push(t),!(t.leaf||s.length-1===n);){let o=1/0,r=1/0,a;for(let l=0;l<t.children.length;l++){const c=t.children[l],h=Id(c),u=OE(e,c)-h;u<r?(r=u,o=h<o?h:o,a=c):u===r&&h<o&&(o=h,a=c)}t=a||t.children[0]}return t}_insert(e,t,n){const s=n?e:this.toBBox(e),o=[],r=this._chooseSubtree(s,this.data,t,o);for(r.children.push(e),ba(r,s);t>=0&&o[t].children.length>this._maxEntries;)this._split(o,t),t--;this._adjustParentBBoxes(s,o,t)}_split(e,t){const n=e[t],s=n.children.length,o=this._minEntries;this._chooseSplitAxis(n,o,s);const r=this._chooseSplitIndex(n,o,s),a=nr(n.children.splice(r,n.children.length-r));a.height=n.height,a.leaf=n.leaf,tr(n,this.toBBox),tr(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(n,a)}_splitRoot(e,t){this.data=nr([e,t]),this.data.height=e.height+1,this.data.leaf=!1,tr(this.data,this.toBBox)}_chooseSplitIndex(e,t,n){let s,o=1/0,r=1/0;for(let a=t;a<=n-t;a++){const l=va(e,0,a,this.toBBox),c=va(e,a,n,this.toBBox),h=AE(l,c),u=Id(l)+Id(c);h<o?(o=h,s=a,r=u<r?u:r):h===o&&u<r&&(r=u,s=a)}return s||n-t}_chooseSplitAxis(e,t,n){const s=e.leaf?this.compareMinX:TE,o=e.leaf?this.compareMinY:IE,r=this._allDistMargin(e,t,n,s),a=this._allDistMargin(e,t,n,o);r<a&&e.children.sort(s)}_allDistMargin(e,t,n,s){e.children.sort(s);const o=this.toBBox,r=va(e,0,t,o),a=va(e,n-t,n,o);let l=Tc(r)+Tc(a);for(let c=t;c<n-t;c++){const h=e.children[c];ba(r,e.leaf?o(h):h),l+=Tc(r)}for(let c=n-t-1;c>=t;c--){const h=e.children[c];ba(a,e.leaf?o(h):h),l+=Tc(a)}return l}_adjustParentBBoxes(e,t,n){for(let s=n;s>=0;s--)ba(t[s],e)}_condense(e){for(let t=e.length-1,n;t>=0;t--)e[t].children.length===0?t>0?(n=e[t-1].children,n.splice(n.indexOf(e[t]),1)):this.clear():tr(e[t],this.toBBox)}};function RE(i,e,t){if(!t)return e.indexOf(i);for(let n=0;n<e.length;n++)if(t(i,e[n]))return n;return-1}function tr(i,e){va(i,0,i.children.length,e,i)}function va(i,e,t,n,s){s||(s=nr(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let o=e;o<t;o++){const r=i.children[o];ba(s,i.leaf?n(r):r)}return s}function ba(i,e){return i.minX=Math.min(i.minX,e.minX),i.minY=Math.min(i.minY,e.minY),i.maxX=Math.max(i.maxX,e.maxX),i.maxY=Math.max(i.maxY,e.maxY),i}function TE(i,e){return i.minX-e.minX}function IE(i,e){return i.minY-e.minY}function Id(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function Tc(i){return i.maxX-i.minX+(i.maxY-i.minY)}function OE(i,e){return(Math.max(e.maxX,i.maxX)-Math.min(e.minX,i.minX))*(Math.max(e.maxY,i.maxY)-Math.min(e.minY,i.minY))}function AE(i,e){const t=Math.max(i.minX,e.minX),n=Math.max(i.minY,e.minY),s=Math.min(i.maxX,e.maxX),o=Math.min(i.maxY,e.maxY);return Math.max(0,s-t)*Math.max(0,o-n)}function Od(i,e){return i.minX<=e.minX&&i.minY<=e.minY&&e.maxX<=i.maxX&&e.maxY<=i.maxY}function Ic(i,e){return e.minX<=i.maxX&&e.minY<=i.maxY&&e.maxX>=i.minX&&e.maxY>=i.minY}function nr(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function w0(i,e,t,n,s){const o=[e,t];for(;o.length;){if(t=o.pop(),e=o.pop(),t-e<=n)continue;const r=e+Math.ceil((t-e)/n/2)*n;_0(i,r,e,t,s),o.push(e,r,r,t)}}class v0{constructor(e){this.rbush_=new Td(e),this.items_={}}insert(e,t){const n={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(n),this.items_[Pe(t)]=n}load(e,t){const n=new Array(t.length);for(let s=0,o=t.length;s<o;s++){const r=e[s],a=t[s],l={minX:r[0],minY:r[1],maxX:r[2],maxY:r[3],value:a};n[s]=l,this.items_[Pe(a)]=l}this.rbush_.load(n)}remove(e){const t=Pe(e),n=this.items_[t];return delete this.items_[t],this.rbush_.remove(n)!==null}update(e,t){const n=this.items_[Pe(t)],s=[n.minX,n.minY,n.maxX,n.maxY];ji(s,e)||(this.remove(t),this.insert(e,t))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(e){const t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this.rbush_.search(t).map(function(s){return s.value})}forEach(e){return this.forEach_(this.getAll(),e)}forEachInExtent(e,t){return this.forEach_(this.getInExtent(e),t)}forEach_(e,t){let n;for(let s=0,o=e.length;s<o;s++)if(n=t(e[s]),n)return n;return n}isEmpty(){return _s(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){const t=this.rbush_.toJSON();return ki(t.minX,t.minY,t.maxX,t.maxY,e)}concat(e){this.rbush_.load(e.rbush_.all());for(const t in e.items_)this.items_[t]=e.items_[t]}}class Ea extends mi{constructor(e){super(),this.projection=De(e.projection),this.attributions_=b0(e.attributions),this.attributionsCollapsible_=e.attributionsCollapsible??!0,this.loading=!1,this.state_=e.state!==void 0?e.state:"ready",this.wrapX_=e.wrapX!==void 0?e.wrapX:!1,this.interpolate_=!!e.interpolate,this.viewResolver=null,this.viewRejector=null;const t=this;this.viewPromise_=new Promise(function(n,s){t.viewResolver=n,t.viewRejector=s})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(e){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(e){this.attributions_=b0(e),this.changed()}setState(e){this.state_=e,this.changed()}}function b0(i){return i?typeof i=="function"?i:(Array.isArray(i)||(i=[i]),e=>i):null}const Fn={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};class bs extends Yn{constructor(e,t,n){super(e),this.feature=t,this.features=n}}class vn extends Ea{constructor(e){e=e||{},super({attributions:e.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:e.wrapX!==void 0?e.wrapX:!0}),this.on,this.once,this.un,this.loader_=Kr,this.format_=e.format||null,this.overlaps_=e.overlaps===void 0?!0:e.overlaps,this.url_=e.url,e.loader!==void 0?this.loader_=e.loader:this.url_!==void 0&&(Ve(this.format_,"`format` must be set when `url` is set"),this.loader_=g0(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:xE;const t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new v0:null,this.loadedExtentsRtree_=new v0,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let n,s;Array.isArray(e.features)?s=e.features:e.features&&(n=e.features,s=n.getArray()),!t&&n===void 0&&(n=new On(s)),s!==void 0&&this.addFeaturesInternal(s),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){const t=Pe(e);if(!this.addToIndex_(t,e)){this.featuresCollection_&&this.featuresCollection_.remove(e);return}this.setupChangeEvents_(t,e);const n=e.getGeometry();if(n){const s=n.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(s,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new bs(Fn.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof Bt||(this.featureChangeKeys_[e]=[Ue(t,_e.CHANGE,this.handleFeatureChange_,this),Ue(t,Bo.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(e,t){let n=!0;if(t.getId()!==void 0){const s=String(t.getId());if(!(s in this.idIndex_))this.idIndex_[s]=t;else if(t instanceof Bt){const o=this.idIndex_[s];o instanceof Bt?Array.isArray(o)?o.push(t):this.idIndex_[s]=[o,t]:n=!1}else n=!1}return n&&(Ve(!(e in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[e]=t),n}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){const t=[],n=[],s=[];for(let o=0,r=e.length;o<r;o++){const a=e[o],l=Pe(a);this.addToIndex_(l,a)&&n.push(a)}for(let o=0,r=n.length;o<r;o++){const a=n[o],l=Pe(a);this.setupChangeEvents_(l,a);const c=a.getGeometry();if(c){const h=c.getExtent();t.push(h),s.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(t,s),this.hasListener(Fn.ADDFEATURE))for(let o=0,r=n.length;o<r;o++)this.dispatchEvent(new bs(Fn.ADDFEATURE,n[o]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(Fn.ADDFEATURE,function(n){t||(t=!0,e.push(n.feature),t=!1)}),this.addEventListener(Fn.REMOVEFEATURE,function(n){t||(t=!0,e.remove(n.feature),t=!1)}),e.addEventListener(cn.ADD,n=>{t||(t=!0,this.addFeature(n.element),t=!1)}),e.addEventListener(cn.REMOVE,n=>{t||(t=!0,this.removeFeature(n.element),t=!1)}),this.featuresCollection_=e}clear(e){if(e){for(const n in this.featureChangeKeys_)this.featureChangeKeys_[n].forEach(st);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(n=>{this.removeFeatureInternal(n)});for(const n in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[n])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const t=new bs(Fn.CLEAR);this.dispatchEvent(t),this.changed()}forEachFeature(e){if(this.featuresRtree_)return this.featuresRtree_.forEach(e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureAtCoordinateDirect(e,t){const n=[e[0],e[1],e[0],e[1]];return this.forEachFeatureInExtent(n,function(s){const o=s.getGeometry();if(o instanceof Bt||o.intersectsCoordinate(e))return t(s)})}forEachFeatureInExtent(e,t){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(e,t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureIntersectingExtent(e,t){return this.forEachFeatureInExtent(e,function(n){const s=n.getGeometry();if(s instanceof Bt||s.intersectsExtent(e)){const o=t(n);if(o)return o}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),_s(this.nullGeometryFeatures_)||fi(e,Object.values(this.nullGeometryFeatures_))),e}getFeaturesAtCoordinate(e){const t=[];return this.forEachFeatureAtCoordinateDirect(e,function(n){t.push(n)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);const s=tm(e,t);return[].concat(...s.map(o=>this.featuresRtree_.getInExtent(o)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(e,t){const n=e[0],s=e[1];let o=null;const r=[NaN,NaN];let a=1/0;const l=[-1/0,-1/0,1/0,1/0];return t=t||Zr,this.featuresRtree_.forEachInExtent(l,function(c){if(t(c)){const h=c.getGeometry(),u=a;if(a=h instanceof Bt?0:h.closestPointXY(n,s,r,a),a<u){o=c;const d=Math.sqrt(a);l[0]=n-d,l[1]=s-d,l[2]=n+d,l[3]=s+d}}}),o}getExtent(e){var t;return((t=this.featuresRtree_)==null?void 0:t.getExtent(e))??null}getFeatureById(e){const t=this.idIndex_[e.toString()];return t!==void 0?t:null}getFeatureByUid(e){const t=this.uidIndex_[e];return t!==void 0?t:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(e){const t=e.target,n=Pe(t),s=t.getGeometry();if(!s)n in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(t),this.nullGeometryFeatures_[n]=t);else{const r=s.getExtent();n in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[n],this.featuresRtree_&&this.featuresRtree_.insert(r,t)):this.featuresRtree_&&this.featuresRtree_.update(r,t)}const o=t.getId();if(o!==void 0){const r=o.toString();this.idIndex_[r]!==t&&(this.removeFromIdIndex_(t),this.idIndex_[r]=t)}else this.removeFromIdIndex_(t),this.uidIndex_[n]=t;this.changed(),this.dispatchEvent(new bs(Fn.CHANGEFEATURE,t))}hasFeature(e){const t=e.getId();return t!==void 0?t in this.idIndex_:Pe(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&_s(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(e,t,n){const s=this.loadedExtentsRtree_,o=this.strategy_(e,t,n);for(let r=0,a=o.length;r<a;++r){const l=o[r];s.forEachInExtent(l,function(h){return Ni(h.extent,l)})||(++this.loadingExtentsCount_,this.dispatchEvent(new bs(Fn.FEATURESLOADSTART)),this.loader_.call(this,l,t,n,h=>{--this.loadingExtentsCount_,this.dispatchEvent(new bs(Fn.FEATURESLOADEND,void 0,h))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new bs(Fn.FEATURESLOADERROR))}),s.insert(l,{extent:l.slice()}))}this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){const t=this.loadedExtentsRtree_,n=t.forEachInExtent(e,function(s){if(ji(s.extent,e))return s});n&&t.remove(n)}removeFeatures(e){let t=!1;for(let n=0,s=e.length;n<s;++n)t=this.removeFeatureInternal(e[n])||t;t&&this.changed()}removeFeature(e){if(!e)return;this.removeFeatureInternal(e)&&this.changed()}removeFeatureInternal(e){const t=Pe(e);if(!(t in this.uidIndex_))return!1;t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e);const n=this.featureChangeKeys_[t];n==null||n.forEach(st),delete this.featureChangeKeys_[t];const s=e.getId();if(s!==void 0){const o=s.toString(),r=this.idIndex_[o];r===e?delete this.idIndex_[o]:Array.isArray(r)&&(r.splice(r.indexOf(e),1),r.length===1&&(this.idIndex_[o]=r[0]))}return delete this.uidIndex_[t],this.hasListener(Fn.REMOVEFEATURE)&&this.dispatchEvent(new bs(Fn.REMOVEFEATURE,e)),!0}removeFromIdIndex_(e){for(const t in this.idIndex_)if(this.idIndex_[t]===e){delete this.idIndex_[t];break}}setLoader(e){this.loader_=e}setUrl(e){Ve(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(g0(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}}class vt{constructor(e){e=e||{},this.patternImage_=null,this.color_=null,e.color!==void 0&&this.setColor(e.color)}clone(){const e=this.getColor();return new vt({color:Array.isArray(e)?e.slice():e||void 0})}getColor(){return this.color_}setColor(e){if(e!==null&&typeof e=="object"&&"src"in e){const t=da(null,e.src,{crossOrigin:"anonymous"},void 0,e.offset?null:e.color?e.color:null,!(e.offset&&e.size));t.ready().then(()=>{this.patternImage_=null}),t.getImageState()===le.IDLE&&t.load(),t.getImageState()===le.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){const e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?Pe(e):typeof e=="object"&&"src"in e?e.src+":"+e.offset:co(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}class St{constructor(e){e=e||{},this.color_=e.color!==void 0?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=e.lineDash!==void 0?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.offset_=e.offset,this.width_=e.width}clone(){const e=this.getColor();return new St({color:Array.isArray(e)?e.slice():e||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),offset:this.getOffset(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(e){this.color_=e}setLineCap(e){this.lineCap_=e}setLineDash(e){this.lineDash_=e}setLineDashOffset(e){this.lineDashOffset_=e}setLineJoin(e){this.lineJoin_=e}setMiterLimit(e){this.miterLimit_=e}setOffset(e){this.offset_=e}setWidth(e){this.width_=e}}function E0(i){return i[0]>0&&i[1]>0}function ME(i,e,t){return t===void 0&&(t=[0,0]),t[0]=i[0]*e+.5|0,t[1]=i[1]*e+.5|0,t}function $t(i,e){return Array.isArray(i)?i:(e===void 0?e=[i,i]:(e[0]=i,e[1]=i),e)}class Oc{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=$t(e.scale),this.displacement_=e.displacement,this.declutterMode_=e.declutterMode}clone(){const e=this.getScale();return new Oc({opacity:this.getOpacity(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return we()}getImage(e){return we()}getHitDetectionImage(){return we()}getPixelRatio(e){return 1}getImageState(){return we()}getImageSize(){return we()}getOrigin(){return we()}getSize(){return we()}setDisplacement(e){this.displacement_=e}setOpacity(e){this.opacity_=e}setRotateWithView(e){this.rotateWithView_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=$t(e)}listenImageChange(e){we()}load(){we()}unlistenImageChange(e){we()}ready(){return Promise.resolve()}}class Ca extends Oc{constructor(e){super({opacity:1,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,rotation:e.rotation!==void 0?e.rotation:0,scale:e.scale!==void 0?e.scale:1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=e.fill!==void 0?e.fill:null,this.origin_=[0,0],this.points_=e.points,this.radius=e.radius,this.radius2_=e.radius2,this.angle_=e.angle!==void 0?e.angle:0,this.stroke_=e.stroke!==void 0?e.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?le.LOADING:le.LOADED,this.imageState_===le.LOADING&&this.ready().then(()=>this.imageState_=le.LOADED),this.render()}clone(){const e=this.getScale(),t=new Ca({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}getAnchor(){const e=this.size_,t=this.getDisplacement(),n=this.getScaleArray();return[e[0]/2-t[0]/n[0],e[1]/2+t[1]/n[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(e){var o,r;const t=(o=this.fill_)==null?void 0:o.getKey(),n=`${e},${this.angle_},${this.radius},${this.radius2_},${this.points_},${t}`+Object.values(this.renderOptions_).join(",");let s=(r=Dn.get(n,null))==null?void 0:r.getImage(1);if(!s){const a=this.renderOptions_,l=Math.ceil(a.size*e),c=ht(l,l);this.draw_(a,c,e),s=c.canvas;const h=new e0(s,void 0,null,le.LOADED,null);Dn.set(n,null,h),createImageBitmap(s).then(u=>{h.setImage(u)})}return s}getPixelRatio(e){return e}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(e){this.radius!==e&&(this.radius=e,this.render())}getRadius2(){return this.radius2_}setRadius2(e){this.radius2_!==e&&(this.radius2_=e,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e,this.render()}listenImageChange(e){}load(){}unlistenImageChange(e){}calculateLineJoinSize_(e,t,n){if(t===0||this.points_===1/0||e!=="bevel"&&e!=="miter")return t;let s=this.radius,o=this.radius2_===void 0?s:this.radius2_;if(s<o){const O=s;s=o,o=O}const r=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/r,l=o*Math.sin(a),c=Math.sqrt(o*o-l*l),h=s-c,u=Math.sqrt(l*l+h*h),d=u/l;if(e==="miter"&&d<=n)return d*t;const f=t/2/d,g=t/2*(h/u),v=Math.sqrt((s+f)*(s+f)+g*g)-s;if(this.radius2_===void 0||e==="bevel")return v*2;const E=s*Math.sin(a),w=Math.sqrt(s*s-E*E),C=o-w,R=Math.sqrt(E*E+C*C)/E;if(R<=n){const O=R*t/2-o-s;return 2*Math.max(v,O)}return v*2}createRenderOptions(){let e=Qo,t=Jo,n=0,s=null,o=0,r,a=0;this.stroke_&&(r=wi(this.stroke_.getColor()??pa),a=this.stroke_.getWidth()??ma,s=this.stroke_.getLineDash(),o=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??Jo,e=this.stroke_.getLineCap()??Qo,n=this.stroke_.getMiterLimit()??fa);const l=this.calculateLineJoinSize_(t,a,n),c=Math.max(this.radius,this.radius2_||0),h=Math.ceil(2*c+l);return{strokeStyle:r,strokeWidth:a,size:h,lineCap:e,lineDash:s,lineDashOffset:o,lineJoin:t,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();const e=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[e,e]}draw_(e,t,n){if(t.scale(n,n),t.translate(e.size/2,e.size/2),this.createPath_(t),this.fill_){let s=this.fill_.getColor();s===null&&(s=un),t.fillStyle=wi(s),t.fill()}e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineCap=e.lineCap,t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}createHitDetectionCanvas_(e){let t;if(this.fill_){let n=this.fill_.getColor(),s=0;typeof n=="string"&&(n=co(n)),n===null?s=1:Array.isArray(n)&&(s=n.length===4?n[3]:1),s===0&&(t=ht(e.size,e.size),this.drawHitDetectionCanvas_(e,t))}return t?t.canvas:this.getImage(1)}createPath_(e){let t=this.points_;const n=this.radius;if(t===1/0)e.arc(0,0,n,0,2*Math.PI);else{const s=this.radius2_===void 0?n:this.radius2_;this.radius2_!==void 0&&(t*=2);const o=this.angle_-Math.PI/2,r=2*Math.PI/t;for(let a=0;a<t;a++){const l=o+a*r,c=a%2===0?n:s;e.lineTo(c*Math.cos(l),c*Math.sin(l))}e.closePath()}}drawHitDetectionCanvas_(e,t){t.translate(e.size/2,e.size/2),this.createPath_(t),t.fillStyle=un,t.fill(),e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}}class Ln extends Ca{constructor(e){e=e||{radius:5},super({points:1/0,fill:e.fill,radius:e.radius,stroke:e.stroke,scale:e.scale!==void 0?e.scale:1,rotation:e.rotation!==void 0?e.rotation:0,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode})}clone(){const e=this.getScale(),t=new Ln({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}}class $e{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=x0,e.geometry!==void 0&&this.setGeometry(e.geometry),this.fill_=e.fill!==void 0?e.fill:null,this.image_=e.image!==void 0?e.image:null,this.renderer_=e.renderer!==void 0?e.renderer:null,this.hitDetectionRenderer_=e.hitDetectionRenderer!==void 0?e.hitDetectionRenderer:null,this.stroke_=e.stroke!==void 0?e.stroke:null,this.text_=e.text!==void 0?e.text:null,this.zIndex_=e.zIndex}clone(){let e=this.getGeometry();return e&&typeof e=="object"&&(e=e.clone()),new $e({geometry:e??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(e){this.renderer_=e}setHitDetectionRenderer(e){this.hitDetectionRenderer_=e}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(e){this.fill_=e}getImage(){return this.image_}setImage(e){this.image_=e}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e}getText(){return this.text_}setText(e){this.text_=e}getZIndex(){return this.zIndex_}setGeometry(e){typeof e=="function"?this.geometryFunction_=e:typeof e=="string"?this.geometryFunction_=function(t){return t.get(e)}:e?e!==void 0&&(this.geometryFunction_=function(){return e}):this.geometryFunction_=x0,this.geometry_=e}setZIndex(e){this.zIndex_=e}}function DE(i){let e;if(typeof i=="function")e=i;else{let t;Array.isArray(i)?t=i:(Ve(typeof i.getZIndex=="function","Expected an `Style` or an array of `Style`"),t=[i]),e=function(){return t}}return e}let Ad=null;function C0(i,e){if(!Ad){const t=new vt({color:"rgba(255,255,255,0.4)"}),n=new St({color:"#3399CC",width:1.25});Ad=[new $e({image:new Ln({fill:t,stroke:n,radius:5}),fill:t,stroke:n})]}return Ad}function x0(i){return i.getGeometry()}const FE="#333";class ir{constructor(e){e=e||{},this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.keepUpright_=e.keepUpright,this.scale_=e.scale,this.scaleArray_=$t(e.scale!==void 0?e.scale:1),this.text_=e.text,this.textAlign_=e.textAlign,this.justify_=e.justify,this.repeat_=e.repeat,this.textBaseline_=e.textBaseline,this.fill_=e.fill!==void 0?e.fill:new vt({color:FE}),this.maxAngle_=e.maxAngle!==void 0?e.maxAngle:Math.PI/4,this.placement_=e.placement!==void 0?e.placement:"point",this.overflow_=!!e.overflow,this.stroke_=e.stroke!==void 0?e.stroke:null,this.offsetX_=e.offsetX!==void 0?e.offsetX:0,this.offsetY_=e.offsetY!==void 0?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=e.padding===void 0?null:e.padding,this.declutterMode_=e.declutterMode}clone(){const e=this.getScale();return new ir({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(e)?e.slice():e,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof vt?this.getFill().clone():this.getFill(),stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(e){this.overflow_=e}setFont(e){this.font_=e}setMaxAngle(e){this.maxAngle_=e}setOffsetX(e){this.offsetX_=e}setOffsetY(e){this.offsetY_=e}setPlacement(e){this.placement_=e}setRepeat(e){this.repeat_=e}setRotateWithView(e){this.rotateWithView_=e}setKeepUpright(e){this.keepUpright_=e}setFill(e){this.fill_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=$t(e!==void 0?e:1)}setStroke(e){this.stroke_=e}setText(e){this.text_=e}setTextAlign(e){this.textAlign_=e}setJustify(e){this.justify_=e}setTextBaseline(e){this.textBaseline_=e}setBackgroundFill(e){this.backgroundFill_=e}setBackgroundStroke(e){this.backgroundStroke_=e}setPadding(e){this.padding_=e}}const ot={ANIMATING:0,INTERACTING:1},pe={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},Ac=[pe.FILL],Es=[pe.STROKE],po=[pe.BEGIN_PATH],P0=[pe.CLOSE_PATH];class xa extends t0{constructor(e,t,n,s){super(),this.tolerance=e,this.maxExtent=t,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(e){const t=this.pixelRatio;return t==1?e:e.map(function(n){return n*t})}appendFlatPointCoordinates(e,t){const n=this.getBufferedMaxExtent(),s=this.tmpCoordinate_,o=this.coordinates;let r=o.length;for(let a=0,l=e.length;a<l;a+=t)s[0]=e[a],s[1]=e[a+1],Js(n,s)&&(o[r++]=s[0],o[r++]=s[1]);return r}appendFlatLineCoordinates(e,t,n,s,o,r){const a=this.coordinates;let l=a.length;const c=this.getBufferedMaxExtent();r&&(t+=s);let h=e[t],u=e[t+1];const d=this.tmpCoordinate_;let f=!0,g,_,v;for(g=t+s;g<n;g+=s)d[0]=e[g],d[1]=e[g+1],v=Ou(c,d),v!==_?(f&&(a[l++]=h,a[l++]=u,f=!1),a[l++]=d[0],a[l++]=d[1]):v===Ft.INTERSECTING?(a[l++]=d[0],a[l++]=d[1],f=!1):f=!0,h=d[0],u=d[1],_=v;return(o&&f||g===t+s)&&(a[l++]=h,a[l++]=u),l}drawCustomCoordinates_(e,t,n,s,o){for(let r=0,a=n.length;r<a;++r){const l=n[r],c=this.appendFlatLineCoordinates(e,t,l,s,!1,!1);o.push(c),t=l}return t}drawCustom(e,t,n,s,o){this.beginGeometry(e,t,o);const r=e.getType(),a=e.getStride(),l=this.coordinates.length;let c,h,u,d,f;switch(r){case"MultiPolygon":c=e.getOrientedFlatCoordinates(),d=[];const g=e.getEndss();f=0;for(let _=0,v=g.length;_<v;++_){const E=[];f=this.drawCustomCoordinates_(c,f,g[_],a,E),d.push(E)}this.instructions.push([pe.CUSTOM,l,d,e,n,nd,o]),this.hitDetectionInstructions.push([pe.CUSTOM,l,d,e,s||n,nd,o]);break;case"Polygon":case"MultiLineString":u=[],c=r=="Polygon"?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),f=this.drawCustomCoordinates_(c,0,e.getEnds(),a,u),this.instructions.push([pe.CUSTOM,l,u,e,n,ra,o]),this.hitDetectionInstructions.push([pe.CUSTOM,l,u,e,s||n,ra,o]);break;case"LineString":case"Circle":c=e.getFlatCoordinates(),h=this.appendFlatLineCoordinates(c,0,c.length,a,!1,!1),this.instructions.push([pe.CUSTOM,l,h,e,n,ws,o]),this.hitDetectionInstructions.push([pe.CUSTOM,l,h,e,s||n,ws,o]);break;case"MultiPoint":c=e.getFlatCoordinates(),h=this.appendFlatPointCoordinates(c,a),h>l&&(this.instructions.push([pe.CUSTOM,l,h,e,n,ws,o]),this.hitDetectionInstructions.push([pe.CUSTOM,l,h,e,s||n,ws,o]));break;case"Point":c=e.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),h=this.coordinates.length,this.instructions.push([pe.CUSTOM,l,h,e,n,void 0,o]),this.hitDetectionInstructions.push([pe.CUSTOM,l,h,e,s||n,void 0,o]);break}this.endGeometry(t)}beginGeometry(e,t,n){this.beginGeometryInstruction1_=[pe.BEGIN_GEOMETRY,t,0,e,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[pe.BEGIN_GEOMETRY,t,0,e,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const e=this.hitDetectionInstructions;e.reverse();let t;const n=e.length;let s,o,r=-1;for(t=0;t<n;++t)s=e[t],o=s[0],o==pe.END_GEOMETRY?r=t:o==pe.BEGIN_GEOMETRY&&(s[2]=t,Cv(this.hitDetectionInstructions,r,t),r=-1)}fillStyleToState(e,t={}){if(e){const n=e.getColor();t.fillPatternScale=n&&typeof n=="object"&&"src"in n?this.pixelRatio:1,t.fillStyle=wi(n||un)}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){const n=e.getColor();t.strokeStyle=wi(n||pa);const s=e.getLineCap();t.lineCap=s!==void 0?s:Qo;const o=e.getLineDash();t.lineDash=o?o.slice():Vi;const r=e.getLineDashOffset();t.lineDashOffset=r||Wi;const a=e.getLineJoin();t.lineJoin=a!==void 0?a:Jo;const l=e.getWidth();t.lineWidth=l!==void 0?l:ma;const c=e.getMiterLimit();t.miterLimit=c!==void 0?c:fa;const h=e.getOffset();t.strokeOffset=h??sE,t.lineWidth>this.maxLineWidth&&(this.maxLineWidth=t.lineWidth,this.bufferedMaxExtent_=null)}else t.strokeStyle=void 0,t.lineCap=void 0,t.lineDash=null,t.lineDashOffset=void 0,t.lineJoin=void 0,t.lineWidth=void 0,t.miterLimit=void 0,t.strokeOffset=void 0;return t}setFillStrokeStyle(e,t){const n=this.state;this.fillStyleToState(e,n),this.strokeStyleToState(t,n)}createFill(e){const t=e.fillStyle,n=[pe.SET_FILL_STYLE,t];return typeof t!="string"&&n.push(e.fillPatternScale),n}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[pe.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,e.lineDash?this.applyPixelRatio(e.lineDash):null,e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){const n=e.fillStyle;(typeof n!="string"||e.currentFillStyle!=n)&&(this.instructions.push(t.call(this,e)),e.currentFillStyle=n)}updateStrokeStyle(e,t){const n=e.strokeStyle,s=e.lineCap,o=e.lineDash,r=e.lineDashOffset,a=e.lineJoin,l=e.lineWidth,c=e.miterLimit,h=e.strokeOffset;(e.currentStrokeStyle!=n||e.currentLineCap!=s||o!=e.currentLineDash&&!ps(e.currentLineDash,o)||e.currentLineDashOffset!=r||e.currentLineJoin!=a||e.currentLineWidth!=l||e.currentMiterLimit!=c||e.currentStrokeOffset!=h)&&(t.call(this,e),e.currentStrokeStyle=n,e.currentLineCap=s,e.currentLineDash=o,e.currentLineDashOffset=r,e.currentLineJoin=a,e.currentLineWidth=l,e.currentMiterLimit=c,e.currentStrokeOffset=h)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const t=[pe.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Hg(this.maxExtent),this.maxLineWidth>0)){const e=this.resolution*(this.maxLineWidth+1)/2;pi(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class LE extends xa{constructor(e,t,n,s){super(e,t,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(e,t,n){if(!this.image_||this.maxExtent&&!Js(this.maxExtent,e.getFlatCoordinates()))return;this.beginGeometry(e,t,n);const s=e.getFlatCoordinates(),o=e.getStride(),r=this.coordinates.length,a=this.appendFlatPointCoordinates(s,o);this.instructions.push([pe.DRAW_IMAGE,r,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([pe.DRAW_IMAGE,r,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}drawMultiPoint(e,t,n){if(!this.image_)return;this.beginGeometry(e,t,n);const s=e.getFlatCoordinates(),o=[];for(let l=0,c=s.length;l<c;l+=e.getStride())(!this.maxExtent||Js(this.maxExtent,s.slice(l,l+2)))&&o.push(s[l],s[l+1]);const r=this.coordinates.length,a=this.appendFlatPointCoordinates(o,2);this.instructions.push([pe.DRAW_IMAGE,r,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([pe.DRAW_IMAGE,r,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(e,t){const n=e.getAnchor(),s=e.getSize(),o=e.getOrigin();this.imagePixelRatio_=e.getPixelRatio(this.pixelRatio),this.anchorX_=n[0],this.anchorY_=n[1],this.hitDetectionImage_=e.getHitDetectionImage(),this.image_=e.getImage(this.pixelRatio),this.height_=s[1],this.opacity_=e.getOpacity(),this.originX_=o[0],this.originY_=o[1],this.rotateWithView_=e.getRotateWithView(),this.rotation_=e.getRotation(),this.scale_=e.getScaleArray(),this.width_=s[0],this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}}class zE extends xa{constructor(e,t,n,s){super(e,t,n,s)}drawFlatCoordinates_(e,t,n,s,o){const r=this.coordinates.length,a=this.appendFlatLineCoordinates(e,t,n,s,!1,!1);return this.instructions.push([pe.MOVE_TO_LINE_TO,r,a,o*this.pixelRatio]),this.hitDetectionInstructions.push([pe.MOVE_TO_LINE_TO,r,a,o]),n}drawLineString(e,t,n){const s=this.state,o=s.strokeStyle,r=s.lineWidth,a=s.strokeOffset;if(o===void 0||r===void 0)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([pe.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Vi,Wi],po);const l=e.getFlatCoordinates(),c=e.getStride();this.drawFlatCoordinates_(l,0,l.length,c,a),this.hitDetectionInstructions.push(Es),this.endGeometry(t)}drawMultiLineString(e,t,n){const s=this.state,o=s.strokeStyle,r=s.lineWidth,a=s.strokeOffset;if(o===void 0||r===void 0)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([pe.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Vi,Wi],po);const l=e.getEnds(),c=e.getFlatCoordinates(),h=e.getStride();let u=0;for(let d=0,f=l.length;d<f;++d)u=this.drawFlatCoordinates_(c,u,l[d],h,a);this.hitDetectionInstructions.push(Es),this.endGeometry(t)}finish(){const e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(Es),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(Es),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(po)}}class S0 extends xa{constructor(e,t,n,s){super(e,t,n,s)}drawFlatCoordinatess_(e,t,n,s,o){const r=this.state,a=r.fillStyle!==void 0,l=r.strokeStyle!==void 0,c=n.length;this.instructions.push(po),this.hitDetectionInstructions.push(po);for(let h=0;h<c;++h){const u=n[h],d=this.coordinates.length,f=this.appendFlatLineCoordinates(e,t,u,s,!0,!l);this.instructions.push([pe.MOVE_TO_LINE_TO,d,f,o*this.pixelRatio,!0]),this.hitDetectionInstructions.push([pe.MOVE_TO_LINE_TO,d,f,o,!0]),l&&(this.instructions.push(P0),this.hitDetectionInstructions.push(P0)),t=u}return a&&(this.instructions.push(Ac),this.hitDetectionInstructions.push(Ac)),l&&(this.instructions.push(Es),this.hitDetectionInstructions.push(Es)),t}drawCircle(e,t,n){const s=this.state,o=s.fillStyle,r=s.strokeStyle,a=s.strokeOffset;if(o===void 0&&r===void 0||this.handleStrokeOffset_(()=>this.drawCircle(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([pe.SET_FILL_STYLE,un]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([pe.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Vi,Wi]);const l=e.getFlatCoordinates(),c=e.getStride(),h=this.coordinates.length;this.appendFlatLineCoordinates(l,0,l.length,c,!1,!1);const u=[pe.CIRCLE,h,a];this.instructions.push(po,u),this.hitDetectionInstructions.push(po,u),s.fillStyle!==void 0&&(this.instructions.push(Ac),this.hitDetectionInstructions.push(Ac)),s.strokeStyle!==void 0&&(this.instructions.push(Es),this.hitDetectionInstructions.push(Es)),this.endGeometry(t)}drawPolygon(e,t,n){const s=this.state,o=s.fillStyle,r=s.strokeStyle,a=s.strokeOffset;if(o===void 0&&r===void 0||this.handleStrokeOffset_(()=>this.drawPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([pe.SET_FILL_STYLE,un]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([pe.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Vi,Wi]);const l=e.getEnds(),c=e.getOrientedFlatCoordinates(),h=e.getStride();this.drawFlatCoordinatess_(c,0,l,h,a),this.endGeometry(t)}drawMultiPolygon(e,t,n){const s=this.state,o=s.fillStyle,r=s.strokeStyle,a=s.strokeOffset;if(o===void 0&&r===void 0||this.handleStrokeOffset_(()=>this.drawMultiPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([pe.SET_FILL_STYLE,un]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([pe.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Vi,Wi]);const l=e.getEndss(),c=e.getOrientedFlatCoordinates(),h=e.getStride();let u=0;for(let d=0,f=l.length;d<f;++d)u=this.drawFlatCoordinatess_(c,u,l[d],h,a);this.endGeometry(t)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const e=this.tolerance;if(e!==0){const t=this.coordinates;for(let n=0,s=t.length;n<s;++n)t[n]=ro(t[n],e)}return super.finish()}setFillStrokeStyles_(){const e=this.state;this.updateFillStyle(e,this.createFill),this.updateStrokeStyle(e,this.applyStroke)}handleStrokeOffset_(e){const t=this.state,n=t.fillStyle,s=t.strokeStyle,o=t.strokeOffset;return Math.abs(o)>0&&n!==void 0&&s!==void 0?(t.strokeStyle=void 0,t.strokeOffset=0,e(),t.fillStyle=void 0,t.strokeStyle=s,t.strokeOffset=o,e(),t.fillStyle=n,!0):!1}}function NE(i,e,t,n,s){const o=[];let r=t,a=0,l=e.slice(t,2);for(;a<i&&r+s<n;){const[c,h]=l.slice(-2),u=e[r+s],d=e[r+s+1],f=Math.sqrt((u-c)*(u-c)+(d-h)*(d-h));if(a+=f,a>=i){const g=(i-a+f)/f,_=_n(c,u,g),v=_n(h,d,g);l.push(_,v),o.push(l),l=[_,v],a==i&&(r+=s),a=0}else if(a<i)l.push(e[r+s],e[r+s+1]),r+=s;else{const g=f-a,_=_n(c,u,g/f),v=_n(h,d,g/f);l.push(_,v),o.push(l),l=[_,v],a=0,r+=s}}return a>0&&o.push(l),o}function kE(i,e,t,n,s){let o=t,r=t,a=0,l=0,c=t,h,u,d,f,g,_,v,E,w,C;for(u=t;u<n;u+=s){const P=e[u],R=e[u+1];g!==void 0&&(w=P-g,C=R-_,f=Math.sqrt(w*w+C*C),v!==void 0&&(l+=d,h=Math.acos((v*w+E*C)/(d*f)),h>i&&(l>a&&(a=l,o=c,r=u),l=0,c=u-s)),d=f,v=w,E=C),g=P,_=R}return l+=f,l>a?[c,u]:[o,r]}const Mc={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class jE extends xa{constructor(e,t,n,s){super(e,t,n,s),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[un]={fillStyle:un},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t,n){const s=this.textFillState_,o=this.textStrokeState_,r=this.textState_;if(this.text_===""||!r||!s&&!o)return;const a=this.coordinates;let l=a.length;const c=e.getType();let h=null,u=e.getStride();if(r.placement==="line"&&(c=="LineString"||c=="MultiLineString"||c=="Polygon"||c=="MultiPolygon")){if(!pt(this.maxExtent,e.getExtent()))return;let d;if(h=e.getFlatCoordinates(),c=="LineString")d=[h.length];else if(c=="MultiLineString")d=e.getEnds();else if(c=="Polygon")d=e.getEnds().slice(0,1);else if(c=="MultiPolygon"){const v=e.getEndss();d=[];for(let E=0,w=v.length;E<w;++E)d.push(v[E][0])}this.beginGeometry(e,t,n);const f=r.repeat,g=f?void 0:r.textAlign;let _=0;for(let v=0,E=d.length;v<E;++v){let w;f?w=NE(f*this.resolution,h,_,d[v],u):w=[h.slice(_,d[v])];for(let C=0,P=w.length;C<P;++C){const R=w[C];let O=0,I=R.length;if(g==null){const z=kE(r.maxAngle,R,0,R.length,2);O=z[0],I=z[1]}for(let z=O;z<I;z+=u)a.push(R[z],R[z+1]);const M=a.length;_=d[v],this.drawChars_(l,M),l=M}}this.endGeometry(t)}else{let d=r.overflow?null:[];switch(c){case"Point":case"MultiPoint":h=e.getFlatCoordinates();break;case"LineString":h=e.getFlatMidpoint();break;case"Circle":h=e.getCenter();break;case"MultiLineString":h=e.getFlatMidpoints(),u=2;break;case"Polygon":h=e.getFlatInteriorPoint(),r.overflow||d.push(h[2]/this.resolution),u=3;break;case"MultiPolygon":const P=e.getFlatInteriorPoints();h=[];for(let R=0,O=P.length;R<O;R+=3)r.overflow||d.push(P[R+2]/this.resolution),h.push(P[R],P[R+1]);if(h.length===0)return;u=2;break}const f=this.appendFlatPointCoordinates(h,u);if(f===l)return;if(d&&(f-l)/2!==h.length/u){let P=l/2;d=d.filter((R,O)=>{const I=a[(P+O)*2]===h[O*u]&&a[(P+O)*2+1]===h[O*u+1];return I||--P,I})}this.saveTextStates_();const g=r.backgroundFill?this.createFill(this.fillStyleToState(r.backgroundFill)):null,_=r.backgroundStroke?this.createStroke(this.strokeStyleToState(r.backgroundStroke)):null;this.beginGeometry(e,t,n);let v=r.padding;if(v!=ho&&(r.scale[0]<0||r.scale[1]<0)){let P=r.padding[0],R=r.padding[1],O=r.padding[2],I=r.padding[3];r.scale[0]<0&&(R=-R,I=-I),r.scale[1]<0&&(P=-P,O=-O),v=[P,R,O,I]}const E=this.pixelRatio;this.instructions.push([pe.DRAW_IMAGE,l,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,v==ho?ho:v.map(function(P){return P*E}),g,_,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]);const w=1/E,C=g?g.slice(0):null;C&&(C[1]=un),this.hitDetectionInstructions.push([pe.DRAW_IMAGE,l,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[w,w],NaN,this.declutterMode_,this.declutterImageWithText_,v,C,_,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?un:this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]),this.endGeometry(t)}}saveTextStates_(){const e=this.textStrokeState_,t=this.textState_,n=this.textFillState_,s=this.strokeKey_;e&&(s in this.strokeStates||(this.strokeStates[s]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));const o=this.textKey_;o in this.textStates||(this.textStates[o]={font:t.font,textAlign:t.textAlign||ga,justify:t.justify,textBaseline:t.textBaseline||xc,scale:t.scale});const r=this.fillKey_;n&&(r in this.fillStates||(this.fillStates[r]={fillStyle:n.fillStyle}))}drawChars_(e,t){const n=this.textStrokeState_,s=this.textState_,o=this.strokeKey_,r=this.textKey_,a=this.fillKey_;this.saveTextStates_();const l=this.pixelRatio,c=Mc[s.textBaseline],h=this.textOffsetY_*l,u=this.text_,d=n?n.lineWidth*Math.abs(s.scale[0])/2:0;this.instructions.push([pe.DRAW_CHARS,e,t,c,s.overflow,a,s.maxAngle,l,h,o,d*l,u,r,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([pe.DRAW_CHARS,e,t,c,s.overflow,a&&un,s.maxAngle,l,h,o,d*l,u,r,1/l,this.declutterMode_,this.textKeepUpright_])}setTextStyle(e,t){let n,s,o;if(!e)this.text_="";else{const r=e.getFill();r?(s=this.textFillState_,s||(s={},this.textFillState_=s),s.fillStyle=wi(r.getColor()||un)):(s=null,this.textFillState_=s);const a=e.getStroke();if(!a)o=null,this.textStrokeState_=o;else{o=this.textStrokeState_,o||(o={},this.textStrokeState_=o);const _=a.getLineDash(),v=a.getLineDashOffset(),E=a.getWidth(),w=a.getMiterLimit();o.lineCap=a.getLineCap()||Qo,o.lineDash=_?_.slice():Vi,o.lineDashOffset=v===void 0?Wi:v,o.lineJoin=a.getLineJoin()||Jo,o.lineWidth=E===void 0?ma:E,o.miterLimit=w===void 0?fa:w,o.strokeStyle=wi(a.getColor()||pa)}n=this.textState_;const l=e.getFont()||s0;aE(l);const c=e.getScaleArray();n.overflow=e.getOverflow(),n.font=l,n.maxAngle=e.getMaxAngle(),n.placement=e.getPlacement(),n.textAlign=e.getTextAlign(),n.repeat=e.getRepeat(),n.justify=e.getJustify(),n.textBaseline=e.getTextBaseline()||xc,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||ho,n.scale=c===void 0?[1,1]:c;const h=e.getOffsetX(),u=e.getOffsetY(),d=e.getRotateWithView(),f=e.getKeepUpright(),g=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=h===void 0?0:h,this.textOffsetY_=u===void 0?0:u,this.textRotateWithView_=d===void 0?!1:d,this.textKeepUpright_=f===void 0?!0:f,this.textRotation_=g===void 0?0:g,this.strokeKey_=o?(typeof o.strokeStyle=="string"?o.strokeStyle:Pe(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&&s.fillStyle?typeof s.fillStyle=="string"?s.fillStyle:"|"+Pe(s.fillStyle):""}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}}const UE={Circle:S0,Default:xa,Image:LE,LineString:zE,Polygon:S0,Text:jE};class R0{constructor(e,t,n,s){this.tolerance_=e,this.maxExtent_=t,this.pixelRatio_=s,this.resolution_=n,this.buildersByZIndex_={}}finish(){const e={};for(const t in this.buildersByZIndex_){e[t]=e[t]||{};const n=this.buildersByZIndex_[t];for(const s in n){const o=n[s].finish();e[t][s]=o}}return e}getBuilder(e,t){const n=e!==void 0?e.toString():"0";let s=this.buildersByZIndex_[n];s===void 0&&(s={},this.buildersByZIndex_[n]=s);let o=s[t];if(o===void 0){const r=UE[t];o=new r(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),s[t]=o}return o}}function GE(i,e,t,n,s,o,r,a,l,c,h,u,d=!0){let f=i[e],g=i[e+1],_=0,v=0,E=0,w=0;function C(){_=f,v=g,e+=n,f=i[e],g=i[e+1],w+=E,E=Math.sqrt((f-_)*(f-_)+(g-v)*(g-v))}do C();while(e<t-n&&w+E<o);let P=E===0?0:(o-w)/E;const R=_n(_,f,P),O=_n(v,g,P),I=e-n,M=w,z=o+a*l(c,s,h);for(;e<t-n&&w+E<z;)C();P=E===0?0:(z-w)/E;const k=_n(_,f,P),q=_n(v,g,P);let H=!1;if(d)if(u){const N=[R,O,k,q];Im(N,0,4,2,u,N,N),H=N[0]>N[2]}else H=R>k;const m=Math.PI,b=[],S=I+n===e;e=I,E=0,w=M,f=i[e],g=i[e+1];let L;if(S){C(),L=Math.atan2(g-v,f-_),H&&(L+=L>0?-m:m);const N=(k+R)/2,j=(q+O)/2;return b[0]=[N,j,(z-o)/2,L,s],b}s=s.replace(/\n/g," ");for(let N=0,j=s.length;N<j;){C();let U=Math.atan2(g-v,f-_);if(H&&(U+=U>0?-m:m),L!==void 0){let V=U-L;if(V+=V>m?-2*m:V<-m?2*m:0,Math.abs(V)>r)return null}L=U;const B=N;let X=0;for(;N<j;++N){const V=H?j-N-1:N,re=a*l(c,s[V],h);if(e+n<t&&w+E<o+X+re/2)break;X+=re}if(N===B)continue;const G=H?s.substring(j-B,j-N):s.substring(B,N);P=E===0?0:(o+X/2-w)/E;const ae=_n(_,f,P),te=_n(v,g,P);b.push([ae,te,X/2,U,G]),o+=X}return b}class Md{constructor(){T(this,"pushMethodArgs_",(...e)=>(this.push_(e),this));this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(yc(),{get:(e,t)=>{if(typeof yc()[t]=="function")return this.push_(t),this.pushMethodArgs_},set:(e,t,n)=>(this.push_(t,n),!0)})}push_(...e){const t=this.instructions_,n=this.zIndex+this.offset_;t[n]||(t[n]=[]),t[n].push(...e)}pushFunction(e){this.push_(e)}getContext(){return this.context_}draw(e){this.instructions_.forEach(t=>{for(let n=0,s=t.length;n<s;++n){const o=t[n];if(typeof o=="function"){o(e);continue}const r=t[++n];if(typeof e[o]=="function")e[o](...r);else{if(typeof r=="function"){e[o]=r(e);continue}e[o]=r}}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}}const sr=yn(),Cs=[],Bi=[],$i=[],xs=[];function T0(i){return i[3].declutterBox}const I0=new RegExp("[֑-ࣿיִ-﷿ﹰ-ﻼࠀ--]");function Dd(i,e){return e==="start"?e=I0.test(i)?"right":"left":e==="end"&&(e=I0.test(i)?"left":"right"),Mc[e]}function qE(i,e,t){return t>0&&i.push(`
|
|
24
|
-
`,""),
|
|
25
|
-
`).reduce(
|
|
26
|
-
`){m+=H,H=0,z=u*C+M*d,++S;continue}const B=f[N+1]||l.font;B!==L&&(s&&k.push("font",B),n&&q.push("font",B),L=B),H=Math.max(H,E[b]);const X=[U,z+M*v[b]+u*(v[b]-w[S]),.5*(d+H)+m];z+=v[b],s&&k.push("strokeText",X),n&&q.push("fillText",X),++b}return Array.prototype.push.apply(P,k),Array.prototype.push.apply(P,q),this.labels_[o]=I,I}replayTextBackground_(e,t,n,s,o,r,a){e.beginPath(),e.moveTo.apply(e,t),e.lineTo.apply(e,n),e.lineTo.apply(e,s),e.lineTo.apply(e,o),e.lineTo.apply(e,t),r&&(this.alignAndScaleFill_=r[2],e.fillStyle=r[1],this.fill_(e)),a&&(this.setStrokeStyle_(e,a),e.stroke())}calculateImageOrLabelDimensions_(e,t,n,s,o,r,a,l,c,h,u,d,f,g,_,v){a*=d[0],l*=d[1];let E=n-a,w=s-l;const C=o+c>e?e-c:o,P=r+h>t?t-h:r,R=g[3]+C*d[0]+g[1],O=g[0]+P*d[1]+g[2],I=E-g[3],M=w-g[0];(_||u!==0)&&(Cs[0]=I,xs[0]=I,Cs[1]=M,Bi[1]=M,Bi[0]=I+R,$i[0]=Bi[0],$i[1]=M+O,xs[1]=$i[1]);let z;return u!==0?(z=Zn(Qt(),n,s,1,1,u,-n,-s),wt(z,Cs),wt(z,Bi),wt(z,$i),wt(z,xs),ki(Math.min(Cs[0],Bi[0],$i[0],xs[0]),Math.min(Cs[1],Bi[1],$i[1],xs[1]),Math.max(Cs[0],Bi[0],$i[0],xs[0]),Math.max(Cs[1],Bi[1],$i[1],xs[1]),sr)):ki(Math.min(I,I+R),Math.min(M,M+O),Math.max(I,I+R),Math.max(M,M+O),sr),f&&(E=Math.round(E),w=Math.round(w)),{drawImageX:E,drawImageY:w,drawImageW:C,drawImageH:P,originX:c,originY:h,declutterBox:{minX:sr[0],minY:sr[1],maxX:sr[2],maxY:sr[3],value:v},canvasTransform:z,scale:d}}replayImageOrLabel_(e,t,n,s,o,r,a){const l=!!(r||a),c=s.declutterBox,h=a?a[2]*s.scale[0]/2:0;return c.minX-h<=t[0]&&c.maxX+h>=0&&c.minY-h<=t[1]&&c.maxY+h>=0&&(l&&this.replayTextBackground_(e,Cs,Bi,$i,xs,r,a),hE(e,s.canvasTransform,o,n,s.originX,s.originY,s.drawImageW,s.drawImageH,s.drawImageX,s.drawImageY,s.scale)),!0}fill_(e){const t=this.alignAndScaleFill_;if(t){const n=wt(this.renderedTransform_,[0,0]),s=512*this.pixelRatio;e.save(),e.translate(n[0]%s,n[1]%s),t!==1&&e.scale(t,t)}e.fill(),t&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],t[1]&&(e.lineWidth=t[2],e.lineCap=t[3],e.lineJoin=t[4],e.miterLimit=t[5],e.lineDashOffset=t[7],e.setLineDash(t[6]))}drawLabelWithPointPlacement_(e,t,n,s){const o=this.textStates[t],r=this.createLabel(e,t,s,n),a=this.strokeStates[n],l=this.pixelRatio,c=Dd(Array.isArray(e)?e[0]:e,o.textAlign||ga),h=Mc[o.textBaseline||xc],u=a&&a.lineWidth?a.lineWidth:0,d=r.width/l-2*o.scale[0],f=c*d+2*(.5-c)*u,g=h*r.height/l+2*(.5-h)*u;return{label:r,anchorX:f,anchorY:g}}execute_(e,t,n,s,o,r,a,l){const c=this.zIndexContext_;let h;this.pixelCoordinates_&&ps(n,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=_i(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),mb(this.renderedTransform_,n));let u=0;const d=s.length;let f=0,g,_,v,E,w,C,P,R,O,I,M,z,k,q,H,m,b=0,S=0;const L=this.coordinateCache_,N=this.viewRotation_,j=Math.round(Math.atan2(-n[1],n[0])*1e12)/1e12,U={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:N},B=this.instructions!=s||this.overlaps?0:200;let X,G,ae,te;for(;u<d;){const V=s[u];switch(V[0]){case pe.BEGIN_GEOMETRY:X=V[1],te=V[3],X.getGeometry()?a!==void 0&&!pt(a,te.getExtent())?u=V[2]+1:++u:u=V[2],c&&(c.zIndex=V[4]);break;case pe.BEGIN_PATH:b>B&&(this.fill_(e),b=0),S>B&&(e.stroke(),S=0),!b&&!S&&(e.beginPath(),R=NaN,O=NaN),++u;break;case pe.CIRCLE:f=V[1],E=V[2]??0;const ie=h[f],he=h[f+1],me=h[f+2]-E,Fe=h[f+3]-E,ue=me-ie,ze=Fe-he,J=Math.sqrt(ue*ue+ze*ze);e.moveTo(ie+J,he),e.arc(ie,he,J,0,2*Math.PI,!0),++u;break;case pe.CLOSE_PATH:e.closePath(),++u;break;case pe.CUSTOM:f=V[1],g=V[2];const dt=V[3],Qe=V[4],ye=V[5];U.geometry=dt,U.feature=X,u in L||(L[u]=[]);const sn=L[u];ye?ye(h,f,g,2,sn):(sn[0]=h[f],sn[1]=h[f+1],sn.length=2),c&&(c.zIndex=V[6]),Qe(sn,U),++u;break;case pe.DRAW_IMAGE:f=V[1],g=V[2],z=V[3],_=V[4],v=V[5];let Gt=V[6];const _t=V[7],Mt=V[8],Je=V[9],qn=V[10];let nt=V[11];const Vn=V[12];let Wn=V[13];P=V[14]||"declutter";const ui=V[15];if(!z&&V.length>=20){k=V[19],q=V[20],H=V[21],m=V[22];const mn=this.drawLabelWithPointPlacement_(k,q,H,m);z=mn.label,V[3]=z;const hs=V[23];_=(mn.anchorX-hs)*this.pixelRatio,V[4]=_;const $n=V[24];v=(mn.anchorY-$n)*this.pixelRatio,V[5]=v,Gt=z.height,V[6]=Gt,Wn=z.width,V[13]=Wn}let qe;V.length>25&&(qe=V[25]);let je,Me,fe;V.length>17?(je=V[16],Me=V[17],fe=V[18]):(je=ho,Me=null,fe=null),qn&&j?nt+=N:!qn&&!j&&(nt-=N);let Ze=0;for(;f<g;f+=2){if(qe&&qe[Ze++]<Wn/this.pixelRatio)continue;const mn=this.calculateImageOrLabelDimensions_(z.width,z.height,h[f],h[f+1],Wn,Gt,_,v,Mt,Je,nt,Vn,o,je,!!Me||!!fe,X),hs=[e,t,z,mn,_t,Me,fe];if(l){let $n,Li,Hn;if(ui){const Ct=g-f;if(!ui[Ct]){ui[Ct]={args:hs,declutterMode:P};continue}const rn=ui[Ct];$n=rn.args,Li=rn.declutterMode,delete ui[Ct],Hn=T0($n)}let us,ds;if($n&&(Li!=="declutter"||!l.collides(Hn))&&(us=!0),(P!=="declutter"||!l.collides(mn.declutterBox))&&(ds=!0),Li==="declutter"&&P==="declutter"){const Ct=us&&ds;us=Ct,ds=Ct}us&&(Li!=="none"&&l.insert(Hn),this.replayImageOrLabel_.apply(this,$n)),ds&&(P!=="none"&&l.insert(mn.declutterBox),this.replayImageOrLabel_.apply(this,hs))}else this.replayImageOrLabel_.apply(this,hs)}++u;break;case pe.DRAW_CHARS:const Ce=V[1],xe=V[2],Be=V[3],Et=V[4];m=V[5];const on=V[6],qt=V[7],lt=V[8];H=V[9];const Dt=V[10];k=V[11],Array.isArray(k)&&(k=k.reduce(VE,"")),q=V[12];const it=[V[13],V[13]];P=V[14]||"declutter";const Vt=V[15],zt=this.textStates[q],Pt=zt.font,et=[zt.scale[0]*qt,zt.scale[1]*qt];let Ot;Pt in this.widths_?Ot=this.widths_[Pt]:(Ot={},this.widths_[Pt]=Ot);const Fi=ud(h,Ce,xe,2),Bn=Math.abs(et[0])*l0(Pt,k,Ot);if(Et||Bn<=Fi){const mn=this.textStates[q].textAlign,hs=(Fi-Bn)*Dd(k,mn),$n=GE(h,Ce,xe,2,k,hs,on,Math.abs(et[0]),l0,Pt,Ot,j?0:this.viewRotation_,Vt);e:if($n){const Li=[];let Hn,us,ds,Ct,rn;if(H)for(Hn=0,us=$n.length;Hn<us;++Hn){rn=$n[Hn],ds=rn[4],Ct=this.createLabel(ds,q,"",H),_=rn[2]+(et[0]<0?-Dt:Dt),v=Be*Ct.height+(.5-Be)*2*Dt*et[1]/et[0]-lt;const fs=this.calculateImageOrLabelDimensions_(Ct.width,Ct.height,rn[0],rn[1],Ct.width,Ct.height,_,v,0,0,rn[3],it,!1,ho,!1,X);if(l&&P==="declutter"&&l.collides(fs.declutterBox))break e;Li.push([e,t,Ct,fs,1,null,null])}if(m)for(Hn=0,us=$n.length;Hn<us;++Hn){rn=$n[Hn],ds=rn[4],Ct=this.createLabel(ds,q,m,""),_=rn[2],v=Be*Ct.height-lt;const fs=this.calculateImageOrLabelDimensions_(Ct.width,Ct.height,rn[0],rn[1],Ct.width,Ct.height,_,v,0,0,rn[3],it,!1,ho,!1,X);if(l&&P==="declutter"&&l.collides(fs.declutterBox))break e;Li.push([e,t,Ct,fs,1,null,null])}l&&P!=="none"&&l.load(Li.map(T0));for(let fs=0,BA=Li.length;fs<BA;++fs)this.replayImageOrLabel_.apply(this,Li[fs])}}++u;break;case pe.END_GEOMETRY:if(r!==void 0){X=V[1];const mn=r(X,te,P);if(mn)return mn}++u;break;case pe.FILL:B?b++:this.fill_(e),++u;break;case pe.MOVE_TO_LINE_TO:for(f=V[1],g=V[2],E=V[3],w=V[4]??!1,G=h[f],ae=h[f+1],E&&(C=f,[G,ae]=bc(G,ae,w?h[g-4]:void 0,w?h[g-3]:void 0,h[f+2],h[f+3],E)),e.moveTo(G,ae),R=G+.5|0,O=ae+.5|0,f+=2;f<g;f+=2)G=h[f],ae=h[f+1],I=G+.5|0,M=ae+.5|0,(f==g-2||I!==R||M!==O)&&(E&&(f==g-2?[G,ae]=bc(G,ae,h[f-2],h[f-1],w?h[C+2]:void 0,w?h[C+3]:void 0,E):[G,ae]=bc(G,ae,h[f-2],h[f-1],h[f+2],h[f+3],E)),e.lineTo(G,ae),R=I,O=M);++u;break;case pe.SET_FILL_STYLE:this.alignAndScaleFill_=V[2],b&&(this.fill_(e),b=0,S&&(e.stroke(),S=0)),e.fillStyle=V[1],++u;break;case pe.SET_STROKE_STYLE:S&&(e.stroke(),S=0),this.setStrokeStyle_(e,V),++u;break;case pe.STROKE:B?S++:e.stroke(),++u;break;default:++u;break}}b&&this.fill_(e),S&&e.stroke()}execute(e,t,n,s,o,r){this.viewRotation_=s,this.execute_(e,t,n,this.instructions,o,void 0,void 0,r)}executeHitDetection(e,t,n,s,o){return this.viewRotation_=n,this.execute_(e,[e.canvas.width,e.canvas.height],t,this.hitDetectionInstructions,!0,s,o)}}const go=["Polygon","Circle","LineString","Image","Text","Default"],Dc=["Image","Text"],BE=go.filter(i=>!Dc.includes(i));let O0=!1,A0=!1;function $E(){let i=0;const e=n=>{const s=ht(1,1,null,{willReadFrequently:n});let o=0;const r=performance.now();for(;performance.now()-r<50;++o)s.fillStyle=`rgba(255,0,${o%256},1)`,s.fillRect(0,0,1,1),s.getImageData(0,0,1,1);return i=o>i?o:i,o};O0={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0}[i],A0=!0}class M0{constructor(e,t,n,s,o,r,a){this.maxExtent_=e,this.overlaps_=s,this.pixelRatio_=n,this.resolution_=t,this.renderBuffer_=r,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=Qt(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(o,a)}clip(e,t){const n=this.getClipCoords(t);e.beginPath(),e.moveTo(n[0],n[1]),e.lineTo(n[2],n[3]),e.lineTo(n[4],n[5]),e.lineTo(n[6],n[7]),e.clip()}createExecutors_(e,t){for(const n in e){let s=this.executorsByZIndex_[n];s===void 0&&(s={},this.executorsByZIndex_[n]=s);const o=e[n];for(const r in o){const a=o[r];s[r]=new WE(this.resolution_,this.pixelRatio_,this.overlaps_,a,t)}}}hasExecutors(e){for(const t in this.executorsByZIndex_){const n=this.executorsByZIndex_[t];for(let s=0,o=e.length;s<o;++s)if(e[s]in n)return!0}return!1}forEachFeatureAtCoordinate(e,t,n,s,o,r){A0===!1&&$E(),s=Math.round(s);const a=s*2+1,l=Zn(this.hitDetectionTransform_,s+.5,s+.5,1/t,-1/t,-n,-e[0],-e[1]),c=!this.hitDetectionContext_;c&&(this.hitDetectionContext_=ht(a,a,null,{willReadFrequently:O0}));const h=this.hitDetectionContext_;h.canvas.width!==a||h.canvas.height!==a?(h.canvas.width=a,h.canvas.height=a):c||h.clearRect(0,0,a,a);let u;this.renderBuffer_!==void 0&&(u=yn(),Hr(u,e),pi(u,t*(this.renderBuffer_+s),u));const d=HE(s);let f;function g(R,O,I){const M=h.getImageData(0,0,a,a).data;for(let z=0,k=d.length;z<k;z++)if(M[d[z]]>0){if(!r||I==="none"||f!=="Image"&&f!=="Text"||r.includes(R)){const q=(d[z]-3)/4,H=s-q%a,m=s-(q/a|0),b=o(R,O,H*H+m*m);if(b)return b}h.clearRect(0,0,a,a);break}}const _=Object.keys(this.executorsByZIndex_).map(Number);_.sort(di);let v,E,w,C,P;for(v=_.length-1;v>=0;--v){const R=_[v].toString();for(w=this.executorsByZIndex_[R],E=go.length-1;E>=0;--E)if(f=go[E],C=w[f],C!==void 0&&(P=C.executeHitDetection(h,l,n,g,u),P))return P}}getClipCoords(e){const t=this.maxExtent_;if(!t)return null;const n=t[0],s=t[1],o=t[2],r=t[3],a=[n,s,n,r,o,r,o,s];return _i(a,0,8,2,e,a),a}isEmpty(){return _s(this.executorsByZIndex_)}execute(e,t,n,s,o,r,a){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?Ev:di),r=r||go;const c=go.length;for(let h=0,u=l.length;h<u;++h){const d=l[h].toString(),f=this.executorsByZIndex_[d];for(let g=0,_=r.length;g<_;++g){const v=r[g],E=f[v];if(E!==void 0){const w=a===null?void 0:E.getZIndexContext(),C=w?w.getContext():e,P=this.maxExtent_&&v!=="Image"&&v!=="Text";if(P&&(C.save(),this.clip(C,n)),!w||v==="Text"||v==="Image"?E.execute(C,t,n,s,o,a):w.pushFunction(R=>E.execute(R,t,n,s,o,a)),P&&C.restore(),w){w.offset();const R=l[h]*c+go.indexOf(v);this.deferredZIndexContexts_[R]||(this.deferredZIndexContexts_[R]=[]),this.deferredZIndexContexts_[R].push(w)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(di);for(let n=0,s=t.length;n<s;++n)e[t[n]].forEach(o=>{o.draw(this.renderedContext_),o.clear()}),e[t[n]].length=0}}const Fd={};function HE(i){if(Fd[i]!==void 0)return Fd[i];const e=i*2+1,t=i*i,n=new Array(t+1);for(let o=0;o<=i;++o)for(let r=0;r<=i;++r){const a=o*o+r*r;if(a>t)break;let l=n[a];l||(l=[],n[a]=l),l.push(((i+o)*e+(i+r))*4+3),o>0&&l.push(((i-o)*e+(i+r))*4+3),r>0&&(l.push(((i+o)*e+(i-r))*4+3),o>0&&l.push(((i-o)*e+(i-r))*4+3))}const s=[];for(let o=0,r=n.length;o<r;++o)n[o]&&s.push(...n[o]);return Fd[i]=s,s}function D0(i,e,t,n){return t!==void 0&&n!==void 0?[t/i,n/e]:t!==void 0?t/i:n!==void 0?n/e:1}class Ps extends Oc{constructor(e){e=e||{};const t=e.opacity!==void 0?e.opacity:1,n=e.rotation!==void 0?e.rotation:0,s=e.scale!==void 0?e.scale:1,o=e.rotateWithView!==void 0?e.rotateWithView:!1;super({opacity:t,rotation:n,scale:s,displacement:e.displacement!==void 0?e.displacement:[0,0],rotateWithView:o,declutterMode:e.declutterMode}),this.anchor_=e.anchor!==void 0?e.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=e.anchorOrigin!==void 0?e.anchorOrigin:"top-left",this.anchorXUnits_=e.anchorXUnits!==void 0?e.anchorXUnits:"fraction",this.anchorYUnits_=e.anchorYUnits!==void 0?e.anchorYUnits:"fraction",this.crossOrigin_=e.crossOrigin!==void 0?e.crossOrigin:null,this.referrerPolicy_=e.referrerPolicy;const r=e.img!==void 0?e.img:null;let a=e.src;Ve(!(a!==void 0&&r),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&r&&(a=r.src||Pe(r)),Ve(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),Ve(!((e.width!==void 0||e.height!==void 0)&&e.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(e.src!==void 0?l=le.IDLE:r!==void 0&&("complete"in r?r.complete?l=r.src?le.LOADED:le.IDLE:l=le.LOADING:l=le.LOADED),this.color_=e.color!==void 0?co(e.color):null,this.iconImage_=da(r,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},l,this.color_),this.offset_=e.offset!==void 0?e.offset:[0,0],this.offsetOrigin_=e.offsetOrigin!==void 0?e.offsetOrigin:"top-left",this.origin_=null,this.size_=e.size!==void 0?e.size:null,this.initialOptions_,e.width!==void 0||e.height!==void 0){let c,h;if(e.size)[c,h]=e.size;else{const u=this.getImage(1);if(u.width&&u.height)c=u.width,h=u.height;else if(u instanceof HTMLImageElement){this.initialOptions_=e;const d=()=>{if(this.unlistenImageChange(d),!this.initialOptions_)return;const f=this.iconImage_.getSize();this.setScale(D0(f[0],f[1],e.width,e.height))};this.listenImageChange(d);return}}c!==void 0&&this.setScale(D0(c,h,e.width,e.height))}}clone(){let e,t,n;return this.initialOptions_?(t=this.initialOptions_.width,n=this.initialOptions_.height):(e=this.getScale(),e=Array.isArray(e)?e.slice():e),new Ps({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:e,width:t,height:n,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let e=this.normalizedAnchor_;if(!e){e=this.anchor_;const s=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!s)return null;e=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(e[0]*=s[0]),this.anchorYUnits_=="fraction"&&(e[1]*=s[1])}if(this.anchorOrigin_!="top-left"){if(!s)return null;e===this.anchor_&&(e=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(e[0]=-e[0]+s[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(e[1]=-e[1]+s[1])}this.normalizedAnchor_=e}const t=this.getDisplacement(),n=this.getScaleArray();return[e[0]-t[0]/n[0],e[1]+t[1]/n[1]]}setAnchor(e){this.anchor_=e,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(e){const t=e?co(e):null;if(this.color_===t||this.color_&&t&&this.color_.length===t.length&&this.color_.every((r,a)=>r===t[a]))return;this.color_=t;const n=this.getSrc(),s=n!==void 0?null:this.getHitDetectionImage(),o=n!==void 0?le.IDLE:this.iconImage_.getImageState();this.iconImage_=da(s,n,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},o,this.color_)}getImage(e){return this.iconImage_.getImage(e)}getPixelRatio(e){return this.iconImage_.getPixelRatio(e)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let e=this.offset_;if(this.offsetOrigin_!="top-left"){const t=this.getSize(),n=this.iconImage_.getSize();if(!t||!n)return null;e=e.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(e[0]=n[0]-t[0]-e[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(e[1]=n[1]-t[1]-e[1])}return this.origin_=e,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(e){this.iconImage_=da(null,e,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},le.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const e=this.getScaleArray();if(this.size_)return this.size_[0]*e[0];if(this.iconImage_.getImageState()==le.LOADED)return this.iconImage_.getSize()[0]*e[0]}getHeight(){const e=this.getScaleArray();if(this.size_)return this.size_[1]*e[1];if(this.iconImage_.getImageState()==le.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(_e.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(_e.CHANGE,e)}ready(){return this.iconImage_.ready()}}const bn=.5;function F0(i,e,t,n,s,o,r,a,l){const c=l?Xu(s):s,h=i[0]*bn,u=i[1]*bn,d=ht(h,u);d.imageSmoothingEnabled=!1;const f=d.canvas,g=new c0(d,bn,s,null,r,a,l?ia(pb(),l):null),_=t.length,v=Math.floor((256*256*256-1)/_),E={};for(let C=1;C<=_;++C){const P=t[C-1],R=P.getStyleFunction()||n;if(!R)continue;let O=R(P,o);if(!O)continue;Array.isArray(O)||(O=[O]);const M=(C*v).toString(16).padStart(7,"#00000");for(let z=0,k=O.length;z<k;++z){const q=O[z],H=q.getGeometryFunction()(P);if(!H||!pt(c,H.getExtent()))continue;const m=q.clone(),b=m.getFill();b&&b.setColor(M);const S=m.getStroke();S&&(S.setColor(M),S.setLineDash(null)),m.setText(void 0);const L=q.getImage();if(L){const B=L.getImageSize();if(!B)continue;const X=ht(B[0],B[1],void 0,{alpha:!1}),G=X.canvas;X.fillStyle=M,X.fillRect(0,0,G.width,G.height),m.setImage(new Ps({img:G,anchor:L.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:L.getOrigin(),opacity:1,size:L.getSize(),scale:L.getScale(),rotation:L.getRotation(),rotateWithView:L.getRotateWithView()}))}const N=m.getZIndex()||0;let j=E[N];j||(j={},E[N]=j,j.Polygon=[],j.Circle=[],j.LineString=[],j.Point=[]);const U=H.getType();if(U==="GeometryCollection"){const B=H.getGeometriesArrayRecursive();for(let X=0,G=B.length;X<G;++X){const ae=B[X];j[ae.getType().replace("Multi","")].push(ae,m)}}else j[U.replace("Multi","")].push(H,m)}}const w=Object.keys(E).map(Number).sort(di);for(let C=0,P=w.length;C<P;++C){const R=E[w[C]];for(const O in R){const I=R[O];for(let M=0,z=I.length;M<z;M+=2){g.setStyle(I[M+1]);for(let k=0,q=e.length;k<q;++k)g.setTransform(e[k]),g.drawGeometry(I[M])}}}return d.getImageData(0,0,f.width,f.height)}function L0(i,e,t){const n=[];if(t){const s=Math.floor(Math.round(i[0])*bn),o=Math.floor(Math.round(i[1])*bn),r=(ct(s,0,t.width-1)+ct(o,0,t.height-1)*t.width)*4,a=t.data[r],l=t.data[r+1],h=t.data[r+2]+256*(l+256*a),u=Math.floor((256*256*256-1)/e.length);h&&h%u===0&&n.push(e[h/u-1])}return n}class z0 extends Yn{constructor(e,t,n,s){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=s}}const XE=5;class YE extends ea{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=XE}getStaleKeys(){return this.staleKeys_}prependStaleKey(e){this.staleKeys_.unshift(e),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(e){return we()}getData(e){return null}prepareFrame(e){return we()}renderFrame(e,t){return we()}forEachFeatureAtCoordinate(e,t,n,s,o){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){const t=e.target;(t.getState()===le.LOADED||t.getState()===le.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=le.LOADED&&t!=le.ERROR&&e.addEventListener(_e.CHANGE,this.boundHandleImageChange_),t==le.IDLE&&(e.load(),t=e.getState()),t==le.LOADED}renderIfReadyAndVisible(){const e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}}const N0=[];let or=null;function ZE(){or=ht(1,1,void 0,{willReadFrequently:!0})}class Ld extends YE{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=Qt(),this.pixelTransform=Qt(),this.inversePixelTransform=Qt(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){or||ZE(),or.clearRect(0,0,1,1);let s;try{or.drawImage(e,t,n,1,1,0,0,1,1),s=or.getImageData(0,0,1,1).data}catch{return or=null,null}return s}getBackground(e){let n=this.getLayer().getBackground();return typeof n=="function"&&(n=n(e.viewState.resolution)),n||void 0}useContainer(e,t,n){const s=this.getLayer().getClassName();let o,r;if(e&&e.className===s&&(!n||e&&e.style.backgroundColor&&ps(co(e.style.backgroundColor),co(n)))){const a=e.firstElementChild;vs(a)&&(r=a.getContext("2d"))}if(r&&bb(r.canvas.style.transform,t)?(this.container=e,this.context=r,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){o=hn?Ym():document.createElement("div"),o.className=s;let a=o.style;a.position="absolute",a.width="100%",a.height="100%",r=ht();const l=r.canvas;o.appendChild(l),a=l.style,a.position="absolute",a.left="0",a.transformOrigin="top left",this.container=o,this.context=r}!this.containerReused&&n&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=n)}clipUnrotated(e,t,n){const s=ln(n),o=Ql(n),r=Zl(n),a=Yl(n);wt(t.coordinateToPixelTransform,s),wt(t.coordinateToPixelTransform,o),wt(t.coordinateToPixelTransform,r),wt(t.coordinateToPixelTransform,a);const l=this.inversePixelTransform;wt(l,s),wt(l,o),wt(l,r),wt(l,a),e.save(),e.beginPath(),e.moveTo(Math.round(s[0]),Math.round(s[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.lineTo(Math.round(r[0]),Math.round(r[1])),e.lineTo(Math.round(a[0]),Math.round(a[1])),e.clip()}prepareContainer(e,t){const n=e.extent,s=e.viewState.resolution,o=e.viewState.rotation,r=e.pixelRatio,a=Math.round(Te(n)/s*r),l=Math.round(ft(n)/s*r);Zn(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/r,1/r,o,-a/2,-l/2),Tm(this.inversePixelTransform,this.pixelTransform);const c=vb(this.pixelTransform);if(this.useContainer(t,c,this.getBackground(e)),!this.containerReused){const h=this.context.canvas;h.width!=a||h.height!=l?(h.width=a,h.height=l):this.context.clearRect(0,0,a,l),c!==h.style.transform&&(h.style.transform=c)}}dispatchRenderEvent_(e,t,n){const s=this.getLayer();if(s.hasListener(e)){const o=new z0(e,this.inversePixelTransform,n,t);s.dispatchEvent(o)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(Mn.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(Mn.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new Md),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(Mn.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(Mn.POSTRENDER,this.context,e))}getRenderTransform(e,t,n,s,o,r,a){const l=o/2,c=r/2,h=s/t,u=-h,d=-e[0]+a,f=-e[1];return Zn(this.tempTransform,l,c,h,u,-n,d,f)}disposeInternal(){delete this.frameState,super.disposeInternal()}}class k0 extends Ld{constructor(e){super(e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=yn(),this.wrappedRenderedExtent_=yn(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(e,t,n){const s=t.extent,o=t.viewState,r=o.center,a=o.resolution,l=o.projection,c=o.rotation,h=l.getExtent(),u=this.getLayer().getSource(),d=this.getLayer().getDeclutter(),f=t.pixelRatio,g=t.viewHints,_=!(g[ot.ANIMATING]||g[ot.INTERACTING]),v=this.context,E=Math.round(Te(s)/a*f),w=Math.round(ft(s)/a*f),C=u.getWrapX()&&l.canWrapX(),P=C?Te(h):null,R=C?Math.ceil((s[2]-h[2])/P)+(this.extendX_?2:1):1;let O=C?Math.floor((s[0]-h[0])/P)-(this.extendX_?1:0):0;do{let I=this.getRenderTransform(r,a,0,f,E,w,O*P);t.declutter&&(I=I.slice(0)),e.execute(v,[v.canvas.width,v.canvas.height],I,c,_,n===void 0?go:n?Dc:BE,n?d&&t.declutter[d]:void 0)}while(++O<R)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=ht(this.context.canvas.width,this.context.canvas.height,N0))}resetDrawContext_(){if(this.opacity_!==1&&this.targetContext_){const e=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=e,la(this.context),N0.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(e){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,e,!0)}renderDeferredInternal(e){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,e,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(e,t){const n=e.layerStatesArray[e.layerIndex];this.opacity_=n.opacity;const s=e.viewState;this.prepareContainer(e,t);const o=this.context,r=this.replayGroup_;let a=r&&!r.isEmpty();if(!a&&!(this.getLayer().hasListener(Mn.PRERENDER)||this.getLayer().hasListener(Mn.POSTRENDER)))return this.container;this.setDrawContext_(),this.preRender(o,e),s.projection,this.clipExtent_=null;let l=!1;if(a&&n.extent&&this.clipping){const c=yi(n.extent);a=pt(c,e.extent),a&&!Ni(c,e.extent)&&(e.declutter?this.clipExtent_=c:(this.clipUnrotated(o,e,c),l=!0))}return a&&this.renderWorlds(r,e,this.getLayer().getDeclutter()?!1:void 0),l&&o.restore(),this.postRender(o,e),this.renderedRotation_!==s.rotation&&(this.renderedRotation_=s.rotation,this.hitDetectionImageData_=null),e.declutter||this.resetDrawContext_(),this.container}getFeatures(e){return new Promise(t=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const n=this.frameState.size.slice(),s=this.renderedCenter_,o=this.renderedResolution_,r=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,c=this.getLayer(),h=[],u=n[0]*bn,d=n[1]*bn;h.push(this.getRenderTransform(s,o,r,bn,u,d,0).slice());const f=c.getSource(),g=a.getExtent();if(f.getWrapX()&&a.canWrapX()&&!Ni(g,l)){let _=l[0];const v=Te(g);let E=0,w;for(;_<g[0];)--E,w=v*E,h.push(this.getRenderTransform(s,o,r,bn,u,d,w).slice()),_+=v;for(E=0,_=l[2];_>g[2];)++E,w=v*E,h.push(this.getRenderTransform(s,o,r,bn,u,d,w).slice()),_-=v}this.hitDetectionImageData_=F0(n,h,this.renderedFeatures_,c.getStyleFunction(),l,o,r,Pc(o,this.renderedPixelRatio_),null)}t(L0(e,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(e,t,n,s,o){var d,f;if(!this.replayGroup_)return;const r=t.viewState.resolution,a=t.viewState.rotation,l=this.getLayer(),c={},h=function(g,_,v){const E=Pe(g),w=c[E];if(w){if(w!==!0&&v<w.distanceSq){if(v===0)return c[E]=!0,o.splice(o.lastIndexOf(w),1),s(g,l,_);w.geometry=_,w.distanceSq=v}}else{if(v===0)return c[E]=!0,s(g,l,_);o.push(c[E]={feature:g,layer:l,geometry:_,distanceSq:v,callback:s})}},u=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(e,r,a,n,h,u?(f=(d=t.declutter)==null?void 0:d[u])==null?void 0:f.all().map(g=>g.value):null)}handleFontsChanged(){const e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){const t=this.getLayer(),n=t.getSource();if(!n)return!1;const s=e.viewHints[ot.ANIMATING],o=e.viewHints[ot.INTERACTING],r=t.getUpdateWhileAnimating(),a=t.getUpdateWhileInteracting();if(this.ready&&!r&&s||!a&&o)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const l=e.extent,c=e.viewState,h=c.projection,u=c.resolution,d=e.pixelRatio,f=t.getRevision(),g=t.getRenderBuffer();let _=t.getRenderOrder();_===void 0&&(_=fE);const v=c.center.slice(),E=pi(l,g*u),w=E.slice(),C=[E.slice()],P=h.getExtent(),R=n.getWrapX()&&h.canWrapX();if(this.extendX_=!1,R){const S=n.getExtent();S&&!Ui(S)&&(this.extendX_=S[0]<P[0]||S[2]>P[2])}if(R&&(!Ni(P,e.extent)||this.extendX_)){const S=Te(P),L=Math.max(Te(E)/2,S);let N=P[0],j=P[2];this.extendX_&&(N-=S,j+=S),E[0]=N-L,E[2]=j+L,Nu(v,h);const U=em(C[0],h);U[0]<P[0]&&U[2]<P[2]?C.push([U[0]+S,U[1],U[2]+S,U[3]]):U[0]>P[0]&&U[2]>P[2]&&C.push([U[0]-S,U[1],U[2]-S,U[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedPixelRatio_===d&&this.renderedRevision_==f&&this.renderedRenderOrder_==_&&this.renderedFrameDeclutter_===!!e.declutter&&Ni(this.wrappedRenderedExtent_,E))return ps(this.renderedExtent_,w)||(this.hitDetectionImageData_=null,this.renderedExtent_=w),this.renderedCenter_=v,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const O=new R0(u0(u,d),E,u,d);let I;for(let S=0,L=C.length;S<L;++S)n.loadFeatures(C[S],u,h);const M=Pc(u,d);let z=!0;const k=(S,L)=>{let N;const j=S.getStyleFunction()||t.getStyleFunction();if(j&&(N=j(S,u)),N){const U=this.renderFeature(S,M,N,O,I,this.getLayer().getDeclutter(),L);z=z&&!U}},q=Xu(E),H=n.getFeaturesInExtent(q);_&&H.sort(_);for(let S=0,L=H.length;S<L;++S)k(H[S],S);this.renderedFeatures_=H,this.ready=z;const m=O.finish(),b=new M0(E,u,d,n.getOverlaps(),m,t.getRenderBuffer(),!!e.declutter);return this.renderedResolution_=u,this.renderedRevision_=f,this.renderedRenderOrder_=_,this.renderedFrameDeclutter_=!!e.declutter,this.renderedExtent_=w,this.wrappedRenderedExtent_=E,this.renderedCenter_=v,this.renderedProjection_=h,this.renderedPixelRatio_=d,this.replayGroup_=b,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(e,t,n,s,o,r,a){if(!n)return!1;let l=!1;if(Array.isArray(n))for(let c=0,h=n.length;c<h;++c)l=Sc(s,e,n[c],t,this.boundHandleStyleImageChange_,o,r,a)||l;else l=Sc(s,e,n,t,this.boundHandleStyleImageChange_,o,r,a);return l}}let mo=0;const Jt=1<<mo++,Le=1<<mo++,dn=1<<mo++,Jn=1<<mo++,yo=1<<mo++,Pa=1<<mo++,Fc=Math.pow(2,mo)-1,zd={[Jt]:"boolean",[Le]:"number",[dn]:"string",[Jn]:"color",[yo]:"number[]",[Pa]:"size"},KE=Object.keys(zd).map(Number).sort(di);function QE(i){return i in zd}function Sa(i){const e=[];for(const t of KE)Ra(i,t)&&e.push(zd[t]);return e.length===0?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function Ra(i,e){return(i&e)===e}function Ss(i,e){return i===e}class At{constructor(e,t){if(!QE(e))throw new Error(`literal expressions must have a specific type, got ${Sa(e)}`);this.type=e,this.value=t}}class JE{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}}function j0(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1,mapState:!1}}function Nt(i,e,t){switch(typeof i){case"boolean":{if(Ss(e,dn))return new At(dn,i?"true":"false");if(!Ra(e,Jt))throw new Error(`got a boolean, but expected ${Sa(e)}`);return new At(Jt,i)}case"number":{if(Ss(e,Pa))return new At(Pa,$t(i));if(Ss(e,Jt))return new At(Jt,!!i);if(Ss(e,dn))return new At(dn,i.toString());if(!Ra(e,Le))throw new Error(`got a number, but expected ${Sa(e)}`);return new At(Le,i)}case"string":{if(Ss(e,Jn))return new At(Jn,wc(i));if(Ss(e,Jt))return new At(Jt,!!i);if(!Ra(e,dn))throw new Error(`got a string, but expected ${Sa(e)}`);return new At(dn,i)}}if(!Array.isArray(i))throw new Error("expression must be an array or a primitive value");if(i.length===0)throw new Error("empty expression");if(typeof i[0]=="string")return hC(i,e,t);for(const n of i)if(typeof n!="number")throw new Error("expected an array of numbers");if(Ss(e,Pa)){if(i.length!==2)throw new Error(`expected an array of two values for a size, got ${i.length}`);return new At(Pa,i)}if(Ss(e,Jn)){if(i.length===3)return new At(Jn,[...i,1]);if(i.length===4)return new At(Jn,i);throw new Error(`expected an array of 3 or 4 values for a color, got ${i.length}`)}if(!Ra(e,yo))throw new Error(`got an array of numbers, but expected ${Sa(e)}`);return new At(yo,i)}const Z={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",LineMetric:"line-metric",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string",Has:"has"},eC={[Z.Get]:ve(Oe(1,1/0),U0),[Z.Var]:ve(Oe(1,1),tC),[Z.Has]:ve(Oe(1,1/0),U0),[Z.Id]:ve(nC,rr),[Z.Concat]:ve(Oe(2,1/0),We(dn)),[Z.GeometryType]:ve(iC,rr),[Z.LineMetric]:ve(rr),[Z.Resolution]:ve(Nd,rr),[Z.Zoom]:ve(Nd,rr),[Z.Time]:ve(Nd,rr),[Z.Any]:ve(Oe(2,1/0),We(Jt)),[Z.All]:ve(Oe(2,1/0),We(Jt)),[Z.Not]:ve(Oe(1,1),We(Jt)),[Z.Equal]:ve(Oe(2,2),We(Fc)),[Z.NotEqual]:ve(Oe(2,2),We(Fc)),[Z.GreaterThan]:ve(Oe(2,2),We(Le)),[Z.GreaterThanOrEqualTo]:ve(Oe(2,2),We(Le)),[Z.LessThan]:ve(Oe(2,2),We(Le)),[Z.LessThanOrEqualTo]:ve(Oe(2,2),We(Le)),[Z.Multiply]:ve(Oe(2,1/0),G0),[Z.Coalesce]:ve(Oe(2,1/0),G0),[Z.Divide]:ve(Oe(2,2),We(Le)),[Z.Add]:ve(Oe(2,1/0),We(Le)),[Z.Subtract]:ve(Oe(2,2),We(Le)),[Z.Clamp]:ve(Oe(3,3),We(Le)),[Z.Mod]:ve(Oe(2,2),We(Le)),[Z.Pow]:ve(Oe(2,2),We(Le)),[Z.Abs]:ve(Oe(1,1),We(Le)),[Z.Floor]:ve(Oe(1,1),We(Le)),[Z.Ceil]:ve(Oe(1,1),We(Le)),[Z.Round]:ve(Oe(1,1),We(Le)),[Z.Sin]:ve(Oe(1,1),We(Le)),[Z.Cos]:ve(Oe(1,1),We(Le)),[Z.Atan]:ve(Oe(1,2),We(Le)),[Z.Sqrt]:ve(Oe(1,1),We(Le)),[Z.Match]:ve(Oe(4,1/0),q0,oC),[Z.Between]:ve(Oe(3,3),We(Le)),[Z.Interpolate]:ve(Oe(6,1/0),q0,rC),[Z.Case]:ve(Oe(3,1/0),sC,aC),[Z.In]:ve(Oe(2,2),lC),[Z.Number]:ve(Oe(1,1/0),We(Fc)),[Z.String]:ve(Oe(1,1/0),We(Fc)),[Z.Array]:ve(Oe(1,1/0),We(Le)),[Z.Color]:ve(Oe(1,4),We(Le)),[Z.Band]:ve(Oe(1,3),We(Le)),[Z.Palette]:ve(Oe(2,2),cC),[Z.ToString]:ve(Oe(1,1),We(Jt|Le|dn|Jn))};function U0(i,e,t){const n=i.length-1,s=new Array(n);for(let o=0;o<n;++o){const r=i[o+1];switch(typeof r){case"number":{s[o]=new At(Le,r);break}case"string":{s[o]=new At(dn,r);break}default:throw new Error(`expected a string key or numeric array index for a get operation, got ${r}`)}o===0&&t.properties.add(String(r))}return s}function tC(i,e,t){const n=i[1];if(typeof n!="string")throw new Error("expected a string argument for var operation");return t.variables.add(n),[new At(dn,n)]}function nC(i,e,t){t.featureId=!0}function iC(i,e,t){t.geometryType=!0}function Nd(i,e,t){t.mapState=!0}function rr(i,e,t){const n=i[0];if(i.length!==1)throw new Error(`expected no arguments for ${n} operation`);return[]}function Oe(i,e){return function(t,n,s){const o=t[0],r=t.length-1;if(i===e){if(r!==i){const a=i===1?"":"s";throw new Error(`expected ${i} argument${a} for ${o}, got ${r}`)}}else if(r<i||r>e){const a=e===1/0?`${i} or more`:`${i} to ${e}`;throw new Error(`expected ${a} arguments for ${o}, got ${r}`)}}}function G0(i,e,t){const n=i.length-1,s=new Array(n);for(let o=0;o<n;++o){const r=Nt(i[o+1],e,t);s[o]=r}return s}function We(i){return function(e,t,n){const s=e.length-1,o=new Array(s);for(let r=0;r<s;++r){const a=Nt(e[r+1],i,n);o[r]=a}return o}}function sC(i,e,t){const n=i[0],s=i.length-1;if(s%2===0)throw new Error(`expected an odd number of arguments for ${n}, got ${s} instead`)}function q0(i,e,t){const n=i[0],s=i.length-1;if(s%2===1)throw new Error(`expected an even number of arguments for operation ${n}, got ${s} instead`)}function oC(i,e,t){const n=i.length-1,s=dn|Le|Jt,o=Nt(i[1],s,t),r=Nt(i[i.length-1],e,t),a=new Array(n-2);for(let l=0;l<n-2;l+=2){try{const c=Nt(i[l+2],o.type,t);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+1} of match expression: ${c.message}`)}try{const c=Nt(i[l+3],r.type,t);a[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+2} of match expression: ${c.message}`)}}return[o,...a,r]}function rC(i,e,t){const n=i[1];let s;switch(n[0]){case"linear":s=1;break;case"exponential":const l=n[1];if(typeof l!="number"||l<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(l)} instead`);s=l;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(n)}`)}const o=new At(Le,s);let r;try{r=Nt(i[2],Le,t)}catch(l){throw new Error(`failed to parse argument 1 in interpolate expression: ${l.message}`)}const a=new Array(i.length-3);for(let l=0;l<a.length;l+=2){try{const c=Nt(i[l+3],Le,t);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${c.message}`)}try{const c=Nt(i[l+4],e,t);a[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${c.message}`)}}return[o,r,...a]}function aC(i,e,t){const n=Nt(i[i.length-1],e,t),s=new Array(i.length-1);for(let o=0;o<s.length-1;o+=2){try{const r=Nt(i[o+1],Jt,t);s[o]=r}catch(r){throw new Error(`failed to parse argument ${o} of case expression: ${r.message}`)}try{const r=Nt(i[o+2],n.type,t);s[o+1]=r}catch(r){throw new Error(`failed to parse argument ${o+1} of case expression: ${r.message}`)}}return s[s.length-1]=n,s}function lC(i,e,t){let n=i[2];if(!Array.isArray(n))throw new Error('the second argument for the "in" operator must be an array');let s;if(typeof n[0]=="string"){if(n[0]!=="literal")throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');if(!Array.isArray(n[1]))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array');n=n[1],s=dn}else s=Le;const o=new Array(n.length);for(let a=0;a<o.length;a++)try{const l=Nt(n[a],s,t);o[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[Nt(i[1],s,t),...o]}function cC(i,e,t){let n;try{n=Nt(i[1],Le,t)}catch(r){throw new Error(`failed to parse first argument in palette expression: ${r.message}`)}const s=i[2];if(!Array.isArray(s))throw new Error("the second argument of palette must be an array");const o=new Array(s.length);for(let r=0;r<o.length;r++){let a;try{a=Nt(s[r],Jn,t)}catch(l){throw new Error(`failed to parse color at index ${r} in palette expression: ${l.message}`)}if(!(a instanceof At))throw new Error(`the palette color at index ${r} must be a literal value`);o[r]=a}return[n,...o]}function ve(...i){return function(e,t,n){const s=e[0];let o;for(let r=0;r<i.length;r++){const a=i[r](e,t,n);if(r==i.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");o=a}}return new JE(t,s,...o)}}function hC(i,e,t){const n=i[0],s=eC[n];if(!s)throw new Error(`unknown operator: ${n}`);return s(i,e,t)}function V0(i){if(!i)return"";const e=i.getType();switch(e){case"Point":case"LineString":case"Polygon":return e;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return e.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return V0(i.getGeometries()[0]);default:return""}}function W0(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function vi(i,e,t){const n=Nt(i,e,t);return ei(n)}function ei(i,e){if(i instanceof At){if(i.type===Jn&&typeof i.value=="string"){const n=wc(i.value);return function(){return n}}return function(){return i.value}}const t=i.operator;switch(t){case Z.Number:case Z.String:case Z.Coalesce:return uC(i);case Z.Get:case Z.Var:case Z.Has:return dC(i);case Z.Id:return n=>n.featureId;case Z.GeometryType:return n=>n.geometryType;case Z.Concat:{const n=i.args.map(s=>ei(s));return s=>"".concat(...n.map(o=>o(s).toString()))}case Z.Resolution:return n=>n.resolution;case Z.Any:case Z.All:case Z.Between:case Z.In:case Z.Not:return pC(i);case Z.Equal:case Z.NotEqual:case Z.LessThan:case Z.LessThanOrEqualTo:case Z.GreaterThan:case Z.GreaterThanOrEqualTo:return fC(i);case Z.Multiply:case Z.Divide:case Z.Add:case Z.Subtract:case Z.Clamp:case Z.Mod:case Z.Pow:case Z.Abs:case Z.Floor:case Z.Ceil:case Z.Round:case Z.Sin:case Z.Cos:case Z.Atan:case Z.Sqrt:return gC(i);case Z.Case:return mC(i);case Z.Match:return yC(i);case Z.Interpolate:return _C(i);case Z.ToString:return wC(i);default:throw new Error(`Unsupported operator ${t}`)}}function uC(i,e){const t=i.operator,n=i.args.length,s=new Array(n);for(let o=0;o<n;++o)s[o]=ei(i.args[o]);switch(t){case Z.Coalesce:return o=>{for(let r=0;r<n;++r){const a=s[r](o);if(typeof a<"u"&&a!==null)return a}throw new Error("Expected one of the values to be non-null")};case Z.Number:case Z.String:return o=>{for(let r=0;r<n;++r){const a=s[r](o);if(typeof a===t)return a}throw new Error(`Expected one of the values to be a ${t}`)};default:throw new Error(`Unsupported assertion operator ${t}`)}}function dC(i,e){const n=i.args[0].value;switch(i.operator){case Z.Get:return s=>{const o=i.args;let r=s.properties[n];for(let a=1,l=o.length;a<l;++a){const h=o[a].value;r=r[h]}return r};case Z.Var:return s=>s.variables[n];case Z.Has:return s=>{const o=i.args;if(!(n in s.properties))return!1;let r=s.properties[n];for(let a=1,l=o.length;a<l;++a){const h=o[a].value;if(!r||!Object.hasOwn(r,h))return!1;r=r[h]}return!0};default:throw new Error(`Unsupported accessor operator ${i.operator}`)}}function fC(i,e){const t=i.operator,n=ei(i.args[0]),s=ei(i.args[1]);switch(t){case Z.Equal:return o=>n(o)===s(o);case Z.NotEqual:return o=>n(o)!==s(o);case Z.LessThan:return o=>n(o)<s(o);case Z.LessThanOrEqualTo:return o=>n(o)<=s(o);case Z.GreaterThan:return o=>n(o)>s(o);case Z.GreaterThanOrEqualTo:return o=>n(o)>=s(o);default:throw new Error(`Unsupported comparison operator ${t}`)}}function pC(i,e){const t=i.operator,n=i.args.length,s=new Array(n);for(let o=0;o<n;++o)s[o]=ei(i.args[o]);switch(t){case Z.Any:return o=>{for(let r=0;r<n;++r)if(s[r](o))return!0;return!1};case Z.All:return o=>{for(let r=0;r<n;++r)if(!s[r](o))return!1;return!0};case Z.Between:return o=>{const r=s[0](o),a=s[1](o),l=s[2](o);return r>=a&&r<=l};case Z.In:return o=>{const r=s[0](o);for(let a=1;a<n;++a)if(r===s[a](o))return!0;return!1};case Z.Not:return o=>!s[0](o);default:throw new Error(`Unsupported logical operator ${t}`)}}function gC(i,e){const t=i.operator,n=i.args.length,s=new Array(n);for(let o=0;o<n;++o)s[o]=ei(i.args[o]);switch(t){case Z.Multiply:return o=>{let r=1;for(let a=0;a<n;++a)r*=s[a](o);return r};case Z.Divide:return o=>s[0](o)/s[1](o);case Z.Add:return o=>{let r=0;for(let a=0;a<n;++a)r+=s[a](o);return r};case Z.Subtract:return o=>s[0](o)-s[1](o);case Z.Clamp:return o=>{const r=s[0](o),a=s[1](o);if(r<a)return a;const l=s[2](o);return r>l?l:r};case Z.Mod:return o=>s[0](o)%s[1](o);case Z.Pow:return o=>Math.pow(s[0](o),s[1](o));case Z.Abs:return o=>Math.abs(s[0](o));case Z.Floor:return o=>Math.floor(s[0](o));case Z.Ceil:return o=>Math.ceil(s[0](o));case Z.Round:return o=>Math.round(s[0](o));case Z.Sin:return o=>Math.sin(s[0](o));case Z.Cos:return o=>Math.cos(s[0](o));case Z.Atan:return n===2?o=>Math.atan2(s[0](o),s[1](o)):o=>Math.atan(s[0](o));case Z.Sqrt:return o=>Math.sqrt(s[0](o));default:throw new Error(`Unsupported numeric operator ${t}`)}}function mC(i,e){const t=i.args.length,n=new Array(t);for(let s=0;s<t;++s)n[s]=ei(i.args[s]);return s=>{for(let o=0;o<t-1;o+=2)if(n[o](s))return n[o+1](s);return n[t-1](s)}}function yC(i,e){const t=i.args.length,n=new Array(t);for(let s=0;s<t;++s)n[s]=ei(i.args[s]);return s=>{const o=n[0](s);for(let r=1;r<t-1;r+=2)if(o===n[r](s))return n[r+1](s);return n[t-1](s)}}function _C(i,e){const t=i.args.length,n=new Array(t);for(let s=0;s<t;++s)n[s]=ei(i.args[s]);return s=>{const o=n[0](s),r=n[1](s);let a,l;for(let c=2;c<t;c+=2){const h=n[c](s);let u=n[c+1](s);const d=Array.isArray(u);if(d&&(u=Zb(u)),h>=r)return c===2?u:d?vC(o,r,a,l,h,u):Ta(o,r,a,l,h,u);a=h,l=u}return l}}function wC(i,e){const t=i.operator,n=i.args.length,s=new Array(n);for(let o=0;o<n;++o)s[o]=ei(i.args[o]);switch(t){case Z.ToString:return o=>{const r=s[0](o);return i.args[0].type===Jn?bd(r):r.toString()};default:throw new Error(`Unsupported convert operator ${t}`)}}function Ta(i,e,t,n,s,o){const r=s-t;if(r===0)return n;const a=e-t,l=i===1?a/r:(Math.pow(i,a)-1)/(Math.pow(i,r)-1);return n+l*(o-n)}function vC(i,e,t,n,s,o){if(s-t===0)return n;const a=Km(n),l=Km(o);let c=l[2]-a[2];c>180?c-=360:c<-180&&(c+=360);const h=[Ta(i,e,t,a[0],s,l[0]),Ta(i,e,t,a[1],s,l[1]),a[2]+Ta(i,e,t,0,s,c),Ta(i,e,t,n[3],s,o[3])];return Kb(h)}function bC(i){return!0}function EC(i){const e=j0(),t=CC(i,e),n=W0();return function(s,o){if(n.properties=s.getPropertiesInternal(),n.resolution=o,e.featureId){const r=s.getId();r!==void 0?n.featureId=r:n.featureId=null}return e.geometryType&&(n.geometryType=V0(s.getGeometry())),t(n)}}function B0(i){const e=j0(),t=i.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=kd(i[r],e);const s=W0(),o=new Array(t);return function(r,a){if(s.properties=r.getPropertiesInternal(),s.resolution=a,e.featureId){const c=r.getId();c!==void 0?s.featureId=c:s.featureId=null}let l=0;for(let c=0;c<t;++c){const h=n[c](s);h&&(o[l]=h,l+=1)}return o.length=l,o}}function CC(i,e){const t=i.length,n=new Array(t);for(let s=0;s<t;++s){const o=i[s],r="filter"in o?vi(o.filter,Jt,e):bC;let a;if(Array.isArray(o.style)){const l=o.style.length;a=new Array(l);for(let c=0;c<l;++c)a[c]=kd(o.style[c],e)}else a=[kd(o.style,e)];n[s]={filter:r,styles:a}}return function(s){const o=[];let r=!1;for(let a=0;a<t;++a){const l=n[a].filter;if(l(s)&&!(i[a].else&&r)){r=!0;for(const c of n[a].styles){const h=c(s);h&&o.push(h)}}}return o}}function kd(i,e){const t=Ia(i,"",e),n=Oa(i,"",e),s=xC(i,e),o=PC(i,e),r=kt(i,"z-index",e);if(!t&&!n&&!s&&!o&&!_s(i))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(i));const a=new $e;return function(l){let c=!0;if(t){const h=t(l);h&&(c=!1),a.setFill(h)}if(n){const h=n(l);h&&(c=!1),a.setStroke(h)}if(s){const h=s(l);h&&(c=!1),a.setText(h)}if(o){const h=o(l);h&&(c=!1),a.setImage(h)}return r&&a.setZIndex(r(l)),c?null:a}}function Ia(i,e,t){let n;if(e+"fill-pattern-src"in i)n=IC(i,e+"fill-",t);else{if(i[e+"fill-color"]==="none")return o=>null;n=Lc(i,e+"fill-color",t)}if(!n)return null;const s=new vt;return function(o){const r=n(o);return r===pd?null:(s.setColor(r),s)}}function Oa(i,e,t){const n=kt(i,e+"stroke-width",t),s=Lc(i,e+"stroke-color",t);if(!n&&!s)return null;const o=Xi(i,e+"stroke-line-cap",t),r=Xi(i,e+"stroke-line-join",t),a=$0(i,e+"stroke-line-dash",t),l=kt(i,e+"stroke-line-dash-offset",t),c=kt(i,e+"stroke-miter-limit",t),h=kt(i,e+"stroke-offset",t),u=new St;return function(d){if(s){const f=s(d);if(f===pd)return null;u.setColor(f)}if(n&&u.setWidth(n(d)),o){const f=o(d);if(f!=="butt"&&f!=="round"&&f!=="square")throw new Error("Expected butt, round, or square line cap");u.setLineCap(f)}if(r){const f=r(d);if(f!=="bevel"&&f!=="round"&&f!=="miter")throw new Error("Expected bevel, round, or miter line join");u.setLineJoin(f)}return a&&u.setLineDash(a(d)),l&&u.setLineDashOffset(l(d)),c&&u.setMiterLimit(c(d)),h&&u.setOffset(h(d)),u}}function xC(i,e){const t="text-",n=Xi(i,t+"value",e);if(!n)return null;const s=Ia(i,t,e),o=Ia(i,t+"background-",e),r=Oa(i,t,e),a=Oa(i,t+"background-",e),l=Xi(i,t+"font",e),c=kt(i,t+"max-angle",e),h=kt(i,t+"offset-x",e),u=kt(i,t+"offset-y",e),d=ar(i,t+"overflow",e),f=Xi(i,t+"placement",e),g=kt(i,t+"repeat",e),_=Nc(i,t+"scale",e),v=ar(i,t+"rotate-with-view",e),E=kt(i,t+"rotation",e),w=Xi(i,t+"align",e),C=Xi(i,t+"justify",e),P=Xi(i,t+"baseline",e),R=ar(i,t+"keep-upright",e),O=$0(i,t+"padding",e),I=kc(i,t+"declutter-mode"),M=new ir({declutterMode:I});return function(z){if(M.setText(n(z)),s&&M.setFill(s(z)),o&&M.setBackgroundFill(o(z)),r&&M.setStroke(r(z)),a&&M.setBackgroundStroke(a(z)),l&&M.setFont(l(z)),c&&M.setMaxAngle(c(z)),h&&M.setOffsetX(h(z)),u&&M.setOffsetY(u(z)),d&&M.setOverflow(d(z)),f){const k=f(z);if(k!=="point"&&k!=="line")throw new Error("Expected point or line for text-placement");M.setPlacement(k)}if(g&&M.setRepeat(g(z)),_&&M.setScale(_(z)),v&&M.setRotateWithView(v(z)),E&&M.setRotation(E(z)),w){const k=w(z);if(k!=="left"&&k!=="center"&&k!=="right"&&k!=="end"&&k!=="start")throw new Error("Expected left, right, center, start, or end for text-align");M.setTextAlign(k)}if(C){const k=C(z);if(k!=="left"&&k!=="right"&&k!=="center")throw new Error("Expected left, right, or center for text-justify");M.setJustify(k)}if(P){const k=P(z);if(k!=="bottom"&&k!=="top"&&k!=="middle"&&k!=="alphabetic"&&k!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");M.setTextBaseline(k)}return O&&M.setPadding(O(z)),R&&M.setKeepUpright(R(z)),M}}function PC(i,e){return"icon-src"in i?SC(i,e):"shape-points"in i?RC(i,e):"circle-radius"in i?TC(i,e):null}function SC(i,e){const t="icon-",n=t+"src",s=Z0(i[n],n),o=zc(i,t+"anchor",e),r=Nc(i,t+"scale",e),a=kt(i,t+"opacity",e),l=zc(i,t+"displacement",e),c=kt(i,t+"rotation",e),h=ar(i,t+"rotate-with-view",e),u=X0(i,t+"anchor-origin"),d=Y0(i,t+"anchor-x-units"),f=Y0(i,t+"anchor-y-units"),g=Hi(i,t+"color");let _,v=null;g!==void 0&&(Array.isArray(g)&&g.length>0&&typeof g[0]=="string"?v=Lc(i,t+"color",e):_=K0(g,t+"color"));const E=AC(i,t+"cross-origin"),w=MC(i,t+"offset"),C=X0(i,t+"offset-origin"),P=jd(i,t+"width"),R=jd(i,t+"height"),O=OC(i,t+"size"),I=kc(i,t+"declutter-mode"),M={src:s,anchorOrigin:u,anchorXUnits:d,anchorYUnits:f,crossOrigin:E,offset:w,offsetOrigin:C,height:R,width:P,size:O,declutterMode:I};let z=null;return function(k){if(z)v&&z.setColor(v(k));else{const q=v?v(k):_;z=new Ps(q!==void 0?Object.assign({},M,{color:q}):Object.assign({},M))}return a&&z.setOpacity(a(k)),l&&z.setDisplacement(l(k)),c&&z.setRotation(c(k)),h&&z.setRotateWithView(h(k)),r&&z.setScale(r(k)),o&&z.setAnchor(o(k)),z}}function RC(i,e){const t="shape-",n=t+"points",s=t+"radius",o=Ud(i[n],n);if(!(s in i))throw new Error(`Expected a number for ${s}`);const r=kt(i,s,e),a=typeof i[s]=="number"?i[s]:5,l=t+"radius2",c=kt(i,l,e),h=typeof i[l]=="number"?i[l]:void 0,u=Ia(i,t,e),d=Oa(i,t,e),f=Nc(i,t+"scale",e),g=zc(i,t+"displacement",e),_=kt(i,t+"rotation",e),v=ar(i,t+"rotate-with-view",e),E=jd(i,t+"angle"),w=kc(i,t+"declutter-mode"),C=new Ca({points:o,radius:a,radius2:h,angle:E,declutterMode:w});return function(P){return r&&C.setRadius(r(P)),c&&C.setRadius2(c(P)),u&&C.setFill(u(P)),d&&C.setStroke(d(P)),g&&C.setDisplacement(g(P)),_&&C.setRotation(_(P)),v&&C.setRotateWithView(v(P)),f&&C.setScale(f(P)),C}}function TC(i,e){const t="circle-",n=Ia(i,t,e),s=Oa(i,t,e),o=kt(i,t+"radius",e),r=Nc(i,t+"scale",e),a=zc(i,t+"displacement",e),l=kt(i,t+"rotation",e),c=ar(i,t+"rotate-with-view",e),h=kc(i,t+"declutter-mode"),u=new Ln({radius:5,declutterMode:h});return function(d){return o&&u.setRadius(o(d)),n&&u.setFill(n(d)),s&&u.setStroke(s(d)),a&&u.setDisplacement(a(d)),l&&u.setRotation(l(d)),c&&u.setRotateWithView(c(d)),r&&u.setScale(r(d)),u}}function Hi(i,e){if(!(e in i))return;const t=i[e];return t===void 0?void 0:t}function kt(i,e,t){const n=Hi(i,e);if(n===void 0)return;const s=vi(n,Le,t);return function(o){return Ud(s(o),e)}}function Xi(i,e,t){const n=Hi(i,e);if(n===void 0)return null;const s=vi(n,dn,t);return function(o){return Z0(s(o),e)}}function IC(i,e,t){const n=Xi(i,e+"pattern-src",t),s=H0(i,e+"pattern-offset",t),o=H0(i,e+"pattern-size",t),r=Lc(i,e+"color",t);return function(a){return{src:n(a),offset:s&&s(a),size:o&&o(a),color:r&&r(a)}}}function ar(i,e,t){const n=Hi(i,e);if(n===void 0)return null;const s=vi(n,Jt,t);return function(o){const r=s(o);if(typeof r!="boolean")throw new Error(`Expected a boolean for ${e}`);return r}}function Lc(i,e,t){const n=Hi(i,e);if(n===void 0)return null;const s=vi(n,Jn,t);return function(o){return K0(s(o),e)}}function $0(i,e,t){const n=Hi(i,e);if(n===void 0)return null;if(Array.isArray(n)&&(n.length===0||typeof n[0]!="string")){const o=n.map((r,a)=>{if(typeof r=="number")return()=>r;const l=vi(r,Le,t);return function(c){return Ud(l(c),`${e}[${a}]`)}});return function(r){const a=new Array(o.length);for(let l=0;l<o.length;++l)a[l]=o[l](r);return a}}const s=vi(n,yo,t);return function(o){return Aa(s(o),e)}}function zc(i,e,t){const n=Hi(i,e);if(n===void 0)return null;const s=vi(n,yo,t);return function(o){const r=Aa(s(o),e);if(r.length!==2)throw new Error(`Expected two numbers for ${e}`);return r}}function H0(i,e,t){const n=Hi(i,e);if(n===void 0)return null;const s=vi(n,yo,t);return function(o){return Q0(s(o),e)}}function Nc(i,e,t){const n=Hi(i,e);if(n===void 0)return null;const s=vi(n,yo|Le,t);return function(o){return DC(s(o),e)}}function jd(i,e){const t=i[e];if(t!==void 0){if(typeof t!="number")throw new Error(`Expected a number for ${e}`);return t}}function OC(i,e){const t=i[e];if(t!==void 0){if(typeof t=="number")return $t(t);if(!Array.isArray(t))throw new Error(`Expected a number or size array for ${e}`);if(t.length!==2||typeof t[0]!="number"||typeof t[1]!="number")throw new Error(`Expected a number or size array for ${e}`);return t}}function AC(i,e){const t=i[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);return t}}function X0(i,e){const t=i[e];if(t!==void 0){if(t!=="bottom-left"&&t!=="bottom-right"&&t!=="top-left"&&t!=="top-right")throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return t}}function Y0(i,e){const t=i[e];if(t!==void 0){if(t!=="pixels"&&t!=="fraction")throw new Error(`Expected pixels or fraction for ${e}`);return t}}function MC(i,e){const t=i[e];if(t!==void 0)return Aa(t,e)}function kc(i,e){const t=i[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);if(t!=="declutter"&&t!=="obstacle"&&t!=="none")throw new Error(`Expected declutter, obstacle, or none for ${e}`);return t}}function Aa(i,e){if(!Array.isArray(i))throw new Error(`Expected an array for ${e}`);const t=i.length;for(let n=0;n<t;++n)if(typeof i[n]!="number")throw new Error(`Expected an array of numbers for ${e}`);return i}function Z0(i,e){if(typeof i!="string")throw new Error(`Expected a string for ${e}`);return i}function Ud(i,e){if(typeof i!="number")throw new Error(`Expected a number for ${e}`);return i}function K0(i,e){if(typeof i=="string")return i;const t=Aa(i,e),n=t.length;if(n<3||n>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return t}function Q0(i,e){const t=Aa(i,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function DC(i,e){return typeof i=="number"?i:Q0(i,e)}const ti={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function J0(i,e,t){return(function(n,s,o,r,a){if(!n)return;if(!s&&!e)return n;const l=e?0:o[0]*s,c=e?0:o[1]*s,h=a?a[0]:0,u=a?a[1]:0;let d=i[0]+l/2+h,f=i[2]-l/2+h,g=i[1]+c/2+u,_=i[3]-c/2+u;d>f&&(d=(f+d)/2,f=d),g>_&&(g=(_+g)/2,_=g);let v=ct(n[0],d,f),E=ct(n[1],g,_);if(r&&t&&s){const w=30*s;v+=-w*Math.log(1+Math.max(0,d-n[0])/w)+w*Math.log(1+Math.max(0,n[0]-f)/w),E+=-w*Math.log(1+Math.max(0,g-n[1])/w)+w*Math.log(1+Math.max(0,n[1]-_)/w)}return[v,E]})}function FC(i){return i}function Gd(i,e,t,n){const s=Te(e)/t[0],o=ft(e)/t[1];return n?Math.min(i,Math.max(s,o)):Math.min(i,Math.min(s,o))}function qd(i,e,t){let n=Math.min(i,e);const s=50;return n*=Math.log(1+s*Math.max(0,i/e-1))/s+1,t&&(n=Math.max(n,t),n/=Math.log(1+s*Math.max(0,t/i-1))/s+1),ct(n,t/2,e*2)}function LC(i,e,t,n){return e=e!==void 0?e:!0,(function(s,o,r,a){if(s!==void 0){const l=i[0],c=i[i.length-1],h=t?Gd(l,t,r,n):l;if(a)return e?qd(s,h,c):ct(s,c,h);const u=Math.min(h,s),d=Math.floor(Xl(i,u,o));return i[d]>h&&d<i.length-1?i[d+1]:i[d]}})}function zC(i,e,t,n,s,o){return n=n!==void 0?n:!0,t=t!==void 0?t:0,(function(r,a,l,c){if(r!==void 0){const h=s?Gd(e,s,l,o):e;if(c)return n?qd(r,h,t):ct(r,t,h);const u=1e-9,d=Math.ceil(Math.log(e/h)/Math.log(i)-u),f=-a*(.5-u)+.5,g=Math.min(h,r),_=Math.floor(Math.log(e/g)/Math.log(i)+f),v=Math.max(d,_),E=e/Math.pow(i,v);return ct(E,t,h)}})}function ey(i,e,t,n,s){return t=t!==void 0?t:!0,(function(o,r,a,l){if(o!==void 0){const c=n?Gd(i,n,a,s):i;return!t||!l?ct(o,e,c):qd(o,c,e)}})}function Vd(i){if(i!==void 0)return 0}function ty(i){if(i!==void 0)return i}function NC(i){const e=2*Math.PI/i;return(function(t,n){if(n)return t;if(t!==void 0)return t=Math.floor(t/e+.5)*e,t})}function kC(i){const e=gs(5);return(function(t,n){return n||t===void 0?t:Math.abs(t)<=e?0:t})}const ny=42,Wd=256,Bd=0;class bi extends mi{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Wu(e.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,e.projection&&Em(),e.center&&(e.center=qi(e.center,this.projection_)),e.extent&&(e.extent=yi(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){const t=Object.assign({},e);for(const a in ti)delete t[a];this.setProperties(t,!0);const n=UC(e);this.maxResolution_=n.maxResolution,this.minResolution_=n.minResolution,this.zoomFactor_=n.zoomFactor,this.resolutions_=e.resolutions,this.padding_=e.padding,this.minZoom_=n.minZoom;const s=jC(e),o=n.constraint,r=GC(e);this.constraints_={center:s,resolution:o,rotation:r},this.setRotation(e.rotation!==void 0?e.rotation:0),this.setCenterInternal(e.center!==void 0?e.center:null),e.resolution!==void 0?this.setResolution(e.resolution):e.zoom!==void 0&&this.setZoom(e.zoom)}get padding(){return this.padding_}set padding(e){let t=this.padding_;this.padding_=e;const n=this.getCenterInternal();if(n){const s=e||[0,0,0,0];t=t||[0,0,0,0];const o=this.getResolution(),r=o/2*(s[3]-t[3]+t[1]-s[1]),a=o/2*(s[0]-t[0]+t[2]-s[2]);this.setCenterInternal([n[0]+r,n[1]-a])}}getUpdatedOptions_(e){const t=this.getProperties();return t.resolution!==void 0?t.resolution=this.getResolution():t.zoom=this.getZoom(),t.center=this.getCenterInternal(),t.rotation=this.getRotation(),Object.assign({},t,e)}animate(e){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const t=new Array(arguments.length);for(let n=0;n<t.length;++n){let s=arguments[n];s.center&&(s=Object.assign({},s),s.center=qi(s.center,this.getProjection())),s.anchor&&(s=Object.assign({},s),s.anchor=qi(s.anchor,this.getProjection())),t[n]=s}this.animateInternal.apply(this,t)}animateInternal(e){let t=arguments.length,n;t>1&&typeof arguments[t-1]=="function"&&(n=arguments[t-1],--t);let s=0;for(;s<t&&!this.isDef();++s){const h=arguments[s];h.center&&this.setCenterInternal(h.center),h.zoom!==void 0?this.setZoom(h.zoom):h.resolution&&this.setResolution(h.resolution),h.rotation!==void 0&&this.setRotation(h.rotation)}if(s===t){n&&jc(n,!0);return}let o=Date.now(),r=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_;const c=[];for(;s<t;++s){const h=arguments[s],u={start:o,complete:!1,anchor:h.anchor,duration:h.duration!==void 0?h.duration:1e3,easing:h.easing||wv,callback:n};if(h.center&&(u.sourceCenter=r,u.targetCenter=h.center.slice(),r=u.targetCenter),h.zoom!==void 0?(u.sourceResolution=a,u.targetResolution=this.getResolutionForZoom(h.zoom),a=u.targetResolution):h.resolution&&(u.sourceResolution=a,u.targetResolution=h.resolution,a=u.targetResolution),h.rotation!==void 0){u.sourceRotation=l;const d=ms(h.rotation-l+Math.PI,2*Math.PI)-Math.PI;u.targetRotation=l+d,l=u.targetRotation}qC(u)?u.complete=!0:o+=u.duration,c.push(u)}this.animations_.push(c),this.setHint(ot.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[ot.ANIMATING]>0}getInteracting(){return this.hints_[ot.INTERACTING]>0}cancelAnimations(){this.setHint(ot.ANIMATING,-this.hints_[ot.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){const s=this.animations_[t];if(s[0].callback&&jc(s[0].callback,!1),!e)for(let o=0,r=s.length;o<r;++o){const a=s[o];if(!a.complete){e=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=e,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const e=Date.now();let t=!1;for(let 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 l=s[r];if(l.complete)continue;const c=e-l.start;let h=l.duration>0?c/l.duration:1;h>=1?(l.complete=!0,h=1):o=!1;const u=l.easing(h);if(l.sourceCenter){const d=l.sourceCenter[0],f=l.sourceCenter[1],g=l.targetCenter[0],_=l.targetCenter[1];this.nextCenter_=l.targetCenter;const v=d+u*(g-d),E=f+u*(_-f);this.targetCenter_=[v,E]}if(l.sourceResolution&&l.targetResolution){const d=u===1?l.targetResolution:l.sourceResolution+u*(l.targetResolution-l.sourceResolution);if(l.anchor){const f=this.getViewportSize_(this.getRotation()),g=this.constraints_.resolution(d,0,f,!0);this.targetCenter_=this.calculateCenterZoom(g,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=d,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){const d=u===1?ms(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+u*(l.targetRotation-l.sourceRotation);if(l.anchor){const f=this.constraints_.rotation(d,!0);this.targetCenter_=this.calculateCenterRotate(f,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=d}if(this.applyTargetState_(!0),t=!0,!l.complete)break}if(o){this.animations_[n]=null,this.setHint(ot.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const r=s[0].callback;r&&jc(r,!0)}}this.animations_=this.animations_.filter(Boolean),t&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let n;const s=this.getCenterInternal();return s!==void 0&&(n=[s[0]-t[0],s[1]-t[1]],zu(n,e-this.getRotation()),Lv(n,t)),n}calculateCenterZoom(e,t){let n;const s=this.getCenterInternal(),o=this.getResolution();if(s!==void 0&&o!==void 0){const r=t[0]-e*(t[0]-s[0])/o,a=t[1]-e*(t[1]-s[1])/o;n=[r,a]}return n}getViewportSize_(e){const t=this.viewportSize_;if(e){const n=t[0],s=t[1];return[Math.abs(n*Math.cos(e))+Math.abs(s*Math.sin(e)),Math.abs(n*Math.sin(e))+Math.abs(s*Math.cos(e))]}return t}setViewportSize(e){this.viewportSize_=Array.isArray(e)?e.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const e=this.getCenterInternal();return e&&Hu(e,this.getProjection())}getCenterInternal(){return this.get(ti.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(e){return e!==void 0?(e[0]=this.hints_[0],e[1]=this.hints_[1],e):this.hints_.slice()}calculateExtent(e){const t=this.calculateExtentInternal(e);return Xu(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();const t=this.getCenterInternal();Ve(t,"The view center is not defined");const n=this.getResolution();Ve(n!==void 0,"The view resolution is not defined");const s=this.getRotation();return Ve(s!==void 0,"The view rotation is not defined"),Kl(t,n,s,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get(ti.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(yi(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();const n=Te(e)/t[0],s=ft(e)/t[1];return Math.max(n,s)}getResolutionForValueFunction(e){e=e||2;const t=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,s=Math.log(t/n)/Math.log(e);return(function(o){return t/Math.pow(e,o*s)})}getRotation(){return this.get(ti.ROTATION)}getValueForResolutionFunction(e){const t=Math.log(e||2),n=this.getConstrainedResolution(this.maxResolution_),s=this.minResolution_,o=Math.log(n/s)/t;return(function(r){return Math.log(n/r)/t/o})}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e);const n=this.padding_;return n&&(t=[t[0]-n[1]-n[3],t[1]-n[0]-n[2]]),t}getState(){const e=this.getProjection(),t=this.getResolution(),n=this.getRotation();let s=this.getCenterInternal();const o=this.padding_;if(o){const r=this.getViewportSizeMinusPadding_();s=$d(s,this.getViewportSize_(),[r[0]/2+o[3],r[1]/2+o[0]],t,n)}return{center:s.slice(0),projection:e!==void 0?e:null,resolution:t,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let e;const t=this.getResolution();return t!==void 0&&(e=this.getZoomForResolution(t)),e}getZoomForResolution(e){let t=this.minZoom_||0,n,s;if(this.resolutions_){const o=Xl(this.resolutions_,e,1);t=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 t+Math.log(n/e)/Math.log(s)}getResolutionForZoom(e){var t;if((t=this.resolutions_)!=null&&t.length){if(this.resolutions_.length===1)return this.resolutions_[0];const n=ct(Math.floor(e),0,this.resolutions_.length-2),s=this.resolutions_[n]/this.resolutions_[n+1];return this.resolutions_[n]/Math.pow(s,ct(e-n,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let n;if(Ve(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(e)){Ve(!Ui(e),"Cannot fit empty extent provided as `geometry`");const s=yi(e,this.getProjection());n=cd(s)}else if(e.getType()==="Circle"){const s=yi(e.getExtent(),this.getProjection());n=cd(s),n.rotate(this.getRotation(),Tn(s))}else n=e;this.fitInternal(n,t)}rotatedExtentForGeometry(e){const t=this.getRotation(),n=Math.cos(t),s=Math.sin(-t),o=e.getFlatCoordinates(),r=e.getStride();let a=1/0,l=1/0,c=-1/0,h=-1/0;for(let u=0,d=o.length;u<d;u+=r){const f=o[u]*n-o[u+1]*s,g=o[u]*s+o[u+1]*n;a=Math.min(a,f),l=Math.min(l,g),c=Math.max(c,f),h=Math.max(h,g)}return[a,l,c,h]}fitInternal(e,t){t=t||{};let n=t.size;n||(n=this.getViewportSizeMinusPadding_());const s=t.padding!==void 0?t.padding:[0,0,0,0],o=t.nearest!==void 0?t.nearest:!1;let r;t.minResolution!==void 0?r=t.minResolution:t.maxZoom!==void 0?r=this.getResolutionForZoom(t.maxZoom):r=0;const a=this.rotatedExtentForGeometry(e);let l=this.getResolutionForExtentInternal(a,[n[0]-s[1]-s[3],n[1]-s[0]-s[2]]);l=isNaN(l)?r:Math.max(l,r),l=this.getConstrainedResolution(l,o?0:1);const c=this.getRotation(),h=Math.sin(c),u=Math.cos(c),d=Tn(a);d[0]+=(s[1]-s[3])/2*l,d[1]+=(s[0]-s[2])/2*l;const f=d[0]*u-d[1]*h,g=d[1]*u+d[0]*h,_=this.getConstrainedCenter([f,g],l),v=t.callback?t.callback:Kr;t.duration!==void 0?this.animateInternal({resolution:l,center:_,duration:t.duration,easing:t.easing},v):(this.targetResolution_=l,this.targetCenter_=_,this.applyTargetState_(!1,!0),jc(v,!0))}centerOn(e,t,n){this.centerOnInternal(qi(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal($d(e,t,n,this.getResolution(),this.getRotation()))}calculateCenterShift(e,t,n,s){let o;const r=this.padding_;if(r&&e){const a=this.getViewportSizeMinusPadding_(-n),l=$d(e,s,[a[0]/2+r[3],a[1]/2+r[0]],t,n);o=[e[0]-l[0],e[1]-l[1]]}return o}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(e){const t=Hu(this.targetCenter_,this.getProjection());this.setCenter([t[0]+e[0],t[1]+e[1]])}adjustCenterInternal(e){const t=this.targetCenter_;this.setCenterInternal([t[0]+e[0],t[1]+e[1]])}adjustResolution(e,t){t=t&&qi(t,this.getProjection()),this.adjustResolutionInternal(e,t)}adjustResolutionInternal(e,t){const n=this.getAnimating()||this.getInteracting(),s=this.getViewportSize_(this.getRotation()),o=this.constraints_.resolution(this.targetResolution_*e,0,s,n);t&&(this.targetCenter_=this.calculateCenterZoom(o,t)),this.targetResolution_*=e,this.applyTargetState_()}adjustZoom(e,t){this.adjustResolution(Math.pow(this.zoomFactor_,-e),t)}adjustRotation(e,t){t&&(t=qi(t,this.getProjection())),this.adjustRotationInternal(e,t)}adjustRotationInternal(e,t){const n=this.getAnimating()||this.getInteracting(),s=this.constraints_.rotation(this.targetRotation_+e,n);t&&(this.targetCenter_=this.calculateCenterRotate(s,t)),this.targetRotation_+=e,this.applyTargetState_()}setCenter(e){this.setCenterInternal(e&&qi(e,this.getProjection()))}setCenterInternal(e){this.targetCenter_=e,this.applyTargetState_()}setHint(e,t){return this.hints_[e]+=t,this.changed(),this.hints_[e]}setResolution(e){this.targetResolution_=e,this.applyTargetState_()}setRotation(e){this.targetRotation_=e,this.applyTargetState_()}setZoom(e){this.setResolution(this.getResolutionForZoom(e))}applyTargetState_(e,t){const n=this.getAnimating()||this.getInteracting()||t,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(ti.ROTATION)!==s&&this.set(ti.ROTATION,s),this.get(ti.RESOLUTION)!==r&&(this.set(ti.RESOLUTION,r),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(ti.CENTER)||!nc(this.get(ti.CENTER),a))&&this.set(ti.CENTER,a),this.getAnimating()&&!e&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(e,t,n){e=e!==void 0?e:200;const s=t||0,o=this.constraints_.rotation(this.targetRotation_),r=this.getViewportSize_(o),a=this.constraints_.resolution(this.targetResolution_,s,r),l=this.constraints_.center(this.targetCenter_,a,r,!1,this.calculateCenterShift(this.targetCenter_,a,o,r));if(e===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=o,this.targetCenter_=l,this.applyTargetState_();return}n=n||(e===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==o||!this.getCenterInternal()||!nc(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:o,center:l,resolution:a,duration:e,easing:Ks,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(ot.INTERACTING,1)}endInteraction(e,t,n){n=n&&qi(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(ot.INTERACTING,-1),this.resolveConstraints(e,t,n))}getConstrainedCenter(e,t){const n=this.getViewportSize_(this.getRotation());return this.constraints_.center(e,t||this.getResolution(),n)}getConstrainedZoom(e,t){const n=this.getResolutionForZoom(e);return this.getZoomForResolution(this.getConstrainedResolution(n,t))}getConstrainedResolution(e,t){t=t||0;const n=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(e,t,n)}}function jc(i,e){setTimeout(function(){i(e)},0)}function jC(i){if(i.extent!==void 0){const t=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return J0(i.extent,i.constrainOnlyCenter,t)}const e=Wu(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,J0(t,!1,!1)}return FC}function UC(i){let e,t,n,r=i.minZoom!==void 0?i.minZoom:Bd,a=i.maxZoom!==void 0?i.maxZoom:28;const l=i.zoomFactor!==void 0?i.zoomFactor:2,c=i.multiWorld!==void 0?i.multiWorld:!1,h=i.smoothResolutionConstraint!==void 0?i.smoothResolutionConstraint:!0,u=i.showFullExtent!==void 0?i.showFullExtent:!1,d=Wu(i.projection,"EPSG:3857"),f=d.getExtent();let g=i.constrainOnlyCenter,_=i.extent;if(!c&&!_&&d.isGlobal()&&(g=!1,_=f),i.resolutions!==void 0){const v=i.resolutions;t=v[r],n=v[a]!==void 0?v[a]:v[v.length-1],i.constrainResolution?e=LC(v,h,!g&&_,u):e=ey(t,n,h,!g&&_,u)}else{const E=(f?Math.max(Te(f),ft(f)):360*ic.degrees/d.getMetersPerUnit())/Wd/Math.pow(2,Bd),w=E/Math.pow(2,28-Bd);t=i.maxResolution,t!==void 0?r=0:t=E/Math.pow(l,r),n=i.minResolution,n===void 0&&(i.maxZoom!==void 0?i.maxResolution!==void 0?n=t/Math.pow(l,a):n=E/Math.pow(l,a):n=w),a=r+Math.floor(Math.log(t/n)/Math.log(l)),n=t/Math.pow(l,a-r),i.constrainResolution?e=zC(l,t,n,h,!g&&_,u):e=ey(t,n,h,!g&&_,u)}return{constraint:e,maxResolution:t,minResolution:n,minZoom:r,zoomFactor:l}}function GC(i){if(i.enableRotation!==void 0?i.enableRotation:!0){const t=i.constrainRotation;return t===void 0||t===!0?kC():t===!1?ty:typeof t=="number"?NC(t):ty}return Vd}function qC(i){return!(i.sourceCenter&&i.targetCenter&&!nc(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function $d(i,e,t,n,s){const o=Math.cos(-s);let r=Math.sin(-s),a=i[0]*o-i[1]*r,l=i[1]*o+i[0]*r;a+=(e[0]/2-t[0])*n,l+=(t[1]-e[1]/2)*n,r=-r;const c=a*o-l*r,h=l*o+a*r;return[c,h]}const Ye={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};class iy extends mi{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;const t=Object.assign({},e);typeof e.properties=="object"&&(delete t.properties,Object.assign(t,e.properties)),t[Ye.OPACITY]=e.opacity!==void 0?e.opacity:1,Ve(typeof t[Ye.OPACITY]=="number","Layer opacity must be a number"),t[Ye.VISIBLE]=e.visible!==void 0?e.visible:!0,t[Ye.Z_INDEX]=e.zIndex,t[Ye.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[Ye.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[Ye.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[Ye.MAX_ZOOM]=e.maxZoom!==void 0?e.maxZoom:1/0,this.className_=t.className!==void 0?t.className:"ol-layer",delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){const t=this.state_||{layer:this,managed:e===void 0?!0:e},n=this.getZIndex();return t.opacity=ct(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=n===void 0&&!t.managed?1/0:n,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return we()}getLayerStatesArray(e){return we()}getExtent(){return this.get(Ye.EXTENT)}getMaxResolution(){return this.get(Ye.MAX_RESOLUTION)}getMinResolution(){return this.get(Ye.MIN_RESOLUTION)}getMinZoom(){return this.get(Ye.MIN_ZOOM)}getMaxZoom(){return this.get(Ye.MAX_ZOOM)}getOpacity(){return this.get(Ye.OPACITY)}getSourceState(){return we()}getVisible(){return this.get(Ye.VISIBLE)}getZIndex(){return this.get(Ye.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(Ye.EXTENT,e)}setMaxResolution(e){this.set(Ye.MAX_RESOLUTION,e)}setMinResolution(e){this.set(Ye.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(Ye.MAX_ZOOM,e)}setMinZoom(e){this.set(Ye.MIN_ZOOM,e)}setOpacity(e){Ve(typeof e=="number","Layer opacity must be a number"),this.set(Ye.OPACITY,e)}setVisible(e){this.set(Ye.VISIBLE,e)}setZIndex(e){this.set(Ye.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}class Ma extends iy{constructor(e){const t=Object.assign({},e);delete t.source,super(t),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,e.render&&(this.render=e.render),e.map&&this.setMap(e.map),this.addChangeListener(Ye.SOURCE,this.handleSourcePropertyChange_);const n=e.source?e.source:null;this.setSource(n)}getLayersArray(e){return e=e||[],e.push(this),e}getLayerStatesArray(e){return e=e||[],e.push(this.getLayerState()),e}getSource(){return this.get(Ye.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){const e=this.getSource();return e?e.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(st(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const e=this.getSource();e&&(this.sourceChangeKey_=Ue(e,_e.CHANGE,this.handleSourceChange_,this),e.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}isVisible(e){let t;const n=this.getMapInternal();!e&&n&&(e=n.getView()),e instanceof bi?t={viewState:e.getState(),extent:e.calculateExtent()}:t=e,!t.layerStatesArray&&n&&(t.layerStatesArray=n.getLayerGroup().getLayerStatesArray());let s;if(t.layerStatesArray){if(s=t.layerStatesArray.find(r=>r.layer===this),!s)return!1}else s=this.getLayerState();const o=this.getExtent();return Hd(s,t.viewState)&&(!o||pt(o,t.extent))}getAttributions(e){var o;if(!this.isVisible(e))return[];const t=(o=this.getSource())==null?void 0:o.getAttributions();if(!t)return[];const n=e instanceof bi?e.getViewStateAndExtent():e;let s=t(n);return Array.isArray(s)||(s=[s]),s}render(e,t){const n=this.getRenderer();return n.prepareFrame(e)?(this.rendered=!0,n.renderFrame(e,t)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(e,t){}renderDeferred(e){const t=this.getRenderer();t&&t.renderDeferred(e)}setMapInternal(e){e||this.unrender(),this.set(Ye.MAP,e)}getMapInternal(){return this.get(Ye.MAP)}setMap(e){this.mapPrecomposeKey_&&(st(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(st(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=Ue(e,Mn.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=Ue(this,_e.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){const t=e.frameState.layerStatesArray,n=this.getLayerState(!1);Ve(!t.some(s=>s.layer===n.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),t.push(n)}setSource(e){this.set(Ye.SOURCE,e)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}}function Hd(i,e){if(!i.visible)return!1;const t=e.resolution;if(t<i.minResolution||t>=i.maxResolution)return!1;const n=e.zoom;return n>i.minZoom&&n<=i.maxZoom}const sy={RENDER_ORDER:"renderOrder"};class Uc extends Ma{constructor(e){e=e||{};const t=Object.assign({},e);delete t.style,delete t.renderBuffer,delete t.updateWhileAnimating,delete t.updateWhileInteracting,super(t),this.declutter_=e.declutter?String(e.declutter):void 0,this.renderBuffer_=e.renderBuffer!==void 0?e.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(e.style),this.updateWhileAnimating_=e.updateWhileAnimating!==void 0?e.updateWhileAnimating:!1,this.updateWhileInteracting_=e.updateWhileInteracting!==void 0?e.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(e){return super.getFeatures(e)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(sy.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(e,t){const n=this.getDeclutter();n in e.declutter||(e.declutter[n]=new Td(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(sy.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?C0:e;const t=VC(e);this.styleFunction_=e===null?void 0:DE(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}}function VC(i){if(i===void 0)return C0;if(!i)return null;if(typeof i=="function"||i instanceof $e)return i;if(!Array.isArray(i))return B0([i]);if(i.length===0)return[];const e=i.length,t=i[0];if(t instanceof $e){const s=new Array(e);for(let o=0;o<e;++o){const r=i[o];if(!(r instanceof $e))throw new Error("Expected a list of style instances");s[o]=r}return s}if("style"in t){const s=new Array(e);for(let o=0;o<e;++o){const r=i[o];if(!("style"in r))throw new Error("Expected a list of rules with a style property");s[o]=r}return EC(s)}return B0(i)}class zn extends Uc{constructor(e){super(e)}createRenderer(){return new k0(this)}}class oy extends vc{constructor(e,t,n,s,o){const r=o!==void 0?le.IDLE:le.LOADED;super(e,t,n,r),this.loader_=o!==void 0?o:null,this.canvas_=s,this.error_=null}getError(){return this.error_}handleLoad_(e){e?(this.error_=e,this.state=le.ERROR):this.state=le.LOADED,this.changed()}load(){this.state==le.IDLE&&(this.state=le.LOADING,this.changed(),this.loader_(this.handleLoad_.bind(this)))}getImage(){return this.canvas_}}const se={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class Da extends Jr{constructor(e,t,n){super(),n=n||{},this.tileCoord=e,this.state=t,this.key="",this.transition_=n.transition===void 0?250:n.transition,this.transitionStarts_={},this.interpolate=!!n.interpolate}changed(){this.dispatchEvent(_e.CHANGE)}release(){this.setState(se.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(e){if(this.state!==se.EMPTY){if(this.state!==se.ERROR&&this.state>e)throw new Error("Tile load sequence violation");this.state=e,this.changed()}}load(){we()}getAlpha(e,t){if(!this.transition_)return 1;let n=this.transitionStarts_[e];if(!n)n=t,this.transitionStarts_[e]=n;else if(n===-1)return 1;const s=t-n+1e3/60;return s>=this.transition_?1:$g(s/this.transition_)}inTransition(e){return this.transition_?this.transitionStarts_[e]!==-1:!1}endTransition(e){this.transition_&&(this.transitionStarts_[e]=-1)}disposeInternal(){this.release(),super.disposeInternal()}}class ry extends Da{constructor(e,t,n,s,o,r){super(e,t,r),this.crossOrigin_=s==null?void 0:s.crossOrigin,this.referrerPolicy_=s==null?void 0:s.referrerPolicy,this.src_=n,this.key=n,this.image_,hn?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=o}getImage(){return this.image_}setImage(e){this.image_=e,this.state=se.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=se.ERROR,this.unlistenImage_(),this.image_=WC(),this.changed()}handleImageLoad_(){if(hn)this.state=se.LOADED;else{const e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=se.LOADED:this.state=se.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==se.ERROR&&(this.state=se.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==se.IDLE&&(this.state=se.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=Qb(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}}function WC(){const i=ht(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}class BC{constructor(e,t,n){this.decay_=e,this.minVelocity_=t,this.delay_=n,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(e,t){this.points_.push(e,t,Date.now())}end(){if(this.points_.length<6)return!1;const e=Date.now()-this.delay_,t=this.points_.length-3;if(this.points_[t+2]<e)return!1;let n=t-3;for(;n>0&&this.points_[n+2]>e;)n-=3;const s=this.points_[t+2]-this.points_[n+2];if(s<1e3/60)return!1;const o=this.points_[t]-this.points_[n],r=this.points_[t+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 lr extends Yn{constructor(e,t,n){super(e),this.map=t,this.frameState=n!==void 0?n:null}}class Rs extends lr{constructor(e,t,n,s,o,r){super(e,t,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(e){this.pixel_=e}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(e){this.coordinate_=e}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}}const bt={SINGLECLICK:"singleclick",CLICK:_e.CLICK,DBLCLICK:_e.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},Xd={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown"};class $C extends Jr{constructor(e,t){super(e),this.map_=e,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=t===void 0?1:t,this.down_=null;const n=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=n,this.pointerdownListenerKey_=Ue(n,Xd.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=Ue(n,Xd.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(_e.TOUCHMOVE,this.boundHandleTouchMove_,Hm?{passive:!1}:!1)}emulateClick_(e){let t=new Rs(bt.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new Rs(bt.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const n=new Rs(bt.SINGLECLICK,this.map_,e);this.dispatchEvent(n)},250)}updateActivePointers_(e){const t=e,n=t.pointerId;if(t.type==bt.POINTERUP||t.type==bt.POINTERCANCEL){delete this.trackedTouches_[n];for(const s in this.trackedTouches_)if(this.trackedTouches_[s].target!==t.target){delete this.trackedTouches_[s];break}}else(t.type==bt.POINTERDOWN||t.type==bt.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);const t=new Rs(bt.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(st),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return e.button===0}handlePointerDown_(e){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(e);const t=new Rs(bt.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);if(this.dispatchEvent(t),this.down_=new PointerEvent(e.type,e),Object.defineProperty(this.down_,"target",{writable:!1,value:e.target}),this.dragListenerKeys_.length===0){const n=this.map_.getOwnerDocument();this.dragListenerKeys_.push(Ue(n,bt.POINTERMOVE,this.handlePointerMove_,this),Ue(n,bt.POINTERUP,this.handlePointerUp_,this),Ue(this.element_,bt.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(Ue(this.element_.getRootNode(),bt.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;const t=new Rs(bt.POINTERDRAG,this.map_,e,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(t)}}relayMoveEvent_(e){this.originalPointerMoveEvent_=e;const t=!!(this.down_&&this.isMoving_(e));this.dispatchEvent(new Rs(bt.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){const t=this.originalPointerMoveEvent_;(!t||t.defaultPrevented)&&(typeof e.cancelable!="boolean"||e.cancelable===!0)&&e.preventDefault()}isMoving_(e){return this.dragging_||Math.abs(e.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(e.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(st(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(_e.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(st(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(st),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const Ts={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},Ht={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},Gc=1/0;class HC{constructor(e,t){this.priorityFunction_=e,this.keyFunction_=t,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,Qr(this.queuedElements_)}dequeue(){const e=this.elements_,t=this.priorities_,n=e[0];e.length==1?(e.length=0,t.length=0):(e[0]=e.pop(),t[0]=t.pop(),this.siftUp_(0));const s=this.keyFunction_(n);return delete this.queuedElements_[s],n}enqueue(e){Ve(!(this.keyFunction_(e)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const t=this.priorityFunction_(e);return t!=Gc?(this.elements_.push(e),this.priorities_.push(t),this.queuedElements_[this.keyFunction_(e)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(e){return e*2+1}getRightChildIndex_(e){return e*2+2}getParentIndex_(e){return e-1>>1}heapify_(){let e;for(e=(this.elements_.length>>1)-1;e>=0;e--)this.siftUp_(e)}isEmpty(){return this.elements_.length===0}isKeyQueued(e){return e in this.queuedElements_}isQueued(e){return this.isKeyQueued(this.keyFunction_(e))}siftUp_(e){const t=this.elements_,n=this.priorities_,s=t.length,o=t[e],r=n[e],a=e;for(;e<s>>1;){const l=this.getLeftChildIndex_(e),c=this.getRightChildIndex_(e),h=c<s&&n[c]<n[l]?c:l;t[e]=t[h],n[e]=n[h],e=h}t[e]=o,n[e]=r,this.siftDown_(a,e)}siftDown_(e,t){const n=this.elements_,s=this.priorities_,o=n[t],r=s[t];for(;t>e;){const a=this.getParentIndex_(t);if(s[a]>r)n[t]=n[a],s[t]=s[a],t=a;else break}n[t]=o,s[t]=r}reprioritize(){const e=this.priorityFunction_,t=this.elements_,n=this.priorities_;let s=0;const o=t.length;let r,a,l;for(a=0;a<o;++a)r=t[a],l=e(r),l==Gc?delete this.queuedElements_[this.keyFunction_(r)]:(n[s]=l,t[s++]=r);t.length=s,n.length=s,this.heapify_()}}class ay extends HC{constructor(e,t){super(n=>e.apply(null,n),n=>n[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=t,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(e){const t=super.enqueue(e);return t&&e[0].addEventListener(_e.CHANGE,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){const t=e.target,n=t.getState();if(n===se.LOADED||n===se.ERROR||n===se.EMPTY){n!==se.ERROR&&t.removeEventListener(_e.CHANGE,this.boundHandleTileChange_);const s=t.getKey();s in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[s],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(e,t){let n=0;for(;this.tilesLoading_<e&&n<t&&this.getCount()>0;){const s=this.dequeue()[0],o=s.getKey();s.getState()===se.IDLE&&!(o in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[o]=!0,++this.tilesLoading_,++n,s.load())}}}function XC(i,e,t,n,s){if(!i||!(t in i.wantedTiles)||!i.wantedTiles[t][e.getKey()])return Gc;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 Yd extends mi{constructor(e){super();const t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents="auto"),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){var e;(e=this.element)==null||e.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(e){var t;this.map_&&((t=this.element)==null||t.remove());for(let n=0,s=this.listenerKeys.length;n<s;++n)st(this.listenerKeys[n]);if(this.listenerKeys.length=0,this.map_=e,e){const n=this.target_??e.getOverlayContainerStopEvent();this.element&&n.appendChild(this.element),this.render!==Kr&&this.listenerKeys.push(Ue(e,Ts.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}}class YC extends Yd{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=e.collapsed!==void 0?e.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=e.collapsible!==void 0,this.collapsible_=e.collapsible!==void 0?e.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=e.attributions;const t=e.className!==void 0?e.className:"ol-attribution",n=e.tipLabel!==void 0?e.tipLabel:"Attributions",s=e.expandClassName!==void 0?e.expandClassName:t+"-expand",o=e.collapseLabel!==void 0?e.collapseLabel:"›",r=e.collapseClassName!==void 0?e.collapseClassName:t+"-collapse";typeof o=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=o,this.collapseLabel_.className=r):this.collapseLabel_=o;const a=e.label!==void 0?e.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=s):this.label_=a;const l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=n,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(_e.CLICK,this.handleClick_.bind(this),!1);const c=t+" "+Cc+" "+Cd+(this.collapsed_&&this.collapsible_?" "+n0:"")+(this.collapsible_?"":" ol-uncollapsible"),h=this.element;h.className=c,h.appendChild(this.toggleButton_),h.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(e){const t=this.getMap().getAllLayers(),n=new Set(t.flatMap(s=>s.getAttributions(e)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(s=>n.add(s)):n.add(this.attributions_)),!this.overrideCollapsible_){const s=!t.some(o=>{var r;return((r=o.getSource())==null?void 0:r.getAttributionsCollapsible())===!1});this.setCollapsible(s)}return Array.from(n)}async updateElement_(e){if(!e){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const t=await Promise.all(this.collectSourceAttributions_(e).map(s=>$o(()=>s))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!ps(t,this.renderedAttributions_)){Gb(this.ulElement_);for(let s=0,o=t.length;s<o;++s){const r=document.createElement("li");r.innerHTML=t[s],this.ulElement_.appendChild(r)}this.renderedAttributions_=t}}handleClick_(e){e.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(n0),this.collapsed_?Xm(this.collapseLabel_,this.label_):Xm(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(e){this.collapsible_!==e&&(this.collapsible_=e,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(e){this.userCollapsed_=e,!(!this.collapsible_||this.collapsed_===e)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(e){this.updateElement_(e.frameState)}}class ZC extends Yd{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target});const t=e.className!==void 0?e.className:"ol-rotate",n=e.label!==void 0?e.label:"⇧",s=e.compassClassName!==void 0?e.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=e.tipLabel?e.tipLabel:"Reset rotation",r=document.createElement("button");r.className=t+"-reset",r.setAttribute("type","button"),r.title=o,r.appendChild(this.label_),r.addEventListener(_e.CLICK,this.handleClick_.bind(this),!1);const a=t+" "+Cc+" "+Cd,l=this.element;l.className=a,l.appendChild(r),this.callResetNorth_=e.resetNorth?e.resetNorth:void 0,this.duration_=e.duration!==void 0?e.duration:250,this.autoHide_=e.autoHide!==void 0?e.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Ec)}handleClick_(e){e.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const t=this.getMap().getView();if(!t)return;const n=t.getRotation();n!==void 0&&(this.duration_>0&&n%(2*Math.PI)!==0?t.animate({rotation:0,duration:this.duration_,easing:Ks}):t.setRotation(0))}render(e){const t=e.frameState;if(!t)return;const n=t.viewState.rotation;if(n!=this.rotation_){const s="rotate("+n+"rad)";if(this.autoHide_){const o=this.element.classList.contains(Ec);!o&&n===0?this.element.classList.add(Ec):o&&n!==0&&this.element.classList.remove(Ec)}this.label_.style.transform=s}this.rotation_=n}}class KC extends Yd{constructor(e){e=e||{},super({element:document.createElement("div"),target:e.target});const t=e.className!==void 0?e.className:"ol-zoom",n=e.delta!==void 0?e.delta:1,s=e.zoomInClassName!==void 0?e.zoomInClassName:t+"-in",o=e.zoomOutClassName!==void 0?e.zoomOutClassName:t+"-out",r=e.zoomInLabel!==void 0?e.zoomInLabel:"+",a=e.zoomOutLabel!==void 0?e.zoomOutLabel:"–",l=e.zoomInTipLabel!==void 0?e.zoomInTipLabel:"Zoom in",c=e.zoomOutTipLabel!==void 0?e.zoomOutTipLabel:"Zoom out",h=document.createElement("button");h.className=s,h.setAttribute("type","button"),h.title=l,h.appendChild(typeof r=="string"?document.createTextNode(r):r),h.addEventListener(_e.CLICK,this.handleClick_.bind(this,n),!1);const u=document.createElement("button");u.className=o,u.setAttribute("type","button"),u.title=c,u.appendChild(typeof a=="string"?document.createTextNode(a):a),u.addEventListener(_e.CLICK,this.handleClick_.bind(this,-n),!1);const d=t+" "+Cc+" "+Cd,f=this.element;f.className=d,f.appendChild(h),f.appendChild(u),this.duration_=e.duration!==void 0?e.duration:250}handleClick_(e,t){t.preventDefault(),this.zoomByDelta_(e)}zoomByDelta_(e){const n=this.getMap().getView();if(!n)return;const s=n.getZoom();if(s!==void 0){const o=n.getConstrainedZoom(s+e);this.duration_>0?(n.getAnimating()&&n.cancelAnimations(),n.animate({zoom:o,duration:this.duration_,easing:Ks})):n.setZoom(o)}}}function ly(i){i=i||{};const e=new On;return(i.zoom!==void 0?i.zoom:!0)&&e.push(new KC(i.zoomOptions)),(i.rotate!==void 0?i.rotate:!0)&&e.push(new ZC(i.rotateOptions)),(i.attribution!==void 0?i.attribution:!0)&&e.push(new YC(i.attributionOptions)),e}const cy={ACTIVE:"active"};class Fa extends mi{constructor(e){super(),this.on,this.once,this.un,e&&e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(cy.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(cy.ACTIVE,e)}setMap(e){this.map_=e}}function QC(i,e,t){const n=i.getCenterInternal();if(n){const s=[n[0]+e[0],n[1]+e[1]];i.animateInternal({duration:t!==void 0?t:250,easing:vv,center:i.getConstrainedCenter(s)})}}function Zd(i,e,t,n){const s=i.getZoom();if(s===void 0)return;const o=i.getConstrainedZoom(s+e),r=i.getResolutionForZoom(o);i.getAnimating()&&i.cancelAnimations(),i.animate({resolution:r,anchor:t,duration:n!==void 0?n:250,easing:Ks})}class JC extends Fa{constructor(e){super(),e=e||{},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:250}handleEvent(e){let t=!1;if(e.type==bt.DBLCLICK){const n=e.originalEvent,s=e.map,o=e.coordinate,r=n.shiftKey?-this.delta_:this.delta_,a=s.getView();Zd(a,r,o,this.duration_),n.preventDefault(),t=!0}return!t}}function Kd(i){const e=arguments;return function(t){let n=!0;for(let s=0,o=e.length;s<o&&(n=n&&e[s](t),!!n);++s);return n}}const ex=function(i){const e=i.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},tx=function(i){const e=i.map.getTargetElement(),t=e.getRootNode(),n=i.map.getOwnerDocument().activeElement;return t instanceof ShadowRoot?t.host.contains(n):e.contains(n)},hy=function(i){const e=i.map.getTargetElement(),t=e.getRootNode();return(t instanceof ShadowRoot?t.host:e).hasAttribute("tabindex")?tx(i):!0},nx=Zr,uy=function(i){const e=i.originalEvent;return"pointerId"in e&&e.button==0&&!(jb&&Bm&&e.ctrlKey)},dy=function(i){const e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},ix=function(i){const e=i.originalEvent;return Bm?e.metaKey:e.ctrlKey},sx=function(i){const e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},fy=function(i){const e=i.originalEvent,t=e.target.tagName;return t!=="INPUT"&&t!=="SELECT"&&t!=="TEXTAREA"&&!e.target.isContentEditable},Qd=function(i){const e=i.originalEvent;return"pointerId"in e&&e.pointerType=="mouse"},ox=function(i){const e=i.originalEvent;return"pointerId"in e&&e.isPrimary&&e.button===0};class La extends Fa{constructor(e){e=e||{},super(e),e.handleDownEvent&&(this.handleDownEvent=e.handleDownEvent),e.handleDragEvent&&(this.handleDragEvent=e.handleDragEvent),e.handleMoveEvent&&(this.handleMoveEvent=e.handleMoveEvent),e.handleUpEvent&&(this.handleUpEvent=e.handleUpEvent),e.stopDown&&(this.stopDown=e.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(e){return!1}handleDragEvent(e){}handleEvent(e){if(!e.originalEvent)return!0;let t=!1;if(this.updateTrackedPointers_(e),this.handlingDownUpSequence){if(e.type==bt.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==bt.POINTERUP){const n=this.handleUpEvent(e);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(e.type==bt.POINTERDOWN){const n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==bt.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}}function Jd(i){const e=i.length;let t=0,n=0;for(let s=0;s<e;s++)t+=i[s].clientX,n+=i[s].clientY;return{clientX:t/e,clientY:n/e}}class rx extends La{constructor(e){super({stopDown:ec}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const t=e.condition?e.condition:Kd(dy,ox);this.condition_=e.onFocusOnly?Kd(hy,t):t,this.noKinetic_=!1}handleDragEvent(e){const t=e.map;this.panning_||(this.panning_=!0,t.getView().beginInteraction());const n=this.targetPointers,s=t.getEventPixel(Jd(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=e.map.getView();zv(o,a.getResolution()),zu(o,a.getRotation()),a.adjustCenterInternal(o)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=s,this.lastPointersCount_=n.length,e.originalEvent.preventDefault()}handleUpEvent(e){const t=e.map,n=t.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const s=this.kinetic_.getDistance(),o=this.kinetic_.getAngle(),r=n.getCenterInternal(),a=t.getPixelFromCoordinateInternal(r),l=t.getCoordinateFromPixelInternal([a[0]-s*Math.cos(o),a[1]-s*Math.sin(o)]);n.animateInternal({center:n.getConstrainedCenter(l),duration:500,easing:Ks})}return this.panning_&&(this.panning_=!1,n.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(e){if(this.targetPointers.length>0&&this.condition_(e)){const n=e.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 ax extends La{constructor(e){e=e||{},super({stopDown:ec}),this.condition_=e.condition?e.condition:ex,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!Qd(e))return;const t=e.map,n=t.getView();if(n.getConstraints().rotation===Vd)return;const s=t.getSize(),o=e.pixel,r=Math.atan2(s[1]/2-o[1],o[0]-s[0]/2);if(this.lastAngle_!==void 0){const a=r-this.lastAngle_;n.adjustRotationInternal(-a)}this.lastAngle_=r}handleUpEvent(e){return Qd(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return Qd(e)&&uy(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}class lx extends Yr{constructor(e){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+e,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const e=this.startPixel_,t=this.endPixel_,n="px",s=this.element_.style;s.left=Math.min(e[0],t[0])+n,s.top=Math.min(e[1],t[1])+n,s.width=Math.abs(t[0]-e[0])+n,s.height=Math.abs(t[1]-e[1])+n}setMap(e){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=e,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(e,t){this.startPixel_=e,this.endPixel_=t,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;const e=this.startPixel_,t=this.endPixel_,s=[e,[e[0],t[1]],t,[t[0],e[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);s[4]=s[0].slice(),this.geometry_?this.geometry_.setCoordinates([s]):this.geometry_=new Kn([s])}getGeometry(){return this.geometry_}}const cr={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class za extends Yn{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}}class cx extends La{constructor(e){super(),this.on,this.once,this.un,e=e??{},this.box_=new lx(e.className||"ol-dragbox"),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??uy,this.boxEndCondition_=e.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(e,t,n){const s=n[0]-t[0],o=n[1]-t[1];return s*s+o*o>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(e){this.startPixel_&&(this.box_.setPixels(this.startPixel_,e.pixel),this.dispatchEvent(new za(cr.BOXDRAG,e.coordinate,e)))}handleUpEvent(e){if(!this.startPixel_)return!1;const t=this.boxEndCondition_(e,this.startPixel_,e.pixel);return t&&this.onBoxEnd(e),this.dispatchEvent(new za(t?cr.BOXEND:cr.BOXCANCEL,e.coordinate,e)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(e){return this.condition_(e)?(this.startPixel_=e.pixel,this.box_.setMap(e.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new za(cr.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new za(cr.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new za(cr.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(e)}}class hx extends cx{constructor(e){e=e||{};const t=e.condition?e.condition:sx;super({condition:t,className:e.className||"ol-dragzoom",minArea:e.minArea}),this.duration_=e.duration!==void 0?e.duration:200,this.out_=e.out!==void 0?e.out:!1}onBoxEnd(e){const 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:Ks})}}const _o={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};class ux extends Fa{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return dy(t)&&fy(t)},this.condition_=e.condition!==void 0?e.condition:this.defaultCondition_,this.duration_=e.duration!==void 0?e.duration:100,this.pixelDelta_=e.pixelDelta!==void 0?e.pixelDelta:128}handleEvent(e){let t=!1;if(e.type==_e.KEYDOWN){const n=e.originalEvent,s=n.key;if(this.condition_(e)&&(s==_o.DOWN||s==_o.LEFT||s==_o.RIGHT||s==_o.UP)){const r=e.map.getView(),a=r.getResolution()*this.pixelDelta_;let l=0,c=0;s==_o.DOWN?c=-a:s==_o.LEFT?l=-a:s==_o.RIGHT?l=a:c=a;const h=[l,c];zu(h,r.getRotation()),QC(r,h,this.duration_),n.preventDefault(),t=!0}}return!t}}class dx extends Fa{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(t){return!ix(t)&&fy(t)},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:100}handleEvent(e){let t=!1;if(e.type==_e.KEYDOWN||e.type==_e.KEYPRESS){const n=e.originalEvent,s=n.key;if(this.condition_(e)&&(s==="+"||s==="-")){const o=e.map,r=s==="+"?this.delta_:-this.delta_,a=o.getView();Zd(a,r,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}}const fx=40,px=300;class gx extends Fa{constructor(e){e=e||{},super(e),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=e.maxDelta!==void 0?e.maxDelta:1,this.duration_=e.duration!==void 0?e.duration:250,this.timeout_=e.timeout!==void 0?e.timeout:80,this.useAnchor_=e.useAnchor!==void 0?e.useAnchor:!0,this.constrainResolution_=e.constrainResolution!==void 0?e.constrainResolution:!1;const t=e.condition?e.condition:nx;this.condition_=e.onFocusOnly?Kd(hy,t):t,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const e=this.getMap();if(!e)return;e.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(e){if(!this.condition_(e)||e.type!==_e.WHEEL)return!0;const n=e.map,s=e.originalEvent;s.preventDefault(),this.useAnchor_&&(this.lastAnchor_=e.pixel);let o=s.deltaY;switch(s.deltaMode){case WheelEvent.DOM_DELTA_LINE:o*=fx;break;case WheelEvent.DOM_DELTA_PAGE:o*=px;break}if(o===0)return!1;this.lastDelta_=o;const r=Date.now();this.startTime_===void 0&&(this.startTime_=r),(!this.mode_||r-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(o)<4?"trackpad":"wheel");const a=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_?n.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=r,!1;this.totalDelta_+=o;const l=Math.max(this.timeout_-(r-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,n),l),!1}handleWheelZoom_(e){const t=e.getView();t.getAnimating()&&t.cancelAnimations();let n=-ct(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),Zd(t,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(e){this.useAnchor_=e,e||(this.lastAnchor_=null)}}class mx extends La{constructor(e){e=e||{};const t=e;t.stopDown||(t.stopDown=ec),super(t),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=e.threshold!==void 0?e.threshold:.3,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){let t=0;const 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 l=o-this.lastAngle_;this.rotationDelta_+=l,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),t=l}this.lastAngle_=o;const r=e.map,a=r.getView();a.getConstraints().rotation!==Vd&&(this.anchor_=r.getCoordinateFromPixelInternal(r.getEventPixel(Jd(this.targetPointers))),this.rotating_&&(r.render(),a.adjustRotationInternal(t,this.anchor_)))}handleUpEvent(e){return this.targetPointers.length<2?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){if(this.targetPointers.length>=2){const t=e.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}}class yx extends La{constructor(e){e=e||{};const t=e;t.stopDown||(t.stopDown=ec),super(t),this.anchor_=null,this.duration_=e.duration!==void 0?e.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(e){let t=1;const 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&&(t=this.lastDistance_/a),this.lastDistance_=a;const l=e.map,c=l.getView();t!=1&&(this.lastScaleDelta_=t),this.anchor_=l.getCoordinateFromPixelInternal(l.getEventPixel(Jd(this.targetPointers))),l.render(),c.adjustResolutionInternal(t,this.anchor_)}handleUpEvent(e){if(this.targetPointers.length<2){const n=e.map.getView(),s=this.lastScaleDelta_>1?1:-1;return n.endInteraction(this.duration_,s),!1}return!0}handleDownEvent(e){if(this.targetPointers.length>=2){const t=e.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}}function py(i){i=i||{};const e=new On,t=new BC(-.005,.05,100);return(i.altShiftDragRotate!==void 0?i.altShiftDragRotate:!0)&&e.push(new ax),(i.doubleClickZoom!==void 0?i.doubleClickZoom:!0)&&e.push(new JC({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan!==void 0?i.dragPan:!0)&&e.push(new rx({onFocusOnly:i.onFocusOnly,kinetic:t})),(i.pinchRotate!==void 0?i.pinchRotate:!0)&&e.push(new mx),(i.pinchZoom!==void 0?i.pinchZoom:!0)&&e.push(new yx({duration:i.zoomDuration})),(i.keyboard!==void 0?i.keyboard:!0)&&(e.push(new ux),e.push(new dx({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom!==void 0?i.mouseWheelZoom:!0)&&e.push(new gx({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom!==void 0?i.shiftDragZoom:!0)&&e.push(new hx({duration:i.zoomDuration})),e}const Is={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"};class Os extends Yn{constructor(e,t){super(e),this.layer=t}}const ef={LAYERS:"layers"};class As extends iy{constructor(e){e=e||{};const t=Object.assign({},e);delete t.layers;let n=e.layers;super(t),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(ef.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new On(n.slice(),{unique:!0}):Ve(typeof n.getArray=="function","Expected `layers` to be an array or a `Collection`"):n=new On(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(st),this.layersListenerKeys_.length=0;const e=this.getLayers();this.layersListenerKeys_.push(Ue(e,cn.ADD,this.handleLayersAdd_,this),Ue(e,cn.REMOVE,this.handleLayersRemove_,this));for(const n in this.listenerKeys_)this.listenerKeys_[n].forEach(st);Qr(this.listenerKeys_);const t=e.getArray();for(let n=0,s=t.length;n<s;n++){const o=t[n];this.registerLayerListeners_(o),this.dispatchEvent(new Os(Is.ADDLAYER,o))}this.changed()}registerLayerListeners_(e){const t=[Ue(e,Bo.PROPERTYCHANGE,this.handleLayerChange_,this),Ue(e,_e.CHANGE,this.handleLayerChange_,this)];e instanceof As&&t.push(Ue(e,Is.ADDLAYER,this.handleLayerGroupAdd_,this),Ue(e,Is.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Pe(e)]=t}handleLayerGroupAdd_(e){this.dispatchEvent(new Os(Is.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new Os(Is.REMOVELAYER,e.layer))}handleLayersAdd_(e){const t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new Os(Is.ADDLAYER,t)),this.changed()}handleLayersRemove_(e){const t=e.element,n=Pe(t);this.listenerKeys_[n].forEach(st),delete this.listenerKeys_[n],this.dispatchEvent(new Os(Is.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(ef.LAYERS)}setLayers(e){const t=this.getLayers();if(t){const n=t.getArray();for(let s=0,o=n.length;s<o;++s)this.dispatchEvent(new Os(Is.REMOVELAYER,n[s]))}this.set(ef.LAYERS,e)}getLayersArray(e){return e=e!==void 0?e:[],this.getLayers().forEach(function(t){t.getLayersArray(e)}),e}getLayerStatesArray(e){const t=e!==void 0?e:[],n=t.length;this.getLayers().forEach(function(r){r.getLayerStatesArray(t)});const s=this.getLayerState();let o=s.zIndex;!e&&s.zIndex===void 0&&(o=0);for(let r=n,a=t.length;r<a;r++){const l=t[r];l.opacity*=s.opacity,l.visible=l.visible&&s.visible,l.maxResolution=Math.min(l.maxResolution,s.maxResolution),l.minResolution=Math.max(l.minResolution,s.minResolution),l.minZoom=Math.max(l.minZoom,s.minZoom),l.maxZoom=Math.min(l.maxZoom,s.maxZoom),s.extent!==void 0&&(l.extent!==void 0?l.extent=Xn(l.extent,s.extent):l.extent=s.extent),l.zIndex===void 0&&(l.zIndex=o)}return t}getSourceState(){return"ready"}}class _x extends Yr{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){we()}calculateMatrices2D(e){const t=e.viewState,n=e.coordinateToPixelTransform,s=e.pixelToCoordinateTransform;Zn(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),Tm(s,n)}forEachFeatureAtCoordinate(e,t,n,s,o,r,a,l){let c;const h=t.viewState;function u(P,R,O,I){return o.call(r,R,P?O:null,I)}const d=h.projection,f=Nu(e.slice(),d),g=[[0,0]];if(d.canWrapX()&&s){const P=d.getExtent(),R=Te(P);g.push([-R,0],[R,0])}const _=t.layerStatesArray,v=_.length,E=[],w=[];for(let P=0;P<g.length;P++)for(let R=v-1;R>=0;--R){const O=_[R],I=O.layer;if(I.hasRenderer()&&Hd(O,h)&&a.call(l,I)){const M=I.getRenderer(),z=I.getSource();if(M&&z){const k=z.getWrapX()?f:e,q=u.bind(null,O.managed);w[0]=k[0]+g[P][0],w[1]=k[1]+g[P][1],c=M.forEachFeatureAtCoordinate(w,t,n,q,E)}if(c)return c}}if(E.length===0)return;const C=1/E.length;return E.forEach((P,R)=>P.distanceSq+=R*C),E.sort((P,R)=>P.distanceSq-R.distanceSq),E.some(P=>c=P.callback(P.feature,P.layer,P.geometry)),c}hasFeatureAtCoordinate(e,t,n,s,o,r){return this.forEachFeatureAtCoordinate(e,t,n,s,Zr,this,o,r)!==void 0}getMap(){return this.map_}renderFrame(e){we()}scheduleExpireIconCache(e){Dn.canExpireCache()&&e.postRenderFunctions.push(wx)}}function wx(i,e){Dn.expire()}class vx extends _x{constructor(e){super(e),this.fontChangeListenerKey_=Ue(uo,Bo.PROPERTYCHANGE,e.redrawText,e),this.element_=hn?Ym():document.createElement("div");const t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=Cc+" ol-layers";const n=e.getViewport();n&&n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(e,t){const n=this.getMap();if(n.hasListener(e)){const s=new z0(e,void 0,t);n.dispatchEvent(s)}}disposeInternal(){st(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(e){if(!e){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(e),this.dispatchRenderEvent(Mn.PRECOMPOSE,e);const t=e.layerStatesArray.sort((c,h)=>c.zIndex-h.zIndex);t.some(c=>c.layer instanceof Uc&&c.layer.getDeclutter())&&(e.declutter={});const s=e.viewState;this.children_.length=0;const o=[];let r=null;for(let c=0,h=t.length;c<h;++c){const u=t[c];e.layerIndex=c;const d=u.layer,f=d.getSourceState();if(!Hd(u,s)||f!="ready"&&f!="undefined"){d.unrender();continue}const g=d.render(e,r);g&&(g!==r&&(this.children_.push(g),r=g),o.push(u))}this.declutter(e,o),qb(this.element_,this.children_);const l=this.getMap().getTargetElement();if(vs(l)){const c=l.getContext("2d");for(const h of this.children_){const u=h.firstElementChild||h,d=h.style.backgroundColor;if(d&&(!vs(u)||u.width>0)&&(c.fillStyle=d,c.fillRect(0,0,l.width,l.height)),vs(u)&&u.width>0){c.save();const f=h.style.opacity||u.style.opacity;c.globalAlpha=f===""?1:Number(f);const g=u.style.transform;if(g)c.transform(...Ku(g));else{const _=parseFloat(u.style.width)/u.width,v=parseFloat(u.style.height)/u.height;c.transform(_,0,0,v,0,0)}c.drawImage(u,0,0),c.restore()}}}this.dispatchRenderEvent(Mn.POSTCOMPOSE,e),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(e)}declutter(e,t){if(e.declutter){for(let n=t.length-1;n>=0;--n){const s=t[n],o=s.layer;o.getDeclutter()&&o.renderDeclutter(e,s)}t.forEach(n=>n.layer.renderDeferred(e))}}}function gy(i){if(i instanceof Ma){i.setMapInternal(null);return}i instanceof As&&i.getLayers().forEach(gy)}function my(i,e){if(i instanceof Ma){i.setMapInternal(e);return}if(i instanceof As){const t=i.getLayers().getArray();for(let n=0,s=t.length;n<s;++n)my(t[n],e)}}let yy=class extends mi{constructor(e){super(),e=e||{},this.on,this.once,this.un;const t=bx(e);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=e.maxTilesLoading!==void 0?e.maxTilesLoading:16,this.pixelRatio_=e.pixelRatio!==void 0?e.pixelRatio:Ub,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Qt(),this.pixelToCoordinateTransform_=Qt(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,hn||(this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in globalThis?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_)),this.mapBrowserEventHandler_=null,this.moveTolerance_=e.moveTolerance,this.keyboardEventTarget_=t.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,hn||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(hn?new On:ly()),this.interactions=t.interactions||(hn?new On:py({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new ay(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(Ht.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(Ht.VIEW,this.handleViewChanged_),this.addChangeListener(Ht.SIZE,this.handleSizeChanged_),this.addChangeListener(Ht.TARGET,this.handleTargetChanged_),this.setProperties(t.values);const n=this;e.view&&!(e.view instanceof bi)&&e.view.then(function(s){n.setView(new bi(s))}),this.controls.addEventListener(cn.ADD,s=>{s.element.setMap(this)}),this.controls.addEventListener(cn.REMOVE,s=>{s.element.setMap(null)}),this.interactions.addEventListener(cn.ADD,s=>{s.element.setMap(this)}),this.interactions.addEventListener(cn.REMOVE,s=>{s.element.setMap(null)}),this.overlays_.addEventListener(cn.ADD,s=>{this.addOverlayInternal_(s.element)}),this.overlays_.addEventListener(cn.REMOVE,s=>{const o=s.element.getId();o!==void 0&&delete this.overlayIdIndex_[o.toString()],s.element.setMap(null)}),this.controls.forEach(s=>{s.setMap(this)}),this.interactions.forEach(s=>{s.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(e){this.getControls().push(e)}addInteraction(e){this.getInteractions().push(e)}addLayer(e){this.getLayerGroup().getLayers().push(e)}handleLayerAdd_(e){my(e.layer,this)}addOverlay(e){this.getOverlays().push(e)}addOverlayInternal_(e){const t=e.getId();t!==void 0&&(this.overlayIdIndex_[t.toString()]=e),e.setMap(this)}disposeInternal(){var e;this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),(e=this.resizeObserver_)==null||e.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(e,t,n){if(!this.frameState_||!this.renderer_)return;const s=this.getCoordinateFromPixelInternal(e);n=n!==void 0?n:{};const o=n.hitTolerance!==void 0?n.hitTolerance:0,r=n.layerFilter!==void 0?n.layerFilter:Zr,a=n.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(s,this.frameState_,o,a,t,null,r,null)}getFeaturesAtPixel(e,t){const n=[];return this.forEachFeatureAtPixel(e,function(s){n.push(s)},t),n}getAllLayers(){const e=[];function t(n){n.forEach(function(s){s instanceof As?t(s.getLayers()):e.push(s)})}return t(this.getLayers()),e}hasFeatureAtPixel(e,t){if(!this.frameState_||!this.renderer_)return!1;const n=this.getCoordinateFromPixelInternal(e);t=t!==void 0?t:{};const s=t.layerFilter!==void 0?t.layerFilter:Zr,o=t.hitTolerance!==void 0?t.hitTolerance:0,r=t.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(n,this.frameState_,o,r,s,null)}getEventCoordinate(e){return this.getCoordinateFromPixel(this.getEventPixel(e))}getEventCoordinateInternal(e){return this.getCoordinateFromPixelInternal(this.getEventPixel(e))}getEventPixel(e){const n=this.viewport_.getBoundingClientRect(),s=this.getSize(),o=n.width/s[0],r=n.height/s[1],a="changedTouches"in e?e.changedTouches[0]:e;return[(a.clientX-n.left)/o,(a.clientY-n.top)/r]}getTarget(){return this.get(Ht.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return Hu(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){const t=this.frameState_;return t?wt(t.pixelToCoordinateTransform,e.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(e){const t=this.overlayIdIndex_[e.toString()];return t!==void 0?t:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(Ht.LAYERGROUP)}setLayers(e){const t=this.getLayerGroup();if(e instanceof On){t.setLayers(e);return}const n=t.getLayers();n.clear(),n.extend(e)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const e=this.getLayerGroup().getLayerStatesArray();for(let t=0,n=e.length;t<n;++t){const s=e[t];if(!s.visible)continue;const o=s.layer.getRenderer();if(o&&!o.ready)return!0;const r=s.layer.getSource();if(r&&r.loading)return!0}return!1}getPixelFromCoordinate(e){const t=qi(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){const t=this.frameState_;return t?wt(t.coordinateToPixelTransform,e.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(e){this.pixelRatio_!==e&&(this.pixelRatio_=e,this.render())}getRenderer(){return this.renderer_}getSize(){return this.get(Ht.SIZE)}getView(){return this.get(Ht.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const e=this.getTargetElement();return e?e.ownerDocument:document}getTilePriority(e,t,n,s){return XC(this.frameState_,e,t,n,s)}handleBrowserEvent(e,t){t=t||e.type;const n=new Rs(t,this,e);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(e){if(!this.frameState_)return;const t=e.originalEvent,n=t.type;if(n===Xd.POINTERDOWN||n===_e.WHEEL||n===_e.KEYDOWN){const s=this.getOwnerDocument(),o=this.viewport_.getRootNode?this.viewport_.getRootNode():s,r=t.target,a=o instanceof ShadowRoot?o.host===r?o.host.ownerDocument:o:o===s?s.documentElement:o;if(this.overlayContainerStopEvent_.contains(r)||!a.contains(r))return}if(e.frameState=this.frameState_,this.dispatchEvent(e)!==!1){const s=this.getInteractions().getArray().slice();for(let o=s.length-1;o>=0;o--){const r=s[o];if(r.getMap()!==this||!r.getActive()||!this.getTargetElement())continue;if(!r.handleEvent(e)||e.propagationStopped)break}}}handlePostRender(){const e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let s=this.maxTilesLoading_,o=s;if(e){const r=e.viewHints;if(r[ot.ANIMATING]||r[ot.INTERACTING]){const a=Date.now()-e.time>8;s=a?0:8,o=a?0:2}}t.getTilesLoading()<s&&(t.reprioritize(),t.loadMoreTiles(s,o))}e&&this.renderer_&&!e.animate&&(this.renderComplete_?(this.hasListener(Mn.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Mn.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new lr(Ts.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new lr(Ts.LOADSTART,this,e))));const n=this.postRenderFunctions_;if(e)for(let s=0,o=n.length;s<o;++s)n[s](this,e);n.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){var n,s;if(this.mapBrowserEventHandler_){for(let o=0,r=this.targetChangeHandlerKeys_.length;o<r;++o)st(this.targetChangeHandlerKeys_[o]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(_e.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(_e.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!vs(this.targetElement_)){(n=this.resizeObserver_)==null||n.unobserve(this.targetElement_);const o=this.targetElement_.getRootNode();o instanceof ShadowRoot&&this.resizeObserver_.unobserve(o.host),this.setSize(void 0)}const e=this.getTarget(),t=typeof e=="string"?document.getElementById(e):e;if(this.targetElement_=t,!t)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{if(vs(t)||t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new vx(this)),!vs(t)){this.mapBrowserEventHandler_=new $C(this,this.moveTolerance_);for(const r in bt)this.mapBrowserEventHandler_.addEventListener(bt[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(_e.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(_e.WHEEL,this.boundHandleBrowserEvent_,Hm?{passive:!1}:!1);let o;if(this.keyboardEventTarget_)o=this.keyboardEventTarget_;else{const r=t.getRootNode();o=r instanceof ShadowRoot?r.host:t}if(this.targetChangeHandlerKeys_=[Ue(o,_e.KEYDOWN,this.handleBrowserEvent,this),Ue(o,_e.KEYPRESS,this.handleBrowserEvent,this)],t instanceof HTMLElement){const r=t.getRootNode();r instanceof ShadowRoot&&this.resizeObserver_.observe(r.host),(s=this.resizeObserver_)==null||s.observe(t)}}this.updateSize()}}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(st(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(st(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=Ue(e,Bo.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=Ue(e,_e.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(st),this.layerGroupPropertyListenerKeys_=null);const e=this.getLayerGroup();e&&(this.handleLayerAdd_(new Os("addlayer",e)),this.layerGroupPropertyListenerKeys_=[Ue(e,Bo.PROPERTYCHANGE,this.render,this),Ue(e,_e.CHANGE,this.render,this),Ue(e,"addlayer",this.handleLayerAdd_,this),Ue(e,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;const e=this.frameState_.layerStatesArray;for(let t=0,n=e.length;t<n;++t){const s=e[t].layer;s.hasRenderer()&&s.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(e){return this.getControls().remove(e)}removeInteraction(e){return this.getInteractions().remove(e)}removeLayer(e){return this.getLayerGroup().getLayers().remove(e)}handleLayerRemove_(e){gy(e.layer)}removeOverlay(e){return this.getOverlays().remove(e)}renderFrame_(e){const t=this.getSize(),n=this.getView(),s=this.frameState_;let o=null;if(t!==void 0&&E0(t)&&n&&n.isDef()){const r=n.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=n.getState();if(o={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:Kl(a.center,a.resolution,a.rotation,t),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:t,tileQueue:this.tileQueue_,time:e,usedTiles:{},viewState:a,viewHints:r,wantedTiles:{},mapId:Pe(this),renderTargets:{}},a.nextCenter&&a.nextResolution){const l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;o.nextExtent=Kl(a.nextCenter,a.nextResolution,l,t)}}this.frameState_=o,this.renderer_.renderFrame(o),o&&(o.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,o.postRenderFunctions),s&&(!this.previousExtent_||!Ui(this.previousExtent_)&&!ji(o.extent,this.previousExtent_))&&(this.dispatchEvent(new lr(Ts.MOVESTART,this,s)),this.previousExtent_=Wo(this.previousExtent_)),this.previousExtent_&&!o.viewHints[ot.ANIMATING]&&!o.viewHints[ot.INTERACTING]&&!ji(o.extent,this.previousExtent_)&&(this.dispatchEvent(new lr(Ts.MOVEEND,this,o)),Hg(o.extent,this.previousExtent_))),this.dispatchEvent(new lr(Ts.POSTRENDER,this,o)),this.renderComplete_=(this.hasListener(Ts.LOADSTART)||this.hasListener(Ts.LOADEND)||this.hasListener(Mn.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(e){const t=this.getLayerGroup();t&&this.handleLayerRemove_(new Os("removelayer",t)),this.set(Ht.LAYERGROUP,e)}setSize(e){this.set(Ht.SIZE,e)}setTarget(e){this.set(Ht.TARGET,e)}setView(e){if(!e||e instanceof bi){this.set(Ht.VIEW,e);return}this.set(Ht.VIEW,new bi);const t=this;e.then(function(n){t.setView(new bi(n))})}updateSize(){const e=this.getTargetElement();let t;if(e){let s,o;if(vs(e)){const r=e.getContext("2d").getTransform();s=e.width/r.a,o=e.height/r.d}else{const r=getComputedStyle(e);s=e.offsetWidth-parseFloat(r.borderLeftWidth)-parseFloat(r.paddingLeft)-parseFloat(r.paddingRight)-parseFloat(r.borderRightWidth),o=e.offsetHeight-parseFloat(r.borderTopWidth)-parseFloat(r.paddingTop)-parseFloat(r.paddingBottom)-parseFloat(r.borderBottomWidth)}!isNaN(s)&&!isNaN(o)&&(t=[Math.max(0,s),Math.max(0,o)],!E0(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&lm("No map visible because the map container's width or height are 0."))}const n=this.getSize();t&&(!n||!ps(t,n))&&(this.setSize(t),this.updateViewportSize_(t))}updateViewportSize_(e){const t=this.getView();t&&t.setViewportSize(e)}};function bx(i){let e=null;i.keyboardEventTarget!==void 0&&(e=typeof i.keyboardEventTarget=="string"?document.getElementById(i.keyboardEventTarget):i.keyboardEventTarget);const t={},n=i.layers&&typeof i.layers.getLayers=="function"?i.layers:new As({layers:i.layers});t[Ht.LAYERGROUP]=n,t[Ht.TARGET]=i.target,t[Ht.VIEW]=i.view instanceof bi?i.view:new bi;let s;i.controls!==void 0&&(Array.isArray(i.controls)?s=new On(i.controls.slice()):(Ve(typeof i.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),s=i.controls));let o;i.interactions!==void 0&&(Array.isArray(i.interactions)?o=new On(i.interactions.slice()):(Ve(typeof i.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),o=i.interactions));let r;return i.overlays!==void 0?Array.isArray(i.overlays)?r=new On(i.overlays.slice()):(Ve(typeof i.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),r=i.overlays):r=new On,{controls:s,interactions:o,keyboardEventTarget:e,overlays:r,values:t}}class tf{constructor(e,t,n,s){this.minX=e,this.maxX=t,this.minY=n,this.maxY=s}contains(e){return this.containsXY(e[1],e[2])}containsTileRange(e){return this.minX<=e.minX&&e.maxX<=this.maxX&&this.minY<=e.minY&&e.maxY<=this.maxY}containsXY(e,t){return this.minX<=e&&e<=this.maxX&&this.minY<=t&&t<=this.maxY}equals(e){return this.minX==e.minX&&this.minY==e.minY&&this.maxX==e.maxX&&this.maxY==e.maxY}extend(e){e.minX<this.minX&&(this.minX=e.minX),e.maxX>this.maxX&&(this.maxX=e.maxX),e.minY<this.minY&&(this.minY=e.minY),e.maxY>this.maxY&&(this.maxY=e.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(e){return this.minX<=e.maxX&&this.maxX>=e.minX&&this.minY<=e.maxY&&this.maxY>=e.minY}}function hr(i,e,t,n,s){return s!==void 0?(s.minX=i,s.maxX=e,s.minY=t,s.maxY=n,s):new tf(i,e,t,n)}const _y=[];class Ex extends Da{constructor(e,t,n,s,o){super(e,t,{transition:0}),this.context_=null,this.executorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.replayState_={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=s.bind(void 0,this),this.removeSourceTiles_=o,this.wrappedTileCoord=n}getContext(){return this.context_||(this.context_=ht(1,1,_y)),this.context_}hasContext(){return!!this.context_}getImage(){return this.hasContext()?this.getContext().canvas:null}getReplayState(e){const t=Pe(e);return t in this.replayState_||(this.replayState_[t]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedPixelRatio:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.replayState_[t]}load(){this.getSourceTiles()}release(){this.context_&&(la(this.context_),_y.push(this.context_.canvas),this.context_=null),this.removeSourceTiles_(this),this.sourceTiles.length=0,super.release()}}let Cx=class extends Da{constructor(e,t,n,s,o,r){super(e,t,r),this.extent=null,this.format_=s,this.features_=null,this.loader_,this.projection=null,this.resolution,this.tileLoadFunction_=o,this.url_=n,this.key=n}getTileUrl(){return this.url_}getFormat(){return this.format_}getFeatures(){return this.features_}load(){this.state==se.IDLE&&(this.setState(se.LOADING),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))}onLoad(e,t){this.setFeatures(e)}onError(){this.setState(se.ERROR)}setFeatures(e){this.features_=e,this.setState(se.LOADED)}setLoader(e){this.loader_=e}};async function wy(i,e=128,t=128,n="map",s=1){return new Promise((o,r)=>{i.renderSync();try{const a=i.getSize()||[e,t],l=document.createElement("canvas"),c=a[0]*s,h=a[1]*s;l.width=c,l.height=h;const u=l.getContext("2d",{willReadFrequently:!0});if(!u)throw new Error("Failed to create canvas context");Array.from(i.getViewport().querySelectorAll(".ol-layer canvas, canvas.ol-layer")).filter(g=>{if(!(g instanceof HTMLCanvasElement)||g.width===0)return!1;try{return g.toDataURL("image/png"),!0}catch{return console.warn("跳过跨域图层:",g),!1}}).forEach(g=>{var w;const _=parseFloat(g.style.opacity||"1");u.globalAlpha=_;let v=[1,0,0,1,0,0];const E=g.style.transform;if(E){const[C,P,R,O,I,M]=((w=E.match(/^matrix\(([^)]+)\)$/))==null?void 0:w[1].split(",").map(Number))||[1,0,0,1,0,0];u.setTransform({a:C,b:P,c:R,d:O,e:I,f:M})}u.drawImage(g,0,0,c,h)}),u.globalAlpha=1,u.setTransform(1,0,0,1,0,0);const f=l.toDataURL("image/png");o(f)}catch(a){r(a)}})}function vy(i,e){const{center:t,orbitPeriod:n,heading:s=0}=e,o=i.getView(),a=(d=>d*Math.PI/180)(s);let l,c,h=!0;const u=d=>{c||(c=d);const g=(d-c)%n/n,_=2*Math.PI*g+a;o.setRotation(-_),i.render(),h&&(l=requestAnimationFrame(u))};return l=requestAnimationFrame(u),{stop(){h=!1,cancelAnimationFrame(l),o.setRotation(0)}}}function xx(i,e){const t=Ie(e),n=new An({geometry:new wn(t)});n.setStyle(new $e({image:new Ln({radius:6,fill:new vt({color:"red"}),stroke:new St({color:"white",width:2})}),text:new ir({text:"中心点可视化-测试后删除",font:"14px sans-serif",fill:new vt({color:"black"}),stroke:new St({color:"white",width:3}),offsetY:-15})}));const s=new zn({source:new vn({features:[n]})});i.addLayer(s)}class by extends p.Destroyable{constructor(t,n,s){super();T(this,"keysPressed",{w:!1,a:!1,s:!1,d:!1});T(this,"animationId",0);T(this,"view");T(this,"updatePosition",()=>{const t=this.view.getCenter();if(!t)return;const n=this.view.getZoom()??10,s=1e3/Math.pow(2,n-10);let[o,r]=t;this.keysPressed.w&&(r+=s),this.keysPressed.s&&(r-=s),this.keysPressed.a&&(o-=s),this.keysPressed.d&&(o+=s),this.view.setCenter([o,r]),this.animationId=requestAnimationFrame(this.updatePosition)});this.map=n,this.view=n.getView(),this.view.setCenter(Ie(s));const o=l=>{l.key in this.keysPressed&&(this.keysPressed[l.key]=!0)},r=l=>{l.key in this.keysPressed&&(this.keysPressed[l.key]=!1)},a=l=>{l.preventDefault();const c=this.view.getZoom()??10,h=l.deltaY>0?-1:1;this.view.setZoom(c+h)};t.addEventListener("keydown",o),t.addEventListener("keyup",r),n.getTargetElement().addEventListener("wheel",a,{passive:!1}),this.d(()=>t.removeEventListener("keydown",o)),this.d(()=>t.removeEventListener("keyup",r)),this.d(()=>n.getTargetElement().removeEventListener("wheel",a)),this.animationId=requestAnimationFrame(this.updatePosition),this.d(()=>cancelAnimationFrame(this.animationId))}}function Px(i){const t=Math.PI/3,n=256,s=i*2*Math.tan(t/2)/i,o=Math.log2(2*Math.PI*6378137/(s*n));return parseFloat(o.toFixed(3))}function Na(i){return 6378137/Math.pow(2,i-5)}function wo(i){const t=Math.log2(6378137/i)+5+0;return Math.min(28,Math.max(0,t))}class Ey extends p.Destroyable{constructor(t){super();T(this,"lastTime",performance.now());T(this,"frameCount",0);T(this,"currentFPS",0);T(this,"map");T(this,"calculateFPS",()=>{const t=performance.now();this.frameCount++,t-this.lastTime>=1e3&&(this.currentFPS=Math.round(this.frameCount*1e3/(t-this.lastTime)),this.frameCount=0,this.lastTime=t)});this.map=t,this.map.on("postrender",this.calculateFPS),this.d(()=>{this.map.un("postrender",this.calculateFPS)})}getFPS(){return this.currentFPS}}const Cy=[0,-90,0];function xy(i,e){const t=i.viewer;if(!t)return;const n=t.getView(),{position:s,rotation:o,duration:r=1e3,hdelta:a,pdelta:l,cancelCallback:c}=e;if(!s)return;const[h,u,d]=s,f=Ie([h,u]),g=(wo==null?void 0:wo(d))??n.getZoom(),v=(((o==null?void 0:o[0])??0)+(a??0))*Math.PI/180,E={center:f,zoom:g,rotation:-v,duration:r};try{return n.animate(E,()=>{}),Promise.resolve(!0)}catch{return c==null||c(),Promise.resolve(!1)}}function Yi(i,e,t,n,s,o){return(i==null?void 0:i.viewer)&&xy(i,{position:e,rotation:n,duration:s&&s*1e3,cancelCallback:o})}function qc(i){const e=i.map(t=>Ie([t[0],t[1]]));return $r(e)}const ka=(i,e,t=1,n=350)=>{i.getView().fit(e,{duration:t*1e3,padding:Array.isArray(n)?n:[n,n,n,n]})},Sx=(i,e,t=1,n=350)=>{const s=qc(e);ka(i,s,t,n)},nf=(i,e,t=1,n=350)=>{const s=Ie([e[0],e[1]]),o=$r([s]);ka(i,o,t,n)},Rx=(i,e,t)=>{};function Py(i,e){const t=i.viewer;if(!t)throw new Error("viewer.map is undefined");const n=t.getView(),s=n.getCenter();if(!s)throw new Error("view center is undefined");const o=n.getZoom(),r=(Na==null?void 0:Na(o??0))??0;return[s[0],s[1],r]}class Tx extends p.Destroyable{constructor(t,n){super();T(this,"_map");T(this,"_view");T(this,"_enabled",!0);T(this,"_keys",[]);T(this,"_changed",new p.Event);T(this,"_options");T(this,"_rafPending",!1);T(this,"_rafId",null);T(this,"_lastEmit",0);if(this._options={emitImmediately:!0,usePostRender:!1,throttleMs:0,useRaf:!0,...n},t instanceof zi.Map){this._map=t;const s=this._map.getView();if(!s)throw new Error("OlViewChanged: map.getView() is undefined");this._view=s}else this._view=t;this._attach(),this.dispose(()=>this._detach()),this._options.emitImmediately&&this._emit()}get changed(){return this._changed}get enabled(){return this._enabled}set enabled(t){this._enabled!==t&&(this._enabled=t,t&&this._emit())}attachMap(t){this._map!==t&&(this._detach(),this._map=t,this._attach(),this._emit())}_on(t,n,s){const o=t.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 t=performance.now();this._options.throttleMs>0&&t-this._lastEmit<this._options.throttleMs||(this._lastEmit=t,this._emit())}_emit(){this._enabled&&this._changed.emit()}}async function Sy(i,e,t,n){if(!i)throw new Error("olMap is undefined");await Promise.resolve();const s=i.getEventPixel(e);if(!s)return;const o=i.getCoordinateFromPixel(s);if(!o)return;const[r,a]=Lt(o),l=t??0;return n?(n[0]=r,n[1]=a,n[2]=l,n):[r,a,l]}function Ry(i,e,t,n,s,o){s.constraintMode="none",s.startDragPos=[0,0,0];const r=e.getEventPixel(i),a=e.getCoordinateFromPixel(r);if(!a)return!1;const l=Lt(a),c=[l[0],l[1],t.position[2]],h=t.position,u=t.heading,d=Ix(e,n,h),f=(g,_)=>{const v=Ox(h,c,g),E=p.geoRhumbDistance(h,c);if(v>.98&&E<d&&!(o!=null&&o[_])){s.constraintMode=_;const w=p.geoRhumbDestination(h,E,g);if(w)return s.startDragPos=[w[0],w[1],h[2]],!0}return!1};return f(u+90,"x")||f(u,"y")?!0:!(o!=null&&o.xy)&&p.geoRhumbDistance(h,c)<d?(s.constraintMode="xy",s.startDragPos=c,!0):!1}function Ix(i,e,t){const n=i.getPixelFromCoordinate(Ie([t[0],t[1]])),s=[n[0]+e,n[1]],o=Lt(i.getCoordinateFromPixel(s));return p.geoRhumbDistance([t[0],t[1],0],[o[0],o[1],0])}function Ox(i,e,t){const n=p.geoRhumbHeading(i,e),s=t*Math.PI/180,o=n*Math.PI/180;return Math.cos(s)*Math.cos(o)+Math.sin(s)*Math.sin(o)}function Ms(i,e,t,n){const s=p.geoRhumbDistance(i,t),o=p.geoRhumbHeading(i,t),r=Math.cos(o*Math.PI/180)*Math.cos(e*Math.PI/180)+Math.sin(o*Math.PI/180)*Math.sin(e*Math.PI/180);return r>0?p.geoRhumbDestination(i,s,e,n):p.geoRhumbDestination(i,s,e+180,n),[r>0?s:-s,n]}function Ax(i,e,t){const n=t*.1,s=[];for(let o=-9;o<10;++o){const r=p.geoRhumbDestination(i,n*o,e);r&&s.push(r)}return s}function Mx(i,e){return p.geoNearestPointOnLine(i,e).geometry.coordinates}function Dx(i,e,t,n=10){const s={constraintMode:"none",startDragPos:[0,0,0]},o=i.getPixelFromCoordinate(Ie([t.position[0],t.position[1]])),r=i.getEventPixel(e),a=r[0]-o[0],l=r[1]-o[1],h=(Math.atan2(-l,a)*(180/Math.PI)-t.heading+360)%360;Math.abs(a)<n&&Math.abs(l)<n?s.constraintMode="xy":h>=75&&h<=105||h>=255&&h<=285?s.constraintMode="y":h<=15||h>=345||h>=165&&h<=195?s.constraintMode="x":s.constraintMode="xy";const[u,d]=Lt(i.getCoordinateFromPixel(r));return s.startDragPos=[u,d,t.position[2]],s}function Fx(i,e,t){const n=i.getPixelFromCoordinate(e),s=[n[0]+t,n[1]],o=i.getCoordinateFromPixel(s);if(!o)return 1/0;const[r,a]=Lt(o),[l,c]=Lt(e);return Math.abs(p.geoRhumbDistance([l,c,0],[r,a,0]))}function Ty(i,e,t,n,s,o){const r=s-t,a=o-n,l=i-t,c=e-n,h=r*l+a*c;if(h<=0)return Math.hypot(i-t,e-n);const u=r*r+a*a;if(u<=h)return Math.hypot(i-s,e-o);const d=h/u,f=t+d*r,g=n+d*a;return Math.hypot(i-f,e-g)}function Iy(i,e,t,n=8,s,o){const r=s??{constraintMode:"none",startDragPos:[0,0,0]};r.constraintMode="none",r.startDragPos=[0,0,0];const a=Ie([t.position[0],t.position[1]]),l=i.getPixelFromCoordinate(a);if(!l)return r;const c=i.getEventPixel(e),[h,u]=c,d=Math.max(1e-6,t.dimensions[0]),f=t.heading,g=p.geoRhumbDestination(t.position,d,f+90),_=p.geoRhumbDestination(t.position,d,f+0);if(!g||!_)return r;const v=a,E=a,w=Ie([g[0],g[1]]),C=Ie([_[0],_[1]]),P=i.getPixelFromCoordinate(v),R=i.getPixelFromCoordinate(w),O=i.getPixelFromCoordinate(E),I=i.getPixelFromCoordinate(C),M=Fx(i,a,n),k=Math.hypot(h-l[0],u-l[1])<=n,q=Ty(h,u,P[0],P[1],R[0],R[1]),H=Ty(h,u,O[0],O[1],I[0],I[1]);if(!(o!=null&&o.zAxis)){const S=d,L=p.geoRhumbDestination(t.position,S,f);if(!L)return r;const N=i.getPixelFromCoordinate(Ie([L[0],L[1]]));Math.hypot(N[0]-l[0],N[1]-l[1])}let m="none";!(o!=null&&o.x)&&q<=n&&q<H&&(m="x"),!(o!=null&&o.y)&&H<=n&&H<q&&(m="y");const b=Lt(i.getCoordinateFromPixel(c));if(m==="x"||m==="y"){const S=m==="x"?f+90:f+0,[L,N]=Ms(t.position,S,[b[0],b[1],t.position[2]]);if(L>0&&N&&p.geoDistance(N,[b[0],b[1],t.position[2]])<=M)return r.constraintMode=m,r.startDragPos=[N[0],N[1],t.position[2]],r}return!(o!=null&&o.xy)&&(k||!0)&&(r.constraintMode="xy",r.startDragPos=[b[0],b[1],t.position[2]]),r}class Oy extends p.Destroyable{constructor(e,t,n,s=100){super();const o=e.getView(),[r,a]=p.getReactFuncs(n),l=()=>{const h=o.getZoom()??0,u=s*Math.pow(2,10-h);a([u,u,u])};l();const c=()=>l();o.on("change:resolution",c),this.ad(()=>o.un("change:resolution",c))}}function x(i){return i!=null}function $(i){this.name="DeveloperError",this.message=i;let e;try{throw new Error}catch(t){e=t.stack}this.stack=e}x(Object.create)&&($.prototype=Object.create(Error.prototype),$.prototype.constructor=$),$.prototype.toString=function(){let i=`${this.name}: ${this.message}`;return x(this.stack)&&(i+=`
|
|
27
|
-
${this.stack.toString()}`),i},$.throwInstantiationError=function(){throw new $("This function defines an interface and should not be called directly.")};const y={};y.typeOf={};function Lx(i){return`${i} is required, actual value was undefined`}function ur(i,e,t){return`Expected ${t} to be typeof ${e}, actual typeof was ${i}`}y.defined=function(i,e){if(!x(e))throw new $(Lx(i))},y.typeOf.func=function(i,e){if(typeof e!="function")throw new $(ur(typeof e,"function",i))},y.typeOf.string=function(i,e){if(typeof e!="string")throw new $(ur(typeof e,"string",i))},y.typeOf.number=function(i,e){if(typeof e!="number")throw new $(ur(typeof e,"number",i))},y.typeOf.number.lessThan=function(i,e,t){if(y.typeOf.number(i,e),e>=t)throw new $(`Expected ${i} to be less than ${t}, actual value was ${e}`)},y.typeOf.number.lessThanOrEquals=function(i,e,t){if(y.typeOf.number(i,e),e>t)throw new $(`Expected ${i} to be less than or equal to ${t}, actual value was ${e}`)},y.typeOf.number.greaterThan=function(i,e,t){if(y.typeOf.number(i,e),e<=t)throw new $(`Expected ${i} to be greater than ${t}, actual value was ${e}`)},y.typeOf.number.greaterThanOrEquals=function(i,e,t){if(y.typeOf.number(i,e),e<t)throw new $(`Expected ${i} to be greater than or equal to ${t}, actual value was ${e}`)},y.typeOf.object=function(i,e){if(typeof e!="object")throw new $(ur(typeof e,"object",i))},y.typeOf.bool=function(i,e){if(typeof e!="boolean")throw new $(ur(typeof e,"boolean",i))},y.typeOf.bigint=function(i,e){if(typeof e!="bigint")throw new $(ur(typeof e,"bigint",i))},y.typeOf.number.equals=function(i,e,t,n){if(y.typeOf.number(i,t),y.typeOf.number(e,n),t!==n)throw new $(`${i} must be equal to ${e}, the actual values are ${t} and ${n}`)};var Ay=typeof globalThis<"u"||typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof self<"u"?self:{};function My(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var sf,Dy;function zx(){if(Dy)return sf;Dy=1;var i=function(e){e==null&&(e=new Date().getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,e.constructor==Array?this.init_by_array(e,e.length):this.init_seed(e)};return i.prototype.init_seed=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){var e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(((e&4294901760)>>>16)*1812433253<<16)+(e&65535)*1812433253+this.mti,this.mt[this.mti]>>>=0}},i.prototype.init_by_array=function(e,t){var n,s,o;for(this.init_seed(19650218),n=1,s=0,o=this.N>t?this.N:t;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)+e[s]+s,this.mt[n]>>>=0,n++,s++,n>=this.N&&(this.mt[0]=this.mt[this.N-1],n=1),s>=t&&(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 e,t=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++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^e>>>1^t[e&1];for(;n<this.N-1;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^e>>>1^t[e&1];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[e&1],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=e<<7&2636928640,e^=e<<15&4022730752,e^=e>>>18,e>>>0},i.prototype.random_int31=function(){return this.random_int()>>>1},i.prototype.random_incl=function(){return this.random_int()*(1/4294967295)},i.prototype.random=function(){return this.random_int()*(1/4294967296)},i.prototype.random_excl=function(){return(this.random_int()+.5)*(1/4294967296)},i.prototype.random_long=function(){var e=this.random_int()>>>5,t=this.random_int()>>>6;return(e*67108864+t)*(1/9007199254740992)},sf=i,sf}var Nx=zx();const Fy=My(Nx),F={};F.EPSILON1=.1,F.EPSILON2=.01,F.EPSILON3=.001,F.EPSILON4=1e-4,F.EPSILON5=1e-5,F.EPSILON6=1e-6,F.EPSILON7=1e-7,F.EPSILON8=1e-8,F.EPSILON9=1e-9,F.EPSILON10=1e-10,F.EPSILON11=1e-11,F.EPSILON12=1e-12,F.EPSILON13=1e-13,F.EPSILON14=1e-14,F.EPSILON15=1e-15,F.EPSILON16=1e-16,F.EPSILON17=1e-17,F.EPSILON18=1e-18,F.EPSILON19=1e-19,F.EPSILON20=1e-20,F.EPSILON21=1e-21,F.GRAVITATIONALPARAMETER=3986004418e5,F.SOLAR_RADIUS=6955e5,F.LUNAR_RADIUS=1737400,F.SIXTY_FOUR_KILOBYTES=64*1024,F.FOUR_GIGABYTES=4*1024*1024*1024,F.sign=Math.sign??function(e){return e=+e,e===0||e!==e?e:e>0?1:-1},F.signNotZero=function(i){return i<0?-1:1},F.toSNorm=function(i,e){return e=e??255,Math.round((F.clamp(i,-1,1)*.5+.5)*e)},F.fromSNorm=function(i,e){return e=e??255,F.clamp(i,0,e)/e*2-1},F.normalize=function(i,e,t){return t=Math.max(t-e,0),t===0?0:F.clamp((i-e)/t,0,1)},F.sinh=Math.sinh??function(e){return(Math.exp(e)-Math.exp(-e))/2},F.cosh=Math.cosh??function(e){return(Math.exp(e)+Math.exp(-e))/2},F.lerp=function(i,e,t){return(1-t)*i+t*e},F.smoothDamp=function(i,e,t,n=0,s=Number.POSITIVE_INFINITY,o=1e-4,r={}){y.typeOf.number("p",i),y.typeOf.number("q",e),y.typeOf.number("velocity",t),y.typeOf.number.greaterThanOrEquals("deltaTime",n,0),y.typeOf.number.greaterThanOrEquals("maximumSpeed",s,0),y.typeOf.number.greaterThanOrEquals("smoothTime",o,1e-4),y.typeOf.object("result",r),o=Math.max(1e-4,o);const a=2/o,l=a*n,c=1/(1+l+.48*l*l+.235*l*l*l),h=s*o;let u=i-e;u=F.clamp(u,-h,h);const d=i-u,f=(t+a*u)*n;return t=(t-a*f)*c,r.value=d+(u+f)*c,r.velocity=t,r},F.PI=Math.PI,F.ONE_OVER_PI=1/Math.PI,F.PI_OVER_TWO=Math.PI/2,F.PI_OVER_THREE=Math.PI/3,F.PI_OVER_FOUR=Math.PI/4,F.PI_OVER_SIX=Math.PI/6,F.THREE_PI_OVER_TWO=3*Math.PI/2,F.TWO_PI=2*Math.PI,F.ONE_OVER_TWO_PI=1/(2*Math.PI),F.RADIANS_PER_DEGREE=Math.PI/180,F.DEGREES_PER_RADIAN=180/Math.PI,F.RADIANS_PER_ARCSECOND=F.RADIANS_PER_DEGREE/3600,F.toRadians=function(i){if(!x(i))throw new $("degrees is required.");return i*F.RADIANS_PER_DEGREE},F.toDegrees=function(i){if(!x(i))throw new $("radians is required.");return i*F.DEGREES_PER_RADIAN},F.convertLongitudeRange=function(i){if(!x(i))throw new $("angle is required.");const e=F.TWO_PI,t=i-Math.floor(i/e)*e;return t<-Math.PI?t+e:t>=Math.PI?t-e:t},F.clampToLatitudeRange=function(i){if(!x(i))throw new $("angle is required.");return F.clamp(i,-1*F.PI_OVER_TWO,F.PI_OVER_TWO)},F.negativePiToPi=function(i){if(!x(i))throw new $("angle is required.");return i>=-F.PI&&i<=F.PI?i:F.zeroToTwoPi(i+F.PI)-F.PI},F.zeroToTwoPi=function(i){if(!x(i))throw new $("angle is required.");if(i>=0&&i<=F.TWO_PI)return i;const e=F.mod(i,F.TWO_PI);return Math.abs(e)<F.EPSILON14&&Math.abs(i)>F.EPSILON14?F.TWO_PI:e},F.mod=function(i,e){if(!x(i))throw new $("m is required.");if(!x(e))throw new $("n is required.");if(e===0)throw new $("divisor cannot be 0.");return F.sign(i)===F.sign(e)&&Math.abs(i)<Math.abs(e)?i:(i%e+e)%e},F.equalsEpsilon=function(i,e,t,n){if(!x(i))throw new $("left is required.");if(!x(e))throw new $("right is required.");t=t??0,n=n??t;const s=Math.abs(i-e);return s<=n||s<=t*Math.max(Math.abs(i),Math.abs(e))},F.lessThan=function(i,e,t){if(!x(i))throw new $("first is required.");if(!x(e))throw new $("second is required.");if(!x(t))throw new $("absoluteEpsilon is required.");return i-e<-t},F.lessThanOrEquals=function(i,e,t){if(!x(i))throw new $("first is required.");if(!x(e))throw new $("second is required.");if(!x(t))throw new $("absoluteEpsilon is required.");return i-e<t},F.greaterThan=function(i,e,t){if(!x(i))throw new $("first is required.");if(!x(e))throw new $("second is required.");if(!x(t))throw new $("absoluteEpsilon is required.");return i-e>t},F.greaterThanOrEquals=function(i,e,t){if(!x(i))throw new $("first is required.");if(!x(e))throw new $("second is required.");if(!x(t))throw new $("absoluteEpsilon is required.");return i-e>-t};const Vc=[1];F.factorial=function(i){if(typeof i!="number"||i<0)throw new $("A number greater than or equal to 0 is required.");const e=Vc.length;if(i>=e){let t=Vc[e-1];for(let n=e;n<=i;n++){const s=t*n;Vc.push(s),t=s}}return Vc[i]},F.incrementWrap=function(i,e,t){if(t=t??0,!x(i))throw new $("n is required.");if(e<=t)throw new $("maximumValue must be greater than minimumValue.");return++i,i>e&&(i=t),i},F.isPowerOfTwo=function(i){if(typeof i!="number"||i<0||i>4294967295)throw new $("A number between 0 and (2^32)-1 is required.");return i!==0&&(i&i-1)===0},F.nextPowerOfTwo=function(i){if(typeof i!="number"||i<0||i>2147483648)throw new $("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},F.previousPowerOfTwo=function(i){if(typeof i!="number"||i<0||i>4294967295)throw new $("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},F.clamp=function(i,e,t){return y.typeOf.number("value",i),y.typeOf.number("min",e),y.typeOf.number("max",t),i<e?e:i>t?t:i};let Ly=new Fy;F.setRandomNumberSeed=function(i){if(!x(i))throw new $("seed is required.");Ly=new Fy(i)},F.nextRandomNumber=function(){return Ly.random()},F.randomBetween=function(i,e){return F.nextRandomNumber()*(e-i)+i},F.acosClamped=function(i){if(!x(i))throw new $("value is required.");return Math.acos(F.clamp(i,-1,1))},F.asinClamped=function(i){if(!x(i))throw new $("value is required.");return Math.asin(F.clamp(i,-1,1))},F.chordLength=function(i,e){if(!x(i))throw new $("angle is required.");if(!x(e))throw new $("radius is required.");return 2*e*Math.sin(i*.5)},F.logBase=function(i,e){if(!x(i))throw new $("number is required.");if(!x(e))throw new $("base is required.");return Math.log(i)/Math.log(e)},F.cbrt=Math.cbrt??function(e){const t=Math.pow(Math.abs(e),.3333333333333333);return e<0?-t:t},F.log2=Math.log2??function(e){return Math.log(e)*Math.LOG2E},F.fog=function(i,e){const t=i*e;return 1-Math.exp(-(t*t))},F.fastApproximateAtan=function(i){return y.typeOf.number("x",i),i*(-.1784*Math.abs(i)-.0663*i*i+1.0301)},F.fastApproximateAtan2=function(i,e){y.typeOf.number("x",i),y.typeOf.number("y",e);let t,n=Math.abs(i);t=Math.abs(e);const s=Math.max(n,t);t=Math.min(n,t);const o=t/s;if(isNaN(o))throw new $("either x or y must be nonzero");return n=F.fastApproximateAtan(o),n=Math.abs(e)>Math.abs(i)?F.PI_OVER_TWO-n:n,n=i<0?F.PI-n:n,n=e<0?-n:n,n};class D{constructor(e,t,n){this.x=e??0,this.y=t??0,this.z=n??0}static fromSpherical(e,t){y.typeOf.object("spherical",e),x(t)||(t=new D);const n=e.clock,s=e.cone,o=e.magnitude??1,r=o*Math.sin(s);return t.x=r*Math.cos(n),t.y=r*Math.sin(n),t.z=o*Math.cos(s),t}static fromElements(e,t,n,s){return x(s)?(s.x=e,s.y=t,s.z=n,s):new D(e,t,n)}static clone(e,t){if(x(e))return x(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t):new D(e.x,e.y,e.z)}static pack(e,t,n){return y.typeOf.object("value",e),y.defined("array",t),n=n??0,t[n++]=e.x,t[n++]=e.y,t[n]=e.z,t}static unpack(e,t,n){return y.defined("array",e),t=t??0,x(n)||(n=new D),n.x=e[t++],n.y=e[t++],n.z=e[t],n}static packArray(e,t){y.defined("array",e);const n=e.length,s=n*3;if(!x(t))t=new Array(s);else{if(!Array.isArray(t)&&t.length!==s)throw new $("If result is a typed array, it must have exactly array.length * 3 elements");t.length!==s&&(t.length=s)}for(let o=0;o<n;++o)D.pack(e[o],t,o*3);return t}static unpackArray(e,t){if(y.defined("array",e),y.typeOf.number.greaterThanOrEquals("array.length",e.length,3),e.length%3!==0)throw new $("array length must be a multiple of 3.");const n=e.length;x(t)?t.length=n/3:t=new Array(n/3);for(let s=0;s<n;s+=3){const o=s/3;t[o]=D.unpack(e,s,t[o])}return t}static maximumComponent(e){return y.typeOf.object("cartesian",e),Math.max(e.x,e.y,e.z)}static minimumComponent(e){return y.typeOf.object("cartesian",e),Math.min(e.x,e.y,e.z)}static minimumByComponent(e,t,n){return y.typeOf.object("first",e),y.typeOf.object("second",t),y.typeOf.object("result",n),n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n}static maximumByComponent(e,t,n){return y.typeOf.object("first",e),y.typeOf.object("second",t),y.typeOf.object("result",n),n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n}static clamp(e,t,n,s){y.typeOf.object("value",e),y.typeOf.object("min",t),y.typeOf.object("max",n),y.typeOf.object("result",s);const o=F.clamp(e.x,t.x,n.x),r=F.clamp(e.y,t.y,n.y),a=F.clamp(e.z,t.z,n.z);return s.x=o,s.y=r,s.z=a,s}static magnitudeSquared(e){return y.typeOf.object("cartesian",e),e.x*e.x+e.y*e.y+e.z*e.z}static magnitude(e){return Math.sqrt(D.magnitudeSquared(e))}static distance(e,t){return y.typeOf.object("left",e),y.typeOf.object("right",t),D.subtract(e,t,Wc),D.magnitude(Wc)}static distanceSquared(e,t){return y.typeOf.object("left",e),y.typeOf.object("right",t),D.subtract(e,t,Wc),D.magnitudeSquared(Wc)}static normalize(e,t){y.typeOf.object("cartesian",e),y.typeOf.object("result",t);const n=D.magnitude(e);if(t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,isNaN(t.x)||isNaN(t.y)||isNaN(t.z))throw new $("normalized result is not a number");return t}static dot(e,t){return y.typeOf.object("left",e),y.typeOf.object("right",t),e.x*t.x+e.y*t.y+e.z*t.z}static multiplyComponents(e,t,n){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",n),n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n}static divideComponents(e,t,n){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",n),n.x=e.x/t.x,n.y=e.y/t.y,n.z=e.z/t.z,n}static add(e,t,n){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",n),n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n}static subtract(e,t,n){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",n),n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n}static multiplyByScalar(e,t,n){return y.typeOf.object("cartesian",e),y.typeOf.number("scalar",t),y.typeOf.object("result",n),n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n}static divideByScalar(e,t,n){return y.typeOf.object("cartesian",e),y.typeOf.number("scalar",t),y.typeOf.object("result",n),n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n}static negate(e,t){return y.typeOf.object("cartesian",e),y.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t.z=-e.z,t}static abs(e,t){return y.typeOf.object("cartesian",e),y.typeOf.object("result",t),t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t}static lerp(e,t,n,s){return y.typeOf.object("start",e),y.typeOf.object("end",t),y.typeOf.number("t",n),y.typeOf.object("result",s),D.multiplyByScalar(t,n,zy),s=D.multiplyByScalar(e,1-n,s),D.add(zy,s,s)}static angleBetween(e,t){y.typeOf.object("left",e),y.typeOf.object("right",t),D.normalize(e,Bc),D.normalize(t,of);const n=D.dot(Bc,of),s=D.magnitude(D.cross(Bc,of,Bc));return Math.atan2(s,n)}static mostOrthogonalAxis(e,t){y.typeOf.object("cartesian",e),y.typeOf.object("result",t);const n=D.normalize(e,kx);return D.abs(n,n),n.x<=n.y?n.x<=n.z?t=D.clone(D.UNIT_X,t):t=D.clone(D.UNIT_Z,t):n.y<=n.z?t=D.clone(D.UNIT_Y,t):t=D.clone(D.UNIT_Z,t),t}static projectVector(e,t,n){y.defined("a",e),y.defined("b",t),y.defined("result",n);const s=D.dot(e,t)/D.dot(t,t);return D.multiplyByScalar(t,s,n)}static equals(e,t){return e===t||x(e)&&x(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z}static equalsArray(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]}static equalsEpsilon(e,t,n,s){return e===t||x(e)&&x(t)&&F.equalsEpsilon(e.x,t.x,n,s)&&F.equalsEpsilon(e.y,t.y,n,s)&&F.equalsEpsilon(e.z,t.z,n,s)}static cross(e,t,n){y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",n);const s=e.x,o=e.y,r=e.z,a=t.x,l=t.y,c=t.z,h=o*c-r*l,u=r*a-s*c,d=s*l-o*a;return n.x=h,n.y=u,n.z=d,n}static midpoint(e,t,n){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",n),n.x=(e.x+t.x)*.5,n.y=(e.y+t.y)*.5,n.z=(e.z+t.z)*.5,n}static fromDegrees(e,t,n,s,o){return y.typeOf.number("longitude",e),y.typeOf.number("latitude",t),e=F.toRadians(e),t=F.toRadians(t),D.fromRadians(e,t,n,s,o)}static fromRadians(e,t,n,s,o){y.typeOf.number("longitude",e),y.typeOf.number("latitude",t),n=n??0;const r=x(s)?s.radiiSquared:D._ellipsoidRadiiSquared,a=Math.cos(t);Nn.x=a*Math.cos(e),Nn.y=a*Math.sin(e),Nn.z=Math.sin(t),Nn=D.normalize(Nn,Nn),D.multiplyComponents(r,Nn,dr);const l=Math.sqrt(D.dot(Nn,dr));return dr=D.divideByScalar(dr,l,dr),Nn=D.multiplyByScalar(Nn,n,Nn),x(o)||(o=new D),D.add(dr,Nn,o)}static fromDegreesArray(e,t,n){if(y.defined("coordinates",e),e.length<2||e.length%2!==0)throw new $("the number of coordinates must be a multiple of 2 and at least 2");const s=e.length;x(n)?n.length=s/2:n=new Array(s/2);for(let o=0;o<s;o+=2){const r=e[o],a=e[o+1],l=o/2;n[l]=D.fromDegrees(r,a,0,t,n[l])}return n}static fromRadiansArray(e,t,n){if(y.defined("coordinates",e),e.length<2||e.length%2!==0)throw new $("the number of coordinates must be a multiple of 2 and at least 2");const s=e.length;x(n)?n.length=s/2:n=new Array(s/2);for(let o=0;o<s;o+=2){const r=e[o],a=e[o+1],l=o/2;n[l]=D.fromRadians(r,a,0,t,n[l])}return n}static fromDegreesArrayHeights(e,t,n){if(y.defined("coordinates",e),e.length<3||e.length%3!==0)throw new $("the number of coordinates must be a multiple of 3 and at least 3");const s=e.length;x(n)?n.length=s/3:n=new Array(s/3);for(let o=0;o<s;o+=3){const r=e[o],a=e[o+1],l=e[o+2],c=o/3;n[c]=D.fromDegrees(r,a,l,t,n[c])}return n}static fromRadiansArrayHeights(e,t,n){if(y.defined("coordinates",e),e.length<3||e.length%3!==0)throw new $("the number of coordinates must be a multiple of 3 and at least 3");const s=e.length;x(n)?n.length=s/3:n=new Array(s/3);for(let o=0;o<s;o+=3){const r=e[o],a=e[o+1],l=e[o+2],c=o/3;n[c]=D.fromRadians(r,a,l,t,n[c])}return n}clone(e){return D.clone(this,e)}equals(e){return D.equals(this,e)}equalsEpsilon(e,t,n){return D.equalsEpsilon(this,e,t,n)}toString(){return`(${this.x}, ${this.y}, ${this.z})`}}D.fromCartesian4=D.clone,D.packedLength=3,D.fromArray=D.unpack;const Wc=new D,zy=new D,Bc=new D,of=new D,kx=new D;let Nn=new D,dr=new D;D._ellipsoidRadiiSquared=new D(6378137*6378137,6378137*6378137,6356752314245179e-9*6356752314245179e-9),D.ZERO=Object.freeze(new D(0,0,0)),D.ONE=Object.freeze(new D(1,1,1)),D.UNIT_X=Object.freeze(new D(1,0,0)),D.UNIT_Y=Object.freeze(new D(0,1,0)),D.UNIT_Z=Object.freeze(new D(0,0,1));class ce{constructor(e,t,n,s){this.x=e??0,this.y=t??0,this.z=n??0,this.w=s??0}static fromElements(e,t,n,s,o){return x(o)?(o.x=e,o.y=t,o.z=n,o.w=s,o):new ce(e,t,n,s)}static fromColor(e,t){return y.typeOf.object("color",e),x(t)?(t.x=e.red,t.y=e.green,t.z=e.blue,t.w=e.alpha,t):new ce(e.red,e.green,e.blue,e.alpha)}static clone(e,t){if(x(e))return x(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new ce(e.x,e.y,e.z,e.w)}static pack(e,t,n){return y.typeOf.object("value",e),y.defined("array",t),n=n??0,t[n++]=e.x,t[n++]=e.y,t[n++]=e.z,t[n]=e.w,t}static unpack(e,t,n){return y.defined("array",e),t=t??0,x(n)||(n=new ce),n.x=e[t++],n.y=e[t++],n.z=e[t++],n.w=e[t],n}static packArray(e,t){y.defined("array",e);const n=e.length,s=n*4;if(!x(t))t=new Array(s);else{if(!Array.isArray(t)&&t.length!==s)throw new $("If result is a typed array, it must have exactly array.length * 4 elements");t.length!==s&&(t.length=s)}for(let o=0;o<n;++o)ce.pack(e[o],t,o*4);return t}static unpackArray(e,t){if(y.defined("array",e),y.typeOf.number.greaterThanOrEquals("array.length",e.length,4),e.length%4!==0)throw new $("array length must be a multiple of 4.");const n=e.length;x(t)?t.length=n/4:t=new Array(n/4);for(let s=0;s<n;s+=4){const o=s/4;t[o]=ce.unpack(e,s,t[o])}return t}static maximumComponent(e){return y.typeOf.object("cartesian",e),Math.max(e.x,e.y,e.z,e.w)}static minimumComponent(e){return y.typeOf.object("cartesian",e),Math.min(e.x,e.y,e.z,e.w)}static minimumByComponent(e,t,n){return y.typeOf.object("first",e),y.typeOf.object("second",t),y.typeOf.object("result",n),n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n.w=Math.min(e.w,t.w),n}static maximumByComponent(e,t,n){return y.typeOf.object("first",e),y.typeOf.object("second",t),y.typeOf.object("result",n),n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n.w=Math.max(e.w,t.w),n}static clamp(e,t,n,s){y.typeOf.object("value",e),y.typeOf.object("min",t),y.typeOf.object("max",n),y.typeOf.object("result",s);const o=F.clamp(e.x,t.x,n.x),r=F.clamp(e.y,t.y,n.y),a=F.clamp(e.z,t.z,n.z),l=F.clamp(e.w,t.w,n.w);return s.x=o,s.y=r,s.z=a,s.w=l,s}static magnitudeSquared(e){return y.typeOf.object("cartesian",e),e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w}static magnitude(e){return Math.sqrt(ce.magnitudeSquared(e))}static distance(e,t){return y.typeOf.object("left",e),y.typeOf.object("right",t),ce.subtract(e,t,$c),ce.magnitude($c)}static distanceSquared(e,t){return y.typeOf.object("left",e),y.typeOf.object("right",t),ce.subtract(e,t,$c),ce.magnitudeSquared($c)}static normalize(e,t){y.typeOf.object("cartesian",e),y.typeOf.object("result",t);const n=ce.magnitude(e);if(t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t.w=e.w/n,isNaN(t.x)||isNaN(t.y)||isNaN(t.z)||isNaN(t.w))throw new $("normalized result is not a number");return t}static dot(e,t){return y.typeOf.object("left",e),y.typeOf.object("right",t),e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w}static multiplyComponents(e,t,n){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",n),n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n.w=e.w*t.w,n}static divideComponents(e,t,n){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",n),n.x=e.x/t.x,n.y=e.y/t.y,n.z=e.z/t.z,n.w=e.w/t.w,n}static add(e,t,n){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",n),n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n}static subtract(e,t,n){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",n),n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n}static multiplyByScalar(e,t,n){return y.typeOf.object("cartesian",e),y.typeOf.number("scalar",t),y.typeOf.object("result",n),n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n}static divideByScalar(e,t,n){return y.typeOf.object("cartesian",e),y.typeOf.number("scalar",t),y.typeOf.object("result",n),n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n}static negate(e,t){return y.typeOf.object("cartesian",e),y.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t}static abs(e,t){return y.typeOf.object("cartesian",e),y.typeOf.object("result",t),t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t.w=Math.abs(e.w),t}static lerp(e,t,n,s){return y.typeOf.object("start",e),y.typeOf.object("end",t),y.typeOf.number("t",n),y.typeOf.object("result",s),ce.multiplyByScalar(t,n,Ny),s=ce.multiplyByScalar(e,1-n,s),ce.add(Ny,s,s)}static mostOrthogonalAxis(e,t){y.typeOf.object("cartesian",e),y.typeOf.object("result",t);const n=ce.normalize(e,jx);return ce.abs(n,n),n.x<=n.y?n.x<=n.z?n.x<=n.w?t=ce.clone(ce.UNIT_X,t):t=ce.clone(ce.UNIT_W,t):n.z<=n.w?t=ce.clone(ce.UNIT_Z,t):t=ce.clone(ce.UNIT_W,t):n.y<=n.z?n.y<=n.w?t=ce.clone(ce.UNIT_Y,t):t=ce.clone(ce.UNIT_W,t):n.z<=n.w?t=ce.clone(ce.UNIT_Z,t):t=ce.clone(ce.UNIT_W,t),t}static equals(e,t){return e===t||x(e)&&x(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w}static equalsArray(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]&&e.w===t[n+3]}static equalsEpsilon(e,t,n,s){return e===t||x(e)&&x(t)&&F.equalsEpsilon(e.x,t.x,n,s)&&F.equalsEpsilon(e.y,t.y,n,s)&&F.equalsEpsilon(e.z,t.z,n,s)&&F.equalsEpsilon(e.w,t.w,n,s)}clone(e){return ce.clone(this,e)}equals(e){return ce.equals(this,e)}equalsEpsilon(e,t,n){return ce.equalsEpsilon(this,e,t,n)}toString(){return`(${this.x}, ${this.y}, ${this.z}, ${this.w})`}static packFloat(e,t){return y.typeOf.number("value",e),x(t)||(t=new ce),rf[0]=e,ky?(t.x=Xt[0],t.y=Xt[1],t.z=Xt[2],t.w=Xt[3]):(t.x=Xt[3],t.y=Xt[2],t.z=Xt[1],t.w=Xt[0]),t}static unpackFloat(e){return y.typeOf.object("packedFloat",e),ky?(Xt[0]=e.x,Xt[1]=e.y,Xt[2]=e.z,Xt[3]=e.w):(Xt[0]=e.w,Xt[1]=e.z,Xt[2]=e.y,Xt[3]=e.x),rf[0]}}ce.packedLength=4,ce.fromArray=ce.unpack;const $c=new ce,Ny=new ce,jx=new ce;ce.ZERO=Object.freeze(new ce(0,0,0,0)),ce.ONE=Object.freeze(new ce(1,1,1,1)),ce.UNIT_X=Object.freeze(new ce(1,0,0,0)),ce.UNIT_Y=Object.freeze(new ce(0,1,0,0)),ce.UNIT_Z=Object.freeze(new ce(0,0,1,0)),ce.UNIT_W=Object.freeze(new ce(0,0,0,1));const rf=new Float32Array(1),Xt=new Uint8Array(rf.buffer),Ux=new Uint32Array([287454020]),ky=new Uint8Array(Ux.buffer)[0]===68,Ei={};Ei.EMPTY_OBJECT=Object.freeze({}),Ei.EMPTY_ARRAY=Object.freeze([]);class K{constructor(e,t,n,s,o,r,a,l,c){this[0]=e??0,this[1]=s??0,this[2]=a??0,this[3]=t??0,this[4]=o??0,this[5]=l??0,this[6]=n??0,this[7]=r??0,this[8]=c??0}static pack(e,t,n){return y.typeOf.object("value",e),y.defined("array",t),n=n??0,t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t[n++]=e[4],t[n++]=e[5],t[n++]=e[6],t[n++]=e[7],t[n]=e[8],t}static unpack(e,t,n){return y.defined("array",e),t=t??0,x(n)||(n=new K),n[0]=e[t++],n[1]=e[t++],n[2]=e[t++],n[3]=e[t++],n[4]=e[t++],n[5]=e[t++],n[6]=e[t++],n[7]=e[t++],n[8]=e[t],n}static packArray(e,t){y.defined("array",e);const n=e.length,s=n*9;if(!x(t))t=new Array(s);else{if(!Array.isArray(t)&&t.length!==s)throw new $("If result is a typed array, it must have exactly array.length * 9 elements");t.length!==s&&(t.length=s)}for(let o=0;o<n;++o)K.pack(e[o],t,o*9);return t}static unpackArray(e,t){if(y.defined("array",e),y.typeOf.number.greaterThanOrEquals("array.length",e.length,9),e.length%9!==0)throw new $("array length must be a multiple of 9.");const n=e.length;x(t)?t.length=n/9:t=new Array(n/9);for(let s=0;s<n;s+=9){const o=s/9;t[o]=K.unpack(e,s,t[o])}return t}static clone(e,t){if(x(e))return x(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):new K(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8])}static fromColumnMajorArray(e,t){return y.defined("values",e),K.clone(e,t)}static fromRowMajorArray(e,t){return y.defined("values",e),x(t)?(t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t):new K(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}static fromQuaternion(e,t){y.typeOf.object("quaternion",e);const n=e.x*e.x,s=e.x*e.y,o=e.x*e.z,r=e.x*e.w,a=e.y*e.y,l=e.y*e.z,c=e.y*e.w,h=e.z*e.z,u=e.z*e.w,d=e.w*e.w,f=n-a-h+d,g=2*(s-u),_=2*(o+c),v=2*(s+u),E=-n+a-h+d,w=2*(l-r),C=2*(o-c),P=2*(l+r),R=-n-a+h+d;return x(t)?(t[0]=f,t[1]=v,t[2]=C,t[3]=g,t[4]=E,t[5]=P,t[6]=_,t[7]=w,t[8]=R,t):new K(f,g,_,v,E,w,C,P,R)}static fromHeadingPitchRoll(e,t){y.typeOf.object("headingPitchRoll",e);const n=Math.cos(-e.pitch),s=Math.cos(-e.heading),o=Math.cos(e.roll),r=Math.sin(-e.pitch),a=Math.sin(-e.heading),l=Math.sin(e.roll),c=n*s,h=-o*a+l*r*s,u=l*a+o*r*s,d=n*a,f=o*s+l*r*a,g=-l*s+o*r*a,_=-r,v=l*n,E=o*n;return x(t)?(t[0]=c,t[1]=d,t[2]=_,t[3]=h,t[4]=f,t[5]=v,t[6]=u,t[7]=g,t[8]=E,t):new K(c,h,u,d,f,g,_,v,E)}static fromScale(e,t){return y.typeOf.object("scale",e),x(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=e.y,t[5]=0,t[6]=0,t[7]=0,t[8]=e.z,t):new K(e.x,0,0,0,e.y,0,0,0,e.z)}static fromUniformScale(e,t){return y.typeOf.number("scale",e),x(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=e,t):new K(e,0,0,0,e,0,0,0,e)}static fromCrossProduct(e,t){return y.typeOf.object("vector",e),x(t)?(t[0]=0,t[1]=e.z,t[2]=-e.y,t[3]=-e.z,t[4]=0,t[5]=e.x,t[6]=e.y,t[7]=-e.x,t[8]=0,t):new K(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)}static fromRotationX(e,t){y.typeOf.number("angle",e);const n=Math.cos(e),s=Math.sin(e);return x(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=n,t[5]=s,t[6]=0,t[7]=-s,t[8]=n,t):new K(1,0,0,0,n,-s,0,s,n)}static fromRotationY(e,t){y.typeOf.number("angle",e);const n=Math.cos(e),s=Math.sin(e);return x(t)?(t[0]=n,t[1]=0,t[2]=-s,t[3]=0,t[4]=1,t[5]=0,t[6]=s,t[7]=0,t[8]=n,t):new K(n,0,s,0,1,0,-s,0,n)}static fromRotationZ(e,t){y.typeOf.number("angle",e);const n=Math.cos(e),s=Math.sin(e);return x(t)?(t[0]=n,t[1]=s,t[2]=0,t[3]=-s,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new K(n,-s,0,s,n,0,0,0,1)}static toArray(e,t){return y.typeOf.object("matrix",e),x(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]}static getElementIndex(e,t){return y.typeOf.number.greaterThanOrEquals("row",t,0),y.typeOf.number.lessThanOrEquals("row",t,2),y.typeOf.number.greaterThanOrEquals("column",e,0),y.typeOf.number.lessThanOrEquals("column",e,2),e*3+t}static getColumn(e,t,n){y.typeOf.object("matrix",e),y.typeOf.number.greaterThanOrEquals("index",t,0),y.typeOf.number.lessThanOrEquals("index",t,2),y.typeOf.object("result",n);const s=t*3,o=e[s],r=e[s+1],a=e[s+2];return n.x=o,n.y=r,n.z=a,n}static setColumn(e,t,n,s){y.typeOf.object("matrix",e),y.typeOf.number.greaterThanOrEquals("index",t,0),y.typeOf.number.lessThanOrEquals("index",t,2),y.typeOf.object("cartesian",n),y.typeOf.object("result",s),s=K.clone(e,s);const o=t*3;return s[o]=n.x,s[o+1]=n.y,s[o+2]=n.z,s}static getRow(e,t,n){y.typeOf.object("matrix",e),y.typeOf.number.greaterThanOrEquals("index",t,0),y.typeOf.number.lessThanOrEquals("index",t,2),y.typeOf.object("result",n);const s=e[t],o=e[t+3],r=e[t+6];return n.x=s,n.y=o,n.z=r,n}static setRow(e,t,n,s){return y.typeOf.object("matrix",e),y.typeOf.number.greaterThanOrEquals("index",t,0),y.typeOf.number.lessThanOrEquals("index",t,2),y.typeOf.object("cartesian",n),y.typeOf.object("result",s),s=K.clone(e,s),s[t]=n.x,s[t+3]=n.y,s[t+6]=n.z,s}static setScale(e,t,n){y.typeOf.object("matrix",e),y.typeOf.object("scale",t),y.typeOf.object("result",n);const s=K.getScale(e,Gx),o=t.x/s.x,r=t.y/s.y,a=t.z/s.z;return n[0]=e[0]*o,n[1]=e[1]*o,n[2]=e[2]*o,n[3]=e[3]*r,n[4]=e[4]*r,n[5]=e[5]*r,n[6]=e[6]*a,n[7]=e[7]*a,n[8]=e[8]*a,n}static setUniformScale(e,t,n){y.typeOf.object("matrix",e),y.typeOf.number("scale",t),y.typeOf.object("result",n);const s=K.getScale(e,qx),o=t/s.x,r=t/s.y,a=t/s.z;return n[0]=e[0]*o,n[1]=e[1]*o,n[2]=e[2]*o,n[3]=e[3]*r,n[4]=e[4]*r,n[5]=e[5]*r,n[6]=e[6]*a,n[7]=e[7]*a,n[8]=e[8]*a,n}static getScale(e,t){return y.typeOf.object("matrix",e),y.typeOf.object("result",t),t.x=D.magnitude(D.fromElements(e[0],e[1],e[2],af)),t.y=D.magnitude(D.fromElements(e[3],e[4],e[5],af)),t.z=D.magnitude(D.fromElements(e[6],e[7],e[8],af)),t}static getMaximumScale(e){return K.getScale(e,jy),D.maximumComponent(jy)}static setRotation(e,t,n){y.typeOf.object("matrix",e),y.typeOf.object("result",n);const s=K.getScale(e,Vx);return n[0]=t[0]*s.x,n[1]=t[1]*s.x,n[2]=t[2]*s.x,n[3]=t[3]*s.y,n[4]=t[4]*s.y,n[5]=t[5]*s.y,n[6]=t[6]*s.z,n[7]=t[7]*s.z,n[8]=t[8]*s.z,n}static getRotation(e,t){y.typeOf.object("matrix",e),y.typeOf.object("result",t);const n=K.getScale(e,Wx);return t[0]=e[0]/n.x,t[1]=e[1]/n.x,t[2]=e[2]/n.x,t[3]=e[3]/n.y,t[4]=e[4]/n.y,t[5]=e[5]/n.y,t[6]=e[6]/n.z,t[7]=e[7]/n.z,t[8]=e[8]/n.z,t}static multiply(e,t,n){y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",n);const s=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],o=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],r=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],a=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],l=e[1]*t[3]+e[4]*t[4]+e[7]*t[5],c=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],h=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],u=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],d=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return n[0]=s,n[1]=o,n[2]=r,n[3]=a,n[4]=l,n[5]=c,n[6]=h,n[7]=u,n[8]=d,n}static add(e,t,n){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",n),n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n}static subtract(e,t,n){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",n),n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n}static multiplyByVector(e,t,n){y.typeOf.object("matrix",e),y.typeOf.object("cartesian",t),y.typeOf.object("result",n);const s=t.x,o=t.y,r=t.z,a=e[0]*s+e[3]*o+e[6]*r,l=e[1]*s+e[4]*o+e[7]*r,c=e[2]*s+e[5]*o+e[8]*r;return n.x=a,n.y=l,n.z=c,n}static multiplyByScalar(e,t,n){return y.typeOf.object("matrix",e),y.typeOf.number("scalar",t),y.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n}static multiplyByScale(e,t,n){return y.typeOf.object("matrix",e),y.typeOf.object("scale",t),y.typeOf.object("result",n),n[0]=e[0]*t.x,n[1]=e[1]*t.x,n[2]=e[2]*t.x,n[3]=e[3]*t.y,n[4]=e[4]*t.y,n[5]=e[5]*t.y,n[6]=e[6]*t.z,n[7]=e[7]*t.z,n[8]=e[8]*t.z,n}static multiplyByUniformScale(e,t,n){return y.typeOf.object("matrix",e),y.typeOf.number("scale",t),y.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n}static negate(e,t){return y.typeOf.object("matrix",e),y.typeOf.object("result",t),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t}static transpose(e,t){y.typeOf.object("matrix",e),y.typeOf.object("result",t);const n=e[0],s=e[3],o=e[6],r=e[1],a=e[4],l=e[7],c=e[2],h=e[5],u=e[8];return t[0]=n,t[1]=s,t[2]=o,t[3]=r,t[4]=a,t[5]=l,t[6]=c,t[7]=h,t[8]=u,t}static computeEigenDecomposition(e,t){y.typeOf.object("matrix",e);const n=F.EPSILON20,s=10;let o=0,r=0;x(t)||(t={});const a=t.unitary=K.clone(K.IDENTITY,t.unitary),l=t.diagonal=K.clone(e,t.diagonal),c=n*$x(l);for(;r<s&&Hx(l)>c;)Xx(l,Hc),K.transpose(Hc,Uy),K.multiply(l,Hc,l),K.multiply(Uy,l,l),K.multiply(a,Hc,a),++o>2&&(++r,o=0);return t}static abs(e,t){return y.typeOf.object("matrix",e),y.typeOf.object("result",t),t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t}static determinant(e){y.typeOf.object("matrix",e);const t=e[0],n=e[3],s=e[6],o=e[1],r=e[4],a=e[7],l=e[2],c=e[5],h=e[8];return t*(r*h-c*a)+o*(c*s-n*h)+l*(n*a-r*s)}static inverse(e,t){y.typeOf.object("matrix",e),y.typeOf.object("result",t);const n=e[0],s=e[1],o=e[2],r=e[3],a=e[4],l=e[5],c=e[6],h=e[7],u=e[8],d=K.determinant(e);if(Math.abs(d)<=F.EPSILON15)throw new $("matrix is not invertible");t[0]=a*u-h*l,t[1]=h*o-s*u,t[2]=s*l-a*o,t[3]=c*l-r*u,t[4]=n*u-c*o,t[5]=r*o-n*l,t[6]=r*h-c*a,t[7]=c*s-n*h,t[8]=n*a-r*s;const f=1/d;return K.multiplyByScalar(t,f,t)}static inverseTranspose(e,t){return y.typeOf.object("matrix",e),y.typeOf.object("result",t),K.inverse(K.transpose(e,Bx),t)}static equals(e,t){return e===t||x(e)&&x(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]}static equalsEpsilon(e,t,n){return n=n??0,e===t||x(e)&&x(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n}get length(){return K.packedLength}clone(e){return K.clone(this,e)}equals(e){return K.equals(this,e)}static equalsArray(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]}equalsEpsilon(e,t){return K.equalsEpsilon(this,e,t)}toString(){return`(${this[0]}, ${this[3]}, ${this[6]})
|
|
28
|
-
(
|
|
29
|
-
(${this[2]}, ${this[5]}, ${this[8]})`}}K.packedLength=9,K.fromArray=K.unpack,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;const Gx=new D,qx=new D,af=new D,jy=new D,Vx=new D,Wx=new D,Hc=new K,Uy=new K,Bx=new K;function $x(i){let e=0;for(let t=0;t<9;++t){const n=i[t];e+=n*n}return Math.sqrt(e)}const lf=[1,0,0],cf=[2,2,1];function Hx(i){let e=0;for(let t=0;t<3;++t){const n=i[K.getElementIndex(cf[t],lf[t])];e+=2*n*n}return Math.sqrt(e)}function Xx(i,e){const t=F.EPSILON15;let n=0,s=1;for(let c=0;c<3;++c){const h=Math.abs(i[K.getElementIndex(cf[c],lf[c])]);h>n&&(s=c,n=h)}let o=1,r=0;const a=lf[s],l=cf[s];if(Math.abs(i[K.getElementIndex(l,a)])>t){const c=i[K.getElementIndex(l,l)],h=i[K.getElementIndex(a,a)],u=i[K.getElementIndex(l,a)],d=(c-h)/2/u;let f;d<0?f=-1/(-d+Math.sqrt(1+d*d)):f=1/(d+Math.sqrt(1+d*d)),o=1/Math.sqrt(1+f*f),r=f*o}return e=K.clone(K.IDENTITY,e),e[K.getElementIndex(a,a)]=e[K.getElementIndex(l,l)]=o,e[K.getElementIndex(l,a)]=r,e[K.getElementIndex(a,l)]=-r,e}function En(i){this.name="RuntimeError",this.message=i;let e;try{throw new Error}catch(t){e=t.stack}this.stack=e}x(Object.create)&&(En.prototype=Object.create(Error.prototype),En.prototype.constructor=En),En.prototype.toString=function(){let i=`${this.name}: ${this.message}`;return x(this.stack)&&(i+=`
|
|
30
|
-
${this.stack.toString()}`),i};class Q{constructor(e,t,n,s,o,r,a,l,c,h,u,d,f,g,_,v){this[0]=e??0,this[1]=o??0,this[2]=c??0,this[3]=f??0,this[4]=t??0,this[5]=r??0,this[6]=h??0,this[7]=g??0,this[8]=n??0,this[9]=a??0,this[10]=u??0,this[11]=_??0,this[12]=s??0,this[13]=l??0,this[14]=d??0,this[15]=v??0}static pack(e,t,n){return y.typeOf.object("value",e),y.defined("array",t),n=n??0,t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t[n++]=e[4],t[n++]=e[5],t[n++]=e[6],t[n++]=e[7],t[n++]=e[8],t[n++]=e[9],t[n++]=e[10],t[n++]=e[11],t[n++]=e[12],t[n++]=e[13],t[n++]=e[14],t[n]=e[15],t}static unpack(e,t,n){return y.defined("array",e),t=t??0,x(n)||(n=new Q),n[0]=e[t++],n[1]=e[t++],n[2]=e[t++],n[3]=e[t++],n[4]=e[t++],n[5]=e[t++],n[6]=e[t++],n[7]=e[t++],n[8]=e[t++],n[9]=e[t++],n[10]=e[t++],n[11]=e[t++],n[12]=e[t++],n[13]=e[t++],n[14]=e[t++],n[15]=e[t],n}static packArray(e,t){y.defined("array",e);const n=e.length,s=n*16;if(!x(t))t=new Array(s);else{if(!Array.isArray(t)&&t.length!==s)throw new $("If result is a typed array, it must have exactly array.length * 16 elements");t.length!==s&&(t.length=s)}for(let o=0;o<n;++o)Q.pack(e[o],t,o*16);return t}static unpackArray(e,t){if(y.defined("array",e),y.typeOf.number.greaterThanOrEquals("array.length",e.length,16),e.length%16!==0)throw new $("array length must be a multiple of 16.");const n=e.length;x(t)?t.length=n/16:t=new Array(n/16);for(let s=0;s<n;s+=16){const o=s/16;t[o]=Q.unpack(e,s,t[o])}return t}static clone(e,t){if(x(e))return x(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):new Q(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15])}static fromColumnMajorArray(e,t){return y.defined("values",e),Q.clone(e,t)}static fromRowMajorArray(e,t){return y.defined("values",e),x(t)?(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t):new Q(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}static fromRotationTranslation(e,t,n){return y.typeOf.object("rotation",e),t=t??D.ZERO,x(n)?(n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=0,n[4]=e[3],n[5]=e[4],n[6]=e[5],n[7]=0,n[8]=e[6],n[9]=e[7],n[10]=e[8],n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,n):new Q(e[0],e[3],e[6],t.x,e[1],e[4],e[7],t.y,e[2],e[5],e[8],t.z,0,0,0,1)}static fromTranslationQuaternionRotationScale(e,t,n,s){y.typeOf.object("translation",e),y.typeOf.object("rotation",t),y.typeOf.object("scale",n),x(s)||(s=new Q);const o=n.x,r=n.y,a=n.z,l=t.x*t.x,c=t.x*t.y,h=t.x*t.z,u=t.x*t.w,d=t.y*t.y,f=t.y*t.z,g=t.y*t.w,_=t.z*t.z,v=t.z*t.w,E=t.w*t.w,w=l-d-_+E,C=2*(c-v),P=2*(h+g),R=2*(c+v),O=-l+d-_+E,I=2*(f-u),M=2*(h-g),z=2*(f+u),k=-l-d+_+E;return s[0]=w*o,s[1]=R*o,s[2]=M*o,s[3]=0,s[4]=C*r,s[5]=O*r,s[6]=z*r,s[7]=0,s[8]=P*a,s[9]=I*a,s[10]=k*a,s[11]=0,s[12]=e.x,s[13]=e.y,s[14]=e.z,s[15]=1,s}static fromTranslationRotationScale(e,t){return y.typeOf.object("translationRotationScale",e),Q.fromTranslationQuaternionRotationScale(e.translation,e.rotation,e.scale,t)}static fromTranslation(e,t){return y.typeOf.object("translation",e),Q.fromRotationTranslation(K.IDENTITY,e,t)}static fromScale(e,t){return y.typeOf.object("scale",e),x(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e.y,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e.z,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new Q(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)}static fromUniformScale(e,t){return y.typeOf.number("scale",e),x(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new Q(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)}static fromRotation(e,t){return y.typeOf.object("rotation",e),x(t)||(t=new Q),t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=0,t[4]=e[3],t[5]=e[4],t[6]=e[5],t[7]=0,t[8]=e[6],t[9]=e[7],t[10]=e[8],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}static fromCamera(e,t){y.typeOf.object("camera",e);const n=e.position,s=e.direction,o=e.up;y.typeOf.object("camera.position",n),y.typeOf.object("camera.direction",s),y.typeOf.object("camera.up",o),D.normalize(s,fr),D.normalize(D.cross(fr,o,pr),pr),D.normalize(D.cross(pr,fr,ja),ja);const r=pr.x,a=pr.y,l=pr.z,c=fr.x,h=fr.y,u=fr.z,d=ja.x,f=ja.y,g=ja.z,_=n.x,v=n.y,E=n.z,w=r*-_+a*-v+l*-E,C=d*-_+f*-v+g*-E,P=c*_+h*v+u*E;return x(t)?(t[0]=r,t[1]=d,t[2]=-c,t[3]=0,t[4]=a,t[5]=f,t[6]=-h,t[7]=0,t[8]=l,t[9]=g,t[10]=-u,t[11]=0,t[12]=w,t[13]=C,t[14]=P,t[15]=1,t):new Q(r,a,l,w,d,f,g,C,-c,-h,-u,P,0,0,0,1)}static computePerspectiveFieldOfView(e,t,n,s,o){y.typeOf.number.greaterThan("fovY",e,0),y.typeOf.number.lessThan("fovY",e,Math.PI),y.typeOf.number.greaterThan("near",n,0),y.typeOf.number.greaterThan("far",s,0),y.typeOf.object("result",o);const a=1/Math.tan(e*.5),l=a/t,c=(s+n)/(n-s),h=2*s*n/(n-s);return o[0]=l,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=a,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=c,o[11]=-1,o[12]=0,o[13]=0,o[14]=h,o[15]=0,o}static computeOrthographicOffCenter(e,t,n,s,o,r,a){y.typeOf.number("left",e),y.typeOf.number("right",t),y.typeOf.number("bottom",n),y.typeOf.number("top",s),y.typeOf.number("near",o),y.typeOf.number("far",r),y.typeOf.object("result",a);let l=1/(t-e),c=1/(s-n),h=1/(r-o);const u=-(t+e)*l,d=-(s+n)*c,f=-(r+o)*h;return l*=2,c*=2,h*=-2,a[0]=l,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=c,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=h,a[11]=0,a[12]=u,a[13]=d,a[14]=f,a[15]=1,a}static computePerspectiveOffCenter(e,t,n,s,o,r,a){y.typeOf.number("left",e),y.typeOf.number("right",t),y.typeOf.number("bottom",n),y.typeOf.number("top",s),y.typeOf.number("near",o),y.typeOf.number("far",r),y.typeOf.object("result",a);const l=2*o/(t-e),c=2*o/(s-n),h=(t+e)/(t-e),u=(s+n)/(s-n),d=-(r+o)/(r-o),f=-1,g=-2*r*o/(r-o);return a[0]=l,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=c,a[6]=0,a[7]=0,a[8]=h,a[9]=u,a[10]=d,a[11]=f,a[12]=0,a[13]=0,a[14]=g,a[15]=0,a}static computeInfinitePerspectiveOffCenter(e,t,n,s,o,r){y.typeOf.number("left",e),y.typeOf.number("right",t),y.typeOf.number("bottom",n),y.typeOf.number("top",s),y.typeOf.number("near",o),y.typeOf.object("result",r);const a=2*o/(t-e),l=2*o/(s-n),c=(t+e)/(t-e),h=(s+n)/(s-n),u=-1,d=-1,f=-2*o;return r[0]=a,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=l,r[6]=0,r[7]=0,r[8]=c,r[9]=h,r[10]=u,r[11]=d,r[12]=0,r[13]=0,r[14]=f,r[15]=0,r}static computeViewportTransformation(e,t,n,s){x(s)||(s=new Q),e=e??Ei.EMPTY_OBJECT;const o=e.x??0,r=e.y??0,a=e.width??0,l=e.height??0;t=t??0,n=n??1;const c=a*.5,h=l*.5,u=(n-t)*.5,d=c,f=h,g=u,_=o+c,v=r+h,E=t+u,w=1;return s[0]=d,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=f,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=g,s[11]=0,s[12]=_,s[13]=v,s[14]=E,s[15]=w,s}static computeView(e,t,n,s,o){return y.typeOf.object("position",e),y.typeOf.object("direction",t),y.typeOf.object("up",n),y.typeOf.object("right",s),y.typeOf.object("result",o),o[0]=s.x,o[1]=n.x,o[2]=-t.x,o[3]=0,o[4]=s.y,o[5]=n.y,o[6]=-t.y,o[7]=0,o[8]=s.z,o[9]=n.z,o[10]=-t.z,o[11]=0,o[12]=-D.dot(s,e),o[13]=-D.dot(n,e),o[14]=D.dot(t,e),o[15]=1,o}static toArray(e,t){return y.typeOf.object("matrix",e),x(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]}static getElementIndex(e,t){return y.typeOf.number.greaterThanOrEquals("row",t,0),y.typeOf.number.lessThanOrEquals("row",t,3),y.typeOf.number.greaterThanOrEquals("column",e,0),y.typeOf.number.lessThanOrEquals("column",e,3),e*4+t}static getColumn(e,t,n){y.typeOf.object("matrix",e),y.typeOf.number.greaterThanOrEquals("index",t,0),y.typeOf.number.lessThanOrEquals("index",t,3),y.typeOf.object("result",n);const s=t*4,o=e[s],r=e[s+1],a=e[s+2],l=e[s+3];return n.x=o,n.y=r,n.z=a,n.w=l,n}static setColumn(e,t,n,s){y.typeOf.object("matrix",e),y.typeOf.number.greaterThanOrEquals("index",t,0),y.typeOf.number.lessThanOrEquals("index",t,3),y.typeOf.object("cartesian",n),y.typeOf.object("result",s),s=Q.clone(e,s);const o=t*4;return s[o]=n.x,s[o+1]=n.y,s[o+2]=n.z,s[o+3]=n.w,s}static getRow(e,t,n){y.typeOf.object("matrix",e),y.typeOf.number.greaterThanOrEquals("index",t,0),y.typeOf.number.lessThanOrEquals("index",t,3),y.typeOf.object("result",n);const s=e[t],o=e[t+4],r=e[t+8],a=e[t+12];return n.x=s,n.y=o,n.z=r,n.w=a,n}static setRow(e,t,n,s){return y.typeOf.object("matrix",e),y.typeOf.number.greaterThanOrEquals("index",t,0),y.typeOf.number.lessThanOrEquals("index",t,3),y.typeOf.object("cartesian",n),y.typeOf.object("result",s),s=Q.clone(e,s),s[t]=n.x,s[t+4]=n.y,s[t+8]=n.z,s[t+12]=n.w,s}static setTranslation(e,t,n){return y.typeOf.object("matrix",e),y.typeOf.object("translation",t),y.typeOf.object("result",n),n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=e[15],n}static setScale(e,t,n){y.typeOf.object("matrix",e),y.typeOf.object("scale",t),y.typeOf.object("result",n);const s=Q.getScale(e,Yx),o=t.x/s.x,r=t.y/s.y,a=t.z/s.z;return n[0]=e[0]*o,n[1]=e[1]*o,n[2]=e[2]*o,n[3]=e[3],n[4]=e[4]*r,n[5]=e[5]*r,n[6]=e[6]*r,n[7]=e[7],n[8]=e[8]*a,n[9]=e[9]*a,n[10]=e[10]*a,n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n}static setUniformScale(e,t,n){y.typeOf.object("matrix",e),y.typeOf.number("scale",t),y.typeOf.object("result",n);const s=Q.getScale(e,Zx),o=t/s.x,r=t/s.y,a=t/s.z;return n[0]=e[0]*o,n[1]=e[1]*o,n[2]=e[2]*o,n[3]=e[3],n[4]=e[4]*r,n[5]=e[5]*r,n[6]=e[6]*r,n[7]=e[7],n[8]=e[8]*a,n[9]=e[9]*a,n[10]=e[10]*a,n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n}static getScale(e,t){return y.typeOf.object("matrix",e),y.typeOf.object("result",t),t.x=D.magnitude(D.fromElements(e[0],e[1],e[2],hf)),t.y=D.magnitude(D.fromElements(e[4],e[5],e[6],hf)),t.z=D.magnitude(D.fromElements(e[8],e[9],e[10],hf)),t}static getMaximumScale(e){return Q.getScale(e,Gy),D.maximumComponent(Gy)}static setRotation(e,t,n){y.typeOf.object("matrix",e),y.typeOf.object("result",n);const s=Q.getScale(e,Kx);return n[0]=t[0]*s.x,n[1]=t[1]*s.x,n[2]=t[2]*s.x,n[3]=e[3],n[4]=t[3]*s.y,n[5]=t[4]*s.y,n[6]=t[5]*s.y,n[7]=e[7],n[8]=t[6]*s.z,n[9]=t[7]*s.z,n[10]=t[8]*s.z,n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n}static getRotation(e,t){y.typeOf.object("matrix",e),y.typeOf.object("result",t);const n=Q.getScale(e,Qx);return t[0]=e[0]/n.x,t[1]=e[1]/n.x,t[2]=e[2]/n.x,t[3]=e[4]/n.y,t[4]=e[5]/n.y,t[5]=e[6]/n.y,t[6]=e[8]/n.z,t[7]=e[9]/n.z,t[8]=e[10]/n.z,t}static multiply(e,t,n){y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",n);const s=e[0],o=e[1],r=e[2],a=e[3],l=e[4],c=e[5],h=e[6],u=e[7],d=e[8],f=e[9],g=e[10],_=e[11],v=e[12],E=e[13],w=e[14],C=e[15],P=t[0],R=t[1],O=t[2],I=t[3],M=t[4],z=t[5],k=t[6],q=t[7],H=t[8],m=t[9],b=t[10],S=t[11],L=t[12],N=t[13],j=t[14],U=t[15],B=s*P+l*R+d*O+v*I,X=o*P+c*R+f*O+E*I,G=r*P+h*R+g*O+w*I,ae=a*P+u*R+_*O+C*I,te=s*M+l*z+d*k+v*q,V=o*M+c*z+f*k+E*q,re=r*M+h*z+g*k+w*q,ie=a*M+u*z+_*k+C*q,he=s*H+l*m+d*b+v*S,me=o*H+c*m+f*b+E*S,Fe=r*H+h*m+g*b+w*S,ue=a*H+u*m+_*b+C*S,ze=s*L+l*N+d*j+v*U,J=o*L+c*N+f*j+E*U,dt=r*L+h*N+g*j+w*U,Qe=a*L+u*N+_*j+C*U;return n[0]=B,n[1]=X,n[2]=G,n[3]=ae,n[4]=te,n[5]=V,n[6]=re,n[7]=ie,n[8]=he,n[9]=me,n[10]=Fe,n[11]=ue,n[12]=ze,n[13]=J,n[14]=dt,n[15]=Qe,n}static add(e,t,n){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",n),n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n[9]=e[9]+t[9],n[10]=e[10]+t[10],n[11]=e[11]+t[11],n[12]=e[12]+t[12],n[13]=e[13]+t[13],n[14]=e[14]+t[14],n[15]=e[15]+t[15],n}static subtract(e,t,n){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",n),n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n[9]=e[9]-t[9],n[10]=e[10]-t[10],n[11]=e[11]-t[11],n[12]=e[12]-t[12],n[13]=e[13]-t[13],n[14]=e[14]-t[14],n[15]=e[15]-t[15],n}static multiplyTransformation(e,t,n){y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",n);const s=e[0],o=e[1],r=e[2],a=e[4],l=e[5],c=e[6],h=e[8],u=e[9],d=e[10],f=e[12],g=e[13],_=e[14],v=t[0],E=t[1],w=t[2],C=t[4],P=t[5],R=t[6],O=t[8],I=t[9],M=t[10],z=t[12],k=t[13],q=t[14],H=s*v+a*E+h*w,m=o*v+l*E+u*w,b=r*v+c*E+d*w,S=s*C+a*P+h*R,L=o*C+l*P+u*R,N=r*C+c*P+d*R,j=s*O+a*I+h*M,U=o*O+l*I+u*M,B=r*O+c*I+d*M,X=s*z+a*k+h*q+f,G=o*z+l*k+u*q+g,ae=r*z+c*k+d*q+_;return n[0]=H,n[1]=m,n[2]=b,n[3]=0,n[4]=S,n[5]=L,n[6]=N,n[7]=0,n[8]=j,n[9]=U,n[10]=B,n[11]=0,n[12]=X,n[13]=G,n[14]=ae,n[15]=1,n}static multiplyByMatrix3(e,t,n){y.typeOf.object("matrix",e),y.typeOf.object("rotation",t),y.typeOf.object("result",n);const s=e[0],o=e[1],r=e[2],a=e[4],l=e[5],c=e[6],h=e[8],u=e[9],d=e[10],f=t[0],g=t[1],_=t[2],v=t[3],E=t[4],w=t[5],C=t[6],P=t[7],R=t[8],O=s*f+a*g+h*_,I=o*f+l*g+u*_,M=r*f+c*g+d*_,z=s*v+a*E+h*w,k=o*v+l*E+u*w,q=r*v+c*E+d*w,H=s*C+a*P+h*R,m=o*C+l*P+u*R,b=r*C+c*P+d*R;return n[0]=O,n[1]=I,n[2]=M,n[3]=0,n[4]=z,n[5]=k,n[6]=q,n[7]=0,n[8]=H,n[9]=m,n[10]=b,n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n}static multiplyByTranslation(e,t,n){y.typeOf.object("matrix",e),y.typeOf.object("translation",t),y.typeOf.object("result",n);const s=t.x,o=t.y,r=t.z,a=s*e[0]+o*e[4]+r*e[8]+e[12],l=s*e[1]+o*e[5]+r*e[9]+e[13],c=s*e[2]+o*e[6]+r*e[10]+e[14];return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=a,n[13]=l,n[14]=c,n[15]=e[15],n}static multiplyByScale(e,t,n){y.typeOf.object("matrix",e),y.typeOf.object("scale",t),y.typeOf.object("result",n);const s=t.x,o=t.y,r=t.z;return s===1&&o===1&&r===1?Q.clone(e,n):(n[0]=s*e[0],n[1]=s*e[1],n[2]=s*e[2],n[3]=e[3],n[4]=o*e[4],n[5]=o*e[5],n[6]=o*e[6],n[7]=e[7],n[8]=r*e[8],n[9]=r*e[9],n[10]=r*e[10],n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n)}static multiplyByUniformScale(e,t,n){return y.typeOf.object("matrix",e),y.typeOf.number("scale",t),y.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3],n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7],n[8]=e[8]*t,n[9]=e[9]*t,n[10]=e[10]*t,n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n}static multiplyByVector(e,t,n){y.typeOf.object("matrix",e),y.typeOf.object("cartesian",t),y.typeOf.object("result",n);const s=t.x,o=t.y,r=t.z,a=t.w,l=e[0]*s+e[4]*o+e[8]*r+e[12]*a,c=e[1]*s+e[5]*o+e[9]*r+e[13]*a,h=e[2]*s+e[6]*o+e[10]*r+e[14]*a,u=e[3]*s+e[7]*o+e[11]*r+e[15]*a;return n.x=l,n.y=c,n.z=h,n.w=u,n}static multiplyByPointAsVector(e,t,n){y.typeOf.object("matrix",e),y.typeOf.object("cartesian",t),y.typeOf.object("result",n);const s=t.x,o=t.y,r=t.z,a=e[0]*s+e[4]*o+e[8]*r,l=e[1]*s+e[5]*o+e[9]*r,c=e[2]*s+e[6]*o+e[10]*r;return n.x=a,n.y=l,n.z=c,n}static multiplyByPoint(e,t,n){y.typeOf.object("matrix",e),y.typeOf.object("cartesian",t),y.typeOf.object("result",n);const s=t.x,o=t.y,r=t.z,a=e[0]*s+e[4]*o+e[8]*r+e[12],l=e[1]*s+e[5]*o+e[9]*r+e[13],c=e[2]*s+e[6]*o+e[10]*r+e[14];return n.x=a,n.y=l,n.z=c,n}static multiplyByScalar(e,t,n){return y.typeOf.object("matrix",e),y.typeOf.number("scalar",t),y.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n[9]=e[9]*t,n[10]=e[10]*t,n[11]=e[11]*t,n[12]=e[12]*t,n[13]=e[13]*t,n[14]=e[14]*t,n[15]=e[15]*t,n}static negate(e,t){return y.typeOf.object("matrix",e),y.typeOf.object("result",t),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t}static transpose(e,t){y.typeOf.object("matrix",e),y.typeOf.object("result",t);const n=e[1],s=e[2],o=e[3],r=e[6],a=e[7],l=e[11];return t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=s,t[9]=r,t[10]=e[10],t[11]=e[14],t[12]=o,t[13]=a,t[14]=l,t[15]=e[15],t}static abs(e,t){return y.typeOf.object("matrix",e),y.typeOf.object("result",t),t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t[9]=Math.abs(e[9]),t[10]=Math.abs(e[10]),t[11]=Math.abs(e[11]),t[12]=Math.abs(e[12]),t[13]=Math.abs(e[13]),t[14]=Math.abs(e[14]),t[15]=Math.abs(e[15]),t}static equals(e,t){return e===t||x(e)&&x(t)&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[3]===t[3]&&e[7]===t[7]&&e[11]===t[11]&&e[15]===t[15]}static equalsEpsilon(e,t,n){return n=n??0,e===t||x(e)&&x(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n&&Math.abs(e[9]-t[9])<=n&&Math.abs(e[10]-t[10])<=n&&Math.abs(e[11]-t[11])<=n&&Math.abs(e[12]-t[12])<=n&&Math.abs(e[13]-t[13])<=n&&Math.abs(e[14]-t[14])<=n&&Math.abs(e[15]-t[15])<=n}static getTranslation(e,t){return y.typeOf.object("matrix",e),y.typeOf.object("result",t),t.x=e[12],t.y=e[13],t.z=e[14],t}static getMatrix3(e,t){return y.typeOf.object("matrix",e),y.typeOf.object("result",t),t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t}static inverse(e,t){y.typeOf.object("matrix",e),y.typeOf.object("result",t);const n=e[0],s=e[4],o=e[8],r=e[12],a=e[1],l=e[5],c=e[9],h=e[13],u=e[2],d=e[6],f=e[10],g=e[14],_=e[3],v=e[7],E=e[11],w=e[15];let C=f*w,P=g*E,R=d*w,O=g*v,I=d*E,M=f*v,z=u*w,k=g*_,q=u*E,H=f*_,m=u*v,b=d*_;const S=C*l+O*c+I*h-(P*l+R*c+M*h),L=P*a+z*c+H*h-(C*a+k*c+q*h),N=R*a+k*l+m*h-(O*a+z*l+b*h),j=M*a+q*l+b*c-(I*a+H*l+m*c),U=P*s+R*o+M*r-(C*s+O*o+I*r),B=C*n+k*o+q*r-(P*n+z*o+H*r),X=O*n+z*s+b*r-(R*n+k*s+m*r),G=I*n+H*s+m*o-(M*n+q*s+b*o);C=o*h,P=r*c,R=s*h,O=r*l,I=s*c,M=o*l,z=n*h,k=r*a,q=n*c,H=o*a,m=n*l,b=s*a;const ae=C*v+O*E+I*w-(P*v+R*E+M*w),te=P*_+z*E+H*w-(C*_+k*E+q*w),V=R*_+k*v+m*w-(O*_+z*v+b*w),re=M*_+q*v+b*E-(I*_+H*v+m*E),ie=R*f+M*g+P*d-(I*g+C*d+O*f),he=q*g+C*u+k*f-(z*f+H*g+P*u),me=z*d+b*g+O*u-(m*g+R*u+k*d),Fe=m*f+I*u+H*d-(q*d+b*f+M*u);let ue=n*S+s*L+o*N+r*j;if(Math.abs(ue)<F.EPSILON21){if(K.equalsEpsilon(Q.getMatrix3(e,Jx),eP,F.EPSILON7)&&ce.equals(Q.getRow(e,3,tP),nP))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]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=1,t;throw new En("matrix is not invertible because its determinate is zero.")}return ue=1/ue,t[0]=S*ue,t[1]=L*ue,t[2]=N*ue,t[3]=j*ue,t[4]=U*ue,t[5]=B*ue,t[6]=X*ue,t[7]=G*ue,t[8]=ae*ue,t[9]=te*ue,t[10]=V*ue,t[11]=re*ue,t[12]=ie*ue,t[13]=he*ue,t[14]=me*ue,t[15]=Fe*ue,t}static inverseTransformation(e,t){y.typeOf.object("matrix",e),y.typeOf.object("result",t);const n=e[0],s=e[1],o=e[2],r=e[4],a=e[5],l=e[6],c=e[8],h=e[9],u=e[10],d=e[12],f=e[13],g=e[14],_=-n*d-s*f-o*g,v=-r*d-a*f-l*g,E=-c*d-h*f-u*g;return t[0]=n,t[1]=r,t[2]=c,t[3]=0,t[4]=s,t[5]=a,t[6]=h,t[7]=0,t[8]=o,t[9]=l,t[10]=u,t[11]=0,t[12]=_,t[13]=v,t[14]=E,t[15]=1,t}static inverseTranspose(e,t){return y.typeOf.object("matrix",e),y.typeOf.object("result",t),Q.inverse(Q.transpose(e,iP),t)}get length(){return Q.packedLength}clone(e){return Q.clone(this,e)}equals(e){return Q.equals(this,e)}static equalsArray(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]&&e[9]===t[n+9]&&e[10]===t[n+10]&&e[11]===t[n+11]&&e[12]===t[n+12]&&e[13]===t[n+13]&&e[14]===t[n+14]&&e[15]===t[n+15]}equalsEpsilon(e,t){return Q.equalsEpsilon(this,e,t)}toString(){return`(${this[0]}, ${this[4]}, ${this[8]}, ${this[12]})
|
|
31
|
-
(${this[1]}, ${this[5]}, ${this[9]}, ${this[13]})
|
|
32
|
-
(${this[2]}, ${this[6]}, ${this[10]}, ${this[14]})
|
|
33
|
-
(${this[3]}, ${this[7]}, ${this[11]}, ${this[15]})`}}Q.packedLength=16,Q.fromArray=Q.unpack,Q.IDENTITY=Object.freeze(new Q(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),Q.ZERO=Object.freeze(new Q(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)),Q.COLUMN0ROW0=0,Q.COLUMN0ROW1=1,Q.COLUMN0ROW2=2,Q.COLUMN0ROW3=3,Q.COLUMN1ROW0=4,Q.COLUMN1ROW1=5,Q.COLUMN1ROW2=6,Q.COLUMN1ROW3=7,Q.COLUMN2ROW0=8,Q.COLUMN2ROW1=9,Q.COLUMN2ROW2=10,Q.COLUMN2ROW3=11,Q.COLUMN3ROW0=12,Q.COLUMN3ROW1=13,Q.COLUMN3ROW2=14,Q.COLUMN3ROW3=15;const fr=new D,pr=new D,ja=new D,Yx=new D,Zx=new D,hf=new D,Gy=new D,Kx=new D,Qx=new D,Jx=new K,eP=new K,tP=new ce,nP=new ce(0,0,0,1),iP=new Q;let Ds;const gt={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},fn={};Object.defineProperties(fn,{element:{get:function(){if(fn.supportsFullscreen())return document[gt.fullscreenElement]}},changeEventName:{get:function(){if(fn.supportsFullscreen())return gt.fullscreenchange}},errorEventName:{get:function(){if(fn.supportsFullscreen())return gt.fullscreenerror}},enabled:{get:function(){if(fn.supportsFullscreen())return document[gt.fullscreenEnabled]}},fullscreen:{get:function(){if(fn.supportsFullscreen())return fn.element!==null}}}),fn.supportsFullscreen=function(){if(x(Ds))return Ds;Ds=!1;const i=document.body;if(typeof i.requestFullscreen=="function")return gt.requestFullscreen="requestFullscreen",gt.exitFullscreen="exitFullscreen",gt.fullscreenEnabled="fullscreenEnabled",gt.fullscreenElement="fullscreenElement",gt.fullscreenchange="fullscreenchange",gt.fullscreenerror="fullscreenerror",Ds=!0,Ds;const e=["webkit","moz","o","ms","khtml"];let t;for(let n=0,s=e.length;n<s;++n){const o=e[n];t=`${o}RequestFullscreen`,typeof i[t]=="function"?(gt.requestFullscreen=t,Ds=!0):(t=`${o}RequestFullScreen`,typeof i[t]=="function"&&(gt.requestFullscreen=t,Ds=!0)),t=`${o}ExitFullscreen`,typeof document[t]=="function"?gt.exitFullscreen=t:(t=`${o}CancelFullScreen`,typeof document[t]=="function"&&(gt.exitFullscreen=t)),t=`${o}FullscreenEnabled`,document[t]!==void 0?gt.fullscreenEnabled=t:(t=`${o}FullScreenEnabled`,document[t]!==void 0&&(gt.fullscreenEnabled=t)),t=`${o}FullscreenElement`,document[t]!==void 0?gt.fullscreenElement=t:(t=`${o}FullScreenElement`,document[t]!==void 0&&(gt.fullscreenElement=t)),t=`${o}fullscreenchange`,document[`on${t}`]!==void 0&&(o==="ms"&&(t="MSFullscreenChange"),gt.fullscreenchange=t),t=`${o}fullscreenerror`,document[`on${t}`]!==void 0&&(o==="ms"&&(t="MSFullscreenError"),gt.fullscreenerror=t)}return Ds},fn.requestFullscreen=function(i,e){fn.supportsFullscreen()&&i[gt.requestFullscreen]({vrDisplay:e})},fn.exitFullscreen=function(){fn.supportsFullscreen()&&document[gt.exitFullscreen]()},fn._names=gt;let kn;typeof navigator<"u"?kn=navigator:kn={};function Ua(i){const e=i.split(".");for(let t=0,n=e.length;t<n;++t)e[t]=parseInt(e[t],10);return e}let Xc,qy;function uf(){if(!x(Xc)&&(Xc=!1,!Qc())){const i=/ Chrome\/([\.0-9]+)/.exec(kn.userAgent);i!==null&&(Xc=!0,qy=Ua(i[1]))}return Xc}function sP(){return uf()&&qy}let Yc,Vy;function Wy(){if(!x(Yc)&&(Yc=!1,!uf()&&!Qc()&&/ Safari\/[\.0-9]+/.test(kn.userAgent))){const i=/ Version\/([\.0-9]+)/.exec(kn.userAgent);i!==null&&(Yc=!0,Vy=Ua(i[1]))}return Yc}function oP(){return Wy()&&Vy}let Zc,df;function By(){if(!x(Zc)){Zc=!1;const i=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(kn.userAgent);i!==null&&(Zc=!0,df=Ua(i[1]),df.isNightly=!!i[2])}return Zc}function rP(){return By()&&df}let Kc,$y;function Qc(){if(!x(Kc)){Kc=!1;const i=/ Edg\/([\.0-9]+)/.exec(kn.userAgent);i!==null&&(Kc=!0,$y=Ua(i[1]))}return Kc}function aP(){return Qc()&&$y}let Jc,ff;function eh(){if(!x(Jc)){Jc=!1;const i=/Firefox\/([\.0-9]+)/.exec(kn.userAgent);i!==null&&(Jc=!0,ff=Ua(i[1]))}return Jc}let pf;function lP(){return x(pf)||(pf=/Windows/i.test(kn.appVersion)),pf}let gf;function cP(){return x(gf)||(gf=navigator.platform==="iPhone"||navigator.platform==="iPod"||navigator.platform==="iPad"),gf}function hP(){return eh()&&ff}let mf;function uP(){return x(mf)||(mf=!eh()&&typeof PointerEvent<"u"&&(!x(kn.pointerEnabled)||kn.pointerEnabled)),mf}let Hy,th;function Xy(){if(!x(th)){const i=document.createElement("canvas");i.setAttribute("style","image-rendering: -moz-crisp-edges;image-rendering: pixelated;");const e=i.style.imageRendering;th=x(e)&&e!=="",th&&(Hy=e)}return th}function dP(){return Xy()?Hy:void 0}function Yt(){if(!Yt.initialized)throw new $("You must call FeatureDetection.supportsWebP.initialize and wait for the promise to resolve before calling FeatureDetection.supportsWebP");return Yt._result}Yt._promise=void 0,Yt._result=void 0,Yt.initialize=function(){return x(Yt._promise)||(Yt._promise=new Promise(i=>{const e=new Image;e.onload=function(){Yt._result=e.width>0&&e.height>0,i(Yt._result)},e.onerror=function(){Yt._result=!1,i(Yt._result)},e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA"})),Yt._promise},Object.defineProperties(Yt,{initialized:{get:function(){return x(Yt._result)}}});const gr=[];typeof ArrayBuffer<"u"&&(gr.push(Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array),typeof Uint8ClampedArray<"u"&&gr.push(Uint8ClampedArray),typeof Uint8ClampedArray<"u"&&gr.push(Uint8ClampedArray),typeof BigInt64Array<"u"&&gr.push(BigInt64Array),typeof BigUint64Array<"u"&&gr.push(BigUint64Array));const Zt={isChrome:uf,chromeVersion:sP,isSafari:Wy,safariVersion:oP,isWebkit:By,webkitVersion:rP,isEdge:Qc,edgeVersion:aP,isFirefox:eh,firefoxVersion:hP,isWindows:lP,isIPadOrIOS:cP,hardwareConcurrency:kn.hardwareConcurrency??3,supportsPointerEvents:uP,supportsImageRenderingPixelated:Xy,supportsWebP:Yt,imageRenderingValue:dP,typedArrayTypes:gr};Zt.supportsBasis=function(i){return Zt.supportsWebAssembly()&&i.context.supportsBasis},Zt.supportsFullscreen=function(){return fn.supportsFullscreen()},Zt.supportsTypedArrays=function(){return typeof ArrayBuffer<"u"},Zt.supportsBigInt64Array=function(){return typeof BigInt64Array<"u"},Zt.supportsBigUint64Array=function(){return typeof BigUint64Array<"u"},Zt.supportsBigInt=function(){return typeof BigInt<"u"},Zt.supportsWebWorkers=function(){return typeof Worker<"u"},Zt.supportsWebAssembly=function(){return typeof WebAssembly<"u"},Zt.supportsWebgl2=function(i){return y.defined("scene",i),i.context.webgl2},Zt.supportsEsmWebWorkers=function(){return!eh()||parseInt(ff)>=114};function yf(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t*6<1?i+(e-i)*6*t:t*2<1?e:t*3<2?i+(e-i)*(2/3-t)*6:i}let A=class Ne{constructor(e,t,n,s){this.red=e??1,this.green=t??1,this.blue=n??1,this.alpha=s??1}static fromCartesian4(e,t){return y.typeOf.object("cartesian",e),x(t)?(t.red=e.x,t.green=e.y,t.blue=e.z,t.alpha=e.w,t):new Ne(e.x,e.y,e.z,e.w)}static fromBytes(e,t,n,s,o){return e=Ne.byteToFloat(e??255),t=Ne.byteToFloat(t??255),n=Ne.byteToFloat(n??255),s=Ne.byteToFloat(s??255),x(o)?(o.red=e,o.green=t,o.blue=n,o.alpha=s,o):new Ne(e,t,n,s)}static fromAlpha(e,t,n){return y.typeOf.object("color",e),y.typeOf.number("alpha",t),x(n)?(n.red=e.red,n.green=e.green,n.blue=e.blue,n.alpha=t,n):new Ne(e.red,e.green,e.blue,t)}static fromRgba(e,t){return wf[0]=e,Ne.fromBytes(Zi[0],Zi[1],Zi[2],Zi[3],t)}static fromHsl(e,t,n,s,o){e=(e??0)%1,t=t??0,n=n??0,s=s??1;let r=n,a=n,l=n;if(t!==0){let c;n<.5?c=n*(1+t):c=n+t-n*t;const h=2*n-c;r=yf(h,c,e+1/3),a=yf(h,c,e),l=yf(h,c,e-1/3)}return x(o)?(o.red=r,o.green=a,o.blue=l,o.alpha=s,o):new Ne(r,a,l,s)}static fromRandom(e,t){e=e??Ei.EMPTY_OBJECT;let n=e.red;if(!x(n)){const a=e.minimumRed??0,l=e.maximumRed??1;y.typeOf.number.lessThanOrEquals("minimumRed",a,l),n=a+F.nextRandomNumber()*(l-a)}let s=e.green;if(!x(s)){const a=e.minimumGreen??0,l=e.maximumGreen??1;y.typeOf.number.lessThanOrEquals("minimumGreen",a,l),s=a+F.nextRandomNumber()*(l-a)}let o=e.blue;if(!x(o)){const a=e.minimumBlue??0,l=e.maximumBlue??1;y.typeOf.number.lessThanOrEquals("minimumBlue",a,l),o=a+F.nextRandomNumber()*(l-a)}let r=e.alpha;if(!x(r)){const a=e.minimumAlpha??0,l=e.maximumAlpha??1;y.typeOf.number.lessThanOrEquals("minimumAlpha",a,l),r=a+F.nextRandomNumber()*(l-a)}return x(t)?(t.red=n,t.green=s,t.blue=o,t.alpha=r,t):new Ne(n,s,o,r)}static fromCssColorString(e,t){y.typeOf.string("color",e),x(t)||(t=new Ne),e=e.trim();const n=Ne[e.toUpperCase()];if(x(n))return Ne.clone(n,t),t;let s=fP.exec(e);return s!==null?(t.red=parseInt(s[1],16)/15,t.green=parseInt(s[2],16)/15,t.blue=parseInt(s[3],16)/15,t.alpha=parseInt(s[4]??"f",16)/15,t):(s=pP.exec(e),s!==null?(t.red=parseInt(s[1],16)/255,t.green=parseInt(s[2],16)/255,t.blue=parseInt(s[3],16)/255,t.alpha=parseInt(s[4]??"ff",16)/255,t):(s=gP.exec(e),s!==null?(t.red=parseFloat(s[1])/(s[1].substr(-1)==="%"?100:255),t.green=parseFloat(s[2])/(s[2].substr(-1)==="%"?100:255),t.blue=parseFloat(s[3])/(s[3].substr(-1)==="%"?100:255),t.alpha=parseFloat(s[4]??"1.0"),t):(s=mP.exec(e),s!==null?Ne.fromHsl(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,parseFloat(s[4]??"1.0"),t):(t=void 0,t))))}static pack(e,t,n){return y.typeOf.object("value",e),y.defined("array",t),n=n??0,t[n++]=e.red,t[n++]=e.green,t[n++]=e.blue,t[n]=e.alpha,t}static unpack(e,t,n){return y.defined("array",e),t=t??0,x(n)||(n=new Ne),n.red=e[t++],n.green=e[t++],n.blue=e[t++],n.alpha=e[t],n}static byteToFloat(e){return e/255}static floatToByte(e){return e===1?255:e*256|0}static clone(e,t){if(x(e))return x(t)?(t.red=e.red,t.green=e.green,t.blue=e.blue,t.alpha=e.alpha,t):new Ne(e.red,e.green,e.blue,e.alpha)}static equals(e,t){return e===t||x(e)&&x(t)&&e.red===t.red&&e.green===t.green&&e.blue===t.blue&&e.alpha===t.alpha}static equalsArray(e,t,n){return e.red===t[n]&&e.green===t[n+1]&&e.blue===t[n+2]&&e.alpha===t[n+3]}clone(e){return Ne.clone(this,e)}equals(e){return Ne.equals(this,e)}equalsEpsilon(e,t){return this===e||x(e)&&Math.abs(this.red-e.red)<=t&&Math.abs(this.green-e.green)<=t&&Math.abs(this.blue-e.blue)<=t&&Math.abs(this.alpha-e.alpha)<=t}toString(){return`(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`}toCssColorString(){const e=Ne.floatToByte(this.red),t=Ne.floatToByte(this.green),n=Ne.floatToByte(this.blue);return this.alpha===1?`rgb(${e},${t},${n})`:`rgba(${e},${t},${n},${this.alpha})`}toCssHexString(){let e=Ne.floatToByte(this.red).toString(16);e.length<2&&(e=`0${e}`);let t=Ne.floatToByte(this.green).toString(16);t.length<2&&(t=`0${t}`);let n=Ne.floatToByte(this.blue).toString(16);if(n.length<2&&(n=`0${n}`),this.alpha<1){let s=Ne.floatToByte(this.alpha).toString(16);return s.length<2&&(s=`0${s}`),`#${e}${t}${n}${s}`}return`#${e}${t}${n}`}toBytes(e){const t=Ne.floatToByte(this.red),n=Ne.floatToByte(this.green),s=Ne.floatToByte(this.blue),o=Ne.floatToByte(this.alpha);return x(e)?(e[0]=t,e[1]=n,e[2]=s,e[3]=o,e):[t,n,s,o]}static bytesToRgba(e,t,n,s){return Zi[0]=e,Zi[1]=t,Zi[2]=n,Zi[3]=s,wf[0]}toRgba(){return Ne.bytesToRgba(Ne.floatToByte(this.red),Ne.floatToByte(this.green),Ne.floatToByte(this.blue),Ne.floatToByte(this.alpha))}brighten(e,t){return y.typeOf.number("magnitude",e),y.typeOf.number.greaterThanOrEquals("magnitude",e,0),y.typeOf.object("result",t),e=1-e,t.red=1-(1-this.red)*e,t.green=1-(1-this.green)*e,t.blue=1-(1-this.blue)*e,t.alpha=this.alpha,t}darken(e,t){return y.typeOf.number("magnitude",e),y.typeOf.number.greaterThanOrEquals("magnitude",e,0),y.typeOf.object("result",t),e=1-e,t.red=this.red*e,t.green=this.green*e,t.blue=this.blue*e,t.alpha=this.alpha,t}withAlpha(e,t){return Ne.fromAlpha(this,e,t)}static add(e,t,n){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",n),n.red=e.red+t.red,n.green=e.green+t.green,n.blue=e.blue+t.blue,n.alpha=e.alpha+t.alpha,n}static subtract(e,t,n){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",n),n.red=e.red-t.red,n.green=e.green-t.green,n.blue=e.blue-t.blue,n.alpha=e.alpha-t.alpha,n}static multiply(e,t,n){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",n),n.red=e.red*t.red,n.green=e.green*t.green,n.blue=e.blue*t.blue,n.alpha=e.alpha*t.alpha,n}static divide(e,t,n){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",n),n.red=e.red/t.red,n.green=e.green/t.green,n.blue=e.blue/t.blue,n.alpha=e.alpha/t.alpha,n}static mod(e,t,n){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",n),n.red=e.red%t.red,n.green=e.green%t.green,n.blue=e.blue%t.blue,n.alpha=e.alpha%t.alpha,n}static lerp(e,t,n,s){return y.typeOf.object("start",e),y.typeOf.object("end",t),y.typeOf.number("t",n),y.typeOf.object("result",s),s.red=F.lerp(e.red,t.red,n),s.green=F.lerp(e.green,t.green,n),s.blue=F.lerp(e.blue,t.blue,n),s.alpha=F.lerp(e.alpha,t.alpha,n),s}static multiplyByScalar(e,t,n){return y.typeOf.object("color",e),y.typeOf.number("scalar",t),y.typeOf.object("result",n),n.red=e.red*t,n.green=e.green*t,n.blue=e.blue*t,n.alpha=e.alpha*t,n}static divideByScalar(e,t,n){return y.typeOf.object("color",e),y.typeOf.number("scalar",t),y.typeOf.object("result",n),n.red=e.red/t,n.green=e.green/t,n.blue=e.blue/t,n.alpha=e.alpha/t,n}},_f,wf,Zi;Zt.supportsTypedArrays()&&(_f=new ArrayBuffer(4),wf=new Uint32Array(_f),Zi=new Uint8Array(_f));const fP=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,pP=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,gP=/^rgba?\s*\(\s*([0-9.]+%?)\s*[,\s]+\s*([0-9.]+%?)\s*[,\s]+\s*([0-9.]+%?)(?:\s*[,\s/]+\s*([0-9.]+))?\s*\)$/i,mP=/^hsla?\s*\(\s*([0-9.]+)\s*[,\s]+\s*([0-9.]+%)\s*[,\s]+\s*([0-9.]+%)(?:\s*[,\s/]+\s*([0-9.]+))?\s*\)$/i;A.packedLength=4,A.ALICEBLUE=Object.freeze(A.fromCssColorString("#F0F8FF")),A.ANTIQUEWHITE=Object.freeze(A.fromCssColorString("#FAEBD7")),A.AQUA=Object.freeze(A.fromCssColorString("#00FFFF")),A.AQUAMARINE=Object.freeze(A.fromCssColorString("#7FFFD4")),A.AZURE=Object.freeze(A.fromCssColorString("#F0FFFF")),A.BEIGE=Object.freeze(A.fromCssColorString("#F5F5DC")),A.BISQUE=Object.freeze(A.fromCssColorString("#FFE4C4")),A.BLACK=Object.freeze(A.fromCssColorString("#000000")),A.BLANCHEDALMOND=Object.freeze(A.fromCssColorString("#FFEBCD")),A.BLUE=Object.freeze(A.fromCssColorString("#0000FF")),A.BLUEVIOLET=Object.freeze(A.fromCssColorString("#8A2BE2")),A.BROWN=Object.freeze(A.fromCssColorString("#A52A2A")),A.BURLYWOOD=Object.freeze(A.fromCssColorString("#DEB887")),A.CADETBLUE=Object.freeze(A.fromCssColorString("#5F9EA0")),A.CHARTREUSE=Object.freeze(A.fromCssColorString("#7FFF00")),A.CHOCOLATE=Object.freeze(A.fromCssColorString("#D2691E")),A.CORAL=Object.freeze(A.fromCssColorString("#FF7F50")),A.CORNFLOWERBLUE=Object.freeze(A.fromCssColorString("#6495ED")),A.CORNSILK=Object.freeze(A.fromCssColorString("#FFF8DC")),A.CRIMSON=Object.freeze(A.fromCssColorString("#DC143C")),A.CYAN=Object.freeze(A.fromCssColorString("#00FFFF")),A.DARKBLUE=Object.freeze(A.fromCssColorString("#00008B")),A.DARKCYAN=Object.freeze(A.fromCssColorString("#008B8B")),A.DARKGOLDENROD=Object.freeze(A.fromCssColorString("#B8860B")),A.DARKGRAY=Object.freeze(A.fromCssColorString("#A9A9A9")),A.DARKGREEN=Object.freeze(A.fromCssColorString("#006400")),A.DARKGREY=A.DARKGRAY,A.DARKKHAKI=Object.freeze(A.fromCssColorString("#BDB76B")),A.DARKMAGENTA=Object.freeze(A.fromCssColorString("#8B008B")),A.DARKOLIVEGREEN=Object.freeze(A.fromCssColorString("#556B2F")),A.DARKORANGE=Object.freeze(A.fromCssColorString("#FF8C00")),A.DARKORCHID=Object.freeze(A.fromCssColorString("#9932CC")),A.DARKRED=Object.freeze(A.fromCssColorString("#8B0000")),A.DARKSALMON=Object.freeze(A.fromCssColorString("#E9967A")),A.DARKSEAGREEN=Object.freeze(A.fromCssColorString("#8FBC8F")),A.DARKSLATEBLUE=Object.freeze(A.fromCssColorString("#483D8B")),A.DARKSLATEGRAY=Object.freeze(A.fromCssColorString("#2F4F4F")),A.DARKSLATEGREY=A.DARKSLATEGRAY,A.DARKTURQUOISE=Object.freeze(A.fromCssColorString("#00CED1")),A.DARKVIOLET=Object.freeze(A.fromCssColorString("#9400D3")),A.DEEPPINK=Object.freeze(A.fromCssColorString("#FF1493")),A.DEEPSKYBLUE=Object.freeze(A.fromCssColorString("#00BFFF")),A.DIMGRAY=Object.freeze(A.fromCssColorString("#696969")),A.DIMGREY=A.DIMGRAY,A.DODGERBLUE=Object.freeze(A.fromCssColorString("#1E90FF")),A.FIREBRICK=Object.freeze(A.fromCssColorString("#B22222")),A.FLORALWHITE=Object.freeze(A.fromCssColorString("#FFFAF0")),A.FORESTGREEN=Object.freeze(A.fromCssColorString("#228B22")),A.FUCHSIA=Object.freeze(A.fromCssColorString("#FF00FF")),A.GAINSBORO=Object.freeze(A.fromCssColorString("#DCDCDC")),A.GHOSTWHITE=Object.freeze(A.fromCssColorString("#F8F8FF")),A.GOLD=Object.freeze(A.fromCssColorString("#FFD700")),A.GOLDENROD=Object.freeze(A.fromCssColorString("#DAA520")),A.GRAY=Object.freeze(A.fromCssColorString("#808080")),A.GREEN=Object.freeze(A.fromCssColorString("#008000")),A.GREENYELLOW=Object.freeze(A.fromCssColorString("#ADFF2F")),A.GREY=A.GRAY,A.HONEYDEW=Object.freeze(A.fromCssColorString("#F0FFF0")),A.HOTPINK=Object.freeze(A.fromCssColorString("#FF69B4")),A.INDIANRED=Object.freeze(A.fromCssColorString("#CD5C5C")),A.INDIGO=Object.freeze(A.fromCssColorString("#4B0082")),A.IVORY=Object.freeze(A.fromCssColorString("#FFFFF0")),A.KHAKI=Object.freeze(A.fromCssColorString("#F0E68C")),A.LAVENDER=Object.freeze(A.fromCssColorString("#E6E6FA")),A.LAVENDAR_BLUSH=Object.freeze(A.fromCssColorString("#FFF0F5")),A.LAWNGREEN=Object.freeze(A.fromCssColorString("#7CFC00")),A.LEMONCHIFFON=Object.freeze(A.fromCssColorString("#FFFACD")),A.LIGHTBLUE=Object.freeze(A.fromCssColorString("#ADD8E6")),A.LIGHTCORAL=Object.freeze(A.fromCssColorString("#F08080")),A.LIGHTCYAN=Object.freeze(A.fromCssColorString("#E0FFFF")),A.LIGHTGOLDENRODYELLOW=Object.freeze(A.fromCssColorString("#FAFAD2")),A.LIGHTGRAY=Object.freeze(A.fromCssColorString("#D3D3D3")),A.LIGHTGREEN=Object.freeze(A.fromCssColorString("#90EE90")),A.LIGHTGREY=A.LIGHTGRAY,A.LIGHTPINK=Object.freeze(A.fromCssColorString("#FFB6C1")),A.LIGHTSEAGREEN=Object.freeze(A.fromCssColorString("#20B2AA")),A.LIGHTSKYBLUE=Object.freeze(A.fromCssColorString("#87CEFA")),A.LIGHTSLATEGRAY=Object.freeze(A.fromCssColorString("#778899")),A.LIGHTSLATEGREY=A.LIGHTSLATEGRAY,A.LIGHTSTEELBLUE=Object.freeze(A.fromCssColorString("#B0C4DE")),A.LIGHTYELLOW=Object.freeze(A.fromCssColorString("#FFFFE0")),A.LIME=Object.freeze(A.fromCssColorString("#00FF00")),A.LIMEGREEN=Object.freeze(A.fromCssColorString("#32CD32")),A.LINEN=Object.freeze(A.fromCssColorString("#FAF0E6")),A.MAGENTA=Object.freeze(A.fromCssColorString("#FF00FF")),A.MAROON=Object.freeze(A.fromCssColorString("#800000")),A.MEDIUMAQUAMARINE=Object.freeze(A.fromCssColorString("#66CDAA")),A.MEDIUMBLUE=Object.freeze(A.fromCssColorString("#0000CD")),A.MEDIUMORCHID=Object.freeze(A.fromCssColorString("#BA55D3")),A.MEDIUMPURPLE=Object.freeze(A.fromCssColorString("#9370DB")),A.MEDIUMSEAGREEN=Object.freeze(A.fromCssColorString("#3CB371")),A.MEDIUMSLATEBLUE=Object.freeze(A.fromCssColorString("#7B68EE")),A.MEDIUMSPRINGGREEN=Object.freeze(A.fromCssColorString("#00FA9A")),A.MEDIUMTURQUOISE=Object.freeze(A.fromCssColorString("#48D1CC")),A.MEDIUMVIOLETRED=Object.freeze(A.fromCssColorString("#C71585")),A.MIDNIGHTBLUE=Object.freeze(A.fromCssColorString("#191970")),A.MINTCREAM=Object.freeze(A.fromCssColorString("#F5FFFA")),A.MISTYROSE=Object.freeze(A.fromCssColorString("#FFE4E1")),A.MOCCASIN=Object.freeze(A.fromCssColorString("#FFE4B5")),A.NAVAJOWHITE=Object.freeze(A.fromCssColorString("#FFDEAD")),A.NAVY=Object.freeze(A.fromCssColorString("#000080")),A.OLDLACE=Object.freeze(A.fromCssColorString("#FDF5E6")),A.OLIVE=Object.freeze(A.fromCssColorString("#808000")),A.OLIVEDRAB=Object.freeze(A.fromCssColorString("#6B8E23")),A.ORANGE=Object.freeze(A.fromCssColorString("#FFA500")),A.ORANGERED=Object.freeze(A.fromCssColorString("#FF4500")),A.ORCHID=Object.freeze(A.fromCssColorString("#DA70D6")),A.PALEGOLDENROD=Object.freeze(A.fromCssColorString("#EEE8AA")),A.PALEGREEN=Object.freeze(A.fromCssColorString("#98FB98")),A.PALETURQUOISE=Object.freeze(A.fromCssColorString("#AFEEEE")),A.PALEVIOLETRED=Object.freeze(A.fromCssColorString("#DB7093")),A.PAPAYAWHIP=Object.freeze(A.fromCssColorString("#FFEFD5")),A.PEACHPUFF=Object.freeze(A.fromCssColorString("#FFDAB9")),A.PERU=Object.freeze(A.fromCssColorString("#CD853F")),A.PINK=Object.freeze(A.fromCssColorString("#FFC0CB")),A.PLUM=Object.freeze(A.fromCssColorString("#DDA0DD")),A.POWDERBLUE=Object.freeze(A.fromCssColorString("#B0E0E6")),A.PURPLE=Object.freeze(A.fromCssColorString("#800080")),A.RED=Object.freeze(A.fromCssColorString("#FF0000")),A.ROSYBROWN=Object.freeze(A.fromCssColorString("#BC8F8F")),A.ROYALBLUE=Object.freeze(A.fromCssColorString("#4169E1")),A.SADDLEBROWN=Object.freeze(A.fromCssColorString("#8B4513")),A.SALMON=Object.freeze(A.fromCssColorString("#FA8072")),A.SANDYBROWN=Object.freeze(A.fromCssColorString("#F4A460")),A.SEAGREEN=Object.freeze(A.fromCssColorString("#2E8B57")),A.SEASHELL=Object.freeze(A.fromCssColorString("#FFF5EE")),A.SIENNA=Object.freeze(A.fromCssColorString("#A0522D")),A.SILVER=Object.freeze(A.fromCssColorString("#C0C0C0")),A.SKYBLUE=Object.freeze(A.fromCssColorString("#87CEEB")),A.SLATEBLUE=Object.freeze(A.fromCssColorString("#6A5ACD")),A.SLATEGRAY=Object.freeze(A.fromCssColorString("#708090")),A.SLATEGREY=A.SLATEGRAY,A.SNOW=Object.freeze(A.fromCssColorString("#FFFAFA")),A.SPRINGGREEN=Object.freeze(A.fromCssColorString("#00FF7F")),A.STEELBLUE=Object.freeze(A.fromCssColorString("#4682B4")),A.TAN=Object.freeze(A.fromCssColorString("#D2B48C")),A.TEAL=Object.freeze(A.fromCssColorString("#008080")),A.THISTLE=Object.freeze(A.fromCssColorString("#D8BFD8")),A.TOMATO=Object.freeze(A.fromCssColorString("#FF6347")),A.TURQUOISE=Object.freeze(A.fromCssColorString("#40E0D0")),A.VIOLET=Object.freeze(A.fromCssColorString("#EE82EE")),A.WHEAT=Object.freeze(A.fromCssColorString("#F5DEB3")),A.WHITE=Object.freeze(A.fromCssColorString("#FFFFFF")),A.WHITESMOKE=Object.freeze(A.fromCssColorString("#F5F5F5")),A.YELLOW=Object.freeze(A.fromCssColorString("#FFFF00")),A.YELLOWGREEN=Object.freeze(A.fromCssColorString("#9ACD32")),A.TRANSPARENT=Object.freeze(new A(0,0,0,0));class ge{constructor(e,t){this.x=e??0,this.y=t??0}static fromElements(e,t,n){return x(n)?(n.x=e,n.y=t,n):new ge(e,t)}static clone(e,t){if(x(e))return x(t)?(t.x=e.x,t.y=e.y,t):new ge(e.x,e.y)}static pack(e,t,n){return y.typeOf.object("value",e),y.defined("array",t),n=n??0,t[n++]=e.x,t[n]=e.y,t}static unpack(e,t,n){return y.defined("array",e),t=t??0,x(n)||(n=new ge),n.x=e[t++],n.y=e[t],n}static packArray(e,t){y.defined("array",e);const n=e.length,s=n*2;if(!x(t))t=new Array(s);else{if(!Array.isArray(t)&&t.length!==s)throw new $("If result is a typed array, it must have exactly array.length * 2 elements");t.length!==s&&(t.length=s)}for(let o=0;o<n;++o)ge.pack(e[o],t,o*2);return t}static unpackArray(e,t){if(y.defined("array",e),y.typeOf.number.greaterThanOrEquals("array.length",e.length,2),e.length%2!==0)throw new $("array length must be a multiple of 2.");const n=e.length;x(t)?t.length=n/2:t=new Array(n/2);for(let s=0;s<n;s+=2){const o=s/2;t[o]=ge.unpack(e,s,t[o])}return t}static maximumComponent(e){return y.typeOf.object("cartesian",e),Math.max(e.x,e.y)}static minimumComponent(e){return y.typeOf.object("cartesian",e),Math.min(e.x,e.y)}static minimumByComponent(e,t,n){return y.typeOf.object("first",e),y.typeOf.object("second",t),y.typeOf.object("result",n),n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n}static maximumByComponent(e,t,n){return y.typeOf.object("first",e),y.typeOf.object("second",t),y.typeOf.object("result",n),n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n}static clamp(e,t,n,s){y.typeOf.object("value",e),y.typeOf.object("min",t),y.typeOf.object("max",n),y.typeOf.object("result",s);const o=F.clamp(e.x,t.x,n.x),r=F.clamp(e.y,t.y,n.y);return s.x=o,s.y=r,s}static magnitudeSquared(e){return y.typeOf.object("cartesian",e),e.x*e.x+e.y*e.y}static magnitude(e){return Math.sqrt(ge.magnitudeSquared(e))}static distance(e,t){return y.typeOf.object("left",e),y.typeOf.object("right",t),ge.subtract(e,t,nh),ge.magnitude(nh)}static distanceSquared(e,t){return y.typeOf.object("left",e),y.typeOf.object("right",t),ge.subtract(e,t,nh),ge.magnitudeSquared(nh)}static normalize(e,t){y.typeOf.object("cartesian",e),y.typeOf.object("result",t);const n=ge.magnitude(e);if(t.x=e.x/n,t.y=e.y/n,isNaN(t.x)||isNaN(t.y))throw new $("normalized result is not a number");return t}static dot(e,t){return y.typeOf.object("left",e),y.typeOf.object("right",t),e.x*t.x+e.y*t.y}static cross(e,t){return y.typeOf.object("left",e),y.typeOf.object("right",t),e.x*t.y-e.y*t.x}static multiplyComponents(e,t,n){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",n),n.x=e.x*t.x,n.y=e.y*t.y,n}static divideComponents(e,t,n){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",n),n.x=e.x/t.x,n.y=e.y/t.y,n}static add(e,t,n){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",n),n.x=e.x+t.x,n.y=e.y+t.y,n}static subtract(e,t,n){return y.typeOf.object("left",e),y.typeOf.object("right",t),y.typeOf.object("result",n),n.x=e.x-t.x,n.y=e.y-t.y,n}static multiplyByScalar(e,t,n){return y.typeOf.object("cartesian",e),y.typeOf.number("scalar",t),y.typeOf.object("result",n),n.x=e.x*t,n.y=e.y*t,n}static divideByScalar(e,t,n){return y.typeOf.object("cartesian",e),y.typeOf.number("scalar",t),y.typeOf.object("result",n),n.x=e.x/t,n.y=e.y/t,n}static negate(e,t){return y.typeOf.object("cartesian",e),y.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t}static abs(e,t){return y.typeOf.object("cartesian",e),y.typeOf.object("result",t),t.x=Math.abs(e.x),t.y=Math.abs(e.y),t}static lerp(e,t,n,s){return y.typeOf.object("start",e),y.typeOf.object("end",t),y.typeOf.number("t",n),y.typeOf.object("result",s),ge.multiplyByScalar(t,n,Yy),s=ge.multiplyByScalar(e,1-n,s),ge.add(Yy,s,s)}static angleBetween(e,t){return y.typeOf.object("left",e),y.typeOf.object("right",t),ge.normalize(e,Zy),ge.normalize(t,Ky),F.acosClamped(ge.dot(Zy,Ky))}static mostOrthogonalAxis(e,t){y.typeOf.object("cartesian",e),y.typeOf.object("result",t);const n=ge.normalize(e,yP);return ge.abs(n,n),n.x<=n.y?t=ge.clone(ge.UNIT_X,t):t=ge.clone(ge.UNIT_Y,t),t}static equals(e,t){return e===t||x(e)&&x(t)&&e.x===t.x&&e.y===t.y}static equalsArray(e,t,n){return e.x===t[n]&&e.y===t[n+1]}static equalsEpsilon(e,t,n,s){return e===t||x(e)&&x(t)&&F.equalsEpsilon(e.x,t.x,n,s)&&F.equalsEpsilon(e.y,t.y,n,s)}clone(e){return ge.clone(this,e)}equals(e){return ge.equals(this,e)}equalsEpsilon(e,t,n){return ge.equalsEpsilon(this,e,t,n)}toString(){return`(${this.x}, ${this.y})`}}ge.fromCartesian3=ge.clone,ge.fromCartesian4=ge.clone,ge.packedLength=2,ge.fromArray=ge.unpack;const nh=new ge,Yy=new ge,Zy=new ge,Ky=new ge,yP=new ge;ge.ZERO=Object.freeze(new ge(0,0)),ge.ONE=Object.freeze(new ge(1,1)),ge.UNIT_X=Object.freeze(new ge(1,0)),ge.UNIT_Y=Object.freeze(new ge(0,1));const _P=new D,wP=new D;function Qy(i,e,t,n,s){if(!x(i))throw new $("cartesian is required.");if(!x(e))throw new $("oneOverRadii is required.");if(!x(t))throw new $("oneOverRadiiSquared is required.");if(!x(n))throw new $("centerToleranceSquared is required.");const o=i.x,r=i.y,a=i.z,l=e.x,c=e.y,h=e.z,u=o*o*l*l,d=r*r*c*c,f=a*a*h*h,g=u+d+f,_=Math.sqrt(1/g),v=D.multiplyByScalar(i,_,_P);if(g<n)return isFinite(_)?D.clone(v,s):void 0;const E=t.x,w=t.y,C=t.z,P=wP;P.x=v.x*E*2,P.y=v.y*w*2,P.z=v.z*C*2;let R=(1-_)*D.magnitude(i)/(.5*D.magnitude(P)),O=0,I,M,z,k,q,H,m,b,S,L,N;do{R-=O,z=1/(1+R*E),k=1/(1+R*w),q=1/(1+R*C),H=z*z,m=k*k,b=q*q,S=H*z,L=m*k,N=b*q,I=u*H+d*m+f*b-1,M=u*S*E+d*L*w+f*N*C;const j=-2*M;O=I/j}while(Math.abs(I)>F.EPSILON12);return x(s)?(s.x=o*z,s.y=r*k,s.z=a*q,s):new D(o*z,r*k,a*q)}const nn=class nn{constructor(e,t,n){this.longitude=e??0,this.latitude=t??0,this.height=n??0}static fromRadians(e,t,n,s){return y.typeOf.number("longitude",e),y.typeOf.number("latitude",t),n=n??0,x(s)?(s.longitude=e,s.latitude=t,s.height=n,s):new nn(e,t,n)}static fromDegrees(e,t,n,s){return y.typeOf.number("longitude",e),y.typeOf.number("latitude",t),e=F.toRadians(e),t=F.toRadians(t),nn.fromRadians(e,t,n,s)}static fromCartesian(e,t,n){const s=x(t)?t.oneOverRadii:nn._ellipsoidOneOverRadii,o=x(t)?t.oneOverRadiiSquared:nn._ellipsoidOneOverRadiiSquared,r=x(t)?t._centerToleranceSquared:nn._ellipsoidCenterToleranceSquared,a=Qy(e,s,o,r,bP);if(!x(a))return;let l=D.multiplyComponents(a,o,vP);l=D.normalize(l,l);const c=D.subtract(e,a,EP),h=Math.atan2(l.y,l.x),u=Math.asin(l.z),d=F.sign(D.dot(c,e))*D.magnitude(c);return x(n)?(n.longitude=h,n.latitude=u,n.height=d,n):new nn(h,u,d)}static toCartesian(e,t,n){return y.defined("cartographic",e),D.fromRadians(e.longitude,e.latitude,e.height,t,n)}static clone(e,t){if(x(e))return x(t)?(t.longitude=e.longitude,t.latitude=e.latitude,t.height=e.height,t):new nn(e.longitude,e.latitude,e.height)}static equals(e,t){return e===t||x(e)&&x(t)&&e.longitude===t.longitude&&e.latitude===t.latitude&&e.height===t.height}static equalsEpsilon(e,t,n){return n=n??0,e===t||x(e)&&x(t)&&Math.abs(e.longitude-t.longitude)<=n&&Math.abs(e.latitude-t.latitude)<=n&&Math.abs(e.height-t.height)<=n}clone(e){return nn.clone(this,e)}equals(e){return nn.equals(this,e)}equalsEpsilon(e,t){return nn.equalsEpsilon(this,e,t)}toString(){return`(${this.longitude}, ${this.latitude}, ${this.height})`}};T(nn,"_ellipsoidOneOverRadii",new D(1/6378137,1/6378137,1/6356752314245179e-9)),T(nn,"_ellipsoidOneOverRadiiSquared",new D(1/(6378137*6378137),1/(6378137*6378137),1/(6356752314245179e-9*6356752314245179e-9))),T(nn,"_ellipsoidCenterToleranceSquared",F.EPSILON1);let Rt=nn;Rt.ZERO=Object.freeze(new Rt(0,0,0));const vP=new D,bP=new D,EP=new D;function Jy(i,e,t,n){e=e??0,t=t??0,n=n??0,y.typeOf.number.greaterThanOrEquals("x",e,0),y.typeOf.number.greaterThanOrEquals("y",t,0),y.typeOf.number.greaterThanOrEquals("z",n,0),i._radii=new D(e,t,n),i._radiiSquared=new D(e*e,t*t,n*n),i._radiiToTheFourth=new D(e*e*e*e,t*t*t*t,n*n*n*n),i._oneOverRadii=new D(e===0?0:1/e,t===0?0:1/t,n===0?0:1/n),i._oneOverRadiiSquared=new D(e===0?0:1/(e*e),t===0?0:1/(t*t),n===0?0:1/(n*n)),i._minimumRadius=Math.min(e,t,n),i._maximumRadius=Math.max(e,t,n),i._centerToleranceSquared=F.EPSILON1,i._radiiSquared.z!==0&&(i._squaredXOverSquaredZ=i._radiiSquared.x/i._radiiSquared.z)}class tt{constructor(e,t,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,this._squaredXOverSquaredZ=void 0,Jy(this,e,t,n)}get radii(){return this._radii}get radiiSquared(){return this._radiiSquared}get radiiToTheFourth(){return this._radiiToTheFourth}get oneOverRadii(){return this._oneOverRadii}get oneOverRadiiSquared(){return this._oneOverRadiiSquared}get minimumRadius(){return this._minimumRadius}get maximumRadius(){return this._maximumRadius}static clone(e,t){if(!x(e))return;const n=e._radii;return x(t)?(D.clone(n,t._radii),D.clone(e._radiiSquared,t._radiiSquared),D.clone(e._radiiToTheFourth,t._radiiToTheFourth),D.clone(e._oneOverRadii,t._oneOverRadii),D.clone(e._oneOverRadiiSquared,t._oneOverRadiiSquared),t._minimumRadius=e._minimumRadius,t._maximumRadius=e._maximumRadius,t._centerToleranceSquared=e._centerToleranceSquared,t):new tt(n.x,n.y,n.z)}static fromCartesian3(e,t){return x(t)||(t=new tt),x(e)&&Jy(t,e.x,e.y,e.z),t}static get default(){return tt._default}static set default(e){y.typeOf.object("value",e),tt._default=e,D._ellipsoidRadiiSquared=e.radiiSquared,Rt._ellipsoidOneOverRadii=e.oneOverRadii,Rt._ellipsoidOneOverRadiiSquared=e.oneOverRadiiSquared,Rt._ellipsoidCenterToleranceSquared=e._centerToleranceSquared}clone(e){return tt.clone(this,e)}static pack(e,t,n){return y.typeOf.object("value",e),y.defined("array",t),n=n??0,D.pack(e._radii,t,n),t}static unpack(e,t,n){y.defined("array",e),t=t??0;const s=D.unpack(e,t);return tt.fromCartesian3(s,n)}geodeticSurfaceNormalCartographic(e,t){y.typeOf.object("cartographic",e);const n=e.longitude,s=e.latitude,o=Math.cos(s),r=o*Math.cos(n),a=o*Math.sin(n),l=Math.sin(s);return x(t)||(t=new D),t.x=r,t.y=a,t.z=l,D.normalize(t,t)}geodeticSurfaceNormal(e,t){if(y.typeOf.object("cartesian",e),isNaN(e.x)||isNaN(e.y)||isNaN(e.z))throw new $("cartesian has a NaN component");if(!D.equalsEpsilon(e,D.ZERO,F.EPSILON14))return x(t)||(t=new D),t=D.multiplyComponents(e,this._oneOverRadiiSquared,t),D.normalize(t,t)}cartographicToCartesian(e,t){const n=CP,s=xP;this.geodeticSurfaceNormalCartographic(e,n),D.multiplyComponents(this._radiiSquared,n,s);const o=Math.sqrt(D.dot(n,s));return D.divideByScalar(s,o,s),D.multiplyByScalar(n,e.height,n),x(t)||(t=new D),D.add(s,n,t)}cartographicArrayToCartesianArray(e,t){y.defined("cartographics",e);const n=e.length;x(t)?t.length=n:t=new Array(n);for(let s=0;s<n;s++)t[s]=this.cartographicToCartesian(e[s],t[s]);return t}cartesianToCartographic(e,t){const n=this.scaleToGeodeticSurface(e,SP);if(!x(n))return;const s=this.geodeticSurfaceNormal(n,PP),o=D.subtract(e,n,RP),r=Math.atan2(s.y,s.x),a=Math.asin(s.z),l=F.sign(D.dot(o,e))*D.magnitude(o);return x(t)?(t.longitude=r,t.latitude=a,t.height=l,t):new Rt(r,a,l)}cartesianArrayToCartographicArray(e,t){y.defined("cartesians",e);const n=e.length;x(t)?t.length=n:t=new Array(n);for(let s=0;s<n;++s)t[s]=this.cartesianToCartographic(e[s],t[s]);return t}scaleToGeodeticSurface(e,t){return Qy(e,this._oneOverRadii,this._oneOverRadiiSquared,this._centerToleranceSquared,t)}scaleToGeocentricSurface(e,t){y.typeOf.object("cartesian",e),x(t)||(t=new D);const n=e.x,s=e.y,o=e.z,r=this._oneOverRadiiSquared,a=1/Math.sqrt(n*n*r.x+s*s*r.y+o*o*r.z);return D.multiplyByScalar(e,a,t)}transformPositionToScaledSpace(e,t){return x(t)||(t=new D),D.multiplyComponents(e,this._oneOverRadii,t)}transformPositionFromScaledSpace(e,t){return x(t)||(t=new D),D.multiplyComponents(e,this._radii,t)}equals(e){return this===e||x(e)&&D.equals(this._radii,e._radii)}toString(){return this._radii.toString()}getSurfaceNormalIntersectionWithZAxis(e,t,n){if(y.typeOf.object("position",e),!F.equalsEpsilon(this._radii.x,this._radii.y,F.EPSILON15))throw new $("Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)");y.typeOf.number.greaterThan("Ellipsoid.radii.z",this._radii.z,0),t=t??0;const s=this._squaredXOverSquaredZ;if(x(n)||(n=new D),n.x=0,n.y=0,n.z=e.z*(1-s),!(Math.abs(n.z)>=this._radii.z-t))return n}getLocalCurvature(e,t){y.typeOf.object("surfacePosition",e),x(t)||(t=new ge);const n=this.getSurfaceNormalIntersectionWithZAxis(e,0,TP),s=D.distance(e,n),o=this.minimumRadius*s/this.maximumRadius**2,r=s*o**2;return ge.fromElements(1/s,1/r,t)}surfaceArea(e){y.typeOf.object("rectangle",e);const t=e.west;let n=e.east;const s=e.south,o=e.north;for(;n<t;)n+=F.TWO_PI;const r=this._radiiSquared,a=r.x,l=r.y,c=r.z,h=a*l;return e_(s,o,function(u){const d=Math.cos(u),f=Math.sin(u);return Math.cos(u)*e_(t,n,function(g){const _=Math.cos(g),v=Math.sin(g);return Math.sqrt(h*f*f+c*(l*_*_+a*v*v)*d*d)})})}}tt.WGS84=Object.freeze(new tt(6378137,6378137,6356752314245179e-9)),tt.UNIT_SPHERE=Object.freeze(new tt(1,1,1)),tt.MOON=Object.freeze(new tt(F.LUNAR_RADIUS,F.LUNAR_RADIUS,F.LUNAR_RADIUS)),tt.MARS=Object.freeze(new tt(3396190,3396190,3376200)),tt._default=tt.WGS84,tt.packedLength=D.packedLength,tt.prototype.geocentricSurfaceNormal=D.normalize;const CP=new D,xP=new D,PP=new D,SP=new D,RP=new D,TP=new D,IP=[.14887433898163,.43339539412925,.67940956829902,.86506336668898,.97390652851717,0],OP=[.29552422471475,.26926671930999,.21908636251598,.14945134915058,.066671344308684,0];function e_(i,e,t){y.typeOf.number("a",i),y.typeOf.number("b",e),y.typeOf.func("func",t);const n=.5*(e+i),s=.5*(e-i);let o=0;for(let r=0;r<5;r++){const a=s*IP[r];o+=OP[r]*(t(n+a)+t(n-a))}return o*=s,o}function Ga(i,e,t){y.defined("array",i),y.defined("itemToFind",e),y.defined("comparator",t);let n=0,s=i.length-1,o,r;for(;n<=s;){if(o=~~((n+s)/2),r=t(i[o],e),r<0){n=o+1;continue}if(r>0){s=o-1;continue}return o}return~(s+1)}function vf(i,e,t,n,s){this.xPoleWander=i,this.yPoleWander=e,this.xPoleOffset=t,this.yPoleOffset=n,this.ut1MinusUtc=s}function bf(i){if(i===null||isNaN(i))throw new $("year is required and must be a number.");return i%4===0&&i%100!==0||i%400===0}const t_=[31,28,31,30,31,30,31,31,30,31,30,31];function Ef(i,e,t,n,s,o,r,a){i=i??1,e=e??1,t=t??1,n=n??0,s=s??0,o=o??0,r=r??0,a=a??!1,_(),v(),this.year=i,this.month=e,this.day=t,this.hour=n,this.minute=s,this.second=o,this.millisecond=r,this.isLeapSecond=a;function _(){y.typeOf.number.greaterThanOrEquals("Year",i,1),y.typeOf.number.lessThanOrEquals("Year",i,9999),y.typeOf.number.greaterThanOrEquals("Month",e,1),y.typeOf.number.lessThanOrEquals("Month",e,12),y.typeOf.number.greaterThanOrEquals("Day",t,1),y.typeOf.number.lessThanOrEquals("Day",t,31),y.typeOf.number.greaterThanOrEquals("Hour",n,0),y.typeOf.number.lessThanOrEquals("Hour",n,23),y.typeOf.number.greaterThanOrEquals("Minute",s,0),y.typeOf.number.lessThanOrEquals("Minute",s,59),y.typeOf.bool("IsLeapSecond",a),y.typeOf.number.greaterThanOrEquals("Second",o,0),y.typeOf.number.lessThanOrEquals("Second",o,a?60:59),y.typeOf.number.greaterThanOrEquals("Millisecond",r,0),y.typeOf.number.lessThan("Millisecond",r,1e3)}function v(){const E=e===2&&bf(i)?t_[e-1]+1:t_[e-1];if(t>E)throw new $("Month and Day represents invalid date")}}function He(i,e){this.julianDate=i,this.offset=e}const at={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};Object.freeze(at);const Ae={UTC:0,TAI:1};Object.freeze(Ae);const n_=new Ef,ih=[31,28,31,30,31,30,31,31,30,31,30,31],sh=29;function Cf(i,e){return oe.compare(i.julianDate,e.julianDate)}const mr=new He;function oh(i){mr.julianDate=i;const e=oe.leapSeconds;let t=Ga(e,mr,Cf);t<0&&(t=~t),t>=e.length&&(t=e.length-1);let n=e[t].offset;t>0&&oe.secondsDifference(e[t].julianDate,i)>n&&(t--,n=e[t].offset),oe.addSeconds(i,n,i)}function i_(i,e){mr.julianDate=i;const t=oe.leapSeconds;let n=Ga(t,mr,Cf);if(n<0&&(n=~n),n===0)return oe.addSeconds(i,-t[0].offset,e);if(n>=t.length)return oe.addSeconds(i,-t[n-1].offset,e);const s=oe.secondsDifference(t[n].julianDate,i);if(s===0)return oe.addSeconds(i,-t[n].offset,e);if(!(s<=1))return oe.addSeconds(i,-t[n-1].offset,e)}function Fs(i,e,t){const n=e/at.SECONDS_PER_DAY|0;return i+=n,e-=at.SECONDS_PER_DAY*n,e<0&&(i--,e+=at.SECONDS_PER_DAY),t.dayNumber=i,t.secondsOfDay=e,t}function xf(i,e,t,n,s,o,r){const a=(e-14)/12|0,l=i+4800+a;let c=(1461*l/4|0)+(367*(e-2-12*a)/12|0)-(3*((l+100)/100|0)/4|0)+t-32075;n=n-12,n<0&&(n+=24);const h=o+(n*at.SECONDS_PER_HOUR+s*at.SECONDS_PER_MINUTE+r*at.SECONDS_PER_MILLISECOND);return h>=43200&&(c-=1),[c,h]}const AP=/^(\d{4})$/,MP=/^(\d{4})-(\d{2})$/,DP=/^(\d{4})-?(\d{3})$/,FP=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,LP=/^(\d{4})-?(\d{2})-?(\d{2})$/,Pf=/([Z+\-])?(\d{2})?:?(\d{2})?$/,zP=/^(\d{2})(\.\d+)?/.source+Pf.source,NP=/^(\d{2}):?(\d{2})(\.\d+)?/.source+Pf.source,kP=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+Pf.source,ni="Invalid ISO 8601 date.";class oe{constructor(e,t,n){this.dayNumber=void 0,this.secondsOfDay=void 0,e=e??0,t=t??0,n=n??Ae.UTC;const s=e|0;t=t+(e-s)*at.SECONDS_PER_DAY,Fs(s,t,this),n===Ae.UTC&&oh(this)}static fromGregorianDate(e,t){if(!(e instanceof Ef))throw new $("date must be a valid GregorianDate.");const n=xf(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond);return x(t)?(Fs(n[0],n[1],t),oh(t),t):new oe(n[0],n[1],Ae.UTC)}static fromDate(e,t){if(!(e instanceof Date)||isNaN(e.getTime()))throw new $("date must be a valid JavaScript Date.");const n=xf(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds());return x(t)?(Fs(n[0],n[1],t),oh(t),t):new oe(n[0],n[1],Ae.UTC)}static fromIso8601(e,t){if(typeof e!="string")throw new $(ni);e=e.replace(",",".");let n=e.split("T"),s,o=1,r=1,a=0,l=0,c=0,h=0;const u=n[0],d=n[1];let f,g;if(!x(u))throw new $(ni);let _;if(n=u.match(LP),n!==null){if(_=u.split("-").length-1,_>0&&_!==2)throw new $(ni);s=+n[1],o=+n[2],r=+n[3]}else if(n=u.match(MP),n!==null)s=+n[1],o=+n[2];else if(n=u.match(AP),n!==null)s=+n[1];else{let C;if(n=u.match(DP),n!==null){if(s=+n[1],C=+n[2],g=bf(s),C<1||g&&C>366||!g&&C>365)throw new $(ni)}else if(n=u.match(FP),n!==null){s=+n[1];const P=+n[2],R=+n[3]||0;if(_=u.split("-").length-1,_>0&&(!x(n[3])&&_!==1||x(n[3])&&_!==2))throw new $(ni);const O=new Date(Date.UTC(s,0,4));C=P*7+R-O.getUTCDay()-3}else throw new $(ni);f=new Date(Date.UTC(s,0,1)),f.setUTCDate(C),o=f.getUTCMonth()+1,r=f.getUTCDate()}if(g=bf(s),o<1||o>12||r<1||(o!==2||!g)&&r>ih[o-1]||g&&o===2&&r>sh)throw new $(ni);let v;if(x(d)){if(n=d.match(kP),n!==null){if(_=d.split(":").length-1,_>0&&_!==2&&_!==3)throw new $(ni);a=+n[1],l=+n[2],c=+n[3],h=+(n[4]||0)*1e3,v=5}else if(n=d.match(NP),n!==null){if(_=d.split(":").length-1,_>2)throw new $(ni);a=+n[1],l=+n[2],c=+(n[3]||0)*60,v=4}else if(n=d.match(zP),n!==null)a=+n[1],l=+(n[2]||0)*60,v=3;else throw new $(ni);if(l>=60||c>=61||a>24||a===24&&(l>0||c>0||h>0))throw new $(ni);const C=n[v],P=+n[v+1],R=+(n[v+2]||0);switch(C){case"+":a=a-P,l=l-R;break;case"-":a=a+P,l=l+R;break;case"Z":break;default:l=l+new Date(Date.UTC(s,o-1,r,a,l)).getTimezoneOffset();break}}const E=c===60;for(E&&c--;l>=60;)l-=60,a++;for(;a>=24;)a-=24,r++;for(f=g&&o===2?sh:ih[o-1];r>f;)r-=f,o++,o>12&&(o-=12,s++),f=g&&o===2?sh:ih[o-1];for(;l<0;)l+=60,a--;for(;a<0;)a+=24,r--;for(;r<1;)o--,o<1&&(o+=12,s--),f=g&&o===2?sh:ih[o-1],r+=f;const w=xf(s,o,r,a,l,c,h);return x(t)?(Fs(w[0],w[1],t),oh(t)):t=new oe(w[0],w[1],Ae.UTC),E&&oe.addSeconds(t,1,t),t}static now(e){return oe.fromDate(new Date,e)}static toGregorianDate(e,t){if(!x(e))throw new $("julianDate is required.");let n=!1,s=i_(e,rh);x(s)||(oe.addSeconds(e,-1,rh),s=i_(rh,rh),n=!0);let o=s.dayNumber;const r=s.secondsOfDay;r>=43200&&(o+=1);let a=o+68569|0;const l=4*a/146097|0;a=a-((146097*l+3)/4|0)|0;const c=4e3*(a+1)/1461001|0;a=a-(1461*c/4|0)+31|0;const h=80*a/2447|0,u=a-(2447*h/80|0)|0;a=h/11|0;const d=h+2-12*a|0,f=100*(l-49)+c+a|0;let g=r/at.SECONDS_PER_HOUR|0,_=r-g*at.SECONDS_PER_HOUR;const v=_/at.SECONDS_PER_MINUTE|0;_=_-v*at.SECONDS_PER_MINUTE;let E=_|0;const w=(_-E)/at.SECONDS_PER_MILLISECOND;return g+=12,g>23&&(g-=24),n&&(E+=1),x(t)?(t.year=f,t.month=d,t.day=u,t.hour=g,t.minute=v,t.second=E,t.millisecond=w,t.isLeapSecond=n,t):new Ef(f,d,u,g,v,E,w,n)}static toDate(e){if(!x(e))throw new $("julianDate is required.");const t=oe.toGregorianDate(e,n_);let n=t.second;return t.isLeapSecond&&(n-=1),new Date(Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,n,t.millisecond))}static toIso8601(e,t){if(!x(e))throw new $("julianDate is required.");const n=oe.toGregorianDate(e,n_);let s=n.year,o=n.month,r=n.day,a=n.hour;const l=n.minute,c=n.second,h=n.millisecond;s===1e4&&o===1&&r===1&&a===0&&l===0&&c===0&&h===0&&(s=9999,o=12,r=31,a=24);let u;if(!x(t)&&h!==0){const d=h*.01;return u=d<1e-6?d.toFixed(20).replace(".","").replace(/0+$/,""):d.toString().replace(".",""),`${s.toString().padStart(4,"0")}-${o.toString().padStart(2,"0")}-${r.toString().padStart(2,"0")}T${a.toString().padStart(2,"0")}:${l.toString().padStart(2,"0")}:${c.toString().padStart(2,"0")}.${u}Z`}return!x(t)||t===0?`${s.toString().padStart(4,"0")}-${o.toString().padStart(2,"0")}-${r.toString().padStart(2,"0")}T${a.toString().padStart(2,"0")}:${l.toString().padStart(2,"0")}:${c.toString().padStart(2,"0")}Z`:(u=(h*.01).toFixed(t).replace(".","").slice(0,t),`${s.toString().padStart(4,"0")}-${o.toString().padStart(2,"0")}-${r.toString().padStart(2,"0")}T${a.toString().padStart(2,"0")}:${l.toString().padStart(2,"0")}:${c.toString().padStart(2,"0")}.${u}Z`)}static clone(e,t){if(x(e))return x(t)?(t.dayNumber=e.dayNumber,t.secondsOfDay=e.secondsOfDay,t):new oe(e.dayNumber,e.secondsOfDay,Ae.TAI)}static compare(e,t){if(!x(e))throw new $("left is required.");if(!x(t))throw new $("right is required.");const n=e.dayNumber-t.dayNumber;return n!==0?n:e.secondsOfDay-t.secondsOfDay}static equals(e,t){return e===t||x(e)&&x(t)&&e.dayNumber===t.dayNumber&&e.secondsOfDay===t.secondsOfDay}static equalsEpsilon(e,t,n){return n=n??0,e===t||x(e)&&x(t)&&Math.abs(oe.secondsDifference(e,t))<=n}static totalDays(e){if(!x(e))throw new $("julianDate is required.");return e.dayNumber+e.secondsOfDay/at.SECONDS_PER_DAY}static secondsDifference(e,t){if(!x(e))throw new $("left is required.");if(!x(t))throw new $("right is required.");return(e.dayNumber-t.dayNumber)*at.SECONDS_PER_DAY+(e.secondsOfDay-t.secondsOfDay)}static daysDifference(e,t){if(!x(e))throw new $("left is required.");if(!x(t))throw new $("right is required.");const n=e.dayNumber-t.dayNumber,s=(e.secondsOfDay-t.secondsOfDay)/at.SECONDS_PER_DAY;return n+s}static computeTaiMinusUtc(e){mr.julianDate=e;const t=oe.leapSeconds;let n=Ga(t,mr,Cf);return n<0&&(n=~n,--n,n<0&&(n=0)),t[n].offset}static addSeconds(e,t,n){if(!x(e))throw new $("julianDate is required.");if(!x(t))throw new $("seconds is required.");if(!x(n))throw new $("result is required.");return Fs(e.dayNumber,e.secondsOfDay+t,n)}static addMinutes(e,t,n){if(!x(e))throw new $("julianDate is required.");if(!x(t))throw new $("minutes is required.");if(!x(n))throw new $("result is required.");const s=e.secondsOfDay+t*at.SECONDS_PER_MINUTE;return Fs(e.dayNumber,s,n)}static addHours(e,t,n){if(!x(e))throw new $("julianDate is required.");if(!x(t))throw new $("hours is required.");if(!x(n))throw new $("result is required.");const s=e.secondsOfDay+t*at.SECONDS_PER_HOUR;return Fs(e.dayNumber,s,n)}static addDays(e,t,n){if(!x(e))throw new $("julianDate is required.");if(!x(t))throw new $("days is required.");if(!x(n))throw new $("result is required.");const s=e.dayNumber+t;return Fs(s,e.secondsOfDay,n)}static lessThan(e,t){return oe.compare(e,t)<0}static lessThanOrEquals(e,t){return oe.compare(e,t)<=0}static greaterThan(e,t){return oe.compare(e,t)>0}static greaterThanOrEquals(e,t){return oe.compare(e,t)>=0}clone(e){return oe.clone(this,e)}equals(e){return oe.equals(this,e)}equalsEpsilon(e,t){return oe.equalsEpsilon(this,e,t)}toString(){return oe.toIso8601(this)}}const rh=new oe(0,0,Ae.TAI);oe.leapSeconds=[new He(new oe(2441317,43210,Ae.TAI),10),new He(new oe(2441499,43211,Ae.TAI),11),new He(new oe(2441683,43212,Ae.TAI),12),new He(new oe(2442048,43213,Ae.TAI),13),new He(new oe(2442413,43214,Ae.TAI),14),new He(new oe(2442778,43215,Ae.TAI),15),new He(new oe(2443144,43216,Ae.TAI),16),new He(new oe(2443509,43217,Ae.TAI),17),new He(new oe(2443874,43218,Ae.TAI),18),new He(new oe(2444239,43219,Ae.TAI),19),new He(new oe(2444786,43220,Ae.TAI),20),new He(new oe(2445151,43221,Ae.TAI),21),new He(new oe(2445516,43222,Ae.TAI),22),new He(new oe(2446247,43223,Ae.TAI),23),new He(new oe(2447161,43224,Ae.TAI),24),new He(new oe(2447892,43225,Ae.TAI),25),new He(new oe(2448257,43226,Ae.TAI),26),new He(new oe(2448804,43227,Ae.TAI),27),new He(new oe(2449169,43228,Ae.TAI),28),new He(new oe(2449534,43229,Ae.TAI),29),new He(new oe(2450083,43230,Ae.TAI),30),new He(new oe(2450630,43231,Ae.TAI),31),new He(new oe(2451179,43232,Ae.TAI),32),new He(new oe(2453736,43233,Ae.TAI),33),new He(new oe(2454832,43234,Ae.TAI),34),new He(new oe(2456109,43235,Ae.TAI),35),new He(new oe(2457204,43236,Ae.TAI),36),new He(new oe(2457754,43237,Ae.TAI),37)];var ah={exports:{}},qa={exports:{}};/*! https://mths.be/punycode v1.4.0 by @mathias */var jP=qa.exports,s_;function UP(){return s_||(s_=1,(function(i,e){(function(t){var n=e&&!e.nodeType&&e,s=i&&!i.nodeType&&i,o=typeof Ay=="object"&&Ay;(o.global===o||o.window===o||o.self===o)&&(t=o);var r,a=2147483647,l=36,c=1,h=26,u=38,d=700,f=72,g=128,_="-",v=/^xn--/,E=/[^\x20-\x7E]/,w=/[\x2E\u3002\uFF0E\uFF61]/g,C={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},P=l-c,R=Math.floor,O=String.fromCharCode,I;function M(B){throw new RangeError(C[B])}function z(B,X){for(var G=B.length,ae=[];G--;)ae[G]=X(B[G]);return ae}function k(B,X){var G=B.split("@"),ae="";G.length>1&&(ae=G[0]+"@",B=G[1]),B=B.replace(w,".");var te=B.split("."),V=z(te,X).join(".");return ae+V}function q(B){for(var X=[],G=0,ae=B.length,te,V;G<ae;)te=B.charCodeAt(G++),te>=55296&&te<=56319&&G<ae?(V=B.charCodeAt(G++),(V&64512)==56320?X.push(((te&1023)<<10)+(V&1023)+65536):(X.push(te),G--)):X.push(te);return X}function H(B){return z(B,function(X){var G="";return X>65535&&(X-=65536,G+=O(X>>>10&1023|55296),X=56320|X&1023),G+=O(X),G}).join("")}function m(B){return B-48<10?B-22:B-65<26?B-65:B-97<26?B-97:l}function b(B,X){return B+22+75*(B<26)-((X!=0)<<5)}function S(B,X,G){var ae=0;for(B=G?R(B/d):B>>1,B+=R(B/X);B>P*h>>1;ae+=l)B=R(B/P);return R(ae+(P+1)*B/(B+u))}function L(B){var X=[],G=B.length,ae,te=0,V=g,re=f,ie,he,me,Fe,ue,ze,J,dt,Qe;for(ie=B.lastIndexOf(_),ie<0&&(ie=0),he=0;he<ie;++he)B.charCodeAt(he)>=128&&M("not-basic"),X.push(B.charCodeAt(he));for(me=ie>0?ie+1:0;me<G;){for(Fe=te,ue=1,ze=l;me>=G&&M("invalid-input"),J=m(B.charCodeAt(me++)),(J>=l||J>R((a-te)/ue))&&M("overflow"),te+=J*ue,dt=ze<=re?c:ze>=re+h?h:ze-re,!(J<dt);ze+=l)Qe=l-dt,ue>R(a/Qe)&&M("overflow"),ue*=Qe;ae=X.length+1,re=S(te-Fe,ae,Fe==0),R(te/ae)>a-V&&M("overflow"),V+=R(te/ae),te%=ae,X.splice(te++,0,V)}return H(X)}function N(B){var X,G,ae,te,V,re,ie,he,me,Fe,ue,ze=[],J,dt,Qe,ye;for(B=q(B),J=B.length,X=g,G=0,V=f,re=0;re<J;++re)ue=B[re],ue<128&&ze.push(O(ue));for(ae=te=ze.length,te&&ze.push(_);ae<J;){for(ie=a,re=0;re<J;++re)ue=B[re],ue>=X&&ue<ie&&(ie=ue);for(dt=ae+1,ie-X>R((a-G)/dt)&&M("overflow"),G+=(ie-X)*dt,X=ie,re=0;re<J;++re)if(ue=B[re],ue<X&&++G>a&&M("overflow"),ue==X){for(he=G,me=l;Fe=me<=V?c:me>=V+h?h:me-V,!(he<Fe);me+=l)ye=he-Fe,Qe=l-Fe,ze.push(O(b(Fe+ye%Qe,0))),he=R(ye/Qe);ze.push(O(b(he,0))),V=S(G,dt,ae==te),G=0,++ae}++G,++X}return ze.join("")}function j(B){return k(B,function(X){return v.test(X)?L(X.slice(4).toLowerCase()):X})}function U(B){return k(B,function(X){return E.test(X)?"xn--"+N(X):X})}if(r={version:"1.3.2",ucs2:{decode:q,encode:H},decode:L,encode:N,toASCII:U,toUnicode:j},n&&s)if(i.exports==n)s.exports=r;else for(I in r)r.hasOwnProperty(I)&&(n[I]=r[I]);else t.punycode=r})(jP)})(qa,qa.exports)),qa.exports}var lh={exports:{}};/*!
|
|
34
|
-
* URI.js - Mutating URLs
|
|
35
|
-
* IPv6 Support
|
|
36
|
-
*
|
|
37
|
-
* Version: 1.19.11
|
|
38
|
-
*
|
|
39
|
-
* Author: Rodney Rehm
|
|
40
|
-
* Web: http://medialize.github.io/URI.js/
|
|
41
|
-
*
|
|
42
|
-
* Licensed under
|
|
43
|
-
* MIT License http://www.opensource.org/licenses/mit-license
|
|
44
|
-
*
|
|
45
|
-
*/var GP=lh.exports,o_;function qP(){return o_||(o_=1,(function(i){(function(e,t){i.exports?i.exports=t():e.IPv6=t(e)})(GP,function(e){var t=e&&e.IPv6;function n(o){var r=o.toLowerCase(),a=r.split(":"),l=a.length,c=8;a[0]===""&&a[1]===""&&a[2]===""?(a.shift(),a.shift()):a[0]===""&&a[1]===""?a.shift():a[l-1]===""&&a[l-2]===""&&a.pop(),l=a.length,a[l-1].indexOf(".")!==-1&&(c=7);var h;for(h=0;h<l&&a[h]!=="";h++);if(h<c)for(a.splice(h,1,"0000");a.length<c;)a.splice(h,0,"0000");for(var u,d=0;d<c;d++){u=a[d].split("");for(var f=0;f<3&&(u[0]==="0"&&u.length>1);f++)u.splice(0,1);a[d]=u.join("")}var g=-1,_=0,v=0,E=-1,w=!1;for(d=0;d<c;d++)w?a[d]==="0"?v+=1:(w=!1,v>_&&(g=E,_=v)):a[d]==="0"&&(w=!0,E=d,v=1);v>_&&(g=E,_=v),_>1&&a.splice(g,_,""),l=a.length;var C="";for(a[0]===""&&(C=":"),d=0;d<l&&(C+=a[d],d!==l-1);d++)C+=":";return a[l-1]===""&&(C+=":"),C}function s(){return e.IPv6===this&&(e.IPv6=t),this}return{best:n,noConflict:s}})})(lh)),lh.exports}var ch={exports:{}};/*!
|
|
46
|
-
* URI.js - Mutating URLs
|
|
47
|
-
* Second Level Domain (SLD) Support
|
|
48
|
-
*
|
|
49
|
-
* Version: 1.19.11
|
|
50
|
-
*
|
|
51
|
-
* Author: Rodney Rehm
|
|
52
|
-
* Web: http://medialize.github.io/URI.js/
|
|
53
|
-
*
|
|
54
|
-
* Licensed under
|
|
55
|
-
* MIT License http://www.opensource.org/licenses/mit-license
|
|
56
|
-
*
|
|
57
|
-
*/var VP=ch.exports,r_;function WP(){return r_||(r_=1,(function(i){(function(e,t){i.exports?i.exports=t():e.SecondLevelDomains=t(e)})(VP,function(e){var t=e&&e.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 e.SecondLevelDomains===this&&(e.SecondLevelDomains=t),this}};return n})})(ch)),ch.exports}/*!
|
|
58
|
-
* URI.js - Mutating URLs
|
|
59
|
-
*
|
|
60
|
-
* Version: 1.19.11
|
|
61
|
-
*
|
|
62
|
-
* Author: Rodney Rehm
|
|
63
|
-
* Web: http://medialize.github.io/URI.js/
|
|
64
|
-
*
|
|
65
|
-
* Licensed under
|
|
66
|
-
* MIT License http://www.opensource.org/licenses/mit-license
|
|
67
|
-
*
|
|
68
|
-
*/var BP=ah.exports,a_;function $P(){return a_||(a_=1,(function(i){(function(e,t){i.exports?i.exports=t(UP(),qP(),WP()):e.URI=t(e.punycode,e.IPv6,e.SecondLevelDomains,e)})(BP,function(e,t,n,s){var o=s&&s.URI;function r(m,b){var S=arguments.length>=1,L=arguments.length>=2;if(!(this instanceof r))return S?L?new r(m,b):new r(m):new r;if(m===void 0){if(S)throw new TypeError("undefined is not a valid argument for URI");typeof location<"u"?m=location.href+"":m=""}if(m===null&&S)throw new TypeError("null is not a valid argument for URI");return this.href(m),b!==void 0?this.absoluteTo(b):this}function a(m){return/^[0-9]+$/.test(m)}r.version="1.19.11";var l=r.prototype,c=Object.prototype.hasOwnProperty;function h(m){return m.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function u(m){return m===void 0?"Undefined":String(Object.prototype.toString.call(m)).slice(8,-1)}function d(m){return u(m)==="Array"}function f(m,b){var S={},L,N;if(u(b)==="RegExp")S=null;else if(d(b))for(L=0,N=b.length;L<N;L++)S[b[L]]=!0;else S[b]=!0;for(L=0,N=m.length;L<N;L++){var j=S&&S[m[L]]!==void 0||!S&&b.test(m[L]);j&&(m.splice(L,1),N--,L--)}return m}function g(m,b){var S,L;if(d(b)){for(S=0,L=b.length;S<L;S++)if(!g(m,b[S]))return!1;return!0}var N=u(b);for(S=0,L=m.length;S<L;S++)if(N==="RegExp"){if(typeof m[S]=="string"&&m[S].match(b))return!0}else if(m[S]===b)return!0;return!1}function _(m,b){if(!d(m)||!d(b)||m.length!==b.length)return!1;m.sort(),b.sort();for(var S=0,L=m.length;S<L;S++)if(m[S]!==b[S])return!1;return!0}function v(m){var b=/^\/+|\/+$/g;return m.replace(b,"")}r._parts=function(){return{protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null,preventInvalidHostname:r.preventInvalidHostname,duplicateQueryParameters:r.duplicateQueryParameters,escapeQuerySpace:r.escapeQuerySpace}},r.preventInvalidHostname=!1,r.duplicateQueryParameters=!1,r.escapeQuerySpace=!0,r.protocol_expression=/^[a-z][a-z0-9.+-]*$/i,r.idn_expression=/[^a-z0-9\._-]/i,r.punycode_expression=/(xn--)/i,r.ip4_expression=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,r.ip6_expression=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,r.find_uri_expression=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/ig,r.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?«»“”„‘’]+$/,parens:/(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g},r.leading_whitespace_expression=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,r.ascii_tab_whitespace=/[\u0009\u000A\u000D]+/g,r.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},r.hostProtocols=["http","https"],r.invalid_hostname_characters=/[^a-zA-Z0-9\.\-:_]/,r.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src",audio:"src",video:"src"},r.getDomAttribute=function(m){if(!(!m||!m.nodeName)){var b=m.nodeName.toLowerCase();if(!(b==="input"&&m.type!=="image"))return r.domAttributes[b]}};function E(m){return escape(m)}function w(m){return encodeURIComponent(m).replace(/[!'()*]/g,E).replace(/\*/g,"%2A")}r.encode=w,r.decode=decodeURIComponent,r.iso8859=function(){r.encode=escape,r.decode=unescape},r.unicode=function(){r.encode=w,r.decode=decodeURIComponent},r.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/ig,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/ig,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}},urnpath:{encode:{expression:/%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/ig,map:{"%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"=","%40":"@"}},decode:{expression:/[\/\?#:]/g,map:{"/":"%2F","?":"%3F","#":"%23",":":"%3A"}}}},r.encodeQuery=function(m,b){var S=r.encode(m+"");return b===void 0&&(b=r.escapeQuerySpace),b?S.replace(/%20/g,"+"):S},r.decodeQuery=function(m,b){m+="",b===void 0&&(b=r.escapeQuerySpace);try{return r.decode(b?m.replace(/\+/g,"%20"):m)}catch{return m}};var C={encode:"encode",decode:"decode"},P,R=function(m,b){return function(S){try{return r[b](S+"").replace(r.characters[m][b].expression,function(L){return r.characters[m][b].map[L]})}catch{return S}}};for(P in C)r[P+"PathSegment"]=R("pathname",C[P]),r[P+"UrnPathSegment"]=R("urnpath",C[P]);var O=function(m,b,S){return function(L){var N;S?N=function(X){return r[b](r[S](X))}:N=r[b];for(var j=(L+"").split(m),U=0,B=j.length;U<B;U++)j[U]=N(j[U]);return j.join(m)}};r.decodePath=O("/","decodePathSegment"),r.decodeUrnPath=O(":","decodeUrnPathSegment"),r.recodePath=O("/","encodePathSegment","decode"),r.recodeUrnPath=O(":","encodeUrnPathSegment","decode"),r.encodeReserved=R("reserved","encode"),r.parse=function(m,b){var S;return b||(b={preventInvalidHostname:r.preventInvalidHostname}),m=m.replace(r.leading_whitespace_expression,""),m=m.replace(r.ascii_tab_whitespace,""),S=m.indexOf("#"),S>-1&&(b.fragment=m.substring(S+1)||null,m=m.substring(0,S)),S=m.indexOf("?"),S>-1&&(b.query=m.substring(S+1)||null,m=m.substring(0,S)),m=m.replace(/^(https?|ftp|wss?)?:+[/\\]*/i,"$1://"),m=m.replace(/^[/\\]{2,}/i,"//"),m.substring(0,2)==="//"?(b.protocol=null,m=m.substring(2),m=r.parseAuthority(m,b)):(S=m.indexOf(":"),S>-1&&(b.protocol=m.substring(0,S)||null,b.protocol&&!b.protocol.match(r.protocol_expression)?b.protocol=void 0:m.substring(S+1,S+3).replace(/\\/g,"/")==="//"?(m=m.substring(S+3),m=r.parseAuthority(m,b)):(m=m.substring(S+1),b.urn=!0))),b.path=m,b},r.parseHost=function(m,b){m||(m=""),m=m.replace(/\\/g,"/");var S=m.indexOf("/"),L,N;if(S===-1&&(S=m.length),m.charAt(0)==="[")L=m.indexOf("]"),b.hostname=m.substring(1,L)||null,b.port=m.substring(L+2,S)||null,b.port==="/"&&(b.port=null);else{var j=m.indexOf(":"),U=m.indexOf("/"),B=m.indexOf(":",j+1);B!==-1&&(U===-1||B<U)?(b.hostname=m.substring(0,S)||null,b.port=null):(N=m.substring(0,S).split(":"),b.hostname=N[0]||null,b.port=N[1]||null)}return b.hostname&&m.substring(S).charAt(0)!=="/"&&(S++,m="/"+m),b.preventInvalidHostname&&r.ensureValidHostname(b.hostname,b.protocol),b.port&&r.ensureValidPort(b.port),m.substring(S)||"/"},r.parseAuthority=function(m,b){return m=r.parseUserinfo(m,b),r.parseHost(m,b)},r.parseUserinfo=function(m,b){var S=m,L=m.indexOf("\\");L!==-1&&(m=m.replace(/\\/g,"/"));var N=m.indexOf("/"),j=m.lastIndexOf("@",N>-1?N:m.length-1),U;return j>-1&&(N===-1||j<N)?(U=m.substring(0,j).split(":"),b.username=U[0]?r.decode(U[0]):null,U.shift(),b.password=U[0]?r.decode(U.join(":")):null,m=S.substring(j+1)):(b.username=null,b.password=null),m},r.parseQuery=function(m,b){if(!m)return{};if(m=m.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,""),!m)return{};for(var S={},L=m.split("&"),N=L.length,j,U,B,X=0;X<N;X++)j=L[X].split("="),U=r.decodeQuery(j.shift(),b),B=j.length?r.decodeQuery(j.join("="),b):null,U!=="__proto__"&&(c.call(S,U)?((typeof S[U]=="string"||S[U]===null)&&(S[U]=[S[U]]),S[U].push(B)):S[U]=B);return S},r.build=function(m){var b="",S=!1;return m.protocol&&(b+=m.protocol+":"),!m.urn&&(b||m.hostname)&&(b+="//",S=!0),b+=r.buildAuthority(m)||"",typeof m.path=="string"&&(m.path.charAt(0)!=="/"&&S&&(b+="/"),b+=m.path),typeof m.query=="string"&&m.query&&(b+="?"+m.query),typeof m.fragment=="string"&&m.fragment&&(b+="#"+m.fragment),b},r.buildHost=function(m){var b="";if(m.hostname)r.ip6_expression.test(m.hostname)?b+="["+m.hostname+"]":b+=m.hostname;else return"";return m.port&&(b+=":"+m.port),b},r.buildAuthority=function(m){return r.buildUserinfo(m)+r.buildHost(m)},r.buildUserinfo=function(m){var b="";return m.username&&(b+=r.encode(m.username)),m.password&&(b+=":"+r.encode(m.password)),b&&(b+="@"),b},r.buildQuery=function(m,b,S){var L="",N,j,U,B;for(j in m)if(j!=="__proto__"&&c.call(m,j))if(d(m[j]))for(N={},U=0,B=m[j].length;U<B;U++)m[j][U]!==void 0&&N[m[j][U]+""]===void 0&&(L+="&"+r.buildQueryParameter(j,m[j][U],S),b!==!0&&(N[m[j][U]+""]=!0));else m[j]!==void 0&&(L+="&"+r.buildQueryParameter(j,m[j],S));return L.substring(1)},r.buildQueryParameter=function(m,b,S){return r.encodeQuery(m,S)+(b!==null?"="+r.encodeQuery(b,S):"")},r.addQuery=function(m,b,S){if(typeof b=="object")for(var L in b)c.call(b,L)&&r.addQuery(m,L,b[L]);else if(typeof b=="string"){if(m[b]===void 0){m[b]=S;return}else typeof m[b]=="string"&&(m[b]=[m[b]]);d(S)||(S=[S]),m[b]=(m[b]||[]).concat(S)}else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter")},r.setQuery=function(m,b,S){if(typeof b=="object")for(var L in b)c.call(b,L)&&r.setQuery(m,L,b[L]);else if(typeof b=="string")m[b]=S===void 0?null:S;else throw new TypeError("URI.setQuery() accepts an object, string as the name parameter")},r.removeQuery=function(m,b,S){var L,N,j;if(d(b))for(L=0,N=b.length;L<N;L++)m[b[L]]=void 0;else if(u(b)==="RegExp")for(j in m)b.test(j)&&(m[j]=void 0);else if(typeof b=="object")for(j in b)c.call(b,j)&&r.removeQuery(m,j,b[j]);else if(typeof b=="string")S!==void 0?u(S)==="RegExp"?!d(m[b])&&S.test(m[b])?m[b]=void 0:m[b]=f(m[b],S):m[b]===String(S)&&(!d(S)||S.length===1)?m[b]=void 0:d(m[b])&&(m[b]=f(m[b],S)):m[b]=void 0;else throw new TypeError("URI.removeQuery() accepts an object, string, RegExp as the first parameter")},r.hasQuery=function(m,b,S,L){switch(u(b)){case"String":break;case"RegExp":for(var N in m)if(c.call(m,N)&&b.test(N)&&(S===void 0||r.hasQuery(m,N,S)))return!0;return!1;case"Object":for(var j in b)if(c.call(b,j)&&!r.hasQuery(m,j,b[j]))return!1;return!0;default:throw new TypeError("URI.hasQuery() accepts a string, regular expression or object as the name parameter")}switch(u(S)){case"Undefined":return b in m;case"Boolean":var U=!!(d(m[b])?m[b].length:m[b]);return S===U;case"Function":return!!S(m[b],b,m);case"Array":if(!d(m[b]))return!1;var B=L?g:_;return B(m[b],S);case"RegExp":return d(m[b])?L?g(m[b],S):!1:!!(m[b]&&m[b].match(S));case"Number":S=String(S);case"String":return d(m[b])?L?g(m[b],S):!1:m[b]===S;default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter")}},r.joinPaths=function(){for(var m=[],b=[],S=0,L=0;L<arguments.length;L++){var N=new r(arguments[L]);m.push(N);for(var j=N.segment(),U=0;U<j.length;U++)typeof j[U]=="string"&&b.push(j[U]),j[U]&&S++}if(!b.length||!S)return new r("");var B=new r("").segment(b);return(m[0].path()===""||m[0].path().slice(0,1)==="/")&&B.path("/"+B.path()),B.normalize()},r.commonPath=function(m,b){var S=Math.min(m.length,b.length),L;for(L=0;L<S;L++)if(m.charAt(L)!==b.charAt(L)){L--;break}return L<1?m.charAt(0)===b.charAt(0)&&m.charAt(0)==="/"?"/":"":((m.charAt(L)!=="/"||b.charAt(L)!=="/")&&(L=m.substring(0,L).lastIndexOf("/")),m.substring(0,L+1))},r.withinString=function(m,b,S){S||(S={});var L=S.start||r.findUri.start,N=S.end||r.findUri.end,j=S.trim||r.findUri.trim,U=S.parens||r.findUri.parens,B=/[a-z0-9-]=["']?$/i;for(L.lastIndex=0;;){var X=L.exec(m);if(!X)break;var G=X.index;if(S.ignoreHtml){var ae=m.slice(Math.max(G-3,0),G);if(ae&&B.test(ae))continue}for(var te=G+m.slice(G).search(N),V=m.slice(G,te),re=-1;;){var ie=U.exec(V);if(!ie)break;var he=ie.index+ie[0].length;re=Math.max(re,he)}if(re>-1?V=V.slice(0,re)+V.slice(re).replace(j,""):V=V.replace(j,""),!(V.length<=X[0].length)&&!(S.ignore&&S.ignore.test(V))){te=G+V.length;var me=b(V,G,te,m);if(me===void 0){L.lastIndex=te;continue}me=String(me),m=m.slice(0,G)+me+m.slice(te),L.lastIndex=G+me.length}}return L.lastIndex=0,m},r.ensureValidHostname=function(m,b){var S=!!m,L=!!b,N=!1;if(L&&(N=g(r.hostProtocols,b)),N&&!S)throw new TypeError("Hostname cannot be empty, if protocol is "+b);if(m&&m.match(r.invalid_hostname_characters)){if(!e)throw new TypeError('Hostname "'+m+'" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available');if(e.toASCII(m).match(r.invalid_hostname_characters))throw new TypeError('Hostname "'+m+'" contains characters other than [A-Z0-9.-:_]')}},r.ensureValidPort=function(m){if(m){var b=Number(m);if(!(a(b)&&b>0&&b<65536))throw new TypeError('Port "'+m+'" is not a valid port')}},r.noConflict=function(m){if(m){var b={URI:this.noConflict()};return s.URITemplate&&typeof s.URITemplate.noConflict=="function"&&(b.URITemplate=s.URITemplate.noConflict()),s.IPv6&&typeof s.IPv6.noConflict=="function"&&(b.IPv6=s.IPv6.noConflict()),s.SecondLevelDomains&&typeof s.SecondLevelDomains.noConflict=="function"&&(b.SecondLevelDomains=s.SecondLevelDomains.noConflict()),b}else s.URI===this&&(s.URI=o);return this},l.build=function(m){return m===!0?this._deferred_build=!0:(m===void 0||this._deferred_build)&&(this._string=r.build(this._parts),this._deferred_build=!1),this},l.clone=function(){return new r(this)},l.valueOf=l.toString=function(){return this.build(!1)._string};function I(m){return function(b,S){return b===void 0?this._parts[m]||"":(this._parts[m]=b||null,this.build(!S),this)}}function M(m,b){return function(S,L){return S===void 0?this._parts[m]||"":(S!==null&&(S=S+"",S.charAt(0)===b&&(S=S.substring(1))),this._parts[m]=S,this.build(!L),this)}}l.protocol=I("protocol"),l.username=I("username"),l.password=I("password"),l.hostname=I("hostname"),l.port=I("port"),l.query=M("query","?"),l.fragment=M("fragment","#"),l.search=function(m,b){var S=this.query(m,b);return typeof S=="string"&&S.length?"?"+S:S},l.hash=function(m,b){var S=this.fragment(m,b);return typeof S=="string"&&S.length?"#"+S:S},l.pathname=function(m,b){if(m===void 0||m===!0){var S=this._parts.path||(this._parts.hostname?"/":"");return m?(this._parts.urn?r.decodeUrnPath:r.decodePath)(S):S}else return this._parts.urn?this._parts.path=m?r.recodeUrnPath(m):"":this._parts.path=m?r.recodePath(m):"/",this.build(!b),this},l.path=l.pathname,l.href=function(m,b){var S;if(m===void 0)return this.toString();this._string="",this._parts=r._parts();var L=m instanceof r,N=typeof m=="object"&&(m.hostname||m.path||m.pathname);if(m.nodeName){var j=r.getDomAttribute(m);m=m[j]||"",N=!1}if(!L&&N&&m.pathname!==void 0&&(m=m.toString()),typeof m=="string"||m instanceof String)this._parts=r.parse(String(m),this._parts);else if(L||N){var U=L?m._parts:m;for(S in U)S!=="query"&&c.call(this._parts,S)&&(this._parts[S]=U[S]);U.query&&this.query(U.query,!1)}else throw new TypeError("invalid input");return this.build(!b),this},l.is=function(m){var b=!1,S=!1,L=!1,N=!1,j=!1,U=!1,B=!1,X=!this._parts.urn;switch(this._parts.hostname&&(X=!1,S=r.ip4_expression.test(this._parts.hostname),L=r.ip6_expression.test(this._parts.hostname),b=S||L,N=!b,j=N&&n&&n.has(this._parts.hostname),U=N&&r.idn_expression.test(this._parts.hostname),B=N&&r.punycode_expression.test(this._parts.hostname)),m.toLowerCase()){case"relative":return X;case"absolute":return!X;case"domain":case"name":return N;case"sld":return j;case"ip":return b;case"ip4":case"ipv4":case"inet4":return S;case"ip6":case"ipv6":case"inet6":return L;case"idn":return U;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return B}return null};var z=l.protocol,k=l.port,q=l.hostname;l.protocol=function(m,b){if(m&&(m=m.replace(/:(\/\/)?$/,""),!m.match(r.protocol_expression)))throw new TypeError('Protocol "'+m+`" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]`);return z.call(this,m,b)},l.scheme=l.protocol,l.port=function(m,b){return this._parts.urn?m===void 0?"":this:(m!==void 0&&(m===0&&(m=null),m&&(m+="",m.charAt(0)===":"&&(m=m.substring(1)),r.ensureValidPort(m))),k.call(this,m,b))},l.hostname=function(m,b){if(this._parts.urn)return m===void 0?"":this;if(m!==void 0){var S={preventInvalidHostname:this._parts.preventInvalidHostname},L=r.parseHost(m,S);if(L!=="/")throw new TypeError('Hostname "'+m+'" contains characters other than [A-Z0-9.-]');m=S.hostname,this._parts.preventInvalidHostname&&r.ensureValidHostname(m,this._parts.protocol)}return q.call(this,m,b)},l.origin=function(m,b){if(this._parts.urn)return m===void 0?"":this;if(m===void 0){var S=this.protocol(),L=this.authority();return L?(S?S+"://":"")+this.authority():""}else{var N=r(m);return this.protocol(N.protocol()).authority(N.authority()).build(!b),this}},l.host=function(m,b){if(this._parts.urn)return m===void 0?"":this;if(m===void 0)return this._parts.hostname?r.buildHost(this._parts):"";var S=r.parseHost(m,this._parts);if(S!=="/")throw new TypeError('Hostname "'+m+'" contains characters other than [A-Z0-9.-]');return this.build(!b),this},l.authority=function(m,b){if(this._parts.urn)return m===void 0?"":this;if(m===void 0)return this._parts.hostname?r.buildAuthority(this._parts):"";var S=r.parseAuthority(m,this._parts);if(S!=="/")throw new TypeError('Hostname "'+m+'" contains characters other than [A-Z0-9.-]');return this.build(!b),this},l.userinfo=function(m,b){if(this._parts.urn)return m===void 0?"":this;if(m===void 0){var S=r.buildUserinfo(this._parts);return S&&S.substring(0,S.length-1)}else return m[m.length-1]!=="@"&&(m+="@"),r.parseUserinfo(m,this._parts),this.build(!b),this},l.resource=function(m,b){var S;return m===void 0?this.path()+this.search()+this.hash():(S=r.parse(m),this._parts.path=S.path,this._parts.query=S.query,this._parts.fragment=S.fragment,this.build(!b),this)},l.subdomain=function(m,b){if(this._parts.urn)return m===void 0?"":this;if(m===void 0){if(!this._parts.hostname||this.is("IP"))return"";var S=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,S)||""}else{var L=this._parts.hostname.length-this.domain().length,N=this._parts.hostname.substring(0,L),j=new RegExp("^"+h(N));if(m&&m.charAt(m.length-1)!=="."&&(m+="."),m.indexOf(":")!==-1)throw new TypeError("Domains cannot contain colons");return m&&r.ensureValidHostname(m,this._parts.protocol),this._parts.hostname=this._parts.hostname.replace(j,m),this.build(!b),this}},l.domain=function(m,b){if(this._parts.urn)return m===void 0?"":this;if(typeof m=="boolean"&&(b=m,m=void 0),m===void 0){if(!this._parts.hostname||this.is("IP"))return"";var S=this._parts.hostname.match(/\./g);if(S&&S.length<2)return this._parts.hostname;var L=this._parts.hostname.length-this.tld(b).length-1;return L=this._parts.hostname.lastIndexOf(".",L-1)+1,this._parts.hostname.substring(L)||""}else{if(!m)throw new TypeError("cannot set domain empty");if(m.indexOf(":")!==-1)throw new TypeError("Domains cannot contain colons");if(r.ensureValidHostname(m,this._parts.protocol),!this._parts.hostname||this.is("IP"))this._parts.hostname=m;else{var N=new RegExp(h(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(N,m)}return this.build(!b),this}},l.tld=function(m,b){if(this._parts.urn)return m===void 0?"":this;if(typeof m=="boolean"&&(b=m,m=void 0),m===void 0){if(!this._parts.hostname||this.is("IP"))return"";var S=this._parts.hostname.lastIndexOf("."),L=this._parts.hostname.substring(S+1);return b!==!0&&n&&n.list[L.toLowerCase()]&&n.get(this._parts.hostname)||L}else{var N;if(m)if(m.match(/[^a-zA-Z0-9-]/))if(n&&n.is(m))N=new RegExp(h(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(N,m);else throw new TypeError('TLD "'+m+'" contains characters other than [A-Z0-9]');else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");N=new RegExp(h(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(N,m)}else throw new TypeError("cannot set TLD empty");return this.build(!b),this}},l.directory=function(m,b){if(this._parts.urn)return m===void 0?"":this;if(m===void 0||m===!0){if(!this._parts.path&&!this._parts.hostname)return"";if(this._parts.path==="/")return"/";var S=this._parts.path.length-this.filename().length-1,L=this._parts.path.substring(0,S)||(this._parts.hostname?"/":"");return m?r.decodePath(L):L}else{var N=this._parts.path.length-this.filename().length,j=this._parts.path.substring(0,N),U=new RegExp("^"+h(j));return this.is("relative")||(m||(m="/"),m.charAt(0)!=="/"&&(m="/"+m)),m&&m.charAt(m.length-1)!=="/"&&(m+="/"),m=r.recodePath(m),this._parts.path=this._parts.path.replace(U,m),this.build(!b),this}},l.filename=function(m,b){if(this._parts.urn)return m===void 0?"":this;if(typeof m!="string"){if(!this._parts.path||this._parts.path==="/")return"";var S=this._parts.path.lastIndexOf("/"),L=this._parts.path.substring(S+1);return m?r.decodePathSegment(L):L}else{var N=!1;m.charAt(0)==="/"&&(m=m.substring(1)),m.match(/\.?\//)&&(N=!0);var j=new RegExp(h(this.filename())+"$");return m=r.recodePath(m),this._parts.path=this._parts.path.replace(j,m),N?this.normalizePath(b):this.build(!b),this}},l.suffix=function(m,b){if(this._parts.urn)return m===void 0?"":this;if(m===void 0||m===!0){if(!this._parts.path||this._parts.path==="/")return"";var S=this.filename(),L=S.lastIndexOf("."),N,j;return L===-1?"":(N=S.substring(L+1),j=/^[a-z0-9%]+$/i.test(N)?N:"",m?r.decodePathSegment(j):j)}else{m.charAt(0)==="."&&(m=m.substring(1));var U=this.suffix(),B;if(U)m?B=new RegExp(h(U)+"$"):B=new RegExp(h("."+U)+"$");else{if(!m)return this;this._parts.path+="."+r.recodePath(m)}return B&&(m=r.recodePath(m),this._parts.path=this._parts.path.replace(B,m)),this.build(!b),this}},l.segment=function(m,b,S){var L=this._parts.urn?":":"/",N=this.path(),j=N.substring(0,1)==="/",U=N.split(L);if(m!==void 0&&typeof m!="number"&&(S=b,b=m,m=void 0),m!==void 0&&typeof m!="number")throw new Error('Bad segment "'+m+'", must be 0-based integer');if(j&&U.shift(),m<0&&(m=Math.max(U.length+m,0)),b===void 0)return m===void 0?U:U[m];if(m===null||U[m]===void 0)if(d(b)){U=[];for(var B=0,X=b.length;B<X;B++)!b[B].length&&(!U.length||!U[U.length-1].length)||(U.length&&!U[U.length-1].length&&U.pop(),U.push(v(b[B])))}else(b||typeof b=="string")&&(b=v(b),U[U.length-1]===""?U[U.length-1]=b:U.push(b));else b?U[m]=v(b):U.splice(m,1);return j&&U.unshift(""),this.path(U.join(L),S)},l.segmentCoded=function(m,b,S){var L,N,j;if(typeof m!="number"&&(S=b,b=m,m=void 0),b===void 0){if(L=this.segment(m,b,S),!d(L))L=L!==void 0?r.decode(L):void 0;else for(N=0,j=L.length;N<j;N++)L[N]=r.decode(L[N]);return L}if(!d(b))b=typeof b=="string"||b instanceof String?r.encode(b):b;else for(N=0,j=b.length;N<j;N++)b[N]=r.encode(b[N]);return this.segment(m,b,S)};var H=l.query;return l.query=function(m,b){if(m===!0)return r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if(typeof m=="function"){var S=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace),L=m.call(this,S);return this._parts.query=r.buildQuery(L||S,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!b),this}else return m!==void 0&&typeof m!="string"?(this._parts.query=r.buildQuery(m,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!b),this):H.call(this,m,b)},l.setQuery=function(m,b,S){var L=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if(typeof m=="string"||m instanceof String)L[m]=b!==void 0?b:null;else if(typeof m=="object")for(var N in m)c.call(m,N)&&(L[N]=m[N]);else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");return this._parts.query=r.buildQuery(L,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof m!="string"&&(S=b),this.build(!S),this},l.addQuery=function(m,b,S){var L=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return r.addQuery(L,m,b===void 0?null:b),this._parts.query=r.buildQuery(L,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof m!="string"&&(S=b),this.build(!S),this},l.removeQuery=function(m,b,S){var L=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return r.removeQuery(L,m,b),this._parts.query=r.buildQuery(L,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof m!="string"&&(S=b),this.build(!S),this},l.hasQuery=function(m,b,S){var L=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return r.hasQuery(L,m,b,S)},l.setSearch=l.setQuery,l.addSearch=l.addQuery,l.removeSearch=l.removeQuery,l.hasSearch=l.hasQuery,l.normalize=function(){return this._parts.urn?this.normalizeProtocol(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build():this.normalizeProtocol(!1).normalizeHostname(!1).normalizePort(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build()},l.normalizeProtocol=function(m){return typeof this._parts.protocol=="string"&&(this._parts.protocol=this._parts.protocol.toLowerCase(),this.build(!m)),this},l.normalizeHostname=function(m){return this._parts.hostname&&(this.is("IDN")&&e?this._parts.hostname=e.toASCII(this._parts.hostname):this.is("IPv6")&&t&&(this._parts.hostname=t.best(this._parts.hostname)),this._parts.hostname=this._parts.hostname.toLowerCase(),this.build(!m)),this},l.normalizePort=function(m){return typeof this._parts.protocol=="string"&&this._parts.port===r.defaultPorts[this._parts.protocol]&&(this._parts.port=null,this.build(!m)),this},l.normalizePath=function(m){var b=this._parts.path;if(!b)return this;if(this._parts.urn)return this._parts.path=r.recodeUrnPath(this._parts.path),this.build(!m),this;if(this._parts.path==="/")return this;b=r.recodePath(b);var S,L="",N,j;for(b.charAt(0)!=="/"&&(S=!0,b="/"+b),(b.slice(-3)==="/.."||b.slice(-2)==="/.")&&(b+="/"),b=b.replace(/(\/(\.\/)+)|(\/\.$)/g,"/").replace(/\/{2,}/g,"/"),S&&(L=b.substring(1).match(/^(\.\.\/)+/)||"",L&&(L=L[0]));N=b.search(/\/\.\.(\/|$)/),N!==-1;){if(N===0){b=b.substring(3);continue}j=b.substring(0,N).lastIndexOf("/"),j===-1&&(j=N),b=b.substring(0,j)+b.substring(N+3)}return S&&this.is("relative")&&(b=L+b.substring(1)),this._parts.path=b,this.build(!m),this},l.normalizePathname=l.normalizePath,l.normalizeQuery=function(m){return typeof this._parts.query=="string"&&(this._parts.query.length?this.query(r.parseQuery(this._parts.query,this._parts.escapeQuerySpace)):this._parts.query=null,this.build(!m)),this},l.normalizeFragment=function(m){return this._parts.fragment||(this._parts.fragment=null,this.build(!m)),this},l.normalizeSearch=l.normalizeQuery,l.normalizeHash=l.normalizeFragment,l.iso8859=function(){var m=r.encode,b=r.decode;r.encode=escape,r.decode=decodeURIComponent;try{this.normalize()}finally{r.encode=m,r.decode=b}return this},l.unicode=function(){var m=r.encode,b=r.decode;r.encode=w,r.decode=unescape;try{this.normalize()}finally{r.encode=m,r.decode=b}return this},l.readable=function(){var m=this.clone();m.username("").password("").normalize();var b="";if(m._parts.protocol&&(b+=m._parts.protocol+"://"),m._parts.hostname&&(m.is("punycode")&&e?(b+=e.toUnicode(m._parts.hostname),m._parts.port&&(b+=":"+m._parts.port)):b+=m.host()),m._parts.hostname&&m._parts.path&&m._parts.path.charAt(0)!=="/"&&(b+="/"),b+=m.path(!0),m._parts.query){for(var S="",L=0,N=m._parts.query.split("&"),j=N.length;L<j;L++){var U=(N[L]||"").split("=");S+="&"+r.decodeQuery(U[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"),U[1]!==void 0&&(S+="="+r.decodeQuery(U[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}b+="?"+S.substring(1)}return b+=r.decodeQuery(m.hash(),!0),b},l.absoluteTo=function(m){var b=this.clone(),S=["protocol","username","password","hostname","port"],L,N,j;if(this._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(m instanceof r||(m=new r(m)),b._parts.protocol||(b._parts.protocol=m._parts.protocol,this._parts.hostname))return b;for(N=0;j=S[N];N++)b._parts[j]=m._parts[j];return b._parts.path?(b._parts.path.substring(-2)===".."&&(b._parts.path+="/"),b.path().charAt(0)!=="/"&&(L=m.directory(),L=L||(m.path().indexOf("/")===0?"/":""),b._parts.path=(L?L+"/":"")+b._parts.path,b.normalizePath())):(b._parts.path=m._parts.path,b._parts.query||(b._parts.query=m._parts.query)),b.build(),b},l.relativeTo=function(m){var b=this.clone().normalize(),S,L,N,j,U;if(b._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(m=new r(m).normalize(),S=b._parts,L=m._parts,j=b.path(),U=m.path(),j.charAt(0)!=="/")throw new Error("URI is already relative");if(U.charAt(0)!=="/")throw new Error("Cannot calculate a URI relative to another relative URI");if(S.protocol===L.protocol&&(S.protocol=null),S.username!==L.username||S.password!==L.password||S.protocol!==null||S.username!==null||S.password!==null)return b.build();if(S.hostname===L.hostname&&S.port===L.port)S.hostname=null,S.port=null;else return b.build();if(j===U)return S.path="",b.build();if(N=r.commonPath(j,U),!N)return b.build();var B=L.path.substring(N.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../");return S.path=B+S.path.substring(N.length)||"./",b.build()},l.equals=function(m){var b=this.clone(),S=new r(m),L={},N={},j={},U,B,X;if(b.normalize(),S.normalize(),b.toString()===S.toString())return!0;if(U=b.query(),B=S.query(),b.query(""),S.query(""),b.toString()!==S.toString()||U.length!==B.length)return!1;L=r.parseQuery(U,this._parts.escapeQuerySpace),N=r.parseQuery(B,this._parts.escapeQuerySpace);for(X in L)if(c.call(L,X)){if(d(L[X])){if(!_(L[X],N[X]))return!1}else if(L[X]!==N[X])return!1;j[X]=!0}for(X in N)if(c.call(N,X)&&!j[X])return!1;return!0},l.preventInvalidHostname=function(m){return this._parts.preventInvalidHostname=!!m,this},l.duplicateQueryParameters=function(m){return this._parts.duplicateQueryParameters=!!m,this},l.escapeQuerySpace=function(m){return this._parts.escapeQuerySpace=!!m,this},r})})(ah)),ah.exports}var HP=$P();const Ls=My(HP);function XP(i){return(i.length===0||i[i.length-1]!=="/")&&(i=`${i}/`),i}function yr(i,e){if(i===null||typeof i!="object")return i;e=e??!1;const t=new i.constructor;for(const n in i)if(i.hasOwnProperty(n)){let s=i[n];e&&(s=yr(s,e)),t[n]=s}return t}function zs(i,e,t){t=t??!1;const n={},s=x(i),o=x(e);let r,a,l;if(s)for(r in i)i.hasOwnProperty(r)&&(a=i[r],o&&t&&typeof a=="object"&&e.hasOwnProperty(r)?(l=e[r],typeof l=="object"?n[r]=zs(a,l,t):n[r]=a):n[r]=a);if(o)for(r in e)e.hasOwnProperty(r)&&!n.hasOwnProperty(r)&&(l=e[r],n[r]=l);return n}function Va(){let i,e;const t=new Promise(function(n,s){i=n,e=s});return{resolve:i,reject:e,promise:t}}function Wa(i,e){let t;return typeof document<"u"&&(t=document),Wa._implementation(i,e,t)}Wa._implementation=function(i,e,t){if(!x(i))throw new $("relative uri is required.");if(!x(e)){if(typeof t>"u")return i;e=t.baseURI??t.location.href}const n=new Ls(i);return n.scheme()!==""?n.toString():n.absoluteTo(e).toString()};function YP(i,e){if(!x(i))throw new $("uri is required.");let t="";const n=i.lastIndexOf("/");return n!==-1&&(t=i.substring(0,n+1)),e&&(i=new Ls(i),i.query().length!==0&&(t+=`?${i.query()}`),i.fragment().length!==0&&(t+=`#${i.fragment()}`)),t}function ZP(i){if(!x(i))throw new $("uri is required.");const e=new Ls(i);e.normalize();let t=e.path(),n=t.lastIndexOf("/");return n!==-1&&(t=t.substr(n+1)),n=t.lastIndexOf("."),n===-1?t="":t=t.substr(n+1),t}const l_={};function c_(i,e,t){x(e)||(e=i.width),x(t)||(t=i.height);let n=l_[e];x(n)||(n={},l_[e]=n);let s=n[t];if(!x(s)){const o=document.createElement("canvas");o.width=e,o.height=t,s=o.getContext("2d",{willReadFrequently:!0}),s.globalCompositeOperation="copy",n[t]=s}return s.drawImage(i,0,0,e,t),s.getImageData(0,0,e,t).data}const KP=/^blob:/i;function h_(i){return y.typeOf.string("uri",i),KP.test(i)}let Ci;function QP(i){x(Ci)||(Ci=document.createElement("a")),Ci.href=globalThis.location.href;const e=Ci.host,t=Ci.protocol;return Ci.href=i,Ci.href=Ci.href,t!==Ci.protocol||e!==Ci.host}const JP=/^data:/i;function u_(i){return y.typeOf.string("uri",i),JP.test(i)}function eS(i){const e=document.createElement("script");return e.async=!0,e.src=i,new Promise((t,n)=>{globalThis.crossOriginIsolated&&e.setAttribute("crossorigin","anonymous");const s=document.getElementsByTagName("head")[0];e.onload=function(){e.onload=void 0,s.removeChild(e),t()},e.onerror=function(o){n(o)},s.appendChild(e)})}function tS(i){if(!x(i))throw new $("obj is required.");let e="";for(const t in i)if(i.hasOwnProperty(t)){const n=i[t],s=`${encodeURIComponent(t)}=`;if(Array.isArray(n))for(let o=0,r=n.length;o<r;++o)e+=`${s+encodeURIComponent(n[o])}&`;else e+=`${s+encodeURIComponent(n)}&`}return e=e.slice(0,-1),e}function nS(i){if(!x(i))throw new $("queryString is required.");const e={};if(i==="")return e;const t=i.replace(/\+/g,"%20").split(/[&;]/);for(let n=0,s=t.length;n<s;++n){const o=t[n].split("="),r=decodeURIComponent(o[0]);let a=o[1];x(a)?a=decodeURIComponent(a):a="";const l=e[r];typeof l=="string"?e[r]=[l,a]:Array.isArray(l)?l.push(a):e[r]=a}return e}const mt={UNISSUED:0,ISSUED:1,ACTIVE:2,RECEIVED:3,CANCELLED:4,FAILED:5};Object.freeze(mt);const d_={TERRAIN:0,IMAGERY:1,TILES3D:2,OTHER:3};Object.freeze(d_);function hh(i){i=i??Ei.EMPTY_OBJECT;const e=i.throttleByServer??!1,t=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=t,this.throttleByServer=e,this.type=i.type??d_.OTHER,this.serverKey=i.serverKey,this.state=mt.UNISSUED,this.deferred=void 0,this.cancelled=!1}hh.prototype.cancel=function(){this.cancelled=!0},hh.prototype.clone=function(i){return x(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=mt.UNISSUED,i.deferred=void 0,i.cancelled=!1,i):new hh(this)};function iS(i){const e={};if(!i)return e;const t=i.split(`\r
|
|
69
|
-
`);for(let n=0;n<t.length;++n){const s=t[n],o=s.indexOf(": ");if(o>0){const r=s.substring(0,o),a=s.substring(o+2);e[r]=a}}return e}function Ba(i,e,t){this.statusCode=i,this.response=e,this.responseHeaders=t,typeof this.responseHeaders=="string"&&(this.responseHeaders=iS(this.responseHeaders))}Ba.prototype.toString=function(){let i="Request has failed.";return x(this.statusCode)&&(i+=` Status Code: ${this.statusCode}`),i};function $a(){this._listeners=new Map,this._toRemove=new Map,this._toAdd=new Map,this._invokingListeners=!1,this._listenerCount=0}Object.defineProperties($a.prototype,{numberOfListeners:{get:function(){return this._listenerCount}}}),$a.prototype.addEventListener=function(i,e){y.typeOf.func("listener",i);const t=this,n=t._invokingListeners?t._toAdd:t._listeners;return Sf(this,n,i,e)&&t._listenerCount++,function(){t.removeEventListener(i,e)}};function Sf(i,e,t,n){e.has(t)||e.set(t,new Set);const s=e.get(t);return s.has(n)?!1:(s.add(n),!0)}$a.prototype.removeEventListener=function(i,e){y.typeOf.func("listener",i);const t=Rf(this,this._listeners,i,e),n=Rf(this,this._toAdd,i,e),s=t||n;return s&&this._listenerCount--,s};function Rf(i,e,t,n){const s=e.get(t);if(!s||!s.has(n))return!1;if(i._invokingListeners){if(!Sf(i,i._toRemove,t,n))return!1}else s.delete(n),s.size===0&&e.delete(t);return!0}$a.prototype.raiseEvent=function(){this._invokingListeners=!0;for(const[i,e]of this._listeners.entries())if(x(i))for(const t of e)i.apply(t,arguments);this._invokingListeners=!1;for(const[i,e]of this._toAdd.entries())for(const t of e)Sf(this,this._listeners,i,t);this._toAdd.clear();for(const[i,e]of this._toRemove.entries())for(const t of e)Rf(this,this._listeners,i,t);this._toRemove.clear()};function vo(i){y.typeOf.object("options",i),y.defined("options.comparator",i.comparator),this._comparator=i.comparator,this._array=[],this._length=0,this._maximumLength=void 0}Object.defineProperties(vo.prototype,{length:{get:function(){return this._length}},internalArray:{get:function(){return this._array}},maximumLength:{get:function(){return this._maximumLength},set:function(i){y.typeOf.number.greaterThanOrEquals("maximumLength",i,0);const e=this._length;if(i<e){const t=this._array;for(let n=i;n<e;++n)t[n]=void 0;this._length=i,t.length=i}this._maximumLength=i}},comparator:{get:function(){return this._comparator}}});function Tf(i,e,t){const n=i[e];i[e]=i[t],i[t]=n}vo.prototype.reserve=function(i){i=i??this._length,this._array.length=i},vo.prototype.heapify=function(i){i=i??0;const e=this._length,t=this._comparator,n=this._array;let s,o=!0;for(;o;){const r=2*(i+1),a=r-1;a<e&&t(n[a],n[i])<0?s=a:s=i,r<e&&t(n[r],n[s])<0&&(s=r),s!==i?(Tf(n,s,i),i=s):o=!1}},vo.prototype.resort=function(){const i=this._length;for(let e=Math.ceil(i/2);e>=0;--e)this.heapify(e)},vo.prototype.insert=function(i){y.defined("element",i);const e=this._array,t=this._comparator,n=this._maximumLength;let s=this._length++;for(s<e.length?e[s]=i:e.push(i);s!==0;){const r=Math.floor((s-1)/2);if(t(e[s],e[r])<0)Tf(e,s,r),s=r;else break}let o;return x(n)&&this._length>n&&(o=e[n],this._length=n),o},vo.prototype.pop=function(i){if(i=i??0,this._length===0)return;y.typeOf.number.lessThan("index",i,this._length);const e=this._array,t=e[i];return Tf(e,i,--this._length),this.heapify(i),e[this._length]=void 0,t};function sS(i,e){return i.priority-e.priority}const Ge={numberOfAttemptedRequests:0,numberOfActiveRequests:0,numberOfCancelledRequests:0,numberOfCancelledActiveRequests:0,numberOfFailedRequests:0,numberOfActiveRequestsEver:0,lastNumberOfActiveRequests:0};let _r=20;const Kt=new vo({comparator:sS});Kt.maximumLength=_r,Kt.reserve(_r);const xi=[];let Ki={};const oS=typeof document<"u"?new Ls(document.location.href):new Ls,uh=new $a;function Ke(){}Ke.maximumRequests=50,Ke.maximumRequestsPerServer=18,Ke.requestsByServer={},Ke.throttleRequests=!0,Ke.debugShowStatistics=!1,Ke.requestCompletedEvent=uh,Object.defineProperties(Ke,{statistics:{get:function(){return Ge}},priorityHeapLength:{get:function(){return _r},set:function(i){if(i<_r)for(;Kt.length>i;){const e=Kt.pop();bo(e)}_r=i,Kt.maximumLength=i,Kt.reserve(i)}}});function f_(i){x(i.priorityFunction)&&(i.priority=i.priorityFunction())}Ke.serverHasOpenSlots=function(i,e){e=e??1;const t=Ke.requestsByServer[i]??Ke.maximumRequestsPerServer;return Ki[i]+e<=t},Ke.heapHasOpenSlots=function(i){return Kt.length+i<=_r};function p_(i){return i.state===mt.UNISSUED&&(i.state=mt.ISSUED,i.deferred=Va()),i.deferred.promise}function rS(i){return function(e){if(i.state===mt.CANCELLED)return;const t=i.deferred;--Ge.numberOfActiveRequests,--Ki[i.serverKey],uh.raiseEvent(),i.state=mt.RECEIVED,i.deferred=void 0,t.resolve(e)}}function aS(i){return function(e){i.state!==mt.CANCELLED&&(++Ge.numberOfFailedRequests,--Ge.numberOfActiveRequests,--Ki[i.serverKey],uh.raiseEvent(e),i.state=mt.FAILED,i.deferred.reject(e))}}function g_(i){const e=p_(i);return i.state=mt.ACTIVE,xi.push(i),++Ge.numberOfActiveRequests,++Ge.numberOfActiveRequestsEver,++Ki[i.serverKey],i.requestFunction().then(rS(i)).catch(aS(i)),e}function bo(i){const e=i.state===mt.ACTIVE;if(i.state=mt.CANCELLED,++Ge.numberOfCancelledRequests,x(i.deferred)){const t=i.deferred;t.promise.catch(()=>{}),i.deferred=void 0,t.reject(new En(`Request cancelled: "${i.url}"`))}e&&(--Ge.numberOfActiveRequests,--Ki[i.serverKey],++Ge.numberOfCancelledActiveRequests),x(i.cancelFunction)&&i.cancelFunction()}Ke.update=function(){let i,e,t=0;const n=xi.length;for(i=0;i<n;++i){if(e=xi[i],e.cancelled&&bo(e),e.state!==mt.ACTIVE){++t;continue}t>0&&(xi[i-t]=e)}xi.length-=t;const s=Kt.internalArray,o=Kt.length;for(i=0;i<o;++i)f_(s[i]);Kt.resort();const r=Math.max(Ke.maximumRequests-xi.length,0);let a=0;for(;a<r&&Kt.length>0;){if(e=Kt.pop(),e.cancelled){bo(e);continue}if(e.throttleByServer&&!Ke.serverHasOpenSlots(e.serverKey)){bo(e);continue}g_(e),++a}lS()},Ke.getServerKey=function(i){y.typeOf.string("url",i);let e=new Ls(i);e.scheme()===""&&(e=e.absoluteTo(oS),e.normalize());let t=e.authority();/:/.test(t)||(t=`${t}:${e.scheme()==="https"?"443":"80"}`);const n=Ki[t];return x(n)||(Ki[t]=0),t},Ke.request=function(i){if(y.typeOf.object("request",i),y.typeOf.string("request.url",i.url),y.typeOf.func("request.requestFunction",i.requestFunction),u_(i.url)||h_(i.url))return uh.raiseEvent(),i.state=mt.RECEIVED,i.requestFunction();if(++Ge.numberOfAttemptedRequests,x(i.serverKey)||(i.serverKey=Ke.getServerKey(i.url)),Ke.throttleRequests&&i.throttleByServer&&!Ke.serverHasOpenSlots(i.serverKey))return;if(!Ke.throttleRequests||!i.throttle)return g_(i);if(xi.length>=Ke.maximumRequests)return;f_(i);const e=Kt.insert(i);if(x(e)){if(e===i)return;bo(e)}return p_(i)};function lS(){Ke.debugShowStatistics&&(Ge.numberOfActiveRequests===0&&Ge.lastNumberOfActiveRequests>0&&(Ge.numberOfAttemptedRequests>0&&(console.log(`Number of attempted requests: ${Ge.numberOfAttemptedRequests}`),Ge.numberOfAttemptedRequests=0),Ge.numberOfCancelledRequests>0&&(console.log(`Number of cancelled requests: ${Ge.numberOfCancelledRequests}`),Ge.numberOfCancelledRequests=0),Ge.numberOfCancelledActiveRequests>0&&(console.log(`Number of cancelled active requests: ${Ge.numberOfCancelledActiveRequests}`),Ge.numberOfCancelledActiveRequests=0),Ge.numberOfFailedRequests>0&&(console.log(`Number of failed requests: ${Ge.numberOfFailedRequests}`),Ge.numberOfFailedRequests=0)),Ge.lastNumberOfActiveRequests=Ge.numberOfActiveRequests)}Ke.clearForSpecs=function(){for(;Kt.length>0;){const e=Kt.pop();bo(e)}const i=xi.length;for(let e=0;e<i;++e)bo(xi[e]);xi.length=0,Ki={},Ge.numberOfAttemptedRequests=0,Ge.numberOfActiveRequests=0,Ge.numberOfCancelledRequests=0,Ge.numberOfCancelledActiveRequests=0,Ge.numberOfFailedRequests=0,Ge.numberOfActiveRequestsEver=0,Ge.lastNumberOfActiveRequests=0},Ke.numberOfActiveRequestsByServer=function(i){return Ki[i]},Ke.requestHeap=Kt;const wr={};let vr={};wr.add=function(i,e){if(!x(i))throw new $("host is required.");if(!x(e)||e<=0)throw new $("port is required to be greater than 0.");const t=`${i.toLowerCase()}:${e}`;x(vr[t])||(vr[t]=!0)},wr.remove=function(i,e){if(!x(i))throw new $("host is required.");if(!x(e)||e<=0)throw new $("port is required to be greater than 0.");const t=`${i.toLowerCase()}:${e}`;x(vr[t])&&delete vr[t]};function cS(i){const e=new Ls(i);e.normalize();let t=e.authority();if(t.length!==0){if(e.authority(t),t.indexOf("@")!==-1&&(t=t.split("@")[1]),t.indexOf(":")===-1){let n=e.scheme();if(n.length===0&&(n=globalThis.location.protocol,n=n.substring(0,n.length-1)),n==="http")t+=":80";else if(n==="https")t+=":443";else return}return t}}wr.contains=function(i){if(!x(i))throw new $("url is required.");const e=cS(i);return!!(x(e)&&x(vr[e]))},wr.clear=function(){vr={}};const m_=(function(){try{const i=new XMLHttpRequest;return i.open("GET","#",!0),i.responseType="blob",i.responseType==="blob"}catch{return!1}})();function ee(i){i=i??Ei.EMPTY_OBJECT,typeof i=="string"&&(i={url:i}),y.typeOf.string("options.url",i.url),this._url=void 0,this._templateValues=Pi(i.templateValues,{}),this._queryParameters=Pi(i.queryParameters,{}),this.headers=Pi(i.headers,{}),this.request=i.request??new hh,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 Pi(i,e){return x(i)?yr(i):e}ee.createIfNeeded=function(i){return i instanceof ee?i.getDerivedResource({request:i.request}):typeof i!="string"?i:new ee({url:i})};let br;ee.supportsImageBitmapOptions=function(){return x(br)?br:typeof createImageBitmap!="function"?(br=Promise.resolve(!1),br):(br=ee.fetchBlob({url:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAABGdBTUEAAE4g3rEiDgAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADElEQVQI12Ng6GAAAAEUAIngE3ZiAAAAAElFTkSuQmCC"}).then(function(e){const t={imageOrientation:"flipY",premultiplyAlpha:"none",colorSpaceConversion:"none"};return Promise.all([createImageBitmap(e,t),createImageBitmap(e)])}).then(function(e){const t=c_(e[0]),n=c_(e[1]);return t[1]!==n[1]}).catch(function(){return!1}),br)},Object.defineProperties(ee,{isBlobSupported:{get:function(){return m_}}}),Object.defineProperties(ee.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 ZP(this._url)}},isDataUri:{get:function(){return u_(this._url)}},isBlobUri:{get:function(){return h_(this._url)}},isCrossOriginUrl:{get:function(){return QP(this._url)}},hasHeaders:{get:function(){return Object.keys(this.headers).length>0}},credits:{get:function(){return this._credits}}}),ee.prototype.toString=function(){return this.getUrlComponent(!0,!0)},ee.prototype.parseUrl=function(i,e,t,n){let s=new Ls(i);const o=hS(s.query());this._queryParameters=e?dh(o,this.queryParameters,t):o,s.search(""),s.fragment(""),x(n)&&s.scheme()===""&&(s=s.absoluteTo(Wa(n))),this._url=s.toString()};function hS(i){return i.length===0?{}:i.indexOf("=")===-1?{[i]:void 0}:nS(i)}function dh(i,e,t){if(!t)return zs(i,e);const n=yr(i,!0);for(const s in e)if(e.hasOwnProperty(s)){let o=n[s];const r=e[s];x(o)?(Array.isArray(o)||(o=n[s]=[o]),n[s]=o.concat(r)):n[s]=Array.isArray(r)?r.slice():r}return n}ee.prototype.getUrlComponent=function(i,e){if(this.isDataUri)return this._url;let t=this._url;i&&(t=`${t}${uS(this.queryParameters)}`),t=t.replace(/%7B/g,"{").replace(/%7D/g,"}");const n=this._templateValues;return Object.keys(n).length>0&&(t=t.replace(/{(.*?)}/g,function(s,o){const r=n[o];return x(r)?encodeURIComponent(r):s})),e&&x(this.proxy)&&(t=this.proxy.getURL(t)),t};function uS(i){const e=Object.keys(i);return e.length===0?"":e.length===1&&!x(i[e[0]])?`?${e[0]}`:`?${tS(i)}`}ee.prototype.setQueryParameters=function(i,e){e?this._queryParameters=dh(this._queryParameters,i,!1):this._queryParameters=dh(i,this._queryParameters,!1)},ee.prototype.appendQueryParameters=function(i){this._queryParameters=dh(i,this._queryParameters,!0)},ee.prototype.setTemplateValues=function(i,e){e?this._templateValues=zs(this._templateValues,i):this._templateValues=zs(i,this._templateValues)},ee.prototype.getDerivedResource=function(i){const e=this.clone();if(e._retryCount=0,x(i.url)){const t=i.preserveQueryParameters??!1;e.parseUrl(i.url,!0,t,this._url)}return x(i.queryParameters)&&(e._queryParameters=zs(i.queryParameters,e.queryParameters)),x(i.templateValues)&&(e._templateValues=zs(i.templateValues,e.templateValues)),x(i.headers)&&(e.headers=zs(i.headers,e.headers)),x(i.proxy)&&(e.proxy=i.proxy),x(i.request)&&(e.request=i.request),x(i.retryCallback)&&(e.retryCallback=i.retryCallback),x(i.retryAttempts)&&(e.retryAttempts=i.retryAttempts),e},ee.prototype.retryOnError=function(i){const e=this.retryCallback;if(typeof e!="function"||this._retryCount>=this.retryAttempts)return Promise.resolve(!1);const t=this;return Promise.resolve(e(this,i)).then(function(n){return++t._retryCount,n})},ee.prototype.clone=function(i){return x(i)?(i._url=this._url,i._queryParameters=yr(this._queryParameters),i._templateValues=yr(this._templateValues),i.headers=yr(this.headers),i.proxy=this.proxy,i.retryCallback=this.retryCallback,i.retryAttempts=this.retryAttempts,i._retryCount=0,i.request=this.request.clone(),i):new ee({url:this._url,queryParameters:this.queryParameters,templateValues:this.templateValues,headers:this.headers,proxy:this.proxy,retryCallback:this.retryCallback,retryAttempts:this.retryAttempts,request:this.request.clone(),parseUrl:!1,credits:x(this.credits)?this.credits.slice():void 0})},ee.prototype.getBaseUri=function(i){return YP(this.getUrlComponent(i),i)},ee.prototype.appendForwardSlash=function(){this._url=XP(this._url)},ee.prototype.fetchArrayBuffer=function(){return this.fetch({responseType:"arraybuffer"})},ee.fetchArrayBuffer=function(i){return new ee(i).fetchArrayBuffer()},ee.prototype.fetchBlob=function(){return this.fetch({responseType:"blob"})},ee.fetchBlob=function(i){return new ee(i).fetchBlob()},ee.prototype.fetchImage=function(i){i=i??Ei.EMPTY_OBJECT;const e=i.preferImageBitmap??!1,t=i.preferBlob??!1,n=i.flipY??!1,s=i.skipColorSpaceConversion??!1;if(If(this.request),!m_||this.isDataUri||this.isBlobUri||!this.hasHeaders&&!t)return this._fetchImage({resource:this,flipY:n,skipColorSpaceConversion:s,preferImageBitmap:e});const o=this.fetchBlob();if(!x(o))return;let r,a,l,c;return ee.supportsImageBitmapOptions().then(function(h){return r=h,a=r&&e,o}).then(function(h){if(!x(h))return;if(c=h,a)return ee.createImageBitmapFromBlob(h,{flipY:n,premultiplyAlpha:!1,skipColorSpaceConversion:s});const u=globalThis.URL.createObjectURL(h);return l=new ee({url:u}),l._fetchImage({flipY:n,skipColorSpaceConversion:s,preferImageBitmap:!1})}).then(function(h){if(x(h))return h.blob=c,a||globalThis.URL.revokeObjectURL(l.url),h}).catch(function(h){return x(l)&&globalThis.URL.revokeObjectURL(l.url),h.blob=c,Promise.reject(h)})},ee.prototype._fetchImage=function(i){const e=this,t=i.flipY,n=i.skipColorSpaceConversion,s=i.preferImageBitmap,o=e.request;o.url=e.url,o.requestFunction=function(){let a=!1;!e.isDataUri&&!e.isBlobUri&&(a=e.isCrossOriginUrl);const l=Va();return ee._Implementations.createImage(o,a,l,t,n,s),l.promise};const r=Ke.request(o);if(x(r))return r.catch(function(a){return o.state!==mt.FAILED?Promise.reject(a):e.retryOnError(a).then(function(l){return l?(o.state=mt.UNISSUED,o.deferred=void 0,e._fetchImage({flipY:t,skipColorSpaceConversion:n,preferImageBitmap:s})):Promise.reject(a)})})},ee.fetchImage=function(i){return new ee(i).fetchImage({flipY:i.flipY,skipColorSpaceConversion:i.skipColorSpaceConversion,preferBlob:i.preferBlob,preferImageBitmap:i.preferImageBitmap})},ee.prototype.fetchText=function(){return this.fetch({responseType:"text"})},ee.fetchText=function(i){return new ee(i).fetchText()},ee.prototype.fetchJson=function(){const i=this.fetch({responseType:"text",headers:{Accept:"application/json,*/*;q=0.01"}});if(x(i))return i.then(function(e){if(x(e))return JSON.parse(e)})},ee.fetchJson=function(i){return new ee(i).fetchJson()},ee.prototype.fetchXML=function(){return this.fetch({responseType:"document",overrideMimeType:"text/xml"})},ee.fetchXML=function(i){return new ee(i).fetchXML()},ee.prototype.fetchJsonp=function(i){i=i??"callback",If(this.request);let e;do e=`loadJsonp${F.nextRandomNumber().toString().substring(2,8)}`;while(x(globalThis[e]));return y_(this,i,e)};function y_(i,e,t){const n={};n[e]=t,i.setQueryParameters(n);const s=i.request,o=i.url;s.url=o,s.requestFunction=function(){const a=Va();return globalThis[t]=function(l){a.resolve(l);try{delete globalThis[t]}catch{globalThis[t]=void 0}},ee._Implementations.loadAndExecuteScript(o,t,a),a.promise};const r=Ke.request(s);if(x(r))return r.catch(function(a){return s.state!==mt.FAILED?Promise.reject(a):i.retryOnError(a).then(function(l){return l?(s.state=mt.UNISSUED,s.deferred=void 0,y_(i,e,t)):Promise.reject(a)})})}ee.fetchJsonp=function(i){return new ee(i).fetchJsonp(i.callbackParameterName)},ee.prototype._makeRequest=function(i){const e=this;If(e.request);const t=e.request,n=e.url;t.url=n,t.requestFunction=function(){const o=i.responseType,r=zs(i.headers,e.headers),a=i.overrideMimeType,l=i.method,c=i.data,h=Va(),u=ee._Implementations.loadWithXhr(n,o,l,c,r,h,a);return x(u)&&x(u.abort)&&(t.cancelFunction=function(){u.abort()}),h.promise};const s=Ke.request(t);if(x(s))return s.then(function(o){return t.cancelFunction=void 0,o}).catch(function(o){return t.cancelFunction=void 0,t.state!==mt.FAILED?Promise.reject(o):e.retryOnError(o).then(function(r){return r?(t.state=mt.UNISSUED,t.deferred=void 0,e.fetch(i)):Promise.reject(o)})})};function If(i){if(i.state===mt.ISSUED||i.state===mt.ACTIVE)throw new En("The Resource is already being fetched.");i.state=mt.UNISSUED,i.deferred=void 0}const dS=/^data:(.*?)(;base64)?,(.*)$/;function fh(i,e){const t=decodeURIComponent(e);return i?atob(t):t}function __(i,e){const t=fh(i,e),n=new ArrayBuffer(t.length),s=new Uint8Array(n);for(let o=0;o<t.length;o++)s[o]=t.charCodeAt(o);return n}function fS(i,e){e=e??"";const t=i[1],n=!!i[2],s=i[3];let o,r;switch(e){case"":case"text":return fh(n,s);case"arraybuffer":return __(n,s);case"blob":return o=__(n,s),new Blob([o],{type:t});case"document":return r=new DOMParser,r.parseFromString(fh(n,s),t);case"json":return JSON.parse(fh(n,s));default:throw new $(`Unhandled responseType: ${e}`)}}ee.prototype.fetch=function(i){return i=Pi(i,{}),i.method="GET",this._makeRequest(i)},ee.fetch=function(i){return new ee(i).fetch({responseType:i.responseType,overrideMimeType:i.overrideMimeType})},ee.prototype.delete=function(i){return i=Pi(i,{}),i.method="DELETE",this._makeRequest(i)},ee.delete=function(i){return new ee(i).delete({responseType:i.responseType,overrideMimeType:i.overrideMimeType,data:i.data})},ee.prototype.head=function(i){return i=Pi(i,{}),i.method="HEAD",this._makeRequest(i)},ee.head=function(i){return new ee(i).head({responseType:i.responseType,overrideMimeType:i.overrideMimeType})},ee.prototype.options=function(i){return i=Pi(i,{}),i.method="OPTIONS",this._makeRequest(i)},ee.options=function(i){return new ee(i).options({responseType:i.responseType,overrideMimeType:i.overrideMimeType})},ee.prototype.post=function(i,e){return y.defined("data",i),e=Pi(e,{}),e.method="POST",e.data=i,this._makeRequest(e)},ee.post=function(i){return new ee(i).post(i.data,{responseType:i.responseType,overrideMimeType:i.overrideMimeType})},ee.prototype.put=function(i,e){return y.defined("data",i),e=Pi(e,{}),e.method="PUT",e.data=i,this._makeRequest(e)},ee.put=function(i){return new ee(i).put(i.data,{responseType:i.responseType,overrideMimeType:i.overrideMimeType})},ee.prototype.patch=function(i,e){return y.defined("data",i),e=Pi(e,{}),e.method="PATCH",e.data=i,this._makeRequest(e)},ee.patch=function(i){return new ee(i).patch(i.data,{responseType:i.responseType,overrideMimeType:i.overrideMimeType})},ee._Implementations={},ee._Implementations.loadImageElement=function(i,e,t){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),t.resolve(n)},n.onerror=function(s){t.reject(s)},e&&(wr.contains(i)?n.crossOrigin="use-credentials":n.crossOrigin=""),n.src=i},ee._Implementations.createImage=function(i,e,t,n,s,o,r){const a=i.url;ee.supportsImageBitmapOptions().then(function(l){if(!(l&&o)){ee._Implementations.loadImageElement(a,e,t);return}const c="blob",h="GET",u=Va(),d=ee._Implementations.loadWithXhr(a,c,h,void 0,r,u,void 0,void 0,void 0);return x(d)&&x(d.abort)&&(i.cancelFunction=function(){d.abort()}),u.promise.then(function(f){if(!x(f)){t.reject(new En(`Successfully retrieved ${a} but it contained no content.`));return}return ee.createImageBitmapFromBlob(f,{flipY:n,premultiplyAlpha:!1,skipColorSpaceConversion:s})}).then(function(f){t.resolve(f)})}).catch(function(l){t.reject(l)})},ee.createImageBitmapFromBlob=function(i,e){return y.defined("options",e),y.typeOf.bool("options.flipY",e.flipY),y.typeOf.bool("options.premultiplyAlpha",e.premultiplyAlpha),y.typeOf.bool("options.skipColorSpaceConversion",e.skipColorSpaceConversion),createImageBitmap(i,{imageOrientation:e.flipY?"flipY":"none",premultiplyAlpha:e.premultiplyAlpha?"premultiply":"none",colorSpaceConversion:e.skipColorSpaceConversion?"none":"default"})};function pS(i,e,t,n,s,o,r){fetch(i,{method:t,headers:s}).then(async a=>{if(!a.ok){const l={};a.headers.forEach((c,h)=>{l[h]=c}),o.reject(new Ba(a.status,a,l));return}switch(e){case"text":o.resolve(a.text());break;case"json":o.resolve(a.json());break;default:o.resolve(new Uint8Array(await a.arrayBuffer()).buffer);break}}).catch(()=>{o.reject(new Ba)})}const gS=typeof XMLHttpRequest>"u";ee._Implementations.loadWithXhr=function(i,e,t,n,s,o,r){const a=dS.exec(i);if(a!==null){o.resolve(fS(a,e));return}if(gS){pS(i,e,t,n,s,o);return}const l=new XMLHttpRequest;if(wr.contains(i)&&(l.withCredentials=!0),l.open(t,i,!0),x(r)&&x(l.overrideMimeType)&&l.overrideMimeType(r),x(s))for(const h in s)s.hasOwnProperty(h)&&l.setRequestHeader(h,s[h]);x(e)&&(l.responseType=e);let c=!1;return typeof i=="string"&&(c=i.indexOf("file://")===0||typeof globalThis<"u"&&globalThis.location.origin==="file://"),l.onload=function(){if((l.status<200||l.status>=300)&&!(c&&l.status===0)){o.reject(new Ba(l.status,l.response,l.getAllResponseHeaders()));return}const h=l.response,u=l.responseType;if(t==="HEAD"||t==="OPTIONS"){const f=l.getAllResponseHeaders().trim().split(/[\r\n]+/),g={};f.forEach(function(_){const v=_.split(": "),E=v.shift();g[E]=v.join(": ")}),o.resolve(g);return}if(l.status===204)o.resolve(void 0);else if(x(h)&&(!x(e)||u===e))o.resolve(h);else if(e==="json"&&typeof h=="string")try{o.resolve(JSON.parse(h))}catch(d){o.reject(d)}else(u===""||u==="document")&&x(l.responseXML)&&l.responseXML.hasChildNodes()?o.resolve(l.responseXML):(u===""||u==="text")&&x(l.responseText)?o.resolve(l.responseText):o.reject(new En("Invalid XMLHttpRequest response type."))},l.onerror=function(h){o.reject(new Ba)},l.send(n),l},ee._Implementations.loadAndExecuteScript=function(i,e,t){return eS(i).catch(function(n){t.reject(n)})},ee._DefaultImplementations={},ee._DefaultImplementations.createImage=ee._Implementations.createImage,ee._DefaultImplementations.loadWithXhr=ee._Implementations.loadWithXhr,ee._DefaultImplementations.loadAndExecuteScript=ee._Implementations.loadAndExecuteScript,ee.DEFAULT=Object.freeze(new ee({url:typeof document>"u"?"":document.location.href.split("?")[0]}));function Ha(i){i=i??Ei.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,x(i.data)?w_(this,i.data):w_(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})}Ha.fromUrl=async function(i,e){y.defined("url",i),e=e??Ei.EMPTY_OBJECT;const t=ee.createIfNeeded(i);let n;try{n=await t.fetchJson()}catch{throw new En(`An error occurred while retrieving the EOP data from the URL ${t.url}.`)}return new Ha({addNewLeapSeconds:e.addNewLeapSeconds,data:n})},Ha.NONE=Object.freeze({compute:function(i,e){return x(e)?(e.xPoleWander=0,e.yPoleWander=0,e.xPoleOffset=0,e.yPoleOffset=0,e.ut1MinusUtc=0):e=new vf(0,0,0,0,0),e}}),Ha.prototype.compute=function(i,e){if(!x(this._samples))return;if(x(e)||(e=new vf(0,0,0,0,0)),this._samples.length===0)return e.xPoleWander=0,e.yPoleWander=0,e.xPoleOffset=0,e.yPoleOffset=0,e.ut1MinusUtc=0,e;const t=this._dates,n=this._lastIndex;let s,o;if(x(n)){const a=t[n],l=t[n+1],c=oe.lessThanOrEquals(a,i),h=!x(l),u=h||oe.greaterThanOrEquals(l,i);if(c&&u)return s=n,!h&&l.equals(i)&&++s,o=s+1,b_(this,t,this._samples,i,s,o,e),e}let r=Ga(t,i,oe.compare,this._dateColumn);return r>=0?(r<t.length-1&&t[r+1].equals(i)&&++r,s=r,o=r):(o=~r,s=o-1,s<0&&(s=0)),this._lastIndex=s,b_(this,t,this._samples,i,s,o,e),e};function mS(i,e){return oe.compare(i.julianDate,e)}function w_(i,e){if(!x(e.columnNames))throw new En("Error in loaded EOP data: The columnNames property is required.");if(!x(e.samples))throw new En("Error in loaded EOP data: The samples property is required.");const t=e.columnNames.indexOf("modifiedJulianDateUtc"),n=e.columnNames.indexOf("xPoleWanderRadians"),s=e.columnNames.indexOf("yPoleWanderRadians"),o=e.columnNames.indexOf("ut1MinusUtcSeconds"),r=e.columnNames.indexOf("xCelestialPoleOffsetRadians"),a=e.columnNames.indexOf("yCelestialPoleOffsetRadians"),l=e.columnNames.indexOf("taiMinusUtcSeconds");if(t<0||n<0||s<0||o<0||r<0||a<0||l<0)throw new En("Error in loaded EOP data: The columnNames property must include modifiedJulianDateUtc, xPoleWanderRadians, yPoleWanderRadians, ut1MinusUtcSeconds, xCelestialPoleOffsetRadians, yCelestialPoleOffsetRadians, and taiMinusUtcSeconds columns");const c=i._samples=e.samples,h=i._dates=[];i._dateColumn=t,i._xPoleWanderRadiansColumn=n,i._yPoleWanderRadiansColumn=s,i._ut1MinusUtcSecondsColumn=o,i._xCelestialPoleOffsetRadiansColumn=r,i._yCelestialPoleOffsetRadiansColumn=a,i._taiMinusUtcSecondsColumn=l,i._columnCount=e.columnNames.length,i._lastIndex=void 0;let u;const d=i._addNewLeapSeconds;for(let f=0,g=c.length;f<g;f+=i._columnCount){const _=c[f+t],v=c[f+l],E=_+at.MODIFIED_JULIAN_DATE_DIFFERENCE,w=new oe(E,v,Ae.TAI);if(h.push(w),d){if(v!==u&&x(u)){const C=oe.leapSeconds,P=Ga(C,w,mS);if(P<0){const R=new He(w,v);C.splice(~P,0,R)}}u=v}}}function v_(i,e,t,n,s){const o=t*n;s.xPoleWander=e[o+i._xPoleWanderRadiansColumn],s.yPoleWander=e[o+i._yPoleWanderRadiansColumn],s.xPoleOffset=e[o+i._xCelestialPoleOffsetRadiansColumn],s.yPoleOffset=e[o+i._yCelestialPoleOffsetRadiansColumn],s.ut1MinusUtc=e[o+i._ut1MinusUtcSecondsColumn]}function Xa(i,e,t){return e+i*(t-e)}function b_(i,e,t,n,s,o,r){const a=i._columnCount;if(o>e.length-1)return r.xPoleWander=0,r.yPoleWander=0,r.xPoleOffset=0,r.yPoleOffset=0,r.ut1MinusUtc=0,r;const l=e[s],c=e[o];if(l.equals(c)||n.equals(l))return v_(i,t,s,a,r),r;if(n.equals(c))return v_(i,t,o,a,r),r;const h=oe.secondsDifference(n,l)/oe.secondsDifference(c,l),u=s*a,d=o*a;let f=t[u+i._ut1MinusUtcSecondsColumn],g=t[d+i._ut1MinusUtcSecondsColumn];const _=g-f;if(_>.5||_<-.5){const v=t[u+i._taiMinusUtcSecondsColumn],E=t[d+i._taiMinusUtcSecondsColumn];v!==E&&(c.equals(n)?f=g:g-=E-v)}return r.xPoleWander=Xa(h,t[u+i._xPoleWanderRadiansColumn],t[d+i._xPoleWanderRadiansColumn]),r.yPoleWander=Xa(h,t[u+i._yPoleWanderRadiansColumn],t[d+i._yPoleWanderRadiansColumn]),r.xPoleOffset=Xa(h,t[u+i._xCelestialPoleOffsetRadiansColumn],t[d+i._xCelestialPoleOffsetRadiansColumn]),r.yPoleOffset=Xa(h,t[u+i._yCelestialPoleOffsetRadiansColumn],t[d+i._yCelestialPoleOffsetRadiansColumn]),r.ut1MinusUtc=Xa(h,f,g),r}function Tt(i,e,t){this.heading=i??0,this.pitch=e??0,this.roll=t??0}Tt.fromQuaternion=function(i,e){if(!x(i))throw new $("quaternion is required");x(e)||(e=new Tt);const t=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 e.heading=-Math.atan2(r,o),e.roll=Math.atan2(s,n),e.pitch=-F.asinClamped(t),e},Tt.fromDegrees=function(i,e,t,n){if(!x(i))throw new $("heading is required");if(!x(e))throw new $("pitch is required");if(!x(t))throw new $("roll is required");return x(n)||(n=new Tt),n.heading=i*F.RADIANS_PER_DEGREE,n.pitch=e*F.RADIANS_PER_DEGREE,n.roll=t*F.RADIANS_PER_DEGREE,n},Tt.clone=function(i,e){if(x(i))return x(e)?(e.heading=i.heading,e.pitch=i.pitch,e.roll=i.roll,e):new Tt(i.heading,i.pitch,i.roll)},Tt.equals=function(i,e){return i===e||x(i)&&x(e)&&i.heading===e.heading&&i.pitch===e.pitch&&i.roll===e.roll},Tt.equalsEpsilon=function(i,e,t,n){return i===e||x(i)&&x(e)&&F.equalsEpsilon(i.heading,e.heading,t,n)&&F.equalsEpsilon(i.pitch,e.pitch,t,n)&&F.equalsEpsilon(i.roll,e.roll,t,n)},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,e,t){return Tt.equalsEpsilon(this,i,e,t)},Tt.prototype.toString=function(){return`(${this.heading}, ${this.pitch}, ${this.roll})`};const E_=/((?:.*\/)|^)Cesium\.js(?:\?|\#|$)/;function yS(){const i=document.getElementsByTagName("script");for(let e=0,t=i.length;e<t;++e){const n=i[e].getAttribute("src"),s=E_.exec(n);if(s!==null)return s[1]}}let ph;function C_(i){return typeof document>"u"?i:(x(ph)||(ph=document.createElement("a")),ph.href=i,ph.href)}let Eo;function x_(){if(x(Eo))return Eo;let i;if(typeof CESIUM_BASE_URL<"u"?i=CESIUM_BASE_URL:x(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Vo&&Vo.tagName.toUpperCase()==="SCRIPT"&&Vo.src||new URL("earthsdk3-ol.umd.cjs",document.baseURI).href)?i=Wa(".",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Vo&&Vo.tagName.toUpperCase()==="SCRIPT"&&Vo.src||new URL("earthsdk3-ol.umd.cjs",document.baseURI).href):typeof define=="object"&&x(define.amd)&&!define.amd.toUrlUndefined&&x(require.toUrl)?i=Wa("..",Co("Core/buildModuleUrl.js")):i=yS(),!x(i))throw new $("Unable to determine Cesium base URL automatically, try defining a global variable called CESIUM_BASE_URL.");return Eo=new ee({url:C_(i)}),Eo.appendForwardSlash(),Eo}function _S(i){return C_(require.toUrl(`../${i}`))}function P_(i){return x_().getDerivedResource({url:i}).url}let gh;function Co(i){return x(gh)||(typeof define=="object"&&x(define.amd)&&!define.amd.toUrlUndefined&&x(require.toUrl)?gh=_S:gh=P_),gh(i)}Co._cesiumScriptRegex=E_,Co._buildModuleUrlFromBaseUrl=P_,Co._clearBaseResource=function(){Eo=void 0},Co.setBaseUrl=function(i){Eo=ee.DEFAULT.getDerivedResource({url:i})},Co.getCesiumBaseUrl=x_;function S_(i,e,t){this.x=i,this.y=e,this.s=t}function mh(i){i=i??Ei.EMPTY_OBJECT,this._xysFileUrlTemplate=ee.createIfNeeded(i.xysFileUrlTemplate),this._interpolationOrder=i.interpolationOrder??9,this._sampleZeroJulianEphemerisDate=i.sampleZeroJulianEphemerisDate??24423965e-1,this._sampleZeroDateTT=new oe(this._sampleZeroJulianEphemerisDate,0,Ae.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 e=this._interpolationOrder,t=this._denominators=new Array(e+1),n=this._xTable=new Array(e+1),s=Math.pow(this._stepSizeDays,e);for(let o=0;o<=e;++o){t[o]=s,n[o]=o*this._stepSizeDays;for(let r=0;r<=e;++r)r!==o&&(t[o]*=o-r);t[o]=1/t[o]}this._work=new Array(e+1),this._coef=new Array(e+1)}const wS=new oe(0,0,Ae.TAI);function Of(i,e,t){const n=wS;return n.dayNumber=e,n.secondsOfDay=t,oe.daysDifference(n,i._sampleZeroDateTT)}mh.prototype.preload=function(i,e,t,n){const s=Of(this,i,e),o=Of(this,t,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 l=r/this._samplesPerXysFile|0,c=a/this._samplesPerXysFile|0,h=[];for(let u=l;u<=c;++u)h.push(Af(this,u));return Promise.all(h)},mh.prototype.computeXysRadians=function(i,e,t){const n=Of(this,i,e);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 l=!1;const c=this._samples;if(x(c[r*3])||(Af(this,r/this._samplesPerXysFile|0),l=!0),x(c[a*3])||(Af(this,a/this._samplesPerXysFile|0),l=!0),l)return;x(t)?(t.x=0,t.y=0,t.s=0):t=new S_(0,0,0);const h=n-r*this._stepSizeDays,u=this._work,d=this._denominators,f=this._coef,g=this._xTable;let _,v;for(_=0;_<=o;++_)u[_]=h-g[_];for(_=0;_<=o;++_){for(f[_]=1,v=0;v<=o;++v)v!==_&&(f[_]*=u[v]);f[_]*=d[_];let E=(r+_)*3;t.x+=f[_]*c[E++],t.y+=f[_]*c[E++],t.s+=f[_]*c[E]}return t},mh.prototype._updateChunkData=function(i,{samples:e}){this._chunkDownloadsInProgress[i]=void 0;const t=this._samplesPerXysFile,n=i*t*3;for(let s=0;s<e.length;++s)this._samples[n+s]=e[s]};async function vS(i,e,t){try{const n=await i.fetchJson();t._updateChunkData(e,n)}catch{}}function Af(i,e){if(x(i._chunkDownloadsInProgress[e]))return i._chunkDownloadsInProgress[e];let t;const n=i._xysFileUrlTemplate;x(n)?t=n.getDerivedResource({templateValues:{0:e}}):t=new ee({url:Co(`Assets/IAU2006_XYS/IAU2006_XYS_${e}.json`)});const s=vS(t,e,i);return i._chunkDownloadsInProgress[e]=s,s}function Y(i,e,t,n){this.x=i??0,this.y=e??0,this.z=t??0,this.w=n??0}let Ya=new D;Y.fromAxisAngle=function(i,e,t){y.typeOf.object("axis",i),y.typeOf.number("angle",e);const n=e/2,s=Math.sin(n);Ya=D.normalize(i,Ya);const o=Ya.x*s,r=Ya.y*s,a=Ya.z*s,l=Math.cos(n);return x(t)?(t.x=o,t.y=r,t.z=a,t.w=l,t):new Y(o,r,a,l)};const bS=[1,2,0],ES=new Array(3);Y.fromRotationMatrix=function(i,e){y.typeOf.object("matrix",i);let t,n,s,o,r;const a=i[K.COLUMN0ROW0],l=i[K.COLUMN1ROW1],c=i[K.COLUMN2ROW2],h=a+l+c;if(h>0)t=Math.sqrt(h+1),r=.5*t,t=.5/t,n=(i[K.COLUMN1ROW2]-i[K.COLUMN2ROW1])*t,s=(i[K.COLUMN2ROW0]-i[K.COLUMN0ROW2])*t,o=(i[K.COLUMN0ROW1]-i[K.COLUMN1ROW0])*t;else{const u=bS;let d=0;l>a&&(d=1),c>a&&c>l&&(d=2);const f=u[d],g=u[f];t=Math.sqrt(i[K.getElementIndex(d,d)]-i[K.getElementIndex(f,f)]-i[K.getElementIndex(g,g)]+1);const _=ES;_[d]=.5*t,t=.5/t,r=(i[K.getElementIndex(g,f)]-i[K.getElementIndex(f,g)])*t,_[f]=(i[K.getElementIndex(f,d)]+i[K.getElementIndex(d,f)])*t,_[g]=(i[K.getElementIndex(g,d)]+i[K.getElementIndex(d,g)])*t,n=-_[0],s=-_[1],o=-_[2]}return x(e)?(e.x=n,e.y=s,e.z=o,e.w=r,e):new Y(n,s,o,r)};const R_=new Y;let T_=new Y,Mf=new Y,I_=new Y;Y.fromHeadingPitchRoll=function(i,e){return y.typeOf.object("headingPitchRoll",i),I_=Y.fromAxisAngle(D.UNIT_X,i.roll,R_),Mf=Y.fromAxisAngle(D.UNIT_Y,-i.pitch,e),e=Y.multiply(Mf,I_,Mf),T_=Y.fromAxisAngle(D.UNIT_Z,-i.heading,R_),Y.multiply(T_,e,e)};const yh=new D,Df=new D,ii=new Y,O_=new Y,_h=new Y;Y.packedLength=4,Y.pack=function(i,e,t){return y.typeOf.object("value",i),y.defined("array",e),t=t??0,e[t++]=i.x,e[t++]=i.y,e[t++]=i.z,e[t]=i.w,e},Y.unpack=function(i,e,t){return y.defined("array",i),e=e??0,x(t)||(t=new Y),t.x=i[e],t.y=i[e+1],t.z=i[e+2],t.w=i[e+3],t},Y.packedInterpolationLength=3,Y.convertPackedArrayForInterpolation=function(i,e,t,n){Y.unpack(i,t*4,_h),Y.conjugate(_h,_h);for(let s=0,o=t-e+1;s<o;s++){const r=s*3;Y.unpack(i,(e+s)*4,ii),Y.multiply(ii,_h,ii),ii.w<0&&Y.negate(ii,ii),Y.computeAxis(ii,yh);const a=Y.computeAngle(ii);x(n)||(n=[]),n[r]=yh.x*a,n[r+1]=yh.y*a,n[r+2]=yh.z*a}},Y.unpackInterpolationResult=function(i,e,t,n,s){x(s)||(s=new Y),D.fromArray(i,0,Df);const o=D.magnitude(Df);return Y.unpack(e,n*4,O_),o===0?Y.clone(Y.IDENTITY,ii):Y.fromAxisAngle(Df,o,ii),Y.multiply(ii,O_,s)},Y.clone=function(i,e){if(x(i))return x(e)?(e.x=i.x,e.y=i.y,e.z=i.z,e.w=i.w,e):new Y(i.x,i.y,i.z,i.w)},Y.conjugate=function(i,e){return y.typeOf.object("quaternion",i),y.typeOf.object("result",e),e.x=-i.x,e.y=-i.y,e.z=-i.z,e.w=i.w,e},Y.magnitudeSquared=function(i){return y.typeOf.object("quaternion",i),i.x*i.x+i.y*i.y+i.z*i.z+i.w*i.w},Y.magnitude=function(i){return Math.sqrt(Y.magnitudeSquared(i))},Y.normalize=function(i,e){y.typeOf.object("result",e);const t=1/Y.magnitude(i),n=i.x*t,s=i.y*t,o=i.z*t,r=i.w*t;return e.x=n,e.y=s,e.z=o,e.w=r,e},Y.inverse=function(i,e){y.typeOf.object("result",e);const t=Y.magnitudeSquared(i);return e=Y.conjugate(i,e),Y.multiplyByScalar(e,1/t,e)},Y.add=function(i,e,t){return y.typeOf.object("left",i),y.typeOf.object("right",e),y.typeOf.object("result",t),t.x=i.x+e.x,t.y=i.y+e.y,t.z=i.z+e.z,t.w=i.w+e.w,t},Y.subtract=function(i,e,t){return y.typeOf.object("left",i),y.typeOf.object("right",e),y.typeOf.object("result",t),t.x=i.x-e.x,t.y=i.y-e.y,t.z=i.z-e.z,t.w=i.w-e.w,t},Y.negate=function(i,e){return y.typeOf.object("quaternion",i),y.typeOf.object("result",e),e.x=-i.x,e.y=-i.y,e.z=-i.z,e.w=-i.w,e},Y.dot=function(i,e){return y.typeOf.object("left",i),y.typeOf.object("right",e),i.x*e.x+i.y*e.y+i.z*e.z+i.w*e.w},Y.multiply=function(i,e,t){y.typeOf.object("left",i),y.typeOf.object("right",e),y.typeOf.object("result",t);const n=i.x,s=i.y,o=i.z,r=i.w,a=e.x,l=e.y,c=e.z,h=e.w,u=r*a+n*h+s*c-o*l,d=r*l-n*c+s*h+o*a,f=r*c+n*l-s*a+o*h,g=r*h-n*a-s*l-o*c;return t.x=u,t.y=d,t.z=f,t.w=g,t},Y.multiplyByScalar=function(i,e,t){return y.typeOf.object("quaternion",i),y.typeOf.number("scalar",e),y.typeOf.object("result",t),t.x=i.x*e,t.y=i.y*e,t.z=i.z*e,t.w=i.w*e,t},Y.divideByScalar=function(i,e,t){return y.typeOf.object("quaternion",i),y.typeOf.number("scalar",e),y.typeOf.object("result",t),t.x=i.x/e,t.y=i.y/e,t.z=i.z/e,t.w=i.w/e,t},Y.computeAxis=function(i,e){y.typeOf.object("quaternion",i),y.typeOf.object("result",e);const t=i.w;if(Math.abs(t-1)<F.EPSILON6||Math.abs(t+1)<F.EPSILON6)return e.x=1,e.y=e.z=0,e;const n=1/Math.sqrt(1-t*t);return e.x=i.x*n,e.y=i.y*n,e.z=i.z*n,e},Y.computeAngle=function(i){return y.typeOf.object("quaternion",i),Math.abs(i.w-1)<F.EPSILON6?0:2*Math.acos(i.w)};let Ff=new Y;Y.lerp=function(i,e,t,n){return y.typeOf.object("start",i),y.typeOf.object("end",e),y.typeOf.number("t",t),y.typeOf.object("result",n),Ff=Y.multiplyByScalar(e,t,Ff),n=Y.multiplyByScalar(i,1-t,n),Y.add(Ff,n,n)};let A_=new Y,Lf=new Y,zf=new Y;Y.slerp=function(i,e,t,n){y.typeOf.object("start",i),y.typeOf.object("end",e),y.typeOf.number("t",t),y.typeOf.object("result",n);let s=Y.dot(i,e),o=e;if(s<0&&(s=-s,o=A_=Y.negate(e,A_)),1-s<F.EPSILON6)return Y.lerp(i,o,t,n);const r=Math.acos(s);return Lf=Y.multiplyByScalar(i,Math.sin((1-t)*r),Lf),zf=Y.multiplyByScalar(o,Math.sin(t*r),zf),n=Y.add(Lf,zf,n),Y.multiplyByScalar(n,1/Math.sin(r),n)},Y.log=function(i,e){y.typeOf.object("quaternion",i),y.typeOf.object("result",e);const t=F.acosClamped(i.w);let n=0;return t!==0&&(n=t/Math.sin(t)),D.multiplyByScalar(i,n,e)},Y.exp=function(i,e){y.typeOf.object("cartesian",i),y.typeOf.object("result",e);const t=D.magnitude(i);let n=0;return t!==0&&(n=Math.sin(t)/t),e.x=i.x*n,e.y=i.y*n,e.z=i.z*n,e.w=Math.cos(t),e};const CS=new D,xS=new D,Za=new Y,Er=new Y;Y.computeInnerQuadrangle=function(i,e,t,n){y.typeOf.object("q0",i),y.typeOf.object("q1",e),y.typeOf.object("q2",t),y.typeOf.object("result",n);const s=Y.conjugate(e,Za);Y.multiply(s,t,Er);const o=Y.log(Er,CS);Y.multiply(s,i,Er);const r=Y.log(Er,xS);return D.add(o,r,o),D.multiplyByScalar(o,.25,o),D.negate(o,o),Y.exp(o,Za),Y.multiply(e,Za,n)},Y.squad=function(i,e,t,n,s,o){y.typeOf.object("q0",i),y.typeOf.object("q1",e),y.typeOf.object("s0",t),y.typeOf.object("s1",n),y.typeOf.number("t",s),y.typeOf.object("result",o);const r=Y.slerp(i,e,s,Za),a=Y.slerp(t,n,s,Er);return Y.slerp(r,a,2*s*(1-s),o)};const PS=new Y,M_=1.9011074535173003,wh=Zt.supportsTypedArrays()?new Float32Array(8):[],vh=Zt.supportsTypedArrays()?new Float32Array(8):[],Qi=Zt.supportsTypedArrays()?new Float32Array(8):[],Ji=Zt.supportsTypedArrays()?new Float32Array(8):[];for(let i=0;i<7;++i){const e=i+1,t=2*e+1;wh[i]=1/(e*t),vh[i]=e/t}wh[7]=M_/136,vh[7]=M_*8/17,Y.fastSlerp=function(i,e,t,n){y.typeOf.object("start",i),y.typeOf.object("end",e),y.typeOf.number("t",t),y.typeOf.object("result",n);let s=Y.dot(i,e),o;s>=0?o=1:(o=-1,s=-s);const r=s-1,a=1-t,l=t*t,c=a*a;for(let f=7;f>=0;--f)Qi[f]=(wh[f]*l-vh[f])*r,Ji[f]=(wh[f]*c-vh[f])*r;const h=o*t*(1+Qi[0]*(1+Qi[1]*(1+Qi[2]*(1+Qi[3]*(1+Qi[4]*(1+Qi[5]*(1+Qi[6]*(1+Qi[7])))))))),u=a*(1+Ji[0]*(1+Ji[1]*(1+Ji[2]*(1+Ji[3]*(1+Ji[4]*(1+Ji[5]*(1+Ji[6]*(1+Ji[7])))))))),d=Y.multiplyByScalar(i,u,PS);return Y.multiplyByScalar(e,h,n),Y.add(d,n,n)},Y.fastSquad=function(i,e,t,n,s,o){y.typeOf.object("q0",i),y.typeOf.object("q1",e),y.typeOf.object("s0",t),y.typeOf.object("s1",n),y.typeOf.number("t",s),y.typeOf.object("result",o);const r=Y.fastSlerp(i,e,s,Za),a=Y.fastSlerp(t,n,s,Er);return Y.fastSlerp(r,a,2*s*(1-s),o)},Y.equals=function(i,e){return i===e||x(i)&&x(e)&&i.x===e.x&&i.y===e.y&&i.z===e.z&&i.w===e.w},Y.equalsEpsilon=function(i,e,t){return t=t??0,i===e||x(i)&&x(e)&&Math.abs(i.x-e.x)<=t&&Math.abs(i.y-e.y)<=t&&Math.abs(i.z-e.z)<=t&&Math.abs(i.w-e.w)<=t},Y.ZERO=Object.freeze(new Y(0,0,0,0)),Y.IDENTITY=Object.freeze(new Y(0,0,0,1)),Y.prototype.clone=function(i){return Y.clone(this,i)},Y.prototype.equals=function(i){return Y.equals(this,i)},Y.prototype.equalsEpsilon=function(i,e){return Y.equalsEpsilon(this,i,e)},Y.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z}, ${this.w})`};const Ee={},Nf={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"}},Cr={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},kf={},pn={east:new D,north:new D,up:new D,west:new D,south:new D,down:new D};let Ns=new D,ks=new D,js=new D;Ee.localFrameToFixedFrameGenerator=function(i,e){if(!Nf.hasOwnProperty(i)||!Nf[i].hasOwnProperty(e))throw new $("firstAxis and secondAxis must be east, north, up, west, south or down.");const t=Nf[i][e];let n;const s=i+e;return x(kf[s])?n=kf[s]:(n=function(o,r,a){if(!x(o))throw new $("origin is required.");if(isNaN(o.x)||isNaN(o.y)||isNaN(o.z))throw new $("origin has a NaN component");if(x(a)||(a=new Q),D.equalsEpsilon(o,D.ZERO,F.EPSILON14))D.unpack(Cr[i],0,Ns),D.unpack(Cr[e],0,ks),D.unpack(Cr[t],0,js);else if(F.equalsEpsilon(o.x,0,F.EPSILON14)&&F.equalsEpsilon(o.y,0,F.EPSILON14)){const l=F.sign(o.z);D.unpack(Cr[i],0,Ns),i!=="east"&&i!=="west"&&D.multiplyByScalar(Ns,l,Ns),D.unpack(Cr[e],0,ks),e!=="east"&&e!=="west"&&D.multiplyByScalar(ks,l,ks),D.unpack(Cr[t],0,js),t!=="east"&&t!=="west"&&D.multiplyByScalar(js,l,js)}else{r=r??tt.default,r.geodeticSurfaceNormal(o,pn.up);const l=pn.up,c=pn.east;c.x=-o.y,c.y=o.x,c.z=0,D.normalize(c,pn.east),D.cross(l,c,pn.north),D.multiplyByScalar(pn.up,-1,pn.down),D.multiplyByScalar(pn.east,-1,pn.west),D.multiplyByScalar(pn.north,-1,pn.south),Ns=pn[i],ks=pn[e],js=pn[t]}return a[0]=Ns.x,a[1]=Ns.y,a[2]=Ns.z,a[3]=0,a[4]=ks.x,a[5]=ks.y,a[6]=ks.z,a[7]=0,a[8]=js.x,a[9]=js.y,a[10]=js.z,a[11]=0,a[12]=o.x,a[13]=o.y,a[14]=o.z,a[15]=1,a},kf[s]=n),n},Ee.eastNorthUpToFixedFrame=Ee.localFrameToFixedFrameGenerator("east","north"),Ee.northEastDownToFixedFrame=Ee.localFrameToFixedFrameGenerator("north","east"),Ee.northUpEastToFixedFrame=Ee.localFrameToFixedFrameGenerator("north","up"),Ee.northWestUpToFixedFrame=Ee.localFrameToFixedFrameGenerator("north","west");const SS=new Y,RS=new D(1,1,1),TS=new Q;Ee.headingPitchRollToFixedFrame=function(i,e,t,n,s){y.typeOf.object("HeadingPitchRoll",e),n=n??Ee.eastNorthUpToFixedFrame;const o=Y.fromHeadingPitchRoll(e,SS),r=Q.fromTranslationQuaternionRotationScale(D.ZERO,o,RS,TS);return s=n(i,t,s),Q.multiply(s,r,s)};const IS=new Q,OS=new K;Ee.headingPitchRollQuaternion=function(i,e,t,n,s){y.typeOf.object("HeadingPitchRoll",e);const o=Ee.headingPitchRollToFixedFrame(i,e,t,n,IS),r=Q.getMatrix3(o,OS);return Y.fromRotationMatrix(r,s)};const AS=new D(1,1,1),MS=new D,D_=new Q,DS=new Q,FS=new K,LS=new Y;Ee.fixedFrameToHeadingPitchRoll=function(i,e,t,n){y.defined("transform",i),e=e??tt.default,t=t??Ee.eastNorthUpToFixedFrame,x(n)||(n=new Tt);const s=Q.getTranslation(i,MS);if(D.equals(s,D.ZERO))return n.heading=0,n.pitch=0,n.roll=0,n;let o=Q.inverseTransformation(t(s,e,D_),D_),r=Q.setScale(i,AS,DS);r=Q.setTranslation(r,D.ZERO,r),o=Q.multiply(o,r,o);let a=Y.fromRotationMatrix(Q.getMatrix3(o,FS),LS);return a=Y.normalize(a,a),Tt.fromQuaternion(a,n)};const zS=6*3600+2460+50.54841,NS=8640184812866e-6,kS=.093104,jS=-62e-7,US=11772758384668e-32,GS=72921158553e-15,qS=F.TWO_PI/86400;let bh=new oe;Ee.computeIcrfToCentralBodyFixedMatrix=function(i,e){let t=Ee.computeIcrfToFixedMatrix(i,e);return x(t)||(t=Ee.computeTemeToPseudoFixedMatrix(i,e)),t},Ee.computeTemeToPseudoFixedMatrix=function(i,e){if(!x(i))throw new $("date is required.");bh=oe.addSeconds(i,-oe.computeTaiMinusUtc(i),bh);const t=bh.dayNumber,n=bh.secondsOfDay;let s;const o=t-2451545;n>=43200?s=(o+.5)/at.DAYS_PER_JULIAN_CENTURY:s=(o-.5)/at.DAYS_PER_JULIAN_CENTURY;const a=(zS+s*(NS+s*(kS+s*jS)))*qS%F.TWO_PI,l=GS+US*(t-24515455e-1),c=(n+at.SECONDS_PER_DAY*.5)%at.SECONDS_PER_DAY,h=a+l*c,u=Math.cos(h),d=Math.sin(h);return x(e)?(e[0]=u,e[1]=-d,e[2]=0,e[3]=d,e[4]=u,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e):new K(u,d,0,-d,u,0,0,0,1)},Ee.iau2006XysData=new mh,Ee.earthOrientationParameters=Ha.NONE;const jf=32.184,VS=2451545;Ee.preloadIcrfFixed=function(i){const e=i.start.dayNumber,t=i.start.secondsOfDay+jf,n=i.stop.dayNumber,s=i.stop.secondsOfDay+jf;return Ee.iau2006XysData.preload(e,t,n,s)},Ee.computeIcrfToFixedMatrix=function(i,e){if(!x(i))throw new $("date is required.");x(e)||(e=new K);const t=Ee.computeFixedToIcrfMatrix(i,e);if(x(t))return K.transpose(t,e)};const WS=32.184,BS=2451545,Eh=new Tt,$S=new K,HS=new oe;Ee.computeMoonFixedToIcrfMatrix=function(i,e){if(!x(i))throw new $("date is required.");x(e)||(e=new K);const t=oe.addSeconds(i,WS,HS),n=oe.totalDays(t)-BS,s=F.toRadians(12.112)-F.toRadians(.052992)*n,o=F.toRadians(24.224)-F.toRadians(.105984)*n,r=F.toRadians(227.645)+F.toRadians(13.012)*n,a=F.toRadians(261.105)+F.toRadians(13.340716)*n,l=F.toRadians(358)+F.toRadians(.9856)*n;return Eh.pitch=F.toRadians(180)-F.toRadians(3.878)*Math.sin(s)-F.toRadians(.12)*Math.sin(o)+F.toRadians(.07)*Math.sin(r)-F.toRadians(.017)*Math.sin(a),Eh.roll=F.toRadians(66.53-90)+F.toRadians(1.543)*Math.cos(s)+F.toRadians(.24)*Math.cos(o)-F.toRadians(.028)*Math.cos(r)+F.toRadians(.007)*Math.cos(a),Eh.heading=F.toRadians(244.375-90)+F.toRadians(13.17635831)*n+F.toRadians(3.558)*Math.sin(s)+F.toRadians(.121)*Math.sin(o)-F.toRadians(.064)*Math.sin(r)+F.toRadians(.016)*Math.sin(a)+F.toRadians(.025)*Math.sin(l),K.fromHeadingPitchRoll(Eh,$S,e)},Ee.computeIcrfToMoonFixedMatrix=function(i,e){if(!x(i))throw new $("date is required.");x(e)||(e=new K);const t=Ee.computeMoonFixedToIcrfMatrix(i,e);if(x(t))return K.transpose(t,e)};const XS=new S_(0,0,0),YS=new vf(0,0,0,0,0),Uf=new K,Gf=new K;Ee.computeFixedToIcrfMatrix=function(i,e){if(!x(i))throw new $("date is required.");x(e)||(e=new K);const t=Ee.earthOrientationParameters.compute(i,YS);if(!x(t))return;const n=i.dayNumber,s=i.secondsOfDay+jf,o=Ee.iau2006XysData.computeXysRadians(n,s,XS);if(!x(o))return;const r=o.x+t.xPoleOffset,a=o.y+t.yPoleOffset,l=1/(1+Math.sqrt(1-r*r-a*a)),c=Uf;c[0]=1-l*r*r,c[3]=-l*r*a,c[6]=r,c[1]=-l*r*a,c[4]=1-l*a*a,c[7]=a,c[2]=-r,c[5]=-a,c[8]=1-l*(r*r+a*a);const h=K.fromRotationZ(-o.s,Gf),u=K.multiply(c,h,Uf),d=i.dayNumber,f=i.secondsOfDay-oe.computeTaiMinusUtc(i)+t.ut1MinusUtc,g=d-2451545,_=f/at.SECONDS_PER_DAY;let v=.779057273264+_+.00273781191135448*(g+_);v=v%1*F.TWO_PI;const E=K.fromRotationZ(v,Gf),w=K.multiply(u,E,Uf),C=Math.cos(t.xPoleWander),P=Math.cos(t.yPoleWander),R=Math.sin(t.xPoleWander),O=Math.sin(t.yPoleWander);let I=n-VS+s/at.SECONDS_PER_DAY;I/=36525;const M=-47e-6*I*F.RADIANS_PER_DEGREE/3600,z=Math.cos(M),k=Math.sin(M),q=Gf;return q[0]=C*z,q[1]=C*k,q[2]=R,q[3]=-P*k+O*R*z,q[4]=P*z+O*R*k,q[5]=-O*C,q[6]=-O*k-P*R*z,q[7]=O*z-P*R*k,q[8]=P*C,K.multiply(w,q,e)};const ZS=new ce;Ee.pointToWindowCoordinates=function(i,e,t,n){return n=Ee.pointToGLWindowCoordinates(i,e,t,n),n.y=2*e[5]-n.y,n},Ee.pointToGLWindowCoordinates=function(i,e,t,n){if(!x(i))throw new $("modelViewProjectionMatrix is required.");if(!x(e))throw new $("viewportTransformation is required.");if(!x(t))throw new $("point is required.");x(n)||(n=new ge);const s=ZS;return Q.multiplyByVector(i,ce.fromElements(t.x,t.y,t.z,1,s),s),ce.multiplyByScalar(s,1/s.w,s),Q.multiplyByVector(e,s,s),ge.fromCartesian4(s,n)};const KS=new D,QS=new D,JS=new D;Ee.rotationMatrixFromPositionVelocity=function(i,e,t,n){if(!x(i))throw new $("position is required.");if(!x(e))throw new $("velocity is required.");const s=(t??tt.default).geodeticSurfaceNormal(i,KS);let o=D.cross(e,s,QS);D.equalsEpsilon(o,D.ZERO,F.EPSILON6)&&(o=D.clone(D.UNIT_X,o));const r=D.cross(o,e,JS);return D.normalize(r,r),D.cross(e,r,o),D.negate(o,o),D.normalize(o,o),x(n)||(n=new K),n[0]=e.x,n[1]=e.y,n[2]=e.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},Ee.SWIZZLE_3D_TO_2D_MATRIX=Object.freeze(new Q(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1));const F_=new Rt,qf=new D,eR=new D,tR=new K,Vf=new Q,L_=new Q;Ee.basisTo2D=function(i,e,t){if(!x(i))throw new $("projection is required.");if(!x(e))throw new $("matrix is required.");if(!x(t))throw new $("result is required.");const n=Q.getTranslation(e,eR),s=i.ellipsoid;let o;if(D.equals(n,D.ZERO))o=D.clone(D.ZERO,qf);else{const h=s.cartesianToCartographic(n,F_);o=i.project(h,qf),D.fromElements(o.z,o.x,o.y,o)}const r=Ee.eastNorthUpToFixedFrame(n,s,Vf),a=Q.inverseTransformation(r,L_),l=Q.getMatrix3(e,tR),c=Q.multiplyByMatrix3(a,l,t);return Q.multiply(Ee.SWIZZLE_3D_TO_2D_MATRIX,c,t),Q.setTranslation(t,o,t),t},Ee.ellipsoidTo2DModelMatrix=function(i,e,t){if(!x(i))throw new $("projection is required.");if(!x(e))throw new $("center is required.");if(!x(t))throw new $("result is required.");const n=i.ellipsoid,s=Ee.eastNorthUpToFixedFrame(e,n,Vf),o=Q.inverseTransformation(s,L_),r=n.cartesianToCartographic(e,F_),a=i.project(r,qf);D.fromElements(a.z,a.x,a.y,a);const l=Q.fromTranslation(a,Vf);return Q.multiply(Ee.SWIZZLE_3D_TO_2D_MATRIX,o,t),Q.multiply(l,t,t),t};class rt{constructor(e,t,n,s){this.west=e??0,this.south=t??0,this.east=n??0,this.north=s??0}get width(){return rt.computeWidth(this)}get height(){return rt.computeHeight(this)}static pack(e,t,n){return y.typeOf.object("value",e),y.defined("array",t),n=n??0,t[n++]=e.west,t[n++]=e.south,t[n++]=e.east,t[n]=e.north,t}static unpack(e,t,n){return y.defined("array",e),t=t??0,x(n)||(n=new rt),n.west=e[t++],n.south=e[t++],n.east=e[t++],n.north=e[t],n}static computeWidth(e){y.typeOf.object("rectangle",e);let t=e.east;const n=e.west;return t<n&&(t+=F.TWO_PI),t-n}static computeHeight(e){return y.typeOf.object("rectangle",e),e.north-e.south}static fromDegrees(e,t,n,s,o){return e=F.toRadians(e??0),t=F.toRadians(t??0),n=F.toRadians(n??0),s=F.toRadians(s??0),x(o)?(o.west=e,o.south=t,o.east=n,o.north=s,o):new rt(e,t,n,s)}static fromRadians(e,t,n,s,o){return x(o)?(o.west=e??0,o.south=t??0,o.east=n??0,o.north=s??0,o):new rt(e,t,n,s)}static fromCartographicArray(e,t){y.defined("cartographics",e);let n=Number.MAX_VALUE,s=-Number.MAX_VALUE,o=Number.MAX_VALUE,r=-Number.MAX_VALUE,a=Number.MAX_VALUE,l=-Number.MAX_VALUE;for(let c=0,h=e.length;c<h;c++){const u=e[c];n=Math.min(n,u.longitude),s=Math.max(s,u.longitude),a=Math.min(a,u.latitude),l=Math.max(l,u.latitude);const d=u.longitude>=0?u.longitude:u.longitude+F.TWO_PI;o=Math.min(o,d),r=Math.max(r,d)}return s-n>r-o&&(n=o,s=r,s>F.PI&&(s=s-F.TWO_PI),n>F.PI&&(n=n-F.TWO_PI)),x(t)?(t.west=n,t.south=a,t.east=s,t.north=l,t):new rt(n,a,s,l)}static fromCartesianArray(e,t,n){y.defined("cartesians",e),t=t??tt.default;let s=Number.MAX_VALUE,o=-Number.MAX_VALUE,r=Number.MAX_VALUE,a=-Number.MAX_VALUE,l=Number.MAX_VALUE,c=-Number.MAX_VALUE;for(let h=0,u=e.length;h<u;h++){const d=t.cartesianToCartographic(e[h]);s=Math.min(s,d.longitude),o=Math.max(o,d.longitude),l=Math.min(l,d.latitude),c=Math.max(c,d.latitude);const f=d.longitude>=0?d.longitude:d.longitude+F.TWO_PI;r=Math.min(r,f),a=Math.max(a,f)}return o-s>a-r&&(s=r,o=a,o>F.PI&&(o=o-F.TWO_PI),s>F.PI&&(s=s-F.TWO_PI)),x(n)?(n.west=s,n.south=l,n.east=o,n.north=c,n):new rt(s,l,o,c)}static fromBoundingSphere(e,t,n){y.typeOf.object("boundingSphere",e);const s=e.center,o=e.radius;if(x(t)||(t=tt.default),x(n)||(n=new rt),D.equals(s,D.ZERO))return rt.clone(rt.MAX_VALUE,n),n;const r=Ee.eastNorthUpToFixedFrame(s,t,nR),a=Q.multiplyByPointAsVector(r,D.UNIT_X,iR);D.normalize(a,a);const l=Q.multiplyByPointAsVector(r,D.UNIT_Y,sR);D.normalize(l,l),D.multiplyByScalar(l,o,l),D.multiplyByScalar(a,o,a);const c=D.negate(l,rR),h=D.negate(a,oR),u=Wf;let d=u[0];return D.add(s,l,d),d=u[1],D.add(s,h,d),d=u[2],D.add(s,c,d),d=u[3],D.add(s,a,d),u[4]=s,rt.fromCartesianArray(u,t,n)}static clone(e,t){if(x(e))return x(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new rt(e.west,e.south,e.east,e.north)}static equalsEpsilon(e,t,n){return n=n??0,e===t||x(e)&&x(t)&&Math.abs(e.west-t.west)<=n&&Math.abs(e.south-t.south)<=n&&Math.abs(e.east-t.east)<=n&&Math.abs(e.north-t.north)<=n}clone(e){return rt.clone(this,e)}equals(e){return rt.equals(this,e)}static equals(e,t){return e===t||x(e)&&x(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north}equalsEpsilon(e,t){return rt.equalsEpsilon(this,e,t)}static _validate(e){y.typeOf.object("rectangle",e);const t=e.north;y.typeOf.number.greaterThanOrEquals("north",t,-F.PI_OVER_TWO),y.typeOf.number.lessThanOrEquals("north",t,F.PI_OVER_TWO);const n=e.south;y.typeOf.number.greaterThanOrEquals("south",n,-F.PI_OVER_TWO),y.typeOf.number.lessThanOrEquals("south",n,F.PI_OVER_TWO);const s=e.west;y.typeOf.number.greaterThanOrEquals("west",s,-Math.PI),y.typeOf.number.lessThanOrEquals("west",s,Math.PI);const o=e.east;y.typeOf.number.greaterThanOrEquals("east",o,-Math.PI),y.typeOf.number.lessThanOrEquals("east",o,Math.PI)}static southwest(e,t){return y.typeOf.object("rectangle",e),x(t)?(t.longitude=e.west,t.latitude=e.south,t.height=0,t):new Rt(e.west,e.south)}static northwest(e,t){return y.typeOf.object("rectangle",e),x(t)?(t.longitude=e.west,t.latitude=e.north,t.height=0,t):new Rt(e.west,e.north)}static northeast(e,t){return y.typeOf.object("rectangle",e),x(t)?(t.longitude=e.east,t.latitude=e.north,t.height=0,t):new Rt(e.east,e.north)}static southeast(e,t){return y.typeOf.object("rectangle",e),x(t)?(t.longitude=e.east,t.latitude=e.south,t.height=0,t):new Rt(e.east,e.south)}static center(e,t){y.typeOf.object("rectangle",e);let n=e.east;const s=e.west;n<s&&(n+=F.TWO_PI);const o=F.negativePiToPi((s+n)*.5),r=(e.south+e.north)*.5;return x(t)?(t.longitude=o,t.latitude=r,t.height=0,t):new Rt(o,r)}static intersection(e,t,n){y.typeOf.object("rectangle",e),y.typeOf.object("otherRectangle",t);let s=e.east,o=e.west,r=t.east,a=t.west;s<o&&r>0?s+=F.TWO_PI:r<a&&s>0&&(r+=F.TWO_PI),s<o&&a<0?a+=F.TWO_PI:r<a&&o<0&&(o+=F.TWO_PI);let l=F.negativePiToPi(Math.max(o,a));const c=F.negativePiToPi(Math.min(s,r));if(l===F.PI&&c<F.PI&&(l=-F.PI),(e.west<e.east||t.west<t.east)&&c<=l)return;const h=Math.max(e.south,t.south),u=Math.min(e.north,t.north);if(!(h>=u))return x(n)?(n.west=l,n.south=h,n.east=c,n.north=u,n):new rt(l,h,c,u)}static simpleIntersection(e,t,n){y.typeOf.object("rectangle",e),y.typeOf.object("otherRectangle",t);const s=Math.max(e.west,t.west),o=Math.max(e.south,t.south),r=Math.min(e.east,t.east),a=Math.min(e.north,t.north);if(!(o>=a||s>=r))return x(n)?(n.west=s,n.south=o,n.east=r,n.north=a,n):new rt(s,o,r,a)}static union(e,t,n){y.typeOf.object("rectangle",e),y.typeOf.object("otherRectangle",t),x(n)||(n=new rt);let s=e.east,o=e.west,r=t.east,a=t.west;s<o&&r>0?s+=F.TWO_PI:r<a&&s>0&&(r+=F.TWO_PI),s<o&&a<0?a+=F.TWO_PI:r<a&&o<0&&(o+=F.TWO_PI);const l=F.negativePiToPi(Math.min(o,a)),c=F.negativePiToPi(Math.max(s,r));return n.west=l,n.south=Math.min(e.south,t.south),n.east=c,n.north=Math.max(e.north,t.north),n}static expand(e,t,n){return y.typeOf.object("rectangle",e),y.typeOf.object("cartographic",t),x(n)||(n=new rt),n.west=Math.min(e.west,t.longitude),n.south=Math.min(e.south,t.latitude),n.east=Math.max(e.east,t.longitude),n.north=Math.max(e.north,t.latitude),n}static contains(e,t){y.typeOf.object("rectangle",e),y.typeOf.object("cartographic",t);let n=t.longitude;const s=t.latitude,o=e.west;let r=e.east;return r<o&&(r+=F.TWO_PI,n<0&&(n+=F.TWO_PI)),(n>o||F.equalsEpsilon(n,o,F.EPSILON14))&&(n<r||F.equalsEpsilon(n,r,F.EPSILON14))&&s>=e.south&&s<=e.north}static subsample(e,t,n,s){y.typeOf.object("rectangle",e),t=t??tt.default,n=n??0,x(s)||(s=[]);let o=0;const r=e.north,a=e.south,l=e.east,c=e.west,h=aR;h.height=n,h.longitude=c,h.latitude=r,s[o]=t.cartographicToCartesian(h,s[o]),o++,h.longitude=l,s[o]=t.cartographicToCartesian(h,s[o]),o++,h.latitude=a,s[o]=t.cartographicToCartesian(h,s[o]),o++,h.longitude=c,s[o]=t.cartographicToCartesian(h,s[o]),o++,r<0?h.latitude=r:a>0?h.latitude=a:h.latitude=0;for(let u=1;u<8;++u)h.longitude=-Math.PI+u*F.PI_OVER_TWO,rt.contains(e,h)&&(s[o]=t.cartographicToCartesian(h,s[o]),o++);return h.latitude===0&&(h.longitude=c,s[o]=t.cartographicToCartesian(h,s[o]),o++,h.longitude=l,s[o]=t.cartographicToCartesian(h,s[o]),o++),s.length=o,s}static subsection(e,t,n,s,o,r){if(y.typeOf.object("rectangle",e),y.typeOf.number.greaterThanOrEquals("westLerp",t,0),y.typeOf.number.lessThanOrEquals("westLerp",t,1),y.typeOf.number.greaterThanOrEquals("southLerp",n,0),y.typeOf.number.lessThanOrEquals("southLerp",n,1),y.typeOf.number.greaterThanOrEquals("eastLerp",s,0),y.typeOf.number.lessThanOrEquals("eastLerp",s,1),y.typeOf.number.greaterThanOrEquals("northLerp",o,0),y.typeOf.number.lessThanOrEquals("northLerp",o,1),y.typeOf.number.lessThanOrEquals("westLerp",t,s),y.typeOf.number.lessThanOrEquals("southLerp",n,o),x(r)||(r=new rt),e.west<=e.east){const l=e.east-e.west;r.west=e.west+t*l,r.east=e.west+s*l}else{const l=F.TWO_PI+e.east-e.west;r.west=F.negativePiToPi(e.west+t*l),r.east=F.negativePiToPi(e.west+s*l)}const a=e.north-e.south;return r.south=e.south+n*a,r.north=e.south+o*a,t===1&&(r.west=e.east),s===1&&(r.east=e.east),n===1&&(r.south=e.north),o===1&&(r.north=e.north),r}}rt.packedLength=4;const nR=new Q,iR=new D,sR=new D,oR=new D,rR=new D,Wf=new Array(5);for(let i=0;i<Wf.length;++i)Wf[i]=new D;const aR=new Rt;rt.MAX_VALUE=Object.freeze(new rt(-Math.PI,-F.PI_OVER_TWO,Math.PI,F.PI_OVER_TWO));function Cn(i,e){i=i??0,this._near=i,e=e??Number.MAX_VALUE,this._far=e}Object.defineProperties(Cn.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}}}),Cn.packedLength=2,Cn.pack=function(i,e,t){if(!x(i))throw new $("value is required");if(!x(e))throw new $("array is required");return t=t??0,e[t++]=i.near,e[t]=i.far,e},Cn.unpack=function(i,e,t){if(!x(i))throw new $("array is required");return e=e??0,x(t)||(t=new Cn),t.near=i[e++],t.far=i[e],t},Cn.equals=function(i,e){return i===e||x(i)&&x(e)&&i.near===e.near&&i.far===e.far},Cn.clone=function(i,e){if(x(i))return x(e)||(e=new Cn),e.near=i.near,e.far=i.far,e},Cn.prototype.clone=function(i){return Cn.clone(this,i)},Cn.prototype.equals=function(i){return Cn.equals(this,i)};function jn(i,e,t,n){this.near=i??0,this.nearValue=e??0,this.far=t??1,this.farValue=n??0}jn.clone=function(i,e){if(x(i))return x(e)?(e.near=i.near,e.nearValue=i.nearValue,e.far=i.far,e.farValue=i.farValue,e):new jn(i.near,i.nearValue,i.far,i.farValue)},jn.packedLength=4,jn.pack=function(i,e,t){if(!x(i))throw new $("value is required");if(!x(e))throw new $("array is required");return t=t??0,e[t++]=i.near,e[t++]=i.nearValue,e[t++]=i.far,e[t]=i.farValue,e},jn.unpack=function(i,e,t){if(!x(i))throw new $("array is required");return e=e??0,x(t)||(t=new jn),t.near=i[e++],t.nearValue=i[e++],t.far=i[e++],t.farValue=i[e],t},jn.equals=function(i,e){return i===e||x(i)&&x(e)&&i.near===e.near&&i.nearValue===e.nearValue&&i.far===e.far&&i.farValue===e.farValue},jn.prototype.clone=function(i){return jn.clone(this,i)},jn.prototype.equals=function(i){return jn.equals(this,i)};function z_(i,e){return D.fromDegrees(...i,void 0,e)}const lR=new Rt;function cR(i,e){const t=Rt.fromCartesian(i,void 0,lR);if(t)return e=e||[0,0,0],e[0]=F.toDegrees(t.longitude),e[1]=F.toDegrees(t.latitude),e[2]=t.height,e}function N_(i,e){return e=e||new ge,e.x=i[0],e.y=i[1],e}function k_(i,e){return e=e||[0,0],e[0]=i.x,e[1]=i.y,e}function j_(i,e){return e=e||new D,e.x=i[0],e.y=i[1],e.z=i[2],e}function U_(i,e){return e=e||[0,0,0],e[0]=i.x,e[1]=i.y,e[2]=i.z,e}function G_(i,e){return e=e||new ce,e.x=i[0],e.y=i[1],e.z=i[2],e.w=i[3],e}function q_(i,e){return e=e||[0,0,0,0],e[0]=i.x,e[1]=i.y,e[2]=i.z,e[3]=i.w,e}function V_(i,e){if(i.length===4)return G_(i,e);if(i.length===3)return j_(i,e);if(i.length===2)return N_(i,e);throw new Error("toCartesian error: should not be here!")}function hR(i,e){if(i instanceof ge)return k_(i,e);if(i instanceof D)return U_(i,e);if(i instanceof ce)return q_(i,e);throw new Error("fromCartesian error: should not be here!")}function uR(i,e){return e=e||new Rt,e.longitude=F.toRadians(i[0]),e.latitude=F.toRadians(i[1]),e.height=i[2],e}function dR(i,e){return e=e||[0,0,0],e[0]=F.toDegrees(i.longitude),e[1]=F.toDegrees(i.latitude),e[2]=0,e}function fR(i,e){return e=e||new A,e.red=i[0],e.green=i[1],e.blue=i[2],e.alpha=i[3],e}function pR(i,e){return e=e||[0,0,0,0],e[0]=i.red,e[1]=i.green,e[2]=i.blue,e[3]=i.alpha,e}function gR(i,e){return e=e||new jn,e.near=i[0],e.nearValue=i[1],e.far=i[2],e.farValue=i[3],e}function mR(i,e){return e=e||[0,0,0,0],e[0]=i.near,e[1]=i.nearValue,e[2]=i.far,e[3]=i.farValue,e}function W_(i,e){return e=e||new Tt,e.heading=F.toRadians(i[0]-90),e.pitch=F.toRadians(i[1]),e.roll=F.toRadians(i[2]),e}function yR(i,e){return e=e||[0,0,0],e[0]=F.toDegrees(i.heading+F.PI_OVER_TWO),e[1]=F.toDegrees(i.pitch),e[2]=F.toDegrees(i.roll),e}function _R(i,e){return e=e||new Cn,e.near=i[0],e.far=i[1],e}function wR(i,e){return e=e||[0,0],e[0]=i.near,e[1]=i.far,e}function vR(i,e){return e=e||new Y,e.x=i[0],e.y=i[1],e.z=i[2],e.w=i[3],e}function bR(i,e){return e=e||[0,0,0,0],e[0]=i.x,e[1]=i.y,e[2]=i.z,e[3]=i.w,e}const ER=new Tt,CR=new D;function xR(i,e,t){const n=W_(e,ER),s=z_(i,CR);return Ee.headingPitchRollQuaternion(s,n,void 0,void 0,t)}function PR(i,e){return e=e||new rt,e.west=i[0]*Math.PI/180,e.south=i[1]*Math.PI/180,e.east=i[2]*Math.PI/180,e.north=i[3]*Math.PI/180,e}function SR(i,e){return e=e||[0,0,0,0],e[0]=i.west,e[1]=i.south,e[2]=i.east,e[3]=i.north,e}const RR=new D;function TR(i,e){return e=e||new tt,tt.fromCartesian3(D.fromArray(i,void 0,RR),e)}function IR(i,e){return e=e||[0,0,0],e[0]=i.radii.x,e[1]=i.radii.y,e[2]=i.radii.z,e}function OR(i,e){return B_(i,D.UNIT_Y,D.UNIT_Z,D.UNIT_X,e)}function AR(i,e){return B_(i,D.UNIT_X,D.UNIT_Z,new D(0,-1,0),e)}function B_(i,e,t,n,s){const[o,r,a]=i,l=Y.fromAxisAngle(t,F.toRadians(-o)),c=Y.fromAxisAngle(n,F.toRadians(r)),h=Y.fromAxisAngle(e,F.toRadians(a)),u=Y.clone(Y.IDENTITY,s);return Y.multiply(h,u,u),Y.multiply(c,u,u),Y.multiply(l,u,u),u}function $_(i,e){e=e??new Array(16);for(let t=0;t<16;++t)e[t]=i[t];return e}function Bf(i,e){const t=Q.clone(Q.IDENTITY),{position:n,rotation:s,scale:o,initialRotationMode:r="YForwardZUp"}=i;if(n){const[a,l,c]=n;Ee.eastNorthUpToFixedFrame(D.fromDegrees(a,l,c),void 0,t)}if(s){const a=new Y;r==="YForwardZUp"?OR(s,a):r==="XForwardZUp"&&AR(s,a);const l=K.fromQuaternion(a);Q.multiply(t,Q.fromRotationTranslation(l),t)}return o&&Q.multiplyByScale(t,V_(o),t),$_(t,e)}const MR=new Q;function H_(i,e){const t=Q.fromArray(i,0,MR);return Q.inverse(t,t),$_(t,e)}const DR=new Q,FR=new D;function X_(i,e,t){const[n,s,o]=e,r=D.fromDegrees(n,s,o,void 0,FR),a=Q.fromArray(i,0,DR),l=Q.multiplyByPoint(a,r,r),{x:c,y:h,z:u}=l;return t=t||[0,0,0],t[0]=c,t[1]=h,t[2]=u,t}const LR=new Q,zR=new D,NR=new Rt;function Y_(i,e,t){const[n,s,o]=e,r=D.fromElements(n,s,o,zR),a=Q.fromArray(i,0,LR),l=Q.multiplyByPoint(a,r,r),c=Rt.fromCartesian(l,void 0,NR);return t=t||[0,0,0],t[0]=F.toDegrees(c.longitude),t[1]=F.toDegrees(c.latitude),t[2]=c.height,t}function xr(i,e){const{originPosition:t,originRotation:n,originScale:s,initialRotationMode:o}=i,r=Bf({position:t,rotation:n,scale:s,initialRotationMode:o}),a=H_(r);return[e.map(c=>X_(a,c)),r,a]}function Ch(i,e){const{originPosition:t,originRotation:n,originScale:s,initialRotationMode:o}=i,r=Bf({position:t,rotation:n,scale:s,initialRotationMode:o});return[e.map(l=>Y_(r,l)),r]}function $f(i,e){return[(i[0]+e[0])/2,(i[1]+e[1])/2,(i[2]+e[2])/2]}class Z_ extends p.Destroyable{constructor(t,n,s,o){super();T(this,"_pixelsToMetersAt",(t,n,s,o)=>{const r=Ie([n,s]),a=t.getPixelFromCoordinate(r);if(!a)return;const l=[a[0]+o,a[1]],c=t.getCoordinateFromPixel(l);if(!c)return;const[h,u]=Lt(c);return Math.abs(p.geoRhumbDistance([n,s,0],[h,u,0]))});const r=t.viewer;if(!r){console.warn("OlCurrentScale: map is undefined");return}const[a,,l]=p.getReactFuncs(n),[,c]=p.getReactFuncs(s),h=()=>{const d=a();if(!d)return;const[f,g]=d,_=this._pixelsToMetersAt(r,f,g,o);_!==void 0&&isFinite(_)&&c([_,_,_])};h(),this.dispose(l.disposableOn(h));const u=()=>h();r.on("postrender",u),this.dispose(()=>r.un("postrender",u))}}function K_(i){const e=p.min(p.objsIterator(i,["0"])),t=p.min(p.objsIterator(i,["1"])),n=p.max(p.objsIterator(i,["0"])),s=p.max(p.objsIterator(i,["1"]));return{minPos:[e,t],maxPos:[n,s]}}function kR(i){const e=i.map(o=>Ie(o)),{minPos:t,maxPos:n}=K_(e),s=[.5*(t[0]+n[0]),.5*(t[1]+n[1])];return Lt(s)}function jR(i,e,t){const n=Ie(t),s=Ie(e),o=[s[0]-n[0],s[1]-n[1]];return i.map(l=>Ie(l)).map(l=>[l[0]+o[0],l[1]+o[1]]).map(l=>Lt(l))}function UR(i,e){var t,n;if(i){try{const s=ts(i);s&&typeof s.destroy=="function"&&s.destroy(),Rh(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=(t=i.getViewport)==null?void 0:t.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 l=a.getExtension&&a.getExtension("WEBGL_lose_context");l&&typeof l.loseContext=="function"&&l.loseContext()}try{r.width=1,r.height=1}catch{}})}catch(s){console.warn("[destroyOlMapHard] webgl lose context skipped:",s)}try{i.setTarget(void 0)}catch{}try{(n=i.dispose)==null||n.call(i)}catch{}try{e(void 0)}catch{}}}class GR extends p.Destroyable{constructor(e,t,n){super();let s;this.d(()=>{e&&s&&e.removeChild(s)});const o=()=>{t.setStatus("Raw"),t.setStatusLog("");const a=t.viewer;if(a){const l=ts(a);l&&(l.destroy(),Rh(a,void 0)),UR(a,n)}};this.d(o);const r=this.dv(p.createProcessingFromAsyncFunc(async(a,l)=>{t.setStatus("Creating"),t.setStatusLog("正在创建OpenLayers视口..."),s=document.createElement("div"),s.style.cssText="height: 100%",s.addEventListener("contextmenu",E=>E.preventDefault()),this.d(()=>{s==null||s.removeEventListener("contextmenu",E=>E.preventDefault())}),l.appendChild(s);const h=De("EPSG:3857").getExtent(),u=Te(h)/256,d=new Array(19),f=new Array(19);for(let E=0;E<19;++E)d[E]=u/Math.pow(2,E),f[E]=E.toString();const g=new yy({target:s,view:new bi({center:[0,0],zoom:0,enableRotation:!0}),interactions:py({doubleClickZoom:!1}),controls:ly({zoom:!1,rotate:!1,attribution:!1})});await a.promise(p.sleep(1e3)),g.updateSize(),g.renderSync();const _=new ResizeObserver(()=>{g.updateSize(),g.renderSync()});_.observe(s),this.d(()=>_.disconnect());const v=new c1(g,t);Rh(g,v),n(g),this.d(()=>n(void 0)),t.setStatus("Created"),t.setStatusLog("成功创建OpenLayers视口!")}));r.start(e),r.errorEvent.don(a=>{console.error(a),t.setStatus("Error"),t.setStatusLog("创建Cesium视口失败!")})}}class qR extends p.Destroyable{constructor(e){super();const t=()=>{};this.dispose(e.viewDistanceChanged.disposableOn(t)),this.dispose(e.visibleAlphaChanged.disposableOn(t))}}class VR extends p.Destroyable{constructor(t){super();T(this,"_debugObjResetting");this._control=t,this._debugObjResetting=this.disposeVar(new p.ObjResettingWithEvent(this._control.debugChanged,()=>{if(this._control.debug)return new qR(this._control)}))}get debugObjResetting(){return this._debugObjResetting}}class Q_ extends p.Destroyable{constructor(t,n,s,o){super();T(this,"_visibleAlpha",this.disposeVar(p.react(1)));T(this,"_viewDistance",this.disposeVar(p.react(0)));T(this,"_debug",this.disposeVar(p.react(!1)));T(this,"_viewDistanceDebug",this.disposeVar(new VR(this)));this._olViewer=t,this._positionReact=s;const[r,,a]=p.getReactFuncs(n),[l,,c]=p.getReactFuncs(this._positionReact),[h,,u]=o?p.getReactFuncs(o):[void 0,void 0,void 0],d=()=>{var v;let g=1,_=Number.NEGATIVE_INFINITY;do{const E=r(),w=l(),C=h?h():0;if(!E||!w)break;const P=(v=this._olViewer.viewer)==null?void 0:v.getView().getCenter();if(console.log(P),!P)break;_=om({getCoordinates:()=>[P,w],getType:()=>"LineString"})-(C??0);const[O,I,M,z]=E;if(O>I||I>M||M>z){console.error("viewDistanceRange 参数错误: n0 <= n1 <= f1 <= f0");break}_>=I&&_<=M?g=1:_<=O||_>=z?g=0:_>O&&_<I?g=(_-O)/(I-O):_>M&&_<z?g=(z-_)/(z-M):g=1}while(!1);this._viewDistance.value=_,this._visibleAlpha.value=g},f=this.disposeVar(p.createNextAnimateFrameEvent(...[this._olViewer.cameraChanged,a,c,u].filter(Boolean)));this.dispose(f.disposableOn(d)),d()}get visibleAlpha(){return this._visibleAlpha.value}get visibleAlphaChanged(){return this._visibleAlpha.changed}get viewDistance(){return this._viewDistance.value}set viewDistance(t){this._viewDistance.value=t}get viewDistanceChanged(){return this._viewDistance.changed}get debug(){return this._debug.value}set debug(t){this._debug.value=t}get debugChanged(){return this._debug.changed}get positionReact(){return this._positionReact}get olViewer(){return this._olViewer}get viewDistanceDebug(){return this._viewDistanceDebug}}class J_ extends p.Destroyable{constructor(t,n){super();T(this,"_map");T(this,"_view");T(this,"_keys",[]);T(this,"_changed",new p.Event);T(this,"_opts");this._map=t;const s=t.getView();if(!s)throw new Error("OlCameraChanged: map.getView() is undefined");this._view=s,this._opts={usePropertyChange:!0,listenSizeChange:!0,usePostRender:!1,emitImmediately:!0,...n},this._attach(),this.dispose(()=>this._detach()),this._opts.emitImmediately&&this._changed.emit()}get changed(){return this._changed}_on(t,n,s){const o=t.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 Hf(i,e){return i.left===e.left&&i.top===e.top&&i.right===e.right&&i.bottom===e.bottom&&i.depth===e.depth}class Xf extends p.Destroyable{constructor(t,n=!0,s){super();T(this,"_coordinate");T(this,"_winPos",{left:NaN,top:NaN,right:NaN,bottom:NaN,depth:NaN});T(this,"_winPosValid",!1);T(this,"_changedEvent",new p.Event);T(this,"_enabled",!0);T(this,"tooltipElement");this.viewer=t,s=s||this.disposeVar(new J_(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(t){this._enabled!==t&&(this._enabled=t,t&&this._updateWinPos())}get enabled(){return this._enabled}set coordinate(t){if(!t){this._coordinate=void 0,this._updateWinPos();return}const n=this.viewer.getView().getProjection(),o=Math.abs(t[0])<=180&&Math.abs(t[1])<=90?Ko(t,"EPSG:4326",n):t;this._coordinate=[o[0],o[1]],this._updateWinPos()}get coordinate(){return this._coordinate}_updateWinPos(){if(!this._enabled)return;if(!this._coordinate){this._emitInvalidIfNeeded();return}const t=this.viewer.getPixelFromCoordinate(this._coordinate),n=this.viewer.getSize(),s=!!t&&Array.isArray(t)&&isFinite(t[0])&&isFinite(t[1])&&!!n&&t[0]>=0&&t[1]>=0&&t[0]<n[0]&&t[1]<n[1];let o=!1;if(s!==this._winPosValid&&(this._winPosValid=s,o=!0),s){const r={left:t[0],top:t[1],right:t[0],bottom:t[1],depth:0};Hf(this._winPos,r)||(this._winPos=r,o=!0)}else{const r={left:NaN,top:NaN,right:NaN,bottom:NaN,depth:NaN};Hf(this._winPos,r)||(this._winPos=r,o=!0)}o&&(this._changedEvent.emit(this._winPosValid,this._winPos),this._syncTooltip())}_emitInvalidIfNeeded(){let t=!1;this._winPosValid&&(this._winPosValid=!1,t=!0);const n={left:NaN,top:NaN,right:NaN,bottom:NaN,depth:NaN};Hf(this._winPos,n)||(this._winPos=n,t=!0),t&&(this._changedEvent.emit(!1,this._winPos),this._syncTooltip())}_syncTooltip(){this.tooltipElement&&(this._winPosValid?(this.tooltipElement.style.display="block",this.tooltipElement.style.left=`${this._winPos.left}px`,this.tooltipElement.style.top=`${this._winPos.top}px`):this.tooltipElement.style.display="none")}get changed(){return this._changedEvent}get winPosValid(){return this._winPosValid}get winPos(){return this._winPos}}class WR extends p.Destroyable{constructor(t,n){super();T(this,"_show",this.disposeVar(p.react(!0)));T(this,"_winPosFromCartesian");T(this,"_near",this.disposeVar(p.react(0)));T(this,"_far",this.disposeVar(p.react(Number.POSITIVE_INFINITY)));T(this,"_actualShow",this.disposeVar(p.react(!1)));this._olPoisContext=t;const{viewer:s,cameraChanged:o}=this._olPoisContext;this._winPosFromCartesian=n||this.disposeVar(new Xf(s,!0,o));let r=0,a=Number.POSITIVE_INFINITY;this.dispose(this._near.changed.disposableOn(c=>r=c*c)),this.dispose(this._far.changed.disposableOn(c=>a=c*c));const l=this.disposeVar(p.createNextMicroTaskEvent(this._near.changed,this._far.changed,this._show.changed,this._winPosFromCartesian.changed,o.changed));this.dispose(l.disposableOn(()=>{if(!this.show){this._actualShow.value=!1;return}const c=this._winPosFromCartesian.winPosValid,u=this._olPoisContext.viewer.getView().getCenter(),d=this._winPosFromCartesian.coordinate;if(!u||!d){this._actualShow.value=!1;return}const f=d[0]-u[0],g=d[1]-u[1],_=f*f+g*g,v=_>=r&&_<=a;this._actualShow.value=v&&c}))}get actualShowChanged(){return this._actualShow.changed}get actualShow(){return this._actualShow.value}set coordinate(t){this._winPosFromCartesian.coordinate=t}get coordinate(){return this._winPosFromCartesian.coordinate}get tracker(){return this._winPosFromCartesian}set show(t){this._show.value=t}get show(){return this._show.value}set near(t){this._near.value=t}get near(){return this._near.value}set far(t){this._far.value=t}get far(){return this._far.value}}class Yf extends WR{constructor(t,n,s){super(n,s);T(this,"_canvasPoi");T(this,"_zOrderChanged");T(this,"_zOrder");T(this,"depth",0);const{canvasPrimitivesContext:o}=this._olPoisContext;this._canvasPoi=this.disposeVar(new t(o));const r=()=>{if(this.actualShow&&this.tracker.winPosValid){const{left:a,top:l,depth:c}=this.tracker.winPos;this._canvasPoi.winPos=[a,l],this.depth=c,this._canvasPoi.depth=this._zOrder??c,this._canvasPoi.show=!0}else this._canvasPoi.show=!1};this.d(this.zOrderChanged.don(()=>{r()})),this.dispose(this.tracker.changed.disposableOn(()=>{r()})),this.dispose(this.actualShowChanged.disposableOn(()=>{r()}))}get canvasPoi(){return this._canvasPoi}set zOrder(t){this._zOrder!==t&&(this._zOrder=t,this.zOrderChanged.emit())}get zOrder(){return this._zOrder}get zOrderChanged(){return this._zOrderChanged||(this._zOrderChanged=new p.Event),this._zOrderChanged}}class es extends p.Destroyable{constructor(t,n){super();T(this,"_pickedEvent",this.disposeVar(new p.Event));T(this,"_flyToEvent",this.disposeVar(new p.Event));T(this,"_clickEvent",this.disposeVar(new p.Event));T(this,"_clickOutEvent",this.disposeVar(new p.Event));T(this,"_dblclickEvent",this.disposeVar(new p.Event));T(this,"_dblclickOutEvent",this.disposeVar(new p.Event));T(this,"_canvasPoiClassAndCreateFunc",p.react(void 0));T(this,"_olViewDistanceRangeControl");T(this,"_canvasObj");T(this,"_id",this.disposeVar(p.react(p.createGuid())));n&&(this.id=n),this._olViewDistanceRangeControl=this.disposeVar(new Q_(t,[this,"viewDistanceRange"],[this,"position"])),this.dispose(p.track([this._olViewDistanceRangeControl,"debug"],[this,"viewDistanceDebug"]));const s=t.viewer;if(!s)return;const o=ts(s);if(!o)return;const{poiContext:r,labelManager:a}=o;a.add(this),this.d(()=>{a.delete(this)}),r&&(this._canvasObj=this.disposeVar(new p.ObjResettingWithEvent(this.canvasPoiClassAndCreateFuncChanged,()=>{if(!this.canvasPoiClassAndCreateFunc)return;const[l,c]=this.canvasPoiClassAndCreateFunc;return new BR(this,l,r,s,c)})))}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}get clickEvent(){return this._clickEvent}get clickOutEvent(){return this._clickOutEvent}get dblclickEvent(){return this._dblclickEvent}get dblclickOutEvent(){return this._dblclickOutEvent}get canvasPoiClassAndCreateFunc(){return this._canvasPoiClassAndCreateFunc.value}set canvasPoiClassAndCreateFunc(t){this._canvasPoiClassAndCreateFunc.value=t}get canvasPoiClassAndCreateFuncChanged(){return this._canvasPoiClassAndCreateFunc.changed}get olViewDistanceRangeControl(){return this._olViewDistanceRangeControl}get visibleAlpha(){return this._olViewDistanceRangeControl.visibleAlpha}get visibleAlphaChanged(){return this._olViewDistanceRangeControl.visibleAlphaChanged}get canvasObj(){var t;return(t=this._canvasObj)==null?void 0:t.obj}get id(){return this._id.value}set id(t){this._id.value=t}get idChanged(){return this._id.changed}}T(es,"defaults",{viewDistanceRange:[1e3,1e4,3e4,6e4]}),(i=>{i.createDefaultProps=()=>({show:!0,enabled:!0,position:p.reactArrayWithUndefined(void 0),positionEditing:!1,viewDistanceRange:p.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,zOrder:0})})(es||(es={})),p.extendClassProps(es.prototype,es.createDefaultProps);class BR extends p.Destroyable{constructor(t,n,s,o,r){super();T(this,"olCanvasPoi");const a=this.olCanvasPoi=this.disposeVar(new Yf(n,s));this.disposeVar(r(a.canvasPoi,t.visibleAlphaChanged));const l=()=>{if(t.position){const u=Ie([t.position[0],t.position[1]]);a.coordinate=u}};l(),this.dispose(t.positionChanged.disposableOn(l));const c=()=>{a.show=(t.show??!0)&&!!t.position&&t.visibleAlpha>0};c();const h=this.disposeVar(p.createNextAnimateFrameEvent(t.showChanged,t.positionChanged,t.visibleAlphaChanged));this.dispose(h.disposableOn(c)),this.dispose(t.flyToEvent.disposableOn(()=>{console.warn("flyTo not implemented in OpenLayers")}))}}class $R extends p.Destroyable{constructor(e,t){super();const n=this.disposeVar(p.createNextAnimateFrameEvent(e.showChanged,e.positionChanged,e.fgColorChanged,e.bgColorChanged,e.tooltipChanged,e.tooltipShowChanged,e.titleChanged,e.sizeChanged,e.originRatioAndOffsetChanged,e.opacityChanged,e.scaleChanged)),s=()=>{t.fgColor=e.fgColor??[1,1,1,1],t.bgColor=e.bgColor??[.3,.3,.3,.8],t.tooltip=e.tooltip??"",t.tooltipShow=e.tooltipShow??!0,t.title=e.title??"",t.size=e.size??[32,32],t.originRatioAndOffset=e.originRatioAndOffset??[.5,1,0,0],t.hovered=e.hovered??!1,t.opacity=e.opacity??1,t._scale=e.scale??1};s(),this.dispose(n.disposableOn(s));const o=this.disposeVar(p.ESSceneObject.context.createEnvStrReact([e,"imageUri"],"${earthsdk3-assets-script-dir}/assets/img/location.png")),r=this.disposeVar(p.createProcessingFromAsyncFunc(async(c,h)=>{const u=await c.promise(p.fetchImage(h));t.image=u})),a=()=>{if(!o.value)return;const c=o.value.trim();c!==""&&r.restart(void 0,c)};a(),this.dispose(o.changed.disposableOn(a));const l=this.disposeVar(new p.Event);this.dispose(t.clickEvent.disposableOn((c,h,u,d,f)=>{(e.enabled??!0)&&l.emit(f)})),this.dispose(l.don(c=>{e.clickEvent.emit(c)})),this.dispose(t.clickOutEvent.disposableOn((c,h,u,d,f)=>{(e.enabled??!0)&&e.clickOutEvent.emit(f)})),this.dispose(t.dbclickEvent.disposableOn((c,h,u,d,f)=>{(e.enabled??!0)&&e.dbclickEvent.emit(f)})),this.dispose(t.dbclickOutEvent.disposableOn((c,h,u,d,f)=>{(e.enabled??!0)&&e.dbclickOutEvent.emit(f)})),this.dispose(p.bind([e,"hovered"],[t,"hovered"])),this.ad(p.bind([t,"isHoverZoom"],[e,"isHoverZoom"]))}}function HR(i,e){const t=i.trim();if(t){try{const n=Function('"use strict";return ('+t+")")();if(typeof n=="function")return n}catch(n){console.info(`firstTryFunc get error! ${n}`)}try{const n=`function (${(e??[]).join(", ")}) {
|
|
70
|
-
${t};
|
|
71
|
-
}`,s=Function('"use strict";return ('+n+")")();return typeof s=="function"?s:void 0}catch(n){console.error(`optionStr get error! ${n}`);return}}}function xh(i,e=48){return`
|
|
21
|
+
`)}}),globalThis.g_XE3CopyRights=globalThis.g_XE3CopyRights||{},globalThis.g_XE3CopyRights[n]=M.copyright,globalThis.g_earthsdk_copyright_print=globalThis.g_earthsdk_copyright_print??!0,globalThis.g_earthsdk_copyright_print&&M.copyright.print()}catch{}class Se extends f.Destroyable{constructor(){super()}}E(Se,"defaults",{enabled:!0}),(n=>{n.createDefaultProps=()=>({enabled:!0})})(Se||(Se={})),f.extendClassProps(Se.prototype,Se.createDefaultProps);function Jd(n){return Math.pow(n,3)}function Jn(n){return 1-Jd(1-n)}function P0(n){return 3*n*n-2*n*n*n}function R0(n){return n}function I0(n,t,e){let i,s;e=e||Pi;let r=0,o=n.length,a=!1;for(;r<o;)i=r+(o-r>>1),s=+e(n[i],t),s<0?r=i+1:(o=i,a=!s);return a?r:~r}function Pi(n,t){return n>t?1:n<t?-1:0}function S0(n,t){return n<t?1:n>t?-1:0}function _a(n,t,e){if(n[0]<=t)return 0;const i=n.length;if(t<=n[i-1])return i-1;if(typeof e=="function"){for(let s=1;s<i;++s){const r=n[s];if(r===t)return s;if(r<t)return e(t,n[s-1],r)>0?s-1:s}return i-1}if(e>0){for(let s=1;s<i;++s)if(n[s]<t)return s-1;return i-1}if(e<0){for(let s=1;s<i;++s)if(n[s]<=t)return s;return i-1}for(let s=1;s<i;++s){if(n[s]==t)return s;if(n[s]<t)return n[s-1]-t<t-n[s]?s-1:s}return i-1}function T0(n,t,e){for(;t<e;){const i=n[t];n[t]=n[e],n[e]=i,++t,--e}}function Ri(n,t){const e=Array.isArray(t)?t:[t],i=e.length;for(let s=0;s<i;s++)n[n.length]=e[s]}function xn(n,t){const e=n.length;if(e!==t.length)return!1;for(let i=0;i<e;i++)if(n[i]!==t[i])return!1;return!0}function M0(n,t,e){const i=t||Pi;return n.every(function(s,r){if(r===0)return!0;const o=i(n[r-1],s);return!(o>0||o===0)})}const oe={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Rr(n){const t=ze();for(let e=0,i=n.length;e<i;++e)Ir(t,n[e]);return t}function A0(n,t,e){const i=Math.min.apply(null,n),s=Math.min.apply(null,t),r=Math.max.apply(null,n),o=Math.max.apply(null,t);return Zi(i,s,r,o,e)}function Ii(n,t,e){return e?(e[0]=n[0]-t,e[1]=n[1]-t,e[2]=n[2]+t,e[3]=n[3]+t,e):[n[0]-t,n[1]-t,n[2]+t,n[3]+t]}function Qd(n,t){return t?(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t):n.slice()}function Qn(n,t,e){let i,s;return t<n[0]?i=n[0]-t:n[2]<t?i=t-n[2]:i=0,e<n[1]?s=n[1]-e:n[3]<e?s=e-n[3]:s=0,i*i+s*s}function ts(n,t){return Ec(n,t[0],t[1])}function Bi(n,t){return n[0]<=t[0]&&t[2]<=n[2]&&n[1]<=t[1]&&t[3]<=n[3]}function Ec(n,t,e){return n[0]<=t&&t<=n[2]&&n[1]<=e&&e<=n[3]}function Cc(n,t){const e=n[0],i=n[1],s=n[2],r=n[3],o=t[0],a=t[1];let l=oe.UNKNOWN;return o<e?l=l|oe.LEFT:o>s&&(l=l|oe.RIGHT),a<i?l=l|oe.BELOW:a>r&&(l=l|oe.ABOVE),l===oe.UNKNOWN&&(l=oe.INTERSECTING),l}function ze(){return[1/0,1/0,-1/0,-1/0]}function Zi(n,t,e,i,s){return s?(s[0]=n,s[1]=t,s[2]=e,s[3]=i,s):[n,t,e,i]}function Ns(n){return Zi(1/0,1/0,-1/0,-1/0,n)}function tf(n,t){const e=n[0],i=n[1];return Zi(e,i,e,i,t)}function bc(n,t,e,i,s){const r=Ns(s);return nf(r,n,t,e,i)}function ji(n,t){return n[0]==t[0]&&n[2]==t[2]&&n[1]==t[1]&&n[3]==t[3]}function ef(n,t){return t[0]<n[0]&&(n[0]=t[0]),t[2]>n[2]&&(n[2]=t[2]),t[1]<n[1]&&(n[1]=t[1]),t[3]>n[3]&&(n[3]=t[3]),n}function Ir(n,t){t[0]<n[0]&&(n[0]=t[0]),t[0]>n[2]&&(n[2]=t[0]),t[1]<n[1]&&(n[1]=t[1]),t[1]>n[3]&&(n[3]=t[1])}function nf(n,t,e,i,s){for(;e<i;e+=s)D0(n,t[e],t[e+1]);return n}function D0(n,t,e){n[0]=Math.min(n[0],t),n[1]=Math.min(n[1],e),n[2]=Math.max(n[2],t),n[3]=Math.max(n[3],e)}function sf(n,t){let e;return e=t(va(n)),e||(e=t(wa(n)),e)||(e=t(Ea(n)),e)||(e=t(Te(n)),e)?e:!1}function Pc(n){let t=0;return qi(n)||(t=ut(n)*Vt(n)),t}function va(n){return[n[0],n[1]]}function wa(n){return[n[2],n[1]]}function He(n){return[(n[0]+n[2])/2,(n[1]+n[3])/2]}function F0(n,t){let e;if(t==="bottom-left")e=va(n);else if(t==="bottom-right")e=wa(n);else if(t==="top-left")e=Te(n);else if(t==="top-right")e=Ea(n);else throw new Error("Invalid corner");return e}function xa(n,t,e,i,s){const[r,o,a,l,c,h,u,d]=rf(n,t,e,i);return Zi(Math.min(r,a,c,u),Math.min(o,l,h,d),Math.max(r,a,c,u),Math.max(o,l,h,d),s)}function rf(n,t,e,i){const s=t*i[0]/2,r=t*i[1]/2,o=Math.cos(e),a=Math.sin(e),l=s*o,c=s*a,h=r*o,u=r*a,d=n[0],g=n[1];return[d-l+u,g-c-h,d-l-u,g-c+h,d+l-u,g+c+h,d+l+u,g+c-h,d-l+u,g-c-h]}function Vt(n){return n[3]-n[1]}function ci(n,t,e){const i=e||ze();return Wt(n,t)?(n[0]>t[0]?i[0]=n[0]:i[0]=t[0],n[1]>t[1]?i[1]=n[1]:i[1]=t[1],n[2]<t[2]?i[2]=n[2]:i[2]=t[2],n[3]<t[3]?i[3]=n[3]:i[3]=t[3]):Ns(i),i}function Te(n){return[n[0],n[3]]}function Ea(n){return[n[2],n[3]]}function ut(n){return n[2]-n[0]}function Wt(n,t){return n[0]<=t[2]&&n[2]>=t[0]&&n[1]<=t[3]&&n[3]>=t[1]}function qi(n){return n[2]<n[0]||n[3]<n[1]}function L0(n,t){return t?(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t):n}function O0(n,t){const e=(n[2]-n[0])/2*(t-1),i=(n[3]-n[1])/2*(t-1);n[0]-=e,n[2]+=e,n[1]-=i,n[3]+=i}function z0(n,t,e){let i=!1;const s=Cc(n,t),r=Cc(n,e);if(s===oe.INTERSECTING||r===oe.INTERSECTING)i=!0;else{const o=n[0],a=n[1],l=n[2],c=n[3],h=t[0],u=t[1],d=e[0],g=e[1],p=(g-u)/(d-h);let m,_;r&oe.ABOVE&&!(s&oe.ABOVE)&&(m=d-(g-c)/p,i=m>=o&&m<=l),!i&&r&oe.RIGHT&&!(s&oe.RIGHT)&&(_=g-(d-l)*p,i=_>=a&&_<=c),!i&&r&oe.BELOW&&!(s&oe.BELOW)&&(m=d-(g-a)/p,i=m>=o&&m<=l),!i&&r&oe.LEFT&&!(s&oe.LEFT)&&(_=g-(d-o)*p,i=_>=a&&_<=c)}return i}function of(n,t,e,i){if(qi(n))return Ns(e);let s=[];if(i>1){const a=n[2]-n[0],l=n[3]-n[1];for(let c=0;c<i;++c)s.push(n[0]+a*c/i,n[1],n[2],n[1]+l*c/i,n[2]-a*c/i,n[3],n[0],n[3]-l*c/i)}else s=[n[0],n[1],n[2],n[1],n[2],n[3],n[0],n[3]];t(s,s,2);const r=[],o=[];for(let a=0,l=s.length;a<l;a+=2)r.push(s[a]),o.push(s[a+1]);return A0(r,o,e)}function af(n,t){const e=t.getExtent(),i=He(n);if(t.canWrapX()&&(i[0]<e[0]||i[0]>=e[2])){const s=ut(e),o=Math.floor((i[0]-e[0])/s)*s;n[0]-=o,n[2]-=o}return n}function lf(n,t,e){if(t.canWrapX()){const i=t.getExtent();if(!isFinite(n[0])||!isFinite(n[2]))return[[i[0],n[1],i[2],n[3]]];af(n,t);const s=ut(i);if(ut(n)>s&&!e)return[[i[0],n[1],i[2],n[3]]];if(n[0]<i[0])return[[n[0]+s,n[1],i[2],n[3]],[i[0],n[1],n[2],n[3]]];if(n[2]>i[2])return[[n[0],n[1],i[2],n[3]],[i[0],n[1],n[2]-s,n[3]]]}return[n]}function kt(n,t,e){return Math.min(Math.max(n,t),e)}function k0(n,t,e,i,s,r){const o=s-e,a=r-i;if(o!==0||a!==0){const l=((n-e)*o+(t-i)*a)/(o*o+a*a);l>1?(e=s,i=r):l>0&&(e+=o*l,i+=a*l)}return es(n,t,e,i)}function es(n,t,e,i){const s=e-n,r=i-t;return s*s+r*r}function N0(n){const t=n.length;for(let i=0;i<t;i++){let s=i,r=Math.abs(n[i][i]);for(let a=i+1;a<t;a++){const l=Math.abs(n[a][i]);l>r&&(r=l,s=a)}if(r===0)return null;const o=n[s];n[s]=n[i],n[i]=o;for(let a=i+1;a<t;a++){const l=-n[a][i]/n[i][i];for(let c=i;c<t+1;c++)i==c?n[a][c]=0:n[a][c]+=l*n[i][c]}}const e=new Array(t);for(let i=t-1;i>=0;i--){e[i]=n[i][t]/n[i][i];for(let s=i-1;s>=0;s--)n[s][t]-=n[s][i]*e[i]}return e}function cf(n){return n*180/Math.PI}function En(n){return n*Math.PI/180}function Cn(n,t){const e=n%t;return e*t<0?e+t:e}function ke(n,t,e){return n+e*(t-n)}function Sr(n,t){const e=Math.pow(10,t);return Math.round(n*e)/e}function hf(n,t){return Math.round(Sr(n,t))}function Ca(n,t){return Math.floor(Sr(n,t))}function bn(n,t){return Math.ceil(Sr(n,t))}function Rc(n,t,e){if(n>=t&&n<e)return n;const i=e-t;return((n-t)%i+i)%i+t}const uf=63710088e-1;function Ic(n,t,e){e=e||uf;const i=En(n[1]),s=En(t[1]),r=(s-i)/2,o=En(t[0]-n[0])/2,a=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(i)*Math.cos(s);return 2*e*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function Sc(n,t){let e=0;for(let i=0,s=n.length;i<s-1;++i)e+=Ic(n[i],n[i+1],t);return e}function df(n,t){t=t||{};const e=t.radius||uf,i=t.projection||"EPSG:3857",s=n.getType();s!=="GeometryCollection"&&(n=n.clone().transform(i,"EPSG:4326"));let r=0,o,a,l,c,h,u;switch(s){case"Point":case"MultiPoint":break;case"LineString":case"LinearRing":{o=n.getCoordinates(),r=Sc(o,e);break}case"MultiLineString":case"Polygon":{for(o=n.getCoordinates(),l=0,c=o.length;l<c;++l)r+=Sc(o[l],e);break}case"MultiPolygon":{for(o=n.getCoordinates(),l=0,c=o.length;l<c;++l)for(a=o[l],h=0,u=a.length;h<u;++h)r+=Sc(a[h],e);break}case"GeometryCollection":{const d=n.getGeometries();for(l=0,c=d.length;l<c;++l)r+=df(d[l],t);break}default:throw new Error("Unsupported geometry type: "+s)}return r}function et(){throw new Error("Unimplemented abstract method.")}let G0=0;function at(n){return n.ol_uid||(n.ol_uid=String(++G0))}const V0="10.8.0",Gs={PROPERTYCHANGE:"propertychange"},Q={CHANGE:"change",ERROR:"error",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",TOUCHMOVE:"touchmove",WHEEL:"wheel"};class Tr{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function Mr(){return!0}function ba(){return!1}function Ar(){}function ff(n){let t,e,i;return function(){const s=Array.prototype.slice.call(arguments);return(!e||this!==i||!xn(s,e))&&(i=this,e=s,t=n.apply(this,arguments)),t}}function Vs(n){function t(){let e;try{e=n()}catch(i){return Promise.reject(i)}return e instanceof Promise?e:Promise.resolve(e)}return t()}function Dr(n){for(const t in n)delete n[t]}function Pn(n){let t;for(t in n)return!1;return!t}class hi{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}class Fr extends Tr{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),s=i[t]||(i[t]=[]);s.includes(e)||s.push(e)}dispatchEvent(t){const e=typeof t=="string",i=e?t:t.type,s=this.listeners_&&this.listeners_[i];if(!s)return;const r=e?new hi(t):t;r.target||(r.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});i in o||(o[i]=0,a[i]=0),++o[i];let l;for(let c=0,h=s.length;c<h;++c)if("handleEvent"in s[c]?l=s[c].handleEvent(r):l=s[c].call(this,r),l===!1||r.propagationStopped){l=!1;break}if(--o[i]===0){let c=a[i];for(delete a[i];c--;)this.removeEventListener(i,Ar);delete o[i]}return l}disposeInternal(){this.listeners_&&Dr(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return this.listeners_?t?t in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const s=i.indexOf(e);s!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[s]=Ar,++this.pendingRemovals_[t]):(i.splice(s,1),i.length===0&&delete this.listeners_[t]))}}function wt(n,t,e,i,s){if(s){const o=e;e=function(a){return n.removeEventListener(t,e),o.call(i??this,a)}}else i&&i!==n&&(e=e.bind(i));const r={target:n,type:t,listener:e};return n.addEventListener(t,e),r}function Pa(n,t,e,i){return wt(n,t,e,i,!0)}function Lt(n){n&&n.target&&(n.target.removeEventListener(n.type,n.listener),Dr(n))}class Lr extends Fr{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(Q.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=wt(this,t[r],e);return s}return wt(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const s=t.length;i=new Array(s);for(let r=0;r<s;++r)i[r]=Pa(this,t[r],e)}else i=Pa(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)Si(i);else if(Array.isArray(t))for(let s=0,r=t.length;s<r;++s)this.removeEventListener(t[s],e);else this.removeEventListener(t,e)}}Lr.prototype.on,Lr.prototype.once,Lr.prototype.un;function Si(n){if(Array.isArray(n))for(let t=0,e=n.length;t<e;++t)Lt(n[t]);else Lt(n)}class gf extends hi{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}class Ti extends Lr{constructor(t){super(),this.on,this.once,this.un,at(this),this.values_=null,t!==void 0&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new gf(i,t,e)),i=Gs.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new gf(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const s=this.values_||(this.values_={});if(i)s[t]=e;else{const r=s[t];s[t]=e,r!==e&&this.notify(t,r)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],Pn(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}function pf(...n){console.warn(...n)}function mf(n,t){const e=(""+n).split("."),i=(""+t).split(".");for(let s=0;s<Math.max(e.length,i.length);s++){const r=parseInt(e[s]||"0",10),o=parseInt(i[s]||"0",10);if(r>o)return 1;if(o>r)return-1}return 0}function W0(n,t){return n[0]+=+t[0],n[1]+=+t[1],n}function Ra(n,t){let e=!0;for(let i=n.length-1;i>=0;--i)if(n[i]!=t[i]){e=!1;break}return e}function Tc(n,t){const e=Math.cos(t),i=Math.sin(t),s=n[0]*e-n[1]*i,r=n[1]*e+n[0]*i;return n[0]=s,n[1]=r,n}function U0(n,t){return n[0]*=t,n[1]*=t,n}function $0(n,t){const e=n[0]-t[0],i=n[1]-t[1];return e*e+i*i}function X0(n,t){return Math.sqrt($0(n,t))}function Mc(n,t){if(t.canWrapX()){const e=ut(t.getExtent()),i=Y0(n,t,e);i&&(n[0]-=i*e)}return n}function Y0(n,t,e){const i=t.getExtent();let s=0;return t.canWrapX()&&(n[0]<i[0]||n[0]>i[2])&&(e=e||ut(i),s=Math.floor((n[0]-i[0])/e)),s}function H0(n,t,e){const i=Math.sqrt((t[0]-n[0])*(t[0]-n[0])+(t[1]-n[1])*(t[1]-n[1])),s=[(t[0]-n[0])/i,(t[1]-n[1])/i],r=[-s[1],s[0]],o=Math.sqrt((e[0]-n[0])*(e[0]-n[0])+(e[1]-n[1])*(e[1]-n[1])),a=[(e[0]-n[0])/o,(e[1]-n[1])/o];let l=i===0||o===0?0:Math.acos(kt(a[0]*s[0]+a[1]*s[1],-1,1));return l=Math.max(l,1e-5),a[0]*r[0]+a[1]*r[1]>0?l:Math.PI*2-l}const Ia={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class Or{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_||Ia[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 zr=6378137,Ws=Math.PI*zr,B0=[-Ws,-Ws,Ws,Ws],Z0=[-180,-85,180,85],Sa=zr*Math.log(Math.tan(Math.PI/2));class Us extends Or{constructor(t){super({code:t,units:"m",extent:B0,global:!0,worldExtent:Z0,getPointResolution:function(e,i){return e/Math.cosh(i[1]/zr)}})}}const yf=[new Us("EPSG:3857"),new Us("EPSG:102100"),new Us("EPSG:102113"),new Us("EPSG:900913"),new Us("http://www.opengis.net/def/crs/EPSG/0/3857"),new Us("http://www.opengis.net/gml/srs/epsg.xml#3857")];function j0(n,t,e,i){const s=n.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=n.slice():t=new Array(s));for(let r=0;r<s;r+=i){t[r]=Ws*n[r]/180;let o=zr*Math.log(Math.tan(Math.PI*(+n[r+1]+90)/360));o>Sa?o=Sa:o<-Sa&&(o=-Sa),t[r+1]=o}return t}function q0(n,t,e,i){const s=n.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=n.slice():t=new Array(s));for(let r=0;r<s;r+=i)t[r]=180*n[r]/Ws,t[r+1]=360*Math.atan(Math.exp(n[r+1]/zr))/Math.PI-90;return t}const K0=6378137,_f=[-180,-90,180,90],J0=Math.PI*K0/180;class is extends Or{constructor(t,e){super({code:t,units:"degrees",extent:_f,axisOrientation:e,global:!0,metersPerUnit:J0,worldExtent:_f})}}const vf=[new is("CRS:84"),new is("EPSG:4326","neu"),new is("urn:ogc:def:crs:OGC:1.3:CRS84"),new is("urn:ogc:def:crs:OGC:2:84"),new is("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new is("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new is("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Ac={};function Q0(n){return Ac[n]||Ac[n.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function t_(n,t){Ac[n]=t}let $s={};function ns(n,t,e){const i=n.getCode(),s=t.getCode();i in $s||($s[i]={}),$s[i][s]=e}function Dc(n,t){return n in $s&&t in $s[n]?$s[n][t]:null}const Ta=.9996,Be=.00669438,Ma=Be*Be,Aa=Ma*Be,ss=Be/(1-Be),wf=Math.sqrt(1-Be),Xs=(1-wf)/(1+wf),xf=Xs*Xs,Fc=xf*Xs,Lc=Fc*Xs,Ef=Lc*Xs,Cf=1-Be/4-3*Ma/64-5*Aa/256,e_=3*Be/8+3*Ma/32+45*Aa/1024,i_=15*Ma/256+45*Aa/1024,n_=35*Aa/3072,s_=3/2*Xs-27/32*Fc+269/512*Ef,r_=21/16*xf-55/32*Lc,o_=151/96*Fc-417/128*Ef,a_=1097/512*Lc,Da=6378137;function l_(n,t,e){const i=n-5e5,o=(e.north?t:t-1e7)/Ta/(Da*Cf),a=o+s_*Math.sin(2*o)+r_*Math.sin(4*o)+o_*Math.sin(6*o)+a_*Math.sin(8*o),l=Math.sin(a),c=l*l,h=Math.cos(a),u=l/h,d=u*u,g=d*d,p=1-Be*c,m=Math.sqrt(1-Be*c),_=Da/m,v=(1-Be)/p,y=ss*h**2,w=y*y,x=i/(_*Ta),C=x*x,P=C*x,b=P*x,R=b*x,I=R*x,S=a-u/v*(C/2-b/24*(5+3*d+10*y-4*w-9*ss))+I/720*(61+90*d+298*y+45*g-252*ss-3*w);let F=(x-P/6*(1+2*d+y)+R/120*(5-2*y+28*d-3*w+8*ss+24*g))/h;return F=Rc(F+En(Rf(e.number)),-Math.PI,Math.PI),[cf(F),cf(S)]}const bf=-80,Pf=84,c_=-180,h_=180;function u_(n,t,e){n=Rc(n,c_,h_),t<bf?t=bf:t>Pf&&(t=Pf);const i=En(t),s=Math.sin(i),r=Math.cos(i),o=s/r,a=o*o,l=a*a,c=En(n),h=Rf(e.number),u=En(h),d=Da/Math.sqrt(1-Be*s**2),g=ss*r**2,p=r*Rc(c-u,-Math.PI,Math.PI),m=p*p,_=m*p,v=_*p,y=v*p,w=y*p,x=Da*(Cf*i-e_*Math.sin(2*i)+i_*Math.sin(4*i)-n_*Math.sin(6*i)),C=Ta*d*(p+_/6*(1-a+g)+y/120*(5-18*a+l+72*g-58*ss))+5e5;let P=Ta*(x+d*o*(m/2+v/24*(5-a+9*g+4*g**2)+w/720*(61-58*a+l+600*g-330*ss)));return e.north||(P+=1e7),[C,P]}function Rf(n){return(n-1)*6-180+3}const d_=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function If(n){let t=0;for(const s of d_){const r=n.match(s);if(r){t=parseInt(r[1]);break}}if(!t)return null;let e=0,i=!1;return t>32700&&t<32761?e=t-32700:t>32600&&t<32661&&(i=!0,e=t-32600),e?{number:e,north:i}:null}function Sf(n,t){return function(e,i,s,r){const o=e.length;s=s>1?s:2,r=r??s,i||(s>2?i=e.slice():i=new Array(o));for(let a=0;a<o;a+=r){const l=e[a],c=e[a+1],h=n(l,c,t);i[a]=h[0],i[a+1]=h[1]}return i}}function f_(n){return If(n)?new Or({code:n,units:"m"}):null}function g_(n){const t=If(n.getCode());return t?{forward:Sf(u_,t),inverse:Sf(l_,t)}:null}const p_=[g_],m_=[f_];let Oc=!0;function Tf(n){Oc=!1}function zc(n,t){if(t!==void 0){for(let e=0,i=n.length;e<i;++e)t[e]=n[e];t=t}else t=n.slice();return t}function Fa(n){t_(n.getCode(),n),ns(n,n,zc)}function y_(n){n.forEach(Fa)}function mt(n){if(typeof n!="string")return n;const t=Q0(n);if(t)return t;for(const e of m_){const i=e(n);if(i)return i}return null}function Mf(n,t,e,i){n=mt(n);let s;const r=n.getPointResolutionFunc();if(r)s=r(t,e);else{const o=n.getUnits();if(o=="degrees"&&!i||i=="degrees")s=t;else{const a=kr(n,mt("EPSG:4326"));if(!a&&o!=="degrees")s=t*n.getMetersPerUnit();else{let c=[e[0]-t/2,e[1],e[0]+t/2,e[1],e[0],e[1]-t/2,e[0],e[1]+t/2];c=a(c,c,2);const h=Ic(c.slice(0,2),c.slice(2,4)),u=Ic(c.slice(4,6),c.slice(6,8));s=(h+u)/2}const l=n.getMetersPerUnit();l!==void 0&&(s/=l)}}return s}function Af(n){y_(n),n.forEach(function(t){n.forEach(function(e){t!==e&&ns(t,e,zc)})})}function __(n,t,e,i){n.forEach(function(s){t.forEach(function(r){ns(s,r,e),ns(r,s,i)})})}function kc(n,t){return n?typeof n=="string"?mt(n):n:mt(t)}function Nc(n){return(function(t,e,i,s){const r=t.length;i=i!==void 0?i:2,s=s??i,e=e!==void 0?e:new Array(r);for(let o=0;o<r;o+=s){const a=n(t.slice(o,o+i)),l=a.length;for(let c=0,h=s;c<h;++c)e[o+c]=c>=l?t[o+c]:a[c]}return e})}function Df(n,t,e,i){const s=mt(n),r=mt(t);ns(s,r,Nc(e)),ns(r,s,Nc(i))}function dt(n,t){return Tf(),Mi(n,"EPSG:4326",t!==void 0?t:"EPSG:3857")}function ae(n,t){const e=Mi(n,t!==void 0?t:"EPSG:3857","EPSG:4326"),i=e[0];return(i<-180||i>180)&&(e[0]=Cn(i+180,360)-180),e}function ye(n,t){if(n===t)return!0;const e=n.getUnits()===t.getUnits();return(n.getCode()===t.getCode()||kr(n,t)===zc)&&e}function kr(n,t){const e=n.getCode(),i=t.getCode();let s=Dc(e,i);if(s)return s;let r=null,o=null;for(const l of p_)r||(r=l(n)),o||(o=l(t));if(!r&&!o)return null;const a="EPSG:4326";if(o)if(r)s=Gc(r.inverse,o.forward);else{const l=Dc(e,a);l&&(s=Gc(l,o.forward))}else{const l=Dc(a,i);l&&(s=Gc(r.inverse,l))}return s&&(Fa(n),Fa(t),ns(n,t,s)),s}function Gc(n,t){return function(e,i,s,r){return i=n(e,i,s,r),t(i,i,s,r)}}function Ki(n,t){const e=mt(n),i=mt(t);return kr(e,i)}function Mi(n,t,e){const i=Ki(t,e);if(!i){const s=mt(t).getCode(),r=mt(e).getCode();throw new Error(`No transform available between ${s} and ${r}`)}return i(n,void 0,n.length)}function Nr(n,t,e,i){const s=Ki(t,e);return of(n,s,void 0,i)}let v_=null;function w_(){return v_}function Vc(n,t){return n}function Ji(n,t){return Oc&&!Ra(n,[0,0])&&n[0]>=-180&&n[0]<=180&&n[1]>=-90&&n[1]<=90&&(Oc=!1,pf("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),n}function Wc(n,t){return n}function Ai(n,t){return n}function x_(){Af(yf),Af(vf),__(vf,yf,j0,q0)}x_();function Et(n,t){if(!n)throw new Error(t)}const Ff=new Array(6);function xe(){return[1,0,0,1,0,0]}function Lf(n){return Uc(n,1,0,0,1,0,0)}function La(n,t){const e=n[0],i=n[1],s=n[2],r=n[3],o=n[4],a=n[5],l=t[0],c=t[1],h=t[2],u=t[3],d=t[4],g=t[5];return n[0]=e*l+s*c,n[1]=i*l+r*c,n[2]=e*h+s*u,n[3]=i*h+r*u,n[4]=e*d+s*g+o,n[5]=i*d+r*g+a,n}function Uc(n,t,e,i,s,r,o){return n[0]=t,n[1]=e,n[2]=i,n[3]=s,n[4]=r,n[5]=o,n}function E_(n,t){return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n}function Yt(n,t){const e=t[0],i=t[1];return t[0]=n[0]*e+n[2]*i+n[4],t[1]=n[1]*e+n[3]*i+n[5],t}function $c(n,t,e){return La(n,Uc(Ff,t,0,0,e,0,0))}function C_(n,t,e){return La(n,Uc(Ff,1,0,0,1,t,e))}function ui(n,t,e,i,s,r,o,a){const l=Math.sin(r),c=Math.cos(r);return n[0]=i*c,n[1]=s*l,n[2]=-i*l,n[3]=s*c,n[4]=o*i*c-a*i*l+t,n[5]=o*s*l+a*s*c+e,n}function Of(n,t){const e=b_(t);Et(e!==0,"Transformation matrix cannot be inverted");const i=t[0],s=t[1],r=t[2],o=t[3],a=t[4],l=t[5];return n[0]=o/e,n[1]=-s/e,n[2]=-r/e,n[3]=i/e,n[4]=(r*l-o*a)/e,n[5]=-(i*l-s*a)/e,n}function b_(n){return n[0]*n[3]-n[1]*n[2]}const P_=[1e5,1e5,1e5,1e5,2,2];function R_(n){return"matrix("+n.join(", ")+")"}function Xc(n){return n.substring(7,n.length-1).split(",").map(parseFloat)}function I_(n,t){const e=Xc(n),i=Xc(t);for(let s=0;s<6;++s)if(Math.round((e[s]-i[s])*P_[s])!==0)return!1;return!0}function Di(n,t,e,i,s,r,o){r=r||[],o=o||2;let a=0;for(let l=t;l<e;l+=i){const c=n[l],h=n[l+1];r[a++]=s[0]*c+s[2]*h+s[4],r[a++]=s[1]*c+s[3]*h+s[5];for(let u=2;u<o;u++)r[a++]=n[l+u]}return r&&r.length!=a&&(r.length=a),r}function zf(n,t,e,i,s,r,o){o=o||[];const a=Math.cos(s),l=Math.sin(s),c=r[0],h=r[1];let u=0;for(let d=t;d<e;d+=i){const g=n[d]-c,p=n[d+1]-h;o[u++]=c+g*a-p*l,o[u++]=h+g*l+p*a;for(let m=d+2;m<d+i;++m)o[u++]=n[m]}return o&&o.length!=u&&(o.length=u),o}function S_(n,t,e,i,s,r,o,a){a=a||[];const l=o[0],c=o[1];let h=0;for(let u=t;u<e;u+=i){const d=n[u]-l,g=n[u+1]-c;a[h++]=l+s*d,a[h++]=c+r*g;for(let p=u+2;p<u+i;++p)a[h++]=n[p]}return a&&a.length!=h&&(a.length=h),a}function T_(n,t,e,i,s,r,o){o=o||[];let a=0;for(let l=t;l<e;l+=i){o[a++]=n[l]+s,o[a++]=n[l+1]+r;for(let c=l+2;c<l+i;++c)o[a++]=n[c]}return o&&o.length!=a&&(o.length=a),o}const kf=xe(),M_=[NaN,NaN];class Nf extends Ti{constructor(){super(),this.extent_=ze(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=ff((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const s=this.clone();return s.applyTransform(i),s.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return et()}closestPointXY(t,e,i,s){return et()}containsXY(t,e){return this.closestPointXY(t,e,M_,Number.MIN_VALUE)===0}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return et()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&Ns(e),this.extentRevision_=this.getRevision()}return L0(this.extent_,t)}rotate(t,e){et()}scale(t,e,i){et()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return et()}getType(){return et()}applyTransform(t){et()}intersectsExtent(t){return et()}translate(t,e){et()}transform(t,e){const i=mt(t),s=i.getUnits()=="tile-pixels"?function(r,o,a){const l=i.getExtent(),c=i.getWorldExtent(),h=Vt(c)/Vt(l);ui(kf,c[0],c[3],h,-h,0,0,0);const u=Di(r,0,r.length,a,kf,o),d=Ki(i,e);return d?d(u,u,a):u}:Ki(i,e);return this.applyTransform(s),this}}class rs extends Nf{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return bc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return et()}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=Gf(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){et()}setLayout(t,e,i){let s;if(t)s=Gf(t);else{for(let r=0;r<i;++r){if(e.length===0){this.layout="XY",this.stride=2;return}e=e[0]}s=e.length,t=os(s)}this.layout=t,this.stride=s}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const s=this.getStride();zf(i,0,i.length,s,t,e,i),this.changed()}}scale(t,e,i){e===void 0&&(e=t),i||(i=He(this.getExtent()));const s=this.getFlatCoordinates();if(s){const r=this.getStride();S_(s,0,s.length,r,t,e,i,s),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const s=this.getStride();T_(i,0,i.length,s,t,e,i),this.changed()}}}function os(n){let t;return n==2?t="XY":n==3?t="XYZ":n==4&&(t="XYZM"),t}function Gf(n){let t;return n=="XY"?t=2:n=="XYZ"||n=="XYM"?t=3:n=="XYZM"&&(t=4),t}function A_(n,t,e){const i=n.getFlatCoordinates();if(!i)return null;const s=n.getStride();return Di(i,0,i.length,s,t,e)}function Vf(n,t,e,i){let s=0;const r=n[e-i],o=n[e-i+1];let a=0,l=0;for(;t<e;t+=i){const c=n[t]-r,h=n[t+1]-o;s+=l*c-a*h,a=c,l=h}return s/2}function Wf(n,t,e,i){let s=0;for(let r=0,o=e.length;r<o;++r){const a=e[r];s+=Vf(n,t,a,i),t=a}return s}function D_(n,t,e,i){let s=0;for(let r=0,o=e.length;r<o;++r){const a=e[r];s+=Wf(n,t,a,i),t=a[a.length-1]}return s}function Uf(n,t,e,i,s,r,o){const a=n[t],l=n[t+1],c=n[e]-a,h=n[e+1]-l;let u;if(c===0&&h===0)u=t;else{const d=((s-a)*c+(r-l)*h)/(c*c+h*h);if(d>1)u=e;else if(d>0){for(let g=0;g<i;++g)o[g]=ke(n[t+g],n[e+g],d);o.length=i;return}else u=t}for(let d=0;d<i;++d)o[d]=n[u+d];o.length=i}function Yc(n,t,e,i,s){let r=n[t],o=n[t+1];for(t+=i;t<e;t+=i){const a=n[t],l=n[t+1],c=es(r,o,a,l);c>s&&(s=c),r=a,o=l}return s}function Hc(n,t,e,i,s){for(let r=0,o=e.length;r<o;++r){const a=e[r];s=Yc(n,t,a,i,s),t=a}return s}function F_(n,t,e,i,s){for(let r=0,o=e.length;r<o;++r){const a=e[r];s=Hc(n,t,a,i,s),t=a[a.length-1]}return s}function Bc(n,t,e,i,s,r,o,a,l,c,h){if(t==e)return c;let u,d;if(s===0){if(d=es(o,a,n[t],n[t+1]),d<c){for(u=0;u<i;++u)l[u]=n[t+u];return l.length=i,d}return c}h=h||[NaN,NaN];let g=t+i;for(;g<e;)if(Uf(n,g-i,g,i,o,a,h),d=es(o,a,h[0],h[1]),d<c){for(c=d,u=0;u<i;++u)l[u]=h[u];l.length=i,g+=i}else g+=i*Math.max((Math.sqrt(d)-Math.sqrt(c))/s|0,1);if(r&&(Uf(n,e-i,t,i,o,a,h),d=es(o,a,h[0],h[1]),d<c)){for(c=d,u=0;u<i;++u)l[u]=h[u];l.length=i}return c}function Zc(n,t,e,i,s,r,o,a,l,c,h){h=h||[NaN,NaN];for(let u=0,d=e.length;u<d;++u){const g=e[u];c=Bc(n,t,g,i,s,r,o,a,l,c,h),t=g}return c}function L_(n,t,e,i,s,r,o,a,l,c,h){h=h||[NaN,NaN];for(let u=0,d=e.length;u<d;++u){const g=e[u];c=Zc(n,t,g,i,s,r,o,a,l,c,h),t=g[g.length-1]}return c}function O_(n,t,e,i){for(let s=0,r=e.length;s<r;++s)n[t++]=e[s];return t}function Oa(n,t,e,i){for(let s=0,r=e.length;s<r;++s){const o=e[s];for(let a=0;a<i;++a)n[t++]=o[a]}return t}function Gr(n,t,e,i,s){s=s||[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=Oa(n,t,e[o],i);s[r++]=l,t=l}return s.length=r,s}function $f(n,t,e,i,s){s=s||[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=Gr(n,t,e[o],i,s[r]);l.length===0&&(l[0]=t),s[r++]=l,t=l[l.length-1]}return s.length=r,s}function Rn(n,t,e,i,s){s=s!==void 0?s:[];let r=0;for(let o=t;o<e;o+=i)s[r++]=n.slice(o,o+i);return s.length=r,s}function Vr(n,t,e,i,s){s=s!==void 0?s:[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];s[r++]=Rn(n,t,l,i,s[r]),t=l}return s.length=r,s}function jc(n,t,e,i,s){s=s!==void 0?s:[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];s[r++]=l.length===1&&l[0]===t?[]:Vr(n,t,l,i,s[r]),t=l[l.length-1]}return s.length=r,s}function za(n,t,e,i,s,r,o){const a=(e-t)/i;if(a<3){for(;t<e;t+=i)r[o++]=n[t],r[o++]=n[t+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const c=[t,e-i];let h=0;for(;c.length>0;){const u=c.pop(),d=c.pop();let g=0;const p=n[d],m=n[d+1],_=n[u],v=n[u+1];for(let y=d+i;y<u;y+=i){const w=n[y],x=n[y+1],C=k0(w,x,p,m,_,v);C>g&&(h=y,g=C)}g>s&&(l[(h-t)/i]=1,d+i<h&&c.push(d,h),h+i<u&&c.push(h,u))}for(let u=0;u<a;++u)l[u]&&(r[o++]=n[t+u*i],r[o++]=n[t+u*i+1]);return o}function Xf(n,t,e,i,s,r,o,a){for(let l=0,c=e.length;l<c;++l){const h=e[l];o=za(n,t,h,i,s,r,o),a.push(o),t=h}return o}function as(n,t){return t*Math.round(n/t)}function z_(n,t,e,i,s,r,o){if(t==e)return o;let a=as(n[t],s),l=as(n[t+1],s);t+=i,r[o++]=a,r[o++]=l;let c,h;do if(c=as(n[t],s),h=as(n[t+1],s),t+=i,t==e)return r[o++]=c,r[o++]=h,o;while(c==a&&h==l);for(;t<e;){const u=as(n[t],s),d=as(n[t+1],s);if(t+=i,u==c&&d==h)continue;const g=c-a,p=h-l,m=u-a,_=d-l;if(g*_==p*m&&(g<0&&m<g||g==m||g>0&&m>g)&&(p<0&&_<p||p==_||p>0&&_>p)){c=u,h=d;continue}r[o++]=c,r[o++]=h,a=c,l=h,c=u,h=d}return r[o++]=c,r[o++]=h,o}function qc(n,t,e,i,s,r,o,a){for(let l=0,c=e.length;l<c;++l){const h=e[l];o=z_(n,t,h,i,s,r,o),a.push(o),t=h}return o}function k_(n,t,e,i,s,r,o,a){for(let l=0,c=e.length;l<c;++l){const h=e[l],u=[];o=qc(n,t,h,i,s,r,o,u),a.push(u),t=h[h.length-1]}return o}class Wr extends rs{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 Wr(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,s){return s<Qn(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Yc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Bc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,s))}getArea(){return Vf(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Rn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=za(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new Wr(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Oa(this.flatCoordinates,0,t,this.stride),this.changed()}}class Ne extends rs{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new Ne(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,s){const r=this.flatCoordinates,o=es(t,e,r[0],r[1]);if(o<s){const a=this.stride;for(let l=0;l<a;++l)i[l]=r[l];return i.length=a,o}return s}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return tf(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return Ec(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=O_(this.flatCoordinates,0,t,this.stride),this.changed()}}function N_(n,t,e,i,s){return!sf(s,function(o){return!ls(n,t,e,i,o[0],o[1])})}function ls(n,t,e,i,s,r){let o=0,a=n[e-i],l=n[e-i+1];for(;t<e;t+=i){const c=n[t],h=n[t+1];l<=r?h>r&&(c-a)*(r-l)-(s-a)*(h-l)>0&&o++:h<=r&&(c-a)*(r-l)-(s-a)*(h-l)<0&&o--,a=c,l=h}return o!==0}function Kc(n,t,e,i,s,r){if(e.length===0||!ls(n,t,e[0],i,s,r))return!1;for(let o=1,a=e.length;o<a;++o)if(ls(n,e[o-1],e[o],i,s,r))return!1;return!0}function G_(n,t,e,i,s,r){if(e.length===0)return!1;for(let o=0,a=e.length;o<a;++o){const l=e[o];if(Kc(n,t,l,i,s,r))return!0;t=l[l.length-1]}return!1}function Jc(n,t,e,i,s,r,o){let a,l,c,h,u,d,g;const p=s[r+1],m=[];for(let y=0,w=e.length;y<w;++y){const x=e[y];for(h=n[x-i],d=n[x-i+1],a=t;a<x;a+=i)u=n[a],g=n[a+1],(p<=d&&g<=p||d<=p&&p<=g)&&(c=(p-d)/(g-d)*(u-h)+h,m.push(c)),h=u,d=g}let _=NaN,v=-1/0;for(m.sort(Pi),h=m[0],a=1,l=m.length;a<l;++a){u=m[a];const y=Math.abs(u-h);y>v&&(c=(h+u)/2,Kc(n,t,e,i,c,p)&&(_=c,v=y)),h=u}return isNaN(_)&&(_=s[r]),o?(o.push(_,p,v),o):[_,p,v]}function Yf(n,t,e,i,s){let r=[];for(let o=0,a=e.length;o<a;++o){const l=e[o];r=Jc(n,t,l,i,s,2*o,r),t=l[l.length-1]}return r}function Hf(n,t,e,i,s){let r;for(t+=i;t<e;t+=i)if(r=s(n.slice(t-i,t),n.slice(t,t+i)),r)return r;return!1}function ka(n,t,e,i,s,r){return r=r??nf(ze(),n,t,e,i),Wt(s,r)?r[0]>=s[0]&&r[2]<=s[2]||r[1]>=s[1]&&r[3]<=s[3]?!0:Hf(n,t,e,i,function(o,a){return z0(s,o,a)}):!1}function V_(n,t,e,i,s){for(let r=0,o=e.length;r<o;++r){if(ka(n,t,e[r],i,s))return!0;t=e[r]}return!1}function Bf(n,t,e,i,s){return!!(ka(n,t,e,i,s)||ls(n,t,e,i,s[0],s[1])||ls(n,t,e,i,s[0],s[3])||ls(n,t,e,i,s[2],s[1])||ls(n,t,e,i,s[2],s[3]))}function Zf(n,t,e,i,s){if(!Bf(n,t,e[0],i,s))return!1;if(e.length===1)return!0;for(let r=1,o=e.length;r<o;++r)if(N_(n,e[r-1],e[r],i,s)&&!ka(n,e[r-1],e[r],i,s))return!1;return!0}function W_(n,t,e,i,s){for(let r=0,o=e.length;r<o;++r){const a=e[r];if(Zf(n,t,a,i,s))return!0;t=a[a.length-1]}return!1}function U_(n,t,e,i){for(;t<e-i;){for(let s=0;s<i;++s){const r=n[t+s];n[t+s]=n[e-i+s],n[e-i+s]=r}t+=i,e-=i}}function Qc(n,t,e,i){let s=0,r=n[e-i],o=n[e-i+1];for(;t<e;t+=i){const a=n[t],l=n[t+1];s+=(a-r)*(l+o),r=a,o=l}return s===0?void 0:s>0}function th(n,t,e,i,s){s=s!==void 0?s:!1;for(let r=0,o=e.length;r<o;++r){const a=e[r],l=Qc(n,t,a,i);if(r===0){if(s&&l||!s&&!l)return!1}else if(s&&!l||!s&&l)return!1;t=a}return!0}function jf(n,t,e,i,s){for(let r=0,o=e.length;r<o;++r){const a=e[r];if(!th(n,t,a,i,s))return!1;a.length&&(t=a[a.length-1])}return!0}function Na(n,t,e,i,s){s=s!==void 0?s:!1;for(let r=0,o=e.length;r<o;++r){const a=e[r],l=Qc(n,t,a,i);(r===0?s&&l||!s&&!l:s&&!l||!s&&l)&&U_(n,t,a,i),t=a}return t}function eh(n,t,e,i,s){for(let r=0,o=e.length;r<o;++r)t=Na(n,t,e[r],i,s);return t}function qf(n,t){const e=[];let i=0,s=0,r;for(let o=0,a=t.length;o<a;++o){const l=t[o],c=Qc(n,i,l,2);if(r===void 0&&(r=c),c===r)e.push(t.slice(s,o+1));else{if(e.length===0)continue;e[e.length-1].push(t[s])}s=o+1,i=l}return e}class di extends rs{constructor(t,e,i){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,e!==void 0&&i?(this.setFlatCoordinates(e,t),this.ends_=i):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?Ri(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new di(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,s){return s<Qn(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Hc(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Zc(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,s))}containsXY(t,e){return Kc(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return Wf(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),Na(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,Vr(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=He(this.getExtent());this.flatInteriorPoint_=Jc(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Ne(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new Wr(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,s=[];let r=0;for(let o=0,a=i.length;o<a;++o){const l=i[o],c=new Wr(e.slice(r,l),t);s.push(c),r=l}return s}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;th(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Na(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=qc(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new di(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return Zf(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=Gr(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}}function ih(n){if(qi(n))throw new Error("Cannot create polygon from empty extent");const t=n[0],e=n[1],i=n[2],s=n[3],r=[t,e,t,s,i,s,i,e,t,e];return new di(r,"XY",[r.length])}const Me={ADD:"add",REMOVE:"remove"},Kf={LENGTH:"length"};class Ga extends hi{constructor(t,e,i){super(t),this.element=e,this.index=i}}class Ze extends Ti{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t??[],this.unique_)for(let i=1,s=this.array_.length;i<s;++i)this.assertUnique_(this.array_[i],i);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,i=t.length;e<i;++e)this.push(t[e]);return this}forEach(t){const e=this.array_;for(let i=0,s=e.length;i<s;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(Kf.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 Ga(Me.ADD,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,s=e.length;i<s;++i)if(e[i]===t)return this.removeAt(i)}removeAt(t){if(t<0||t>=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new Ga(Me.REMOVE,e,t)),e}setAt(t,e){const i=this.getLength();if(t>=i){this.insertAt(t,e);return}if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const s=this.array_[t];this.array_[t]=e,this.dispatchEvent(new Ga(Me.REMOVE,s,t)),this.dispatchEvent(new Ga(Me.ADD,e,t))}updateLength_(){this.set(Kf.LENGTH,this.array_.length)}assertUnique_(t,e){const i=this.array_;for(let s=0,r=i.length;s<r;++s)if(i[s]===t&&s!==e)throw new Error("Duplicate item added to a unique collection")}}class je extends Ti{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 i=this.getStyle();return i&&t.setStyle(i),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(Lt(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=wt(t,Q.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?$_(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 $_(n){if(typeof n=="function")return n;let t;return Array.isArray(n)?t=n:(Et(typeof n.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),t=[n]),function(){return t}}function Va(n,t,e,i,s,r,o){let a,l;const c=(e-t)/i;if(c===1)a=t;else if(c===2)a=t,l=s;else if(c!==0){let h=n[t],u=n[t+1],d=0;const g=[0];for(let _=t+i;_<e;_+=i){const v=n[_],y=n[_+1];d+=Math.sqrt((v-h)*(v-h)+(y-u)*(y-u)),g.push(d),h=v,u=y}const p=s*d,m=I0(g,p);m<0?(l=(p-g[-m-2])/(g[-m-1]-g[-m-2]),a=t+(-m-2)*i):a=t+m*i}o=o>1?o:2,r=r||new Array(o);for(let h=0;h<o;++h)r[h]=a===void 0?NaN:l===void 0?n[a+h]:ke(n[a+h],n[a+i+h],l);return r}function nh(n,t,e,i,s,r){if(e==t)return null;let o;if(s<n[t+i-1])return r?(o=n.slice(t,t+i),o[i-1]=s,o):null;if(n[e-1]<s)return r?(o=n.slice(e-i,e),o[i-1]=s,o):null;if(s==n[t+i-1])return n.slice(t,t+i);let a=t/i,l=e/i;for(;a<l;){const d=a+l>>1;s<n[(d+1)*i-1]?l=d:a=d+1}const c=n[a*i-1];if(s==c)return n.slice((a-1)*i,(a-1)*i+i);const h=n[(a+1)*i-1],u=(s-c)/(h-c);o=[];for(let d=0;d<i-1;++d)o.push(ke(n[(a-1)*i+d],n[a*i+d],u));return o.push(s),o}function X_(n,t,e,i,s,r,o){if(o)return nh(n,t,e[e.length-1],i,s,r);let a;if(s<n[i-1])return r?(a=n.slice(0,i),a[i-1]=s,a):null;if(n[n.length-1]<s)return r?(a=n.slice(n.length-i),a[i-1]=s,a):null;for(let l=0,c=e.length;l<c;++l){const h=e[l];if(t!=h){if(s<n[t+i-1])return null;if(s<=n[h-1])return nh(n,t,h,i,s,!1);t=h}}return null}function sh(n,t,e,i){let s=n[t],r=n[t+1],o=0;for(let a=t+i;a<e;a+=i){const l=n[a],c=n[a+1];o+=Math.sqrt((l-s)*(l-s)+(c-r)*(c-r)),s=l,r=c}return o}class fi extends rs{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){Ri(this.flatCoordinates,t),this.changed()}clone(){const t=new fi(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,s){return s<Qn(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Yc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Bc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,i,s))}forEachSegment(t){return Hf(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,nh(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return Rn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return Va(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return sh(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){const e=[];return e.length=za(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new fi(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return ka(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,this.getExtent())}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Oa(this.flatCoordinates,0,t,this.stride),this.changed()}}const qe={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"},cs=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"";cs.includes("safari")&&!cs.includes("chrom")&&(cs.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(cs));const Y_=cs.includes("webkit")&&!cs.includes("edge"),Jf=cs.includes("macintosh"),H_=typeof devicePixelRatio<"u"?devicePixelRatio:1,Ae=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,rh=typeof Image<"u"&&Image.prototype.decode,Qf=typeof createImageBitmap=="function",tg=(function(){let n=!1;try{const t=Object.defineProperty({},"passive",{get:function(){n=!0}});globalThis.addEventListener("_",null,t),globalThis.removeEventListener("_",null,t)}catch{}return n})(),Y={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function Nt(n,t,e,i){let s;return e&&e.length?s=e.shift():Ae?s=new class extends OffscreenCanvas{constructor(){super(...arguments);E(this,"style",{})}}(n??300,t??150):s=document.createElement("canvas"),n&&(s.width=n),t&&(s.height=t),s.getContext("2d",i)}let oh;function Wa(){return oh||(oh=Nt(1,1)),oh}function Ur(n){const t=n.canvas;t.width=1,t.height=1,n.clearRect(0,0,1,1)}function eg(n,t){const e=t.parentNode;e&&e.replaceChild(n,t)}function B_(n){for(;n.lastChild;)n.lastChild.remove()}function Z_(n,t){const e=n.childNodes;for(let i=0;;++i){const s=e[i],r=t[i];if(!s&&!r)break;if(s!==r){if(!s){n.appendChild(r);continue}if(!r){n.removeChild(s),--i;continue}n.insertBefore(r,s)}}}function ig(){return new Proxy({childNodes:[],appendChild:function(t){return this.childNodes.push(t),t},remove:function(){},removeChild:function(t){const e=this.childNodes.indexOf(t);if(e===-1)throw new Error("Node to remove was not found");return this.childNodes.splice(e,1),t},insertBefore:function(t,e){const i=this.childNodes.indexOf(e);if(i===-1)throw new Error("Reference node not found");return this.childNodes.splice(i,0,t),t},style:{}},{get(t,e,i){return e==="firstElementChild"?t.childNodes.length>0?t.childNodes[0]:null:Reflect.get(t,e,i)}})}function In(n){return typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas}const ah=[NaN,NaN,NaN,0];let lh;function j_(){return lh||(lh=Nt(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),lh}const q_=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,K_=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,J_=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Q_=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function Ua(n,t){return n.endsWith("%")?Number(n.substring(0,n.length-1))/t:Number(n)}function $r(n){throw new Error('failed to parse "'+n+'" as color')}function ng(n){if(n.toLowerCase().startsWith("rgb")){const r=n.match(K_)||n.match(q_)||n.match(J_);if(r){const o=r[4],a=100/255;return[kt(Ua(r[1],a)+.5|0,0,255),kt(Ua(r[2],a)+.5|0,0,255),kt(Ua(r[3],a)+.5|0,0,255),o!==void 0?kt(Ua(o,100),0,1):1]}$r(n)}if(n.startsWith("#")){if(Q_.test(n)){const r=n.substring(1),o=r.length<=4?1:2,a=[0,0,0,255];for(let l=0,c=r.length;l<c;l+=o){let h=parseInt(r.substring(l,l+o),16);o===1&&(h+=h<<4),a[l/o]=h}return a[3]=a[3]/255,a}$r(n)}const t=j_();t.fillStyle="#abcdef";let e=t.fillStyle;t.fillStyle=n,t.fillStyle===e&&(t.fillStyle="#fedcba",e=t.fillStyle,t.fillStyle=n,t.fillStyle===e&&$r(n));const i=t.fillStyle;if(i.startsWith("#")||i.startsWith("rgba"))return ng(i);t.clearRect(0,0,1,1),t.fillRect(0,0,1,1);const s=Array.from(t.getImageData(0,0,1,1).data);return s[3]=Sr(s[3]/255,3),s}function tv(n){return typeof n=="string"?n:gh(n)}const ev=1024,Xr={};let ch=0;function iv(n){if(n.length===4)return n;const t=n.slice();return t[3]=1,t}function hh(n){return n>.0031308?Math.pow(n,1/2.4)*269.025-14.025:n*3294.6}function uh(n){return n>.2068965?Math.pow(n,3):(n-4/29)*(108/841)}function dh(n){return n>10.314724?Math.pow((n+14.025)/269.025,2.4):n/3294.6}function fh(n){return n>.0088564?Math.pow(n,1/3):n/(108/841)+4/29}function sg(n){const t=dh(n[0]),e=dh(n[1]),i=dh(n[2]),s=fh(t*.222488403+e*.716873169+i*.06060791),r=500*(fh(t*.452247074+e*.399439023+i*.148375274)-s),o=200*(s-fh(t*.016863605+e*.117638439+i*.865350722)),a=Math.atan2(o,r)*(180/Math.PI);return[116*s-16,Math.sqrt(r*r+o*o),a<0?a+360:a,n[3]]}function nv(n){const t=(n[0]+16)/116,e=n[1],i=n[2]*Math.PI/180,s=uh(t),r=uh(t+e/500*Math.cos(i)),o=uh(t-e/200*Math.sin(i)),a=hh(r*3.021973625-s*1.617392459-o*.404875592),l=hh(r*-.943766287+s*1.916279586+o*.027607165),c=hh(r*.069407491-s*.22898585+o*1.159737864);return[kt(a+.5|0,0,255),kt(l+.5|0,0,255),kt(c+.5|0,0,255),n[3]]}function $a(n){if(n==="none")return ah;if(Xr.hasOwnProperty(n))return Xr[n];if(ch>=ev){let e=0;for(const i in Xr)(e++&3)===0&&(delete Xr[i],--ch)}const t=ng(n);t.length!==4&&$r(n);for(const e of t)isNaN(e)&&$r(n);return Xr[n]=t,++ch,t}function hs(n){return Array.isArray(n)?n:$a(n)}function gh(n){let t=n[0];t!=(t|0)&&(t=t+.5|0);let e=n[1];e!=(e|0)&&(e=e+.5|0);let i=n[2];i!=(i|0)&&(i=i+.5|0);const s=n[3]===void 0?1:Math.round(n[3]*1e3)/1e3;return"rgba("+t+","+e+","+i+","+s+")"}class Xa extends Fr{constructor(t,e,i,s){super(),this.extent=t,this.pixelRatio_=i,this.resolution=e,this.state=typeof s=="function"?Y.IDLE:s,this.image_=null,this.loader=typeof s=="function"?s:null}changed(){this.dispatchEvent(Q.CHANGE)}getExtent(){return this.extent}getImage(){return this.image_}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){if(this.state==Y.IDLE&&this.loader){this.state=Y.LOADING,this.changed();const t=this.getResolution(),e=Array.isArray(t)?t[0]:t;Vs(()=>this.loader(this.getExtent(),e,this.getPixelRatio())).then(i=>{"image"in i&&(this.image_=i.image),"extent"in i&&(this.extent=i.extent),"resolution"in i&&(this.resolution=i.resolution),"pixelRatio"in i&&(this.pixelRatio_=i.pixelRatio),(i instanceof HTMLImageElement||Qf&&i instanceof ImageBitmap||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement)&&(this.image_=i),this.state=Y.LOADED}).catch(i=>{this.state=Y.ERROR,console.error(i)}).finally(()=>this.changed())}}setImage(t){this.image_=t}setResolution(t){this.resolution=t}}function sv(n,t,e){const i=n;let s=!0,r=!1,o=!1;const a=[Pa(i,Q.LOAD,function(){o=!0,r||t()})];return i.src&&rh?(r=!0,i.decode().then(function(){s&&t()}).catch(function(l){s&&(o?t():e())})):a.push(Pa(i,Q.ERROR,e)),function(){s=!1,a.forEach(Lt)}}function rv(n,t){return new Promise((e,i)=>{function s(){o(),e(n)}function r(){o(),i(new Error("Image load error"))}function o(){n.removeEventListener("load",s),n.removeEventListener("error",r)}n.addEventListener("load",s),n.addEventListener("error",r)})}function rg(n,t){return t&&(n.src=t),n.src&&rh?new Promise((e,i)=>n.decode().then(()=>e(n)).catch(s=>n.complete&&n.width?e(n):i(s))):rv(n)}function og(n,t){return t&&(n.src=t),n.src&&rh&&Qf?n.decode().then(()=>createImageBitmap(n)).catch(e=>{if(n.complete&&n.width)return n;throw e}):rg(n)}class ov{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];(t++&3)===0&&!i.hasListener()&&(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e){const i=ph(t,e);return i in this.cache_?this.cache_[i]:null}getPattern(t,e){const i=ph(t,e);return i in this.patternCache_?this.patternCache_[i]:null}set(t,e,i,s){const r=ph(t,e),o=r in this.cache_;this.cache_[r]=i,s&&(i.getImageState()===Y.IDLE&&i.load(),i.getImageState()===Y.LOADING?i.ready().then(()=>{this.patternCache_[r]=Wa().createPattern(i.getImage(1),"repeat")}):this.patternCache_[r]=Wa().createPattern(i.getImage(1),"repeat")),o||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function ph(n,t){const e=t?hs(t):"null";return n+":"+e}const Ke=new ov;let Yr=null;class ag extends Fr{constructor(t,e,i,s,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i==null?void 0:i.crossOrigin,this.referrerPolicy_=i==null?void 0:i.referrerPolicy,this.canvas_={},this.color_=r,this.imageState_=s===void 0?Y.IDLE:s,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===Y.LOADED){Yr||(Yr=Nt(1,1,void 0,{willReadFrequently:!0})),Yr.drawImage(this.image_,0,0);try{Yr.getImageData(0,0,1,1),this.tainted_=!1}catch{Yr=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(Q.CHANGE)}handleImageError_(){this.imageState_=Y.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Y.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}setImage(t){this.image_=t}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=Nt(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===Y.IDLE){this.image_||this.initializeImage_(),this.imageState_=Y.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&rg(this.image_,this.src_).then(t=>{this.image_=t,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==Y.LOADED)return;const e=this.image_,i=Nt(Math.ceil(e.width*t),Math.ceil(e.height*t)),s=i.canvas;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle=tv(this.color_),i.fillRect(0,0,s.width/t,s.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=s}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(this.imageState_===Y.LOADED||this.imageState_===Y.ERROR)t();else{const e=()=>{(this.imageState_===Y.LOADED||this.imageState_===Y.ERROR)&&(this.removeEventListener(Q.CHANGE,e),t())};this.addEventListener(Q.CHANGE,e)}})),this.ready_}}function Hr(n,t,e,i,s,r){let o=t===void 0?void 0:Ke.get(t,s);return o||(o=new ag(n,n&&"src"in n?n.src||void 0:t,e,i,s),Ke.set(t,s,o,r)),r&&o&&!Ke.getPattern(t,s)&&Ke.set(t,s,o,r),o}function Fi(n){return n?Array.isArray(n)?gh(n):typeof n=="object"&&"src"in n?av(n):n:null}function av(n){if(!n.offset||!n.size)return Ke.getPattern(n.src,n.color);const t=n.src+":"+n.offset,e=Ke.getPattern(t,n.color);if(e)return e;const i=Ke.get(n.src,null);if(i.getImageState()!==Y.LOADED)return null;const s=Nt(n.size[0],n.size[1]);return s.drawImage(i.getImage(1),n.offset[0],n.offset[1],n.size[0],n.size[1],0,0,n.size[0],n.size[1]),Hr(s.canvas,t,void 0,Y.LOADED,n.color,!0),Ke.getPattern(t,n.color)}function lv(n,t,e,i,s,r){s=s??[],r=r??t;const o=n[0],a=n[1],l=n[n.length-4],c=n[n.length-3];let h,u,d,g,p,m,_,v,y=0;for(let w=0;w<n.length;w+=t){d=h,g=u,p=void 0,m=void 0,w+t<n.length&&(p=n[w+t],m=n[w+t+1]),i&&w===0&&(d=l,g=c),i&&w===n.length-2&&(p=o,m=a),h=n[w],u=n[w+1],[_,v]=Ya(h,u,d,g,p,m,e),s[y++]=_,s[y++]=v;for(let x=2;x<r;x++)s[y++]=n[w+x]}return s.length!=y&&(s.length=y),s}function Ya(n,t,e,i,s,r,o){let a,l;e!==void 0&&i!==void 0?(a=n-e,l=t-i):s!==void 0&&r!==void 0?(a=s-n,l=r-t):(a=1,l=0);const c=Math.hypot(a,l),h=a/c,u=l/c;if(a=-u,l=h,e===void 0||i===void 0)return[n+a*o,t+l*o];if(s===void 0||r===void 0)return[n+a*o,t+l*o];const d=H0([n,t],[e,i],[s,r]);if(Math.cos(d)>.998)return[n+h*o,t+u*o];const g=Math.cos(d/2),p=Math.sin(d/2),m=p*a+g*l,_=-g*a+p*l,v=m*(1/p),y=_*(1/p);return[n+v*o,t+y*o]}class lg{drawCustom(t,e,i,s,r){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}const Ha="ol-hidden",Ba="ol-unselectable",mh="ol-control",cg="ol-collapsed",cv=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z0-9]+?)\\s*$`].join(""),"i"),hg=["style","variant","weight","size","lineHeight","family"],yh={normal:400,bold:700},_h=function(n){const t=n.match(cv);if(!t)return null;const e={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let i=0,s=hg.length;i<s;++i){const r=t[i+1];r!==void 0&&(e[hg[i]]=typeof r=="string"?r.trim():r)}return isNaN(Number(e.weight))&&e.weight in yh&&(e.weight=yh[e.weight]),e.families=e.family.split(/,\s?/).map(i=>i.trim().replace(/^['"]|['"]$/g,"")),e},ug="10px sans-serif",De="#000",Ys="round",Qi=[],tn=0,Hs="round",Br=10,hv=0,Zr="#000",jr="center",Za="middle",us=[0,0,0,0],qr=1,ds=new Ti;let Kr=null,dg;const vh={},uv=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function dv(n,t,e){return`${n} ${t} 16px "${e}"`}const fv=(function(){let t,e;async function i(r){await e.ready;const o=await e.load(r);if(o.length===0)return!1;const a=_h(r),l=a.families[0].toLowerCase(),c=a.weight;return o.some(h=>{const u=h.family.replace(/^['"]|['"]$/g,"").toLowerCase(),d=yh[h.weight]||h.weight;return u===l&&h.style===a.style&&d==c})}async function s(){await e.ready;let r=!0;const o=ds.getProperties(),a=Object.keys(o).filter(l=>o[l]<100);for(let l=a.length-1;l>=0;--l){const c=a[l];let h=o[c];h<100&&(await i(c)?(Dr(vh),ds.set(c,100)):(h+=10,ds.set(c,h,!0),h<100&&(r=!1)))}t=void 0,r||(t=setTimeout(s,100))}return async function(r){e||(e=Ae?self.fonts:document.fonts);const o=_h(r);if(!o)return;const a=o.families;let l=!1;for(const c of a){if(uv.has(c))continue;const h=dv(o.style,o.weight,c);ds.get(h)===void 0&&(ds.set(h,0,!0),l=!0)}l&&(clearTimeout(t),t=setTimeout(s,100))}})(),gv=(function(){let n;return function(t){let e=vh[t];if(e==null){if(Ae){const i=_h(t),s=fg(t,"Žg");e=(isNaN(Number(i.lineHeight))?1.2:Number(i.lineHeight))*(s.actualBoundingBoxAscent+s.actualBoundingBoxDescent)}else n||(n=document.createElement("div"),n.innerHTML="M",n.style.minHeight="0",n.style.maxHeight="none",n.style.height="auto",n.style.padding="0",n.style.border="none",n.style.position="absolute",n.style.display="block",n.style.left="-99999px"),n.style.font=t,document.body.appendChild(n),e=n.offsetHeight,document.body.removeChild(n);vh[t]=e}return e}})();function fg(n,t){return Kr||(Kr=Nt(1,1)),n!=dg&&(Kr.font=n,dg=Kr.font),Kr.measureText(t)}function gg(n,t){return fg(n,t).width}function pg(n,t,e){if(t in e)return e[t];const i=t.split(`
|
|
22
|
+
`).reduce((s,r)=>Math.max(s,gg(n,r)),0);return e[t]=i,i}function pv(n,t){const e=[],i=[],s=[];let r=0,o=0,a=0,l=0;for(let c=0,h=t.length;c<=h;c+=2){const u=t[c];if(u===`
|
|
23
|
+
`||c===h){r=Math.max(r,o),s.push(o),o=0,a+=l,l=0;continue}const d=t[c+1]||n.font,g=gg(d,u);e.push(g),o+=g;const p=gv(d);i.push(p),l=Math.max(l,p)}return{width:r,height:a,widths:e,heights:i,lineWidths:s}}function mv(n,t,e,i,s,r,o,a,l,c,h){n.save(),e!==1&&(n.globalAlpha===void 0?n.globalAlpha=u=>u.globalAlpha*=e:n.globalAlpha*=e),t&&n.transform.apply(n,t),i.contextInstructions?(n.translate(l,c),n.scale(h[0],h[1]),yv(i,n)):h[0]<0||h[1]<0?(n.translate(l,c),n.scale(h[0],h[1]),n.drawImage(i,s,r,o,a,0,0,o,a)):n.drawImage(i,s,r,o,a,l,c,o*h[0],a*h[1]),n.restore()}function yv(n,t){const e=n.contextInstructions;for(let i=0,s=e.length;i<s;i+=2)Array.isArray(e[i+1])?t[e[i]].apply(t,e[i+1]):t[e[i]]=e[i+1]}class mg extends lg{constructor(t,e,i,s,r,o,a){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=s,this.transformRotation_=s?Sr(Math.atan2(s[1],s[0]),10):0,this.viewRotation_=r,this.squaredTolerance_=o,this.userTransform_=a,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=xe()}drawImages_(t,e,i,s){if(!this.image_)return;const r=Di(t,e,i,s,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=l*this.imageOpacity_);let c=this.imageRotation_;this.transformRotation_===0&&(c-=this.viewRotation_),this.imageRotateWithView_&&(c+=this.viewRotation_);for(let h=0,u=r.length;h<u;h+=2){const d=r[h]-this.imageAnchorX_,g=r[h+1]-this.imageAnchorY_;if(c!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const p=d+this.imageAnchorX_,m=g+this.imageAnchorY_;ui(a,p,m,1,1,c,-p,-m),o.save(),o.transform.apply(o,a),o.translate(p,m),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.restore()}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,d,g,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(t,e,i,s){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const r=Di(t,e,i,s,this.transform_,this.pixelCoordinates_),o=this.context_;let a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);e<i;e+=s){const l=r[e]+this.textOffsetX_,c=r[e+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.save(),o.translate(l-this.textOffsetX_,c-this.textOffsetY_),o.rotate(a),o.translate(this.textOffsetX_,this.textOffsetY_),o.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&o.strokeText(this.text_,0,0),this.textFillState_&&o.fillText(this.text_,0,0),o.restore()):(this.textStrokeState_&&o.strokeText(this.text_,l,c),this.textFillState_&&o.fillText(this.text_,l,c))}}moveToLineTo_(t,e,i,s,r,o){const a=this.context_;let l=Di(t,e,i,s,this.transform_,this.pixelCoordinates_);Math.abs(o)>0&&(l=lv(l,s,o,r,l)),a.moveTo(l[0],l[1]);let c=l.length;r&&(c-=2);for(let h=2;h<c;h+=2)a.lineTo(l[h],l[h+1]);return r&&a.closePath(),i}drawRings_(t,e,i,s,r){for(let o=0,a=i.length;o<a;++o)e=this.moveToLineTo_(t,e,i[o],s,!0,r);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Wt(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=A_(t,this.transform_,this.pixelCoordinates_),i=e[2]-e[0],s=e[3]-e[1],r=Math.sqrt(i*i+s*s),o=this.context_;o.beginPath(),o.arc(e[0],e[1],r,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}this.text_!==""&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t);break}}drawFeature(t,e){const i=e.getGeometryFunction()(t);i&&(this.setStyle(e),this.drawGeometry(i))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let i=0,s=e.length;i<s;++i)this.drawGeometry(e[i])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),this.text_!==""&&this.drawText_(e,0,e.length,i)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),this.text_!==""&&this.drawText_(e,0,e.length,i)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Wt(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(i,0,i.length,t.getStride(),!1,this.strokeState_.strokeOffset),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(Wt(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const i=this.context_,s=t.getFlatCoordinates();let r=0;const o=t.getEnds(),a=t.getStride();i.beginPath();for(let l=0,c=o.length;l<c;++l)r=this.moveToLineTo_(s,r,o[l],a,!1,this.strokeState_.strokeOffset);i.stroke()}if(this.text_!==""){const i=t.getFlatMidpoints();this.drawText_(i,0,i.length,2)}}}drawPolygon(t){var e;if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Wt(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const i=this.context_;i.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride(),(e=this.strokeState_)==null?void 0:e.strokeOffset),this.fillState_&&i.fill(),this.strokeState_&&i.stroke()}if(this.text_!==""){const i=t.getFlatInteriorPoint();this.drawText_(i,0,2,2)}}}drawMultiPolygon(t){var e;if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Wt(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const i=this.context_,s=t.getOrientedFlatCoordinates();let r=0;const o=t.getEndss(),a=t.getStride();i.beginPath();for(let l=0,c=o.length;l<c;++l){const h=o[l];r=this.drawRings_(s,r,h,a,(e=this.strokeState_)==null?void 0:e.strokeOffset)}this.fillState_&&i.fill(),this.strokeState_&&i.stroke()}if(this.text_!==""){const i=t.getFlatInteriorPoints();this.drawText_(i,0,i.length,2)}}}setContextFillState_(t){const e=this.context_,i=this.contextFillState_;i?i.fillStyle!=t.fillStyle&&(i.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=t.lineCap&&(i.lineCap=t.lineCap,e.lineCap=t.lineCap),xn(i.lineDash,t.lineDash)||e.setLineDash(i.lineDash=t.lineDash),i.lineDashOffset!=t.lineDashOffset&&(i.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),i.lineJoin!=t.lineJoin&&(i.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),i.lineWidth!=t.lineWidth&&(i.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),i.miterLimit!=t.miterLimit&&(i.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),i.strokeStyle!=t.strokeStyle&&(i.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){const e=this.context_,i=this.contextTextState_,s=t.textAlign?t.textAlign:jr;i?(i.font!=t.font&&(i.font=t.font,e.font=t.font),i.textAlign!=s&&(i.textAlign=s,e.textAlign=s),i.textBaseline!=t.textBaseline&&(i.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 i=t.getColor();this.fillState_={fillStyle:Fi(i||De)}}if(!e)this.strokeState_=null;else{const i=e.getColor(),s=e.getLineCap(),r=e.getLineDash(),o=e.getLineDashOffset(),a=e.getLineJoin(),l=e.getWidth(),c=e.getMiterLimit(),h=r||Qi,u=e.getOffset();this.strokeState_={lineCap:s!==void 0?s:Ys,lineDash:this.pixelRatio_===1?h:h.map(d=>d*this.pixelRatio_),lineDashOffset:(o||tn)*this.pixelRatio_,lineJoin:a!==void 0?a:Hs,lineWidth:(l!==void 0?l:qr)*this.pixelRatio_,miterLimit:c!==void 0?c:Br,strokeStyle:Fi(i||Zr),strokeOffset:(u??0)*this.pixelRatio_}}}setImageStyle(t){let e;if(!t||!(e=t.getSize())){this.image_=null;return}const i=t.getPixelRatio(this.pixelRatio_),s=t.getAnchor(),r=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=s[0]*i,this.imageAnchorY_=s[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const o=t.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/i,o[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(!t)this.text_="";else{const e=t.getFill();if(!e)this.textFillState_=null;else{const g=e.getColor();this.textFillState_={fillStyle:Fi(g||De)}}const i=t.getStroke();if(!i)this.textStrokeState_=null;else{const g=i.getColor(),p=i.getLineCap(),m=i.getLineDash(),_=i.getLineDashOffset(),v=i.getLineJoin(),y=i.getWidth(),w=i.getMiterLimit();this.textStrokeState_={lineCap:p!==void 0?p:Ys,lineDash:m||Qi,lineDashOffset:_||tn,lineJoin:v!==void 0?v:Hs,lineWidth:y!==void 0?y:qr,miterLimit:w!==void 0?w:Br,strokeStyle:Fi(g||Zr)}}const s=t.getFont(),r=t.getOffsetX(),o=t.getOffsetY(),a=t.getRotateWithView(),l=t.getRotation(),c=t.getScaleArray(),h=t.getText(),u=t.getTextAlign(),d=t.getTextBaseline();this.textState_={font:s!==void 0?s:ug,textAlign:u!==void 0?u:jr,textBaseline:d!==void 0?d:Za},this.text_=h!==void 0?Array.isArray(h)?h.reduce((g,p,m)=>g+=m%2?" ":p,""):h:"",this.textOffsetX_=r!==void 0?this.pixelRatio_*r:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*c[0],this.pixelRatio_*c[1]]}}}const _v=.5,yg={Point:Rv,LineString:Cv,Polygon:Sv,MultiPoint:Iv,MultiLineString:bv,MultiPolygon:Pv,GeometryCollection:Ev,Circle:wv};function vv(n,t){return parseInt(at(n),10)-parseInt(at(t),10)}function ja(n,t){const e=_g(n,t);return e*e}function _g(n,t){return _v*n/t}function wv(n,t,e,i,s){const r=e.getFill(),o=e.getStroke();if(r||o){const l=n.getBuilder(e.getZIndex(),"Circle");l.setFillStrokeStyle(r,o),l.drawCircle(t,i,s)}const a=e.getText();if(a&&a.getText()){const l=n.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i)}}function qa(n,t,e,i,s,r,o,a){const l=[],c=e.getImage();if(c){let d=!0;const g=c.getImageState();g==Y.LOADED||g==Y.ERROR?d=!1:g==Y.IDLE&&c.load(),d&&l.push(c.ready())}const h=e.getFill();h&&h.loading()&&l.push(h.ready());const u=l.length>0;return u&&Promise.all(l).then(()=>s(null)),xv(n,t,e,i,r,o,a),u}function xv(n,t,e,i,s,r,o){const a=e.getGeometryFunction()(t);if(!a)return;const l=a.simplifyTransformed(i,s);if(e.getRenderer())vg(n,l,e,t,o);else{const h=yg[l.getType()];h(n,l,e,t,o,r)}}function vg(n,t,e,i,s){if(t.getType()=="GeometryCollection"){const o=t.getGeometries();for(let a=0,l=o.length;a<l;++a)vg(n,o[a],e,i,s);return}n.getBuilder(e.getZIndex(),"Default").drawCustom(t,i,e.getRenderer(),e.getHitDetectionRenderer(),s)}function Ev(n,t,e,i,s,r){const o=t.getGeometriesArray();let a,l;for(a=0,l=o.length;a<l;++a){const c=yg[o[a].getType()];c(n,o[a],e,i,s,r)}}function Cv(n,t,e,i,s){const r=e.getStroke();if(r){const a=n.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,r),a.drawLineString(t,i,s)}const o=e.getText();if(o&&o.getText()){const a=n.getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,i,s)}}function bv(n,t,e,i,s){const r=e.getStroke();if(r){const a=n.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,r),a.drawMultiLineString(t,i,s)}const o=e.getText();if(o&&o.getText()){const a=n.getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,i,s)}}function Pv(n,t,e,i,s){const r=e.getFill(),o=e.getStroke();if(o||r){const l=n.getBuilder(e.getZIndex(),"Polygon");l.setFillStrokeStyle(r,o),l.drawMultiPolygon(t,i,s)}const a=e.getText();if(a&&a.getText()){const l=n.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i,s)}}function Rv(n,t,e,i,s,r){const o=e.getImage(),a=e.getText(),l=a&&a.getText(),c=r&&o&&l?{}:void 0;if(o){if(o.getImageState()!=Y.LOADED)return;const h=n.getBuilder(e.getZIndex(),"Image");h.setImageStyle(o,c),h.drawPoint(t,i,s)}if(l){const h=n.getBuilder(e.getZIndex(),"Text");h.setTextStyle(a,c),h.drawText(t,i,s)}}function Iv(n,t,e,i,s,r){const o=e.getImage(),a=o&&o.getOpacity()!==0,l=e.getText(),c=l&&l.getText(),h=r&&a&&c?{}:void 0;if(a){if(o.getImageState()!=Y.LOADED)return;const u=n.getBuilder(e.getZIndex(),"Image");u.setImageStyle(o,h),u.drawMultiPoint(t,i,s)}if(c){const u=n.getBuilder(e.getZIndex(),"Text");u.setTextStyle(l,h),u.drawText(t,i,s)}}function Sv(n,t,e,i,s){const r=e.getFill(),o=e.getStroke();if(r||o){const l=n.getBuilder(e.getZIndex(),"Polygon");l.setFillStrokeStyle(r,o),l.drawPolygon(t,i,s)}const a=e.getText();if(a&&a.getText()){const l=n.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i,s)}}function wg(n){if(!(n.context instanceof CanvasRenderingContext2D))throw new Error("Only works for render events from Canvas 2D layers");const t=n.inversePixelTransform[0],e=n.inversePixelTransform[1],i=Math.sqrt(t*t+e*e),s=n.frameState,r=La(n.inversePixelTransform.slice(),s.coordinateToPixelTransform),o=ja(s.viewState.resolution,i);let a;return new mg(n.context,i,s.extent,r,s.viewState.rotation,o,a)}let Tv=!1;function xg(n,t,e,i,s,r,o){const a=new XMLHttpRequest;a.open("GET",typeof n=="function"?n(e,i,s):n,!0),t.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=Tv,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){const c=t.getType();try{let h;c=="text"||c=="json"?h=a.responseText:c=="xml"?h=a.responseXML||a.responseText:c=="arraybuffer"&&(h=a.response),h?r(t.readFeatures(h,{extent:e,featureProjection:s}),t.readProjection(h)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function Eg(n,t){return function(e,i,s,r,o){xg(n,t,e,i,s,(a,l)=>{this.addFeatures(a),r!==void 0&&r(a)},()=>{this.changed(),o!==void 0&&o()})}}function Mv(n,t){return[[-1/0,-1/0,1/0,1/0]]}function Av(n,t){return[n]}function Cg(n,t,e,i){const s=[];let r=ze();for(let o=0,a=e.length;o<a;++o){const l=e[o];r=bc(n,t,l[0],i),s.push((r[0]+r[2])/2,(r[1]+r[3])/2),t=l[l.length-1]}return s}class Ka extends Nf{constructor(t){super(),this.geometries_=t,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(Lt),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const t=this.geometries_;for(let e=0,i=t.length;e<i;++e)this.changeEventsKeys_.push(wt(t[e],Q.CHANGE,this.changed,this))}clone(){const t=new Ka(wh(this.geometries_));return t.applyProperties(this),t}closestPointXY(t,e,i,s){if(s<Qn(this.getExtent(),t,e))return s;const r=this.geometries_;for(let o=0,a=r.length;o<a;++o)s=r[o].closestPointXY(t,e,i,s);return s}containsXY(t,e){const i=this.geometries_;for(let s=0,r=i.length;s<r;++s)if(i[s].containsXY(t,e))return!0;return!1}computeExtent(t){Ns(t);const e=this.geometries_;for(let i=0,s=e.length;i<s;++i)ef(t,e[i].getExtent());return t}getGeometries(){return wh(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let t=[];const e=this.geometries_;for(let i=0,s=e.length;i<s;++i)e[i].getType()===this.getType()?t=t.concat(e[i].getGeometriesArrayRecursive()):t.push(e[i]);return t}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&t<this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=[],i=this.geometries_;let s=!1;for(let r=0,o=i.length;r<o;++r){const a=i[r],l=a.getSimplifiedGeometry(t);e.push(l),l!==a&&(s=!0)}return s?new Ka(e):(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getType(){return"GeometryCollection"}intersectsExtent(t){const e=this.geometries_;for(let i=0,s=e.length;i<s;++i)if(e[i].intersectsExtent(t))return!0;return!1}isEmpty(){return this.geometries_.length===0}rotate(t,e){const i=this.geometries_;for(let s=0,r=i.length;s<r;++s)i[s].rotate(t,e);this.changed()}scale(t,e,i){i||(i=He(this.getExtent()));const s=this.geometries_;for(let r=0,o=s.length;r<o;++r)s[r].scale(t,e,i);this.changed()}setGeometries(t){this.setGeometriesArray(wh(t))}setGeometriesArray(t){this.unlistenGeometriesChange_(),this.geometries_=t,this.listenGeometriesChange_(),this.changed()}applyTransform(t){const e=this.geometries_;for(let i=0,s=e.length;i<s;++i)e[i].applyTransform(t);this.changed()}translate(t,e){const i=this.geometries_;for(let s=0,r=i.length;s<r;++s)i[s].translate(t,e);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function wh(n){return n.map(t=>t.clone())}class fs extends rs{constructor(t,e,i){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(t[0]))this.setCoordinates(t,e);else if(e!==void 0&&i)this.setFlatCoordinates(e,t),this.ends_=i;else{const s=t,r=[],o=[];for(let l=0,c=s.length;l<c;++l){const h=s[l];Ri(r,h.getFlatCoordinates()),o.push(r.length)}const a=s.length===0?this.getLayout():s[0].getLayout();this.setFlatCoordinates(a,r),this.ends_=o}}appendLineString(t){Ri(this.flatCoordinates,t.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new fs(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,s){return s<Qn(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Hc(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Zc(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,t,e,i,s))}getCoordinateAtM(t,e,i){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(e=e!==void 0?e:!1,i=i!==void 0?i:!1,X_(this.flatCoordinates,0,this.ends_,this.stride,t,e,i))}getCoordinates(){return Vr(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new fi(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLineStrings(){const t=this.flatCoordinates,e=this.ends_,i=this.layout,s=[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o],c=new fi(t.slice(r,l),i);s.push(c),r=l}return s}getLength(){const t=this.ends_;let e=0,i=0;for(let s=0,r=t.length;s<r;++s)i+=sh(this.flatCoordinates,e,t[s],this.stride),e=t[s];return i}getFlatMidpoints(){const t=[],e=this.flatCoordinates;let i=0;const s=this.ends_,r=this.stride;for(let o=0,a=s.length;o<a;++o){const l=s[o],c=Va(e,i,l,r,.5);Ri(t,c),i=l}return t}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=Xf(this.flatCoordinates,0,this.ends_,this.stride,t,e,0,i),new fs(e,"XY",i)}getType(){return"MultiLineString"}intersectsExtent(t){return V_(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=Gr(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}}class Bs extends rs{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){Ri(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){const t=new Bs(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,s){if(s<Qn(this.getExtent(),t,e))return s;const r=this.flatCoordinates,o=this.stride;for(let a=0,l=r.length;a<l;a+=o){const c=es(t,e,r[a],r[a+1]);if(c<s){s=c;for(let h=0;h<o;++h)i[h]=r[a+h];i.length=o}}return s}getCoordinates(){return Rn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){const e=this.flatCoordinates.length/this.stride;return t<0||e<=t?null:new Ne(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){const t=this.flatCoordinates,e=this.layout,i=this.stride,s=[];for(let r=0,o=t.length;r<o;r+=i){const a=new Ne(t.slice(r,r+i),e);s.push(a)}return s}getType(){return"MultiPoint"}intersectsExtent(t){const e=this.flatCoordinates,i=this.stride;for(let s=0,r=e.length;s<r;s+=i){const o=e[s],a=e[s+1];if(Ec(t,o,a))return!0}return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Oa(this.flatCoordinates,0,t,this.stride),this.changed()}}class Jr extends rs{constructor(t,e,i){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!i&&!Array.isArray(t[0])){const s=t,r=[],o=[];for(let a=0,l=s.length;a<l;++a){const c=s[a],h=r.length,u=c.getEnds();for(let d=0,g=u.length;d<g;++d)u[d]+=h;Ri(r,c.getFlatCoordinates()),o.push(u)}e=s.length===0?this.getLayout():s[0].getLayout(),t=r,i=o}e!==void 0&&i?(this.setFlatCoordinates(e,t),this.endss_=i):this.setCoordinates(t,e)}appendPolygon(t){let e;if(!this.flatCoordinates)this.flatCoordinates=t.getFlatCoordinates().slice(),e=t.getEnds().slice(),this.endss_.push();else{const i=this.flatCoordinates.length;Ri(this.flatCoordinates,t.getFlatCoordinates()),e=t.getEnds().slice();for(let s=0,r=e.length;s<r;++s)e[s]+=i}this.endss_.push(e),this.changed()}clone(){const t=this.endss_.length,e=new Array(t);for(let s=0;s<t;++s)e[s]=this.endss_[s].slice();const i=new Jr(this.flatCoordinates.slice(),this.layout,e);return i.applyProperties(this),i}closestPointXY(t,e,i,s){return s<Qn(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(F_(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),L_(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,t,e,i,s))}containsXY(t,e){return G_(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)}getArea(){return D_(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),eh(e,0,this.endss_,this.stride,t)):e=this.flatCoordinates,jc(e,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const t=Cg(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Yf(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new Bs(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;jf(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=eh(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=k_(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),e,0,i),new Jr(e,"XY",i)}getPolygon(t){if(t<0||this.endss_.length<=t)return null;let e;if(t===0)e=0;else{const r=this.endss_[t-1];e=r[r.length-1]}const i=this.endss_[t].slice(),s=i[i.length-1];if(e!==0)for(let r=0,o=i.length;r<o;++r)i[r]-=e;return new di(this.flatCoordinates.slice(e,s),this.layout,i)}getPolygons(){const t=this.layout,e=this.flatCoordinates,i=this.endss_,s=[];let r=0;for(let o=0,a=i.length;o<a;++o){const l=i[o].slice(),c=l[l.length-1];if(r!==0)for(let u=0,d=l.length;u<d;++u)l[u]-=r;const h=new di(e.slice(r,c),t,l);s.push(h),r=c}return s}getType(){return"MultiPolygon"}intersectsExtent(t){return W_(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,3),this.flatCoordinates||(this.flatCoordinates=[]);const i=$f(this.flatCoordinates,0,t,this.stride,this.endss_);if(i.length===0)this.flatCoordinates.length=0;else{const s=i[i.length-1];this.flatCoordinates.length=s.length===0?0:s[s.length-1]}this.changed()}}const bg=xe();class _e{constructor(t,e,i,s,r,o){this.styleFunction,this.extent_,this.id_=o,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=r,this.squaredTolerance_,this.stride_=s,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?tf(this.flatCoordinates_):bc(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=He(this.getExtent());this.flatInteriorPoints_=Jc(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=qf(this.flatCoordinates_,this.ends_),e=Cg(this.flatCoordinates_,0,t,2);this.flatInteriorPoints_=Yf(this.flatCoordinates_,0,t,2,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=Va(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const i=this.ends_;for(let s=0,r=i.length;s<r;++s){const o=i[s],a=Va(t,e,o,2,.5);Ri(this.flatMidpoints_,a),e=o}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(t){return this}simplifyTransformed(t,e){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(t){t=mt(t);const e=t.getExtent(),i=t.getWorldExtent();if(e&&i){const s=Vt(i)/Vt(e);ui(bg,i[0],i[3],s,-s,0,0,0),Di(this.flatCoordinates_,0,this.flatCoordinates_.length,2,bg,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){var t;return new _e(this.type_,this.flatCoordinates_.slice(),(t=this.ends_)==null?void 0:t.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=ff((t,e)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const i=this.simplifiedGeometry_.getFlatCoordinates();let s;switch(this.type_){case"LineString":i.length=za(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),s=[i.length];break;case"MultiLineString":s=[],i.length=Xf(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,s);break;case"Polygon":s=[],i.length=qc(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,s);break}return s&&(this.simplifiedGeometry_=new _e(this.type_,i,s,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}_e.prototype.getFlatCoordinates=_e.prototype.getOrientedFlatCoordinates;function Pg(n,t,e=0,i=n.length-1,s=Dv){for(;i>e;){if(i-e>600){const l=i-e+1,c=t-e+1,h=Math.log(l),u=.5*Math.exp(2*h/3),d=.5*Math.sqrt(h*u*(l-u)/l)*(c-l/2<0?-1:1),g=Math.max(e,Math.floor(t-c*u/l+d)),p=Math.min(i,Math.floor(t+(l-c)*u/l+d));Pg(n,t,g,p,s)}const r=n[t];let o=e,a=i;for(Qr(n,e,t),s(n[i],r)>0&&Qr(n,e,i);o<a;){for(Qr(n,o,a),o++,a--;s(n[o],r)<0;)o++;for(;s(n[a],r)>0;)a--}s(n[e],r)===0?Qr(n,e,a):(a++,Qr(n,a,i)),a<=t&&(e=a+1),t<=a&&(i=a-1)}}function Qr(n,t,e){const i=n[t];n[t]=n[e],n[e]=i}function Dv(n,t){return n<t?-1:n>t?1:0}let xh=class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const i=[];if(!Qa(t,e))return i;const s=this.toBBox,r=[];for(;e;){for(let o=0;o<e.children.length;o++){const a=e.children[o],l=e.leaf?s(a):a;Qa(t,l)&&(e.leaf?i.push(a):Ch(t,l)?this._all(a,i):r.push(a))}e=r.pop()}return i}collides(t){let e=this.data;if(!Qa(t,e))return!1;const i=[];for(;e;){for(let s=0;s<e.children.length;s++){const r=e.children[s],o=e.leaf?this.toBBox(r):r;if(Qa(t,o)){if(e.leaf||Ch(t,o))return!0;i.push(r)}}e=i.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let i=0;i<t.length;i++)this.insert(t[i]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=e;else if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const i=this.data;this.data=e,e=i}this._insert(e,this.data.height-e.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=js([]),this}remove(t,e){if(!t)return this;let i=this.data;const s=this.toBBox(t),r=[],o=[];let a,l,c;for(;i||r.length;){if(i||(i=r.pop(),l=r[r.length-1],a=o.pop(),c=!0),i.leaf){const h=Fv(t,i.children,e);if(h!==-1)return i.children.splice(h,1),r.push(i),this._condense(r),this}!c&&!i.leaf&&Ch(i,s)?(r.push(i),o.push(a),a=0,l=i,i=i.children[0]):l?(a++,i=l.children[a],c=!1):i=null}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const i=[];for(;t;)t.leaf?e.push(...t.children):i.push(...t.children),t=i.pop();return e}_build(t,e,i,s){const r=i-e+1;let o=this._maxEntries,a;if(r<=o)return a=js(t.slice(e,i+1)),Zs(a,this.toBBox),a;s||(s=Math.ceil(Math.log(r)/Math.log(o)),o=Math.ceil(r/Math.pow(o,s-1))),a=js([]),a.leaf=!1,a.height=s;const l=Math.ceil(r/o),c=l*Math.ceil(Math.sqrt(o));Rg(t,e,i,c,this.compareMinX);for(let h=e;h<=i;h+=c){const u=Math.min(h+c-1,i);Rg(t,h,u,l,this.compareMinY);for(let d=h;d<=u;d+=l){const g=Math.min(d+l-1,u);a.children.push(this._build(t,d,g,s-1))}}return Zs(a,this.toBBox),a}_chooseSubtree(t,e,i,s){for(;s.push(e),!(e.leaf||s.length-1===i);){let r=1/0,o=1/0,a;for(let l=0;l<e.children.length;l++){const c=e.children[l],h=Eh(c),u=zv(t,c)-h;u<o?(o=u,r=h<r?h:r,a=c):u===o&&h<r&&(r=h,a=c)}e=a||e.children[0]}return e}_insert(t,e,i){const s=i?t:this.toBBox(t),r=[],o=this._chooseSubtree(s,this.data,e,r);for(o.children.push(t),eo(o,s);e>=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(s,r,e)}_split(t,e){const i=t[e],s=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,s);const o=this._chooseSplitIndex(i,r,s),a=js(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,Zs(i,this.toBBox),Zs(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)}_splitRoot(t,e){this.data=js([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Zs(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let s,r=1/0,o=1/0;for(let a=e;a<=i-e;a++){const l=to(t,0,a,this.toBBox),c=to(t,a,i,this.toBBox),h=kv(l,c),u=Eh(l)+Eh(c);h<r?(r=h,s=a,o=u<o?u:o):h===r&&u<o&&(o=u,s=a)}return s||i-e}_chooseSplitAxis(t,e,i){const s=t.leaf?this.compareMinX:Lv,r=t.leaf?this.compareMinY:Ov,o=this._allDistMargin(t,e,i,s),a=this._allDistMargin(t,e,i,r);o<a&&t.children.sort(s)}_allDistMargin(t,e,i,s){t.children.sort(s);const r=this.toBBox,o=to(t,0,e,r),a=to(t,i-e,i,r);let l=Ja(o)+Ja(a);for(let c=e;c<i-e;c++){const h=t.children[c];eo(o,t.leaf?r(h):h),l+=Ja(o)}for(let c=i-e-1;c>=e;c--){const h=t.children[c];eo(a,t.leaf?r(h):h),l+=Ja(a)}return l}_adjustParentBBoxes(t,e,i){for(let s=i;s>=0;s--)eo(e[s],t)}_condense(t){for(let e=t.length-1,i;e>=0;e--)t[e].children.length===0?e>0?(i=t[e-1].children,i.splice(i.indexOf(t[e]),1)):this.clear():Zs(t[e],this.toBBox)}};function Fv(n,t,e){if(!e)return t.indexOf(n);for(let i=0;i<t.length;i++)if(e(n,t[i]))return i;return-1}function Zs(n,t){to(n,0,n.children.length,t,n)}function to(n,t,e,i,s){s||(s=js(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let r=t;r<e;r++){const o=n.children[r];eo(s,n.leaf?i(o):o)}return s}function eo(n,t){return n.minX=Math.min(n.minX,t.minX),n.minY=Math.min(n.minY,t.minY),n.maxX=Math.max(n.maxX,t.maxX),n.maxY=Math.max(n.maxY,t.maxY),n}function Lv(n,t){return n.minX-t.minX}function Ov(n,t){return n.minY-t.minY}function Eh(n){return(n.maxX-n.minX)*(n.maxY-n.minY)}function Ja(n){return n.maxX-n.minX+(n.maxY-n.minY)}function zv(n,t){return(Math.max(t.maxX,n.maxX)-Math.min(t.minX,n.minX))*(Math.max(t.maxY,n.maxY)-Math.min(t.minY,n.minY))}function kv(n,t){const e=Math.max(n.minX,t.minX),i=Math.max(n.minY,t.minY),s=Math.min(n.maxX,t.maxX),r=Math.min(n.maxY,t.maxY);return Math.max(0,s-e)*Math.max(0,r-i)}function Ch(n,t){return n.minX<=t.minX&&n.minY<=t.minY&&t.maxX<=n.maxX&&t.maxY<=n.maxY}function Qa(n,t){return t.minX<=n.maxX&&t.minY<=n.maxY&&t.maxX>=n.minX&&t.maxY>=n.minY}function js(n){return{children:n,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Rg(n,t,e,i,s){const r=[t,e];for(;r.length;){if(e=r.pop(),t=r.pop(),e-t<=i)continue;const o=t+Math.ceil((e-t)/i/2)*i;Pg(n,o,t,e,s),r.push(t,o,o,e)}}class Ig{constructor(t){this.rbush_=new xh(t),this.items_={}}insert(t,e){const i={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(i),this.items_[at(e)]=i}load(t,e){const i=new Array(e.length);for(let s=0,r=e.length;s<r;s++){const o=t[s],a=e[s],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};i[s]=l,this.items_[at(a)]=l}this.rbush_.load(i)}remove(t){const e=at(t),i=this.items_[e];return delete this.items_[e],this.rbush_.remove(i)!==null}update(t,e){const i=this.items_[at(e)],s=[i.minX,i.minY,i.maxX,i.maxY];ji(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 i;for(let s=0,r=t.length;s<r;s++)if(i=e(t[s]),i)return i;return i}isEmpty(){return Pn(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return Zi(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 io extends Ti{constructor(t){super(),this.projection=mt(t.projection),this.attributions_=Sg(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible??!0,this.loading=!1,this.state_=t.state!==void 0?t.state:"ready",this.wrapX_=t.wrapX!==void 0?t.wrapX:!1,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;const e=this;this.viewPromise_=new Promise(function(i,s){e.viewResolver=i,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_=Sg(t),this.changed()}setState(t){this.state_=t,this.changed()}}function Sg(n){return n?typeof n=="function"?n:(Array.isArray(n)||(n=[n]),t=>n):null}const Je={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};class Sn extends hi{constructor(t,e,i){super(t),this.feature=e,this.features=i}}class Ge extends io{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_=Ar,this.format_=t.format||null,this.overlaps_=t.overlaps===void 0?!0:t.overlaps,this.url_=t.url,t.loader!==void 0?this.loader_=t.loader:this.url_!==void 0&&(Et(this.format_,"`format` must be set when `url` is set"),this.loader_=Eg(this.url_,this.format_)),this.strategy_=t.strategy!==void 0?t.strategy:Mv;const e=t.useSpatialIndex!==void 0?t.useSpatialIndex:!0;this.featuresRtree_=e?new Ig:null,this.loadedExtentsRtree_=new Ig,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let i,s;Array.isArray(t.features)?s=t.features:t.features&&(i=t.features,s=i.getArray()),!e&&i===void 0&&(i=new Ze(s)),s!==void 0&&this.addFeaturesInternal(s),i!==void 0&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=at(t);if(!this.addToIndex_(e,t)){this.featuresCollection_&&this.featuresCollection_.remove(t);return}this.setupChangeEvents_(e,t);const i=t.getGeometry();if(i){const s=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(s,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new Sn(Je.ADDFEATURE,t))}setupChangeEvents_(t,e){e instanceof _e||(this.featureChangeKeys_[t]=[wt(e,Q.CHANGE,this.handleFeatureChange_,this),wt(e,Gs.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(t,e){let i=!0;if(e.getId()!==void 0){const s=String(e.getId());if(!(s in this.idIndex_))this.idIndex_[s]=e;else if(e instanceof _e){const r=this.idIndex_[s];r instanceof _e?Array.isArray(r)?r.push(e):this.idIndex_[s]=[r,e]:i=!1}else i=!1}return i&&(Et(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],s=[];for(let r=0,o=t.length;r<o;r++){const a=t[r],l=at(a);this.addToIndex_(l,a)&&i.push(a)}for(let r=0,o=i.length;r<o;r++){const a=i[r],l=at(a);this.setupChangeEvents_(l,a);const c=a.getGeometry();if(c){const h=c.getExtent();e.push(h),s.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(e,s),this.hasListener(Je.ADDFEATURE))for(let r=0,o=i.length;r<o;r++)this.dispatchEvent(new Sn(Je.ADDFEATURE,i[r]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(Je.ADDFEATURE,function(i){e||(e=!0,t.push(i.feature),e=!1)}),this.addEventListener(Je.REMOVEFEATURE,function(i){e||(e=!0,t.remove(i.feature),e=!1)}),t.addEventListener(Me.ADD,i=>{e||(e=!0,this.addFeature(i.element),e=!1)}),t.addEventListener(Me.REMOVE,i=>{e||(e=!0,this.removeFeature(i.element),e=!1)}),this.featuresCollection_=t}clear(t){if(t){for(const i in this.featureChangeKeys_)this.featureChangeKeys_[i].forEach(Lt);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(i=>{this.removeFeatureInternal(i)});for(const i in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[i])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new Sn(Je.CLEAR);this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const i=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(i,function(s){const r=s.getGeometry();if(r instanceof _e||r.intersectsCoordinate(t))return e(s)})}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,function(i){const s=i.getGeometry();if(s instanceof _e||s.intersectsExtent(t)){const r=e(i);if(r)return r}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),Pn(this.nullGeometryFeatures_)||Ri(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,function(i){e.push(i)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const s=lf(t,e);return[].concat(...s.map(r=>this.featuresRtree_.getInExtent(r)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],s=t[1];let r=null;const o=[NaN,NaN];let a=1/0;const l=[-1/0,-1/0,1/0,1/0];return e=e||Mr,this.featuresRtree_.forEachInExtent(l,function(c){if(e(c)){const h=c.getGeometry(),u=a;if(a=h instanceof _e?0:h.closestPointXY(i,s,o,a),a<u){r=c;const d=Math.sqrt(a);l[0]=i-d,l[1]=s-d,l[2]=i+d,l[3]=s+d}}}),r}getExtent(t){var e;return((e=this.featuresRtree_)==null?void 0:e.getExtent(t))??null}getFeatureById(t){const e=this.idIndex_[t.toString()];return e!==void 0?e:null}getFeatureByUid(t){const e=this.uidIndex_[t];return e!==void 0?e:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){const e=t.target,i=at(e),s=e.getGeometry();if(!s)i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[i]=e);else{const o=s.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(o,e)):this.featuresRtree_&&this.featuresRtree_.update(o,e)}const r=e.getId();if(r!==void 0){const o=r.toString();this.idIndex_[o]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[o]=e)}else this.removeFromIdIndex_(e),this.uidIndex_[i]=e;this.changed(),this.dispatchEvent(new Sn(Je.CHANGEFEATURE,e))}hasFeature(t){const e=t.getId();return e!==void 0?e in this.idIndex_:at(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Pn(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(t,e,i){const s=this.loadedExtentsRtree_,r=this.strategy_(t,e,i);for(let o=0,a=r.length;o<a;++o){const l=r[o];s.forEachInExtent(l,function(h){return Bi(h.extent,l)})||(++this.loadingExtentsCount_,this.dispatchEvent(new Sn(Je.FEATURESLOADSTART)),this.loader_.call(this,l,e,i,h=>{--this.loadingExtentsCount_,this.dispatchEvent(new Sn(Je.FEATURESLOADEND,void 0,h))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new Sn(Je.FEATURESLOADERROR))}),s.insert(l,{extent:l.slice()}))}this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_,i=e.forEachInExtent(t,function(s){if(ji(s.extent,t))return s});i&&e.remove(i)}removeFeatures(t){let e=!1;for(let i=0,s=t.length;i<s;++i)e=this.removeFeatureInternal(t[i])||e;e&&this.changed()}removeFeature(t){if(!t)return;this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=at(t);if(!(e in this.uidIndex_))return!1;e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t);const i=this.featureChangeKeys_[e];i==null||i.forEach(Lt),delete this.featureChangeKeys_[e];const s=t.getId();if(s!==void 0){const r=s.toString(),o=this.idIndex_[r];o===t?delete this.idIndex_[r]:Array.isArray(o)&&(o.splice(o.indexOf(t),1),o.length===1&&(this.idIndex_[r]=o[0]))}return delete this.uidIndex_[e],this.hasListener(Je.REMOVEFEATURE)&&this.dispatchEvent(new Sn(Je.REMOVEFEATURE,t)),!0}removeFromIdIndex_(t){for(const e in this.idIndex_)if(this.idIndex_[e]===t){delete this.idIndex_[e];break}}setLoader(t){this.loader_=t}setUrl(t){Et(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(Eg(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}}class Ht{constructor(t){t=t||{},this.patternImage_=null,this.color_=null,t.color!==void 0&&this.setColor(t.color)}clone(){const t=this.getColor();return new Ht({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){if(t!==null&&typeof t=="object"&&"src"in t){const e=Hr(null,t.src,{crossOrigin:"anonymous"},void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));e.ready().then(()=>{this.patternImage_=null}),e.getImageState()===Y.IDLE&&e.load(),e.getImageState()===Y.LOADING&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?at(t):typeof t=="object"&&"src"in t?t.src+":"+t.offset:hs(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}class te{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.offset_=t.offset,this.width_=t.width}clone(){const t=this.getColor();return new te({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(),offset:this.getOffset(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(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}setOffset(t){this.offset_=t}setWidth(t){this.width_=t}}function Tg(n){return n[0]>0&&n[1]>0}function Nv(n,t,e){return e===void 0&&(e=[0,0]),e[0]=n[0]*t+.5|0,e[1]=n[1]*t+.5|0,e}function ve(n,t){return Array.isArray(n)?n:(t===void 0?t=[n,n]:(t[0]=n,t[1]=n),t)}class tl{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=ve(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new tl({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 et()}getImage(t){return et()}getHitDetectionImage(){return et()}getPixelRatio(t){return 1}getImageState(){return et()}getImageSize(){return et()}getOrigin(){return et()}getSize(){return et()}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_=ve(t)}listenImageChange(t){et()}load(){et()}unlistenImageChange(t){et()}ready(){return Promise.resolve()}}class no extends tl{constructor(t){super({opacity:1,rotateWithView:t.rotateWithView!==void 0?t.rotateWithView:!1,rotation:t.rotation!==void 0?t.rotation:0,scale:t.scale!==void 0?t.scale:1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=t.fill!==void 0?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius=t.radius,this.radius2_=t.radius2,this.angle_=t.angle!==void 0?t.angle:0,this.stroke_=t.stroke!==void 0?t.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?Y.LOADING:Y.LOADED,this.imageState_===Y.LOADING&&this.ready().then(()=>this.imageState_=Y.LOADED),this.render()}clone(){const t=this.getScale(),e=new no({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){var r,o;const e=(r=this.fill_)==null?void 0:r.getKey(),i=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let s=(o=Ke.get(i,null))==null?void 0:o.getImage(1);if(!s){const a=this.renderOptions_,l=Math.ceil(a.size*t),c=Nt(l,l);this.draw_(a,c,t),s=c.canvas;const h=new ag(s,void 0,null,Y.LOADED,null);Ke.set(i,null,h),createImageBitmap(s).then(u=>{h.setImage(u)})}return s}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(t){this.radius!==t&&(this.radius=t,this.render())}getRadius2(){return this.radius2_}setRadius2(t){this.radius2_!==t&&(this.radius2_=t,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(e===0||this.points_===1/0||t!=="bevel"&&t!=="miter")return e;let s=this.radius,r=this.radius2_===void 0?s:this.radius2_;if(s<r){const P=s;s=r,r=P}const o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=r*Math.sin(a),c=Math.sqrt(r*r-l*l),h=s-c,u=Math.sqrt(l*l+h*h),d=u/l;if(t==="miter"&&d<=i)return d*e;const g=e/2/d,p=e/2*(h/u),_=Math.sqrt((s+g)*(s+g)+p*p)-s;if(this.radius2_===void 0||t==="bevel")return _*2;const v=s*Math.sin(a),y=Math.sqrt(s*s-v*v),w=r-y,C=Math.sqrt(v*v+w*w)/v;if(C<=i){const P=C*e/2-r-s;return 2*Math.max(_,P)}return _*2}createRenderOptions(){let t=Ys,e=Hs,i=0,s=null,r=0,o,a=0;this.stroke_&&(o=Fi(this.stroke_.getColor()??Zr),a=this.stroke_.getWidth()??qr,s=this.stroke_.getLineDash(),r=this.stroke_.getLineDashOffset()??0,e=this.stroke_.getLineJoin()??Hs,t=this.stroke_.getLineCap()??Ys,i=this.stroke_.getMiterLimit()??Br);const l=this.calculateLineJoinSize_(e,a,i),c=Math.max(this.radius,this.radius2_||0),h=Math.ceil(2*c+l);return{strokeStyle:o,strokeWidth:a,size:h,lineCap:t,lineDash:s,lineDashOffset:r,lineJoin:e,miterLimit:i}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let s=this.fill_.getColor();s===null&&(s=De),e.fillStyle=Fi(s),e.fill()}t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){let e;if(this.fill_){let i=this.fill_.getColor(),s=0;typeof i=="string"&&(i=hs(i)),i===null?s=1:Array.isArray(i)&&(s=i.length===4?i[3]:1),s===0&&(e=Nt(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_;const i=this.radius;if(e===1/0)t.arc(0,0,i,0,2*Math.PI);else{const s=this.radius2_===void 0?i:this.radius2_;this.radius2_!==void 0&&(e*=2);const r=this.angle_-Math.PI/2,o=2*Math.PI/e;for(let a=0;a<e;a++){const l=r+a*o,c=a%2===0?i:s;t.lineTo(c*Math.cos(l),c*Math.sin(l))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=De,e.fill(),t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}}class Qe extends no{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 Qe({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}}class Pt{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=Ag,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 Pt({geometry:t??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){typeof t=="function"?this.geometryFunction_=t:typeof t=="string"?this.geometryFunction_=function(e){return e.get(t)}:t?t!==void 0&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=Ag,this.geometry_=t}setZIndex(t){this.zIndex_=t}}function Gv(n){let t;if(typeof n=="function")t=n;else{let e;Array.isArray(n)?e=n:(Et(typeof n.getZIndex=="function","Expected an `Style` or an array of `Style`"),e=[n]),t=function(){return e}}return t}let bh=null;function Mg(n,t){if(!bh){const e=new Ht({color:"rgba(255,255,255,0.4)"}),i=new te({color:"#3399CC",width:1.25});bh=[new Pt({image:new Qe({fill:e,stroke:i,radius:5}),fill:e,stroke:i})]}return bh}function Ag(n){return n.getGeometry()}const Vv="#333";class qs{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.keepUpright_=t.keepUpright,this.scale_=t.scale,this.scaleArray_=ve(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 Ht({color:Vv}),this.maxAngle_=t.maxAngle!==void 0?t.maxAngle:Math.PI/4,this.placement_=t.placement!==void 0?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=t.stroke!==void 0?t.stroke:null,this.offsetX_=t.offsetX!==void 0?t.offsetX:0,this.offsetY_=t.offsetY!==void 0?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=t.padding===void 0?null:t.padding,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new qs({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof Ht?this.getFill().clone():this.getFill(),stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setKeepUpright(t){this.keepUpright_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=ve(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 Ot={ANIMATING:0,INTERACTING:1},K={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},el=[K.FILL],Tn=[K.STROKE],gs=[K.BEGIN_PATH],Dg=[K.CLOSE_PATH];class so extends lg{constructor(t,e,i,s){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=s,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return e==1?t:t.map(function(i){return i*e})}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),s=this.tmpCoordinate_,r=this.coordinates;let o=r.length;for(let a=0,l=t.length;a<l;a+=e)s[0]=t[a],s[1]=t[a+1],ts(i,s)&&(r[o++]=s[0],r[o++]=s[1]);return o}appendFlatLineCoordinates(t,e,i,s,r,o){const a=this.coordinates;let l=a.length;const c=this.getBufferedMaxExtent();o&&(e+=s);let h=t[e],u=t[e+1];const d=this.tmpCoordinate_;let g=!0,p,m,_;for(p=e+s;p<i;p+=s)d[0]=t[p],d[1]=t[p+1],_=Cc(c,d),_!==m?(g&&(a[l++]=h,a[l++]=u,g=!1),a[l++]=d[0],a[l++]=d[1]):_===oe.INTERSECTING?(a[l++]=d[0],a[l++]=d[1],g=!1):g=!0,h=d[0],u=d[1],m=_;return(r&&g||p===e+s)&&(a[l++]=h,a[l++]=u),l}drawCustomCoordinates_(t,e,i,s,r){for(let o=0,a=i.length;o<a;++o){const l=i[o],c=this.appendFlatLineCoordinates(t,e,l,s,!1,!1);r.push(c),e=l}return e}drawCustom(t,e,i,s,r){this.beginGeometry(t,e,r);const o=t.getType(),a=t.getStride(),l=this.coordinates.length;let c,h,u,d,g;switch(o){case"MultiPolygon":c=t.getOrientedFlatCoordinates(),d=[];const p=t.getEndss();g=0;for(let m=0,_=p.length;m<_;++m){const v=[];g=this.drawCustomCoordinates_(c,g,p[m],a,v),d.push(v)}this.instructions.push([K.CUSTOM,l,d,t,i,jc,r]),this.hitDetectionInstructions.push([K.CUSTOM,l,d,t,s||i,jc,r]);break;case"Polygon":case"MultiLineString":u=[],c=o=="Polygon"?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),g=this.drawCustomCoordinates_(c,0,t.getEnds(),a,u),this.instructions.push([K.CUSTOM,l,u,t,i,Vr,r]),this.hitDetectionInstructions.push([K.CUSTOM,l,u,t,s||i,Vr,r]);break;case"LineString":case"Circle":c=t.getFlatCoordinates(),h=this.appendFlatLineCoordinates(c,0,c.length,a,!1,!1),this.instructions.push([K.CUSTOM,l,h,t,i,Rn,r]),this.hitDetectionInstructions.push([K.CUSTOM,l,h,t,s||i,Rn,r]);break;case"MultiPoint":c=t.getFlatCoordinates(),h=this.appendFlatPointCoordinates(c,a),h>l&&(this.instructions.push([K.CUSTOM,l,h,t,i,Rn,r]),this.hitDetectionInstructions.push([K.CUSTOM,l,h,t,s||i,Rn,r]));break;case"Point":c=t.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),h=this.coordinates.length,this.instructions.push([K.CUSTOM,l,h,t,i,void 0,r]),this.hitDetectionInstructions.push([K.CUSTOM,l,h,t,s||i,void 0,r]);break}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[K.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[K.BEGIN_GEOMETRY,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;t.reverse();let e;const i=t.length;let s,r,o=-1;for(e=0;e<i;++e)s=t[e],r=s[0],r==K.END_GEOMETRY?o=e:r==K.BEGIN_GEOMETRY&&(s[2]=e,T0(this.hitDetectionInstructions,o,e),o=-1)}fillStyleToState(t,e={}){if(t){const i=t.getColor();e.fillPatternScale=i&&typeof i=="object"&&"src"in i?this.pixelRatio:1,e.fillStyle=Fi(i||De)}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const i=t.getColor();e.strokeStyle=Fi(i||Zr);const s=t.getLineCap();e.lineCap=s!==void 0?s:Ys;const r=t.getLineDash();e.lineDash=r?r.slice():Qi;const o=t.getLineDashOffset();e.lineDashOffset=o||tn;const a=t.getLineJoin();e.lineJoin=a!==void 0?a:Hs;const l=t.getWidth();e.lineWidth=l!==void 0?l:qr;const c=t.getMiterLimit();e.miterLimit=c!==void 0?c:Br;const h=t.getOffset();e.strokeOffset=h??hv,e.lineWidth>this.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0,e.strokeOffset=void 0;return e}setFillStrokeStyle(t,e){const i=this.state;this.fillStyleToState(t,i),this.strokeStyleToState(e,i)}createFill(t){const e=t.fillStyle,i=[K.SET_FILL_STYLE,e];return typeof e!="string"&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[K.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;(typeof i!="string"||t.currentFillStyle!=i)&&(this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,s=t.lineCap,r=t.lineDash,o=t.lineDashOffset,a=t.lineJoin,l=t.lineWidth,c=t.miterLimit,h=t.strokeOffset;(t.currentStrokeStyle!=i||t.currentLineCap!=s||r!=t.currentLineDash&&!xn(t.currentLineDash,r)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=l||t.currentMiterLimit!=c||t.currentStrokeOffset!=h)&&(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=s,t.currentLineDash=r,t.currentLineDashOffset=o,t.currentLineJoin=a,t.currentLineWidth=l,t.currentMiterLimit=c,t.currentStrokeOffset=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[K.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Qd(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;Ii(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class Wv extends so{constructor(t,e,i,s){super(t,e,i,s),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e,i){if(!this.image_||this.maxExtent&&!ts(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);const s=t.getFlatCoordinates(),r=t.getStride(),o=this.coordinates.length,a=this.appendFlatPointCoordinates(s,r);this.instructions.push([K.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([K.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i);const s=t.getFlatCoordinates(),r=[];for(let l=0,c=s.length;l<c;l+=t.getStride())(!this.maxExtent||ts(this.maxExtent,s.slice(l,l+2)))&&r.push(s[l],s[l+1]);const o=this.coordinates.length,a=this.appendFlatPointCoordinates(r,2);this.instructions.push([K.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([K.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const i=t.getAnchor(),s=t.getSize(),r=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=s[1],this.opacity_=t.getOpacity(),this.originX_=r[0],this.originY_=r[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=s[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}class Uv extends so{constructor(t,e,i,s){super(t,e,i,s)}drawFlatCoordinates_(t,e,i,s,r){const o=this.coordinates.length,a=this.appendFlatLineCoordinates(t,e,i,s,!1,!1);return this.instructions.push([K.MOVE_TO_LINE_TO,o,a,r*this.pixelRatio]),this.hitDetectionInstructions.push([K.MOVE_TO_LINE_TO,o,a,r]),i}drawLineString(t,e,i){const s=this.state,r=s.strokeStyle,o=s.lineWidth,a=s.strokeOffset;if(r===void 0||o===void 0)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([K.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Qi,tn],gs);const l=t.getFlatCoordinates(),c=t.getStride();this.drawFlatCoordinates_(l,0,l.length,c,a),this.hitDetectionInstructions.push(Tn),this.endGeometry(e)}drawMultiLineString(t,e,i){const s=this.state,r=s.strokeStyle,o=s.lineWidth,a=s.strokeOffset;if(r===void 0||o===void 0)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([K.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Qi,tn],gs);const l=t.getEnds(),c=t.getFlatCoordinates(),h=t.getStride();let u=0;for(let d=0,g=l.length;d<g;++d)u=this.drawFlatCoordinates_(c,u,l[d],h,a);this.hitDetectionInstructions.push(Tn),this.endGeometry(e)}finish(){const t=this.state;return t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&this.instructions.push(Tn),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(Tn),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(gs)}}class Fg extends so{constructor(t,e,i,s){super(t,e,i,s)}drawFlatCoordinatess_(t,e,i,s,r){const o=this.state,a=o.fillStyle!==void 0,l=o.strokeStyle!==void 0,c=i.length;this.instructions.push(gs),this.hitDetectionInstructions.push(gs);for(let h=0;h<c;++h){const u=i[h],d=this.coordinates.length,g=this.appendFlatLineCoordinates(t,e,u,s,!0,!l);this.instructions.push([K.MOVE_TO_LINE_TO,d,g,r*this.pixelRatio,!0]),this.hitDetectionInstructions.push([K.MOVE_TO_LINE_TO,d,g,r,!0]),l&&(this.instructions.push(Dg),this.hitDetectionInstructions.push(Dg)),e=u}return a&&(this.instructions.push(el),this.hitDetectionInstructions.push(el)),l&&(this.instructions.push(Tn),this.hitDetectionInstructions.push(Tn)),e}drawCircle(t,e,i){const s=this.state,r=s.fillStyle,o=s.strokeStyle,a=s.strokeOffset;if(r===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawCircle(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([K.SET_FILL_STYLE,De]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([K.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Qi,tn]);const l=t.getFlatCoordinates(),c=t.getStride(),h=this.coordinates.length;this.appendFlatLineCoordinates(l,0,l.length,c,!1,!1);const u=[K.CIRCLE,h,a];this.instructions.push(gs,u),this.hitDetectionInstructions.push(gs,u),s.fillStyle!==void 0&&(this.instructions.push(el),this.hitDetectionInstructions.push(el)),s.strokeStyle!==void 0&&(this.instructions.push(Tn),this.hitDetectionInstructions.push(Tn)),this.endGeometry(e)}drawPolygon(t,e,i){const s=this.state,r=s.fillStyle,o=s.strokeStyle,a=s.strokeOffset;if(r===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([K.SET_FILL_STYLE,De]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([K.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Qi,tn]);const l=t.getEnds(),c=t.getOrientedFlatCoordinates(),h=t.getStride();this.drawFlatCoordinatess_(c,0,l,h,a),this.endGeometry(e)}drawMultiPolygon(t,e,i){const s=this.state,r=s.fillStyle,o=s.strokeStyle,a=s.strokeOffset;if(r===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawMultiPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([K.SET_FILL_STYLE,De]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([K.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Qi,tn]);const l=t.getEndss(),c=t.getOrientedFlatCoordinates(),h=t.getStride();let u=0;for(let d=0,g=l.length;d<g;++d)u=this.drawFlatCoordinatess_(c,u,l[d],h,a);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const t=this.tolerance;if(t!==0){const e=this.coordinates;for(let i=0,s=e.length;i<s;++i)e[i]=as(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;this.updateFillStyle(t,this.createFill),this.updateStrokeStyle(t,this.applyStroke)}handleStrokeOffset_(t){const e=this.state,i=e.fillStyle,s=e.strokeStyle,r=e.strokeOffset;return Math.abs(r)>0&&i!==void 0&&s!==void 0?(e.strokeStyle=void 0,e.strokeOffset=0,t(),e.fillStyle=void 0,e.strokeStyle=s,e.strokeOffset=r,t(),e.fillStyle=i,!0):!1}}function $v(n,t,e,i,s){const r=[];let o=e,a=0,l=t.slice(e,2);for(;a<n&&o+s<i;){const[c,h]=l.slice(-2),u=t[o+s],d=t[o+s+1],g=Math.sqrt((u-c)*(u-c)+(d-h)*(d-h));if(a+=g,a>=n){const p=(n-a+g)/g,m=ke(c,u,p),_=ke(h,d,p);l.push(m,_),r.push(l),l=[m,_],a==n&&(o+=s),a=0}else if(a<n)l.push(t[o+s],t[o+s+1]),o+=s;else{const p=g-a,m=ke(c,u,p/g),_=ke(h,d,p/g);l.push(m,_),r.push(l),l=[m,_],a=0,o+=s}}return a>0&&r.push(l),r}function Xv(n,t,e,i,s){let r=e,o=e,a=0,l=0,c=e,h,u,d,g,p,m,_,v,y,w;for(u=e;u<i;u+=s){const x=t[u],C=t[u+1];p!==void 0&&(y=x-p,w=C-m,g=Math.sqrt(y*y+w*w),_!==void 0&&(l+=d,h=Math.acos((_*y+v*w)/(d*g)),h>n&&(l>a&&(a=l,r=c,o=u),l=0,c=u-s)),d=g,_=y,v=w),p=x,m=C}return l+=g,l>a?[c,u]:[r,o]}const il={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class Yv extends so{constructor(t,e,i,s){super(t,e,i,s),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[De]={fillStyle:De},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e,i){const s=this.textFillState_,r=this.textStrokeState_,o=this.textState_;if(this.text_===""||!o||!s&&!r)return;const a=this.coordinates;let l=a.length;const c=t.getType();let h=null,u=t.getStride();if(o.placement==="line"&&(c=="LineString"||c=="MultiLineString"||c=="Polygon"||c=="MultiPolygon")){if(!Wt(this.maxExtent,t.getExtent()))return;let d;if(h=t.getFlatCoordinates(),c=="LineString")d=[h.length];else if(c=="MultiLineString")d=t.getEnds();else if(c=="Polygon")d=t.getEnds().slice(0,1);else if(c=="MultiPolygon"){const _=t.getEndss();d=[];for(let v=0,y=_.length;v<y;++v)d.push(_[v][0])}this.beginGeometry(t,e,i);const g=o.repeat,p=g?void 0:o.textAlign;let m=0;for(let _=0,v=d.length;_<v;++_){let y;g?y=$v(g*this.resolution,h,m,d[_],u):y=[h.slice(m,d[_])];for(let w=0,x=y.length;w<x;++w){const C=y[w];let P=0,b=C.length;if(p==null){const I=Xv(o.maxAngle,C,0,C.length,2);P=I[0],b=I[1]}for(let I=P;I<b;I+=u)a.push(C[I],C[I+1]);const R=a.length;m=d[_],this.drawChars_(l,R),l=R}}this.endGeometry(e)}else{let d=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(),u=2;break;case"Polygon":h=t.getFlatInteriorPoint(),o.overflow||d.push(h[2]/this.resolution),u=3;break;case"MultiPolygon":const x=t.getFlatInteriorPoints();h=[];for(let C=0,P=x.length;C<P;C+=3)o.overflow||d.push(x[C+2]/this.resolution),h.push(x[C],x[C+1]);if(h.length===0)return;u=2;break}const g=this.appendFlatPointCoordinates(h,u);if(g===l)return;if(d&&(g-l)/2!==h.length/u){let x=l/2;d=d.filter((C,P)=>{const b=a[(x+P)*2]===h[P*u]&&a[(x+P)*2+1]===h[P*u+1];return b||--x,b})}this.saveTextStates_();const p=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,m=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(t,e,i);let _=o.padding;if(_!=us&&(o.scale[0]<0||o.scale[1]<0)){let x=o.padding[0],C=o.padding[1],P=o.padding[2],b=o.padding[3];o.scale[0]<0&&(C=-C,b=-b),o.scale[1]<0&&(x=-x,P=-P),_=[x,C,P,b]}const v=this.pixelRatio;this.instructions.push([K.DRAW_IMAGE,l,g,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,_==us?us:_.map(function(x){return x*v}),p,m,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]);const y=1/v,w=p?p.slice(0):null;w&&(w[1]=De),this.hitDetectionInstructions.push([K.DRAW_IMAGE,l,g,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[y,y],NaN,this.declutterMode_,this.declutterImageWithText_,_,w,m,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?De:this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]),this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,s=this.strokeKey_;t&&(s in this.strokeStates||(this.strokeStates[s]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const r=this.textKey_;r in this.textStates||(this.textStates[r]={font:e.font,textAlign:e.textAlign||jr,justify:e.justify,textBaseline:e.textBaseline||Za,scale:e.scale});const o=this.fillKey_;i&&(o in this.fillStates||(this.fillStates[o]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,s=this.textState_,r=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();const l=this.pixelRatio,c=il[s.textBaseline],h=this.textOffsetY_*l,u=this.text_,d=i?i.lineWidth*Math.abs(s.scale[0])/2:0;this.instructions.push([K.DRAW_CHARS,t,e,c,s.overflow,a,s.maxAngle,l,h,r,d*l,u,o,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([K.DRAW_CHARS,t,e,c,s.overflow,a&&De,s.maxAngle,l,h,r,d*l,u,o,1/l,this.declutterMode_,this.textKeepUpright_])}setTextStyle(t,e){let i,s,r;if(!t)this.text_="";else{const o=t.getFill();o?(s=this.textFillState_,s||(s={},this.textFillState_=s),s.fillStyle=Fi(o.getColor()||De)):(s=null,this.textFillState_=s);const a=t.getStroke();if(!a)r=null,this.textStrokeState_=r;else{r=this.textStrokeState_,r||(r={},this.textStrokeState_=r);const m=a.getLineDash(),_=a.getLineDashOffset(),v=a.getWidth(),y=a.getMiterLimit();r.lineCap=a.getLineCap()||Ys,r.lineDash=m?m.slice():Qi,r.lineDashOffset=_===void 0?tn:_,r.lineJoin=a.getLineJoin()||Hs,r.lineWidth=v===void 0?qr:v,r.miterLimit=y===void 0?Br:y,r.strokeStyle=Fi(a.getColor()||Zr)}i=this.textState_;const l=t.getFont()||ug;fv(l);const c=t.getScaleArray();i.overflow=t.getOverflow(),i.font=l,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||Za,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||us,i.scale=c===void 0?[1,1]:c;const h=t.getOffsetX(),u=t.getOffsetY(),d=t.getRotateWithView(),g=t.getKeepUpright(),p=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=h===void 0?0:h,this.textOffsetY_=u===void 0?0:u,this.textRotateWithView_=d===void 0?!1:d,this.textKeepUpright_=g===void 0?!0:g,this.textRotation_=p===void 0?0:p,this.strokeKey_=r?(typeof r.strokeStyle=="string"?r.strokeStyle:at(r.strokeStyle))+r.lineCap+r.lineDashOffset+"|"+r.lineWidth+r.lineJoin+r.miterLimit+"["+r.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=s&&s.fillStyle?typeof s.fillStyle=="string"?s.fillStyle:"|"+at(s.fillStyle):""}this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}const Hv={Circle:Fg,Default:so,Image:Wv,LineString:Uv,Polygon:Fg,Text:Yv};class Lg{constructor(t,e,i,s){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=s,this.resolution_=i,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const i=this.buildersByZIndex_[e];for(const s in i){const r=i[s].finish();t[e][s]=r}}return t}getBuilder(t,e){const i=t!==void 0?t.toString():"0";let s=this.buildersByZIndex_[i];s===void 0&&(s={},this.buildersByZIndex_[i]=s);let r=s[e];if(r===void 0){const o=Hv[e];r=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),s[e]=r}return r}}function Bv(n,t,e,i,s,r,o,a,l,c,h,u,d=!0){let g=n[t],p=n[t+1],m=0,_=0,v=0,y=0;function w(){m=g,_=p,t+=i,g=n[t],p=n[t+1],y+=v,v=Math.sqrt((g-m)*(g-m)+(p-_)*(p-_))}do w();while(t<e-i&&y+v<r);let x=v===0?0:(r-y)/v;const C=ke(m,g,x),P=ke(_,p,x),b=t-i,R=y,I=r+a*l(c,s,h);for(;t<e-i&&y+v<I;)w();x=v===0?0:(I-y)/v;const S=ke(m,g,x),F=ke(_,p,x);let k=!1;if(d)if(u){const N=[C,P,S,F];zf(N,0,4,2,u,N,N),k=N[0]>N[2]}else k=C>S;const T=Math.PI,L=[],A=b+i===t;t=b,v=0,y=R,g=n[t],p=n[t+1];let U;if(A){w(),U=Math.atan2(p-_,g-m),k&&(U+=U>0?-T:T);const N=(S+C)/2,$=(F+P)/2;return L[0]=[N,$,(I-r)/2,U,s],L}s=s.replace(/\n/g," ");for(let N=0,$=s.length;N<$;){w();let X=Math.atan2(p-_,g-m);if(k&&(X+=X>0?-T:T),U!==void 0){let D=X-U;if(D+=D>T?-2*T:D<-T?2*T:0,Math.abs(D)>o)return null}U=X;const Z=N;let J=0;for(;N<$;++N){const D=k?$-N-1:N,tt=a*l(c,s[D],h);if(t+i<e&&y+v<r+J+tt/2)break;J+=tt}if(N===Z)continue;const O=k?s.substring($-Z,$-N):s.substring(Z,N);x=v===0?0:(r+J/2-y)/v;const gt=ke(m,g,x),B=ke(_,p,x);L.push([gt,B,J/2,X,O]),r+=J}return L}class Ph{constructor(){E(this,"pushMethodArgs_",(...t)=>(this.push_(t),this));this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(Wa(),{get:(t,e)=>{if(typeof Wa()[e]=="function")return this.push_(e),this.pushMethodArgs_},set:(t,e,i)=>(this.push_(e,i),!0)})}push_(...t){const e=this.instructions_,i=this.zIndex+this.offset_;e[i]||(e[i]=[]),e[i].push(...t)}pushFunction(t){this.push_(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach(e=>{for(let i=0,s=e.length;i<s;++i){const r=e[i];if(typeof r=="function"){r(t);continue}const o=e[++i];if(typeof t[r]=="function")t[r](...o);else{if(typeof o=="function"){t[r]=o(t);continue}t[r]=o}}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}}const Ks=ze(),Mn=[],en=[],nn=[],An=[];function Og(n){return n[3].declutterBox}const zg=new RegExp("[֑-ࣿיִ-﷿ﹰ-ﻼࠀ--]");function Rh(n,t){return t==="start"?t=zg.test(n)?"right":"left":t==="end"&&(t=zg.test(n)?"left":"right"),il[t]}function Zv(n,t,e){return e>0&&n.push(`
|
|
24
|
+
`,""),n.push(t,""),n}function jv(n,t,e){return e%2===0&&(n+=t),n}class qv{constructor(t,e,i,s,r){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=s.instructions,this.coordinates=s.coordinates,this.coordinateCache_={},this.renderedTransform_=xe(),this.hitDetectionInstructions=s.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=s.fillStates||{},this.strokeStates=s.strokeStates||{},this.textStates=s.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=r?new Ph:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,s){const r=t+e+i+s;if(this.labels_[r])return this.labels_[r];const o=s?this.strokeStates[s]:null,a=i?this.fillStates[i]:null,l=this.textStates[e],c=this.pixelRatio,h=[l.scale[0]*c,l.scale[1]*c],u=l.justify?il[l.justify]:Rh(Array.isArray(t)?t[0]:t,l.textAlign||jr),d=s&&o.lineWidth?o.lineWidth:0,g=Array.isArray(t)?t:String(t).split(`
|
|
25
|
+
`).reduce(Zv,[]),{width:p,height:m,widths:_,heights:v,lineWidths:y}=pv(l,g),w=p+d,x=[],C=(w+2)*h[0],P=(m+d)*h[1],b={width:C<0?Math.floor(C):Math.ceil(C),height:P<0?Math.floor(P):Math.ceil(P),contextInstructions:x};(h[0]!=1||h[1]!=1)&&x.push("scale",h),s&&(x.push("strokeStyle",o.strokeStyle),x.push("lineWidth",d),x.push("lineCap",o.lineCap),x.push("lineJoin",o.lineJoin),x.push("miterLimit",o.miterLimit),x.push("setLineDash",[o.lineDash]),x.push("lineDashOffset",o.lineDashOffset)),i&&x.push("fillStyle",a.fillStyle),x.push("textBaseline","middle"),x.push("textAlign","center");const R=.5-u;let I=u*w+R*d;const S=[],F=[];let k=0,T=0,L=0,A=0,U;for(let N=0,$=g.length;N<$;N+=2){const X=g[N];if(X===`
|
|
26
|
+
`){T+=k,k=0,I=u*w+R*d,++A;continue}const Z=g[N+1]||l.font;Z!==U&&(s&&S.push("font",Z),i&&F.push("font",Z),U=Z),k=Math.max(k,v[L]);const J=[X,I+R*_[L]+u*(_[L]-y[A]),.5*(d+k)+T];I+=_[L],s&&S.push("strokeText",J),i&&F.push("fillText",J),++L}return Array.prototype.push.apply(x,S),Array.prototype.push.apply(x,F),this.labels_[r]=b,b}replayTextBackground_(t,e,i,s,r,o,a){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,s),t.lineTo.apply(t,r),t.lineTo.apply(t,e),o&&(this.alignAndScaleFill_=o[2],t.fillStyle=o[1],this.fill_(t)),a&&(this.setStrokeStyle_(t,a),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,s,r,o,a,l,c,h,u,d,g,p,m,_){a*=d[0],l*=d[1];let v=i-a,y=s-l;const w=r+c>t?t-c:r,x=o+h>e?e-h:o,C=p[3]+w*d[0]+p[1],P=p[0]+x*d[1]+p[2],b=v-p[3],R=y-p[0];(m||u!==0)&&(Mn[0]=b,An[0]=b,Mn[1]=R,en[1]=R,en[0]=b+C,nn[0]=en[0],nn[1]=R+P,An[1]=nn[1]);let I;return u!==0?(I=ui(xe(),i,s,1,1,u,-i,-s),Yt(I,Mn),Yt(I,en),Yt(I,nn),Yt(I,An),Zi(Math.min(Mn[0],en[0],nn[0],An[0]),Math.min(Mn[1],en[1],nn[1],An[1]),Math.max(Mn[0],en[0],nn[0],An[0]),Math.max(Mn[1],en[1],nn[1],An[1]),Ks)):Zi(Math.min(b,b+C),Math.min(R,R+P),Math.max(b,b+C),Math.max(R,R+P),Ks),g&&(v=Math.round(v),y=Math.round(y)),{drawImageX:v,drawImageY:y,drawImageW:w,drawImageH:x,originX:c,originY:h,declutterBox:{minX:Ks[0],minY:Ks[1],maxX:Ks[2],maxY:Ks[3],value:_},canvasTransform:I,scale:d}}replayImageOrLabel_(t,e,i,s,r,o,a){const l=!!(o||a),c=s.declutterBox,h=a?a[2]*s.scale[0]/2:0;return c.minX-h<=e[0]&&c.maxX+h>=0&&c.minY-h<=e[1]&&c.maxY+h>=0&&(l&&this.replayTextBackground_(t,Mn,en,nn,An,o,a),mv(t,s.canvasTransform,r,i,s.originX,s.originY,s.drawImageW,s.drawImageH,s.drawImageX,s.drawImageY,s.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=Yt(this.renderedTransform_,[0,0]),s=512*this.pixelRatio;t.save(),t.translate(i[0]%s,i[1]%s),e!==1&&t.scale(e,e)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],e[1]&&(t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6]))}drawLabelWithPointPlacement_(t,e,i,s){const r=this.textStates[e],o=this.createLabel(t,e,s,i),a=this.strokeStates[i],l=this.pixelRatio,c=Rh(Array.isArray(t)?t[0]:t,r.textAlign||jr),h=il[r.textBaseline||Za],u=a&&a.lineWidth?a.lineWidth:0,d=o.width/l-2*r.scale[0],g=c*d+2*(.5-c)*u,p=h*o.height/l+2*(.5-h)*u;return{label:o,anchorX:g,anchorY:p}}execute_(t,e,i,s,r,o,a,l){const c=this.zIndexContext_;let h;this.pixelCoordinates_&&xn(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=Di(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),E_(this.renderedTransform_,i));let u=0;const d=s.length;let g=0,p,m,_,v,y,w,x,C,P,b,R,I,S,F,k,T,L=0,A=0;const U=this.coordinateCache_,N=this.viewRotation_,$=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,X={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:N},Z=this.instructions!=s||this.overlaps?0:200;let J,O,gt,B;for(;u<d;){const D=s[u];switch(D[0]){case K.BEGIN_GEOMETRY:J=D[1],B=D[3],J.getGeometry()?a!==void 0&&!Wt(a,B.getExtent())?u=D[2]+1:++u:u=D[2],c&&(c.zIndex=D[4]);break;case K.BEGIN_PATH:L>Z&&(this.fill_(t),L=0),A>Z&&(t.stroke(),A=0),!L&&!A&&(t.beginPath(),C=NaN,P=NaN),++u;break;case K.CIRCLE:g=D[1],v=D[2]??0;const H=h[g],lt=h[g+1],It=h[g+2]-v,$t=h[g+3]-v,Kt=It-H,Jt=$t-lt,V=Math.sqrt(Kt*Kt+Jt*Jt);t.moveTo(H+V,lt),t.arc(H,lt,V,0,2*Math.PI,!0),++u;break;case K.CLOSE_PATH:t.closePath(),++u;break;case K.CUSTOM:g=D[1],p=D[2];const Ye=D[3],le=D[4],st=D[5];X.geometry=Ye,X.feature=J,u in U||(U[u]=[]);const Pe=U[u];st?st(h,g,p,2,Pe):(Pe[0]=h[g],Pe[1]=h[g+1],Pe.length=2),c&&(c.zIndex=D[6]),le(Pe,X),++u;break;case K.DRAW_IMAGE:g=D[1],p=D[2],I=D[3],m=D[4],_=D[5];let ge=D[6];const Xt=D[7],se=D[8],Mt=D[9],ni=D[10];let Dt=D[11];const si=D[12];let ri=D[13];x=D[14]||"declutter";const bi=D[15];if(!I&&D.length>=20){S=D[19],F=D[20],k=D[21],T=D[22];const Oe=this.drawLabelWithPointPlacement_(S,F,k,T);I=Oe.label,D[3]=I;const yn=D[23];m=(Oe.anchorX-yn)*this.pixelRatio,D[4]=m;const ai=D[24];_=(Oe.anchorY-ai)*this.pixelRatio,D[5]=_,ge=I.height,D[6]=ge,ri=I.width,D[13]=ri}let xt;D.length>25&&(xt=D[25]);let vt,pt,q;D.length>17?(vt=D[16],pt=D[17],q=D[18]):(vt=us,pt=null,q=null),ni&&$?Dt+=N:!ni&&!$&&(Dt-=N);let Tt=0;for(;g<p;g+=2){if(xt&&xt[Tt++]<ri/this.pixelRatio)continue;const Oe=this.calculateImageOrLabelDimensions_(I.width,I.height,h[g],h[g+1],ri,ge,m,_,se,Mt,Dt,si,r,vt,!!pt||!!q,J),yn=[t,e,I,Oe,Xt,pt,q];if(l){let ai,Yi,li;if(bi){const jt=p-g;if(!bi[jt]){bi[jt]={args:yn,declutterMode:x};continue}const Ie=bi[jt];ai=Ie.args,Yi=Ie.declutterMode,delete bi[jt],li=Og(ai)}let _n,vn;if(ai&&(Yi!=="declutter"||!l.collides(li))&&(_n=!0),(x!=="declutter"||!l.collides(Oe.declutterBox))&&(vn=!0),Yi==="declutter"&&x==="declutter"){const jt=_n&&vn;_n=jt,vn=jt}_n&&(Yi!=="none"&&l.insert(li),this.replayImageOrLabel_.apply(this,ai)),vn&&(x!=="none"&&l.insert(Oe.declutterBox),this.replayImageOrLabel_.apply(this,yn))}else this.replayImageOrLabel_.apply(this,yn)}++u;break;case K.DRAW_CHARS:const rt=D[1],ot=D[2],bt=D[3],Zt=D[4];T=D[5];const Re=D[6],pe=D[7],zt=D[8];k=D[9];const re=D[10];S=D[11],Array.isArray(S)&&(S=S.reduce(jv,"")),F=D[12];const Ft=[D[13],D[13]];x=D[14]||"declutter";const me=D[15],ce=this.textStates[F],Qt=ce.font,At=[ce.scale[0]*pe,ce.scale[1]*pe];let ie;Qt in this.widths_?ie=this.widths_[Qt]:(ie={},this.widths_[Qt]=ie);const Xi=sh(h,rt,ot,2),oi=Math.abs(At[0])*pg(Qt,S,ie);if(Zt||oi<=Xi){const Oe=this.textStates[F].textAlign,yn=(Xi-oi)*Rh(S,Oe),ai=Bv(h,rt,ot,2,S,yn,Re,Math.abs(At[0]),pg,Qt,ie,$?0:this.viewRotation_,me);t:if(ai){const Yi=[];let li,_n,vn,jt,Ie;if(k)for(li=0,_n=ai.length;li<_n;++li){Ie=ai[li],vn=Ie[4],jt=this.createLabel(vn,F,"",k),m=Ie[2]+(At[0]<0?-re:re),_=bt*jt.height+(.5-bt)*2*re*At[1]/At[0]-zt;const wn=this.calculateImageOrLabelDimensions_(jt.width,jt.height,Ie[0],Ie[1],jt.width,jt.height,m,_,0,0,Ie[3],Ft,!1,us,!1,J);if(l&&x==="declutter"&&l.collides(wn.declutterBox))break t;Yi.push([t,e,jt,wn,1,null,null])}if(T)for(li=0,_n=ai.length;li<_n;++li){Ie=ai[li],vn=Ie[4],jt=this.createLabel(vn,F,T,""),m=Ie[2],_=bt*jt.height-zt;const wn=this.calculateImageOrLabelDimensions_(jt.width,jt.height,Ie[0],Ie[1],jt.width,jt.height,m,_,0,0,Ie[3],Ft,!1,us,!1,J);if(l&&x==="declutter"&&l.collides(wn.declutterBox))break t;Yi.push([t,e,jt,wn,1,null,null])}l&&x!=="none"&&l.load(Yi.map(Og));for(let wn=0,xR=Yi.length;wn<xR;++wn)this.replayImageOrLabel_.apply(this,Yi[wn])}}++u;break;case K.END_GEOMETRY:if(o!==void 0){J=D[1];const Oe=o(J,B,x);if(Oe)return Oe}++u;break;case K.FILL:Z?L++:this.fill_(t),++u;break;case K.MOVE_TO_LINE_TO:for(g=D[1],p=D[2],v=D[3],y=D[4]??!1,O=h[g],gt=h[g+1],v&&(w=g,[O,gt]=Ya(O,gt,y?h[p-4]:void 0,y?h[p-3]:void 0,h[g+2],h[g+3],v)),t.moveTo(O,gt),C=O+.5|0,P=gt+.5|0,g+=2;g<p;g+=2)O=h[g],gt=h[g+1],b=O+.5|0,R=gt+.5|0,(g==p-2||b!==C||R!==P)&&(v&&(g==p-2?[O,gt]=Ya(O,gt,h[g-2],h[g-1],y?h[w+2]:void 0,y?h[w+3]:void 0,v):[O,gt]=Ya(O,gt,h[g-2],h[g-1],h[g+2],h[g+3],v)),t.lineTo(O,gt),C=b,P=R);++u;break;case K.SET_FILL_STYLE:this.alignAndScaleFill_=D[2],L&&(this.fill_(t),L=0,A&&(t.stroke(),A=0)),t.fillStyle=D[1],++u;break;case K.SET_STROKE_STYLE:A&&(t.stroke(),A=0),this.setStrokeStyle_(t,D),++u;break;case K.STROKE:Z?A++:t.stroke(),++u;break;default:++u;break}}L&&this.fill_(t),A&&t.stroke()}execute(t,e,i,s,r,o){this.viewRotation_=s,this.execute_(t,e,i,this.instructions,r,void 0,void 0,o)}executeHitDetection(t,e,i,s,r){return this.viewRotation_=i,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,s,r)}}const ps=["Polygon","Circle","LineString","Image","Text","Default"],nl=["Image","Text"],Kv=ps.filter(n=>!nl.includes(n));let kg=!1,Ng=!1;function Jv(){let n=0;const t=i=>{const s=Nt(1,1,null,{willReadFrequently:i});let r=0;const o=performance.now();for(;performance.now()-o<50;++r)s.fillStyle=`rgba(255,0,${r%256},1)`,s.fillRect(0,0,1,1),s.getImageData(0,0,1,1);return n=r>n?r:n,r};kg={[t(!0)]:!0,[t(!1)]:!1,[t(void 0)]:void 0}[n],Ng=!0}class Gg{constructor(t,e,i,s,r,o,a){this.maxExtent_=t,this.overlaps_=s,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=xe(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(r,a)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(const i in t){let s=this.executorsByZIndex_[i];s===void 0&&(s={},this.executorsByZIndex_[i]=s);const r=t[i];for(const o in r){const a=r[o];s[o]=new qv(this.resolution_,this.pixelRatio_,this.overlaps_,a,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let s=0,r=t.length;s<r;++s)if(t[s]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,s,r,o){Ng===!1&&Jv(),s=Math.round(s);const a=s*2+1,l=ui(this.hitDetectionTransform_,s+.5,s+.5,1/e,-1/e,-i,-t[0],-t[1]),c=!this.hitDetectionContext_;c&&(this.hitDetectionContext_=Nt(a,a,null,{willReadFrequently:kg}));const h=this.hitDetectionContext_;h.canvas.width!==a||h.canvas.height!==a?(h.canvas.width=a,h.canvas.height=a):c||h.clearRect(0,0,a,a);let u;this.renderBuffer_!==void 0&&(u=ze(),Ir(u,t),Ii(u,e*(this.renderBuffer_+s),u));const d=Qv(s);let g;function p(C,P,b){const R=h.getImageData(0,0,a,a).data;for(let I=0,S=d.length;I<S;I++)if(R[d[I]]>0){if(!o||b==="none"||g!=="Image"&&g!=="Text"||o.includes(C)){const F=(d[I]-3)/4,k=s-F%a,T=s-(F/a|0),L=r(C,P,k*k+T*T);if(L)return L}h.clearRect(0,0,a,a);break}}const m=Object.keys(this.executorsByZIndex_).map(Number);m.sort(Pi);let _,v,y,w,x;for(_=m.length-1;_>=0;--_){const C=m[_].toString();for(y=this.executorsByZIndex_[C],v=ps.length-1;v>=0;--v)if(g=ps[v],w=y[g],w!==void 0&&(x=w.executeHitDetection(h,l,i,p,u),x))return x}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],s=e[1],r=e[2],o=e[3],a=[i,s,i,o,r,o,r,s];return Di(a,0,8,2,t,a),a}isEmpty(){return Pn(this.executorsByZIndex_)}execute(t,e,i,s,r,o,a){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?S0:Pi),o=o||ps;const c=ps.length;for(let h=0,u=l.length;h<u;++h){const d=l[h].toString(),g=this.executorsByZIndex_[d];for(let p=0,m=o.length;p<m;++p){const _=o[p],v=g[_];if(v!==void 0){const y=a===null?void 0:v.getZIndexContext(),w=y?y.getContext():t,x=this.maxExtent_&&_!=="Image"&&_!=="Text";if(x&&(w.save(),this.clip(w,i)),!y||_==="Text"||_==="Image"?v.execute(w,e,i,s,r,a):y.pushFunction(C=>v.execute(C,e,i,s,r,a)),x&&w.restore(),y){y.offset();const C=l[h]*c+ps.indexOf(_);this.deferredZIndexContexts_[C]||(this.deferredZIndexContexts_[C]=[]),this.deferredZIndexContexts_[C].push(y)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(Pi);for(let i=0,s=e.length;i<s;++i)t[e[i]].forEach(r=>{r.draw(this.renderedContext_),r.clear()}),t[e[i]].length=0}}const Ih={};function Qv(n){if(Ih[n]!==void 0)return Ih[n];const t=n*2+1,e=n*n,i=new Array(e+1);for(let r=0;r<=n;++r)for(let o=0;o<=n;++o){const a=r*r+o*o;if(a>e)break;let l=i[a];l||(l=[],i[a]=l),l.push(((n+r)*t+(n+o))*4+3),r>0&&l.push(((n-r)*t+(n+o))*4+3),o>0&&(l.push(((n+r)*t+(n-o))*4+3),r>0&&l.push(((n-r)*t+(n-o))*4+3))}const s=[];for(let r=0,o=i.length;r<o;++r)i[r]&&s.push(...i[r]);return Ih[n]=s,s}function Vg(n,t,e,i){return e!==void 0&&i!==void 0?[e/n,i/t]:e!==void 0?e/n:i!==void 0?i/t:1}class Dn extends tl{constructor(t){t=t||{};const e=t.opacity!==void 0?t.opacity:1,i=t.rotation!==void 0?t.rotation:0,s=t.scale!==void 0?t.scale:1,r=t.rotateWithView!==void 0?t.rotateWithView:!1;super({opacity:e,rotation:i,scale:s,displacement:t.displacement!==void 0?t.displacement:[0,0],rotateWithView:r,declutterMode:t.declutterMode}),this.anchor_=t.anchor!==void 0?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=t.anchorOrigin!==void 0?t.anchorOrigin:"top-left",this.anchorXUnits_=t.anchorXUnits!==void 0?t.anchorXUnits:"fraction",this.anchorYUnits_=t.anchorYUnits!==void 0?t.anchorYUnits:"fraction",this.crossOrigin_=t.crossOrigin!==void 0?t.crossOrigin:null,this.referrerPolicy_=t.referrerPolicy;const o=t.img!==void 0?t.img:null;let a=t.src;Et(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||at(o)),Et(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),Et(!((t.width!==void 0||t.height!==void 0)&&t.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(t.src!==void 0?l=Y.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?Y.LOADED:Y.IDLE:l=Y.LOADING:l=Y.LOADED),this.color_=t.color!==void 0?hs(t.color):null,this.iconImage_=Hr(o,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},l,this.color_),this.offset_=t.offset!==void 0?t.offset:[0,0],this.offsetOrigin_=t.offsetOrigin!==void 0?t.offsetOrigin:"top-left",this.origin_=null,this.size_=t.size!==void 0?t.size:null,this.initialOptions_,t.width!==void 0||t.height!==void 0){let c,h;if(t.size)[c,h]=t.size;else{const u=this.getImage(1);if(u.width&&u.height)c=u.width,h=u.height;else if(u instanceof HTMLImageElement){this.initialOptions_=t;const d=()=>{if(this.unlistenImageChange(d),!this.initialOptions_)return;const g=this.iconImage_.getSize();this.setScale(Vg(g[0],g[1],t.width,t.height))};this.listenImageChange(d);return}}c!==void 0&&this.setScale(Vg(c,h,t.width,t.height))}}clone(){let t,e,i;return this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new Dn({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:i,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const 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(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(t){const e=t?hs(t):null;if(this.color_===e||this.color_&&e&&this.color_.length===e.length&&this.color_.every((o,a)=>o===e[a]))return;this.color_=e;const i=this.getSrc(),s=i!==void 0?null:this.getHitDetectionImage(),r=i!==void 0?Y.IDLE:this.iconImage_.getImageState();this.iconImage_=Hr(s,i,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},r,this.color_)}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if(this.offsetOrigin_!="top-left"){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(t[0]=i[0]-e[0]-t[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(t){this.iconImage_=Hr(null,t,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},Y.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();if(this.size_)return this.size_[0]*t[0];if(this.iconImage_.getImageState()==Y.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()==Y.LOADED)return this.iconImage_.getSize()[1]*t[1]}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(Q.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(Q.CHANGE,t)}ready(){return this.iconImage_.ready()}}const Ve=.5;function Wg(n,t,e,i,s,r,o,a,l){const c=l?Wc(s):s,h=n[0]*Ve,u=n[1]*Ve,d=Nt(h,u);d.imageSmoothingEnabled=!1;const g=d.canvas,p=new mg(d,Ve,s,null,o,a,l?kr(w_(),l):null),m=e.length,_=Math.floor((256*256*256-1)/m),v={};for(let w=1;w<=m;++w){const x=e[w-1],C=x.getStyleFunction()||i;if(!C)continue;let P=C(x,r);if(!P)continue;Array.isArray(P)||(P=[P]);const R=(w*_).toString(16).padStart(7,"#00000");for(let I=0,S=P.length;I<S;++I){const F=P[I],k=F.getGeometryFunction()(x);if(!k||!Wt(c,k.getExtent()))continue;const T=F.clone(),L=T.getFill();L&&L.setColor(R);const A=T.getStroke();A&&(A.setColor(R),A.setLineDash(null)),T.setText(void 0);const U=F.getImage();if(U){const Z=U.getImageSize();if(!Z)continue;const J=Nt(Z[0],Z[1],void 0,{alpha:!1}),O=J.canvas;J.fillStyle=R,J.fillRect(0,0,O.width,O.height),T.setImage(new Dn({img:O,anchor:U.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:U.getOrigin(),opacity:1,size:U.getSize(),scale:U.getScale(),rotation:U.getRotation(),rotateWithView:U.getRotateWithView()}))}const N=T.getZIndex()||0;let $=v[N];$||($={},v[N]=$,$.Polygon=[],$.Circle=[],$.LineString=[],$.Point=[]);const X=k.getType();if(X==="GeometryCollection"){const Z=k.getGeometriesArrayRecursive();for(let J=0,O=Z.length;J<O;++J){const gt=Z[J];$[gt.getType().replace("Multi","")].push(gt,T)}}else $[X.replace("Multi","")].push(k,T)}}const y=Object.keys(v).map(Number).sort(Pi);for(let w=0,x=y.length;w<x;++w){const C=v[y[w]];for(const P in C){const b=C[P];for(let R=0,I=b.length;R<I;R+=2){p.setStyle(b[R+1]);for(let S=0,F=t.length;S<F;++S)p.setTransform(t[S]),p.drawGeometry(b[R])}}}return d.getImageData(0,0,g.width,g.height)}function Ug(n,t,e){const i=[];if(e){const s=Math.floor(Math.round(n[0])*Ve),r=Math.floor(Math.round(n[1])*Ve),o=(kt(s,0,e.width-1)+kt(r,0,e.height-1)*e.width)*4,a=e.data[o],l=e.data[o+1],h=e.data[o+2]+256*(l+256*a),u=Math.floor((256*256*256-1)/t.length);h&&h%u===0&&i.push(t[h/u-1])}return i}class $g extends hi{constructor(t,e,i,s){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=s}}const tw=5;class ew extends Lr{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=tw}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return et()}getData(t){return null}prepareFrame(t){return et()}renderFrame(t,e){return et()}forEachFeatureAtCoordinate(t,e,i,s,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;(e.getState()===Y.LOADED||e.getState()===Y.ERROR)&&this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=Y.LOADED&&e!=Y.ERROR&&t.addEventListener(Q.CHANGE,this.boundHandleImageChange_),e==Y.IDLE&&(t.load(),e=t.getState()),e==Y.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&t.getSourceState()==="ready"&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}}const Xg=[];let Js=null;function iw(){Js=Nt(1,1,void 0,{willReadFrequently:!0})}class Sh extends ew{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=xe(),this.pixelTransform=xe(),this.inversePixelTransform=xe(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){Js||iw(),Js.clearRect(0,0,1,1);let s;try{Js.drawImage(t,e,i,1,1,0,0,1,1),s=Js.getImageData(0,0,1,1).data}catch{return Js=null,null}return s}getBackground(t){let i=this.getLayer().getBackground();return typeof i=="function"&&(i=i(t.viewState.resolution)),i||void 0}useContainer(t,e,i){const s=this.getLayer().getClassName();let r,o;if(t&&t.className===s&&(!i||t&&t.style.backgroundColor&&xn(hs(t.style.backgroundColor),hs(i)))){const a=t.firstElementChild;In(a)&&(o=a.getContext("2d"))}if(o&&I_(o.canvas.style.transform,e)?(this.container=t,this.context=o,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){r=Ae?ig():document.createElement("div"),r.className=s;let a=r.style;a.position="absolute",a.width="100%",a.height="100%",o=Nt();const l=o.canvas;r.appendChild(l),a=l.style,a.position="absolute",a.left="0",a.transformOrigin="top left",this.container=r,this.context=o}!this.containerReused&&i&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const s=Te(i),r=Ea(i),o=wa(i),a=va(i);Yt(e.coordinateToPixelTransform,s),Yt(e.coordinateToPixelTransform,r),Yt(e.coordinateToPixelTransform,o),Yt(e.coordinateToPixelTransform,a);const l=this.inversePixelTransform;Yt(l,s),Yt(l,r),Yt(l,o),Yt(l,a),t.save(),t.beginPath(),t.moveTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.lineTo(Math.round(a[0]),Math.round(a[1])),t.clip()}prepareContainer(t,e){const i=t.extent,s=t.viewState.resolution,r=t.viewState.rotation,o=t.pixelRatio,a=Math.round(ut(i)/s*o),l=Math.round(Vt(i)/s*o);ui(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/o,1/o,r,-a/2,-l/2),Of(this.inversePixelTransform,this.pixelTransform);const c=R_(this.pixelTransform);if(this.useContainer(e,c,this.getBackground(t)),!this.containerReused){const h=this.context.canvas;h.width!=a||h.height!=l?(h.width=a,h.height=l):this.context.clearRect(0,0,a,l),c!==h.style.transform&&(h.style.transform=c)}}dispatchRenderEvent_(t,e,i){const s=this.getLayer();if(s.hasListener(t)){const r=new $g(t,this.inversePixelTransform,i,e);s.dispatchEvent(r)}}preRender(t,e){this.frameState=e,!e.declutter&&this.dispatchRenderEvent_(qe.PRERENDER,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(qe.POSTRENDER,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new Ph),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(qe.PRERENDER,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(qe.POSTRENDER,this.context,t))}getRenderTransform(t,e,i,s,r,o,a){const l=r/2,c=o/2,h=s/e,u=-h,d=-t[0]+a,g=-t[1];return ui(this.tempTransform,l,c,h,u,-i,d,g)}disposeInternal(){delete this.frameState,super.disposeInternal()}}class Yg extends Sh{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=ze(),this.wrappedRenderedExtent_=ze(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(t,e,i){const s=e.extent,r=e.viewState,o=r.center,a=r.resolution,l=r.projection,c=r.rotation,h=l.getExtent(),u=this.getLayer().getSource(),d=this.getLayer().getDeclutter(),g=e.pixelRatio,p=e.viewHints,m=!(p[Ot.ANIMATING]||p[Ot.INTERACTING]),_=this.context,v=Math.round(ut(s)/a*g),y=Math.round(Vt(s)/a*g),w=u.getWrapX()&&l.canWrapX(),x=w?ut(h):null,C=w?Math.ceil((s[2]-h[2])/x)+(this.extendX_?2:1):1;let P=w?Math.floor((s[0]-h[0])/x)-(this.extendX_?1:0):0;do{let b=this.getRenderTransform(o,a,0,g,v,y,P*x);e.declutter&&(b=b.slice(0)),t.execute(_,[_.canvas.width,_.canvas.height],b,c,m,i===void 0?ps:i?nl:Kv,i?d&&e.declutter[d]:void 0)}while(++P<C)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=Nt(this.context.canvas.width,this.context.canvas.height,Xg))}resetDrawContext_(){if(this.opacity_!==1&&this.targetContext_){const t=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=t,Ur(this.context),Xg.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(t){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,t,!0)}renderDeferredInternal(t){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,t,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex];this.opacity_=i.opacity;const s=t.viewState;this.prepareContainer(t,e);const r=this.context,o=this.replayGroup_;let a=o&&!o.isEmpty();if(!a&&!(this.getLayer().hasListener(qe.PRERENDER)||this.getLayer().hasListener(qe.POSTRENDER)))return this.container;this.setDrawContext_(),this.preRender(r,t),s.projection,this.clipExtent_=null;let l=!1;if(a&&i.extent&&this.clipping){const c=Ai(i.extent);a=Wt(c,t.extent),a&&!Bi(c,t.extent)&&(t.declutter?this.clipExtent_=c:(this.clipUnrotated(r,t,c),l=!0))}return a&&this.renderWorlds(o,t,this.getLayer().getDeclutter()?!1:void 0),l&&r.restore(),this.postRender(r,t),this.renderedRotation_!==s.rotation&&(this.renderedRotation_=s.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise(e=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const i=this.frameState.size.slice(),s=this.renderedCenter_,r=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,c=this.getLayer(),h=[],u=i[0]*Ve,d=i[1]*Ve;h.push(this.getRenderTransform(s,r,o,Ve,u,d,0).slice());const g=c.getSource(),p=a.getExtent();if(g.getWrapX()&&a.canWrapX()&&!Bi(p,l)){let m=l[0];const _=ut(p);let v=0,y;for(;m<p[0];)--v,y=_*v,h.push(this.getRenderTransform(s,r,o,Ve,u,d,y).slice()),m+=_;for(v=0,m=l[2];m>p[2];)++v,y=_*v,h.push(this.getRenderTransform(s,r,o,Ve,u,d,y).slice()),m-=_}this.hitDetectionImageData_=Wg(i,h,this.renderedFeatures_,c.getStyleFunction(),l,r,o,ja(r,this.renderedPixelRatio_),null)}e(Ug(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,s,r){var d,g;if(!this.replayGroup_)return;const o=e.viewState.resolution,a=e.viewState.rotation,l=this.getLayer(),c={},h=function(p,m,_){const v=at(p),y=c[v];if(y){if(y!==!0&&_<y.distanceSq){if(_===0)return c[v]=!0,r.splice(r.lastIndexOf(y),1),s(p,l,m);y.geometry=m,y.distanceSq=_}}else{if(_===0)return c[v]=!0,s(p,l,m);r.push(c[v]={feature:p,layer:l,geometry:m,distanceSq:_,callback:s})}},u=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,o,a,i,h,u?(g=(d=e.declutter)==null?void 0:d[u])==null?void 0:g.all().map(p=>p.value):null)}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const s=t.viewHints[Ot.ANIMATING],r=t.viewHints[Ot.INTERACTING],o=e.getUpdateWhileAnimating(),a=e.getUpdateWhileInteracting();if(this.ready&&!o&&s||!a&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const l=t.extent,c=t.viewState,h=c.projection,u=c.resolution,d=t.pixelRatio,g=e.getRevision(),p=e.getRenderBuffer();let m=e.getRenderOrder();m===void 0&&(m=vv);const _=c.center.slice(),v=Ii(l,p*u),y=v.slice(),w=[v.slice()],x=h.getExtent(),C=i.getWrapX()&&h.canWrapX();if(this.extendX_=!1,C){const A=i.getExtent();A&&!qi(A)&&(this.extendX_=A[0]<x[0]||A[2]>x[2])}if(C&&(!Bi(x,t.extent)||this.extendX_)){const A=ut(x),U=Math.max(ut(v)/2,A);let N=x[0],$=x[2];this.extendX_&&(N-=A,$+=A),v[0]=N-U,v[2]=$+U,Mc(_,h);const X=af(w[0],h);X[0]<x[0]&&X[2]<x[2]?w.push([X[0]+A,X[1],X[2]+A,X[3]]):X[0]>x[0]&&X[2]>x[2]&&w.push([X[0]-A,X[1],X[2]-A,X[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedPixelRatio_===d&&this.renderedRevision_==g&&this.renderedRenderOrder_==m&&this.renderedFrameDeclutter_===!!t.declutter&&Bi(this.wrappedRenderedExtent_,v))return xn(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=_,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const P=new Lg(_g(u,d),v,u,d);let b;for(let A=0,U=w.length;A<U;++A)i.loadFeatures(w[A],u,h);const R=ja(u,d);let I=!0;const S=(A,U)=>{let N;const $=A.getStyleFunction()||e.getStyleFunction();if($&&(N=$(A,u)),N){const X=this.renderFeature(A,R,N,P,b,this.getLayer().getDeclutter(),U);I=I&&!X}},F=Wc(v),k=i.getFeaturesInExtent(F);m&&k.sort(m);for(let A=0,U=k.length;A<U;++A)S(k[A],A);this.renderedFeatures_=k,this.ready=I;const T=P.finish(),L=new Gg(v,u,d,i.getOverlaps(),T,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=u,this.renderedRevision_=g,this.renderedRenderOrder_=m,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=y,this.wrappedRenderedExtent_=v,this.renderedCenter_=_,this.renderedProjection_=h,this.renderedPixelRatio_=d,this.replayGroup_=L,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,s,r,o,a){if(!i)return!1;let l=!1;if(Array.isArray(i))for(let c=0,h=i.length;c<h;++c)l=qa(s,t,i[c],e,this.boundHandleStyleImageChange_,r,o,a)||l;else l=qa(s,t,i,e,this.boundHandleStyleImageChange_,r,o,a);return l}}let ms=0;const Ee=1<<ms++,yt=1<<ms++,Fe=1<<ms++,gi=1<<ms++,ys=1<<ms++,ro=1<<ms++,sl=Math.pow(2,ms)-1,Th={[Ee]:"boolean",[yt]:"number",[Fe]:"string",[gi]:"color",[ys]:"number[]",[ro]:"size"},nw=Object.keys(Th).map(Number).sort(Pi);function sw(n){return n in Th}function oo(n){const t=[];for(const e of nw)ao(n,e)&&t.push(Th[e]);return t.length===0?"untyped":t.length<3?t.join(" or "):t.slice(0,-1).join(", ")+", or "+t[t.length-1]}function ao(n,t){return(n&t)===t}function Fn(n,t){return n===t}class ne{constructor(t,e){if(!sw(t))throw new Error(`literal expressions must have a specific type, got ${oo(t)}`);this.type=t,this.value=e}}class rw{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function Hg(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1,mapState:!1}}function he(n,t,e){switch(typeof n){case"boolean":{if(Fn(t,Fe))return new ne(Fe,n?"true":"false");if(!ao(t,Ee))throw new Error(`got a boolean, but expected ${oo(t)}`);return new ne(Ee,n)}case"number":{if(Fn(t,ro))return new ne(ro,ve(n));if(Fn(t,Ee))return new ne(Ee,!!n);if(Fn(t,Fe))return new ne(Fe,n.toString());if(!ao(t,yt))throw new Error(`got a number, but expected ${oo(t)}`);return new ne(yt,n)}case"string":{if(Fn(t,gi))return new ne(gi,$a(n));if(Fn(t,Ee))return new ne(Ee,!!n);if(!ao(t,Fe))throw new Error(`got a string, but expected ${oo(t)}`);return new ne(Fe,n)}}if(!Array.isArray(n))throw new Error("expression must be an array or a primitive value");if(n.length===0)throw new Error("empty expression");if(typeof n[0]=="string")return mw(n,t,e);for(const i of n)if(typeof i!="number")throw new Error("expected an array of numbers");if(Fn(t,ro)){if(n.length!==2)throw new Error(`expected an array of two values for a size, got ${n.length}`);return new ne(ro,n)}if(Fn(t,gi)){if(n.length===3)return new ne(gi,[...n,1]);if(n.length===4)return new ne(gi,n);throw new Error(`expected an array of 3 or 4 values for a color, got ${n.length}`)}if(!ao(t,ys))throw new Error(`got an array of numbers, but expected ${oo(t)}`);return new ne(ys,n)}const z={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",LineMetric:"line-metric",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string",Has:"has"},ow={[z.Get]:it(ft(1,1/0),Bg),[z.Var]:it(ft(1,1),aw),[z.Has]:it(ft(1,1/0),Bg),[z.Id]:it(lw,Qs),[z.Concat]:it(ft(2,1/0),Ct(Fe)),[z.GeometryType]:it(cw,Qs),[z.LineMetric]:it(Qs),[z.Resolution]:it(Mh,Qs),[z.Zoom]:it(Mh,Qs),[z.Time]:it(Mh,Qs),[z.Any]:it(ft(2,1/0),Ct(Ee)),[z.All]:it(ft(2,1/0),Ct(Ee)),[z.Not]:it(ft(1,1),Ct(Ee)),[z.Equal]:it(ft(2,2),Ct(sl)),[z.NotEqual]:it(ft(2,2),Ct(sl)),[z.GreaterThan]:it(ft(2,2),Ct(yt)),[z.GreaterThanOrEqualTo]:it(ft(2,2),Ct(yt)),[z.LessThan]:it(ft(2,2),Ct(yt)),[z.LessThanOrEqualTo]:it(ft(2,2),Ct(yt)),[z.Multiply]:it(ft(2,1/0),Zg),[z.Coalesce]:it(ft(2,1/0),Zg),[z.Divide]:it(ft(2,2),Ct(yt)),[z.Add]:it(ft(2,1/0),Ct(yt)),[z.Subtract]:it(ft(2,2),Ct(yt)),[z.Clamp]:it(ft(3,3),Ct(yt)),[z.Mod]:it(ft(2,2),Ct(yt)),[z.Pow]:it(ft(2,2),Ct(yt)),[z.Abs]:it(ft(1,1),Ct(yt)),[z.Floor]:it(ft(1,1),Ct(yt)),[z.Ceil]:it(ft(1,1),Ct(yt)),[z.Round]:it(ft(1,1),Ct(yt)),[z.Sin]:it(ft(1,1),Ct(yt)),[z.Cos]:it(ft(1,1),Ct(yt)),[z.Atan]:it(ft(1,2),Ct(yt)),[z.Sqrt]:it(ft(1,1),Ct(yt)),[z.Match]:it(ft(4,1/0),jg,uw),[z.Between]:it(ft(3,3),Ct(yt)),[z.Interpolate]:it(ft(6,1/0),jg,dw),[z.Case]:it(ft(3,1/0),hw,fw),[z.In]:it(ft(2,2),gw),[z.Number]:it(ft(1,1/0),Ct(sl)),[z.String]:it(ft(1,1/0),Ct(sl)),[z.Array]:it(ft(1,1/0),Ct(yt)),[z.Color]:it(ft(1,4),Ct(yt)),[z.Band]:it(ft(1,3),Ct(yt)),[z.Palette]:it(ft(2,2),pw),[z.ToString]:it(ft(1,1),Ct(Ee|yt|Fe|gi))};function Bg(n,t,e){const i=n.length-1,s=new Array(i);for(let r=0;r<i;++r){const o=n[r+1];switch(typeof o){case"number":{s[r]=new ne(yt,o);break}case"string":{s[r]=new ne(Fe,o);break}default:throw new Error(`expected a string key or numeric array index for a get operation, got ${o}`)}r===0&&e.properties.add(String(o))}return s}function aw(n,t,e){const i=n[1];if(typeof i!="string")throw new Error("expected a string argument for var operation");return e.variables.add(i),[new ne(Fe,i)]}function lw(n,t,e){e.featureId=!0}function cw(n,t,e){e.geometryType=!0}function Mh(n,t,e){e.mapState=!0}function Qs(n,t,e){const i=n[0];if(n.length!==1)throw new Error(`expected no arguments for ${i} operation`);return[]}function ft(n,t){return function(e,i,s){const r=e[0],o=e.length-1;if(n===t){if(o!==n){const a=n===1?"":"s";throw new Error(`expected ${n} argument${a} for ${r}, got ${o}`)}}else if(o<n||o>t){const a=t===1/0?`${n} or more`:`${n} to ${t}`;throw new Error(`expected ${a} arguments for ${r}, got ${o}`)}}}function Zg(n,t,e){const i=n.length-1,s=new Array(i);for(let r=0;r<i;++r){const o=he(n[r+1],t,e);s[r]=o}return s}function Ct(n){return function(t,e,i){const s=t.length-1,r=new Array(s);for(let o=0;o<s;++o){const a=he(t[o+1],n,i);r[o]=a}return r}}function hw(n,t,e){const i=n[0],s=n.length-1;if(s%2===0)throw new Error(`expected an odd number of arguments for ${i}, got ${s} instead`)}function jg(n,t,e){const i=n[0],s=n.length-1;if(s%2===1)throw new Error(`expected an even number of arguments for operation ${i}, got ${s} instead`)}function uw(n,t,e){const i=n.length-1,s=Fe|yt|Ee,r=he(n[1],s,e),o=he(n[n.length-1],t,e),a=new Array(i-2);for(let l=0;l<i-2;l+=2){try{const c=he(n[l+2],r.type,e);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+1} of match expression: ${c.message}`)}try{const c=he(n[l+3],o.type,e);a[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+2} of match expression: ${c.message}`)}}return[r,...a,o]}function dw(n,t,e){const i=n[1];let s;switch(i[0]){case"linear":s=1;break;case"exponential":const l=i[1];if(typeof l!="number"||l<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(l)} instead`);s=l;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(i)}`)}const r=new ne(yt,s);let o;try{o=he(n[2],yt,e)}catch(l){throw new Error(`failed to parse argument 1 in interpolate expression: ${l.message}`)}const a=new Array(n.length-3);for(let l=0;l<a.length;l+=2){try{const c=he(n[l+3],yt,e);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${c.message}`)}try{const c=he(n[l+4],t,e);a[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${c.message}`)}}return[r,o,...a]}function fw(n,t,e){const i=he(n[n.length-1],t,e),s=new Array(n.length-1);for(let r=0;r<s.length-1;r+=2){try{const o=he(n[r+1],Ee,e);s[r]=o}catch(o){throw new Error(`failed to parse argument ${r} of case expression: ${o.message}`)}try{const o=he(n[r+2],i.type,e);s[r+1]=o}catch(o){throw new Error(`failed to parse argument ${r+1} of case expression: ${o.message}`)}}return s[s.length-1]=i,s}function gw(n,t,e){let i=n[2];if(!Array.isArray(i))throw new Error('the second argument for the "in" operator must be an array');let s;if(typeof i[0]=="string"){if(i[0]!=="literal")throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');if(!Array.isArray(i[1]))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array');i=i[1],s=Fe}else s=yt;const r=new Array(i.length);for(let a=0;a<r.length;a++)try{const l=he(i[a],s,e);r[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[he(n[1],s,e),...r]}function pw(n,t,e){let i;try{i=he(n[1],yt,e)}catch(o){throw new Error(`failed to parse first argument in palette expression: ${o.message}`)}const s=n[2];if(!Array.isArray(s))throw new Error("the second argument of palette must be an array");const r=new Array(s.length);for(let o=0;o<r.length;o++){let a;try{a=he(s[o],gi,e)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof ne))throw new Error(`the palette color at index ${o} must be a literal value`);r[o]=a}return[i,...r]}function it(...n){return function(t,e,i){const s=t[0];let r;for(let o=0;o<n.length;o++){const a=n[o](t,e,i);if(o==n.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");r=a}}return new rw(e,s,...r)}}function mw(n,t,e){const i=n[0],s=ow[i];if(!s)throw new Error(`unknown operator: ${i}`);return s(n,t,e)}function qg(n){if(!n)return"";const t=n.getType();switch(t){case"Point":case"LineString":case"Polygon":return t;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return t.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return qg(n.getGeometries()[0]);default:return""}}function Kg(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function Li(n,t,e){const i=he(n,t,e);return pi(i)}function pi(n,t){if(n instanceof ne){if(n.type===gi&&typeof n.value=="string"){const i=$a(n.value);return function(){return i}}return function(){return n.value}}const e=n.operator;switch(e){case z.Number:case z.String:case z.Coalesce:return yw(n);case z.Get:case z.Var:case z.Has:return _w(n);case z.Id:return i=>i.featureId;case z.GeometryType:return i=>i.geometryType;case z.Concat:{const i=n.args.map(s=>pi(s));return s=>"".concat(...i.map(r=>r(s).toString()))}case z.Resolution:return i=>i.resolution;case z.Any:case z.All:case z.Between:case z.In:case z.Not:return ww(n);case z.Equal:case z.NotEqual:case z.LessThan:case z.LessThanOrEqualTo:case z.GreaterThan:case z.GreaterThanOrEqualTo:return vw(n);case z.Multiply:case z.Divide:case z.Add:case z.Subtract:case z.Clamp:case z.Mod:case z.Pow:case z.Abs:case z.Floor:case z.Ceil:case z.Round:case z.Sin:case z.Cos:case z.Atan:case z.Sqrt:return xw(n);case z.Case:return Ew(n);case z.Match:return Cw(n);case z.Interpolate:return bw(n);case z.ToString:return Pw(n);default:throw new Error(`Unsupported operator ${e}`)}}function yw(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=pi(n.args[r]);switch(e){case z.Coalesce:return r=>{for(let o=0;o<i;++o){const a=s[o](r);if(typeof a<"u"&&a!==null)return a}throw new Error("Expected one of the values to be non-null")};case z.Number:case z.String:return r=>{for(let o=0;o<i;++o){const a=s[o](r);if(typeof a===e)return a}throw new Error(`Expected one of the values to be a ${e}`)};default:throw new Error(`Unsupported assertion operator ${e}`)}}function _w(n,t){const i=n.args[0].value;switch(n.operator){case z.Get:return s=>{const r=n.args;let o=s.properties[i];for(let a=1,l=r.length;a<l;++a){const h=r[a].value;o=o[h]}return o};case z.Var:return s=>s.variables[i];case z.Has:return s=>{const r=n.args;if(!(i in s.properties))return!1;let o=s.properties[i];for(let a=1,l=r.length;a<l;++a){const h=r[a].value;if(!o||!Object.hasOwn(o,h))return!1;o=o[h]}return!0};default:throw new Error(`Unsupported accessor operator ${n.operator}`)}}function vw(n,t){const e=n.operator,i=pi(n.args[0]),s=pi(n.args[1]);switch(e){case z.Equal:return r=>i(r)===s(r);case z.NotEqual:return r=>i(r)!==s(r);case z.LessThan:return r=>i(r)<s(r);case z.LessThanOrEqualTo:return r=>i(r)<=s(r);case z.GreaterThan:return r=>i(r)>s(r);case z.GreaterThanOrEqualTo:return r=>i(r)>=s(r);default:throw new Error(`Unsupported comparison operator ${e}`)}}function ww(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=pi(n.args[r]);switch(e){case z.Any:return r=>{for(let o=0;o<i;++o)if(s[o](r))return!0;return!1};case z.All:return r=>{for(let o=0;o<i;++o)if(!s[o](r))return!1;return!0};case z.Between:return r=>{const o=s[0](r),a=s[1](r),l=s[2](r);return o>=a&&o<=l};case z.In:return r=>{const o=s[0](r);for(let a=1;a<i;++a)if(o===s[a](r))return!0;return!1};case z.Not:return r=>!s[0](r);default:throw new Error(`Unsupported logical operator ${e}`)}}function xw(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=pi(n.args[r]);switch(e){case z.Multiply:return r=>{let o=1;for(let a=0;a<i;++a)o*=s[a](r);return o};case z.Divide:return r=>s[0](r)/s[1](r);case z.Add:return r=>{let o=0;for(let a=0;a<i;++a)o+=s[a](r);return o};case z.Subtract:return r=>s[0](r)-s[1](r);case z.Clamp:return r=>{const o=s[0](r),a=s[1](r);if(o<a)return a;const l=s[2](r);return o>l?l:o};case z.Mod:return r=>s[0](r)%s[1](r);case z.Pow:return r=>Math.pow(s[0](r),s[1](r));case z.Abs:return r=>Math.abs(s[0](r));case z.Floor:return r=>Math.floor(s[0](r));case z.Ceil:return r=>Math.ceil(s[0](r));case z.Round:return r=>Math.round(s[0](r));case z.Sin:return r=>Math.sin(s[0](r));case z.Cos:return r=>Math.cos(s[0](r));case z.Atan:return i===2?r=>Math.atan2(s[0](r),s[1](r)):r=>Math.atan(s[0](r));case z.Sqrt:return r=>Math.sqrt(s[0](r));default:throw new Error(`Unsupported numeric operator ${e}`)}}function Ew(n,t){const e=n.args.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=pi(n.args[s]);return s=>{for(let r=0;r<e-1;r+=2)if(i[r](s))return i[r+1](s);return i[e-1](s)}}function Cw(n,t){const e=n.args.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=pi(n.args[s]);return s=>{const r=i[0](s);for(let o=1;o<e-1;o+=2)if(r===i[o](s))return i[o+1](s);return i[e-1](s)}}function bw(n,t){const e=n.args.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=pi(n.args[s]);return s=>{const r=i[0](s),o=i[1](s);let a,l;for(let c=2;c<e;c+=2){const h=i[c](s);let u=i[c+1](s);const d=Array.isArray(u);if(d&&(u=iv(u)),h>=o)return c===2?u:d?Rw(r,o,a,l,h,u):lo(r,o,a,l,h,u);a=h,l=u}return l}}function Pw(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=pi(n.args[r]);switch(e){case z.ToString:return r=>{const o=s[0](r);return n.args[0].type===gi?gh(o):o.toString()};default:throw new Error(`Unsupported convert operator ${e}`)}}function lo(n,t,e,i,s,r){const o=s-e;if(o===0)return i;const a=t-e,l=n===1?a/o:(Math.pow(n,a)-1)/(Math.pow(n,o)-1);return i+l*(r-i)}function Rw(n,t,e,i,s,r){if(s-e===0)return i;const a=sg(i),l=sg(r);let c=l[2]-a[2];c>180?c-=360:c<-180&&(c+=360);const h=[lo(n,t,e,a[0],s,l[0]),lo(n,t,e,a[1],s,l[1]),a[2]+lo(n,t,e,0,s,c),lo(n,t,e,i[3],s,r[3])];return nv(h)}function Iw(n){return!0}function Sw(n){const t=Hg(),e=Tw(n,t),i=Kg();return function(s,r){if(i.properties=s.getPropertiesInternal(),i.resolution=r,t.featureId){const o=s.getId();o!==void 0?i.featureId=o:i.featureId=null}return t.geometryType&&(i.geometryType=qg(s.getGeometry())),e(i)}}function Jg(n){const t=Hg(),e=n.length,i=new Array(e);for(let o=0;o<e;++o)i[o]=Ah(n[o],t);const s=Kg(),r=new Array(e);return function(o,a){if(s.properties=o.getPropertiesInternal(),s.resolution=a,t.featureId){const c=o.getId();c!==void 0?s.featureId=c:s.featureId=null}let l=0;for(let c=0;c<e;++c){const h=i[c](s);h&&(r[l]=h,l+=1)}return r.length=l,r}}function Tw(n,t){const e=n.length,i=new Array(e);for(let s=0;s<e;++s){const r=n[s],o="filter"in r?Li(r.filter,Ee,t):Iw;let a;if(Array.isArray(r.style)){const l=r.style.length;a=new Array(l);for(let c=0;c<l;++c)a[c]=Ah(r.style[c],t)}else a=[Ah(r.style,t)];i[s]={filter:o,styles:a}}return function(s){const r=[];let o=!1;for(let a=0;a<e;++a){const l=i[a].filter;if(l(s)&&!(n[a].else&&o)){o=!0;for(const c of i[a].styles){const h=c(s);h&&r.push(h)}}}return r}}function Ah(n,t){const e=co(n,"",t),i=ho(n,"",t),s=Mw(n,t),r=Aw(n,t),o=ue(n,"z-index",t);if(!e&&!i&&!s&&!r&&!Pn(n))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(n));const a=new Pt;return function(l){let c=!0;if(e){const h=e(l);h&&(c=!1),a.setFill(h)}if(i){const h=i(l);h&&(c=!1),a.setStroke(h)}if(s){const h=s(l);h&&(c=!1),a.setText(h)}if(r){const h=r(l);h&&(c=!1),a.setImage(h)}return o&&a.setZIndex(o(l)),c?null:a}}function co(n,t,e){let i;if(t+"fill-pattern-src"in n)i=Ow(n,t+"fill-",e);else{if(n[t+"fill-color"]==="none")return r=>null;i=rl(n,t+"fill-color",e)}if(!i)return null;const s=new Ht;return function(r){const o=i(r);return o===ah?null:(s.setColor(o),s)}}function ho(n,t,e){const i=ue(n,t+"stroke-width",e),s=rl(n,t+"stroke-color",e);if(!i&&!s)return null;const r=rn(n,t+"stroke-line-cap",e),o=rn(n,t+"stroke-line-join",e),a=Qg(n,t+"stroke-line-dash",e),l=ue(n,t+"stroke-line-dash-offset",e),c=ue(n,t+"stroke-miter-limit",e),h=ue(n,t+"stroke-offset",e),u=new te;return function(d){if(s){const g=s(d);if(g===ah)return null;u.setColor(g)}if(i&&u.setWidth(i(d)),r){const g=r(d);if(g!=="butt"&&g!=="round"&&g!=="square")throw new Error("Expected butt, round, or square line cap");u.setLineCap(g)}if(o){const g=o(d);if(g!=="bevel"&&g!=="round"&&g!=="miter")throw new Error("Expected bevel, round, or miter line join");u.setLineJoin(g)}return a&&u.setLineDash(a(d)),l&&u.setLineDashOffset(l(d)),c&&u.setMiterLimit(c(d)),h&&u.setOffset(h(d)),u}}function Mw(n,t){const e="text-",i=rn(n,e+"value",t);if(!i)return null;const s=co(n,e,t),r=co(n,e+"background-",t),o=ho(n,e,t),a=ho(n,e+"background-",t),l=rn(n,e+"font",t),c=ue(n,e+"max-angle",t),h=ue(n,e+"offset-x",t),u=ue(n,e+"offset-y",t),d=tr(n,e+"overflow",t),g=rn(n,e+"placement",t),p=ue(n,e+"repeat",t),m=al(n,e+"scale",t),_=tr(n,e+"rotate-with-view",t),v=ue(n,e+"rotation",t),y=rn(n,e+"align",t),w=rn(n,e+"justify",t),x=rn(n,e+"baseline",t),C=tr(n,e+"keep-upright",t),P=Qg(n,e+"padding",t),b=ll(n,e+"declutter-mode"),R=new qs({declutterMode:b});return function(I){if(R.setText(i(I)),s&&R.setFill(s(I)),r&&R.setBackgroundFill(r(I)),o&&R.setStroke(o(I)),a&&R.setBackgroundStroke(a(I)),l&&R.setFont(l(I)),c&&R.setMaxAngle(c(I)),h&&R.setOffsetX(h(I)),u&&R.setOffsetY(u(I)),d&&R.setOverflow(d(I)),g){const S=g(I);if(S!=="point"&&S!=="line")throw new Error("Expected point or line for text-placement");R.setPlacement(S)}if(p&&R.setRepeat(p(I)),m&&R.setScale(m(I)),_&&R.setRotateWithView(_(I)),v&&R.setRotation(v(I)),y){const S=y(I);if(S!=="left"&&S!=="center"&&S!=="right"&&S!=="end"&&S!=="start")throw new Error("Expected left, right, center, start, or end for text-align");R.setTextAlign(S)}if(w){const S=w(I);if(S!=="left"&&S!=="right"&&S!=="center")throw new Error("Expected left, right, or center for text-justify");R.setJustify(S)}if(x){const S=x(I);if(S!=="bottom"&&S!=="top"&&S!=="middle"&&S!=="alphabetic"&&S!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");R.setTextBaseline(S)}return P&&R.setPadding(P(I)),C&&R.setKeepUpright(C(I)),R}}function Aw(n,t){return"icon-src"in n?Dw(n,t):"shape-points"in n?Fw(n,t):"circle-radius"in n?Lw(n,t):null}function Dw(n,t){const e="icon-",i=e+"src",s=np(n[i],i),r=ol(n,e+"anchor",t),o=al(n,e+"scale",t),a=ue(n,e+"opacity",t),l=ol(n,e+"displacement",t),c=ue(n,e+"rotation",t),h=tr(n,e+"rotate-with-view",t),u=ep(n,e+"anchor-origin"),d=ip(n,e+"anchor-x-units"),g=ip(n,e+"anchor-y-units"),p=sn(n,e+"color");let m,_=null;p!==void 0&&(Array.isArray(p)&&p.length>0&&typeof p[0]=="string"?_=rl(n,e+"color",t):m=sp(p,e+"color"));const v=kw(n,e+"cross-origin"),y=Nw(n,e+"offset"),w=ep(n,e+"offset-origin"),x=Dh(n,e+"width"),C=Dh(n,e+"height"),P=zw(n,e+"size"),b=ll(n,e+"declutter-mode"),R={src:s,anchorOrigin:u,anchorXUnits:d,anchorYUnits:g,crossOrigin:v,offset:y,offsetOrigin:w,height:C,width:x,size:P,declutterMode:b};let I=null;return function(S){if(I)_&&I.setColor(_(S));else{const F=_?_(S):m;I=new Dn(F!==void 0?Object.assign({},R,{color:F}):Object.assign({},R))}return a&&I.setOpacity(a(S)),l&&I.setDisplacement(l(S)),c&&I.setRotation(c(S)),h&&I.setRotateWithView(h(S)),o&&I.setScale(o(S)),r&&I.setAnchor(r(S)),I}}function Fw(n,t){const e="shape-",i=e+"points",s=e+"radius",r=Fh(n[i],i);if(!(s in n))throw new Error(`Expected a number for ${s}`);const o=ue(n,s,t),a=typeof n[s]=="number"?n[s]:5,l=e+"radius2",c=ue(n,l,t),h=typeof n[l]=="number"?n[l]:void 0,u=co(n,e,t),d=ho(n,e,t),g=al(n,e+"scale",t),p=ol(n,e+"displacement",t),m=ue(n,e+"rotation",t),_=tr(n,e+"rotate-with-view",t),v=Dh(n,e+"angle"),y=ll(n,e+"declutter-mode"),w=new no({points:r,radius:a,radius2:h,angle:v,declutterMode:y});return function(x){return o&&w.setRadius(o(x)),c&&w.setRadius2(c(x)),u&&w.setFill(u(x)),d&&w.setStroke(d(x)),p&&w.setDisplacement(p(x)),m&&w.setRotation(m(x)),_&&w.setRotateWithView(_(x)),g&&w.setScale(g(x)),w}}function Lw(n,t){const e="circle-",i=co(n,e,t),s=ho(n,e,t),r=ue(n,e+"radius",t),o=al(n,e+"scale",t),a=ol(n,e+"displacement",t),l=ue(n,e+"rotation",t),c=tr(n,e+"rotate-with-view",t),h=ll(n,e+"declutter-mode"),u=new Qe({radius:5,declutterMode:h});return function(d){return r&&u.setRadius(r(d)),i&&u.setFill(i(d)),s&&u.setStroke(s(d)),a&&u.setDisplacement(a(d)),l&&u.setRotation(l(d)),c&&u.setRotateWithView(c(d)),o&&u.setScale(o(d)),u}}function sn(n,t){if(!(t in n))return;const e=n[t];return e===void 0?void 0:e}function ue(n,t,e){const i=sn(n,t);if(i===void 0)return;const s=Li(i,yt,e);return function(r){return Fh(s(r),t)}}function rn(n,t,e){const i=sn(n,t);if(i===void 0)return null;const s=Li(i,Fe,e);return function(r){return np(s(r),t)}}function Ow(n,t,e){const i=rn(n,t+"pattern-src",e),s=tp(n,t+"pattern-offset",e),r=tp(n,t+"pattern-size",e),o=rl(n,t+"color",e);return function(a){return{src:i(a),offset:s&&s(a),size:r&&r(a),color:o&&o(a)}}}function tr(n,t,e){const i=sn(n,t);if(i===void 0)return null;const s=Li(i,Ee,e);return function(r){const o=s(r);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${t}`);return o}}function rl(n,t,e){const i=sn(n,t);if(i===void 0)return null;const s=Li(i,gi,e);return function(r){return sp(s(r),t)}}function Qg(n,t,e){const i=sn(n,t);if(i===void 0)return null;if(Array.isArray(i)&&(i.length===0||typeof i[0]!="string")){const r=i.map((o,a)=>{if(typeof o=="number")return()=>o;const l=Li(o,yt,e);return function(c){return Fh(l(c),`${t}[${a}]`)}});return function(o){const a=new Array(r.length);for(let l=0;l<r.length;++l)a[l]=r[l](o);return a}}const s=Li(i,ys,e);return function(r){return uo(s(r),t)}}function ol(n,t,e){const i=sn(n,t);if(i===void 0)return null;const s=Li(i,ys,e);return function(r){const o=uo(s(r),t);if(o.length!==2)throw new Error(`Expected two numbers for ${t}`);return o}}function tp(n,t,e){const i=sn(n,t);if(i===void 0)return null;const s=Li(i,ys,e);return function(r){return rp(s(r),t)}}function al(n,t,e){const i=sn(n,t);if(i===void 0)return null;const s=Li(i,ys|yt,e);return function(r){return Gw(s(r),t)}}function Dh(n,t){const e=n[t];if(e!==void 0){if(typeof e!="number")throw new Error(`Expected a number for ${t}`);return e}}function zw(n,t){const e=n[t];if(e!==void 0){if(typeof e=="number")return ve(e);if(!Array.isArray(e))throw new Error(`Expected a number or size array for ${t}`);if(e.length!==2||typeof e[0]!="number"||typeof e[1]!="number")throw new Error(`Expected a number or size array for ${t}`);return e}}function kw(n,t){const e=n[t];if(e!==void 0){if(typeof e!="string")throw new Error(`Expected a string for ${t}`);return e}}function ep(n,t){const e=n[t];if(e!==void 0){if(e!=="bottom-left"&&e!=="bottom-right"&&e!=="top-left"&&e!=="top-right")throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${t}`);return e}}function ip(n,t){const e=n[t];if(e!==void 0){if(e!=="pixels"&&e!=="fraction")throw new Error(`Expected pixels or fraction for ${t}`);return e}}function Nw(n,t){const e=n[t];if(e!==void 0)return uo(e,t)}function ll(n,t){const e=n[t];if(e!==void 0){if(typeof e!="string")throw new Error(`Expected a string for ${t}`);if(e!=="declutter"&&e!=="obstacle"&&e!=="none")throw new Error(`Expected declutter, obstacle, or none for ${t}`);return e}}function uo(n,t){if(!Array.isArray(n))throw new Error(`Expected an array for ${t}`);const e=n.length;for(let i=0;i<e;++i)if(typeof n[i]!="number")throw new Error(`Expected an array of numbers for ${t}`);return n}function np(n,t){if(typeof n!="string")throw new Error(`Expected a string for ${t}`);return n}function Fh(n,t){if(typeof n!="number")throw new Error(`Expected a number for ${t}`);return n}function sp(n,t){if(typeof n=="string")return n;const e=uo(n,t),i=e.length;if(i<3||i>4)throw new Error(`Expected a color with 3 or 4 values for ${t}`);return e}function rp(n,t){const e=uo(n,t);if(e.length!==2)throw new Error(`Expected an array of two numbers for ${t}`);return e}function Gw(n,t){return typeof n=="number"?n:rp(n,t)}const mi={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function op(n,t,e){return(function(i,s,r,o,a){if(!i)return;if(!s&&!t)return i;const l=t?0:r[0]*s,c=t?0:r[1]*s,h=a?a[0]:0,u=a?a[1]:0;let d=n[0]+l/2+h,g=n[2]-l/2+h,p=n[1]+c/2+u,m=n[3]-c/2+u;d>g&&(d=(g+d)/2,g=d),p>m&&(p=(m+p)/2,m=p);let _=kt(i[0],d,g),v=kt(i[1],p,m);if(o&&e&&s){const y=30*s;_+=-y*Math.log(1+Math.max(0,d-i[0])/y)+y*Math.log(1+Math.max(0,i[0]-g)/y),v+=-y*Math.log(1+Math.max(0,p-i[1])/y)+y*Math.log(1+Math.max(0,i[1]-m)/y)}return[_,v]})}function Vw(n){return n}function Lh(n,t,e,i){const s=ut(t)/e[0],r=Vt(t)/e[1];return i?Math.min(n,Math.max(s,r)):Math.min(n,Math.min(s,r))}function Oh(n,t,e){let i=Math.min(n,t);const s=50;return i*=Math.log(1+s*Math.max(0,n/t-1))/s+1,e&&(i=Math.max(i,e),i/=Math.log(1+s*Math.max(0,e/n-1))/s+1),kt(i,e/2,t*2)}function Ww(n,t,e,i){return t=t!==void 0?t:!0,(function(s,r,o,a){if(s!==void 0){const l=n[0],c=n[n.length-1],h=e?Lh(l,e,o,i):l;if(a)return t?Oh(s,h,c):kt(s,c,h);const u=Math.min(h,s),d=Math.floor(_a(n,u,r));return n[d]>h&&d<n.length-1?n[d+1]:n[d]}})}function Uw(n,t,e,i,s,r){return i=i!==void 0?i:!0,e=e!==void 0?e:0,(function(o,a,l,c){if(o!==void 0){const h=s?Lh(t,s,l,r):t;if(c)return i?Oh(o,h,e):kt(o,e,h);const u=1e-9,d=Math.ceil(Math.log(t/h)/Math.log(n)-u),g=-a*(.5-u)+.5,p=Math.min(h,o),m=Math.floor(Math.log(t/p)/Math.log(n)+g),_=Math.max(d,m),v=t/Math.pow(n,_);return kt(v,e,h)}})}function ap(n,t,e,i,s){return e=e!==void 0?e:!0,(function(r,o,a,l){if(r!==void 0){const c=i?Lh(n,i,a,s):n;return!e||!l?kt(r,t,c):Oh(r,c,t)}})}function zh(n){if(n!==void 0)return 0}function lp(n){if(n!==void 0)return n}function $w(n){const t=2*Math.PI/n;return(function(e,i){if(i)return e;if(e!==void 0)return e=Math.floor(e/t+.5)*t,e})}function Xw(n){const t=En(5);return(function(e,i){return i||e===void 0?e:Math.abs(e)<=t?0:e})}const cp=42,kh=256,Nh=0;class Oi extends Ti{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=kc(t.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,t.projection&&Tf(),t.center&&(t.center=Ji(t.center,this.projection_)),t.extent&&(t.extent=Ai(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const a in mi)delete e[a];this.setProperties(e,!0);const i=Hw(t);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=i.minZoom;const s=Yw(t),r=i.constraint,o=Bw(t);this.constraints_={center:s,resolution:r,rotation:o},this.setRotation(t.rotation!==void 0?t.rotation:0),this.setCenterInternal(t.center!==void 0?t.center:null),t.resolution!==void 0?this.setResolution(t.resolution):t.zoom!==void 0&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const i=this.getCenterInternal();if(i){const s=t||[0,0,0,0];e=e||[0,0,0,0];const r=this.getResolution(),o=r/2*(s[3]-e[3]+e[1]-s[1]),a=r/2*(s[0]-e[0]+e[2]-s[2]);this.setCenterInternal([i[0]+o,i[1]-a])}}getUpdatedOptions_(t){const e=this.getProperties();return e.resolution!==void 0?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let i=0;i<e.length;++i){let s=arguments[i];s.center&&(s=Object.assign({},s),s.center=Ji(s.center,this.getProjection())),s.anchor&&(s=Object.assign({},s),s.anchor=Ji(s.anchor,this.getProjection())),e[i]=s}this.animateInternal.apply(this,e)}animateInternal(t){let e=arguments.length,i;e>1&&typeof arguments[e-1]=="function"&&(i=arguments[e-1],--e);let s=0;for(;s<e&&!this.isDef();++s){const h=arguments[s];h.center&&this.setCenterInternal(h.center),h.zoom!==void 0?this.setZoom(h.zoom):h.resolution&&this.setResolution(h.resolution),h.rotation!==void 0&&this.setRotation(h.rotation)}if(s===e){i&&cl(i,!0);return}let r=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_;const c=[];for(;s<e;++s){const h=arguments[s],u={start:r,complete:!1,anchor:h.anchor,duration:h.duration!==void 0?h.duration:1e3,easing:h.easing||P0,callback:i};if(h.center&&(u.sourceCenter=o,u.targetCenter=h.center.slice(),o=u.targetCenter),h.zoom!==void 0?(u.sourceResolution=a,u.targetResolution=this.getResolutionForZoom(h.zoom),a=u.targetResolution):h.resolution&&(u.sourceResolution=a,u.targetResolution=h.resolution,a=u.targetResolution),h.rotation!==void 0){u.sourceRotation=l;const d=Cn(h.rotation-l+Math.PI,2*Math.PI)-Math.PI;u.targetRotation=l+d,l=u.targetRotation}Zw(u)?u.complete=!0:r+=u.duration,c.push(u)}this.animations_.push(c),this.setHint(Ot.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[Ot.ANIMATING]>0}getInteracting(){return this.hints_[Ot.INTERACTING]>0}cancelAnimations(){this.setHint(Ot.ANIMATING,-this.hints_[Ot.ANIMATING]);let t;for(let e=0,i=this.animations_.length;e<i;++e){const s=this.animations_[e];if(s[0].callback&&cl(s[0].callback,!1),!t)for(let r=0,o=s.length;r<o;++r){const a=s[r];if(!a.complete){t=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let i=this.animations_.length-1;i>=0;--i){const s=this.animations_[i];let r=!0;for(let o=0,a=s.length;o<a;++o){const l=s[o];if(l.complete)continue;const c=t-l.start;let h=l.duration>0?c/l.duration:1;h>=1?(l.complete=!0,h=1):r=!1;const u=l.easing(h);if(l.sourceCenter){const d=l.sourceCenter[0],g=l.sourceCenter[1],p=l.targetCenter[0],m=l.targetCenter[1];this.nextCenter_=l.targetCenter;const _=d+u*(p-d),v=g+u*(m-g);this.targetCenter_=[_,v]}if(l.sourceResolution&&l.targetResolution){const d=u===1?l.targetResolution:l.sourceResolution+u*(l.targetResolution-l.sourceResolution);if(l.anchor){const g=this.getViewportSize_(this.getRotation()),p=this.constraints_.resolution(d,0,g,!0);this.targetCenter_=this.calculateCenterZoom(p,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=d,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){const d=u===1?Cn(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+u*(l.targetRotation-l.sourceRotation);if(l.anchor){const g=this.constraints_.rotation(d,!0);this.targetCenter_=this.calculateCenterRotate(g,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=d}if(this.applyTargetState_(!0),e=!0,!l.complete)break}if(r){this.animations_[i]=null,this.setHint(Ot.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const o=s[0].callback;o&&cl(o,!0)}}this.animations_=this.animations_.filter(Boolean),e&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const s=this.getCenterInternal();return s!==void 0&&(i=[s[0]-e[0],s[1]-e[1]],Tc(i,t-this.getRotation()),W0(i,e)),i}calculateCenterZoom(t,e){let i;const s=this.getCenterInternal(),r=this.getResolution();if(s!==void 0&&r!==void 0){const o=e[0]-t*(e[0]-s[0])/r,a=e[1]-t*(e[1]-s[1])/r;i=[o,a]}return i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],s=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(s*Math.sin(t)),Math.abs(i*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&&Vc(t,this.getProjection())}getCenterInternal(){return this.get(mi.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 Wc(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();Et(e,"The view center is not defined");const i=this.getResolution();Et(i!==void 0,"The view resolution is not defined");const s=this.getRotation();return Et(s!==void 0,"The view rotation is not defined"),xa(e,i,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(mi.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(Ai(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=ut(t)/e[0],s=Vt(t)/e[1];return Math.max(i,s)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,s=Math.log(e/i)/Math.log(t);return(function(r){return e/Math.pow(t,r*s)})}getRotation(){return this.get(mi.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),s=this.minResolution_,r=Math.log(i/s)/e;return(function(o){return Math.log(i/o)/e/r})}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let s=this.getCenterInternal();const r=this.padding_;if(r){const o=this.getViewportSizeMinusPadding_();s=Gh(s,this.getViewportSize_(),[o[0]/2+r[3],o[1]/2+r[0]],e,i)}return{center:s.slice(0),projection:t!==void 0?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return e!==void 0&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e=this.minZoom_||0,i,s;if(this.resolutions_){const r=_a(this.resolutions_,t,1);e=r,i=this.resolutions_[r],r==this.resolutions_.length-1?s=2:s=i/this.resolutions_[r+1]}else i=this.maxResolution_,s=this.zoomFactor_;return e+Math.log(i/t)/Math.log(s)}getResolutionForZoom(t){var e;if((e=this.resolutions_)!=null&&e.length){if(this.resolutions_.length===1)return this.resolutions_[0];const i=kt(Math.floor(t),0,this.resolutions_.length-2),s=this.resolutions_[i]/this.resolutions_[i+1];return this.resolutions_[i]/Math.pow(s,kt(t-i,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(Et(Array.isArray(t)||typeof t.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){Et(!qi(t),"Cannot fit empty extent provided as `geometry`");const s=Ai(t,this.getProjection());i=ih(s)}else if(t.getType()==="Circle"){const s=Ai(t.getExtent(),this.getProjection());i=ih(s),i.rotate(this.getRotation(),He(s))}else i=t;this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),s=Math.sin(-e),r=t.getFlatCoordinates(),o=t.getStride();let a=1/0,l=1/0,c=-1/0,h=-1/0;for(let u=0,d=r.length;u<d;u+=o){const g=r[u]*i-r[u+1]*s,p=r[u]*s+r[u+1]*i;a=Math.min(a,g),l=Math.min(l,p),c=Math.max(c,g),h=Math.max(h,p)}return[a,l,c,h]}fitInternal(t,e){e=e||{};let i=e.size;i||(i=this.getViewportSizeMinusPadding_());const s=e.padding!==void 0?e.padding:[0,0,0,0],r=e.nearest!==void 0?e.nearest:!1;let o;e.minResolution!==void 0?o=e.minResolution:e.maxZoom!==void 0?o=this.getResolutionForZoom(e.maxZoom):o=0;const a=this.rotatedExtentForGeometry(t);let l=this.getResolutionForExtentInternal(a,[i[0]-s[1]-s[3],i[1]-s[0]-s[2]]);l=isNaN(l)?o:Math.max(l,o),l=this.getConstrainedResolution(l,r?0:1);const c=this.getRotation(),h=Math.sin(c),u=Math.cos(c),d=He(a);d[0]+=(s[1]-s[3])/2*l,d[1]+=(s[0]-s[2])/2*l;const g=d[0]*u-d[1]*h,p=d[1]*u+d[0]*h,m=this.getConstrainedCenter([g,p],l),_=e.callback?e.callback:Ar;e.duration!==void 0?this.animateInternal({resolution:l,center:m,duration:e.duration,easing:e.easing},_):(this.targetResolution_=l,this.targetCenter_=m,this.applyTargetState_(!1,!0),cl(_,!0))}centerOn(t,e,i){this.centerOnInternal(Ji(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(Gh(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,s){let r;const o=this.padding_;if(o&&t){const a=this.getViewportSizeMinusPadding_(-i),l=Gh(t,s,[a[0]/2+o[3],a[1]/2+o[0]],e,i);r=[t[0]-l[0],t[1]-l[1]]}return r}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(t){const e=Vc(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&&Ji(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const i=this.getAnimating()||this.getInteracting(),s=this.getViewportSize_(this.getRotation()),r=this.constraints_.resolution(this.targetResolution_*t,0,s,i);e&&(this.targetCenter_=this.calculateCenterZoom(r,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=Ji(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const i=this.getAnimating()||this.getInteracting(),s=this.constraints_.rotation(this.targetRotation_+t,i);e&&(this.targetCenter_=this.calculateCenterRotate(s,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t&&Ji(t,this.getProjection()))}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const i=this.getAnimating()||this.getInteracting()||e,s=this.constraints_.rotation(this.targetRotation_,i),r=this.getViewportSize_(s),o=this.constraints_.resolution(this.targetResolution_,0,r,i),a=this.constraints_.center(this.targetCenter_,o,r,i,this.calculateCenterShift(this.targetCenter_,o,s,r));this.get(mi.ROTATION)!==s&&this.set(mi.ROTATION,s),this.get(mi.RESOLUTION)!==o&&(this.set(mi.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(mi.CENTER)||!Ra(this.get(mi.CENTER),a))&&this.set(mi.CENTER,a),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=t!==void 0?t:200;const s=e||0,r=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(r),a=this.constraints_.resolution(this.targetResolution_,s,o),l=this.constraints_.center(this.targetCenter_,a,o,!1,this.calculateCenterShift(this.targetCenter_,a,r,o));if(t===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=r,this.targetCenter_=l,this.applyTargetState_();return}i=i||(t===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==r||!this.getCenterInternal()||!Ra(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:r,center:l,resolution:a,duration:t,easing:Jn,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Ot.INTERACTING,1)}endInteraction(t,e,i){i=i&&Ji(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(Ot.INTERACTING,-1),this.resolveConstraints(t,e,i))}getConstrainedCenter(t,e){const i=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,e||this.getResolution(),i)}getConstrainedZoom(t,e){const i=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(i,e))}getConstrainedResolution(t,e){e=e||0;const i=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,i)}}function cl(n,t){setTimeout(function(){n(t)},0)}function Yw(n){if(n.extent!==void 0){const e=n.smoothExtentConstraint!==void 0?n.smoothExtentConstraint:!0;return op(n.extent,n.constrainOnlyCenter,e)}const t=kc(n.projection,"EPSG:3857");if(n.multiWorld!==!0&&t.isGlobal()){const e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,op(e,!1,!1)}return Vw}function Hw(n){let t,e,i,o=n.minZoom!==void 0?n.minZoom:Nh,a=n.maxZoom!==void 0?n.maxZoom:28;const l=n.zoomFactor!==void 0?n.zoomFactor:2,c=n.multiWorld!==void 0?n.multiWorld:!1,h=n.smoothResolutionConstraint!==void 0?n.smoothResolutionConstraint:!0,u=n.showFullExtent!==void 0?n.showFullExtent:!1,d=kc(n.projection,"EPSG:3857"),g=d.getExtent();let p=n.constrainOnlyCenter,m=n.extent;if(!c&&!m&&d.isGlobal()&&(p=!1,m=g),n.resolutions!==void 0){const _=n.resolutions;e=_[o],i=_[a]!==void 0?_[a]:_[_.length-1],n.constrainResolution?t=Ww(_,h,!p&&m,u):t=ap(e,i,h,!p&&m,u)}else{const v=(g?Math.max(ut(g),Vt(g)):360*Ia.degrees/d.getMetersPerUnit())/kh/Math.pow(2,Nh),y=v/Math.pow(2,28-Nh);e=n.maxResolution,e!==void 0?o=0:e=v/Math.pow(l,o),i=n.minResolution,i===void 0&&(n.maxZoom!==void 0?n.maxResolution!==void 0?i=e/Math.pow(l,a):i=v/Math.pow(l,a):i=y),a=o+Math.floor(Math.log(e/i)/Math.log(l)),i=e/Math.pow(l,a-o),n.constrainResolution?t=Uw(l,e,i,h,!p&&m,u):t=ap(e,i,h,!p&&m,u)}return{constraint:t,maxResolution:e,minResolution:i,minZoom:o,zoomFactor:l}}function Bw(n){if(n.enableRotation!==void 0?n.enableRotation:!0){const e=n.constrainRotation;return e===void 0||e===!0?Xw():e===!1?lp:typeof e=="number"?$w(e):lp}return zh}function Zw(n){return!(n.sourceCenter&&n.targetCenter&&!Ra(n.sourceCenter,n.targetCenter)||n.sourceResolution!==n.targetResolution||n.sourceRotation!==n.targetRotation)}function Gh(n,t,e,i,s){const r=Math.cos(-s);let o=Math.sin(-s),a=n[0]*r-n[1]*o,l=n[1]*r+n[0]*o;a+=(t[0]/2-e[0])*i,l+=(e[1]-t[1]/2)*i,o=-o;const c=a*r-l*o,h=l*r+a*o;return[c,h]}const St={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 hp extends Ti{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[St.OPACITY]=t.opacity!==void 0?t.opacity:1,Et(typeof e[St.OPACITY]=="number","Layer opacity must be a number"),e[St.VISIBLE]=t.visible!==void 0?t.visible:!0,e[St.Z_INDEX]=t.zIndex,e[St.MAX_RESOLUTION]=t.maxResolution!==void 0?t.maxResolution:1/0,e[St.MIN_RESOLUTION]=t.minResolution!==void 0?t.minResolution:0,e[St.MIN_ZOOM]=t.minZoom!==void 0?t.minZoom:-1/0,e[St.MAX_ZOOM]=t.maxZoom!==void 0?t.maxZoom:1/0,this.className_=e.className!==void 0?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:t===void 0?!0:t},i=this.getZIndex();return e.opacity=kt(Math.round(this.getOpacity()*100)/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=i===void 0&&!e.managed?1/0:i,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return et()}getLayerStatesArray(t){return et()}getExtent(){return this.get(St.EXTENT)}getMaxResolution(){return this.get(St.MAX_RESOLUTION)}getMinResolution(){return this.get(St.MIN_RESOLUTION)}getMinZoom(){return this.get(St.MIN_ZOOM)}getMaxZoom(){return this.get(St.MAX_ZOOM)}getOpacity(){return this.get(St.OPACITY)}getSourceState(){return et()}getVisible(){return this.get(St.VISIBLE)}getZIndex(){return this.get(St.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(St.EXTENT,t)}setMaxResolution(t){this.set(St.MAX_RESOLUTION,t)}setMinResolution(t){this.set(St.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(St.MAX_ZOOM,t)}setMinZoom(t){this.set(St.MIN_ZOOM,t)}setOpacity(t){Et(typeof t=="number","Layer opacity must be a number"),this.set(St.OPACITY,t)}setVisible(t){this.set(St.VISIBLE,t)}setZIndex(t){this.set(St.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}class fo extends hp{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(St.SOURCE,this.handleSourcePropertyChange_);const i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return t=t||[],t.push(this),t}getLayerStatesArray(t){return t=t||[],t.push(this.getLayerState()),t}getSource(){return this.get(St.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_&&(Lt(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=wt(t,Q.CHANGE,this.handleSourceChange_,this),t.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return!this.renderer_||!this.rendered?null:this.renderer_.getData(t)}isVisible(t){let e;const i=this.getMapInternal();!t&&i&&(t=i.getView()),t instanceof Oi?e={viewState:t.getState(),extent:t.calculateExtent()}:e=t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray());let s;if(e.layerStatesArray){if(s=e.layerStatesArray.find(o=>o.layer===this),!s)return!1}else s=this.getLayerState();const r=this.getExtent();return Vh(s,e.viewState)&&(!r||Wt(r,e.extent))}getAttributions(t){var r;if(!this.isVisible(t))return[];const e=(r=this.getSource())==null?void 0:r.getAttributions();if(!e)return[];const i=t instanceof Oi?t.getViewStateAndExtent():t;let s=e(i);return Array.isArray(s)||(s=[s]),s}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){const e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set(St.MAP,t)}getMapInternal(){return this.get(St.MAP)}setMap(t){this.mapPrecomposeKey_&&(Lt(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(Lt(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=wt(t,qe.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=wt(this,Q.CHANGE,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);Et(!e.some(s=>s.layer===i.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(i)}setSource(t){this.set(St.SOURCE,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}}function Vh(n,t){if(!n.visible)return!1;const e=t.resolution;if(e<n.minResolution||e>=n.maxResolution)return!1;const i=t.zoom;return i>n.minZoom&&i<=n.maxZoom}const up={RENDER_ORDER:"renderOrder"};class hl extends fo{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=t.declutter?String(t.declutter):void 0,this.renderBuffer_=t.renderBuffer!==void 0?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=t.updateWhileAnimating!==void 0?t.updateWhileAnimating:!1,this.updateWhileInteracting_=t.updateWhileInteracting!==void 0?t.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(up.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const i=this.getDeclutter();i in t.declutter||(t.declutter[i]=new xh(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(up.RENDER_ORDER,t)}setStyle(t){this.style_=t===void 0?Mg:t;const e=jw(t);this.styleFunction_=t===null?void 0:Gv(e),this.changed()}setDeclutter(t){this.declutter_=t?String(t):void 0,this.changed()}}function jw(n){if(n===void 0)return Mg;if(!n)return null;if(typeof n=="function"||n instanceof Pt)return n;if(!Array.isArray(n))return Jg([n]);if(n.length===0)return[];const t=n.length,e=n[0];if(e instanceof Pt){const s=new Array(t);for(let r=0;r<t;++r){const o=n[r];if(!(o instanceof Pt))throw new Error("Expected a list of style instances");s[r]=o}return s}if("style"in e){const s=new Array(t);for(let r=0;r<t;++r){const o=n[r];if(!("style"in o))throw new Error("Expected a list of rules with a style property");s[r]=o}return Sw(s)}return Jg(n)}class ti extends hl{constructor(t){super(t)}createRenderer(){return new Yg(this)}}class dp extends Xa{constructor(t,e,i,s,r){const o=r!==void 0?Y.IDLE:Y.LOADED;super(t,e,i,o),this.loader_=r!==void 0?r:null,this.canvas_=s,this.error_=null}getError(){return this.error_}handleLoad_(t){t?(this.error_=t,this.state=Y.ERROR):this.state=Y.LOADED,this.changed()}load(){this.state==Y.IDLE&&(this.state=Y.LOADING,this.changed(),this.loader_(this.handleLoad_.bind(this)))}getImage(){return this.canvas_}}const W={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class go extends Fr{constructor(t,e,i){super(),i=i||{},this.tileCoord=t,this.state=e,this.key="",this.transition_=i.transition===void 0?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(Q.CHANGE)}release(){this.setState(W.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==W.EMPTY){if(this.state!==W.ERROR&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){et()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(!i)i=e,this.transitionStarts_[t]=i;else if(i===-1)return 1;const s=e-i+1e3/60;return s>=this.transition_?1:Jd(s/this.transition_)}inTransition(t){return this.transition_?this.transitionStarts_[t]!==-1:!1}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}disposeInternal(){this.release(),super.disposeInternal()}}class fp extends go{constructor(t,e,i,s,r,o){super(t,e,o),this.crossOrigin_=s==null?void 0:s.crossOrigin,this.referrerPolicy_=s==null?void 0:s.referrerPolicy,this.src_=i,this.key=i,this.image_,Ae?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=W.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=W.ERROR,this.unlistenImage_(),this.image_=qw(),this.changed()}handleImageLoad_(){if(Ae)this.state=W.LOADED;else{const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=W.LOADED:this.state=W.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==W.ERROR&&(this.state=W.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==W.IDLE&&(this.state=W.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=sv(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}}function qw(){const n=Nt(1,1);return n.fillStyle="rgba(0,0,0,0)",n.fillRect(0,0,1,1),n.canvas}class Kw{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;let i=e-3;for(;i>0&&this.points_[i+2]>t;)i-=3;const s=this.points_[e+2]-this.points_[i+2];if(s<1e3/60)return!1;const r=this.points_[e]-this.points_[i],o=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(o,r),this.initialVelocity_=Math.sqrt(r*r+o*o)/s,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}class er extends hi{constructor(t,e,i){super(t),this.map=e,this.frameState=i!==void 0?i:null}}class Ln extends er{constructor(t,e,i,s,r,o){super(t,e,r),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=s!==void 0?s:!1,this.activePointers=o}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(t){this.pixel_=t}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(t){this.coordinate_=t}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}}const Bt={SINGLECLICK:"singleclick",CLICK:Q.CLICK,DBLCLICK:Q.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},Wh={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown"};class Jw extends Fr{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=e===void 0?1:e,this.down_=null;const i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=wt(i,Wh.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=wt(i,Wh.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(Q.TOUCHMOVE,this.boundHandleTouchMove_,tg?{passive:!1}:!1)}emulateClick_(t){let e=new Ln(Bt.CLICK,this.map_,t);this.dispatchEvent(e),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new Ln(Bt.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const i=new Ln(Bt.SINGLECLICK,this.map_,t);this.dispatchEvent(i)},250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==Bt.POINTERUP||e.type==Bt.POINTERCANCEL){delete this.trackedTouches_[i];for(const s in this.trackedTouches_)if(this.trackedTouches_[s].target!==e.target){delete this.trackedTouches_[s];break}}else(e.type==Bt.POINTERDOWN||e.type==Bt.POINTERMOVE)&&(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new Ln(Bt.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(Lt),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 Ln(Bt.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),this.dragListenerKeys_.length===0){const i=this.map_.getOwnerDocument();this.dragListenerKeys_.push(wt(i,Bt.POINTERMOVE,this.handlePointerMove_,this),wt(i,Bt.POINTERUP,this.handlePointerUp_,this),wt(this.element_,Bt.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==i&&this.dragListenerKeys_.push(wt(this.element_.getRootNode(),Bt.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new Ln(Bt.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 Ln(Bt.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_&&(Lt(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(Q.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(Lt(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(Lt),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const On={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},we={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},ul=1/0;class Qw{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,Dr(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];t.length==1?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const s=this.keyFunction_(i);return delete this.queuedElements_[s],i}enqueue(t){Et(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=ul?(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(t){return t*2+1}getRightChildIndex_(t){return t*2+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return this.elements_.length===0}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,s=e.length,r=e[t],o=i[t],a=t;for(;t<s>>1;){const l=this.getLeftChildIndex_(t),c=this.getRightChildIndex_(t),h=c<s&&i[c]<i[l]?c:l;e[t]=e[h],i[t]=i[h],t=h}e[t]=r,i[t]=o,this.siftDown_(a,t)}siftDown_(t,e){const i=this.elements_,s=this.priorities_,r=i[e],o=s[e];for(;e>t;){const a=this.getParentIndex_(e);if(s[a]>o)i[e]=i[a],s[e]=s[a],e=a;else break}i[e]=r,s[e]=o}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let s=0;const r=e.length;let o,a,l;for(a=0;a<r;++a)o=e[a],l=t(o),l==ul?delete this.queuedElements_[this.keyFunction_(o)]:(i[s]=l,e[s++]=o);e.length=s,i.length=s,this.heapify_()}}class gp extends Qw{constructor(t,e){super(i=>t.apply(null,i),i=>i[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);return e&&t[0].addEventListener(Q.CHANGE,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===W.LOADED||i===W.ERROR||i===W.EMPTY){i!==W.ERROR&&e.removeEventListener(Q.CHANGE,this.boundHandleTileChange_);const s=e.getKey();s in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[s],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i=0;for(;this.tilesLoading_<t&&i<e&&this.getCount()>0;){const s=this.dequeue()[0],r=s.getKey();s.getState()===W.IDLE&&!(r in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[r]=!0,++this.tilesLoading_,++i,s.load())}}}function tx(n,t,e,i,s){if(!n||!(e in n.wantedTiles)||!n.wantedTiles[e][t.getKey()])return ul;const r=n.viewState.center,o=i[0]-r[0],a=i[1]-r[1];return 65536*Math.log(s)+Math.sqrt(o*o+a*a)/s}class Uh extends Ti{constructor(t){super();const e=t.element;e&&!t.target&&!e.style.pointerEvents&&(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){var t;(t=this.element)==null||t.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){var e;this.map_&&((e=this.element)==null||e.remove());for(let i=0,s=this.listenerKeys.length;i<s;++i)Lt(this.listenerKeys[i]);if(this.listenerKeys.length=0,this.map_=t,t){const i=this.target_??t.getOverlayContainerStopEvent();this.element&&i.appendChild(this.element),this.render!==Ar&&this.listenerKeys.push(wt(t,On.POSTRENDER,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_=typeof t=="string"?document.getElementById(t):t}}class ex extends Uh{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=t.collapsed!==void 0?t.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=t.collapsible!==void 0,this.collapsible_=t.collapsible!==void 0?t.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=t.attributions;const e=t.className!==void 0?t.className:"ol-attribution",i=t.tipLabel!==void 0?t.tipLabel:"Attributions",s=t.expandClassName!==void 0?t.expandClassName:e+"-expand",r=t.collapseLabel!==void 0?t.collapseLabel:"›",o=t.collapseClassName!==void 0?t.collapseClassName:e+"-collapse";typeof r=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=r,this.collapseLabel_.className=o):this.collapseLabel_=r;const a=t.label!==void 0?t.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=s):this.label_=a;const l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=i,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(Q.CLICK,this.handleClick_.bind(this),!1);const c=e+" "+Ba+" "+mh+(this.collapsed_&&this.collapsible_?" "+cg:"")+(this.collapsible_?"":" ol-uncollapsible"),h=this.element;h.className=c,h.appendChild(this.toggleButton_),h.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=this.getMap().getAllLayers(),i=new Set(e.flatMap(s=>s.getAttributions(t)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(s=>i.add(s)):i.add(this.attributions_)),!this.overrideCollapsible_){const s=!e.some(r=>{var o;return((o=r.getSource())==null?void 0:o.getAttributionsCollapsible())===!1});this.setCollapsible(s)}return Array.from(i)}async updateElement_(t){if(!t){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const e=await Promise.all(this.collectSourceAttributions_(t).map(s=>Vs(()=>s))),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!xn(e,this.renderedAttributions_)){B_(this.ulElement_);for(let s=0,r=e.length;s<r;++s){const o=document.createElement("li");o.innerHTML=e[s],this.ulElement_.appendChild(o)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(cg),this.collapsed_?eg(this.collapseLabel_,this.label_):eg(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 ix extends Uh{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target});const e=t.className!==void 0?t.className:"ol-rotate",i=t.label!==void 0?t.label:"⇧",s=t.compassClassName!==void 0?t.compassClassName:"ol-compass";this.label_=null,typeof i=="string"?(this.label_=document.createElement("span"),this.label_.className=s,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(s));const r=t.tipLabel?t.tipLabel:"Reset rotation",o=document.createElement("button");o.className=e+"-reset",o.setAttribute("type","button"),o.title=r,o.appendChild(this.label_),o.addEventListener(Q.CLICK,this.handleClick_.bind(this),!1);const a=e+" "+Ba+" "+mh,l=this.element;l.className=a,l.appendChild(o),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=t.duration!==void 0?t.duration:250,this.autoHide_=t.autoHide!==void 0?t.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Ha)}handleClick_(t){t.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const e=this.getMap().getView();if(!e)return;const i=e.getRotation();i!==void 0&&(this.duration_>0&&i%(2*Math.PI)!==0?e.animate({rotation:0,duration:this.duration_,easing:Jn}):e.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const s="rotate("+i+"rad)";if(this.autoHide_){const r=this.element.classList.contains(Ha);!r&&i===0?this.element.classList.add(Ha):r&&i!==0&&this.element.classList.remove(Ha)}this.label_.style.transform=s}this.rotation_=i}}class nx extends Uh{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=t.className!==void 0?t.className:"ol-zoom",i=t.delta!==void 0?t.delta:1,s=t.zoomInClassName!==void 0?t.zoomInClassName:e+"-in",r=t.zoomOutClassName!==void 0?t.zoomOutClassName:e+"-out",o=t.zoomInLabel!==void 0?t.zoomInLabel:"+",a=t.zoomOutLabel!==void 0?t.zoomOutLabel:"–",l=t.zoomInTipLabel!==void 0?t.zoomInTipLabel:"Zoom in",c=t.zoomOutTipLabel!==void 0?t.zoomOutTipLabel:"Zoom out",h=document.createElement("button");h.className=s,h.setAttribute("type","button"),h.title=l,h.appendChild(typeof o=="string"?document.createTextNode(o):o),h.addEventListener(Q.CLICK,this.handleClick_.bind(this,i),!1);const u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=c,u.appendChild(typeof a=="string"?document.createTextNode(a):a),u.addEventListener(Q.CLICK,this.handleClick_.bind(this,-i),!1);const d=e+" "+Ba+" "+mh,g=this.element;g.className=d,g.appendChild(h),g.appendChild(u),this.duration_=t.duration!==void 0?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const i=this.getMap().getView();if(!i)return;const s=i.getZoom();if(s!==void 0){const r=i.getConstrainedZoom(s+t);this.duration_>0?(i.getAnimating()&&i.cancelAnimations(),i.animate({zoom:r,duration:this.duration_,easing:Jn})):i.setZoom(r)}}}function pp(n){n=n||{};const t=new Ze;return(n.zoom!==void 0?n.zoom:!0)&&t.push(new nx(n.zoomOptions)),(n.rotate!==void 0?n.rotate:!0)&&t.push(new ix(n.rotateOptions)),(n.attribution!==void 0?n.attribution:!0)&&t.push(new ex(n.attributionOptions)),t}const mp={ACTIVE:"active"};class po extends Ti{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(mp.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(mp.ACTIVE,t)}setMap(t){this.map_=t}}function sx(n,t,e){const i=n.getCenterInternal();if(i){const s=[i[0]+t[0],i[1]+t[1]];n.animateInternal({duration:e!==void 0?e:250,easing:R0,center:n.getConstrainedCenter(s)})}}function $h(n,t,e,i){const s=n.getZoom();if(s===void 0)return;const r=n.getConstrainedZoom(s+t),o=n.getResolutionForZoom(r);n.getAnimating()&&n.cancelAnimations(),n.animate({resolution:o,anchor:e,duration:i!==void 0?i:250,easing:Jn})}class rx extends po{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:250}handleEvent(t){let e=!1;if(t.type==Bt.DBLCLICK){const i=t.originalEvent,s=t.map,r=t.coordinate,o=i.shiftKey?-this.delta_:this.delta_,a=s.getView();$h(a,o,r,this.duration_),i.preventDefault(),e=!0}return!e}}function Xh(n){const t=arguments;return function(e){let i=!0;for(let s=0,r=t.length;s<r&&(i=i&&t[s](e),!!i);++s);return i}}const ox=function(n){const t=n.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},ax=function(n){const t=n.map.getTargetElement(),e=t.getRootNode(),i=n.map.getOwnerDocument().activeElement;return e instanceof ShadowRoot?e.host.contains(i):t.contains(i)},yp=function(n){const t=n.map.getTargetElement(),e=t.getRootNode();return(e instanceof ShadowRoot?e.host:t).hasAttribute("tabindex")?ax(n):!0},lx=Mr,_p=function(n){const t=n.originalEvent;return"pointerId"in t&&t.button==0&&!(Y_&&Jf&&t.ctrlKey)},vp=function(n){const t=n.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},cx=function(n){const t=n.originalEvent;return Jf?t.metaKey:t.ctrlKey},hx=function(n){const t=n.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},wp=function(n){const t=n.originalEvent,e=t.target.tagName;return e!=="INPUT"&&e!=="SELECT"&&e!=="TEXTAREA"&&!t.target.isContentEditable},Yh=function(n){const t=n.originalEvent;return"pointerId"in t&&t.pointerType=="mouse"},ux=function(n){const t=n.originalEvent;return"pointerId"in t&&t.isPrimary&&t.button===0};class mo extends po{constructor(t){t=t||{},super(t),t.handleDownEvent&&(this.handleDownEvent=t.handleDownEvent),t.handleDragEvent&&(this.handleDragEvent=t.handleDragEvent),t.handleMoveEvent&&(this.handleMoveEvent=t.handleMoveEvent),t.handleUpEvent&&(this.handleUpEvent=t.handleUpEvent),t.stopDown&&(this.stopDown=t.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(t){return!1}handleDragEvent(t){}handleEvent(t){if(!t.originalEvent)return!0;let e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==Bt.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==Bt.POINTERUP){const i=this.handleUpEvent(t);this.handlingDownUpSequence=i&&this.targetPointers.length>0}}else if(t.type==Bt.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==Bt.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 Hh(n){const t=n.length;let e=0,i=0;for(let s=0;s<t;s++)e+=n[s].clientX,i+=n[s].clientY;return{clientX:e/t,clientY:i/t}}class dx extends mo{constructor(t){super({stopDown:ba}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:Xh(vp,ux);this.condition_=t.onFocusOnly?Xh(yp,e):e,this.noKinetic_=!1}handleDragEvent(t){const e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());const i=this.targetPointers,s=e.getEventPixel(Hh(i));if(i.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(s[0],s[1]),this.lastCentroid){const r=[this.lastCentroid[0]-s[0],s[1]-this.lastCentroid[1]],a=t.map.getView();U0(r,a.getResolution()),Tc(r,a.getRotation()),a.adjustCenterInternal(r)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=s,this.lastPointersCount_=i.length,t.originalEvent.preventDefault()}handleUpEvent(t){const e=t.map,i=e.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const s=this.kinetic_.getDistance(),r=this.kinetic_.getAngle(),o=i.getCenterInternal(),a=e.getPixelFromCoordinateInternal(o),l=e.getCoordinateFromPixelInternal([a[0]-s*Math.cos(r),a[1]-s*Math.sin(r)]);i.animateInternal({center:i.getConstrainedCenter(l),duration:500,easing:Jn})}return this.panning_&&(this.panning_=!1,i.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(t){if(this.targetPointers.length>0&&this.condition_(t)){const i=t.map.getView();return this.lastCentroid=null,i.getAnimating()&&i.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}}class fx extends mo{constructor(t){t=t||{},super({stopDown:ba}),this.condition_=t.condition?t.condition:ox,this.lastAngle_=void 0,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){if(!Yh(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===zh)return;const s=e.getSize(),r=t.pixel,o=Math.atan2(s[1]/2-r[1],r[0]-s[0]/2);if(this.lastAngle_!==void 0){const a=o-this.lastAngle_;i.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(t){return Yh(t)?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){return Yh(t)&&_p(t)&&this.condition_(t)?(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}class gx extends Tr{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,i="px",s=this.element_.style;s.left=Math.min(t[0],e[0])+i,s.top=Math.min(t[1],e[1])+i,s.width=Math.abs(e[0]-t[0])+i,s.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;const t=this.startPixel_,e=this.endPixel_,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 di([s])}getGeometry(){return this.geometry_}}const ir={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class yo extends hi{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}class px extends mo{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new gx(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??_p,this.boxEndCondition_=t.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const s=i[0]-e[0],r=i[1]-e[1];return s*s+r*r>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new yo(ir.BOXDRAG,t.coordinate,t)))}handleUpEvent(t){if(!this.startPixel_)return!1;const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new yo(e?ir.BOXEND:ir.BOXCANCEL,t.coordinate,t)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(t){return this.condition_(t)?(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new yo(ir.BOXSTART,t.coordinate,t)),!0):!1}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new yo(ir.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new yo(ir.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}}class mx extends px{constructor(t){t=t||{};const e=t.condition?t.condition:hx;super({condition:e,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=t.duration!==void 0?t.duration:200,this.out_=t.out!==void 0?t.out:!1}onBoxEnd(t){const i=this.getMap().getView();let s=this.getGeometry();if(this.out_){const r=i.rotatedExtentForGeometry(s),o=i.getResolutionForExtentInternal(r),a=i.getResolution()/o;s=s.clone(),s.scale(a*a)}i.fitInternal(s,{duration:this.duration_,easing:Jn})}}const _s={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};class yx extends po{constructor(t){super(),t=t||{},this.defaultCondition_=function(e){return vp(e)&&wp(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==Q.KEYDOWN){const i=t.originalEvent,s=i.key;if(this.condition_(t)&&(s==_s.DOWN||s==_s.LEFT||s==_s.RIGHT||s==_s.UP)){const o=t.map.getView(),a=o.getResolution()*this.pixelDelta_;let l=0,c=0;s==_s.DOWN?c=-a:s==_s.LEFT?l=-a:s==_s.RIGHT?l=a:c=a;const h=[l,c];Tc(h,o.getRotation()),sx(o,h,this.duration_),i.preventDefault(),e=!0}}return!e}}class _x extends po{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(e){return!cx(e)&&wp(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==Q.KEYDOWN||t.type==Q.KEYPRESS){const i=t.originalEvent,s=i.key;if(this.condition_(t)&&(s==="+"||s==="-")){const r=t.map,o=s==="+"?this.delta_:-this.delta_,a=r.getView();$h(a,o,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}}const vx=40,wx=300;class xx extends po{constructor(t){t=t||{},super(t),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=t.maxDelta!==void 0?t.maxDelta:1,this.duration_=t.duration!==void 0?t.duration:250,this.timeout_=t.timeout!==void 0?t.timeout:80,this.useAnchor_=t.useAnchor!==void 0?t.useAnchor:!0,this.constrainResolution_=t.constrainResolution!==void 0?t.constrainResolution:!1;const e=t.condition?t.condition:lx;this.condition_=t.onFocusOnly?Xh(yp,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();if(!t)return;t.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(t){if(!this.condition_(t)||t.type!==Q.WHEEL)return!0;const i=t.map,s=t.originalEvent;s.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.pixel);let r=s.deltaY;switch(s.deltaMode){case WheelEvent.DOM_DELTA_LINE:r*=vx;break;case WheelEvent.DOM_DELTA_PAGE:r*=wx;break}if(r===0)return!1;this.lastDelta_=r;const o=Date.now();this.startTime_===void 0&&(this.startTime_=o),(!this.mode_||o-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(r)<4?"trackpad":"wheel");const a=i.getView();if(this.mode_==="trackpad"&&!(a.getConstrainResolution()||this.constrainResolution_))return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(a.getAnimating()&&a.cancelAnimations(),a.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),a.adjustZoom(-r/this.deltaPerZoom_,this.lastAnchor_?i.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=o,!1;this.totalDelta_+=r;const l=Math.max(this.timeout_-(o-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,i),l),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-kt(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),$h(e,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}}class Ex extends mo{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=ba),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=t.threshold!==void 0?t.threshold:.3,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){let e=0;const i=this.targetPointers[0],s=this.targetPointers[1],r=Math.atan2(s.clientY-i.clientY,s.clientX-i.clientX);if(this.lastAngle_!==void 0){const l=r-this.lastAngle_;this.rotationDelta_+=l,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=l}this.lastAngle_=r;const o=t.map,a=o.getView();a.getConstraints().rotation!==zh&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(Hh(this.targetPointers))),this.rotating_&&(o.render(),a.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){return this.targetPointers.length<2?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}class Cx extends mo{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=ba),super(e),this.anchor_=null,this.duration_=t.duration!==void 0?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],s=this.targetPointers[1],r=i.clientX-s.clientX,o=i.clientY-s.clientY,a=Math.sqrt(r*r+o*o);this.lastDistance_!==void 0&&(e=this.lastDistance_/a),this.lastDistance_=a;const l=t.map,c=l.getView();e!=1&&(this.lastScaleDelta_=e),this.anchor_=l.getCoordinateFromPixelInternal(l.getEventPixel(Hh(this.targetPointers))),l.render(),c.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const i=t.map.getView(),s=this.lastScaleDelta_>1?1:-1;return i.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 xp(n){n=n||{};const t=new Ze,e=new Kw(-.005,.05,100);return(n.altShiftDragRotate!==void 0?n.altShiftDragRotate:!0)&&t.push(new fx),(n.doubleClickZoom!==void 0?n.doubleClickZoom:!0)&&t.push(new rx({delta:n.zoomDelta,duration:n.zoomDuration})),(n.dragPan!==void 0?n.dragPan:!0)&&t.push(new dx({onFocusOnly:n.onFocusOnly,kinetic:e})),(n.pinchRotate!==void 0?n.pinchRotate:!0)&&t.push(new Ex),(n.pinchZoom!==void 0?n.pinchZoom:!0)&&t.push(new Cx({duration:n.zoomDuration})),(n.keyboard!==void 0?n.keyboard:!0)&&(t.push(new yx),t.push(new _x({delta:n.zoomDelta,duration:n.zoomDuration}))),(n.mouseWheelZoom!==void 0?n.mouseWheelZoom:!0)&&t.push(new xx({onFocusOnly:n.onFocusOnly,duration:n.zoomDuration})),(n.shiftDragZoom!==void 0?n.shiftDragZoom:!0)&&t.push(new mx({duration:n.zoomDuration})),t}const zn={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"};class kn extends hi{constructor(t,e){super(t),this.layer=e}}const Bh={LAYERS:"layers"};class Nn extends hp{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let i=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(Bh.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new Ze(i.slice(),{unique:!0}):Et(typeof i.getArray=="function","Expected `layers` to be an array or a `Collection`"):i=new Ze(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(Lt),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(wt(t,Me.ADD,this.handleLayersAdd_,this),wt(t,Me.REMOVE,this.handleLayersRemove_,this));for(const i in this.listenerKeys_)this.listenerKeys_[i].forEach(Lt);Dr(this.listenerKeys_);const e=t.getArray();for(let i=0,s=e.length;i<s;i++){const r=e[i];this.registerLayerListeners_(r),this.dispatchEvent(new kn(zn.ADDLAYER,r))}this.changed()}registerLayerListeners_(t){const e=[wt(t,Gs.PROPERTYCHANGE,this.handleLayerChange_,this),wt(t,Q.CHANGE,this.handleLayerChange_,this)];t instanceof Nn&&e.push(wt(t,zn.ADDLAYER,this.handleLayerGroupAdd_,this),wt(t,zn.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[at(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new kn(zn.ADDLAYER,t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new kn(zn.REMOVELAYER,t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new kn(zn.ADDLAYER,e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=at(e);this.listenerKeys_[i].forEach(Lt),delete this.listenerKeys_[i],this.dispatchEvent(new kn(zn.REMOVELAYER,e)),this.changed()}getLayers(){return this.get(Bh.LAYERS)}setLayers(t){const e=this.getLayers();if(e){const i=e.getArray();for(let s=0,r=i.length;s<r;++s)this.dispatchEvent(new kn(zn.REMOVELAYER,i[s]))}this.set(Bh.LAYERS,t)}getLayersArray(t){return t=t!==void 0?t:[],this.getLayers().forEach(function(e){e.getLayersArray(t)}),t}getLayerStatesArray(t){const e=t!==void 0?t:[],i=e.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(e)});const s=this.getLayerState();let r=s.zIndex;!t&&s.zIndex===void 0&&(r=0);for(let o=i,a=e.length;o<a;o++){const l=e[o];l.opacity*=s.opacity,l.visible=l.visible&&s.visible,l.maxResolution=Math.min(l.maxResolution,s.maxResolution),l.minResolution=Math.max(l.minResolution,s.minResolution),l.minZoom=Math.max(l.minZoom,s.minZoom),l.maxZoom=Math.min(l.maxZoom,s.maxZoom),s.extent!==void 0&&(l.extent!==void 0?l.extent=ci(l.extent,s.extent):l.extent=s.extent),l.zIndex===void 0&&(l.zIndex=r)}return e}getSourceState(){return"ready"}}class bx extends Tr{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){et()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,s=t.pixelToCoordinateTransform;ui(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),Of(s,i)}forEachFeatureAtCoordinate(t,e,i,s,r,o,a,l){let c;const h=e.viewState;function u(x,C,P,b){return r.call(o,C,x?P:null,b)}const d=h.projection,g=Mc(t.slice(),d),p=[[0,0]];if(d.canWrapX()&&s){const x=d.getExtent(),C=ut(x);p.push([-C,0],[C,0])}const m=e.layerStatesArray,_=m.length,v=[],y=[];for(let x=0;x<p.length;x++)for(let C=_-1;C>=0;--C){const P=m[C],b=P.layer;if(b.hasRenderer()&&Vh(P,h)&&a.call(l,b)){const R=b.getRenderer(),I=b.getSource();if(R&&I){const S=I.getWrapX()?g:t,F=u.bind(null,P.managed);y[0]=S[0]+p[x][0],y[1]=S[1]+p[x][1],c=R.forEachFeatureAtCoordinate(y,e,i,F,v)}if(c)return c}}if(v.length===0)return;const w=1/v.length;return v.forEach((x,C)=>x.distanceSq+=C*w),v.sort((x,C)=>x.distanceSq-C.distanceSq),v.some(x=>c=x.callback(x.feature,x.layer,x.geometry)),c}hasFeatureAtCoordinate(t,e,i,s,r,o){return this.forEachFeatureAtCoordinate(t,e,i,s,Mr,this,r,o)!==void 0}getMap(){return this.map_}renderFrame(t){et()}scheduleExpireIconCache(t){Ke.canExpireCache()&&t.postRenderFunctions.push(Px)}}function Px(n,t){Ke.expire()}class Rx extends bx{constructor(t){super(t),this.fontChangeListenerKey_=wt(ds,Gs.PROPERTYCHANGE,t.redrawText,t),this.element_=Ae?ig():document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=Ba+" ol-layers";const i=t.getViewport();i&&i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const s=new $g(t,void 0,e);i.dispatchEvent(s)}}disposeInternal(){Lt(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(t){if(!t){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(t),this.dispatchRenderEvent(qe.PRECOMPOSE,t);const e=t.layerStatesArray.sort((c,h)=>c.zIndex-h.zIndex);e.some(c=>c.layer instanceof hl&&c.layer.getDeclutter())&&(t.declutter={});const s=t.viewState;this.children_.length=0;const r=[];let o=null;for(let c=0,h=e.length;c<h;++c){const u=e[c];t.layerIndex=c;const d=u.layer,g=d.getSourceState();if(!Vh(u,s)||g!="ready"&&g!="undefined"){d.unrender();continue}const p=d.render(t,o);p&&(p!==o&&(this.children_.push(p),o=p),r.push(u))}this.declutter(t,r),Z_(this.element_,this.children_);const l=this.getMap().getTargetElement();if(In(l)){const c=l.getContext("2d");for(const h of this.children_){const u=h.firstElementChild||h,d=h.style.backgroundColor;if(d&&(!In(u)||u.width>0)&&(c.fillStyle=d,c.fillRect(0,0,l.width,l.height)),In(u)&&u.width>0){c.save();const g=h.style.opacity||u.style.opacity;c.globalAlpha=g===""?1:Number(g);const p=u.style.transform;if(p)c.transform(...Xc(p));else{const m=parseFloat(u.style.width)/u.width,_=parseFloat(u.style.height)/u.height;c.transform(m,0,0,_,0,0)}c.drawImage(u,0,0),c.restore()}}}this.dispatchRenderEvent(qe.POSTCOMPOSE,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){if(t.declutter){for(let i=e.length-1;i>=0;--i){const s=e[i],r=s.layer;r.getDeclutter()&&r.renderDeclutter(t,s)}e.forEach(i=>i.layer.renderDeferred(t))}}}function Ep(n){if(n instanceof fo){n.setMapInternal(null);return}n instanceof Nn&&n.getLayers().forEach(Ep)}function Cp(n,t){if(n instanceof fo){n.setMapInternal(t);return}if(n instanceof Nn){const e=n.getLayers().getArray();for(let i=0,s=e.length;i<s;++i)Cp(e[i],t)}}let bp=class extends Ti{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=Ix(t);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=t.maxTilesLoading!==void 0?t.maxTilesLoading:16,this.pixelRatio_=t.pixelRatio!==void 0?t.pixelRatio:H_,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=xe(),this.pixelToCoordinateTransform_=xe(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,Ae||(this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in globalThis?" 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,Ae||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=e.controls||(Ae?new Ze:pp()),this.interactions=e.interactions||(Ae?new Ze:xp({onFocusOnly:!0})),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new gp(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(we.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(we.VIEW,this.handleViewChanged_),this.addChangeListener(we.SIZE,this.handleSizeChanged_),this.addChangeListener(we.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const i=this;t.view&&!(t.view instanceof Oi)&&t.view.then(function(s){i.setView(new Oi(s))}),this.controls.addEventListener(Me.ADD,s=>{s.element.setMap(this)}),this.controls.addEventListener(Me.REMOVE,s=>{s.element.setMap(null)}),this.interactions.addEventListener(Me.ADD,s=>{s.element.setMap(this)}),this.interactions.addEventListener(Me.REMOVE,s=>{s.element.setMap(null)}),this.overlays_.addEventListener(Me.ADD,s=>{this.addOverlayInternal_(s.element)}),this.overlays_.addEventListener(Me.REMOVE,s=>{const r=s.element.getId();r!==void 0&&delete this.overlayIdIndex_[r.toString()],s.element.setMap(null)}),this.controls.forEach(s=>{s.setMap(this)}),this.interactions.forEach(s=>{s.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){Cp(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();e!==void 0&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){var t;this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),(t=this.resizeObserver_)==null||t.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const s=this.getCoordinateFromPixelInternal(t);i=i!==void 0?i:{};const r=i.hitTolerance!==void 0?i.hitTolerance:0,o=i.layerFilter!==void 0?i.layerFilter:Mr,a=i.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(s,this.frameState_,r,a,e,null,o,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,function(s){i.push(s)},e),i}getAllLayers(){const t=[];function e(i){i.forEach(function(s){s instanceof Nn?e(s.getLayers()):t.push(s)})}return e(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t);e=e!==void 0?e:{};const s=e.layerFilter!==void 0?e.layerFilter:Mr,r=e.hitTolerance!==void 0?e.hitTolerance:0,o=e.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,r,o,s,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const i=this.viewport_.getBoundingClientRect(),s=this.getSize(),r=i.width/s[0],o=i.height/s[1],a="changedTouches"in t?t.changedTouches[0]:t;return[(a.clientX-i.left)/r,(a.clientY-i.top)/o]}getTarget(){return this.get(we.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return Vc(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?Yt(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(we.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof Ze){e.setLayers(t);return}const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e<i;++e){const s=t[e];if(!s.visible)continue;const r=s.layer.getRenderer();if(r&&!r.ready)return!0;const o=s.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(t){const e=Ji(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?Yt(e.coordinateToPixelTransform,t.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(t){this.pixelRatio_!==t&&(this.pixelRatio_=t,this.render())}getRenderer(){return this.renderer_}getSize(){return this.get(we.SIZE)}getView(){return this.get(we.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,i,s){return tx(this.frameState_,t,e,i,s)}handleBrowserEvent(t,e){e=e||t.type;const i=new Ln(e,this,t);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,i=e.type;if(i===Wh.POINTERDOWN||i===Q.WHEEL||i===Q.KEYDOWN){const s=this.getOwnerDocument(),r=this.viewport_.getRootNode?this.viewport_.getRootNode():s,o=e.target,a=r instanceof ShadowRoot?r.host===o?r.host.ownerDocument:r:r===s?s.documentElement:r;if(this.overlayContainerStopEvent_.contains(o)||!a.contains(o))return}if(t.frameState=this.frameState_,this.dispatchEvent(t)!==!1){const s=this.getInteractions().getArray().slice();for(let r=s.length-1;r>=0;r--){const o=s[r];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let s=this.maxTilesLoading_,r=s;if(t){const o=t.viewHints;if(o[Ot.ANIMATING]||o[Ot.INTERACTING]){const a=Date.now()-t.time>8;s=a?0:8,r=a?0:2}}e.getTilesLoading()<s&&(e.reprioritize(),e.loadMoreTiles(s,r))}t&&this.renderer_&&!t.animate&&(this.renderComplete_?(this.hasListener(qe.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(qe.RENDERCOMPLETE,t),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new er(On.LOADEND,this,t)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new er(On.LOADSTART,this,t))));const i=this.postRenderFunctions_;if(t)for(let s=0,r=i.length;s<r;++s)i[s](this,t);i.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){var i,s;if(this.mapBrowserEventHandler_){for(let r=0,o=this.targetChangeHandlerKeys_.length;r<o;++r)Lt(this.targetChangeHandlerKeys_[r]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(Q.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(Q.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!In(this.targetElement_)){(i=this.resizeObserver_)==null||i.unobserve(this.targetElement_);const r=this.targetElement_.getRootNode();r instanceof ShadowRoot&&this.resizeObserver_.unobserve(r.host),this.setSize(void 0)}const t=this.getTarget(),e=typeof t=="string"?document.getElementById(t):t;if(this.targetElement_=e,!e)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{if(In(e)||e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new Rx(this)),!In(e)){this.mapBrowserEventHandler_=new Jw(this,this.moveTolerance_);for(const o in Bt)this.mapBrowserEventHandler_.addEventListener(Bt[o],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(Q.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(Q.WHEEL,this.boundHandleBrowserEvent_,tg?{passive:!1}:!1);let r;if(this.keyboardEventTarget_)r=this.keyboardEventTarget_;else{const o=e.getRootNode();r=o instanceof ShadowRoot?o.host:e}if(this.targetChangeHandlerKeys_=[wt(r,Q.KEYDOWN,this.handleBrowserEvent,this),wt(r,Q.KEYPRESS,this.handleBrowserEvent,this)],e instanceof HTMLElement){const o=e.getRootNode();o instanceof ShadowRoot&&this.resizeObserver_.observe(o.host),(s=this.resizeObserver_)==null||s.observe(e)}}this.updateSize()}}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(Lt(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(Lt(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=wt(t,Gs.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=wt(t,Q.CHANGE,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(Lt),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new kn("addlayer",t)),this.layerGroupPropertyListenerKeys_=[wt(t,Gs.PROPERTYCHANGE,this.render,this),wt(t,Q.CHANGE,this.render,this),wt(t,"addlayer",this.handleLayerAdd_,this),wt(t,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;const t=this.frameState_.layerStatesArray;for(let e=0,i=t.length;e<i;++e){const s=t[e].layer;s.hasRenderer()&&s.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){return this.getLayerGroup().getLayers().remove(t)}handleLayerRemove_(t){Ep(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),i=this.getView(),s=this.frameState_;let r=null;if(e!==void 0&&Tg(e)&&i&&i.isDef()){const o=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=i.getState();if(r={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:xa(a.center,a.resolution,a.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:at(this),renderTargets:{}},a.nextCenter&&a.nextResolution){const l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;r.nextExtent=xa(a.nextCenter,a.nextResolution,l,e)}}this.frameState_=r,this.renderer_.renderFrame(r),r&&(r.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,r.postRenderFunctions),s&&(!this.previousExtent_||!qi(this.previousExtent_)&&!ji(r.extent,this.previousExtent_))&&(this.dispatchEvent(new er(On.MOVESTART,this,s)),this.previousExtent_=Ns(this.previousExtent_)),this.previousExtent_&&!r.viewHints[Ot.ANIMATING]&&!r.viewHints[Ot.INTERACTING]&&!ji(r.extent,this.previousExtent_)&&(this.dispatchEvent(new er(On.MOVEEND,this,r)),Qd(r.extent,this.previousExtent_))),this.dispatchEvent(new er(On.POSTRENDER,this,r)),this.renderComplete_=(this.hasListener(On.LOADSTART)||this.hasListener(On.LOADEND)||this.hasListener(qe.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new kn("removelayer",e)),this.set(we.LAYERGROUP,t)}setSize(t){this.set(we.SIZE,t)}setTarget(t){this.set(we.TARGET,t)}setView(t){if(!t||t instanceof Oi){this.set(we.VIEW,t);return}this.set(we.VIEW,new Oi);const e=this;t.then(function(i){e.setView(new Oi(i))})}updateSize(){const t=this.getTargetElement();let e;if(t){let s,r;if(In(t)){const o=t.getContext("2d").getTransform();s=t.width/o.a,r=t.height/o.d}else{const o=getComputedStyle(t);s=t.offsetWidth-parseFloat(o.borderLeftWidth)-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight)-parseFloat(o.borderRightWidth),r=t.offsetHeight-parseFloat(o.borderTopWidth)-parseFloat(o.paddingTop)-parseFloat(o.paddingBottom)-parseFloat(o.borderBottomWidth)}!isNaN(s)&&!isNaN(r)&&(e=[Math.max(0,s),Math.max(0,r)],!Tg(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&pf("No map visible because the map container's width or height are 0."))}const i=this.getSize();e&&(!i||!xn(e,i))&&(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}};function Ix(n){let t=null;n.keyboardEventTarget!==void 0&&(t=typeof n.keyboardEventTarget=="string"?document.getElementById(n.keyboardEventTarget):n.keyboardEventTarget);const e={},i=n.layers&&typeof n.layers.getLayers=="function"?n.layers:new Nn({layers:n.layers});e[we.LAYERGROUP]=i,e[we.TARGET]=n.target,e[we.VIEW]=n.view instanceof Oi?n.view:new Oi;let s;n.controls!==void 0&&(Array.isArray(n.controls)?s=new Ze(n.controls.slice()):(Et(typeof n.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),s=n.controls));let r;n.interactions!==void 0&&(Array.isArray(n.interactions)?r=new Ze(n.interactions.slice()):(Et(typeof n.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),r=n.interactions));let o;return n.overlays!==void 0?Array.isArray(n.overlays)?o=new Ze(n.overlays.slice()):(Et(typeof n.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=n.overlays):o=new Ze,{controls:s,interactions:r,keyboardEventTarget:t,overlays:o,values:e}}class Zh{constructor(t,e,i,s){this.minX=t,this.maxX=e,this.minY=i,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 nr(n,t,e,i,s){return s!==void 0?(s.minX=n,s.maxX=t,s.minY=e,s.maxY=i,s):new Zh(n,t,e,i)}const Pp=[];class Sx extends go{constructor(t,e,i,s,r){super(t,e,{transition:0}),this.context_=null,this.executorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.replayState_={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=s.bind(void 0,this),this.removeSourceTiles_=r,this.wrappedTileCoord=i}getContext(){return this.context_||(this.context_=Nt(1,1,Pp)),this.context_}hasContext(){return!!this.context_}getImage(){return this.hasContext()?this.getContext().canvas:null}getReplayState(t){const e=at(t);return e in this.replayState_||(this.replayState_[e]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedPixelRatio:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.replayState_[e]}load(){this.getSourceTiles()}release(){this.context_&&(Ur(this.context_),Pp.push(this.context_.canvas),this.context_=null),this.removeSourceTiles_(this),this.sourceTiles.length=0,super.release()}}let Tx=class extends go{constructor(t,e,i,s,r,o){super(t,e,o),this.extent=null,this.format_=s,this.features_=null,this.loader_,this.projection=null,this.resolution,this.tileLoadFunction_=r,this.url_=i,this.key=i}getTileUrl(){return this.url_}getFormat(){return this.format_}getFeatures(){return this.features_}load(){this.state==W.IDLE&&(this.setState(W.LOADING),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))}onLoad(t,e){this.setFeatures(t)}onError(){this.setState(W.ERROR)}setFeatures(t){this.features_=t,this.setState(W.LOADED)}setLoader(t){this.loader_=t}};async function Rp(n,t=128,e=128,i="map",s=1){return new Promise((r,o)=>{n.renderSync();try{const a=n.getSize()||[t,e],l=document.createElement("canvas"),c=a[0]*s,h=a[1]*s;l.width=c,l.height=h;const u=l.getContext("2d",{willReadFrequently:!0});if(!u)throw new Error("Failed to create canvas context");Array.from(n.getViewport().querySelectorAll(".ol-layer canvas, canvas.ol-layer")).filter(p=>{if(!(p instanceof HTMLCanvasElement)||p.width===0)return!1;try{return p.toDataURL("image/png"),!0}catch{return console.warn("跳过跨域图层:",p),!1}}).forEach(p=>{var y;const m=parseFloat(p.style.opacity||"1");u.globalAlpha=m;let _=[1,0,0,1,0,0];const v=p.style.transform;if(v){const[w,x,C,P,b,R]=((y=v.match(/^matrix\(([^)]+)\)$/))==null?void 0:y[1].split(",").map(Number))||[1,0,0,1,0,0];u.setTransform({a:w,b:x,c:C,d:P,e:b,f:R})}u.drawImage(p,0,0,c,h)}),u.globalAlpha=1,u.setTransform(1,0,0,1,0,0);const g=l.toDataURL("image/png");r(g)}catch(a){o(a)}})}function Ip(n,t){const{center:e,orbitPeriod:i,heading:s=0}=t,r=n.getView(),a=(d=>d*Math.PI/180)(s);let l,c,h=!0;const u=d=>{c||(c=d);const p=(d-c)%i/i,m=2*Math.PI*p+a;r.setRotation(-m),n.render(),h&&(l=requestAnimationFrame(u))};return l=requestAnimationFrame(u),{stop(){h=!1,cancelAnimationFrame(l),r.setRotation(0)}}}function Mx(n,t){const e=dt(t),i=new je({geometry:new Ne(e)});i.setStyle(new Pt({image:new Qe({radius:6,fill:new Ht({color:"red"}),stroke:new te({color:"white",width:2})}),text:new qs({text:"中心点可视化-测试后删除",font:"14px sans-serif",fill:new Ht({color:"black"}),stroke:new te({color:"white",width:3}),offsetY:-15})}));const s=new ti({source:new Ge({features:[i]})});n.addLayer(s)}class Sp extends f.Destroyable{constructor(e,i,s){super();E(this,"keysPressed",{w:!1,a:!1,s:!1,d:!1});E(this,"animationId",0);E(this,"view");E(this,"updatePosition",()=>{const e=this.view.getCenter();if(!e)return;const i=this.view.getZoom()??10,s=1e3/Math.pow(2,i-10);let[r,o]=e;this.keysPressed.w&&(o+=s),this.keysPressed.s&&(o-=s),this.keysPressed.a&&(r-=s),this.keysPressed.d&&(r+=s),this.view.setCenter([r,o]),this.animationId=requestAnimationFrame(this.updatePosition)});this.map=i,this.view=i.getView(),this.view.setCenter(dt(s));const r=l=>{l.key in this.keysPressed&&(this.keysPressed[l.key]=!0)},o=l=>{l.key in this.keysPressed&&(this.keysPressed[l.key]=!1)},a=l=>{l.preventDefault();const c=this.view.getZoom()??10,h=l.deltaY>0?-1:1;this.view.setZoom(c+h)};e.addEventListener("keydown",r),e.addEventListener("keyup",o),i.getTargetElement().addEventListener("wheel",a,{passive:!1}),this.d(()=>e.removeEventListener("keydown",r)),this.d(()=>e.removeEventListener("keyup",o)),this.d(()=>i.getTargetElement().removeEventListener("wheel",a)),this.animationId=requestAnimationFrame(this.updatePosition),this.d(()=>cancelAnimationFrame(this.animationId))}}function Tp(n){const e=Math.PI/3,i=256,s=n*2*Math.tan(e/2)/n,r=Math.log2(2*Math.PI*6378137/(s*i));return parseFloat(r.toFixed(3))}function sr(n){return 6378137/Math.pow(2,n-5)}function Gn(n){const e=Math.log2(6378137/n)+5+0;return Math.min(28,Math.max(0,e))}class Mp extends f.Destroyable{constructor(e){super();E(this,"lastTime",performance.now());E(this,"frameCount",0);E(this,"currentFPS",0);E(this,"map");E(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 Ap=[0,-90,0];function Dp(n,t){const e=n.viewer;if(!e)return;const i=e.getView(),{position:s,rotation:r,duration:o=1e3,hdelta:a,pdelta:l,cancelCallback:c}=t;if(!s)return;const[h,u,d]=s,g=dt([h,u]),p=(Gn==null?void 0:Gn(d))??i.getZoom(),_=(((r==null?void 0:r[0])??0)+(a??0))*Math.PI/180,v={center:g,zoom:p,rotation:-_,duration:o};try{return i.animate(v,()=>{}),Promise.resolve(!0)}catch{return c==null||c(),Promise.resolve(!1)}}function on(n,t,e,i,s,r){return(n==null?void 0:n.viewer)&&Dp(n,{position:t,rotation:i,duration:s&&s*1e3,cancelCallback:r})}function dl(n){const t=n.map(e=>dt([e[0],e[1]]));return Rr(t)}const _o=(n,t,e=1,i=350)=>{n.getView().fit(t,{duration:e*1e3,padding:Array.isArray(i)?i:[i,i,i,i]})},Ax=(n,t,e=1,i=350)=>{const s=dl(t);_o(n,s,e,i)},jh=(n,t,e=1,i=350)=>{const s=dt([t[0],t[1]]),r=Rr([s]);_o(n,r,e,i)},Dx=(n,t,e)=>{};function Fp(n,t){const e=n.viewer;if(!e)throw new Error("viewer.map is undefined");const i=e.getView(),s=i.getCenter();if(!s)throw new Error("view center is undefined");const r=i.getZoom(),o=(sr==null?void 0:sr(r??0))??0;return[s[0],s[1],o]}class Fx extends f.Destroyable{constructor(e,i){super();E(this,"_map");E(this,"_view");E(this,"_enabled",!0);E(this,"_keys",[]);E(this,"_changed",new f.Event);E(this,"_options");E(this,"_rafPending",!1);E(this,"_rafId",null);E(this,"_lastEmit",0);if(this._options={emitImmediately:!0,usePostRender:!1,throttleMs:0,useRaf:!0,...i},e instanceof Hi.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,i,s){const r=e.on(i,s);return this._keys.push(r),this.dispose(()=>Si(r)),r}_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(Si),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 Lp(n,t,e,i){if(!n)throw new Error("olMap is undefined");await Promise.resolve();const s=n.getEventPixel(t);if(!s)return;const r=n.getCoordinateFromPixel(s);if(!r)return;const[o,a]=ae(r),l=e??0;return i?(i[0]=o,i[1]=a,i[2]=l,i):[o,a,l]}function Op(n,t,e,i,s,r){s.constraintMode="none",s.startDragPos=[0,0,0];const o=t.getEventPixel(n),a=t.getCoordinateFromPixel(o);if(!a)return!1;const l=ae(a),c=[l[0],l[1],e.position[2]],h=e.position,u=e.heading,d=Lx(t,i,h),g=(p,m)=>{const _=Ox(h,c,p),v=f.geoRhumbDistance(h,c);if(_>.98&&v<d&&!(r!=null&&r[m])){s.constraintMode=m;const y=f.geoRhumbDestination(h,v,p);if(y)return s.startDragPos=[y[0],y[1],h[2]],!0}return!1};return g(u+90,"x")||g(u,"y")?!0:!(r!=null&&r.xy)&&f.geoRhumbDistance(h,c)<d?(s.constraintMode="xy",s.startDragPos=c,!0):!1}function Lx(n,t,e){const i=n.getPixelFromCoordinate(dt([e[0],e[1]])),s=[i[0]+t,i[1]],r=ae(n.getCoordinateFromPixel(s));return f.geoRhumbDistance([e[0],e[1],0],[r[0],r[1],0])}function Ox(n,t,e){const i=f.geoRhumbHeading(n,t),s=e*Math.PI/180,r=i*Math.PI/180;return Math.cos(s)*Math.cos(r)+Math.sin(s)*Math.sin(r)}function Vn(n,t,e,i){const s=f.geoRhumbDistance(n,e),r=f.geoRhumbHeading(n,e),o=Math.cos(r*Math.PI/180)*Math.cos(t*Math.PI/180)+Math.sin(r*Math.PI/180)*Math.sin(t*Math.PI/180);return o>0?f.geoRhumbDestination(n,s,t,i):f.geoRhumbDestination(n,s,t+180,i),[o>0?s:-s,i]}function zx(n,t,e){const i=e*.1,s=[];for(let r=-9;r<10;++r){const o=f.geoRhumbDestination(n,i*r,t);o&&s.push(o)}return s}function kx(n,t){return f.geoNearestPointOnLine(n,t).geometry.coordinates}function Nx(n,t,e,i=10){const s={constraintMode:"none",startDragPos:[0,0,0]},r=n.getPixelFromCoordinate(dt([e.position[0],e.position[1]])),o=n.getEventPixel(t),a=o[0]-r[0],l=o[1]-r[1],h=(Math.atan2(-l,a)*(180/Math.PI)-e.heading+360)%360;Math.abs(a)<i&&Math.abs(l)<i?s.constraintMode="xy":h>=75&&h<=105||h>=255&&h<=285?s.constraintMode="y":h<=15||h>=345||h>=165&&h<=195?s.constraintMode="x":s.constraintMode="xy";const[u,d]=ae(n.getCoordinateFromPixel(o));return s.startDragPos=[u,d,e.position[2]],s}function Gx(n,t,e){const i=n.getPixelFromCoordinate(t),s=[i[0]+e,i[1]],r=n.getCoordinateFromPixel(s);if(!r)return 1/0;const[o,a]=ae(r),[l,c]=ae(t);return Math.abs(f.geoRhumbDistance([l,c,0],[o,a,0]))}function zp(n,t,e,i,s,r){const o=s-e,a=r-i,l=n-e,c=t-i,h=o*l+a*c;if(h<=0)return Math.hypot(n-e,t-i);const u=o*o+a*a;if(u<=h)return Math.hypot(n-s,t-r);const d=h/u,g=e+d*o,p=i+d*a;return Math.hypot(n-g,t-p)}function kp(n,t,e,i=8,s,r){const o=s??{constraintMode:"none",startDragPos:[0,0,0]};o.constraintMode="none",o.startDragPos=[0,0,0];const a=dt([e.position[0],e.position[1]]),l=n.getPixelFromCoordinate(a);if(!l)return o;const c=n.getEventPixel(t),[h,u]=c,d=Math.max(1e-6,e.dimensions[0]),g=e.heading,p=f.geoRhumbDestination(e.position,d,g+90),m=f.geoRhumbDestination(e.position,d,g+0);if(!p||!m)return o;const _=a,v=a,y=dt([p[0],p[1]]),w=dt([m[0],m[1]]),x=n.getPixelFromCoordinate(_),C=n.getPixelFromCoordinate(y),P=n.getPixelFromCoordinate(v),b=n.getPixelFromCoordinate(w),R=Gx(n,a,i),S=Math.hypot(h-l[0],u-l[1])<=i,F=zp(h,u,x[0],x[1],C[0],C[1]),k=zp(h,u,P[0],P[1],b[0],b[1]);if(!(r!=null&&r.zAxis)){const A=d,U=f.geoRhumbDestination(e.position,A,g);if(!U)return o;const N=n.getPixelFromCoordinate(dt([U[0],U[1]]));Math.hypot(N[0]-l[0],N[1]-l[1])}let T="none";!(r!=null&&r.x)&&F<=i&&F<k&&(T="x"),!(r!=null&&r.y)&&k<=i&&k<F&&(T="y");const L=ae(n.getCoordinateFromPixel(c));if(T==="x"||T==="y"){const A=T==="x"?g+90:g+0,[U,N]=Vn(e.position,A,[L[0],L[1],e.position[2]]);if(U>0&&N&&f.geoDistance(N,[L[0],L[1],e.position[2]])<=R)return o.constraintMode=T,o.startDragPos=[N[0],N[1],e.position[2]],o}return!(r!=null&&r.xy)&&(S||!0)&&(o.constraintMode="xy",o.startDragPos=[L[0],L[1],e.position[2]]),o}class Np extends f.Destroyable{constructor(t,e,i,s=100){super();const r=t.getView(),[o,a]=f.getReactFuncs(i),l=()=>{const h=r.getZoom()??0,u=s*Math.pow(2,10-h);a([u,u,u])};l();const c=()=>l();r.on("change:resolution",c),this.ad(()=>r.un("change:resolution",c))}}const Gp=(1-1/298.257223563)**2;function fl(n,t={x:0,y:0,z:0}){return[t.x,t.y,t.z]=f.lbhToXyz(n),t}function Vp({x:n,y:t,z:e},i){if(n===0&&t===0&&e===0)return;const s=f.xyzToLbh([n,t,e]);return i?([i[0],i[1],i[2]]=s,i):s}function Wp(n,t){const{x:e,y:i,z:s,w:r}=n;return{x:r*t.x+e*t.w+i*t.z-s*t.y,y:r*t.y-e*t.z+i*t.w+s*t.x,z:r*t.z+e*t.y-i*t.x+s*t.w,w:r*t.w-e*t.x-i*t.y-s*t.z}}function Vx(n,t,e){const{x:i,y:s,z:r}=n,o=Math.abs(i)<=1e-14&&Math.abs(s)<=1e-14,a=Math.hypot(i,s),l=Math.hypot(a,r/Gp),c=o?[0,0,r<-1e-14?-1:1]:[i/l,s/l,r/Gp/l],h=o?[0,1,0]:[-s/a,i/a,0],u=[-c[2]*h[1],c[2]*h[0],c[0]*h[1]-c[1]*h[0]],d=-t.heading/2,g=-t.pitch/2,p=t.roll/2,m=Wp(Wp({x:0,y:0,z:Math.sin(d),w:Math.cos(d)},{x:0,y:Math.sin(g),z:0,w:Math.cos(g)}),{x:Math.sin(p),y:0,z:0,w:Math.cos(p)}),{x:_,y:v,z:y,w}=m,x=[[_*_-v*v-y*y+w*w,2*(_*v+w*y),2*(_*y-w*v)],[2*(_*v-w*y),-_*_+v*v-y*y+w*w,2*(v*y+w*_)],[2*(_*y+w*v),2*(v*y-w*_),-_*_-v*v+y*y+w*w]].map(([b,R,I])=>h.map((S,F)=>S*b+u[F]*R+c[F]*I)),C=x.map((b,R)=>b[R]),P=C[0]+C[1]+C[2];if(e=e||{x:0,y:0,z:0,w:0},P>0){const b=Math.sqrt(1+P);e.w=b/2,e.x=(x[1][2]-x[2][1])/(2*b),e.y=(x[2][0]-x[0][2])/(2*b),e.z=(x[0][1]-x[1][0])/(2*b)}else{const b=C.indexOf(Math.max(...C)),R=(b+1)%3,I=(R+1)%3,S=Math.sqrt(1+C[b]-C[R]-C[I]),F=[0,0,0];F[b]=-S/2,F[R]=-(x[b][R]+x[R][b])/(2*S),F[I]=-(x[b][I]+x[I][b])/(2*S),[e.x,e.y,e.z]=F,e.w=(x[I][R]-x[R][I])/(2*S)}return e}const vo=n=>n*(Math.PI/180),wo=n=>n*(180/Math.PI);function Up(n,t){return t=t||{x:0,y:0},t.x=n[0],t.y=n[1],t}function $p(n,t){return t=t||[0,0],t[0]=n.x,t[1]=n.y,t}function gl(n,t){return t=t||{x:0,y:0,z:0},t.x=n[0],t.y=n[1],t.z=n[2],t}function Xp(n,t){return t=t||[0,0,0],t[0]=n.x,t[1]=n.y,t[2]=n.z,t}function Yp(n,t){return t=t||{x:0,y:0,z:0,w:0},t.x=n[0],t.y=n[1],t.z=n[2],t.w=n[3],t}function Hp(n,t){return t=t||[0,0,0,0],t[0]=n.x,t[1]=n.y,t[2]=n.z,t[3]=n.w,t}function Wx(n,t){if(n.length===4)return Yp(n,t);if(n.length===3)return gl(n,t);if(n.length===2)return Up(n,t);throw new Error("toCartesian error: should not be here!")}function Ux(n,t){if("x"in n&&"y"in n)return"w"in n&&"z"in n?Hp(n,t):"z"in n?Xp(n,t):$p(n,t);throw new Error("fromCartesian error: should not be here!")}function $x(n,t){return t=t||{longitude:0,latitude:0,height:0},t.longitude=vo(n[0]),t.latitude=vo(n[1]),t.height=n[2],t}function Xx(n,t){return t=t||[0,0,0],t[0]=wo(n.longitude),t[1]=wo(n.latitude),t[2]=0,t}function Yx(n,t){return t=t||{red:0,green:0,blue:0,alpha:0},t.red=n[0],t.green=n[1],t.blue=n[2],t.alpha=n[3],t}function Hx(n,t){return t=t||[0,0,0,0],t[0]=n.red,t[1]=n.green,t[2]=n.blue,t[3]=n.alpha,t}function Bx(n,t){return t=t||{near:0,nearValue:0,far:0,farValue:0},t.near=n[0],t.nearValue=n[1],t.far=n[2],t.farValue=n[3],t}function Zx(n,t){return t=t||[0,0,0,0],t[0]=n.near,t[1]=n.nearValue,t[2]=n.far,t[3]=n.farValue,t}function Bp(n,t){return t=t||{heading:0,pitch:0,roll:0},t.heading=vo(n[0]-90),t.pitch=vo(n[1]),t.roll=vo(n[2]),t}function jx(n,t){return t=t||[0,0,0],t[0]=wo(n.heading+Math.PI/2),t[1]=wo(n.pitch),t[2]=wo(n.roll),t}function qx(n,t){return t=t||{near:0,far:0},t.near=n[0],t.far=n[1],t}function Kx(n,t){return t=t||[0,0],t[0]=n.near,t[1]=n.far,t}function Jx(n,t){return t=t||{x:0,y:0,z:0,w:0},t.x=n[0],t.y=n[1],t.z=n[2],t.w=n[3],t}function Qx(n,t){return t=t||[0,0,0,0],t[0]=n.x,t[1]=n.y,t[2]=n.z,t[3]=n.w,t}function t1(n,t,e){return Vx(fl(n),Bp(t),e)}function e1(n,t){return t=t||{west:0,south:0,east:0,north:0},t.west=n[0]*Math.PI/180,t.south=n[1]*Math.PI/180,t.east=n[2]*Math.PI/180,t.north=n[3]*Math.PI/180,t}function i1(n,t){return t=t||[0,0,0,0],t[0]=n.west,t[1]=n.south,t[2]=n.east,t[3]=n.north,t}function n1(n,t){if(n.some(e=>e<0))throw new RangeError("Ellipsoid radii must be nonnegative");return t?(gl(n,t.radii),t):{radii:gl(n)}}function s1(n,t){return t=t||[0,0,0],t[0]=n.radii.x,t[1]=n.radii.y,t[2]=n.radii.z,t}const Zp={x:1,y:0,z:0},r1={x:0,y:1,z:0},jp={x:0,y:0,z:1},o1={x:0,y:-1,z:0};function qh(n,t){const e=Math.hypot(n.x,n.y,n.z);if(!e)throw new Error("Rotation axis must have nonzero length");const i=t*(Math.PI/360),s=Math.sin(i)/e;return{x:n.x*s,y:n.y*s,z:n.z*s,w:Math.cos(i)}}function qp(n,t,e){const i=n.w*t.x+n.x*t.w+n.y*t.z-n.z*t.y,s=n.w*t.y-n.x*t.z+n.y*t.w+n.z*t.x,r=n.w*t.z+n.x*t.y-n.y*t.x+n.z*t.w,o=n.w*t.w-n.x*t.x-n.y*t.y-n.z*t.z;return Object.assign(e,{x:i,y:s,z:r,w:o})}function a1(n,t){return Kp(n,r1,jp,Zp,t)}function l1(n,t){return Kp(n,Zp,jp,o1,t)}function Kp([n,t,e],i,s,r,o){const a=qh(i,e),l=qp(qh(r,t),a,a);return qp(qh(s,-n),l,o??l)}function pl(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function c1(n){const{x:t,y:e,z:i}=fl(n);if(Math.abs(t)<=1e-14&&Math.abs(e)<=1e-14){const d=Math.abs(i)<=1e-14?1:Math.sign(i);return[0,1,0,0,-d,0,0,0,0,0,d,0,t,e,i,1]}const s=Math.hypot(t,e),r=-e/s,o=t/s,a=i*(6378137/6356752314245179e-9)**2,l=Math.hypot(s,a),c=t/l,h=e/l,u=a/l;return[r,o,0,0,-u*o,u*r,s/l,0,c,h,u,0,t,e,i,1]}function Kh(n,t=pl()){const{position:e,rotation:i,initialRotationMode:s="YForwardZUp",scale:r}=n,o=e?c1(e):pl();let a=[1,0,0,0,1,0,0,0,1];if(i){const l=s==="YForwardZUp"?a1:l1,{x:c,y:h,z:u,w:d}=l(i);a=[d*d+c*c-h*h-u*u,2*(c*h+d*u),2*(c*u-d*h),2*(c*h-d*u),d*d-c*c+h*h-u*u,2*(h*u+d*c),2*(c*u+d*h),2*(h*u-d*c),d*d-c*c-h*h+u*u]}for(let l=0;l<3;l++)for(let c=0;c<4;c++)t[l*4+c]=(o[c]*a[l*3]+o[c+4]*a[l*3+1]+o[c+8]*a[l*3+2])*((r==null?void 0:r[l])??1);for(let l=12;l<16;l++)t[l]=o[l];return t}function Jp(n,t=pl()){const e=pl();for(let s=0;s<4;s++)for(let r=0;r<4;r++){const o=[];for(let v=0;v<4;v++)if(v!==r)for(let y=0;y<4;y++)y!==s&&o.push(n[v*4+y]);const[a,l,c,h,u,d,g,p,m]=o,_=(r+s)%2?-1:1;e[s*4+r]=_*(a*(u*m-d*p)-l*(h*m-d*g)+c*(h*p-u*g))}const i=n[0]*e[0]+n[4]*e[1]+n[8]*e[2]+n[12]*e[3];if(Math.abs(i)<1e-21){if(![0,1,2,4,5,6,8,9,10].every(o=>Math.abs(n[o])<=1e-7)||n[3]!==0||n[7]!==0||n[11]!==0||n[15]!==1)throw new Error("Model matrix is singular");const r=n.slice(12,15);t.fill(0),r.forEach((o,a)=>{t[12+a]=-o}),t[15]=1}else for(let s=0;s<16;s++)t[s]=e[s]/i;return t}function Qp(n,t,e,i,s){for(let r=0;r<3;r++)s[r]=n[r]*t+n[r+4]*e+n[r+8]*i+n[r+12];return s}function tm(n,t,e=[0,0,0]){const{x:i,y:s,z:r}=fl(t);return Qp(n,i,s,r,e)}function em(n,t,e=[0,0,0]){const[i,s,r]=Qp(n,...t,[0,0,0]),o=Vp({x:i,y:s,z:r},e);if(!o)throw new Error("Earth center has no geodetic position");return o}function h1(n,t){const{originPosition:e,originRotation:i,originScale:s,initialRotationMode:r}=n,o=Kh({position:e,rotation:i,scale:s,initialRotationMode:r}),a=Jp(o);return[t.map(c=>tm(a,c)),o,a]}function u1(n,t){const{originPosition:e,originRotation:i,originScale:s,initialRotationMode:r}=n,o=Kh({position:e,rotation:i,scale:s,initialRotationMode:r});return[t.map(l=>em(o,l)),o]}function Jh(n,t){return[(n[0]+t[0])/2,(n[1]+t[1])/2,(n[2]+t[2])/2]}class im extends f.Destroyable{constructor(e,i,s,r){super();E(this,"_pixelsToMetersAt",(e,i,s,r)=>{const o=dt([i,s]),a=e.getPixelFromCoordinate(o);if(!a)return;const l=[a[0]+r,a[1]],c=e.getCoordinateFromPixel(l);if(!c)return;const[h,u]=ae(c);return Math.abs(f.geoRhumbDistance([i,s,0],[h,u,0]))});const o=e.viewer;if(!o){console.warn("OlCurrentScale: map is undefined");return}const[a,,l]=f.getReactFuncs(i),[,c]=f.getReactFuncs(s),h=()=>{const d=a();if(!d)return;const[g,p]=d,m=this._pixelsToMetersAt(o,g,p,r);m!==void 0&&isFinite(m)&&c([m,m,m])};h(),this.dispose(l.disposableOn(h));const u=()=>h();o.on("postrender",u),this.dispose(()=>o.un("postrender",u))}}function nm(n){const t=f.min(f.objsIterator(n,["0"])),e=f.min(f.objsIterator(n,["1"])),i=f.max(f.objsIterator(n,["0"])),s=f.max(f.objsIterator(n,["1"]));return{minPos:[t,e],maxPos:[i,s]}}function d1(n){const t=n.map(r=>dt(r)),{minPos:e,maxPos:i}=nm(t),s=[.5*(e[0]+i[0]),.5*(e[1]+i[1])];return ae(s)}function f1(n,t,e){const i=dt(e),s=dt(t),r=[s[0]-i[0],s[1]-i[1]];return n.map(l=>dt(l)).map(l=>[l[0]+r[0],l[1]+r[1]]).map(l=>ae(l))}function g1(n,t){var e,i;if(n){try{const s=ln(n);s&&typeof s.destroy=="function"&&s.destroy(),vl(n,void 0)}catch(s){console.warn("[destroyOlMapHard] extensions cleanup error:",s)}try{n.getOverlays().clear()}catch{}try{n.getLayers().forEach(s=>{const r=s&&typeof s.getSource=="function"?s.getSource():void 0;if(r&&typeof r.clear=="function")try{r.clear()}catch{}if(r&&r.tileCache&&typeof r.tileCache.clear=="function")try{r.tileCache.clear()}catch{}if(typeof s.dispose=="function")try{s.dispose()}catch{}}),n.getLayers().clear()}catch{}try{n.getInteractions().clear()}catch{}try{n.getControls().clear()}catch{}try{const s=(e=n.getViewport)==null?void 0:e.call(n);s&&s.querySelectorAll("canvas").forEach(o=>{const a=o.getContext&&o.getContext("webgl2")||o.getContext&&o.getContext("webgl")||o.getContext&&o.getContext("experimental-webgl");if(a){const l=a.getExtension&&a.getExtension("WEBGL_lose_context");l&&typeof l.loseContext=="function"&&l.loseContext()}try{o.width=1,o.height=1}catch{}})}catch(s){console.warn("[destroyOlMapHard] webgl lose context skipped:",s)}try{n.setTarget(void 0)}catch{}try{(i=n.dispose)==null||i.call(n)}catch{}try{t(void 0)}catch{}}}class p1 extends f.Destroyable{constructor(t,e,i){super();let s;this.d(()=>{t&&s&&t.removeChild(s)});const r=()=>{e.setStatus("Raw"),e.setStatusLog("");const a=e.viewer;if(a){const l=ln(a);l&&(l.destroy(),vl(a,void 0)),g1(a,i)}};this.d(r);const o=this.dv(f.createProcessingFromAsyncFunc(async(a,l)=>{e.setStatus("Creating"),e.setStatusLog("正在创建OpenLayers视口..."),s=document.createElement("div"),s.style.cssText="height: 100%",s.addEventListener("contextmenu",v=>v.preventDefault()),this.d(()=>{s==null||s.removeEventListener("contextmenu",v=>v.preventDefault())}),l.appendChild(s);const h=mt("EPSG:3857").getExtent(),u=ut(h)/256,d=new Array(19),g=new Array(19);for(let v=0;v<19;++v)d[v]=u/Math.pow(2,v),g[v]=v.toString();const p=new bp({target:s,view:new Oi({center:[0,0],zoom:0,enableRotation:!0}),interactions:xp({doubleClickZoom:!1}),controls:pp({zoom:!1,rotate:!1,attribution:!1})});await a.promise(f.sleep(1e3)),p.updateSize(),p.renderSync();const m=new ResizeObserver(()=>{p.updateSize(),p.renderSync()});m.observe(s),this.d(()=>m.disconnect());const _=new pm(p,e);vl(p,_),i(p),this.d(()=>i(void 0)),e.setStatus("Created"),e.setStatusLog("成功创建OpenLayers视口!")}));o.start(t),o.errorEvent.don(a=>{console.error(a),e.setStatus("Error"),e.setStatusLog("创建 OpenLayers 视口失败")})}}class m1 extends f.Destroyable{constructor(t){super();const e=()=>{};this.dispose(t.viewDistanceChanged.disposableOn(e)),this.dispose(t.visibleAlphaChanged.disposableOn(e))}}class y1 extends f.Destroyable{constructor(e){super();E(this,"_debugObjResetting");this._control=e,this._debugObjResetting=this.disposeVar(new f.ObjResettingWithEvent(this._control.debugChanged,()=>{if(this._control.debug)return new m1(this._control)}))}get debugObjResetting(){return this._debugObjResetting}}class sm extends f.Destroyable{constructor(e,i,s,r){super();E(this,"_visibleAlpha",this.disposeVar(f.react(1)));E(this,"_viewDistance",this.disposeVar(f.react(0)));E(this,"_debug",this.disposeVar(f.react(!1)));E(this,"_viewDistanceDebug",this.disposeVar(new y1(this)));this._olViewer=e,this._positionReact=s;const[o,,a]=f.getReactFuncs(i),[l,,c]=f.getReactFuncs(this._positionReact),[h,,u]=r?f.getReactFuncs(r):[void 0,void 0,void 0],d=()=>{var _;let p=1,m=Number.NEGATIVE_INFINITY;do{const v=o(),y=l(),w=h?h():0;if(!v||!y)break;const x=(_=this._olViewer.viewer)==null?void 0:_.getView().getCenter();if(console.log(x),!x)break;m=df({getCoordinates:()=>[x,y],getType:()=>"LineString"})-(w??0);const[P,b,R,I]=v;if(P>b||b>R||R>I){console.error("viewDistanceRange 参数错误: n0 <= n1 <= f1 <= f0");break}m>=b&&m<=R?p=1:m<=P||m>=I?p=0:m>P&&m<b?p=(m-P)/(b-P):m>R&&m<I?p=(I-m)/(I-R):p=1}while(!1);this._viewDistance.value=m,this._visibleAlpha.value=p},g=this.disposeVar(f.createNextAnimateFrameEvent(...[this._olViewer.cameraChanged,a,c,u].filter(Boolean)));this.dispose(g.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 rm extends f.Destroyable{constructor(e,i){super();E(this,"_map");E(this,"_view");E(this,"_keys",[]);E(this,"_changed",new f.Event);E(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,...i},this._attach(),this.dispose(()=>this._detach()),this._opts.emitImmediately&&this._changed.emit()}get changed(){return this._changed}_on(e,i,s){const r=e.on(i,s);this._keys.push(r)}_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(Si),this._keys.length=0}}function Qh(n,t){return n.left===t.left&&n.top===t.top&&n.right===t.right&&n.bottom===t.bottom&&n.depth===t.depth}class tu extends f.Destroyable{constructor(e,i=!0,s){super();E(this,"_coordinate");E(this,"_winPos",{left:NaN,top:NaN,right:NaN,bottom:NaN,depth:NaN});E(this,"_winPosValid",!1);E(this,"_changedEvent",new f.Event);E(this,"_enabled",!0);E(this,"tooltipElement");this.viewer=e,s=s||this.disposeVar(new rm(this.viewer,{usePropertyChange:!0,listenSizeChange:!0,usePostRender:!1,emitImmediately:!0})),this.dispose(s.changed.disposableOn(()=>this._updateWinPos())),this.dispose(()=>{this._changedEvent.empty||console.warn("WinPosFromCartesian需要销毁,但是changed事件仍有监听,代码未必有错,但是说明代码不严谨。")}),this._enabled=i,this._updateWinPos()}set enabled(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 i=this.viewer.getView().getProjection(),r=Math.abs(e[0])<=180&&Math.abs(e[1])<=90?Mi(e,"EPSG:4326",i):e;this._coordinate=[r[0],r[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),i=this.viewer.getSize(),s=!!e&&Array.isArray(e)&&isFinite(e[0])&&isFinite(e[1])&&!!i&&e[0]>=0&&e[1]>=0&&e[0]<i[0]&&e[1]<i[1];let r=!1;if(s!==this._winPosValid&&(this._winPosValid=s,r=!0),s){const o={left:e[0],top:e[1],right:e[0],bottom:e[1],depth:0};Qh(this._winPos,o)||(this._winPos=o,r=!0)}else{const o={left:NaN,top:NaN,right:NaN,bottom:NaN,depth:NaN};Qh(this._winPos,o)||(this._winPos=o,r=!0)}r&&(this._changedEvent.emit(this._winPosValid,this._winPos),this._syncTooltip())}_emitInvalidIfNeeded(){let e=!1;this._winPosValid&&(this._winPosValid=!1,e=!0);const i={left:NaN,top:NaN,right:NaN,bottom:NaN,depth:NaN};Qh(this._winPos,i)||(this._winPos=i,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 _1 extends f.Destroyable{constructor(e,i){super();E(this,"_show",this.disposeVar(f.react(!0)));E(this,"_winPosFromCartesian");E(this,"_near",this.disposeVar(f.react(0)));E(this,"_far",this.disposeVar(f.react(Number.POSITIVE_INFINITY)));E(this,"_actualShow",this.disposeVar(f.react(!1)));this._olPoisContext=e;const{viewer:s,cameraChanged:r}=this._olPoisContext;this._winPosFromCartesian=i||this.disposeVar(new tu(s,!0,r));let o=0,a=Number.POSITIVE_INFINITY;this.dispose(this._near.changed.disposableOn(c=>o=c*c)),this.dispose(this._far.changed.disposableOn(c=>a=c*c));const l=this.disposeVar(f.createNextMicroTaskEvent(this._near.changed,this._far.changed,this._show.changed,this._winPosFromCartesian.changed,r.changed));this.dispose(l.disposableOn(()=>{if(!this.show){this._actualShow.value=!1;return}const c=this._winPosFromCartesian.winPosValid,u=this._olPoisContext.viewer.getView().getCenter(),d=this._winPosFromCartesian.coordinate;if(!u||!d){this._actualShow.value=!1;return}const g=d[0]-u[0],p=d[1]-u[1],m=g*g+p*p,_=m>=o&&m<=a;this._actualShow.value=_&&c}))}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 eu extends _1{constructor(e,i,s){super(i,s);E(this,"_canvasPoi");E(this,"_zOrderChanged");E(this,"_zOrder");E(this,"depth",0);const{canvasPrimitivesContext:r}=this._olPoisContext;this._canvasPoi=this.disposeVar(new e(r));const o=()=>{if(this.actualShow&&this.tracker.winPosValid){const{left:a,top:l,depth:c}=this.tracker.winPos;this._canvasPoi.winPos=[a,l],this.depth=c,this._canvasPoi.depth=this._zOrder??c,this._canvasPoi.show=!0}else this._canvasPoi.show=!1};this.d(this.zOrderChanged.don(()=>{o()})),this.dispose(this.tracker.changed.disposableOn(()=>{o()})),this.dispose(this.actualShowChanged.disposableOn(()=>{o()}))}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 an extends f.Destroyable{constructor(e,i){super();E(this,"_pickedEvent",this.disposeVar(new f.Event));E(this,"_flyToEvent",this.disposeVar(new f.Event));E(this,"_clickEvent",this.disposeVar(new f.Event));E(this,"_clickOutEvent",this.disposeVar(new f.Event));E(this,"_dblclickEvent",this.disposeVar(new f.Event));E(this,"_dblclickOutEvent",this.disposeVar(new f.Event));E(this,"_canvasPoiClassAndCreateFunc",f.react(void 0));E(this,"_olViewDistanceRangeControl");E(this,"_canvasObj");E(this,"_id",this.disposeVar(f.react(f.createGuid())));i&&(this.id=i),this._olViewDistanceRangeControl=this.disposeVar(new sm(e,[this,"viewDistanceRange"],[this,"position"])),this.dispose(f.track([this._olViewDistanceRangeControl,"debug"],[this,"viewDistanceDebug"]));const s=e.viewer;if(!s)return;const r=ln(s);if(!r)return;const{poiContext:o,labelManager:a}=r;a.add(this),this.d(()=>{a.delete(this)}),o&&(this._canvasObj=this.disposeVar(new f.ObjResettingWithEvent(this.canvasPoiClassAndCreateFuncChanged,()=>{if(!this.canvasPoiClassAndCreateFunc)return;const[l,c]=this.canvasPoiClassAndCreateFunc;return new v1(this,l,o,s,c)})))}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}}E(an,"defaults",{viewDistanceRange:[1e3,1e4,3e4,6e4]}),(n=>{n.createDefaultProps=()=>({show:!0,enabled:!0,position:f.reactArrayWithUndefined(void 0),positionEditing:!1,viewDistanceRange:f.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,zOrder:0})})(an||(an={})),f.extendClassProps(an.prototype,an.createDefaultProps);class v1 extends f.Destroyable{constructor(e,i,s,r,o){super();E(this,"olCanvasPoi");const a=this.olCanvasPoi=this.disposeVar(new eu(i,s));this.disposeVar(o(a.canvasPoi,e.visibleAlphaChanged));const l=()=>{if(e.position){const u=dt([e.position[0],e.position[1]]);a.coordinate=u}};l(),this.dispose(e.positionChanged.disposableOn(l));const c=()=>{a.show=(e.show??!0)&&!!e.position&&e.visibleAlpha>0};c();const h=this.disposeVar(f.createNextAnimateFrameEvent(e.showChanged,e.positionChanged,e.visibleAlphaChanged));this.dispose(h.disposableOn(c)),this.dispose(e.flyToEvent.disposableOn(()=>{console.warn("flyTo not implemented in OpenLayers")}))}}class w1 extends f.Destroyable{constructor(t,e){super();const i=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(i.disposableOn(s));const r=this.disposeVar(f.ESSceneObject.context.createEnvStrReact([t,"imageUri"],"${earthsdk3-assets-script-dir}/assets/img/location.png")),o=this.disposeVar(f.createProcessingFromAsyncFunc(async(c,h)=>{const u=await c.promise(f.fetchImage(h));e.image=u})),a=()=>{if(!r.value)return;const c=r.value.trim();c!==""&&o.restart(void 0,c)};a(),this.dispose(r.changed.disposableOn(a));const l=this.disposeVar(new f.Event);this.dispose(e.clickEvent.disposableOn((c,h,u,d,g)=>{(t.enabled??!0)&&l.emit(g)})),this.dispose(l.don(c=>{t.clickEvent.emit(c)})),this.dispose(e.clickOutEvent.disposableOn((c,h,u,d,g)=>{(t.enabled??!0)&&t.clickOutEvent.emit(g)})),this.dispose(e.dbclickEvent.disposableOn((c,h,u,d,g)=>{(t.enabled??!0)&&t.dbclickEvent.emit(g)})),this.dispose(e.dbclickOutEvent.disposableOn((c,h,u,d,g)=>{(t.enabled??!0)&&t.dbclickOutEvent.emit(g)})),this.dispose(f.bind([t,"hovered"],[e,"hovered"])),this.ad(f.bind([e,"isHoverZoom"],[t,"isHoverZoom"]))}}function x1(n,t){const e=n.trim();if(e){try{const i=Function('"use strict";return ('+e+")")();if(typeof i=="function")return i}catch(i){console.info(`firstTryFunc get error! ${i}`)}try{const i=`function (${(t??[]).join(", ")}) {
|
|
27
|
+
${e};
|
|
28
|
+
}`,s=Function('"use strict";return ('+i+")")();return typeof s=="function"?s:void 0}catch(i){console.error(`optionStr get error! ${i}`);return}}}function ml(n,t=48){return`
|
|
72
29
|
<div style="
|
|
73
30
|
background: rgba(0, 0, 0, 0.6);
|
|
74
31
|
color: white;
|
|
@@ -78,7 +35,7 @@ ${t};
|
|
|
78
35
|
white-space: nowrap;
|
|
79
36
|
pointer-events: none;
|
|
80
37
|
">
|
|
81
|
-
${
|
|
38
|
+
${n.split(`
|
|
82
39
|
`).map(s=>`
|
|
83
40
|
<div style="height: 24px; line-height: 24px">
|
|
84
41
|
${s}
|
|
@@ -86,13 +43,13 @@ ${t};
|
|
|
86
43
|
`).join(" ")}
|
|
87
44
|
</div>
|
|
88
45
|
<div style="
|
|
89
|
-
height: ${
|
|
46
|
+
height: ${t}px;
|
|
90
47
|
width: 2px;
|
|
91
48
|
background: rgba(0, 0, 0, 0.6);
|
|
92
49
|
margin: auto;
|
|
93
50
|
">
|
|
94
51
|
</div>
|
|
95
|
-
`}function e1(i){return Math.abs(i)<1e3?`${i.toFixed(2)} m`:`${(i/1e3).toFixed(2)} km`}function Ph(i,e=!1){const t=i<0?"-":"",n=Math.abs(i),s=n|0,o=(n-s)*60;if(e)return`${t}${s}°${o.toFixed(3)}′`;const r=o|0,l=((o-r)*60).toFixed(3);return`${t}${s}°${r}′${l}″`}function Zf(i,e){if(i)return Object.prototype.hasOwnProperty.call(i,e)?i[e]!=null?Object.assign({},i[e]):void 0:Zf(i.childPickedInfo,e)}function Kf(i,e){const[t]=p.getReactFuncs(e);return p.bind(i,e,n=>{const[s,o,r]=n??[0,0,0];return[s+90,o,r]},n=>{const[s,o,r]=n??[0,0,0];if(!(!t()&&s===-90&&o===0&&r===0))return[Math.abs(s-90)<1e-9?0:s-90,o,r]})}function XR(i,e){const[t,n,s]=e,o=`${t}-${n}-${s}`;let r=p.getExtProp(i,o);return r||(r=p.imageToCanvas(i),p.setCanvasUniformColor(r,e),p.setExtProp(i,o,r)),r}class YR extends p.CanvasPoi{constructor(t,n,s=[32,32],o=[.5,1,0,0],r="#F00F"){super(t);T(this,"_tooltip","");T(this,"_title","");T(this,"__scale",[1,1]);T(this,"_tooltipAlpha",0);T(this,"_bgColor",[.3,.3,.3,.8]);T(this,"_bgColorHexStr",p.getColorHexStr(this._bgColor));T(this,"_fgColor",[1,1,1,1]);T(this,"_fgColorHexStr",p.getColorHexStr(this._fgColor));T(this,"_tooltipShow",this.disposeVar(p.react(!0)));T(this,"_isHoverZoom",this.disposeVar(p.react(!1)));this._image=n,this._size=s,this._originRatioAndOffset=o,this._defaultColorStr=r;const a=new p.Transition(100),l=new p.Transition(100);this.dispose(()=>{a.destroy(),l.destroy()});const c=()=>{this._clickEvent&&!this._clickEvent.empty&&(this.isHoverZoom&&(this.hovered?(this._scale[0]*=1.5,this._scale[1]*=1.5):(this._scale[0]/=1.5,this._scale[1]/=1.5)),this._tooltipAlpha=a.current)};this.dispose(this.activedChanged.disposableOn(u=>{l.target=u?1:0,this.needRedraw()}));const h=()=>{const u=this.tooltipShow&&this.hovered;a.target=u?1:0,c(),this.needRedraw()};this.dispose(this.hoveredChanged.disposableOn(h)),this.dispose(this.tooltipShowChanged.disposableOn(h)),this.dispose(this.selectedChanged.disposableOn(()=>{this.needRedraw()}))}get tooltipShow(){return this._tooltipShow.value}set tooltipShow(t){this._tooltipShow.value=t}get tooltipShowChanged(){return this._tooltipShow.changed}get isHoverZoom(){return this._isHoverZoom.value}set isHoverZoom(t){this._isHoverZoom.value=t}get isHoverZoomChanged(){return this._isHoverZoom.changed}set size(t){const[n,s]=t,[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(t){const[n,s]=t,[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(t){if(!this._fgColor.every((n,s)=>t[s]===n)){const[n,s,o,r]=t;this._fgColor.splice(0,4,n,s,o,r),this._fgColorHexStr=p.getColorHexStr(this._fgColor),this.needRedraw()}}get fgColor(){return this._fgColor}set bgColor(t){if(!this._bgColor.every((n,s)=>t[s]===n)){const[n,s,o,r]=t;this._bgColor.splice(0,4,n,s,o,r),this._bgColorHexStr=p.getColorHexStr(this._bgColor),this.needRedraw()}}get bgColor(){return this._bgColor}set originRatioAndOffset(t){const[n,s,o,r]=this._originRatioAndOffset,[a,l,c,h]=t;(n!==a||s!==l||o!==c||r!==h)&&(this._originRatioAndOffset.splice(0,4,a,l,c,h),this.needRedraw(),this.needPickRedraw())}get originRatioAndOffset(){return this._originRatioAndOffset}set image(t){this._image!==t&&(this._image=t,this.needRedraw())}get image(){return this._image}set defaultColorStr(t){this._defaultColorStr!==t&&(this._defaultColorStr=t,this.needRedraw())}get defaultColorStr(){return this._defaultColorStr}set tooltip(t){this._tooltip!==t&&(this._tooltip=t,this.needRedraw())}get tooltip(){return this._tooltip}set title(t){this._title!==t&&(this._title=t,this.needRedraw())}get title(){return this._title}draw(t){if(!this._show)return;const[n,s]=this._winPos,o=this._size[0]*this.__scale[0],r=this._size[1]*this.__scale[1],{left:a,top:l,right:c,bottom:h}=p.getDrawRect([n,s],this._size,this.__scale,this._originRatioAndOffset),u=t.globalAlpha;if(t.globalAlpha=this.opacity,this._image){if(this.selected){const d=XR(this._image,[1,0,0]),{left:f,top:g}=p.getDrawRect([n,s],[o+6,r+6],[1,1],this._originRatioAndOffset);t.drawImage(d,f,g,o+6,r+6)}t.drawImage(this._image,a,l,o,r)}else t.fillStyle=this._fgColorHexStr,t.fillRect(a,l,o,r);if(this._title!==""&&p.drawTextBlock(t,n+20,s-16,[0,.5,0,0],this._title,"14px Arial",4,this._fgColorHexStr,this._bgColorHexStr),t.globalAlpha=u,this._hovered&&this._tooltip!==""){const d=t.globalAlpha;t.globalAlpha=this._tooltipAlpha,p.drawTextBlock(t,(a+c)*.5,l-5,[.5,1,0,0],this._tooltip,"12px Arial",4,this._fgColorHexStr,this._bgColorHexStr),t.globalAlpha=d}}drawForPick(t,n){if(!this._show)return;const[s,o]=this._winPos,r=n("default"),a=this._size[0]*this.__scale[0],l=this._size[1]*this.__scale[1],{left:c,top:h}=p.getDrawRect([s,o],this._size,this.__scale,this._originRatioAndOffset);t.fillStyle=r,t.fillRect(c,h,a,l)}}class Si extends p.Destroyable{constructor(t){var r;super();T(this,"_pickedEvent",this.disposeVar(new p.Event));T(this,"_flyToEvent",this.disposeVar(new p.Event));T(this,"_clickEvent",this.disposeVar(new p.Event));T(this,"_clickOutEvent",this.disposeVar(new p.Event));T(this,"_dbclickEvent",this.disposeVar(new p.Event));T(this,"_dbclickOutEvent",this.disposeVar(new p.Event));T(this,"_clickFunc",this.disposeVar(p.react(void 0)));T(this,"_clickFuncInit",(()=>{this.dispose(this.clickEvent.disposableOn(t=>this.clickFunc&&this.clickFunc(t)))})());T(this,"_geoCanvasPoi");if(!((r=t.extensions)==null?void 0:r.poiContext)){console.warn("poiContext is missing!");return}if(this._geoCanvasPoi=this.disposeVar(new es(t)),!t.viewer)return;const{geoCanvasPoi:o}=this;o.canvasPoiClassAndCreateFunc=[YR,a=>new $R(this,a)],this.dispose(p.bind([o,"show"],[this,"show"])),this.dispose(p.bind([o,"enabled"],[this,"enabled"])),this.dispose(p.bind([o,"position"],[this,"position"])),this.dispose(p.bind([o,"positionEditing"],[this,"positionEditing"])),this.dispose(p.track([o,"viewDistanceRange"],[this,"viewDistanceRange"])),this.dispose(p.track([o,"viewDistanceDebug"],[this,"viewDistanceDebug"])),this.dispose(p.track([o,"zOrder"],[this,"zOrder"])),this.dispose(this.flyToEvent.disposableOn(a=>{o.flyTo(a)})),this.dispose(this._clickEvent.disposableOn(a=>{this.pickOnClick&&this.pickedEvent.emit(new p.ESJPickedResult({type:"viewerPicking",pointerEvent:a}))}));{const a=()=>{const l=HR(this.clickFuncStr,["event"]);l&&(this.clickFunc=l)};a(),this.dispose(this.clickFuncStrChanged.disposableOn(a))}}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}get clickEvent(){return this._clickEvent}get clickOutEvent(){return this._clickOutEvent}get dbclickEvent(){return this._dbclickEvent}get dbclickOutEvent(){return this._dbclickOutEvent}get clickFunc(){return this._clickFunc.value}set clickFunc(t){this._clickFunc.value=t}get clickFuncChanged(){return this._clickFunc.changed}get geoCanvasPoi(){return this._geoCanvasPoi}}T(Si,"defaults",{viewDistanceRange:[1e3,1e4,3e4,6e4],scale:[1,1]}),(i=>{i.createDefaultProps=()=>({show:!0,enabled:!0,position:p.reactArrayWithUndefined(void 0),positionEditing:!1,fgColor:p.reactArray([1,1,1,1]),bgColor:p.reactArray([0,0,0,0]),tooltip:"",tooltipShow:!0,title:"",size:p.reactArray([32,32]),scale:p.reactArray([1,1]),originRatioAndOffset:p.reactArray([.5,1,0,0]),hovered:!1,imageUri:p.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/img/location.png"),opacity:1,viewDistanceRange:p.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,pickOnClick:!1,clickFuncStr:"",zOrder:0,isHoverZoom:!1})})(Si||(Si={})),p.extendClassProps(Si.prototype,Si.createDefaultProps);class Qf extends p.Destroyable{constructor(t,n,s,o){super();T(this,"_divPoi");T(this,"_show",!0);T(this,"_winPosFromCoordinate");T(this,"_zOrderChanged");T(this,"_zOrder");T(this,"depth",0);this._olPoisContext=n;const{viewer:r,divContainer:a,cameraChanged:l}=n;this._winPosFromCoordinate=o||this.disposeVar(new Xf(r)),this._winPosFromCoordinate.coordinate=s,this._divPoi=new p.DivPoi(t,a),this.d(()=>this._divPoi.destroy()),this.d(this._winPosFromCoordinate.changed.disposableOn((c,h)=>{const{left:u,top:d,depth:f}=h,{floatDiv:g}=this._divPoi;g.winPos=[u,d],this.depth=Math.round((1-f)*1e11),g.element.style.zIndex=`${this.zOrder??this.depth}`,this._updateShow(c)})),this.d(this.zOrderChanged.don(()=>{const{floatDiv:c}=this._divPoi;c.element.style.zIndex=`${this.zOrder??this.depth}`,this._updateShow(this._winPosFromCoordinate.winPosValid)}))}_updateShow(t){this._divPoi.show=this._show&&t}get divPoi(){return this._divPoi}set coordinate(t){this._winPosFromCoordinate.coordinate=t}get coordinate(){return this._winPosFromCoordinate.coordinate}get winPosFromCoordinate(){return this._winPosFromCoordinate}set show(t){this._show!==t&&(this._show=t,this._updateShow(this._winPosFromCoordinate.winPosValid))}get show(){return this._show}set zOrder(t){this._zOrder!==t&&(this._zOrder=t,this.zOrderChanged.emit())}get zOrder(){return this._zOrder}get zOrderChanged(){return this._zOrderChanged||(this._zOrderChanged=new p.Event),this._zOrderChanged}}class ZR extends p.Destroyable{constructor(t,n,s,o,r){super();T(this,"_olCanvasPoi");T(this,"_olDivPoi");T(this,"_show",!0);T(this,"_winPosFromCoordinate");T(this,"_switchTransition");T(this,"_status","Canvas");T(this,"_statusChanged");this._olPoisContext=s;const{viewer:a}=this._olPoisContext;this._winPosFromCoordinate=r||this.disposeVar(new Xf(a)),this._winPosFromCoordinate.coordinate=o,this._olCanvasPoi=new Yf(t,this._olPoisContext,this._winPosFromCoordinate),this.dispose(()=>this._olCanvasPoi.destroy()),this._olDivPoi=new Qf(n,this._olPoisContext,o,this._winPosFromCoordinate),this.dispose(()=>this._olDivPoi.destroy()),this._switchTransition=new p.Transition(300),this.dispose(this._switchTransition.currentChanged.disposableOn((l,c)=>{this._updateShow(),this._olCanvasPoi.canvasPoi.opacity=1-c,this._olDivPoi.divPoi.floatDiv.opacity=c})),this._updateShow()}_updateShow(){this._olCanvasPoi.show=this._show&&this._switchTransition.current<1,this._olDivPoi.show=this._show&&this._switchTransition.current>0}set show(t){this._show!==t&&(this._show=t,this._updateShow())}get show(){return this._show}set coordinate(t){this._winPosFromCoordinate.coordinate=t}get coordinate(){return this._winPosFromCoordinate.coordinate}get winPosFromCoordinate(){return this._winPosFromCoordinate}set status(t){var n;this._status!==t&&(this._status=t,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 p.Event),this._statusChanged}get olCanvasPoi(){return this._olCanvasPoi}get olDivPoi(){return this._olDivPoi}}class t1 extends p.Destroyable{constructor(t,n=!0){super();T(this,"_divContainer");T(this,"_canvasPrimitivesContext");T(this,"_cameraChanged");T(this,"_clickEvent",this.disposeVar(new p.Event));T(this,"_dbclickEvent",this.disposeVar(new p.Event));T(this,"_downEvent",this.disposeVar(new p.Event));T(this,"_upEvent",this.disposeVar(new p.Event));T(this,"_moveEvent",this.disposeVar(new p.Event));T(this,"_outEvent",this.disposeVar(new p.Event));T(this,"_poiClickedEvent");this._viewer=t,this._useInnerInteraction=n,this._cameraChanged=this.disposeVar(new J_(this._viewer));const s=t.getViewport();this._divContainer=s;const o=document.createElement("div");o.style.position="absolute",o.style.left="0",o.style.top="0",o.style.width="100%",o.style.height="100%",o.style.pointerEvents="none",o.id="xcx",o.style.backgroundColor="rgba(0,0,0,0)",s.appendChild(o),this.dispose(()=>s.removeChild(o));const r=new p.CanvasPrimitivesContext;this._canvasPrimitivesContext=r,o.appendChild(r.element),this.dispose(()=>r.destroy());const a=r.element,l=()=>{const _=a.clientWidth||a.getBoundingClientRect().width||1,E=(a.width||_)/_;return Math.max(1,E)};let c=l();const h=new ResizeObserver(()=>{c=l()});h.observe(a),this.dispose(()=>h.disconnect());const u=_=>{const v=s.getBoundingClientRect();return[_.clientX-v.left,_.clientY-v.top]};let d,f;const g=_=>{d!==_&&(d&&(d.hovered=!1),d=_,d&&(d.hovered=!0))};if(this.dispose(this._moveEvent.disposableOn((_,v,E)=>{const w=r.pick(_*c,v*c,1,1),C=w.length>0?w[0].poi:void 0;g(C)})),this.dispose(this._outEvent.disposableOn((_,v,E)=>{g(void 0)})),this.dispose(this._downEvent.disposableOn((_,v,E)=>{f&&(f.actived=!1);const w=r.pick(_*c,v*c,1,1);if(w.length>0){const C=w[0].poi;C instanceof p.CanvasPrimitive&&(C.actived=!0,f=C)}})),this.dispose(this._upEvent.disposableOn((_,v,E)=>{f&&(f.actived=!1,f=void 0)})),this.dispose(this._clickEvent.disposableOn((_,v,E)=>{var C,P;const w=r.pick(_*c,v*c,1,1);if(w.length>0){(C=this._poiClickedEvent)==null||C.emit(!0);const{poi:R,tag:O}=w[0];for(const I of r.pois)I===R?I.hasClickEvent()&&I.clickEvent.emit(_,v,O,I,E):I.hasClickOutEvent()&&I.clickOutEvent.emit(_,v,"",I,E)}else{(P=this._poiClickedEvent)==null||P.emit(!1);for(const R of r.pois)R.hasClickOutEvent()&&R.clickOutEvent.emit(_,v,"",R,E)}})),this.dispose(this._dbclickEvent.disposableOn((_,v,E)=>{var C,P,R,O,I;const w=r.pick(_*c,v*c,1,1);if(w.length>0){(C=this._poiClickedEvent)==null||C.emit(!0);const{poi:M,tag:z}=w[0];for(const k of r.pois)k===M?(P=k.hasDbclickEvent)!=null&&P.call(k)&&k.dbclickEvent.emit(_,v,z,k,E):(R=k.hasDbclickOutEvent)!=null&&R.call(k)&&k.dbclickOutEvent.emit(_,v,"",k,E)}else{(O=this._poiClickedEvent)==null||O.emit(!1);for(const M of r.pois)(I=M.hasDbclickOutEvent)!=null&&I.call(M)&&M.dbclickOutEvent.emit(_,v,"",M,E)}})),this._useInnerInteraction){const _=this.disposeVar(new p.PointerClick),v=this.disposeVar(new p.PointerHover),E=s,w=this.disposeVar(p.DomElementEvent.create(E,"pointerdown")),C=this.disposeVar(p.DomElementEvent.create(E,"pointermove")),P=this.disposeVar(p.DomElementEvent.create(E,"pointerup")),R=this.disposeVar(p.DomElementEvent.create(E,"pointerout"));this.dispose(w.disposableOn(O=>{_.pointerDown(O),v.pointerDown(O);const[I,M]=u(O);this._downEvent.emit(I,M,O)})),this.dispose(C.disposableOn(O=>{_.pointerMove(O),v.pointerMove(O);const[I,M]=u(O);this._moveEvent.emit(I,M,O)})),this.dispose(P.disposableOn(O=>{_.pointerUp(O),v.pointerUp(O);const[I,M]=u(O);this._upEvent.emit(I,M,O)})),this.dispose(R.disposableOn(O=>{_.pointerOut(O),v.pointerOut(O);const[I,M]=u(O);this._outEvent.emit(I,M,O)})),this.dispose(_.clickEvent.disposableOn(O=>{const[I,M]=u(O);this._clickEvent.emit(I,M,O)})),this.dispose(_.dbclickEvent.disposableOn(O=>{const[I,M]=u(O);this._dbclickEvent.emit(I,M,O)}))}}get useInnerInteraction(){return this._useInnerInteraction}get divContainer(){return this._divContainer}get canvasPrimitivesContext(){return this._canvasPrimitivesContext}get poiClickedEvent(){return this._poiClickedEvent||(this._poiClickedEvent=new p.Event),this._poiClickedEvent}get viewer(){return this._viewer}get cameraChanged(){return this._cameraChanged}pointerClick(...t){this._useInnerInteraction?console.warn("当前使用内置交互(useInnerInteraction=true),请勿手动调用!"):this._clickEvent.emit(...t)}pointerDbclick(...t){this._useInnerInteraction?console.warn("当前使用内置交互(useInnerInteraction=true),请勿手动调用!"):this._dbclickEvent.emit(...t)}pointerDown(...t){this._useInnerInteraction?console.warn("当前使用内置交互(useInnerInteraction=true),请勿手动调用!"):this._downEvent.emit(...t)}pointerUp(...t){this._useInnerInteraction?console.warn("当前使用内置交互(useInnerInteraction=true),请勿手动调用!"):this._upEvent.emit(...t)}pointerMove(...t){this._useInnerInteraction?console.warn("当前使用内置交互(useInnerInteraction=true),请勿手动调用!"):this._moveEvent.emit(...t)}pointerOut(...t){this._useInnerInteraction?console.warn("当前使用内置交互(useInnerInteraction=true),请勿手动调用!"):this._outEvent.emit(...t)}}class Pr extends p.Destroyable{constructor(t){super();T(this,"_flyToEvent",this.disposeVar(new p.Event));T(this,"_commandEvent",this.disposeVar(new p.Event));T(this,"_dbclickEvent",this.disposeVar(new p.Event));const n=this;let s=Number.POSITIVE_INFINITY;this.dispose(this.enabledChanged.disposableOn(w=>{s=w??!1?Date.now():Number.POSITIVE_INFINITY}));const o=this.disposeVar(new p.Transition(100));o.reset(0);const r=this.disposeVar(p.createTimeoutWithStartValues(()=>o.target=0,500)),a=this.disposeVar(p.createTimeoutWithStartValues(()=>o.target=1,500));let l=0,c=null;const h=120,u=w=>{w?(l++,c&&(clearTimeout(c),c=null),r.cancel()):(l=Math.max(0,l-1),c&&clearTimeout(c),c=setTimeout(()=>{l===0&&r.restart(),c=null},h))},d=this.disposeVar(new Si(t));d.originRatioAndOffset=[.5,.5,0,0],this.dispose(p.track([d,"tooltip"],[n,"title"]));{const w=()=>{d.size=this.mainPoiSize??[12,12]};w(),this.dispose(this.mainPoiSizeChanged.disposableOn(w))}{const w=()=>{d.fgColor=this.mainPoiFgColor??[1,1,1,1]};w(),this.dispose(this.mainPoiFgColorChanged.disposableOn(w))}{const w=()=>{d.bgColor=this.mainPoiBgColor??[0,0,0,.6]};w(),this.dispose(this.mainPoiBgColorChanged.disposableOn(w))}const f=this.disposeVar(p.createNextAnimateFrameEvent(n.showChanged,n.positionChanged,n.descriptionChanged,n.titleChanged,n.imageUriChanged)),g=()=>{d.show=n.show??!0,d.imageUri=n.imageUri??p.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/img/point-yellow.png"),d.position=n.position};g(),this.dispose(f.disposableOn(g)),this.dispose(p.bind([d,"position"],[this,"position"])),this.dispose(p.bind([d,"positionEditing"],[this,"positionEditing"])),this.dispose(this._flyToEvent.disposableOn(w=>d.flyTo(w)));const _=[],v=()=>{_.forEach(w=>{w.destroy()}),_.length=0};this.dispose(v);const E=()=>{v();const{commands:w}=n;if(!w)return;const C=w.length,P=50,R=0,O=-(C*P*Math.PI/180)*.5;for(let I=0;I<C;++I){const[M,z,k,q]=w[I],H=O+P*(I+.5)*Math.PI/180,m=Math.sin(H)*R,b=Math.cos(H)*R,S=new Si(t);S.imageUri=q,S.tooltip=z,S.bgColor=[0,0,0,.6],S.fgColor=[1,1,1,1],S.size=[24,24],S.dispose(p.track([S,"position"],[n,"position"])),S.originRatioAndOffset=[.5,.5,-m,b],S.show=!1,S.opacity=0,S.dispose(S.opacityChanged.disposableOn(L=>S.show=(L??1)>0)),S.dispose(o.currentChanged.disposableOn(L=>S.enabled=L>0)),S.dispose(S.clickEvent.disposableOn(L=>n.commandEvent.emit(M,L))),S.dispose(S.hoveredChanged.disposableOn(u)),_.push(S)}};E(),this.dispose(n.commandsChanged.disposableOn(E)),this.dispose(d.hoveredChanged.disposableOn(u)),this.dispose(d.hoveredChanged.disposableOn(w=>w?n.enabled&&a.restart():a.cancel())),this.dispose(o.currentChanged.disposableOn(w=>{const C=_.length,P=50,R=w*35,O=-(C*P*Math.PI/180)*.5;for(let I=0;I<C;++I){const M=O+P*(I+.5)*Math.PI/180,z=Math.sin(M)*R,k=Math.cos(M)*R;_[I].originRatioAndOffset=[.5,.5,-z,k],_[I].opacity=w}})),this.dispose(d.clickEvent.disposableOn(w=>{if(!n.enabled)return;const C=w.__xbsj_listenerTime__;if(!(C!==void 0&&s>C))if(w.button===0)if(n.clickCommandName)n.commandEvent.emit(n.clickCommandName,w);else{if(o.current>0&&o.current<1)return;o.target=o.target===1?0:1}else w.button===2&&n.rightClickCommandName&&n.commandEvent.emit(n.rightClickCommandName,w)})),this.dispose(d.clickOutEvent.disposableOn(()=>{n.enabled&&(o.target=0)})),this.dispose(n.commandEvent.disposableOn(()=>o.target=0)),this.dispose(d.dbclickEvent.disposableOn(w=>{if(!n.enabled)return;const C=w.__xbsj_listenerTime__;C!==void 0&&s>C||(n.dbclickEvent.emit(w),a.isRunning&&r.cancel(),o.target=0)})),this.dispose(o.targetChanged.disposableOn(w=>{w===1&&l===0?r.restart():r.cancel()})),this.dispose(o.targetChanged.disposableOn(w=>w===1&&a.cancel())),this.dispose(o.targetChanged.disposableOn(w=>d.tooltipShow=w===0))}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}get commandEvent(){return this._commandEvent}get dbclickEvent(){return this._dbclickEvent}}(i=>{i.createDefaultProps=()=>({show:!0,enabled:!0,position:p.reactArrayWithUndefined(void 0),positionEditing:!1,title:"",description:"",imageUri:p.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/img/point-yellow.png"),commands:p.reactDeepArrayWithUndefined(void 0,(e,t)=>e.every((n,s)=>n===t[s]),e=>[...e]),clickCommandName:"",rightClickCommandName:"",mainPoiSize:p.reactArrayWithUndefined(void 0),mainPoiBgColor:p.reactArrayWithUndefined(void 0),mainPoiFgColor:p.reactArrayWithUndefined(void 0)})})(Pr||(Pr={})),p.extendClassProps(Pr.prototype,Pr.createDefaultProps);const Jf=`class OLDiv {
|
|
52
|
+
`}function om(n){return Math.abs(n)<1e3?`${n.toFixed(2)} m`:`${(n/1e3).toFixed(2)} km`}function yl(n,t=!1){const e=n<0?"-":"",i=Math.abs(n),s=i|0,r=(i-s)*60;if(t)return`${e}${s}°${r.toFixed(3)}′`;const o=r|0,l=((r-o)*60).toFixed(3);return`${e}${s}°${o}′${l}″`}function iu(n,t){if(n)return Object.prototype.hasOwnProperty.call(n,t)?n[t]!=null?Object.assign({},n[t]):void 0:iu(n.childPickedInfo,t)}function nu(n,t){const[e]=f.getReactFuncs(t);return f.bind(n,t,i=>{const[s,r,o]=i??[0,0,0];return[s+90,r,o]},i=>{const[s,r,o]=i??[0,0,0];if(!(!e()&&s===-90&&r===0&&o===0))return[Math.abs(s-90)<1e-9?0:s-90,r,o]})}function E1(n,t){const[e,i,s]=t,r=`${e}-${i}-${s}`;let o=f.getExtProp(n,r);return o||(o=f.imageToCanvas(n),f.setCanvasUniformColor(o,t),f.setExtProp(n,r,o)),o}class C1 extends f.CanvasPoi{constructor(e,i,s=[32,32],r=[.5,1,0,0],o="#F00F"){super(e);E(this,"_tooltip","");E(this,"_title","");E(this,"__scale",[1,1]);E(this,"_tooltipAlpha",0);E(this,"_bgColor",[.3,.3,.3,.8]);E(this,"_bgColorHexStr",f.getColorHexStr(this._bgColor));E(this,"_fgColor",[1,1,1,1]);E(this,"_fgColorHexStr",f.getColorHexStr(this._fgColor));E(this,"_tooltipShow",this.disposeVar(f.react(!0)));E(this,"_isHoverZoom",this.disposeVar(f.react(!1)));this._image=i,this._size=s,this._originRatioAndOffset=r,this._defaultColorStr=o;const a=new f.Transition(100),l=new f.Transition(100);this.dispose(()=>{a.destroy(),l.destroy()});const c=()=>{this._clickEvent&&!this._clickEvent.empty&&(this.isHoverZoom&&(this.hovered?(this._scale[0]*=1.5,this._scale[1]*=1.5):(this._scale[0]/=1.5,this._scale[1]/=1.5)),this._tooltipAlpha=a.current)};this.dispose(this.activedChanged.disposableOn(u=>{l.target=u?1:0,this.needRedraw()}));const h=()=>{const u=this.tooltipShow&&this.hovered;a.target=u?1:0,c(),this.needRedraw()};this.dispose(this.hoveredChanged.disposableOn(h)),this.dispose(this.tooltipShowChanged.disposableOn(h)),this.dispose(this.selectedChanged.disposableOn(()=>{this.needRedraw()}))}get tooltipShow(){return this._tooltipShow.value}set tooltipShow(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[i,s]=e,[r,o]=this._size;(r!==i||o!==s)&&(this._size[0]=i,this._size[1]=s,this.needRedraw(),this.needPickRedraw())}get size(){return this._size}set _scale(e){const[i,s]=e,[r,o]=this.__scale;(r!==i||o!==s)&&(this.__scale[0]=i,this.__scale[1]=s,this.needRedraw(),this.needPickRedraw())}get _scale(){return this.__scale}set fgColor(e){if(!this._fgColor.every((i,s)=>e[s]===i)){const[i,s,r,o]=e;this._fgColor.splice(0,4,i,s,r,o),this._fgColorHexStr=f.getColorHexStr(this._fgColor),this.needRedraw()}}get fgColor(){return this._fgColor}set bgColor(e){if(!this._bgColor.every((i,s)=>e[s]===i)){const[i,s,r,o]=e;this._bgColor.splice(0,4,i,s,r,o),this._bgColorHexStr=f.getColorHexStr(this._bgColor),this.needRedraw()}}get bgColor(){return this._bgColor}set originRatioAndOffset(e){const[i,s,r,o]=this._originRatioAndOffset,[a,l,c,h]=e;(i!==a||s!==l||r!==c||o!==h)&&(this._originRatioAndOffset.splice(0,4,a,l,c,h),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[i,s]=this._winPos,r=this._size[0]*this.__scale[0],o=this._size[1]*this.__scale[1],{left:a,top:l,right:c,bottom:h}=f.getDrawRect([i,s],this._size,this.__scale,this._originRatioAndOffset),u=e.globalAlpha;if(e.globalAlpha=this.opacity,this._image){if(this.selected){const d=E1(this._image,[1,0,0]),{left:g,top:p}=f.getDrawRect([i,s],[r+6,o+6],[1,1],this._originRatioAndOffset);e.drawImage(d,g,p,r+6,o+6)}e.drawImage(this._image,a,l,r,o)}else e.fillStyle=this._fgColorHexStr,e.fillRect(a,l,r,o);if(this._title!==""&&f.drawTextBlock(e,i+20,s-16,[0,.5,0,0],this._title,"14px Arial",4,this._fgColorHexStr,this._bgColorHexStr),e.globalAlpha=u,this._hovered&&this._tooltip!==""){const d=e.globalAlpha;e.globalAlpha=this._tooltipAlpha,f.drawTextBlock(e,(a+c)*.5,l-5,[.5,1,0,0],this._tooltip,"12px Arial",4,this._fgColorHexStr,this._bgColorHexStr),e.globalAlpha=d}}drawForPick(e,i){if(!this._show)return;const[s,r]=this._winPos,o=i("default"),a=this._size[0]*this.__scale[0],l=this._size[1]*this.__scale[1],{left:c,top:h}=f.getDrawRect([s,r],this._size,this.__scale,this._originRatioAndOffset);e.fillStyle=o,e.fillRect(c,h,a,l)}}class zi extends f.Destroyable{constructor(e){var o;super();E(this,"_pickedEvent",this.disposeVar(new f.Event));E(this,"_flyToEvent",this.disposeVar(new f.Event));E(this,"_clickEvent",this.disposeVar(new f.Event));E(this,"_clickOutEvent",this.disposeVar(new f.Event));E(this,"_dbclickEvent",this.disposeVar(new f.Event));E(this,"_dbclickOutEvent",this.disposeVar(new f.Event));E(this,"_clickFunc",this.disposeVar(f.react(void 0)));E(this,"_clickFuncInit",(()=>{this.dispose(this.clickEvent.disposableOn(e=>this.clickFunc&&this.clickFunc(e)))})());E(this,"_geoCanvasPoi");if(!((o=e.extensions)==null?void 0:o.poiContext)){console.warn("poiContext is missing!");return}if(this._geoCanvasPoi=this.disposeVar(new an(e)),!e.viewer)return;const{geoCanvasPoi:r}=this;r.canvasPoiClassAndCreateFunc=[C1,a=>new w1(this,a)],this.dispose(f.bind([r,"show"],[this,"show"])),this.dispose(f.bind([r,"enabled"],[this,"enabled"])),this.dispose(f.bind([r,"position"],[this,"position"])),this.dispose(f.bind([r,"positionEditing"],[this,"positionEditing"])),this.dispose(f.track([r,"viewDistanceRange"],[this,"viewDistanceRange"])),this.dispose(f.track([r,"viewDistanceDebug"],[this,"viewDistanceDebug"])),this.dispose(f.track([r,"zOrder"],[this,"zOrder"])),this.dispose(this.flyToEvent.disposableOn(a=>{r.flyTo(a)})),this.dispose(this._clickEvent.disposableOn(a=>{this.pickOnClick&&this.pickedEvent.emit(new f.ESJPickedResult({type:"viewerPicking",pointerEvent:a}))}));{const a=()=>{const l=x1(this.clickFuncStr,["event"]);l&&(this.clickFunc=l)};a(),this.dispose(this.clickFuncStrChanged.disposableOn(a))}}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(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}}E(zi,"defaults",{viewDistanceRange:[1e3,1e4,3e4,6e4],scale:[1,1]}),(n=>{n.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})})(zi||(zi={})),f.extendClassProps(zi.prototype,zi.createDefaultProps);class su extends f.Destroyable{constructor(e,i,s,r){super();E(this,"_divPoi");E(this,"_show",!0);E(this,"_winPosFromCoordinate");E(this,"_zOrderChanged");E(this,"_zOrder");E(this,"depth",0);this._olPoisContext=i;const{viewer:o,divContainer:a,cameraChanged:l}=i;this._winPosFromCoordinate=r||this.disposeVar(new tu(o)),this._winPosFromCoordinate.coordinate=s,this._divPoi=new f.DivPoi(e,a),this.d(()=>this._divPoi.destroy()),this.d(this._winPosFromCoordinate.changed.disposableOn((c,h)=>{const{left:u,top:d,depth:g}=h,{floatDiv:p}=this._divPoi;p.winPos=[u,d],this.depth=Math.round((1-g)*1e11),p.element.style.zIndex=`${this.zOrder??this.depth}`,this._updateShow(c)})),this.d(this.zOrderChanged.don(()=>{const{floatDiv:c}=this._divPoi;c.element.style.zIndex=`${this.zOrder??this.depth}`,this._updateShow(this._winPosFromCoordinate.winPosValid)}))}_updateShow(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 b1 extends f.Destroyable{constructor(e,i,s,r,o){super();E(this,"_olCanvasPoi");E(this,"_olDivPoi");E(this,"_show",!0);E(this,"_winPosFromCoordinate");E(this,"_switchTransition");E(this,"_status","Canvas");E(this,"_statusChanged");this._olPoisContext=s;const{viewer:a}=this._olPoisContext;this._winPosFromCoordinate=o||this.disposeVar(new tu(a)),this._winPosFromCoordinate.coordinate=r,this._olCanvasPoi=new eu(e,this._olPoisContext,this._winPosFromCoordinate),this.dispose(()=>this._olCanvasPoi.destroy()),this._olDivPoi=new su(i,this._olPoisContext,r,this._winPosFromCoordinate),this.dispose(()=>this._olDivPoi.destroy()),this._switchTransition=new f.Transition(300),this.dispose(this._switchTransition.currentChanged.disposableOn((l,c)=>{this._updateShow(),this._olCanvasPoi.canvasPoi.opacity=1-c,this._olDivPoi.divPoi.floatDiv.opacity=c})),this._updateShow()}_updateShow(){this._olCanvasPoi.show=this._show&&this._switchTransition.current<1,this._olDivPoi.show=this._show&&this._switchTransition.current>0}set show(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 i;this._status!==e&&(this._status=e,this._switchTransition.target=this._status==="Canvas"?0:1,(i=this._statusChanged)==null||i.emit(this._status))}get status(){return this._status}get statusChanged(){return this._statusChanged||(this._statusChanged=new f.Event),this._statusChanged}get olCanvasPoi(){return this._olCanvasPoi}get olDivPoi(){return this._olDivPoi}}class am extends f.Destroyable{constructor(e,i=!0){super();E(this,"_divContainer");E(this,"_canvasPrimitivesContext");E(this,"_cameraChanged");E(this,"_clickEvent",this.disposeVar(new f.Event));E(this,"_dbclickEvent",this.disposeVar(new f.Event));E(this,"_downEvent",this.disposeVar(new f.Event));E(this,"_upEvent",this.disposeVar(new f.Event));E(this,"_moveEvent",this.disposeVar(new f.Event));E(this,"_outEvent",this.disposeVar(new f.Event));E(this,"_poiClickedEvent");this._viewer=e,this._useInnerInteraction=i,this._cameraChanged=this.disposeVar(new rm(this._viewer));const s=e.getViewport();this._divContainer=s;const r=document.createElement("div");r.style.position="absolute",r.style.left="0",r.style.top="0",r.style.width="100%",r.style.height="100%",r.style.pointerEvents="none",r.id="xcx",r.style.backgroundColor="rgba(0,0,0,0)",s.appendChild(r),this.dispose(()=>s.removeChild(r));const o=new f.CanvasPrimitivesContext;this._canvasPrimitivesContext=o,r.appendChild(o.element),this.dispose(()=>o.destroy());const a=o.element,l=()=>{const m=a.clientWidth||a.getBoundingClientRect().width||1,v=(a.width||m)/m;return Math.max(1,v)};let c=l();const h=new ResizeObserver(()=>{c=l()});h.observe(a),this.dispose(()=>h.disconnect());const u=m=>{const _=s.getBoundingClientRect();return[m.clientX-_.left,m.clientY-_.top]};let d,g;const p=m=>{d!==m&&(d&&(d.hovered=!1),d=m,d&&(d.hovered=!0))};if(this.dispose(this._moveEvent.disposableOn((m,_,v)=>{const y=o.pick(m*c,_*c,1,1),w=y.length>0?y[0].poi:void 0;p(w)})),this.dispose(this._outEvent.disposableOn((m,_,v)=>{p(void 0)})),this.dispose(this._downEvent.disposableOn((m,_,v)=>{g&&(g.actived=!1);const y=o.pick(m*c,_*c,1,1);if(y.length>0){const w=y[0].poi;w instanceof f.CanvasPrimitive&&(w.actived=!0,g=w)}})),this.dispose(this._upEvent.disposableOn((m,_,v)=>{g&&(g.actived=!1,g=void 0)})),this.dispose(this._clickEvent.disposableOn((m,_,v)=>{var w,x;const y=o.pick(m*c,_*c,1,1);if(y.length>0){(w=this._poiClickedEvent)==null||w.emit(!0);const{poi:C,tag:P}=y[0];for(const b of o.pois)b===C?b.hasClickEvent()&&b.clickEvent.emit(m,_,P,b,v):b.hasClickOutEvent()&&b.clickOutEvent.emit(m,_,"",b,v)}else{(x=this._poiClickedEvent)==null||x.emit(!1);for(const C of o.pois)C.hasClickOutEvent()&&C.clickOutEvent.emit(m,_,"",C,v)}})),this.dispose(this._dbclickEvent.disposableOn((m,_,v)=>{var w,x,C,P,b;const y=o.pick(m*c,_*c,1,1);if(y.length>0){(w=this._poiClickedEvent)==null||w.emit(!0);const{poi:R,tag:I}=y[0];for(const S of o.pois)S===R?(x=S.hasDbclickEvent)!=null&&x.call(S)&&S.dbclickEvent.emit(m,_,I,S,v):(C=S.hasDbclickOutEvent)!=null&&C.call(S)&&S.dbclickOutEvent.emit(m,_,"",S,v)}else{(P=this._poiClickedEvent)==null||P.emit(!1);for(const R of o.pois)(b=R.hasDbclickOutEvent)!=null&&b.call(R)&&R.dbclickOutEvent.emit(m,_,"",R,v)}})),this._useInnerInteraction){const m=this.disposeVar(new f.PointerClick),_=this.disposeVar(new f.PointerHover),v=s,y=this.disposeVar(f.DomElementEvent.create(v,"pointerdown")),w=this.disposeVar(f.DomElementEvent.create(v,"pointermove")),x=this.disposeVar(f.DomElementEvent.create(v,"pointerup")),C=this.disposeVar(f.DomElementEvent.create(v,"pointerout"));this.dispose(y.disposableOn(P=>{m.pointerDown(P),_.pointerDown(P);const[b,R]=u(P);this._downEvent.emit(b,R,P)})),this.dispose(w.disposableOn(P=>{m.pointerMove(P),_.pointerMove(P);const[b,R]=u(P);this._moveEvent.emit(b,R,P)})),this.dispose(x.disposableOn(P=>{m.pointerUp(P),_.pointerUp(P);const[b,R]=u(P);this._upEvent.emit(b,R,P)})),this.dispose(C.disposableOn(P=>{m.pointerOut(P),_.pointerOut(P);const[b,R]=u(P);this._outEvent.emit(b,R,P)})),this.dispose(m.clickEvent.disposableOn(P=>{const[b,R]=u(P);this._clickEvent.emit(b,R,P)})),this.dispose(m.dbclickEvent.disposableOn(P=>{const[b,R]=u(P);this._dbclickEvent.emit(b,R,P)}))}}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 rr extends f.Destroyable{constructor(e){super();E(this,"_flyToEvent",this.disposeVar(new f.Event));E(this,"_commandEvent",this.disposeVar(new f.Event));E(this,"_dbclickEvent",this.disposeVar(new f.Event));const i=this;let s=Number.POSITIVE_INFINITY;this.dispose(this.enabledChanged.disposableOn(y=>{s=y??!1?Date.now():Number.POSITIVE_INFINITY}));const r=this.disposeVar(new f.Transition(100));r.reset(0);const o=this.disposeVar(f.createTimeoutWithStartValues(()=>r.target=0,500)),a=this.disposeVar(f.createTimeoutWithStartValues(()=>r.target=1,500));let l=0,c=null;const h=120,u=y=>{y?(l++,c&&(clearTimeout(c),c=null),o.cancel()):(l=Math.max(0,l-1),c&&clearTimeout(c),c=setTimeout(()=>{l===0&&o.restart(),c=null},h))},d=this.disposeVar(new zi(e));d.originRatioAndOffset=[.5,.5,0,0],this.dispose(f.track([d,"tooltip"],[i,"title"]));{const y=()=>{d.size=this.mainPoiSize??[12,12]};y(),this.dispose(this.mainPoiSizeChanged.disposableOn(y))}{const y=()=>{d.fgColor=this.mainPoiFgColor??[1,1,1,1]};y(),this.dispose(this.mainPoiFgColorChanged.disposableOn(y))}{const y=()=>{d.bgColor=this.mainPoiBgColor??[0,0,0,.6]};y(),this.dispose(this.mainPoiBgColorChanged.disposableOn(y))}const g=this.disposeVar(f.createNextAnimateFrameEvent(i.showChanged,i.positionChanged,i.descriptionChanged,i.titleChanged,i.imageUriChanged)),p=()=>{d.show=i.show??!0,d.imageUri=i.imageUri??f.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/img/point-yellow.png"),d.position=i.position};p(),this.dispose(g.disposableOn(p)),this.dispose(f.bind([d,"position"],[this,"position"])),this.dispose(f.bind([d,"positionEditing"],[this,"positionEditing"])),this.dispose(this._flyToEvent.disposableOn(y=>d.flyTo(y)));const m=[],_=()=>{m.forEach(y=>{y.destroy()}),m.length=0};this.dispose(_);const v=()=>{_();const{commands:y}=i;if(!y)return;const w=y.length,x=50,C=0,P=-(w*x*Math.PI/180)*.5;for(let b=0;b<w;++b){const[R,I,S,F]=y[b],k=P+x*(b+.5)*Math.PI/180,T=Math.sin(k)*C,L=Math.cos(k)*C,A=new zi(e);A.imageUri=F,A.tooltip=I,A.bgColor=[0,0,0,.6],A.fgColor=[1,1,1,1],A.size=[24,24],A.dispose(f.track([A,"position"],[i,"position"])),A.originRatioAndOffset=[.5,.5,-T,L],A.show=!1,A.opacity=0,A.dispose(A.opacityChanged.disposableOn(U=>A.show=(U??1)>0)),A.dispose(r.currentChanged.disposableOn(U=>A.enabled=U>0)),A.dispose(A.clickEvent.disposableOn(U=>i.commandEvent.emit(R,U))),A.dispose(A.hoveredChanged.disposableOn(u)),m.push(A)}};v(),this.dispose(i.commandsChanged.disposableOn(v)),this.dispose(d.hoveredChanged.disposableOn(u)),this.dispose(d.hoveredChanged.disposableOn(y=>y?i.enabled&&a.restart():a.cancel())),this.dispose(r.currentChanged.disposableOn(y=>{const w=m.length,x=50,C=y*35,P=-(w*x*Math.PI/180)*.5;for(let b=0;b<w;++b){const R=P+x*(b+.5)*Math.PI/180,I=Math.sin(R)*C,S=Math.cos(R)*C;m[b].originRatioAndOffset=[.5,.5,-I,S],m[b].opacity=y}})),this.dispose(d.clickEvent.disposableOn(y=>{if(!i.enabled)return;const w=y.__xbsj_listenerTime__;if(!(w!==void 0&&s>w))if(y.button===0)if(i.clickCommandName)i.commandEvent.emit(i.clickCommandName,y);else{if(r.current>0&&r.current<1)return;r.target=r.target===1?0:1}else y.button===2&&i.rightClickCommandName&&i.commandEvent.emit(i.rightClickCommandName,y)})),this.dispose(d.clickOutEvent.disposableOn(()=>{i.enabled&&(r.target=0)})),this.dispose(i.commandEvent.disposableOn(()=>r.target=0)),this.dispose(d.dbclickEvent.disposableOn(y=>{if(!i.enabled)return;const w=y.__xbsj_listenerTime__;w!==void 0&&s>w||(i.dbclickEvent.emit(y),a.isRunning&&o.cancel(),r.target=0)})),this.dispose(r.targetChanged.disposableOn(y=>{y===1&&l===0?o.restart():o.cancel()})),this.dispose(r.targetChanged.disposableOn(y=>y===1&&a.cancel())),this.dispose(r.targetChanged.disposableOn(y=>d.tooltipShow=y===0))}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}get commandEvent(){return this._commandEvent}get dbclickEvent(){return this._dbclickEvent}}(n=>{n.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((i,s)=>i===e[s]),t=>[...t]),clickCommandName:"",rightClickCommandName:"",mainPoiSize:f.reactArrayWithUndefined(void 0),mainPoiBgColor:f.reactArrayWithUndefined(void 0),mainPoiFgColor:f.reactArrayWithUndefined(void 0)})})(rr||(rr={})),f.extendClassProps(rr.prototype,rr.createDefaultProps);const ru=`class OLDiv {
|
|
96
53
|
// container是Poi的div
|
|
97
54
|
// olCustomDivPoi指向当前的OLGeoCustomDivPoi场景对象
|
|
98
55
|
// viewer指定当前的视口
|
|
@@ -127,19 +84,19 @@ ${t};
|
|
|
127
84
|
destroy() {
|
|
128
85
|
this._container.removeChild(this._div);
|
|
129
86
|
}
|
|
130
|
-
}`,
|
|
87
|
+
}`,lm=`OL版示例代码:
|
|
131
88
|
\`\`\`
|
|
132
|
-
${
|
|
89
|
+
${ru}
|
|
133
90
|
\`\`\`
|
|
134
|
-
`,
|
|
91
|
+
`,cm=`<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);">
|
|
135
92
|
<h3 style="margin:0 0 10px 0;font-size:16px;">Office Label</h3>
|
|
136
93
|
<p style="margin:0;">Professional business information display</p>
|
|
137
94
|
</div>
|
|
138
|
-
`,
|
|
95
|
+
`,P1=`OL版示例代码:
|
|
139
96
|
\`\`\`
|
|
140
|
-
${
|
|
97
|
+
${cm}
|
|
141
98
|
\`\`\`
|
|
142
|
-
`;class
|
|
99
|
+
`;class de extends f.Destroyable{constructor(e,i){super();E(this,"_updateEvent",this.disposeVar(new f.Event));E(this,"_instanceClassReact",this.disposeVar(f.react(void 0)));E(this,"_flyToEvent",this.disposeVar(new f.Event));E(this,"_pickedEvent",this.disposeVar(new f.Event));E(this,"_innerHtmlMounted",this.disposeVar(new f.Event));E(this,"_olDivPoi");E(this,"_objResetting");E(this,"_olViewVisibleDistanceRangeControl");this._olViewVisibleDistanceRangeControl=this.disposeVar(new sm(e,[this,"viewDistanceRange"],[this,"position"])),this.dispose(f.track([this._olViewVisibleDistanceRangeControl,"debug"],[this,"viewDistanceDebug"]));const s=e.viewer;if(!s)return;const r=ln(s);if(!r)return;const{poiContext:o,labelManager:a}=r;a.add(this),this.ad(()=>{a.delete(this)});const l=this.position?[this.position[0],this.position[1]]:[0,0];console.log(l,"OlGeoCustomDivPoi initialCoord");const c=this._olDivPoi=this.disposeVar(new su(f.PosFloatDiv,o,l));{const v=()=>{const{contentDiv:y}=c.divPoi.floatDiv;y.style.all=this.cssAllInitial?"initial":"unset"};v(),this.dispose(this.cssAllInitialChanged.disposableOn(v))}const h=this.disposeVar(f.createNextAnimateFrameEvent(this.instanceClassChanged,this.shadowDomChanged)),u=this.disposeVar(new f.ObjResettingWithEvent(h,()=>{const{instanceClass:v}=this;if(!v)return;let{contentDiv:y}=c.divPoi.floatDiv;return y.firstElementChild&&y.removeChild(y.firstElementChild),this.shadowDom&&(y=y.appendChild(document.createElement("div")).attachShadow({mode:"open"}).appendChild(document.createElement("div"))),new v(y,this,e)}));this._objResetting=u;const{_updateEvent:d}=this;this.dispose(d.disposableOn(v=>{if(u.obj)try{v(u.obj,this,e)}catch(y){console.error(`OLCustomDiv update error! ${y}`)}}));const g=()=>{c.divPoi.floatDiv.opacity=(this.opacity??1)*this.visibleAlpha};g(),this.dispose(this.opacityChanged.disposableOn(g)),this.dispose(this.visibleAlphaChanged.disposableOn(g));const p=()=>{const[v,y,w,x]=this.originRatioAndOffset??[.5,1,0,0];c.divPoi.floatDiv.originRatioX=v,c.divPoi.floatDiv.originRatioY=y,c.divPoi.floatDiv.originOffsetX=w,c.divPoi.floatDiv.originOffsetY=x};p(),this.dispose(this.originRatioAndOffsetChanged.disposableOn(p));const m=()=>{if(this.position){const v=dt([this.position[0],this.position[1]]);c.coordinate=v}c.show=(this.show??!0)&&!!this.position&&this.visibleAlpha>0};m(),this.dispose(this.positionChanged.disposableOn(m)),this.dispose(this.showChanged.disposableOn(m)),this.dispose(this.visibleAlphaChanged.disposableOn(m));{const{contentDiv:v}=c.divPoi.floatDiv;v.addEventListener("mouseenter",y=>{(this.allowPicking??!1)&&this.pickFromDiv(v,{pointerEvent:y})}),v.addEventListener("mouseleave",y=>{(this.allowPicking??!1)&&this.pickFromDiv(v,{pointerEvent:y})}),v.addEventListener("mousedown",y=>{(this.allowPicking??!1)&&this.pickFromDiv(v,{pointerEvent:y})}),v.oncontextmenu=y=>{y.preventDefault()}}this.dispose(this.flyToEvent.disposableOn(v=>{if(!this.position){console.warn("OLGeoPoint当前没有位置信息,无法飞入!");return}let y=1e3;if(this.viewDistanceRange){const[w,x,C,P]=this.viewDistanceRange;w>x||x>C||C>P?console.error("viewDistanceRange存在问题,需要满足逐级增大的条件,否则不生效!"):y=(x+C)*.5}on(e,this.position,y,void 0,v)}));const _=()=>{try{this.instanceClass=this.instanceClassStr&&Function(`"use strict";return (${this.instanceClassStr})`)()}catch{this.instanceClass=void 0}};_(),this.dispose(this.instanceClassStrChanged.disposableOn(_));{const v=()=>{if(this.innerHTML===void 0){this.instanceClassStr=void 0;return}const y=`class OLDiv {
|
|
143
100
|
constructor(container, olCustomDivPoi, viewer) {
|
|
144
101
|
this._container = container;
|
|
145
102
|
this._div = document.createElement('div');
|
|
@@ -152,21 +109,21 @@ ${i1}
|
|
|
152
109
|
destroy() {
|
|
153
110
|
this._container.removeChild(this._div);
|
|
154
111
|
}
|
|
155
|
-
}`;this.instanceClassStr=w};E(),this.dispose(this.innerHTMLChanged.disposableOn(E))}}update(t){this._updateEvent.emit(t)}get instanceClass(){return this._instanceClassReact.value}set instanceClass(t){this._instanceClassReact.value=t}get instanceClassChanged(){return this._instanceClassReact.changed}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}get pickedEvent(){return this._pickedEvent}pickFromDiv(t,n){(this.allowPicking??!1)&&this.pickedEvent.emit(new p.ESJPickedResult({element:t,...n}))}get innerHtmlMounted(){return this._innerHtmlMounted}get olDivPoi(){return this._olDivPoi}set olDivPoi(t){this._olDivPoi=t}get objResetting(){return this._objResetting}get olViewerVisibleDistanceRangeControl(){return this._olViewVisibleDistanceRangeControl}get visibleAlpha(){return this._olViewVisibleDistanceRangeControl.visibleAlpha}get visibleAlphaChanged(){return this._olViewVisibleDistanceRangeControl.visibleAlphaChanged}}T(jt,"defaultOLInstanceClassStr",Jf),T(jt,"olInstanceClassStrReadMe",n1),T(jt,"defaults",{position:[116.39,39.9,0],instanceClassStr:Jf,instanceClassStrReadMe:n1,innerHTML:i1,innerHTMLReadMe:KR,viewDistanceRange:[1e3,1e4,3e4,6e4],zOrder:0}),(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,opacity:1,position:p.reactArrayWithUndefined(void 0),originRatioAndOffset:p.reactArray([.5,1,0,0]),instanceClassStr:void 0,innerHTML:void 0,viewDistanceRange:p.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,shadowDom:!1,cssAllInitial:!1,zOrder:0})})(jt||(jt={})),p.extendClassProps(jt.prototype,jt.createDefaultProps);class QR extends p.Destroyable{constructor(e,t,n){super(),this._container=e}}const Pu=class Pu extends p.Destroyable{constructor(t,n){super();T(this,"_pickedEvent",this.disposeVar(new p.Event));T(this,"_divEvent",this.disposeVar(new p.Event));T(this,"_divCreatedEvent",this.disposeVar(new p.Event));T(this,"_divToDestroyEvent",this.disposeVar(new p.Event));T(this,"_pc",this.disposeVar(new p.PointerClick));T(this,"_flyToEvent",this.disposeVar(new p.Event));T(this,"_customDivPoi");this._customDivPoi=this.disposeVar(new jt(t,n));const s=this,o=this._customDivPoi;this.dispose(this.flyToEvent.disposableOn(r=>{o.flyTo(r)})),this.dispose(p.bind([o,"show"],[this,"show"])),this.dispose(p.bind([o,"position"],[this,"position"])),this.dispose(p.bind([o,"originRatioAndOffset"],[this,"originRatioAndOffset"])),this.dispose(p.bind([o,"opacity"],[this,"opacity"])),this.dispose(p.bind([o,"viewDistanceRange"],[this,"viewDistanceRange"])),this.dispose(p.bind([o,"viewDistanceDebug"],[this,"viewDistanceDebug"])),this.dispose(p.bind([o,"shadowDom"],[this,"shadowDom"])),this.dispose(p.bind([o,"cssAllInitial"],[this,"cssAllInitial"])),this.dispose(p.bind([o,"allowPicking"],[this,"pickOnClick"])),this.d(p.bind([o,"zOrder"],[this,"zOrder"]));{class r extends QR{constructor(l,c,h){super(l,c,h);const u=document.createElement("div");u.style.overflow="hidden",u.style.whiteSpace="nowrap",u.addEventListener("mouseover",()=>{s.divEvent.emit(!0)}),u.addEventListener("mouseout",()=>{s.divEvent.emit(!1)});{{const f=()=>{o.show=s.show??!0,u.style.pointerEvents="all",s.width===void 0?u.style.width="auto":u.style.width=`${s.width}px`,s.height===void 0?u.style.height="auto":u.style.height=`${s.height}px`,s.text!==void 0?u.innerHTML=`${s.text.replace(/\n/g,"<br/>")??"请输入文字"}`:u.innerHTML="请输入文字",u.style.fontSize=`${s.fontSize??14}px`,u.style.fontFamily=`${s.fontFamily??Pu.defaults.fontFamily}`;const _=s.borderRadius??[6,6,6,6];u.style.borderRadius=`${_[0]}px ${_[1]}px ${_[2]}px ${_[3]}px`;const v=s.color??[1,1,1,1];u.style.color=`rgba(${v[0]*255},${v[1]*255},${v[2]*255},${v[3]})`;const E=s.backgroundColor??[0,0,0,.8];u.style.backgroundColor=`rgba(${E[0]*255},${E[1]*255},${E[2]*255},${E[3]})`;const w=s.padding??[5,5,5,5];u.style.padding=`${w[0]}px ${w[1]}px ${w[2]}px ${w[3]}px`,u.style.borderWidth=`${s.borderWidth??0}px`;const C=s.borderColor??[1,1,1,1];u.style.borderColor=`rgba(${C[0]*255},${C[1]*255},${C[2]*255},${C[3]})`,u.style.borderStyle=`${s.borderStyle??"solid"}`,u.style.textAlign=`${s.textAlign??"left"}`,u.style.transform=`scale(${s.scale[0]??1},${s.scale[1]??1}) rotate(${s.rotate??0}deg)`};f();const g=this.disposeVar(p.createNextAnimateFrameEvent(s.showChanged,s.widthChanged,s.heightChanged,s.textChanged,s.fontSizeChanged,s.borderRadiusChanged,s.colorChanged,s.backgroundColorChanged,s.paddingChanged,s.borderWidthChanged,s.borderColorChanged,s.borderStyleChanged,s.fontFamilyChanged,s.textAlignChanged,s.scaleChanged,s.rotateChanged));this.dispose(g.disposableOn(f))}{const f=()=>{s.textEditing?(u.contentEditable="true",u.focus(),document.execCommand("selectAll",!1,null)):(u.contentEditable="false",document.execCommand("unselect",!1,null))};f(),this.dispose(s.textEditingChanged.disposableOn(f))}{const f=()=>{s.textEditingInteraction||(s.positionEditing??!1?u.style.pointerEvents="none":u.style.pointerEvents="all")};f(),this.dispose(s.positionEditingChanged.disposableOn(f))}let d=null;this.dispose(()=>clearInterval(d));{const f=()=>{u.ondblclick=()=>{s.positionEditing&&(s.positionEditing=!1),s.textEditingInteraction&&(s.textEditing=!0)},u.onblur=()=>{s.text=u.innerText,s.textEditingInteraction&&(d&&clearTimeout(d),d=setTimeout(()=>{s.textEditing=!1},100))},u.addEventListener("keydown",function(g){s.textEditingInteraction&&(g.code==="Enter"&&!g.shiftKey&&u.blur(),g.code==="Escape"&&u.blur())})};f(),this.dispose(s.textEditingInteractionChanged.disposableOn(f))}}this._container.appendChild(u),this.dispose(()=>{this._container.removeChild(u)}),s._divCreatedEvent.emit(u),this.dispose(()=>s._divToDestroyEvent.emit(u))}}o.instanceClass=r}this.dispose(o.pickedEvent.don(r=>{(o.allowPicking??!1)&&s.pickedEvent.emit(r)}))}get pickedEvent(){return this._pickedEvent}get divEvent(){return this._divEvent}get divCreatedEvent(){return this._divCreatedEvent}get divToDestroyEvent(){return this._divToDestroyEvent}get pc(){return this._pc}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}get customDivPoi(){return this._customDivPoi}};T(Pu,"defaults",{width:80,height:28,text:"请输入文字",borderStyle:"solid",fontFamily:"",viewDistanceRange:[1e3,1e4,3e4,6e4],scale:[1,1],zOrder:0});let Us=Pu;(i=>{i.createDefaultProps=()=>({show:!0,position:p.reactArrayWithUndefined(void 0),text:void 0,width:void 0,height:void 0,fontFamily:void 0,positionEditing:!1,textEditing:!1,textEditingInteraction:!1,originRatioAndOffset:p.reactArray([.5,1,0,0]),opacity:1,fontSize:14,textAlign:"left",color:p.reactArray([1,1,1,1]),backgroundColor:p.reactArray([0,0,0,.8]),padding:p.reactArray([5,5,5,5]),borderRadius:p.reactArray([6,6,6,6]),borderWidth:0,borderColor:p.reactArray([1,1,1,1]),borderStyle:"solid",viewDistanceRange:p.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,pickOnClick:!1,shadowDom:!1,cssAllInitial:!1,scale:p.reactArray([1,1]),zOrder:0,rotate:0})})(Us||(Us={})),p.extendClassProps(Us.prototype,Us.createDefaultProps);class s1 extends p.Destroyable{constructor(t){super();T(this,"_enabled",this.disposeVar(p.react(!1)));T(this,"_cursorPosition",p.react(void 0));T(this,"quickPickPosition",!0);let n=new p.Destroyable;const s=()=>{n&&(n.destroy(),n=void 0)};this.dispose(s);const o=()=>{var d;if(s(),!this._enabled.value||!t)return;const r=ts(t);if(!r)return;n=new p.Destroyable;const a=n.disposeVar(p.react(void 0)),l=n.disposeVar(p.createNextAnimateFrameEvent(a.changed)),c=(d=t.getTargetElement)==null?void 0:d.call(t);if(!c)return;const h=f=>{const g=p.getDomEventCurrentTargetPos(f);a.value=g};c.addEventListener("mousemove",h),n.dispose(()=>c.removeEventListener("mousemove",h));const u=n.disposeVar(p.createProcessingFromAsyncFunc(async f=>{const g=r.pickingManager;if(!g||!a.value)return;const _=a.value,v=this.quickPickPosition?await f.promise(p.createCancelablePromise(g.quickPickPosition(_))):await f.promise(p.createCancelablePromise(g.pickPosition(_)));this._cursorPosition.value=v}));n.dispose(l.disposableOn(()=>{u.restart()}))};o(),this.dispose(this._enabled.changed.disposableOn(o))}get enabled(){return this._enabled.value}set enabled(t){this._enabled.value=t}get enabledChanged(){return this._enabled.changed}get cursorPosition(){return this._cursorPosition.value}get cursorPositionChanged(){return this._cursorPosition.changed}}class o1 extends p.Destroyable{constructor(t){super();T(this,"_baseLayers",new Set);T(this,"_imageryGroup",new As({zIndex:-9999,visible:!0}));this._map=t,this._map.addLayer(this._imageryGroup),this.d(()=>this._map.removeLayer(this._imageryGroup))}get baseLayers(){return this._baseLayers}get map(){return this._map}add(t){if(this._baseLayers.has(t)){console.warn("imageriesManager add error: has already added!",t);return}this._imageryGroup.getLayers().push(t),this._baseLayers.add(t)}delete(t){if(!this._baseLayers.has(t)){console.warn("imageriesManager delete error: has not added!",t);return}this._imageryGroup.getLayers().remove(t),this._baseLayers.delete(t)}setZindex(t,n){if(!this._baseLayers.has(t)){console.warn("imageriesManager setZindex error: has not added!",t);return}t.setZIndex(n-9999)}}class r1 extends p.Destroyable{constructor(t){super();T(this,"_labelMap",{div:new globalThis.Map,canvas:new globalThis.Map});this._map=t;const n=t.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(t.on("moveend",()=>this._updateZOrder())),this.dispose(()=>gi(s))}add(t){const n=t instanceof jt?"div":"canvas";if(this._labelMap[n].has(t)){console.warn(`Label already exists in ${n} map`,t);return}const s=new p.Destroyable;{const o=s.dv(p.createNextAnimateFrameEvent(t.zOrderChanged,t.positionChanged));s.dispose(o.don(()=>this._updateZOrder()))}this._labelMap[n].set(t,()=>s.destroy()),this._updateZOrder()}delete(t){const n=t instanceof jt?"div":"canvas";if(!this._labelMap[n].has(t)){console.warn(`Label not found in ${n} map`,t);return}const s=this._labelMap[n].get(t);s==null||s(),this._labelMap[n].delete(t),this._updateZOrder()}_updateZOrder(){for(const t in this._labelMap)Object.prototype.hasOwnProperty.call(this._labelMap,t)&&this._updateLabelZOrder(this._labelMap[t],t)}_updateLabelZOrder(t,n){var a;const s={};for(const l of t.keys()){const c=l.zOrder.toString();s[c]||(s[c]=new globalThis.Map);const h=l instanceof jt&&l.olDivPoi?l.olDivPoi.depth:l instanceof es&&l.canvasObj&&((a=l.canvasObj.olCanvasPoi)==null?void 0:a.depth)||0;s[c].set(l,h)}const o=Object.keys(s).sort((l,c)=>n==="div"?Number(c)-Number(l):Number(l)-Number(c));let r=t.size;o.forEach(l=>{new globalThis.Map([...s[l]].sort((h,u)=>u[1]-h[1])).forEach((h,u)=>{var d;u instanceof jt&&u.olDivPoi?u.olDivPoi.zOrder=r:u instanceof es&&((d=u.canvasObj)!=null&&d.olCanvasPoi)&&(u.canvasObj.olCanvasPoi.zOrder=r),r--})})}}function Sh(i){return Array.isArray(i)?Math.min(...i):i}class a1 extends Ld{constructor(e){super(e),this.image=null,this.renderedSourceRevision_=0}getImage(){return this.image?this.image.getImage():null}prepareFrame(e){const t=e.layerStatesArray[e.layerIndex],n=e.pixelRatio,s=e.viewState,o=s.resolution,r=this.getLayer().getSource(),a=e.viewHints;let l=e.extent;if(t.extent!==void 0&&(l=Xn(l,yi(t.extent,s.projection))),!a[ot.ANIMATING]&&!a[ot.INTERACTING]&&!Ui(l))if(r){!this.getLayer().rendered&&this.renderedSourceRevision_!==r.getRevision()&&(this.image=null),this.renderedSourceRevision_=r.getRevision();const c=s.projection,h=r.getImage(l,o,n,c);h&&(this.loadImage(h)?this.image=h:h.getState()===le.EMPTY&&(this.image=null))}else this.image=null;return!!this.image}getData(e){const t=this.frameState;if(!t)return null;const n=this.getLayer(),s=wt(t.pixelToCoordinateTransform,e.slice()),o=n.getExtent();if(o&&!Js(o,s))return null;const r=this.image.getExtent(),a=this.image.getImage(),l=Te(r),c=Math.floor(a.width*((s[0]-r[0])/l));if(c<0||c>=a.width)return null;const h=ft(r),u=Math.floor(a.height*((r[3]-s[1])/h));return u<0||u>=a.height?null:this.getImageData(a,c,u)}renderFrame(e,t){const n=this.image,s=n.getExtent(),o=n.getResolution(),[r,a]=Array.isArray(o)?o:[o,o],l=n.getPixelRatio(),c=e.layerStatesArray[e.layerIndex],h=e.pixelRatio,u=e.viewState,d=u.center,f=u.resolution,g=h*r/(f*l),_=h*a/(f*l);this.prepareContainer(e,t);const v=this.context.canvas.width,E=this.context.canvas.height,w=this.getRenderContext(e);let C=!1,P=!0;if(c.extent){const z=yi(c.extent,u.projection);P=pt(z,e.extent),C=P&&!Ni(z,e.extent),C&&this.clipUnrotated(w,e,z)}const R=n.getImage(),O=Zn(this.tempTransform,v/2,E/2,g,_,0,l*(s[0]-d[0])/r,l*(d[1]-s[3])/a);this.renderedResolution=a*h/l;const I=R.width*O[0],M=R.height*O[3];if(this.getLayer().getSource().getInterpolate()||(w.imageSmoothingEnabled=!1),this.preRender(w,e),P&&I>=.5&&M>=.5){const z=O[4],k=O[5],q=c.opacity;q!==1&&(w.save(),w.globalAlpha=q),w.drawImage(R,0,0,+R.width,+R.height,z,k,I,M),q!==1&&w.restore()}return this.postRender(this.context,e),C&&w.restore(),w.imageSmoothingEnabled=!0,this.container}}class JR extends a1{constructor(e){super(e),this.vectorRenderer_=new k0(e),this.layerImageRatio_=e.getImageRatio(),this.coordinateToVectorPixelTransform_=Qt(),this.renderedPixelToCoordinateTransform_=null}disposeInternal(){this.vectorRenderer_.dispose(),super.disposeInternal()}getFeatures(e){if(!this.vectorRenderer_)return Promise.resolve([]);const t=wt(this.coordinateToVectorPixelTransform_,wt(this.renderedPixelToCoordinateTransform_,e.slice()));return this.vectorRenderer_.getFeatures(t)}handleFontsChanged(){this.vectorRenderer_.handleFontsChanged()}prepareFrame(e){var h;const t=e.pixelRatio,n=e.viewState,s=n.resolution,o=e.viewHints,r=this.vectorRenderer_;let a=e.extent;this.layerImageRatio_!==1&&(a=a.slice(0),Iv(a,this.layerImageRatio_));const l=Te(a)/s,c=ft(a)/s;if(!o[ot.ANIMATING]&&!o[ot.INTERACTING]&&!Ui(a)){r.useContainer(null,null);const u=r.context,d=e.layerStatesArray[e.layerIndex],f=Object.assign({},d,{opacity:1}),g=Object.assign({},e,{extent:a,size:[l,c],viewState:Object.assign({},e.viewState,{rotation:0}),layerStatesArray:[f],layerIndex:0,declutter:null}),_=this.getLayer().getDeclutter();_&&(g.declutter={[_]:new Td(9)});const v=new oy(a,s,t,u.canvas,function(E){r.prepareFrame(g)&&r.replayGroupChanged&&(r.clipping=!1,r.renderFrame(g,null),r.renderDeclutter(g),r.renderDeferred(g),E())});v.addEventListener(_e.CHANGE,()=>{if(v.getState()!==le.LOADED)return;this.image=v;const E=v.getPixelRatio(),w=Sh(v.getResolution())*t/E;this.renderedResolution=w,this.coordinateToVectorPixelTransform_=Zn(this.coordinateToVectorPixelTransform_,l/2,c/2,1/w,-1/w,0,-n.center[0],-n.center[1])}),v.load()}return this.image&&(this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice()),!((h=this.getLayer().getSource())!=null&&h.loading)&&!!this.image}preRender(){}postRender(){}renderDeclutter(){}forEachFeatureAtCoordinate(e,t,n,s,o){return this.vectorRenderer_?this.vectorRenderer_.forEachFeatureAtCoordinate(e,t,n,s,o):super.forEachFeatureAtCoordinate(e,t,n,s,o)}}class eT extends Uc{constructor(e){e=e||{};const t=Object.assign({},e);delete t.imageRatio,super(t),this.imageRatio_=e.imageRatio!==void 0?e.imageRatio:1}getImageRatio(){return this.imageRatio_}createRenderer(){return new JR(this)}}class l1 extends p.Destroyable{constructor(t){super();T(this,"_map");this._map=t.viewer}async pickPosition(t){return new Promise(n=>{try{if(!this._map)return n(void 0);const s=this._map.getCoordinateFromPixel(t),[o,r]=Lt(s);n([o,r,0])}catch(s){return console.error(s),n(void 0)}})}async quickPickPosition(t){return await this.pickPosition(t)}async pick(t,n,s){return new Promise(o=>{try{if(!this._map)return o(void 0);const r=[];this._map.forEachFeatureAtPixel(t,(f,g)=>{console.log("forEachFeatureAtPixel",f,g),r.push([f,g])}),console.log("pickedObjects",r);const a=r.length>0?r[0]:void 0;if(!a)return o(void 0);const l=a[0].getId();if(!l)return o(void 0);let c=p.ESSceneObject.getSceneObjectById(l.toString());if(c&&c.parentID&&(c=p.ESSceneObject.getSceneObjectById(c.parentID)),!c)return o(void 0);console.log("sceneObject:",c);const h=new p.ESJPickedResult(a,c,void 0,void 0,s,t);return c&&Reflect.has(c,"allowPicking")&&Reflect.has(c,"pickedEvent")&&(c.allowPicking??!1)&&c.pickedEvent.emit(h),c&&Reflect.has(c,"allowPicking")&&!(c.allowPicking??!1)?o(new p.ESJPickedResult):o(h)}catch(r){return console.error(r),o(void 0)}})}_layerPickable(t){return!t||t instanceof As?!1:t instanceof zn||t instanceof eT}_resolveSceneObject(t,n){var a,l;let s;const o=(a=t==null?void 0:t.get)==null?void 0:a.call(t,"ESSceneObjectID");if(typeof o=="string"&&(s=o),!s){const c=(l=n==null?void 0:n.get)==null?void 0:l.call(n,"ESSceneObjectID");typeof c=="string"&&(s=c)}let r=s?p.ESSceneObject.getSceneObject(s):void 0;return r&&r.parentID&&(r=p.ESSceneObject.getSceneObject(r.parentID)),r}_buildGeoJsonPickInfo(t,n,s){var h;const o=t.getGeometry(),r=((h=o==null?void 0:o.getType)==null?void 0:h.call(o))??"Point",a=t.getProperties?t.getProperties():{},{geometry:l,...c}=a||{};return r==="Point"?{type:"Point",coordinates:[n,s,0],properties:c}:{type:r,coordinates:void 0,properties:c}}}function ts(i){return p.getExtProp(i,"_viewerExtensions")}function Rh(i,e){p.setExtProp(i,"_viewerExtensions",e)}class c1 extends p.Destroyable{constructor(t,n){super();T(this,"_imageriesManager");T(this,"_labelManager");T(this,"_pickingManager");T(this,"_poiContext");T(this,"_cursorPositionInfo");this._viewer=t,this._olViewer=n,this._imageriesManager=this.dv(new o1(t)),this._labelManager=this.dv(new r1(t)),this._poiContext=this.disposeVar(new t1(this._viewer)),this._cursorPositionInfo=this.dv(new s1(t)),this.ad(n.viewerChanged.don(()=>{this._pickingManager=this.dv(new l1(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 tT extends p.Destroyable{constructor(e,t){super(),this._olViewer=e,this._viewer=t;const n=this._viewer,s=n.getView();{let o=this._olViewer.disabledInputStack===0;const r=()=>{var l;const a=this._olViewer.disabledInputStack===0;a!==o&&(o=a,a?this._olViewer.restoreMapInteraction():(this._olViewer.changeToMap(),(l=s.cancelAnimations)==null||l.call(s),this._olViewer.suspendMapInteraction()))};r(),this.dispose(this._olViewer.disabledInputStackChanged.don(r))}{const o=()=>{this._olViewer.cameraChanged.emit()},r=s.on("change:center",()=>o()),a=s.on("change:resolution",()=>o()),l=s.on("change:rotation",()=>o());this.d(()=>{gi([r,a,l])})}{let o=performance.now(),r=0;const a=()=>{var u;const c=performance.now();r++;const h=c-o;h>1e3&&(((u=this._olViewer._fps)==null?void 0:u.value)!==void 0&&(this._olViewer._fps.value=r*1e3/h|0),o=c,r=0)},l=n.on("postrender",a);this.d(()=>gi(l))}}get olViewer(){return this._olViewer}get viewer(){return this._viewer}}const Br=class Br extends p.ESViewer{constructor(t){super(t);T(this,"_viewer",this.dv(p.react(void 0)));T(this,"orbitController",null);T(this,"_fpsMonitor",null);T(this,"wasdController",null);T(this,"_disabledInputStack",this.disposeVar(p.react(0)));T(this,"_interactionBackup",null);T(this,"_notSupportEditingCount",this.disposeVar(p.react(0)));T(this,"_editingSystem",this.ad(yv()));if(t.type!==Br.type)throw new Error("option.type must be ESOlViewer");this.d(this._viewer.changed.don(n=>{this.viewerChanged.emit(n)})),this.dv(new p.ObjResettingWithEvent(this.viewerChanged,()=>{if(this.viewer)return new tT(this,this.viewer)})),this.dv(new p.ObjResettingWithEvent(this.subContainerChanged,()=>{if(this.setStatus("Raw"),this.setStatusLog(""),!!this.subContainer)return new GR(this.subContainer,this,n=>this._viewer.value=n)}))}get viewer(){return this._viewer.value}get extensions(){return this.viewer&&ts(this.viewer)}get disabledInputStack(){return this._disabledInputStack.value}set disabledInputStack(t){this._disabledInputStack.value=t}get disabledInputStackChanged(){return this._disabledInputStack.changed}incrementDisabledInputStack(){++this._disabledInputStack.value}decrementDisabledInputStack(){--this._disabledInputStack.value}_suspendMapInteraction(){!this.viewer||this._interactionBackup||(this._interactionBackup=this.viewer.getInteractions().getArray().slice(),this.viewer.getInteractions().clear())}_restoreMapInteraction(){!this.viewer||!this._interactionBackup||(this._interactionBackup.forEach(t=>{var n;return(n=this.viewer)==null?void 0:n.getInteractions().push(t)}),this._interactionBackup=null)}restoreMapInteraction(){this._restoreMapInteraction()}suspendMapInteraction(){this._suspendMapInteraction()}_func(t=!1){return console.warn("ESOlViewer 暂未实现该方法!"),Promise.resolve(void 0)}setRotation(t){if(!this.viewer)return;this.viewer.getView().setRotation(t*Math.PI/180)}async pick(t,n,s){if(!this.extensions)return;const{pickingManager:o}=this.extensions;return await o.pick(t,void 0,n)}async pickPosition(t){if(!this.extensions)return;const{pickingManager:n}=this.extensions;return await n.pickPosition(t)}async quickPickPosition(t){if(!this.extensions)return;const{pickingManager:n}=this.extensions;return await n.quickPickPosition(t)}flyIn(t,n,s){if(!this.viewer)return;const o=wo(t[2]);this.viewer.getView().animate({center:Ie([t[0],t[1]]),zoom:o,duration:(s??1)*1e3})}flyTo(t,n){if(!this.viewer)return;const s=wo(t.distance);this.viewer.getView().animate({center:Ie([n[0],n[1]]),zoom:s,duration:(t.flyDuration??1)*1e3})}flyToBoundingSphere(t,n,s){if(!this.viewer)return;const o={_duration:(s??1)*1e3};console.log(t);const r=Ie([t[0],t[1]]),a=Ie([t[2],t[3]]);this.viewer.getView().fit(cd([r[0],r[1],a[0],a[1]]),{duration:o._duration,easing:Ks,padding:[10,10,10,10]})}async getTerrainHeight(t){return console.warn("openlayers不支持获取地形高度!"),0}getCurrentCameraInfo(){if(!this.viewer)return;const t=this.viewer.getView().getZoom();if(!t)return;const n=Na(t),s=this.viewer.getView().getCenter();if(!s)return;const o=Lt(s),r=this.viewer.getView().getRotation();return{position:[o[0],o[1],n],rotation:[0,r/(Math.PI/180),0]}}transformFlyParam(t,n){}calcFlyToParam(t){const n=this.getCurrentCameraInfo();if(!n)return;const{position:s,rotation:o}=n,r=p.geoRhumbDistance(s,t),a=t[0]-s[0],l=t[1]-s[1],h=Math.atan2(a,l)*180/Math.PI,u=t[2]-s[2],f=Math.atan2(u,r)*180/Math.PI,g=h+90;return{distance:r,heading:g,pitch:f,flyDuration:1,hDelta:-(o[0]-g),pDelta:o[1]-f}}getLengthInPixel(){if(this.viewer)return this.viewer.getView().getResolution()}changeToWalk(t){this.viewer&&(this.changeToMap(),this.container&&(this.wasdController=this.dv(new by(this.container,this.viewer,[t[0],t[1]]))))}changeToMap(){var t;this.wasdController&&(this.wasdController.destroy(),this.wasdController=null),this.orbitController&&(this.orbitController.stop(),this.orbitController=null,(t=this.viewer)==null||t.getView().setRotation(0))}changeToRotateGlobe(t,n,s){this.changeToMap(),console.warn("Openlayers引擎暂不支持全球旋转,已切换为Map模式")}changeToLine(t,n,s,o,r,a){this._func()}changeToUserDefined(t){this.changeToMap(),console.warn("Openlayers引擎暂不支持自定义漫游,已切换为Map模式")}changeToRotatePoint(t,n=5e4,s=60,o=90,r=0){if(!this.viewer)return;const a=this.viewer.getView();this.changeToMap();const l={_distance:n,_orbitPeriod:s*1e3,heading:o},c=wo(l._distance);a.setZoom(c),this.orbitController=vy(this.viewer,{center:[t[0],t[1]],orbitPeriod:l._orbitPeriod,heading:l.heading})}changeToFollow(t,n,s,o){this._func()}getFPS(){return this.viewer&&!this._fpsMonitor&&(this._fpsMonitor=this.dv(new Ey(this.viewer))),this._fpsMonitor?this._fpsMonitor.getFPS():0}async getVersion(){const t=globalThis.g_XE3CopyRights??{};return t.openlayers=Fv,t}getHeightByLonLat(t,n,s){return console.warn("getHeightByLonLat is not supported in OpenLayers"),Promise.resolve(0)}getHeightsByLonLats(t,n){return console.warn("getHeightsByLonLats is not supported in OpenLayers"),Promise.resolve([])}async capture(t,n){if(this.viewer)return await wy(this.viewer,t,n)}lonLatAltToScreenPosition(t){var r;const n=[t[0],t[1]],s=Ie(n),o=(r=this.viewer)==null?void 0:r.getPixelFromCoordinate(s);return o?Promise.resolve([o[0],o[1]]):Promise.resolve(void 0)}getBoundSphere(t){return this._func()}get notSupportEditingCount(){return this._notSupportEditingCount.value}set notSupportEditingCount(t){this._notSupportEditingCount.value=t}get notSupportEditingCountChanged(){return this._notSupportEditingCount.changed}startEditing(t,n,s){s=Object.assign({useKeyToSwitch:!0,callSource:"outer"},s);const o=t.components.main??t;o&&n!=null&&(o.editingID=`${s.callSource}_${p.createGuid()}`,this._editingSystem.restart(void 0,this,o,n,s.useKeyToSwitch))}stopEditing(){this._editingSystem.isRunning&&this._editingSystem.cancel()}moveObjects(t){this._func()}getViewExtent(){if(!this.viewer)return console.warn("ESOlViewer: OpenLayers viewer not initialized."),Promise.resolve(void 0);const n=this.viewer.getView().calculateExtent(this.viewer.getSize());if(console.log(n),!n)return Promise.resolve(void 0);const s=Lt([n[0],n[1]]),o=Lt([n[2],n[3]]),r=[s[0],s[1],o[0],o[1]];return console.log(r),Promise.resolve(r)}};T(Br,"type",Br.register("ESOlViewer",Br));let Ri=Br;(i=>{i.createDefaultProps=()=>({...p.ESViewer.createDefaultProps()})})(Ri||(Ri={})),p.extendClassProps(Ri.prototype,Ri.createDefaultProps);class nT extends Ma{constructor(e){e=e||{},super(e)}}class ep extends nT{constructor(e){super(e)}createRenderer(){return new a1(this)}getData(e){return super.getData(e)}}function tp(i){return i instanceof Image||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageBitmap?i:null}const iT=new Error("disposed"),sT=[256,256];class h1 extends Da{constructor(e){const t=se.IDLE;super(e.tileCoord,t,{transition:e.transition,interpolate:e.interpolate}),this.loader_=e.loader,this.data_=null,this.error_=null,this.size_=e.size||null,this.controller_=e.controller||null}getSize(){if(this.size_)return this.size_;const e=tp(this.data_);return e?[e.width,e.height]:sT}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==se.IDLE&&this.state!==se.ERROR)return;this.state=se.LOADING,this.changed();const e=this;this.loader_().then(function(t){e.data_=t,e.state=se.LOADED,e.changed()}).catch(function(t){e.error_=t,e.state=se.ERROR,e.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(iT),this.controller_=null),super.disposeInternal()}}let np;const Sr=[];function u1(i,e,t,n,s){i.beginPath(),i.moveTo(0,0),i.lineTo(e,t),i.lineTo(n,s),i.closePath(),i.save(),i.clip(),i.fillRect(0,0,Math.max(e,n)+1,Math.max(t,s)),i.restore()}function ip(i,e){return Math.abs(i[e*4]-210)>2||Math.abs(i[e*4+3]-.75*255)>2}function oT(){if(np===void 0){const i=ht(6,6,Sr);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",u1(i,4,5,4,0),u1(i,4,5,0,5);const e=i.getImageData(0,0,3,3).data;np=ip(e,0)||ip(e,4)||ip(e,8),la(i),Sr.push(i.canvas)}return np}function Th(i,e,t,n){const s=Ko(t,e,i);let o=Cm(e,n,t);const r=e.getMetersPerUnit();r!==void 0&&(o*=r);const a=i.getMetersPerUnit();a!==void 0&&(o/=a);const l=i.getExtent();if(!l||Js(l,s)){const c=Cm(i,o,s)/o;isFinite(c)&&c>0&&(o/=c)}return o}function rT(i,e,t,n){const s=Tn(t);let o=Th(i,e,s,n);return(!isFinite(o)||o<=0)&&Kg(t,function(r){return o=Th(i,e,r,n),isFinite(o)&&o>0}),o}function d1(i,e,t,n,s,o,r,a,l,c,h,u,d,f){const g=ht(Math.round(t*i),Math.round(t*e),Sr);if(u||(g.imageSmoothingEnabled=!1),l.length===0)return g.canvas;g.scale(t,t);function _(R){return Math.round(R*t)/t}g.globalCompositeOperation="lighter";const v=yn();l.forEach(function(R,O,I){Yg(v,R.extent)});let E;const w=t/n,C=(u?1:1+Math.pow(2,-24))/w;(!d||l.length!==1||c!==0)&&(E=ht(Math.round(Te(v)*w),Math.round(ft(v)*w),Sr),u||(E.imageSmoothingEnabled=!1),l.forEach(function(R,O,I){if(R.image.width>0&&R.image.height>0){if(R.clipExtent){E.save();const H=(R.clipExtent[0]-v[0])*w,m=-(R.clipExtent[3]-v[3])*w,b=Te(R.clipExtent)*w,S=ft(R.clipExtent)*w;E.rect(u?H:Math.round(H),u?m:Math.round(m),u?b:Math.round(H+b)-Math.round(H),u?S:Math.round(m+S)-Math.round(m)),E.clip()}const M=(R.extent[0]-v[0])*w,z=-(R.extent[3]-v[3])*w,k=Te(R.extent)*w,q=ft(R.extent)*w;E.drawImage(R.image,c,c,R.image.width-2*c,R.image.height-2*c,u?M:Math.round(M),u?z:Math.round(z),u?k:Math.round(M+k)-Math.round(M),u?q:Math.round(z+q)-Math.round(z)),R.clipExtent&&E.restore()}}));const P=ln(r);return a.getTriangles().forEach(function(R,O,I){const M=R.source,z=R.target;let k=M[0][0],q=M[0][1],H=M[1][0],m=M[1][1],b=M[2][0],S=M[2][1];const L=_((z[0][0]-P[0])/o),N=_(-(z[0][1]-P[1])/o),j=_((z[1][0]-P[0])/o),U=_(-(z[1][1]-P[1])/o),B=_((z[2][0]-P[0])/o),X=_(-(z[2][1]-P[1])/o),G=k,ae=q;k=0,q=0,H-=G,m-=ae,b-=G,S-=ae;const te=[[H,m,0,0,j-L],[b,S,0,0,B-L],[0,0,H,m,U-N],[0,0,b,S,X-N]],V=Mv(te);if(!V)return;if(g.save(),g.beginPath(),oT()||!u){g.moveTo(j,U);const ie=4,he=L-j,me=N-U;for(let Fe=0;Fe<ie;Fe++)g.lineTo(j+_((Fe+1)*he/ie),U+_(Fe*me/(ie-1))),Fe!=ie-1&&g.lineTo(j+_((Fe+1)*he/ie),U+_((Fe+1)*me/(ie-1)));g.lineTo(B,X)}else g.moveTo(j,U),g.lineTo(L,N),g.lineTo(B,X);g.clip(),g.transform(V[0],V[2],V[1],V[3],L,N),g.translate(v[0]-G,v[3]-ae);let re;if(E)re=E.canvas,g.scale(C,-C);else{const ie=l[0],he=ie.extent;re=ie.image,g.scale(Te(he)/re.width,-ft(he)/re.height)}g.drawImage(re,0,0),g.restore()}),E&&(la(E),Sr.push(E.canvas)),h&&(g.save(),g.globalCompositeOperation="source-over",g.strokeStyle="black",g.lineWidth=1,a.getTriangles().forEach(function(R,O,I){const M=R.target,z=(M[0][0]-P[0])/o,k=-(M[0][1]-P[1])/o,q=(M[1][0]-P[0])/o,H=-(M[1][1]-P[1])/o,m=(M[2][0]-P[0])/o,b=-(M[2][1]-P[1])/o;g.beginPath(),g.moveTo(q,H),g.lineTo(z,k),g.lineTo(m,b),g.closePath(),g.stroke()}),g.restore()),g.canvas}const aT=10,f1=.25;class p1{constructor(e,t,n,s,o,r,a){this.sourceProj_=e,this.targetProj_=t;let l={};const c=a?Bu(C=>wt(a,Ko(C,this.targetProj_,this.sourceProj_))):Gi(this.targetProj_,this.sourceProj_);this.transformInv_=function(C){const P=C[0]+"/"+C[1];return l[P]||(l[P]=c(C)),l[P]},this.maxSourceExtent_=s,this.errorThresholdSquared_=o*o,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&Te(s)>=Te(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Te(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?Te(this.targetProj_.getExtent()):null;const h=ln(n),u=Ql(n),d=Zl(n),f=Yl(n),g=this.transformInv_(h),_=this.transformInv_(u),v=this.transformInv_(d),E=this.transformInv_(f),w=aT+(r?Math.max(0,Math.ceil(Math.log2(Mu(n)/(r*r*256*256)))):0);if(this.addQuad_(h,u,d,f,g,_,v,E,w),this.wrapsXInSource_){let C=1/0;this.triangles_.forEach(function(P,R,O){C=Math.min(C,P.source[0][0],P.source[1][0],P.source[2][0])}),this.triangles_.forEach(P=>{if(Math.max(P.source[0][0],P.source[1][0],P.source[2][0])-C>this.sourceWorldWidth_/2){const R=[[P.source[0][0],P.source[0][1]],[P.source[1][0],P.source[1][1]],[P.source[2][0],P.source[2][1]]];R[0][0]-C>this.sourceWorldWidth_/2&&(R[0][0]-=this.sourceWorldWidth_),R[1][0]-C>this.sourceWorldWidth_/2&&(R[1][0]-=this.sourceWorldWidth_),R[2][0]-C>this.sourceWorldWidth_/2&&(R[2][0]-=this.sourceWorldWidth_);const O=Math.min(R[0][0],R[1][0],R[2][0]);Math.max(R[0][0],R[1][0],R[2][0])-O<this.sourceWorldWidth_/2&&(P.source=R)}})}l={}}addTriangle_(e,t,n,s,o,r){this.triangles_.push({source:[s,o,r],target:[e,t,n]})}addQuad_(e,t,n,s,o,r,a,l,c){const h=$r([o,r,a,l]),u=this.sourceWorldWidth_?Te(h)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,f=this.sourceProj_.canWrapX()&&u>.5&&u<1;let g=!1;if(c>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const v=$r([e,t,n,s]);g=Te(v)/this.targetWorldWidth_>f1||g}!f&&this.sourceProj_.isGlobal()&&u&&(g=u>f1||g)}if(!g&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3])&&!pt(h,this.maxSourceExtent_))return;let _=0;if(!g&&(!isFinite(o[0])||!isFinite(o[1])||!isFinite(r[0])||!isFinite(r[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(c>0)g=!0;else if(_=(!isFinite(o[0])||!isFinite(o[1])?8:0)+(!isFinite(r[0])||!isFinite(r[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),_!=1&&_!=2&&_!=4&&_!=8)return}if(c>0){if(!g){const v=[(e[0]+n[0])/2,(e[1]+n[1])/2],E=this.transformInv_(v);let w;f?w=(ms(o[0],d)+ms(a[0],d))/2-ms(E[0],d):w=(o[0]+a[0])/2-E[0];const C=(o[1]+a[1])/2-E[1];g=w*w+C*C>this.errorThresholdSquared_}if(g){if(Math.abs(e[0]-n[0])<=Math.abs(e[1]-n[1])){const v=[(t[0]+n[0])/2,(t[1]+n[1])/2],E=this.transformInv_(v),w=[(s[0]+e[0])/2,(s[1]+e[1])/2],C=this.transformInv_(w);this.addQuad_(e,t,v,w,o,r,E,C,c-1),this.addQuad_(w,v,n,s,C,E,a,l,c-1)}else{const v=[(e[0]+t[0])/2,(e[1]+t[1])/2],E=this.transformInv_(v),w=[(n[0]+s[0])/2,(n[1]+s[1])/2],C=this.transformInv_(w);this.addQuad_(e,v,w,s,o,E,C,l,c-1),this.addQuad_(v,t,n,w,E,r,a,C,c-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(_&11)==0&&this.addTriangle_(e,n,s,o,a,l),(_&14)==0&&this.addTriangle_(e,n,t,o,a,r),_&&((_&13)==0&&this.addTriangle_(t,s,e,r,l,o),(_&7)==0&&this.addTriangle_(t,s,n,r,l,a))}calculateSourceExtent(){const e=yn();return this.triangles_.forEach(function(t,n,s){const o=t.source;Hr(e,o[0]),Hr(e,o[1]),Hr(e,o[2])}),e}getTriangles(){return this.triangles_}}const g1=.5;class m1 extends Da{constructor(e,t,n,s,o,r,a,l,c,h,u,d){super(o,se.IDLE,d),this.renderEdges_=u!==void 0?u:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=t,this.targetTileGrid_=s,this.wrappedTileCoord_=r||o,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=e.canWrapX()?e.getExtent():void 0;const f=s.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let _=this.sourceTileGrid_.getExtent();const v=g?Xn(f,g):f;if(Mu(v)===0){this.state=se.EMPTY;return}const E=e.getExtent();E&&(_?_=Xn(_,E):_=E);const w=s.getResolution(this.wrappedTileCoord_[0]),C=rT(e,n,v,w);if(!isFinite(C)||C<=0){this.state=se.EMPTY;return}const P=h!==void 0?h:g1;if(this.triangulation_=new p1(e,n,v,_,C*P,w),this.triangulation_.getTriangles().length===0){this.state=se.EMPTY;return}this.sourceZ_=t.getZForResolution(C);let R=this.triangulation_.calculateSourceExtent();if(_&&(e.canWrapX()?(R[1]=ct(R[1],_[1],_[3]),R[3]=ct(R[3],_[1],_[3])):R=Xn(R,_)),!Mu(R))this.state=se.EMPTY;else{let O=0,I=0;e.canWrapX()&&(O=Te(E),I=Math.floor((R[0]-E[0])/O)),tm(R.slice(),e,!0).forEach(z=>{const k=t.getTileRangeForExtentAndZ(z,this.sourceZ_);for(let q=k.minX;q<=k.maxX;q++)for(let H=k.minY;H<=k.maxY;H++){const m=I*O;this.sourceTiles_.push({getTile:()=>c(this.sourceZ_,q,H,a),offset:m})}++I}),this.sourceTiles_.length===0&&(this.state=se.EMPTY)}}getImage(){return this.canvas_}reproject_(){const e=[];if(this.sourceTiles_.forEach(t=>{var s;const n=t.tile;if(n&&n.getState()==se.LOADED){const o=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);o[0]+=t.offset,o[2]+=t.offset;const r=(s=this.clipExtent_)==null?void 0:s.slice();r&&(r[0]+=t.offset,r[2]+=t.offset),e.push({extent:o,clipExtent:r,image:n.getImage()})}}),this.sourceTiles_.length=0,e.length===0)this.state=se.ERROR;else{const t=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(t),s=typeof n=="number"?n:n[0],o=typeof n=="number"?n:n[1],r=this.targetTileGrid_.getResolution(t),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=d1(s,o,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),r,l,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=se.LOADED}this.changed()}load(){for(const e of this.sourceTiles_)e.tile=e.getTile();if(this.state==se.IDLE){this.state=se.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:t})=>{const n=t.getState();if(n==se.IDLE||n==se.LOADING){e++;const s=Ue(t,_e.CHANGE,o=>{const r=t.getState();(r==se.LOADED||r==se.ERROR||r==se.EMPTY)&&(st(s),e--,e===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(s)}}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:t},n,s){t.getState()==se.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(st),this.sourcesListenerKeys_=null}release(){this.canvas_&&(la(this.canvas_.getContext("2d")),Sr.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}}class y1{constructor(e){this.highWaterMark=e!==void 0?e:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const e=this.pop();e instanceof Yr&&e.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){const n=this.entries_[e];return Ve(n!==void 0,"Tried to get a value for a key that does not exist in the cache"),n===this.newest_||(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n),n.value_}remove(e){const t=this.entries_[e];return Ve(t!==void 0,"Tried to get a value for a key that does not exist in the cache"),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){const e=new Array(this.count_);let t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.key_;return e}getValues(){const e=new Array(this.count_);let t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){var t;return(t=this.entries_[e])==null?void 0:t.value_}pop(){const e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){Ve(!(e in this.entries_),"Tried to set a value for a key that is used already");const n={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[e]=n,++this.count_}setSize(e){this.highWaterMark=e}}function Ih(i,e,t,n){return n!==void 0?(n[0]=i,n[1]=e,n[2]=t,n):[i,e,t]}function lT(i,e,t){return i+"/"+e+"/"+t}function Oh(i,e,t,n,s){return`${Pe(i)},${e},${lT(t,n,s)}`}function _1(i){return cT(i[0],i[1],i[2])}function cT(i,e,t){return(e<<i)+t}function hT(i,e){const t=i[0],n=i[1],s=i[2];if(e.getMinZoom()>t||t>e.getMaxZoom())return!1;const o=e.getFullTileRange(t);return o?o.containsXY(n,s):!0}function sp(i,e,t){if(!(t in i))return i[t]=new Set([e]),!0;const n=i[t],s=n.has(e);return s||n.add(e),!s}function uT(i,e,t){const n=i[t];return n?n.delete(e):!1}function w1(i,e){const t=i.layerStatesArray[i.layerIndex];t.extent&&(e=Xn(e,yi(t.extent,i.viewState.projection)));const n=t.layer.getRenderSource();if(!n.getWrapX()){const s=n.getTileGridForProjection(i.viewState.projection).getExtent();s&&(e=Xn(e,s))}return e}class v1 extends Ld{constructor(e,t){super(e),t=t||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=yn(),this.tempTileRange_=new tf(0,0,0,0),this.tempTileCoord_=Ih(0,0,0);const n=t.cacheSize!==void 0?t.cacheSize:512;this.tileCache_=new y1(n),this.sourceTileCache_=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new y1(512)),this.sourceTileCache_}getOrCreateTile(e,t,n,s){const o=this.tileCache_,a=this.getLayer().getSource(),l=Oh(a,a.getKey(),e,t,n);let c;if(o.containsKey(l))c=o.get(l);else{const h=s.viewState.projection,u=a.getProjection();if(c=a.getTile(e,t,n,s.pixelRatio,h,!u||Wt(u,h)?void 0:this.getSourceTileCache()),!c)return null;o.set(l,c)}return c}getTile(e,t,n,s){const o=this.getOrCreateTile(e,t,n,s);return o||null}getData(e){const t=this.frameState;if(!t)return null;const n=this.getLayer(),s=wt(t.pixelToCoordinateTransform,e.slice()),o=n.getExtent();if(o&&!Js(o,s))return null;const r=t.viewState,a=n.getRenderSource(),l=a.getTileGridForProjection(r.projection),c=a.getTilePixelRatio(t.pixelRatio);for(let h=l.getZForResolution(r.resolution);h>=l.getMinZoom();--h){const u=l.getTileCoordForCoordAndZ(s,h),d=this.getTile(h,u[1],u[2],t);if(!d||d.getState()!==se.LOADED)continue;const f=l.getOrigin(h),g=$t(l.getTileSize(h)),_=l.getResolution(h);let v;if(d instanceof ry||d instanceof m1)v=d.getImage();else if(d instanceof h1){if(v=tp(d.getData()),!v)continue}else continue;const E=Math.floor(c*((s[0]-f[0])/_-u[1]*g[0])),w=Math.floor(c*((f[1]-s[1])/_-u[2]*g[1])),C=Math.round(c*a.getGutterForProjection(r.projection));return this.getImageData(v,E+C,w+C)}return null}prepareFrame(e){var s;this.renderedProjection?e.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=e.viewState.projection):this.renderedProjection=e.viewState.projection;const t=this.getLayer().getSource();if(!t)return!1;const n=t.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==n&&(this.renderedSourceRevision_=n,this.renderedSourceKey_===t.getKey()&&(this.tileCache_.clear(),(s=this.sourceTileCache_)==null||s.clear())):this.renderedSourceRevision_=n,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(e,t,n,s,o){const r=e.viewState,a=this.getLayer(),l=a.getRenderSource(),c=l.getTileGridForProjection(r.projection),h=Pe(l);h in e.wantedTiles||(e.wantedTiles[h]={});const u=e.wantedTiles[h],d=a.getMapInternal(),f=Math.max(n-o,c.getMinZoom(),c.getZForResolution(Math.min(a.getMaxResolution(),d?d.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):c.getResolution(0)),l.zDirection)),g=r.rotation,_=g?Qg(r.center,r.resolution,g,e.size):void 0;for(let v=n;v>=f;--v){const E=c.getTileRangeForExtentAndZ(t,v,this.tempTileRange_),w=c.getResolution(v);for(let C=E.minX;C<=E.maxX;++C)for(let P=E.minY;P<=E.maxY;++P){if(g&&!c.tileCoordIntersectsViewport([v,C,P],_))continue;const R=this.getTile(v,C,P,e);if(!R||!sp(s,R,v))continue;const I=R.getKey();if(u[I]=!0,R.getState()===se.IDLE&&!e.tileQueue.isKeyQueued(I)){const M=Ih(v,C,P,this.tempTileCoord_);e.tileQueue.enqueue([R,h,c.getTileCoordCenter(M),w])}}}}findStaleTile_(e,t){const n=this.tileCache_,s=e[0],o=e[1],r=e[2],a=this.getStaleKeys();for(let l=0;l<a.length;++l){const c=Oh(this.getLayer().getSource(),a[l],s,o,r);if(n.containsKey(c)){const h=n.peek(c);if(h.getState()===se.LOADED)return h.endTransition(Pe(this)),sp(t,h,s),!0}}return!1}findAltTiles_(e,t,n,s){const o=e.getTileRangeForTileCoordAndZ(t,n,this.tempTileRange_);if(!o)return!1;let r=!0;const a=this.tileCache_,l=this.getLayer().getRenderSource(),c=l.getKey();for(let h=o.minX;h<=o.maxX;++h)for(let u=o.minY;u<=o.maxY;++u){const d=Oh(l,c,n,h,u);let f=!1;if(a.containsKey(d)){const g=a.peek(d);g.getState()===se.LOADED&&(sp(s,g,n),f=!0)}f||(r=!1)}return r}renderFrame(e,t){this.renderComplete=!0;const n=e.layerStatesArray[e.layerIndex],s=e.viewState,o=s.projection,r=s.resolution,a=s.center,l=e.pixelRatio,c=this.getLayer(),h=c.getSource(),u=h.getTileGridForProjection(o),d=u.getZForResolution(r,h.zDirection),f=u.getResolution(d),g=h.getKey();this.renderedSourceKey_?this.renderedSourceKey_!==g&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=g):this.renderedSourceKey_=g;let _=e.extent;const v=h.getTilePixelRatio(l);this.prepareContainer(e,t);const E=this.context.canvas.width,w=this.context.canvas.height,C=n.extent&&yi(n.extent);C&&(_=Xn(_,yi(n.extent)));const P=f*E/2/v,R=f*w/2/v,O=[a[0]-P,a[1]-R,a[0]+P,a[1]+R],I={};this.renderedTiles.length=0;const M=c.getPreload();if(e.nextExtent&&this.enqueueTilesForNextExtent()){const j=u.getZForResolution(s.nextResolution,h.zDirection),U=w1(e,e.nextExtent);this.enqueueTiles(e,U,j,I,M)}const z=w1(e,_);if(this.enqueueTiles(e,z,d,I,0),M>0&&setTimeout(()=>{this.enqueueTiles(e,z,d-1,I,M-1)},0),!(d in I))return this.container;const k=Pe(this),q=e.time;for(const j of I[d]){const U=j.getState();if(U===se.EMPTY)continue;const B=j.tileCoord;if(U===se.LOADED&&j.getAlpha(k,q)===1){j.endTransition(k);continue}if(U!==se.ERROR&&(this.renderComplete=!1),this.findStaleTile_(B,I)){uT(I,j,d),e.animate=!0;continue}if(this.findAltTiles_(u,B,d+1,I))continue;const ae=u.getMinZoom();for(let te=d-1;te>=ae&&!this.findAltTiles_(u,B,te,I);--te);}const H=f/r*l/v,m=this.getRenderContext(e);Zn(this.tempTransform,E/2,w/2,H,H,0,-E/2,-w/2),n.extent&&this.clipUnrotated(m,e,C),h.getInterpolate()||(m.imageSmoothingEnabled=!1),this.preRender(m,e);const b=Object.keys(I).map(Number);b.sort(di);let S;const L=[],N=[];for(let j=b.length-1;j>=0;--j){const U=b[j],B=h.getTilePixelSize(U,l,o),G=u.getResolution(U)/f,ae=B[0]*G*H,te=B[1]*G*H,V=u.getTileCoordForCoordAndZ(ln(O),U),re=u.getTileCoordExtent(V),ie=wt(this.tempTransform,[v*(re[0]-O[0])/f,v*(O[3]-re[3])/f]),he=v*h.getGutterForProjection(o);for(const me of I[U]){if(me.getState()!==se.LOADED)continue;const Fe=me.tileCoord,ue=V[1]-Fe[1],ze=Math.round(ie[0]-(ue-1)*ae),J=V[2]-Fe[2],dt=Math.round(ie[1]-(J-1)*te),Qe=Math.round(ie[0]-ue*ae),ye=Math.round(ie[1]-J*te),sn=ze-Qe,Gt=dt-ye,_t=b.length===1;let Mt=!1;S=[Qe,ye,Qe+sn,ye,Qe+sn,ye+Gt,Qe,ye+Gt];for(let Je=0,qn=L.length;Je<qn;++Je)if(!_t&&U<N[Je]){const nt=L[Je];pt([Qe,ye,Qe+sn,ye+Gt],[nt[0],nt[3],nt[4],nt[7]])&&(Mt||(m.save(),Mt=!0),m.beginPath(),m.moveTo(S[0],S[1]),m.lineTo(S[2],S[3]),m.lineTo(S[4],S[5]),m.lineTo(S[6],S[7]),m.moveTo(nt[6],nt[7]),m.lineTo(nt[4],nt[5]),m.lineTo(nt[2],nt[3]),m.lineTo(nt[0],nt[1]),m.clip())}L.push(S),N.push(U),this.drawTile(me,e,Qe,ye,sn,Gt,he,_t),Mt&&m.restore(),this.renderedTiles.unshift(me),this.updateUsedTiles(e.usedTiles,h,me)}}if(this.renderedResolution=f,this.extentChanged=!this.renderedExtent_||!ji(this.renderedExtent_,O),this.renderedExtent_=O,this.renderedPixelRatio=l,this.postRender(this.context,e),n.extent&&m.restore(),m.imageSmoothingEnabled=!0,this.renderComplete){const j=(U,B)=>{var te;const X=Pe(h),G=B.wantedTiles[X],ae=G?Object.keys(G).length:0;this.updateCacheSize(ae),this.tileCache_.expireCache(),(te=this.sourceTileCache_)==null||te.expireCache()};e.postRenderFunctions.push(j)}return this.container}updateCacheSize(e){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,e*2)}drawTile(e,t,n,s,o,r,a,l){let c;if(e instanceof h1){if(c=tp(e.getData()),!c)throw new Error("Rendering array data is not yet supported")}else c=this.getTileImage(e);if(!c)return;const h=this.getRenderContext(t),u=Pe(this),d=t.layerStatesArray[t.layerIndex],f=d.opacity*(l?e.getAlpha(u,t.time):1),g=f!==h.globalAlpha;g&&(h.save(),h.globalAlpha=f),h.drawImage(c,a,a,c.width-2*a,c.height-2*a,n,s,o,r),g&&h.restore(),f!==d.opacity?t.animate=!0:l&&e.endTransition(u)}getImage(){const e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}updateUsedTiles(e,t,n){const s=Pe(t);s in e||(e[s]={}),e[s][n.getKey()]=!0}}const Gs={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class dT extends Ma{constructor(e){e=e||{};const t=Object.assign({},e),n=e.cacheSize;delete e.cacheSize,delete t.preload,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=n,this.setPreload(e.preload!==void 0?e.preload:0),this.setUseInterimTilesOnError(e.useInterimTilesOnError!==void 0?e.useInterimTilesOnError:!0)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(Gs.PRELOAD)}setPreload(e){this.set(Gs.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(Gs.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(Gs.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}}class Ah extends dT{constructor(e){super(e)}createRenderer(){return new v1(this,{cacheSize:this.getCacheSize()})}}class fT extends vc{constructor(e,t,n,s,o,r,a){let l=e.getExtent();l&&e.canWrapX()&&(l=l.slice(),l[0]=-1/0,l[2]=1/0);let c=t.getExtent();c&&t.canWrapX()&&(c=c.slice(),c[0]=-1/0,c[2]=1/0);const h=c?Xn(n,c):n,u=Tn(h),d=Th(e,t,u,s),f=g1,g=new p1(e,t,h,l,d*f,s),_=g.calculateSourceExtent(),v=Ui(_)?null:r(_,d,o),E=v?le.IDLE:le.EMPTY,w=v?v.getPixelRatio():1;super(n,s,w,E),this.targetProj_=t,this.maxSourceExtent_=l,this.triangulation_=g,this.targetResolution_=s,this.targetExtent_=n,this.sourceImage_=v,this.sourcePixelRatio_=w,this.interpolate_=a,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==le.LOADING&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const e=this.sourceImage_.getState();if(e==le.LOADED){const t=Te(this.targetExtent_)/this.targetResolution_,n=ft(this.targetExtent_)/this.targetResolution_;this.canvas_=d1(t,n,this.sourcePixelRatio_,Sh(this.sourceImage_.getResolution()),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.interpolate_,!0)}this.state=e,this.changed()}load(){if(this.state==le.IDLE){this.state=le.LOADING,this.changed();const e=this.sourceImage_.getState();e==le.LOADED||e==le.ERROR?this.reproject_():(this.sourceListenerKey_=Ue(this.sourceImage_,_e.CHANGE,t=>{const n=this.sourceImage_.getState();(n==le.LOADED||n==le.ERROR)&&(this.unlistenSource_(),this.reproject_())}),this.sourceImage_.load())}}unlistenSource_(){st(this.sourceListenerKey_),this.sourceListenerKey_=null}}const Rr=4,op={IMAGELOADSTART:"imageloadstart",IMAGELOADEND:"imageloadend",IMAGELOADERROR:"imageloaderror"};class pT extends Yn{constructor(e,t){super(e),this.image=t}}class rp extends Ea{constructor(e){super({attributions:e.attributions,projection:e.projection,state:e.state,interpolate:e.interpolate!==void 0?e.interpolate:!0}),this.on,this.once,this.un,this.loader=e.loader||null,this.resolutions_=e.resolutions!==void 0?e.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0,this.image=null,this.wantedExtent_,this.wantedResolution_,this.static_=e.loader?e.loader.length===0:!1,this.wantedProjection_=null}getResolutions(){return this.resolutions_}setResolutions(e){this.resolutions_=e}findNearestResolution(e){const t=this.getResolutions();if(t){const n=Xl(t,e,0);e=t[n]}return e}getImage(e,t,n,s){const o=this.getProjection();if(!o||!s||Wt(o,s))return o&&(s=o),this.getImageInternal(e,t,n,s);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&Wt(this.reprojectedImage_.getProjection(),s)&&this.reprojectedImage_.getResolution()==t&&ji(this.reprojectedImage_.getExtent(),e))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new fT(o,s,e,t,n,(r,a,l)=>this.getImageInternal(r,a,l,o),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(e,t,n,s){if(this.loader){const o=mT(e,t,n,1),r=this.findNearestResolution(t);if(this.image&&(this.static_||this.wantedProjection_===s&&(this.wantedExtent_&&Ni(this.wantedExtent_,o)||Ni(this.image.getExtent(),o))&&(this.wantedResolution_&&Sh(this.wantedResolution_)===r||Sh(this.image.getResolution())===r)))return this.image;this.wantedProjection_=s,this.wantedExtent_=o,this.wantedResolution_=r,this.image=new vc(o,r,n,this.loader),this.image.addEventListener(_e.CHANGE,this.handleImageChange.bind(this))}return this.image}handleImageChange(e){const t=e.target;let n;switch(t.getState()){case le.LOADING:this.loading=!0,n=op.IMAGELOADSTART;break;case le.LOADED:this.loading=!1,n=op.IMAGELOADEND;break;case le.ERROR:this.loading=!1,n=op.IMAGELOADERROR;break;default:return}this.hasListener(n)&&this.dispatchEvent(new pT(n,t))}}function gT(i,e){i.getImage().src=e}function mT(i,e,t,n){const s=e/t,o=Tn(i),r=ys(Te(i)/s,Rr),a=ys(ft(i)/s,Rr),l=ys((n-1)*r/2,Rr),c=r+2*l,h=ys((n-1)*a/2,Rr),u=a+2*h;return Kl(o,s,0,[c,u])}function yT(i){const e=i.load||Jm,t=i.imageExtent,n=i.crossOrigin??null;return()=>{const s=new Image;return s.crossOrigin=n,i.referrerPolicy!==void 0&&(s.referrerPolicy=i.referrerPolicy),e(s,i.url).then(o=>{const r=Te(t)/o.width,a=ft(t)/o.height;return{image:o,extent:t,resolution:r!==a?[r,a]:a,pixelRatio:1}})}}class b1 extends rp{constructor(e){const t=e.crossOrigin!==void 0?e.crossOrigin:null,n=e.imageLoadFunction!==void 0?e.imageLoadFunction:gT;super({attributions:e.attributions,interpolate:e.interpolate,projection:De(e.projection)}),this.url_=e.url,this.imageExtent_=e.imageExtent,this.image=null,this.image=new vc(this.imageExtent_,void 0,1,yT({url:e.url,imageExtent:e.imageExtent,crossOrigin:t,referrerPolicy:e.referrerPolicy,load:(s,o)=>(this.image.setImage(s),n(this.image,o),Jm(s))})),this.image.addEventListener(_e.CHANGE,this.handleImageChange.bind(this))}getImageExtent(){return this.imageExtent_}getImageInternal(e,t,n,s){return pt(e,this.image.getExtent())?this.image:null}getUrl(){return this.url_}}const Tr=[0,0,0],qs=5;class Vs{constructor(e){this.minZoom=e.minZoom!==void 0?e.minZoom:0,this.resolutions_=e.resolutions,Ve(xv(this.resolutions_,(s,o)=>o-s),"`resolutions` must be sorted in descending order");let t;if(!e.origins){for(let s=0,o=this.resolutions_.length-1;s<o;++s)if(!t)t=this.resolutions_[s]/this.resolutions_[s+1];else if(this.resolutions_[s]/this.resolutions_[s+1]!==t){t=void 0;break}}this.zoomFactor_=t,this.maxZoom=this.resolutions_.length-1,this.origin_=e.origin!==void 0?e.origin:null,this.origins_=null,e.origins!==void 0&&(this.origins_=e.origins,Ve(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const n=e.extent;n!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=ln(n)),Ve(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,e.tileSizes!==void 0&&(this.tileSizes_=e.tileSizes,Ve(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=e.tileSize!==void 0?e.tileSize:this.tileSizes_?null:Wd,Ve(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=n!==void 0?n:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],e.sizes!==void 0?this.fullTileRanges_=e.sizes.map((s,o)=>{const r=new tf(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}):n&&this.calculateTileRanges_(n)}forEachTileCoord(e,t,n){const s=this.getTileRangeForExtentAndZ(e,t);for(let o=s.minX,r=s.maxX;o<=r;++o)for(let a=s.minY,l=s.maxY;a<=l;++a)n([t,o,a])}forEachTileCoordParentTileRange(e,t,n,s){let o,r,a,l=null,c=e[0]-1;for(this.zoomFactor_===2?(r=e[1],a=e[2]):l=this.getTileCoordExtent(e,s);c>=this.minZoom;){if(r!==void 0&&a!==void 0?(r=Math.floor(r/2),a=Math.floor(a/2),o=hr(r,r,a,a,n)):o=this.getTileRangeForExtentAndZ(l,c,n),t(c,o))return!0;--c}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_[e]}getOrigins(){return this.origins_}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,t,n){if(e[0]<this.maxZoom){if(this.zoomFactor_===2){const o=e[1]*2,r=e[2]*2;return hr(o,o+1,r,r+1,t)}const s=this.getTileCoordExtent(e,n||this.tmpExtent_);return this.getTileRangeForExtentAndZ(s,e[0]+1,t)}return null}getTileRangeForTileCoordAndZ(e,t,n){if(t>this.maxZoom||t<this.minZoom)return null;const s=e[0],o=e[1],r=e[2];if(t===s)return hr(o,r,o,r,n);if(this.zoomFactor_){const l=Math.pow(this.zoomFactor_,t-s),c=Math.floor(o*l),h=Math.floor(r*l);if(t<s)return hr(c,c,h,h,n);const u=Math.floor(l*(o+1))-1,d=Math.floor(l*(r+1))-1;return hr(c,u,h,d,n)}const a=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,t,n)}getTileRangeForExtentAndZ(e,t,n){this.getTileCoordForXYAndZ_(e[0],e[3],t,!1,Tr);const s=Tr[1],o=Tr[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,Tr);const r=Tr[1],a=Tr[2];return hr(s,r,o,a,n)}getTileCoordCenter(e){const t=this.getOrigin(e[0]),n=this.getResolution(e[0]),s=$t(this.getTileSize(e[0]),this.tmpSize_);return[t[0]+(e[1]+.5)*s[0]*n,t[1]-(e[2]+.5)*s[1]*n]}getTileCoordExtent(e,t){const n=this.getOrigin(e[0]),s=this.getResolution(e[0]),o=$t(this.getTileSize(e[0]),this.tmpSize_),r=n[0]+e[1]*o[0]*s,a=n[1]-(e[2]+1)*o[1]*s,l=r+o[0]*s,c=a+o[1]*s;return ki(r,a,l,c,t)}getTileCoordForCoordAndResolution(e,t,n){return this.getTileCoordForXYAndResolution_(e[0],e[1],t,!1,n)}getTileCoordForXYAndResolution_(e,t,n,s,o){const r=this.getZForResolution(n),a=n/this.getResolution(r),l=this.getOrigin(r),c=$t(this.getTileSize(r),this.tmpSize_);let h=a*(e-l[0])/n/c[0],u=a*(l[1]-t)/n/c[1];return s?(h=ys(h,qs)-1,u=ys(u,qs)-1):(h=Jl(h,qs),u=Jl(u,qs)),Ih(r,h,u,o)}getTileCoordForXYAndZ_(e,t,n,s,o){const r=this.getOrigin(n),a=this.getResolution(n),l=$t(this.getTileSize(n),this.tmpSize_);let c=(e-r[0])/a/l[0],h=(r[1]-t)/a/l[1];return s?(c=ys(c,qs)-1,h=ys(h,qs)-1):(c=Jl(c,qs),h=Jl(h,qs)),Ih(n,c,h,o)}getTileCoordForCoordAndZ(e,t,n){return this.getTileCoordForXYAndZ_(e[0],e[1],t,!1,n)}getTileCoordResolution(e){return this.resolutions_[e[0]]}getTileSize(e){return this.tileSize_?this.tileSize_:this.tileSizes_[e]}getFullTileRange(e){return this.fullTileRanges_?this.fullTileRanges_[e]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,e):null}getZForResolution(e,t){const n=Xl(this.resolutions_,e,t||0);return ct(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return Um(t,0,t.length,2,this.getTileCoordExtent(e))}calculateTileRanges_(e){const t=this.resolutions_.length,n=new Array(t);for(let s=this.minZoom;s<t;++s)n[s]=this.getTileRangeForExtentAndZ(e,s);this.fullTileRanges_=n}}class _T extends Vs{constructor(e){super({extent:e.extent,origin:e.origin,origins:e.origins,resolutions:e.resolutions,tileSize:e.tileSize,tileSizes:e.tileSizes,sizes:e.sizes}),this.matrixIds_=e.matrixIds}getMatrixId(e){return this.matrixIds_[e]}getMatrixIds(){return this.matrixIds_}}function ap(i){let e=i.getDefaultTileGrid();return e||(e=bT(i),i.setDefaultTileGrid(e)),e}function wT(i,e,t){const n=e[0],s=i.getTileCoordCenter(e),o=Ka(t);if(!Js(o,s)){const r=Te(o),a=Math.ceil((o[0]-s[0])/r);return s[0]+=r*a,i.getTileCoordForCoordAndZ(s,n)}return e}function vT(i,e,t,n){n=n!==void 0?n:"top-left";const s=E1(i,e,t);return new Vs({extent:i,origin:Rv(i,n),resolutions:s,tileSize:t})}function Ir(i){const e=i||{},t=e.extent||De("EPSG:3857").getExtent(),n={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:E1(t,e.maxZoom,e.tileSize,e.maxResolution)};return new Vs(n)}function E1(i,e,t,n){e=e!==void 0?e:ny,t=$t(t!==void 0?t:Wd);const s=ft(i),o=Te(i);n=n>0?n:Math.max(o/t[0],s/t[1]);const r=e+1,a=new Array(r);for(let l=0;l<r;++l)a[l]=n/Math.pow(2,l);return a}function bT(i,e,t,n){const s=Ka(i);return vT(s,e,t,n)}function Ka(i){i=De(i);let e=i.getExtent();if(!e){const t=180*ic.degrees/i.getMetersPerUnit();e=ki(-t,-t,t,t)}return e}class C1 extends Ea{constructor(e){super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX,interpolate:e.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=e.tilePixelRatio!==void 0?e.tilePixelRatio:1,this.tileGrid=e.tileGrid!==void 0?e.tileGrid:null;const t=[256,256];this.tileGrid&&$t(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),t),this.tmpSize=[0,0],this.key_=e.key||Pe(this),this.tileOptions={transition:e.transition,interpolate:e.interpolate},this.zDirection=e.zDirection?e.zDirection:0}getGutterForProjection(e){return 0}getKey(){return this.key_}setKey(e){this.key_!==e&&(this.key_=e,this.changed())}getResolutions(e){const t=e?this.getTileGridForProjection(e):this.tileGrid;return t?t.getResolutions():null}getTile(e,t,n,s,o,r){return we()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:ap(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){const s=this.getTileGridForProjection(n),o=this.getTilePixelRatio(t),r=$t(s.getTileSize(e),this.tmpSize);return o==1?r:ME(r,o,this.tmpSize)}getTileCoordForTileUrlFunction(e,t){const n=t!==void 0?t:this.getProjection(),s=t!==void 0?this.getTileGridForProjection(n):this.tileGrid||this.getTileGridForProjection(n);return this.getWrapX()&&n.isGlobal()&&(e=wT(s,e,n)),hT(e,s)?e:null}clear(){}refresh(){this.clear(),super.refresh()}}class ET extends Yn{constructor(e,t){super(e),this.tile=t}}function x1(i){return function(e){const t=e.buffers,n=e.meta,s=e.imageOps,o=e.width,r=e.height,a=t.length,l=t[0].byteLength;if(s){const d=new Array(a);for(let g=0;g<a;++g)d[g]=new ImageData(new Uint8ClampedArray(t[g]),o,r);return i(d,n).data.buffer}const c=new Uint8ClampedArray(l),h=new Array(a),u=new Array(a);for(let d=0;d<a;++d)h[d]=new Uint8ClampedArray(t[d]),u[d]=[0,0,0,0];for(let d=0;d<l;d+=4){for(let g=0;g<a;++g){const _=h[g];u[g][0]=_[d],u[g][1]=_[d+1],u[g][2]=_[d+2],u[g][3]=_[d+3]}const f=i(u,n);c[d]=f[0],c[d+1]=f[1],c[d+2]=f[2],c[d+3]=f[3]}return c.buffer}}function CT(i,e){const n=Object.keys(i.lib||{}).map(function(o){return"const "+o+" = "+i.lib[o].toString()+";"}).concat(["const __minion__ = ("+x1.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(`
|
|
156
|
-
`),"binary").toString("base64"):URL.createObjectURL(new Blob(
|
|
157
|
-
`);this.generateTileUrlFunction_?this.setTileUrlFunction(
|
|
158
|
-
`);this.setTileUrlFunction(cp(e.map(this.createFromWMTSTemplate.bind(this))),t)}getDimensions(){return this.dimensions_}getFormat(){return this.format_}getLayer(){return this.layer_}getMatrixSet(){return this.matrixSet_}getRequestEncoding(){return this.requestEncoding_}getStyle(){return this.style_}getVersion(){return this.version_}getKeyForDimensions_(){const e=this.urls?this.urls.slice(0):[];for(const t in this.dimensions_)e.push(t+"-"+this.dimensions_[t]);return e.join("/")}updateDimensions(e){Object.assign(this.dimensions_,e),this.setKey(this.getKeyForDimensions_())}createFromWMTSTemplate(e){const t=this.requestEncoding_,n={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};t=="KVP"&&Object.assign(n,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),e=t=="KVP"?Mh(e,n):e.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,l){if(!r)return;const c={TileMatrix:s.getMatrixId(r[0]),TileCol:r[1],TileRow:r[2]};Object.assign(c,o);let h=e;return t=="KVP"?h=Mh(h,c):h=h.replace(/\{(\w+?)\}/g,function(u,d){return encodeURIComponent(c[d])}),h})}}class Lh extends Fh{constructor(e){e=e||{};const t=e.projection!==void 0?e.projection:"EPSG:3857",n=e.tileGrid!==void 0?e.tileGrid:Ir({extent:Ka(t),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize});super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,referrerPolicy:e.referrerPolicy,interpolate:e.interpolate,projection:t,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:n,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.gutter_=e.gutter!==void 0?e.gutter:0}getGutter(){return this.gutter_}}const GT={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},O1={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};class qT extends v1{constructor(e,t){super(e,t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=Qt(),this.tileClipContexts_=null}enqueueTilesForNextExtent(){return this.getLayer().getRenderMode()!=="vector"}drawTile(e,t,n,s,o,r,a,l){this.updateExecutorGroup_(e,t.pixelRatio,t.viewState.projection),this.tileImageNeedsRender_(e)&&this.renderTileImage_(e,t),super.drawTile(e,t,n,s,o,r,a,l)}getTile(e,t,n,s){const o=this.getOrCreateTile(e,t,n,s);if(!o)return null;const r=s.viewState,a=r.resolution,l=s.viewHints,c=this.getLayer().getSource(),h=c.getTileGridForProjection(r.projection),u=!(l[ot.ANIMATING]||l[ot.INTERACTING]),d=h.getZForResolution(a,c.zDirection)===e;return u&&d?o.wantedResolution=a:o.wantedResolution||(o.wantedResolution=h.getResolution(e)),o}prepareFrame(e){const t=this.getLayer().getRevision();return this.renderedLayerRevision_!==t&&(this.renderedLayerRevision_=t,this.renderedTiles.length=0),super.prepareFrame(e)}updateExecutorGroup_(e,t,n){const s=this.getLayer(),o=s.getRevision(),r=s.getRenderOrder()||null,a=e.wantedResolution,l=e.getReplayState(s);if(!l.dirty&&l.renderedResolution===a&&l.renderedRevision==o&&l.renderedPixelRatio===t&&l.renderedRenderOrder==r)return;const c=s.getSource(),h=!!s.getDeclutter(),u=c.getTileGrid(),f=c.getTileGridForProjection(n).getTileCoordExtent(e.wrappedTileCoord),g=c.getSourceTiles(t,n,e),_=Pe(s);delete e.hitDetectionImageData[_],e.executorGroups[_]=[],l.dirty=!1;for(let v=0,E=g.length;v<E;++v){const w=g[v];if(w.getState()!=se.LOADED)continue;const C=c.getProjection(),P=w.tileCoord;let R=u.getTileCoordExtent(P);n&&C&&!Wt(n,C)&&(R=sa(R,C,n,32));const O=Xn(f,R),I=pi(O,s.getRenderBuffer()*a,this.tempExtent),M=ji(R,O)?null:I,z=new R0(0,O,a,t),k=Pc(a,t),q=function(L,N){let j;const U=L.getStyleFunction()||s.getStyleFunction();if(U&&(j=U(L,a)),j){const B=this.renderFeature(L,k,j,z,h,N);l.dirty=l.dirty||B}},H=w.getFeatures();r&&r!==l.renderedRenderOrder&&H.sort(r);for(let L=0,N=H.length;L<N;++L){let j=H[L];n&&w.projection&&!Wt(n,w.projection)&&(j=j.clone(),j.getGeometry().applyTransform(Gi(w.projection,n))),(!M||pt(M,j.getGeometry().getExtent()))&&q.call(this,j,L)}const m=z.finish(),b=s.getRenderMode()!=="vector"&&h&&g.length===1?null:O,S=new M0(b,a,t,c.getOverlaps(),m,s.getRenderBuffer(),!0);e.executorGroups[_].push(S)}l.renderedRevision=o,l.renderedPixelRatio=t,l.renderedRenderOrder=r,l.renderedResolution=a}forEachFeatureAtCoordinate(e,t,n,s,o){var C,P;const r=t.viewState.resolution,a=t.viewState.rotation;n=n??0;const l=this.getLayer(),h=l.getSource().getTileGridForProjection(t.viewState.projection),u=$r([e]);pi(u,r*n,u);const d={},f=function(R,O,I){let M=R.getId();M===void 0&&(M=Pe(R));const z=d[M];if(z){if(z!==!0&&I<z.distanceSq){if(I===0)return d[M]=!0,o.splice(o.lastIndexOf(z),1),s(R,l,O);z.geometry=O,z.distanceSq=I}}else{if(I===0)return d[M]=!0,s(R,l,O);o.push(d[M]={feature:R,layer:l,geometry:O,distanceSq:I,callback:s})}},g=this.renderedTiles,_=Pe(l),v=l.getDeclutter(),E=v?(P=(C=t.declutter)==null?void 0:C[v])==null?void 0:P.all().map(R=>R.value):null;let w;e:for(let R=0,O=g.length;R<O;++R){const I=g[R],M=h.getTileCoordExtent(I.wrappedTileCoord);if(!pt(M,u))continue;const z=I.executorGroups[_];for(let k=0,q=z.length;k<q;++k)if(w=z[k].forEachFeatureAtCoordinate(e,r,a,n,f,E),w)break e}return w}getFeatures(e){return this.renderedTiles.length===0?Promise.resolve([]):new Promise((t,n)=>{const s=this.getLayer(),o=s.getSource(),r=this.renderedProjection,a=r.getExtent(),l=this.renderedResolution,c=o.getTileGridForProjection(r),h=wt(this.renderedPixelToCoordinateTransform_,e.slice()),u=c.getTileCoordForCoordAndResolution(h,l).toString(),d=this.renderedTiles.find(C=>C.tileCoord.toString()===u&&C.getState()===se.LOADED);if(!d||d.loadingSourceTiles>0){t([]);return}o.getWrapX()&&r.canWrapX()&&!Ni(a,c.getTileCoordExtent(d.tileCoord))&&Nu(h,r);const f=Pe(s),g=c.getTileCoordExtent(d.wrappedTileCoord),_=ln(g),v=[(h[0]-_[0])/l,(_[1]-h[1])/l],E=d.getSourceTiles().reduce((C,P)=>C.concat(P.getFeatures()),[]);let w=d.hitDetectionImageData[f];if(!w){const C=$t(c.getTileSize(c.getZForResolution(l,o.zDirection))),P=this.renderedRotation_,R=[this.getRenderTransform(c.getTileCoordCenter(d.wrappedTileCoord),l,0,bn,C[0]*bn,C[1]*bn,0)];w=F0(C,R,E,s.getStyleFunction(),c.getTileCoordExtent(d.wrappedTileCoord),d.getReplayState(s).renderedResolution,P),d.hitDetectionImageData[f]=w}t(L0(v,E,w))})}getFeaturesInExtent(e){const t=[],n=this.getTileCache();if(n.getCount()===0)return t;const o=this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),r=o.getZForResolution(this.renderedResolution),a={};return n.forEach(l=>{if(l.tileCoord[0]!==r||l.getState()!==se.LOADED)return;const c=l.getSourceTiles();for(let h=0,u=c.length;h<u;++h){const d=c[h],f=d.getKey();if(f in a)continue;a[f]=!0;const g=d.tileCoord;if(pt(e,o.getTileCoordExtent(g))){const _=d.getFeatures();if(_)for(let v=0,E=_.length;v<E;++v){const w=_[v],C=w.getGeometry();pt(e,C.getExtent())&&t.push(w)}}}}),t}handleFontsChanged(){const e=this.getLayer();e.getVisible()&&this.renderedLayerRevision_!==void 0&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}renderDeclutter(e,t){var d;const n=this.context,s=n.globalAlpha;n.globalAlpha=t.opacity;const o=e.viewHints,r=!(o[ot.ANIMATING]||o[ot.INTERACTING]),a=[this.context.canvas.width,this.context.canvas.height],l=this.getLayer().getDeclutter(),c=l?(d=e.declutter)==null?void 0:d[l]:void 0,h=Pe(this.getLayer()),u=this.renderedTiles;for(let f=0,g=u.length;f<g;++f){const _=u[f],v=_.executorGroups[h];if(v)for(let E=v.length-1;E>=0;--E)v[E].execute(this.context,a,this.getTileRenderTransform(_,e),e.viewState.rotation,r,Dc,c)}n.globalAlpha=s}renderDeferredInternal(e){const t=this.renderedTiles,n=Pe(this.getLayer()),s=t.reduce((l,c,h)=>(c.executorGroups[n].forEach(u=>l.push({executorGroup:u,index:h})),l),[]),o=s.map(({executorGroup:l})=>l.getDeferredZIndexContexts()),r={};for(let l=0,c=s.length;l<c;++l){const h=s[l].executorGroup.getDeferredZIndexContexts();for(const u in h)r[u]=!0}Object.keys(r).map(Number).sort(di).forEach(l=>{o.forEach((c,h)=>{c[l]&&(c[l].forEach(u=>{const{executorGroup:d,index:f}=s[h],g=d.getRenderedContext(),_=g.globalAlpha;g.globalAlpha=this.renderedOpacity_;const v=this.tileClipContexts_[f];v&&v.draw(g),u.draw(g),v&&g.restore(),g.globalAlpha=_,u.clear()}),c[l].length=0)})})}getTileRenderTransform(e,t){const n=t.pixelRatio,s=t.viewState,o=s.center,r=s.resolution,a=s.rotation,l=t.size,c=Math.round(l[0]*n),h=Math.round(l[1]*n),d=this.getLayer().getSource().getTileGridForProjection(t.viewState.projection),f=e.tileCoord,g=d.getTileCoordExtent(e.wrappedTileCoord),_=d.getTileCoordExtent(f,this.tempExtent)[0]-g[0];return hc(Zu(this.inversePixelTransform.slice(),1/n,1/n),this.getRenderTransform(o,r,a,n,c,h,_))}postRender(e,t){var R;const n=t.viewHints,s=!(n[ot.ANIMATING]||n[ot.INTERACTING]);this.renderedPixelToCoordinateTransform_=t.pixelToCoordinateTransform.slice(),this.renderedRotation_=t.viewState.rotation,this.renderedOpacity_=t.layerStatesArray[t.layerIndex].opacity;const o=this.getLayer(),r=o.getRenderMode(),a=e.globalAlpha;e.globalAlpha=this.renderedOpacity_;const l=o.getDeclutter(),c=l?O1[r].filter(O=>!Dc.includes(O)):O1[r],h=t.viewState,u=h.rotation,d=o.getSource(),g=d.getTileGridForProjection(h.projection).getZForResolution(h.resolution,d.zDirection),_=this.renderedTiles,v=[],E=[],w=[],C=Pe(o);let P=!0;for(let O=_.length-1;O>=0;--O){const I=_[O];P=P&&!I.getReplayState(o).dirty;const M=I.executorGroups[C].filter(S=>S.hasExecutors(c));if(M.length===0)continue;const z=this.getTileRenderTransform(I,t),k=I.tileCoord[0];let q=!1;const H=M[0].getClipCoords(z);let m=e,b;if(H){b=new Md,m=b.getContext();for(let S=0,L=v.length;S<L;++S)if(g!==k&&k<E[S]){const N=v[S];pt([H[0],H[3],H[4],H[7]],[N[0],N[3],N[4],N[7]])&&(q||(m.save(),q=!0),m.beginPath(),m.moveTo(H[0],H[1]),m.lineTo(H[2],H[3]),m.lineTo(H[4],H[5]),m.lineTo(H[6],H[7]),m.moveTo(N[6],N[7]),m.lineTo(N[4],N[5]),m.lineTo(N[2],N[3]),m.lineTo(N[0],N[1]),m.clip())}v.push(H),E.push(k)}for(let S=0,L=M.length;S<L;++S)M[S].execute(e,[e.canvas.width,e.canvas.height],z,u,s,c,(R=t.declutter)==null?void 0:R[l]);q&&(m===e?m.restore():w[O]=b)}e.globalAlpha=a,this.ready=P,this.tileClipContexts_=w,t.declutter||this.renderDeferredInternal(t),super.postRender(e,t)}renderFeature(e,t,n,s,o,r){if(!n)return!1;let a=!1;if(Array.isArray(n))for(let l=0,c=n.length;l<c;++l)a=Sc(s,e,n[l],t,this.boundHandleStyleImageChange_,void 0,o,r)||a;else a=Sc(s,e,n,t,this.boundHandleStyleImageChange_,void 0,o,r);return a}tileImageNeedsRender_(e){const t=this.getLayer();if(t.getRenderMode()==="vector")return!1;const n=e.getReplayState(t),s=t.getRevision(),o=e.wantedResolution;return n.renderedTileResolution!==o||n.renderedTileRevision!==s}renderTileImage_(e,t){const n=this.getLayer(),s=e.getReplayState(n),o=n.getRevision(),r=e.executorGroups[Pe(n)];s.renderedTileRevision=o;const a=e.wrappedTileCoord,l=a[0],c=n.getSource();let h=t.pixelRatio;const d=t.viewState.projection,f=c.getTileGridForProjection(d),g=f.getResolution(e.tileCoord[0]),_=t.pixelRatio/e.wantedResolution*g,v=f.getResolution(l),E=e.getContext();h=Math.round(Math.max(h,_/h));const w=c.getTilePixelSize(l,h,d);E.canvas.width=w[0],E.canvas.height=w[1];const C=h/_;if(C!==1){const I=Rm(this.tmpTransform_);Zu(I,C,C),E.setTransform.apply(E,I)}const P=f.getTileCoordExtent(a,this.tempExtent),R=_/v,O=Rm(this.tmpTransform_);Zu(O,R,-R),yb(O,-P[0],-P[3]);for(let I=0,M=r.length;I<M;++I)r[I].execute(E,[E.canvas.width*C,E.canvas.height*C],O,0,!0,GT[n.getRenderMode()],null);s.renderedTileResolution=e.wantedResolution}}class zh extends Uc{constructor(e){e=e||{};const t=Object.assign({},e);delete t.preload;const n=e.cacheSize===void 0?0:e.cacheSize;delete e.cacheSize,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=n;const s=e.renderMode||"hybrid";Ve(s=="hybrid"||s=="vector","`renderMode` must be `'hybrid'` or `'vector'`"),this.renderMode_=s,this.setPreload(e.preload?e.preload:0),this.setUseInterimTilesOnError(e.useInterimTilesOnError!==void 0?e.useInterimTilesOnError:!0),this.getBackground,this.setBackground}createRenderer(){return new qT(this,{cacheSize:this.cacheSize_})}getFeatures(e){return super.getFeatures(e)}getFeaturesInExtent(e){return this.getRenderer().getFeaturesInExtent(e)}getRenderMode(){return this.renderMode_}getPreload(){return this.get(Gs.PRELOAD)}getUseInterimTilesOnError(){return this.get(Gs.USE_INTERIM_TILES_ON_ERROR)}setPreload(e){this.set(Gs.PRELOAD,e)}setUseInterimTilesOnError(e){this.set(Gs.USE_INTERIM_TILES_ON_ERROR,e)}}class dp extends Dh{constructor(e){const t=e.projection||"EPSG:3857",n=e.extent||Ka(t),s=e.tileGrid||Ir({extent:n,maxResolution:e.maxResolution,maxZoom:e.maxZoom!==void 0?e.maxZoom:22,minZoom:e.minZoom,tileSize:e.tileSize||512});super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,interpolate:!0,projection:t,state:e.state,tileGrid:s,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:A1,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX===void 0?!0:e.wrapX,transition:e.transition,zDirection:e.zDirection===void 0?1:e.zDirection}),this.format_=e.format?e.format:null,this.tileKeysBySourceTileUrl_={},this.sourceTiles_={},this.overlaps_=e.overlaps==null?!0:e.overlaps,this.tileClass=e.tileClass?e.tileClass:Cx,this.tileGrids_={}}getOverlaps(){return this.overlaps_}getSourceTiles(e,t,n){if(n.getState()===se.IDLE){n.setState(se.LOADING);const s=n.wrappedTileCoord,o=this.getTileGridForProjection(t);let r=o.getTileCoordExtent(s);const a=s[0],l=o.getResolution(a);pi(r,-l,r);const c=this.projection;t&&this.projection&&!Wt(t,c)&&(r=sa(r,t,c));const h=this.tileGrid,u=h.getExtent();u&&Xn(r,u,r);let d=l;t&&c&&!Wt(t,c)&&(d=l/c.getMetersPerUnit()/t.getMetersPerUnit());const f=h.getZForResolution(d,this.zDirection);h.forEachTileCoord(r,f,g=>{const _=this.tileUrlFunction(g,e,t);this.sourceTiles_[_]||(this.sourceTiles_[_]=new this.tileClass(g,_?se.IDLE:se.EMPTY,_,this.format_,this.tileLoadFunction));const v=this.sourceTiles_[_];n.sourceTiles.push(v),this.tileKeysBySourceTileUrl_[_]||(this.tileKeysBySourceTileUrl_[_]=[]),this.tileKeysBySourceTileUrl_[_].push(n.getKey());const E=v.getState();if(E<se.LOADED){const w=C=>{this.handleTileChange(C);const P=v.getState();if(P===se.LOADED||P===se.ERROR){const R=v.getKey();R in n.errorTileKeys?v.getState()===se.LOADED&&delete n.errorTileKeys[R]:n.loadingSourceTiles--,P===se.ERROR?n.errorTileKeys[R]=!0:v.removeEventListener(_e.CHANGE,w),n.loadingSourceTiles===0&&n.setState(_s(n.errorTileKeys)?se.LOADED:se.ERROR)}};v.addEventListener(_e.CHANGE,w),n.loadingSourceTiles++}E===se.IDLE&&(v.extent=h.getTileCoordExtent(g),v.projection=this.projection,v.resolution=h.getResolution(g[0]),v.load())}),n.loadingSourceTiles||n.setState(n.sourceTiles.some(g=>g.getState()===se.ERROR)?se.ERROR:se.LOADED)}return n.sourceTiles}removeSourceTiles(e){const t=e.getKey(),n=e.sourceTiles;for(let s=0,o=n.length;s<o;++s){const r=n[s].getTileUrl();if(!this.tileKeysBySourceTileUrl_[r])return;const a=this.tileKeysBySourceTileUrl_[r].indexOf(t);a!==-1&&(this.tileKeysBySourceTileUrl_[r].splice(a,1),this.tileKeysBySourceTileUrl_[r].length===0&&(delete this.tileKeysBySourceTileUrl_[r],delete this.sourceTiles_[r]))}}getTile(e,t,n,s,o){const r=[e,t,n];let a=this.getTileCoordForTileUrlFunction(r,o);const l=this.getTileGrid().getExtent(),c=this.projection,h=this.getTileGridForProjection(o);if(a&&l){const f=h.getTileCoordExtent(a);pi(f,-h.getResolution(e),f),pt(l,!o||!c||Wt(o,c)?f:sa(f,o,c))||(a=null)}let u=!0;if(a!==null){const f=this.tileGrid,g=h.getResolution(e);let _=g;o&&c&&!Wt(o,c)&&(_=g/c.getMetersPerUnit()/o.getMetersPerUnit());const v=f.getZForResolution(_,1),E=h.getTileCoordExtent(a);pi(E,-g,E),f.forEachTileCoord(!o||!c||Wt(o,c)?E:sa(E,o,c),v,w=>{u=u&&!this.tileUrlFunction(w,s,c)})}const d=new Ex(r,u?se.EMPTY:se.IDLE,a,this.getSourceTiles.bind(this,s,o),this.removeSourceTiles.bind(this));return d.key=this.getKey(),d}getTileGridForProjection(e){const t=e.getCode();let n=this.tileGrids_[t];if(!n){const s=this.projection;if(s!==null&&!Wt(s,e))return ap(e);const o=this.tileGrid,r=o.getResolutions().slice(),a=r.map(function(h,u){return o.getOrigin(u)}),l=r.map(function(h,u){return o.getTileSize(u)}),c=ny+1;for(let h=r.length;h<c;++h)r.push(r[h-1]/2),a.push(a[h-1]),l.push(l[h-1]);n=new Vs({extent:o.getExtent(),origins:a,resolutions:r,tileSizes:l}),this.tileGrids_[t]=n}return n}getTilePixelRatio(e){return e}getTilePixelSize(e,t,n){const s=this.getTileGridForProjection(n),o=$t(s.getTileSize(e),this.tmpSize);return[Math.round(o[0]*t),Math.round(o[1]*t)]}setOverlaps(e){this.overlaps_=e,this.changed()}}function A1(i,e){i.setLoader(function(t,n,s){p0(e,i.getFormat(),t,n,s,i.onLoad.bind(i),i.onError.bind(i))})}const fp=65536*65536,M1=1/fp,VT=12,D1=typeof TextDecoder>"u"?null:new TextDecoder("utf-8"),pp=0,Nh=1,Qa=2,kh=5;class WT{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,t,n=this.length){for(;this.pos<n;){const s=this.readVarint(),o=s>>3,r=this.pos;this.type=s&7,e(o,t,this),this.pos===r&&this.skip(s)}return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*fp;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*fp;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const t=this.buf;let n,s;return s=t[this.pos++],n=s&127,s<128||(s=t[this.pos++],n|=(s&127)<<7,s<128)||(s=t[this.pos++],n|=(s&127)<<14,s<128)||(s=t[this.pos++],n|=(s&127)<<21,s<128)?n:(s=t[this.pos],n|=(s&15)<<28,BT(n,e,this))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2===1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){const e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=VT&&D1?D1.decode(this.buf.subarray(t,e)):sI(this.buf,t,e)}readBytes(){const e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){const n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===Qa?this.readVarint()+this.pos:this.pos+1}skip(e){const t=e&7;if(t===pp)for(;this.buf[this.pos++]>127;);else if(t===Qa)this.pos=this.readVarint()+this.pos;else if(t===kh)this.pos+=4;else if(t===Nh)this.pos+=8;else throw new Error(`Unimplemented type: ${t}`)}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){const n=new Uint8Array(t);n.set(this.buf),this.buf=n,this.dataView=new DataView(n.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*M1),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*M1),!0),this.pos+=8}writeVarint(e){if(e=+e||0,e>268435455||e<0){$T(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))}writeSVarint(e){this.writeVarint(e<0?-e*2-1:e*2)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(e.length*4),this.pos++;const t=this.pos;this.pos=oI(this.buf,e,this.pos);const n=this.pos-t;n>=128&&F1(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const t=e.length;this.writeVarint(t),this.realloc(t);for(let n=0;n<t;n++)this.buf[this.pos++]=e[n]}writeRawMessage(e,t){this.pos++;const n=this.pos;e(t,this);const s=this.pos-n;s>=128&&F1(n,s,this),this.pos=n-1,this.writeVarint(s),this.pos+=s}writeMessage(e,t,n){this.writeTag(e,Qa),this.writeRawMessage(t,n)}writePackedVarint(e,t){t.length&&this.writeMessage(e,YT,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,ZT,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,JT,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,KT,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,QT,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,eI,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,tI,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,nI,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,iI,t)}writeBytesField(e,t){this.writeTag(e,Qa),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,kh),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,kh),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,Nh),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,Nh),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,pp),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,pp),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,Qa),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,kh),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,Nh),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}}function BT(i,e,t){const n=t.buf;let s,o;if(o=n[t.pos++],s=(o&112)>>4,o<128||(o=n[t.pos++],s|=(o&127)<<3,o<128)||(o=n[t.pos++],s|=(o&127)<<10,o<128)||(o=n[t.pos++],s|=(o&127)<<17,o<128)||(o=n[t.pos++],s|=(o&127)<<24,o<128)||(o=n[t.pos++],s|=(o&1)<<31,o<128))return Or(i,s,e);throw new Error("Expected varint not more than 10 bytes")}function Or(i,e,t){return t?e*4294967296+(i>>>0):(e>>>0)*4294967296+(i>>>0)}function $T(i,e){let t,n;if(i>=0?(t=i%4294967296|0,n=i/4294967296|0):(t=~(-i%4294967296),n=~(-i/4294967296),t^4294967295?t=t+1|0:(t=0,n=n+1|0)),i>=18446744073709552e3||i<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),HT(t,n,e),XT(n,e)}function HT(i,e,t){t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos]=i&127}function XT(i,e){const t=(i&7)<<4;e.buf[e.pos++]|=t|((i>>>=3)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127)))))}function F1(i,e,t){const n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));t.realloc(n);for(let s=t.pos-1;s>=i;s--)t.buf[s+n]=t.buf[s]}function YT(i,e){for(let t=0;t<i.length;t++)e.writeVarint(i[t])}function ZT(i,e){for(let t=0;t<i.length;t++)e.writeSVarint(i[t])}function KT(i,e){for(let t=0;t<i.length;t++)e.writeFloat(i[t])}function QT(i,e){for(let t=0;t<i.length;t++)e.writeDouble(i[t])}function JT(i,e){for(let t=0;t<i.length;t++)e.writeBoolean(i[t])}function eI(i,e){for(let t=0;t<i.length;t++)e.writeFixed32(i[t])}function tI(i,e){for(let t=0;t<i.length;t++)e.writeSFixed32(i[t])}function nI(i,e){for(let t=0;t<i.length;t++)e.writeFixed64(i[t])}function iI(i,e){for(let t=0;t<i.length;t++)e.writeSFixed64(i[t])}function sI(i,e,t){let n="",s=e;for(;s<t;){const o=i[s];let r=null,a=o>239?4:o>223?3:o>191?2:1;if(s+a>t)break;let l,c,h;a===1?o<128&&(r=o):a===2?(l=i[s+1],(l&192)===128&&(r=(o&31)<<6|l&63,r<=127&&(r=null))):a===3?(l=i[s+1],c=i[s+2],(l&192)===128&&(c&192)===128&&(r=(o&15)<<12|(l&63)<<6|c&63,(r<=2047||r>=55296&&r<=57343)&&(r=null))):a===4&&(l=i[s+1],c=i[s+2],h=i[s+3],(l&192)===128&&(c&192)===128&&(h&192)===128&&(r=(o&15)<<18|(l&63)<<12|(c&63)<<6|h&63,(r<=65535||r>=1114112)&&(r=null))),r===null?(r=65533,a=1):r>65535&&(r-=65536,n+=String.fromCharCode(r>>>10&1023|55296),r=56320|r&1023),n+=String.fromCharCode(r),s+=a}return n}function oI(i,e,t){for(let n=0,s,o;n<e.length;n++){if(s=e.charCodeAt(n),s>55295&&s<57344)if(o)if(s<56320){i[t++]=239,i[t++]=191,i[t++]=189,o=s;continue}else s=o-55296<<10|s-56320|65536,o=null;else{s>56319||n+1===e.length?(i[t++]=239,i[t++]=191,i[t++]=189):o=s;continue}else o&&(i[t++]=239,i[t++]=191,i[t++]=189,o=null);s<128?i[t++]=s:(s<2048?i[t++]=s>>6|192:(s<65536?i[t++]=s>>12|224:(i[t++]=s>>18|240,i[t++]=s>>12&63|128),i[t++]=s>>6&63|128),i[t++]=s&63|128)}return t}class L1{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=An,this.supportedMediaTypes=null}getReadOptions(e,t){if(t){let n=t.dataProjection?De(t.dataProjection):this.readProjection(e);t.extent&&n&&n.getUnits()==="tile-pixels"&&(n=De(n),n.setWorldExtent(t.extent)),t={dataProjection:n,featureProjection:t.featureProjection}}return this.adaptOptions(t)}adaptOptions(e){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},e)}getType(){return we()}readFeature(e,t){return we()}readFeatures(e,t){return we()}readGeometry(e,t){return we()}readProjection(e){return we()}writeFeature(e,t){return we()}writeFeatures(e,t){return we()}writeGeometry(e,t){return we()}}function jh(i,e,t){const n=t?De(t.featureProjection):null,s=t?De(t.dataProjection):null;let o=i;if(n&&s&&!Wt(n,s)){e&&(o=i.clone());const r=e?n:s,a=e?s:n;r.getUnits()==="tile-pixels"?o.transform(r,a):o.applyTransform(Gi(r,a))}if(e&&t&&t.decimals!==void 0){const r=Math.pow(10,t.decimals),a=function(l){for(let c=0,h=l.length;c<h;++c)l[c]=Math.round(l[c]*r)/r;return l};o===i&&(o=i.clone()),o.applyTransform(a)}return o}const rI={Point:wn,LineString:Qn,Polygon:Kn,MultiPoint:er,MultiLineString:fo,MultiPolygon:_a};function aI(i,e,t){return Array.isArray(e[0])?(qm(i,0,e,t)||(i=i.slice(),ld(i,0,e,t)),i):(ad(i,0,e,t)||(i=i.slice(),pc(i,0,e,t)),i)}function z1(i,e){var o;const t=i.geometry;if(!t)return[];if(Array.isArray(t))return t.map(r=>z1({...i,geometry:r})).flat();const n=t.type==="MultiPolygon"?"Polygon":t.type;if(n==="GeometryCollection"||n==="Circle")throw new Error("Unsupported geometry type: "+n);const s=t.layout.length;return jh(new Bt(n,n==="Polygon"?aI(t.flatCoordinates,t.ends,s):t.flatCoordinates,(o=t.ends)==null?void 0:o.flat(),s,i.properties||{},i.id).enableSimplifyTransformed(),!1,e)}function gp(i,e){if(!i)return null;if(Array.isArray(i)){const n=i.map(s=>gp(s,e));return new Rc(n)}const t=rI[i.type];return jh(new t(i.flatCoordinates,i.layout||"XY",i.ends),!1,e)}class mp extends L1{constructor(e){super(),e=e||{},this.dataProjection=new ta({code:"",units:"tile-pixels"}),this.featureClass=e.featureClass?e.featureClass:Bt,this.geometryName_=e.geometryName,this.layerName_=e.layerName?e.layerName:"layer",this.layers_=e.layers?e.layers:null,this.idProperty_=e.idProperty,this.supportedMediaTypes=["application/vnd.mapbox-vector-tile","application/x-protobuf"]}readRawGeometry_(e,t,n,s){e.pos=t.geometry;const o=e.readVarint()+e.pos;let r=1,a=0,l=0,c=0,h=0,u=0;for(;e.pos<o;){if(!a){const d=e.readVarint();r=d&7,a=d>>3}if(a--,r===1||r===2)l+=e.readSVarint(),c+=e.readSVarint(),r===1&&h>u&&(s.push(h),u=h),n.push(l,c),h+=2;else if(r===7)h>u&&(n.push(n[u],n[u+1]),h+=2);else throw new Error("Invalid command found in the PBF")}h>u&&(s.push(h),u=h)}createFeature_(e,t,n){const s=t.type;if(s===0)return null;let o;const r=t.properties;let a;this.idProperty_?(a=r[this.idProperty_],delete r[this.idProperty_]):a=t.id,r[this.layerName_]=t.layer.name;const l=[],c=[];this.readRawGeometry_(e,t,l,c);const h=dI(s,c.length);if(this.featureClass===Bt)o=new this.featureClass(h,l,c,2,r,a),o.transform(n.dataProjection);else{let u;if(h=="Polygon"){const g=Vm(l,c);u=g.length>1?new _a(l,"XY",g):new Kn(l,"XY",c)}else u=h==="Point"?new wn(l,"XY"):h==="LineString"?new Qn(l,"XY"):h==="MultiPoint"?new er(l,"XY"):h==="MultiLineString"?new fo(l,"XY",c):null;const d=this.featureClass;o=new d,this.geometryName_&&o.setGeometryName(this.geometryName_);const f=jh(u,!1,n);o.setGeometry(f),a!==void 0&&o.setId(a),o.setProperties(r,!0)}return o}getType(){return"arraybuffer"}readFeatures(e,t){const n=this.layers_;t=this.adaptOptions(t);const s=De(t.dataProjection);s.setWorldExtent(t.extent),t.dataProjection=s;const o=new WT(e),r=o.readFields(lI,{}),a=[];for(const l in r){if(n&&!n.includes(l))continue;const c=r[l],h=c?[0,0,c.extent,c.extent]:null;s.setExtent(h);for(let u=0,d=c.length;u<d;++u){const f=uI(o,c,u),g=this.createFeature_(o,f,t);g!==null&&a.push(g)}}return a}readProjection(e){return this.dataProjection}setLayers(e){this.layers_=e}}function lI(i,e,t){if(i===3){const n={keys:[],values:[],features:[]},s=t.readVarint()+t.pos;t.readFields(cI,n,s),n.length=n.features.length,n.length&&(e[n.name]=n)}}function cI(i,e,t){if(i===15)e.version=t.readVarint();else if(i===1)e.name=t.readString();else if(i===5)e.extent=t.readVarint();else if(i===2)e.features.push(t.pos);else if(i===3)e.keys.push(t.readString());else if(i===4){let n=null;const s=t.readVarint()+t.pos;for(;t.pos<s;)i=t.readVarint()>>3,n=i===1?t.readString():i===2?t.readFloat():i===3?t.readDouble():i===4?t.readVarint64():i===5?t.readVarint():i===6?t.readSVarint():i===7?t.readBoolean():null;e.values.push(n)}}function hI(i,e,t){if(i==1)e.id=t.readVarint();else if(i==2){const n=t.readVarint()+t.pos;for(;t.pos<n;){const s=e.layer.keys[t.readVarint()],o=e.layer.values[t.readVarint()];e.properties[s]=o}}else i==3?e.type=t.readVarint():i==4&&(e.geometry=t.pos)}function uI(i,e,t){i.pos=e.features[t];const n=i.readVarint()+i.pos,s={layer:e,type:0,properties:{}};return i.readFields(hI,s,n),s}function dI(i,e){let t;return i===1?t=e===1?"Point":"MultiPoint":i===2?t=e===1?"LineString":"MultiLineString":i===3&&(t="Polygon"),t}var fI=8,pI={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},gI={"*":{type:"source"}},mI=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],yI={type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},_I={type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},wI={type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},vI={type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},bI={type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},EI={type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},CI={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},xI=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],PI={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},SI={"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},RI={"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},TI={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},II={"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},OI={"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},AI={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},MI={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},DI={type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},FI={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},LI={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},zI={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},NI={type:"array",value:"expression_name",minimum:1},kI={anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},jI={"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},UI={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},GI={type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},qI=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],VI={"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},WI={"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},BI={"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},$I={"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},HI={"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},XI={"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},YI={"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},ZI={"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},KI={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},QI={"*":{type:"string"}},JI={type:"array",value:"interpolation_name",minimum:1},eO={type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}},tO={$version:fI,$root:pI,sources:gI,source:mI,source_vector:yI,source_raster:_I,source_raster_dem:wI,source_geojson:vI,source_video:bI,source_image:EI,layer:CI,layout:xI,layout_background:PI,layout_fill:SI,layout_circle:RI,layout_heatmap:TI,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:II,layout_symbol:OI,layout_raster:AI,layout_hillshade:MI,"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:DI,filter_operator:FI,geometry_type:LI,function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:zI,expression:NI,light:kI,sky:jI,terrain:UI,projection:GI,paint:qI,paint_fill:VI,"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:WI,paint_circle:BI,paint_heatmap:$I,paint_symbol:HI,paint_raster:XI,paint_hillshade:YI,"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:ZI,transition:KI,"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:QI,interpolation:JI,interpolation_name:eO};const nO=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function iO(i,e){const t={};for(const n in i)n!=="ref"&&(t[n]=i[n]);return nO.forEach(n=>{n in e&&(t[n]=e[n])}),t}function sO(i){i=i.slice();const e=Object.create(null);for(let t=0;t<i.length;t++)e[i[t].id]=i[t];for(let t=0;t<i.length;t++)"ref"in i[t]&&(i[t]=iO(i[t],e[i[t].ref]));return i}class Ti extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class yp{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[n,s]of t)this.bindings[n]=s}concat(e){return new yp(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}}const Uh={kind:"null"},ne={kind:"number"},be={kind:"string"},Re={kind:"boolean"},Ii={kind:"color"},Gh={kind:"projectionDefinition"},Po={kind:"object"},Se={kind:"value"},oO={kind:"error"},qh={kind:"collator"},Vh={kind:"formatted"},Wh={kind:"padding"},Ja={kind:"colorArray"},Bh={kind:"numberArray"},el={kind:"resolvedImage"},$h={kind:"variableAnchorOffsetCollection"};function en(i,e){return{kind:"array",itemType:i,N:e}}function ut(i){if(i.kind==="array"){const e=ut(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}else return i.kind}const rO=[Uh,ne,be,Re,Ii,Gh,Vh,Po,en(Se),Wh,Bh,Ja,el,$h];function tl(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!tl(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const t of rO)if(!tl(t,e))return null}}return`Expected ${ut(i)} but found ${ut(e)} instead.`}function _p(i,e){return e.some(t=>t.kind===i.kind)}function So(i,e){return e.some(t=>t==="null"?i===null:t==="array"?Array.isArray(i):t==="object"?i&&!Array.isArray(i)&&typeof i=="object":t===typeof i)}function Ws(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const N1=.96422,k1=1,j1=.82521,U1=4/29,Ar=6/29,G1=3*Ar*Ar,aO=Ar*Ar*Ar,lO=Math.PI/180,cO=180/Math.PI;function q1(i){return i=i%360,i<0&&(i+=360),i}function V1([i,e,t,n]){i=wp(i),e=wp(e),t=wp(t);let s,o;const r=vp((.2225045*i+.7168786*e+.0606169*t)/k1);i===e&&e===t?s=o=r:(s=vp((.4360747*i+.3850649*e+.1430804*t)/N1),o=vp((.0139322*i+.0971045*e+.7141733*t)/j1));const a=116*r-16;return[a<0?0:a,500*(s-r),200*(r-o),n]}function wp(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function vp(i){return i>aO?Math.pow(i,1/3):i/G1+U1}function W1([i,e,t,n]){let s=(i+16)/116,o=isNaN(e)?s:s+e/500,r=isNaN(t)?s:s-t/200;return s=k1*Ep(s),o=N1*Ep(o),r=j1*Ep(r),[bp(3.1338561*o-1.6168667*s-.4906146*r),bp(-.9787684*o+1.9161415*s+.033454*r),bp(.0719453*o-.2289914*s+1.4052427*r),n]}function bp(i){return i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055,i<0?0:i>1?1:i}function Ep(i){return i>Ar?i*i*i:G1*(i-U1)}function hO(i){const[e,t,n,s]=V1(i),o=Math.sqrt(t*t+n*n);return[Math.round(o*1e4)?q1(Math.atan2(n,t)*cO):NaN,o,e,s]}function uO([i,e,t,n]){return i=isNaN(i)?0:i*lO,W1([t,Math.cos(i)*e,Math.sin(i)*e,n])}function dO([i,e,t,n]){i=q1(i),e/=100,t/=100;function s(o){const r=(o+i/30)%12,a=e*Math.min(t,1-t);return t-a*Math.max(-1,Math.min(r-3,9-r,1))}return[s(0),s(8),s(4),n]}const fO=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function B1(i,e){return fO(i,e)?i[e]:void 0}function pO(i){if(i=i.toLowerCase().trim(),i==="transparent")return[0,0,0,0];const e=B1(gO,i);if(e){const[s,o,r]=e;return[s/255,o/255,r/255,1]}if(i.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(i)){const o=i.length<6?1:2;let r=1;return[Hh(i.slice(r,r+=o)),Hh(i.slice(r,r+=o)),Hh(i.slice(r,r+=o)),Hh(i.slice(r,r+o)||"ff")]}if(i.startsWith("rgb")){const s=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,o=i.match(s);if(o){const[r,a,l,c,h,u,d,f,g,_,v,E]=o,w=[c||" ",d||" ",_].join("");if(w===" "||w===" /"||w===",,"||w===",,,"){const C=[l,u,g].join(""),P=C==="%%%"?100:C===""?255:0;if(P){const R=[Mr(+a/P,0,1),Mr(+h/P,0,1),Mr(+f/P,0,1),v?$1(+v,E):1];if(H1(R))return R}}return}}const t=/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,n=i.match(t);if(n){const[s,o,r,a,l,c,h,u,d]=n,f=[r||" ",l||" ",h].join("");if(f===" "||f===" /"||f===",,"||f===",,,"){const g=[+o,Mr(+a,0,100),Mr(+c,0,100),u?$1(+u,d):1];if(H1(g))return dO(g)}}}function Hh(i){return parseInt(i.padEnd(2,i),16)/255}function $1(i,e){return Mr(e?i/100:i,0,1)}function Mr(i,e,t){return Math.min(Math.max(e,i),t)}function H1(i){return!i.some(Number.isNaN)}const gO={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function Ro(i,e,t){return i+t*(e-i)}function nl(i,e,t){return i.map((n,s)=>Ro(n,e[s],t))}class ke{constructor(e,t,n,s=1,o=!0){this.r=e,this.g=t,this.b=n,this.a=s,o||(this.r*=s,this.g*=s,this.b*=s,s||this.overwriteGetter("rgb",[e,t,n,s]))}static parse(e){if(e instanceof ke)return e;if(typeof e!="string")return;const t=pO(e);if(t)return new ke(...t,!1)}get rgb(){const{r:e,g:t,b:n,a:s}=this,o=s||1/0;return this.overwriteGetter("rgb",[e/o,t/o,n/o,s])}get hcl(){return this.overwriteGetter("hcl",hO(this.rgb))}get lab(){return this.overwriteGetter("lab",V1(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){const[e,t,n,s]=this.rgb;return`rgba(${[e,t,n].map(o=>Math.round(o*255)).join(",")},${s})`}static interpolate(e,t,n,s="rgb"){switch(s){case"rgb":{const[o,r,a,l]=nl(e.rgb,t.rgb,n);return new ke(o,r,a,l,!1)}case"hcl":{const[o,r,a,l]=e.hcl,[c,h,u,d]=t.hcl;let f,g;if(!isNaN(o)&&!isNaN(c)){let C=c-o;c>o&&C>180?C-=360:c<o&&o-c>180&&(C+=360),f=o+n*C}else isNaN(o)?isNaN(c)?f=NaN:(f=c,(a===1||a===0)&&(g=h)):(f=o,(u===1||u===0)&&(g=r));const[_,v,E,w]=uO([f,g??Ro(r,h,n),Ro(a,u,n),Ro(l,d,n)]);return new ke(_,v,E,w,!1)}case"lab":{const[o,r,a,l]=W1(nl(e.lab,t.lab,n));return new ke(o,r,a,l,!1)}}}}ke.black=new ke(0,0,0,1),ke.white=new ke(1,1,1,1),ke.transparent=new ke(0,0,0,0),ke.red=new ke(1,0,0,1);class Cp{constructor(e,t,n){e?this.sensitivity=t?"variant":"case":this.sensitivity=t?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const mO=["bottom","center","top"];class xp{constructor(e,t,n,s,o,r){this.text=e,this.image=t,this.scale=n,this.fontStack=s,this.textColor=o,this.verticalAlign=r}}class ns{constructor(e){this.sections=e}static fromString(e){return new ns([new xp(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0?!0:!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof ns?e:ns.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class si{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof si)return e;if(typeof e=="number")return new si([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const t of e)if(typeof t!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]];break}return new si(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){return new si(nl(e.values,t.values,n))}}class oi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof oi)return e;if(typeof e=="number")return new oi([e]);if(Array.isArray(e)){for(const t of e)if(typeof t!="number")return;return new oi(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){return new oi(nl(e.values,t.values,n))}}class xn{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof xn)return e;if(typeof e=="string"){const n=ke.parse(e);return n?new xn([n]):void 0}if(!Array.isArray(e))return;const t=[];for(const n of e){if(typeof n!="string")return;const s=ke.parse(n);if(!s)return;t.push(s)}return new xn(t)}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n,s="rgb"){const o=[];if(e.values.length!=t.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${t.values.length}), cannot interpolate.`);for(let r=0;r<e.values.length;r++)o.push(ke.interpolate(e.values[r],t.values[r],n,s));return new xn(o)}}class yt extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}}const yO=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Oi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Oi)return e;if(!(!Array.isArray(e)||e.length<1||e.length%2!==0)){for(let t=0;t<e.length;t+=2){const n=e[t],s=e[t+1];if(typeof n!="string"||!yO.has(n)||!Array.isArray(s)||s.length!==2||typeof s[0]!="number"||typeof s[1]!="number")return}return new Oi(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){const s=e.values,o=t.values;if(s.length!==o.length)throw new yt(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${t.toString()}`);const r=[];for(let a=0;a<s.length;a+=2){if(s[a]!==o[a])throw new yt(`Cannot interpolate values containing mismatched anchors. from[${a}]: ${s[a]}, to[${a}]: ${o[a]}`);r.push(s[a]);const[l,c]=s[a+1],[h,u]=o[a+1];r.push([Ro(l,h,n),Ro(c,u,n)])}return new Oi(r)}}class Bs{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Bs({name:e,available:!1}):null}}class ri{constructor(e,t,n){this.from=e,this.to=t,this.transition=n}static interpolate(e,t,n){return new ri(e,t,n)}static parse(e){if(e instanceof ri)return e;if(Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number")return new ri(e[0],e[1],e[2]);if(typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number")return new ri(e.from,e.to,e.transition);if(typeof e=="string")return new ri(e,e,1)}}function X1(i,e,t,n){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255?typeof n>"u"||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[i,e,t,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[i,e,t,n]:[i,e,t]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function il(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof ri||i instanceof ke||i instanceof Cp||i instanceof ns||i instanceof si||i instanceof oi||i instanceof xn||i instanceof Oi||i instanceof Bs)return!0;if(Array.isArray(i)){for(const e of i)if(!il(e))return!1;return!0}else if(typeof i=="object"){for(const e in i)if(!il(i[e]))return!1;return!0}else return!1}function It(i){if(i===null)return Uh;if(typeof i=="string")return be;if(typeof i=="boolean")return Re;if(typeof i=="number")return ne;if(i instanceof ke)return Ii;if(i instanceof ri)return Gh;if(i instanceof Cp)return qh;if(i instanceof ns)return Vh;if(i instanceof si)return Wh;if(i instanceof oi)return Bh;if(i instanceof xn)return Ja;if(i instanceof Oi)return $h;if(i instanceof Bs)return el;if(Array.isArray(i)){const e=i.length;let t;for(const n of i){const s=It(n);if(!t)t=s;else{if(t===s)continue;t=Se;break}}return en(t||Se,e)}else return Po}function sl(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof ke||i instanceof ri||i instanceof ns||i instanceof si||i instanceof oi||i instanceof xn||i instanceof Oi||i instanceof Bs?i.toString():JSON.stringify(i)}class Dr{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(e.length!==2)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!il(e[1]))return t.error("invalid value");const n=e[1];let s=It(n);const o=t.expectedType;return s.kind==="array"&&s.N===0&&o&&o.kind==="array"&&(typeof o.N!="number"||o.N===0)&&(s=o),new Dr(s,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Xh={string:be,number:ne,boolean:Re,object:Po};class ai{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let n=1,s;const o=e[0];if(o==="array"){let a;if(e.length>2){const c=e[1];if(typeof c!="string"||!(c in Xh)||c==="object")return t.error('The item type argument of "array" must be one of string, number, boolean',1);a=Xh[c],n++}else a=Se;let l;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);l=e[2],n++}s=en(a,l)}else{if(!Xh[o])throw new Error(`Types doesn't contain name = ${o}`);s=Xh[o]}const r=[];for(;n<e.length;n++){const a=t.parse(e[n],n,Se);if(!a)return null;r.push(a)}return new ai(s,r)}evaluate(e){for(let t=0;t<this.args.length;t++){const n=this.args[t].evaluate(e);if(tl(this.type,It(n))){if(t===this.args.length-1)throw new yt(`Expected value to be of type ${ut(this.type)}, but found ${ut(It(n))} instead.`)}else return n}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Y1={"to-boolean":Re,"to-color":Ii,"to-number":ne,"to-string":be};class $s{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const n=e[0];if(!Y1[n])throw new Error(`Can't parse ${n} as it is not part of the known types`);if((n==="to-boolean"||n==="to-string")&&e.length!==2)return t.error("Expected one argument.");const s=Y1[n],o=[];for(let r=1;r<e.length;r++){const a=t.parse(e[r],r,Se);if(!a)return null;o.push(a)}return new $s(s,o)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let t,n;for(const s of this.args){if(t=s.evaluate(e),n=null,t instanceof ke)return t;if(typeof t=="string"){const o=e.parseColor(t);if(o)return o}else if(Array.isArray(t)&&(t.length<3||t.length>4?n=`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:n=X1(t[0],t[1],t[2],t[3]),!n))return new ke(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new yt(n||`Could not parse color from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"padding":{let t;for(const n of this.args){t=n.evaluate(e);const s=si.parse(t);if(s)return s}throw new yt(`Could not parse padding from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"numberArray":{let t;for(const n of this.args){t=n.evaluate(e);const s=oi.parse(t);if(s)return s}throw new yt(`Could not parse numberArray from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"colorArray":{let t;for(const n of this.args){t=n.evaluate(e);const s=xn.parse(t);if(s)return s}throw new yt(`Could not parse colorArray from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(const n of this.args){t=n.evaluate(e);const s=Oi.parse(t);if(s)return s}throw new yt(`Could not parse variableAnchorOffsetCollection from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(const n of this.args){if(t=n.evaluate(e),t===null)return 0;const s=Number(t);if(!isNaN(s))return s}throw new yt(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return ns.fromString(sl(this.args[0].evaluate(e)));case"resolvedImage":return Bs.fromString(sl(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return sl(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const _O=["Unknown","Point","LineString","Polygon"];class Z1{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?_O[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let t=this._parseColorCache.get(e);return t||(t=ke.parse(e),this._parseColorCache.set(e,t)),t}}class Yh{constructor(e,t,n=[],s,o=new yp,r=[]){this.registry=e,this.path=n,this.key=n.map(a=>`[${a}]`).join(""),this.scope=o,this.errors=r,this.expectedType=s,this._isConstant=t}parse(e,t,n,s,o={}){return t?this.concat(t,n,s)._parse(e,o):this._parse(e,o)}_parse(e,t){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);function n(s,o,r){return r==="assert"?new ai(o,[s]):r==="coerce"?new $s(o,[s]):s}if(Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const s=e[0];if(typeof s!="string")return this.error(`Expression name must be a string, but found ${typeof s} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const o=this.registry[s];if(o){let r=o.parse(e,this);if(!r)return null;if(this.expectedType){const a=this.expectedType,l=r.type;if((a.kind==="string"||a.kind==="number"||a.kind==="boolean"||a.kind==="object"||a.kind==="array")&&l.kind==="value")r=n(r,a,t.typeAnnotation||"assert");else if(a.kind==="projectionDefinition"&&["string","array"].includes(l.kind)||["color","formatted","resolvedImage"].includes(a.kind)&&["value","string"].includes(l.kind)||["padding","numberArray"].includes(a.kind)&&["value","number","array"].includes(l.kind)||a.kind==="colorArray"&&["value","string","array"].includes(l.kind)||a.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(l.kind))r=n(r,a,t.typeAnnotation||"coerce");else if(this.checkSubtype(a,l))return null}if(!(r instanceof Dr)&&r.type.kind!=="resolvedImage"&&this._isConstant(r)){const a=new Z1;try{r=new Dr(r.type,r.evaluate(a))}catch(l){return this.error(l.message),null}}return r}return this.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0)}else return typeof e>"u"?this.error("'undefined' value invalid. Use null instead."):typeof e=="object"?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,t,n){const s=typeof e=="number"?this.path.concat(e):this.path,o=n?this.scope.concat(n):this.scope;return new Yh(this.registry,this._isConstant,s,t||null,o,this.errors)}error(e,...t){const n=`${this.key}${t.map(s=>`[${s}]`).join("")}`;this.errors.push(new Ti(n,e))}checkSubtype(e,t){const n=tl(e,t);return n&&this.error(n),n}}class Zh{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const n=[];for(let o=1;o<e.length-1;o+=2){const r=e[o];if(typeof r!="string")return t.error(`Expected string, but found ${typeof r} instead.`,o);if(/[^a-zA-Z0-9_]/.test(r))return t.error("Variable names must contain only alphanumeric characters or '_'.",o);const a=t.parse(e[o+1],o+1);if(!a)return null;n.push([r,a])}const s=t.parse(e[e.length-1],e.length-1,t.expectedType,n);return s?new Zh(n,s):null}outputDefined(){return this.result.outputDefined()}}class Kh{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(e.length!==2||typeof e[1]!="string")return t.error("'var' expression requires exactly one string literal argument.");const n=e[1];return t.scope.has(n)?new Kh(n,t.scope.get(n)):t.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Pp{constructor(e,t,n){this.type=e,this.index=t,this.input=n}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,ne),s=t.parse(e[2],2,en(t.expectedType||Se));if(!n||!s)return null;const o=s.type;return new Pp(o.itemType,n,s)}evaluate(e){const t=this.index.evaluate(e),n=this.input.evaluate(e);if(t<0)throw new yt(`Array index out of bounds: ${t} < 0.`);if(t>=n.length)throw new yt(`Array index out of bounds: ${t} > ${n.length-1}.`);if(t!==Math.floor(t))throw new yt(`Array index must be an integer, but found ${t} instead.`);return n[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class Sp{constructor(e,t){this.type=Re,this.needle=e,this.haystack=t}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,Se),s=t.parse(e[2],2,Se);return!n||!s?null:_p(n.type,[Re,be,ne,Uh,Se])?new Sp(n,s):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${ut(n.type)} instead`)}evaluate(e){const t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!So(t,["boolean","string","number","null"]))throw new yt(`Expected first argument to be of type boolean, string, number or null, but found ${ut(It(t))} instead.`);if(!So(n,["string","array"]))throw new yt(`Expected second argument to be of type array or string, but found ${ut(It(n))} instead.`);return n.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Qh{constructor(e,t,n){this.type=ne,this.needle=e,this.haystack=t,this.fromIndex=n}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,Se),s=t.parse(e[2],2,Se);if(!n||!s)return null;if(!_p(n.type,[Re,be,ne,Uh,Se]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${ut(n.type)} instead`);if(e.length===4){const o=t.parse(e[3],3,ne);return o?new Qh(n,s,o):null}else return new Qh(n,s)}evaluate(e){const t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!So(t,["boolean","string","number","null"]))throw new yt(`Expected first argument to be of type boolean, string, number or null, but found ${ut(It(t))} instead.`);let s;if(this.fromIndex&&(s=this.fromIndex.evaluate(e)),So(n,["string"])){const o=n.indexOf(t,s);return o===-1?-1:[...n.slice(0,o)].length}else{if(So(n,["array"]))return n.indexOf(t,s);throw new yt(`Expected second argument to be of type array or string, but found ${ut(It(n))} instead.`)}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class Rp{constructor(e,t,n,s,o,r){this.inputType=e,this.type=t,this.input=n,this.cases=s,this.outputs=o,this.otherwise=r}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!==1)return t.error("Expected an even number of arguments.");let n,s;t.expectedType&&t.expectedType.kind!=="value"&&(s=t.expectedType);const o={},r=[];for(let c=2;c<e.length-1;c+=2){let h=e[c];const u=e[c+1];Array.isArray(h)||(h=[h]);const d=t.concat(c);if(h.length===0)return d.error("Expected at least one branch label.");for(const g of h){if(typeof g!="number"&&typeof g!="string")return d.error("Branch labels must be numbers or strings.");if(typeof g=="number"&&Math.abs(g)>Number.MAX_SAFE_INTEGER)return d.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof g=="number"&&Math.floor(g)!==g)return d.error("Numeric branch labels must be integer values.");if(!n)n=It(g);else if(d.checkSubtype(n,It(g)))return null;if(typeof o[String(g)]<"u")return d.error("Branch labels must be unique.");o[String(g)]=r.length}const f=t.parse(u,c,s);if(!f)return null;s=s||f.type,r.push(f)}const a=t.parse(e[1],1,Se);if(!a)return null;const l=t.parse(e[e.length-1],e.length-1,s);return!l||a.type.kind!=="value"&&t.concat(1).checkSubtype(n,a.type)?null:new Rp(n,s,a,o,r,l)}evaluate(e){const t=this.input.evaluate(e);return(It(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class Tp{constructor(e,t,n){this.type=e,this.branches=t,this.otherwise=n}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!==0)return t.error("Expected an odd number of arguments.");let n;t.expectedType&&t.expectedType.kind!=="value"&&(n=t.expectedType);const s=[];for(let r=1;r<e.length-1;r+=2){const a=t.parse(e[r],r,Re);if(!a)return null;const l=t.parse(e[r+1],r+1,n);if(!l)return null;s.push([a,l]),n=n||l.type}const o=t.parse(e[e.length-1],e.length-1,n);if(!o)return null;if(!n)throw new Error("Can't infer output type");return new Tp(n,s,o)}evaluate(e){for(const[t,n]of this.branches)if(t.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,n]of this.branches)e(t),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}}class Jh{constructor(e,t,n,s){this.type=e,this.input=t,this.beginIndex=n,this.endIndex=s}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,Se),s=t.parse(e[2],2,ne);if(!n||!s)return null;if(!_p(n.type,[en(Se),be,Se]))return t.error(`Expected first argument to be of type array or string, but found ${ut(n.type)} instead`);if(e.length===4){const o=t.parse(e[3],3,ne);return o?new Jh(n.type,n,s,o):null}else return new Jh(n.type,n,s)}evaluate(e){const t=this.input.evaluate(e),n=this.beginIndex.evaluate(e);let s;if(this.endIndex&&(s=this.endIndex.evaluate(e)),So(t,["string"]))return[...t].slice(n,s).join("");if(So(t,["array"]))return t.slice(n,s);throw new yt(`Expected first argument to be of type array or string, but found ${ut(It(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function K1(i,e){const t=i.length-1;let n=0,s=t,o=0,r,a;for(;n<=s;)if(o=Math.floor((n+s)/2),r=i[o],a=i[o+1],r<=e){if(o===t||e<a)return o;n=o+1}else if(r>e)s=o-1;else throw new yt("Input is not a number.");return 0}class eu{constructor(e,t,n){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[s,o]of n)this.labels.push(s),this.outputs.push(o)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return t.error("Expected an even number of arguments.");const n=t.parse(e[1],1,ne);if(!n)return null;const s=[];let o=null;t.expectedType&&t.expectedType.kind!=="value"&&(o=t.expectedType);for(let r=1;r<e.length;r+=2){const a=r===1?-1/0:e[r],l=e[r+1],c=r,h=r+1;if(typeof a!="number")return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',c);if(s.length&&s[s.length-1][0]>=a)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',c);const u=t.parse(l,h,o);if(!u)return null;o=o||u.type,s.push([a,u])}return new eu(o,n,s)}evaluate(e){const t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);const s=this.input.evaluate(e);if(s<=t[0])return n[0].evaluate(e);const o=t.length;if(s>=t[o-1])return n[o-1].evaluate(e);const r=K1(t,s);return n[r].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function wO(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Ip,Q1;function vO(){if(Q1)return Ip;Q1=1,Ip=i;function i(e,t,n,s){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(s-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=n,this.p2y=s}return i.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,s=0;s<8;s++){var o=this.sampleCurveX(n)-e;if(Math.abs(o)<t)return n;var r=this.sampleCurveDerivativeX(n);if(Math.abs(r)<1e-6)break;n=n-o/r}var a=0,l=1;for(n=e,s=0;s<20&&(o=this.sampleCurveX(n),!(Math.abs(o-e)<t));s++)e>o?a=n:l=n,n=(l-a)*.5+a;return n},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},Ip}var bO=vO(),EO=wO(bO);class Ai{constructor(e,t,n,s,o){this.type=e,this.operator=t,this.interpolation=n,this.input=s,this.labels=[],this.outputs=[];for(const[r,a]of o)this.labels.push(r),this.outputs.push(a)}static interpolationFactor(e,t,n,s){let o=0;if(e.name==="exponential")o=Op(t,e.base,n,s);else if(e.name==="linear")o=Op(t,1,n,s);else if(e.name==="cubic-bezier"){const r=e.controlPoints;o=new EO(r[0],r[1],r[2],r[3]).solve(Op(t,1,n,s))}return o}static parse(e,t){let[n,s,o,...r]=e;if(!Array.isArray(s)||s.length===0)return t.error("Expected an interpolation type expression.",1);if(s[0]==="linear")s={name:"linear"};else if(s[0]==="exponential"){const c=s[1];if(typeof c!="number")return t.error("Exponential interpolation requires a numeric base.",1,1);s={name:"exponential",base:c}}else if(s[0]==="cubic-bezier"){const c=s.slice(1);if(c.length!==4||c.some(h=>typeof h!="number"||h<0||h>1))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);s={name:"cubic-bezier",controlPoints:c}}else return t.error(`Unknown interpolation type ${String(s[0])}`,1,0);if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return t.error("Expected an even number of arguments.");if(o=t.parse(o,2,ne),!o)return null;const a=[];let l=null;(n==="interpolate-hcl"||n==="interpolate-lab")&&t.expectedType!=Ja?l=Ii:t.expectedType&&t.expectedType.kind!=="value"&&(l=t.expectedType);for(let c=0;c<r.length;c+=2){const h=r[c],u=r[c+1],d=c+3,f=c+4;if(typeof h!="number")return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',d);if(a.length&&a[a.length-1][0]>=h)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',d);const g=t.parse(u,f,l);if(!g)return null;l=l||g.type,a.push([h,g])}return!Ws(l,ne)&&!Ws(l,Gh)&&!Ws(l,Ii)&&!Ws(l,Wh)&&!Ws(l,Bh)&&!Ws(l,Ja)&&!Ws(l,$h)&&!Ws(l,en(ne))?t.error(`Type ${ut(l)} is not interpolatable.`):new Ai(l,n,s,o,a)}evaluate(e){const t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);const s=this.input.evaluate(e);if(s<=t[0])return n[0].evaluate(e);const o=t.length;if(s>=t[o-1])return n[o-1].evaluate(e);const r=K1(t,s),a=t[r],l=t[r+1],c=Ai.interpolationFactor(this.interpolation,s,a,l),h=n[r].evaluate(e),u=n[r+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Ro(h,u,c);case"color":return ke.interpolate(h,u,c);case"padding":return si.interpolate(h,u,c);case"colorArray":return xn.interpolate(h,u,c);case"numberArray":return oi.interpolate(h,u,c);case"variableAnchorOffsetCollection":return Oi.interpolate(h,u,c);case"array":return nl(h,u,c);case"projectionDefinition":return ri.interpolate(h,u,c)}case"interpolate-hcl":switch(this.type.kind){case"color":return ke.interpolate(h,u,c,"hcl");case"colorArray":return xn.interpolate(h,u,c,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return ke.interpolate(h,u,c,"lab");case"colorArray":return xn.interpolate(h,u,c,"lab")}}}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Op(i,e,t,n){const s=n-t,o=i-t;return s===0?0:e===1?o/s:(Math.pow(e,o)-1)/(Math.pow(e,s)-1)}class ol{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let n=null;const s=t.expectedType;s&&s.kind!=="value"&&(n=s);const o=[];for(const a of e.slice(1)){const l=t.parse(a,1+o.length,n,void 0,{typeAnnotation:"omit"});if(!l)return null;n=n||l.type,o.push(l)}if(!n)throw new Error("No output type");return s&&o.some(a=>tl(s,a.type))?new ol(Se,o):new ol(n,o)}evaluate(e){let t=null,n=0,s;for(const o of this.args)if(n++,t=o.evaluate(e),t&&t instanceof Bs&&!t.available&&(s||(s=t.name),t=null,n===this.args.length&&(t=s)),t!==null)break;return t}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}function J1(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function CO(i,e,t){return e===t}function xO(i,e,t){return e!==t}function PO(i,e,t){return e<t}function SO(i,e,t){return e>t}function RO(i,e,t){return e<=t}function TO(i,e,t){return e>=t}function ew(i,e,t,n){return n.compare(e,t)===0}function IO(i,e,t,n){return!ew(i,e,t,n)}function OO(i,e,t,n){return n.compare(e,t)<0}function AO(i,e,t,n){return n.compare(e,t)>0}function MO(i,e,t,n){return n.compare(e,t)<=0}function DO(i,e,t,n){return n.compare(e,t)>=0}function Fr(i,e,t){const n=i!=="=="&&i!=="!=";return class _v{constructor(o,r,a){this.type=Re,this.lhs=o,this.rhs=r,this.collator=a,this.hasUntypedArgument=o.type.kind==="value"||r.type.kind==="value"}static parse(o,r){if(o.length!==3&&o.length!==4)return r.error("Expected two or three arguments.");const a=o[0];let l=r.parse(o[1],1,Se);if(!l)return null;if(!J1(a,l.type))return r.concat(1).error(`"${a}" comparisons are not supported for type '${ut(l.type)}'.`);let c=r.parse(o[2],2,Se);if(!c)return null;if(!J1(a,c.type))return r.concat(2).error(`"${a}" comparisons are not supported for type '${ut(c.type)}'.`);if(l.type.kind!==c.type.kind&&l.type.kind!=="value"&&c.type.kind!=="value")return r.error(`Cannot compare types '${ut(l.type)}' and '${ut(c.type)}'.`);n&&(l.type.kind==="value"&&c.type.kind!=="value"?l=new ai(c.type,[l]):l.type.kind!=="value"&&c.type.kind==="value"&&(c=new ai(l.type,[c])));let h=null;if(o.length===4){if(l.type.kind!=="string"&&c.type.kind!=="string"&&l.type.kind!=="value"&&c.type.kind!=="value")return r.error("Cannot use collator to compare non-string types.");if(h=r.parse(o[3],3,qh),!h)return null}return new _v(l,c,h)}evaluate(o){const r=this.lhs.evaluate(o),a=this.rhs.evaluate(o);if(n&&this.hasUntypedArgument){const l=It(r),c=It(a);if(l.kind!==c.kind||!(l.kind==="string"||l.kind==="number"))throw new yt(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${l.kind}, ${c.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const l=It(r),c=It(a);if(l.kind!=="string"||c.kind!=="string")return e(o,r,a)}return this.collator?t(o,r,a,this.collator.evaluate(o)):e(o,r,a)}eachChild(o){o(this.lhs),o(this.rhs),this.collator&&o(this.collator)}outputDefined(){return!0}}}const FO=Fr("==",CO,ew),LO=Fr("!=",xO,IO),zO=Fr("<",PO,OO),NO=Fr(">",SO,AO),kO=Fr("<=",RO,MO),jO=Fr(">=",TO,DO);class tu{constructor(e,t,n){this.type=qh,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(e.length!==2)return t.error("Expected one argument.");const n=e[1];if(typeof n!="object"||Array.isArray(n))return t.error("Collator options argument must be an object.");const s=t.parse(n["case-sensitive"]===void 0?!1:n["case-sensitive"],1,Re);if(!s)return null;const o=t.parse(n["diacritic-sensitive"]===void 0?!1:n["diacritic-sensitive"],1,Re);if(!o)return null;let r=null;return n.locale&&(r=t.parse(n.locale,1,be),!r)?null:new tu(s,o,r)}evaluate(e){return new Cp(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class Ap{constructor(e,t,n,s,o,r){this.type=be,this.number=e,this.locale=t,this.currency=n,this.unit=s,this.minFractionDigits=o,this.maxFractionDigits=r}static parse(e,t){if(e.length!==3)return t.error("Expected two arguments.");const n=t.parse(e[1],1,ne);if(!n)return null;const s=e[2];if(typeof s!="object"||Array.isArray(s))return t.error("NumberFormat options argument must be an object.");let o=null;if(s.locale&&(o=t.parse(s.locale,1,be),!o))return null;let r=null;if(s.currency&&(r=t.parse(s.currency,1,be),!r))return null;let a=null;if(s.unit&&(a=t.parse(s.unit,1,be),!a))return null;if(r&&a)return t.error("NumberFormat options `currency` and `unit` are mutually exclusive");let l=null;if(s["min-fraction-digits"]&&(l=t.parse(s["min-fraction-digits"],1,ne),!l))return null;let c=null;return s["max-fraction-digits"]&&(c=t.parse(s["max-fraction-digits"],1,ne),!c)?null:new Ap(n,o,r,a,l,c)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class Mp{constructor(e){this.type=Vh,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const n=e[1];if(!Array.isArray(n)&&typeof n=="object")return t.error("First argument must be an image or text section.");const s=[];let o=!1;for(let r=1;r<=e.length-1;++r){const a=e[r];if(o&&typeof a=="object"&&!Array.isArray(a)){o=!1;let l=null;if(a["font-scale"]&&(l=t.parse(a["font-scale"],1,ne),!l))return null;let c=null;if(a["text-font"]&&(c=t.parse(a["text-font"],1,en(be)),!c))return null;let h=null;if(a["text-color"]&&(h=t.parse(a["text-color"],1,Ii),!h))return null;let u=null;if(a["vertical-align"]){if(typeof a["vertical-align"]=="string"&&!mO.includes(a["vertical-align"]))return t.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${a["vertical-align"]}' instead.`);if(u=t.parse(a["vertical-align"],1,be),!u)return null}const d=s[s.length-1];d.scale=l,d.font=c,d.textColor=h,d.verticalAlign=u}else{const l=t.parse(e[r],1,Se);if(!l)return null;const c=l.type.kind;if(c!=="string"&&c!=="value"&&c!=="null"&&c!=="resolvedImage")return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");o=!0,s.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Mp(s)}evaluate(e){const t=n=>{const s=n.content.evaluate(e);return It(s)===el?new xp("",s,null,null,null,n.verticalAlign?n.verticalAlign.evaluate(e):null):new xp(sl(s),null,n.scale?n.scale.evaluate(e):null,n.font?n.font.evaluate(e).join(","):null,n.textColor?n.textColor.evaluate(e):null,n.verticalAlign?n.verticalAlign.evaluate(e):null)};return new ns(this.sections.map(t))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor),t.verticalAlign&&e(t.verticalAlign)}outputDefined(){return!1}}class Dp{constructor(e){this.type=el,this.input=e}static parse(e,t){if(e.length!==2)return t.error("Expected two arguments.");const n=t.parse(e[1],1,be);return n?new Dp(n):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),n=Bs.fromString(t);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(t)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}}class Fp{constructor(e){this.type=ne,this.input=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const n=t.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?t.error(`Expected argument of type string or array, but found ${ut(n.type)} instead.`):new Fp(n):null}evaluate(e){const t=this.input.evaluate(e);if(typeof t=="string")return[...t].length;if(Array.isArray(t))return t.length;throw new yt(`Expected value to be of type string or array, but found ${ut(It(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Mi=8192;function UO(i,e){const t=GO(i[0]),n=VO(i[1]),s=Math.pow(2,e.z);return[Math.round(t*s*Mi),Math.round(n*s*Mi)]}function Lp(i,e){const t=Math.pow(2,e.z),n=(i[0]/Mi+e.x)/t,s=(i[1]/Mi+e.y)/t;return[qO(n),WO(s)]}function GO(i){return(180+i)/360}function qO(i){return i*360-180}function VO(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function WO(i){return 360/Math.PI*Math.atan(Math.exp((180-i*360)*Math.PI/180))-90}function rl(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function al(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function BO(i,e,t){return e[1]>i[1]!=t[1]>i[1]&&i[0]<(t[0]-e[0])*(i[1]-e[1])/(t[1]-e[1])+e[0]}function $O(i,e,t){const n=i[0]-e[0],s=i[1]-e[1],o=i[0]-t[0],r=i[1]-t[1];return n*r-o*s===0&&n*o<=0&&s*r<=0}function nu(i,e,t,n){const s=[e[0]-i[0],e[1]-i[1]],o=[n[0]-t[0],n[1]-t[1]];return ZO(o,s)===0?!1:!!(nw(i,e,t,n)&&nw(t,n,i,e))}function HO(i,e,t){for(const n of t)for(let s=0;s<n.length-1;++s)if(nu(i,e,n[s],n[s+1]))return!0;return!1}function Lr(i,e,t=!1){let n=!1;for(const s of e)for(let o=0;o<s.length-1;o++){if($O(i,s[o],s[o+1]))return t;BO(i,s[o],s[o+1])&&(n=!n)}return n}function XO(i,e){for(const t of e)if(Lr(i,t))return!0;return!1}function tw(i,e){for(const t of i)if(!Lr(t,e))return!1;for(let t=0;t<i.length-1;++t)if(HO(i[t],i[t+1],e))return!1;return!0}function YO(i,e){for(const t of e)if(tw(i,t))return!0;return!1}function ZO(i,e){return i[0]*e[1]-i[1]*e[0]}function nw(i,e,t,n){const s=i[0]-t[0],o=i[1]-t[1],r=e[0]-t[0],a=e[1]-t[1],l=n[0]-t[0],c=n[1]-t[1],h=s*c-l*o,u=r*c-l*a;return h>0&&u<0||h<0&&u>0}function zp(i,e,t){const n=[];for(let s=0;s<i.length;s++){const o=[];for(let r=0;r<i[s].length;r++){const a=UO(i[s][r],t);rl(e,a),o.push(a)}n.push(o)}return n}function iw(i,e,t){const n=[];for(let s=0;s<i.length;s++){const o=zp(i[s],e,t);n.push(o)}return n}function sw(i,e,t,n){if(i[0]<t[0]||i[0]>t[2]){const s=n*.5;let o=i[0]-t[0]>s?-n:t[0]-i[0]>s?n:0;o===0&&(o=i[0]-t[2]>s?-n:t[2]-i[0]>s?n:0),i[0]+=o}rl(e,i)}function KO(i){i[0]=i[1]=1/0,i[2]=i[3]=-1/0}function ow(i,e,t,n){const s=Math.pow(2,n.z)*Mi,o=[n.x*Mi,n.y*Mi],r=[];for(const a of i)for(const l of a){const c=[l.x+o[0],l.y+o[1]];sw(c,e,t,s),r.push(c)}return r}function rw(i,e,t,n){const s=Math.pow(2,n.z)*Mi,o=[n.x*Mi,n.y*Mi],r=[];for(const a of i){const l=[];for(const c of a){const h=[c.x+o[0],c.y+o[1]];rl(e,h),l.push(h)}r.push(l)}if(e[2]-e[0]<=s/2){KO(e);for(const a of r)for(const l of a)sw(l,e,t,s)}return r}function QO(i,e){const t=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],s=i.canonicalID();if(e.type==="Polygon"){const o=zp(e.coordinates,n,s),r=ow(i.geometry(),t,n,s);if(!al(t,n))return!1;for(const a of r)if(!Lr(a,o))return!1}if(e.type==="MultiPolygon"){const o=iw(e.coordinates,n,s),r=ow(i.geometry(),t,n,s);if(!al(t,n))return!1;for(const a of r)if(!XO(a,o))return!1}return!0}function JO(i,e){const t=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],s=i.canonicalID();if(e.type==="Polygon"){const o=zp(e.coordinates,n,s),r=rw(i.geometry(),t,n,s);if(!al(t,n))return!1;for(const a of r)if(!tw(a,o))return!1}if(e.type==="MultiPolygon"){const o=iw(e.coordinates,n,s),r=rw(i.geometry(),t,n,s);if(!al(t,n))return!1;for(const a of r)if(!YO(a,o))return!1}return!0}class To{constructor(e,t){this.type=Re,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(il(e[1])){const n=e[1];if(n.type==="FeatureCollection"){const s=[];for(const o of n.features){const{type:r,coordinates:a}=o.geometry;r==="Polygon"&&s.push(a),r==="MultiPolygon"&&s.push(...a)}if(s.length){const o={type:"MultiPolygon",coordinates:s};return new To(n,o)}}else if(n.type==="Feature"){const s=n.geometry.type;if(s==="Polygon"||s==="MultiPolygon")return new To(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new To(n,n)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return QO(e,this.geometries);if(e.geometryType()==="LineString")return JO(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class aw{constructor(e=[],t=(n,s)=>n<s?-1:n>s?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:n}=this,s=t[e];for(;e>0;){const o=e-1>>1,r=t[o];if(n(s,r)>=0)break;t[e]=r,e=o}t[e]=s}_down(e){const{data:t,compare:n}=this,s=this.length>>1,o=t[e];for(;e<s;){let r=(e<<1)+1;const a=r+1;if(a<this.length&&n(t[a],t[r])<0&&(r=a),n(t[r],o)>=0)break;t[e]=t[r],e=r}t[e]=o}}function e2(i,e){if(i.length<=1)return[i];const n=[];let s,o;for(const r of i){const a=t2(r);a!==0&&(r.area=Math.abs(a),o===void 0&&(o=a<0),o===a<0?(s&&n.push(s),s=[r]):s.push(r))}return s&&n.push(s),n}function t2(i){let e=0;for(let t=0,n=i.length,s=n-1,o,r;t<n;s=t++)o=i[t],r=i[s],e+=(r.x-o.x)*(o.y+r.y);return e}const n2=6378.137,lw=1/298.257223563,cw=lw*(2-lw),hw=Math.PI/180;class Np{constructor(e){const t=hw*n2*1e3,n=Math.cos(e*hw),s=1/(1-cw*(1-n*n)),o=Math.sqrt(s);this.kx=t*o*n,this.ky=t*o*s*(1-cw)}distance(e,t){const n=this.wrap(e[0]-t[0])*this.kx,s=(e[1]-t[1])*this.ky;return Math.sqrt(n*n+s*s)}pointOnLine(e,t){let n=1/0,s,o,r,a;for(let l=0;l<e.length-1;l++){let c=e[l][0],h=e[l][1],u=this.wrap(e[l+1][0]-c)*this.kx,d=(e[l+1][1]-h)*this.ky,f=0;(u!==0||d!==0)&&(f=(this.wrap(t[0]-c)*this.kx*u+(t[1]-h)*this.ky*d)/(u*u+d*d),f>1?(c=e[l+1][0],h=e[l+1][1]):f>0&&(c+=u/this.kx*f,h+=d/this.ky*f)),u=this.wrap(t[0]-c)*this.kx,d=(t[1]-h)*this.ky;const g=u*u+d*d;g<n&&(n=g,s=c,o=h,r=l,a=f)}return{point:[s,o],index:r,t:Math.max(0,Math.min(1,a))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}const kp=100,jp=50;function uw(i,e){return e[0]-i[0]}function iu(i){return i[1]-i[0]+1}function is(i,e){return i[1]>=i[0]&&i[1]<e}function Up(i,e){if(i[0]>i[1])return[null,null];const t=iu(i);if(e){if(t===2)return[i,null];const s=Math.floor(t/2);return[[i[0],i[0]+s],[i[0]+s,i[1]]]}if(t===1)return[i,null];const n=Math.floor(t/2)-1;return[[i[0],i[0]+n],[i[0]+n+1,i[1]]]}function Gp(i,e){if(!is(e,i.length))return[1/0,1/0,-1/0,-1/0];const t=[1/0,1/0,-1/0,-1/0];for(let n=e[0];n<=e[1];++n)rl(t,i[n]);return t}function qp(i){const e=[1/0,1/0,-1/0,-1/0];for(const t of i)for(const n of t)rl(e,n);return e}function dw(i){return i[0]!==-1/0&&i[1]!==-1/0&&i[2]!==1/0&&i[3]!==1/0}function Vp(i,e,t){if(!dw(i)||!dw(e))return NaN;let n=0,s=0;return i[2]<e[0]&&(n=e[0]-i[2]),i[0]>e[2]&&(n=i[0]-e[2]),i[1]>e[3]&&(s=i[1]-e[3]),i[3]<e[1]&&(s=e[1]-i[3]),t.distance([0,0],[n,s])}function Io(i,e,t){const n=t.pointOnLine(e,i);return t.distance(i,n.point)}function Wp(i,e,t,n,s){const o=Math.min(Io(i,[t,n],s),Io(e,[t,n],s)),r=Math.min(Io(t,[i,e],s),Io(n,[i,e],s));return Math.min(o,r)}function i2(i,e,t,n,s){if(!(is(e,i.length)&&is(n,t.length)))return 1/0;let r=1/0;for(let a=e[0];a<e[1];++a){const l=i[a],c=i[a+1];for(let h=n[0];h<n[1];++h){const u=t[h],d=t[h+1];if(nu(l,c,u,d))return 0;r=Math.min(r,Wp(l,c,u,d,s))}}return r}function s2(i,e,t,n,s){if(!(is(e,i.length)&&is(n,t.length)))return NaN;let r=1/0;for(let a=e[0];a<=e[1];++a)for(let l=n[0];l<=n[1];++l)if(r=Math.min(r,s.distance(i[a],t[l])),r===0)return r;return r}function o2(i,e,t){if(Lr(i,e,!0))return 0;let n=1/0;for(const s of e){const o=s[0],r=s[s.length-1];if(o!==r&&(n=Math.min(n,Io(i,[r,o],t)),n===0))return n;const a=t.pointOnLine(s,i);if(n=Math.min(n,t.distance(i,a.point)),n===0)return n}return n}function r2(i,e,t,n){if(!is(e,i.length))return NaN;for(let o=e[0];o<=e[1];++o)if(Lr(i[o],t,!0))return 0;let s=1/0;for(let o=e[0];o<e[1];++o){const r=i[o],a=i[o+1];for(const l of t)for(let c=0,h=l.length,u=h-1;c<h;u=c++){const d=l[u],f=l[c];if(nu(r,a,d,f))return 0;s=Math.min(s,Wp(r,a,d,f,n))}}return s}function fw(i,e){for(const t of i)for(const n of t)if(Lr(n,e,!0))return!0;return!1}function a2(i,e,t,n=1/0){const s=qp(i),o=qp(e);if(n!==1/0&&Vp(s,o,t)>=n)return n;if(al(s,o)){if(fw(i,e))return 0}else if(fw(e,i))return 0;let r=1/0;for(const a of i)for(let l=0,c=a.length,h=c-1;l<c;h=l++){const u=a[h],d=a[l];for(const f of e)for(let g=0,_=f.length,v=_-1;g<_;v=g++){const E=f[v],w=f[g];if(nu(u,d,E,w))return 0;r=Math.min(r,Wp(u,d,E,w,t))}}return r}function pw(i,e,t,n,s,o){if(!o)return;const r=Vp(Gp(n,o),s,t);r<e&&i.push([r,o,[0,0]])}function su(i,e,t,n,s,o,r){if(!o||!r)return;const a=Vp(Gp(n,o),Gp(s,r),t);a<e&&i.push([a,o,r])}function ou(i,e,t,n,s=1/0){let o=Math.min(n.distance(i[0],t[0][0]),s);if(o===0)return o;const r=new aw([[0,[0,i.length-1],[0,0]]],uw),a=qp(t);for(;r.length>0;){const l=r.pop();if(l[0]>=o)continue;const c=l[1],h=e?jp:kp;if(iu(c)<=h){if(!is(c,i.length))return NaN;if(e){const u=r2(i,c,t,n);if(isNaN(u)||u===0)return u;o=Math.min(o,u)}else for(let u=c[0];u<=c[1];++u){const d=o2(i[u],t,n);if(o=Math.min(o,d),o===0)return 0}}else{const u=Up(c,e);pw(r,o,n,i,a,u[0]),pw(r,o,n,i,a,u[1])}}return o}function ru(i,e,t,n,s,o=1/0){let r=Math.min(o,s.distance(i[0],t[0]));if(r===0)return r;const a=new aw([[0,[0,i.length-1],[0,t.length-1]]],uw);for(;a.length>0;){const l=a.pop();if(l[0]>=r)continue;const c=l[1],h=l[2],u=e?jp:kp,d=n?jp:kp;if(iu(c)<=u&&iu(h)<=d){if(!is(c,i.length)&&is(h,t.length))return NaN;let f;if(e&&n)f=i2(i,c,t,h,s),r=Math.min(r,f);else if(e&&!n){const g=i.slice(c[0],c[1]+1);for(let _=h[0];_<=h[1];++_)if(f=Io(t[_],g,s),r=Math.min(r,f),r===0)return r}else if(!e&&n){const g=t.slice(h[0],h[1]+1);for(let _=c[0];_<=c[1];++_)if(f=Io(i[_],g,s),r=Math.min(r,f),r===0)return r}else f=s2(i,c,t,h,s),r=Math.min(r,f)}else{const f=Up(c,e),g=Up(h,n);su(a,r,s,i,t,f[0],g[0]),su(a,r,s,i,t,f[0],g[1]),su(a,r,s,i,t,f[1],g[0]),su(a,r,s,i,t,f[1],g[1])}}return r}function l2(i,e){const t=i.geometry(),n=t.flat().map(r=>Lp([r.x,r.y],i.canonical));if(t.length===0)return NaN;const s=new Np(n[0][1]);let o=1/0;for(const r of e){switch(r.type){case"Point":o=Math.min(o,ru(n,!1,[r.coordinates],!1,s,o));break;case"LineString":o=Math.min(o,ru(n,!1,r.coordinates,!0,s,o));break;case"Polygon":o=Math.min(o,ou(n,!1,r.coordinates,s,o));break}if(o===0)return o}return o}function c2(i,e){const t=i.geometry(),n=t.flat().map(r=>Lp([r.x,r.y],i.canonical));if(t.length===0)return NaN;const s=new Np(n[0][1]);let o=1/0;for(const r of e){switch(r.type){case"Point":o=Math.min(o,ru(n,!0,[r.coordinates],!1,s,o));break;case"LineString":o=Math.min(o,ru(n,!0,r.coordinates,!0,s,o));break;case"Polygon":o=Math.min(o,ou(n,!0,r.coordinates,s,o));break}if(o===0)return o}return o}function h2(i,e){const t=i.geometry();if(t.length===0||t[0].length===0)return NaN;const n=e2(t).map(r=>r.map(a=>a.map(l=>Lp([l.x,l.y],i.canonical)))),s=new Np(n[0][0][0][1]);let o=1/0;for(const r of e)for(const a of n){switch(r.type){case"Point":o=Math.min(o,ou([r.coordinates],!1,a,s,o));break;case"LineString":o=Math.min(o,ou(r.coordinates,!0,a,s,o));break;case"Polygon":o=Math.min(o,a2(a,r.coordinates,s,o));break}if(o===0)return o}return o}function Bp(i){return i.type==="MultiPolygon"?i.coordinates.map(e=>({type:"Polygon",coordinates:e})):i.type==="MultiLineString"?i.coordinates.map(e=>({type:"LineString",coordinates:e})):i.type==="MultiPoint"?i.coordinates.map(e=>({type:"Point",coordinates:e})):[i]}class Oo{constructor(e,t){this.type=ne,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(il(e[1])){const n=e[1];if(n.type==="FeatureCollection")return new Oo(n,n.features.map(s=>Bp(s.geometry)).flat());if(n.type==="Feature")return new Oo(n,Bp(n.geometry));if("type"in n&&"coordinates"in n)return new Oo(n,Bp(n))}return t.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return l2(e,this.geometries);if(e.geometryType()==="LineString")return c2(e,this.geometries);if(e.geometryType()==="Polygon")return h2(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class ll{constructor(e){this.type=Se,this.key=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const n=e[1];return n==null?t.error("Global state property must be defined."):typeof n!="string"?t.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new ll(n)}evaluate(e){var t;const n=(t=e.globals)===null||t===void 0?void 0:t.globalState;return!n||Object.keys(n).length===0?null:B1(n,this.key)}eachChild(){}outputDefined(){return!1}}const au={"==":FO,"!=":LO,">":NO,"<":zO,">=":jO,"<=":kO,array:ai,at:Pp,boolean:ai,case:Tp,coalesce:ol,collator:tu,format:Mp,image:Dp,in:Sp,"index-of":Qh,interpolate:Ai,"interpolate-hcl":Ai,"interpolate-lab":Ai,length:Fp,let:Zh,literal:Dr,match:Rp,number:ai,"number-format":Ap,object:ai,slice:Jh,step:eu,string:ai,"to-boolean":$s,"to-color":$s,"to-number":$s,"to-string":$s,var:Kh,within:To,distance:Oo,"global-state":ll};class Pn{constructor(e,t,n,s){this.name=e,this.type=t,this._evaluate=n,this.args=s}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){const n=e[0],s=Pn.definitions[n];if(!s)return t.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const o=Array.isArray(s)?s[0]:s.type,r=Array.isArray(s)?[[s[1],s[2]]]:s.overloads,a=r.filter(([c])=>!Array.isArray(c)||c.length===e.length-1);let l=null;for(const[c,h]of a){l=new Yh(t.registry,lu,t.path,null,t.scope);const u=[];let d=!1;for(let f=1;f<e.length;f++){const g=e[f],_=Array.isArray(c)?c[f-1]:c.type,v=l.parse(g,1+u.length,_);if(!v){d=!0;break}u.push(v)}if(!d){if(Array.isArray(c)&&c.length!==u.length){l.error(`Expected ${c.length} arguments, but found ${u.length} instead.`);continue}for(let f=0;f<u.length;f++){const g=Array.isArray(c)?c[f]:c.type,_=u[f];l.concat(f+1).checkSubtype(g,_.type)}if(l.errors.length===0)return new Pn(n,o,h,u)}}if(a.length===1)t.errors.push(...l.errors);else{const h=(a.length?a:r).map(([d])=>d2(d)).join(" | "),u=[];for(let d=1;d<e.length;d++){const f=t.parse(e[d],1+u.length);if(!f)return null;u.push(ut(f.type))}t.error(`Expected arguments of type ${h}, but found (${u.join(", ")}) instead.`)}return null}static register(e,t){Pn.definitions=t;for(const n in t)e[n]=Pn}}function gw(i,[e,t,n,s]){e=e.evaluate(i),t=t.evaluate(i),n=n.evaluate(i);const o=s?s.evaluate(i):1,r=X1(e,t,n,o);if(r)throw new yt(r);return new ke(e/255,t/255,n/255,o,!1)}function mw(i,e){return i in e}function $p(i,e){const t=e[i];return typeof t>"u"?null:t}function u2(i,e,t,n){for(;t<=n;){const s=t+n>>1;if(e[s]===i)return!0;e[s]>i?n=s-1:t=s+1}return!1}function Ao(i){return{type:i}}Pn.register(au,{error:[oO,[be],(i,[e])=>{throw new yt(e.evaluate(i))}],typeof:[be,[Se],(i,[e])=>ut(It(e.evaluate(i)))],"to-rgba":[en(ne,4),[Ii],(i,[e])=>{const[t,n,s,o]=e.evaluate(i).rgb;return[t*255,n*255,s*255,o]}],rgb:[Ii,[ne,ne,ne],gw],rgba:[Ii,[ne,ne,ne,ne],gw],has:{type:Re,overloads:[[[be],(i,[e])=>mw(e.evaluate(i),i.properties())],[[be,Po],(i,[e,t])=>mw(e.evaluate(i),t.evaluate(i))]]},get:{type:Se,overloads:[[[be],(i,[e])=>$p(e.evaluate(i),i.properties())],[[be,Po],(i,[e,t])=>$p(e.evaluate(i),t.evaluate(i))]]},"feature-state":[Se,[be],(i,[e])=>$p(e.evaluate(i),i.featureState||{})],properties:[Po,[],i=>i.properties()],"geometry-type":[be,[],i=>i.geometryType()],id:[Se,[],i=>i.id()],zoom:[ne,[],i=>i.globals.zoom],"heatmap-density":[ne,[],i=>i.globals.heatmapDensity||0],elevation:[ne,[],i=>i.globals.elevation||0],"line-progress":[ne,[],i=>i.globals.lineProgress||0],accumulated:[Se,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[ne,Ao(ne),(i,e)=>{let t=0;for(const n of e)t+=n.evaluate(i);return t}],"*":[ne,Ao(ne),(i,e)=>{let t=1;for(const n of e)t*=n.evaluate(i);return t}],"-":{type:ne,overloads:[[[ne,ne],(i,[e,t])=>e.evaluate(i)-t.evaluate(i)],[[ne],(i,[e])=>-e.evaluate(i)]]},"/":[ne,[ne,ne],(i,[e,t])=>e.evaluate(i)/t.evaluate(i)],"%":[ne,[ne,ne],(i,[e,t])=>e.evaluate(i)%t.evaluate(i)],ln2:[ne,[],()=>Math.LN2],pi:[ne,[],()=>Math.PI],e:[ne,[],()=>Math.E],"^":[ne,[ne,ne],(i,[e,t])=>Math.pow(e.evaluate(i),t.evaluate(i))],sqrt:[ne,[ne],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[ne,[ne],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[ne,[ne],(i,[e])=>Math.log(e.evaluate(i))],log2:[ne,[ne],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[ne,[ne],(i,[e])=>Math.sin(e.evaluate(i))],cos:[ne,[ne],(i,[e])=>Math.cos(e.evaluate(i))],tan:[ne,[ne],(i,[e])=>Math.tan(e.evaluate(i))],asin:[ne,[ne],(i,[e])=>Math.asin(e.evaluate(i))],acos:[ne,[ne],(i,[e])=>Math.acos(e.evaluate(i))],atan:[ne,[ne],(i,[e])=>Math.atan(e.evaluate(i))],min:[ne,Ao(ne),(i,e)=>Math.min(...e.map(t=>t.evaluate(i)))],max:[ne,Ao(ne),(i,e)=>Math.max(...e.map(t=>t.evaluate(i)))],abs:[ne,[ne],(i,[e])=>Math.abs(e.evaluate(i))],round:[ne,[ne],(i,[e])=>{const t=e.evaluate(i);return t<0?-Math.round(-t):Math.round(t)}],floor:[ne,[ne],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[ne,[ne],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[Re,[be,Se],(i,[e,t])=>i.properties()[e.value]===t.value],"filter-id-==":[Re,[Se],(i,[e])=>i.id()===e.value],"filter-type-==":[Re,[be],(i,[e])=>i.geometryType()===e.value],"filter-<":[Re,[be,Se],(i,[e,t])=>{const n=i.properties()[e.value],s=t.value;return typeof n==typeof s&&n<s}],"filter-id-<":[Re,[Se],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t<n}],"filter->":[Re,[be,Se],(i,[e,t])=>{const n=i.properties()[e.value],s=t.value;return typeof n==typeof s&&n>s}],"filter-id->":[Re,[Se],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t>n}],"filter-<=":[Re,[be,Se],(i,[e,t])=>{const n=i.properties()[e.value],s=t.value;return typeof n==typeof s&&n<=s}],"filter-id-<=":[Re,[Se],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t<=n}],"filter->=":[Re,[be,Se],(i,[e,t])=>{const n=i.properties()[e.value],s=t.value;return typeof n==typeof s&&n>=s}],"filter-id->=":[Re,[Se],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t>=n}],"filter-has":[Re,[Se],(i,[e])=>e.value in i.properties()],"filter-has-id":[Re,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Re,[en(be)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[Re,[en(Se)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[Re,[be,en(Se)],(i,[e,t])=>t.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[Re,[be,en(Se)],(i,[e,t])=>u2(i.properties()[e.value],t.value,0,t.value.length-1)],all:{type:Re,overloads:[[[Re,Re],(i,[e,t])=>e.evaluate(i)&&t.evaluate(i)],[Ao(Re),(i,e)=>{for(const t of e)if(!t.evaluate(i))return!1;return!0}]]},any:{type:Re,overloads:[[[Re,Re],(i,[e,t])=>e.evaluate(i)||t.evaluate(i)],[Ao(Re),(i,e)=>{for(const t of e)if(t.evaluate(i))return!0;return!1}]]},"!":[Re,[Re],(i,[e])=>!e.evaluate(i)],"is-supported-script":[Re,[be],(i,[e])=>{const t=i.globals&&i.globals.isSupportedScript;return t?t(e.evaluate(i)):!0}],upcase:[be,[be],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[be,[be],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[be,Ao(Se),(i,e)=>e.map(t=>sl(t.evaluate(i))).join("")],split:[en(be),[be,be],(i,[e,t])=>e.evaluate(i).split(t.evaluate(i))],join:[be,[en(be),be],(i,[e,t])=>e.evaluate(i).join(t.evaluate(i))],"resolved-locale":[be,[qh],(i,[e])=>e.evaluate(i).resolvedLocale()]});function d2(i){return Array.isArray(i)?`(${i.map(ut).join(", ")})`:`(${ut(i.type)}...)`}function lu(i){if(i instanceof Kh)return lu(i.boundExpression);if(i instanceof Pn&&i.name==="error")return!1;if(i instanceof tu)return!1;if(i instanceof To)return!1;if(i instanceof Oo)return!1;if(i instanceof ll)return!1;const e=i instanceof $s||i instanceof ai;let t=!0;return i.eachChild(n=>{e?t=t&&lu(n):t=t&&n instanceof Dr}),t?Hp(i)&&Yp(i,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function Hp(i){if(i instanceof Pn){if(i.name==="get"&&i.args.length===1)return!1;if(i.name==="feature-state")return!1;if(i.name==="has"&&i.args.length===1)return!1;if(i.name==="properties"||i.name==="geometry-type"||i.name==="id")return!1;if(/^filter-/.test(i.name))return!1}if(i instanceof To||i instanceof Oo)return!1;let e=!0;return i.eachChild(t=>{e&&!Hp(t)&&(e=!1)}),e}function Xp(i){if(i instanceof Pn&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(t=>{e&&!Xp(t)&&(e=!1)}),e}function Yp(i,e){if(i instanceof Pn&&e.indexOf(i.name)>=0)return!1;let t=!0;return i.eachChild(n=>{t&&!Yp(n,e)&&(t=!1)}),t}function Zp(i){return{result:"success",value:i}}function zr(i){return{result:"error",value:i}}function f2(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function p2(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function g2(i){return!!i.expression&&i.expression.interpolated}function cu(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)&&It(i)===Po}class m2{constructor(e,t,n){this.expression=e,this._warningHistory={},this._evaluator=new Z1,this._defaultValue=t?_2(t):null,this._enumValues=t&&t.type==="enum"?t.values:null,this._globalState=n}evaluateWithoutErrorHandling(e,t,n,s,o,r){return this._globalState&&(e=Nr(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=n,this._evaluator.canonical=s,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=r,this.expression.evaluate(this._evaluator)}evaluate(e,t,n,s,o,r){this._globalState&&(e=Nr(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=n||null,this._evaluator.canonical=s,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=r||null;try{const a=this.expression.evaluate(this._evaluator);if(a==null||typeof a=="number"&&a!==a)return this._defaultValue;if(this._enumValues&&!(a in this._enumValues))throw new yt(`Expected value to be one of ${Object.keys(this._enumValues).map(l=>JSON.stringify(l)).join(", ")}, but found ${JSON.stringify(a)} instead.`);return a}catch(a){return this._warningHistory[a.message]||(this._warningHistory[a.message]=!0,typeof console<"u"&&console.warn(a.message)),this._defaultValue}}}function hu(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in au}function yw(i,e,t){const n=new Yh(au,lu,[],e?y2(e):void 0),s=n.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?Zp(new m2(s,e,t)):zr(n.errors)}class _w{constructor(e,t,n){this.kind=e,this._styleExpression=t,this.isStateDependent=e!=="constant"&&!Xp(t.expression),this.globalStateRefs=du(t.expression),this._globalState=n}evaluateWithoutErrorHandling(e,t,n,s,o,r){return this._globalState&&(e=Nr(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,n,s,o,r)}evaluate(e,t,n,s,o,r){return this._globalState&&(e=Nr(e,this._globalState)),this._styleExpression.evaluate(e,t,n,s,o,r)}}class ww{constructor(e,t,n,s,o){this.kind=e,this.zoomStops=n,this._styleExpression=t,this.isStateDependent=e!=="camera"&&!Xp(t.expression),this.globalStateRefs=du(t.expression),this.interpolationType=s,this._globalState=o}evaluateWithoutErrorHandling(e,t,n,s,o,r){return this._globalState&&(e=Nr(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,n,s,o,r)}evaluate(e,t,n,s,o,r){return this._globalState&&(e=Nr(e,this._globalState)),this._styleExpression.evaluate(e,t,n,s,o,r)}interpolationFactor(e,t,n){return this.interpolationType?Ai.interpolationFactor(this.interpolationType,e,t,n):0}}function vw(i,e,t){const n=yw(i,e,t);if(n.result==="error")return n;const s=n.value.expression,o=Hp(s);if(!o&&!f2(e))return zr([new Ti("","data expressions not supported")]);const r=Yp(s,["zoom"]);if(!r&&!p2(e))return zr([new Ti("","zoom expressions not supported")]);const a=uu(s);if(!a&&!r)return zr([new Ti("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(a instanceof Ti)return zr([a]);if(a instanceof Ai&&!g2(e))return zr([new Ti("",'"interpolate" expressions cannot be used with this property')]);if(!a)return Zp(o?new _w("constant",n.value,t):new _w("source",n.value,t));const l=a instanceof Ai?a.interpolation:void 0;return Zp(o?new ww("camera",n.value,a.labels,l,t):new ww("composite",n.value,a.labels,l,t))}function uu(i){let e=null;if(i instanceof Zh)e=uu(i.result);else if(i instanceof ol){for(const t of i.args)if(e=uu(t),e)break}else(i instanceof eu||i instanceof Ai)&&i.input instanceof Pn&&i.input.name==="zoom"&&(e=i);return e instanceof Ti||i.eachChild(t=>{const n=uu(t);n instanceof Ti?e=n:!e&&n?e=new Ti("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&n&&e!==n&&(e=new Ti("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function du(i,e=new Set){return i instanceof ll&&e.add(i.key),i.eachChild(t=>{du(t,e)}),e}function y2(i){const e={color:Ii,string:be,number:ne,enum:be,boolean:Re,formatted:Vh,padding:Wh,numberArray:Bh,colorArray:Ja,projectionDefinition:Gh,resolvedImage:el,variableAnchorOffsetCollection:$h};return i.type==="array"?en(e[i.value]||Se,i.length):e[i.type]}function _2(i){if(i.type==="color"&&cu(i.default))return new ke(0,0,0,0);switch(i.type){case"color":return ke.parse(i.default)||null;case"padding":return si.parse(i.default)||null;case"numberArray":return oi.parse(i.default)||null;case"colorArray":return xn.parse(i.default)||null;case"variableAnchorOffsetCollection":return Oi.parse(i.default)||null;case"projectionDefinition":return ri.parse(i.default)||null;default:return i.default===void 0?null:i.default}}function Nr(i,e){const{zoom:t,heatmapDensity:n,elevation:s,lineProgress:o,isSupportedScript:r,accumulated:a}=i??{};return{zoom:t,heatmapDensity:n,elevation:s,lineProgress:o,isSupportedScript:r,accumulated:a,globalState:e}}function bw(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!bw(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const w2={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function v2(i,e){if(i==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};bw(i)||(i=fu(i));const t=yw(i,w2,e);if(t.result==="error")throw new Error(t.value.map(n=>`${n.key}: ${n.message}`).join(", "));{const n=Ew(i);return{filter:(s,o,r)=>t.value.evaluate(s,o,{},r),needGeometry:n,getGlobalStateRefs:()=>du(t.value.expression)}}}function b2(i,e){return i<e?-1:i>e?1:0}function Ew(i){if(!Array.isArray(i))return!1;if(i[0]==="within"||i[0]==="distance")return!0;for(let e=1;e<i.length;e++)if(Ew(i[e]))return!0;return!1}function fu(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?Kp(i[1],i[2],"=="):e==="!="?pu(Kp(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Kp(i[1],i[2],e):e==="any"?E2(i.slice(1)):e==="all"?["all"].concat(i.slice(1).map(fu)):e==="none"?["all"].concat(i.slice(1).map(fu).map(pu)):e==="in"?Cw(i[1],i.slice(2)):e==="!in"?pu(Cw(i[1],i.slice(2))):e==="has"?xw(i[1]):e==="!has"?pu(xw(i[1])):!0}function Kp(i,e,t){switch(i){case"$type":return[`filter-type-${t}`,e];case"$id":return[`filter-id-${t}`,e];default:return[`filter-${t}`,i,e]}}function E2(i){return["any"].concat(i.map(fu))}function Cw(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(t=>typeof t!=typeof e[0])?["filter-in-large",i,["literal",e.sort(b2)]]:["filter-in-small",i,["literal",e]]}}function xw(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function pu(i){return["!",i]}function cl(i){return typeof i=="object"?["literal",i]:i}function Pw(i,e){let t=i.stops;if(!t)return C2(i,e);const n=t&&typeof t[0][0]=="object",s=n||i.property!==void 0,o=n||!s;return t=t.map(r=>!s&&e.tokens&&typeof r[1]=="string"?[r[0],R2(r[1])]:[r[0],cl(r[1])]),n?x2(i,e,t):o?S2(i,e,t):Jp(i,e,t)}function C2(i,e){const t=["get",i.property];if(i.default===void 0)return e.type==="string"?["string",t]:t;if(e.type==="enum")return["match",t,Object.keys(e.values),t,i.default];{const n=[e.type==="color"?"to-color":e.type,t,cl(i.default)];return e.type==="array"&&n.splice(1,0,e.value,e.length||null),n}}function Qp(i){switch(i.colorSpace){case"hcl":return"interpolate-hcl";case"lab":return"interpolate-lab";default:return"interpolate"}}function x2(i,e,t){const n={},s={},o=[];for(let a=0;a<t.length;a++){const l=t[a],c=l[0].zoom;n[c]===void 0&&(n[c]={zoom:c,type:i.type,property:i.property,default:i.default},s[c]=[],o.push(c)),s[c].push([l[0].value,l[1]])}if(tg({},e)==="exponential"){const a=[Qp(i),["linear"],["zoom"]];for(const l of o){const c=Jp(n[l],e,s[l]);kr(a,l,c,!1)}return a}else{const a=["step",["zoom"]];for(const l of o){const c=Jp(n[l],e,s[l]);kr(a,l,c,!0)}return eg(a),a}}function P2(i,e){if(i!==void 0)return i;if(e!==void 0)return e}function Sw(i,e){const t=cl(P2(i.default,e.default));return t===void 0&&e.type==="resolvedImage"?"":t}function Jp(i,e,t){const n=tg(i,e),s=["get",i.property];if(n==="categorical"&&typeof t[0][0]=="boolean"){const o=["case"];for(const r of t)o.push(["==",s,r[0]],r[1]);return o.push(Sw(i,e)),o}else if(n==="categorical"){const o=["match",s];for(const r of t)kr(o,r[0],r[1],!1);return o.push(Sw(i,e)),o}else if(n==="interval"){const o=["step",["number",s]];for(const r of t)kr(o,r[0],r[1],!0);return eg(o),i.default===void 0?o:["case",["==",["typeof",s],"number"],o,cl(i.default)]}else if(n==="exponential"){const o=i.base!==void 0?i.base:1,r=[Qp(i),o===1?["linear"]:["exponential",o],["number",s]];for(const a of t)kr(r,a[0],a[1],!1);return i.default===void 0?r:["case",["==",["typeof",s],"number"],r,cl(i.default)]}else throw new Error(`Unknown property function type ${n}`)}function S2(i,e,t,n=["zoom"]){const s=tg(i,e);let o,r=!1;if(s==="interval")o=["step",n],r=!0;else if(s==="exponential"){const a=i.base!==void 0?i.base:1;o=[Qp(i),a===1?["linear"]:["exponential",a],n]}else throw new Error(`Unknown zoom function type "${s}"`);for(const a of t)kr(o,a[0],a[1],r);return eg(o),o}function eg(i){i[0]==="step"&&i.length===3&&(i.push(0),i.push(i[3]))}function kr(i,e,t,n){i.length>3&&e===i[i.length-2]||(n&&i.length===2||i.push(e),i.push(t))}function tg(i,e){return i.type?i.type:e.expression.interpolated?"exponential":"interval"}function R2(i){const e=["concat"],t=/{([^{}]+)}/g;let n=0;for(let s=t.exec(i);s!==null;s=t.exec(i)){const o=i.slice(n,t.lastIndex-s[0].length);n=t.lastIndex,o.length>0&&e.push(o),e.push(["get",s[1]])}if(e.length===1)return i;if(n<i.length)e.push(i.slice(n));else if(e.length===2)return["to-string",e[1]];return e}const Rw=tO;var Tw={thin:100,hairline:100,"ultra-light":200,"extra-light":200,light:300,book:300,regular:400,normal:400,plain:400,roman:400,standard:400,medium:500,"semi-bold":600,"demi-bold":600,bold:700,"extra-bold":800,"ultra-bold":800,heavy:900,black:900,"heavy-black":900,fat:900,poster:900,"ultra-black":950,"extra-black":950},hl=" ",Iw=/(italic|oblique)$/i,Ow={};function ng(i,e,t){var n=Ow[i];if(!n){Array.isArray(i)||(i=[i]);for(var s=400,o="normal",r=[],a,l,c=0,h=i.length;c<h;++c){var u=i[c],d=u.split(" "),f=d[d.length-1].toLowerCase();f=="normal"||f=="italic"||f=="oblique"?(o=l?o:f,l=!0,d.pop(),f=d[d.length-1].toLowerCase()):Iw.test(f)&&(f=f.replace(Iw,""),o=l?o:d[d.length-1].replace(f,""),l=!0);for(var g in Tw){var _=d.length>1?d[d.length-2].toLowerCase():"";if(f==g||f==g.replace("-","")||_+"-"+f==g){s=a?s:Tw[g],d.pop(),_&&g.startsWith(_)&&d.pop();break}}!a&&typeof f=="number"&&(s=f,a=!0);var v=d.join(hl).replace("Klokantech Noto Sans","Noto Sans").replace("DIN Pro","Barlow").replace("Arial Unicode MS","Arial");v.indexOf(hl)!==-1&&(v='"'+v+'"'),r.push(v)}n=Ow[i]=[o,s,r]}return n[0]+hl+n[1]+hl+e+"px"+(t?"/"+t:"")+hl+n[2]}function Aw(i,[e,t,n,s]){e=e.evaluate(i),t=t.evaluate(i),n=n.evaluate(i);const o=s?s.evaluate(i):1;return ke.parse(`hsla(${e}, ${t}%, ${n}%, ${o})`)}function T2(i){const e=i[0]/255,t=i[1]/255,n=i[2]/255,s=i[3],o=Math.max(e,t,n),r=Math.min(e,t,n),a=(o+r)/2;let l,c;if(o===r)l=0,c=0;else{const h=o-r;switch(c=a>.5?h/(2-o-r):h/(o+r),o){case e:l=(t-n)/h+(t<n?6:0);break;case t:l=(n-e)/h+2;break;case n:l=(e-t)/h+4;break;default:l=0}l/=6}return[l*360,c*100,a*100,s]}function gu(i){if(Array.isArray(i)){if(i.length===0)return i;const e=i[0];if(e==="literal")return i;if(e==="image"&&i.length===3&&typeof i[2]=="object"&&i[2]!==null&&!Array.isArray(i[2]))return["image-config",gu(i[1]),["literal",i[2]]];const t=i.length;for(let n=1;n<t;++n){const s=i[n],o=gu(s);if(o!==s){const r=[e];for(let a=1;a<n;++a)r.push(i[a]);r.push(o);for(let a=n+1;a<t;++a)r.push(gu(i[a]));return r}}}return i}const Mw={},Mo={zoom:0,distanceFromCenter:0};Pn.register(au,{...Pn.definitions,pitch:[{kind:"number"},[],i=>Mo.pitch||0],"distance-from-center":[{kind:"number"},[],i=>Mo.distanceFromCenter||0],"to-hsla":[{kind:"array",itemType:{kind:"number"},N:4},[{kind:"string"}],(i,[e])=>T2(wc(e.evaluate(i)))],hsl:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"}],Aw],hsla:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"},{kind:"number"}],Aw],"image-config":[{kind:"value"},[{kind:"string"},{kind:"value"}],(i,[e,t])=>e.evaluate(i)],"measure-light":[{kind:"number"},[{kind:"value"}],()=>1],config:[{kind:"value"},[{kind:"string"}],(i,[e])=>{const t=Mw[e.evaluate(i)];return t===void 0?{}:t}]});const Dw="https://api.mapbox.com";function ig(i){const e="mapbox://";return i.indexOf(e)!==0?"":i.slice(e.length)}function I2(i,e,t){if(typeof i=="string")return[{id:"default",url:Fw(i,e,t)}];for(const n of i)n.url=Fw(n.url,e,t);return i}function Fw(i,e,t){const n=ig(i);if(!n)return decodeURI(new URL(i,t).href);const s="sprites/";if(n.indexOf(s)!==0)throw new Error(`unexpected sprites url: ${i}`);const o=n.slice(s.length);return`${Dw}/styles/v1/${o}/sprite?access_token=${e}`}function Lw(i,e){const t=ig(i);if(!t)return decodeURI(new URL(i,location.href).href);const n="styles/";if(t.indexOf(n)!==0)throw new Error(`unexpected style url: ${i}`);const s=t.slice(n.length);return`${Dw}/styles/v1/${s}?&access_token=${e}`}const O2=["a","b","c","d"];function mu(i,e,t,n){const s=new URL(i,n||location.href),o=ig(i);if(!o)return e?(s.searchParams.has(t)||s.searchParams.set(t,e),[decodeURI(s.href)]):[decodeURI(s.href)];if(o==="mapbox.satellite"){const r=globalThis.devicePixelRatio>=1.5?"@2x":"";return[`https://api.mapbox.com/v4/${o}/{z}/{x}/{y}${r}.webp?access_token=${e}`]}return O2.map(r=>`https://${r}.tiles.mapbox.com/v4/${o}/{z}/{x}/{y}.vector.pbf?access_token=${e}`)}const sg=Object.freeze({}),zw={},Nw={};let A2=0;function og(i){return i.id||(i.id=A2++),i.id}function M2(i,e){return og(i)+"."+Pe(e)}function D2(i){let e=zw[i.id];return e||(e={},zw[og(i)]=e),e}function F2(i){let e=Nw[i.id];return e||(e={},Nw[og(i)]=e),e}function rg(i){return i*Math.PI/180}const ag=(function(){const i=[];for(let e=78271.51696402048;i.length<=24;e/=2)i.push(e);return i})();function yu(i,e){if(typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof OffscreenCanvas<"u")return new OffscreenCanvas(i,e);const t=document.createElement("canvas");return t.width=i,t.height=e,t}function L2(i,e){let t=0;const n=e.length;for(;t<n;++t)if(e[t]<i&&t+1<n){const o=e[t]/e[t+1];return t+Math.log(e[t]/i)/Math.log(o)}return n-1}function z2(i,e){const t=Math.floor(i),n=Math.pow(2,i-t);return e[t]/n}const jr={};function Ur(i,e,t={},n){if(e in jr)return n&&(n.url=jr[e][0].url),jr[e][1];const s=t.transformRequest&&t.transformRequest(e,i)||e,o=function(l){return delete jr[e],Promise.reject(new Error("Error fetching source "+e))},r=function(l){return delete jr[e],l.ok?l.json():Promise.reject(new Error("Error fetching source "+e))},a=$o(()=>s).then(l=>l instanceof Response?(n&&(n.url=l.url),r(l)):(l instanceof Request||(l=new Request(l)),l.headers.get("Accept")||l.headers.set("Accept","application/json"),n&&(n.url=l.url),fetch(l).then(r).catch(o))).catch(o);return jr[e]=[s,a],a}function N2(i,e){if(typeof i=="string")if(i.trim().startsWith("{"))try{const t=JSON.parse(i);return Promise.resolve(t)}catch(t){return Promise.reject(t)}else return i=Lw(i,e.accessToken),Ur("Style",i,e);else return Promise.resolve(i)}const kw={};function k2(i,e,t={}){const n=[e,JSON.stringify(i)].toString();let s=kw[n];if(!s||t.transformRequest){let o;t.transformRequest&&(o=(a,l)=>{const c=t.transformRequest&&t.transformRequest(l,"Tiles")||l;if(a instanceof zi.VectorTile)a.setLoader((h,u,d)=>{const f=function(g){g.arrayBuffer().then(_=>{const E=a.getFormat().readFeatures(_,{extent:h,featureProjection:d});a.setFeatures(E)})};$o(()=>c).then(g=>{if(g instanceof Response)return f(g);fetch(g).then(f).catch(_=>a.setState(se.ERROR))}).catch(g=>a.setState(se.ERROR))});else{const h=a.getImage();$o(()=>c).then(u=>{if(typeof u=="string"){h.src=u;return}const d=f=>f.blob().then(g=>{const _=URL.createObjectURL(g);h.addEventListener("load",()=>URL.revokeObjectURL(_)),h.addEventListener("error",()=>URL.revokeObjectURL(_)),h.src=_});if(u instanceof Response)return d(u);fetch(u).then(d).catch(f=>a.setState(se.ERROR))}).catch(u=>a.setState(se.ERROR))}});const r=i.url;if(r&&!i.tiles){const a=mu(r,t.accessToken,t.accessTokenParam||"access_token",e||location.href);if(r.startsWith("mapbox://"))s=Promise.resolve({tileJson:Object.assign({},i,{url:void 0,tiles:a}),tileLoadFunction:o});else{const l={};s=Ur("Source",a[0],t,l).then(function(c){return c.tiles=c.tiles.map(function(h){return c.scheme==="tms"&&(h=h.replace("{y}","{-y}")),mu(h,t.accessToken,t.accessTokenParam||"access_token",l.url)[0]}),Promise.resolve({tileJson:c,tileLoadFunction:o})})}}else i.tiles?(i=Object.assign({},i,{tiles:i.tiles.map(function(a){return i.scheme==="tms"&&(a=a.replace("{y}","{-y}")),mu(a,t.accessToken,t.accessTokenParam||"access_token",e||location.href)[0]})}),s=Promise.resolve({tileJson:Object.assign({},i),tileLoadFunction:o})):s=Promise.reject(new Error("source has no `tiles` nor `url`"));kw[n]=s}return s}function jw(i,e,t,n){const s=[2*t*e.pixelRatio+e.width,2*t*e.pixelRatio+e.height],o=yu(s[0],s[1]),r=o.getContext("2d");r.drawImage(i,e.x,e.y,e.width,e.height,t*e.pixelRatio,t*e.pixelRatio,e.width,e.height);const a=r.getImageData(0,0,s[0],s[1]);r.globalCompositeOperation="destination-over",r.fillStyle=`rgba(${n.r*255},${n.g*255},${n.b*255},${n.a})`;const l=a.data;for(let c=0,h=a.width;c<h;++c)for(let u=0,d=a.height;u<d;++u){const f=(u*h+c)*4;l[f+3]>0&&r.arc(c,u,t*e.pixelRatio,0,2*Math.PI)}return r.fill(),o}function j2(i,e,t){const n=Math.max(0,Math.min(1,(t-i)/(e-i)));return n*n*(3-2*n)}function Uw(i,e,t){const n=yu(e.width,e.height),s=n.getContext("2d");s.drawImage(i,e.x,e.y,e.width,e.height,0,0,e.width,e.height);const o=s.getImageData(0,0,e.width,e.height),r=o.data;for(let a=0,l=o.width;a<l;++a)for(let c=0,h=o.height;c<h;++c){const u=(c*l+a)*4,d=r[u+3]/255,f=.75,g=.1,_=j2(f-g,f+g,d);_>0?(r[u+0]=Math.round(255*t.r*_),r[u+1]=Math.round(255*t.g*_),r[u+2]=Math.round(255*t.b*_),r[u+3]=Math.round(255*_)):r[u+3]=0}return s.putImageData(o,0,0),n}const U2=Array(256).join(" ");function lg(i,e){if(e>=.05){let t="";const n=i.split(`
|
|
159
|
-
`),s=
|
|
160
|
-
`),
|
|
161
|
-
`)!==-1){const
|
|
162
|
-
`),a=[];for(let l=0,c=
|
|
163
|
-
`)}const s=
|
|
164
|
-
`)}else o=i;o=lg(o,n),_u[s]=o}return o}const q2=["Arial","Courier New","Times New Roman","Verdana","sans-serif","serif","monospace","cursive","fantasy"],qw={};function V2(i,e="https://cdn.jsdelivr.net/npm/@fontsource/{font-family}/{fontweight}{-fontstyle}.css"){if(hn)return i;let t;for(let n=0,s=i.length;n<s;++n){const o=i[n];if(o in qw)continue;qw[o]=!0;const a=ng(o,16).split(" ");t||(t=[]),t.push([a.slice(3).join(" ").replace(/"/g,""),a[1],a[0]])}return t&&(async()=>{await document.fonts.ready;for(let n=0,s=t.length;n<s;++n){const o=t[n],r=o[0];if(q2.includes(r))continue;const a=o[1],l=o[2];if(!(await document.fonts.load(`${l} ${a} 16px "${r}"`)).some(h=>h.family.replace(/^['"]|['"]$/g,"").toLowerCase()===r.toLowerCase()&&G2(h.weight,a)&&h.style===l)){const h=e.replace("{font-family}",r.replace(/ /g,"-").toLowerCase()).replace("{Font+Family}",r.replace(/ /g,"+")).replace("{fontweight}",a).replace("{-fontstyle}",l.replace("normal","").replace(/(.+)/,"-$1")).replace("{fontstyle}",l);if(!document.querySelector('link[href="'+h+'"]')){const u=document.createElement("link");u.href=h,u.rel="stylesheet",document.head.appendChild(u)}}}})(),i}const W2={Point:1,MultiPoint:1,LineString:2,MultiLineString:2,Polygon:3,MultiPolygon:3},B2={center:[.5,.5],left:[0,.5],right:[1,.5],top:[.5,0],bottom:[.5,1],"top-left":[0,0],"top-right":[1,0],"bottom-left":[0,1],"bottom-right":[1,1]},Vw=function(i,e){let t=vw(i,e);if(t.result==="error"){const n=gu(i);n!==i&&(t=vw(n,e))}if(t.result==="error"){const n=t.value[0];return console.error("Error parsing expression:",i,n.key,n.message),{evaluate:()=>e.default}}return t.value};let wu,ug;function de(i,e,t,n,s,o){const r=i.id;s||(s={},console.warn("No functionCache provided to getValue()")),s[r]||(s[r]={});const a=s[r];if(!a[t]){let l=(i[e]||sg)[t];const c=Rw[`${e}_${i.type}`]&&Rw[`${e}_${i.type}`][t];l===void 0&&c&&(l=c.default);let h=hu(l);if(!h&&cu(l)&&(l=Pw(l,c),h=!0),h){const u=Vw(l,c);a[t]=u.evaluate.bind(u)}else{const u=c?c.type:typeof l;(u==="color"||u==="colorArray")&&(l=ke.parse(l));let d=!1;if(u==="array")for(let f=0;f<l.length;++f){const g=l[f];if(hu(g)||cu(g)){d=!0;break}}if(d){const f=Object.assign({},c,{type:c.value}),g=[];for(let _=0;_<l.length;++_){let v=l[_];if(!hu(v)&&cu(v)&&(v=Pw(v,f)),hu(v)){const E=Vw(v,f);g.push(E.evaluate.bind(E))}else g.push(function(){return v})}a[t]=function(_,v,E){const w=[];for(let C=0;C<g.length;++C)w[C]=g[C](_,v,E);return w}}else a[t]=function(){return l}}}return a[t](Mo,n,o)}function Ww(i,e,t,n){return de(i,"layout",`${t}-allow-overlap`,e,n)?de(i,"layout",`${t}-ignore-placement`,e,n)?"none":"obstacle":"declutter"}function $2(i,e,t,n){if(n||console.warn("No filterCache provided to evaluateFilter()"),!(i in n))try{n[i]=v2(e).filter}catch(s){console.warn("Filter will evaluate to false: "+s.message),n[i]=function(){return!1}}return n[i](Mo,t)}function Fo(i,e){if(i){if(i.a===0||e===0)return;const t=i.a;return e=e===void 0?1:e,t===0?"transparent":"rgba("+Math.round(i.r*255/t)+","+Math.round(i.g*255/t)+","+Math.round(i.b*255/t)+","+t*e+")"}return i}const H2=/\{[^{}}]*\}/g;function dg(i,e){return i.replace(H2,function(t){return e[t.slice(1,-1)]||""})}function Bw(i,e){let t=i.split(":")[0];return t===i&&(t="default"),e[t]}const X2={};function Y2(i,e,t,n=ag,s=void 0,o=void 0,r=void 0,a=void 0){if(typeof e=="string"&&(e=JSON.parse(e)),e.schema)for(const C in e.schema){const P=e.schema[C];"default"in P&&(Mw[C]=P.default)}if(e.version!=8)throw new Error("glStyle version 8 required.");X2[M2(e,i)]=Array.from(arguments);const l={};(typeof o=="string"||o instanceof Request||o instanceof Response||o instanceof Promise)&&(o={default:o});for(const C in o){const P=o[C];$o(()=>P).then(async R=>{let O;if(typeof Image<"u"){const I=new Image;if(typeof R=="string")I.crossOrigin="anonymous",I.src=R;else{let M;R instanceof Request?M=await fetch(R):R instanceof Response&&(M=R);const z=await M.blob();O=URL.createObjectURL(z),I.src=O}I.addEventListener("load",function M(){I.removeEventListener("load",M),l[C]={image:I,size:[I.width,I.height]},i.changed(),O&&URL.revokeObjectURL(O)}),I.addEventListener("error",function M(){URL.revokeObjectURL(O),I.removeEventListener("error",M)})}else if(typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope){const I=self;I.postMessage({action:"loadImage",src:R}),I.addEventListener("message",function(z){z.data.action==="imageLoaded"&&z.data.src===R&&(l[C]={image:z.data.image,size:[z.data.image.width,z.data.image.height]})})}})}const c=sO(e.layers),h={},u=[],d={},f={},g=D2(e),_=F2(e);let v;for(let C=0,P=c.length;C<P;++C){const R=c[C],O=R.id;if(typeof t=="string"&&R.source==t||Array.isArray(t)&&t.indexOf(O)!==-1){const I=R["source-layer"];if(v){if(R.source!==v)throw new Error(`Layer "${O}" does not use source "${v}`)}else{v=R.source;const z=e.sources[v];if(!z)throw new Error(`Source "${v}" is not defined`);const k=z.type;if(k!=="vector"&&k!=="geojson")throw new Error(`Source "${v}" is not of type "vector" or "geojson", but "${k}"`)}let M=h[I];M||(M=[],h[I]=M),M.push({layer:R,index:C}),u.push(O)}}const E=[],w=function(C,P,R){var L,N,j;const O=((j=(N=(L=i.getSource)==null?void 0:L.call(i))==null?void 0:N.format_)==null?void 0:j.layerName_)??"mvt:layer",I=C.getProperties(),M=h[I[O]];if(!M)return;let z=n.indexOf(P);z==-1&&(z=L2(P,n)),Mo.zoom=z,Mo.distanceFromCenter=0;const k=C.getGeometry(),q=W2[k.getType()],H=i.get("map");if(H&&H instanceof yy&&q===1){const U=H.getSize();if(U){const B=H.getView().getCenter(),X=Tn(k.getExtent());Mo.distanceFromCenter=kv(B,X)/P/U[1]}}const m={id:C.getId(),properties:I,type:q},b=i.get("mapbox-featurestate")[C.getId()];let S=-1;for(let U=0,B=M.length;U<B;++U){const X=M[U],G=X.layer,ae=G.id;if(R!==void 0&&R!==ae)continue;const te=G.layout||sg,V=G.paint||sg;if(de(G,"layout","visibility",m,g,b)==="none"||"minzoom"in G&&z<G.minzoom||"maxzoom"in G&&z>=G.maxzoom)continue;const ie=G.filter;if(!ie||$2(ae,ie,m,_)){let he,me,Fe,ue,ze,J;const dt=X.index;if(q==3&&(G.type=="fill"||G.type=="fill-extrusion")){if(me=de(G,"paint",G.type+"-opacity",m,g,b),G.type+"-pattern"in V){const qe=de(G,"paint",G.type+"-pattern",m,g,b);if(qe){const je=typeof qe=="string"?dg(qe,I):qe.toString(),Me=Bw(je,l);if(s&&s[je]&&Me){++S,J=E[S],(!J||!J.getFill()||J.getStroke()||J.getText())&&(J=new $e({fill:new vt}),E[S]=J),Fe=J.getFill(),J.setZIndex(dt);const fe=je+"."+me;let Ze=f[fe];if(!Ze){const Ce=s[je],xe=yu(Ce.width,Ce.height),Be=xe.getContext("2d");Be.globalAlpha=me,Be.drawImage(Me.image,Ce.x,Ce.y,Ce.width,Ce.height,0,0,Ce.width,Ce.height),Ze=Be.createPattern(xe,"repeat"),f[fe]=Ze}Fe.setColor(Ze)}}}else if(he=Fo(de(G,"paint",G.type+"-color",m,g,b),me),G.type+"-outline-color"in V&&(ze=Fo(de(G,"paint",G.type+"-outline-color",m,g,b),me)),ze||(ze=he),he||ze){if(++S,J=E[S],(!J||he&&!J.getFill()||!he&&J.getFill()||ze&&!J.getStroke()||!ze&&J.getStroke()||J.getText())&&(J=new $e({fill:he?new vt:void 0,stroke:ze?new St:void 0}),E[S]=J),he&&(Fe=J.getFill(),Fe.setColor(he)),G.type==="fill-extrusion"){const qe=de(G,"paint","fill-extrusion-height",m,g,b);if(qe>0){const je=Math.max(.1,.9-Math.min(qe,225)/280);if(ze&&ze!=="transparent"){const Me=ke.parse(ze);ze=`rgba(${Math.round(Me.r*255*je)},${Math.round(Me.g*255*je)},${Math.round(Me.b*255*je)},${Me.a})`}}}ze&&(ue=J.getStroke(),ue.setColor(ze),ue.setWidth(.5)),J.setZIndex(dt)}}if(q!=1&&G.type=="line"){"line-pattern"in V?he=void 0:he=Fo(de(G,"paint","line-color",m,g,b),de(G,"paint","line-opacity",m,g,b));const qe=de(G,"paint","line-width",m,g,b);he&&qe>0&&(++S,J=E[S],(!J||!J.getStroke()||J.getFill()||J.getText())&&(J=new $e({stroke:new St}),E[S]=J),ue=J.getStroke(),ue.setLineCap(de(G,"layout","line-cap",m,g,b)),ue.setLineJoin(de(G,"layout","line-join",m,g,b)),ue.setMiterLimit(de(G,"layout","line-miter-limit",m,g,b)),ue.setColor(he),ue.setWidth(qe),ue.setLineDash(V["line-dasharray"]?de(G,"paint","line-dasharray",m,g,b).map(function(je){return je*qe}):null),ue.setOffset(de(G,"paint","line-offset",m,g,b)),J.setZIndex(dt))}let Qe=!1,ye=null,sn=0,Gt,_t,Mt;if((q==1||q==2)&&"icon-image"in te){const qe=de(G,"layout","icon-image",m,g,b);if(qe){Gt=typeof qe=="string"?dg(qe,I):qe.toString();let je;const Me=a?a(i,Gt):void 0,fe=Bw(Gt,l);if(s&&s[Gt]&&fe||Me){const Ze=de(G,"layout","icon-rotation-alignment",m,g,b);if(q==2){const Ce=C.getGeometry();if(Ce.getFlatMidpoint||Ce.getFlatMidpoints){const xe=Ce.getExtent();if(Math.sqrt(Math.max(Math.pow((xe[2]-xe[0])/P,2),Math.pow((xe[3]-xe[1])/P,2)))>150){const Et=Ce.getType()==="MultiLineString"?Ce.getFlatMidpoints():Ce.getFlatMidpoint();if(ug||(wu=[NaN,NaN],ug=new Bt("Point",wu,[],2,{},void 0)),je=ug,wu[0]=Et[0],wu[1]=Et[1],de(G,"layout","symbol-placement",m,g,b)==="line"&&Ze==="map"){const qt=Ce.getStride(),lt=Ce.getFlatCoordinates();for(let Dt=0,it=lt.length-qt;Dt<it;Dt+=qt){const Vt=lt[Dt],zt=lt[Dt+1],Pt=lt[Dt+qt],et=lt[Dt+qt+1],Ot=Math.min(Vt,Pt),Fi=Math.max(Vt,Pt),Bn=Et[0],mn=Et[1],hs=(et-zt)*(Bn-Vt)-(Pt-Vt)*(mn-zt);if(Math.abs(hs)<.001&&Bn<=Fi&&Bn>=Ot){sn=Math.atan2(zt-et,Pt-Vt);break}}}}}}if(q!==2||je){const Ce=de(G,"layout","icon-size",m,g,b),xe=V["icon-color"]!==void 0?de(G,"paint","icon-color",m,g,b):null;if(!xe||xe.a!==0){const Be=de(G,"paint","icon-halo-color",m,g,b),Et=de(G,"paint","icon-halo-width",m,g,b);let on=`${Gt}.${Ce}.${Et}.${Be}`;if(xe!==null&&(on+=`.${xe}`),_t=d[on],!_t){const qt=Ww(G,m,"icon",g);let lt;"icon-offset"in te&&(lt=de(G,"layout","icon-offset",m,g,b).slice(0),lt[0]*=Ce,lt[1]*=-Ce);let Dt=xe?[xe.r*255,xe.g*255,xe.b*255,xe.a]:void 0;if(Me){const it={color:Dt,rotateWithView:Ze==="map",displacement:lt,declutterMode:qt,scale:Ce};typeof Me=="string"?it.src=Me:(it.img=Me,it.imgSize=[Me.width,Me.height]),_t=new Ps(it)}else{const it=s[Gt];let Vt,zt,Pt;if(Et)it.sdf?(Vt=jw(Uw(fe.image,it,xe||[0,0,0,1]),{x:0,y:0,width:it.width,height:it.height,pixelRatio:it.pixelRatio},Et,Be),Dt=void 0):Vt=jw(fe.image,it,Et,Be);else{if(it.sdf&&!fe.unSDFed){const et=Uw(fe.image,{x:0,y:0,width:fe.size[0],height:fe.size[1]},{r:1,g:1,b:1});fe.image=et,fe.unSDFed=!0}Vt=fe.image,zt=[it.width,it.height],Pt=[it.x,it.y]}_t=new Ps({color:Dt,img:Vt,imgSize:fe.size,size:zt,offset:Pt,rotateWithView:Ze==="map",scale:Ce/it.pixelRatio,displacement:lt,declutterMode:qt})}d[on]=_t}}_t&&(++S,J=E[S],(!J||!J.getImage()||J.getFill()||J.getStroke())&&(J=new $e,E[S]=J),J.setGeometry(je),_t.setRotation(sn+rg(de(G,"layout","icon-rotate",m,g,b))),_t.setOpacity(de(G,"paint","icon-opacity",m,g,b)),_t.setAnchor(B2[de(G,"layout","icon-anchor",m,g,b)]),J.setImage(_t),ye=J.getText(),J.setText(void 0),J.setZIndex(dt),Qe=!0,Mt=!1)}else Mt=!0}}}if(q==1&&G.type==="circle"){++S,J=E[S],(!J||!J.getImage()||J.getFill()||J.getStroke())&&(J=new $e,E[S]=J);const qe="circle-radius"in V?de(G,"paint","circle-radius",m,g,b):5,je=Fo(de(G,"paint","circle-stroke-color",m,g,b),de(G,"paint","circle-stroke-opacity",m,g,b)),Me=de(G,"paint","circle-translate",m,g,b),fe=Fo(de(G,"paint","circle-color",m,g,b),de(G,"paint","circle-opacity",m,g,b)),Ze=de(G,"paint","circle-stroke-width",m,g,b),Ce=qe+"."+je+"."+fe+"."+Ze+"."+Me[0]+"."+Me[1];_t=d[Ce],_t||(_t=new Ln({radius:qe,displacement:[Me[0],-Me[1]],stroke:je&&Ze>0?new St({width:Ze,color:je}):void 0,fill:fe?new vt({color:fe}):void 0,declutterMode:"none"}),d[Ce]=_t),J.setImage(_t),ye=J.getText(),J.setText(void 0),J.setGeometry(void 0),J.setZIndex(dt),Qe=!0}let Je,qn,nt,Vn,Wn,ui;if("text-field"in te){Vn=Math.round(de(G,"layout","text-size",m,g,b));const qe=de(G,"layout","text-font",m,g,b);nt=de(G,"layout","text-line-height",m,g,b),qn=ng(r?r(qe,e.metadata?e.metadata["ol:webfonts"]:void 0):qe,Vn,nt),qn.includes("sans-serif")||(qn+=",sans-serif"),Wn=de(G,"layout","text-letter-spacing",m,g,b),ui=de(G,"layout","text-max-width",m,g,b);const je=de(G,"layout","text-field",m,g,b);typeof je=="object"&&je.sections?je.sections.length===1?Je=je.toString():Je=je.sections.reduce((Me,fe,Ze)=>{const Ce=fe.fontStack?fe.fontStack.split(","):qe,xe=ng(r?r(Ce):Ce,Vn*(fe.scale||1),nt);let Be=fe.text;if(Be===`
|
|
165
|
-
`)return
|
|
166
|
-
`,""),
|
|
167
|
-
`);for(let
|
|
168
|
-
`,""),Me.push(Be[Et],xe);return Me},[]):Je=dg(je,I).trim(),me=de(G,"paint","text-opacity",m,g,b)}if(Je&&me&&!Mt){Qe||(++S,J=E[S],(!J||!J.getText()||J.getFill()||J.getStroke())&&(J=new $e,E[S]=J),J.setImage(void 0),J.setGeometry(void 0));const qe=Ww(G,m,"text",g);J.getText()||J.setText(ye),ye=J.getText(),(!ye||"getDeclutterMode"in ye&&ye.getDeclutterMode()!==qe)&&(ye=new ir({padding:[2,2,2,2],declutterMode:qe}),J.setText(ye));const je=de(G,"layout","text-transform",m,g,b);je=="uppercase"?Je=Array.isArray(Je)?Je.map((et,Ot)=>Ot%2?et:et.toUpperCase()):Je.toUpperCase():je=="lowercase"&&(Je=Array.isArray(Je)?Je.map((et,Ot)=>Ot%2?et:et.toLowerCase()):Je.toLowerCase());const Me=Array.isArray(Je)?Je:q==2?lg(Je,Wn):hg(Je,qn,ui,Wn);if(ye.setText(Me),ye.setFont(qn),ye.setRotation(rg(de(G,"layout","text-rotate",m,g,b))),typeof ye.setKeepUpright=="function"){const et=de(G,"layout","text-keep-upright",m,g,b);ye.setKeepUpright(et)}const fe=de(G,"layout","text-anchor",m,g,b),Ze=Qe||q==1?"point":de(G,"layout","symbol-placement",m,g,b);let Ce;if(Ze==="line-center"?(ye.setPlacement("line"),Ce="center"):ye.setPlacement(Ze),Ze==="line"&&typeof ye.setRepeat=="function"){const et=de(G,"layout","symbol-spacing",m,g,b);ye.setRepeat(et*2)}ye.setOverflow(Ze==="point");let xe=de(G,"paint","text-halo-width",m,g,b);const Be=de(G,"layout","text-offset",m,g,b),Et=de(G,"paint","text-translate",m,g,b);let on=0,qt=0;if(Ze=="point"){Ce="center",fe.indexOf("left")!==-1?(Ce="left",qt=xe):fe.indexOf("right")!==-1&&(Ce="right",qt=-xe);const et=de(G,"layout","text-rotation-alignment",m,g,b);ye.setRotateWithView(et=="map")}else ye.setMaxAngle(rg(de(G,"layout","text-max-angle",m,g,b))*Je.length/Me.length),ye.setRotateWithView(!1);ye.setTextAlign(Ce);let lt="middle";fe.indexOf("bottom")==0?(lt="bottom",on=-xe-.5*(nt-1)*Vn):fe.indexOf("top")==0&&(lt="top",on=xe+.5*(nt-1)*Vn),ye.setTextBaseline(lt);const Dt=de(G,"layout","text-justify",m,g,b);ye.setJustify(Dt==="auto"?void 0:Dt),ye.setOffsetX(Be[0]*Vn+qt+Et[0]),ye.setOffsetY(Be[1]*Vn+on+Et[1]);const it=ye.getFill()||new vt;it.setColor(Fo(de(G,"paint","text-color",m,g,b),me)),ye.setFill(it);const Vt=Fo(de(G,"paint","text-halo-color",m,g,b),me);if(Vt&&xe>0){const et=ye.getStroke()||new St;et.setColor(Vt),xe*=2;const Ot=.5*Vn;et.setWidth(xe<=Ot?xe:Ot),ye.setStroke(et)}else ye.setStroke(void 0);const zt=de(G,"layout","text-padding",m,g,b),Pt=ye.getPadding();zt!==Pt[0]&&(Pt[0]=zt,Pt[1]=zt,Pt[2]=zt,Pt[3]=zt),J.setZIndex(dt)}}}if(S>-1)return E.length=S+1,E};return i.setStyle(w),i.set("mapbox-layers",u),i.set("mapbox-source",v),i.set("mapbox-featurestate",i.get("mapbox-featurestate")||{}),w}class Z2 extends L1{constructor(){super()}getType(){return"json"}readFeature(e,t){return this.readFeatureFromObject(vu(e),this.getReadOptions(e,t))}readFeatures(e,t){return this.readFeaturesFromObject(vu(e),this.getReadOptions(e,t))}readFeatureFromObject(e,t){return we()}readFeaturesFromObject(e,t){return we()}readGeometry(e,t){return this.readGeometryFromObject(vu(e),this.getReadOptions(e,t))}readGeometryFromObject(e,t){return we()}readProjection(e){return this.readProjectionFromObject(vu(e))}readProjectionFromObject(e){return we()}writeFeature(e,t){return JSON.stringify(this.writeFeatureObject(e,t))}writeFeatureObject(e,t){return we()}writeFeatures(e,t){return JSON.stringify(this.writeFeaturesObject(e,t))}writeFeaturesObject(e,t){return we()}writeGeometry(e,t){return JSON.stringify(this.writeGeometryObject(e,t))}writeGeometryObject(e,t){return we()}}function vu(i){if(typeof i=="string"){const e=JSON.parse(i);return e||null}return i!==null?i:null}class $w extends Z2{constructor(e){e=e||{},super(),this.dataProjection=De(e.dataProjection?e.dataProjection:"EPSG:4326"),e.featureProjection&&(this.defaultFeatureProjection=De(e.featureProjection)),e.featureClass&&(this.featureClass=e.featureClass),this.geometryName_=e.geometryName,this.extractGeometryName_=e.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(e,t){let n=null;e.type==="Feature"?n=e:n={type:"Feature",geometry:e,properties:null};const s=fg(n.geometry);if(this.featureClass===Bt)return z1({geometry:s,id:n.id,properties:n.properties},t);const o=new An;return this.geometryName_?o.setGeometryName(this.geometryName_):this.extractGeometryName_&&n.geometry_name&&o.setGeometryName(n.geometry_name),o.setGeometry(gp(s,t)),"id"in n&&o.setId(n.id),n.properties&&o.setProperties(n.properties,!0),o}readFeaturesFromObject(e,t){const n=e;let s=null;if(n.type==="FeatureCollection"){const o=e;s=[];const r=o.features;for(let a=0,l=r.length;a<l;++a){const c=this.readFeatureFromObject(r[a],t);c&&s.push(c)}}else s=[this.readFeatureFromObject(e,t)];return s.flat()}readGeometryFromObject(e,t){return K2(e,t)}readProjectionFromObject(e){const t=e.crs;let n;if(t)if(t.type=="name")n=De(t.properties.name);else if(t.type==="EPSG")n=De("EPSG:"+t.properties.code);else throw new Error("Unknown SRS type");else n=this.dataProjection;return n}writeFeatureObject(e,t){t=this.adaptOptions(t);const n={type:"Feature",geometry:null,properties:null},s=e.getId();if(s!==void 0&&(n.id=s),!e.hasProperties())return n;const o=e.getProperties(),r=e.getGeometry();return r&&(n.geometry=pg(r,t),delete o[e.getGeometryName()]),_s(o)||(n.properties=o),n}writeFeaturesObject(e,t){t=this.adaptOptions(t);const n=[];for(let s=0,o=e.length;s<o;++s)n.push(this.writeFeatureObject(e[s],t));return{type:"FeatureCollection",features:n}}writeGeometryObject(e,t){return pg(e,this.adaptOptions(t))}}function fg(i,e){if(!i)return null;let t;switch(i.type){case"Point":{t=J2(i);break}case"LineString":{t=eA(i);break}case"Polygon":{t=sA(i);break}case"MultiPoint":{t=nA(i);break}case"MultiLineString":{t=tA(i);break}case"MultiPolygon":{t=iA(i);break}case"GeometryCollection":{t=Q2(i);break}default:throw new Error("Unsupported GeoJSON type: "+i.type)}return t}function K2(i,e){const t=fg(i);return gp(t,e)}function Q2(i,e){return i.geometries.map(function(n){return fg(n)})}function J2(i){const e=i.coordinates;return{type:"Point",flatCoordinates:e,layout:oo(e.length)}}function eA(i){var n;const e=i.coordinates,t=e.flat();return{type:"LineString",flatCoordinates:t,ends:[t.length],layout:oo(((n=e[0])==null?void 0:n.length)||2)}}function tA(i){var o,r;const e=i.coordinates,t=((r=(o=e[0])==null?void 0:o[0])==null?void 0:r.length)||2,n=[],s=oa(n,0,e,t);return{type:"MultiLineString",flatCoordinates:n,ends:s,layout:oo(t)}}function nA(i){var t;const e=i.coordinates;return{type:"MultiPoint",flatCoordinates:e.flat(),layout:oo(((t=e[0])==null?void 0:t.length)||2)}}function iA(i){var o,r;const e=i.coordinates,t=[],n=((r=(o=e[0])==null?void 0:o[0])==null?void 0:r[0].length)||2,s=zm(t,0,e,n);return{type:"MultiPolygon",flatCoordinates:t,ends:s,layout:oo(n)}}function sA(i){var o,r;const e=i.coordinates,t=[],n=(r=(o=e[0])==null?void 0:o[0])==null?void 0:r.length,s=oa(t,0,e,n);return{type:"Polygon",flatCoordinates:t,ends:s,layout:oo(n)}}function pg(i,e){i=jh(i,!0,e);const t=i.getType();let n;switch(t){case"Point":{n=hA(i);break}case"LineString":{n=rA(i);break}case"Polygon":{n=uA(i,e);break}case"MultiPoint":{n=lA(i);break}case"MultiLineString":{n=aA(i);break}case"MultiPolygon":{n=cA(i,e);break}case"GeometryCollection":{n=oA(i,e);break}case"Circle":{n={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+t)}return n}function oA(i,e){return e=Object.assign({},e),delete e.featureProjection,{type:"GeometryCollection",geometries:i.getGeometriesArray().map(function(n){return pg(n,e)})}}function rA(i,e){return{type:"LineString",coordinates:i.getCoordinates()}}function aA(i,e){return{type:"MultiLineString",coordinates:i.getCoordinates()}}function lA(i,e){return{type:"MultiPoint",coordinates:i.getCoordinates()}}function cA(i,e){let t;return e&&(t=e.rightHanded),{type:"MultiPolygon",coordinates:i.getCoordinates(t)}}function hA(i,e){return{type:"Point",coordinates:i.getCoordinates()}}function uA(i,e){let t;return e&&(t=e.rightHanded),{type:"Polygon",coordinates:i.getCoordinates(t)}}function dA(i,e,t,n){const s=document.createElement("script"),o="olc_"+Pe(e);function r(){delete globalThis[o],s.parentNode.removeChild(s)}s.async=!0,s.src=i+(i.includes("?")?"&":"?")+"callback="+o;const a=setTimeout(function(){r(),t&&t()},1e4);globalThis[o]=function(l){clearTimeout(a),r(),e(l)},document.head.appendChild(s)}class fA extends Fh{constructor(e){if(super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,projection:De("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:"loading",tileLoadFunction:e.tileLoadFunction,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,zDirection:e.zDirection}),this.tileJSON_=null,this.tileSize_=e.tileSize,e.url)if(e.jsonp)dA(e.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{const t=new XMLHttpRequest;t.addEventListener("load",this.onXHRLoad_.bind(this)),t.addEventListener("error",this.onXHRError_.bind(this)),t.open("GET",e.url),t.send()}else if(e.tileJSON)this.handleTileJSONResponse(e.tileJSON);else throw new Error("Either `url` or `tileJSON` options must be provided")}onXHRLoad_(e){const t=e.target;if(!t.status||t.status>=200&&t.status<300){let n;try{n=JSON.parse(t.responseText)}catch{this.handleTileJSONError();return}this.handleTileJSONResponse(n)}else this.handleTileJSONError()}onXHRError_(e){this.handleTileJSONError()}getTileJSON(){return this.tileJSON_}handleTileJSONResponse(e){const t=De("EPSG:4326"),n=this.getProjection();let s;if(e.bounds!==void 0){const c=ia(t,n);s=Jg(e.bounds,c)}const o=Ka(n),r=e.minzoom||0,a=e.maxzoom||22,l=Ir({extent:o,maxZoom:a,minZoom:r,tileSize:this.tileSize_});if(this.tileGrid=l,this.tileUrlFunction=T1(e.tiles,l),e.attribution&&!this.getAttributions()){const c=s!==void 0?s:o;this.setAttributions(function(h){return pt(c,h.extent)?[e.attribution]:null})}this.tileJSON_=e,this.setState("ready")}handleTileJSONError(){this.setState("error")}}ke.parse("#000000"),ke.parse("#FFFFFF"),ke.parse("#000000");function pA(i,e=512){return i.getExtent()?Ir({extent:i.getExtent(),tileSize:e,maxZoom:22}).getResolutions():ag}function gA(i,e){return e.accessToken||(e=Object.assign({},e),new URL(i).searchParams.forEach((n,s)=>{e.accessToken=n,e.accessTokenParam=s})),e}function mA(i,e,t="",n={},s=void 0){let o,r,a,l,c=!0;return typeof t!="string"&&!Array.isArray(t)?(a=t,l=a.source||a.layers,n=a):l=t,typeof n=="string"?(o=n,a={}):(o=n.styleUrl,a=n),a.updateSource===!1&&(c=!1),s||(s=a.resolutions),!o&&typeof e=="string"&&!e.trim().startsWith("{")&&(o=e),o&&(o=o.startsWith("data:")?location.href:Lw(o,a.accessToken),a=gA(o,a)),new Promise(function(h,u){N2(e,a).then(function(d){if(d.version!=8)return u(new Error("glStyle version 8 required."));if(!(i instanceof zn||i instanceof zh))return u(new Error("Can only apply to VectorLayer or VectorTileLayer"));const f=i instanceof zh?"vector":"geojson";if(l?Array.isArray(l)?r=d.layers.find(function(P){return P.id===l[0]}).source:r=l:(r=d.layers.find(function(P){return P.source&&d.sources[P.source].type===f}).source,l=r),!r)return u(new Error(`No ${f} source found in the glStyle.`));function g(){if(!c)return Promise.resolve();if(i instanceof zh)return wA(d.sources[r],o,a).then(function(I){const M=i.getSource();M?I!==M&&(M.setTileUrlFunction(I.getTileUrlFunction()),typeof M.setUrls=="function"&&typeof I.getUrls=="function"&&M.setUrls(I.getUrls()),M.format_||(M.format_=I.format_),M.getAttributions()||M.setAttributions(I.getAttributions()),M.getTileLoadFunction()===A1&&M.setTileLoadFunction(I.getTileLoadFunction()),Wt(M.getProjection(),I.getProjection())&&(M.tileGrid=I.getTileGrid())):i.setSource(I);const z=i.getSource().getTileGrid();!isFinite(i.getMaxResolution())&&!isFinite(i.getMinZoom())&&z.getMinZoom()>0&&i.setMaxResolution(z2(Math.max(0,z.getMinZoom()-1e-12),z.getResolutions()))});const P=d.sources[r];let R=i.getSource();(!R||R.get("mapbox-source")!==P)&&(R=bA(P,o,a));const O=i.getSource();return O?R!==O&&(O.getAttributions()||O.setAttributions(R.getAttributions()),O.format_||(O.format_=R.getFormat()),O.url_=R.getUrl()):i.setSource(R),Promise.resolve()}let _,v;const E={},w={};function C(){if(!v&&(!d.sprite||E)){if(a.projection&&!s){const I=De(a.projection).getUnits();I!=="m"&&(s=ag.map(M=>M/ic[I]))}let P;const R=i.getSource();R instanceof dp&&R.format_ instanceof mp&&(P=R.format_.layerName_),v=Y2(i,d,l,s,E,w,(O,I=a.webfonts)=>V2(O,I),a.getImage,P),i.getStyle()?g().then(h).catch(u):u(new Error(`Nothing to show for source [${r}]`))}else v?(i.setStyle(v),g().then(h).catch(u)):u(new Error("Something went wrong trying to apply style."))}if(d.sprite){const P=I2(d.sprite,a.accessToken,o||location.href);_=hn?1:globalThis.devicePixelRatio>=1.5?.5:1;const R=_==.5?"@2x":"";Promise.all(P.map(function(O){const I=new URL(O.url);let M=I.origin+I.pathname+R+".json"+I.search;return new Promise(function(z,k){Ur("Sprite",M,a).then(z).catch(function(q){M=I.origin+I.pathname+".json"+I.search,Ur("Sprite",M,a).then(z).catch(k)})}).then(function(z){z===void 0&&u(new Error("No sprites found."));let k;if(k=I.origin+I.pathname+R+".png"+I.search,a.transformRequest){const q=a.transformRequest(k,"SpriteImage")||k;(q instanceof Request||q instanceof Promise)&&(k=q)}w[O.id]=k;for(const q in z){const H=O.id=="default"?q:`${O.id}:${q}`;E[H]=z[q]}}).catch(function(z){u(new Error(`Sprites cannot be loaded: ${M}: ${z.message}`))})})).then(C).catch(u)}else C()}).catch(u)})}function yA(i,e){const t=i.bounds;if(t){const n=Ie([t[0],t[1]],e),s=Ie([t[2],t[3]],e);return[n[0],n[1],s[0],s[1]]}return De(e).getExtent()}function _A(i,e,t){const n=new fA({tileJSON:e,tileSize:i.tileSize||e.tileSize||512}),s=n.getTileJSON(),o=n.getTileGrid(),r=De(t.projection||"EPSG:3857"),a=yA(s,r),l=r.getExtent(),c=s.minzoom||0,h=s.maxzoom||22,u={attributions:n.getAttributions(),projection:r,tileGrid:new Vs({origin:l?ln(l):o.getOrigin(0),extent:a||o.getExtent(),minZoom:c,resolutions:pA(r,e.tileSize).slice(0,h+1),tileSize:o.getTileSize(0)})};return Array.isArray(s.tiles)?u.urls=s.tiles:u.url=s.tiles,u}function wA(i,e,t){return new Promise(function(n,s){k2(i,e,t).then(function({tileJson:o,tileLoadFunction:r}){const a=_A(i,o,t);a.tileLoadFunction=r,a.format=new mp({layerName:"mvt:layer"});const l=new dp(a);l.set("mapbox-source",i),n(l)}).catch(s)})}function vA(i){return`{bbox-${(i?i.getCode():"EPSG:3857").toLowerCase().replace(/[^a-z0-9]/g,"-")}}`}function bA(i,e,t){const n=t.projection?new $w({dataProjection:t.projection}):new $w,s=i.data,o={};if(typeof s=="string"){const[a]=mu(s,t.accessToken,t.accessTokenParam||"access_token",e||location.href);if(/\{bbox-[0-9a-z-]+\}/.test(a)){const c=(u,d,f)=>{const g=vA(f);return a.replace(g,`${u.join(",")}`)},h=new vn({attributions:i.attribution,format:n,loader:(u,d,f,g,_)=>{const v=typeof c=="function"?c(u,d,f):c;Ur("GeoJSON",v,t).then(E=>{const w=h.getFormat().readFeatures(E,{featureProjection:f});h.addFeatures(w),g(w)}).catch(E=>{h.removeLoadedExtent(u),_()})},strategy:PE});return h.set("mapbox-source",i),h}const l=new vn({attributions:i.attribution,format:n,url:a,loader:(c,h,u,d,f)=>{Ur("GeoJSON",a,t).then(g=>{const _=l.getFormat().readFeatures(g,{featureProjection:u});l.addFeatures(_),d(_)}).catch(g=>{l.removeLoadedExtent(c),f()})}});return l}o.features=n.readFeatures(s,{featureProjection:"EPSG:3857"});const r=new vn(Object.assign({attributions:i.attribution,format:n},o));return r.set("mapbox-source",i),r}class gg extends p.Destroyable{constructor(t,n){super();T(this,"_imageriesManager");T(this,"_map");T(this,"_raster");T(this,"_layer",this.dv(p.react(void 0)));T(this,"_rShow",this.dv(p.react(!0)));T(this,"_rAlpha",this.dv(p.react(1)));T(this,"_rZIndex",this.dv(p.react(0)));T(this,"_rRectangle",this.dv(p.react(void 0)));T(this,"_rSplitDirection",this.dv(p.react("NONE")));T(this,"_rBrightness",this.dv(p.react(1)));T(this,"_rContrast",this.dv(p.react(1)));T(this,"_rHue",this.dv(p.react(0)));T(this,"_rSaturation",this.dv(p.react(1)));T(this,"_rGamma",this.dv(p.react(1)));T(this,"_raf");this.id=n;const s=t.viewer;if(!s)return;this._map=s;const o=ts(s);if(!o)return;const{imageriesManager:r}=o;this._imageriesManager=r,this.d(()=>this._destroyLayer())}get layer(){return this._layer.value}set layer(t){this._layer.value=t}get layerChanged(){return this._layer.changed}get show(){return this._rShow.value}get alpha(){return this._rAlpha.value}get zIndex(){return this._rZIndex.value}get rectangle(){return this._rRectangle.value}get splitDirection(){return this._rSplitDirection.value}get brightness(){return this._rBrightness.value}get contrast(){return this._rContrast.value}get hue(){return this._rHue.value}get saturation(){return this._rSaturation.value}get gamma(){return this._rGamma.value}get showChanged(){return this._rShow.changed}get alphaChanged(){return this._rAlpha.changed}get zIndexChanged(){return this._rZIndex.changed}get rectangleChanged(){return this._rRectangle.changed}get splitDirectionChanged(){return this._rSplitDirection.changed}get brightnessChanged(){return this._rBrightness.changed}get contrastChanged(){return this._rContrast.changed}get hueChanged(){return this._rHue.changed}get saturationChanged(){return this._rSaturation.changed}get gammaChanged(){return this._rGamma.changed}set show(t){var s;const n=t??!0;this._rShow.value=n,(s=this._layer.value)==null||s.setVisible(n)}set alpha(t){var s;const n=t??1;this._rAlpha.value=n,(s=this._layer.value)==null||s.setOpacity(n)}set zIndex(t){const n=t??0;this._rZIndex.value=n,this._layer.value&&this._imageriesManager&&this._imageriesManager.setZindex(this._layer.value,n)}set rectangle(t){this._rRectangle.value=t}set splitDirection(t){this._rSplitDirection.value=t??"NONE"}set brightness(t){this._rBrightness.value=t??1,this._applyColorAdjustments()}set contrast(t){this._rContrast.value=t??1,this._applyColorAdjustments()}set hue(t){this._rHue.value=t??0,this._applyColorAdjustments()}set saturation(t){this._rSaturation.value=t??1,this._applyColorAdjustments()}set gamma(t){this._rGamma.value=t??1,this._applyColorAdjustments()}_applyColorAdjustments(){this._raf||(this._raf=requestAnimationFrame(()=>{var s,o,r;this._raf=void 0;const t=this._layer.value,n=(s=t==null?void 0:t.getSource)==null?void 0:s.call(t);(r=(o=this._raster)==null?void 0:o.changed)==null||r.call(o),n!=null&&n.refresh?n.refresh():t!=null&&t.changed&&t.changed()}))}set imageryProvider(t){this._createFromProvider(t)}flyTo(t){}_destroyLayer(){var n,s,o;const t=(n=this._layer)==null?void 0:n.value;this._map&&t&&this._imageriesManager&&this._imageriesManager.delete(t),this._raf&&(cancelAnimationFrame(this._raf),this._raf=void 0),(o=(s=this._raster)==null?void 0:s.dispose)==null||o.call(s),this._raster=void 0,this._layer.value=void 0}_wrapWithRaster(t){const n=Math.min(4,Math.max(1,(typeof navigator<"u"&&navigator.hardwareConcurrency||4)-1)),s=new lp({sources:[t],operationType:"pixel",threads:n,operation:function(o,r){function a(_,v,E){return .2126*_+.7152*v+.0722*E}function l(_,v,E,w,C){const P=.299*_+.587*v+.114*E,R=.595716*_-.274453*v-.321263*E,O=.211456*_-.522591*v+.311135*E,I=R*w-O*C,M=R*C+O*w;let z=P+.9563*I+.621*M,k=P-.2721*I-.6474*M,q=P-1.107*I+1.7046*M;const H=m=>m<0?0:m>1?1:m;return[H(z),H(k),H(q)]}const c=o[0];let h=c[0]/255,u=c[1]/255,d=c[2]/255;const f=c[3]/255;if(r.hueCos!==1||r.hueSin!==0){const _=l(h,u,d,r.hueCos,r.hueSin);h=_[0],u=_[1],d=_[2]}if(r.saturation!==1){const _=a(h,u,d);h=_+(h-_)*r.saturation,u=_+(u-_)*r.saturation,d=_+(d-_)*r.saturation}r.brightness!==1&&(h*=r.brightness,u*=r.brightness,d*=r.brightness),r.contrast!==1&&(h=(h-.5)*r.contrast+.5,u=(u-.5)*r.contrast+.5,d=(d-.5)*r.contrast+.5),r.gammaInv!==1&&(h=Math.pow(Math.max(h,0),r.gammaInv),u=Math.pow(Math.max(u,0),r.gammaInv),d=Math.pow(Math.max(d,0),r.gammaInv));const g=_=>Math.max(0,Math.min(255,Math.round(_*255)));return c[0]=g(h),c[1]=g(u),c[2]=g(d),c[3]=g(f),c}});return s.on("beforeoperations",o=>{const r=this._rHue.value??0;o.data.brightness=this._rBrightness.value??1,o.data.contrast=this._rContrast.value??1,o.data.saturation=this._rSaturation.value??1,o.data.gammaInv=1/Math.max(1e-4,this._rGamma.value??1),o.data.hueCos=Math.cos(r),o.data.hueSin=Math.sin(r)}),this._raster=s,s}_makeLayerForSource(t){return t instanceof lp?new ep({source:t}):t instanceof b1?new ep({source:t}):new Ah({source:t})}_createFromProvider(t){var g,_,v,E;if(!this._map)return;this._destroyLayer();const s=De("EPSG:3857").getExtent(),o=Te(s)/256,r=t,a=r.crossOrigin??"anonymous",l=Math.max((r.maximumLevel??18)+1,19),c=Array.from({length:l},(w,C)=>o/Math.pow(2,C));Array.from({length:l},(w,C)=>C.toString());const h=(w,C)=>{if(!C)return{url:w};const P=Array.isArray(C)?C:C.split("");return P.length?w.includes("{s}")?{urls:P.map(R=>w.replace("{s}",R))}:{url:w}:{url:w}},u=w=>typeof w=="string"?w:w&&w.url||"",d=r.minimumLevel??0,f=r.maximumLevel??18;switch(t.type){case"UrlTemplateImageryProvider":{const w=t,C=u(w.url),P=h(C,w.subdomains),R=new Lh({...P.urls?{urls:P.urls}:{url:P.url},attributions:r.attributions,crossOrigin:a,wrapX:!0,minZoom:d,maxZoom:f,transition:0}),O=this._wrapWithRaster(R);this._layer.value=this._makeLayerForSource(O);break}case"WebMapTileServiceImageryProvider":{const w=t,C=(w.matrixSet??w.tileMatrixSetID??"EPSG:3857").toUpperCase(),P=C==="EPSG:4326",R=(w.minimumLevel??d)|0,O=(w.maximumLevel??f)|0,I=w.tileMatrixLabels||w.TileMatrixLabels,M=P?Array.from({length:22},(B,X)=>`${C}:${X}`):Array.from({length:22},(B,X)=>String(X)),z=I&&I.length?I:M,k=z.length,q=Math.max(0,Math.min(R,k-1)),H=Math.max(q,Math.min(O,k-1)),m=Math.max(1,H-q+1),b=z.slice(q,q+m),S=256;let L,N,j;if(P){N=[-180,-90,180,90],L=ln(N);const B=360/(S*2);j=Array.from({length:m},(X,G)=>B/Math.pow(2,q+G))}else{N=s,L=ln(N);const B=Te(N)/S;j=Array.from({length:m},(X,G)=>B/Math.pow(2,q+G))}const U=new UT({url:u(w.url),layer:w.layer,matrixSet:C,format:w.format??"image/png",style:w.style??"default",tileGrid:w.tileGrid??new _T({origin:L,extent:N,resolutions:j,matrixIds:b,tileSize:S}),requestEncoding:w.requestEncoding||w.requestencoding||"KVP",...P?{projection:De("EPSG:4326")}:{},attributions:r.attributions,crossOrigin:a,wrapX:!0,transition:0,tileLoadFunction:(B,X)=>{const G=new Image;G.crossOrigin=a||"anonymous",G.onload=()=>{var je,Me;const ae=this._rBrightness.value??1,te=this._rContrast.value??1,V=this._rSaturation.value??1,re=this._rHue.value??0,ie=this._rGamma.value??1;if(re===0&&V===1&&ae===1&&te===1&&ie===1){const fe=(je=B.getImage)==null?void 0:je.call(B);if(fe){fe.src=X;return}}const he=G.naturalWidth||G.width,me=G.naturalHeight||G.height;if(!he||!me){B.getImage().src=X;return}const Fe=document.createElement("canvas");Fe.width=he,Fe.height=me;const ue=Fe.getContext("2d",{willReadFrequently:!0});ue.drawImage(G,0,0);const ze=ue.getImageData(0,0,he,me),J=ze.data,dt=Math.cos(re),Qe=Math.sin(re),ye=[[.299,.587,.114],[.595716,-.274453,-.321263],[.211456,-.522591,.311135]],sn=[[1,.9563,.621],[1,-.2721,-.6474],[1,-1.107,1.7046]],Gt=[[1,0,0],[0,dt,-Qe],[0,Qe,dt]],_t=(fe,Ze)=>{const Ce=Array.from({length:3},()=>[0,0,0]);for(let xe=0;xe<3;xe++)for(let Be=0;Be<3;Be++)Ce[xe][Be]=fe[xe][0]*Ze[0][Be]+fe[xe][1]*Ze[1][Be]+fe[xe][2]*Ze[2][Be];return Ce},Mt=_t(sn,_t(Gt,ye)),Je=.5-.5*te,qn=1/Math.max(1e-4,ie),nt=new Uint8ClampedArray(256);for(let fe=0;fe<256;fe++)nt[fe]=Math.max(0,Math.min(255,Math.round(Math.pow(fe/255,qn)*255)));const Vn=.2126,Wn=.7152,ui=.0722;for(let fe=0;fe<J.length;fe+=4){let Ze=J[fe]/255,Ce=J[fe+1]/255,xe=J[fe+2]/255;const Be=J[fe+3],Et=Mt[0][0]*Ze+Mt[0][1]*Ce+Mt[0][2]*xe,on=Mt[1][0]*Ze+Mt[1][1]*Ce+Mt[1][2]*xe,qt=Mt[2][0]*Ze+Mt[2][1]*Ce+Mt[2][2]*xe,lt=Vn*Et+Wn*on+ui*qt,Dt=lt+(Et-lt)*V,it=lt+(on-lt)*V,Vt=lt+(qt-lt)*V,zt=Dt*ae,Pt=it*ae,et=Vt*ae;let Ot=zt*te+Je,Fi=Pt*te+Je,Bn=et*te+Je;Ot=Ot<0?0:Ot>1?1:Ot,Fi=Fi<0?0:Fi>1?1:Fi,Bn=Bn<0?0:Bn>1?1:Bn,J[fe]=nt[Math.round(Ot*255)],J[fe+1]=nt[Math.round(Fi*255)],J[fe+2]=nt[Math.round(Bn*255)],J[fe+3]=Be}ue.putImageData(ze,0,0);const qe=(Me=B.setImage)==null?void 0:Me.bind(B);qe?qe(Fe):B.getImage().src=Fe.toDataURL("image/png")},G.onerror=()=>{B.getImage().src=X},G.src=X}});this._layer.value=new Ah({source:U});break}case"WebMapServiceImageryProvider":{const w=t,C={LAYERS:w.layers,TILED:!0,VERSION:((g=w.parameters)==null?void 0:g.VERSION)??((_=w.parameters)==null?void 0:_.version)??"1.3.0",...w.parameters},P=new jT({url:u(w.url),params:C,attributions:r.attributions,crossOrigin:a,transition:0}),R=this._wrapWithRaster(P);this._layer.value=this._makeLayerForSource(R);break}case"TileMapServiceImageryProvider":{const w=t,C=w.url?u(w.url):"",P=C.includes("{-y}"),R=/4326/.test(C)?"EPSG:4326":"EPSG:3857",O=De(R),I=P?Ir({extent:O.getExtent(),minZoom:d,maxZoom:f,tileSize:256}):void 0,M=w.url?u(w.url):"",z=new Lh({url:M,attributions:r.attributions,crossOrigin:a,wrapX:!0,minZoom:d,maxZoom:f,tileGrid:new Vs({origin:ln(s),resolutions:c.slice(d,f+1)}),zDirection:-1,transition:0,...I?{tileGrid:I}:{}}),k=this._wrapWithRaster(z);this._layer.value=this._makeLayerForSource(k);break}case"OpenStreetMapImageryProvider":{const w=t,C=new Lh({url:w.url,attributions:r.attributions,crossOrigin:a,wrapX:!0,transition:0}),P=this._wrapWithRaster(C);this._layer.value=this._makeLayerForSource(P);break}case"SingleTileImageryProvider":{const w=t,C=typeof w.url=="string"?w.url:w.url.url,P=w.rectangle?sa(w.rectangle,"EPSG:4326","EPSG:3857"):s,R=new b1({url:C,imageExtent:P,attributions:r.attributions,crossOrigin:a,interpolate:!0}),O=this._wrapWithRaster(R);this._layer.value=this._makeLayerForSource(O);break}case"MVTImageryProvider":{(async()=>{var B,X,G,ae;const w=t;if(!w.url)return;let C,P=[],R,O,I=null,M,z;const k=async te=>{if(!te)return{};if(typeof te=="string"){const V=te.toLowerCase();if(V.endsWith(".json")||V.includes("tilejson")||V.includes(".json?"))try{const re=await fetch(te);if(re.ok){const ie=await re.json(),he=ie.minzoom,me=ie.maxzoom;if(ie.tiles&&ie.tiles.length>0)return{url:ie.tiles[0],minzoom:he,maxzoom:me};if(ie.url)return{url:ie.url,minzoom:he,maxzoom:me}}}catch{}return{url:te}}if(typeof te=="object"){const V=te,re=V.minzoom,ie=V.maxzoom;if(V.tiles&&V.tiles.length>0)return{url:V.tiles[0],minzoom:re,maxzoom:ie};if(V.url)return{url:V.url,minzoom:re,maxzoom:ie}}return{}},q=te=>{const V=te.toLowerCase();return V.includes("style.json")||V.endsWith(".json")&&!V.includes("{z}")&&!V.includes("{x}")&&!V.includes("{y}")};let H="customSource";if(typeof w.url=="string")if(q(w.url))try{const te=await fetch(w.url);if(!te.ok){console.warn(`[OlImagery] MVT: fetch style.json 失败: ${te.status}`);return}I=await te.json();const V=I.sources||{};for(const re in V)if(Object.prototype.hasOwnProperty.call(V,re)){const ie=V[re];if(ie.type==="vector"){if(H=re,ie.minzoom!==void 0&&(M=M===void 0?ie.minzoom:Math.min(M,ie.minzoom)),ie.maxzoom!==void 0&&(z=z===void 0?ie.maxzoom:Math.max(z,ie.maxzoom)),ie.tiles&&ie.tiles.length>0){C=ie.tiles[0];break}if(ie.url){const he=await k(ie.url);if(C=he.url,he.minzoom!==void 0&&(M=M===void 0?he.minzoom:Math.min(M,he.minzoom)),he.maxzoom!==void 0&&(z=z===void 0?he.maxzoom:Math.max(z,he.maxzoom)),C)break}}}if(!C){console.warn("[OlImagery] MVT: style.json 中未找到有效的 tile URL");return}P=(B=w.style)!=null&&B.length?w.style:I.layers||[],R=I.glyphs,O=I.sprite}catch(te){console.warn("[OlImagery] MVT: fetch style.json 出错:",te);return}else{const te=await k(w.url);C=te.url,M=te.minzoom,z=te.maxzoom,P=w.style||[],R=w.glyphs,O=w.sprite}else if(w.url&&typeof w.url=="object"){I=w.url;const te=I.sources||{};for(const V in te)if(Object.prototype.hasOwnProperty.call(te,V)){const re=te[V];if(re.type==="vector"){if(H=V,re.minzoom!==void 0&&(M=M===void 0?re.minzoom:Math.min(M,re.minzoom)),re.maxzoom!==void 0&&(z=z===void 0?re.maxzoom:Math.max(z,re.maxzoom)),re.tiles&&re.tiles.length>0){C=re.tiles[0];break}if(re.url){const ie=await k(re.url);if(C=ie.url,ie.minzoom!==void 0&&(M=M===void 0?ie.minzoom:Math.min(M,ie.minzoom)),ie.maxzoom!==void 0&&(z=z===void 0?ie.maxzoom:Math.max(z,ie.maxzoom)),C)break}}}if(!C){console.warn("[OlImagery] MVT: 未在 style JSON 中找到有效的 tile URL");return}P=(X=w.style)!=null&&X.length?w.style:I.layers||[],R=I.glyphs,O=I.sprite}else return;if(C&&w.accessToken&&C.includes("mapbox")&&!C.includes("access_token")){const te=C.includes("?")?"&":"?";C+=`${te}access_token=${w.accessToken}`}const m=Math.max(w.minimumLevel??0,M??0),b=Math.min(w.maximumLevel??18,z??18),S=w.tileSize||512,L=w.scheme||"xyz",N=((G=I==null?void 0:I.metadata)==null?void 0:G["mapbox:projection"])||((ae=I==null?void 0:I.metadata)==null?void 0:ae.projection)||"EPSG:3857",j=new dp({url:C,format:new mp,tileGrid:Ir({tileSize:S,minZoom:m,maxZoom:b}),...L==="tms"?{zDirection:-1}:{},attributions:I==null?void 0:I.attribution});N!=="EPSG:3857"&&(j.dataProjection=N),j.on("tileloaderror",te=>{console.error("[OlImagery] MVT: 瓦片加载失败",te)});const U=new zh({source:j,declutter:!0});if(P.length>0)try{const te="https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf",V={version:8,name:"MVT Style",sources:{[H]:{type:"vector",tiles:[C],minzoom:m,maxzoom:b}},layers:P,glyphs:R||te,sprite:O},re={source:H,...typeof w.url=="string"&&w.url.toLowerCase().includes("style.json")?{styleUrl:w.url}:{}};await mA(U,V,re)}catch(te){console.warn("[OlImagery] MVT: ol-mapbox-style 应用样式失败,使用默认样式",te),U.setStyle(function(V){var me;const re=V.getGeometry(),ie=((me=re==null?void 0:re.getType)==null?void 0:me.call(re))||"",he=[];return ie==="LineString"||ie==="MultiLineString"?he.push(new $e({stroke:new St({color:"#ff0000",width:3})})):ie==="Polygon"||ie==="MultiPolygon"?he.push(new $e({fill:new vt({color:"rgba(100, 100, 100, 0.5)"}),stroke:new St({color:"#333333",width:1})})):(ie==="Point"||ie==="MultiPoint")&&he.push(new $e({image:new Ln({radius:5,fill:new vt({color:"#ff0000"})})})),he})}this._layer.value=U,this._layer.value.setOpacity(this._rAlpha.value),this._layer.value.setVisible(this._rShow.value),this.layer&&(this._imageriesManager&&this._imageriesManager.add(this.layer),this._imageriesManager&&this._imageriesManager.setZindex(this.layer,this._rZIndex.value))})();break}default:{console.warn("[OlImagery] 未实现的 provider.type:",t.type,t);return}}(v=this._layer.value)==null||v.setOpacity(this._rAlpha.value),(E=this._layer.value)==null||E.setVisible(this._rShow.value),this.layer&&(this._imageriesManager&&this._imageriesManager.add(this.layer),this._imageriesManager&&this._imageriesManager.setZindex(this.layer,this._rZIndex.value))}}const Su=class Su extends p.Destroyable{constructor(t,n){super();T(this,"_pickedEvent",this.disposeVar(new p.Event));T(this,"_flyToEvent",this.disposeVar(new p.Event));T(this,"_clickEvent",this.disposeVar(new p.Event));T(this,"_hovered",this.disposeVar(p.react(!1)));T(this,"_feature");T(this,"_source");T(this,"_layer");T(this,"_initialized",!1);const s=new wn([]);this._feature=new An({geometry:s}),this._feature.setId(n??p.createGuid());const o=t.viewer;if(!o)return;this._source=new vn,this.dispose(()=>{var c;return(c=this._source)==null?void 0:c.dispose()}),this._layer=new zn({source:this._source}),this.dispose(()=>{var c;return(c=this._layer)==null?void 0:c.dispose()});const r=()=>{var c;(c=this._layer)==null||c.setVisible(this.show??!0)};this.d(p.createEventsCallFunc(this.showChanged,r,{immediate:!0})),o.addLayer(this._layer),this.dispose(()=>o.removeLayer(this._layer));const a=()=>{if(!this._source||!this._feature||(this._source.clear(),!this.position))return;const c=Ie([this.position[0][0],this.position[0][1]]);s.setCoordinates(c);const h=this.radius??5,u=this.strokeWidth??2,d=this.fillColor??[1,1,1,1],f=this.strokeColor??[0,153/255,1,1],g=new vt({color:`rgba(${d.slice(0,3).map(E=>Math.round(E*255)).join(",")},${d[3]})`}),_=new St({color:`rgba(${f.slice(0,3).map(E=>Math.round(E*255)).join(",")},${f[3]})`,width:u}),v=new $e({image:new Ln({radius:h,fill:g,stroke:_})});this._feature.setStyle(v),this._source.addFeature(this._feature)};a();const l=this.disposeVar(p.createNextAnimateFrameEvent(this.positionChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged));this.dispose(l.disposableOn(a)),this.dispose(this.flyToEvent.disposableOn(c=>{this.position&&Yi(t,this.position)})),this.dispose(this.positionChanged.disposableOn(()=>{!this._initialized&&this.position&&(this._initializePoint(),this._initialized=!0)}))}get typeName(){return"OlPoint"}get defaultProps(){return Su.createDefaultProps()}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}get clickEvent(){return this._clickEvent}get hovered(){return this._hovered.value}set hovered(t){this._hovered.value=t}get feature(){return this._feature}_initializePoint(){const t=()=>{var f;if(!this.position)return;const s=Ie([this.position[0],this.position[1]]);if(!this._feature)return;this._feature.getGeometry().setCoordinates(s);const r=this.radius??5,a=this.strokeWidth??2,l=this.fillColor??[1,1,1,1],c=this.strokeColor??[0,153/255,1,1],h=new vt({color:`rgba(${l.slice(0,3).map(g=>Math.round(g*255)).join(",")},${l[3]})`}),u=new St({color:`rgba(${c.slice(0,3).map(g=>Math.round(g*255)).join(",")},${c[3]})`,width:a}),d=new $e({image:new Ln({radius:r,fill:h,stroke:u})});this._feature.setStyle(d),this._feature.set("visible",this.show??!0),(f=this._source)==null||f.addFeature(this._feature)};t();const n=p.createNextAnimateFrameEvent(this.positionChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged);this.dispose(n.disposableOn(t))}};T(Su,"defaults",{position:[],width:2,loop:!1,color:[1,1,1,.5],outlineColor:[0,0,0,1],show:!0,allowPicking:!1,strokeColor:[0,153/255,1,1],fillColor:[1,1,1,1],strokeWidth:2,radius:5});let li=Su;(i=>{i.createDefaultProps=()=>({show:void 0,position:p.reactArrayWithUndefined(void 0),editting:void 0,allowPicking:!1,pixelSize:void 0,color:p.reactArrayWithUndefined(void 0),outlineColor:p.reactArrayWithUndefined(void 0),outlineWidth:void 0,fillColor:p.reactArrayWithUndefined(void 0),strokeColor:p.reactArrayWithUndefined(void 0),strokeWidth:void 0,radius:void 0,zIndex:void 0})})(li||(li={})),p.extendClassProps(li.prototype,li.createDefaultProps);const Ru=class Ru extends p.Destroyable{constructor(t,n){super();T(this,"_flyToEvent",this.disposeVar(new p.Event));T(this,"_layer");T(this,"_feature");T(this,"_source");T(this,"_lineString");const s=new Qn([]);this._lineString=s,this.d(()=>{var c;return(c=this._lineString)==null?void 0:c.dispose()}),this._feature=new An({geometry:s}),this._feature.setId(n??p.createGuid()),this.d(()=>{var c;return(c=this._feature)==null?void 0:c.dispose()}),this._source=new vn,this.d(()=>{var c;return(c=this._source)==null?void 0:c.dispose()}),this._layer=new zn({zIndex:0,source:this._source}),this.d(()=>{var c;return(c=this._layer)==null?void 0:c.dispose()});const o=t.viewer;if(!o)return;o.addLayer(this._layer),this.d(()=>o.removeLayer(this._layer));const r=()=>{var c;(c=this._layer)==null||c.setVisible(this.show??!0)};r(),this.ad(this.showChanged.don(r)),this.d(p.createEventsCallFunc(this.zIndexChanged,()=>{var c;(c=this._layer)==null||c.setZIndex(this.zIndex)},{immediate:!0}));const a=()=>{if(!this._source||!this._feature||(this._source.clear(),!this.positions||this.positions.length<2))return;const c=this.positions.map(d=>Ie([d[0],d[1]]));this.loop&&c.length>=3&&c.push(c[0]),this._feature.getGeometry().setCoordinates(c);const u=(d,f)=>{const g=[],_=new St({color:`rgba(${this.color[0]*255}, ${this.color[1]*255}, ${this.color[2]*255}, ${this.color[3]})`,width:this.width??2,lineDash:this.hasDash?[this.dashLength??16,(this.dashLength??16)/2]:void 0});if(g.push(new $e({stroke:_})),this.hasArrow&&c.length>=2){const[v,E]=c[c.length-2],[w,C]=c[c.length-1],P=EA(w-v,C-E);g.push(new $e({geometry:new wn([w,C]),image:new Ca({points:3,radius:8,rotation:P,rotateWithView:!0,fill:new vt({color:`rgba(${this.color[0]*255}, ${this.color[1]*255}, ${this.color[2]*255}, ${this.color[3]})`})})}))}return g};this._feature.setStyle(u),this._source.addFeature(this._feature)};a();const l=this.disposeVar(p.createNextAnimateFrameEvent(this.positionsChanged,this.loopChanged,this.widthChanged,this.colorChanged,this.hasDashChanged,this.dashLengthChanged,this.hasArrowChanged,this.showChanged));this.d(l.disposableOn(a)),this.d(this.flyToEvent.disposableOn(c=>{if(!this.positions||this.positions.length===0)return;const h=this.positions[Math.floor(this.positions.length/2)];Yi(t,h)}))}get typeName(){return"OlPolyline"}get defaultProps(){return Ru.createDefaultProps()}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}};T(Ru,"defaults",{positions:[],width:2,loop:!1,color:[1,1,1,1],hasDash:!1,dashLength:16,hasArrow:!1});let Ut=Ru;(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:p.reactPositions(void 0),loop:!1,width:2,color:p.reactArray([1,1,1,1]),hasDash:!1,dashLength:16,hasArrow:!1,arcType:"GEODESIC",depthTest:!1,zIndex:0,dashPattern:255,gapColor:p.reactArray([0,0,0,0])})})(Ut||(Ut={})),p.extendClassProps(Ut.prototype,Ut.createDefaultProps);function EA(i,e){const t=Math.atan2(e,i);return(Math.PI/2-t+2*Math.PI)%(2*Math.PI)}class CA extends p.Destroyable{constructor(t,n){super();T(this,"_geoPoint");T(this,"_geoAxis");this._geoPoint=this.disposeVar(new li(n,t.id)),this._geoAxis=this.disposeVar(new Ut(n,t.id)),this._geoAxis.width=6,this._geoAxis.color=[1,1,0,.7]}get geoPoint(){return this._geoPoint}get geoAxis(){return this._geoAxis}}const as=class as extends p.Destroyable{constructor(t,n){super();T(this,"_captureEvent",this.disposeVar(new p.Event));T(this,"_id",this.disposeVar(p.react(p.createGuid())));if(this._olViewer=t,n&&(this.id=n),!t.viewer)return;this.disposeVar(new p.ObjResettingWithEvent(this.showChanged,()=>{if(this.show&&this.position)return new CA(this,t)})),this.default&&this.flyTo(void 0,!1);const o=this.disposeVar(p.createProcessingFromAsyncFunc(async a=>{const{position:l,rotation:c,viewDistance:h,duration:u=1e3}=this;if(l){const d=Yi(this._olViewer,l,h,c,u,()=>{this.enabled=!1});d&&await a.promise(d),this.enabled=!1}}));this.dispose(this.enabledChanged.disposableOn(()=>{o.isRunning&&o.cancel(),this.enabled&&o.restart()}));const r=this.disposeVar(p.createProcessingFromAsyncFunc(async(a,l,c)=>{var d,f;const h=(f=(d=this._olViewer).capture)==null?void 0:f.call(d,l,c);if(!h)return;const u=await a.promise(h);u&&(this.thumbnail=u)}));this.dispose(this.captureEvent.disposableOn((a,l)=>{r.restart(void 0,a??as.defaults.thumbnailWidth,l??as.defaults.thumbnailHeight)}))}get captureEvent(){return this._captureEvent}capture(t,n){this._captureEvent.emit(t,n)}get id(){return this._id.value}set id(t){this._id.value=t}get idChanged(){return this._id.changed}resetWithCurrentCamera(t){if(!this._olViewer.actived)return;const n=this._olViewer.getCurrentCameraInfo();n&&(t&as.ResetFlag.Position&&(this.position=n.position),t&as.ResetFlag.Rotation&&(this.rotation=n.rotation),t&as.ResetFlag.ViewDistance&&(this.viewDistance=0))}flyTo(t,n){if((n??!0)&&!this._olViewer.actived)return;const{position:s,rotation:o,viewDistance:r,duration:a}=this;s&&Yi(this._olViewer,s,r,o,t??a)}};T(as,"ResetFlag",{Position:1,Rotation:2,ViewDistance:4,Zoom:10}),T(as,"defaults",{thumbnailWidth:64,thumbnailHeight:64,enabled:!0,show:!1,position:[116.39,39.9,100],duration:1e3,default:!1,thumbnail:""});let Lo=as;(i=>{i.createDefaultProps=()=>({enabled:!0,position:p.reactArrayWithUndefined(void 0),positionEditing:!1,show:!1,rotation:p.reactArray([0,0,0]),viewDistance:0,duration:void 0,default:!1,thumbnail:""})})(Lo||(Lo={})),p.extendClassProps(Lo.prototype,Lo.createDefaultProps);class ss extends p.Destroyable{constructor(t,n){super();T(this,"_flyToEvent",this.disposeVar(new p.Event));T(this,"_feature");T(this,"_layer");T(this,"_source");const s=new Kn([[]]);this._feature=new An({geometry:s}),this._feature.setId(n??p.createGuid());const o=t.viewer;if(!o)return;this._source=new vn,this.dispose(()=>{var c;return(c=this._source)==null?void 0:c.dispose()}),this._layer=new zn({source:this._source}),this.dispose(()=>{var c;return(c=this._layer)==null?void 0:c.dispose()}),o.addLayer(this._layer),this.dispose(()=>o.removeLayer(this._layer));const r=()=>{var c,h;(c=this._layer)==null||c.setVisible(this.show??!0),(h=this._layer)==null||h.setZIndex(this.zIndex)};this.d(p.createEventsCallFunc([this.showChanged,this.zIndexChanged],r,{immediate:!0}));const a=()=>{if(!this._source||!this._feature||(this._source.clear(),!this.positions||this.positions.length<3))return;const c=Xw(this.positions);if(c.length<4)return;this._feature.getGeometry().setCoordinates([c]);const h=this.filled?this.fillColor:[0,0,0,0],u=this.stroked?this.outlineColor:[0,0,0,0];this._feature.setStyle(new $e({fill:new vt({color:Hw(h)}),stroke:new St({color:Hw(u),width:this.outlineWidth??1.5,lineDash:this.hasDash?[this.dashLength??16,(this.dashLength??16)/2]:void 0})})),this._source.addFeature(this._feature)};a();const l=this.disposeVar(p.createNextAnimateFrameEvent(this.positionsChanged,this.fillColorChanged,this.outlineColorChanged,this.outlineWidthChanged,this.hasDashChanged,this.dashLengthChanged,this.strokedChanged,this.filledChanged));this.dispose(l.disposableOn(a)),this.dispose(this.flyToEvent.disposableOn(c=>{if(!this.positions||this.positions.length===0)return;const h=Xw(this.positions),[u,d]=xA(h),[f,g]=Lt([u,d]);Yi(t,[f,g,0])}))}get typeName(){return"OlPolygon"}get defaultProps(){return ss.createDefaultProps()}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}}(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:p.reactJsonWithUndefined(void 0),fillColor:p.reactArray([1,1,1,.4]),outlineColor:p.reactArray([1,1,1,1]),outlineWidth:1.5,hasDash:!1,dashLength:16,zIndex:0,stroked:!0,filled:!0})})(ss||(ss={})),p.extendClassProps(ss.prototype,ss.createDefaultProps);function Hw(i){return`rgba(${i[0]*255}, ${i[1]*255}, ${i[2]*255}, ${i[3]})`}function Xw(i){const e=i.map(s=>Ie([s[0],s[1]])),t=e[0],n=e[e.length-1];return(!t||!n||t[0]!==n[0]||t[1]!==n[1])&&e.push(t),e}function xA(i){let e=0,t=0,n=0;for(let s=0,o=i.length-1;s<i.length;o=s++){const[r,a]=i[o],[l,c]=i[s],h=r*c-l*a;e+=h,t+=(r+l)*h,n+=(a+c)*h}return e*=.5,Math.abs(e)<1e-9?i[0]:(t/=6*e,n/=6*e,[t,n])}const Tu=class Tu extends p.Destroyable{constructor(t,n){super();T(this,"_pickedEvent",this.disposeVar(new p.Event));T(this,"_flyToEvent",this.disposeVar(new p.Event));T(this,"_clickEvent",this.disposeVar(new p.Event));T(this,"_hovered",this.disposeVar(p.react(!1)));T(this,"_feature");T(this,"_source");T(this,"_layer");T(this,"_initialized",!1);const s=new er([]);this._feature=new An({geometry:s}),this._feature.setId(n??p.createGuid());const o=t.viewer;if(!o)return;this._source=new vn,this.dispose(()=>{var c;return(c=this._source)==null?void 0:c.dispose()}),this._layer=new zn({source:this._source}),this.dispose(()=>{var c;return(c=this._layer)==null?void 0:c.dispose()});const r=()=>{var c;(c=this._layer)==null||c.setVisible(this.show??!0)};r(),this.ad(this.showChanged.don(r)),o.addLayer(this._layer),this.dispose(()=>o.removeLayer(this._layer));const a=()=>{if(!this._source||!this._feature||(this._source.clear(),!this.points))return;const c=this.points.map(w=>Ie([w[0],w[1]]));if(!this._feature)return;const h=this._feature.getGeometry();h&&h.setCoordinates(c);const u=this.radius??5,d=this.strokeWidth??2,f=this.fillColor??[255,255,255,1],g=this.strokeColor??[0,153/255,1,1],_=new vt({color:`rgba(${f.map(w=>w*255).join(",")})`}),v=new St({color:`rgba(${g.map(w=>w*255).join(",")})`,width:d}),E=new $e({image:new Ln({radius:u,fill:_,stroke:v})});this._feature.setStyle(E),this._source.addFeature(this._feature)};a();const l=this.disposeVar(p.createNextAnimateFrameEvent(this.pointsChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged));this.dispose(l.disposableOn(a)),this.dispose(this.pointsChanged.don(()=>{!this._initialized&&this.points&&(this._initializePoint(),this._initialized=!0)}))}get typeName(){return"OlMultiPoint"}get defaultProps(){return Tu.createDefaultProps()}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}get clickEvent(){return this._clickEvent}get hovered(){return this._hovered.value}set hovered(t){this._hovered.value=t}get feature(){return this._feature}_initializePoint(){const t=()=>{var f;if(!this.points)return;const s=this.points.map(g=>Ie([g[0],g[1]]));if(!this._feature)return;const o=this._feature.getGeometry();o&&o.setCoordinates(s);const r=this.radius??5,a=this.strokeWidth??2,l=this.fillColor??[1,1,1,1],c=this.strokeColor??[0,153/255,1,1],h=new vt({color:`rgba(${l.map(g=>g*255).join(",")})`}),u=new St({color:`rgba(${c.map(g=>g*255).join(",")})`,width:a}),d=new $e({image:new Ln({radius:r,fill:h,stroke:u})});this._feature.setStyle(d),this._feature.set("visible",this.show??!0),(f=this._source)==null||f.addFeature(this._feature)};t();const n=p.createNextAnimateFrameEvent(this.pointsChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged);this.dispose(n.disposableOn(t))}};T(Tu,"defaults",{position:[],width:2,loop:!1,color:[1,1,1,.5],outlineColor:[0,0,0,1],show:!0,allowPicking:!1,strokeColor:[0,153/255,1,1],fillColor:[1,1,1,1],strokeWidth:2,radius:5});let Hs=Tu;(i=>{i.createDefaultProps=()=>({show:void 0,points:p.reactPositions(void 0),editting:void 0,allowPicking:!1,pixelSize:void 0,color:p.reactArrayWithUndefined(void 0),outlineColor:p.reactArrayWithUndefined(void 0),outlineWidth:void 0,fillColor:p.reactArrayWithUndefined(void 0),strokeColor:p.reactArrayWithUndefined(void 0),strokeWidth:void 0,radius:void 0,zIndex:void 0})})(Hs||(Hs={})),p.extendClassProps(Hs.prototype,Hs.createDefaultProps);class ul extends p.EngineObject{constructor(e,t){if(super(e,t),!t.viewer){console.warn("map is undefined!");return}this.d(e.flyToEvent.don((s,o)=>this.flyTo(s,o))),this.d(e.flyInEvent.don((s,o)=>this.flyIn(s,o))),this.dispose(e.calcFlyInParamEvent.disposableOn(()=>{if(!t.actived)return;const s=t.getCurrentCameraInfo();if(!s)return;const{position:o,rotation:r}=s;e.flyInParam={position:o,rotation:r,flyDuration:1}})),this.dispose(e.calcFlyToParamEvent.disposableOn(()=>{e.useCalcFlyToParamInESObjectWithLocation||console.warn("calcFlyToParam无法调用,该对象缺少position属性!")}))}flyToWithPromise(e,t,n,s,o,r,a){const{sceneObject:l,olViewer:c}=this;c.flyTo({distance:n??0,heading:s?s[0]:0,pitch:s?s[1]:0,flyDuration:o??1,hDelta:r??0,pDelta:a??0},t)}flyTo(e,t){const{sceneObject:n,olViewer:s}=this;return s.actived?(n.flyToParam&&(n.useCalcFlyToParamInESObjectWithLocation||console.warn("flyToParam无法使用,该对象缺少position属性,若飞行失败,请清空flyToParam后重试!")),n.flyInParam?this.flyIn(e,t):!1):!1}flyIn(e,t){const{sceneObject:n,olViewer:s}=this;if(!s.actived)return!1;if(n.flyInParam){const{position:o,rotation:r,flyDuration:a}=n.flyInParam,l=e??a;return this.olViewer.flyIn(o,r,l),!0}return!1}get olViewer(){return this.viewer}}class dl extends ul{constructor(t,n){super(t,n);T(this,"_smoothMoving");this._smoothMoving=this.dv(new p.SmoothMoveController(n)),this.d(this._smoothMoving.currentPositionChanged.don(o=>{o&&(t.position=o)})),this.d(this._smoothMoving.currentRotationChanged.don(o=>{o&&this._smoothMoving.isRotating&&(t.rotation=o)})),this.d(this._smoothMoving.currentHeadingChanged.don(o=>{if(o!==void 0&&!this._smoothMoving.isRotating){const r=t.rotation;t.rotation=[o-90,r[1],r[2]]}})),this.d(t.smoothMoveEvent.don((o,r)=>this.smoothMove(o,r*1e3))),this.d(t.smoothMoveWithRotationEvent.don((o,r,a)=>this.smoothMoveWithRotation(o,r,a*1e3))),this.d(t.smoothMoveOnGroundEvent.don((o,r,a)=>this.smoothMoveOnGround(o,r,a*1e3))),this.d(t.smoothMoveWithRotationOnGroundEvent.don((o,r,a,l)=>this.smoothMoveWithRotationOnGround(o,r,a,l*1e3))),this.d(t.calcFlyToParamEvent.don(()=>{if(!t.useCalcFlyToParamInESObjectWithLocation||!t.position)return;const o=n.calcFlyToParam(t.position);if(!o){console.warn("olViewer.calcFlyToParam failed.");return}console.log("olViewer.calcFlyToParam success.",o),t.flyToParam=o})),this.d(t.automaticLandingEvent.don(async()=>{console.warn("ESOlViewer automaticLandingEvent is not supported.")}));const s=this.dv(p.createNextAnimateFrameEvent(t.minVisibleDistanceChanged,t.maxVisibleDistanceChanged));this.d(s.don(()=>this.visibleDistance(t,n))),this.d(n.cameraChanged.don(()=>this.visibleDistance(t,n)))}smoothMove(t,n){this._smoothMoving.isGround=!1,this._smoothMoving.isRotating=!1,this._smoothMoving.restart(this.sceneObject.position,this.sceneObject.rotation,0),this._smoothMoving.restart(t,this.sceneObject.rotation,n)}smoothMoveWithRotation(t,n,s){this._smoothMoving.isGround=!1,this._smoothMoving.isRotating=!0,this._smoothMoving.restart(this.sceneObject.position,this.sceneObject.rotation,0),this._smoothMoving.restart(t,n,s)}async smoothMoveOnGround(t,n,s){const o=await this.olViewer.getTerrainHeight([t,n])??0;this._smoothMoving.isGround=!0,this._smoothMoving.isRotating=!1,this._smoothMoving.restart(this.sceneObject.position,this.sceneObject.rotation,0),this._smoothMoving.restart([t,n,o],this.sceneObject.rotation,s)}async smoothMoveWithRotationOnGround(t,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],t,o)}visibleDistance(t,n){if(!t.show||!t.position)return;const s=p.getDistancesFromPositions([t.position,Py(n)],"NONE")[0];t.minVisibleDistance<t.maxVisibleDistance?s>t.minVisibleDistance&&s<t.maxVisibleDistance:t.maxVisibleDistance===0&&s>t.minVisibleDistance}flyTo(t,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:l,heading:c,pitch:h,flyDuration:u,hDelta:d,pDelta:f}=a;return this.flyToWithPromise(n,r,l,[c,h,0],t??u,d,f),!0}else return nf(o.viewer,s.position,t),!0}flyIn(t,n){const{sceneObject:s,olViewer:o}=this;return!o.actived||!o.viewer?!1:!super.flyIn(t,n)&&s.position?(nf(o.viewer,s.position,t),!0):!1}}class mg extends dl{constructor(t,n){super(t,n);T(this,"_lastHoverResult",this.dv(p.react(void 0)));if(!n.viewer){console.warn("viewer is undefined!");return}this.ad(p.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(t){this._lastHoverResult.value=t}get lastHoverResultChanged(){return this._lastHoverResult.changed}}const PA=i=>{const e=[];if(i){const t=i.length;let n=0;for(let s=0;s<t;++s){const o=(s+1)%t,r=p.geoDistance(i[s],i[o]),a=Math.abs(i[s][2]-i[o][2]),l=Math.sqrt(r*r+a*a);n+=l,e.push(n)}}return e},SA=i=>{let e;return i?(i.length<3?e=0:e=p.geoArea(i),e):0},RA=i=>{let e;return i?(i.length<3?e=void 0:e=p.geoCenterOfMass(i),e):void 0},vl=class vl extends ul{constructor(e,t){if(super(e,t),!t.viewer){console.warn("viewer is undefined!");return}}flyIn(e,t){if(!super.flyIn(e,t)){if(!this.olViewer.actived||!this.olViewer.viewer)return!1;const s=this.sceneObject.points;if(!s||s.length===0)return!1;const o=qc(s);return ka(this.olViewer.viewer,o,e),console.log("OlESGeoVector flyIn"),!0}return!0}flyTo(e,t){if(!super.flyTo(e,t)){if(!this.olViewer.actived||!this.olViewer.viewer)return!1;const s=this.sceneObject.points;if(!s||s.length===0)return!1;const o=qc(s);return ka(this.olViewer.viewer,o,e),console.log("OlESGeoVector flyTo"),!0}return!0}};T(vl,"type",vl.register("ESOlViewer",p.ESGeoVector.type,vl));let Gr=vl;class zo extends p.Destroyable{constructor(t,n){super();T(this,"_flyToEvent",this.disposeVar(new p.Event));if(!t.viewer)return;const o=this.ad(new ss(t,n)),r=this.ad(new Ut(t,n));r.loop=!0,this.ad(p.bind([r,"depthTest"],[this,"depthTest"])),this.d(p.track([o,"allowPicking"],[this,"allowPicking"]));const a=()=>{r.show=!!(this.show&&this.outline),o.show=!!(this.show&&this.fill),r.positions=this.positions,o.positions=o.show?this.positions||[]:[],r.color=this.outlineColor,r.width=this.outlineWidth;const[c=1,h=1,u=1,d=.5]=this.color||[1,1,1,.5];o.fillColor=[c,h,u,d]};a();const l=this.disposeVar(p.createNextAnimateFrameEvent(this.showChanged,this.outlineChanged,this.outlineColorChanged,this.outlineWidthChanged,this.fillChanged,this.colorChanged,this.positionsChanged));this.d(l.disposableOn(a)),this.d(this.flyToEvent.disposableOn(c=>{o.show?o.flyTo(c):r.show&&r.flyTo(c)}))}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}}T(zo,"defaults",{viewDistanceRange:[1e3,1e4,3e4,6e4],positions:[]}),(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,outline:!0,strokeGround:!1,outlineColor:p.reactArray([1,1,1,1]),outlineWidth:2,ground:!1,fill:!0,color:p.reactArray([1,1,1,.5]),positions:p.reactPositions(void 0),viewDistanceRange:p.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,depthTest:!1})})(zo||(zo={})),p.extendClassProps(zo.prototype,zo.createDefaultProps);const bl=class bl extends Gr{constructor(t,n){super(t,n);T(this,"_geoPolygon");if(!n.viewer){console.warn("viewer is undefined!");return}this._geoPolygon=this.ad(new ss(this.olViewer,t.id));const o=this.geoPolygon;o&&(this.d(p.track([o,"show"],[t,"show"])),this.d(p.track([o,"allowPicking"],[t,"allowPicking"])),this.d(p.bind([o,"positions"],[t,"points"])),this.d(p.track([o,"stroked"],[t,"stroked"])),this.d(p.track([o,"outlineColor"],[t,"strokeColor"])),this.d(p.track([o,"outlineWidth"],[t,"strokeWidth"])),this.d(p.track([o,"filled"],[t,"filled"])),this.d(p.track([o,"fillColor"],[t,"fillColor"])))}get geoPolygon(){return this._geoPolygon}};T(bl,"type",bl.register("ESOlViewer",p.ESGeoPolygon.type,bl));let fl=bl;function pl(i){var t;const e=(t=Zf(i,"pickResult"))==null?void 0:t.pointerEvent;return(e==null?void 0:e.buttons)!=0?(e==null?void 0:e.button)??0:-1}function TA(i,e,t){const n=[];for(const s of t)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":e>=1e3?n.push(`周长:${(e/1e3).toFixed(2)} km`):n.push(`周长:${e.toFixed(2)} m`);break}return n}class qr extends p.Destroyable{constructor(t,n){super();T(this,"_pickedEvent",this.dv(new p.Event));T(this,"_flyToEvent",this.dv(new p.Event));T(this,"_area",this.dv(p.react(0)));T(this,"_centerOfMass",this.dv(p.reactArrayWithUndefined(void 0)));T(this,"_distances",this.dv(p.reactArray([])));T(this,"_geoPolyline");T(this,"_id",this.dv(p.react(p.createGuid())));n&&(this.id=n);{const s=()=>{this._distances.value=PA(this.positions),this._area.value=SA(this.positions),this._centerOfMass.value=RA(this.positions)};s();const o=this.dv(p.createNextAnimateFrameEvent(this.positionsChanged));this.dispose(o.disposableOn(s))}{const s=this._geoPolyline=this.dv(new Ut(t,n));s.loop=!0,s.arcType="GEODESIC",this.dispose(p.bind([s,"color"],[this,"color"])),this.dispose(p.bind([s,"dashLength"],[this,"dashLength"])),this.dispose(p.bind([s,"dashPattern"],[this,"dashPattern"])),this.dispose(p.bind([s,"gapColor"],[this,"gapColor"])),this.dispose(p.bind([s,"hasArrow"],[this,"hasArrow"])),this.dispose(p.bind([s,"hasDash"],[this,"hasDash"])),this.dispose(p.bind([s,"positions"],[this,"positions"])),this.dispose(p.bind([s,"show"],[this,"show"])),this.dispose(p.bind([s,"allowPicking"],[this,"allowPicking"])),this.dispose(p.bind([s,"width"],[this,"width"])),this.dispose(p.bind([s,"depthTest"],[this,"depthTest"]))}{const s=this.dv(new zo(t,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(p.track([s,"show"],[this,"show"])),this.dispose(p.track([s,"ground"],[this,"ground"])),this.dispose(p.track([s,"allowPicking"],[this,"allowPicking"])),this.dispose(p.bind([s,"depthTest"],[this,"depthTest"])),this.d(this.flyToEvent.don(a=>{s.flyTo(a)}))}{const s=this.dv(new jt(t,n)),o=this.dv(p.createNextAnimateFrameEvent(this.areaChanged,this.centerOfMassChanged,this.distancesChanged,this.unitsChanged)),r=()=>{if(this.distances.length===0){s.innerHTML="";return}const a=TA(this.area,this.distances[this.distances.length-1],this.units);s.innerHTML=xh([...a].join(`
|
|
169
|
-
`))};r(),this.dispose(o.disposableOn(r)),this.dispose(p.track([s,"show"],[this,"show"])),this.dispose(p.track([s,"allowPicking"],[this,"allowPicking"])),this.dispose(p.bind([s,"shadowDom"],[this,"shadowDom"])),this.dispose(p.bind([s,"cssAllInitial"],[this,"cssAllInitial"])),this.dispose(p.track([s,"position"],[this,"centerOfMass"])),this.ad(s.pickedEvent.don(a=>{pl(a)===0&&this.pickedEvent.emit(a)}))}}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}get area(){return this._area.value}get areaChanged(){return this._area.changed}get centerOfMass(){return this._centerOfMass.value}get centerOfMassChanged(){return this._centerOfMass.changed}get distances(){return this._distances.value}get distancesChanged(){return this._distances.changed}get geoPolyline(){return this._geoPolyline}get id(){return this._id.value}set id(t){this._id.value=t}get idChanged(){return this._id.changed}}T(qr,"defaults",{positions:[]}),(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:p.reactPositions(void 0),width:2,color:p.reactArray([1,1,1,.5]),fillColor:p.reactArray([1,1,1,.5]),hasDash:!1,gapColor:p.reactArray([0,0,0,0]),dashLength:16,dashPattern:255,hasArrow:void 0,depthTest:!1,shadowDom:!1,cssAllInitial:!1,strokeGround:!0,ground:!0,units:p.reactArray(["SquareMeter_SquareKilometer","MU_Hectare","PerimeterMeter_PerimeterKilometer"])})})(qr||(qr={})),p.extendClassProps(qr.prototype,qr.createDefaultProps);const El=class El extends fl{constructor(t,n){super(t,n);T(this,"_olAreaMeasurement");if(this._olAreaMeasurement=this.disposeVar(new qr(n,t.id)),!n.viewer){console.warn("viewer is undefined!");return}t.strokeGround=!1,t.fillGround=!1;const o=this._olAreaMeasurement;this.dispose(p.track([o,"show"],[t,"show"])),this.dispose(p.track([o,"units"],[t,"units"])),this.dispose(p.track([o,"allowPicking"],[t,"allowPicking"])),this.dispose(p.bind([o,"positions"],[t,"points"])),this.dispose(p.bind([o,"strokeGround"],[t,"strokeGround"])),this.d(p.bind([o,"ground"],[t,"fillGround"]));{const r=()=>{if(t.stroked)o.width=t.strokeWidth;else{o.width=0;return}o.color=t.strokeColor;const c=t.strokeStyle;if(c.material==="hasDash"&&c.materialParams)try{const u=c.materialParams;Reflect.has(u,"gapColor")&&(o.gapColor=u.gapColor??[0,0,0,0]),Reflect.has(u,"dashLength")&&(o.dashLength=u.dashLength),Reflect.has(u,"dashPattern")&&(o.dashPattern=u.dashPattern)}catch(u){console.error(u)}else o.gapColor=[0,0,0,0],o.dashLength=0,o.dashPattern=0;const h=t.strokeMaterial??"normal";h==="hasDash"?(o.hasDash=!0,o.hasArrow=!1):h==="hasArrow"?(o.hasDash=!1,o.hasArrow=!0):(o.hasDash=!1,o.hasArrow=!1)};r();const a=this.disposeVar(p.createNextAnimateFrameEvent(t.strokeStyleChanged,t.strokedChanged));this.dispose(a.disposableOn(r))}{const r=()=>{if(t.filled)o.fillColor=t.fillColor;else{o.fillColor=[1,1,1,0];return}};r();const a=this.disposeVar(p.createNextAnimateFrameEvent(t.fillStyleChanged,t.filledChanged));this.dispose(a.disposableOn(r))}this.dispose(o.pickedEvent.disposableOn(r=>{(t.allowPicking??!1)&&t.pickedEvent.emit(r)}))}get olAreaMeasurement(){return this._olAreaMeasurement}};T(El,"type",El.register("ESOlViewer",p.ESAreaMeasurement.type,El));let yg=El;const Uo=class Uo extends p.Destroyable{constructor(t,n){super();T(this,"_pickedEvent",this.disposeVar(new p.Event));T(this,"_flyToEvent",this.disposeVar(new p.Event));T(this,"_heading",this.disposeVar(p.react(0)));T(this,"_textFunc",this.disposeVar(p.react(void 0)));const s=this;{const a=()=>{if(this.positions&&this.positions.length>=2){let c=0;this.arcType===void 0||this.arcType==="GEODESIC"?c=p.geoHeading(this.positions[0],this.positions[1]):this.arcType==="RHUMB"?c=p.geoRhumbHeading(this.positions[0],this.positions[1]):this.arcType==="NONE"?c=p.geoHeading(this.positions[0],this.positions[1]):console.warn(`未知的arcType: ${this.arcType},导致距离无法计算!`),this._heading.value=this.angleMode==="-180~180"?p.clampN180_180(c):p.clamp0_360(c)}};a();const l=this.disposeVar(p.createNextAnimateFrameEvent(this.positionsChanged,this.arcTypeChanged,this.angleModeChanged));this.dispose(l.disposableOn(a))}const o=this.disposeVar(new Ut(t,n));o.loop=!1,this.dispose(p.track([o,"allowPicking"],[s,"allowPicking"])),this.dispose(p.bind([o,"arcType"],[s,"arcType"])),this.dispose(p.bind([o,"color"],[s,"color"])),this.dispose(p.bind([o,"dashLength"],[s,"dashLength"])),this.dispose(p.bind([o,"dashPattern"],[s,"dashPattern"])),this.dispose(p.bind([o,"gapColor"],[s,"gapColor"])),this.dispose(p.bind([o,"hasArrow"],[s,"hasArrow"])),this.dispose(p.bind([o,"hasDash"],[s,"hasDash"])),this.dispose(p.bind([o,"positions"],[s,"positions"])),this.dispose(p.bind([o,"show"],[s,"show"])),this.dispose(p.bind([o,"width"],[s,"width"])),this.dispose(p.bind([o,"depthTest"],[s,"depthTest"])),this.dispose(s.flyToEvent.disposableOn(a=>{t.actived&&o.flyTo(a)}));const r=this.disposeVar(new jt(t,n));this.dispose(p.bind([r,"shadowDom"],[s,"shadowDom"])),this.dispose(p.bind([r,"cssAllInitial"],[s,"cssAllInitial"])),this.dispose(p.bind([r,"show"],[s,"show"]));{const a=()=>{s.positions&&s.positions.length>=2?r.position=s.positions[1]:r.position=void 0};a(),this.dispose(s.positionsChanged.disposableOn(a))}{const a=()=>{const{heading:c}=s,h=(s.textFunc??Uo.defaultTextFunc_度格式)(c);r.innerHTML=xh(`方向: ${h}`,24)};a();const l=this.disposeVar(p.createNextAnimateFrameEvent(s.headingChanged,s.textFuncChanged));this.dispose(l.disposableOn(a))}this.ad(r.pickedEvent.don(a=>{pl(a)===0&&this.pickedEvent.emit(a)}))}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}get heading(){return this._heading.value}get headingChanged(){return this._heading.changed}get textFunc(){return this._textFunc.value}set textFunc(t){this._textFunc.value=t}get textFuncChanged(){return this._textFunc.changed}};T(Uo,"defaultTextFunc_度格式",t=>`${t.toFixed(5)}°`),T(Uo,"defaultTextFunc_度分格式",t=>`${Ph(t,!0)}`),T(Uo,"defaultTextFunc_度分秒格式",t=>`${Ph(t,!1)}`),T(Uo,"defaults",{positions:[]});let No=Uo;(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:p.reactPositions(void 0),width:4,color:p.reactArray([1,1,1,1]),hasDash:!1,gapColor:p.reactArray([0,0,0,0]),dashLength:16,dashPattern:255,hasArrow:!0,arcType:"GEODESIC",depthTest:!1,shadowDom:!1,cssAllInitial:!1,angleMode:"-180~180",strokeGround:!1})})(No||(No={})),p.extendClassProps(No.prototype,No.createDefaultProps);const Cl=class Cl extends Gr{constructor(t,n){super(t,n);T(this,"_olDirectionMeasurement");if(this._olDirectionMeasurement=this.disposeVar(new No(n,t.id)),!n.viewer){console.warn("viewer is undefined!");return}const o=this._olDirectionMeasurement;o.angleMode="0~360",this.dispose(p.track([o,"show"],[t,"show"])),this.dispose(p.track([o,"allowPicking"],[t,"allowPicking"])),this.dispose(p.bind([o,"positions"],[t,"points"])),this.dispose(p.bind([o,"strokeGround"],[t,"strokeGround"]));{const r=()=>{if(t.stroked)o.width=t.strokeWidth;else{o.width=0;return}o.width=t.strokeWidth,o.color=t.strokeColor;const c=t.strokeMaterial??"normal";c==="hasDash"?(o.hasDash=!0,o.hasArrow=!1):c==="hasArrow"?(o.hasDash=!1,o.hasArrow=!0):c==="normal"?(o.hasDash=!1,o.hasArrow=!1):(o.hasDash=!1,o.hasArrow=!0);const h=t.strokeStyle;if(h.material==="hasDash"&&h.materialParams)try{const u=h.materialParams;Reflect.has(u,"gapColor")&&(o.gapColor=u.gapColor??[0,0,0,0]),Reflect.has(u,"dashLength")&&(o.dashLength=u.dashLength),Reflect.has(u,"dashPattern")&&(o.dashPattern=u.dashPattern)}catch(u){console.error(u)}else o.gapColor=[0,0,0,0],o.dashLength=0,o.dashPattern=0};r();const a=this.disposeVar(p.createNextAnimateFrameEvent(t.strokeStyleChanged,t.strokedChanged));this.dispose(a.disposableOn(r))}this.dispose(o.pickedEvent.disposableOn(r=>{pl(r)===0&&(t.allowPicking??!1)&&t.pickedEvent.emit(r)}))}get olDirectionMeasurement(){return this._olDirectionMeasurement}};T(Cl,"type",Cl.register("ESOlViewer",p.ESDirectionMeasurement.type,Cl));let _g=Cl;function Yw(i,e,t,n){const s=new jt(t,n);return s.innerHTML=xh(i),s.position=e,s.show=!0,s}class Vr extends p.Destroyable{constructor(t,n){super();T(this,"_pickedEvent",this.disposeVar(new p.Event));T(this,"_flyToEvent",this.disposeVar(new p.Event));T(this,"_distances",this.disposeVar(p.reactArray([])));const s=async()=>{this._distances.value=p.getDistancesFromPositions(this.positions??[],this.arcType)};s();const o=this.disposeVar(p.createNextAnimateFrameEvent(this.positionsChanged,this.arcTypeChanged,this.strokeGroundChanged));this.dispose(o.disposableOn(s));const r=this.disposeVar(new Ut(t,n));r.loop=!1,this.dispose(p.track([r,"allowPicking"],[this,"allowPicking"])),this.dispose(p.bind([r,"arcType"],[this,"arcType"])),this.dispose(p.bind([r,"color"],[this,"color"])),this.dispose(p.bind([r,"dashLength"],[this,"dashLength"])),this.dispose(p.bind([r,"dashPattern"],[this,"dashPattern"])),this.dispose(p.bind([r,"gapColor"],[this,"gapColor"])),this.dispose(p.bind([r,"hasArrow"],[this,"hasArrow"])),this.dispose(p.bind([r,"hasDash"],[this,"hasDash"])),this.dispose(p.bind([r,"positions"],[this,"positions"])),this.dispose(p.bind([r,"show"],[this,"show"])),this.dispose(p.bind([r,"width"],[this,"width"])),this.dispose(p.bind([r,"depthTest"],[this,"depthTest"])),this.dispose(this.flyToEvent.disposableOn(a=>{t.actived&&r.flyTo(a)}));{const a=[],l=()=>{for(let h of a)h.destroy();a.length=0};this.dispose(l);const c=()=>{if(l(),!this.positions)return;if(this.positions.length>0&&this.distances.length>0){const u=Yw("起点",this.positions[0],t,n);u.dispose(p.track([u,"show"],[this,"show"])),u.dispose(p.track([u,"shadowDom"],[this,"shadowDom"])),u.dispose(p.track([u,"cssAllInitial"],[this,"cssAllInitial"])),a.push(u)}const h=this.distances.length;for(let u=0;u<h;++u){const d=this.distances[u],f=this.positions[u+1],g=Yw(`长度: ${e1(d)}`,f,t,n);g.dispose(p.track([g,"show"],[this,"show"])),g.dispose(p.track([g,"shadowDom"],[this,"shadowDom"])),g.dispose(p.track([g,"cssAllInitial"],[this,"cssAllInitial"])),this.ad(g.pickedEvent.don(_=>{pl(_)===0&&this.pickedEvent.emit(_)})),a.push(g)}};c(),this.dispose(this.distancesChanged.disposableOn(()=>p.inOrderRunning(c)))}}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}get distances(){return this._distances.value}get distancesChanged(){return this._distances.changed}}T(Vr,"defaults",{positions:[]}),(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:p.reactPositions(void 0),width:1,color:p.reactArray([1,1,1,1]),hasDash:!1,gapColor:p.reactArray([0,0,0,0]),dashLength:16,dashPattern:255,hasArrow:!1,arcType:"GEODESIC",depthTest:!1,shadowDom:!1,cssAllInitial:!1,strokeGround:!1})})(Vr||(Vr={})),p.extendClassProps(Vr.prototype,Vr.createDefaultProps);const xl=class xl extends Gr{constructor(t,n){super(t,n);T(this,"_geoPolyline");if(this._geoPolyline=this.disposeVar(new Ut(n,t.id)),!n.viewer){console.warn("viewer is undefined!");return}const o=this._geoPolyline;console.log(o.positions),console.log(t.points),this.dispose(p.track([o,"allowPicking"],[t,"allowPicking"])),this.dispose(p.bind([o,"positions"],[t,"points"])),this.dispose(p.track([o,"width"],[t,"strokeWidth"])),this.dispose(p.track([o,"color"],[t,"strokeColor"])),this.dispose(p.track([o,"show"],[t,"show"]));{const r=()=>{o.show=t.show&&t.stroked};r();const a=this.disposeVar(p.createNextAnimateFrameEvent(t.showChanged,t.strokedChanged));this.dispose(a.disposableOn(r))}}get geoPolyline(){return this._geoPolyline}};T(xl,"type",xl.register("ESOlViewer",p.ESGeoLineString.type,xl));let gl=xl;const Pl=class Pl extends gl{constructor(t,n){super(t,n);T(this,"_olDistanceMeasurement");if(console.log("OlESDistanceMeasurement constructor",n.viewer),this._olDistanceMeasurement=this.disposeVar(new Vr(n,t.id)),!n.viewer){console.warn("viewer is undefined!");return}const{olDistanceMeasurement:o}=this;this.dispose(p.track([o,"show"],[t,"show"])),this.dispose(p.track([o,"allowPicking"],[t,"allowPicking"])),this.dispose(p.bind([o,"positions"],[t,"points"])),this.dispose(p.bind([o,"strokeGround"],[t,"strokeGround"]));{const r=()=>{if(t.stroked)o.width=t.strokeWidth;else{o.width=0;return}o.width=t.strokeWidth,o.color=t.strokeColor;const c=t.strokeMaterial??"normal";c==="hasDash"?(o.hasDash=!0,o.hasArrow=!1):c==="hasArrow"?(o.hasDash=!1,o.hasArrow=!0):(o.hasDash=!1,o.hasArrow=!1);const h=t.strokeStyle;if(h.material==="hasDash"&&h.materialParams)try{const u=h.materialParams;Reflect.has(u,"gapColor")&&(o.gapColor=u.gapColor??[0,0,0,0]),Reflect.has(u,"dashLength")&&(o.dashLength=u.dashLength),Reflect.has(u,"dashPattern")&&(o.dashPattern=u.dashPattern)}catch(u){console.error(u)}else o.gapColor=[0,0,0,0],o.dashLength=0,o.dashPattern=0};r();const a=this.disposeVar(p.createNextAnimateFrameEvent(t.strokeStyleChanged,t.strokedChanged));this.dispose(a.disposableOn(r))}this.dispose(o.pickedEvent.disposableOn(r=>{pl(r)===0&&(t.allowPicking??!1)&&t.pickedEvent.emit(r)}))}get olDistanceMeasurement(){return this._olDistanceMeasurement}};T(Pl,"type",Pl.register("ESOlViewer",p.ESDistanceMeasurement.type,Pl));let wg=Pl;const Sl=class Sl extends dl{constructor(e,t){super(e,t);const n=t.viewer;if(!n)return;const s=new vn,o=new zi.Feature({geometry:new wn(Ie([e.position[0]??0,e.position[1]??0]))});s.addFeature(o),o.setId(e.id),this.d(e.positionChanged.don(f=>{const g=Ie([f[0],f[1]]),_=o.getGeometry();_==null||_.setCoordinates(g)}));const r=new zn({source:s});n.addLayer(r),this.d(()=>n.removeLayer(r));let a=64,l=64;{const f=new Image;f.onload=()=>{console.log("Image loaded",f.width),a=f.width,l=f.height},f.src=e.url,this.d(e.urlChanged.don(()=>{const g=p.ESSceneObject.context.getStrFromEnv(p.rpToap(e.url));f.src=g}))}function c(f,g,_){const v=p.ESSceneObject.context.getStrFromEnv(p.rpToap(f)),E=a*g[0],w=l*g[1],C=_*Math.PI/180;return new $e({image:new Ps({src:v,width:E,height:w,anchor:[.5,1],anchorXUnits:"fraction",anchorYUnits:"fraction",rotation:C})})}let h=c(e.url,[1,1],e.rotation[0]??0);const u=()=>{const f=n.getView().getResolution();if(!f)return;const{size_m:[g,_],minmaxScale:[v,E]}=e;let w=g/f/a,C=_/f/l;w=Math.max(v,Math.min(E,w)),C=Math.max(v,Math.min(E,C)),h=c(e.url,[w,C],e.rotation[0]??0),o.setStyle(h),o.changed()};this.d(p.createEventsCallFunc([e.size_mChanged,e.urlChanged,e.minmaxScaleChanged,e.rotationChanged],u)),u();const d=n.getView().on("change:resolution",()=>{u()});this.d(()=>gi(d))}};T(Sl,"type",Sl.register("ESOlViewer",p.ESGeoIcon.type,Sl));let vg=Sl;const Rl=class Rl extends dl{constructor(t,n){super(t,n);T(this,"_geoPoint");if(this._geoPoint=this.disposeVar(new li(n,t.id)),!n.viewer){console.warn("viewer is undefined!");return}const o=this._geoPoint;this.d(p.track([o,"allowPicking"],[t,"allowPicking"])),this.d(p.bind([o,"position"],[t,"position"])),this.d(p.track([o,"show"],[t,"show"]));{const r=()=>{o.show=t.show&&t.pointed};r();const a=this.dv(p.createNextAnimateFrameEvent(t.showChanged,t.pointedChanged));this.d(a.don(r))}}get geoPoint(){return this._geoPoint}};T(Rl,"type",Rl.register("ESOlViewer",p.ESGeoPoint.type,Rl));let bg=Rl;const Tl=class Tl extends Gr{constructor(t,n){super(t,n);T(this,"_geoPoints");const s=this.dv(new Hs(n,t.id));if(this._geoPoints=s,!n.viewer){console.warn("viewer is undefined!");return}this.d(p.track([s,"allowPicking"],[t,"allowPicking"])),this.d(p.bind([s,"points"],[t,"points"]));{const r=()=>{s.show=t.show&&t.pointed};this.d(p.createEventsCallFunc([t.showChanged,t.pointedChanged],r,{immediate:!0}))}}get geoPoints(){return this._geoPoints}};T(Tl,"type",Tl.register("ESOlViewer",p.ESGeoPoints.type,Tl));let Eg=Tl;const Il=class Il extends fl{constructor(t,n){super(t,n);T(this,"_fireLayer");T(this,"_fireFeatures",[]);T(this,"_animationId",null);T(this,"_renderEventsKey",null);T(this,"_flickerPhase",0);if(!n.viewer){console.warn("OlESGeoPolygonWithFire: viewer is undefined!");return}const o=this.geoPolygon;if(o){const r=()=>{o.show=!1};r(),this.d(t.showChanged.don(r)),this.d(t.fireShowChanged.don(r))}this.createFireLayer(n),this.disposeVar(p.createNextAnimateFrameEvent(t.pointsChanged,t.fireShowChanged,t.fireHeightChanged,t.showChanged))}createFireLayer(t){const n=this.sceneObject;if(!n.points||n.points.length<3)return;const s=t.viewer;if(!s)return;const o=new vn;this._fireLayer=new zn({source:o,zIndex:999}),s.addLayer(this._fireLayer),this.d(()=>{this._fireLayer&&s.removeLayer(this._fireLayer)}),this.createFireFeatures(n),this.startFlickerAnimation()}createFireFeatures(t){if(!this._fireLayer||!t.points)return;const n=t.points,s=t.fireHeight??5,o=Math.max(1,Math.min(10,s)),r=this.calculateCentroid(n),a=Ie([r[0],r[1]]),l=n.map(g=>Ie([g[0],g[1]])),c=l[0],h=l[l.length-1];(c[0]!==h[0]||c[1]!==h[1])&&l.push(c);const u=1+o*.08,d=[{color:[.8,.1,0,.15+o*.01],expand:u*1.3,stroke:!1},{color:[1,.25,0,.2+o*.02],expand:u*1.15,stroke:!1},{color:[1,.4,0,.3+o*.02],expand:u*1,stroke:!1},{color:[1,.6,0,.4+o*.03],expand:u*.85,stroke:!1},{color:[1,.85,.1,.5+o*.03],expand:u*.65,stroke:!1},{color:[1,1,.6,.4+o*.04],expand:u*.4,stroke:!1}],f=this._fireLayer.getSource();if(f){this._fireFeatures=[];for(const g of d){const _=l.map(C=>{const P=C[0]-a[0],R=C[1]-a[1];return[a[0]+P*g.expand,a[1]+R*g.expand]}),v=new Kn([_]),E=new zi.Feature({geometry:v}),w=new $e({fill:new vt({color:`rgba(${Math.round(g.color[0]*255)}, ${Math.round(g.color[1]*255)}, ${Math.round(g.color[2]*255)}, ${g.color[3]})`}),stroke:g.stroke?new St({color:`rgba(${Math.round(g.color[0]*255)}, ${Math.round(g.color[1]*255)}, ${Math.round(g.color[2]*255)}, ${g.color[3]*1.5})`,width:2}):void 0});E.setStyle(w),f.addFeature(E),this._fireFeatures.push(E)}}}startFlickerAnimation(){if(!this._fireLayer)return;this.stopFlickerAnimation();const n=this.sceneObject.fireHeight??5,s=Math.max(1,Math.min(10,n)),o=.05+s*.015;this._renderEventsKey=this._fireLayer.on("postrender",r=>{if(!r.frameState)return;this._flickerPhase+=o,this._flickerPhase>Math.PI*2&&(this._flickerPhase-=Math.PI*2);const l=this._fireFeatures,c=this._flickerPhase;for(let h=0;h<l.length;h++){const d=l[h].getStyle();if(!d)continue;const f=d.getFill();if(!f)continue;const g=[.15+s*.01,.2+s*.02,.3+s*.02,.4+s*.03,.5+s*.03,.4+s*.04],_=h*.7,v=Math.sin(c+_)*.5+.5,E=Math.sin(c*2.3+_*1.5)*.3+.7,w=g[h]*(.6+v*.4)*E,P=f.getColor().match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(P){const R=parseInt(P[1]),O=parseInt(P[2]),I=parseInt(P[3]);f.setColor(`rgba(${R}, ${O}, ${I}, ${w})`)}}})}stopFlickerAnimation(){this._renderEventsKey&&(gi(this._renderEventsKey),this._renderEventsKey=null),this._animationId!==null&&(cancelAnimationFrame(this._animationId),this._animationId=null)}destroyFireLayer(){if(this.stopFlickerAnimation(),this._fireLayer){const t=this.olViewer.viewer;t&&t.removeLayer(this._fireLayer),this._fireLayer.dispose(),this._fireLayer=void 0}this._fireFeatures=[]}calculateCentroid(t){let n=0,s=0,o=0;const r=t.length;for(let a=0,l=r-1;a<r;l=a++){const[c,h]=t[l],[u,d]=t[a],f=c*d-u*h;n+=f,s+=(c+u)*f,o+=(h+d)*f}return n*=.5,Math.abs(n)<1e-9?t[0]:(s/=6*n,o/=6*n,[s,o])}};T(Il,"type",Il.register("ESOlViewer",p.ESGeoPolygonWithFire.type,Il));let Cg=Il;class Zw extends p.Destroyable{constructor(t,n){super();T(this,"_olGeoCanvasImagePoi");T(this,"flyTo",(t,n)=>{if(this.olGeoCanvasImagePoi.position){Yi(this.olViewer,this.olGeoCanvasImagePoi.position,1e3,Cy,t);return}this.olGeoCanvasImagePoi.flyTo(t&&t*1e3)});this.sceneObject=t,this.olViewer=n,this._olGeoCanvasImagePoi=this.dv(new Si(n));const s=this._olGeoCanvasImagePoi;s.pickOnClick=!0,this.d(s.pickedEvent.don(o=>{(t.allowPicking??!1)&&t.pickedEvent.emit(o)}));{const o=h=>{let u=h;return h.includes("inner://")&&(u="${earthsdk3-assets-script-dir}/assets/img/points/"+h.split("inner://")[1]),p.ESSceneObject.context.getStrFromEnv(p.rpToap(u))},r=()=>{const h=o(typeof t.url=="string"?t.url:t.url.url);if(s.imageUri=h,t.sizeByContent){const d=new Image;d.src=h,d.onload=()=>{s.size=[d.width,d.height]}}else{const d=t.size;s.size=[...d]}},a=this.disposeVar(p.createNextAnimateFrameEvent(t.urlChanged,t.sizeByContentChanged,t.sizeChanged));this.d(a.don(()=>r())),r(),this.d(p.track([s,"zOrder"],[t,"zOrder"])),this.d(p.track([s,"show"],[t,"show"])),this.d(p.bind([s,"position"],[t,"position"])),this.ad(p.bind([s,"isHoverZoom"],[t,"isHoverZoom"]));{const h=()=>{s.scale=[t.scale[1],t.scale[2]]};h(),this.d(t.scaleChanged.don(h))}const l=()=>{const h=t.anchor,u=t.offset;h?s.originRatioAndOffset=[...h,-u[0],-u[1]]:s.originRatioAndOffset=[0,0,0,0]},c=this.ad(p.createNextAnimateFrameEvent(t.anchorChanged,t.offsetChanged));this.d(c.don(()=>l())),l(),this.d(s.clickEvent.don(h=>{const{offsetX:u,offsetY:d}=h,g={type:h.button===0?"leftClick":h.button===2?"rightClick":void 0,add:{mousePos:[u,d]}};t.widgetEvent.emit(g)})),this.d(s.hoveredChanged.don(h=>{if(h===void 0)return;const u={type:h?"mouseEnter":"mouseLeave"};t.widgetEvent.emit(u)}))}}get olGeoCanvasImagePoi(){return this._olGeoCanvasImagePoi}}const Ol=class Ol extends mg{constructor(t,n){super(t,n);T(this,"_resetting");if(!n.viewer){console.warn("viewer is undefined!");return}const o=this.dv(p.createNextAnimateFrameEvent(this.sceneObject.urlChanged,this.sceneObject.screenRenderChanged,this.sceneObject.sizeByContentChanged,this.sceneObject.sizeChanged));this._resetting=this.dv(new p.ObjResettingWithEvent(o,()=>new Zw(this.sceneObject,this.olViewer)))}get resetting(){return this._resetting}flyTo(t,n){const{sceneObject:s,olViewer:o,resetting:r}=this;return o.actived?s.flyToParam||s.flyInParam?super.flyTo(t,n):(r&&r.obj&&r.obj.flyTo(t,n),s.flyOverEvent.emit(n,"over",o),!0):!1}};T(Ol,"type",Ol.register("ESOlViewer",p.ESImageLabel.type,Ol));let xg=Ol;function Kw(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 Al=class Al extends ul{constructor(t,n){super(t,n);T(this,"_olImagery");if(!n.viewer){console.warn("viewer is undefined!");return}const o=this.dv(new gg(n,t.id));this._olImagery=o;const r=this.ad(p.reactJson(""));{const h=()=>{if(typeof t.url=="string")r.value=p.ESSceneObject.context.getStrFromEnv(t.url);else{const u=t.url;u.url=p.ESSceneObject.context.getStrFromEnv(u.url),r.value=u}};h(),this.ad(t.urlChanged.don(h))}const a=()=>{var v,E;if(!r.value)return;const h=(((v=t.options)==null?void 0:v.type)??"auto").toLowerCase(),u=t.options??{};let d={type:"UrlTemplateImageryProvider",url:r.value,rectangle:t.rectangle,maximumLevel:t.maximumLevel,minimumLevel:t.minimumLevel,...u},f=r.value,g=typeof f=="string"?f:f.url;const _=g.toLowerCase();if(Kw(h)==="auto")if(_.startsWith("ion://")){const C=+_.substring(6);d={...u,assetId:C,type:"IonImageryProvider"}}else if(_.includes("{x}")||_.includes("{y}")||_.includes("{z}"))d.type="UrlTemplateImageryProvider";else if(_.includes("wmts"))d.type="WebMapTileServiceImageryProvider";else if(_.includes("wms"))d.type="WebMapServiceImageryProvider";else{if(g.includes("/tilemapresource.xml")){const w=g.split("/tilemapresource.xml").join("");typeof f=="string"?f=w:f.url=w,d.url=f}d.type="TileMapServiceImageryProvider"}else{if(h==="tms"&&g.includes("/tilemapresource.xml")){const C=g.split("/tilemapresource.xml").join("");typeof f=="string"?f=C:f.url=C,d.url=f}else if(h==="ion"&&_.startsWith("ion://")){const P=+g.substring(6);d={...u,assetId:P,type:"IonImageryProvider"}}const w=Kw(h);w!=="auto"&&(d.type=w)}if(d.type==="WebMapTileServiceImageryProvider"){let w=typeof f=="string"?f:f.url;const C=w.indexOf("?");if(C>=0){const M=new URLSearchParams(w.substring(C+1)),z=M.get("format")||M.get("Format")||d.format;d.format=z||"image/png",w=w.substring(0,C)}else d.format=d.format??"image/png";const P=(E=/\/wmts\/rest\/([^/]+)\//i.exec(w))==null?void 0:E[1];P?d.layer=d.layer??d.layers??P:d.layer=d.layer??d.layers??"";const R=d.tileMatrixSetID||d.TileMatrixSet||"EPSG:4326";let O=d.tileMatrixLabels||d.TileMatrixLabels;(!O||!Array.isArray(O)||O.length===0)&&(O=Array.from({length:22},(M,z)=>`${R}:${z}`)),d.tileMatrixSetID=R,d.tileMatrixLabels=O,d.style=d.style??"default";const I=w.toLowerCase().indexOf("/wmts/");if(I>=0){const M=w.substring(0,I);d.url=`${M}/wmts`;const z=typeof f=="string"?f:f.url,k=/\/wmts\/rest\/([^/]+)\//i.exec(z);k&&k[1]&&(d.layer=k[1]),d._rawUrl=z}else{d.url=w;const M=typeof f=="string"?f:f.url,z=/\/wmts\/rest\/([^/]+)\//i.exec(M);z&&z[1]&&(d.layer=z[1]),d._rawUrl=M}d.requestEncoding="KVP",d.requestencoding="KVP",d.params=void 0}else if(d.type==="WebMapServiceImageryProvider"){const w=d.layer??d.layers??"",C=d.style??"",P=d.format??"image/png";d.params={...d.params??{},LAYERS:w,STYLES:C,FORMAT:P,TILED:!0,TRANSPARENT:!0}}else d.type==="TileMapServiceImageryProvider"?d.yReverse=d.yReverse??!0:d.type==="IonImageryProvider"&&console.warn("[OlESImageryLayer] 在 OL 侧使用 ion:// 可能无效,请在外部将 ion 转换为可用的 xyz/wmts/wms/tms 源 URL。");o.imageryProvider=d};a();const l=[r.changed,t.maximumLevelChanged,t.minimumLevelChanged,t.optionsChanged,t.rectangleChanged],c=this.dv(p.createNextAnimateFrameEvent(...l));this.d(c.don(a)),this.d(p.track([o,"show"],[t,"show"])),this.d(p.track([o,"splitDirection"],[t,"splitDirection"])),this.d(p.track([o,"brightness"],[t,"czmBrightness"])),this.d(p.track([o,"contrast"],[t,"czmContrast"])),this.d(p.track([o,"hue"],[t,"czmHue"])),this.d(p.track([o,"saturation"],[t,"czmSaturation"])),this.d(p.track([o,"gamma"],[t,"czmGamma"])),this.d(p.track([o,"rectangle"],[t,"rectangle"])),this.d(p.track([o,"zIndex"],[t,"zIndex"])),this.d(p.bind([o,"alpha"],[t,"opacity"])),this.d(p.bind([o,"alpha"],[t,"czmAlpha"]))}get olImagery(){return this._olImagery}flyTo(t,n){const{sceneObject:s,olViewer:o,olImagery:r}=this;return o.actived?s.flyToParam||s.flyInParam?super.flyTo(t,n):(r.flyTo(t&&t),s.flyOverEvent.emit(n,"over",o),!0):!1}flyIn(t,n){const{sceneObject:s,olViewer:o,olImagery:r}=this;return o.actived?s.flyInParam?super.flyIn(t,n):(r.flyTo(t&&t),s.flyOverEvent.emit(n,"over",o),!0):!1}};T(Al,"type",Al.register("ESOlViewer",p.ESImageryLayer.type,Al));let Pg=Al;function Qw(i,e=!1){const t=Ph(i[0],e),n=Ph(i[1],e),s=e1(i[2]);return[t,n,s]}const Gn=class Gn extends dl{constructor(t,n){super(t,n);T(this,"_geoCustomDivPoi");T(this,"_textFunc",this.disposeVar(p.react(void 0)));if(!n.viewer){console.warn("viewer is undefined!");return}this._geoCustomDivPoi=this.disposeVar(new jt(n,t.id));const o=this.geoCustomDivPoi;this.dispose(p.track([o,"show"],[t,"show"])),this.dispose(p.bind([o,"position"],[t,"position"])),this.dispose(p.track([o,"allowPicking"],[t,"allowPicking"]));{this.dispose(o.pickedEvent.disposableOn(r=>{(t.allowPicking??p.ESLocationMeasurement.defaults.allowPicking)&&t.pickedEvent.emit(r)})),this.dispose(o.innerHtmlMounted.disposableOn(r=>{const a=r.firstElementChild;a&&(a.style.pointerEvents="auto",a.style.cursor="default",a.onclick=l=>o.pickFromDiv(a,{type:"viewerPicking",pointerEvent:l}))}));{const r=()=>{if(!t.position)return;const l=(this.textFunc??Gn.defaultTextFunc_度格式)(t.position);o.innerHTML=xh(l)};r();const a=this.disposeVar(p.createNextAnimateFrameEvent(t.positionChanged,this.textFuncChanged));this.dispose(a.disposableOn(r))}{const r=()=>{n.lonLatFormat??(n.lonLatFormat="DECIMAL_DEGREE"),this.textFunc=n.lonLatFormat=="DECIMAL_DEGREE"?Gn.defaultTextFunc_度格式:n.lonLatFormat=="DEGREES_DECIMAL_MINUTES"?Gn.defaultTextFunc_度分格式:Gn.defaultTextFunc_度分秒格式};r(),this.d(n.lonLatFormatChanged.don(()=>{r()}))}}}get geoCustomDivPoi(){return this._geoCustomDivPoi}get textFunc(){return this._textFunc.value}set textFunc(t){this._textFunc.value=t}get textFuncChanged(){return this._textFunc.changed}flyTo(t,n){const{sceneObject:s,olViewer:o,geoCustomDivPoi:r}=this;return o.actived?s.flyToParam||s.flyInParam?super.flyTo(t,n):(r.flyTo(t),s.flyOverEvent.emit(n,"over",o),!0):!1}flyIn(t,n){const{sceneObject:s,olViewer:o,geoCustomDivPoi:r}=this;return o.actived?s.flyInParam?super.flyIn(t,n):(r.flyTo(t),s.flyOverEvent.emit(n,"over",o),!0):!1}};T(Gn,"type",Gn.register("ESOlViewer",p.ESLocationMeasurement.type,Gn)),T(Gn,"defaultTextFunc_度格式",t=>{if(!t)return"";const[n=0,s=0,o=0]=t;return`经度: ${n.toFixed(5)}°
|
|
170
|
-
纬度: ${s.toFixed(5)}°`}),
|
|
171
|
-
纬度: ${s}`}),
|
|
172
|
-
纬度: ${s}`});let Sg=Gn;const Ml=class Ml extends ul{constructor(t,n){super(t,n);T(this,"_olImagery");if(!n.viewer){console.warn("[OlESMVTLayer] viewer is undefined!");return}const o=this.ad(new gg(n,t.id));this._olImagery=o;const r=this.ad(p.reactJson(""));{const h=async()=>{if(typeof t.url=="string"){const u=p.ESSceneObject.context.getStrFromEnv(t.url);if(IA(u))try{const d=await fetch(u);if(d.ok){const f=await d.json();r.value=f}else r.value=u}catch{r.value=u}else r.value=u}else{const u=t.url;if(typeof u=="object"&&u!==null){const d=Tg(u,p.ESSceneObject.context.getStrFromEnv);r.value=d}else r.value=u}};h(),this.ad(t.urlChanged.don(h))}const a=()=>{var d;const h=r.value;if(!h)return;const u={type:"MVTImageryProvider",url:h,accessToken:t.accessToken||void 0,tileSize:t.tileSize||512,maximumLevel:t.maximumLevel,minimumLevel:t.minimumLevel,rectangle:t.rectangle,style:(d=t.style)!=null&&d.length?t.style:void 0,scheme:t.scheme||"xyz",...typeof h=="object"&&h!==null?{glyphs:h.glyphs,sprite:h.sprite}:{}};o.imageryProvider=u};a();const l=[r.changed,t.maximumLevelChanged,t.minimumLevelChanged,t.tileSizeChanged,t.rectangleChanged,t.styleChanged,t.schemeChanged,t.accessTokenChanged],c=this.dv(p.createNextAnimateFrameEvent(...l));this.d(c.don(a)),this.d(p.track([o,"show"],[t,"show"])),this.d(p.track([o,"zIndex"],[t,"zIndex"])),this.d(p.track([o,"rectangle"],[t,"rectangle"])),this.d(p.bind([o,"alpha"],[t,"opacity"])),this.d(p.bind([o,"alpha"],[t,"czmAlpha"]))}get olImagery(){return this._olImagery}flyTo(t,n){const{sceneObject:s,olViewer:o,olImagery:r}=this;return o.actived?s.flyToParam||s.flyInParam?super.flyTo(t,n):(r==null||r.flyTo(t&&t),s.flyOverEvent.emit(n,"over",o),!0):!1}flyIn(t,n){const{sceneObject:s,olViewer:o,olImagery:r}=this;return o.actived?s.flyInParam?super.flyIn(t,n):(r==null||r.flyTo(t&&t),s.flyOverEvent.emit(n,"over",o),!0):!1}};T(Ml,"type",Ml.register("ESOlViewer",p.ESMVTLayer.type,Ml));let Rg=Ml;function Tg(i,e){if(typeof i=="string")return e(i);if(Array.isArray(i))return i.map(t=>Tg(t,e));if(i&&typeof i=="object"){const t={};for(const[n,s]of Object.entries(i))n==="url"&&typeof s=="string"?t[n]=e(s):t[n]=Tg(s,e);return t}return i}function IA(i){if(!i)return!1;const e=i.toLowerCase();return!!(e.includes("style.json")||e.endsWith(".json")||!e.includes("{z}")&&!e.includes("{x}")&&!e.includes("{y}"))}function ml(i,e){const[t,n]=i,[s,o]=e;return Math.sqrt(Math.pow(t-s,2)+Math.pow(n-o,2))}function yl(i,e,t){const[n,s]=i,o=Math.cos(e*Math.PI/180)*t+n,r=Math.sin(e*Math.PI/180)*t+s;return[o,r]}const bu=(i,e=!1)=>{const[[t=0,n=0],[s=0,o=0]]=i;return e?Math.atan2(o-n,s-t)*180/Math.PI:Math.atan2(o-n,s-t)};function OA(i,e,t){let n=1/0,s=0,o=0,r=0;for(let f=0;f<i.length-1;f++){const[g,_]=i[f],[v,E]=i[f+1],[w,C]=e,P=w-g,R=C-_,O=v-g,I=E-_,M=P*O+R*I,z=O*O+I*I;let k=z!==0?M/z:-1,q,H;k<0?(q=g,H=_,k=0):k>1?(q=v,H=E,k=1):(q=g+k*O,H=_+k*I);const m=Math.sqrt((w-q)*(w-q)+(C-H)*(C-H));m<n&&(n=m,s=f,o=k)}for(let f=0;f<s;f++)r+=ml(i[f],i[f+1]);r+=o*ml(i[s],i[s+1]);const a=r+t;let l=0;for(let f=0;f<i.length-1;f++)l+=ml(i[f],i[f+1]);let c=0;if(a<=0){const f=bu([i[0],i[1]],!0);return{point:yl(i[0],f+180,Math.abs(a)),angle:f,isValid:!1}}for(let f=0;f<i.length-1;f++){const g=ml(i[f],i[f+1]);if(c+g>=a){const v=(a-c)/g,[E,w]=i[f],[C,P]=i[f+1],R=[E+v*(C-E),w+v*(P-w)],O=bu([i[f],i[f+1]],!0);return{point:R,angle:O,isValid:!0}}c+=g}const h=i.length-1,u=bu([i[h-1],i[h]],!0),d=a-c;return{point:yl(i[h],u,d),angle:u,isValid:!1}}function Jw(i,e,t,n,s){let o=ml(i,e),r=bu([i,e],!0);const a=s-n;if(a>0&&o>a){const[l,c]=yl(i,r,a);return t.push([l,c,r,!0]),Jw([l,c],e,t,0,s)}else return o+n}function ev(i,e,t){const n=[];let s=0;s+=Math.max(0,e%t);for(let o=0,r=i.length-1;o<r;o++){const[a,l]=[i[o],i[o+1]];n.push([...a,0,!1]),s=Jw(a,l,n,s,t),s=s%t,n.push([...l,0,!1])}return n}const Dl=class Dl extends gl{constructor(t,n){super(t,n);T(this,"animationId",null);T(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});T(this,"offset",this.sceneObject.strokeWidth*this.options.ARROW_OFFSET_RATIO*globalThis.devicePixelRatio);T(this,"eventsKey",null);const s=n.viewer;if(!s)return;const o=this.geoPolyline._layer;this.d(()=>this.clear()),this.d(p.createEventsCallFunc([t.materialModeChanged,t.showChanged,t.speedChanged,t.strokedChanged,t.strokeWidthChanged],()=>{if(this.clear(),!(t.show&&t.stroked)||t.materialMode==="pureColor")return;const{SPEED_MULTIPLIER:r}=this.options;this.eventsKey=o.on("postrender",l=>{t.materialMode==="singleArrow"?this._rendererSingleArrows(l):this._rendererArrows(l)});const a=l=>{const c=(t.speed??1)*r,h=Math.max(.1,c);this.offset-=h,this.offset<=0&&(this.offset=this.sceneObject.strokeWidth*this.options.ARROW_OFFSET_RATIO*globalThis.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*globalThis.devicePixelRatio}_rendererSingleArrows(t){var d;const{ARROW_LINE_WIDTH_RATIO:n,ARROW_OFFSET_RATIO:s,ARROW_LINE_COLOR:o}=this.options,r=f0(t),a=t.target,l=r.transform_,c=r.context_,h=a.getSource(),u=(d=t.frameState)==null?void 0:d.extent;t.frameState&&(t.frameState.animate=!0),!(!h||!u)&&h.forEachFeatureInExtent(u,f=>{const g=f.getGeometry();let _;g instanceof fo?_=g.getLineStrings():g instanceof Qn&&(_=[g]),_&&_.forEach(v=>{const E=v.getFlatCoordinates(),w=_i(E,0,E.length,2,l,[]);let C=[];for(let R=0;R<w.length;R+=2){const O=w[R],I=w[R+1];C.push([O,I])}const P=ev(C,this.offset,this.sceneObject.strokeWidth*s*globalThis.devicePixelRatio);c.lineWidth=this.sceneObject.strokeWidth*n*globalThis.devicePixelRatio,c.strokeStyle=o,P.filter(R=>R[3]).forEach(R=>{const[O,I,M]=R,z=yl([O,I],M-180,5),k=this.sceneObject.strokeWidth*.5*globalThis.devicePixelRatio,q=Math.atan2(I-z[1],O-z[0]),H=O-k*Math.cos(q+45*Math.PI/180),m=I-k*Math.sin(q+45*Math.PI/180),b=O-k*Math.cos(q-45*Math.PI/180),S=I-k*Math.sin(q-45*Math.PI/180);c.beginPath(),c.moveTo(H,m),c.lineTo(O,I),c.lineTo(b,S),c.stroke()})})})}_rendererArrows(t){var g;const{ARROW_OFFSET_RATIO:n,ARROW_LINE_WIDTH_RATIO:s,ARROW_LINE_COLOR:o,ARROWS_PER_GROUP:r,ARROW_SPACING_RATIO:a}=this.options,l=f0(t),c=t.target,h=l.transform_,u=l.context_,d=c.getSource(),f=(g=t.frameState)==null?void 0:g.extent;t.frameState&&(t.frameState.animate=!0),!(!d||!f)&&d.forEachFeatureInExtent(f,_=>{const v=_.getGeometry();let E;v instanceof fo?E=v.getLineStrings():v instanceof Qn&&(E=[v]),E&&E.forEach(w=>{const C=w.getFlatCoordinates(),P=_i(C,0,C.length,2,h,[]);let R=[];for(let I=0;I<P.length;I+=2){const M=P[I],z=P[I+1];R.push([M,z])}const O=ev(R,this.offset,this.sceneObject.strokeWidth*n*globalThis.devicePixelRatio);u.lineWidth=this.sceneObject.strokeWidth*s*globalThis.devicePixelRatio,u.strokeStyle=o,O.filter(I=>I[3]).forEach(I=>{const[M,z,k]=I;for(let q=0;q<r;q++){const H=(q-(r-1)/2)*this.sceneObject.strokeWidth*a*globalThis.devicePixelRatio,m=OA(R,[M,z],H);if(!m.isValid)continue;const[b,S]=m.point,L=m.angle,N=yl([b,S],L-180,5),j=this.sceneObject.strokeWidth*.5*globalThis.devicePixelRatio,U=Math.atan2(S-N[1],b-N[0]),B=b-j*Math.cos(U+45*Math.PI/180),X=S-j*Math.sin(U+45*Math.PI/180),G=b-j*Math.cos(U-45*Math.PI/180),ae=S-j*Math.sin(U-45*Math.PI/180);u.beginPath(),u.moveTo(B,X),u.lineTo(b,S),u.lineTo(G,ae),u.stroke()}})})})}};T(Dl,"type",Dl.register(Ri.type,p.ESPath.type,Dl));let Ig=Dl;const Fl=class Fl extends mg{constructor(t,n){super(t,n);T(this,"_olTextLabel");this._olTextLabel=this.disposeVar(new Us(n,t.id));const s=this._olTextLabel,o=()=>{const a=t.anchor,l=t.offset;a?s.originRatioAndOffset=[...a,-l[0],-l[1]]:s.originRatioAndOffset=[0,0,0,0]},r=this.ad(p.createNextAnimateFrameEvent(t.anchorChanged,t.offsetChanged));this.dispose(r.disposableOn(()=>o())),o(),this.dispose(p.track([s,"zOrder"],[t,"zOrder"])),this.dispose(p.track([s,"show"],[t,"show"])),this.dispose(p.bind([s,"text"],[t,"text"])),this.dispose(p.track([s,"color"],[t,"color"])),this.dispose(p.track([s,"backgroundColor"],[t,"backgroundColor"])),this.dispose(p.bind([s,"textEditingInteraction"],[t,"textEditingInteraction"])),this.dispose(p.bind([s,"textEditing"],[t,"textEditing"])),this.dispose(p.bind([s,"position"],[t,"position"])),this.dispose(p.track([s,"width"],[t,"width"])),this.dispose(p.track([s,"opacity"],[t,"opacity"])),this.dispose(p.track([s,"padding"],[t,"padding"])),this.dispose(p.track([s,"borderRadius"],[t,"borderRadius"])),this.dispose(p.track([s,"borderColor"],[t,"borderColor"])),this.dispose(p.track([s,"borderWidth"],[t,"borderWidth"])),this.dispose(p.track([s,"textAlign"],[t,"textAlign"])),this.dispose(p.track([s,"fontSize"],[t,"fontSize"])),this.dispose(p.track([s,"borderStyle"],[t,"borderStyle"])),this.dispose(p.track([s,"pickOnClick"],[t,"allowPicking"])),this.dispose(p.track([s,"rotate"],[t,"rotate"]));{const a=()=>{s.scale=[t.scale[1],t.scale[2]]};a(),this.dispose(t.scaleChanged.don(a))}{const a=()=>{t.sizeByContent?(s.width=void 0,s.height=void 0):(s.width=t.size[0],s.height=t.size[1])};a(),this.dispose(t.sizeByContentChanged.don(a)),this.dispose(t.sizeChanged.don(a))}this.d(s.pickedEvent.don(a=>{var h;const l=(h=Zf(a,"pickResult"))==null?void 0:h.pointerEvent;if(!l)return;const c={type:l.buttons!=0&&l.button==0?"leftClick":l.button==2?"rightClick":void 0,add:{mousePos:[l.offsetX,l.offsetY]}};c.type==null&&(c.type=l.type),t.widgetEvent.emit(c)}));{let a;const l=c=>{c&&(a=c),a&&(a.style.pointerEvents=t.editing?"none":"all")};this.d(t.editingChanged.don(()=>l(void 0))),this.ad(this._olTextLabel.divCreatedEvent.don(c=>l(c)))}}get olTextLabel(){return this._olTextLabel}};T(Fl,"type",Fl.register(Ri.type,p.ESTextLabel.type,Fl));let Og=Fl;const tn=Math.PI,tv=6378245,nv=.006693421622965943;function iv(i,e){let t=AA(i-105,e-35),n=MA(i-105,e-35);const s=e/180*tn;let o=Math.sin(s);o=1-nv*o*o;const r=Math.sqrt(o);return t=t*180/(tv*(1-nv)/(o*r)*tn),n=n*180/(tv/r*Math.cos(s)*tn),[n,t]}function sv(i,e){return i<72.004||i>137.8347||e<.8293||e>55.8271}function AA(i,e){let t=-100+2*i+3*e+.2*e*e+.1*i*e+.2*Math.sqrt(Math.abs(i));return t+=(20*Math.sin(6*i*tn)+20*Math.sin(2*i*tn))*2/3,t+=(20*Math.sin(e*tn)+40*Math.sin(e/3*tn))*2/3,t+=(160*Math.sin(e/12*tn)+320*Math.sin(e*tn/30))*2/3,t}function MA(i,e){let t=300+i+2*e+.1*i*i+.1*i*e+.1*Math.sqrt(Math.abs(i));return t+=(20*Math.sin(6*i*tn)+20*Math.sin(2*i*tn))*2/3,t+=(20*Math.sin(i*tn)+40*Math.sin(i/3*tn))*2/3,t+=(150*Math.sin(i/12*tn)+300*Math.sin(i/30*tn))*2/3,t}const ov=function(i){return function(e,t,n){const s=e.length,o=n||2;let r;t?r=t:o!==2?r=e.slice():r=new Array(s);for(let a=0;a<s;a+=o)i(e,r,a);return r}},Eu={toWGS84:ov(function(i,e,t){let n=i[t],s=i[t+1];if(!sv(n,s)){const o=iv(n,s);n=n-o[0],s=s-o[1]}e[t]=n,e[t+1]=s}),fromWGS84:ov(function(i,e,t){let n=i[t],s=i[t+1];if(!sv(n,s)){const o=iv(n,s);n=n+o[0],s=s+o[1]}e[t]=n,e[t+1]=s})},gn={ll2smerc:Gi("EPSG:4326","EPSG:3857"),smerc2ll:Gi("EPSG:3857","EPSG:4326")};gn.ll2gmerc=function(i,e,t){const n=Eu.fromWGS84(i,e,t);return gn.ll2smerc(n,n,t)},gn.gmerc2ll=function(i,e,t){const n=gn.smerc2ll(i,i,t);return Eu.toWGS84(n,e,t)},gn.smerc2gmerc=function(i,e,t){let n=gn.smerc2ll(i,i,t);return n=Eu.fromWGS84(n,n,t),gn.ll2smerc(n,n,t)},gn.gmerc2smerc=function(i,e,t){let n=gn.smerc2ll(i,i,t);return n=Eu.toWGS84(n,n,t),gn.ll2smerc(n,n,t)};const Ag=new ta({code:"GCJ-02",extent:[-20037508342789244e-9,-20037508342789244e-9,20037508342789244e-9,20037508342789244e-9],units:"m"});cc(Ag),Pm("EPSG:4326",Ag,gn.ll2gmerc,gn.gmerc2ll),Pm("EPSG:3857",Ag,gn.smerc2gmerc,gn.gmerc2smerc);class DA extends p.Destroyable{constructor(e,t){super();const n=t.viewer;if(!n){console.warn("map is undefined!");return}const s=ts(n);if(!s)return;const{imageriesManager:o}=s,r=De("EPSG:3857");if(!r)return;const a=r.getExtent(),l=Te(a)/256,c=new Array(19),h=new Array(19);for(let f=0;f<19;++f)c[f]=l/Math.pow(2,f),h[f]=f;const u=new Lh({tileGrid:new Vs(e.tileGrid??{origin:ln(a),resolutions:c,matrixIds:h}),url:e.url,urls:e.urls,attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin??"anonymous",interpolate:e.interpolate,projection:e.projection??r,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tilePixelRatio:e.tilePixelRatio,tileLoadFunction:e.tileLoadFunction&&Function('"use strict";return ('+e.tileLoadFunction+")")(),wrapX:e.wrapX,transition:e.transition,zDirection:e.zDirection,maxZoom:e.maxZoom,minZoom:e.minZoom,opaque:e.opaque,maxResolution:e.maxResolution,tileSize:e.tileSize,gutter:e.gutter,tileUrlFunction:e.tileUrlFunction&&Function('"use strict";return ('+e.tileUrlFunction+")")()});this.dispose(()=>u.dispose());const d=new Ah({source:u});o.add(d),this.dispose(()=>o.delete(d)),d.setVisible(e.show??!0),this.dispose(()=>d.dispose()),this.dispose(e.showChanged.disposableOn(f=>{d.setVisible(f??!0)})),this.d(p.createEventsCallFunc(e.zIndexChanged,()=>{o.setZindex(d,e.zIndex??0)},{immediate:!0}));{const f=()=>{u.tileGrid=new Vs(e.tileGrid??{origin:ln(a),resolutions:c,matrixIds:h}),e.attributions&&u.setAttributions(e.attributions),e.tileLoadFunction&&u.setTileLoadFunction(Function('"use strict";return ('+e.tileLoadFunction+")")()),e.tileUrlFunction&&u.setTileUrlFunction(Function('"use strict";return ('+e.tileUrlFunction+")")())},g=this.disposeVar(p.createNextAnimateFrameEvent(e.attributionsChanged,e.tileGridChanged,e.tileLoadFunctionChanged,e.tileUrlFunctionChanged));this.dispose(g.disposableOn(f))}e.urlChanged.disposableOn(f=>{u.setUrl(f??"")}),e.urlsChanged.disposableOn(f=>{u.setUrls(f??[])})}}const Ll=class Ll extends ul{constructor(e,t){super(e,t);let n;this.dispose(()=>n&&n.destroy());{const s=()=>{n&&n.destroy(),n=new DA(e,t)};s();const o=this.disposeVar(p.createNextAnimateFrameEvent(e.attributionsCollapsibleChanged,e.cacheSizeChanged,e.crossOriginChanged,e.interpolateChanged,e.projectionChanged,e.reprojectionErrorThresholdChanged,e.tilePixelRatioChanged,e.wrapXChanged,e.transitionChanged,e.zDirectionChanged,e.maxZoomChanged,e.minZoomChanged,e.opaqueChanged,e.maxResolutionChanged,e.tileSizeChanged,e.gutterChanged));this.dispose(o.disposableOn(s))}}};T(Ll,"type",Ll.register(Ri.type,p.ESXYZLayer.type,Ll));let Mg=Ll;const Go=class Go extends an{constructor(t){super();T(this,"_config",this.disposeVar(p.react(Go.defaultConfig)));T(this,"_overEvent",this.disposeVar(new p.Event));T(this,"_pointerEventFilterFunc",this.disposeVar(p.react(Go.defaultPointerEventFilterFunc)));if(!!t.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 li(t));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 p.ObjResettingWithEvent(this.enabledChanged,()=>this.enabled?new FA(t,this):void 0))}}get config(){return this._config.value}set config(t){this._config.value=t}get configChanged(){return this._config.changed}get overEvent(){return this._overEvent}over(){this._overEvent.emit()}get pointerEventFilterFunc(){return this._pointerEventFilterFunc.value}set pointerEventFilterFunc(t){this._pointerEventFilterFunc.value=t}get pointerEventFilterFuncChanged(){return this._pointerEventFilterFunc.changed}};T(Go,"defaultConfig",{clickEnabled:!0,dblClickEnabled:!0}),T(Go,"defaultPointerEventFilterFunc",t=>t.button===0),T(Go,"defaults",{...an.defaults,position:[116.39,39.9,0]});let ci=Go;(i=>{i.createDefaultProps=()=>({...an.createDefaultProps(),position:p.reactArrayWithUndefined(void 0),virtualHeight:void 0,clickEnabled:!0,dblClickEnabled:!1})})(ci||(ci={})),p.extendClassProps(ci.prototype,ci.createDefaultProps);class FA extends p.Destroyable{constructor(t,n){super();T(this,"_doings",[]);T(this,"initDoings",this.ad(()=>{this._doings.forEach(t=>t.destroy()),this._doings.length=0}));this._olViewer=t,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(t.clickEvent.don(o=>{o.pointerEvent&&s(o.pointerEvent,"click")})),this.ad(t.dblclickEvent.don(o=>{o.pointerEvent&&s(o.pointerEvent,"dblclick")}))}this.ad(t.pointerMoveEvent.don(s=>{if(!s.pointerEvent)return;const o=new LA(this,s.pointerEvent,r=>{const a=[...r];t.editingHeightOffset&&(a[2]+=t.editingHeightOffset),n.position=a,this._doings.splice(0,this._doings.indexOf(o)+1).forEach(c=>c.destroy())});this._doings.push(o)}))}get olViewer(){return this._olViewer.viewer}get placeEditing(){return this._placeEditing}}class LA extends p.Destroyable{constructor(e,t,n){super(),this._owner=e;const{olViewer:s}=this._owner;if(!s)return;const o=Sy(s,t,this._owner.placeEditing.virtualHeight),[r]=p.getEventFromPromise(o);this.dispose(r.disposableOn(n))}}class Sn extends an{constructor(){super()}}T(Sn,"defaults",{...an.defaults,position:[116.39,39.9,0]}),(i=>{i.createDefaultProps=()=>({...an.createDefaultProps(),position:p.reactArrayWithUndefined(void 0)})})(Sn||(Sn={})),p.extendClassProps(Sn.prototype,Sn.createDefaultProps);function rv(i,e){const t=new Ut(i);return t.hasArrow=!0,t.arcType="RHUMB",t.width=4,t.color=e,t}const ls=class ls extends p.Destroyable{constructor(e){if(super(),!e.viewer)return;const t=this.disposeVar(rv(e,ls.defaults.xAxisColor)),n=this.disposeVar(rv(e,ls.defaults.yAxisColor));{const s=()=>{t.show=this.xAxisShow&&this.show,n.show=this.yAxisShow&&this.show};s();const o=this.ad(p.createNextAnimateFrameEvent(this.showChanged,this.xAxisShowChanged,this.yAxisShowChanged));this.dispose(o.disposableOn(s))}{const s=()=>{var f;const{position:r=ls.defaults.position,heading:a=ls.defaults.heading}=this,h=((f=e.viewer)==null?void 0:f.getView().getResolution())*65,u=p.geoRhumbDestination(r,h,90+a),d=p.geoRhumbDestination(r,h,0+a);u&&(t.positions=[r,u]),d&&(n.positions=[r,d])};s();const o=this.disposeVar(p.createNextAnimateFrameEvent(this.positionChanged,this.dimensionsChanged,this.headingChanged));this.dispose(o.disposableOn(s))}{const s=()=>{t.color=this.xAxisColor??ls.defaults.xAxisColor,n.color=this.yAxisColor??ls.defaults.yAxisColor};s();const o=this.disposeVar(p.createNextAnimateFrameEvent(this.xAxisColorChanged,this.yAxisColorChanged));this.dispose(o.disposableOn(s))}}};T(ls,"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 Xs=ls;(i=>{i.createDefaultProps=()=>({show:!0,position:p.reactArrayWithUndefined(void 0),heading:0,dimensions:p.reactArray([1e3,1e3,1e3]),xAxisColor:p.reactArray([1,0,0,1]),yAxisColor:p.reactArray([0,1,0,1]),xAxisShow:!0,yAxisShow:!0})})(Xs||(Xs={})),p.extendClassProps(Xs.prototype,Xs.createDefaultProps);class Di extends p.Destroyable{constructor(t,n){super();T(this,"_flyToEvent",this.disposeVar(new p.Event));T(this,"_layer");T(this,"_source");const s=t.viewer;if(!s)return;this._source=new vn,this._layer=new zn({source:this._source}),s.addLayer(this._layer),this.dispose(()=>s.removeLayer(this._layer)),this.dispose(()=>{var a;return(a=this._source)==null?void 0:a.clear(!0)}),this.dispose(()=>{var a;return(a=this._layer)==null?void 0:a.dispose()});const o=()=>{var a;if(this._source&&(this._source.clear(),!!this.positions)){for(const l of this.positions){if(!l||l.length<2)continue;const c=l.map(d=>Ie([d[0],d[1]]));this.loop&&c.length>=3&&c.push(c[0]);const h=new Qn(c),u=new An({geometry:h});u.setId(p.createGuid()),u.setStyle(new $e({stroke:new St({color:`rgba(${this.color[0]*255}, ${this.color[1]*255}, ${this.color[2]*255}, ${this.color[3]})`,width:this.width??2,lineDash:this.hasDash?[this.dashLength??16,(this.dashLength??16)/2]:void 0})})),this._source.addFeature(u)}(a=this._layer)==null||a.setVisible(this.show??!0)}};o();const r=this.disposeVar(p.createNextAnimateFrameEvent(this.positionsChanged,this.showChanged,this.colorChanged,this.loopChanged,this.hasDashChanged,this.dashLengthChanged,this.widthChanged));this.dispose(r.disposableOn(o)),this.dispose(this.flyToEvent.disposableOn(a=>{if(!this.positions||this.positions.length===0)return;const l=this.positions.flat();if(l.length===0)return;const c=l[Math.floor(l.length/2)];Yi(t,c)}))}get typeName(){return"OlPolylines"}get defaultProps(){return Di.createDefaultProps()}get flyToEvent(){return this._flyToEvent}flyTo(t){this._flyToEvent.emit(t)}}(i=>{i.createDefaultProps=()=>({show:!0,positions:p.reactPositionsSet(void 0),width:2,color:p.reactArray([1,1,1,1]),loop:!1,hasDash:!1,dashLength:16,arcType:"GEODESIC",topOrBottom:"none"})})(Di||(Di={})),p.extendClassProps(Di.prototype,Di.createDefaultProps);const Zs=class Zs extends Sn{constructor(t){super();T(this,"_opInfo",{step:this.ad(p.react(!1)),moved:this.ad(p.react(!1)),constraintMode:this.ad(p.react("none")),originPosition:this.disposeVar(p.reactArray(Sn.defaults.position)),originHeading:this.disposeVar(p.react(0)),originDimensions:this.disposeVar(p.reactArray([1,1,1])),draggingStartPosition:this.disposeVar(p.reactArray([0,0,0])),movingPosition:this.disposeVar(p.reactArray([0,0,0])),targetPosition:this.disposeVar(p.reactArray([0,0,0])),targetHeading:this.disposeVar(p.react(0))});T(this,"_createCoordinates",t=>{const n=this.ad(new Xs(t));this.dispose(this._opInfo.step.changed.disposableOn(()=>{av(n,this._opInfo.constraintMode.value,this._opInfo.step.value)}));{const s=()=>{const r=[...this.position??Zs.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});T(this,"_createOriginCoordinates",t=>{const n=this.ad(new Xs(t));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});T(this,"_createGrid",t=>{const n=this.ad(new Di(t));{const s=()=>{var d;const r=this._opInfo.originPosition.value,a=this._opInfo.originHeading.value,c=((d=t.viewer)==null?void 0:d.getView().getResolution())*15,h=c*5,u=[];for(let f=-4;f<5;++f){const g=p.geoRhumbDestination(r,f*c,a+90);if(g){const _=p.geoRhumbDestination(g,h,a+180),v=p.geoRhumbDestination(g,h,a);_&&v&&u.push([_,g,v])}}for(let f=-4;f<5;++f){const g=p.geoRhumbDestination(r,f*c,a);if(g){const _=p.geoRhumbDestination(g,h,a-90),v=p.geoRhumbDestination(g,h,a+90);_&&v&&u.push([_,g,v])}}n.positions=u};s();const o=this.disposeVar(p.createNextAnimateFrameEvent(this._opInfo.originPosition.changed,this._opInfo.originHeading.changed,this._opInfo.originDimensions.changed));this.dispose(o.disposableOn(s))}return n});T(this,"_createHelpLine",t=>{const n=this.ad(new Ut(t));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(p.createNextAnimateFrameEvent(this._opInfo.originPosition.changed,this._opInfo.targetPosition.changed));this.ad(o.don(s))}return n});T(this,"_createCircle",t=>{const n=this.ad(new Di(t));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(p.createNextAnimateFrameEvent(this._opInfo.originPosition.changed,this._opInfo.originDimensions.changed)),o=()=>{var u;const r=this._opInfo.originPosition.value,l=((u=t.viewer)==null?void 0:u.getView().getResolution())*70,c=[],h=32;for(let d=0;d<=h;++d){const f=d*360/h,g=p.geoRhumbDestination(r,l,f);g&&c.push(g)}c.length>0&&c.push(c[0]),n.positions=[c]};return o(),this.dispose(s.disposableOn(o)),n});T(this,"_pickingXYProcessing",t=>this.ad(new p.Processing((n,s,o)=>{const r=[0,0,0];return t.pointerMoveEvent.don(a=>{if(!a.pointerEvent||!t.viewer)return;const l=t.viewer.getEventPixel(a.pointerEvent);if(!l)return;const c=t.viewer.getCoordinateFromPixel(l);if(!c)return;const h=Lt(c);if(r[0]=h[0],r[1]=h[1],r[2]=this._opInfo.originPosition.value[2],this._opInfo.constraintMode.value==="x")Ms(this._opInfo.originPosition.value,this._opInfo.originHeading.value+90,r,r);else if(this._opInfo.constraintMode.value==="y")Ms(this._opInfo.originPosition.value,this._opInfo.originHeading.value,r,r);else if(this._opInfo.constraintMode.value!=="xy"){console.warn("should not be here!");return}this._opInfo.movingPosition.value=r;const u=[0,0,0];p.geoRhumbDestination(r,o,s,u),this._opInfo.targetPosition.value=u})})));if(!t.viewer)return;const n=this.ad(p.reactArray([1,1,1]));this.ad(t.dblclickEvent.don(()=>this.enabled=!1)),this.ad(new Oy(t.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(t),o=this._createOriginCoordinates(t),r=this._createGrid(t),a=this._createHelpLine(t),l=this._createCircle(t);{const d=()=>{l.show=r.show=this.enabled&&this.showCircle,a.show=this.enabled&&this.showCircle&&this._opInfo.moved.value,s.show=this.enabled&&this.showCoordinates,o.show=this.enabled&&this.showCoordinates&&this._opInfo.moved.value};d();const f=this.ad(p.createNextAnimateFrameEvent(this.enabledChanged,this.showCircleChanged,this.showCoordinatesChanged,this._opInfo.moved.changed));this.ad(f.don(d))}{const d=()=>{s.xAxisShow=o.xAxisShow=this.xAxisShow,s.yAxisShow=o.yAxisShow=this.yAxisShow};d();const f=this.ad(p.createNextAnimateFrameEvent(this.xAxisShowChanged,this.yAxisShowChanged));this.ad(f.don(d))}{const d=()=>{r.color=this._opInfo.constraintMode.value!=="none"?[1,1,0,.6]:[1,1,0,.3],av(s,this._opInfo.constraintMode.value,this._opInfo.step.value)};d(),this.dispose(this._opInfo.constraintMode.changed.disposableOn(d))}const c=this._pickingXYProcessing(t),h=this.ad(p.createProcessingFromAsyncFunc(async d=>{do this._opInfo.step.value=!0,this._opInfo.constraintMode.value="none",d.disposer.dispose(()=>{this._opInfo.constraintMode.value="none"}),await p.step(d,async f=>{const g=()=>{const C=[...this.position??Zs.defaults.position];this._opInfo.targetPosition.value=this._opInfo.originPosition.value=C},_=()=>this._opInfo.targetHeading.value=this._opInfo.originHeading.value=this.heading,v=()=>this._opInfo.originDimensions.value=n.value;f.disposer.dispose((g(),this.positionChanged.don(g))),f.disposer.dispose((_(),this.headingChanged.don(_))),f.disposer.dispose((v(),n.changed.don(v)));const E={constraintMode:"none",startDragPos:[0,0,0]},w=C=>{const P={position:s.position??Zs.defaults.position,heading:s.heading??Zs.defaults.heading,dimensions:s.dimensions??Zs.defaults.dimensions};t.viewer&&Ry(C,t.viewer,P,this.axisSnapPixelSize,E,{x:this.disableX,y:this.disableY,xy:this.disableXY}),this._opInfo.constraintMode.value=E.constraintMode,this._opInfo.movingPosition.value=this._opInfo.draggingStartPosition.value=E.startDragPos};f.disposer.dispose(t.pointerMoveEvent.don(C=>{C.pointerEvent&&w(C.pointerEvent)})),await p.step(f,C=>new Promise((P,R)=>{C.disposer.dispose(R),C.disposer.dispose(t.pointerDownEvent.don(O=>{O.pointerEvent&&w(O.pointerEvent),O.pointerEvent&&O.pointerEvent.button===0&&E.constraintMode!=="none"&&P()}))}))}),this._opInfo.step.value=!1,await p.step(d,async f=>{if(t.incrementDisabledInputStack(),console.log("检查地图交互编辑模式",t.disabledInputStack),f.disposer.dispose(()=>{t.decrementDisabledInputStack()}),["xy","x","y"].includes(this._opInfo.constraintMode.value)){const g=p.geoRhumbHeading(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value),_=p.geoRhumbDistance(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value);c.restart(void 0,g,_),f.disposer.dispose(()=>c.cancel())}else console.warn(`pickingInfo.constraintMode error! ${this._opInfo.constraintMode.value}`);await p.step(f,g=>new Promise((_,v)=>{g.disposer.dispose(v),g.disposer.dispose(t.pointerUpEvent.don(()=>{_()})),g.disposer.dispose(t.pointerOutEvent.don(()=>_()))}))});while(!0)})),u=()=>{this.enabled?h.restart():h.isRunning&&h.cancel()};u(),this.ad(this.enabledChanged.don(u))}}};T(Zs,"defaults",{...Sn.defaults,heading:0,dimensions:[200,200,200],xAxisColor:[1,0,0,1],yAxisColor:[0,1,0,1]});let hi=Zs;(i=>{i.createDefaultProps=()=>({...Sn.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})})(hi||(hi={})),p.extendClassProps(hi.prototype,hi.createDefaultProps);function av(i,e,t){i.xAxisColor=[1,0,0,.99],i.yAxisColor=[0,1,0,.99],e==="x"?i.xAxisColor=t?[1,1,0,.8]:[1,1,0,.99]:e==="y"?i.yAxisColor=t?[1,1,0,.8]:[1,1,0,.99]:e==="xy"&&(i.xAxisColor=t?[1,1,0,.8]:[1,1,0,.99],i.yAxisColor=t?[1,1,0,.8]:[1,1,0,.99])}class Wr extends p.Destroyable{constructor(t){super();T(this,"_vectorLayer");T(this,"_feature");T(this,"_circleCanvas");T(this,"_debugFeature");t.viewer&&(this._createCircleCanvas(),this._createVectorLayer(t),this._createDebugFeature(t))}get vectorLayer(){return this._vectorLayer}get feature(){return this._feature}get circleCanvas(){return this._circleCanvas}get debugFeature(){return this._debugFeature}_createCircleCanvas(){this._circleCanvas=document.createElement("canvas"),this._circleCanvas.width=256,this._circleCanvas.height=256;const t=()=>{var h,u,d;const s=(h=this._circleCanvas)==null?void 0:h.getContext("2d");if(!s)return;const o=this.color,r=`rgba(${o[0]*255|0}, ${o[1]*255|0}, ${o[2]*255|0}, ${o[3]})`;s.clearRect(0,0,256,256),s.lineWidth=6,s.beginPath(),s.arc(128,128,64,0,Math.PI*2,!1),s.strokeStyle=`rgba(0,0,0,${o[3]})`,s.stroke(),s.lineWidth=4,s.beginPath(),s.arc(128,128,64,0,Math.PI*2,!1),s.strokeStyle=r,s.stroke();let a=this.circleRotation*Math.PI/180;a=Math.atan2(Math.sin(a),Math.cos(a));const l=a<0;s.lineWidth=3,s.beginPath(),s.moveTo(128,128),s.arc(128,128,64,0,a,l),s.lineTo(128,128),s.fillStyle=`rgba(${o[0]*255|0}, ${o[1]*255|0}, ${o[2]*255|0}, 0.5)`,s.fill(),s.save(),s.font="16px console",s.textBaseline="middle",s.textAlign="center";const c=`${this.circleRotation.toFixed(1)}°`;s.translate(128,128),s.rotate(Math.PI*.5),s.rotate(a*.5),s.translate(-128,-128),s.fillStyle="white",s.fillText(c,128,54),s.restore(),(d=(u=this._feature)==null?void 0:u.changed)==null||d.call(u)};t();const n=this.ad(p.createNextAnimateFrameEvent(this.colorChanged,this.circleRotationChanged,this.circleStartRotationChanged,this.circleEndRotationChanged));this.ad(n.don(t))}_createVectorLayer(t){var o;const n=new vn;this._feature=new An({geometry:new wn([0,0])});const s=()=>{if(!this._circleCanvas)return new $e;const r=this.pixelSize??300;return new $e({image:new Ps({img:this._circleCanvas,width:r,height:r,anchor:[.5,.5],anchorXUnits:"fraction",anchorYUnits:"fraction"}),text:new ir({text:"",font:"0px console"})})};this._feature.setStyle(s),n.addFeature(this._feature),this._vectorLayer=new zn({source:n,zIndex:1e3});{const r=()=>{if(!this.position||!this._feature)return;const a=Ie([this.position[0],this.position[1]]),l=this._feature.getGeometry();l==null||l.setCoordinates(a)};r(),this.dispose(this.positionChanged.disposableOn(r))}{const r=()=>{this._vectorLayer&&this._vectorLayer.setVisible(this.show)};r(),this.dispose(this.showChanged.disposableOn(r))}{const r=()=>{this._feature&&this._feature.setStyle(s)};r(),this.dispose(this.colorChanged.disposableOn(r)),this.dispose(this.circleRotationChanged.disposableOn(r)),this.dispose(this.pixelSizeChanged.disposableOn(r))}(o=t.viewer)==null||o.addLayer(this._vectorLayer),this.d(()=>{var r;return(r=t.viewer)==null?void 0:r.removeLayer(this._vectorLayer)})}_createDebugFeature(t){var o;const n=new vn;this._debugFeature=new An({geometry:new wn([0,0])}),this._debugFeature.setStyle(new $e({image:new Ln({radius:5,fill:new vt({color:"red"})})})),n.addFeature(this._debugFeature);const s=new zn({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=Ie([this.position[0],this.position[1]]),l=this._debugFeature.getGeometry();l==null||l.setCoordinates(a)};r(),this.dispose(this.positionChanged.disposableOn(r))}(o=t.viewer)==null||o.addLayer(s),this.d(()=>{var r;return(r=t.viewer)==null?void 0:r.removeLayer(s)})}}T(Wr,"defaults",{position:[116.39,39.9,0]}),(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,editing:!1,position:p.reactArrayWithUndefined(void 0),rotation:p.reactArray([0,0,0]),selfRotation:p.reactArray([0,0,0]),pixelSize:300,color:p.reactArray([1,1,1,1]),circleRotation:0,circleStartRotation:0,circleEndRotation:0,debug:!1})})(Wr||(Wr={})),p.extendClassProps(Wr.prototype,Wr.createDefaultProps);function lv(i,e){const n=i.getViewport().getBoundingClientRect();return[e.clientX-n.left,e.clientY-n.top]}class zA extends p.HasOwner{constructor(e){super(e);const{olViewer:t}=this.owner;let n;this.dispose(()=>this.owner.hoveredPlaneType="none");const s=this._createRotatorMoveProcessing();this.dispose(t.pointerMoveEvent.disposableOn(o=>{const r=n=this._getStartInfo(o.pointerEvent);this.owner.hoveredPlaneType=(r==null?void 0:r.currentPlaneType)??"none"})),this.dispose(t.pointerDownEvent.disposableOn(o=>{n&&n.currentPlaneType!=="none"&&(s.restart(void 0,t,n),n=void 0)})),this.dispose(t.dblclickEvent.disposableOn(o=>{const r=this._getStartInfo(o.pointerEvent);r&&r.currentPlaneType!=="none"||(this.owner.enabled=!1)}))}_createRotatorMoveProcessing(){return this.ad(p.createProcessingFromAsyncFunc(async(e,t,n)=>{const s=this.owner.circle;t.incrementDisabledInputStack(),e.disposer.dispose(()=>t.decrementDisabledInputStack()),this.owner.movingPlaneType=n.currentPlaneType,e.disposer.dispose(()=>{this.owner.movingPlaneType="none"});const o=n.pointerId;e.disposer.dispose(t.pointerMoveEvent.don(l=>{if(!n||!l.pointerEvent)return;const c=t.viewer,h=[];c.getInteractions().forEach(C=>{var R,O,I;const P=(R=C==null?void 0:C.constructor)==null?void 0:R.name;(P==="DragPan"||P==="MouseWheelZoom"||P==="DoubleClickZoom"||P==="PinchZoom"||P==="DragRotate"||P==="PinchRotate")&&(h.push([C,((O=C.getActive)==null?void 0:O.call(C))??!0]),(I=C.setActive)==null||I.call(C,!1))}),e.disposer.dispose(()=>h.forEach(([C,P])=>{var R;return(R=C.setActive)==null?void 0:R.call(C,P)}));let u=n.startAngle,d=0;const f=l.pointerEvent,g=lv(t.viewer,f);if(n.currentPlaneType==="none")return;const _=this._calculateAngle(g);if(_===null)return;let v=_-u;v>180&&(v-=360),v<-180&&(v+=360),d+=v,u=_;let E=n.startRotation+d;E>360&&(E=360),E<-360&&(E=-360),this.owner.previewRotation=E;const w=this.owner.circle;w.circleStartRotation=0,w.circleEndRotation=0})),e.disposer.dispose(()=>{s.circleStartRotation=0,s.circleEndRotation=0}),await p.step(e,l=>new Promise((c,h)=>{l.disposer.dispose(h),l.disposer.dispose(t.pointerUpEvent.don(u=>{u.pointerEvent.pointerId===o&&c()})),l.disposer.dispose(t.pointerOutEvent.don(u=>{u.pointerEvent.pointerId===o&&c()}))}));const[,r,a]=this.owner.selfRotation;this.owner.selfRotation=[this.owner.previewRotation,r,a]}))}_calculateAngle(e){const{olViewer:t}=this.owner,n=t.viewer;if(!n||!this.owner.position)return null;const s=Ie([this.owner.position[0],this.owner.position[1]]),o=n.getPixelFromCoordinate(s);if(!o)return null;const r=e[0]-o[0],a=e[1]-o[1],l=Math.sqrt(r*r+a*a),c=this.owner.pixelSize/4;if(l<c*.8||l>c*1.2)return null;let h=Math.atan2(a,r);return h=(h*180/Math.PI+360)%360,h}_getStartInfo(e){const{olViewer:t}=this.owner;if(!this.owner.position)return;const n=lv(this.owner.olViewer.viewer,e),s=e.pointerId,o=this._calculateAngle(n);return{currentPlaneType:o!==null?"heading":"none",startRotation:this.owner.selfRotation[0],startAngle:o||0,pointerId:s}}}class Ys extends Sn{constructor(t){super();T(this,"_hoveredPlaneType",this.disposeVar(p.react("none")));T(this,"_movingPlaneType",this.disposeVar(p.react("none")));T(this,"_previewRotation",this.disposeVar(p.react(0)));T(this,"_circle");T(this,"_rotatorRunningResetting");this._olViewer=t;const n=this._olViewer;this._rotatorRunningResetting=this.disposeVar(new p.ObjResettingWithEvent(this.enabledChanged,()=>{if(this.enabled)return new zA(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(t){this._hoveredPlaneType.value=t}get hoveredPlaneTypeChanged(){return this._hoveredPlaneType.changed}get movingPlaneType(){return this._movingPlaneType.value}set movingPlaneType(t){this._movingPlaneType.value=t}get movingPlaneTypeChanged(){return this._movingPlaneType.changed}get previewRotation(){return this._previewRotation.value}set previewRotation(t){this._previewRotation.value=t}get previewRotationChanged(){return this._previewRotation.changed}get circle(){return this._circle}get olViewer(){return this._olViewer}get rotatorRunningResetting(){return this._rotatorRunningResetting}_createRotatorCircle(t){const n=this.ad(new Wr(t));this.dispose(p.track([n,"position"],[this,"position"])),this.dispose(p.track([n,"pixelSize"],[this,"pixelSize"])),this.dispose(p.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",l=[0,0,1,o||r?1:.8];n.color=l};s(),this.dispose(this.movingPlaneTypeChanged.disposableOn(s)),this.dispose(this.hoveredPlaneTypeChanged.disposableOn(s))}return n}}T(Ys,"rotationNum",{heading:0}),T(Ys,"rotationFuncs",{heading:([t,n,s])=>[0,n,s]}),(i=>{i.createDefaultProps=()=>({...Sn.createDefaultProps(),rotation:p.reactArray([0,0,0]),selfRotation:p.reactArray([0,0,0]),pixelSize:300,showHelper:!1,debug:!1})})(Ys||(Ys={})),p.extendClassProps(Ys.prototype,Ys.createDefaultProps);const qo=class qo extends p.Destroyable{get startPosition(){return this.positions&&this.positions[0]}set startPosition(e){this.positions=[e??qo.defaults.positions[0],this.stopPosition??qo.defaults.positions[1]]}get startPositionChanged(){return this.positionsChanged}get stopPosition(){return this.positions&&this.positions[1]}set stopPosition(e){this.positions=[this.startPosition??qo.defaults.positions[0],e??qo.defaults.positions[1]]}get stopPositionChanged(){return this.positionsChanged}constructor(e,t){if(super(),!e.viewer)return;const s=this.ad(new Ut(e,t));s.arcType="RHUMB";const o=this.ad(new li(e,t));this.ad(p.track([s,"allowPicking"],[this,"allowPicking"])),this.ad(p.track([o,"allowPicking"],[this,"allowPicking"]));{const r=()=>{s.show=o.show=this.show};r(),this.ad(this.showChanged.don(r))}{const r=()=>{s.width=this.width/2,o.pixelSize=this.width};r(),this.ad(this.widthChanged.don(r))}{const r=()=>{s.color=o.color=this.color};r(),this.ad(this.colorChanged.don(r))}{const r=()=>{s.positions=this.positions,o.position=this.stopPosition};r(),this.dispose(this.startPositionChanged.disposableOn(r)),this.dispose(this.stopPositionChanged.disposableOn(r))}}};T(qo,"defaults",{positions:[[0,0,0],[0,0,1e6]]});let ko=qo;(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:p.reactPositions(i.defaults.positions),width:10,color:p.reactArray([1,0,0,1])})})(ko||(ko={})),p.extendClassProps(ko.prototype,ko.createDefaultProps);class os extends Sn{constructor(t){super();T(this,"_lastPosition");T(this,"_opInfo",{step:this.ad(p.react(!1)),moved:this.ad(p.react(!1)),constraintMode:this.disposeVar(p.react("none")),originPosition:this.disposeVar(p.reactArray([0,0,0])),originHeading:this.disposeVar(p.react(0)),originDimensions:this.disposeVar(p.reactArray([1,1,1])),draggingStartPosition:this.disposeVar(p.reactArray([0,0,0])),movingPosition:this.disposeVar(p.reactArray([0,0,0])),targetPosition:this.disposeVar(p.reactArray([0,0,0])),targetHeading:this.disposeVar(p.react(0))});T(this,"_scaleAxis");T(this,"_pickingXYProcessing",t=>this.disposeVar(new p.Processing((n,s,o)=>{const r=[0,0,0];return t.pointerMoveEvent.disposableOn(a=>{if(!a.pointerEvent||!t.viewer)return;const l=t.viewer.getEventPixel(a.pointerEvent),c=t.viewer.getCoordinateFromPixel(l);if(!c)return;const[h,u]=Lt(c);r[0]=h,r[1]=u,r[2]=0,this._opInfo.constraintMode.value==="x"?Ms(this._opInfo.originPosition.value,this._opInfo.originHeading.value+90,r,r):this._opInfo.constraintMode.value==="y"?Ms(this._opInfo.originPosition.value,this._opInfo.originHeading.value,r,r):this._opInfo.constraintMode.value==="xy"||console.warn("should not be here!"),this._opInfo.movingPosition.value=r,this._lastPosition||(this._lastPosition=[...this._opInfo.draggingStartPosition.value]);const d=[0,0,0];if(p.geoRhumbDestination(r,o,s,d),this._opInfo.targetPosition.value=d,!this._axisPixelInfo)return;const f=this._axisPixelInfo,g=t.viewer.getEventPixel(a.pointerEvent),_=f.len*f.len,v=((g[0]-f.a[0])*f.v[0]+(g[1]-f.a[1])*f.v[1])/_,E=Math.max(-2,Math.min(2,v)),w=E===0?0:E>0?1:-1;let C=0;w===0?C=0:w===f.sideStart||f.sideStart===0?C=Math.max(0,Math.abs(E)-Math.abs(f.tStart)):C=Math.abs(E);const P=(E>=0?1:-1)*C,R=this.scaleSensitivity??.6,O=Math.max(.1,1+R*P),[I,M,z]=f.baseScale;let k=I,q=M;f.mode==="y"?k=Math.max(.01,I*O):f.mode==="x"&&(q=Math.max(.01,M*O)),this.scale=[k,q,z??0]})})));T(this,"_axisPixelInfo");console.log("here ScaleEditing constructor",t.viewer);const n=t.viewer;if(n){this.ad(new Z_(t,this.positionReact,this._opInfo.originDimensions,this.axisPixelSize)),this.ad(t.dblclickEvent.don(()=>{this.enabled=!1})),this._scaleAxis={yAxis:this._createScaleAxis(t,"yAxis"),xAxis:this._createScaleAxis(t,"xAxis")};{const s=()=>{if(!this._scaleAxis)return;const{yAxis:o,xAxis:r}=this._scaleAxis,a=this._opInfo.constraintMode.value,l=this._opInfo.step.value;o.color=[0,1,0,.99],r.color=[1,0,0,.99],a==="x"?r.color=l?[1,1,0,.8]:[1,1,0,.99]:a==="y"&&(o.color=l?[1,1,0,.8]:[1,1,0,.99])};s(),this.dispose(this._opInfo.constraintMode.changed.disposableOn(s)),this.dispose(this._opInfo.step.changed.disposableOn(s))}{const s=()=>{if(!this._scaleAxis)return;const{position:r=os.defaults.position}=this;console.log("ScaleEditing.defaults.position",r);const{yAxis:a,xAxis:l}=this._scaleAxis;l.startPosition=a.startPosition=r;const c=p.geoRhumbDestination(r,this._opInfo.originDimensions.value[0],90);c&&(l.stopPosition=c);const h=p.geoRhumbDestination(r,this._opInfo.originDimensions.value[1],0);h&&(a.stopPosition=h)};s();const o=this.ad(p.createNextAnimateFrameEvent(this.positionChanged,this._opInfo.originDimensions.changed));this.ad(o.don(s))}{const s=()=>{if(this._opInfo.constraintMode.value==="none"){this._opInfo.moved.value=!1;return}if(this._opInfo.originHeading.value!==this._opInfo.targetHeading.value){this._opInfo.moved.value=!0;return}if(!this._opInfo.originPosition.value.every((o,r)=>o===this._opInfo.targetPosition.value[r])){this._opInfo.moved.value=!0;return}};s(),this.dispose(this._opInfo.originHeading.changed.disposableOn(s)),this.dispose(this._opInfo.originPosition.changed.disposableOn(s)),this.dispose(this._opInfo.targetHeading.changed.disposableOn(s)),this.dispose(this._opInfo.targetPosition.changed.disposableOn(s))}{const s=this._pickingXYProcessing(t),o=()=>{const h=[...this.position??os.defaults.position];t.editingHeightOffset&&(h[2]-=t.editingHeightOffset),this._opInfo.targetPosition.value=this._opInfo.originPosition.value=h},r={constraintMode:"none",startDragPos:[0,0,0]},a=h=>{if(!this.position||!this._scaleAxis)return;const u={position:this.position,dimensions:this._opInfo.originDimensions.value,heading:this._opInfo.originHeading.value||0};Iy(n,h,u,this.axisSnapPixelSize,r);const d=n.getView().getProjection(),f=n.getEventPixel(h),g=z=>n.getPixelFromCoordinate(Ie([z[0],z[1]],d)),{xAxis:_,yAxis:v}=this._scaleAxis,E=g(_.startPosition),w=g(_.stopPosition),C=g(v.startPosition),P=g(v.stopPosition),R=cv(f,E,w),O=cv(f,C,P),I=this.axisSnapPixelSize??10;let M="none";if((R.dist<=I||O.dist<=I)&&(M=R.dist<=O.dist?"x":"y"),this._opInfo.constraintMode.value=M,r.constraintMode=M,M==="x"||M==="y"){const z=n.getCoordinateFromPixel(f);if(z){const[k,q]=Lt(z),H=[k,q,this._opInfo.originPosition.value[2]??0];M==="x"?Ms(this._opInfo.originPosition.value,this._opInfo.originHeading.value+90,H,H):Ms(this._opInfo.originPosition.value,this._opInfo.originHeading.value,H,H),r.startDragPos=H,this._opInfo.movingPosition.value=this._opInfo.draggingStartPosition.value=H}}else r.startDragPos=[0,0,0],this._opInfo.movingPosition.value=this._opInfo.draggingStartPosition.value=[0,0,0]},l=this.disposeVar(p.createProcessingFromAsyncFunc(async h=>{this._opInfo.step.value=!0,this._opInfo.constraintMode.value="none",h.disposer.dispose(()=>{this._opInfo.constraintMode.value="none"}),await p.step(h,async u=>{u.disposer.dispose((o(),this.positionChanged.disposableOn(o))),u.disposer.dispose(t.pointerMoveEvent.disposableOn(d=>{d.pointerEvent&&a(d.pointerEvent)})),await p.step(u,d=>new Promise((f,g)=>{d.disposer.dispose(g),d.disposer.dispose(t.pointerDownEvent.don(_=>{if(_.pointerEvent&&a(_.pointerEvent),_.pointerEvent&&_.pointerEvent.button===0&&this._opInfo.constraintMode.value!=="none"){{const v=r.constraintMode==="x"?"x":"y",{xAxis:E,yAxis:w}=this._scaleAxis,C=v==="x"?E:w,P=n.getView().getProjection(),R=b=>n.getPixelFromCoordinate(Ie([b[0],b[1]],P)),O=R(C.startPosition),I=R(C.stopPosition),M=[I[0]-O[0],I[1]-O[1]],z=Math.hypot(M[0],M[1])||1,k=n.getEventPixel(_.pointerEvent),q=((k[0]-O[0])*M[0]+(k[1]-O[1])*M[1])/(z*z),H=Math.max(-1,Math.min(1,q)),m=H===0?0:H>0?1:-1;this._axisPixelInfo={a:O,v:M,len:z,tStart:H,sideStart:m,mode:v,baseScale:[this.scale[0]??1,this.scale[1]??1,this.scale[2]??0]}}f()}}))}))}),this._opInfo.step.value=!1,await p.step(h,async u=>{if(t.incrementDisabledInputStack(),u.disposer.dispose(()=>t.decrementDisabledInputStack()),this.dispose(this.enabledChanged.disposableOn(d=>{if(!d&&t.disabledInputStack>0)for(;t.disabledInputStack>0;)t.decrementDisabledInputStack()})),["x","y"].includes(this._opInfo.constraintMode.value)){const d=p.geoRhumbHeading(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value),f=p.geoRhumbDistance(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value);s.restart(void 0,d,f),u.disposer.dispose(()=>s.cancel())}await p.step(u,d=>new Promise((f,g)=>{d.disposer.dispose(g),d.disposer.dispose(t.pointerUpEvent.don(()=>{f()})),d.disposer.dispose(t.pointerOutEvent.don(()=>{f()}))})),this._lastPosition=void 0,this._axisPixelInfo=void 0}),l.restart()})),c=()=>{this.enabled?l.restart():l.isRunning&&l.cancel()};c(),this.dispose(this.enabledChanged.disposableOn(c))}}}get scaleAxis(){return this._scaleAxis}_createScaleAxis(t,n){const s=this.ad(new ko(t));return s.width=10,this.ad(p.track([s,"show"],[this,"enabled"])),s}}(i=>{i.createDefaultProps=()=>({...Sn.createDefaultProps(),scale:p.reactArray([1,1,0]),axisPixelSize:100,axisSnapPixelSize:10,scaleSensitivity:.8})})(os||(os={})),p.extendClassProps(os.prototype,os.createDefaultProps);function cv(i,e,t){const n=t[0]-e[0],s=t[1]-e[1],o=i[0]-e[0],r=i[1]-e[1],a=n*o+s*r,l=n*n+s*s;let c=l>0?Math.max(0,Math.min(1,a/l)):0;const h=e[0]+c*n,u=e[1]+c*s,d=i[0]-h,f=i[1]-u;return{dist:Math.hypot(d,f),t:c}}const cs=class cs extends an{constructor(t){super();T(this,"_editingPoints",this.disposeVar(new p.ObservableArray));T(this,"_cancelEvent",this.disposeVar(new p.Event));T(this,"_currentProcess");T(this,"_menuPoiEnabled",this.disposeVar(p.react(!1)));T(this,"_status",this.disposeVar(p.react("None")));T(this,"_positionsChanged",this.ad(new p.Event));T(this,"_cursorInfo");this._olViewer=t,console.log("imgaeUrl:",cs.baseImageUrl+"point-green.png"),this.enabled=!1,this.createPolyline(t),this._createCursorInfo(t),this.dispose(()=>this.resetPositions()),this.dispose(()=>this.editingPoints.length=0),this.dispose(this.editingPoints.changedEvent.disposableOn(()=>this.positionsChanged.emit())),this.dispose(this.editingPoints.toChangeEvent.disposableOn(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(t.dblclickEvent.don(n=>{this.ad(p.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(t){this._currentProcess=t}get menuPoiEnabled(){return this._menuPoiEnabled.value}set menuPoiEnabled(t){this._menuPoiEnabled.value=t}get menuPoiEnabledChanged(){return this._menuPoiEnabled.changed}get status(){return this._status.value}get statusChanged(){return this._status.changed}set status(t){this._status.value=t}getPositions(){const t=[];for(let n of this._editingPoints)n.position&&t.push([...n.position]);return t}resetPositions(t){if(this.enabled??cs.defaults.enabled)return console.warn("MultiPointsEditing.resetPositions error: this.enabled === true"),!1;const n=t||[];return!(n.length===this.editingPoints.length&&n.every((s,o)=>s.every((r,a)=>{const l=this.editingPoints.get(o);return l.position&&l.position[a]===r})))}forceResetPositions(t){(this.enabled??cs.defaults.enabled)&&(this.enabled=!1),this.resetPositions(t)}get positions(){return this.getPositions()}set positions(t){this.resetPositions(t)}get positionsChanged(){return this._positionsChanged}get olViewer(){return this._olViewer}get cursorInfo(){return this._cursorInfo}createPolyline(t){const n=this.ad(new Ut(t));this.ad(p.track([n,"color"],[this,"polylineColor"])),this.ad(p.track([n,"width"],[this,"polylineWidth"])),this.ad(p.track([n,"show"],[this,"polylineShow"])),this.ad(p.track([n,"arcType"],[this,"polylineArcType"])),this.ad(p.track([n,"loop"],[this,"loop"]));{const s=()=>{const o=[];for(const r of this.getPositions())r[2]-=t.editingHeightOffset??0,o.push(r);n.positions=o};s(),this.ad(this.positionsChanged.don(s))}}_createCursorInfo(t){const n=this._cursorInfo=this.ad(new p.CursorInfo(t.container,p.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)}}))}};T(cs,"baseImageUrl",p.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/img/")),T(cs,"defaults",{...an.defaults,debug:!1,polylineShow:!1,polylineWidth:1,polylineColor:[1,1,1,1],polylineArcType:"GEODESIC",maxPointsNum:Number.MAX_SAFE_INTEGER,loop:!1,firstControlPointImageUrl:cs.baseImageUrl+"point-green.png",otherControlPointImageUrl:cs.baseImageUrl+"point-yellow.png"});let Un=cs;(i=>{i.createDefaultProps=()=>({...an.createDefaultProps(),loop:!1,debug:!1,polylineShow:!0,polylineWidth:1,polylineColor:p.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})})(Un||(Un={})),p.extendClassProps(Un.prototype,Un.createDefaultProps);let NA=0;class Dg extends p.Destroyable{constructor(t,n){super();T(this,"_position",this.disposeVar(p.reactArrayWithUndefined(void 0)));T(this,"_id",NA++);T(this,"_menuPoi");n&&(this.position=n),t.debug&&console.log(`PolylinePositionEditor creating! ${this.id}`),this.dispose(()=>{t.debug&&console.log(`PolylinePositionEditor destroying! ${this.id}`)});const s=this._menuPoi=this.ad(new Pr(t.olViewer));s.enabled=!1,this.ad(p.track([s,"show"],[t,"enabled"]));{const o=()=>{if(this.position===void 0){s.position=void 0;return}const r=[...this.position];r[2]=0,s.position=r,t.positionsChanged.emit()};o(),this.d(this.positionChanged.don(o))}{const o=()=>{const r=t.editingPoints.indexOf(this)+1;r!==0&&(s.title=`控制点${r}`,r===1?s.imageUri=t.firstControlPointImageUrl??Un.defaults.firstControlPointImageUrl:s.imageUri=t.otherControlPointImageUrl??Un.defaults.otherControlPointImageUrl)};o(),this.dispose(t.editingPoints.changedEvent.disposableOn(o))}}get position(){return this._position.value}set position(t){this._position.value=t}get positionChanged(){return this._position.changed}get id(){return this._id}get menuPoi(){return this._menuPoi}}class Fg extends Dg{constructor(e,t){super(e,t)}}class xt extends Un{constructor(t){super(t);T(this,"_deletePreviousPointWhileAddingEvent",this.disposeVar(new p.Event));T(this,"placeEditing");if(!t.viewer)return;const n=this.placeEditing=this.ad(new ci(t));n.enabled=!1,this.currentProcess=this.disposeVar(p.createProcessingFromAsyncFunc(async s=>{s.disposer.dispose(()=>{(this.debug??xt.defaults.debug)&&console.log("---editing canceled~~~"),this.status="None",this.enabled=!1}),(this.debug??xt.defaults.debug)&&console.log("直接进入Adding状态"),this.status="Adding",await s.promise(p.step(s,async o=>{const r=o.disposer,a=r.ad(this._addingEditingProcessing());r.dispose(()=>"adding canceled!"),r.dispose(this.cancelEvent.disposableOn(()=>a.cancel())),await o.promise(new Promise(l=>{r.dispose(a.completeEvent.disposableOnce(l))}))}))})),this.dispose(t.clickEvent.don(s=>{var o;((o=s.pointerEvent)==null?void 0:o.button)===2&&this.deletePreviousPointWhileAdding()}))}deletePreviousPointWhileAdding(){this._deletePreviousPointWhileAddingEvent.emit()}resetPositions(t){if(!super.resetPositions(t))return!0;const n=t?t.map(s=>new Fg(this,s)):[];return this.editingPoints.splice(0,this.editingPoints.length,...n),!0}_addingEditingProcessing(){const t=()=>{if(this.maxPointsNum!==void 0)return this.editingPoints.length>=this.maxPointsNum&&(this.debug??xt.defaults.debug)&&console.log("impl.positionEditors.length >= impl.maxPointsNum"),this.editingPoints.length>=this.maxPointsNum},n=p.createProcessingFromAsyncFunc(async s=>{let o=this.editingPoints.length;this.menuPoiEnabled=!1;do if(!await s.promise(p.step(s,async a=>{let l;!t()&&(l=a.disposer.disposeVar(new hv(this,o)));const h=a.disposer.disposeVar(new dv(this,o));return a.disposer.dispose(this._deletePreviousPointWhileAddingEvent.disposableOn(()=>h.do())),await a.promise(new Promise(u=>{l&&a.disposer.dispose(l.overEvent.disposableOnce(d=>{d?(o++,u(!0)):u(!1)})),a.disposer.dispose(h.overEvent.disposableOnce(d=>{d?(o--,u(!0)):u(!1)})),a.disposer.dispose(this.cancelEvent.disposableOn(()=>u(!1)))}))})))break;while(!0)});return n.start(),n}}(i=>{i.createDefaultProps=()=>({...Un.createDefaultProps()})})(xt||(xt={})),p.extendClassProps(xt.prototype,xt.createDefaultProps);class hv extends p.Destroyable{constructor(t,n){super();T(this,"_overEvent",this.disposeVar(new p.Event));const{placeEditing:s}=t;let o=new Fg(t,void 0);t.editingPoints.splice(n,0,o);const r=()=>{(t.debug??xt.defaults.debug)&&console.log("delete currentPosEditor");const c=t.editingPoints.indexOf(o);if(c===-1)throw new Error("currentPosEditor not found");t.editingPoints.splice(c,1)};if(s.enabled??!1)throw console.error("placeEditing.enabled is true!"),new Error("placeEditing.enabled is true!");this.dispose(p.track([o,"position"],[s,"position"])),s.enabled=!0;let a=!1;const l=()=>{r(),this._overEvent.emit(!1)};this.dispose(()=>{s.enabled=!1,!a&&l()}),this.dispose(s.overEvent.disposableOnce(()=>{a=!0,o.position===void 0?l():this._overEvent.emit(!0)})),(t.debug??xt.defaults.debug)&&console.log(`PointAdding creating! index(${n})`),this.dispose(()=>{(t.debug??xt.defaults.debug)&&console.log(`PointAdding destroying! index(${n})`)})}get overEvent(){return this._overEvent}}function uv(i,e){const t=i.editingPoints,n=e-1;return n<0?(console.warn("previousIndex < 0, cannot delete the point!"),!1):(t.splice(n,1),!0)}class dv extends p.Destroyable{constructor(t,n){super();T(this,"_overEvent",this.disposeVar(new p.Event));T(this,"_doEvent",this.disposeVar(new p.Event));this.dispose(this._doEvent.disposableOn(()=>this._overEvent.emit(uv(t,n)))),(t.debug??xt.defaults.debug)&&console.log(`PreviousPointDeleting creating! currentIndex(${n})`),this.dispose(()=>{(t.debug??xt.defaults.debug)&&console.log(`PreviousPointDeleting destroying! currentIndex(${n})`)})}get overEvent(){return this._overEvent}do(){return this._doEvent.emit()}}class fv extends xt{constructor(e){super(e),this.loop=!1}}class pv extends xt{constructor(e){super(e),this.loop=!0}}class Cu extends Dg{constructor(e,t){super(e,t);{const{menuPoi:n}=this;n.commands=[["add","增加控制点","",Xe.baseImageUrl+"add.png"],["delete","删除当前控制点","",Xe.baseImageUrl+"delete.png"],["modify","修改当前控制点","",Xe.baseImageUrl+"modify.png"]],n.clickCommandName="modify",n.rightClickCommandName="delete",this.dispose(n.commandEvent.disposableOn(s=>{e.menuPoiCommand(this,s)})),this.dispose(n.dbclickEvent.disposableOn(()=>{e.menuPoiCommand(this,"dbClick")}))}if(e.middlePointShow){const n=this.ad(new Si(e.olViewer));{n.imageUri=e.firstControlPointImageUrl??Xe.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(!(e.enabled??Xe.defaults.enabled)){n.enabled=!1,n.show=!1;return}do{const r=e.editingPoints.indexOf(this);if(r===-1)break;const a=e.editingPoints.length;if(a===0){console.error("impl.positionEditors.length === 0!");break}if(!(e.loop??Xe.defaults.loop)&&r+1>=a)break;const c=this.position;if(!c)break;let h=(r+1)%a;const d=e.editingPoints.get(h).position;if(!d)break;const f=$f(c,d);if(!f)break;f[2]-=e.olViewer.editingHeightOffset??0,n.position=f;const g=e.editingPoints.length<(e.maxPointsNum??Xe.defaults.maxPointsNum);n.enabled=g,n.show=g;return}while(!1);n.enabled=!1,n.show=!1};s(),this.dispose(e.positionsChanged.disposableOn(s)),this.dispose(e.loopChanged.disposableOn(s)),this.dispose(e.enabledChanged.disposableOn(s))}this.dispose(n.clickEvent.disposableOn(s=>{if(s.button!==0||e.editingPoints.length>=(e.maxPointsNum??Xe.defaults.maxPointsNum))return;const o=e.editingPoints.indexOf(this);if(o===-1)return;const r=n.position?[...n.position]:void 0;r&&(r[2]+=e.olViewer.editingHeightOffset??0);let a=new Cu(e,r);e.editingPoints.splice(o+1,0,a),e.modify(a)}))}}}}class Xe extends Un{constructor(t){super(t);T(this,"_menuPoiCommand",this.disposeVar(new p.Event));T(this,"_forceModifyPosEditorEvent",this.disposeVar(new p.Event));T(this,"_overEvent",this.disposeVar(new p.Event));T(this,"translationEditing");console.log("这是多点修改编辑器");{const s=this.ad(p.createNextAnimateFrameEvent(this.moveWithFirstPositionChanged,this.editingPoints.changedEvent));this.ad(new p.ObjResettingWithEvent(s,()=>{if(!(!this.moveWithFirstPosition||this.editingPoints.length<=1))return new kA(this.editingPoints.get(0),this)}))}const n=this.translationEditing=this.disposeVar(new hi(t));n.enabled=!1,this.currentProcess=this.disposeVar(p.createProcessingFromAsyncFunc(async s=>{s.disposer.dispose(()=>{(this.debug??Xe.defaults.debug)&&console.log("---editing canceled~~~"),this.status="None",this.enabled=!1});let o=-1;do if((this.debug??Xe.defaults.debug)&&console.log("进入Modifying修改状态"),this.status="Modifying",o=await s.promise(p.step(s,async r=>{const a=r.disposer,l=a.ad(new jA(this));return a.dispose(()=>"modifying canceled!"),this.editingPoints.length>0&&l.modify(this.editingPoints.get(o===-1||o>=this.editingPoints.length?0:o)),a.dispose(this.cancelEvent.disposableOn(()=>l.cancel())),a.dispose(this._forceModifyPosEditorEvent.disposableOn(h=>l.modify(h))),await r.promise(new Promise(h=>{a.dispose(l.overEvent.disposableOnce(u=>{h(u)}))}))})),o===-1){(this.debug??Xe.defaults.debug)&&console.log("退出编辑状态");break}else{if(this.editingPoints.length>=(this.maxPointsNum??Xe.defaults.maxPointsNum))return;if(this.editingPoints.length===0){console.error("impl.positionEditors.length === 0!");return}this.loop??Xe.defaults.loop;const a=this.editingPoints.get(o-1).position;if(!a)return;let l=o%this.editingPoints.length;const h=this.editingPoints.get(l).position;if(!h)return;const u=$f(a,h);if(!u)return;u&&(u[2]+=this.olViewer.editingHeightOffset??0);let d=new Cu(this,u);this.editingPoints.splice(o,0,d)}while(!0);this.status="None",this.enabled=!1}))}menuPoiCommand(t,n){this._menuPoiCommand.emit(t,n)}modify(t){this._forceModifyPosEditorEvent.emit(t)}resetPositions(t){if(!super.resetPositions(t))return!0;const n=t?t.map(s=>new Cu(this,s)):[];return this.editingPoints.splice(0,this.editingPoints.length,...n),!0}get overEvent(){return this._overEvent}}(i=>{i.createDefaultProps=()=>({...Un.createDefaultProps(),moveWithFirstPosition:!1})})(Xe||(Xe={})),p.extendClassProps(Xe.prototype,Xe.createDefaultProps);class kA extends p.Destroyable{constructor(e,t){super(),this._firstPositionEditor=e,this.multiPointsModifyEditing=t,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 l=this.multiPointsModifyEditing.editingPoints.get(a),c=l.position;c!==void 0&&(l.position=[c[0]+o[0],c[1]+o[1],c[2]+o[2]])}})}}class jA extends p.Destroyable{constructor(t){super();T(this,"_overEvent",this.disposeVar(new p.Event));T(this,"_cancelEvent",this.disposeVar(new p.Event));T(this,"_forceModifyPosEditorEvent",this.disposeVar(new p.Event));t.menuPoiEnabled=!0,this.dispose(()=>t.menuPoiEnabled=!1);let n;const s=()=>{n==null||n.destroy(),n=void 0,t.status="Modifying"};this.dispose(s);const o=r=>{s(),t.status="Modifying_Point",n=new UA(t,r),n.dispose(n.overEvent.disposableOn(()=>{s()}))};this.dispose(this._forceModifyPosEditorEvent.disposableOn(o)),this.dispose(t._menuPoiCommand.disposableOn((r,a)=>{if(a==="delete"){if(t.editingPoints.length<=2)return;const l=t.editingPoints.indexOf(r);if(l===-1)throw console.error("posEditor not found"),new Error("posEditor not found");t.editingPoints.splice(l,1)}else if(a==="modify")o(r);else if(a==="add"){const l=t.editingPoints.indexOf(r);if(l===-1)throw console.error("posEditor not found"),new Error("posEditor not found");this._overEvent.emit(l+1)}else a==="dbClick"?this._overEvent.emit(-1):alert(`未知的commandName(${a})`)})),this.dispose(this._cancelEvent.disposableOn(()=>{this._overEvent.emit(-1)}))}get overEvent(){return this._overEvent}cancel(){this._cancelEvent.emit()}modify(t){this._forceModifyPosEditorEvent.emit(t)}}class UA extends p.Destroyable{constructor(t,n){super();T(this,"_overEvent",this.disposeVar(new p.Event));this._modifying=t,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(p.track([this._posEditor,"position"],[s,"position"])),this.dispose(s.enabledChanged.disposableOnce(o=>{o||this._overEvent.emit()}))}get overEvent(){return this._overEvent}}class gv extends Xe{constructor(e){super(e),this.loop=!1}}class mv extends Xe{constructor(e){super(e),this.loop=!0}}class jo extends xt{init(){const e=this.startPosition;if(!e)return;const t=this.distance,n=this.rotation,s=t*Math.cos(n[1]*Math.PI/180),o=p.geoDestination(e,s,n[0]);if(!o){this.positions=[e];return}const r=t*Math.sin(n[1]*Math.PI/180);o[2]+=r,this.positions=[e,o],this.editingPoints.length==2&&(this.editingPoints.get(0).position=e,this.editingPoints.get(1).position=o)}constructor(e){super(e),this.loop=!0,this.maxPointsNum=2;{const t=()=>{if(!this.positions||this.positions.length==0){this.distance=1,this.rotation=[90,0,0],this.startPosition=[0,0,0];return}if(this.positions.length==1){this.distance=1,this.rotation=[90,0,0];return}this.startPosition=this.positions[0],this.endPosition=this.positions[1];const n=p.geoHeading(this.startPosition,this.endPosition),s=p.geoDistance(this.startPosition,this.endPosition);if(s<=0){this.rotation=[90,0,0],this.distance=1;return}const o=this.endPosition[2]-this.startPosition[2],r=Math.atan(o/s)*180/Math.PI,a=Math.sqrt(s*s+o*o);this.rotation=[n,r,0],this.distance=a};t(),this.ad(this.positionsChanged.don(t))}}}(i=>{i.createDefaultProps=()=>({...xt.createDefaultProps(),startPosition:p.reactArrayWithUndefined(void 0),endPosition:p.reactArrayWithUndefined(void 0),rotation:p.reactArray([90,0,0]),distance:p.react(1)})})(jo||(jo={})),p.extendClassProps(jo.prototype,jo.createDefaultProps);class rs extends Xe{init(){const e=this.startPosition;if(!e)return;const t=this.distance,n=this.rotation,s=t*Math.cos(n[1]*Math.PI/180),o=p.geoDestination(e,s,n[0]);if(!o){this.positions=[e];return}const r=t*Math.sin(n[1]*Math.PI/180);o[2]+=r,this.positions=[e,o],this.editingPoints.length==2&&(this.editingPoints.get(0).position=e,this.editingPoints.get(1).position=o)}constructor(e){super(e),this.loop=!0,this.maxPointsNum=2,this.middlePointShow=!1,this.moveWithFirstPosition=!0;{const t=()=>{do{if(!this.positions||this.positions.length==0){this.distance=1,this.rotation=[90,0,0],this.startPosition=[0,0,0];break}if(this.startPosition=this.positions[0],this.positions.length==1){this.editingPoints.get(0).menuPoi.commands=[["add","增加控制点","",Xe.baseImageUrl+"add.png"],["delete","删除当前控制点","",Xe.baseImageUrl+"delete.png"],["modify","修改当前控制点","",Xe.baseImageUrl+"modify.png"]],this.rotation=[90,0,0],this.distance=1;break}this.endPosition=this.positions[1];for(let l of this.editingPoints)l.menuPoi.commands=[["delete","删除当前控制点","",Xe.baseImageUrl+"delete.png"],["modify","修改当前控制点","",Xe.baseImageUrl+"modify.png"]];const n=p.geoHeading(this.startPosition,this.endPosition),s=p.geoDistance(this.startPosition,this.endPosition);if(Math.abs(s)<=0){this.rotation=[90,0,0],this.distance=1;return}const o=this.endPosition[2]-this.startPosition[2],r=Math.atan(o/s)*180/Math.PI,a=Math.sqrt(s*s+o*o);this.rotation=[n,r,0],this.distance=a}while(!1)};this.ad(this.positionsChanged.don(t))}}}(i=>{i.createDefaultProps=()=>({...Xe.createDefaultProps(),startPosition:p.reactArrayWithUndefined(void 0),endPosition:p.reactArrayWithUndefined(void 0),rotation:p.reactArray([0,0,0]),distance:p.react(0)})})(rs||(rs={})),p.extendClassProps(rs.prototype,rs.createDefaultProps);class GA extends xt{constructor(e){super(e),this.loop=!1,this.polylineShow=!1}}class qA extends Xe{constructor(e){super(e),this.loop=!1,this.polylineShow=!1,this.middlePointShow=!1}}class _l extends xt{constructor(e){super(e),e.viewer||(this.loop=!1);{const t=()=>{if(!this.positions||this.positions.length<2){this.visibilityPositions=void 0;return}const n=[...this.positions[0]];n[2]-=e.editingHeightOffset??0,this.visibilityPositions=this.positions.map(s=>(s[2]-=e.editingHeightOffset??0,[n,s]))};t(),this.ad(this.positionsChanged.don(t))}}createPolyline(e){const t=this.ad(new Di(e));t.topOrBottom="bottom",this.ad(p.track([t,"color"],[this,"polylineColor"])),this.ad(p.track([t,"width"],[this,"polylineWidth"])),this.ad(p.track([t,"show"],[this,"polylineShow"])),this.ad(p.track([t,"arcType"],[this,"polylineArcType"])),this.ad(p.track([t,"loop"],[this,"loop"])),this.ad(p.track([t,"positions"],[this,"visibilityPositions"]))}}(i=>{i.createDefaultProps=()=>({...xt.createDefaultProps(),visibilityPositions:p.reactPositionsSet(void 0)})})(_l||(_l={})),p.extendClassProps(_l.prototype,_l.createDefaultProps);class wl extends Xe{constructor(e){if(super(e),!!e.viewer){this.loop=!1,this.middlePointShow=!1;{const t=()=>{if(!this.positions||this.positions.length<2)return;const n=[...this.positions[0]];n[2]-=e.editingHeightOffset??0,this.visibilityPositions=this.positions.map(s=>(s[2]-=e.editingHeightOffset??0,[n,s]))};t(),this.ad(this.positionsChanged.don(t))}}}createPolyline(e){const t=this.ad(new Di(e));t.topOrBottom="bottom",this.ad(p.track([t,"color"],[this,"polylineColor"])),this.ad(p.track([t,"width"],[this,"polylineWidth"])),this.ad(p.track([t,"show"],[this,"polylineShow"])),this.ad(p.track([t,"arcType"],[this,"polylineArcType"])),this.ad(p.track([t,"loop"],[this,"loop"])),this.ad(p.track([t,"positions"],[this,"visibilityPositions"]))}}(i=>{i.createDefaultProps=()=>({...Xe.createDefaultProps(),visibilityPositions:p.reactPositionsSet(void 0)})})(wl||(wl={})),p.extendClassProps(wl.prototype,wl.createDefaultProps);class VA extends rs{constructor(e){super(e),this.firstControlPointImageUrl=this.otherControlPointImageUrl,this.translationEditing.xAxisShow=!1,this.translationEditing.yAxisShow=!1,this.translationEditing.showCircle=!1,this.rotation=[0,90,0]}}class Rn extends p.EngineObject{constructor(t,n,s){super(t,n,s??!0);T(this,"_supportEditing",this.disposeVar(p.react(!0)));T(this,"_currentEditing",this.disposeVar(p.react(void 0)));this.ad(this.supportEditingChanged.don(()=>{this.destroy()}))}get supportEditing(){return this._supportEditing.value}set supportEditing(t){this._supportEditing.value=t}get supportEditingChanged(){return this._supportEditing.changed}get currentEditing(){return this._currentEditing.value}set currentEditing(t){this._currentEditing.value=t}get currentEditingChanged(){return this._currentEditing.changed}}const zl=class zl extends Rn{constructor(e,t){super(Array.isArray(e)?e[0]:e,t,!0);const n=this.currentEditing=this.ad(new hi(t));if(this.ad(n.enabledChanged.don(s=>{s||this.ad(p.nextAnimateFrame(()=>this.destroy()))})),Array.isArray(e)){const s=[];for(let o=0;o<e.length;o++){const r=e[o];Reflect.has(r,"position")?s.push(r.position):r.points&&s.push(...r.points)}n.position=p.getMinMaxCorner(s).center,this.ad(n.positionChanged.disposableOn((o,r)=>{if(!o||!r)return;const a=xr({originPosition:r},[o])[0][0];e.forEach(l=>{if(Reflect.has(l,"position")){const c=xr({originPosition:r},[l.position])[0][0];l.position=Ch({originPosition:r},[[c[0]+a[0],c[1]+a[1],c[2]+a[2]]])[0][0]}else if(Reflect.has(l,"points")&&l.points){const c=xr({originPosition:r},l.points)[0];l.points=Ch({originPosition:r},c.map(h=>[h[0]+a[0],h[1]+a[1],h[2]+a[2]]))[0]}})}));return}if(Reflect.has(e,"position")){this.ad(p.bind([n,"position"],[e,"position"]));return}if(Reflect.has(e,"points")){const s=e;if(s.points===void 0||s.points.length===0){this.destroy();return}n.position=p.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=xr({originPosition:r},[o])[0][0],l=xr({originPosition:r},s.points)[0];s.points=Ch({originPosition:r},l.map(c=>[c[0]+a[0],c[1]+a[1],c[2]+a[2]]))[0]}));return}this.supportEditing=!1}};T(zl,"type",zl.registerEditing("ESOlViewer",p.ESJEditingMode.Translation,zl));let xu=zl;function yv(){const i=p.createProcessingFromAsyncFunc(async(e,t,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),t.editingEvent.emit({objectIDs:[n.parentID],editingID:a,type:"start",add:{modes:r}});const l=()=>{t.notSupportEditingCount=0,t.editingEvent.emit({objectIDs:[n.parentID],editingID:a,type:"end",add:{modes:r}}),i.isRunning&&i.cancel()};e.disposer.ad(l),e.disposer.ad(n.toDestroyEvent.don(l));const c=u=>{u.code==="Escape"&&l()};document.body.addEventListener("keydown",c),e.disposer.ad(()=>document.body.removeEventListener("keydown",c));const h=async u=>{if(!i.isRunning)return;const d=r[u%r.length],f=await p.step(e,async _=>{const v=_.disposer,E=p.EngineObject.contextEditing.getEngineObjConstructor(d,t.typeName);if(!E||!n.supportEditingModes().includes(d))return console.log(`未找到编辑模式或不支持当前编辑模式 ${d},已跳过,请检查输入`),t.editingEvent.emit({objectIDs:[n.parentID],editingID:a,type:"changedFailed",add:{cMode:d,cIndex:u}}),t.notSupportEditingCount++,"next";const w=new E(n,t);if(v.ad(()=>{!w.isDestroyed()&&w.destroy()}),w.supportEditing)t.editingEvent.emit({objectIDs:[n.parentID],editingID:a,type:"changed",add:{cMode:d,cIndex:u}}),t.notSupportEditingCount=0;else return console.log(`编辑模式 ${d} 不支持,已跳过`),t.editingEvent.emit({objectIDs:[n.parentID],editingID:a,type:"changedFailed",add:{cMode:d,cIndex:u}}),t.notSupportEditingCount++,"next";return await _.promise(new Promise(P=>{if(w.isDestroyed())return P("next");if(v.ad(w.toDestroyEvent.don(()=>{console.log(`编辑模式 ${d} 结束`),P("next")})),o){const R=O=>{O.code==="Space"&&(console.log(`编辑模式 ${d} 切换到下一模式`),P("next"))};document.body.addEventListener("keydown",R),v.ad(()=>document.body.removeEventListener("keydown",R)),v.ad(t.dblclickEvent.don(()=>P("done")))}else v.ad(t.dblclickEvent.don(()=>P("done")))}))});if(t.notSupportEditingCount===r.length||f==="done")return;const g=o?(u+1)%r.length:u+1;if(!(!o&&g>=r.length))return await Promise.resolve(),h(g)};await h(0)});return i}function WA(){const i=p.createProcessingFromAsyncFunc(async(e,t,n,s)=>{t.editingEvent.emit({objectIDs:n.map(l=>l.parentID),editingID:s,type:"start"});const o=()=>{t.editingEvent.emit({objectIDs:n.map(l=>l.parentID),editingID:s,type:"end"}),i.isRunning&&i.cancel()};e.disposer.ad(o);const r=l=>{l.code=="Escape"&&o()};document.body.addEventListener("keydown",r),e.disposer.ad(()=>document.body.removeEventListener("keydown",r));const a=new xu(n,t);e.disposer.ad(()=>{!a.isDestroyed()&&a.destroy()}),await e.promise(new Promise(l=>{a.isDestroyed()&&l(),e.disposer.ad(a.toDestroyEvent.don(()=>{console.log("移动结束"),l()})),e.disposer.ad(t.dblclickEvent.don(()=>l()))}))});return i}const Nl=class Nl extends Rn{constructor(e,t){super(e,t,!0);const n=this.currentEditing=this.ad(new ci(t));this.ad(t.clickEvent.don(s=>{var o;((o=s.pointerEvent)==null?void 0:o.button)==2&&(n.enabled=!0)})),Reflect.has(e,"position")?(this.ad(p.bind([n,"position"],[e,"position"])),n.enabled=!n.position||p.equalsN3(n.position,[0,0,0])):this.supportEditing=!1}};T(Nl,"type",Nl.registerEditing("ESOlViewer",p.ESJEditingMode.Place,Nl));let Lg=Nl;const kl=class kl extends Rn{constructor(e,t){super(e,t,!0);const n=this.currentEditing=this.ad(new os(t));if(this.ad(n.enabledChanged.don(s=>{!s&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))})),Reflect.has(e,"position")&&Reflect.has(e,"scale")){const s=e;this.ad(p.bind([n,"position"],[s,"position"])),this.ad(p.bind([n,"scale"],[s,"scale"]))}else throw new Error(`ScaleEditingWrapper:${e.typeName} 缩放属性无法绑定缩放编辑`)}};T(kl,"type",kl.registerEditing("ESOlViewer",p.ESJEditingMode.Scale,kl));let zg=kl;const jl=class jl extends Rn{constructor(t,n){super(t,n,!0);T(this,"_olViewer");T(this,"positionBindRemove");this._olViewer=n;const s=t;this.ad(()=>this.clear()),p.equalsN3(s.position,[0,0,0])?this.switchEditing(p.ESJEditingMode.Place):this.switchEditing(p.ESJEditingMode.Translation),this.ad(n.clickEvent.don(o=>{var r,a;((r=o.pointerEvent)==null?void 0:r.button)==0&&this.currentEditing instanceof ci&&this.switchEditing(p.ESJEditingMode.Translation),((a=o.pointerEvent)==null?void 0:a.button)==2&&this.currentEditing instanceof hi&&this.switchEditing(p.ESJEditingMode.Place)}))}clear(){var t;(t=this.positionBindRemove)==null||t.call(this),this.currentEditing&&!this.currentEditing.isDestroyed()&&this.currentEditing.destroy(),this.currentEditing=this.positionBindRemove=void 0}switchEditing(t){this.clear(),this.currentEditing=t==p.ESJEditingMode.Place?new ci(this._olViewer):new hi(this._olViewer),this.currentEditing.enabled=!0,this.positionBindRemove=p.bind([this.currentEditing,"position"],[this.sceneObject,"position"])}};T(jl,"type",jl.registerEditing("ESOlViewer",p.ESJEditingMode.SinglePoint,jl));let Ng=jl;const Ul=class Ul extends Rn{constructor(e,t){super(e,t,!0);const n=this.currentEditing=this.ad(new fv(t));if(this.ad(n.enabledChanged.don(s=>{s||this.ad(p.nextAnimateFrame(()=>this.destroy()))})),Reflect.has(e,"points")){const s=()=>n.positions=e.points??[];s(),this.ad(e.pointsChanged.don(()=>{n.enabled||s()})),n.enabled=!0,this.ad(p.track([e,"points"],[n,"positions"]))}else this.supportEditing=!1}};T(Ul,"type",Ul.registerEditing("ESOlViewer",p.ESJEditingMode.LineStringAppend,Ul));let kg=Ul;const Gl=class Gl extends Rn{constructor(e,t){super(e,t,!0);const n=this.currentEditing=this.ad(new gv(t));if(this.ad(n.enabledChanged.don(s=>{s||this.ad(p.nextAnimateFrame(()=>this.destroy()))})),Reflect.has(e,"points")){const s=()=>{n.positions=e.points??[]};s(),this.ad(e.pointsChanged.don(()=>{n.enabled||s()})),n.enabled=!0,this.ad(p.track([e,"points"],[n,"positions"]))}else this.supportEditing=!1}};T(Gl,"type",Gl.registerEditing("ESOlViewer",p.ESJEditingMode.LineStringInsert,Gl));let jg=Gl;const ql=class ql extends Rn{constructor(e,t){super(e,t,!0);const n=this.currentEditing=this.ad(new pv(t));if(this.ad(n.enabledChanged.don(s=>{!s&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))})),Reflect.has(e,"points")){const s=()=>{n.positions=e.points??[]};s(),this.ad(e.pointsChanged.don(()=>{n.enabled||s()})),n.enabled=!0,this.ad(p.track([e,"points"],[n,"positions"]))}else this.supportEditing=!1}};T(ql,"type",ql.registerEditing("ESOlViewer",p.ESJEditingMode.CircularAppend,ql));let Ug=ql;const Vl=class Vl extends Rn{constructor(e,t){super(e,t,!0);const n=this.currentEditing=this.ad(new mv(t));if(this.ad(n.enabledChanged.don(s=>{!s&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))})),Reflect.has(e,"points")){const s=()=>n.positions=e.points??[];s(),this.ad(e.pointsChanged.don(()=>!n.enabled&&s())),n.enabled=!0,this.ad(p.track([e,"points"],[n,"positions"]))}else this.supportEditing=!1}};T(Vl,"type",Vl.registerEditing("ESOlViewer",p.ESJEditingMode.CircularInsert,Vl));let Gg=Vl;const Wl=class Wl extends Rn{constructor(e,t){super(e,t,!0);const n=this.currentEditing=this.ad(new jo(t));if(this.ad(n.enabledChanged.don(s=>{!s&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))})),Reflect.has(e,"position")){const s=e;if(this.ad(p.bind([n,"startPosition"],[s,"position"])),this.ad(Kf([n,"rotation"],[s,"rotation"])),Reflect.has(s,"far"))this.ad(p.bind([n,"distance"],[s,"far"]));else if(Reflect.has(s,"radius"))this.ad(p.bind([n,"distance"],[s,"radius"]));else if(Reflect.has(s,"distance"))this.ad(p.bind([n,"distance"],[s,"distance"]));else{const o=t.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(e,"points")){const s=e,o=()=>n.positions=s.points??[];o(),this.ad(s.pointsChanged.don(()=>!n.enabled&&o())),this.ad(p.track([s,"points"],[n,"positions"]))}else throw new Error(`DoublePointsAppendEditingWrapper:${e.typeName} 坐标属性无法绑定双点追加编辑`);n.startPosition&&!p.equalsN3(n.startPosition,[0,0,0])&&n.init(),n.enabled=!0}};T(Wl,"type",Wl.registerEditing("ESOlViewer",p.ESJEditingMode.DoublePointsAppend,Wl));let qg=Wl;const Bl=class Bl extends Rn{constructor(e,t){var r;super(e,t,!0);const n=t.viewer;if(!n)return;const s=this.currentEditing=this.ad(new rs(t));if(Reflect.has(e,"position")){const a=e;if(this.ad(p.bind([s,"startPosition"],[a,"position"])),this.ad(Kf([s,"rotation"],[a,"rotation"])),Reflect.has(a,"far"))this.ad(p.bind([s,"distance"],[a,"far"]));else if(Reflect.has(a,"radius"))this.ad(p.bind([s,"distance"],[a,"radius"]));else if(Reflect.has(a,"distance"))this.ad(p.bind([s,"distance"],[a,"distance"]));else{const l=((r=n.getView())==null?void 0:r.getResolution())??1;s.distance=Math.max(1,l*100)}}else if(Reflect.has(e,"points")){const a=e;if(!a.points||a.points.length!==2)throw new Error(`DoublePointsModifyEditingWrapper:${e.typeName} 坐标属性无法绑定双点修改编辑`);s.moveWithFirstPosition=!1;const l=()=>s.positions=a.points??[];l(),this.ad(a.pointsChanged.don(()=>!s.enabled&&l())),this.ad(p.track([a,"points"],[s,"positions"]))}else throw new Error(`DoublePointsModifyEditingWrapper:${e.typeName} 坐标属性无法绑定双点修改编辑`);s.init(),s.enabled=!0;const o=this.ad(p.createNextAnimateFrameEvent(s.enabledChanged,s.startPositionChanged));this.ad(o.don(()=>{(!s.enabled||!s.startPosition||p.equalsN3(s.startPosition,[0,0,0]))&&this.destroy()}))}};T(Bl,"type",Bl.registerEditing("ESOlViewer",p.ESJEditingMode.DoublePointsModify,Bl));let Vg=Bl;const $l=class $l extends Rn{constructor(t,n){var o;super(t,n,!0);T(this,"_olViewer");T(this,"bindRemove",[]);this._olViewer=n;const s=t;this.ad(()=>this.clear()),p.equalsN3(s.position,[0,0,0])||Reflect.has(s,"points")&&((o=s.points)==null?void 0:o.length)==0?this.switchEditing(p.ESJEditingMode.DoublePointsAppend):this.switchEditing(p.ESJEditingMode.DoublePointsModify)}clear(){this.bindRemove.forEach(t=>t==null?void 0:t()),this.currentEditing&&!this.currentEditing.isDestroyed()&&this.currentEditing.destroy(),this.currentEditing=void 0,this.bindRemove=[]}switchEditing(t){this.clear();const n=this._olViewer,s=this.sceneObject,o=this.currentEditing=t==p.ESJEditingMode.DoublePointsAppend?new jo(n):new rs(n);if(this.bindRemove.push(o.enabledChanged.don(r=>{!r&&this.ad(p.nextAnimateFrame(()=>this.destroy()))})),Reflect.has(s,"position")){const r=s;if(this.bindRemove.push(p.bind([o,"startPosition"],[r,"position"])),this.bindRemove.push(Kf([o,"rotation"],[r,"rotation"])),Reflect.has(r,"far"))this.bindRemove.push(p.bind([o,"distance"],[r,"far"]));else if(Reflect.has(r,"radius"))this.bindRemove.push(p.bind([o,"distance"],[r,"radius"]));else if(Reflect.has(r,"distance"))this.bindRemove.push(p.bind([o,"distance"],[r,"distance"]));else{const a=n.viewer,l=a==null?void 0:a.getView(),c=(l==null?void 0:l.getResolution())??1;o.distance=Math.max(1,c*100)}}else if(Reflect.has(s,"points")){o instanceof rs&&(o.moveWithFirstPosition=!1);const r=s,a=()=>o.positions=r.points??[];a(),this.bindRemove.push(r.pointsChanged.don(()=>!o.enabled&&a())),this.bindRemove.push(p.track([r,"points"],[o,"positions"]))}else throw new Error(`DoublePointsWrapper:${s.typeName} 坐标属性无法绑定双点编辑`);t==p.ESJEditingMode.DoublePointsAppend?this.bindRemove.push(n.clickEvent.don(r=>{var a;o.editingPoints.length==o.maxPointsNum&&((a=r.pointerEvent)==null?void 0:a.button)==0&&this.switchEditing(p.ESJEditingMode.DoublePointsModify)})):o.init(),o.enabled=!0}};T($l,"type",$l.registerEditing("ESOlViewer",p.ESJEditingMode.DoublePoints,$l));let Wg=$l;const Hl=class Hl extends Rn{constructor(e,t){super(e,t,!0);const n=this.currentEditing=this.ad(new Ys(t));if(n.rotation=[90,0,0],this.ad(n.enabledChanged.don(s=>{s||this.ad(p.nextAnimateFrame(()=>this.destroy()))})),Reflect.has(e,"position")&&Reflect.has(e,"rotation")){const s=e;this.ad(p.bind([n,"position"],[s,"position"])),this.ad(p.bind([n,"selfRotation"],[s,"rotation"]));return}else throw new Error(`OlRotationEditingWrapper:${e.typeName} 旋转属性无法绑定旋转编辑`)}};T(Hl,"type",Hl.registerEditing("ESOlViewer",p.ESJEditingMode.Rotation,Hl));let Bg=Hl;W.AddEditingPoint=Fg,W.BaseEditingWrapper=Rn,W.CircularAppendEditing=pv,W.CircularAppendEditingWrapper=Ug,W.CircularInsertEditing=mv,W.CircularInsertEditingWrapper=Gg,W.CurrentScale=Z_,W.DoublePointsAppendEditing=jo,W.DoublePointsAppendEditingWrapper=qg,W.DoublePointsModifyEditing=rs,W.DoublePointsModifyEditingWrapper=Vg,W.DoublePointsWrapper=Wg,W.ESOlViewer=Ri,W.EditingPoint=Dg,W.FPSMonitor=Ey,W.GeoCanvasPoi=es,W.HeightModifyEditing=VA,W.ImageLabel2D=Zw,W.LineStringAppendEditing=fv,W.LineStringAppendEditingWrapper=kg,W.LineStringInsertEditing=gv,W.LineStringInsertEditingWrapper=jg,W.MultiPointsAppendEditing=xt,W.OLCurrentScale=Oy,W.OlCanvasAndDivSwitchPoi=ZR,W.OlCanvasPoi=Yf,W.OlCursorPositionInfo=s1,W.OlDivPoi=Qf,W.OlESAreaMeasurement=yg,W.OlESDirectionMeasurement=_g,W.OlESDistanceMeasurement=wg,W.OlESGeoIcon=vg,W.OlESGeoLineString=gl,W.OlESGeoPoint=bg,W.OlESGeoPoints=Eg,W.OlESGeoPolygon=fl,W.OlESGeoPolygonImpl=zo,W.OlESGeoPolygonWithFire=Cg,W.OlESImageLabel=xg,W.OlESImageryLayer=Pg,W.OlESLabel=mg,W.OlESLocationMeasurement=Sg,W.OlESMVTLayer=Rg,W.OlESObjectWithLocation=dl,W.OlESPath=Ig,W.OlESTextLabel=Og,W.OlESXYZLayer=Mg,W.OlGeoCanvasImagePoi=Si,W.OlGeoCanvasMenuPoi=Pr,W.OlGeoCustomDivPoi=jt,W.OlGeoDivTextPoi=Us,W.OlImageriesManager=o1,W.OlImagery=gg,W.OlLabelManager=r1,W.OlMultiPoint=Hs,W.OlPickingManager=l1,W.OlPoint=li,W.OlPoisContext=t1,W.OlPolygon=ss,W.OlPolyline=Ut,W.OlRotationEditing=Ys,W.OlRotationEditingWrapper=Bg,W.OlView=Lo,W.OlViewChanged=Tx,W.OlViewerExtensions=c1,W.PlaceEditing=ci,W.PlaceEditingWrapper=Lg,W.PointAdding=hv,W.PreviousPointDeleting=dv,W.ScaleEditing=os,W.ScaleEditingWrapper=zg,W.ScatterAppendEditing=GA,W.ScatterModifyEditing=qA,W.SinglePointEditingWrapper=Ng,W.TranslationEditing=hi,W.TranslationEditingWrapper=xu,W.VisibilityAppendEditing=_l,W.VisibilityModifyEditing=wl,W.WASDController=by,W.capture=wy,W.cesiumHeightToOlZoom=wo,W.compute2DPickingConstraint=Dx,W.compute2DPickingInfoWithCoordinates=Iy,W.computePickingInfoWithCoordinates2D=Ry,W.createEditingSystemProcessing=yv,W.createHelperLine=Ax,W.createMoveObjectsProcessing=WA,W.defaultFlyToRotation=Cy,W.deletePreviousPoint=uv,W.flyExtent=ka,W.flyTo=Yi,W.flyToWithParam=Rx,W.flyToWithPosition=nf,W.flyToWithPositions=Sx,W.fromCartesian=hR,W.fromCartesian2=k_,W.fromCartesian3=U_,W.fromCartesian4=q_,W.fromCartographic=dR,W.fromColor=pR,W.fromDistanceDisplayCondition=wR,W.fromEllipsoid=IR,W.fromHeadingPitchRoll=yR,W.fromNearFarScalar=mR,W.fromQuaternion=bR,W.fromRectangle=SR,W.geoNeareastPointOnRhumbLine=Ms,W.geoNeareastPointOnRhumbLine2=Mx,W.getCameraPosition=Py,W.getCenterFromPositions=kR,W.getFlatMidPoint=$f,W.getInverseModelMatrix=H_,W.getMinMaxCoordinates=K_,W.getModelMatrixFromPosition=Bf,W.getOlZoomFromCesiumHeight=Px,W.getPointsExtent=qc,W.getViewerExtensions=ts,W.localPositionToPosition=Y_,W.localPositionsToPositions=Ch,W.moveAllPositionsWithCenter=jR,W.olFlyTo=xy,W.olZoomToCesiumHeight=Na,W.orbitAroundPoint=vy,W.pickOlPosition=Sy,W.positionAndRotationToQuaternion=xR,W.positionFromCartesian=cR,W.positionToCartesian=z_,W.positionToLocalPosition=X_,W.positionsToLocalPositions=xr,W.setViewerExtensions=Rh,W.toCartesian=V_,W.toCartesian2=N_,W.toCartesian3=j_,W.toCartesian4=G_,W.toCartographic=uR,W.toColor=fR,W.toDistanceDisplayCondition=_R,W.toEllipsoid=TR,W.toHeadingPitchRoll=W_,W.toNearFarScalar=gR,W.toQuaternion=vR,W.toRectangle=PR,W.visualizeCenterPoint=xx,Object.defineProperty(W,Symbol.toStringTag,{value:"Module"})}));
|
|
112
|
+
}`;this.instanceClassStr=y};v(),this.dispose(this.innerHTMLChanged.disposableOn(v))}}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,i){(this.allowPicking??!1)&&this.pickedEvent.emit(new f.ESJPickedResult({element:e,...i}))}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}}E(de,"defaultOLInstanceClassStr",ru),E(de,"olInstanceClassStrReadMe",lm),E(de,"defaults",{position:[116.39,39.9,0],instanceClassStr:ru,instanceClassStrReadMe:lm,innerHTML:cm,innerHTMLReadMe:P1,viewDistanceRange:[1e3,1e4,3e4,6e4],zOrder:0}),(n=>{n.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})})(de||(de={})),f.extendClassProps(de.prototype,de.createDefaultProps);class R1 extends f.Destroyable{constructor(t,e,i){super(),this._container=t}}const _c=class _c extends f.Destroyable{constructor(e,i){super();E(this,"_pickedEvent",this.disposeVar(new f.Event));E(this,"_divEvent",this.disposeVar(new f.Event));E(this,"_divCreatedEvent",this.disposeVar(new f.Event));E(this,"_divToDestroyEvent",this.disposeVar(new f.Event));E(this,"_pc",this.disposeVar(new f.PointerClick));E(this,"_flyToEvent",this.disposeVar(new f.Event));E(this,"_customDivPoi");this._customDivPoi=this.disposeVar(new de(e,i));const s=this,r=this._customDivPoi;this.dispose(this.flyToEvent.disposableOn(o=>{r.flyTo(o)})),this.dispose(f.bind([r,"show"],[this,"show"])),this.dispose(f.bind([r,"position"],[this,"position"])),this.dispose(f.bind([r,"originRatioAndOffset"],[this,"originRatioAndOffset"])),this.dispose(f.bind([r,"opacity"],[this,"opacity"])),this.dispose(f.bind([r,"viewDistanceRange"],[this,"viewDistanceRange"])),this.dispose(f.bind([r,"viewDistanceDebug"],[this,"viewDistanceDebug"])),this.dispose(f.bind([r,"shadowDom"],[this,"shadowDom"])),this.dispose(f.bind([r,"cssAllInitial"],[this,"cssAllInitial"])),this.dispose(f.bind([r,"allowPicking"],[this,"pickOnClick"])),this.d(f.bind([r,"zOrder"],[this,"zOrder"]));{class o extends R1{constructor(l,c,h){super(l,c,h);const u=document.createElement("div");u.style.overflow="hidden",u.style.whiteSpace="nowrap",u.addEventListener("mouseover",()=>{s.divEvent.emit(!0)}),u.addEventListener("mouseout",()=>{s.divEvent.emit(!1)});{{const g=()=>{r.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??_c.defaults.fontFamily}`;const m=s.borderRadius??[6,6,6,6];u.style.borderRadius=`${m[0]}px ${m[1]}px ${m[2]}px ${m[3]}px`;const _=s.color??[1,1,1,1];u.style.color=`rgba(${_[0]*255},${_[1]*255},${_[2]*255},${_[3]})`;const v=s.backgroundColor??[0,0,0,.8];u.style.backgroundColor=`rgba(${v[0]*255},${v[1]*255},${v[2]*255},${v[3]})`;const y=s.padding??[5,5,5,5];u.style.padding=`${y[0]}px ${y[1]}px ${y[2]}px ${y[3]}px`,u.style.borderWidth=`${s.borderWidth??0}px`;const w=s.borderColor??[1,1,1,1];u.style.borderColor=`rgba(${w[0]*255},${w[1]*255},${w[2]*255},${w[3]})`,u.style.borderStyle=`${s.borderStyle??"solid"}`,u.style.textAlign=`${s.textAlign??"left"}`,u.style.transform=`scale(${s.scale[0]??1},${s.scale[1]??1}) rotate(${s.rotate??0}deg)`};g();const p=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(p.disposableOn(g))}{const g=()=>{s.textEditing?(u.contentEditable="true",u.focus(),document.execCommand("selectAll",!1,null)):(u.contentEditable="false",document.execCommand("unselect",!1,null))};g(),this.dispose(s.textEditingChanged.disposableOn(g))}{const g=()=>{s.textEditingInteraction||(s.positionEditing??!1?u.style.pointerEvents="none":u.style.pointerEvents="all")};g(),this.dispose(s.positionEditingChanged.disposableOn(g))}let d=null;this.dispose(()=>clearInterval(d));{const g=()=>{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(p){s.textEditingInteraction&&(p.code==="Enter"&&!p.shiftKey&&u.blur(),p.code==="Escape"&&u.blur())})};g(),this.dispose(s.textEditingInteractionChanged.disposableOn(g))}}this._container.appendChild(u),this.dispose(()=>{this._container.removeChild(u)}),s._divCreatedEvent.emit(u),this.dispose(()=>s._divToDestroyEvent.emit(u))}}r.instanceClass=o}this.dispose(r.pickedEvent.don(o=>{(r.allowPicking??!1)&&s.pickedEvent.emit(o)}))}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}};E(_c,"defaults",{width:80,height:28,text:"请输入文字",borderStyle:"solid",fontFamily:"",viewDistanceRange:[1e3,1e4,3e4,6e4],scale:[1,1],zOrder:0});let Wn=_c;(n=>{n.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})})(Wn||(Wn={})),f.extendClassProps(Wn.prototype,Wn.createDefaultProps);class hm extends f.Destroyable{constructor(e){super();E(this,"_enabled",this.disposeVar(f.react(!1)));E(this,"_cursorPosition",f.react(void 0));E(this,"quickPickPosition",!0);let i=new f.Destroyable;const s=()=>{i&&(i.destroy(),i=void 0)};this.dispose(s);const r=()=>{var d;if(s(),!this._enabled.value||!e)return;const o=ln(e);if(!o)return;i=new f.Destroyable;const a=i.disposeVar(f.react(void 0)),l=i.disposeVar(f.createNextAnimateFrameEvent(a.changed)),c=(d=e.getTargetElement)==null?void 0:d.call(e);if(!c)return;const h=g=>{const p=f.getDomEventCurrentTargetPos(g);a.value=p};c.addEventListener("mousemove",h),i.dispose(()=>c.removeEventListener("mousemove",h));const u=i.disposeVar(f.createProcessingFromAsyncFunc(async g=>{const p=o.pickingManager;if(!p||!a.value)return;const m=a.value,_=this.quickPickPosition?await g.promise(f.createCancelablePromise(p.quickPickPosition(m))):await g.promise(f.createCancelablePromise(p.pickPosition(m)));this._cursorPosition.value=_}));i.dispose(l.disposableOn(()=>{u.restart()}))};r(),this.dispose(this._enabled.changed.disposableOn(r))}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 um extends f.Destroyable{constructor(e){super();E(this,"_baseLayers",new Set);E(this,"_imageryGroup",new Nn({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,i){if(!this._baseLayers.has(e)){console.warn("imageriesManager setZindex error: has not added!",e);return}e.setZIndex(i-9999)}}class dm extends f.Destroyable{constructor(e){super();E(this,"_labelMap",{div:new globalThis.Map,canvas:new globalThis.Map});this._map=e;const i=e.getView(),s=[];s.push(i.on("change:center",()=>this._updateZOrder())),s.push(i.on("change:resolution",()=>this._updateZOrder())),s.push(i.on("change:rotation",()=>this._updateZOrder())),s.push(e.on("moveend",()=>this._updateZOrder())),this.dispose(()=>Si(s))}add(e){const i=e instanceof de?"div":"canvas";if(this._labelMap[i].has(e)){console.warn(`Label already exists in ${i} map`,e);return}const s=new f.Destroyable;{const r=s.dv(f.createNextAnimateFrameEvent(e.zOrderChanged,e.positionChanged));s.dispose(r.don(()=>this._updateZOrder()))}this._labelMap[i].set(e,()=>s.destroy()),this._updateZOrder()}delete(e){const i=e instanceof de?"div":"canvas";if(!this._labelMap[i].has(e)){console.warn(`Label not found in ${i} map`,e);return}const s=this._labelMap[i].get(e);s==null||s(),this._labelMap[i].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,i){var a;const s={};for(const l of e.keys()){const c=l.zOrder.toString();s[c]||(s[c]=new globalThis.Map);const h=l instanceof de&&l.olDivPoi?l.olDivPoi.depth:l instanceof an&&l.canvasObj&&((a=l.canvasObj.olCanvasPoi)==null?void 0:a.depth)||0;s[c].set(l,h)}const r=Object.keys(s).sort((l,c)=>i==="div"?Number(c)-Number(l):Number(l)-Number(c));let o=e.size;r.forEach(l=>{new globalThis.Map([...s[l]].sort((h,u)=>u[1]-h[1])).forEach((h,u)=>{var d;u instanceof de&&u.olDivPoi?u.olDivPoi.zOrder=o:u instanceof an&&((d=u.canvasObj)!=null&&d.olCanvasPoi)&&(u.canvasObj.olCanvasPoi.zOrder=o),o--})})}}function _l(n){return Array.isArray(n)?Math.min(...n):n}class fm extends Sh{constructor(t){super(t),this.image=null,this.renderedSourceRevision_=0}getImage(){return this.image?this.image.getImage():null}prepareFrame(t){const e=t.layerStatesArray[t.layerIndex],i=t.pixelRatio,s=t.viewState,r=s.resolution,o=this.getLayer().getSource(),a=t.viewHints;let l=t.extent;if(e.extent!==void 0&&(l=ci(l,Ai(e.extent,s.projection))),!a[Ot.ANIMATING]&&!a[Ot.INTERACTING]&&!qi(l))if(o){!this.getLayer().rendered&&this.renderedSourceRevision_!==o.getRevision()&&(this.image=null),this.renderedSourceRevision_=o.getRevision();const c=s.projection,h=o.getImage(l,r,i,c);h&&(this.loadImage(h)?this.image=h:h.getState()===Y.EMPTY&&(this.image=null))}else this.image=null;return!!this.image}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),s=Yt(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!ts(r,s))return null;const o=this.image.getExtent(),a=this.image.getImage(),l=ut(o),c=Math.floor(a.width*((s[0]-o[0])/l));if(c<0||c>=a.width)return null;const h=Vt(o),u=Math.floor(a.height*((o[3]-s[1])/h));return u<0||u>=a.height?null:this.getImageData(a,c,u)}renderFrame(t,e){const i=this.image,s=i.getExtent(),r=i.getResolution(),[o,a]=Array.isArray(r)?r:[r,r],l=i.getPixelRatio(),c=t.layerStatesArray[t.layerIndex],h=t.pixelRatio,u=t.viewState,d=u.center,g=u.resolution,p=h*o/(g*l),m=h*a/(g*l);this.prepareContainer(t,e);const _=this.context.canvas.width,v=this.context.canvas.height,y=this.getRenderContext(t);let w=!1,x=!0;if(c.extent){const I=Ai(c.extent,u.projection);x=Wt(I,t.extent),w=x&&!Bi(I,t.extent),w&&this.clipUnrotated(y,t,I)}const C=i.getImage(),P=ui(this.tempTransform,_/2,v/2,p,m,0,l*(s[0]-d[0])/o,l*(d[1]-s[3])/a);this.renderedResolution=a*h/l;const b=C.width*P[0],R=C.height*P[3];if(this.getLayer().getSource().getInterpolate()||(y.imageSmoothingEnabled=!1),this.preRender(y,t),x&&b>=.5&&R>=.5){const I=P[4],S=P[5],F=c.opacity;F!==1&&(y.save(),y.globalAlpha=F),y.drawImage(C,0,0,+C.width,+C.height,I,S,b,R),F!==1&&y.restore()}return this.postRender(this.context,t),w&&y.restore(),y.imageSmoothingEnabled=!0,this.container}}class I1 extends fm{constructor(t){super(t),this.vectorRenderer_=new Yg(t),this.layerImageRatio_=t.getImageRatio(),this.coordinateToVectorPixelTransform_=xe(),this.renderedPixelToCoordinateTransform_=null}disposeInternal(){this.vectorRenderer_.dispose(),super.disposeInternal()}getFeatures(t){if(!this.vectorRenderer_)return Promise.resolve([]);const e=Yt(this.coordinateToVectorPixelTransform_,Yt(this.renderedPixelToCoordinateTransform_,t.slice()));return this.vectorRenderer_.getFeatures(e)}handleFontsChanged(){this.vectorRenderer_.handleFontsChanged()}prepareFrame(t){var h;const e=t.pixelRatio,i=t.viewState,s=i.resolution,r=t.viewHints,o=this.vectorRenderer_;let a=t.extent;this.layerImageRatio_!==1&&(a=a.slice(0),O0(a,this.layerImageRatio_));const l=ut(a)/s,c=Vt(a)/s;if(!r[Ot.ANIMATING]&&!r[Ot.INTERACTING]&&!qi(a)){o.useContainer(null,null);const u=o.context,d=t.layerStatesArray[t.layerIndex],g=Object.assign({},d,{opacity:1}),p=Object.assign({},t,{extent:a,size:[l,c],viewState:Object.assign({},t.viewState,{rotation:0}),layerStatesArray:[g],layerIndex:0,declutter:null}),m=this.getLayer().getDeclutter();m&&(p.declutter={[m]:new xh(9)});const _=new dp(a,s,e,u.canvas,function(v){o.prepareFrame(p)&&o.replayGroupChanged&&(o.clipping=!1,o.renderFrame(p,null),o.renderDeclutter(p),o.renderDeferred(p),v())});_.addEventListener(Q.CHANGE,()=>{if(_.getState()!==Y.LOADED)return;this.image=_;const v=_.getPixelRatio(),y=_l(_.getResolution())*e/v;this.renderedResolution=y,this.coordinateToVectorPixelTransform_=ui(this.coordinateToVectorPixelTransform_,l/2,c/2,1/y,-1/y,0,-i.center[0],-i.center[1])}),_.load()}return this.image&&(this.renderedPixelToCoordinateTransform_=t.pixelToCoordinateTransform.slice()),!((h=this.getLayer().getSource())!=null&&h.loading)&&!!this.image}preRender(){}postRender(){}renderDeclutter(){}forEachFeatureAtCoordinate(t,e,i,s,r){return this.vectorRenderer_?this.vectorRenderer_.forEachFeatureAtCoordinate(t,e,i,s,r):super.forEachFeatureAtCoordinate(t,e,i,s,r)}}class S1 extends hl{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 I1(this)}}class gm extends f.Destroyable{constructor(e){super();E(this,"_map");this._map=e.viewer}async pickPosition(e){return new Promise(i=>{try{if(!this._map)return i(void 0);const s=this._map.getCoordinateFromPixel(e),[r,o]=ae(s);i([r,o,0])}catch(s){return console.error(s),i(void 0)}})}async quickPickPosition(e){return await this.pickPosition(e)}async pick(e,i,s){return new Promise(r=>{try{if(!this._map)return r(void 0);const o=[];this._map.forEachFeatureAtPixel(e,(g,p)=>{console.log("forEachFeatureAtPixel",g,p),o.push([g,p])}),console.log("pickedObjects",o);const a=o.length>0?o[0]:void 0;if(!a)return r(void 0);const l=a[0].getId();if(!l)return r(void 0);let c=f.ESSceneObject.getSceneObjectById(l.toString());if(c&&c.parentID&&(c=f.ESSceneObject.getSceneObjectById(c.parentID)),!c)return r(void 0);console.log("sceneObject:",c);const h=new f.ESJPickedResult(a,c,void 0,void 0,s,e);return c&&Reflect.has(c,"allowPicking")&&Reflect.has(c,"pickedEvent")&&(c.allowPicking??!1)&&c.pickedEvent.emit(h),c&&Reflect.has(c,"allowPicking")&&!(c.allowPicking??!1)?r(new f.ESJPickedResult):r(h)}catch(o){return console.error(o),r(void 0)}})}_layerPickable(e){return!e||e instanceof Nn?!1:e instanceof ti||e instanceof S1}_resolveSceneObject(e,i){var a,l;let s;const r=(a=e==null?void 0:e.get)==null?void 0:a.call(e,"ESSceneObjectID");if(typeof r=="string"&&(s=r),!s){const c=(l=i==null?void 0:i.get)==null?void 0:l.call(i,"ESSceneObjectID");typeof c=="string"&&(s=c)}let o=s?f.ESSceneObject.getSceneObject(s):void 0;return o&&o.parentID&&(o=f.ESSceneObject.getSceneObject(o.parentID)),o}_buildGeoJsonPickInfo(e,i,s){var h;const r=e.getGeometry(),o=((h=r==null?void 0:r.getType)==null?void 0:h.call(r))??"Point",a=e.getProperties?e.getProperties():{},{geometry:l,...c}=a||{};return o==="Point"?{type:"Point",coordinates:[i,s,0],properties:c}:{type:o,coordinates:void 0,properties:c}}}function ln(n){return f.getExtProp(n,"_viewerExtensions")}function vl(n,t){f.setExtProp(n,"_viewerExtensions",t)}class pm extends f.Destroyable{constructor(e,i){super();E(this,"_imageriesManager");E(this,"_labelManager");E(this,"_pickingManager");E(this,"_poiContext");E(this,"_cursorPositionInfo");this._viewer=e,this._olViewer=i,this._imageriesManager=this.dv(new um(e)),this._labelManager=this.dv(new dm(e)),this._poiContext=this.disposeVar(new am(this._viewer)),this._cursorPositionInfo=this.dv(new hm(e)),this.ad(i.viewerChanged.don(()=>{this._pickingManager=this.dv(new gm(i))}))}get viewer(){return this._viewer}get olViewer(){return this._olViewer}get imageriesManager(){return this._imageriesManager}get labelManager(){return this._labelManager}get pickingManager(){return this._pickingManager}get poiContext(){return this._poiContext}get cursorPositionInfo(){return this._cursorPositionInfo}}class T1 extends f.Destroyable{constructor(t,e){super(),this._olViewer=t,this._viewer=e;const i=this._viewer,s=i.getView();{let r=this._olViewer.disabledInputStack===0;const o=()=>{var l;const a=this._olViewer.disabledInputStack===0;a!==r&&(r=a,a?this._olViewer.restoreMapInteraction():(this._olViewer.changeToMap(),(l=s.cancelAnimations)==null||l.call(s),this._olViewer.suspendMapInteraction()))};o(),this.dispose(this._olViewer.disabledInputStackChanged.don(o))}{const r=()=>{this._olViewer.cameraChanged.emit()},o=s.on("change:center",()=>r()),a=s.on("change:resolution",()=>r()),l=s.on("change:rotation",()=>r());this.d(()=>{Si([o,a,l])})}{let r=performance.now(),o=0;const a=()=>{var u;const c=performance.now();o++;const h=c-r;h>1e3&&(((u=this._olViewer._fps)==null?void 0:u.value)!==void 0&&(this._olViewer._fps.value=o*1e3/h|0),r=c,o=0)},l=i.on("postrender",a);this.d(()=>Si(l))}}get olViewer(){return this._olViewer}get viewer(){return this._viewer}}const Pr=class Pr extends f.ESViewer{constructor(e){super(e);E(this,"_viewer",this.dv(f.react(void 0)));E(this,"orbitController",null);E(this,"_fpsMonitor",null);E(this,"wasdController",null);E(this,"_disabledInputStack",this.disposeVar(f.react(0)));E(this,"_interactionBackup",null);E(this,"_notSupportEditingCount",this.disposeVar(f.react(0)));E(this,"_editingSystem",this.ad(C0()));if(e.type!==Pr.type)throw new Error("option.type must be ESOlViewer");this.d(this._viewer.changed.don(i=>{this.viewerChanged.emit(i)})),this.dv(new f.ObjResettingWithEvent(this.viewerChanged,()=>{if(this.viewer)return new T1(this,this.viewer)})),this.dv(new f.ObjResettingWithEvent(this.subContainerChanged,()=>{if(this.setStatus("Raw"),this.setStatusLog(""),!!this.subContainer)return new p1(this.subContainer,this,i=>this._viewer.value=i)}))}get viewer(){return this._viewer.value}get extensions(){return this.viewer&&ln(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 i;return(i=this.viewer)==null?void 0:i.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,i,s){if(!this.extensions)return;const{pickingManager:r}=this.extensions;return await r.pick(e,void 0,i)}async pickPosition(e){if(!this.extensions)return;const{pickingManager:i}=this.extensions;return await i.pickPosition(e)}async quickPickPosition(e){if(!this.extensions)return;const{pickingManager:i}=this.extensions;return await i.quickPickPosition(e)}flyIn(e,i,s){if(!this.viewer)return;const r=Gn(e[2]);this.viewer.getView().animate({center:dt([e[0],e[1]]),zoom:r,duration:(s??1)*1e3})}flyTo(e,i){if(!this.viewer)return;const s=Gn(e.distance);this.viewer.getView().animate({center:dt([i[0],i[1]]),zoom:s,duration:(e.flyDuration??1)*1e3})}flyToBoundingSphere(e,i,s){if(!this.viewer)return;const r={_duration:(s??1)*1e3};console.log(e);const o=dt([e[0],e[1]]),a=dt([e[2],e[3]]);this.viewer.getView().fit(ih([o[0],o[1],a[0],a[1]]),{duration:r._duration,easing:Jn,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 i=sr(e),s=this.viewer.getView().getCenter();if(!s)return;const r=ae(s),o=this.viewer.getView().getRotation();return{position:[r[0],r[1],i],rotation:[0,o/(Math.PI/180),0]}}transformFlyParam(e,i){}calcFlyToParam(e){const i=this.getCurrentCameraInfo();if(!i)return;const{position:s,rotation:r}=i,o=f.geoRhumbDistance(s,e),a=e[0]-s[0],l=e[1]-s[1],h=Math.atan2(a,l)*180/Math.PI,u=e[2]-s[2],g=Math.atan2(u,o)*180/Math.PI,p=h+90;return{distance:o,heading:p,pitch:g,flyDuration:1,hDelta:-(r[0]-p),pDelta:r[1]-g}}getLengthInPixel(){if(this.viewer)return this.viewer.getView().getResolution()}changeToWalk(e){this.viewer&&(this.changeToMap(),this.container&&(this.wasdController=this.dv(new Sp(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,i,s){this.changeToMap(),console.warn("Openlayers引擎暂不支持全球旋转,已切换为Map模式")}changeToLine(e,i,s,r,o,a){this._func()}changeToUserDefined(e){this.changeToMap(),console.warn("Openlayers引擎暂不支持自定义漫游,已切换为Map模式")}changeToRotatePoint(e,i=5e4,s=60,r=90,o=0){if(!this.viewer)return;const a=this.viewer.getView();this.changeToMap();const l={_distance:i,_orbitPeriod:s*1e3,heading:r},c=Gn(l._distance);a.setZoom(c),this.orbitController=Ip(this.viewer,{center:[e[0],e[1]],orbitPeriod:l._orbitPeriod,heading:l.heading})}changeToFollow(e,i,s,r){this._func()}getFPS(){return this.viewer&&!this._fpsMonitor&&(this._fpsMonitor=this.dv(new Mp(this.viewer))),this._fpsMonitor?this._fpsMonitor.getFPS():0}async getVersion(){const e=globalThis.g_XE3CopyRights??{};return e.openlayers=V0,e}getHeightByLonLat(e,i,s){return console.warn("getHeightByLonLat is not supported in OpenLayers"),Promise.resolve(0)}getHeightsByLonLats(e,i){return console.warn("getHeightsByLonLats is not supported in OpenLayers"),Promise.resolve([])}async capture(e,i){if(this.viewer)return await Rp(this.viewer,e,i)}lonLatAltToScreenPosition(e){var o;const i=[e[0],e[1]],s=dt(i),r=(o=this.viewer)==null?void 0:o.getPixelFromCoordinate(s);return r?Promise.resolve([r[0],r[1]]):Promise.resolve(void 0)}getBoundSphere(e){return this._func()}get notSupportEditingCount(){return this._notSupportEditingCount.value}set notSupportEditingCount(e){this._notSupportEditingCount.value=e}get notSupportEditingCountChanged(){return this._notSupportEditingCount.changed}startEditing(e,i,s){s=Object.assign({useKeyToSwitch:!0,callSource:"outer"},s);const r=e.components.main??e;r&&i!=null&&(r.editingID=`${s.callSource}_${f.createGuid()}`,this._editingSystem.restart(void 0,this,r,i,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 i=this.viewer.getView().calculateExtent(this.viewer.getSize());if(console.log(i),!i)return Promise.resolve(void 0);const s=ae([i[0],i[1]]),r=ae([i[2],i[3]]),o=[s[0],s[1],r[0],r[1]];return console.log(o),Promise.resolve(o)}};E(Pr,"type",Pr.register("ESOlViewer",Pr));let ki=Pr;(n=>{n.createDefaultProps=()=>({...f.ESViewer.createDefaultProps()})})(ki||(ki={})),f.extendClassProps(ki.prototype,ki.createDefaultProps);class M1 extends fo{constructor(t){t=t||{},super(t)}}class ou extends M1{constructor(t){super(t)}createRenderer(){return new fm(this)}getData(t){return super.getData(t)}}function au(n){return n instanceof Image||n instanceof HTMLCanvasElement||n instanceof HTMLVideoElement||n instanceof ImageBitmap?n:null}const A1=new Error("disposed"),D1=[256,256];class mm extends go{constructor(t){const e=W.IDLE;super(t.tileCoord,e,{transition:t.transition,interpolate:t.interpolate}),this.loader_=t.loader,this.data_=null,this.error_=null,this.size_=t.size||null,this.controller_=t.controller||null}getSize(){if(this.size_)return this.size_;const t=au(this.data_);return t?[t.width,t.height]:D1}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==W.IDLE&&this.state!==W.ERROR)return;this.state=W.LOADING,this.changed();const t=this;this.loader_().then(function(e){t.data_=e,t.state=W.LOADED,t.changed()}).catch(function(e){t.error_=e,t.state=W.ERROR,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(A1),this.controller_=null),super.disposeInternal()}}let lu;const or=[];function ym(n,t,e,i,s){n.beginPath(),n.moveTo(0,0),n.lineTo(t,e),n.lineTo(i,s),n.closePath(),n.save(),n.clip(),n.fillRect(0,0,Math.max(t,i)+1,Math.max(e,s)),n.restore()}function cu(n,t){return Math.abs(n[t*4]-210)>2||Math.abs(n[t*4+3]-.75*255)>2}function F1(){if(lu===void 0){const n=Nt(6,6,or);n.globalCompositeOperation="lighter",n.fillStyle="rgba(210, 0, 0, 0.75)",ym(n,4,5,4,0),ym(n,4,5,0,5);const t=n.getImageData(0,0,3,3).data;lu=cu(t,0)||cu(t,4)||cu(t,8),Ur(n),or.push(n.canvas)}return lu}function wl(n,t,e,i){const s=Mi(e,t,n);let r=Mf(t,i,e);const o=t.getMetersPerUnit();o!==void 0&&(r*=o);const a=n.getMetersPerUnit();a!==void 0&&(r/=a);const l=n.getExtent();if(!l||ts(l,s)){const c=Mf(n,r,s)/r;isFinite(c)&&c>0&&(r/=c)}return r}function L1(n,t,e,i){const s=He(e);let r=wl(n,t,s,i);return(!isFinite(r)||r<=0)&&sf(e,function(o){return r=wl(n,t,o,i),isFinite(r)&&r>0}),r}function _m(n,t,e,i,s,r,o,a,l,c,h,u,d,g){const p=Nt(Math.round(e*n),Math.round(e*t),or);if(u||(p.imageSmoothingEnabled=!1),l.length===0)return p.canvas;p.scale(e,e);function m(C){return Math.round(C*e)/e}p.globalCompositeOperation="lighter";const _=ze();l.forEach(function(C,P,b){ef(_,C.extent)});let v;const y=e/i,w=(u?1:1+Math.pow(2,-24))/y;(!d||l.length!==1||c!==0)&&(v=Nt(Math.round(ut(_)*y),Math.round(Vt(_)*y),or),u||(v.imageSmoothingEnabled=!1),l.forEach(function(C,P,b){if(C.image.width>0&&C.image.height>0){if(C.clipExtent){v.save();const k=(C.clipExtent[0]-_[0])*y,T=-(C.clipExtent[3]-_[3])*y,L=ut(C.clipExtent)*y,A=Vt(C.clipExtent)*y;v.rect(u?k:Math.round(k),u?T:Math.round(T),u?L:Math.round(k+L)-Math.round(k),u?A:Math.round(T+A)-Math.round(T)),v.clip()}const R=(C.extent[0]-_[0])*y,I=-(C.extent[3]-_[3])*y,S=ut(C.extent)*y,F=Vt(C.extent)*y;v.drawImage(C.image,c,c,C.image.width-2*c,C.image.height-2*c,u?R:Math.round(R),u?I:Math.round(I),u?S:Math.round(R+S)-Math.round(R),u?F:Math.round(I+F)-Math.round(I)),C.clipExtent&&v.restore()}}));const x=Te(o);return a.getTriangles().forEach(function(C,P,b){const R=C.source,I=C.target;let S=R[0][0],F=R[0][1],k=R[1][0],T=R[1][1],L=R[2][0],A=R[2][1];const U=m((I[0][0]-x[0])/r),N=m(-(I[0][1]-x[1])/r),$=m((I[1][0]-x[0])/r),X=m(-(I[1][1]-x[1])/r),Z=m((I[2][0]-x[0])/r),J=m(-(I[2][1]-x[1])/r),O=S,gt=F;S=0,F=0,k-=O,T-=gt,L-=O,A-=gt;const B=[[k,T,0,0,$-U],[L,A,0,0,Z-U],[0,0,k,T,X-N],[0,0,L,A,J-N]],D=N0(B);if(!D)return;if(p.save(),p.beginPath(),F1()||!u){p.moveTo($,X);const H=4,lt=U-$,It=N-X;for(let $t=0;$t<H;$t++)p.lineTo($+m(($t+1)*lt/H),X+m($t*It/(H-1))),$t!=H-1&&p.lineTo($+m(($t+1)*lt/H),X+m(($t+1)*It/(H-1)));p.lineTo(Z,J)}else p.moveTo($,X),p.lineTo(U,N),p.lineTo(Z,J);p.clip(),p.transform(D[0],D[2],D[1],D[3],U,N),p.translate(_[0]-O,_[3]-gt);let tt;if(v)tt=v.canvas,p.scale(w,-w);else{const H=l[0],lt=H.extent;tt=H.image,p.scale(ut(lt)/tt.width,-Vt(lt)/tt.height)}p.drawImage(tt,0,0),p.restore()}),v&&(Ur(v),or.push(v.canvas)),h&&(p.save(),p.globalCompositeOperation="source-over",p.strokeStyle="black",p.lineWidth=1,a.getTriangles().forEach(function(C,P,b){const R=C.target,I=(R[0][0]-x[0])/r,S=-(R[0][1]-x[1])/r,F=(R[1][0]-x[0])/r,k=-(R[1][1]-x[1])/r,T=(R[2][0]-x[0])/r,L=-(R[2][1]-x[1])/r;p.beginPath(),p.moveTo(F,k),p.lineTo(I,S),p.lineTo(T,L),p.closePath(),p.stroke()}),p.restore()),p.canvas}const O1=10,vm=.25;class wm{constructor(t,e,i,s,r,o,a){this.sourceProj_=t,this.targetProj_=e;let l={};const c=a?Nc(w=>Yt(a,Mi(w,this.targetProj_,this.sourceProj_))):Ki(this.targetProj_,this.sourceProj_);this.transformInv_=function(w){const x=w[0]+"/"+w[1];return l[x]||(l[x]=c(w)),l[x]},this.maxSourceExtent_=s,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&ut(s)>=ut(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?ut(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?ut(this.targetProj_.getExtent()):null;const h=Te(i),u=Ea(i),d=wa(i),g=va(i),p=this.transformInv_(h),m=this.transformInv_(u),_=this.transformInv_(d),v=this.transformInv_(g),y=O1+(o?Math.max(0,Math.ceil(Math.log2(Pc(i)/(o*o*256*256)))):0);if(this.addQuad_(h,u,d,g,p,m,_,v,y),this.wrapsXInSource_){let w=1/0;this.triangles_.forEach(function(x,C,P){w=Math.min(w,x.source[0][0],x.source[1][0],x.source[2][0])}),this.triangles_.forEach(x=>{if(Math.max(x.source[0][0],x.source[1][0],x.source[2][0])-w>this.sourceWorldWidth_/2){const C=[[x.source[0][0],x.source[0][1]],[x.source[1][0],x.source[1][1]],[x.source[2][0],x.source[2][1]]];C[0][0]-w>this.sourceWorldWidth_/2&&(C[0][0]-=this.sourceWorldWidth_),C[1][0]-w>this.sourceWorldWidth_/2&&(C[1][0]-=this.sourceWorldWidth_),C[2][0]-w>this.sourceWorldWidth_/2&&(C[2][0]-=this.sourceWorldWidth_);const P=Math.min(C[0][0],C[1][0],C[2][0]);Math.max(C[0][0],C[1][0],C[2][0])-P<this.sourceWorldWidth_/2&&(x.source=C)}})}l={}}addTriangle_(t,e,i,s,r,o){this.triangles_.push({source:[s,r,o],target:[t,e,i]})}addQuad_(t,e,i,s,r,o,a,l,c){const h=Rr([r,o,a,l]),u=this.sourceWorldWidth_?ut(h)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,g=this.sourceProj_.canWrapX()&&u>.5&&u<1;let p=!1;if(c>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const _=Rr([t,e,i,s]);p=ut(_)/this.targetWorldWidth_>vm||p}!g&&this.sourceProj_.isGlobal()&&u&&(p=u>vm||p)}if(!p&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3])&&!Wt(h,this.maxSourceExtent_))return;let m=0;if(!p&&(!isFinite(r[0])||!isFinite(r[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(c>0)p=!0;else if(m=(!isFinite(r[0])||!isFinite(r[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),m!=1&&m!=2&&m!=4&&m!=8)return}if(c>0){if(!p){const _=[(t[0]+i[0])/2,(t[1]+i[1])/2],v=this.transformInv_(_);let y;g?y=(Cn(r[0],d)+Cn(a[0],d))/2-Cn(v[0],d):y=(r[0]+a[0])/2-v[0];const w=(r[1]+a[1])/2-v[1];p=y*y+w*w>this.errorThresholdSquared_}if(p){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const _=[(e[0]+i[0])/2,(e[1]+i[1])/2],v=this.transformInv_(_),y=[(s[0]+t[0])/2,(s[1]+t[1])/2],w=this.transformInv_(y);this.addQuad_(t,e,_,y,r,o,v,w,c-1),this.addQuad_(y,_,i,s,w,v,a,l,c-1)}else{const _=[(t[0]+e[0])/2,(t[1]+e[1])/2],v=this.transformInv_(_),y=[(i[0]+s[0])/2,(i[1]+s[1])/2],w=this.transformInv_(y);this.addQuad_(t,_,y,s,r,v,w,l,c-1),this.addQuad_(_,e,i,y,v,o,a,w,c-1)}return}}if(g){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(m&11)==0&&this.addTriangle_(t,i,s,r,a,l),(m&14)==0&&this.addTriangle_(t,i,e,r,a,o),m&&((m&13)==0&&this.addTriangle_(e,s,t,o,l,r),(m&7)==0&&this.addTriangle_(e,s,i,o,l,a))}calculateSourceExtent(){const t=ze();return this.triangles_.forEach(function(e,i,s){const r=e.source;Ir(t,r[0]),Ir(t,r[1]),Ir(t,r[2])}),t}getTriangles(){return this.triangles_}}const xm=.5;class Em extends go{constructor(t,e,i,s,r,o,a,l,c,h,u,d){super(r,W.IDLE,d),this.renderEdges_=u!==void 0?u:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=s,this.wrappedTileCoord_=o||r,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;const g=s.getTileCoordExtent(this.wrappedTileCoord_),p=this.targetTileGrid_.getExtent();let m=this.sourceTileGrid_.getExtent();const _=p?ci(g,p):g;if(Pc(_)===0){this.state=W.EMPTY;return}const v=t.getExtent();v&&(m?m=ci(m,v):m=v);const y=s.getResolution(this.wrappedTileCoord_[0]),w=L1(t,i,_,y);if(!isFinite(w)||w<=0){this.state=W.EMPTY;return}const x=h!==void 0?h:xm;if(this.triangulation_=new wm(t,i,_,m,w*x,y),this.triangulation_.getTriangles().length===0){this.state=W.EMPTY;return}this.sourceZ_=e.getZForResolution(w);let C=this.triangulation_.calculateSourceExtent();if(m&&(t.canWrapX()?(C[1]=kt(C[1],m[1],m[3]),C[3]=kt(C[3],m[1],m[3])):C=ci(C,m)),!Pc(C))this.state=W.EMPTY;else{let P=0,b=0;t.canWrapX()&&(P=ut(v),b=Math.floor((C[0]-v[0])/P)),lf(C.slice(),t,!0).forEach(I=>{const S=e.getTileRangeForExtentAndZ(I,this.sourceZ_);for(let F=S.minX;F<=S.maxX;F++)for(let k=S.minY;k<=S.maxY;k++){const T=b*P;this.sourceTiles_.push({getTile:()=>c(this.sourceZ_,F,k,a),offset:T})}++b}),this.sourceTiles_.length===0&&(this.state=W.EMPTY)}}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{var s;const i=e.tile;if(i&&i.getState()==W.LOADED){const r=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);r[0]+=e.offset,r[2]+=e.offset;const o=(s=this.clipExtent_)==null?void 0:s.slice();o&&(o[0]+=e.offset,o[2]+=e.offset),t.push({extent:r,clipExtent:o,image:i.getImage()})}}),this.sourceTiles_.length=0,t.length===0)this.state=W.ERROR;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),s=typeof i=="number"?i:i[0],r=typeof i=="number"?i:i[1],o=this.targetTileGrid_.getResolution(e),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=_m(s,r,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=W.LOADED}this.changed()}load(){for(const t of this.sourceTiles_)t.tile=t.getTile();if(this.state==W.IDLE){this.state=W.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{const i=e.getState();if(i==W.IDLE||i==W.LOADING){t++;const s=wt(e,Q.CHANGE,r=>{const o=e.getState();(o==W.LOADED||o==W.ERROR||o==W.EMPTY)&&(Lt(s),t--,t===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(s)}}),t===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:e},i,s){e.getState()==W.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(Lt),this.sourcesListenerKeys_=null}release(){this.canvas_&&(Ur(this.canvas_.getContext("2d")),or.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}}class Cm{constructor(t){this.highWaterMark=t!==void 0?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const t=this.pop();t instanceof Tr&&t.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const i=this.entries_[t];return Et(i!==void 0,"Tried to get a value for a key that does not exist in the cache"),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_}remove(t){const e=this.entries_[t];return Et(e!==void 0,"Tried to get a value for a key that does not exist in the cache"),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e=0,i;for(i=this.newest_;i;i=i.older)t[e++]=i.key_;return t}getValues(){const t=new Array(this.count_);let e=0,i;for(i=this.newest_;i;i=i.older)t[e++]=i.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){var e;return(e=this.entries_[t])==null?void 0:e.value_}pop(){const t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){Et(!(t in this.entries_),"Tried to set a value for a key that is used already");const i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_}setSize(t){this.highWaterMark=t}}function xl(n,t,e,i){return i!==void 0?(i[0]=n,i[1]=t,i[2]=e,i):[n,t,e]}function z1(n,t,e){return n+"/"+t+"/"+e}function El(n,t,e,i,s){return`${at(n)},${t},${z1(e,i,s)}`}function bm(n){return k1(n[0],n[1],n[2])}function k1(n,t,e){return(t<<n)+e}function N1(n,t){const e=n[0],i=n[1],s=n[2];if(t.getMinZoom()>e||e>t.getMaxZoom())return!1;const r=t.getFullTileRange(e);return r?r.containsXY(i,s):!0}function hu(n,t,e){if(!(e in n))return n[e]=new Set([t]),!0;const i=n[e],s=i.has(t);return s||i.add(t),!s}function G1(n,t,e){const i=n[e];return i?i.delete(t):!1}function Pm(n,t){const e=n.layerStatesArray[n.layerIndex];e.extent&&(t=ci(t,Ai(e.extent,n.viewState.projection)));const i=e.layer.getRenderSource();if(!i.getWrapX()){const s=i.getTileGridForProjection(n.viewState.projection).getExtent();s&&(t=ci(t,s))}return t}class Rm extends Sh{constructor(t,e){super(t),e=e||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=ze(),this.tempTileRange_=new Zh(0,0,0,0),this.tempTileCoord_=xl(0,0,0);const i=e.cacheSize!==void 0?e.cacheSize:512;this.tileCache_=new Cm(i),this.sourceTileCache_=null,this.maxStaleKeys=i*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new Cm(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,s){const r=this.tileCache_,a=this.getLayer().getSource(),l=El(a,a.getKey(),t,e,i);let c;if(r.containsKey(l))c=r.get(l);else{const h=s.viewState.projection,u=a.getProjection();if(c=a.getTile(t,e,i,s.pixelRatio,h,!u||ye(u,h)?void 0:this.getSourceTileCache()),!c)return null;r.set(l,c)}return c}getTile(t,e,i,s){const r=this.getOrCreateTile(t,e,i,s);return r||null}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),s=Yt(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!ts(r,s))return null;const o=e.viewState,a=i.getRenderSource(),l=a.getTileGridForProjection(o.projection),c=a.getTilePixelRatio(e.pixelRatio);for(let h=l.getZForResolution(o.resolution);h>=l.getMinZoom();--h){const u=l.getTileCoordForCoordAndZ(s,h),d=this.getTile(h,u[1],u[2],e);if(!d||d.getState()!==W.LOADED)continue;const g=l.getOrigin(h),p=ve(l.getTileSize(h)),m=l.getResolution(h);let _;if(d instanceof fp||d instanceof Em)_=d.getImage();else if(d instanceof mm){if(_=au(d.getData()),!_)continue}else continue;const v=Math.floor(c*((s[0]-g[0])/m-u[1]*p[0])),y=Math.floor(c*((g[1]-s[1])/m-u[2]*p[1])),w=Math.round(c*a.getGutterForProjection(o.projection));return this.getImageData(_,v+w,y+w)}return null}prepareFrame(t){var s;this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;const e=this.getLayer().getSource();if(!e)return!1;const i=e.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==i&&(this.renderedSourceRevision_=i,this.renderedSourceKey_===e.getKey()&&(this.tileCache_.clear(),(s=this.sourceTileCache_)==null||s.clear())):this.renderedSourceRevision_=i,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(t,e,i,s,r){const o=t.viewState,a=this.getLayer(),l=a.getRenderSource(),c=l.getTileGridForProjection(o.projection),h=at(l);h in t.wantedTiles||(t.wantedTiles[h]={});const u=t.wantedTiles[h],d=a.getMapInternal(),g=Math.max(i-r,c.getMinZoom(),c.getZForResolution(Math.min(a.getMaxResolution(),d?d.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):c.getResolution(0)),l.zDirection)),p=o.rotation,m=p?rf(o.center,o.resolution,p,t.size):void 0;for(let _=i;_>=g;--_){const v=c.getTileRangeForExtentAndZ(e,_,this.tempTileRange_),y=c.getResolution(_);for(let w=v.minX;w<=v.maxX;++w)for(let x=v.minY;x<=v.maxY;++x){if(p&&!c.tileCoordIntersectsViewport([_,w,x],m))continue;const C=this.getTile(_,w,x,t);if(!C||!hu(s,C,_))continue;const b=C.getKey();if(u[b]=!0,C.getState()===W.IDLE&&!t.tileQueue.isKeyQueued(b)){const R=xl(_,w,x,this.tempTileCoord_);t.tileQueue.enqueue([C,h,c.getTileCoordCenter(R),y])}}}}findStaleTile_(t,e){const i=this.tileCache_,s=t[0],r=t[1],o=t[2],a=this.getStaleKeys();for(let l=0;l<a.length;++l){const c=El(this.getLayer().getSource(),a[l],s,r,o);if(i.containsKey(c)){const h=i.peek(c);if(h.getState()===W.LOADED)return h.endTransition(at(this)),hu(e,h,s),!0}}return!1}findAltTiles_(t,e,i,s){const r=t.getTileRangeForTileCoordAndZ(e,i,this.tempTileRange_);if(!r)return!1;let o=!0;const a=this.tileCache_,l=this.getLayer().getRenderSource(),c=l.getKey();for(let h=r.minX;h<=r.maxX;++h)for(let u=r.minY;u<=r.maxY;++u){const d=El(l,c,i,h,u);let g=!1;if(a.containsKey(d)){const p=a.peek(d);p.getState()===W.LOADED&&(hu(s,p,i),g=!0)}g||(o=!1)}return o}renderFrame(t,e){this.renderComplete=!0;const i=t.layerStatesArray[t.layerIndex],s=t.viewState,r=s.projection,o=s.resolution,a=s.center,l=t.pixelRatio,c=this.getLayer(),h=c.getSource(),u=h.getTileGridForProjection(r),d=u.getZForResolution(o,h.zDirection),g=u.getResolution(d),p=h.getKey();this.renderedSourceKey_?this.renderedSourceKey_!==p&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=p):this.renderedSourceKey_=p;let m=t.extent;const _=h.getTilePixelRatio(l);this.prepareContainer(t,e);const v=this.context.canvas.width,y=this.context.canvas.height,w=i.extent&&Ai(i.extent);w&&(m=ci(m,Ai(i.extent)));const x=g*v/2/_,C=g*y/2/_,P=[a[0]-x,a[1]-C,a[0]+x,a[1]+C],b={};this.renderedTiles.length=0;const R=c.getPreload();if(t.nextExtent&&this.enqueueTilesForNextExtent()){const $=u.getZForResolution(s.nextResolution,h.zDirection),X=Pm(t,t.nextExtent);this.enqueueTiles(t,X,$,b,R)}const I=Pm(t,m);if(this.enqueueTiles(t,I,d,b,0),R>0&&setTimeout(()=>{this.enqueueTiles(t,I,d-1,b,R-1)},0),!(d in b))return this.container;const S=at(this),F=t.time;for(const $ of b[d]){const X=$.getState();if(X===W.EMPTY)continue;const Z=$.tileCoord;if(X===W.LOADED&&$.getAlpha(S,F)===1){$.endTransition(S);continue}if(X!==W.ERROR&&(this.renderComplete=!1),this.findStaleTile_(Z,b)){G1(b,$,d),t.animate=!0;continue}if(this.findAltTiles_(u,Z,d+1,b))continue;const gt=u.getMinZoom();for(let B=d-1;B>=gt&&!this.findAltTiles_(u,Z,B,b);--B);}const k=g/o*l/_,T=this.getRenderContext(t);ui(this.tempTransform,v/2,y/2,k,k,0,-v/2,-y/2),i.extent&&this.clipUnrotated(T,t,w),h.getInterpolate()||(T.imageSmoothingEnabled=!1),this.preRender(T,t);const L=Object.keys(b).map(Number);L.sort(Pi);let A;const U=[],N=[];for(let $=L.length-1;$>=0;--$){const X=L[$],Z=h.getTilePixelSize(X,l,r),O=u.getResolution(X)/g,gt=Z[0]*O*k,B=Z[1]*O*k,D=u.getTileCoordForCoordAndZ(Te(P),X),tt=u.getTileCoordExtent(D),H=Yt(this.tempTransform,[_*(tt[0]-P[0])/g,_*(P[3]-tt[3])/g]),lt=_*h.getGutterForProjection(r);for(const It of b[X]){if(It.getState()!==W.LOADED)continue;const $t=It.tileCoord,Kt=D[1]-$t[1],Jt=Math.round(H[0]-(Kt-1)*gt),V=D[2]-$t[2],Ye=Math.round(H[1]-(V-1)*B),le=Math.round(H[0]-Kt*gt),st=Math.round(H[1]-V*B),Pe=Jt-le,ge=Ye-st,Xt=L.length===1;let se=!1;A=[le,st,le+Pe,st,le+Pe,st+ge,le,st+ge];for(let Mt=0,ni=U.length;Mt<ni;++Mt)if(!Xt&&X<N[Mt]){const Dt=U[Mt];Wt([le,st,le+Pe,st+ge],[Dt[0],Dt[3],Dt[4],Dt[7]])&&(se||(T.save(),se=!0),T.beginPath(),T.moveTo(A[0],A[1]),T.lineTo(A[2],A[3]),T.lineTo(A[4],A[5]),T.lineTo(A[6],A[7]),T.moveTo(Dt[6],Dt[7]),T.lineTo(Dt[4],Dt[5]),T.lineTo(Dt[2],Dt[3]),T.lineTo(Dt[0],Dt[1]),T.clip())}U.push(A),N.push(X),this.drawTile(It,t,le,st,Pe,ge,lt,Xt),se&&T.restore(),this.renderedTiles.unshift(It),this.updateUsedTiles(t.usedTiles,h,It)}}if(this.renderedResolution=g,this.extentChanged=!this.renderedExtent_||!ji(this.renderedExtent_,P),this.renderedExtent_=P,this.renderedPixelRatio=l,this.postRender(this.context,t),i.extent&&T.restore(),T.imageSmoothingEnabled=!0,this.renderComplete){const $=(X,Z)=>{var B;const J=at(h),O=Z.wantedTiles[J],gt=O?Object.keys(O).length:0;this.updateCacheSize(gt),this.tileCache_.expireCache(),(B=this.sourceTileCache_)==null||B.expireCache()};t.postRenderFunctions.push($)}return this.container}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,t*2)}drawTile(t,e,i,s,r,o,a,l){let c;if(t instanceof mm){if(c=au(t.getData()),!c)throw new Error("Rendering array data is not yet supported")}else c=this.getTileImage(t);if(!c)return;const h=this.getRenderContext(e),u=at(this),d=e.layerStatesArray[e.layerIndex],g=d.opacity*(l?t.getAlpha(u,e.time):1),p=g!==h.globalAlpha;p&&(h.save(),h.globalAlpha=g),h.drawImage(c,a,a,c.width-2*a,c.height-2*a,i,s,r,o),p&&h.restore(),g!==d.opacity?e.animate=!0:l&&t.endTransition(u)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}updateUsedTiles(t,e,i){const s=at(e);s in t||(t[s]={}),t[s][i.getKey()]=!0}}const Un={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class V1 extends fo{constructor(t){t=t||{};const e=Object.assign({},t),i=t.cacheSize;delete t.cacheSize,delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=i,this.setPreload(t.preload!==void 0?t.preload:0),this.setUseInterimTilesOnError(t.useInterimTilesOnError!==void 0?t.useInterimTilesOnError:!0)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(Un.PRELOAD)}setPreload(t){this.set(Un.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(Un.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(Un.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}}class Cl extends V1{constructor(t){super(t)}createRenderer(){return new Rm(this,{cacheSize:this.getCacheSize()})}}class W1 extends Xa{constructor(t,e,i,s,r,o,a){let l=t.getExtent();l&&t.canWrapX()&&(l=l.slice(),l[0]=-1/0,l[2]=1/0);let c=e.getExtent();c&&e.canWrapX()&&(c=c.slice(),c[0]=-1/0,c[2]=1/0);const h=c?ci(i,c):i,u=He(h),d=wl(t,e,u,s),g=xm,p=new wm(t,e,h,l,d*g,s),m=p.calculateSourceExtent(),_=qi(m)?null:o(m,d,r),v=_?Y.IDLE:Y.EMPTY,y=_?_.getPixelRatio():1;super(i,s,y,v),this.targetProj_=e,this.maxSourceExtent_=l,this.triangulation_=p,this.targetResolution_=s,this.targetExtent_=i,this.sourceImage_=_,this.sourcePixelRatio_=y,this.interpolate_=a,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==Y.LOADING&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const t=this.sourceImage_.getState();if(t==Y.LOADED){const e=ut(this.targetExtent_)/this.targetResolution_,i=Vt(this.targetExtent_)/this.targetResolution_;this.canvas_=_m(e,i,this.sourcePixelRatio_,_l(this.sourceImage_.getResolution()),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.interpolate_,!0)}this.state=t,this.changed()}load(){if(this.state==Y.IDLE){this.state=Y.LOADING,this.changed();const t=this.sourceImage_.getState();t==Y.LOADED||t==Y.ERROR?this.reproject_():(this.sourceListenerKey_=wt(this.sourceImage_,Q.CHANGE,e=>{const i=this.sourceImage_.getState();(i==Y.LOADED||i==Y.ERROR)&&(this.unlistenSource_(),this.reproject_())}),this.sourceImage_.load())}}unlistenSource_(){Lt(this.sourceListenerKey_),this.sourceListenerKey_=null}}const ar=4,uu={IMAGELOADSTART:"imageloadstart",IMAGELOADEND:"imageloadend",IMAGELOADERROR:"imageloaderror"};class U1 extends hi{constructor(t,e){super(t),this.image=e}}class du extends io{constructor(t){super({attributions:t.attributions,projection:t.projection,state:t.state,interpolate:t.interpolate!==void 0?t.interpolate:!0}),this.on,this.once,this.un,this.loader=t.loader||null,this.resolutions_=t.resolutions!==void 0?t.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0,this.image=null,this.wantedExtent_,this.wantedResolution_,this.static_=t.loader?t.loader.length===0:!1,this.wantedProjection_=null}getResolutions(){return this.resolutions_}setResolutions(t){this.resolutions_=t}findNearestResolution(t){const e=this.getResolutions();if(e){const i=_a(e,t,0);t=e[i]}return t}getImage(t,e,i,s){const r=this.getProjection();if(!r||!s||ye(r,s))return r&&(s=r),this.getImageInternal(t,e,i,s);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&ye(this.reprojectedImage_.getProjection(),s)&&this.reprojectedImage_.getResolution()==e&&ji(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new W1(r,s,t,e,i,(o,a,l)=>this.getImageInternal(o,a,l,r),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(t,e,i,s){if(this.loader){const r=X1(t,e,i,1),o=this.findNearestResolution(e);if(this.image&&(this.static_||this.wantedProjection_===s&&(this.wantedExtent_&&Bi(this.wantedExtent_,r)||Bi(this.image.getExtent(),r))&&(this.wantedResolution_&&_l(this.wantedResolution_)===o||_l(this.image.getResolution())===o)))return this.image;this.wantedProjection_=s,this.wantedExtent_=r,this.wantedResolution_=o,this.image=new Xa(r,o,i,this.loader),this.image.addEventListener(Q.CHANGE,this.handleImageChange.bind(this))}return this.image}handleImageChange(t){const e=t.target;let i;switch(e.getState()){case Y.LOADING:this.loading=!0,i=uu.IMAGELOADSTART;break;case Y.LOADED:this.loading=!1,i=uu.IMAGELOADEND;break;case Y.ERROR:this.loading=!1,i=uu.IMAGELOADERROR;break;default:return}this.hasListener(i)&&this.dispatchEvent(new U1(i,e))}}function $1(n,t){n.getImage().src=t}function X1(n,t,e,i){const s=t/e,r=He(n),o=bn(ut(n)/s,ar),a=bn(Vt(n)/s,ar),l=bn((i-1)*o/2,ar),c=o+2*l,h=bn((i-1)*a/2,ar),u=a+2*h;return xa(r,s,0,[c,u])}function Y1(n){const t=n.load||og,e=n.imageExtent,i=n.crossOrigin??null;return()=>{const s=new Image;return s.crossOrigin=i,n.referrerPolicy!==void 0&&(s.referrerPolicy=n.referrerPolicy),t(s,n.url).then(r=>{const o=ut(e)/r.width,a=Vt(e)/r.height;return{image:r,extent:e,resolution:o!==a?[o,a]:a,pixelRatio:1}})}}class Im extends du{constructor(t){const e=t.crossOrigin!==void 0?t.crossOrigin:null,i=t.imageLoadFunction!==void 0?t.imageLoadFunction:$1;super({attributions:t.attributions,interpolate:t.interpolate,projection:mt(t.projection)}),this.url_=t.url,this.imageExtent_=t.imageExtent,this.image=null,this.image=new Xa(this.imageExtent_,void 0,1,Y1({url:t.url,imageExtent:t.imageExtent,crossOrigin:e,referrerPolicy:t.referrerPolicy,load:(s,r)=>(this.image.setImage(s),i(this.image,r),og(s))})),this.image.addEventListener(Q.CHANGE,this.handleImageChange.bind(this))}getImageExtent(){return this.imageExtent_}getImageInternal(t,e,i,s){return Wt(t,this.image.getExtent())?this.image:null}getUrl(){return this.url_}}const lr=[0,0,0],$n=5;class Xn{constructor(t){this.minZoom=t.minZoom!==void 0?t.minZoom:0,this.resolutions_=t.resolutions,Et(M0(this.resolutions_,(s,r)=>r-s),"`resolutions` must be sorted in descending order");let e;if(!t.origins){for(let s=0,r=this.resolutions_.length-1;s<r;++s)if(!e)e=this.resolutions_[s]/this.resolutions_[s+1];else if(this.resolutions_[s]/this.resolutions_[s+1]!==e){e=void 0;break}}this.zoomFactor_=e,this.maxZoom=this.resolutions_.length-1,this.origin_=t.origin!==void 0?t.origin:null,this.origins_=null,t.origins!==void 0&&(this.origins_=t.origins,Et(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const i=t.extent;i!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=Te(i)),Et(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,t.tileSizes!==void 0&&(this.tileSizes_=t.tileSizes,Et(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=t.tileSize!==void 0?t.tileSize:this.tileSizes_?null:kh,Et(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=i!==void 0?i:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],t.sizes!==void 0?this.fullTileRanges_=t.sizes.map((s,r)=>{const o=new Zh(Math.min(0,s[0]),Math.max(s[0]-1,-1),Math.min(0,s[1]),Math.max(s[1]-1,-1));if(i){const a=this.getTileRangeForExtentAndZ(i,r);o.minX=Math.max(a.minX,o.minX),o.maxX=Math.min(a.maxX,o.maxX),o.minY=Math.max(a.minY,o.minY),o.maxY=Math.min(a.maxY,o.maxY)}return o}):i&&this.calculateTileRanges_(i)}forEachTileCoord(t,e,i){const s=this.getTileRangeForExtentAndZ(t,e);for(let r=s.minX,o=s.maxX;r<=o;++r)for(let a=s.minY,l=s.maxY;a<=l;++a)i([e,r,a])}forEachTileCoordParentTileRange(t,e,i,s){let r,o,a,l=null,c=t[0]-1;for(this.zoomFactor_===2?(o=t[1],a=t[2]):l=this.getTileCoordExtent(t,s);c>=this.minZoom;){if(o!==void 0&&a!==void 0?(o=Math.floor(o/2),a=Math.floor(a/2),r=nr(o,o,a,a,i)):r=this.getTileRangeForExtentAndZ(l,c,i),e(c,r))return!0;--c}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getOrigins(){return this.origins_}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]<this.maxZoom){if(this.zoomFactor_===2){const r=t[1]*2,o=t[2]*2;return nr(r,r+1,o,o+1,e)}const s=this.getTileCoordExtent(t,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(s,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,i){if(e>this.maxZoom||e<this.minZoom)return null;const s=t[0],r=t[1],o=t[2];if(e===s)return nr(r,o,r,o,i);if(this.zoomFactor_){const l=Math.pow(this.zoomFactor_,e-s),c=Math.floor(r*l),h=Math.floor(o*l);if(e<s)return nr(c,c,h,h,i);const u=Math.floor(l*(r+1))-1,d=Math.floor(l*(o+1))-1;return nr(c,u,h,d,i)}const a=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,e,i)}getTileRangeForExtentAndZ(t,e,i){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,lr);const s=lr[1],r=lr[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,lr);const o=lr[1],a=lr[2];return nr(s,o,r,a,i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),s=ve(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*s[0]*i,e[1]-(t[2]+.5)*s[1]*i]}getTileCoordExtent(t,e){const i=this.getOrigin(t[0]),s=this.getResolution(t[0]),r=ve(this.getTileSize(t[0]),this.tmpSize_),o=i[0]+t[1]*r[0]*s,a=i[1]-(t[2]+1)*r[1]*s,l=o+r[0]*s,c=a+r[1]*s;return Zi(o,a,l,c,e)}getTileCoordForCoordAndResolution(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,i)}getTileCoordForXYAndResolution_(t,e,i,s,r){const o=this.getZForResolution(i),a=i/this.getResolution(o),l=this.getOrigin(o),c=ve(this.getTileSize(o),this.tmpSize_);let h=a*(t-l[0])/i/c[0],u=a*(l[1]-e)/i/c[1];return s?(h=bn(h,$n)-1,u=bn(u,$n)-1):(h=Ca(h,$n),u=Ca(u,$n)),xl(o,h,u,r)}getTileCoordForXYAndZ_(t,e,i,s,r){const o=this.getOrigin(i),a=this.getResolution(i),l=ve(this.getTileSize(i),this.tmpSize_);let c=(t-o[0])/a/l[0],h=(o[1]-e)/a/l[1];return s?(c=bn(c,$n)-1,h=bn(h,$n)-1):(c=Ca(c,$n),h=Ca(h,$n)),xl(i,c,h,r)}getTileCoordForCoordAndZ(t,e,i){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,i)}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 i=_a(this.resolutions_,t,e||0);return kt(i,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return Bf(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,i=new Array(e);for(let s=this.minZoom;s<e;++s)i[s]=this.getTileRangeForExtentAndZ(t,s);this.fullTileRanges_=i}}class H1 extends Xn{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_}}function fu(n){let t=n.getDefaultTileGrid();return t||(t=j1(n),n.setDefaultTileGrid(t)),t}function B1(n,t,e){const i=t[0],s=n.getTileCoordCenter(t),r=xo(e);if(!ts(r,s)){const o=ut(r),a=Math.ceil((r[0]-s[0])/o);return s[0]+=o*a,n.getTileCoordForCoordAndZ(s,i)}return t}function Z1(n,t,e,i){i=i!==void 0?i:"top-left";const s=Sm(n,t,e);return new Xn({extent:n,origin:F0(n,i),resolutions:s,tileSize:e})}function cr(n){const t=n||{},e=t.extent||mt("EPSG:3857").getExtent(),i={extent:e,minZoom:t.minZoom,tileSize:t.tileSize,resolutions:Sm(e,t.maxZoom,t.tileSize,t.maxResolution)};return new Xn(i)}function Sm(n,t,e,i){t=t!==void 0?t:cp,e=ve(e!==void 0?e:kh);const s=Vt(n),r=ut(n);i=i>0?i:Math.max(r/e[0],s/e[1]);const o=t+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=i/Math.pow(2,l);return a}function j1(n,t,e,i){const s=xo(n);return Z1(s,t,e,i)}function xo(n){n=mt(n);let t=n.getExtent();if(!t){const e=180*Ia.degrees/n.getMetersPerUnit();t=Zi(-e,-e,e,e)}return t}class Tm extends io{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:t.projection,state:t.state,wrapX:t.wrapX,interpolate:t.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=t.tilePixelRatio!==void 0?t.tilePixelRatio:1,this.tileGrid=t.tileGrid!==void 0?t.tileGrid:null;const e=[256,256];this.tileGrid&&ve(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tmpSize=[0,0],this.key_=t.key||at(this),this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,s,r,o){return et()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:fu(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const s=this.getTileGridForProjection(i),r=this.getTilePixelRatio(e),o=ve(s.getTileSize(t),this.tmpSize);return r==1?o:Nv(o,r,this.tmpSize)}getTileCoordForTileUrlFunction(t,e){const i=e!==void 0?e:this.getProjection(),s=e!==void 0?this.getTileGridForProjection(i):this.tileGrid||this.getTileGridForProjection(i);return this.getWrapX()&&i.isGlobal()&&(t=B1(s,t,i)),N1(t,s)?t:null}clear(){}refresh(){this.clear(),super.refresh()}}class q1 extends hi{constructor(t,e){super(t),this.tile=e}}function Mm(n){return function(t){const e=t.buffers,i=t.meta,s=t.imageOps,r=t.width,o=t.height,a=e.length,l=e[0].byteLength;if(s){const d=new Array(a);for(let p=0;p<a;++p)d[p]=new ImageData(new Uint8ClampedArray(e[p]),r,o);return n(d,i).data.buffer}const c=new Uint8ClampedArray(l),h=new Array(a),u=new Array(a);for(let d=0;d<a;++d)h[d]=new Uint8ClampedArray(e[d]),u[d]=[0,0,0,0];for(let d=0;d<l;d+=4){for(let p=0;p<a;++p){const m=h[p];u[p][0]=m[d],u[p][1]=m[d+1],u[p][2]=m[d+2],u[p][3]=m[d+3]}const g=n(u,i);c[d]=g[0],c[d+1]=g[1],c[d+2]=g[2],c[d+3]=g[3]}return c.buffer}}function K1(n,t){const i=Object.keys(n.lib||{}).map(function(r){return"const "+r+" = "+n.lib[r].toString()+";"}).concat(["const __minion__ = ("+Mm.toString()+")(",n.operation.toString(),");",'self.addEventListener("message", function(event) {'," const buffer = __minion__(event.data);"," self.postMessage({buffer: buffer, meta: event.data.meta}, [buffer]);","});"]),s=new Worker(typeof Blob>"u"?"data:text/javascript;base64,"+Buffer.from(i.join(`
|
|
113
|
+
`),"binary").toString("base64"):URL.createObjectURL(new Blob(i,{type:"text/javascript"})));return s.addEventListener("message",t),s}function J1(n,t){const e=Mm(n.operation);let i=!1;return{postMessage:function(s){setTimeout(function(){i||t({data:{buffer:e(s),meta:s.meta}})},0)},terminate:function(){i=!0}}}class Q1 extends Tr{constructor(t){super(),this.imageOps_=!!t.imageOps;let e;t.threads===0?e=0:this.imageOps_?e=1:e=t.threads||1;const i=new Array(e);if(e)for(let s=0;s<e;++s)i[s]=K1(t,this.onWorkerMessage_.bind(this,s));else i[0]=J1(t,this.onWorkerMessage_.bind(this,0));this.workers_=i,this.queue_=[],this.maxQueueLength_=t.queue||1/0,this.running_=0,this.dataLookup_={},this.job_=null}process(t,e,i){this.enqueue_({inputs:t,meta:e,callback:i}),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,i=t.inputs[0].height,s=t.inputs.map(function(l){return l.data.buffer}),r=this.workers_.length;if(this.running_=r,r===1){this.workers_[0].postMessage({buffers:s,meta:t.meta,imageOps:this.imageOps_,width:e,height:i},s);return}const o=t.inputs[0].data.length,a=4*Math.ceil(o/4/r);for(let l=0;l<r;++l){const c=l*a,h=[];for(let u=0,d=s.length;u<d;++u)h.push(s[u].slice(c,c+a));this.workers_[l].postMessage({buffers:h,meta:t.meta,imageOps:this.imageOps_,width:e,height:i},h)}}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 i,s;if(e===1)i=new Uint8ClampedArray(this.dataLookup_[0].buffer),s=this.dataLookup_[0].meta;else{const r=t.inputs[0].data.length;i=new Uint8ClampedArray(r),s=new Array(e);const o=4*Math.ceil(r/4/e);for(let a=0;a<e;++a){const l=this.dataLookup_[a].buffer,c=a*o;i.set(new Uint8ClampedArray(l),c),s[a]=this.dataLookup_[a].meta}}this.job_=null,this.dataLookup_={},t.callback(null,new ImageData(i,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 Am={BEFOREOPERATIONS:"beforeoperations",AFTEROPERATIONS:"afteroperations"};class Dm extends hi{constructor(t,e,i){super(t),this.extent=e.extent,this.resolution=e.viewState.resolution/e.pixelRatio,this.data=i}}class gu extends du{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_=iE(t.sources);const e=this.changed.bind(this);for(let i=0,s=this.layers_.length;i<s;++i)this.layers_[i].addEventListener(Q.CHANGE,e);this.useResolutions_=t.resolutions!==null,this.tileQueue_=new gp(function(){return 1},this.processSources_.bind(this)),this.requestedFrameState_,this.renderedImageCanvas_=null,this.renderedRevision_,this.frameState_={animate:!1,coordinateToPixelTransform:xe(),declutter:null,extent:null,index:0,layerIndex:0,layerStatesArray:eE(this.layers_),pixelRatio:1,pixelToCoordinateTransform:xe(),postRenderFunctions:[],size:[0,0],tileQueue:this.tileQueue_,time:Date.now(),usedTiles:{},viewState:{rotation:0},viewHints:[],wantedTiles:{},mapId:at(this),renderTargets:{}},this.setAttributions(function(i){var r;const s=[];for(let o=0,a=t.sources.length;o<a;++o){const l=t.sources[o],c=l instanceof io?l:l.getSource();if(!c)continue;const h=(r=c.getAttributions())==null?void 0:r(i);typeof h=="string"?s.push(h):h!==void 0&&s.push(...h)}return s}),t.operation!==void 0&&this.setOperation(t.operation,t.lib)}setOperation(t,e){this.processor_&&this.processor_.dispose(),this.processor_=new Q1({operation:t,imageOps:this.operationType_==="image",queue:1,lib:e,threads:this.threads_}),this.changed()}updateFrameState_(t,e,i){const s=Object.assign({},this.frameState_);s.viewState=Object.assign({},s.viewState);const r=He(t);s.size[0]=Math.ceil(ut(t)/e),s.size[1]=Math.ceil(Vt(t)/e),s.extent=[r[0]-s.size[0]*e/2,r[1]-s.size[1]*e/2,r[0]+s.size[0]*e/2,r[1]+s.size[1]*e/2],s.time=Date.now();const o=s.viewState;return o.center=r,o.projection=i,o.resolution=e,s}allSourcesReady_(){let t=!0,e;for(let i=0,s=this.layers_.length;i<s;++i)if(e=this.layers_[i].getSource(),!e||e.getState()!=="ready"){t=!1;break}return t}getImage(t,e,i,s){if(!this.allSourcesReady_())return null;this.tileQueue_.loadMoreTiles(16,16),e=this.findNearestResolution(e);const r=this.updateFrameState_(t,e,s);if(this.requestedFrameState_=r,this.renderedImageCanvas_){const o=this.renderedImageCanvas_.getResolution(),a=this.renderedImageCanvas_.getExtent();(e!==o||!ji(r.extent,a))&&(this.renderedImageCanvas_=null)}return(!this.renderedImageCanvas_||this.getRevision()!==this.renderedRevision_)&&this.processSources_(),r.animate&&requestAnimationFrame(this.changed.bind(this)),this.renderedImageCanvas_}processSources_(){const t=this.requestedFrameState_,e=this.layers_.length,i=new Array(e);for(let r=0;r<e;++r){t.layerIndex=r,t.renderTargets={};const o=tE(this.layers_[r],t);if(o)i[r]=o;else return}const s={};this.dispatchEvent(new Dm(Am.BEFOREOPERATIONS,t,s)),this.processor_.process(i,s,this.onWorkerComplete_.bind(this,t))}onWorkerComplete_(t,e,i,s){if(e||!i)return;const r=t.extent,o=t.viewState.resolution;if(o!==this.requestedFrameState_.viewState.resolution||!ji(r,this.requestedFrameState_.extent))return;let a;if(this.renderedImageCanvas_)a=this.renderedImageCanvas_.getImage().getContext("2d");else{const l=Math.round(ut(r)/o),c=Math.round(Vt(r)/o);a=Nt(l,c),this.renderedImageCanvas_=new dp(r,o,1,a.canvas)}a.putImageData(i,0,0),t.animate?requestAnimationFrame(this.changed.bind(this)):this.changed(),this.renderedRevision_=this.getRevision(),this.dispatchEvent(new Dm(Am.AFTEROPERATIONS,t,s))}getResolutions(t){if(!this.useResolutions_)return null;let e=super.getResolutions();if(!e)for(let i=0,s=this.layers_.length;i<s&&(e=this.layers_[i].getSource().getResolutions(t),!e);++i);return e}disposeInternal(){this.processor_&&this.processor_.dispose(),super.disposeInternal()}}gu.prototype.dispose;let vs=null;function tE(n,t){const e=n.getRenderer();if(!e)throw new Error("Unsupported layer type: "+n);if(!e.prepareFrame(t))return null;const i=t.size[0],s=t.size[1];if(i===0||s===0)return null;const r=e.renderFrame(t,null);let o;if(r instanceof HTMLCanvasElement)o=r;else{if(r&&(o=r.firstElementChild),!(o instanceof HTMLCanvasElement))throw new Error("Unsupported rendered element: "+o);if(o.width===i&&o.height===s)return o.getContext("2d").getImageData(0,0,i,s)}if(!vs)vs=Nt(i,s,void 0,{willReadFrequently:!0});else{const a=vs.canvas;a.width!==i||a.height!==s?vs=Nt(i,s,void 0,{willReadFrequently:!0}):vs.clearRect(0,0,i,s)}return vs.drawImage(o,0,0,i,s),vs.getImageData(0,0,i,s)}function eE(n){return n.map(function(t){return t.getLayerState()})}function iE(n){const t=n.length,e=new Array(t);for(let i=0;i<t;++i)e[i]=nE(n[i]);return e}function nE(n){let t;return n instanceof io?n instanceof Tm?t=new Cl({source:n}):n instanceof du&&(t=new ou({source:n})):t=n,t}function bl(n,t){const e=[];Object.keys(t).forEach(function(s){t[s]!==null&&t[s]!==void 0&&e.push(s+"="+encodeURIComponent(t[s]))});const i=e.join("&");return n=n.replace(/[?&]$/,""),n+=n.includes("?")?"&":"?",n+i}const sE=/\{z\}/g,rE=/\{x\}/g,oE=/\{y\}/g,aE=/\{-y\}/g;function lE(n,t,e,i,s){return n.replace(sE,t.toString()).replace(rE,e.toString()).replace(oE,i.toString()).replace(aE,function(){if(s===void 0)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(s-i).toString()})}function Fm(n){const t=[];let e=/\{([a-z])-([a-z])\}/.exec(n);if(e){const i=e[1].charCodeAt(0),s=e[2].charCodeAt(0);let r;for(r=i;r<=s;++r)t.push(n.replace(e[0],String.fromCharCode(r)));return t}if(e=/\{(\d+)-(\d+)\}/.exec(n),e){const i=parseInt(e[2],10);for(let s=parseInt(e[1],10);s<=i;s++)t.push(n.replace(e[0],s.toString()));return t}return t.push(n),t}function cE(n,t){return(function(e,i,s){if(!e)return;let r;const o=e[0];if(t){const a=t.getFullTileRange(o);a&&(r=a.getHeight()-1)}return lE(n,o,e[1],e[2],r)})}function Lm(n,t){const e=n.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=cE(n[s],t);return pu(i)}function pu(n){return n.length===1?n[0]:(function(t,e,i){if(!t)return;const s=bm(t),r=Cn(s,n.length);return n[r](t,e,i)})}const mu={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};class Pl extends Tm{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===Pl.prototype.tileUrlFunction,this.tileLoadFunction=t.tileLoadFunction,t.tileUrlFunction&&(this.tileUrlFunction=t.tileUrlFunction),this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(t){const e=t.target,i=at(e),s=e.getState();let r;s==W.LOADING?(this.tileLoadingKeys_[i]=!0,r=mu.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=s==W.ERROR?mu.TILELOADERROR:s==W.LOADED?mu.TILELOADEND:void 0),r!=null&&this.dispatchEvent(new q1(r,e))}setTileLoadFunction(t){this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,typeof e<"u"?this.setKey(e):this.changed()}setUrl(t){const e=Fm(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join(`
|
|
114
|
+
`);this.generateTileUrlFunction_?this.setTileUrlFunction(Lm(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}}class Rl extends Pl{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:hE,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.referrerPolicy=t.referrerPolicy,this.tileClass=t.tileClass!==void 0?t.tileClass:fp,this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(t){return this.getProjection()&&t&&!ye(this.getProjection(),t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||ye(e,t)))return this.tileGrid;const i=at(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=fu(t)),this.tileGridForProjection[i]}createTile_(t,e,i,s,r,o){const a=[t,e,i],l=this.getTileCoordForTileUrlFunction(a,r),c=l?this.tileUrlFunction(l,s,r):void 0,h=new this.tileClass(a,c!==void 0?W.IDLE:W.EMPTY,c!==void 0?c:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return h.key=o,h.addEventListener(Q.CHANGE,this.handleTileChange.bind(this)),h}getTile(t,e,i,s,r,o){const a=this.getProjection();if(!a||!r||ye(a,r))return this.getTileInternal(t,e,i,s,a||r);const l=[t,e,i],c=this.getKey(),h=this.getTileGridForProjection(a),u=this.getTileGridForProjection(r),d=this.getTileCoordForTileUrlFunction(l,r),g=new Em(a,h,r,u,l,d,this.getTilePixelRatio(s),this.getGutter(),(p,m,_,v)=>this.getTileInternal(p,m,_,v,a,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return g.key=c,g}getTileInternal(t,e,i,s,r,o){const a=this.getKey(),l=El(this,a,t,e,i);if(o&&o.containsKey(l))return o.get(l);const c=this.createTile_(t,e,i,s,r,a);return o==null||o.set(l,c),c}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){const i=mt(t);if(i){const s=at(i);s in this.tileGridForProjection||(this.tileGridForProjection[s]=e)}}}function hE(n,t){if(Ae){const e=n.getCrossOrigin();let i="same-origin",s="same-origin";e==="anonymous"||e===""?(i="cors",s="omit"):e==="use-credentials"&&(i="cors",s="include");const r={mode:i,credentials:s,referrerPolicy:n.getReferrerPolicy()};fetch(t,r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.blob()}).then(o=>createImageBitmap(o)).then(o=>{var c;const a=n.getImage();a.width=o.width,a.height=o.height,a.getContext("2d").drawImage(o,0,0),(c=o.close)==null||c.call(o),a.dispatchEvent(new Event("load"))}).catch(()=>{n.getImage().dispatchEvent(new Event("error"))});return}n.getImage().src=t}const yu="1.3.0";function uE(n,t,e,i,s){s.WIDTH=e[0],s.HEIGHT=e[1];const r=i.getAxisOrientation(),o=mf(s.VERSION,"1.3")>=0;s[o?"CRS":"SRS"]=i.getCode();const a=o&&r.startsWith("ne")?[t[1],t[0],t[3],t[2]]:t;return s.BBOX=a.join(","),bl(n,s)}function dE(n,t,e,i,s,r,o){r=Object.assign({REQUEST:"GetMap"},r);const a=t/e,l=[hf(ut(n)/a,ar),hf(Vt(n)/a,ar)];if(e!=1)switch(o){case"geoserver":const h=90*e+.5|0;"FORMAT_OPTIONS"in r?r.FORMAT_OPTIONS+=";dpi:"+h:r.FORMAT_OPTIONS="dpi:"+h;break;case"mapserver":r.MAP_RESOLUTION=90*e;break;case"carmentaserver":case"qgis":r.DPI=90*e;break;default:throw new Error("Unknown `serverType` configured")}return uE(s,n,l,i,r)}function Om(n,t){return Object.assign({REQUEST:t,SERVICE:"WMS",VERSION:yu,FORMAT:"image/png",STYLES:"",TRANSPARENT:"TRUE"},n)}class fE extends Rl{constructor(t){t=t||{};const e=Object.assign({},t.params);super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction,url:t.url,urls:t.urls,wrapX:t.wrapX!==void 0?t.wrapX:!0,transition:t.transition,zDirection:t.zDirection}),this.gutter_=t.gutter!==void 0?t.gutter:0,this.params_=e,this.v13_=!0,this.serverType_=t.serverType,this.hidpi_=t.hidpi!==void 0?t.hidpi:!0,this.tmpExtent_=ze(),this.updateV13_(),this.setKey(this.getKeyForParams_())}getFeatureInfoUrl(t,e,i,s){const r=mt(i),o=this.getProjection()||r;let a=this.getTileGrid();a||(a=this.getTileGridForProjection(o));const l=Mi(t,r,o),c=wl(o,r,t,e),h=a.getZForResolution(c,this.zDirection),u=a.getResolution(h),d=a.getTileCoordForCoordAndZ(l,h);if(a.getResolutions().length<=d[0])return;let g=a.getTileCoordExtent(d,this.tmpExtent_);const p=this.gutter_;p!==0&&(g=Ii(g,u*p,g));const m={QUERY_LAYERS:this.params_.LAYERS};Object.assign(m,Om(this.params_,"GetFeatureInfo"),s);const _=Math.floor((l[0]-g[0])/u),v=Math.floor((g[3]-l[1])/u);return m[this.v13_?"I":"X"]=_,m[this.v13_?"J":"Y"]=v,this.getRequestUrl_(d,g,1,o||r,m)}getLegendUrl(t,e){if(this.urls[0]===void 0)return;const i={SERVICE:"WMS",VERSION:yu,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;i.LAYER=s}if(t!==void 0){const s=this.getProjection()?this.getProjection().getMetersPerUnit():1,r=28e-5;i.SCALE=t*s/r}return Object.assign(i,e),bl(this.urls[0],i)}getGutter(){return this.gutter_}getParams(){return this.params_}getRequestUrl_(t,e,i,s,r){const o=this.urls;if(!o)return;let a;if(o.length==1)a=o[0];else{const l=Cn(bm(t),o.length);a=o[l]}return dE(e,(this.tileGrid||this.getTileGridForProjection(s)).getResolution(t[0]),i,s,a,r,this.serverType_)}getTilePixelRatio(t){return!this.hidpi_||this.serverType_===void 0?1:t}getKeyForParams_(){let t=0;const e=[];for(const i in this.params_)e[t++]=i+"-"+this.params_[i];return e.join("/")}setParams_(t){this.params_=t,this.updateV13_(),this.setKey(this.getKeyForParams_())}setParams(t){this.setParams_(Object.assign({},t))}updateParams(t){this.setParams_(Object.assign(this.params_,t))}updateV13_(){const t=this.params_.VERSION||yu;this.v13_=mf(t,"1.3")>=0}tileUrlFunction(t,e,i){let s=this.getTileGrid();if(s||(s=this.getTileGridForProjection(i)),s.getResolutions().length<=t[0])return;e!=1&&(!this.hidpi_||this.serverType_===void 0)&&(e=1);const r=s.getResolution(t[0]);let o=s.getTileCoordExtent(t,this.tmpExtent_);const a=this.gutter_;a!==0&&(o=Ii(o,r*a,o));const l=Object.assign({},Om(this.params_,"GetMap"));return this.getRequestUrl_(t,o,e,i,l)}}class gE extends Rl{constructor(t){const e=t.requestEncoding!==void 0?t.requestEncoding:"KVP",i=t.tileGrid;let s=t.urls;s===void 0&&t.url!==void 0&&(s=Fm(t.url)),super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:i,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=pu(s.map(this.createFromWMTSTemplate.bind(this))))}setUrls(t){this.urls=t;const e=t.join(`
|
|
115
|
+
`);this.setTileUrlFunction(pu(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_,i={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};e=="KVP"&&Object.assign(i,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),t=e=="KVP"?bl(t,i):t.replace(/\{(\w+?)\}/g,function(o,a){return a.toLowerCase()in i?i[a.toLowerCase()]:o});const s=this.tileGrid,r=this.dimensions_;return(function(o,a,l){if(!o)return;const c={TileMatrix:s.getMatrixId(o[0]),TileCol:o[1],TileRow:o[2]};Object.assign(c,r);let h=t;return e=="KVP"?h=bl(h,c):h=h.replace(/\{(\w+?)\}/g,function(u,d){return encodeURIComponent(c[d])}),h})}}class Il extends Rl{constructor(t){t=t||{};const e=t.projection!==void 0?t.projection:"EPSG:3857",i=t.tileGrid!==void 0?t.tileGrid:cr({extent:xo(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,interpolate:t.interpolate,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX!==void 0?t.wrapX:!0,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.gutter_=t.gutter!==void 0?t.gutter:0}getGutter(){return this.gutter_}}const pE={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},zm={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};class mE extends Rm{constructor(t,e){super(t,e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=xe(),this.tileClipContexts_=null}enqueueTilesForNextExtent(){return this.getLayer().getRenderMode()!=="vector"}drawTile(t,e,i,s,r,o,a,l){this.updateExecutorGroup_(t,e.pixelRatio,e.viewState.projection),this.tileImageNeedsRender_(t)&&this.renderTileImage_(t,e),super.drawTile(t,e,i,s,r,o,a,l)}getTile(t,e,i,s){const r=this.getOrCreateTile(t,e,i,s);if(!r)return null;const o=s.viewState,a=o.resolution,l=s.viewHints,c=this.getLayer().getSource(),h=c.getTileGridForProjection(o.projection),u=!(l[Ot.ANIMATING]||l[Ot.INTERACTING]),d=h.getZForResolution(a,c.zDirection)===t;return u&&d?r.wantedResolution=a:r.wantedResolution||(r.wantedResolution=h.getResolution(t)),r}prepareFrame(t){const e=this.getLayer().getRevision();return this.renderedLayerRevision_!==e&&(this.renderedLayerRevision_=e,this.renderedTiles.length=0),super.prepareFrame(t)}updateExecutorGroup_(t,e,i){const s=this.getLayer(),r=s.getRevision(),o=s.getRenderOrder()||null,a=t.wantedResolution,l=t.getReplayState(s);if(!l.dirty&&l.renderedResolution===a&&l.renderedRevision==r&&l.renderedPixelRatio===e&&l.renderedRenderOrder==o)return;const c=s.getSource(),h=!!s.getDeclutter(),u=c.getTileGrid(),g=c.getTileGridForProjection(i).getTileCoordExtent(t.wrappedTileCoord),p=c.getSourceTiles(e,i,t),m=at(s);delete t.hitDetectionImageData[m],t.executorGroups[m]=[],l.dirty=!1;for(let _=0,v=p.length;_<v;++_){const y=p[_];if(y.getState()!=W.LOADED)continue;const w=c.getProjection(),x=y.tileCoord;let C=u.getTileCoordExtent(x);i&&w&&!ye(i,w)&&(C=Nr(C,w,i,32));const P=ci(g,C),b=Ii(P,s.getRenderBuffer()*a,this.tempExtent),R=ji(C,P)?null:b,I=new Lg(0,P,a,e),S=ja(a,e),F=function(U,N){let $;const X=U.getStyleFunction()||s.getStyleFunction();if(X&&($=X(U,a)),$){const Z=this.renderFeature(U,S,$,I,h,N);l.dirty=l.dirty||Z}},k=y.getFeatures();o&&o!==l.renderedRenderOrder&&k.sort(o);for(let U=0,N=k.length;U<N;++U){let $=k[U];i&&y.projection&&!ye(i,y.projection)&&($=$.clone(),$.getGeometry().applyTransform(Ki(y.projection,i))),(!R||Wt(R,$.getGeometry().getExtent()))&&F.call(this,$,U)}const T=I.finish(),L=s.getRenderMode()!=="vector"&&h&&p.length===1?null:P,A=new Gg(L,a,e,c.getOverlaps(),T,s.getRenderBuffer(),!0);t.executorGroups[m].push(A)}l.renderedRevision=r,l.renderedPixelRatio=e,l.renderedRenderOrder=o,l.renderedResolution=a}forEachFeatureAtCoordinate(t,e,i,s,r){var w,x;const o=e.viewState.resolution,a=e.viewState.rotation;i=i??0;const l=this.getLayer(),h=l.getSource().getTileGridForProjection(e.viewState.projection),u=Rr([t]);Ii(u,o*i,u);const d={},g=function(C,P,b){let R=C.getId();R===void 0&&(R=at(C));const I=d[R];if(I){if(I!==!0&&b<I.distanceSq){if(b===0)return d[R]=!0,r.splice(r.lastIndexOf(I),1),s(C,l,P);I.geometry=P,I.distanceSq=b}}else{if(b===0)return d[R]=!0,s(C,l,P);r.push(d[R]={feature:C,layer:l,geometry:P,distanceSq:b,callback:s})}},p=this.renderedTiles,m=at(l),_=l.getDeclutter(),v=_?(x=(w=e.declutter)==null?void 0:w[_])==null?void 0:x.all().map(C=>C.value):null;let y;t:for(let C=0,P=p.length;C<P;++C){const b=p[C],R=h.getTileCoordExtent(b.wrappedTileCoord);if(!Wt(R,u))continue;const I=b.executorGroups[m];for(let S=0,F=I.length;S<F;++S)if(y=I[S].forEachFeatureAtCoordinate(t,o,a,i,g,v),y)break t}return y}getFeatures(t){return this.renderedTiles.length===0?Promise.resolve([]):new Promise((e,i)=>{const s=this.getLayer(),r=s.getSource(),o=this.renderedProjection,a=o.getExtent(),l=this.renderedResolution,c=r.getTileGridForProjection(o),h=Yt(this.renderedPixelToCoordinateTransform_,t.slice()),u=c.getTileCoordForCoordAndResolution(h,l).toString(),d=this.renderedTiles.find(w=>w.tileCoord.toString()===u&&w.getState()===W.LOADED);if(!d||d.loadingSourceTiles>0){e([]);return}r.getWrapX()&&o.canWrapX()&&!Bi(a,c.getTileCoordExtent(d.tileCoord))&&Mc(h,o);const g=at(s),p=c.getTileCoordExtent(d.wrappedTileCoord),m=Te(p),_=[(h[0]-m[0])/l,(m[1]-h[1])/l],v=d.getSourceTiles().reduce((w,x)=>w.concat(x.getFeatures()),[]);let y=d.hitDetectionImageData[g];if(!y){const w=ve(c.getTileSize(c.getZForResolution(l,r.zDirection))),x=this.renderedRotation_,C=[this.getRenderTransform(c.getTileCoordCenter(d.wrappedTileCoord),l,0,Ve,w[0]*Ve,w[1]*Ve,0)];y=Wg(w,C,v,s.getStyleFunction(),c.getTileCoordExtent(d.wrappedTileCoord),d.getReplayState(s).renderedResolution,x),d.hitDetectionImageData[g]=y}e(Ug(_,v,y))})}getFeaturesInExtent(t){const e=[],i=this.getTileCache();if(i.getCount()===0)return e;const r=this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),o=r.getZForResolution(this.renderedResolution),a={};return i.forEach(l=>{if(l.tileCoord[0]!==o||l.getState()!==W.LOADED)return;const c=l.getSourceTiles();for(let h=0,u=c.length;h<u;++h){const d=c[h],g=d.getKey();if(g in a)continue;a[g]=!0;const p=d.tileCoord;if(Wt(t,r.getTileCoordExtent(p))){const m=d.getFeatures();if(m)for(let _=0,v=m.length;_<v;++_){const y=m[_],w=y.getGeometry();Wt(t,w.getExtent())&&e.push(y)}}}}),e}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.renderedLayerRevision_!==void 0&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}renderDeclutter(t,e){var d;const i=this.context,s=i.globalAlpha;i.globalAlpha=e.opacity;const r=t.viewHints,o=!(r[Ot.ANIMATING]||r[Ot.INTERACTING]),a=[this.context.canvas.width,this.context.canvas.height],l=this.getLayer().getDeclutter(),c=l?(d=t.declutter)==null?void 0:d[l]:void 0,h=at(this.getLayer()),u=this.renderedTiles;for(let g=0,p=u.length;g<p;++g){const m=u[g],_=m.executorGroups[h];if(_)for(let v=_.length-1;v>=0;--v)_[v].execute(this.context,a,this.getTileRenderTransform(m,t),t.viewState.rotation,o,nl,c)}i.globalAlpha=s}renderDeferredInternal(t){const e=this.renderedTiles,i=at(this.getLayer()),s=e.reduce((l,c,h)=>(c.executorGroups[i].forEach(u=>l.push({executorGroup:u,index:h})),l),[]),r=s.map(({executorGroup:l})=>l.getDeferredZIndexContexts()),o={};for(let l=0,c=s.length;l<c;++l){const h=s[l].executorGroup.getDeferredZIndexContexts();for(const u in h)o[u]=!0}Object.keys(o).map(Number).sort(Pi).forEach(l=>{r.forEach((c,h)=>{c[l]&&(c[l].forEach(u=>{const{executorGroup:d,index:g}=s[h],p=d.getRenderedContext(),m=p.globalAlpha;p.globalAlpha=this.renderedOpacity_;const _=this.tileClipContexts_[g];_&&_.draw(p),u.draw(p),_&&p.restore(),p.globalAlpha=m,u.clear()}),c[l].length=0)})})}getTileRenderTransform(t,e){const i=e.pixelRatio,s=e.viewState,r=s.center,o=s.resolution,a=s.rotation,l=e.size,c=Math.round(l[0]*i),h=Math.round(l[1]*i),d=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),g=t.tileCoord,p=d.getTileCoordExtent(t.wrappedTileCoord),m=d.getTileCoordExtent(g,this.tempExtent)[0]-p[0];return La($c(this.inversePixelTransform.slice(),1/i,1/i),this.getRenderTransform(r,o,a,i,c,h,m))}postRender(t,e){var C;const i=e.viewHints,s=!(i[Ot.ANIMATING]||i[Ot.INTERACTING]);this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation,this.renderedOpacity_=e.layerStatesArray[e.layerIndex].opacity;const r=this.getLayer(),o=r.getRenderMode(),a=t.globalAlpha;t.globalAlpha=this.renderedOpacity_;const l=r.getDeclutter(),c=l?zm[o].filter(P=>!nl.includes(P)):zm[o],h=e.viewState,u=h.rotation,d=r.getSource(),p=d.getTileGridForProjection(h.projection).getZForResolution(h.resolution,d.zDirection),m=this.renderedTiles,_=[],v=[],y=[],w=at(r);let x=!0;for(let P=m.length-1;P>=0;--P){const b=m[P];x=x&&!b.getReplayState(r).dirty;const R=b.executorGroups[w].filter(A=>A.hasExecutors(c));if(R.length===0)continue;const I=this.getTileRenderTransform(b,e),S=b.tileCoord[0];let F=!1;const k=R[0].getClipCoords(I);let T=t,L;if(k){L=new Ph,T=L.getContext();for(let A=0,U=_.length;A<U;++A)if(p!==S&&S<v[A]){const N=_[A];Wt([k[0],k[3],k[4],k[7]],[N[0],N[3],N[4],N[7]])&&(F||(T.save(),F=!0),T.beginPath(),T.moveTo(k[0],k[1]),T.lineTo(k[2],k[3]),T.lineTo(k[4],k[5]),T.lineTo(k[6],k[7]),T.moveTo(N[6],N[7]),T.lineTo(N[4],N[5]),T.lineTo(N[2],N[3]),T.lineTo(N[0],N[1]),T.clip())}_.push(k),v.push(S)}for(let A=0,U=R.length;A<U;++A)R[A].execute(t,[t.canvas.width,t.canvas.height],I,u,s,c,(C=e.declutter)==null?void 0:C[l]);F&&(T===t?T.restore():y[P]=L)}t.globalAlpha=a,this.ready=x,this.tileClipContexts_=y,e.declutter||this.renderDeferredInternal(e),super.postRender(t,e)}renderFeature(t,e,i,s,r,o){if(!i)return!1;let a=!1;if(Array.isArray(i))for(let l=0,c=i.length;l<c;++l)a=qa(s,t,i[l],e,this.boundHandleStyleImageChange_,void 0,r,o)||a;else a=qa(s,t,i,e,this.boundHandleStyleImageChange_,void 0,r,o);return a}tileImageNeedsRender_(t){const e=this.getLayer();if(e.getRenderMode()==="vector")return!1;const i=t.getReplayState(e),s=e.getRevision(),r=t.wantedResolution;return i.renderedTileResolution!==r||i.renderedTileRevision!==s}renderTileImage_(t,e){const i=this.getLayer(),s=t.getReplayState(i),r=i.getRevision(),o=t.executorGroups[at(i)];s.renderedTileRevision=r;const a=t.wrappedTileCoord,l=a[0],c=i.getSource();let h=e.pixelRatio;const d=e.viewState.projection,g=c.getTileGridForProjection(d),p=g.getResolution(t.tileCoord[0]),m=e.pixelRatio/t.wantedResolution*p,_=g.getResolution(l),v=t.getContext();h=Math.round(Math.max(h,m/h));const y=c.getTilePixelSize(l,h,d);v.canvas.width=y[0],v.canvas.height=y[1];const w=h/m;if(w!==1){const b=Lf(this.tmpTransform_);$c(b,w,w),v.setTransform.apply(v,b)}const x=g.getTileCoordExtent(a,this.tempExtent),C=m/_,P=Lf(this.tmpTransform_);$c(P,C,-C),C_(P,-x[0],-x[3]);for(let b=0,R=o.length;b<R;++b)o[b].execute(v,[v.canvas.width*w,v.canvas.height*w],P,0,!0,pE[i.getRenderMode()],null);s.renderedTileResolution=t.wantedResolution}}class Sl extends hl{constructor(t){t=t||{};const e=Object.assign({},t);delete e.preload;const i=t.cacheSize===void 0?0:t.cacheSize;delete t.cacheSize,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=i;const s=t.renderMode||"hybrid";Et(s=="hybrid"||s=="vector","`renderMode` must be `'hybrid'` or `'vector'`"),this.renderMode_=s,this.setPreload(t.preload?t.preload:0),this.setUseInterimTilesOnError(t.useInterimTilesOnError!==void 0?t.useInterimTilesOnError:!0),this.getBackground,this.setBackground}createRenderer(){return new mE(this,{cacheSize:this.cacheSize_})}getFeatures(t){return super.getFeatures(t)}getFeaturesInExtent(t){return this.getRenderer().getFeaturesInExtent(t)}getRenderMode(){return this.renderMode_}getPreload(){return this.get(Un.PRELOAD)}getUseInterimTilesOnError(){return this.get(Un.USE_INTERIM_TILES_ON_ERROR)}setPreload(t){this.set(Un.PRELOAD,t)}setUseInterimTilesOnError(t){this.set(Un.USE_INTERIM_TILES_ON_ERROR,t)}}class _u extends Pl{constructor(t){const e=t.projection||"EPSG:3857",i=t.extent||xo(e),s=t.tileGrid||cr({extent:i,maxResolution:t.maxResolution,maxZoom:t.maxZoom!==void 0?t.maxZoom:22,minZoom:t.minZoom,tileSize:t.tileSize||512});super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,interpolate:!0,projection:e,state:t.state,tileGrid:s,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:km,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX===void 0?!0:t.wrapX,transition:t.transition,zDirection:t.zDirection===void 0?1:t.zDirection}),this.format_=t.format?t.format:null,this.tileKeysBySourceTileUrl_={},this.sourceTiles_={},this.overlaps_=t.overlaps==null?!0:t.overlaps,this.tileClass=t.tileClass?t.tileClass:Tx,this.tileGrids_={}}getOverlaps(){return this.overlaps_}getSourceTiles(t,e,i){if(i.getState()===W.IDLE){i.setState(W.LOADING);const s=i.wrappedTileCoord,r=this.getTileGridForProjection(e);let o=r.getTileCoordExtent(s);const a=s[0],l=r.getResolution(a);Ii(o,-l,o);const c=this.projection;e&&this.projection&&!ye(e,c)&&(o=Nr(o,e,c));const h=this.tileGrid,u=h.getExtent();u&&ci(o,u,o);let d=l;e&&c&&!ye(e,c)&&(d=l/c.getMetersPerUnit()/e.getMetersPerUnit());const g=h.getZForResolution(d,this.zDirection);h.forEachTileCoord(o,g,p=>{const m=this.tileUrlFunction(p,t,e);this.sourceTiles_[m]||(this.sourceTiles_[m]=new this.tileClass(p,m?W.IDLE:W.EMPTY,m,this.format_,this.tileLoadFunction));const _=this.sourceTiles_[m];i.sourceTiles.push(_),this.tileKeysBySourceTileUrl_[m]||(this.tileKeysBySourceTileUrl_[m]=[]),this.tileKeysBySourceTileUrl_[m].push(i.getKey());const v=_.getState();if(v<W.LOADED){const y=w=>{this.handleTileChange(w);const x=_.getState();if(x===W.LOADED||x===W.ERROR){const C=_.getKey();C in i.errorTileKeys?_.getState()===W.LOADED&&delete i.errorTileKeys[C]:i.loadingSourceTiles--,x===W.ERROR?i.errorTileKeys[C]=!0:_.removeEventListener(Q.CHANGE,y),i.loadingSourceTiles===0&&i.setState(Pn(i.errorTileKeys)?W.LOADED:W.ERROR)}};_.addEventListener(Q.CHANGE,y),i.loadingSourceTiles++}v===W.IDLE&&(_.extent=h.getTileCoordExtent(p),_.projection=this.projection,_.resolution=h.getResolution(p[0]),_.load())}),i.loadingSourceTiles||i.setState(i.sourceTiles.some(p=>p.getState()===W.ERROR)?W.ERROR:W.LOADED)}return i.sourceTiles}removeSourceTiles(t){const e=t.getKey(),i=t.sourceTiles;for(let s=0,r=i.length;s<r;++s){const o=i[s].getTileUrl();if(!this.tileKeysBySourceTileUrl_[o])return;const a=this.tileKeysBySourceTileUrl_[o].indexOf(e);a!==-1&&(this.tileKeysBySourceTileUrl_[o].splice(a,1),this.tileKeysBySourceTileUrl_[o].length===0&&(delete this.tileKeysBySourceTileUrl_[o],delete this.sourceTiles_[o]))}}getTile(t,e,i,s,r){const o=[t,e,i];let a=this.getTileCoordForTileUrlFunction(o,r);const l=this.getTileGrid().getExtent(),c=this.projection,h=this.getTileGridForProjection(r);if(a&&l){const g=h.getTileCoordExtent(a);Ii(g,-h.getResolution(t),g),Wt(l,!r||!c||ye(r,c)?g:Nr(g,r,c))||(a=null)}let u=!0;if(a!==null){const g=this.tileGrid,p=h.getResolution(t);let m=p;r&&c&&!ye(r,c)&&(m=p/c.getMetersPerUnit()/r.getMetersPerUnit());const _=g.getZForResolution(m,1),v=h.getTileCoordExtent(a);Ii(v,-p,v),g.forEachTileCoord(!r||!c||ye(r,c)?v:Nr(v,r,c),_,y=>{u=u&&!this.tileUrlFunction(y,s,c)})}const d=new Sx(o,u?W.EMPTY:W.IDLE,a,this.getSourceTiles.bind(this,s,r),this.removeSourceTiles.bind(this));return d.key=this.getKey(),d}getTileGridForProjection(t){const e=t.getCode();let i=this.tileGrids_[e];if(!i){const s=this.projection;if(s!==null&&!ye(s,t))return fu(t);const r=this.tileGrid,o=r.getResolutions().slice(),a=o.map(function(h,u){return r.getOrigin(u)}),l=o.map(function(h,u){return r.getTileSize(u)}),c=cp+1;for(let h=o.length;h<c;++h)o.push(o[h-1]/2),a.push(a[h-1]),l.push(l[h-1]);i=new Xn({extent:r.getExtent(),origins:a,resolutions:o,tileSizes:l}),this.tileGrids_[e]=i}return i}getTilePixelRatio(t){return t}getTilePixelSize(t,e,i){const s=this.getTileGridForProjection(i),r=ve(s.getTileSize(t),this.tmpSize);return[Math.round(r[0]*e),Math.round(r[1]*e)]}setOverlaps(t){this.overlaps_=t,this.changed()}}function km(n,t){n.setLoader(function(e,i,s){xg(t,n.getFormat(),e,i,s,n.onLoad.bind(n),n.onError.bind(n))})}const vu=65536*65536,Nm=1/vu,yE=12,Gm=typeof TextDecoder>"u"?null:new TextDecoder("utf-8"),wu=0,Tl=1,Eo=2,Ml=5;class _E{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(t,e,i=this.length){for(;this.pos<i;){const s=this.readVarint(),r=s>>3,o=this.pos;this.type=s&7,t(r,e,this),this.pos===o&&this.skip(s)}return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*vu;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*vu;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const e=this.buf;let i,s;return s=e[this.pos++],i=s&127,s<128||(s=e[this.pos++],i|=(s&127)<<7,s<128)||(s=e[this.pos++],i|=(s&127)<<14,s<128)||(s=e[this.pos++],i|=(s&127)<<21,s<128)?i:(s=e[this.pos],i|=(s&15)<<28,vE(i,t,this))}readVarint64(){return this.readVarint(!0)}readSVarint(){const t=this.readVarint();return t%2===1?(t+1)/-2:t/2}readBoolean(){return!!this.readVarint()}readString(){const t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=yE&&Gm?Gm.decode(this.buf.subarray(e,t)):DE(this.buf,e,t)}readBytes(){const t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readVarint(e));return t}readPackedSVarint(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFloat());return t}readPackedDouble(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed64());return t}readPackedEnd(){return this.type===Eo?this.readVarint()+this.pos:this.pos+1}skip(t){const e=t&7;if(e===wu)for(;this.buf[this.pos++]>127;);else if(e===Eo)this.pos=this.readVarint()+this.pos;else if(e===Ml)this.pos+=4;else if(e===Tl)this.pos+=8;else throw new Error(`Unimplemented type: ${e}`)}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e<this.pos+t;)e*=2;if(e!==this.length){const i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.dataView=new DataView(i.buffer),this.length=e}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeSFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,t&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*Nm),!0),this.pos+=8}writeSFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,t&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*Nm),!0),this.pos+=8}writeVarint(t){if(t=+t||0,t>268435455||t<0){wE(t,this);return}this.realloc(4),this.buf[this.pos++]=t&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=t>>>7&127)))}writeSVarint(t){this.writeVarint(t<0?-t*2-1:t*2)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(t.length*4),this.pos++;const e=this.pos;this.pos=FE(this.buf,t,this.pos);const i=this.pos-e;i>=128&&Vm(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){const e=t.length;this.writeVarint(e),this.realloc(e);for(let i=0;i<e;i++)this.buf[this.pos++]=t[i]}writeRawMessage(t,e){this.pos++;const i=this.pos;t(e,this);const s=this.pos-i;s>=128&&Vm(i,s,this),this.pos=i-1,this.writeVarint(s),this.pos+=s}writeMessage(t,e,i){this.writeTag(t,Eo),this.writeRawMessage(e,i)}writePackedVarint(t,e){e.length&&this.writeMessage(t,CE,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,bE,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,IE,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,PE,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,RE,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,SE,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,TE,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,ME,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,AE,e)}writeBytesField(t,e){this.writeTag(t,Eo),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,Ml),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,Ml),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,Tl),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,Tl),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,wu),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,wu),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,Eo),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,Ml),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,Tl),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}}function vE(n,t,e){const i=e.buf;let s,r;if(r=i[e.pos++],s=(r&112)>>4,r<128||(r=i[e.pos++],s|=(r&127)<<3,r<128)||(r=i[e.pos++],s|=(r&127)<<10,r<128)||(r=i[e.pos++],s|=(r&127)<<17,r<128)||(r=i[e.pos++],s|=(r&127)<<24,r<128)||(r=i[e.pos++],s|=(r&1)<<31,r<128))return hr(n,s,t);throw new Error("Expected varint not more than 10 bytes")}function hr(n,t,e){return e?t*4294967296+(n>>>0):(t>>>0)*4294967296+(n>>>0)}function wE(n,t){let e,i;if(n>=0?(e=n%4294967296|0,i=n/4294967296|0):(e=~(-n%4294967296),i=~(-n/4294967296),e^4294967295?e=e+1|0:(e=0,i=i+1|0)),n>=18446744073709552e3||n<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),xE(e,i,t),EE(i,t)}function xE(n,t,e){e.buf[e.pos++]=n&127|128,n>>>=7,e.buf[e.pos++]=n&127|128,n>>>=7,e.buf[e.pos++]=n&127|128,n>>>=7,e.buf[e.pos++]=n&127|128,n>>>=7,e.buf[e.pos]=n&127}function EE(n,t){const e=(n&7)<<4;t.buf[t.pos++]|=e|((n>>>=3)?128:0),n&&(t.buf[t.pos++]=n&127|((n>>>=7)?128:0),n&&(t.buf[t.pos++]=n&127|((n>>>=7)?128:0),n&&(t.buf[t.pos++]=n&127|((n>>>=7)?128:0),n&&(t.buf[t.pos++]=n&127|((n>>>=7)?128:0),n&&(t.buf[t.pos++]=n&127)))))}function Vm(n,t,e){const i=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));e.realloc(i);for(let s=e.pos-1;s>=n;s--)e.buf[s+i]=e.buf[s]}function CE(n,t){for(let e=0;e<n.length;e++)t.writeVarint(n[e])}function bE(n,t){for(let e=0;e<n.length;e++)t.writeSVarint(n[e])}function PE(n,t){for(let e=0;e<n.length;e++)t.writeFloat(n[e])}function RE(n,t){for(let e=0;e<n.length;e++)t.writeDouble(n[e])}function IE(n,t){for(let e=0;e<n.length;e++)t.writeBoolean(n[e])}function SE(n,t){for(let e=0;e<n.length;e++)t.writeFixed32(n[e])}function TE(n,t){for(let e=0;e<n.length;e++)t.writeSFixed32(n[e])}function ME(n,t){for(let e=0;e<n.length;e++)t.writeFixed64(n[e])}function AE(n,t){for(let e=0;e<n.length;e++)t.writeSFixed64(n[e])}function DE(n,t,e){let i="",s=t;for(;s<e;){const r=n[s];let o=null,a=r>239?4:r>223?3:r>191?2:1;if(s+a>e)break;let l,c,h;a===1?r<128&&(o=r):a===2?(l=n[s+1],(l&192)===128&&(o=(r&31)<<6|l&63,o<=127&&(o=null))):a===3?(l=n[s+1],c=n[s+2],(l&192)===128&&(c&192)===128&&(o=(r&15)<<12|(l&63)<<6|c&63,(o<=2047||o>=55296&&o<=57343)&&(o=null))):a===4&&(l=n[s+1],c=n[s+2],h=n[s+3],(l&192)===128&&(c&192)===128&&(h&192)===128&&(o=(r&15)<<18|(l&63)<<12|(c&63)<<6|h&63,(o<=65535||o>=1114112)&&(o=null))),o===null?(o=65533,a=1):o>65535&&(o-=65536,i+=String.fromCharCode(o>>>10&1023|55296),o=56320|o&1023),i+=String.fromCharCode(o),s+=a}return i}function FE(n,t,e){for(let i=0,s,r;i<t.length;i++){if(s=t.charCodeAt(i),s>55295&&s<57344)if(r)if(s<56320){n[e++]=239,n[e++]=191,n[e++]=189,r=s;continue}else s=r-55296<<10|s-56320|65536,r=null;else{s>56319||i+1===t.length?(n[e++]=239,n[e++]=191,n[e++]=189):r=s;continue}else r&&(n[e++]=239,n[e++]=191,n[e++]=189,r=null);s<128?n[e++]=s:(s<2048?n[e++]=s>>6|192:(s<65536?n[e++]=s>>12|224:(n[e++]=s>>18|240,n[e++]=s>>12&63|128),n[e++]=s>>6&63|128),n[e++]=s&63|128)}return e}class Wm{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=je,this.supportedMediaTypes=null}getReadOptions(t,e){if(e){let i=e.dataProjection?mt(e.dataProjection):this.readProjection(t);e.extent&&i&&i.getUnits()==="tile-pixels"&&(i=mt(i),i.setWorldExtent(e.extent)),e={dataProjection:i,featureProjection:e.featureProjection}}return this.adaptOptions(e)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},t)}getType(){return et()}readFeature(t,e){return et()}readFeatures(t,e){return et()}readGeometry(t,e){return et()}readProjection(t){return et()}writeFeature(t,e){return et()}writeFeatures(t,e){return et()}writeGeometry(t,e){return et()}}function Al(n,t,e){const i=e?mt(e.featureProjection):null,s=e?mt(e.dataProjection):null;let r=n;if(i&&s&&!ye(i,s)){t&&(r=n.clone());const o=t?i:s,a=t?s:i;o.getUnits()==="tile-pixels"?r.transform(o,a):r.applyTransform(Ki(o,a))}if(t&&e&&e.decimals!==void 0){const o=Math.pow(10,e.decimals),a=function(l){for(let c=0,h=l.length;c<h;++c)l[c]=Math.round(l[c]*o)/o;return l};r===n&&(r=n.clone()),r.applyTransform(a)}return r}const LE={Point:Ne,LineString:fi,Polygon:di,MultiPoint:Bs,MultiLineString:fs,MultiPolygon:Jr};function OE(n,t,e){return Array.isArray(t[0])?(jf(n,0,t,e)||(n=n.slice(),eh(n,0,t,e)),n):(th(n,0,t,e)||(n=n.slice(),Na(n,0,t,e)),n)}function Um(n,t){var r;const e=n.geometry;if(!e)return[];if(Array.isArray(e))return e.map(o=>Um({...n,geometry:o})).flat();const i=e.type==="MultiPolygon"?"Polygon":e.type;if(i==="GeometryCollection"||i==="Circle")throw new Error("Unsupported geometry type: "+i);const s=e.layout.length;return Al(new _e(i,i==="Polygon"?OE(e.flatCoordinates,e.ends,s):e.flatCoordinates,(r=e.ends)==null?void 0:r.flat(),s,n.properties||{},n.id).enableSimplifyTransformed(),!1,t)}function xu(n,t){if(!n)return null;if(Array.isArray(n)){const i=n.map(s=>xu(s,t));return new Ka(i)}const e=LE[n.type];return Al(new e(n.flatCoordinates,n.layout||"XY",n.ends),!1,t)}class Eu extends Wm{constructor(t){super(),t=t||{},this.dataProjection=new Or({code:"",units:"tile-pixels"}),this.featureClass=t.featureClass?t.featureClass:_e,this.geometryName_=t.geometryName,this.layerName_=t.layerName?t.layerName:"layer",this.layers_=t.layers?t.layers:null,this.idProperty_=t.idProperty,this.supportedMediaTypes=["application/vnd.mapbox-vector-tile","application/x-protobuf"]}readRawGeometry_(t,e,i,s){t.pos=e.geometry;const r=t.readVarint()+t.pos;let o=1,a=0,l=0,c=0,h=0,u=0;for(;t.pos<r;){if(!a){const d=t.readVarint();o=d&7,a=d>>3}if(a--,o===1||o===2)l+=t.readSVarint(),c+=t.readSVarint(),o===1&&h>u&&(s.push(h),u=h),i.push(l,c),h+=2;else if(o===7)h>u&&(i.push(i[u],i[u+1]),h+=2);else throw new Error("Invalid command found in the PBF")}h>u&&(s.push(h),u=h)}createFeature_(t,e,i){const s=e.type;if(s===0)return null;let r;const o=e.properties;let a;this.idProperty_?(a=o[this.idProperty_],delete o[this.idProperty_]):a=e.id,o[this.layerName_]=e.layer.name;const l=[],c=[];this.readRawGeometry_(t,e,l,c);const h=VE(s,c.length);if(this.featureClass===_e)r=new this.featureClass(h,l,c,2,o,a),r.transform(i.dataProjection);else{let u;if(h=="Polygon"){const p=qf(l,c);u=p.length>1?new Jr(l,"XY",p):new di(l,"XY",c)}else u=h==="Point"?new Ne(l,"XY"):h==="LineString"?new fi(l,"XY"):h==="MultiPoint"?new Bs(l,"XY"):h==="MultiLineString"?new fs(l,"XY",c):null;const d=this.featureClass;r=new d,this.geometryName_&&r.setGeometryName(this.geometryName_);const g=Al(u,!1,i);r.setGeometry(g),a!==void 0&&r.setId(a),r.setProperties(o,!0)}return r}getType(){return"arraybuffer"}readFeatures(t,e){const i=this.layers_;e=this.adaptOptions(e);const s=mt(e.dataProjection);s.setWorldExtent(e.extent),e.dataProjection=s;const r=new _E(t),o=r.readFields(zE,{}),a=[];for(const l in o){if(i&&!i.includes(l))continue;const c=o[l],h=c?[0,0,c.extent,c.extent]:null;s.setExtent(h);for(let u=0,d=c.length;u<d;++u){const g=GE(r,c,u),p=this.createFeature_(r,g,e);p!==null&&a.push(p)}}return a}readProjection(t){return this.dataProjection}setLayers(t){this.layers_=t}}function zE(n,t,e){if(n===3){const i={keys:[],values:[],features:[]},s=e.readVarint()+e.pos;e.readFields(kE,i,s),i.length=i.features.length,i.length&&(t[i.name]=i)}}function kE(n,t,e){if(n===15)t.version=e.readVarint();else if(n===1)t.name=e.readString();else if(n===5)t.extent=e.readVarint();else if(n===2)t.features.push(e.pos);else if(n===3)t.keys.push(e.readString());else if(n===4){let i=null;const s=e.readVarint()+e.pos;for(;e.pos<s;)n=e.readVarint()>>3,i=n===1?e.readString():n===2?e.readFloat():n===3?e.readDouble():n===4?e.readVarint64():n===5?e.readVarint():n===6?e.readSVarint():n===7?e.readBoolean():null;t.values.push(i)}}function NE(n,t,e){if(n==1)t.id=e.readVarint();else if(n==2){const i=e.readVarint()+e.pos;for(;e.pos<i;){const s=t.layer.keys[e.readVarint()],r=t.layer.values[e.readVarint()];t.properties[s]=r}}else n==3?t.type=e.readVarint():n==4&&(t.geometry=e.pos)}function GE(n,t,e){n.pos=t.features[e];const i=n.readVarint()+n.pos,s={layer:t,type:0,properties:{}};return n.readFields(NE,s,i),s}function VE(n,t){let e;return n===1?e=t===1?"Point":"MultiPoint":n===2?e=t===1?"LineString":"MultiLineString":n===3&&(e="Polygon"),e}var WE=8,UE={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},$E={"*":{type:"source"}},XE=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],YE={type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},HE={type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},BE={type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},ZE={type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},jE={type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},qE={type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},KE={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},JE=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],QE={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},tC={"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},eC={"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},iC={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},nC={"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},sC={"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},rC={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},oC={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},aC={type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},lC={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},cC={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},hC={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},uC={type:"array",value:"expression_name",minimum:1},dC={anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},fC={"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},gC={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},pC={type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},mC=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],yC={"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},_C={"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},vC={"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},wC={"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},xC={"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},EC={"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},CC={"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},bC={"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},PC={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},RC={"*":{type:"string"}},IC={type:"array",value:"interpolation_name",minimum:1},SC={type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}},TC={$version:WE,$root:UE,sources:$E,source:XE,source_vector:YE,source_raster:HE,source_raster_dem:BE,source_geojson:ZE,source_video:jE,source_image:qE,layer:KE,layout:JE,layout_background:QE,layout_fill:tC,layout_circle:eC,layout_heatmap:iC,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:nC,layout_symbol:sC,layout_raster:rC,layout_hillshade:oC,"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:aC,filter_operator:lC,geometry_type:cC,function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:hC,expression:uC,light:dC,sky:fC,terrain:gC,projection:pC,paint:mC,paint_fill:yC,"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:_C,paint_circle:vC,paint_heatmap:wC,paint_symbol:xC,paint_raster:EC,paint_hillshade:CC,"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:bC,transition:PC,"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:RC,interpolation:IC,interpolation_name:SC};const MC=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function AC(n,t){const e={};for(const i in n)i!=="ref"&&(e[i]=n[i]);return MC.forEach(i=>{i in t&&(e[i]=t[i])}),e}function DC(n){n=n.slice();const t=Object.create(null);for(let e=0;e<n.length;e++)t[n[e].id]=n[e];for(let e=0;e<n.length;e++)"ref"in n[e]&&(n[e]=AC(n[e],t[n[e].ref]));return n}class Ni extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class Cu{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[i,s]of e)this.bindings[i]=s}concat(t){return new Cu(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return this.bindings[t]?!0:this.parent?this.parent.has(t):!1}}const Dl={kind:"null"},G={kind:"number"},nt={kind:"string"},ht={kind:"boolean"},Gi={kind:"color"},Fl={kind:"projectionDefinition"},ws={kind:"object"},ct={kind:"value"},FC={kind:"error"},Ll={kind:"collator"},Ol={kind:"formatted"},zl={kind:"padding"},Co={kind:"colorArray"},kl={kind:"numberArray"},bo={kind:"resolvedImage"},Nl={kind:"variableAnchorOffsetCollection"};function Ce(n,t){return{kind:"array",itemType:n,N:t}}function Gt(n){if(n.kind==="array"){const t=Gt(n.itemType);return typeof n.N=="number"?`array<${t}, ${n.N}>`:n.itemType.kind==="value"?"array":`array<${t}>`}else return n.kind}const LC=[Dl,G,nt,ht,Gi,Fl,Ol,ws,Ce(ct),zl,kl,Co,bo,Nl];function Po(n,t){if(t.kind==="error")return null;if(n.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!Po(n.itemType,t.itemType))&&(typeof n.N!="number"||n.N===t.N))return null}else{if(n.kind===t.kind)return null;if(n.kind==="value"){for(const e of LC)if(!Po(e,t))return null}}return`Expected ${Gt(n)} but found ${Gt(t)} instead.`}function bu(n,t){return t.some(e=>e.kind===n.kind)}function xs(n,t){return t.some(e=>e==="null"?n===null:e==="array"?Array.isArray(n):e==="object"?n&&!Array.isArray(n)&&typeof n=="object":e===typeof n)}function Yn(n,t){return n.kind==="array"&&t.kind==="array"?n.itemType.kind===t.itemType.kind&&typeof n.N=="number":n.kind===t.kind}const $m=.96422,Xm=1,Ym=.82521,Hm=4/29,ur=6/29,Bm=3*ur*ur,OC=ur*ur*ur,zC=Math.PI/180,kC=180/Math.PI;function Zm(n){return n=n%360,n<0&&(n+=360),n}function jm([n,t,e,i]){n=Pu(n),t=Pu(t),e=Pu(e);let s,r;const o=Ru((.2225045*n+.7168786*t+.0606169*e)/Xm);n===t&&t===e?s=r=o:(s=Ru((.4360747*n+.3850649*t+.1430804*e)/$m),r=Ru((.0139322*n+.0971045*t+.7141733*e)/Ym));const a=116*o-16;return[a<0?0:a,500*(s-o),200*(o-r),i]}function Pu(n){return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function Ru(n){return n>OC?Math.pow(n,1/3):n/Bm+Hm}function qm([n,t,e,i]){let s=(n+16)/116,r=isNaN(t)?s:s+t/500,o=isNaN(e)?s:s-e/200;return s=Xm*Su(s),r=$m*Su(r),o=Ym*Su(o),[Iu(3.1338561*r-1.6168667*s-.4906146*o),Iu(-.9787684*r+1.9161415*s+.033454*o),Iu(.0719453*r-.2289914*s+1.4052427*o),i]}function Iu(n){return n=n<=.00304?12.92*n:1.055*Math.pow(n,1/2.4)-.055,n<0?0:n>1?1:n}function Su(n){return n>ur?n*n*n:Bm*(n-Hm)}function NC(n){const[t,e,i,s]=jm(n),r=Math.sqrt(e*e+i*i);return[Math.round(r*1e4)?Zm(Math.atan2(i,e)*kC):NaN,r,t,s]}function GC([n,t,e,i]){return n=isNaN(n)?0:n*zC,qm([e,Math.cos(n)*t,Math.sin(n)*t,i])}function VC([n,t,e,i]){n=Zm(n),t/=100,e/=100;function s(r){const o=(r+n/30)%12,a=t*Math.min(e,1-e);return e-a*Math.max(-1,Math.min(o-3,9-o,1))}return[s(0),s(8),s(4),i]}const WC=Object.hasOwn||function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};function Km(n,t){return WC(n,t)?n[t]:void 0}function UC(n){if(n=n.toLowerCase().trim(),n==="transparent")return[0,0,0,0];const t=Km($C,n);if(t){const[s,r,o]=t;return[s/255,r/255,o/255,1]}if(n.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(n)){const r=n.length<6?1:2;let o=1;return[Gl(n.slice(o,o+=r)),Gl(n.slice(o,o+=r)),Gl(n.slice(o,o+=r)),Gl(n.slice(o,o+r)||"ff")]}if(n.startsWith("rgb")){const s=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,r=n.match(s);if(r){const[o,a,l,c,h,u,d,g,p,m,_,v]=r,y=[c||" ",d||" ",m].join("");if(y===" "||y===" /"||y===",,"||y===",,,"){const w=[l,u,p].join(""),x=w==="%%%"?100:w===""?255:0;if(x){const C=[dr(+a/x,0,1),dr(+h/x,0,1),dr(+g/x,0,1),_?Jm(+_,v):1];if(Qm(C))return C}}return}}const e=/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,i=n.match(e);if(i){const[s,r,o,a,l,c,h,u,d]=i,g=[o||" ",l||" ",h].join("");if(g===" "||g===" /"||g===",,"||g===",,,"){const p=[+r,dr(+a,0,100),dr(+c,0,100),u?Jm(+u,d):1];if(Qm(p))return VC(p)}}}function Gl(n){return parseInt(n.padEnd(2,n),16)/255}function Jm(n,t){return dr(t?n/100:n,0,1)}function dr(n,t,e){return Math.min(Math.max(t,n),e)}function Qm(n){return!n.some(Number.isNaN)}const $C={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function Es(n,t,e){return n+e*(t-n)}function Ro(n,t,e){return n.map((i,s)=>Es(i,t[s],e))}class _t{constructor(t,e,i,s=1,r=!0){this.r=t,this.g=e,this.b=i,this.a=s,r||(this.r*=s,this.g*=s,this.b*=s,s||this.overwriteGetter("rgb",[t,e,i,s]))}static parse(t){if(t instanceof _t)return t;if(typeof t!="string")return;const e=UC(t);if(e)return new _t(...e,!1)}get rgb(){const{r:t,g:e,b:i,a:s}=this,r=s||1/0;return this.overwriteGetter("rgb",[t/r,e/r,i/r,s])}get hcl(){return this.overwriteGetter("hcl",NC(this.rgb))}get lab(){return this.overwriteGetter("lab",jm(this.rgb))}overwriteGetter(t,e){return Object.defineProperty(this,t,{value:e}),e}toString(){const[t,e,i,s]=this.rgb;return`rgba(${[t,e,i].map(r=>Math.round(r*255)).join(",")},${s})`}static interpolate(t,e,i,s="rgb"){switch(s){case"rgb":{const[r,o,a,l]=Ro(t.rgb,e.rgb,i);return new _t(r,o,a,l,!1)}case"hcl":{const[r,o,a,l]=t.hcl,[c,h,u,d]=e.hcl;let g,p;if(!isNaN(r)&&!isNaN(c)){let w=c-r;c>r&&w>180?w-=360:c<r&&r-c>180&&(w+=360),g=r+i*w}else isNaN(r)?isNaN(c)?g=NaN:(g=c,(a===1||a===0)&&(p=h)):(g=r,(u===1||u===0)&&(p=o));const[m,_,v,y]=GC([g,p??Es(o,h,i),Es(a,u,i),Es(l,d,i)]);return new _t(m,_,v,y,!1)}case"lab":{const[r,o,a,l]=qm(Ro(t.lab,e.lab,i));return new _t(r,o,a,l,!1)}}}}_t.black=new _t(0,0,0,1),_t.white=new _t(1,1,1,1),_t.transparent=new _t(0,0,0,0),_t.red=new _t(1,0,0,1);class Tu{constructor(t,e,i){t?this.sensitivity=e?"variant":"case":this.sensitivity=e?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const XC=["bottom","center","top"];class Mu{constructor(t,e,i,s,r,o){this.text=t,this.image=e,this.scale=i,this.fontStack=s,this.textColor=r,this.verticalAlign=o}}class cn{constructor(t){this.sections=t}static fromString(t){return new cn([new Mu(t,null,null,null,null,null)])}isEmpty(){return this.sections.length===0?!0:!this.sections.some(t=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof cn?t:cn.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}}class yi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof yi)return t;if(typeof t=="number")return new yi([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const e of t)if(typeof e!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]];break}return new yi(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i){return new yi(Ro(t.values,e.values,i))}}class _i{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof _i)return t;if(typeof t=="number")return new _i([t]);if(Array.isArray(t)){for(const e of t)if(typeof e!="number")return;return new _i(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i){return new _i(Ro(t.values,e.values,i))}}class We{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof We)return t;if(typeof t=="string"){const i=_t.parse(t);return i?new We([i]):void 0}if(!Array.isArray(t))return;const e=[];for(const i of t){if(typeof i!="string")return;const s=_t.parse(i);if(!s)return;e.push(s)}return new We(e)}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i,s="rgb"){const r=[];if(t.values.length!=e.values.length)throw new Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${e.values.length}), cannot interpolate.`);for(let o=0;o<t.values.length;o++)r.push(_t.interpolate(t.values[o],e.values[o],i,s));return new We(r)}}class Ut extends Error{constructor(t){super(t),this.name="RuntimeError"}toJSON(){return this.message}}const YC=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Vi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Vi)return t;if(!(!Array.isArray(t)||t.length<1||t.length%2!==0)){for(let e=0;e<t.length;e+=2){const i=t[e],s=t[e+1];if(typeof i!="string"||!YC.has(i)||!Array.isArray(s)||s.length!==2||typeof s[0]!="number"||typeof s[1]!="number")return}return new Vi(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i){const s=t.values,r=e.values;if(s.length!==r.length)throw new Ut(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${e.toString()}`);const o=[];for(let a=0;a<s.length;a+=2){if(s[a]!==r[a])throw new Ut(`Cannot interpolate values containing mismatched anchors. from[${a}]: ${s[a]}, to[${a}]: ${r[a]}`);o.push(s[a]);const[l,c]=s[a+1],[h,u]=r[a+1];o.push([Es(l,h,i),Es(c,u,i)])}return new Vi(o)}}class Hn{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new Hn({name:t,available:!1}):null}}class vi{constructor(t,e,i){this.from=t,this.to=e,this.transition=i}static interpolate(t,e,i){return new vi(t,e,i)}static parse(t){if(t instanceof vi)return t;if(Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number")return new vi(t[0],t[1],t[2]);if(typeof t=="object"&&typeof t.from=="string"&&typeof t.to=="string"&&typeof t.transition=="number")return new vi(t.from,t.to,t.transition);if(typeof t=="string")return new vi(t,t,1)}}function ty(n,t,e,i){return typeof n=="number"&&n>=0&&n<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof e=="number"&&e>=0&&e<=255?typeof i>"u"||typeof i=="number"&&i>=0&&i<=1?null:`Invalid rgba value [${[n,t,e,i].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof i=="number"?[n,t,e,i]:[n,t,e]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Io(n){if(n===null||typeof n=="string"||typeof n=="boolean"||typeof n=="number"||n instanceof vi||n instanceof _t||n instanceof Tu||n instanceof cn||n instanceof yi||n instanceof _i||n instanceof We||n instanceof Vi||n instanceof Hn)return!0;if(Array.isArray(n)){for(const t of n)if(!Io(t))return!1;return!0}else if(typeof n=="object"){for(const t in n)if(!Io(n[t]))return!1;return!0}else return!1}function ee(n){if(n===null)return Dl;if(typeof n=="string")return nt;if(typeof n=="boolean")return ht;if(typeof n=="number")return G;if(n instanceof _t)return Gi;if(n instanceof vi)return Fl;if(n instanceof Tu)return Ll;if(n instanceof cn)return Ol;if(n instanceof yi)return zl;if(n instanceof _i)return kl;if(n instanceof We)return Co;if(n instanceof Vi)return Nl;if(n instanceof Hn)return bo;if(Array.isArray(n)){const t=n.length;let e;for(const i of n){const s=ee(i);if(!e)e=s;else{if(e===s)continue;e=ct;break}}return Ce(e||ct,t)}else return ws}function So(n){const t=typeof n;return n===null?"":t==="string"||t==="number"||t==="boolean"?String(n):n instanceof _t||n instanceof vi||n instanceof cn||n instanceof yi||n instanceof _i||n instanceof We||n instanceof Vi||n instanceof Hn?n.toString():JSON.stringify(n)}class fr{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(t.length!==2)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Io(t[1]))return e.error("invalid value");const i=t[1];let s=ee(i);const r=e.expectedType;return s.kind==="array"&&s.N===0&&r&&r.kind==="array"&&(typeof r.N!="number"||r.N===0)&&(s=r),new fr(s,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Vl={string:nt,number:G,boolean:ht,object:ws};class wi{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i=1,s;const r=t[0];if(r==="array"){let a;if(t.length>2){const c=t[1];if(typeof c!="string"||!(c in Vl)||c==="object")return e.error('The item type argument of "array" must be one of string, number, boolean',1);a=Vl[c],i++}else a=ct;let l;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);l=t[2],i++}s=Ce(a,l)}else{if(!Vl[r])throw new Error(`Types doesn't contain name = ${r}`);s=Vl[r]}const o=[];for(;i<t.length;i++){const a=e.parse(t[i],i,ct);if(!a)return null;o.push(a)}return new wi(s,o)}evaluate(t){for(let e=0;e<this.args.length;e++){const i=this.args[e].evaluate(t);if(Po(this.type,ee(i))){if(e===this.args.length-1)throw new Ut(`Expected value to be of type ${Gt(this.type)}, but found ${Gt(ee(i))} instead.`)}else return i}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const ey={"to-boolean":ht,"to-color":Gi,"to-number":G,"to-string":nt};class Bn{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[0];if(!ey[i])throw new Error(`Can't parse ${i} as it is not part of the known types`);if((i==="to-boolean"||i==="to-string")&&t.length!==2)return e.error("Expected one argument.");const s=ey[i],r=[];for(let o=1;o<t.length;o++){const a=e.parse(t[o],o,ct);if(!a)return null;r.push(a)}return new Bn(s,r)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let e,i;for(const s of this.args){if(e=s.evaluate(t),i=null,e instanceof _t)return e;if(typeof e=="string"){const r=t.parseColor(e);if(r)return r}else if(Array.isArray(e)&&(e.length<3||e.length>4?i=`Invalid rgba value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:i=ty(e[0],e[1],e[2],e[3]),!i))return new _t(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new Ut(i||`Could not parse color from value '${typeof e=="string"?e:JSON.stringify(e)}'`)}case"padding":{let e;for(const i of this.args){e=i.evaluate(t);const s=yi.parse(e);if(s)return s}throw new Ut(`Could not parse padding from value '${typeof e=="string"?e:JSON.stringify(e)}'`)}case"numberArray":{let e;for(const i of this.args){e=i.evaluate(t);const s=_i.parse(e);if(s)return s}throw new Ut(`Could not parse numberArray from value '${typeof e=="string"?e:JSON.stringify(e)}'`)}case"colorArray":{let e;for(const i of this.args){e=i.evaluate(t);const s=We.parse(e);if(s)return s}throw new Ut(`Could not parse colorArray from value '${typeof e=="string"?e:JSON.stringify(e)}'`)}case"variableAnchorOffsetCollection":{let e;for(const i of this.args){e=i.evaluate(t);const s=Vi.parse(e);if(s)return s}throw new Ut(`Could not parse variableAnchorOffsetCollection from value '${typeof e=="string"?e:JSON.stringify(e)}'`)}case"number":{let e=null;for(const i of this.args){if(e=i.evaluate(t),e===null)return 0;const s=Number(e);if(!isNaN(s))return s}throw new Ut(`Could not convert ${JSON.stringify(e)} to number.`)}case"formatted":return cn.fromString(So(this.args[0].evaluate(t)));case"resolvedImage":return Hn.fromString(So(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return So(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const HC=["Unknown","Point","LineString","Polygon"];class iy{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?HC[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache.get(t);return e||(e=_t.parse(t),this._parseColorCache.set(t,e)),e}}class Wl{constructor(t,e,i=[],s,r=new Cu,o=[]){this.registry=t,this.path=i,this.key=i.map(a=>`[${a}]`).join(""),this.scope=r,this.errors=o,this.expectedType=s,this._isConstant=e}parse(t,e,i,s,r={}){return e?this.concat(e,i,s)._parse(t,r):this._parse(t,r)}_parse(t,e){(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number")&&(t=["literal",t]);function i(s,r,o){return o==="assert"?new wi(r,[s]):o==="coerce"?new Bn(r,[s]):s}if(Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const s=t[0];if(typeof s!="string")return this.error(`Expression name must be a string, but found ${typeof s} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const r=this.registry[s];if(r){let o=r.parse(t,this);if(!o)return null;if(this.expectedType){const a=this.expectedType,l=o.type;if((a.kind==="string"||a.kind==="number"||a.kind==="boolean"||a.kind==="object"||a.kind==="array")&&l.kind==="value")o=i(o,a,e.typeAnnotation||"assert");else if(a.kind==="projectionDefinition"&&["string","array"].includes(l.kind)||["color","formatted","resolvedImage"].includes(a.kind)&&["value","string"].includes(l.kind)||["padding","numberArray"].includes(a.kind)&&["value","number","array"].includes(l.kind)||a.kind==="colorArray"&&["value","string","array"].includes(l.kind)||a.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(l.kind))o=i(o,a,e.typeAnnotation||"coerce");else if(this.checkSubtype(a,l))return null}if(!(o instanceof fr)&&o.type.kind!=="resolvedImage"&&this._isConstant(o)){const a=new iy;try{o=new fr(o.type,o.evaluate(a))}catch(l){return this.error(l.message),null}}return o}return this.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0)}else return typeof t>"u"?this.error("'undefined' value invalid. Use null instead."):typeof t=="object"?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof t} instead.`)}concat(t,e,i){const s=typeof t=="number"?this.path.concat(t):this.path,r=i?this.scope.concat(i):this.scope;return new Wl(this.registry,this._isConstant,s,e||null,r,this.errors)}error(t,...e){const i=`${this.key}${e.map(s=>`[${s}]`).join("")}`;this.errors.push(new Ni(i,t))}checkSubtype(t,e){const i=Po(t,e);return i&&this.error(i),i}}class Ul{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const i=[];for(let r=1;r<t.length-1;r+=2){const o=t[r];if(typeof o!="string")return e.error(`Expected string, but found ${typeof o} instead.`,r);if(/[^a-zA-Z0-9_]/.test(o))return e.error("Variable names must contain only alphanumeric characters or '_'.",r);const a=e.parse(t[r+1],r+1);if(!a)return null;i.push([o,a])}const s=e.parse(t[t.length-1],t.length-1,e.expectedType,i);return s?new Ul(i,s):null}outputDefined(){return this.result.outputDefined()}}class $l{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(t.length!==2||typeof t[1]!="string")return e.error("'var' expression requires exactly one string literal argument.");const i=t[1];return e.scope.has(i)?new $l(i,e.scope.get(i)):e.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class Au{constructor(t,e,i){this.type=t,this.index=e,this.input=i}static parse(t,e){if(t.length!==3)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,G),s=e.parse(t[2],2,Ce(e.expectedType||ct));if(!i||!s)return null;const r=s.type;return new Au(r.itemType,i,s)}evaluate(t){const e=this.index.evaluate(t),i=this.input.evaluate(t);if(e<0)throw new Ut(`Array index out of bounds: ${e} < 0.`);if(e>=i.length)throw new Ut(`Array index out of bounds: ${e} > ${i.length-1}.`);if(e!==Math.floor(e))throw new Ut(`Array index must be an integer, but found ${e} instead.`);return i[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class Du{constructor(t,e){this.type=ht,this.needle=t,this.haystack=e}static parse(t,e){if(t.length!==3)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,ct),s=e.parse(t[2],2,ct);return!i||!s?null:bu(i.type,[ht,nt,G,Dl,ct])?new Du(i,s):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${Gt(i.type)} instead`)}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!xs(e,["boolean","string","number","null"]))throw new Ut(`Expected first argument to be of type boolean, string, number or null, but found ${Gt(ee(e))} instead.`);if(!xs(i,["string","array"]))throw new Ut(`Expected second argument to be of type array or string, but found ${Gt(ee(i))} instead.`);return i.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class Xl{constructor(t,e,i){this.type=G,this.needle=t,this.haystack=e,this.fromIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,ct),s=e.parse(t[2],2,ct);if(!i||!s)return null;if(!bu(i.type,[ht,nt,G,Dl,ct]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${Gt(i.type)} instead`);if(t.length===4){const r=e.parse(t[3],3,G);return r?new Xl(i,s,r):null}else return new Xl(i,s)}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!xs(e,["boolean","string","number","null"]))throw new Ut(`Expected first argument to be of type boolean, string, number or null, but found ${Gt(ee(e))} instead.`);let s;if(this.fromIndex&&(s=this.fromIndex.evaluate(t)),xs(i,["string"])){const r=i.indexOf(e,s);return r===-1?-1:[...i.slice(0,r)].length}else{if(xs(i,["array"]))return i.indexOf(e,s);throw new Ut(`Expected second argument to be of type array or string, but found ${Gt(ee(i))} instead.`)}}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class Fu{constructor(t,e,i,s,r,o){this.inputType=t,this.type=e,this.input=i,this.cases=s,this.outputs=r,this.otherwise=o}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!==1)return e.error("Expected an even number of arguments.");let i,s;e.expectedType&&e.expectedType.kind!=="value"&&(s=e.expectedType);const r={},o=[];for(let c=2;c<t.length-1;c+=2){let h=t[c];const u=t[c+1];Array.isArray(h)||(h=[h]);const d=e.concat(c);if(h.length===0)return d.error("Expected at least one branch label.");for(const p of h){if(typeof p!="number"&&typeof p!="string")return d.error("Branch labels must be numbers or strings.");if(typeof p=="number"&&Math.abs(p)>Number.MAX_SAFE_INTEGER)return d.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof p=="number"&&Math.floor(p)!==p)return d.error("Numeric branch labels must be integer values.");if(!i)i=ee(p);else if(d.checkSubtype(i,ee(p)))return null;if(typeof r[String(p)]<"u")return d.error("Branch labels must be unique.");r[String(p)]=o.length}const g=e.parse(u,c,s);if(!g)return null;s=s||g.type,o.push(g)}const a=e.parse(t[1],1,ct);if(!a)return null;const l=e.parse(t[t.length-1],t.length-1,s);return!l||a.type.kind!=="value"&&e.concat(1).checkSubtype(i,a.type)?null:new Fu(i,s,a,r,o,l)}evaluate(t){const e=this.input.evaluate(t);return(ee(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}}class Lu{constructor(t,e,i){this.type=t,this.branches=e,this.otherwise=i}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!==0)return e.error("Expected an odd number of arguments.");let i;e.expectedType&&e.expectedType.kind!=="value"&&(i=e.expectedType);const s=[];for(let o=1;o<t.length-1;o+=2){const a=e.parse(t[o],o,ht);if(!a)return null;const l=e.parse(t[o+1],o+1,i);if(!l)return null;s.push([a,l]),i=i||l.type}const r=e.parse(t[t.length-1],t.length-1,i);if(!r)return null;if(!i)throw new Error("Can't infer output type");return new Lu(i,s,r)}evaluate(t){for(const[e,i]of this.branches)if(e.evaluate(t))return i.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,i]of this.branches)t(e),t(i);t(this.otherwise)}outputDefined(){return this.branches.every(([t,e])=>e.outputDefined())&&this.otherwise.outputDefined()}}class Yl{constructor(t,e,i,s){this.type=t,this.input=e,this.beginIndex=i,this.endIndex=s}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,ct),s=e.parse(t[2],2,G);if(!i||!s)return null;if(!bu(i.type,[Ce(ct),nt,ct]))return e.error(`Expected first argument to be of type array or string, but found ${Gt(i.type)} instead`);if(t.length===4){const r=e.parse(t[3],3,G);return r?new Yl(i.type,i,s,r):null}else return new Yl(i.type,i,s)}evaluate(t){const e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);let s;if(this.endIndex&&(s=this.endIndex.evaluate(t)),xs(e,["string"]))return[...e].slice(i,s).join("");if(xs(e,["array"]))return e.slice(i,s);throw new Ut(`Expected first argument to be of type array or string, but found ${Gt(ee(e))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function ny(n,t){const e=n.length-1;let i=0,s=e,r=0,o,a;for(;i<=s;)if(r=Math.floor((i+s)/2),o=n[r],a=n[r+1],o<=t){if(r===e||t<a)return r;i=r+1}else if(o>t)s=r-1;else throw new Ut("Input is not a number.");return 0}class Hl{constructor(t,e,i){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[s,r]of i)this.labels.push(s),this.outputs.push(r)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!==0)return e.error("Expected an even number of arguments.");const i=e.parse(t[1],1,G);if(!i)return null;const s=[];let r=null;e.expectedType&&e.expectedType.kind!=="value"&&(r=e.expectedType);for(let o=1;o<t.length;o+=2){const a=o===1?-1/0:t[o],l=t[o+1],c=o,h=o+1;if(typeof a!="number")return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',c);if(s.length&&s[s.length-1][0]>=a)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',c);const u=e.parse(l,h,r);if(!u)return null;r=r||u.type,s.push([a,u])}return new Hl(r,i,s)}evaluate(t){const e=this.labels,i=this.outputs;if(e.length===1)return i[0].evaluate(t);const s=this.input.evaluate(t);if(s<=e[0])return i[0].evaluate(t);const r=e.length;if(s>=e[r-1])return i[r-1].evaluate(t);const o=ny(e,s);return i[o].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function BC(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ou,sy;function ZC(){if(sy)return Ou;sy=1,Ou=n;function n(t,e,i,s){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(s-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=i,this.p2y=s}return n.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(e===void 0&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var i=t,s=0;s<8;s++){var r=this.sampleCurveX(i)-t;if(Math.abs(r)<e)return i;var o=this.sampleCurveDerivativeX(i);if(Math.abs(o)<1e-6)break;i=i-r/o}var a=0,l=1;for(i=t,s=0;s<20&&(r=this.sampleCurveX(i),!(Math.abs(r-t)<e));s++)t>r?a=i:l=i,i=(l-a)*.5+a;return i},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},Ou}var jC=ZC(),qC=BC(jC);class Wi{constructor(t,e,i,s,r){this.type=t,this.operator=e,this.interpolation=i,this.input=s,this.labels=[],this.outputs=[];for(const[o,a]of r)this.labels.push(o),this.outputs.push(a)}static interpolationFactor(t,e,i,s){let r=0;if(t.name==="exponential")r=zu(e,t.base,i,s);else if(t.name==="linear")r=zu(e,1,i,s);else if(t.name==="cubic-bezier"){const o=t.controlPoints;r=new qC(o[0],o[1],o[2],o[3]).solve(zu(e,1,i,s))}return r}static parse(t,e){let[i,s,r,...o]=t;if(!Array.isArray(s)||s.length===0)return e.error("Expected an interpolation type expression.",1);if(s[0]==="linear")s={name:"linear"};else if(s[0]==="exponential"){const c=s[1];if(typeof c!="number")return e.error("Exponential interpolation requires a numeric base.",1,1);s={name:"exponential",base:c}}else if(s[0]==="cubic-bezier"){const c=s.slice(1);if(c.length!==4||c.some(h=>typeof h!="number"||h<0||h>1))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);s={name:"cubic-bezier",controlPoints:c}}else return e.error(`Unknown interpolation type ${String(s[0])}`,1,0);if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!==0)return e.error("Expected an even number of arguments.");if(r=e.parse(r,2,G),!r)return null;const a=[];let l=null;(i==="interpolate-hcl"||i==="interpolate-lab")&&e.expectedType!=Co?l=Gi:e.expectedType&&e.expectedType.kind!=="value"&&(l=e.expectedType);for(let c=0;c<o.length;c+=2){const h=o[c],u=o[c+1],d=c+3,g=c+4;if(typeof h!="number")return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',d);if(a.length&&a[a.length-1][0]>=h)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',d);const p=e.parse(u,g,l);if(!p)return null;l=l||p.type,a.push([h,p])}return!Yn(l,G)&&!Yn(l,Fl)&&!Yn(l,Gi)&&!Yn(l,zl)&&!Yn(l,kl)&&!Yn(l,Co)&&!Yn(l,Nl)&&!Yn(l,Ce(G))?e.error(`Type ${Gt(l)} is not interpolatable.`):new Wi(l,i,s,r,a)}evaluate(t){const e=this.labels,i=this.outputs;if(e.length===1)return i[0].evaluate(t);const s=this.input.evaluate(t);if(s<=e[0])return i[0].evaluate(t);const r=e.length;if(s>=e[r-1])return i[r-1].evaluate(t);const o=ny(e,s),a=e[o],l=e[o+1],c=Wi.interpolationFactor(this.interpolation,s,a,l),h=i[o].evaluate(t),u=i[o+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Es(h,u,c);case"color":return _t.interpolate(h,u,c);case"padding":return yi.interpolate(h,u,c);case"colorArray":return We.interpolate(h,u,c);case"numberArray":return _i.interpolate(h,u,c);case"variableAnchorOffsetCollection":return Vi.interpolate(h,u,c);case"array":return Ro(h,u,c);case"projectionDefinition":return vi.interpolate(h,u,c)}case"interpolate-hcl":switch(this.type.kind){case"color":return _t.interpolate(h,u,c,"hcl");case"colorArray":return We.interpolate(h,u,c,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return _t.interpolate(h,u,c,"lab");case"colorArray":return We.interpolate(h,u,c,"lab")}}}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function zu(n,t,e,i){const s=i-e,r=n-e;return s===0?0:t===1?r/s:(Math.pow(t,r)-1)/(Math.pow(t,s)-1)}class To{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i=null;const s=e.expectedType;s&&s.kind!=="value"&&(i=s);const r=[];for(const a of t.slice(1)){const l=e.parse(a,1+r.length,i,void 0,{typeAnnotation:"omit"});if(!l)return null;i=i||l.type,r.push(l)}if(!i)throw new Error("No output type");return s&&r.some(a=>Po(s,a.type))?new To(ct,r):new To(i,r)}evaluate(t){let e=null,i=0,s;for(const r of this.args)if(i++,e=r.evaluate(t),e&&e instanceof Hn&&!e.available&&(s||(s=e.name),e=null,i===this.args.length&&(e=s)),e!==null)break;return e}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function ry(n,t){return n==="=="||n==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function KC(n,t,e){return t===e}function JC(n,t,e){return t!==e}function QC(n,t,e){return t<e}function tb(n,t,e){return t>e}function eb(n,t,e){return t<=e}function ib(n,t,e){return t>=e}function oy(n,t,e,i){return i.compare(t,e)===0}function nb(n,t,e,i){return!oy(n,t,e,i)}function sb(n,t,e,i){return i.compare(t,e)<0}function rb(n,t,e,i){return i.compare(t,e)>0}function ob(n,t,e,i){return i.compare(t,e)<=0}function ab(n,t,e,i){return i.compare(t,e)>=0}function gr(n,t,e){const i=n!=="=="&&n!=="!=";return class b0{constructor(r,o,a){this.type=ht,this.lhs=r,this.rhs=o,this.collator=a,this.hasUntypedArgument=r.type.kind==="value"||o.type.kind==="value"}static parse(r,o){if(r.length!==3&&r.length!==4)return o.error("Expected two or three arguments.");const a=r[0];let l=o.parse(r[1],1,ct);if(!l)return null;if(!ry(a,l.type))return o.concat(1).error(`"${a}" comparisons are not supported for type '${Gt(l.type)}'.`);let c=o.parse(r[2],2,ct);if(!c)return null;if(!ry(a,c.type))return o.concat(2).error(`"${a}" comparisons are not supported for type '${Gt(c.type)}'.`);if(l.type.kind!==c.type.kind&&l.type.kind!=="value"&&c.type.kind!=="value")return o.error(`Cannot compare types '${Gt(l.type)}' and '${Gt(c.type)}'.`);i&&(l.type.kind==="value"&&c.type.kind!=="value"?l=new wi(c.type,[l]):l.type.kind!=="value"&&c.type.kind==="value"&&(c=new wi(l.type,[c])));let h=null;if(r.length===4){if(l.type.kind!=="string"&&c.type.kind!=="string"&&l.type.kind!=="value"&&c.type.kind!=="value")return o.error("Cannot use collator to compare non-string types.");if(h=o.parse(r[3],3,Ll),!h)return null}return new b0(l,c,h)}evaluate(r){const o=this.lhs.evaluate(r),a=this.rhs.evaluate(r);if(i&&this.hasUntypedArgument){const l=ee(o),c=ee(a);if(l.kind!==c.kind||!(l.kind==="string"||l.kind==="number"))throw new Ut(`Expected arguments for "${n}" to be (string, string) or (number, number), but found (${l.kind}, ${c.kind}) instead.`)}if(this.collator&&!i&&this.hasUntypedArgument){const l=ee(o),c=ee(a);if(l.kind!=="string"||c.kind!=="string")return t(r,o,a)}return this.collator?e(r,o,a,this.collator.evaluate(r)):t(r,o,a)}eachChild(r){r(this.lhs),r(this.rhs),this.collator&&r(this.collator)}outputDefined(){return!0}}}const lb=gr("==",KC,oy),cb=gr("!=",JC,nb),hb=gr("<",QC,sb),ub=gr(">",tb,rb),db=gr("<=",eb,ob),fb=gr(">=",ib,ab);class Bl{constructor(t,e,i){this.type=Ll,this.locale=i,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(t.length!==2)return e.error("Expected one argument.");const i=t[1];if(typeof i!="object"||Array.isArray(i))return e.error("Collator options argument must be an object.");const s=e.parse(i["case-sensitive"]===void 0?!1:i["case-sensitive"],1,ht);if(!s)return null;const r=e.parse(i["diacritic-sensitive"]===void 0?!1:i["diacritic-sensitive"],1,ht);if(!r)return null;let o=null;return i.locale&&(o=e.parse(i.locale,1,nt),!o)?null:new Bl(s,r,o)}evaluate(t){return new Tu(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class ku{constructor(t,e,i,s,r,o){this.type=nt,this.number=t,this.locale=e,this.currency=i,this.unit=s,this.minFractionDigits=r,this.maxFractionDigits=o}static parse(t,e){if(t.length!==3)return e.error("Expected two arguments.");const i=e.parse(t[1],1,G);if(!i)return null;const s=t[2];if(typeof s!="object"||Array.isArray(s))return e.error("NumberFormat options argument must be an object.");let r=null;if(s.locale&&(r=e.parse(s.locale,1,nt),!r))return null;let o=null;if(s.currency&&(o=e.parse(s.currency,1,nt),!o))return null;let a=null;if(s.unit&&(a=e.parse(s.unit,1,nt),!a))return null;if(o&&a)return e.error("NumberFormat options `currency` and `unit` are mutually exclusive");let l=null;if(s["min-fraction-digits"]&&(l=e.parse(s["min-fraction-digits"],1,G),!l))return null;let c=null;return s["max-fraction-digits"]&&(c=e.parse(s["max-fraction-digits"],1,G),!c)?null:new ku(i,r,o,a,l,c)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class Nu{constructor(t){this.type=Ol,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[1];if(!Array.isArray(i)&&typeof i=="object")return e.error("First argument must be an image or text section.");const s=[];let r=!1;for(let o=1;o<=t.length-1;++o){const a=t[o];if(r&&typeof a=="object"&&!Array.isArray(a)){r=!1;let l=null;if(a["font-scale"]&&(l=e.parse(a["font-scale"],1,G),!l))return null;let c=null;if(a["text-font"]&&(c=e.parse(a["text-font"],1,Ce(nt)),!c))return null;let h=null;if(a["text-color"]&&(h=e.parse(a["text-color"],1,Gi),!h))return null;let u=null;if(a["vertical-align"]){if(typeof a["vertical-align"]=="string"&&!XC.includes(a["vertical-align"]))return e.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${a["vertical-align"]}' instead.`);if(u=e.parse(a["vertical-align"],1,nt),!u)return null}const d=s[s.length-1];d.scale=l,d.font=c,d.textColor=h,d.verticalAlign=u}else{const l=e.parse(t[o],1,ct);if(!l)return null;const c=l.type.kind;if(c!=="string"&&c!=="value"&&c!=="null"&&c!=="resolvedImage")return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");r=!0,s.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Nu(s)}evaluate(t){const e=i=>{const s=i.content.evaluate(t);return ee(s)===bo?new Mu("",s,null,null,null,i.verticalAlign?i.verticalAlign.evaluate(t):null):new Mu(So(s),null,i.scale?i.scale.evaluate(t):null,i.font?i.font.evaluate(t).join(","):null,i.textColor?i.textColor.evaluate(t):null,i.verticalAlign?i.verticalAlign.evaluate(t):null)};return new cn(this.sections.map(e))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor),e.verticalAlign&&t(e.verticalAlign)}outputDefined(){return!1}}class Gu{constructor(t){this.type=bo,this.input=t}static parse(t,e){if(t.length!==2)return e.error("Expected two arguments.");const i=e.parse(t[1],1,nt);return i?new Gu(i):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),i=Hn.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}}class Vu{constructor(t){this.type=G,this.input=t}static parse(t,e){if(t.length!==2)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const i=e.parse(t[1],1);return i?i.type.kind!=="array"&&i.type.kind!=="string"&&i.type.kind!=="value"?e.error(`Expected argument of type string or array, but found ${Gt(i.type)} instead.`):new Vu(i):null}evaluate(t){const e=this.input.evaluate(t);if(typeof e=="string")return[...e].length;if(Array.isArray(e))return e.length;throw new Ut(`Expected value to be of type string or array, but found ${Gt(ee(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const Ui=8192;function gb(n,t){const e=pb(n[0]),i=yb(n[1]),s=Math.pow(2,t.z);return[Math.round(e*s*Ui),Math.round(i*s*Ui)]}function Wu(n,t){const e=Math.pow(2,t.z),i=(n[0]/Ui+t.x)/e,s=(n[1]/Ui+t.y)/e;return[mb(i),_b(s)]}function pb(n){return(180+n)/360}function mb(n){return n*360-180}function yb(n){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n*Math.PI/360)))/360}function _b(n){return 360/Math.PI*Math.atan(Math.exp((180-n*360)*Math.PI/180))-90}function Mo(n,t){n[0]=Math.min(n[0],t[0]),n[1]=Math.min(n[1],t[1]),n[2]=Math.max(n[2],t[0]),n[3]=Math.max(n[3],t[1])}function Ao(n,t){return!(n[0]<=t[0]||n[2]>=t[2]||n[1]<=t[1]||n[3]>=t[3])}function vb(n,t,e){return t[1]>n[1]!=e[1]>n[1]&&n[0]<(e[0]-t[0])*(n[1]-t[1])/(e[1]-t[1])+t[0]}function wb(n,t,e){const i=n[0]-t[0],s=n[1]-t[1],r=n[0]-e[0],o=n[1]-e[1];return i*o-r*s===0&&i*r<=0&&s*o<=0}function Zl(n,t,e,i){const s=[t[0]-n[0],t[1]-n[1]],r=[i[0]-e[0],i[1]-e[1]];return bb(r,s)===0?!1:!!(ly(n,t,e,i)&&ly(e,i,n,t))}function xb(n,t,e){for(const i of e)for(let s=0;s<i.length-1;++s)if(Zl(n,t,i[s],i[s+1]))return!0;return!1}function pr(n,t,e=!1){let i=!1;for(const s of t)for(let r=0;r<s.length-1;r++){if(wb(n,s[r],s[r+1]))return e;vb(n,s[r],s[r+1])&&(i=!i)}return i}function Eb(n,t){for(const e of t)if(pr(n,e))return!0;return!1}function ay(n,t){for(const e of n)if(!pr(e,t))return!1;for(let e=0;e<n.length-1;++e)if(xb(n[e],n[e+1],t))return!1;return!0}function Cb(n,t){for(const e of t)if(ay(n,e))return!0;return!1}function bb(n,t){return n[0]*t[1]-n[1]*t[0]}function ly(n,t,e,i){const s=n[0]-e[0],r=n[1]-e[1],o=t[0]-e[0],a=t[1]-e[1],l=i[0]-e[0],c=i[1]-e[1],h=s*c-l*r,u=o*c-l*a;return h>0&&u<0||h<0&&u>0}function Uu(n,t,e){const i=[];for(let s=0;s<n.length;s++){const r=[];for(let o=0;o<n[s].length;o++){const a=gb(n[s][o],e);Mo(t,a),r.push(a)}i.push(r)}return i}function cy(n,t,e){const i=[];for(let s=0;s<n.length;s++){const r=Uu(n[s],t,e);i.push(r)}return i}function hy(n,t,e,i){if(n[0]<e[0]||n[0]>e[2]){const s=i*.5;let r=n[0]-e[0]>s?-i:e[0]-n[0]>s?i:0;r===0&&(r=n[0]-e[2]>s?-i:e[2]-n[0]>s?i:0),n[0]+=r}Mo(t,n)}function Pb(n){n[0]=n[1]=1/0,n[2]=n[3]=-1/0}function uy(n,t,e,i){const s=Math.pow(2,i.z)*Ui,r=[i.x*Ui,i.y*Ui],o=[];for(const a of n)for(const l of a){const c=[l.x+r[0],l.y+r[1]];hy(c,t,e,s),o.push(c)}return o}function dy(n,t,e,i){const s=Math.pow(2,i.z)*Ui,r=[i.x*Ui,i.y*Ui],o=[];for(const a of n){const l=[];for(const c of a){const h=[c.x+r[0],c.y+r[1]];Mo(t,h),l.push(h)}o.push(l)}if(t[2]-t[0]<=s/2){Pb(t);for(const a of o)for(const l of a)hy(l,t,e,s)}return o}function Rb(n,t){const e=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],s=n.canonicalID();if(t.type==="Polygon"){const r=Uu(t.coordinates,i,s),o=uy(n.geometry(),e,i,s);if(!Ao(e,i))return!1;for(const a of o)if(!pr(a,r))return!1}if(t.type==="MultiPolygon"){const r=cy(t.coordinates,i,s),o=uy(n.geometry(),e,i,s);if(!Ao(e,i))return!1;for(const a of o)if(!Eb(a,r))return!1}return!0}function Ib(n,t){const e=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],s=n.canonicalID();if(t.type==="Polygon"){const r=Uu(t.coordinates,i,s),o=dy(n.geometry(),e,i,s);if(!Ao(e,i))return!1;for(const a of o)if(!ay(a,r))return!1}if(t.type==="MultiPolygon"){const r=cy(t.coordinates,i,s),o=dy(n.geometry(),e,i,s);if(!Ao(e,i))return!1;for(const a of o)if(!Cb(a,r))return!1}return!0}class Cs{constructor(t,e){this.type=ht,this.geojson=t,this.geometries=e}static parse(t,e){if(t.length!==2)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Io(t[1])){const i=t[1];if(i.type==="FeatureCollection"){const s=[];for(const r of i.features){const{type:o,coordinates:a}=r.geometry;o==="Polygon"&&s.push(a),o==="MultiPolygon"&&s.push(...a)}if(s.length){const r={type:"MultiPolygon",coordinates:s};return new Cs(i,r)}}else if(i.type==="Feature"){const s=i.geometry.type;if(s==="Polygon"||s==="MultiPolygon")return new Cs(i,i.geometry)}else if(i.type==="Polygon"||i.type==="MultiPolygon")return new Cs(i,i)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return Rb(t,this.geometries);if(t.geometryType()==="LineString")return Ib(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class fy{constructor(t=[],e=(i,s)=>i<s?-1:i>s?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;const t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:i}=this,s=e[t];for(;t>0;){const r=t-1>>1,o=e[r];if(i(s,o)>=0)break;e[t]=o,t=r}e[t]=s}_down(t){const{data:e,compare:i}=this,s=this.length>>1,r=e[t];for(;t<s;){let o=(t<<1)+1;const a=o+1;if(a<this.length&&i(e[a],e[o])<0&&(o=a),i(e[o],r)>=0)break;e[t]=e[o],t=o}e[t]=r}}function Sb(n,t){if(n.length<=1)return[n];const i=[];let s,r;for(const o of n){const a=Tb(o);a!==0&&(o.area=Math.abs(a),r===void 0&&(r=a<0),r===a<0?(s&&i.push(s),s=[o]):s.push(o))}return s&&i.push(s),i}function Tb(n){let t=0;for(let e=0,i=n.length,s=i-1,r,o;e<i;s=e++)r=n[e],o=n[s],t+=(o.x-r.x)*(r.y+o.y);return t}const Mb=6378.137,gy=1/298.257223563,py=gy*(2-gy),my=Math.PI/180;class $u{constructor(t){const e=my*Mb*1e3,i=Math.cos(t*my),s=1/(1-py*(1-i*i)),r=Math.sqrt(s);this.kx=e*r*i,this.ky=e*r*s*(1-py)}distance(t,e){const i=this.wrap(t[0]-e[0])*this.kx,s=(t[1]-e[1])*this.ky;return Math.sqrt(i*i+s*s)}pointOnLine(t,e){let i=1/0,s,r,o,a;for(let l=0;l<t.length-1;l++){let c=t[l][0],h=t[l][1],u=this.wrap(t[l+1][0]-c)*this.kx,d=(t[l+1][1]-h)*this.ky,g=0;(u!==0||d!==0)&&(g=(this.wrap(e[0]-c)*this.kx*u+(e[1]-h)*this.ky*d)/(u*u+d*d),g>1?(c=t[l+1][0],h=t[l+1][1]):g>0&&(c+=u/this.kx*g,h+=d/this.ky*g)),u=this.wrap(e[0]-c)*this.kx,d=(e[1]-h)*this.ky;const p=u*u+d*d;p<i&&(i=p,s=c,r=h,o=l,a=g)}return{point:[s,r],index:o,t:Math.max(0,Math.min(1,a))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}const Xu=100,Yu=50;function yy(n,t){return t[0]-n[0]}function jl(n){return n[1]-n[0]+1}function hn(n,t){return n[1]>=n[0]&&n[1]<t}function Hu(n,t){if(n[0]>n[1])return[null,null];const e=jl(n);if(t){if(e===2)return[n,null];const s=Math.floor(e/2);return[[n[0],n[0]+s],[n[0]+s,n[1]]]}if(e===1)return[n,null];const i=Math.floor(e/2)-1;return[[n[0],n[0]+i],[n[0]+i+1,n[1]]]}function Bu(n,t){if(!hn(t,n.length))return[1/0,1/0,-1/0,-1/0];const e=[1/0,1/0,-1/0,-1/0];for(let i=t[0];i<=t[1];++i)Mo(e,n[i]);return e}function Zu(n){const t=[1/0,1/0,-1/0,-1/0];for(const e of n)for(const i of e)Mo(t,i);return t}function _y(n){return n[0]!==-1/0&&n[1]!==-1/0&&n[2]!==1/0&&n[3]!==1/0}function ju(n,t,e){if(!_y(n)||!_y(t))return NaN;let i=0,s=0;return n[2]<t[0]&&(i=t[0]-n[2]),n[0]>t[2]&&(i=n[0]-t[2]),n[1]>t[3]&&(s=n[1]-t[3]),n[3]<t[1]&&(s=t[1]-n[3]),e.distance([0,0],[i,s])}function bs(n,t,e){const i=e.pointOnLine(t,n);return e.distance(n,i.point)}function qu(n,t,e,i,s){const r=Math.min(bs(n,[e,i],s),bs(t,[e,i],s)),o=Math.min(bs(e,[n,t],s),bs(i,[n,t],s));return Math.min(r,o)}function Ab(n,t,e,i,s){if(!(hn(t,n.length)&&hn(i,e.length)))return 1/0;let o=1/0;for(let a=t[0];a<t[1];++a){const l=n[a],c=n[a+1];for(let h=i[0];h<i[1];++h){const u=e[h],d=e[h+1];if(Zl(l,c,u,d))return 0;o=Math.min(o,qu(l,c,u,d,s))}}return o}function Db(n,t,e,i,s){if(!(hn(t,n.length)&&hn(i,e.length)))return NaN;let o=1/0;for(let a=t[0];a<=t[1];++a)for(let l=i[0];l<=i[1];++l)if(o=Math.min(o,s.distance(n[a],e[l])),o===0)return o;return o}function Fb(n,t,e){if(pr(n,t,!0))return 0;let i=1/0;for(const s of t){const r=s[0],o=s[s.length-1];if(r!==o&&(i=Math.min(i,bs(n,[o,r],e)),i===0))return i;const a=e.pointOnLine(s,n);if(i=Math.min(i,e.distance(n,a.point)),i===0)return i}return i}function Lb(n,t,e,i){if(!hn(t,n.length))return NaN;for(let r=t[0];r<=t[1];++r)if(pr(n[r],e,!0))return 0;let s=1/0;for(let r=t[0];r<t[1];++r){const o=n[r],a=n[r+1];for(const l of e)for(let c=0,h=l.length,u=h-1;c<h;u=c++){const d=l[u],g=l[c];if(Zl(o,a,d,g))return 0;s=Math.min(s,qu(o,a,d,g,i))}}return s}function vy(n,t){for(const e of n)for(const i of e)if(pr(i,t,!0))return!0;return!1}function Ob(n,t,e,i=1/0){const s=Zu(n),r=Zu(t);if(i!==1/0&&ju(s,r,e)>=i)return i;if(Ao(s,r)){if(vy(n,t))return 0}else if(vy(t,n))return 0;let o=1/0;for(const a of n)for(let l=0,c=a.length,h=c-1;l<c;h=l++){const u=a[h],d=a[l];for(const g of t)for(let p=0,m=g.length,_=m-1;p<m;_=p++){const v=g[_],y=g[p];if(Zl(u,d,v,y))return 0;o=Math.min(o,qu(u,d,v,y,e))}}return o}function wy(n,t,e,i,s,r){if(!r)return;const o=ju(Bu(i,r),s,e);o<t&&n.push([o,r,[0,0]])}function ql(n,t,e,i,s,r,o){if(!r||!o)return;const a=ju(Bu(i,r),Bu(s,o),e);a<t&&n.push([a,r,o])}function Kl(n,t,e,i,s=1/0){let r=Math.min(i.distance(n[0],e[0][0]),s);if(r===0)return r;const o=new fy([[0,[0,n.length-1],[0,0]]],yy),a=Zu(e);for(;o.length>0;){const l=o.pop();if(l[0]>=r)continue;const c=l[1],h=t?Yu:Xu;if(jl(c)<=h){if(!hn(c,n.length))return NaN;if(t){const u=Lb(n,c,e,i);if(isNaN(u)||u===0)return u;r=Math.min(r,u)}else for(let u=c[0];u<=c[1];++u){const d=Fb(n[u],e,i);if(r=Math.min(r,d),r===0)return 0}}else{const u=Hu(c,t);wy(o,r,i,n,a,u[0]),wy(o,r,i,n,a,u[1])}}return r}function Jl(n,t,e,i,s,r=1/0){let o=Math.min(r,s.distance(n[0],e[0]));if(o===0)return o;const a=new fy([[0,[0,n.length-1],[0,e.length-1]]],yy);for(;a.length>0;){const l=a.pop();if(l[0]>=o)continue;const c=l[1],h=l[2],u=t?Yu:Xu,d=i?Yu:Xu;if(jl(c)<=u&&jl(h)<=d){if(!hn(c,n.length)&&hn(h,e.length))return NaN;let g;if(t&&i)g=Ab(n,c,e,h,s),o=Math.min(o,g);else if(t&&!i){const p=n.slice(c[0],c[1]+1);for(let m=h[0];m<=h[1];++m)if(g=bs(e[m],p,s),o=Math.min(o,g),o===0)return o}else if(!t&&i){const p=e.slice(h[0],h[1]+1);for(let m=c[0];m<=c[1];++m)if(g=bs(n[m],p,s),o=Math.min(o,g),o===0)return o}else g=Db(n,c,e,h,s),o=Math.min(o,g)}else{const g=Hu(c,t),p=Hu(h,i);ql(a,o,s,n,e,g[0],p[0]),ql(a,o,s,n,e,g[0],p[1]),ql(a,o,s,n,e,g[1],p[0]),ql(a,o,s,n,e,g[1],p[1])}}return o}function zb(n,t){const e=n.geometry(),i=e.flat().map(o=>Wu([o.x,o.y],n.canonical));if(e.length===0)return NaN;const s=new $u(i[0][1]);let r=1/0;for(const o of t){switch(o.type){case"Point":r=Math.min(r,Jl(i,!1,[o.coordinates],!1,s,r));break;case"LineString":r=Math.min(r,Jl(i,!1,o.coordinates,!0,s,r));break;case"Polygon":r=Math.min(r,Kl(i,!1,o.coordinates,s,r));break}if(r===0)return r}return r}function kb(n,t){const e=n.geometry(),i=e.flat().map(o=>Wu([o.x,o.y],n.canonical));if(e.length===0)return NaN;const s=new $u(i[0][1]);let r=1/0;for(const o of t){switch(o.type){case"Point":r=Math.min(r,Jl(i,!0,[o.coordinates],!1,s,r));break;case"LineString":r=Math.min(r,Jl(i,!0,o.coordinates,!0,s,r));break;case"Polygon":r=Math.min(r,Kl(i,!0,o.coordinates,s,r));break}if(r===0)return r}return r}function Nb(n,t){const e=n.geometry();if(e.length===0||e[0].length===0)return NaN;const i=Sb(e).map(o=>o.map(a=>a.map(l=>Wu([l.x,l.y],n.canonical)))),s=new $u(i[0][0][0][1]);let r=1/0;for(const o of t)for(const a of i){switch(o.type){case"Point":r=Math.min(r,Kl([o.coordinates],!1,a,s,r));break;case"LineString":r=Math.min(r,Kl(o.coordinates,!0,a,s,r));break;case"Polygon":r=Math.min(r,Ob(a,o.coordinates,s,r));break}if(r===0)return r}return r}function Ku(n){return n.type==="MultiPolygon"?n.coordinates.map(t=>({type:"Polygon",coordinates:t})):n.type==="MultiLineString"?n.coordinates.map(t=>({type:"LineString",coordinates:t})):n.type==="MultiPoint"?n.coordinates.map(t=>({type:"Point",coordinates:t})):[n]}class Ps{constructor(t,e){this.type=G,this.geojson=t,this.geometries=e}static parse(t,e){if(t.length!==2)return e.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Io(t[1])){const i=t[1];if(i.type==="FeatureCollection")return new Ps(i,i.features.map(s=>Ku(s.geometry)).flat());if(i.type==="Feature")return new Ps(i,Ku(i.geometry));if("type"in i&&"coordinates"in i)return new Ps(i,Ku(i))}return e.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return zb(t,this.geometries);if(t.geometryType()==="LineString")return kb(t,this.geometries);if(t.geometryType()==="Polygon")return Nb(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Do{constructor(t){this.type=ct,this.key=t}static parse(t,e){if(t.length!==2)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const i=t[1];return i==null?e.error("Global state property must be defined."):typeof i!="string"?e.error(`Global state property must be string, but found ${typeof t[1]} instead.`):new Do(i)}evaluate(t){var e;const i=(e=t.globals)===null||e===void 0?void 0:e.globalState;return!i||Object.keys(i).length===0?null:Km(i,this.key)}eachChild(){}outputDefined(){return!1}}const Ql={"==":lb,"!=":cb,">":ub,"<":hb,">=":fb,"<=":db,array:wi,at:Au,boolean:wi,case:Lu,coalesce:To,collator:Bl,format:Nu,image:Gu,in:Du,"index-of":Xl,interpolate:Wi,"interpolate-hcl":Wi,"interpolate-lab":Wi,length:Vu,let:Ul,literal:fr,match:Fu,number:wi,"number-format":ku,object:wi,slice:Yl,step:Hl,string:wi,"to-boolean":Bn,"to-color":Bn,"to-number":Bn,"to-string":Bn,var:$l,within:Cs,distance:Ps,"global-state":Do};class Ue{constructor(t,e,i,s){this.name=t,this.type=e,this._evaluate=i,this.args=s}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,e){const i=t[0],s=Ue.definitions[i];if(!s)return e.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const r=Array.isArray(s)?s[0]:s.type,o=Array.isArray(s)?[[s[1],s[2]]]:s.overloads,a=o.filter(([c])=>!Array.isArray(c)||c.length===t.length-1);let l=null;for(const[c,h]of a){l=new Wl(e.registry,tc,e.path,null,e.scope);const u=[];let d=!1;for(let g=1;g<t.length;g++){const p=t[g],m=Array.isArray(c)?c[g-1]:c.type,_=l.parse(p,1+u.length,m);if(!_){d=!0;break}u.push(_)}if(!d){if(Array.isArray(c)&&c.length!==u.length){l.error(`Expected ${c.length} arguments, but found ${u.length} instead.`);continue}for(let g=0;g<u.length;g++){const p=Array.isArray(c)?c[g]:c.type,m=u[g];l.concat(g+1).checkSubtype(p,m.type)}if(l.errors.length===0)return new Ue(i,r,h,u)}}if(a.length===1)e.errors.push(...l.errors);else{const h=(a.length?a:o).map(([d])=>Vb(d)).join(" | "),u=[];for(let d=1;d<t.length;d++){const g=e.parse(t[d],1+u.length);if(!g)return null;u.push(Gt(g.type))}e.error(`Expected arguments of type ${h}, but found (${u.join(", ")}) instead.`)}return null}static register(t,e){Ue.definitions=e;for(const i in e)t[i]=Ue}}function xy(n,[t,e,i,s]){t=t.evaluate(n),e=e.evaluate(n),i=i.evaluate(n);const r=s?s.evaluate(n):1,o=ty(t,e,i,r);if(o)throw new Ut(o);return new _t(t/255,e/255,i/255,r,!1)}function Ey(n,t){return n in t}function Ju(n,t){const e=t[n];return typeof e>"u"?null:e}function Gb(n,t,e,i){for(;e<=i;){const s=e+i>>1;if(t[s]===n)return!0;t[s]>n?i=s-1:e=s+1}return!1}function Rs(n){return{type:n}}Ue.register(Ql,{error:[FC,[nt],(n,[t])=>{throw new Ut(t.evaluate(n))}],typeof:[nt,[ct],(n,[t])=>Gt(ee(t.evaluate(n)))],"to-rgba":[Ce(G,4),[Gi],(n,[t])=>{const[e,i,s,r]=t.evaluate(n).rgb;return[e*255,i*255,s*255,r]}],rgb:[Gi,[G,G,G],xy],rgba:[Gi,[G,G,G,G],xy],has:{type:ht,overloads:[[[nt],(n,[t])=>Ey(t.evaluate(n),n.properties())],[[nt,ws],(n,[t,e])=>Ey(t.evaluate(n),e.evaluate(n))]]},get:{type:ct,overloads:[[[nt],(n,[t])=>Ju(t.evaluate(n),n.properties())],[[nt,ws],(n,[t,e])=>Ju(t.evaluate(n),e.evaluate(n))]]},"feature-state":[ct,[nt],(n,[t])=>Ju(t.evaluate(n),n.featureState||{})],properties:[ws,[],n=>n.properties()],"geometry-type":[nt,[],n=>n.geometryType()],id:[ct,[],n=>n.id()],zoom:[G,[],n=>n.globals.zoom],"heatmap-density":[G,[],n=>n.globals.heatmapDensity||0],elevation:[G,[],n=>n.globals.elevation||0],"line-progress":[G,[],n=>n.globals.lineProgress||0],accumulated:[ct,[],n=>n.globals.accumulated===void 0?null:n.globals.accumulated],"+":[G,Rs(G),(n,t)=>{let e=0;for(const i of t)e+=i.evaluate(n);return e}],"*":[G,Rs(G),(n,t)=>{let e=1;for(const i of t)e*=i.evaluate(n);return e}],"-":{type:G,overloads:[[[G,G],(n,[t,e])=>t.evaluate(n)-e.evaluate(n)],[[G],(n,[t])=>-t.evaluate(n)]]},"/":[G,[G,G],(n,[t,e])=>t.evaluate(n)/e.evaluate(n)],"%":[G,[G,G],(n,[t,e])=>t.evaluate(n)%e.evaluate(n)],ln2:[G,[],()=>Math.LN2],pi:[G,[],()=>Math.PI],e:[G,[],()=>Math.E],"^":[G,[G,G],(n,[t,e])=>Math.pow(t.evaluate(n),e.evaluate(n))],sqrt:[G,[G],(n,[t])=>Math.sqrt(t.evaluate(n))],log10:[G,[G],(n,[t])=>Math.log(t.evaluate(n))/Math.LN10],ln:[G,[G],(n,[t])=>Math.log(t.evaluate(n))],log2:[G,[G],(n,[t])=>Math.log(t.evaluate(n))/Math.LN2],sin:[G,[G],(n,[t])=>Math.sin(t.evaluate(n))],cos:[G,[G],(n,[t])=>Math.cos(t.evaluate(n))],tan:[G,[G],(n,[t])=>Math.tan(t.evaluate(n))],asin:[G,[G],(n,[t])=>Math.asin(t.evaluate(n))],acos:[G,[G],(n,[t])=>Math.acos(t.evaluate(n))],atan:[G,[G],(n,[t])=>Math.atan(t.evaluate(n))],min:[G,Rs(G),(n,t)=>Math.min(...t.map(e=>e.evaluate(n)))],max:[G,Rs(G),(n,t)=>Math.max(...t.map(e=>e.evaluate(n)))],abs:[G,[G],(n,[t])=>Math.abs(t.evaluate(n))],round:[G,[G],(n,[t])=>{const e=t.evaluate(n);return e<0?-Math.round(-e):Math.round(e)}],floor:[G,[G],(n,[t])=>Math.floor(t.evaluate(n))],ceil:[G,[G],(n,[t])=>Math.ceil(t.evaluate(n))],"filter-==":[ht,[nt,ct],(n,[t,e])=>n.properties()[t.value]===e.value],"filter-id-==":[ht,[ct],(n,[t])=>n.id()===t.value],"filter-type-==":[ht,[nt],(n,[t])=>n.geometryType()===t.value],"filter-<":[ht,[nt,ct],(n,[t,e])=>{const i=n.properties()[t.value],s=e.value;return typeof i==typeof s&&i<s}],"filter-id-<":[ht,[ct],(n,[t])=>{const e=n.id(),i=t.value;return typeof e==typeof i&&e<i}],"filter->":[ht,[nt,ct],(n,[t,e])=>{const i=n.properties()[t.value],s=e.value;return typeof i==typeof s&&i>s}],"filter-id->":[ht,[ct],(n,[t])=>{const e=n.id(),i=t.value;return typeof e==typeof i&&e>i}],"filter-<=":[ht,[nt,ct],(n,[t,e])=>{const i=n.properties()[t.value],s=e.value;return typeof i==typeof s&&i<=s}],"filter-id-<=":[ht,[ct],(n,[t])=>{const e=n.id(),i=t.value;return typeof e==typeof i&&e<=i}],"filter->=":[ht,[nt,ct],(n,[t,e])=>{const i=n.properties()[t.value],s=e.value;return typeof i==typeof s&&i>=s}],"filter-id->=":[ht,[ct],(n,[t])=>{const e=n.id(),i=t.value;return typeof e==typeof i&&e>=i}],"filter-has":[ht,[ct],(n,[t])=>t.value in n.properties()],"filter-has-id":[ht,[],n=>n.id()!==null&&n.id()!==void 0],"filter-type-in":[ht,[Ce(nt)],(n,[t])=>t.value.indexOf(n.geometryType())>=0],"filter-id-in":[ht,[Ce(ct)],(n,[t])=>t.value.indexOf(n.id())>=0],"filter-in-small":[ht,[nt,Ce(ct)],(n,[t,e])=>e.value.indexOf(n.properties()[t.value])>=0],"filter-in-large":[ht,[nt,Ce(ct)],(n,[t,e])=>Gb(n.properties()[t.value],e.value,0,e.value.length-1)],all:{type:ht,overloads:[[[ht,ht],(n,[t,e])=>t.evaluate(n)&&e.evaluate(n)],[Rs(ht),(n,t)=>{for(const e of t)if(!e.evaluate(n))return!1;return!0}]]},any:{type:ht,overloads:[[[ht,ht],(n,[t,e])=>t.evaluate(n)||e.evaluate(n)],[Rs(ht),(n,t)=>{for(const e of t)if(e.evaluate(n))return!0;return!1}]]},"!":[ht,[ht],(n,[t])=>!t.evaluate(n)],"is-supported-script":[ht,[nt],(n,[t])=>{const e=n.globals&&n.globals.isSupportedScript;return e?e(t.evaluate(n)):!0}],upcase:[nt,[nt],(n,[t])=>t.evaluate(n).toUpperCase()],downcase:[nt,[nt],(n,[t])=>t.evaluate(n).toLowerCase()],concat:[nt,Rs(ct),(n,t)=>t.map(e=>So(e.evaluate(n))).join("")],split:[Ce(nt),[nt,nt],(n,[t,e])=>t.evaluate(n).split(e.evaluate(n))],join:[nt,[Ce(nt),nt],(n,[t,e])=>t.evaluate(n).join(e.evaluate(n))],"resolved-locale":[nt,[Ll],(n,[t])=>t.evaluate(n).resolvedLocale()]});function Vb(n){return Array.isArray(n)?`(${n.map(Gt).join(", ")})`:`(${Gt(n.type)}...)`}function tc(n){if(n instanceof $l)return tc(n.boundExpression);if(n instanceof Ue&&n.name==="error")return!1;if(n instanceof Bl)return!1;if(n instanceof Cs)return!1;if(n instanceof Ps)return!1;if(n instanceof Do)return!1;const t=n instanceof Bn||n instanceof wi;let e=!0;return n.eachChild(i=>{t?e=e&&tc(i):e=e&&i instanceof fr}),e?Qu(n)&&ed(n,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function Qu(n){if(n instanceof Ue){if(n.name==="get"&&n.args.length===1)return!1;if(n.name==="feature-state")return!1;if(n.name==="has"&&n.args.length===1)return!1;if(n.name==="properties"||n.name==="geometry-type"||n.name==="id")return!1;if(/^filter-/.test(n.name))return!1}if(n instanceof Cs||n instanceof Ps)return!1;let t=!0;return n.eachChild(e=>{t&&!Qu(e)&&(t=!1)}),t}function td(n){if(n instanceof Ue&&n.name==="feature-state")return!1;let t=!0;return n.eachChild(e=>{t&&!td(e)&&(t=!1)}),t}function ed(n,t){if(n instanceof Ue&&t.indexOf(n.name)>=0)return!1;let e=!0;return n.eachChild(i=>{e&&!ed(i,t)&&(e=!1)}),e}function id(n){return{result:"success",value:n}}function mr(n){return{result:"error",value:n}}function Wb(n){return n["property-type"]==="data-driven"||n["property-type"]==="cross-faded-data-driven"}function Ub(n){return!!n.expression&&n.expression.parameters.indexOf("zoom")>-1}function $b(n){return!!n.expression&&n.expression.interpolated}function ec(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)&&ee(n)===ws}class Xb{constructor(t,e,i){this.expression=t,this._warningHistory={},this._evaluator=new iy,this._defaultValue=e?Hb(e):null,this._enumValues=e&&e.type==="enum"?e.values:null,this._globalState=i}evaluateWithoutErrorHandling(t,e,i,s,r,o){return this._globalState&&(t=yr(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=s,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(t,e,i,s,r,o){this._globalState&&(t=yr(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=s,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=o||null;try{const a=this.expression.evaluate(this._evaluator);if(a==null||typeof a=="number"&&a!==a)return this._defaultValue;if(this._enumValues&&!(a in this._enumValues))throw new Ut(`Expected value to be one of ${Object.keys(this._enumValues).map(l=>JSON.stringify(l)).join(", ")}, but found ${JSON.stringify(a)} instead.`);return a}catch(a){return this._warningHistory[a.message]||(this._warningHistory[a.message]=!0,typeof console<"u"&&console.warn(a.message)),this._defaultValue}}}function ic(n){return Array.isArray(n)&&n.length>0&&typeof n[0]=="string"&&n[0]in Ql}function Cy(n,t,e){const i=new Wl(Ql,tc,[],t?Yb(t):void 0),s=i.parse(n,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?id(new Xb(s,t,e)):mr(i.errors)}class by{constructor(t,e,i){this.kind=t,this._styleExpression=e,this.isStateDependent=t!=="constant"&&!td(e.expression),this.globalStateRefs=sc(e.expression),this._globalState=i}evaluateWithoutErrorHandling(t,e,i,s,r,o){return this._globalState&&(t=yr(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,i,s,r,o)}evaluate(t,e,i,s,r,o){return this._globalState&&(t=yr(t,this._globalState)),this._styleExpression.evaluate(t,e,i,s,r,o)}}class Py{constructor(t,e,i,s,r){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent=t!=="camera"&&!td(e.expression),this.globalStateRefs=sc(e.expression),this.interpolationType=s,this._globalState=r}evaluateWithoutErrorHandling(t,e,i,s,r,o){return this._globalState&&(t=yr(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,i,s,r,o)}evaluate(t,e,i,s,r,o){return this._globalState&&(t=yr(t,this._globalState)),this._styleExpression.evaluate(t,e,i,s,r,o)}interpolationFactor(t,e,i){return this.interpolationType?Wi.interpolationFactor(this.interpolationType,t,e,i):0}}function Ry(n,t,e){const i=Cy(n,t,e);if(i.result==="error")return i;const s=i.value.expression,r=Qu(s);if(!r&&!Wb(t))return mr([new Ni("","data expressions not supported")]);const o=ed(s,["zoom"]);if(!o&&!Ub(t))return mr([new Ni("","zoom expressions not supported")]);const a=nc(s);if(!a&&!o)return mr([new Ni("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(a instanceof Ni)return mr([a]);if(a instanceof Wi&&!$b(t))return mr([new Ni("",'"interpolate" expressions cannot be used with this property')]);if(!a)return id(r?new by("constant",i.value,e):new by("source",i.value,e));const l=a instanceof Wi?a.interpolation:void 0;return id(r?new Py("camera",i.value,a.labels,l,e):new Py("composite",i.value,a.labels,l,e))}function nc(n){let t=null;if(n instanceof Ul)t=nc(n.result);else if(n instanceof To){for(const e of n.args)if(t=nc(e),t)break}else(n instanceof Hl||n instanceof Wi)&&n.input instanceof Ue&&n.input.name==="zoom"&&(t=n);return t instanceof Ni||n.eachChild(e=>{const i=nc(e);i instanceof Ni?t=i:!t&&i?t=new Ni("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&i&&t!==i&&(t=new Ni("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function sc(n,t=new Set){return n instanceof Do&&t.add(n.key),n.eachChild(e=>{sc(e,t)}),t}function Yb(n){const t={color:Gi,string:nt,number:G,enum:nt,boolean:ht,formatted:Ol,padding:zl,numberArray:kl,colorArray:Co,projectionDefinition:Fl,resolvedImage:bo,variableAnchorOffsetCollection:Nl};return n.type==="array"?Ce(t[n.value]||ct,n.length):t[n.type]}function Hb(n){if(n.type==="color"&&ec(n.default))return new _t(0,0,0,0);switch(n.type){case"color":return _t.parse(n.default)||null;case"padding":return yi.parse(n.default)||null;case"numberArray":return _i.parse(n.default)||null;case"colorArray":return We.parse(n.default)||null;case"variableAnchorOffsetCollection":return Vi.parse(n.default)||null;case"projectionDefinition":return vi.parse(n.default)||null;default:return n.default===void 0?null:n.default}}function yr(n,t){const{zoom:e,heatmapDensity:i,elevation:s,lineProgress:r,isSupportedScript:o,accumulated:a}=n??{};return{zoom:e,heatmapDensity:i,elevation:s,lineProgress:r,isSupportedScript:o,accumulated:a,globalState:t}}function Iy(n){if(n===!0||n===!1)return!0;if(!Array.isArray(n)||n.length===0)return!1;switch(n[0]){case"has":return n.length>=2&&n[1]!=="$id"&&n[1]!=="$type";case"in":return n.length>=3&&(typeof n[1]!="string"||Array.isArray(n[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return n.length!==3||Array.isArray(n[1])||Array.isArray(n[2]);case"any":case"all":for(const t of n.slice(1))if(!Iy(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}const Bb={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Zb(n,t){if(n==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Iy(n)||(n=rc(n));const e=Cy(n,Bb,t);if(e.result==="error")throw new Error(e.value.map(i=>`${i.key}: ${i.message}`).join(", "));{const i=Sy(n);return{filter:(s,r,o)=>e.value.evaluate(s,r,{},o),needGeometry:i,getGlobalStateRefs:()=>sc(e.value.expression)}}}function jb(n,t){return n<t?-1:n>t?1:0}function Sy(n){if(!Array.isArray(n))return!1;if(n[0]==="within"||n[0]==="distance")return!0;for(let t=1;t<n.length;t++)if(Sy(n[t]))return!0;return!1}function rc(n){if(!n)return!0;const t=n[0];return n.length<=1?t!=="any":t==="=="?nd(n[1],n[2],"=="):t==="!="?oc(nd(n[1],n[2],"==")):t==="<"||t===">"||t==="<="||t===">="?nd(n[1],n[2],t):t==="any"?qb(n.slice(1)):t==="all"?["all"].concat(n.slice(1).map(rc)):t==="none"?["all"].concat(n.slice(1).map(rc).map(oc)):t==="in"?Ty(n[1],n.slice(2)):t==="!in"?oc(Ty(n[1],n.slice(2))):t==="has"?My(n[1]):t==="!has"?oc(My(n[1])):!0}function nd(n,t,e){switch(n){case"$type":return[`filter-type-${e}`,t];case"$id":return[`filter-id-${e}`,t];default:return[`filter-${e}`,n,t]}}function qb(n){return["any"].concat(n.map(rc))}function Ty(n,t){if(t.length===0)return!1;switch(n){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(e=>typeof e!=typeof t[0])?["filter-in-large",n,["literal",t.sort(jb)]]:["filter-in-small",n,["literal",t]]}}function My(n){switch(n){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",n]}}function oc(n){return["!",n]}function Fo(n){return typeof n=="object"?["literal",n]:n}function Ay(n,t){let e=n.stops;if(!e)return Kb(n,t);const i=e&&typeof e[0][0]=="object",s=i||n.property!==void 0,r=i||!s;return e=e.map(o=>!s&&t.tokens&&typeof o[1]=="string"?[o[0],eP(o[1])]:[o[0],Fo(o[1])]),i?Jb(n,t,e):r?tP(n,t,e):rd(n,t,e)}function Kb(n,t){const e=["get",n.property];if(n.default===void 0)return t.type==="string"?["string",e]:e;if(t.type==="enum")return["match",e,Object.keys(t.values),e,n.default];{const i=[t.type==="color"?"to-color":t.type,e,Fo(n.default)];return t.type==="array"&&i.splice(1,0,t.value,t.length||null),i}}function sd(n){switch(n.colorSpace){case"hcl":return"interpolate-hcl";case"lab":return"interpolate-lab";default:return"interpolate"}}function Jb(n,t,e){const i={},s={},r=[];for(let a=0;a<e.length;a++){const l=e[a],c=l[0].zoom;i[c]===void 0&&(i[c]={zoom:c,type:n.type,property:n.property,default:n.default},s[c]=[],r.push(c)),s[c].push([l[0].value,l[1]])}if(ad({},t)==="exponential"){const a=[sd(n),["linear"],["zoom"]];for(const l of r){const c=rd(i[l],t,s[l]);_r(a,l,c,!1)}return a}else{const a=["step",["zoom"]];for(const l of r){const c=rd(i[l],t,s[l]);_r(a,l,c,!0)}return od(a),a}}function Qb(n,t){if(n!==void 0)return n;if(t!==void 0)return t}function Dy(n,t){const e=Fo(Qb(n.default,t.default));return e===void 0&&t.type==="resolvedImage"?"":e}function rd(n,t,e){const i=ad(n,t),s=["get",n.property];if(i==="categorical"&&typeof e[0][0]=="boolean"){const r=["case"];for(const o of e)r.push(["==",s,o[0]],o[1]);return r.push(Dy(n,t)),r}else if(i==="categorical"){const r=["match",s];for(const o of e)_r(r,o[0],o[1],!1);return r.push(Dy(n,t)),r}else if(i==="interval"){const r=["step",["number",s]];for(const o of e)_r(r,o[0],o[1],!0);return od(r),n.default===void 0?r:["case",["==",["typeof",s],"number"],r,Fo(n.default)]}else if(i==="exponential"){const r=n.base!==void 0?n.base:1,o=[sd(n),r===1?["linear"]:["exponential",r],["number",s]];for(const a of e)_r(o,a[0],a[1],!1);return n.default===void 0?o:["case",["==",["typeof",s],"number"],o,Fo(n.default)]}else throw new Error(`Unknown property function type ${i}`)}function tP(n,t,e,i=["zoom"]){const s=ad(n,t);let r,o=!1;if(s==="interval")r=["step",i],o=!0;else if(s==="exponential"){const a=n.base!==void 0?n.base:1;r=[sd(n),a===1?["linear"]:["exponential",a],i]}else throw new Error(`Unknown zoom function type "${s}"`);for(const a of e)_r(r,a[0],a[1],o);return od(r),r}function od(n){n[0]==="step"&&n.length===3&&(n.push(0),n.push(n[3]))}function _r(n,t,e,i){n.length>3&&t===n[n.length-2]||(i&&n.length===2||n.push(t),n.push(e))}function ad(n,t){return n.type?n.type:t.expression.interpolated?"exponential":"interval"}function eP(n){const t=["concat"],e=/{([^{}]+)}/g;let i=0;for(let s=e.exec(n);s!==null;s=e.exec(n)){const r=n.slice(i,e.lastIndex-s[0].length);i=e.lastIndex,r.length>0&&t.push(r),t.push(["get",s[1]])}if(t.length===1)return n;if(i<n.length)t.push(n.slice(i));else if(t.length===2)return["to-string",t[1]];return t}const Fy=TC;var Ly={thin:100,hairline:100,"ultra-light":200,"extra-light":200,light:300,book:300,regular:400,normal:400,plain:400,roman:400,standard:400,medium:500,"semi-bold":600,"demi-bold":600,bold:700,"extra-bold":800,"ultra-bold":800,heavy:900,black:900,"heavy-black":900,fat:900,poster:900,"ultra-black":950,"extra-black":950},Lo=" ",Oy=/(italic|oblique)$/i,zy={};function ld(n,t,e){var i=zy[n];if(!i){Array.isArray(n)||(n=[n]);for(var s=400,r="normal",o=[],a,l,c=0,h=n.length;c<h;++c){var u=n[c],d=u.split(" "),g=d[d.length-1].toLowerCase();g=="normal"||g=="italic"||g=="oblique"?(r=l?r:g,l=!0,d.pop(),g=d[d.length-1].toLowerCase()):Oy.test(g)&&(g=g.replace(Oy,""),r=l?r:d[d.length-1].replace(g,""),l=!0);for(var p in Ly){var m=d.length>1?d[d.length-2].toLowerCase():"";if(g==p||g==p.replace("-","")||m+"-"+g==p){s=a?s:Ly[p],d.pop(),m&&p.startsWith(m)&&d.pop();break}}!a&&typeof g=="number"&&(s=g,a=!0);var _=d.join(Lo).replace("Klokantech Noto Sans","Noto Sans").replace("DIN Pro","Barlow").replace("Arial Unicode MS","Arial");_.indexOf(Lo)!==-1&&(_='"'+_+'"'),o.push(_)}i=zy[n]=[r,s,o]}return i[0]+Lo+i[1]+Lo+t+"px"+(e?"/"+e:"")+Lo+i[2]}function ky(n,[t,e,i,s]){t=t.evaluate(n),e=e.evaluate(n),i=i.evaluate(n);const r=s?s.evaluate(n):1;return _t.parse(`hsla(${t}, ${e}%, ${i}%, ${r})`)}function iP(n){const t=n[0]/255,e=n[1]/255,i=n[2]/255,s=n[3],r=Math.max(t,e,i),o=Math.min(t,e,i),a=(r+o)/2;let l,c;if(r===o)l=0,c=0;else{const h=r-o;switch(c=a>.5?h/(2-r-o):h/(r+o),r){case t:l=(e-i)/h+(e<i?6:0);break;case e:l=(i-t)/h+2;break;case i:l=(t-e)/h+4;break;default:l=0}l/=6}return[l*360,c*100,a*100,s]}function ac(n){if(Array.isArray(n)){if(n.length===0)return n;const t=n[0];if(t==="literal")return n;if(t==="image"&&n.length===3&&typeof n[2]=="object"&&n[2]!==null&&!Array.isArray(n[2]))return["image-config",ac(n[1]),["literal",n[2]]];const e=n.length;for(let i=1;i<e;++i){const s=n[i],r=ac(s);if(r!==s){const o=[t];for(let a=1;a<i;++a)o.push(n[a]);o.push(r);for(let a=i+1;a<e;++a)o.push(ac(n[a]));return o}}}return n}const Ny={},Is={zoom:0,distanceFromCenter:0};Ue.register(Ql,{...Ue.definitions,pitch:[{kind:"number"},[],n=>Is.pitch||0],"distance-from-center":[{kind:"number"},[],n=>Is.distanceFromCenter||0],"to-hsla":[{kind:"array",itemType:{kind:"number"},N:4},[{kind:"string"}],(n,[t])=>iP($a(t.evaluate(n)))],hsl:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"}],ky],hsla:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"},{kind:"number"}],ky],"image-config":[{kind:"value"},[{kind:"string"},{kind:"value"}],(n,[t,e])=>t.evaluate(n)],"measure-light":[{kind:"number"},[{kind:"value"}],()=>1],config:[{kind:"value"},[{kind:"string"}],(n,[t])=>{const e=Ny[t.evaluate(n)];return e===void 0?{}:e}]});const Gy="https://api.mapbox.com";function cd(n){const t="mapbox://";return n.indexOf(t)!==0?"":n.slice(t.length)}function nP(n,t,e){if(typeof n=="string")return[{id:"default",url:Vy(n,t,e)}];for(const i of n)i.url=Vy(i.url,t,e);return n}function Vy(n,t,e){const i=cd(n);if(!i)return decodeURI(new URL(n,e).href);const s="sprites/";if(i.indexOf(s)!==0)throw new Error(`unexpected sprites url: ${n}`);const r=i.slice(s.length);return`${Gy}/styles/v1/${r}/sprite?access_token=${t}`}function Wy(n,t){const e=cd(n);if(!e)return decodeURI(new URL(n,location.href).href);const i="styles/";if(e.indexOf(i)!==0)throw new Error(`unexpected style url: ${n}`);const s=e.slice(i.length);return`${Gy}/styles/v1/${s}?&access_token=${t}`}const sP=["a","b","c","d"];function lc(n,t,e,i){const s=new URL(n,i||location.href),r=cd(n);if(!r)return t?(s.searchParams.has(e)||s.searchParams.set(e,t),[decodeURI(s.href)]):[decodeURI(s.href)];if(r==="mapbox.satellite"){const o=globalThis.devicePixelRatio>=1.5?"@2x":"";return[`https://api.mapbox.com/v4/${r}/{z}/{x}/{y}${o}.webp?access_token=${t}`]}return sP.map(o=>`https://${o}.tiles.mapbox.com/v4/${r}/{z}/{x}/{y}.vector.pbf?access_token=${t}`)}const hd=Object.freeze({}),Uy={},$y={};let rP=0;function ud(n){return n.id||(n.id=rP++),n.id}function oP(n,t){return ud(n)+"."+at(t)}function aP(n){let t=Uy[n.id];return t||(t={},Uy[ud(n)]=t),t}function lP(n){let t=$y[n.id];return t||(t={},$y[ud(n)]=t),t}function dd(n){return n*Math.PI/180}const fd=(function(){const n=[];for(let t=78271.51696402048;n.length<=24;t/=2)n.push(t);return n})();function cc(n,t){if(typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof OffscreenCanvas<"u")return new OffscreenCanvas(n,t);const e=document.createElement("canvas");return e.width=n,e.height=t,e}function cP(n,t){let e=0;const i=t.length;for(;e<i;++e)if(t[e]<n&&e+1<i){const r=t[e]/t[e+1];return e+Math.log(t[e]/n)/Math.log(r)}return i-1}function hP(n,t){const e=Math.floor(n),i=Math.pow(2,n-e);return t[e]/i}const vr={};function wr(n,t,e={},i){if(t in vr)return i&&(i.url=vr[t][0].url),vr[t][1];const s=e.transformRequest&&e.transformRequest(t,n)||t,r=function(l){return delete vr[t],Promise.reject(new Error("Error fetching source "+t))},o=function(l){return delete vr[t],l.ok?l.json():Promise.reject(new Error("Error fetching source "+t))},a=Vs(()=>s).then(l=>l instanceof Response?(i&&(i.url=l.url),o(l)):(l instanceof Request||(l=new Request(l)),l.headers.get("Accept")||l.headers.set("Accept","application/json"),i&&(i.url=l.url),fetch(l).then(o).catch(r))).catch(r);return vr[t]=[s,a],a}function uP(n,t){if(typeof n=="string")if(n.trim().startsWith("{"))try{const e=JSON.parse(n);return Promise.resolve(e)}catch(e){return Promise.reject(e)}else return n=Wy(n,t.accessToken),wr("Style",n,t);else return Promise.resolve(n)}const Xy={};function dP(n,t,e={}){const i=[t,JSON.stringify(n)].toString();let s=Xy[i];if(!s||e.transformRequest){let r;e.transformRequest&&(r=(a,l)=>{const c=e.transformRequest&&e.transformRequest(l,"Tiles")||l;if(a instanceof Hi.VectorTile)a.setLoader((h,u,d)=>{const g=function(p){p.arrayBuffer().then(m=>{const v=a.getFormat().readFeatures(m,{extent:h,featureProjection:d});a.setFeatures(v)})};Vs(()=>c).then(p=>{if(p instanceof Response)return g(p);fetch(p).then(g).catch(m=>a.setState(W.ERROR))}).catch(p=>a.setState(W.ERROR))});else{const h=a.getImage();Vs(()=>c).then(u=>{if(typeof u=="string"){h.src=u;return}const d=g=>g.blob().then(p=>{const m=URL.createObjectURL(p);h.addEventListener("load",()=>URL.revokeObjectURL(m)),h.addEventListener("error",()=>URL.revokeObjectURL(m)),h.src=m});if(u instanceof Response)return d(u);fetch(u).then(d).catch(g=>a.setState(W.ERROR))}).catch(u=>a.setState(W.ERROR))}});const o=n.url;if(o&&!n.tiles){const a=lc(o,e.accessToken,e.accessTokenParam||"access_token",t||location.href);if(o.startsWith("mapbox://"))s=Promise.resolve({tileJson:Object.assign({},n,{url:void 0,tiles:a}),tileLoadFunction:r});else{const l={};s=wr("Source",a[0],e,l).then(function(c){return c.tiles=c.tiles.map(function(h){return c.scheme==="tms"&&(h=h.replace("{y}","{-y}")),lc(h,e.accessToken,e.accessTokenParam||"access_token",l.url)[0]}),Promise.resolve({tileJson:c,tileLoadFunction:r})})}}else n.tiles?(n=Object.assign({},n,{tiles:n.tiles.map(function(a){return n.scheme==="tms"&&(a=a.replace("{y}","{-y}")),lc(a,e.accessToken,e.accessTokenParam||"access_token",t||location.href)[0]})}),s=Promise.resolve({tileJson:Object.assign({},n),tileLoadFunction:r})):s=Promise.reject(new Error("source has no `tiles` nor `url`"));Xy[i]=s}return s}function Yy(n,t,e,i){const s=[2*e*t.pixelRatio+t.width,2*e*t.pixelRatio+t.height],r=cc(s[0],s[1]),o=r.getContext("2d");o.drawImage(n,t.x,t.y,t.width,t.height,e*t.pixelRatio,e*t.pixelRatio,t.width,t.height);const a=o.getImageData(0,0,s[0],s[1]);o.globalCompositeOperation="destination-over",o.fillStyle=`rgba(${i.r*255},${i.g*255},${i.b*255},${i.a})`;const l=a.data;for(let c=0,h=a.width;c<h;++c)for(let u=0,d=a.height;u<d;++u){const g=(u*h+c)*4;l[g+3]>0&&o.arc(c,u,e*t.pixelRatio,0,2*Math.PI)}return o.fill(),r}function fP(n,t,e){const i=Math.max(0,Math.min(1,(e-n)/(t-n)));return i*i*(3-2*i)}function Hy(n,t,e){const i=cc(t.width,t.height),s=i.getContext("2d");s.drawImage(n,t.x,t.y,t.width,t.height,0,0,t.width,t.height);const r=s.getImageData(0,0,t.width,t.height),o=r.data;for(let a=0,l=r.width;a<l;++a)for(let c=0,h=r.height;c<h;++c){const u=(c*l+a)*4,d=o[u+3]/255,g=.75,p=.1,m=fP(g-p,g+p,d);m>0?(o[u+0]=Math.round(255*e.r*m),o[u+1]=Math.round(255*e.g*m),o[u+2]=Math.round(255*e.b*m),o[u+3]=Math.round(255*m)):o[u+3]=0}return s.putImageData(r,0,0),i}const gP=Array(256).join(" ");function gd(n,t){if(t>=.05){let e="";const i=n.split(`
|
|
116
|
+
`),s=gP.slice(0,Math.round(t/.1));for(let r=0,o=i.length;r<o;++r)r>0&&(e+=`
|
|
117
|
+
`),e+=i[r].split("").join(s);return e}return n}let pd;function By(){return pd||(pd=cc(1,1).getContext("2d")),pd}function pP(n,t){if(/\d+ \d+/.test(n)){const[e,i]=n.split(" ").map(Number);return e<=t&&t<=i}return n==t}function Ss(n,t){return By().measureText(n).width+(n.length-1)*t}const hc={};ds.on("propertychange",()=>{for(const n in hc)delete hc[n]});function md(n,t,e,i){if(n.indexOf(`
|
|
118
|
+
`)!==-1){const o=n.split(`
|
|
119
|
+
`),a=[];for(let l=0,c=o.length;l<c;++l)a.push(md(o[l],t,e,i));return a.join(`
|
|
120
|
+
`)}const s=e+","+t+","+n+","+i;let r=hc[s];if(!r){const o=n.split(" ");if(o.length>1){const a=By();a.font=t;const c=a.measureText("M").width*e;let h="";const u=[];for(let d=0,g=o.length;d<g;++d){const p=o[d],m=h+(h?" ":"")+p;Ss(m,i)<=c?h=m:(h&&u.push(h),h=p)}h&&u.push(h);for(let d=0,g=u.length;d<g&&g>1;++d){const p=u[d];if(Ss(p,i)<c*.35){const m=d>0?Ss(u[d-1],i):1/0,_=d<g-1?Ss(u[d+1],i):1/0;u.splice(d,1),g-=1,m<_?(u[d-1]+=" "+p,d-=1):u[d]=p+" "+u[d]}}for(let d=0,g=u.length-1;d<g;++d){const p=u[d],m=u[d+1];if(Ss(p,i)>c*.7&&Ss(m,i)<c*.6){const _=p.split(" "),v=_.pop();Ss(v,i)<c*.2&&(u[d]=_.join(" "),u[d+1]=v+" "+m),g-=1}}r=u.join(`
|
|
121
|
+
`)}else r=n;r=gd(r,i),hc[s]=r}return r}const mP=["Arial","Courier New","Times New Roman","Verdana","sans-serif","serif","monospace","cursive","fantasy"],Zy={};function yP(n,t="https://cdn.jsdelivr.net/npm/@fontsource/{font-family}/{fontweight}{-fontstyle}.css"){if(Ae)return n;let e;for(let i=0,s=n.length;i<s;++i){const r=n[i];if(r in Zy)continue;Zy[r]=!0;const a=ld(r,16).split(" ");e||(e=[]),e.push([a.slice(3).join(" ").replace(/"/g,""),a[1],a[0]])}return e&&(async()=>{await document.fonts.ready;for(let i=0,s=e.length;i<s;++i){const r=e[i],o=r[0];if(mP.includes(o))continue;const a=r[1],l=r[2];if(!(await document.fonts.load(`${l} ${a} 16px "${o}"`)).some(h=>h.family.replace(/^['"]|['"]$/g,"").toLowerCase()===o.toLowerCase()&&pP(h.weight,a)&&h.style===l)){const h=t.replace("{font-family}",o.replace(/ /g,"-").toLowerCase()).replace("{Font+Family}",o.replace(/ /g,"+")).replace("{fontweight}",a).replace("{-fontstyle}",l.replace("normal","").replace(/(.+)/,"-$1")).replace("{fontstyle}",l);if(!document.querySelector('link[href="'+h+'"]')){const u=document.createElement("link");u.href=h,u.rel="stylesheet",document.head.appendChild(u)}}}})(),n}const _P={Point:1,MultiPoint:1,LineString:2,MultiLineString:2,Polygon:3,MultiPolygon:3},vP={center:[.5,.5],left:[0,.5],right:[1,.5],top:[.5,0],bottom:[.5,1],"top-left":[0,0],"top-right":[1,0],"bottom-left":[0,1],"bottom-right":[1,1]},jy=function(n,t){let e=Ry(n,t);if(e.result==="error"){const i=ac(n);i!==n&&(e=Ry(i,t))}if(e.result==="error"){const i=e.value[0];return console.error("Error parsing expression:",n,i.key,i.message),{evaluate:()=>t.default}}return e.value};let uc,yd;function j(n,t,e,i,s,r){const o=n.id;s||(s={},console.warn("No functionCache provided to getValue()")),s[o]||(s[o]={});const a=s[o];if(!a[e]){let l=(n[t]||hd)[e];const c=Fy[`${t}_${n.type}`]&&Fy[`${t}_${n.type}`][e];l===void 0&&c&&(l=c.default);let h=ic(l);if(!h&&ec(l)&&(l=Ay(l,c),h=!0),h){const u=jy(l,c);a[e]=u.evaluate.bind(u)}else{const u=c?c.type:typeof l;(u==="color"||u==="colorArray")&&(l=_t.parse(l));let d=!1;if(u==="array")for(let g=0;g<l.length;++g){const p=l[g];if(ic(p)||ec(p)){d=!0;break}}if(d){const g=Object.assign({},c,{type:c.value}),p=[];for(let m=0;m<l.length;++m){let _=l[m];if(!ic(_)&&ec(_)&&(_=Ay(_,g)),ic(_)){const v=jy(_,g);p.push(v.evaluate.bind(v))}else p.push(function(){return _})}a[e]=function(m,_,v){const y=[];for(let w=0;w<p.length;++w)y[w]=p[w](m,_,v);return y}}else a[e]=function(){return l}}}return a[e](Is,i,r)}function qy(n,t,e,i){return j(n,"layout",`${e}-allow-overlap`,t,i)?j(n,"layout",`${e}-ignore-placement`,t,i)?"none":"obstacle":"declutter"}function wP(n,t,e,i){if(i||console.warn("No filterCache provided to evaluateFilter()"),!(n in i))try{i[n]=Zb(t).filter}catch(s){console.warn("Filter will evaluate to false: "+s.message),i[n]=function(){return!1}}return i[n](Is,e)}function Ts(n,t){if(n){if(n.a===0||t===0)return;const e=n.a;return t=t===void 0?1:t,e===0?"transparent":"rgba("+Math.round(n.r*255/e)+","+Math.round(n.g*255/e)+","+Math.round(n.b*255/e)+","+e*t+")"}return n}const xP=/\{[^{}}]*\}/g;function _d(n,t){return n.replace(xP,function(e){return t[e.slice(1,-1)]||""})}function Ky(n,t){let e=n.split(":")[0];return e===n&&(e="default"),t[e]}const EP={};function CP(n,t,e,i=fd,s=void 0,r=void 0,o=void 0,a=void 0){if(typeof t=="string"&&(t=JSON.parse(t)),t.schema)for(const w in t.schema){const x=t.schema[w];"default"in x&&(Ny[w]=x.default)}if(t.version!=8)throw new Error("glStyle version 8 required.");EP[oP(t,n)]=Array.from(arguments);const l={};(typeof r=="string"||r instanceof Request||r instanceof Response||r instanceof Promise)&&(r={default:r});for(const w in r){const x=r[w];Vs(()=>x).then(async C=>{let P;if(typeof Image<"u"){const b=new Image;if(typeof C=="string")b.crossOrigin="anonymous",b.src=C;else{let R;C instanceof Request?R=await fetch(C):C instanceof Response&&(R=C);const I=await R.blob();P=URL.createObjectURL(I),b.src=P}b.addEventListener("load",function R(){b.removeEventListener("load",R),l[w]={image:b,size:[b.width,b.height]},n.changed(),P&&URL.revokeObjectURL(P)}),b.addEventListener("error",function R(){URL.revokeObjectURL(P),b.removeEventListener("error",R)})}else if(typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope){const b=self;b.postMessage({action:"loadImage",src:C}),b.addEventListener("message",function(I){I.data.action==="imageLoaded"&&I.data.src===C&&(l[w]={image:I.data.image,size:[I.data.image.width,I.data.image.height]})})}})}const c=DC(t.layers),h={},u=[],d={},g={},p=aP(t),m=lP(t);let _;for(let w=0,x=c.length;w<x;++w){const C=c[w],P=C.id;if(typeof e=="string"&&C.source==e||Array.isArray(e)&&e.indexOf(P)!==-1){const b=C["source-layer"];if(_){if(C.source!==_)throw new Error(`Layer "${P}" does not use source "${_}`)}else{_=C.source;const I=t.sources[_];if(!I)throw new Error(`Source "${_}" is not defined`);const S=I.type;if(S!=="vector"&&S!=="geojson")throw new Error(`Source "${_}" is not of type "vector" or "geojson", but "${S}"`)}let R=h[b];R||(R=[],h[b]=R),R.push({layer:C,index:w}),u.push(P)}}const v=[],y=function(w,x,C){var U,N,$;const P=(($=(N=(U=n.getSource)==null?void 0:U.call(n))==null?void 0:N.format_)==null?void 0:$.layerName_)??"mvt:layer",b=w.getProperties(),R=h[b[P]];if(!R)return;let I=i.indexOf(x);I==-1&&(I=cP(x,i)),Is.zoom=I,Is.distanceFromCenter=0;const S=w.getGeometry(),F=_P[S.getType()],k=n.get("map");if(k&&k instanceof bp&&F===1){const X=k.getSize();if(X){const Z=k.getView().getCenter(),J=He(S.getExtent());Is.distanceFromCenter=X0(Z,J)/x/X[1]}}const T={id:w.getId(),properties:b,type:F},L=n.get("mapbox-featurestate")[w.getId()];let A=-1;for(let X=0,Z=R.length;X<Z;++X){const J=R[X],O=J.layer,gt=O.id;if(C!==void 0&&C!==gt)continue;const B=O.layout||hd,D=O.paint||hd;if(j(O,"layout","visibility",T,p,L)==="none"||"minzoom"in O&&I<O.minzoom||"maxzoom"in O&&I>=O.maxzoom)continue;const H=O.filter;if(!H||wP(gt,H,T,m)){let lt,It,$t,Kt,Jt,V;const Ye=J.index;if(F==3&&(O.type=="fill"||O.type=="fill-extrusion")){if(It=j(O,"paint",O.type+"-opacity",T,p,L),O.type+"-pattern"in D){const xt=j(O,"paint",O.type+"-pattern",T,p,L);if(xt){const vt=typeof xt=="string"?_d(xt,b):xt.toString(),pt=Ky(vt,l);if(s&&s[vt]&&pt){++A,V=v[A],(!V||!V.getFill()||V.getStroke()||V.getText())&&(V=new Pt({fill:new Ht}),v[A]=V),$t=V.getFill(),V.setZIndex(Ye);const q=vt+"."+It;let Tt=g[q];if(!Tt){const rt=s[vt],ot=cc(rt.width,rt.height),bt=ot.getContext("2d");bt.globalAlpha=It,bt.drawImage(pt.image,rt.x,rt.y,rt.width,rt.height,0,0,rt.width,rt.height),Tt=bt.createPattern(ot,"repeat"),g[q]=Tt}$t.setColor(Tt)}}}else if(lt=Ts(j(O,"paint",O.type+"-color",T,p,L),It),O.type+"-outline-color"in D&&(Jt=Ts(j(O,"paint",O.type+"-outline-color",T,p,L),It)),Jt||(Jt=lt),lt||Jt){if(++A,V=v[A],(!V||lt&&!V.getFill()||!lt&&V.getFill()||Jt&&!V.getStroke()||!Jt&&V.getStroke()||V.getText())&&(V=new Pt({fill:lt?new Ht:void 0,stroke:Jt?new te:void 0}),v[A]=V),lt&&($t=V.getFill(),$t.setColor(lt)),O.type==="fill-extrusion"){const xt=j(O,"paint","fill-extrusion-height",T,p,L);if(xt>0){const vt=Math.max(.1,.9-Math.min(xt,225)/280);if(Jt&&Jt!=="transparent"){const pt=_t.parse(Jt);Jt=`rgba(${Math.round(pt.r*255*vt)},${Math.round(pt.g*255*vt)},${Math.round(pt.b*255*vt)},${pt.a})`}}}Jt&&(Kt=V.getStroke(),Kt.setColor(Jt),Kt.setWidth(.5)),V.setZIndex(Ye)}}if(F!=1&&O.type=="line"){"line-pattern"in D?lt=void 0:lt=Ts(j(O,"paint","line-color",T,p,L),j(O,"paint","line-opacity",T,p,L));const xt=j(O,"paint","line-width",T,p,L);lt&&xt>0&&(++A,V=v[A],(!V||!V.getStroke()||V.getFill()||V.getText())&&(V=new Pt({stroke:new te}),v[A]=V),Kt=V.getStroke(),Kt.setLineCap(j(O,"layout","line-cap",T,p,L)),Kt.setLineJoin(j(O,"layout","line-join",T,p,L)),Kt.setMiterLimit(j(O,"layout","line-miter-limit",T,p,L)),Kt.setColor(lt),Kt.setWidth(xt),Kt.setLineDash(D["line-dasharray"]?j(O,"paint","line-dasharray",T,p,L).map(function(vt){return vt*xt}):null),Kt.setOffset(j(O,"paint","line-offset",T,p,L)),V.setZIndex(Ye))}let le=!1,st=null,Pe=0,ge,Xt,se;if((F==1||F==2)&&"icon-image"in B){const xt=j(O,"layout","icon-image",T,p,L);if(xt){ge=typeof xt=="string"?_d(xt,b):xt.toString();let vt;const pt=a?a(n,ge):void 0,q=Ky(ge,l);if(s&&s[ge]&&q||pt){const Tt=j(O,"layout","icon-rotation-alignment",T,p,L);if(F==2){const rt=w.getGeometry();if(rt.getFlatMidpoint||rt.getFlatMidpoints){const ot=rt.getExtent();if(Math.sqrt(Math.max(Math.pow((ot[2]-ot[0])/x,2),Math.pow((ot[3]-ot[1])/x,2)))>150){const Zt=rt.getType()==="MultiLineString"?rt.getFlatMidpoints():rt.getFlatMidpoint();if(yd||(uc=[NaN,NaN],yd=new _e("Point",uc,[],2,{},void 0)),vt=yd,uc[0]=Zt[0],uc[1]=Zt[1],j(O,"layout","symbol-placement",T,p,L)==="line"&&Tt==="map"){const pe=rt.getStride(),zt=rt.getFlatCoordinates();for(let re=0,Ft=zt.length-pe;re<Ft;re+=pe){const me=zt[re],ce=zt[re+1],Qt=zt[re+pe],At=zt[re+pe+1],ie=Math.min(me,Qt),Xi=Math.max(me,Qt),oi=Zt[0],Oe=Zt[1],yn=(At-ce)*(oi-me)-(Qt-me)*(Oe-ce);if(Math.abs(yn)<.001&&oi<=Xi&&oi>=ie){Pe=Math.atan2(ce-At,Qt-me);break}}}}}}if(F!==2||vt){const rt=j(O,"layout","icon-size",T,p,L),ot=D["icon-color"]!==void 0?j(O,"paint","icon-color",T,p,L):null;if(!ot||ot.a!==0){const bt=j(O,"paint","icon-halo-color",T,p,L),Zt=j(O,"paint","icon-halo-width",T,p,L);let Re=`${ge}.${rt}.${Zt}.${bt}`;if(ot!==null&&(Re+=`.${ot}`),Xt=d[Re],!Xt){const pe=qy(O,T,"icon",p);let zt;"icon-offset"in B&&(zt=j(O,"layout","icon-offset",T,p,L).slice(0),zt[0]*=rt,zt[1]*=-rt);let re=ot?[ot.r*255,ot.g*255,ot.b*255,ot.a]:void 0;if(pt){const Ft={color:re,rotateWithView:Tt==="map",displacement:zt,declutterMode:pe,scale:rt};typeof pt=="string"?Ft.src=pt:(Ft.img=pt,Ft.imgSize=[pt.width,pt.height]),Xt=new Dn(Ft)}else{const Ft=s[ge];let me,ce,Qt;if(Zt)Ft.sdf?(me=Yy(Hy(q.image,Ft,ot||[0,0,0,1]),{x:0,y:0,width:Ft.width,height:Ft.height,pixelRatio:Ft.pixelRatio},Zt,bt),re=void 0):me=Yy(q.image,Ft,Zt,bt);else{if(Ft.sdf&&!q.unSDFed){const At=Hy(q.image,{x:0,y:0,width:q.size[0],height:q.size[1]},{r:1,g:1,b:1});q.image=At,q.unSDFed=!0}me=q.image,ce=[Ft.width,Ft.height],Qt=[Ft.x,Ft.y]}Xt=new Dn({color:re,img:me,imgSize:q.size,size:ce,offset:Qt,rotateWithView:Tt==="map",scale:rt/Ft.pixelRatio,displacement:zt,declutterMode:pe})}d[Re]=Xt}}Xt&&(++A,V=v[A],(!V||!V.getImage()||V.getFill()||V.getStroke())&&(V=new Pt,v[A]=V),V.setGeometry(vt),Xt.setRotation(Pe+dd(j(O,"layout","icon-rotate",T,p,L))),Xt.setOpacity(j(O,"paint","icon-opacity",T,p,L)),Xt.setAnchor(vP[j(O,"layout","icon-anchor",T,p,L)]),V.setImage(Xt),st=V.getText(),V.setText(void 0),V.setZIndex(Ye),le=!0,se=!1)}else se=!0}}}if(F==1&&O.type==="circle"){++A,V=v[A],(!V||!V.getImage()||V.getFill()||V.getStroke())&&(V=new Pt,v[A]=V);const xt="circle-radius"in D?j(O,"paint","circle-radius",T,p,L):5,vt=Ts(j(O,"paint","circle-stroke-color",T,p,L),j(O,"paint","circle-stroke-opacity",T,p,L)),pt=j(O,"paint","circle-translate",T,p,L),q=Ts(j(O,"paint","circle-color",T,p,L),j(O,"paint","circle-opacity",T,p,L)),Tt=j(O,"paint","circle-stroke-width",T,p,L),rt=xt+"."+vt+"."+q+"."+Tt+"."+pt[0]+"."+pt[1];Xt=d[rt],Xt||(Xt=new Qe({radius:xt,displacement:[pt[0],-pt[1]],stroke:vt&&Tt>0?new te({width:Tt,color:vt}):void 0,fill:q?new Ht({color:q}):void 0,declutterMode:"none"}),d[rt]=Xt),V.setImage(Xt),st=V.getText(),V.setText(void 0),V.setGeometry(void 0),V.setZIndex(Ye),le=!0}let Mt,ni,Dt,si,ri,bi;if("text-field"in B){si=Math.round(j(O,"layout","text-size",T,p,L));const xt=j(O,"layout","text-font",T,p,L);Dt=j(O,"layout","text-line-height",T,p,L),ni=ld(o?o(xt,t.metadata?t.metadata["ol:webfonts"]:void 0):xt,si,Dt),ni.includes("sans-serif")||(ni+=",sans-serif"),ri=j(O,"layout","text-letter-spacing",T,p,L),bi=j(O,"layout","text-max-width",T,p,L);const vt=j(O,"layout","text-field",T,p,L);typeof vt=="object"&&vt.sections?vt.sections.length===1?Mt=vt.toString():Mt=vt.sections.reduce((pt,q,Tt)=>{const rt=q.fontStack?q.fontStack.split(","):xt,ot=ld(o?o(rt):rt,si*(q.scale||1),Dt);let bt=q.text;if(bt===`
|
|
122
|
+
`)return pt.push(`
|
|
123
|
+
`,""),pt;if(F==2)return pt.push(gd(bt,ri),ot),pt;bt=md(bt,ot,bi,ri).split(`
|
|
124
|
+
`);for(let Zt=0,Re=bt.length;Zt<Re;++Zt)Zt>0&&pt.push(`
|
|
125
|
+
`,""),pt.push(bt[Zt],ot);return pt},[]):Mt=_d(vt,b).trim(),It=j(O,"paint","text-opacity",T,p,L)}if(Mt&&It&&!se){le||(++A,V=v[A],(!V||!V.getText()||V.getFill()||V.getStroke())&&(V=new Pt,v[A]=V),V.setImage(void 0),V.setGeometry(void 0));const xt=qy(O,T,"text",p);V.getText()||V.setText(st),st=V.getText(),(!st||"getDeclutterMode"in st&&st.getDeclutterMode()!==xt)&&(st=new qs({padding:[2,2,2,2],declutterMode:xt}),V.setText(st));const vt=j(O,"layout","text-transform",T,p,L);vt=="uppercase"?Mt=Array.isArray(Mt)?Mt.map((At,ie)=>ie%2?At:At.toUpperCase()):Mt.toUpperCase():vt=="lowercase"&&(Mt=Array.isArray(Mt)?Mt.map((At,ie)=>ie%2?At:At.toLowerCase()):Mt.toLowerCase());const pt=Array.isArray(Mt)?Mt:F==2?gd(Mt,ri):md(Mt,ni,bi,ri);if(st.setText(pt),st.setFont(ni),st.setRotation(dd(j(O,"layout","text-rotate",T,p,L))),typeof st.setKeepUpright=="function"){const At=j(O,"layout","text-keep-upright",T,p,L);st.setKeepUpright(At)}const q=j(O,"layout","text-anchor",T,p,L),Tt=le||F==1?"point":j(O,"layout","symbol-placement",T,p,L);let rt;if(Tt==="line-center"?(st.setPlacement("line"),rt="center"):st.setPlacement(Tt),Tt==="line"&&typeof st.setRepeat=="function"){const At=j(O,"layout","symbol-spacing",T,p,L);st.setRepeat(At*2)}st.setOverflow(Tt==="point");let ot=j(O,"paint","text-halo-width",T,p,L);const bt=j(O,"layout","text-offset",T,p,L),Zt=j(O,"paint","text-translate",T,p,L);let Re=0,pe=0;if(Tt=="point"){rt="center",q.indexOf("left")!==-1?(rt="left",pe=ot):q.indexOf("right")!==-1&&(rt="right",pe=-ot);const At=j(O,"layout","text-rotation-alignment",T,p,L);st.setRotateWithView(At=="map")}else st.setMaxAngle(dd(j(O,"layout","text-max-angle",T,p,L))*Mt.length/pt.length),st.setRotateWithView(!1);st.setTextAlign(rt);let zt="middle";q.indexOf("bottom")==0?(zt="bottom",Re=-ot-.5*(Dt-1)*si):q.indexOf("top")==0&&(zt="top",Re=ot+.5*(Dt-1)*si),st.setTextBaseline(zt);const re=j(O,"layout","text-justify",T,p,L);st.setJustify(re==="auto"?void 0:re),st.setOffsetX(bt[0]*si+pe+Zt[0]),st.setOffsetY(bt[1]*si+Re+Zt[1]);const Ft=st.getFill()||new Ht;Ft.setColor(Ts(j(O,"paint","text-color",T,p,L),It)),st.setFill(Ft);const me=Ts(j(O,"paint","text-halo-color",T,p,L),It);if(me&&ot>0){const At=st.getStroke()||new te;At.setColor(me),ot*=2;const ie=.5*si;At.setWidth(ot<=ie?ot:ie),st.setStroke(At)}else st.setStroke(void 0);const ce=j(O,"layout","text-padding",T,p,L),Qt=st.getPadding();ce!==Qt[0]&&(Qt[0]=ce,Qt[1]=ce,Qt[2]=ce,Qt[3]=ce),V.setZIndex(Ye)}}}if(A>-1)return v.length=A+1,v};return n.setStyle(y),n.set("mapbox-layers",u),n.set("mapbox-source",_),n.set("mapbox-featurestate",n.get("mapbox-featurestate")||{}),y}class bP extends Wm{constructor(){super()}getType(){return"json"}readFeature(t,e){return this.readFeatureFromObject(dc(t),this.getReadOptions(t,e))}readFeatures(t,e){return this.readFeaturesFromObject(dc(t),this.getReadOptions(t,e))}readFeatureFromObject(t,e){return et()}readFeaturesFromObject(t,e){return et()}readGeometry(t,e){return this.readGeometryFromObject(dc(t),this.getReadOptions(t,e))}readGeometryFromObject(t,e){return et()}readProjection(t){return this.readProjectionFromObject(dc(t))}readProjectionFromObject(t){return et()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(t,e){return et()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(t,e){return et()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(t,e){return et()}}function dc(n){if(typeof n=="string"){const t=JSON.parse(n);return t||null}return n!==null?n:null}class Jy extends bP{constructor(t){t=t||{},super(),this.dataProjection=mt(t.dataProjection?t.dataProjection:"EPSG:4326"),t.featureProjection&&(this.defaultFeatureProjection=mt(t.featureProjection)),t.featureClass&&(this.featureClass=t.featureClass),this.geometryName_=t.geometryName,this.extractGeometryName_=t.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(t,e){let i=null;t.type==="Feature"?i=t:i={type:"Feature",geometry:t,properties:null};const s=vd(i.geometry);if(this.featureClass===_e)return Um({geometry:s,id:i.id,properties:i.properties},e);const r=new je;return this.geometryName_?r.setGeometryName(this.geometryName_):this.extractGeometryName_&&i.geometry_name&&r.setGeometryName(i.geometry_name),r.setGeometry(xu(s,e)),"id"in i&&r.setId(i.id),i.properties&&r.setProperties(i.properties,!0),r}readFeaturesFromObject(t,e){const i=t;let s=null;if(i.type==="FeatureCollection"){const r=t;s=[];const o=r.features;for(let a=0,l=o.length;a<l;++a){const c=this.readFeatureFromObject(o[a],e);c&&s.push(c)}}else s=[this.readFeatureFromObject(t,e)];return s.flat()}readGeometryFromObject(t,e){return PP(t,e)}readProjectionFromObject(t){const e=t.crs;let i;if(e)if(e.type=="name")i=mt(e.properties.name);else if(e.type==="EPSG")i=mt("EPSG:"+e.properties.code);else throw new Error("Unknown SRS type");else i=this.dataProjection;return i}writeFeatureObject(t,e){e=this.adaptOptions(e);const i={type:"Feature",geometry:null,properties:null},s=t.getId();if(s!==void 0&&(i.id=s),!t.hasProperties())return i;const r=t.getProperties(),o=t.getGeometry();return o&&(i.geometry=wd(o,e),delete r[t.getGeometryName()]),Pn(r)||(i.properties=r),i}writeFeaturesObject(t,e){e=this.adaptOptions(e);const i=[];for(let s=0,r=t.length;s<r;++s)i.push(this.writeFeatureObject(t[s],e));return{type:"FeatureCollection",features:i}}writeGeometryObject(t,e){return wd(t,this.adaptOptions(e))}}function vd(n,t){if(!n)return null;let e;switch(n.type){case"Point":{e=IP(n);break}case"LineString":{e=SP(n);break}case"Polygon":{e=DP(n);break}case"MultiPoint":{e=MP(n);break}case"MultiLineString":{e=TP(n);break}case"MultiPolygon":{e=AP(n);break}case"GeometryCollection":{e=RP(n);break}default:throw new Error("Unsupported GeoJSON type: "+n.type)}return e}function PP(n,t){const e=vd(n);return xu(e,t)}function RP(n,t){return n.geometries.map(function(i){return vd(i)})}function IP(n){const t=n.coordinates;return{type:"Point",flatCoordinates:t,layout:os(t.length)}}function SP(n){var i;const t=n.coordinates,e=t.flat();return{type:"LineString",flatCoordinates:e,ends:[e.length],layout:os(((i=t[0])==null?void 0:i.length)||2)}}function TP(n){var r,o;const t=n.coordinates,e=((o=(r=t[0])==null?void 0:r[0])==null?void 0:o.length)||2,i=[],s=Gr(i,0,t,e);return{type:"MultiLineString",flatCoordinates:i,ends:s,layout:os(e)}}function MP(n){var e;const t=n.coordinates;return{type:"MultiPoint",flatCoordinates:t.flat(),layout:os(((e=t[0])==null?void 0:e.length)||2)}}function AP(n){var r,o;const t=n.coordinates,e=[],i=((o=(r=t[0])==null?void 0:r[0])==null?void 0:o[0].length)||2,s=$f(e,0,t,i);return{type:"MultiPolygon",flatCoordinates:e,ends:s,layout:os(i)}}function DP(n){var r,o;const t=n.coordinates,e=[],i=(o=(r=t[0])==null?void 0:r[0])==null?void 0:o.length,s=Gr(e,0,t,i);return{type:"Polygon",flatCoordinates:e,ends:s,layout:os(i)}}function wd(n,t){n=Al(n,!0,t);const e=n.getType();let i;switch(e){case"Point":{i=NP(n);break}case"LineString":{i=LP(n);break}case"Polygon":{i=GP(n,t);break}case"MultiPoint":{i=zP(n);break}case"MultiLineString":{i=OP(n);break}case"MultiPolygon":{i=kP(n,t);break}case"GeometryCollection":{i=FP(n,t);break}case"Circle":{i={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+e)}return i}function FP(n,t){return t=Object.assign({},t),delete t.featureProjection,{type:"GeometryCollection",geometries:n.getGeometriesArray().map(function(i){return wd(i,t)})}}function LP(n,t){return{type:"LineString",coordinates:n.getCoordinates()}}function OP(n,t){return{type:"MultiLineString",coordinates:n.getCoordinates()}}function zP(n,t){return{type:"MultiPoint",coordinates:n.getCoordinates()}}function kP(n,t){let e;return t&&(e=t.rightHanded),{type:"MultiPolygon",coordinates:n.getCoordinates(e)}}function NP(n,t){return{type:"Point",coordinates:n.getCoordinates()}}function GP(n,t){let e;return t&&(e=t.rightHanded),{type:"Polygon",coordinates:n.getCoordinates(e)}}function VP(n,t,e,i){const s=document.createElement("script"),r="olc_"+at(t);function o(){delete globalThis[r],s.parentNode.removeChild(s)}s.async=!0,s.src=n+(n.includes("?")?"&":"?")+"callback="+r;const a=setTimeout(function(){o(),e&&e()},1e4);globalThis[r]=function(l){clearTimeout(a),o(),t(l)},document.head.appendChild(s)}class WP extends Rl{constructor(t){if(super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:mt("EPSG:3857"),reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:"loading",tileLoadFunction:t.tileLoadFunction,wrapX:t.wrapX!==void 0?t.wrapX:!0,transition:t.transition,zDirection:t.zDirection}),this.tileJSON_=null,this.tileSize_=t.tileSize,t.url)if(t.jsonp)VP(t.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{const e=new XMLHttpRequest;e.addEventListener("load",this.onXHRLoad_.bind(this)),e.addEventListener("error",this.onXHRError_.bind(this)),e.open("GET",t.url),e.send()}else if(t.tileJSON)this.handleTileJSONResponse(t.tileJSON);else throw new Error("Either `url` or `tileJSON` options must be provided")}onXHRLoad_(t){const e=t.target;if(!e.status||e.status>=200&&e.status<300){let i;try{i=JSON.parse(e.responseText)}catch{this.handleTileJSONError();return}this.handleTileJSONResponse(i)}else this.handleTileJSONError()}onXHRError_(t){this.handleTileJSONError()}getTileJSON(){return this.tileJSON_}handleTileJSONResponse(t){const e=mt("EPSG:4326"),i=this.getProjection();let s;if(t.bounds!==void 0){const c=kr(e,i);s=of(t.bounds,c)}const r=xo(i),o=t.minzoom||0,a=t.maxzoom||22,l=cr({extent:r,maxZoom:a,minZoom:o,tileSize:this.tileSize_});if(this.tileGrid=l,this.tileUrlFunction=Lm(t.tiles,l),t.attribution&&!this.getAttributions()){const c=s!==void 0?s:r;this.setAttributions(function(h){return Wt(c,h.extent)?[t.attribution]:null})}this.tileJSON_=t,this.setState("ready")}handleTileJSONError(){this.setState("error")}}_t.parse("#000000"),_t.parse("#FFFFFF"),_t.parse("#000000");function UP(n,t=512){return n.getExtent()?cr({extent:n.getExtent(),tileSize:t,maxZoom:22}).getResolutions():fd}function $P(n,t){return t.accessToken||(t=Object.assign({},t),new URL(n).searchParams.forEach((i,s)=>{t.accessToken=i,t.accessTokenParam=s})),t}function XP(n,t,e="",i={},s=void 0){let r,o,a,l,c=!0;return typeof e!="string"&&!Array.isArray(e)?(a=e,l=a.source||a.layers,i=a):l=e,typeof i=="string"?(r=i,a={}):(r=i.styleUrl,a=i),a.updateSource===!1&&(c=!1),s||(s=a.resolutions),!r&&typeof t=="string"&&!t.trim().startsWith("{")&&(r=t),r&&(r=r.startsWith("data:")?location.href:Wy(r,a.accessToken),a=$P(r,a)),new Promise(function(h,u){uP(t,a).then(function(d){if(d.version!=8)return u(new Error("glStyle version 8 required."));if(!(n instanceof ti||n instanceof Sl))return u(new Error("Can only apply to VectorLayer or VectorTileLayer"));const g=n instanceof Sl?"vector":"geojson";if(l?Array.isArray(l)?o=d.layers.find(function(x){return x.id===l[0]}).source:o=l:(o=d.layers.find(function(x){return x.source&&d.sources[x.source].type===g}).source,l=o),!o)return u(new Error(`No ${g} source found in the glStyle.`));function p(){if(!c)return Promise.resolve();if(n instanceof Sl)return BP(d.sources[o],r,a).then(function(b){const R=n.getSource();R?b!==R&&(R.setTileUrlFunction(b.getTileUrlFunction()),typeof R.setUrls=="function"&&typeof b.getUrls=="function"&&R.setUrls(b.getUrls()),R.format_||(R.format_=b.format_),R.getAttributions()||R.setAttributions(b.getAttributions()),R.getTileLoadFunction()===km&&R.setTileLoadFunction(b.getTileLoadFunction()),ye(R.getProjection(),b.getProjection())&&(R.tileGrid=b.getTileGrid())):n.setSource(b);const I=n.getSource().getTileGrid();!isFinite(n.getMaxResolution())&&!isFinite(n.getMinZoom())&&I.getMinZoom()>0&&n.setMaxResolution(hP(Math.max(0,I.getMinZoom()-1e-12),I.getResolutions()))});const x=d.sources[o];let C=n.getSource();(!C||C.get("mapbox-source")!==x)&&(C=jP(x,r,a));const P=n.getSource();return P?C!==P&&(P.getAttributions()||P.setAttributions(C.getAttributions()),P.format_||(P.format_=C.getFormat()),P.url_=C.getUrl()):n.setSource(C),Promise.resolve()}let m,_;const v={},y={};function w(){if(!_&&(!d.sprite||v)){if(a.projection&&!s){const b=mt(a.projection).getUnits();b!=="m"&&(s=fd.map(R=>R/Ia[b]))}let x;const C=n.getSource();C instanceof _u&&C.format_ instanceof Eu&&(x=C.format_.layerName_),_=CP(n,d,l,s,v,y,(P,b=a.webfonts)=>yP(P,b),a.getImage,x),n.getStyle()?p().then(h).catch(u):u(new Error(`Nothing to show for source [${o}]`))}else _?(n.setStyle(_),p().then(h).catch(u)):u(new Error("Something went wrong trying to apply style."))}if(d.sprite){const x=nP(d.sprite,a.accessToken,r||location.href);m=Ae?1:globalThis.devicePixelRatio>=1.5?.5:1;const C=m==.5?"@2x":"";Promise.all(x.map(function(P){const b=new URL(P.url);let R=b.origin+b.pathname+C+".json"+b.search;return new Promise(function(I,S){wr("Sprite",R,a).then(I).catch(function(F){R=b.origin+b.pathname+".json"+b.search,wr("Sprite",R,a).then(I).catch(S)})}).then(function(I){I===void 0&&u(new Error("No sprites found."));let S;if(S=b.origin+b.pathname+C+".png"+b.search,a.transformRequest){const F=a.transformRequest(S,"SpriteImage")||S;(F instanceof Request||F instanceof Promise)&&(S=F)}y[P.id]=S;for(const F in I){const k=P.id=="default"?F:`${P.id}:${F}`;v[k]=I[F]}}).catch(function(I){u(new Error(`Sprites cannot be loaded: ${R}: ${I.message}`))})})).then(w).catch(u)}else w()}).catch(u)})}function YP(n,t){const e=n.bounds;if(e){const i=dt([e[0],e[1]],t),s=dt([e[2],e[3]],t);return[i[0],i[1],s[0],s[1]]}return mt(t).getExtent()}function HP(n,t,e){const i=new WP({tileJSON:t,tileSize:n.tileSize||t.tileSize||512}),s=i.getTileJSON(),r=i.getTileGrid(),o=mt(e.projection||"EPSG:3857"),a=YP(s,o),l=o.getExtent(),c=s.minzoom||0,h=s.maxzoom||22,u={attributions:i.getAttributions(),projection:o,tileGrid:new Xn({origin:l?Te(l):r.getOrigin(0),extent:a||r.getExtent(),minZoom:c,resolutions:UP(o,t.tileSize).slice(0,h+1),tileSize:r.getTileSize(0)})};return Array.isArray(s.tiles)?u.urls=s.tiles:u.url=s.tiles,u}function BP(n,t,e){return new Promise(function(i,s){dP(n,t,e).then(function({tileJson:r,tileLoadFunction:o}){const a=HP(n,r,e);a.tileLoadFunction=o,a.format=new Eu({layerName:"mvt:layer"});const l=new _u(a);l.set("mapbox-source",n),i(l)}).catch(s)})}function ZP(n){return`{bbox-${(n?n.getCode():"EPSG:3857").toLowerCase().replace(/[^a-z0-9]/g,"-")}}`}function jP(n,t,e){const i=e.projection?new Jy({dataProjection:e.projection}):new Jy,s=n.data,r={};if(typeof s=="string"){const[a]=lc(s,e.accessToken,e.accessTokenParam||"access_token",t||location.href);if(/\{bbox-[0-9a-z-]+\}/.test(a)){const c=(u,d,g)=>{const p=ZP(g);return a.replace(p,`${u.join(",")}`)},h=new Ge({attributions:n.attribution,format:i,loader:(u,d,g,p,m)=>{const _=typeof c=="function"?c(u,d,g):c;wr("GeoJSON",_,e).then(v=>{const y=h.getFormat().readFeatures(v,{featureProjection:g});h.addFeatures(y),p(y)}).catch(v=>{h.removeLoadedExtent(u),m()})},strategy:Av});return h.set("mapbox-source",n),h}const l=new Ge({attributions:n.attribution,format:i,url:a,loader:(c,h,u,d,g)=>{wr("GeoJSON",a,e).then(p=>{const m=l.getFormat().readFeatures(p,{featureProjection:u});l.addFeatures(m),d(m)}).catch(p=>{l.removeLoadedExtent(c),g()})}});return l}r.features=i.readFeatures(s,{featureProjection:"EPSG:3857"});const o=new Ge(Object.assign({attributions:n.attribution,format:i},r));return o.set("mapbox-source",n),o}class xd extends f.Destroyable{constructor(e,i){super();E(this,"_imageriesManager");E(this,"_map");E(this,"_raster");E(this,"_layer",this.dv(f.react(void 0)));E(this,"_rShow",this.dv(f.react(!0)));E(this,"_rAlpha",this.dv(f.react(1)));E(this,"_rZIndex",this.dv(f.react(0)));E(this,"_rRectangle",this.dv(f.react(void 0)));E(this,"_rSplitDirection",this.dv(f.react("NONE")));E(this,"_rBrightness",this.dv(f.react(1)));E(this,"_rContrast",this.dv(f.react(1)));E(this,"_rHue",this.dv(f.react(0)));E(this,"_rSaturation",this.dv(f.react(1)));E(this,"_rGamma",this.dv(f.react(1)));E(this,"_raf");this.id=i;const s=e.viewer;if(!s)return;this._map=s;const r=ln(s);if(!r)return;const{imageriesManager:o}=r;this._imageriesManager=o,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 i=e??!0;this._rShow.value=i,(s=this._layer.value)==null||s.setVisible(i)}set alpha(e){var s;const i=e??1;this._rAlpha.value=i,(s=this._layer.value)==null||s.setOpacity(i)}set zIndex(e){const i=e??0;this._rZIndex.value=i,this._layer.value&&this._imageriesManager&&this._imageriesManager.setZindex(this._layer.value,i)}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,r,o;this._raf=void 0;const e=this._layer.value,i=(s=e==null?void 0:e.getSource)==null?void 0:s.call(e);(o=(r=this._raster)==null?void 0:r.changed)==null||o.call(r),i!=null&&i.refresh?i.refresh():e!=null&&e.changed&&e.changed()}))}set imageryProvider(e){this._createFromProvider(e)}flyTo(e){}_destroyLayer(){var i,s,r;const e=(i=this._layer)==null?void 0:i.value;this._map&&e&&this._imageriesManager&&this._imageriesManager.delete(e),this._raf&&(cancelAnimationFrame(this._raf),this._raf=void 0),(r=(s=this._raster)==null?void 0:s.dispose)==null||r.call(s),this._raster=void 0,this._layer.value=void 0}_wrapWithRaster(e){const i=Math.min(4,Math.max(1,(typeof navigator<"u"&&navigator.hardwareConcurrency||4)-1)),s=new gu({sources:[e],operationType:"pixel",threads:i,operation:function(r,o){function a(m,_,v){return .2126*m+.7152*_+.0722*v}function l(m,_,v,y,w){const x=.299*m+.587*_+.114*v,C=.595716*m-.274453*_-.321263*v,P=.211456*m-.522591*_+.311135*v,b=C*y-P*w,R=C*w+P*y;let I=x+.9563*b+.621*R,S=x-.2721*b-.6474*R,F=x-1.107*b+1.7046*R;const k=T=>T<0?0:T>1?1:T;return[k(I),k(S),k(F)]}const c=r[0];let h=c[0]/255,u=c[1]/255,d=c[2]/255;const g=c[3]/255;if(o.hueCos!==1||o.hueSin!==0){const m=l(h,u,d,o.hueCos,o.hueSin);h=m[0],u=m[1],d=m[2]}if(o.saturation!==1){const m=a(h,u,d);h=m+(h-m)*o.saturation,u=m+(u-m)*o.saturation,d=m+(d-m)*o.saturation}o.brightness!==1&&(h*=o.brightness,u*=o.brightness,d*=o.brightness),o.contrast!==1&&(h=(h-.5)*o.contrast+.5,u=(u-.5)*o.contrast+.5,d=(d-.5)*o.contrast+.5),o.gammaInv!==1&&(h=Math.pow(Math.max(h,0),o.gammaInv),u=Math.pow(Math.max(u,0),o.gammaInv),d=Math.pow(Math.max(d,0),o.gammaInv));const p=m=>Math.max(0,Math.min(255,Math.round(m*255)));return c[0]=p(h),c[1]=p(u),c[2]=p(d),c[3]=p(g),c}});return s.on("beforeoperations",r=>{const o=this._rHue.value??0;r.data.brightness=this._rBrightness.value??1,r.data.contrast=this._rContrast.value??1,r.data.saturation=this._rSaturation.value??1,r.data.gammaInv=1/Math.max(1e-4,this._rGamma.value??1),r.data.hueCos=Math.cos(o),r.data.hueSin=Math.sin(o)}),this._raster=s,s}_makeLayerForSource(e){return e instanceof gu?new ou({source:e}):e instanceof Im?new ou({source:e}):new Cl({source:e})}_createFromProvider(e){var p,m,_,v;if(!this._map)return;this._destroyLayer();const s=mt("EPSG:3857").getExtent(),r=ut(s)/256,o=e,a=o.crossOrigin??"anonymous",l=Math.max((o.maximumLevel??18)+1,19),c=Array.from({length:l},(y,w)=>r/Math.pow(2,w));Array.from({length:l},(y,w)=>w.toString());const h=(y,w)=>{if(!w)return{url:y};const x=Array.isArray(w)?w:w.split("");return x.length?y.includes("{s}")?{urls:x.map(C=>y.replace("{s}",C))}:{url:y}:{url:y}},u=y=>typeof y=="string"?y:y&&y.url||"",d=o.minimumLevel??0,g=o.maximumLevel??18;switch(e.type){case"UrlTemplateImageryProvider":{const y=e,w=u(y.url),x=h(w,y.subdomains),C=new Il({...x.urls?{urls:x.urls}:{url:x.url},attributions:o.attributions,crossOrigin:a,wrapX:!0,minZoom:d,maxZoom:g,transition:0}),P=this._wrapWithRaster(C);this._layer.value=this._makeLayerForSource(P);break}case"WebMapTileServiceImageryProvider":{const y=e,w=(y.matrixSet??y.tileMatrixSetID??"EPSG:3857").toUpperCase(),x=w==="EPSG:4326",C=(y.minimumLevel??d)|0,P=(y.maximumLevel??g)|0,b=y.tileMatrixLabels||y.TileMatrixLabels,R=x?Array.from({length:22},(Z,J)=>`${w}:${J}`):Array.from({length:22},(Z,J)=>String(J)),I=b&&b.length?b:R,S=I.length,F=Math.max(0,Math.min(C,S-1)),k=Math.max(F,Math.min(P,S-1)),T=Math.max(1,k-F+1),L=I.slice(F,F+T),A=256;let U,N,$;if(x){N=[-180,-90,180,90],U=Te(N);const Z=360/(A*2);$=Array.from({length:T},(J,O)=>Z/Math.pow(2,F+O))}else{N=s,U=Te(N);const Z=ut(N)/A;$=Array.from({length:T},(J,O)=>Z/Math.pow(2,F+O))}const X=new gE({url:u(y.url),layer:y.layer,matrixSet:w,format:y.format??"image/png",style:y.style??"default",tileGrid:y.tileGrid??new H1({origin:U,extent:N,resolutions:$,matrixIds:L,tileSize:A}),requestEncoding:y.requestEncoding||y.requestencoding||"KVP",...x?{projection:mt("EPSG:4326")}:{},attributions:o.attributions,crossOrigin:a,wrapX:!0,transition:0,tileLoadFunction:(Z,J)=>{const O=new Image;O.crossOrigin=a||"anonymous",O.onload=()=>{var vt,pt;const gt=this._rBrightness.value??1,B=this._rContrast.value??1,D=this._rSaturation.value??1,tt=this._rHue.value??0,H=this._rGamma.value??1;if(tt===0&&D===1&>===1&&B===1&&H===1){const q=(vt=Z.getImage)==null?void 0:vt.call(Z);if(q){q.src=J;return}}const lt=O.naturalWidth||O.width,It=O.naturalHeight||O.height;if(!lt||!It){Z.getImage().src=J;return}const $t=document.createElement("canvas");$t.width=lt,$t.height=It;const Kt=$t.getContext("2d",{willReadFrequently:!0});Kt.drawImage(O,0,0);const Jt=Kt.getImageData(0,0,lt,It),V=Jt.data,Ye=Math.cos(tt),le=Math.sin(tt),st=[[.299,.587,.114],[.595716,-.274453,-.321263],[.211456,-.522591,.311135]],Pe=[[1,.9563,.621],[1,-.2721,-.6474],[1,-1.107,1.7046]],ge=[[1,0,0],[0,Ye,-le],[0,le,Ye]],Xt=(q,Tt)=>{const rt=Array.from({length:3},()=>[0,0,0]);for(let ot=0;ot<3;ot++)for(let bt=0;bt<3;bt++)rt[ot][bt]=q[ot][0]*Tt[0][bt]+q[ot][1]*Tt[1][bt]+q[ot][2]*Tt[2][bt];return rt},se=Xt(Pe,Xt(ge,st)),Mt=.5-.5*B,ni=1/Math.max(1e-4,H),Dt=new Uint8ClampedArray(256);for(let q=0;q<256;q++)Dt[q]=Math.max(0,Math.min(255,Math.round(Math.pow(q/255,ni)*255)));const si=.2126,ri=.7152,bi=.0722;for(let q=0;q<V.length;q+=4){let Tt=V[q]/255,rt=V[q+1]/255,ot=V[q+2]/255;const bt=V[q+3],Zt=se[0][0]*Tt+se[0][1]*rt+se[0][2]*ot,Re=se[1][0]*Tt+se[1][1]*rt+se[1][2]*ot,pe=se[2][0]*Tt+se[2][1]*rt+se[2][2]*ot,zt=si*Zt+ri*Re+bi*pe,re=zt+(Zt-zt)*D,Ft=zt+(Re-zt)*D,me=zt+(pe-zt)*D,ce=re*gt,Qt=Ft*gt,At=me*gt;let ie=ce*B+Mt,Xi=Qt*B+Mt,oi=At*B+Mt;ie=ie<0?0:ie>1?1:ie,Xi=Xi<0?0:Xi>1?1:Xi,oi=oi<0?0:oi>1?1:oi,V[q]=Dt[Math.round(ie*255)],V[q+1]=Dt[Math.round(Xi*255)],V[q+2]=Dt[Math.round(oi*255)],V[q+3]=bt}Kt.putImageData(Jt,0,0);const xt=(pt=Z.setImage)==null?void 0:pt.bind(Z);xt?xt($t):Z.getImage().src=$t.toDataURL("image/png")},O.onerror=()=>{Z.getImage().src=J},O.src=J}});this._layer.value=new Cl({source:X});break}case"WebMapServiceImageryProvider":{const y=e,w={LAYERS:y.layers,TILED:!0,VERSION:((p=y.parameters)==null?void 0:p.VERSION)??((m=y.parameters)==null?void 0:m.version)??"1.3.0",...y.parameters},x=new fE({url:u(y.url),params:w,attributions:o.attributions,crossOrigin:a,transition:0}),C=this._wrapWithRaster(x);this._layer.value=this._makeLayerForSource(C);break}case"TileMapServiceImageryProvider":{const y=e,w=y.url?u(y.url):"",x=w.includes("{-y}"),C=/4326/.test(w)?"EPSG:4326":"EPSG:3857",P=mt(C),b=x?cr({extent:P.getExtent(),minZoom:d,maxZoom:g,tileSize:256}):void 0,R=y.url?u(y.url):"",I=new Il({url:R,attributions:o.attributions,crossOrigin:a,wrapX:!0,minZoom:d,maxZoom:g,tileGrid:new Xn({origin:Te(s),resolutions:c.slice(d,g+1)}),zDirection:-1,transition:0,...b?{tileGrid:b}:{}}),S=this._wrapWithRaster(I);this._layer.value=this._makeLayerForSource(S);break}case"OpenStreetMapImageryProvider":{const y=e,w=new Il({url:y.url,attributions:o.attributions,crossOrigin:a,wrapX:!0,transition:0}),x=this._wrapWithRaster(w);this._layer.value=this._makeLayerForSource(x);break}case"SingleTileImageryProvider":{const y=e,w=typeof y.url=="string"?y.url:y.url.url,x=y.rectangle?Nr(y.rectangle,"EPSG:4326","EPSG:3857"):s,C=new Im({url:w,imageExtent:x,attributions:o.attributions,crossOrigin:a,interpolate:!0}),P=this._wrapWithRaster(C);this._layer.value=this._makeLayerForSource(P);break}case"MVTImageryProvider":{(async()=>{var Z,J,O,gt;const y=e;if(!y.url)return;let w,x=[],C,P,b=null,R,I;const S=async B=>{if(!B)return{};if(typeof B=="string"){const D=B.toLowerCase();if(D.endsWith(".json")||D.includes("tilejson")||D.includes(".json?"))try{const tt=await fetch(B);if(tt.ok){const H=await tt.json(),lt=H.minzoom,It=H.maxzoom;if(H.tiles&&H.tiles.length>0)return{url:H.tiles[0],minzoom:lt,maxzoom:It};if(H.url)return{url:H.url,minzoom:lt,maxzoom:It}}}catch{}return{url:B}}if(typeof B=="object"){const D=B,tt=D.minzoom,H=D.maxzoom;if(D.tiles&&D.tiles.length>0)return{url:D.tiles[0],minzoom:tt,maxzoom:H};if(D.url)return{url:D.url,minzoom:tt,maxzoom:H}}return{}},F=B=>{const D=B.toLowerCase();return D.includes("style.json")||D.endsWith(".json")&&!D.includes("{z}")&&!D.includes("{x}")&&!D.includes("{y}")};let k="customSource";if(typeof y.url=="string")if(F(y.url))try{const B=await fetch(y.url);if(!B.ok){console.warn(`[OlImagery] MVT: fetch style.json 失败: ${B.status}`);return}b=await B.json();const D=b.sources||{};for(const tt in D)if(Object.prototype.hasOwnProperty.call(D,tt)){const H=D[tt];if(H.type==="vector"){if(k=tt,H.minzoom!==void 0&&(R=R===void 0?H.minzoom:Math.min(R,H.minzoom)),H.maxzoom!==void 0&&(I=I===void 0?H.maxzoom:Math.max(I,H.maxzoom)),H.tiles&&H.tiles.length>0){w=H.tiles[0];break}if(H.url){const lt=await S(H.url);if(w=lt.url,lt.minzoom!==void 0&&(R=R===void 0?lt.minzoom:Math.min(R,lt.minzoom)),lt.maxzoom!==void 0&&(I=I===void 0?lt.maxzoom:Math.max(I,lt.maxzoom)),w)break}}}if(!w){console.warn("[OlImagery] MVT: style.json 中未找到有效的 tile URL");return}x=(Z=y.style)!=null&&Z.length?y.style:b.layers||[],C=b.glyphs,P=b.sprite}catch(B){console.warn("[OlImagery] MVT: fetch style.json 出错:",B);return}else{const B=await S(y.url);w=B.url,R=B.minzoom,I=B.maxzoom,x=y.style||[],C=y.glyphs,P=y.sprite}else if(y.url&&typeof y.url=="object"){b=y.url;const B=b.sources||{};for(const D in B)if(Object.prototype.hasOwnProperty.call(B,D)){const tt=B[D];if(tt.type==="vector"){if(k=D,tt.minzoom!==void 0&&(R=R===void 0?tt.minzoom:Math.min(R,tt.minzoom)),tt.maxzoom!==void 0&&(I=I===void 0?tt.maxzoom:Math.max(I,tt.maxzoom)),tt.tiles&&tt.tiles.length>0){w=tt.tiles[0];break}if(tt.url){const H=await S(tt.url);if(w=H.url,H.minzoom!==void 0&&(R=R===void 0?H.minzoom:Math.min(R,H.minzoom)),H.maxzoom!==void 0&&(I=I===void 0?H.maxzoom:Math.max(I,H.maxzoom)),w)break}}}if(!w){console.warn("[OlImagery] MVT: 未在 style JSON 中找到有效的 tile URL");return}x=(J=y.style)!=null&&J.length?y.style:b.layers||[],C=b.glyphs,P=b.sprite}else return;if(w&&y.accessToken&&w.includes("mapbox")&&!w.includes("access_token")){const B=w.includes("?")?"&":"?";w+=`${B}access_token=${y.accessToken}`}const T=Math.max(y.minimumLevel??0,R??0),L=Math.min(y.maximumLevel??18,I??18),A=y.tileSize||512,U=y.scheme||"xyz",N=((O=b==null?void 0:b.metadata)==null?void 0:O["mapbox:projection"])||((gt=b==null?void 0:b.metadata)==null?void 0:gt.projection)||"EPSG:3857",$=new _u({url:w,format:new Eu,tileGrid:cr({tileSize:A,minZoom:T,maxZoom:L}),...U==="tms"?{zDirection:-1}:{},attributions:b==null?void 0:b.attribution});N!=="EPSG:3857"&&($.dataProjection=N),$.on("tileloaderror",B=>{console.error("[OlImagery] MVT: 瓦片加载失败",B)});const X=new Sl({source:$,declutter:!0});if(x.length>0)try{const B="https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf",D={version:8,name:"MVT Style",sources:{[k]:{type:"vector",tiles:[w],minzoom:T,maxzoom:L}},layers:x,glyphs:C||B,sprite:P},tt={source:k,...typeof y.url=="string"&&y.url.toLowerCase().includes("style.json")?{styleUrl:y.url}:{}};await XP(X,D,tt)}catch(B){console.warn("[OlImagery] MVT: ol-mapbox-style 应用样式失败,使用默认样式",B),X.setStyle(function(D){var It;const tt=D.getGeometry(),H=((It=tt==null?void 0:tt.getType)==null?void 0:It.call(tt))||"",lt=[];return H==="LineString"||H==="MultiLineString"?lt.push(new Pt({stroke:new te({color:"#ff0000",width:3})})):H==="Polygon"||H==="MultiPolygon"?lt.push(new Pt({fill:new Ht({color:"rgba(100, 100, 100, 0.5)"}),stroke:new te({color:"#333333",width:1})})):(H==="Point"||H==="MultiPoint")&<.push(new Pt({image:new Qe({radius:5,fill:new Ht({color:"#ff0000"})})})),lt})}this._layer.value=X,this._layer.value.setOpacity(this._rAlpha.value),this._layer.value.setVisible(this._rShow.value),this.layer&&(this._imageriesManager&&this._imageriesManager.add(this.layer),this._imageriesManager&&this._imageriesManager.setZindex(this.layer,this._rZIndex.value))})();break}default:{console.warn("[OlImagery] 未实现的 provider.type:",e.type,e);return}}(_=this._layer.value)==null||_.setOpacity(this._rAlpha.value),(v=this._layer.value)==null||v.setVisible(this._rShow.value),this.layer&&(this._imageriesManager&&this._imageriesManager.add(this.layer),this._imageriesManager&&this._imageriesManager.setZindex(this.layer,this._rZIndex.value))}}const vc=class vc extends f.Destroyable{constructor(e,i){super();E(this,"_pickedEvent",this.disposeVar(new f.Event));E(this,"_flyToEvent",this.disposeVar(new f.Event));E(this,"_clickEvent",this.disposeVar(new f.Event));E(this,"_hovered",this.disposeVar(f.react(!1)));E(this,"_feature");E(this,"_source");E(this,"_layer");E(this,"_initialized",!1);const s=new Ne([]);this._feature=new je({geometry:s}),this._feature.setId(i??f.createGuid());const r=e.viewer;if(!r)return;this._source=new Ge,this.dispose(()=>{var c;return(c=this._source)==null?void 0:c.dispose()}),this._layer=new ti({source:this._source}),this.dispose(()=>{var c;return(c=this._layer)==null?void 0:c.dispose()});const o=()=>{var c;(c=this._layer)==null||c.setVisible(this.show??!0)};this.d(f.createEventsCallFunc(this.showChanged,o,{immediate:!0})),r.addLayer(this._layer),this.dispose(()=>r.removeLayer(this._layer));const a=()=>{if(!this._source||!this._feature||(this._source.clear(),!this.position))return;const c=dt([this.position[0][0],this.position[0][1]]);s.setCoordinates(c);const h=this.radius??5,u=this.strokeWidth??2,d=this.fillColor??[1,1,1,1],g=this.strokeColor??[0,153/255,1,1],p=new Ht({color:`rgba(${d.slice(0,3).map(v=>Math.round(v*255)).join(",")},${d[3]})`}),m=new te({color:`rgba(${g.slice(0,3).map(v=>Math.round(v*255)).join(",")},${g[3]})`,width:u}),_=new Pt({image:new Qe({radius:h,fill:p,stroke:m})});this._feature.setStyle(_),this._source.addFeature(this._feature)};a();const l=this.disposeVar(f.createNextAnimateFrameEvent(this.positionChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged));this.dispose(l.disposableOn(a)),this.dispose(this.flyToEvent.disposableOn(c=>{this.position&&on(e,this.position)})),this.dispose(this.positionChanged.disposableOn(()=>{!this._initialized&&this.position&&(this._initializePoint(),this._initialized=!0)}))}get typeName(){return"OlPoint"}get defaultProps(){return vc.createDefaultProps()}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}get clickEvent(){return this._clickEvent}get hovered(){return this._hovered.value}set hovered(e){this._hovered.value=e}get feature(){return this._feature}_initializePoint(){const e=()=>{var g;if(!this.position)return;const s=dt([this.position[0],this.position[1]]);if(!this._feature)return;this._feature.getGeometry().setCoordinates(s);const o=this.radius??5,a=this.strokeWidth??2,l=this.fillColor??[1,1,1,1],c=this.strokeColor??[0,153/255,1,1],h=new Ht({color:`rgba(${l.slice(0,3).map(p=>Math.round(p*255)).join(",")},${l[3]})`}),u=new te({color:`rgba(${c.slice(0,3).map(p=>Math.round(p*255)).join(",")},${c[3]})`,width:a}),d=new Pt({image:new Qe({radius:o,fill:h,stroke:u})});this._feature.setStyle(d),this._feature.set("visible",this.show??!0),(g=this._source)==null||g.addFeature(this._feature)};e();const i=f.createNextAnimateFrameEvent(this.positionChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged);this.dispose(i.disposableOn(e))}};E(vc,"defaults",{position:[],width:2,loop:!1,color:[1,1,1,.5],outlineColor:[0,0,0,1],show:!0,allowPicking:!1,strokeColor:[0,153/255,1,1],fillColor:[1,1,1,1],strokeWidth:2,radius:5});let xi=vc;(n=>{n.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})})(xi||(xi={})),f.extendClassProps(xi.prototype,xi.createDefaultProps);const wc=class wc extends f.Destroyable{constructor(e,i){super();E(this,"_flyToEvent",this.disposeVar(new f.Event));E(this,"_layer");E(this,"_feature");E(this,"_source");E(this,"_lineString");const s=new fi([]);this._lineString=s,this.d(()=>{var c;return(c=this._lineString)==null?void 0:c.dispose()}),this._feature=new je({geometry:s}),this._feature.setId(i??f.createGuid()),this.d(()=>{var c;return(c=this._feature)==null?void 0:c.dispose()}),this._source=new Ge,this.d(()=>{var c;return(c=this._source)==null?void 0:c.dispose()}),this._layer=new ti({zIndex:0,source:this._source}),this.d(()=>{var c;return(c=this._layer)==null?void 0:c.dispose()});const r=e.viewer;if(!r)return;r.addLayer(this._layer),this.d(()=>r.removeLayer(this._layer));const o=()=>{var c;(c=this._layer)==null||c.setVisible(this.show??!0)};o(),this.ad(this.showChanged.don(o)),this.d(f.createEventsCallFunc(this.zIndexChanged,()=>{var c;(c=this._layer)==null||c.setZIndex(this.zIndex)},{immediate:!0}));const a=()=>{if(!this._source||!this._feature||(this._source.clear(),!this.positions||this.positions.length<2))return;const c=this.positions.map(d=>dt([d[0],d[1]]));this.loop&&c.length>=3&&c.push(c[0]),this._feature.getGeometry().setCoordinates(c);const u=(d,g)=>{const p=[],m=new te({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(p.push(new Pt({stroke:m})),this.hasArrow&&c.length>=2){const[_,v]=c[c.length-2],[y,w]=c[c.length-1],x=qP(y-_,w-v);p.push(new Pt({geometry:new Ne([y,w]),image:new no({points:3,radius:8,rotation:x,rotateWithView:!0,fill:new Ht({color:`rgba(${this.color[0]*255}, ${this.color[1]*255}, ${this.color[2]*255}, ${this.color[3]})`})})}))}return p};this._feature.setStyle(u),this._source.addFeature(this._feature)};a();const l=this.disposeVar(f.createNextAnimateFrameEvent(this.positionsChanged,this.loopChanged,this.widthChanged,this.colorChanged,this.hasDashChanged,this.dashLengthChanged,this.hasArrowChanged,this.showChanged));this.d(l.disposableOn(a)),this.d(this.flyToEvent.disposableOn(c=>{if(!this.positions||this.positions.length===0)return;const h=this.positions[Math.floor(this.positions.length/2)];on(e,h)}))}get typeName(){return"OlPolyline"}get defaultProps(){return wc.createDefaultProps()}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}};E(wc,"defaults",{positions:[],width:2,loop:!1,color:[1,1,1,1],hasDash:!1,dashLength:16,hasArrow:!1});let fe=wc;(n=>{n.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])})})(fe||(fe={})),f.extendClassProps(fe.prototype,fe.createDefaultProps);function qP(n,t){const e=Math.atan2(t,n);return(Math.PI/2-e+2*Math.PI)%(2*Math.PI)}class KP extends f.Destroyable{constructor(e,i){super();E(this,"_geoPoint");E(this,"_geoAxis");this._geoPoint=this.disposeVar(new xi(i,e.id)),this._geoAxis=this.disposeVar(new fe(i,e.id)),this._geoAxis.width=6,this._geoAxis.color=[1,1,0,.7]}get geoPoint(){return this._geoPoint}get geoAxis(){return this._geoAxis}}const gn=class gn extends f.Destroyable{constructor(e,i){super();E(this,"_captureEvent",this.disposeVar(new f.Event));E(this,"_id",this.disposeVar(f.react(f.createGuid())));if(this._olViewer=e,i&&(this.id=i),!e.viewer)return;this.disposeVar(new f.ObjResettingWithEvent(this.showChanged,()=>{if(this.show&&this.position)return new KP(this,e)})),this.default&&this.flyTo(void 0,!1);const r=this.disposeVar(f.createProcessingFromAsyncFunc(async a=>{const{position:l,rotation:c,viewDistance:h,duration:u=1e3}=this;if(l){const d=on(this._olViewer,l,h,c,u,()=>{this.enabled=!1});d&&await a.promise(d),this.enabled=!1}}));this.dispose(this.enabledChanged.disposableOn(()=>{r.isRunning&&r.cancel(),this.enabled&&r.restart()}));const o=this.disposeVar(f.createProcessingFromAsyncFunc(async(a,l,c)=>{var d,g;const h=(g=(d=this._olViewer).capture)==null?void 0:g.call(d,l,c);if(!h)return;const u=await a.promise(h);u&&(this.thumbnail=u)}));this.dispose(this.captureEvent.disposableOn((a,l)=>{o.restart(void 0,a??gn.defaults.thumbnailWidth,l??gn.defaults.thumbnailHeight)}))}get captureEvent(){return this._captureEvent}capture(e,i){this._captureEvent.emit(e,i)}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 i=this._olViewer.getCurrentCameraInfo();i&&(e&gn.ResetFlag.Position&&(this.position=i.position),e&gn.ResetFlag.Rotation&&(this.rotation=i.rotation),e&gn.ResetFlag.ViewDistance&&(this.viewDistance=0))}flyTo(e,i){if((i??!0)&&!this._olViewer.actived)return;const{position:s,rotation:r,viewDistance:o,duration:a}=this;s&&on(this._olViewer,s,o,r,e??a)}};E(gn,"ResetFlag",{Position:1,Rotation:2,ViewDistance:4,Zoom:10}),E(gn,"defaults",{thumbnailWidth:64,thumbnailHeight:64,enabled:!0,show:!1,position:[116.39,39.9,100],duration:1e3,default:!1,thumbnail:""});let Ms=gn;(n=>{n.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:""})})(Ms||(Ms={})),f.extendClassProps(Ms.prototype,Ms.createDefaultProps);class un extends f.Destroyable{constructor(e,i){super();E(this,"_flyToEvent",this.disposeVar(new f.Event));E(this,"_feature");E(this,"_layer");E(this,"_source");const s=new di([[]]);this._feature=new je({geometry:s}),this._feature.setId(i??f.createGuid());const r=e.viewer;if(!r)return;this._source=new Ge,this.dispose(()=>{var c;return(c=this._source)==null?void 0:c.dispose()}),this._layer=new ti({source:this._source}),this.dispose(()=>{var c;return(c=this._layer)==null?void 0:c.dispose()}),r.addLayer(this._layer),this.dispose(()=>r.removeLayer(this._layer));const o=()=>{var c,h;(c=this._layer)==null||c.setVisible(this.show??!0),(h=this._layer)==null||h.setZIndex(this.zIndex)};this.d(f.createEventsCallFunc([this.showChanged,this.zIndexChanged],o,{immediate:!0}));const a=()=>{if(!this._source||!this._feature||(this._source.clear(),!this.positions||this.positions.length<3))return;const c=t0(this.positions);if(c.length<4)return;this._feature.getGeometry().setCoordinates([c]);const h=this.filled?this.fillColor:[0,0,0,0],u=this.stroked?this.outlineColor:[0,0,0,0];this._feature.setStyle(new Pt({fill:new Ht({color:Qy(h)}),stroke:new te({color:Qy(u),width:this.outlineWidth??1.5,lineDash:this.hasDash?[this.dashLength??16,(this.dashLength??16)/2]:void 0})})),this._source.addFeature(this._feature)};a();const l=this.disposeVar(f.createNextAnimateFrameEvent(this.positionsChanged,this.fillColorChanged,this.outlineColorChanged,this.outlineWidthChanged,this.hasDashChanged,this.dashLengthChanged,this.strokedChanged,this.filledChanged));this.dispose(l.disposableOn(a)),this.dispose(this.flyToEvent.disposableOn(c=>{if(!this.positions||this.positions.length===0)return;const h=t0(this.positions),[u,d]=JP(h),[g,p]=ae([u,d]);on(e,[g,p,0])}))}get typeName(){return"OlPolygon"}get defaultProps(){return un.createDefaultProps()}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}}(n=>{n.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})})(un||(un={})),f.extendClassProps(un.prototype,un.createDefaultProps);function Qy(n){return`rgba(${n[0]*255}, ${n[1]*255}, ${n[2]*255}, ${n[3]})`}function t0(n){const t=n.map(s=>dt([s[0],s[1]])),e=t[0],i=t[t.length-1];return(!e||!i||e[0]!==i[0]||e[1]!==i[1])&&t.push(e),t}function JP(n){let t=0,e=0,i=0;for(let s=0,r=n.length-1;s<n.length;r=s++){const[o,a]=n[r],[l,c]=n[s],h=o*c-l*a;t+=h,e+=(o+l)*h,i+=(a+c)*h}return t*=.5,Math.abs(t)<1e-9?n[0]:(e/=6*t,i/=6*t,[e,i])}const xc=class xc extends f.Destroyable{constructor(e,i){super();E(this,"_pickedEvent",this.disposeVar(new f.Event));E(this,"_flyToEvent",this.disposeVar(new f.Event));E(this,"_clickEvent",this.disposeVar(new f.Event));E(this,"_hovered",this.disposeVar(f.react(!1)));E(this,"_feature");E(this,"_source");E(this,"_layer");E(this,"_initialized",!1);const s=new Bs([]);this._feature=new je({geometry:s}),this._feature.setId(i??f.createGuid());const r=e.viewer;if(!r)return;this._source=new Ge,this.dispose(()=>{var c;return(c=this._source)==null?void 0:c.dispose()}),this._layer=new ti({source:this._source}),this.dispose(()=>{var c;return(c=this._layer)==null?void 0:c.dispose()});const o=()=>{var c;(c=this._layer)==null||c.setVisible(this.show??!0)};o(),this.ad(this.showChanged.don(o)),r.addLayer(this._layer),this.dispose(()=>r.removeLayer(this._layer));const a=()=>{if(!this._source||!this._feature||(this._source.clear(),!this.points))return;const c=this.points.map(y=>dt([y[0],y[1]]));if(!this._feature)return;const h=this._feature.getGeometry();h&&h.setCoordinates(c);const u=this.radius??5,d=this.strokeWidth??2,g=this.fillColor??[255,255,255,1],p=this.strokeColor??[0,153/255,1,1],m=new Ht({color:`rgba(${g.map(y=>y*255).join(",")})`}),_=new te({color:`rgba(${p.map(y=>y*255).join(",")})`,width:d}),v=new Pt({image:new Qe({radius:u,fill:m,stroke:_})});this._feature.setStyle(v),this._source.addFeature(this._feature)};a();const l=this.disposeVar(f.createNextAnimateFrameEvent(this.pointsChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged));this.dispose(l.disposableOn(a)),this.dispose(this.pointsChanged.don(()=>{!this._initialized&&this.points&&(this._initializePoint(),this._initialized=!0)}))}get typeName(){return"OlMultiPoint"}get defaultProps(){return xc.createDefaultProps()}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}get clickEvent(){return this._clickEvent}get hovered(){return this._hovered.value}set hovered(e){this._hovered.value=e}get feature(){return this._feature}_initializePoint(){const e=()=>{var g;if(!this.points)return;const s=this.points.map(p=>dt([p[0],p[1]]));if(!this._feature)return;const r=this._feature.getGeometry();r&&r.setCoordinates(s);const o=this.radius??5,a=this.strokeWidth??2,l=this.fillColor??[1,1,1,1],c=this.strokeColor??[0,153/255,1,1],h=new Ht({color:`rgba(${l.map(p=>p*255).join(",")})`}),u=new te({color:`rgba(${c.map(p=>p*255).join(",")})`,width:a}),d=new Pt({image:new Qe({radius:o,fill:h,stroke:u})});this._feature.setStyle(d),this._feature.set("visible",this.show??!0),(g=this._source)==null||g.addFeature(this._feature)};e();const i=f.createNextAnimateFrameEvent(this.pointsChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged);this.dispose(i.disposableOn(e))}};E(xc,"defaults",{position:[],width:2,loop:!1,color:[1,1,1,.5],outlineColor:[0,0,0,1],show:!0,allowPicking:!1,strokeColor:[0,153/255,1,1],fillColor:[1,1,1,1],strokeWidth:2,radius:5});let Zn=xc;(n=>{n.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})})(Zn||(Zn={})),f.extendClassProps(Zn.prototype,Zn.createDefaultProps);class Oo extends f.EngineObject{constructor(t,e){if(super(t,e),!e.viewer){console.warn("map is undefined!");return}this.d(t.flyToEvent.don((s,r)=>this.flyTo(s,r))),this.d(t.flyInEvent.don((s,r)=>this.flyIn(s,r))),this.dispose(t.calcFlyInParamEvent.disposableOn(()=>{if(!e.actived)return;const s=e.getCurrentCameraInfo();if(!s)return;const{position:r,rotation:o}=s;t.flyInParam={position:r,rotation:o,flyDuration:1}})),this.dispose(t.calcFlyToParamEvent.disposableOn(()=>{t.useCalcFlyToParamInESObjectWithLocation||console.warn("calcFlyToParam无法调用,该对象缺少position属性!")}))}flyToWithPromise(t,e,i,s,r,o,a){const{sceneObject:l,olViewer:c}=this;c.flyTo({distance:i??0,heading:s?s[0]:0,pitch:s?s[1]:0,flyDuration:r??1,hDelta:o??0,pDelta:a??0},e)}flyTo(t,e){const{sceneObject:i,olViewer:s}=this;return s.actived?(i.flyToParam&&(i.useCalcFlyToParamInESObjectWithLocation||console.warn("flyToParam无法使用,该对象缺少position属性,若飞行失败,请清空flyToParam后重试!")),i.flyInParam?this.flyIn(t,e):!1):!1}flyIn(t,e){const{sceneObject:i,olViewer:s}=this;if(!s.actived)return!1;if(i.flyInParam){const{position:r,rotation:o,flyDuration:a}=i.flyInParam,l=t??a;return this.olViewer.flyIn(r,o,l),!0}return!1}get olViewer(){return this.viewer}}class zo extends Oo{constructor(e,i){super(e,i);E(this,"_smoothMoving");this._smoothMoving=this.dv(new f.SmoothMoveController(i)),this.d(this._smoothMoving.currentPositionChanged.don(r=>{r&&(e.position=r)})),this.d(this._smoothMoving.currentRotationChanged.don(r=>{r&&this._smoothMoving.isRotating&&(e.rotation=r)})),this.d(this._smoothMoving.currentHeadingChanged.don(r=>{if(r!==void 0&&!this._smoothMoving.isRotating){const o=e.rotation;e.rotation=[r-90,o[1],o[2]]}})),this.d(e.smoothMoveEvent.don((r,o)=>this.smoothMove(r,o*1e3))),this.d(e.smoothMoveWithRotationEvent.don((r,o,a)=>this.smoothMoveWithRotation(r,o,a*1e3))),this.d(e.smoothMoveOnGroundEvent.don((r,o,a)=>this.smoothMoveOnGround(r,o,a*1e3))),this.d(e.smoothMoveWithRotationOnGroundEvent.don((r,o,a,l)=>this.smoothMoveWithRotationOnGround(r,o,a,l*1e3))),this.d(e.calcFlyToParamEvent.don(()=>{if(!e.useCalcFlyToParamInESObjectWithLocation||!e.position)return;const r=i.calcFlyToParam(e.position);if(!r){console.warn("olViewer.calcFlyToParam failed.");return}console.log("olViewer.calcFlyToParam success.",r),e.flyToParam=r})),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,i))),this.d(i.cameraChanged.don(()=>this.visibleDistance(e,i)))}smoothMove(e,i){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,i)}smoothMoveWithRotation(e,i,s){this._smoothMoving.isGround=!1,this._smoothMoving.isRotating=!0,this._smoothMoving.restart(this.sceneObject.position,this.sceneObject.rotation,0),this._smoothMoving.restart(e,i,s)}async smoothMoveOnGround(e,i,s){const r=await this.olViewer.getTerrainHeight([e,i])??0;this._smoothMoving.isGround=!0,this._smoothMoving.isRotating=!1,this._smoothMoving.restart(this.sceneObject.position,this.sceneObject.rotation,0),this._smoothMoving.restart([e,i,r],this.sceneObject.rotation,s)}async smoothMoveWithRotationOnGround(e,i,s,r){const o=await this.olViewer.getTerrainHeight([i,s])??0;this._smoothMoving.isGround=!0,this._smoothMoving.isRotating=!0,this._smoothMoving.restart(this.sceneObject.position,this.sceneObject.rotation,0),this._smoothMoving.restart([i,s,o],e,r)}visibleDistance(e,i){if(!e.show||!e.position)return;const s=f.getDistancesFromPositions([e.position,Fp(i)],"NONE")[0];e.minVisibleDistance<e.maxVisibleDistance?s>e.minVisibleDistance&&s<e.maxVisibleDistance:e.maxVisibleDistance===0&&s>e.minVisibleDistance}flyTo(e,i){const{sceneObject:s,olViewer:r}=this;if(!r.actived||!r.viewer)return!1;if(s.flyToParam&&s.position){const{position:o,flyToParam:a}=s,{distance:l,heading:c,pitch:h,flyDuration:u,hDelta:d,pDelta:g}=a;return this.flyToWithPromise(i,o,l,[c,h,0],e??u,d,g),!0}else return jh(r.viewer,s.position,e),!0}flyIn(e,i){const{sceneObject:s,olViewer:r}=this;return!r.actived||!r.viewer?!1:!super.flyIn(e,i)&&s.position?(jh(r.viewer,s.position,e),!0):!1}}class Ed extends zo{constructor(e,i){super(e,i);E(this,"_lastHoverResult",this.dv(f.react(void 0)));if(!i.viewer){console.warn("viewer is undefined!");return}this.ad(f.createProcessingFromAsyncFunc(async(r,o)=>{const a=await r.promise(i.pick(o.screenPosition,"innerHoverEvent"));this.lastHoverResult=Object.assign({},a,o)}))}get lastHoverResult(){return this._lastHoverResult.value}set lastHoverResult(e){this._lastHoverResult.value=e}get lastHoverResultChanged(){return this._lastHoverResult.changed}}const QP=n=>{const t=[];if(n){const e=n.length;let i=0;for(let s=0;s<e;++s){const r=(s+1)%e,o=f.geoDistance(n[s],n[r]),a=Math.abs(n[s][2]-n[r][2]),l=Math.sqrt(o*o+a*a);i+=l,t.push(i)}}return t},tR=n=>{let t;return n?(n.length<3?t=0:t=f.geoArea(n),t):0},eR=n=>{let t;return n?(n.length<3?t=void 0:t=f.geoCenterOfMass(n),t):void 0},Xo=class Xo extends Oo{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 r=dl(s);return _o(this.olViewer.viewer,r,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 r=dl(s);return _o(this.olViewer.viewer,r,t),console.log("OlESGeoVector flyTo"),!0}return!0}};E(Xo,"type",Xo.register("ESOlViewer",f.ESGeoVector.type,Xo));let xr=Xo;class As extends f.Destroyable{constructor(e,i){super();E(this,"_flyToEvent",this.disposeVar(new f.Event));if(!e.viewer)return;const r=this.ad(new un(e,i)),o=this.ad(new fe(e,i));o.loop=!0,this.ad(f.bind([o,"depthTest"],[this,"depthTest"])),this.d(f.track([r,"allowPicking"],[this,"allowPicking"]));const a=()=>{o.show=!!(this.show&&this.outline),r.show=!!(this.show&&this.fill),o.positions=this.positions,r.positions=r.show?this.positions||[]:[],o.color=this.outlineColor,o.width=this.outlineWidth;const[c=1,h=1,u=1,d=.5]=this.color||[1,1,1,.5];r.fillColor=[c,h,u,d]};a();const l=this.disposeVar(f.createNextAnimateFrameEvent(this.showChanged,this.outlineChanged,this.outlineColorChanged,this.outlineWidthChanged,this.fillChanged,this.colorChanged,this.positionsChanged));this.d(l.disposableOn(a)),this.d(this.flyToEvent.disposableOn(c=>{r.show?r.flyTo(c):o.show&&o.flyTo(c)}))}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}}E(As,"defaults",{viewDistanceRange:[1e3,1e4,3e4,6e4],positions:[]}),(n=>{n.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})})(As||(As={})),f.extendClassProps(As.prototype,As.createDefaultProps);const Yo=class Yo extends xr{constructor(e,i){super(e,i);E(this,"_geoPolygon");if(!i.viewer){console.warn("viewer is undefined!");return}this._geoPolygon=this.ad(new un(this.olViewer,e.id));const r=this.geoPolygon;r&&(this.d(f.track([r,"show"],[e,"show"])),this.d(f.track([r,"allowPicking"],[e,"allowPicking"])),this.d(f.bind([r,"positions"],[e,"points"])),this.d(f.track([r,"stroked"],[e,"stroked"])),this.d(f.track([r,"outlineColor"],[e,"strokeColor"])),this.d(f.track([r,"outlineWidth"],[e,"strokeWidth"])),this.d(f.track([r,"filled"],[e,"filled"])),this.d(f.track([r,"fillColor"],[e,"fillColor"])))}get geoPolygon(){return this._geoPolygon}};E(Yo,"type",Yo.register("ESOlViewer",f.ESGeoPolygon.type,Yo));let ko=Yo;function No(n){var e;const t=(e=iu(n,"pickResult"))==null?void 0:e.pointerEvent;return(t==null?void 0:t.buttons)!=0?(t==null?void 0:t.button)??0:-1}function iR(n,t,e){const i=[];for(const s of e)switch(s){case"SquareMeter_SquareKilometer":n>=1e6?i.push(`面积:${(n/1e6).toFixed(2)} km²`):i.push(`面积:${n.toFixed(2)} m²`);break;case"MU_Hectare":const r=n*(1/666.7);if(r>=15){const o=r/15;i.push(`面积:${o.toFixed(2)} 公顷`)}else i.push(`面积:${r.toFixed(2)} 亩`);break;case"PerimeterMeter_PerimeterKilometer":t>=1e3?i.push(`周长:${(t/1e3).toFixed(2)} km`):i.push(`周长:${t.toFixed(2)} m`);break}return i}class Er extends f.Destroyable{constructor(e,i){super();E(this,"_pickedEvent",this.dv(new f.Event));E(this,"_flyToEvent",this.dv(new f.Event));E(this,"_area",this.dv(f.react(0)));E(this,"_centerOfMass",this.dv(f.reactArrayWithUndefined(void 0)));E(this,"_distances",this.dv(f.reactArray([])));E(this,"_geoPolyline");E(this,"_id",this.dv(f.react(f.createGuid())));i&&(this.id=i);{const s=()=>{this._distances.value=QP(this.positions),this._area.value=tR(this.positions),this._centerOfMass.value=eR(this.positions)};s();const r=this.dv(f.createNextAnimateFrameEvent(this.positionsChanged));this.dispose(r.disposableOn(s))}{const s=this._geoPolyline=this.dv(new fe(e,i));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 As(e,i));s.outline=!1;const r=()=>{s.positions=this.positions};r(),this.dispose(this.positionsChanged.disposableOn(r));const o=()=>{const a=this.fillColor;s.color=[a[0],a[1],a[2],a[3]*.5]};o(),this.dispose(this.fillColorChanged.disposableOn(o)),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 de(e,i)),r=this.dv(f.createNextAnimateFrameEvent(this.areaChanged,this.centerOfMassChanged,this.distancesChanged,this.unitsChanged)),o=()=>{if(this.distances.length===0){s.innerHTML="";return}const a=iR(this.area,this.distances[this.distances.length-1],this.units);s.innerHTML=ml([...a].join(`
|
|
126
|
+
`))};o(),this.dispose(r.disposableOn(o)),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=>{No(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}}E(Er,"defaults",{positions:[]}),(n=>{n.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"])})})(Er||(Er={})),f.extendClassProps(Er.prototype,Er.createDefaultProps);const Ho=class Ho extends ko{constructor(e,i){super(e,i);E(this,"_olAreaMeasurement");if(this._olAreaMeasurement=this.disposeVar(new Er(i,e.id)),!i.viewer){console.warn("viewer is undefined!");return}e.strokeGround=!1,e.fillGround=!1;const r=this._olAreaMeasurement;this.dispose(f.track([r,"show"],[e,"show"])),this.dispose(f.track([r,"units"],[e,"units"])),this.dispose(f.track([r,"allowPicking"],[e,"allowPicking"])),this.dispose(f.bind([r,"positions"],[e,"points"])),this.dispose(f.bind([r,"strokeGround"],[e,"strokeGround"])),this.d(f.bind([r,"ground"],[e,"fillGround"]));{const o=()=>{if(e.stroked)r.width=e.strokeWidth;else{r.width=0;return}r.color=e.strokeColor;const c=e.strokeStyle;if(c.material==="hasDash"&&c.materialParams)try{const u=c.materialParams;Reflect.has(u,"gapColor")&&(r.gapColor=u.gapColor??[0,0,0,0]),Reflect.has(u,"dashLength")&&(r.dashLength=u.dashLength),Reflect.has(u,"dashPattern")&&(r.dashPattern=u.dashPattern)}catch(u){console.error(u)}else r.gapColor=[0,0,0,0],r.dashLength=0,r.dashPattern=0;const h=e.strokeMaterial??"normal";h==="hasDash"?(r.hasDash=!0,r.hasArrow=!1):h==="hasArrow"?(r.hasDash=!1,r.hasArrow=!0):(r.hasDash=!1,r.hasArrow=!1)};o();const a=this.disposeVar(f.createNextAnimateFrameEvent(e.strokeStyleChanged,e.strokedChanged));this.dispose(a.disposableOn(o))}{const o=()=>{if(e.filled)r.fillColor=e.fillColor;else{r.fillColor=[1,1,1,0];return}};o();const a=this.disposeVar(f.createNextAnimateFrameEvent(e.fillStyleChanged,e.filledChanged));this.dispose(a.disposableOn(o))}this.dispose(r.pickedEvent.disposableOn(o=>{(e.allowPicking??!1)&&e.pickedEvent.emit(o)}))}get olAreaMeasurement(){return this._olAreaMeasurement}};E(Ho,"type",Ho.register("ESOlViewer",f.ESAreaMeasurement.type,Ho));let Cd=Ho;const Os=class Os extends f.Destroyable{constructor(e,i){super();E(this,"_pickedEvent",this.disposeVar(new f.Event));E(this,"_flyToEvent",this.disposeVar(new f.Event));E(this,"_heading",this.disposeVar(f.react(0)));E(this,"_textFunc",this.disposeVar(f.react(void 0)));const s=this;{const a=()=>{if(this.positions&&this.positions.length>=2){let c=0;this.arcType===void 0||this.arcType==="GEODESIC"?c=f.geoHeading(this.positions[0],this.positions[1]):this.arcType==="RHUMB"?c=f.geoRhumbHeading(this.positions[0],this.positions[1]):this.arcType==="NONE"?c=f.geoHeading(this.positions[0],this.positions[1]):console.warn(`未知的arcType: ${this.arcType},导致距离无法计算!`),this._heading.value=this.angleMode==="-180~180"?f.clampN180_180(c):f.clamp0_360(c)}};a();const l=this.disposeVar(f.createNextAnimateFrameEvent(this.positionsChanged,this.arcTypeChanged,this.angleModeChanged));this.dispose(l.disposableOn(a))}const r=this.disposeVar(new fe(e,i));r.loop=!1,this.dispose(f.track([r,"allowPicking"],[s,"allowPicking"])),this.dispose(f.bind([r,"arcType"],[s,"arcType"])),this.dispose(f.bind([r,"color"],[s,"color"])),this.dispose(f.bind([r,"dashLength"],[s,"dashLength"])),this.dispose(f.bind([r,"dashPattern"],[s,"dashPattern"])),this.dispose(f.bind([r,"gapColor"],[s,"gapColor"])),this.dispose(f.bind([r,"hasArrow"],[s,"hasArrow"])),this.dispose(f.bind([r,"hasDash"],[s,"hasDash"])),this.dispose(f.bind([r,"positions"],[s,"positions"])),this.dispose(f.bind([r,"show"],[s,"show"])),this.dispose(f.bind([r,"width"],[s,"width"])),this.dispose(f.bind([r,"depthTest"],[s,"depthTest"])),this.dispose(s.flyToEvent.disposableOn(a=>{e.actived&&r.flyTo(a)}));const o=this.disposeVar(new de(e,i));this.dispose(f.bind([o,"shadowDom"],[s,"shadowDom"])),this.dispose(f.bind([o,"cssAllInitial"],[s,"cssAllInitial"])),this.dispose(f.bind([o,"show"],[s,"show"]));{const a=()=>{s.positions&&s.positions.length>=2?o.position=s.positions[1]:o.position=void 0};a(),this.dispose(s.positionsChanged.disposableOn(a))}{const a=()=>{const{heading:c}=s,h=(s.textFunc??Os.defaultTextFunc_度格式)(c);o.innerHTML=ml(`方向: ${h}`,24)};a();const l=this.disposeVar(f.createNextAnimateFrameEvent(s.headingChanged,s.textFuncChanged));this.dispose(l.disposableOn(a))}this.ad(o.pickedEvent.don(a=>{No(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}};E(Os,"defaultTextFunc_度格式",e=>`${e.toFixed(5)}°`),E(Os,"defaultTextFunc_度分格式",e=>`${yl(e,!0)}`),E(Os,"defaultTextFunc_度分秒格式",e=>`${yl(e,!1)}`),E(Os,"defaults",{positions:[]});let Ds=Os;(n=>{n.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})})(Ds||(Ds={})),f.extendClassProps(Ds.prototype,Ds.createDefaultProps);const Bo=class Bo extends xr{constructor(e,i){super(e,i);E(this,"_olDirectionMeasurement");if(this._olDirectionMeasurement=this.disposeVar(new Ds(i,e.id)),!i.viewer){console.warn("viewer is undefined!");return}const r=this._olDirectionMeasurement;r.angleMode="0~360",this.dispose(f.track([r,"show"],[e,"show"])),this.dispose(f.track([r,"allowPicking"],[e,"allowPicking"])),this.dispose(f.bind([r,"positions"],[e,"points"])),this.dispose(f.bind([r,"strokeGround"],[e,"strokeGround"]));{const o=()=>{if(e.stroked)r.width=e.strokeWidth;else{r.width=0;return}r.width=e.strokeWidth,r.color=e.strokeColor;const c=e.strokeMaterial??"normal";c==="hasDash"?(r.hasDash=!0,r.hasArrow=!1):c==="hasArrow"?(r.hasDash=!1,r.hasArrow=!0):c==="normal"?(r.hasDash=!1,r.hasArrow=!1):(r.hasDash=!1,r.hasArrow=!0);const h=e.strokeStyle;if(h.material==="hasDash"&&h.materialParams)try{const u=h.materialParams;Reflect.has(u,"gapColor")&&(r.gapColor=u.gapColor??[0,0,0,0]),Reflect.has(u,"dashLength")&&(r.dashLength=u.dashLength),Reflect.has(u,"dashPattern")&&(r.dashPattern=u.dashPattern)}catch(u){console.error(u)}else r.gapColor=[0,0,0,0],r.dashLength=0,r.dashPattern=0};o();const a=this.disposeVar(f.createNextAnimateFrameEvent(e.strokeStyleChanged,e.strokedChanged));this.dispose(a.disposableOn(o))}this.dispose(r.pickedEvent.disposableOn(o=>{No(o)===0&&(e.allowPicking??!1)&&e.pickedEvent.emit(o)}))}get olDirectionMeasurement(){return this._olDirectionMeasurement}};E(Bo,"type",Bo.register("ESOlViewer",f.ESDirectionMeasurement.type,Bo));let bd=Bo;function e0(n,t,e,i){const s=new de(e,i);return s.innerHTML=ml(n),s.position=t,s.show=!0,s}class Cr extends f.Destroyable{constructor(e,i){super();E(this,"_pickedEvent",this.disposeVar(new f.Event));E(this,"_flyToEvent",this.disposeVar(new f.Event));E(this,"_distances",this.disposeVar(f.reactArray([])));const s=async()=>{this._distances.value=f.getDistancesFromPositions(this.positions??[],this.arcType)};s();const r=this.disposeVar(f.createNextAnimateFrameEvent(this.positionsChanged,this.arcTypeChanged,this.strokeGroundChanged));this.dispose(r.disposableOn(s));const o=this.disposeVar(new fe(e,i));o.loop=!1,this.dispose(f.track([o,"allowPicking"],[this,"allowPicking"])),this.dispose(f.bind([o,"arcType"],[this,"arcType"])),this.dispose(f.bind([o,"color"],[this,"color"])),this.dispose(f.bind([o,"dashLength"],[this,"dashLength"])),this.dispose(f.bind([o,"dashPattern"],[this,"dashPattern"])),this.dispose(f.bind([o,"gapColor"],[this,"gapColor"])),this.dispose(f.bind([o,"hasArrow"],[this,"hasArrow"])),this.dispose(f.bind([o,"hasDash"],[this,"hasDash"])),this.dispose(f.bind([o,"positions"],[this,"positions"])),this.dispose(f.bind([o,"show"],[this,"show"])),this.dispose(f.bind([o,"width"],[this,"width"])),this.dispose(f.bind([o,"depthTest"],[this,"depthTest"])),this.dispose(this.flyToEvent.disposableOn(a=>{e.actived&&o.flyTo(a)}));{const a=[],l=()=>{for(let h of a)h.destroy();a.length=0};this.dispose(l);const c=()=>{if(l(),!this.positions)return;if(this.positions.length>0&&this.distances.length>0){const u=e0("起点",this.positions[0],e,i);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 h=this.distances.length;for(let u=0;u<h;++u){const d=this.distances[u],g=this.positions[u+1],p=e0(`长度: ${om(d)}`,g,e,i);p.dispose(f.track([p,"show"],[this,"show"])),p.dispose(f.track([p,"shadowDom"],[this,"shadowDom"])),p.dispose(f.track([p,"cssAllInitial"],[this,"cssAllInitial"])),this.ad(p.pickedEvent.don(m=>{No(m)===0&&this.pickedEvent.emit(m)})),a.push(p)}};c(),this.dispose(this.distancesChanged.disposableOn(()=>f.inOrderRunning(c)))}}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}}E(Cr,"defaults",{positions:[]}),(n=>{n.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})})(Cr||(Cr={})),f.extendClassProps(Cr.prototype,Cr.createDefaultProps);const Zo=class Zo extends xr{constructor(e,i){super(e,i);E(this,"_geoPolyline");if(this._geoPolyline=this.disposeVar(new fe(i,e.id)),!i.viewer){console.warn("viewer is undefined!");return}const r=this._geoPolyline;console.log(r.positions),console.log(e.points),this.dispose(f.track([r,"allowPicking"],[e,"allowPicking"])),this.dispose(f.bind([r,"positions"],[e,"points"])),this.dispose(f.track([r,"width"],[e,"strokeWidth"])),this.dispose(f.track([r,"color"],[e,"strokeColor"])),this.dispose(f.track([r,"show"],[e,"show"]));{const o=()=>{r.show=e.show&&e.stroked};o();const a=this.disposeVar(f.createNextAnimateFrameEvent(e.showChanged,e.strokedChanged));this.dispose(a.disposableOn(o))}}get geoPolyline(){return this._geoPolyline}};E(Zo,"type",Zo.register("ESOlViewer",f.ESGeoLineString.type,Zo));let Go=Zo;const jo=class jo extends Go{constructor(e,i){super(e,i);E(this,"_olDistanceMeasurement");if(console.log("OlESDistanceMeasurement constructor",i.viewer),this._olDistanceMeasurement=this.disposeVar(new Cr(i,e.id)),!i.viewer){console.warn("viewer is undefined!");return}const{olDistanceMeasurement:r}=this;this.dispose(f.track([r,"show"],[e,"show"])),this.dispose(f.track([r,"allowPicking"],[e,"allowPicking"])),this.dispose(f.bind([r,"positions"],[e,"points"])),this.dispose(f.bind([r,"strokeGround"],[e,"strokeGround"]));{const o=()=>{if(e.stroked)r.width=e.strokeWidth;else{r.width=0;return}r.width=e.strokeWidth,r.color=e.strokeColor;const c=e.strokeMaterial??"normal";c==="hasDash"?(r.hasDash=!0,r.hasArrow=!1):c==="hasArrow"?(r.hasDash=!1,r.hasArrow=!0):(r.hasDash=!1,r.hasArrow=!1);const h=e.strokeStyle;if(h.material==="hasDash"&&h.materialParams)try{const u=h.materialParams;Reflect.has(u,"gapColor")&&(r.gapColor=u.gapColor??[0,0,0,0]),Reflect.has(u,"dashLength")&&(r.dashLength=u.dashLength),Reflect.has(u,"dashPattern")&&(r.dashPattern=u.dashPattern)}catch(u){console.error(u)}else r.gapColor=[0,0,0,0],r.dashLength=0,r.dashPattern=0};o();const a=this.disposeVar(f.createNextAnimateFrameEvent(e.strokeStyleChanged,e.strokedChanged));this.dispose(a.disposableOn(o))}this.dispose(r.pickedEvent.disposableOn(o=>{No(o)===0&&(e.allowPicking??!1)&&e.pickedEvent.emit(o)}))}get olDistanceMeasurement(){return this._olDistanceMeasurement}};E(jo,"type",jo.register("ESOlViewer",f.ESDistanceMeasurement.type,jo));let Pd=jo;const qo=class qo extends zo{constructor(t,e){super(t,e);const i=e.viewer;if(!i)return;const s=new Ge,r=new Hi.Feature({geometry:new Ne(dt([t.position[0]??0,t.position[1]??0]))});s.addFeature(r),r.setId(t.id),this.d(t.positionChanged.don(g=>{const p=dt([g[0],g[1]]),m=r.getGeometry();m==null||m.setCoordinates(p)}));const o=new ti({source:s});i.addLayer(o),this.d(()=>i.removeLayer(o));let a=64,l=64;{const g=new Image;g.onload=()=>{console.log("Image loaded",g.width),a=g.width,l=g.height},g.src=t.url,this.d(t.urlChanged.don(()=>{const p=f.ESSceneObject.context.getStrFromEnv(f.rpToap(t.url));g.src=p}))}function c(g,p,m){const _=f.ESSceneObject.context.getStrFromEnv(f.rpToap(g)),v=a*p[0],y=l*p[1],w=m*Math.PI/180;return new Pt({image:new Dn({src:_,width:v,height:y,anchor:[.5,1],anchorXUnits:"fraction",anchorYUnits:"fraction",rotation:w})})}let h=c(t.url,[1,1],t.rotation[0]??0);const u=()=>{const g=i.getView().getResolution();if(!g)return;const{size_m:[p,m],minmaxScale:[_,v]}=t;let y=p/g/a,w=m/g/l;y=Math.max(_,Math.min(v,y)),w=Math.max(_,Math.min(v,w)),h=c(t.url,[y,w],t.rotation[0]??0),r.setStyle(h),r.changed()};this.d(f.createEventsCallFunc([t.size_mChanged,t.urlChanged,t.minmaxScaleChanged,t.rotationChanged],u)),u();const d=i.getView().on("change:resolution",()=>{u()});this.d(()=>Si(d))}};E(qo,"type",qo.register("ESOlViewer",f.ESGeoIcon.type,qo));let Rd=qo;const Ko=class Ko extends zo{constructor(e,i){super(e,i);E(this,"_geoPoint");if(this._geoPoint=this.disposeVar(new xi(i,e.id)),!i.viewer){console.warn("viewer is undefined!");return}const r=this._geoPoint;this.d(f.track([r,"allowPicking"],[e,"allowPicking"])),this.d(f.bind([r,"position"],[e,"position"])),this.d(f.track([r,"show"],[e,"show"]));{const o=()=>{r.show=e.show&&e.pointed};o();const a=this.dv(f.createNextAnimateFrameEvent(e.showChanged,e.pointedChanged));this.d(a.don(o))}}get geoPoint(){return this._geoPoint}};E(Ko,"type",Ko.register("ESOlViewer",f.ESGeoPoint.type,Ko));let Id=Ko;const Jo=class Jo extends xr{constructor(e,i){super(e,i);E(this,"_geoPoints");const s=this.dv(new Zn(i,e.id));if(this._geoPoints=s,!i.viewer){console.warn("viewer is undefined!");return}this.d(f.track([s,"allowPicking"],[e,"allowPicking"])),this.d(f.bind([s,"points"],[e,"points"]));{const o=()=>{s.show=e.show&&e.pointed};this.d(f.createEventsCallFunc([e.showChanged,e.pointedChanged],o,{immediate:!0}))}}get geoPoints(){return this._geoPoints}};E(Jo,"type",Jo.register("ESOlViewer",f.ESGeoPoints.type,Jo));let Sd=Jo;const Qo=class Qo extends ko{constructor(e,i){super(e,i);E(this,"_fireLayer");E(this,"_fireFeatures",[]);E(this,"_animationId",null);E(this,"_renderEventsKey",null);E(this,"_flickerPhase",0);if(!i.viewer){console.warn("OlESGeoPolygonWithFire: viewer is undefined!");return}const r=this.geoPolygon;if(r){const o=()=>{r.show=!1};o(),this.d(e.showChanged.don(o)),this.d(e.fireShowChanged.don(o))}this.createFireLayer(i),this.disposeVar(f.createNextAnimateFrameEvent(e.pointsChanged,e.fireShowChanged,e.fireHeightChanged,e.showChanged))}createFireLayer(e){const i=this.sceneObject;if(!i.points||i.points.length<3)return;const s=e.viewer;if(!s)return;const r=new Ge;this._fireLayer=new ti({source:r,zIndex:999}),s.addLayer(this._fireLayer),this.d(()=>{this._fireLayer&&s.removeLayer(this._fireLayer)}),this.createFireFeatures(i),this.startFlickerAnimation()}createFireFeatures(e){if(!this._fireLayer||!e.points)return;const i=e.points,s=e.fireHeight??5,r=Math.max(1,Math.min(10,s)),o=this.calculateCentroid(i),a=dt([o[0],o[1]]),l=i.map(p=>dt([p[0],p[1]])),c=l[0],h=l[l.length-1];(c[0]!==h[0]||c[1]!==h[1])&&l.push(c);const u=1+r*.08,d=[{color:[.8,.1,0,.15+r*.01],expand:u*1.3,stroke:!1},{color:[1,.25,0,.2+r*.02],expand:u*1.15,stroke:!1},{color:[1,.4,0,.3+r*.02],expand:u*1,stroke:!1},{color:[1,.6,0,.4+r*.03],expand:u*.85,stroke:!1},{color:[1,.85,.1,.5+r*.03],expand:u*.65,stroke:!1},{color:[1,1,.6,.4+r*.04],expand:u*.4,stroke:!1}],g=this._fireLayer.getSource();if(g){this._fireFeatures=[];for(const p of d){const m=l.map(w=>{const x=w[0]-a[0],C=w[1]-a[1];return[a[0]+x*p.expand,a[1]+C*p.expand]}),_=new di([m]),v=new Hi.Feature({geometry:_}),y=new Pt({fill:new Ht({color:`rgba(${Math.round(p.color[0]*255)}, ${Math.round(p.color[1]*255)}, ${Math.round(p.color[2]*255)}, ${p.color[3]})`}),stroke:p.stroke?new te({color:`rgba(${Math.round(p.color[0]*255)}, ${Math.round(p.color[1]*255)}, ${Math.round(p.color[2]*255)}, ${p.color[3]*1.5})`,width:2}):void 0});v.setStyle(y),g.addFeature(v),this._fireFeatures.push(v)}}}startFlickerAnimation(){if(!this._fireLayer)return;this.stopFlickerAnimation();const i=this.sceneObject.fireHeight??5,s=Math.max(1,Math.min(10,i)),r=.05+s*.015;this._renderEventsKey=this._fireLayer.on("postrender",o=>{if(!o.frameState)return;this._flickerPhase+=r,this._flickerPhase>Math.PI*2&&(this._flickerPhase-=Math.PI*2);const l=this._fireFeatures,c=this._flickerPhase;for(let h=0;h<l.length;h++){const d=l[h].getStyle();if(!d)continue;const g=d.getFill();if(!g)continue;const p=[.15+s*.01,.2+s*.02,.3+s*.02,.4+s*.03,.5+s*.03,.4+s*.04],m=h*.7,_=Math.sin(c+m)*.5+.5,v=Math.sin(c*2.3+m*1.5)*.3+.7,y=p[h]*(.6+_*.4)*v,x=g.getColor().match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(x){const C=parseInt(x[1]),P=parseInt(x[2]),b=parseInt(x[3]);g.setColor(`rgba(${C}, ${P}, ${b}, ${y})`)}}})}stopFlickerAnimation(){this._renderEventsKey&&(Si(this._renderEventsKey),this._renderEventsKey=null),this._animationId!==null&&(cancelAnimationFrame(this._animationId),this._animationId=null)}destroyFireLayer(){if(this.stopFlickerAnimation(),this._fireLayer){const e=this.olViewer.viewer;e&&e.removeLayer(this._fireLayer),this._fireLayer.dispose(),this._fireLayer=void 0}this._fireFeatures=[]}calculateCentroid(e){let i=0,s=0,r=0;const o=e.length;for(let a=0,l=o-1;a<o;l=a++){const[c,h]=e[l],[u,d]=e[a],g=c*d-u*h;i+=g,s+=(c+u)*g,r+=(h+d)*g}return i*=.5,Math.abs(i)<1e-9?e[0]:(s/=6*i,r/=6*i,[s,r])}};E(Qo,"type",Qo.register("ESOlViewer",f.ESGeoPolygonWithFire.type,Qo));let Td=Qo;class i0 extends f.Destroyable{constructor(e,i){super();E(this,"_olGeoCanvasImagePoi");E(this,"flyTo",(e,i)=>{if(this.olGeoCanvasImagePoi.position){on(this.olViewer,this.olGeoCanvasImagePoi.position,1e3,Ap,e);return}this.olGeoCanvasImagePoi.flyTo(e&&e*1e3)});this.sceneObject=e,this.olViewer=i,this._olGeoCanvasImagePoi=this.dv(new zi(i));const s=this._olGeoCanvasImagePoi;s.pickOnClick=!0,this.d(s.pickedEvent.don(r=>{(e.allowPicking??!1)&&e.pickedEvent.emit(r)}));{const r=h=>{let u=h;return h.includes("inner://")&&(u="${earthsdk3-assets-script-dir}/assets/img/points/"+h.split("inner://")[1]),f.ESSceneObject.context.getStrFromEnv(f.rpToap(u))},o=()=>{const h=r(typeof e.url=="string"?e.url:e.url.url);if(s.imageUri=h,e.sizeByContent){const d=new Image;d.src=h,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(()=>o())),o(),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 h=()=>{s.scale=[e.scale[1],e.scale[2]]};h(),this.d(e.scaleChanged.don(h))}const l=()=>{const h=e.anchor,u=e.offset;h?s.originRatioAndOffset=[...h,-u[0],-u[1]]:s.originRatioAndOffset=[0,0,0,0]},c=this.ad(f.createNextAnimateFrameEvent(e.anchorChanged,e.offsetChanged));this.d(c.don(()=>l())),l(),this.d(s.clickEvent.don(h=>{const{offsetX:u,offsetY:d}=h,p={type:h.button===0?"leftClick":h.button===2?"rightClick":void 0,add:{mousePos:[u,d]}};e.widgetEvent.emit(p)})),this.d(s.hoveredChanged.don(h=>{if(h===void 0)return;const u={type:h?"mouseEnter":"mouseLeave"};e.widgetEvent.emit(u)}))}}get olGeoCanvasImagePoi(){return this._olGeoCanvasImagePoi}}const ta=class ta extends Ed{constructor(e,i){super(e,i);E(this,"_resetting");if(!i.viewer){console.warn("viewer is undefined!");return}const r=this.dv(f.createNextAnimateFrameEvent(this.sceneObject.urlChanged,this.sceneObject.screenRenderChanged,this.sceneObject.sizeByContentChanged,this.sceneObject.sizeChanged));this._resetting=this.dv(new f.ObjResettingWithEvent(r,()=>new i0(this.sceneObject,this.olViewer)))}get resetting(){return this._resetting}flyTo(e,i){const{sceneObject:s,olViewer:r,resetting:o}=this;return r.actived?s.flyToParam||s.flyInParam?super.flyTo(e,i):(o&&o.obj&&o.obj.flyTo(e,i),s.flyOverEvent.emit(i,"over",r),!0):!1}};E(ta,"type",ta.register("ESOlViewer",f.ESImageLabel.type,ta));let Md=ta;function n0(n){switch(n){case"wms":return"WebMapServiceImageryProvider";case"tms":return"TileMapServiceImageryProvider";case"wmts":return"WebMapTileServiceImageryProvider";case"xyz":return"UrlTemplateImageryProvider";case"ion":return"IonImageryProvider";case"auto":default:return"auto"}}const ea=class ea extends Oo{constructor(e,i){super(e,i);E(this,"_olImagery");if(!i.viewer){console.warn("viewer is undefined!");return}const r=this.dv(new xd(i,e.id));this._olImagery=r;const o=this.ad(f.reactJson(""));{const h=()=>{if(typeof e.url=="string")o.value=f.ESSceneObject.context.getStrFromEnv(e.url);else{const u=e.url;u.url=f.ESSceneObject.context.getStrFromEnv(u.url),o.value=u}};h(),this.ad(e.urlChanged.don(h))}const a=()=>{var _,v;if(!o.value)return;const h=(((_=e.options)==null?void 0:_.type)??"auto").toLowerCase(),u=e.options??{};let d={type:"UrlTemplateImageryProvider",url:o.value,rectangle:e.rectangle,maximumLevel:e.maximumLevel,minimumLevel:e.minimumLevel,...u},g=o.value,p=typeof g=="string"?g:g.url;const m=p.toLowerCase();if(n0(h)==="auto")if(m.startsWith("ion://")){const w=+m.substring(6);d={...u,assetId:w,type:"IonImageryProvider"}}else if(m.includes("{x}")||m.includes("{y}")||m.includes("{z}"))d.type="UrlTemplateImageryProvider";else if(m.includes("wmts"))d.type="WebMapTileServiceImageryProvider";else if(m.includes("wms"))d.type="WebMapServiceImageryProvider";else{if(p.includes("/tilemapresource.xml")){const y=p.split("/tilemapresource.xml").join("");typeof g=="string"?g=y:g.url=y,d.url=g}d.type="TileMapServiceImageryProvider"}else{if(h==="tms"&&p.includes("/tilemapresource.xml")){const w=p.split("/tilemapresource.xml").join("");typeof g=="string"?g=w:g.url=w,d.url=g}else if(h==="ion"&&m.startsWith("ion://")){const x=+p.substring(6);d={...u,assetId:x,type:"IonImageryProvider"}}const y=n0(h);y!=="auto"&&(d.type=y)}if(d.type==="WebMapTileServiceImageryProvider"){let y=typeof g=="string"?g:g.url;const w=y.indexOf("?");if(w>=0){const R=new URLSearchParams(y.substring(w+1)),I=R.get("format")||R.get("Format")||d.format;d.format=I||"image/png",y=y.substring(0,w)}else d.format=d.format??"image/png";const x=(v=/\/wmts\/rest\/([^/]+)\//i.exec(y))==null?void 0:v[1];x?d.layer=d.layer??d.layers??x:d.layer=d.layer??d.layers??"";const C=d.tileMatrixSetID||d.TileMatrixSet||"EPSG:4326";let P=d.tileMatrixLabels||d.TileMatrixLabels;(!P||!Array.isArray(P)||P.length===0)&&(P=Array.from({length:22},(R,I)=>`${C}:${I}`)),d.tileMatrixSetID=C,d.tileMatrixLabels=P,d.style=d.style??"default";const b=y.toLowerCase().indexOf("/wmts/");if(b>=0){const R=y.substring(0,b);d.url=`${R}/wmts`;const I=typeof g=="string"?g:g.url,S=/\/wmts\/rest\/([^/]+)\//i.exec(I);S&&S[1]&&(d.layer=S[1]),d._rawUrl=I}else{d.url=y;const R=typeof g=="string"?g:g.url,I=/\/wmts\/rest\/([^/]+)\//i.exec(R);I&&I[1]&&(d.layer=I[1]),d._rawUrl=R}d.requestEncoding="KVP",d.requestencoding="KVP",d.params=void 0}else if(d.type==="WebMapServiceImageryProvider"){const y=d.layer??d.layers??"",w=d.style??"",x=d.format??"image/png";d.params={...d.params??{},LAYERS:y,STYLES:w,FORMAT:x,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。");r.imageryProvider=d};a();const l=[o.changed,e.maximumLevelChanged,e.minimumLevelChanged,e.optionsChanged,e.rectangleChanged],c=this.dv(f.createNextAnimateFrameEvent(...l));this.d(c.don(a)),this.d(f.track([r,"show"],[e,"show"])),this.d(f.track([r,"splitDirection"],[e,"splitDirection"])),this.d(f.track([r,"brightness"],[e,"czmBrightness"])),this.d(f.track([r,"contrast"],[e,"czmContrast"])),this.d(f.track([r,"hue"],[e,"czmHue"])),this.d(f.track([r,"saturation"],[e,"czmSaturation"])),this.d(f.track([r,"gamma"],[e,"czmGamma"])),this.d(f.track([r,"rectangle"],[e,"rectangle"])),this.d(f.track([r,"zIndex"],[e,"zIndex"])),this.d(f.bind([r,"alpha"],[e,"opacity"])),this.d(f.bind([r,"alpha"],[e,"czmAlpha"]))}get olImagery(){return this._olImagery}flyTo(e,i){const{sceneObject:s,olViewer:r,olImagery:o}=this;return r.actived?s.flyToParam||s.flyInParam?super.flyTo(e,i):(o.flyTo(e&&e),s.flyOverEvent.emit(i,"over",r),!0):!1}flyIn(e,i){const{sceneObject:s,olViewer:r,olImagery:o}=this;return r.actived?s.flyInParam?super.flyIn(e,i):(o.flyTo(e&&e),s.flyOverEvent.emit(i,"over",r),!0):!1}};E(ea,"type",ea.register("ESOlViewer",f.ESImageryLayer.type,ea));let Ad=ea;function s0(n,t=!1){const e=yl(n[0],t),i=yl(n[1],t),s=om(n[2]);return[e,i,s]}const ii=class ii extends zo{constructor(e,i){super(e,i);E(this,"_geoCustomDivPoi");E(this,"_textFunc",this.disposeVar(f.react(void 0)));if(!i.viewer){console.warn("viewer is undefined!");return}this._geoCustomDivPoi=this.disposeVar(new de(i,e.id));const r=this.geoCustomDivPoi;this.dispose(f.track([r,"show"],[e,"show"])),this.dispose(f.bind([r,"position"],[e,"position"])),this.dispose(f.track([r,"allowPicking"],[e,"allowPicking"]));{this.dispose(r.pickedEvent.disposableOn(o=>{(e.allowPicking??f.ESLocationMeasurement.defaults.allowPicking)&&e.pickedEvent.emit(o)})),this.dispose(r.innerHtmlMounted.disposableOn(o=>{const a=o.firstElementChild;a&&(a.style.pointerEvents="auto",a.style.cursor="default",a.onclick=l=>r.pickFromDiv(a,{type:"viewerPicking",pointerEvent:l}))}));{const o=()=>{if(!e.position)return;const l=(this.textFunc??ii.defaultTextFunc_度格式)(e.position);r.innerHTML=ml(l)};o();const a=this.disposeVar(f.createNextAnimateFrameEvent(e.positionChanged,this.textFuncChanged));this.dispose(a.disposableOn(o))}{const o=()=>{i.lonLatFormat??(i.lonLatFormat="DECIMAL_DEGREE"),this.textFunc=i.lonLatFormat=="DECIMAL_DEGREE"?ii.defaultTextFunc_度格式:i.lonLatFormat=="DEGREES_DECIMAL_MINUTES"?ii.defaultTextFunc_度分格式:ii.defaultTextFunc_度分秒格式};o(),this.d(i.lonLatFormatChanged.don(()=>{o()}))}}}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,i){const{sceneObject:s,olViewer:r,geoCustomDivPoi:o}=this;return r.actived?s.flyToParam||s.flyInParam?super.flyTo(e,i):(o.flyTo(e),s.flyOverEvent.emit(i,"over",r),!0):!1}flyIn(e,i){const{sceneObject:s,olViewer:r,geoCustomDivPoi:o}=this;return r.actived?s.flyInParam?super.flyIn(e,i):(o.flyTo(e),s.flyOverEvent.emit(i,"over",r),!0):!1}};E(ii,"type",ii.register("ESOlViewer",f.ESLocationMeasurement.type,ii)),E(ii,"defaultTextFunc_度格式",e=>{if(!e)return"";const[i=0,s=0,r=0]=e;return`经度: ${i.toFixed(5)}°
|
|
127
|
+
纬度: ${s.toFixed(5)}°`}),E(ii,"defaultTextFunc_度分格式",e=>{if(!e)return"";const[i,s]=s0(e,!0);return`经度: ${i}
|
|
128
|
+
纬度: ${s}`}),E(ii,"defaultTextFunc_度分秒格式",e=>{if(!e)return"";const[i,s]=s0(e);return`经度: ${i}
|
|
129
|
+
纬度: ${s}`});let Dd=ii;const ia=class ia extends Oo{constructor(e,i){super(e,i);E(this,"_olImagery");if(!i.viewer){console.warn("[OlESMVTLayer] viewer is undefined!");return}const r=this.ad(new xd(i,e.id));this._olImagery=r;const o=this.ad(f.reactJson(""));{const h=async()=>{if(typeof e.url=="string"){const u=f.ESSceneObject.context.getStrFromEnv(e.url);if(nR(u))try{const d=await fetch(u);if(d.ok){const g=await d.json();o.value=g}else o.value=u}catch{o.value=u}else o.value=u}else{const u=e.url;if(typeof u=="object"&&u!==null){const d=Ld(u,f.ESSceneObject.context.getStrFromEnv);o.value=d}else o.value=u}};h(),this.ad(e.urlChanged.don(h))}const a=()=>{var d;const h=o.value;if(!h)return;const u={type:"MVTImageryProvider",url:h,accessToken:e.accessToken||void 0,tileSize:e.tileSize||512,maximumLevel:e.maximumLevel,minimumLevel:e.minimumLevel,rectangle:e.rectangle,style:(d=e.style)!=null&&d.length?e.style:void 0,scheme:e.scheme||"xyz",...typeof h=="object"&&h!==null?{glyphs:h.glyphs,sprite:h.sprite}:{}};r.imageryProvider=u};a();const l=[o.changed,e.maximumLevelChanged,e.minimumLevelChanged,e.tileSizeChanged,e.rectangleChanged,e.styleChanged,e.schemeChanged,e.accessTokenChanged],c=this.dv(f.createNextAnimateFrameEvent(...l));this.d(c.don(a)),this.d(f.track([r,"show"],[e,"show"])),this.d(f.track([r,"zIndex"],[e,"zIndex"])),this.d(f.track([r,"rectangle"],[e,"rectangle"])),this.d(f.bind([r,"alpha"],[e,"opacity"])),this.d(f.bind([r,"alpha"],[e,"czmAlpha"]))}get olImagery(){return this._olImagery}flyTo(e,i){const{sceneObject:s,olViewer:r,olImagery:o}=this;return r.actived?s.flyToParam||s.flyInParam?super.flyTo(e,i):(o==null||o.flyTo(e&&e),s.flyOverEvent.emit(i,"over",r),!0):!1}flyIn(e,i){const{sceneObject:s,olViewer:r,olImagery:o}=this;return r.actived?s.flyInParam?super.flyIn(e,i):(o==null||o.flyTo(e&&e),s.flyOverEvent.emit(i,"over",r),!0):!1}};E(ia,"type",ia.register("ESOlViewer",f.ESMVTLayer.type,ia));let Fd=ia;function Ld(n,t){if(typeof n=="string")return t(n);if(Array.isArray(n))return n.map(e=>Ld(e,t));if(n&&typeof n=="object"){const e={};for(const[i,s]of Object.entries(n))i==="url"&&typeof s=="string"?e[i]=t(s):e[i]=Ld(s,t);return e}return n}function nR(n){if(!n)return!1;const t=n.toLowerCase();return!!(t.includes("style.json")||t.endsWith(".json")||!t.includes("{z}")&&!t.includes("{x}")&&!t.includes("{y}"))}function Vo(n,t){const[e,i]=n,[s,r]=t;return Math.sqrt(Math.pow(e-s,2)+Math.pow(i-r,2))}function Wo(n,t,e){const[i,s]=n,r=Math.cos(t*Math.PI/180)*e+i,o=Math.sin(t*Math.PI/180)*e+s;return[r,o]}const fc=(n,t=!1)=>{const[[e=0,i=0],[s=0,r=0]]=n;return t?Math.atan2(r-i,s-e)*180/Math.PI:Math.atan2(r-i,s-e)};function sR(n,t,e){let i=1/0,s=0,r=0,o=0;for(let g=0;g<n.length-1;g++){const[p,m]=n[g],[_,v]=n[g+1],[y,w]=t,x=y-p,C=w-m,P=_-p,b=v-m,R=x*P+C*b,I=P*P+b*b;let S=I!==0?R/I:-1,F,k;S<0?(F=p,k=m,S=0):S>1?(F=_,k=v,S=1):(F=p+S*P,k=m+S*b);const T=Math.sqrt((y-F)*(y-F)+(w-k)*(w-k));T<i&&(i=T,s=g,r=S)}for(let g=0;g<s;g++)o+=Vo(n[g],n[g+1]);o+=r*Vo(n[s],n[s+1]);const a=o+e;let l=0;for(let g=0;g<n.length-1;g++)l+=Vo(n[g],n[g+1]);let c=0;if(a<=0){const g=fc([n[0],n[1]],!0);return{point:Wo(n[0],g+180,Math.abs(a)),angle:g,isValid:!1}}for(let g=0;g<n.length-1;g++){const p=Vo(n[g],n[g+1]);if(c+p>=a){const _=(a-c)/p,[v,y]=n[g],[w,x]=n[g+1],C=[v+_*(w-v),y+_*(x-y)],P=fc([n[g],n[g+1]],!0);return{point:C,angle:P,isValid:!0}}c+=p}const h=n.length-1,u=fc([n[h-1],n[h]],!0),d=a-c;return{point:Wo(n[h],u,d),angle:u,isValid:!1}}function r0(n,t,e,i,s){let r=Vo(n,t),o=fc([n,t],!0);const a=s-i;if(a>0&&r>a){const[l,c]=Wo(n,o,a);return e.push([l,c,o,!0]),r0([l,c],t,e,0,s)}else return r+i}function o0(n,t,e){const i=[];let s=0;s+=Math.max(0,t%e);for(let r=0,o=n.length-1;r<o;r++){const[a,l]=[n[r],n[r+1]];i.push([...a,0,!1]),s=r0(a,l,i,s,e),s=s%e,i.push([...l,0,!1])}return i}const na=class na extends Go{constructor(e,i){super(e,i);E(this,"animationId",null);E(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});E(this,"offset",this.sceneObject.strokeWidth*this.options.ARROW_OFFSET_RATIO*globalThis.devicePixelRatio);E(this,"eventsKey",null);const s=i.viewer;if(!s)return;const r=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:o}=this.options;this.eventsKey=r.on("postrender",l=>{e.materialMode==="singleArrow"?this._rendererSingleArrows(l):this._rendererArrows(l)});const a=l=>{const c=(e.speed??1)*o,h=Math.max(.1,c);this.offset-=h,this.offset<=0&&(this.offset=this.sceneObject.strokeWidth*this.options.ARROW_OFFSET_RATIO*globalThis.devicePixelRatio),s.render(),this.animationId=requestAnimationFrame(a)};this.animationId=requestAnimationFrame(a)},{immediate:!0}))}clear(){this.animationId&&cancelAnimationFrame(this.animationId),this.animationId=null,this.eventsKey&&Si(this.eventsKey),this.eventsKey=null,this.offset=this.sceneObject.strokeWidth*this.options.ARROW_OFFSET_RATIO*globalThis.devicePixelRatio}_rendererSingleArrows(e){var d;const{ARROW_LINE_WIDTH_RATIO:i,ARROW_OFFSET_RATIO:s,ARROW_LINE_COLOR:r}=this.options,o=wg(e),a=e.target,l=o.transform_,c=o.context_,h=a.getSource(),u=(d=e.frameState)==null?void 0:d.extent;e.frameState&&(e.frameState.animate=!0),!(!h||!u)&&h.forEachFeatureInExtent(u,g=>{const p=g.getGeometry();let m;p instanceof fs?m=p.getLineStrings():p instanceof fi&&(m=[p]),m&&m.forEach(_=>{const v=_.getFlatCoordinates(),y=Di(v,0,v.length,2,l,[]);let w=[];for(let C=0;C<y.length;C+=2){const P=y[C],b=y[C+1];w.push([P,b])}const x=o0(w,this.offset,this.sceneObject.strokeWidth*s*globalThis.devicePixelRatio);c.lineWidth=this.sceneObject.strokeWidth*i*globalThis.devicePixelRatio,c.strokeStyle=r,x.filter(C=>C[3]).forEach(C=>{const[P,b,R]=C,I=Wo([P,b],R-180,5),S=this.sceneObject.strokeWidth*.5*globalThis.devicePixelRatio,F=Math.atan2(b-I[1],P-I[0]),k=P-S*Math.cos(F+45*Math.PI/180),T=b-S*Math.sin(F+45*Math.PI/180),L=P-S*Math.cos(F-45*Math.PI/180),A=b-S*Math.sin(F-45*Math.PI/180);c.beginPath(),c.moveTo(k,T),c.lineTo(P,b),c.lineTo(L,A),c.stroke()})})})}_rendererArrows(e){var p;const{ARROW_OFFSET_RATIO:i,ARROW_LINE_WIDTH_RATIO:s,ARROW_LINE_COLOR:r,ARROWS_PER_GROUP:o,ARROW_SPACING_RATIO:a}=this.options,l=wg(e),c=e.target,h=l.transform_,u=l.context_,d=c.getSource(),g=(p=e.frameState)==null?void 0:p.extent;e.frameState&&(e.frameState.animate=!0),!(!d||!g)&&d.forEachFeatureInExtent(g,m=>{const _=m.getGeometry();let v;_ instanceof fs?v=_.getLineStrings():_ instanceof fi&&(v=[_]),v&&v.forEach(y=>{const w=y.getFlatCoordinates(),x=Di(w,0,w.length,2,h,[]);let C=[];for(let b=0;b<x.length;b+=2){const R=x[b],I=x[b+1];C.push([R,I])}const P=o0(C,this.offset,this.sceneObject.strokeWidth*i*globalThis.devicePixelRatio);u.lineWidth=this.sceneObject.strokeWidth*s*globalThis.devicePixelRatio,u.strokeStyle=r,P.filter(b=>b[3]).forEach(b=>{const[R,I,S]=b;for(let F=0;F<o;F++){const k=(F-(o-1)/2)*this.sceneObject.strokeWidth*a*globalThis.devicePixelRatio,T=sR(C,[R,I],k);if(!T.isValid)continue;const[L,A]=T.point,U=T.angle,N=Wo([L,A],U-180,5),$=this.sceneObject.strokeWidth*.5*globalThis.devicePixelRatio,X=Math.atan2(A-N[1],L-N[0]),Z=L-$*Math.cos(X+45*Math.PI/180),J=A-$*Math.sin(X+45*Math.PI/180),O=L-$*Math.cos(X-45*Math.PI/180),gt=A-$*Math.sin(X-45*Math.PI/180);u.beginPath(),u.moveTo(Z,J),u.lineTo(L,A),u.lineTo(O,gt),u.stroke()}})})})}};E(na,"type",na.register(ki.type,f.ESPath.type,na));let Od=na;const sa=class sa extends Ed{constructor(e,i){super(e,i);E(this,"_olTextLabel");this._olTextLabel=this.disposeVar(new Wn(i,e.id));const s=this._olTextLabel,r=()=>{const a=e.anchor,l=e.offset;a?s.originRatioAndOffset=[...a,-l[0],-l[1]]:s.originRatioAndOffset=[0,0,0,0]},o=this.ad(f.createNextAnimateFrameEvent(e.anchorChanged,e.offsetChanged));this.dispose(o.disposableOn(()=>r())),r(),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 h;const l=(h=iu(a,"pickResult"))==null?void 0:h.pointerEvent;if(!l)return;const c={type:l.buttons!=0&&l.button==0?"leftClick":l.button==2?"rightClick":void 0,add:{mousePos:[l.offsetX,l.offsetY]}};c.type==null&&(c.type=l.type),e.widgetEvent.emit(c)}));{let a;const l=c=>{c&&(a=c),a&&(a.style.pointerEvents=e.editing?"none":"all")};this.d(e.editingChanged.don(()=>l(void 0))),this.ad(this._olTextLabel.divCreatedEvent.don(c=>l(c)))}}get olTextLabel(){return this._olTextLabel}};E(sa,"type",sa.register(ki.type,f.ESTextLabel.type,sa));let zd=sa;const be=Math.PI,a0=6378245,l0=.006693421622965943;function c0(n,t){let e=rR(n-105,t-35),i=oR(n-105,t-35);const s=t/180*be;let r=Math.sin(s);r=1-l0*r*r;const o=Math.sqrt(r);return e=e*180/(a0*(1-l0)/(r*o)*be),i=i*180/(a0/o*Math.cos(s)*be),[i,e]}function h0(n,t){return n<72.004||n>137.8347||t<.8293||t>55.8271}function rR(n,t){let e=-100+2*n+3*t+.2*t*t+.1*n*t+.2*Math.sqrt(Math.abs(n));return e+=(20*Math.sin(6*n*be)+20*Math.sin(2*n*be))*2/3,e+=(20*Math.sin(t*be)+40*Math.sin(t/3*be))*2/3,e+=(160*Math.sin(t/12*be)+320*Math.sin(t*be/30))*2/3,e}function oR(n,t){let e=300+n+2*t+.1*n*n+.1*n*t+.1*Math.sqrt(Math.abs(n));return e+=(20*Math.sin(6*n*be)+20*Math.sin(2*n*be))*2/3,e+=(20*Math.sin(n*be)+40*Math.sin(n/3*be))*2/3,e+=(150*Math.sin(n/12*be)+300*Math.sin(n/30*be))*2/3,e}const u0=function(n){return function(t,e,i){const s=t.length,r=i||2;let o;e?o=e:r!==2?o=t.slice():o=new Array(s);for(let a=0;a<s;a+=r)n(t,o,a);return o}},gc={toWGS84:u0(function(n,t,e){let i=n[e],s=n[e+1];if(!h0(i,s)){const r=c0(i,s);i=i-r[0],s=s-r[1]}t[e]=i,t[e+1]=s}),fromWGS84:u0(function(n,t,e){let i=n[e],s=n[e+1];if(!h0(i,s)){const r=c0(i,s);i=i+r[0],s=s+r[1]}t[e]=i,t[e+1]=s})},Le={ll2smerc:Ki("EPSG:4326","EPSG:3857"),smerc2ll:Ki("EPSG:3857","EPSG:4326")};Le.ll2gmerc=function(n,t,e){const i=gc.fromWGS84(n,t,e);return Le.ll2smerc(i,i,e)},Le.gmerc2ll=function(n,t,e){const i=Le.smerc2ll(n,n,e);return gc.toWGS84(i,t,e)},Le.smerc2gmerc=function(n,t,e){let i=Le.smerc2ll(n,n,e);return i=gc.fromWGS84(i,i,e),Le.ll2smerc(i,i,e)},Le.gmerc2smerc=function(n,t,e){let i=Le.smerc2ll(n,n,e);return i=gc.toWGS84(i,i,e),Le.ll2smerc(i,i,e)};const kd=new Or({code:"GCJ-02",extent:[-20037508342789244e-9,-20037508342789244e-9,20037508342789244e-9,20037508342789244e-9],units:"m"});Fa(kd),Df("EPSG:4326",kd,Le.ll2gmerc,Le.gmerc2ll),Df("EPSG:3857",kd,Le.smerc2gmerc,Le.gmerc2smerc);class aR extends f.Destroyable{constructor(t,e){super();const i=e.viewer;if(!i){console.warn("map is undefined!");return}const s=ln(i);if(!s)return;const{imageriesManager:r}=s,o=mt("EPSG:3857");if(!o)return;const a=o.getExtent(),l=ut(a)/256,c=new Array(19),h=new Array(19);for(let g=0;g<19;++g)c[g]=l/Math.pow(2,g),h[g]=g;const u=new Il({tileGrid:new Xn(t.tileGrid??{origin:Te(a),resolutions:c,matrixIds:h}),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??o,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 Cl({source:u});r.add(d),this.dispose(()=>r.delete(d)),d.setVisible(t.show??!0),this.dispose(()=>d.dispose()),this.dispose(t.showChanged.disposableOn(g=>{d.setVisible(g??!0)})),this.d(f.createEventsCallFunc(t.zIndexChanged,()=>{r.setZindex(d,t.zIndex??0)},{immediate:!0}));{const g=()=>{u.tileGrid=new Xn(t.tileGrid??{origin:Te(a),resolutions:c,matrixIds:h}),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+")")())},p=this.disposeVar(f.createNextAnimateFrameEvent(t.attributionsChanged,t.tileGridChanged,t.tileLoadFunctionChanged,t.tileUrlFunctionChanged));this.dispose(p.disposableOn(g))}t.urlChanged.disposableOn(g=>{u.setUrl(g??"")}),t.urlsChanged.disposableOn(g=>{u.setUrls(g??[])})}}const ra=class ra extends Oo{constructor(t,e){super(t,e);let i;this.dispose(()=>i&&i.destroy());{const s=()=>{i&&i.destroy(),i=new aR(t,e)};s();const r=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(r.disposableOn(s))}}};E(ra,"type",ra.register(ki.type,f.ESXYZLayer.type,ra));let Nd=ra;const zs=class zs extends Se{constructor(e){super();E(this,"_config",this.disposeVar(f.react(zs.defaultConfig)));E(this,"_overEvent",this.disposeVar(new f.Event));E(this,"_pointerEventFilterFunc",this.disposeVar(f.react(zs.defaultPointerEventFilterFunc)));if(!!e.viewer){{const i=()=>{const{config:s}=this;s.clickEnabled!==void 0&&(this.clickEnabled=s.clickEnabled),s.dblClickEnabled!==void 0&&(this.dblClickEnabled=s.dblClickEnabled)};i(),this.dispose(this.configChanged.disposableOn(i))}{const i=this.ad(new xi(e));i.pixelSize=4,i.outlineColor=[0,0,.8,1],i.outlineWidth=2,i.allowPicking=!1;{const s=()=>{if(!this.position)return;const r=[...this.position];i.position=r,i.show=!!this.position};s(),this.dispose(this.positionChanged.disposableOn(s))}}this.ad(new f.ObjResettingWithEvent(this.enabledChanged,()=>this.enabled?new lR(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}};E(zs,"defaultConfig",{clickEnabled:!0,dblClickEnabled:!0}),E(zs,"defaultPointerEventFilterFunc",e=>e.button===0),E(zs,"defaults",{...Se.defaults,position:[116.39,39.9,0]});let Ei=zs;(n=>{n.createDefaultProps=()=>({...Se.createDefaultProps(),position:f.reactArrayWithUndefined(void 0),virtualHeight:void 0,clickEnabled:!0,dblClickEnabled:!1})})(Ei||(Ei={})),f.extendClassProps(Ei.prototype,Ei.createDefaultProps);class lR extends f.Destroyable{constructor(e,i){super();E(this,"_doings",[]);E(this,"initDoings",this.ad(()=>{this._doings.forEach(e=>e.destroy()),this._doings.length=0}));this._olViewer=e,this._placeEditing=i;{const s=(r,o)=>{o=="click"&&(!i.clickEnabled||!i.pointerEventFilterFunc(r))||o=="dblclick"&&(!i.dblClickEnabled||!i.pointerEventFilterFunc(r))||(i.over(),i.enabled=!1)};this.ad(e.clickEvent.don(r=>{r.pointerEvent&&s(r.pointerEvent,"click")})),this.ad(e.dblclickEvent.don(r=>{r.pointerEvent&&s(r.pointerEvent,"dblclick")}))}this.ad(e.pointerMoveEvent.don(s=>{if(!s.pointerEvent)return;const r=new cR(this,s.pointerEvent,o=>{const a=[...o];e.editingHeightOffset&&(a[2]+=e.editingHeightOffset),i.position=a,this._doings.splice(0,this._doings.indexOf(r)+1).forEach(c=>c.destroy())});this._doings.push(r)}))}get olViewer(){return this._olViewer.viewer}get placeEditing(){return this._placeEditing}}class cR extends f.Destroyable{constructor(t,e,i){super(),this._owner=t;const{olViewer:s}=this._owner;if(!s)return;const r=Lp(s,e,this._owner.placeEditing.virtualHeight),[o]=f.getEventFromPromise(r);this.dispose(o.disposableOn(i))}}class $e extends Se{constructor(){super()}}E($e,"defaults",{...Se.defaults,position:[116.39,39.9,0]}),(n=>{n.createDefaultProps=()=>({...Se.createDefaultProps(),position:f.reactArrayWithUndefined(void 0)})})($e||($e={})),f.extendClassProps($e.prototype,$e.createDefaultProps);function d0(n,t){const e=new fe(n);return e.hasArrow=!0,e.arcType="RHUMB",e.width=4,e.color=t,e}const pn=class pn extends f.Destroyable{constructor(t){if(super(),!t.viewer)return;const e=this.disposeVar(d0(t,pn.defaults.xAxisColor)),i=this.disposeVar(d0(t,pn.defaults.yAxisColor));{const s=()=>{e.show=this.xAxisShow&&this.show,i.show=this.yAxisShow&&this.show};s();const r=this.ad(f.createNextAnimateFrameEvent(this.showChanged,this.xAxisShowChanged,this.yAxisShowChanged));this.dispose(r.disposableOn(s))}{const s=()=>{var g;const{position:o=pn.defaults.position,heading:a=pn.defaults.heading}=this,h=((g=t.viewer)==null?void 0:g.getView().getResolution())*65,u=f.geoRhumbDestination(o,h,90+a),d=f.geoRhumbDestination(o,h,0+a);u&&(e.positions=[o,u]),d&&(i.positions=[o,d])};s();const r=this.disposeVar(f.createNextAnimateFrameEvent(this.positionChanged,this.dimensionsChanged,this.headingChanged));this.dispose(r.disposableOn(s))}{const s=()=>{e.color=this.xAxisColor??pn.defaults.xAxisColor,i.color=this.yAxisColor??pn.defaults.yAxisColor};s();const r=this.disposeVar(f.createNextAnimateFrameEvent(this.xAxisColorChanged,this.yAxisColorChanged));this.dispose(r.disposableOn(s))}}};E(pn,"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 jn=pn;(n=>{n.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})})(jn||(jn={})),f.extendClassProps(jn.prototype,jn.createDefaultProps);class $i extends f.Destroyable{constructor(e,i){super();E(this,"_flyToEvent",this.disposeVar(new f.Event));E(this,"_layer");E(this,"_source");const s=e.viewer;if(!s)return;this._source=new Ge,this._layer=new ti({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 r=()=>{var a;if(this._source&&(this._source.clear(),!!this.positions)){for(const l of this.positions){if(!l||l.length<2)continue;const c=l.map(d=>dt([d[0],d[1]]));this.loop&&c.length>=3&&c.push(c[0]);const h=new fi(c),u=new je({geometry:h});u.setId(f.createGuid()),u.setStyle(new Pt({stroke:new te({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)}};r();const o=this.disposeVar(f.createNextAnimateFrameEvent(this.positionsChanged,this.showChanged,this.colorChanged,this.loopChanged,this.hasDashChanged,this.dashLengthChanged,this.widthChanged));this.dispose(o.disposableOn(r)),this.dispose(this.flyToEvent.disposableOn(a=>{if(!this.positions||this.positions.length===0)return;const l=this.positions.flat();if(l.length===0)return;const c=l[Math.floor(l.length/2)];on(e,c)}))}get typeName(){return"OlPolylines"}get defaultProps(){return $i.createDefaultProps()}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}}(n=>{n.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"})})($i||($i={})),f.extendClassProps($i.prototype,$i.createDefaultProps);const Kn=class Kn extends $e{constructor(e){super();E(this,"dragStarted",this.ad(new f.Event));E(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($e.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))});E(this,"_createCoordinates",e=>{const i=this.ad(new jn(e));this.dispose(this._opInfo.step.changed.disposableOn(()=>{f0(i,this._opInfo.constraintMode.value,this._opInfo.step.value)}));{const s=()=>{const o=[...this.position??Kn.defaults.position];i.position=o};s(),this.dispose(this.positionChanged.disposableOn(s))}{const s=()=>{i.heading=this.heading??0};s(),this.dispose(this.headingChanged.disposableOn(s))}{const s=()=>{i.dimensions=this._opInfo.originDimensions.value};s(),this.dispose(this._opInfo.originDimensions.changed.disposableOn(s))}return i});E(this,"_createOriginCoordinates",e=>{const i=this.ad(new jn(e));i.xAxisColor=[1,0,0,.5],i.yAxisColor=[0,1,0,.5];const{originPosition:s,originHeading:r,originDimensions:o}=this._opInfo;{const a=()=>{i.position=s.value};a(),this.dispose(s.changed.disposableOn(a))}{const a=()=>{i.heading=r.value??0};a(),this.dispose(r.changed.disposableOn(a))}{const a=()=>{i.dimensions=o.value};a(),this.dispose(o.changed.disposableOn(a))}return i});E(this,"_createGrid",e=>{const i=this.ad(new $i(e));{const s=()=>{var d;const o=this._opInfo.originPosition.value,a=this._opInfo.originHeading.value,c=((d=e.viewer)==null?void 0:d.getView().getResolution())*15,h=c*5,u=[];for(let g=-4;g<5;++g){const p=f.geoRhumbDestination(o,g*c,a+90);if(p){const m=f.geoRhumbDestination(p,h,a+180),_=f.geoRhumbDestination(p,h,a);m&&_&&u.push([m,p,_])}}for(let g=-4;g<5;++g){const p=f.geoRhumbDestination(o,g*c,a);if(p){const m=f.geoRhumbDestination(p,h,a-90),_=f.geoRhumbDestination(p,h,a+90);m&&_&&u.push([m,p,_])}}i.positions=u};s();const r=this.disposeVar(f.createNextAnimateFrameEvent(this._opInfo.originPosition.changed,this._opInfo.originHeading.changed,this._opInfo.originDimensions.changed));this.dispose(r.disposableOn(s))}return i});E(this,"_createHelpLine",e=>{const i=this.ad(new fe(e));i.hasDash=!0,i.arcType="RHUMB",i.color=[1,1,0,.99];{const s=()=>{i.positions=[this._opInfo.originPosition.value,this._opInfo.targetPosition.value]},r=this.ad(f.createNextAnimateFrameEvent(this._opInfo.originPosition.changed,this._opInfo.targetPosition.changed));this.ad(r.don(s))}return i});E(this,"_createCircle",e=>{const i=this.ad(new $i(e));i.arcType="RHUMB",i.width=2,i.hasDash=!0,i.loop=!1,i.color=[1,1,0,1],i.show=!0;const s=this.disposeVar(f.createNextAnimateFrameEvent(this._opInfo.originPosition.changed,this._opInfo.originDimensions.changed)),r=()=>{var u;const o=this._opInfo.originPosition.value,l=((u=e.viewer)==null?void 0:u.getView().getResolution())*70,c=[],h=32;for(let d=0;d<=h;++d){const g=d*360/h,p=f.geoRhumbDestination(o,l,g);p&&c.push(p)}c.length>0&&c.push(c[0]),i.positions=[c]};return r(),this.dispose(s.disposableOn(r)),i});E(this,"_pickingXYProcessing",e=>this.ad(new f.Processing((i,s,r)=>{const o=[0,0,0];return e.pointerMoveEvent.don(a=>{if(!a.pointerEvent||!e.viewer)return;const l=e.viewer.getEventPixel(a.pointerEvent);if(!l)return;const c=e.viewer.getCoordinateFromPixel(l);if(!c)return;const h=ae(c,e.viewer.getView().getProjection());if(o[0]=h[0],o[1]=h[1],o[2]=this._opInfo.originPosition.value[2],this._opInfo.constraintMode.value==="x")Vn(this._opInfo.originPosition.value,this._opInfo.originHeading.value+90,o,o);else if(this._opInfo.constraintMode.value==="y")Vn(this._opInfo.originPosition.value,this._opInfo.originHeading.value,o,o);else if(this._opInfo.constraintMode.value!=="xy"){console.warn("should not be here!");return}this._opInfo.movingPosition.value=o;const u=[0,0,0];f.geoRhumbDestination(o,r,s,u),this._opInfo.targetPosition.value=u})})));if(!e.viewer)return;const i=this.ad(f.reactArray([1,1,1]));this.ad(e.dblclickEvent.don(()=>this.enabled=!1)),this.ad(new Np(e.viewer,this.positionReact,i,this.axisPixelSize));{this.ad(this._opInfo.targetPosition.changed.don(r=>{if(this._opInfo.moved){const o=[...r];this.position=o}})),this.ad(this._opInfo.targetHeading.changed.don(r=>this._opInfo.moved&&(this.heading=r)));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((r,o)=>r===this._opInfo.targetPosition.value[o])){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),r=this._createOriginCoordinates(e),o=this._createGrid(e),a=this._createHelpLine(e),l=this._createCircle(e);{const d=()=>{l.show=o.show=this.enabled&&this.showCircle,a.show=this.enabled&&this.showCircle&&this._opInfo.moved.value,s.show=this.enabled&&this.showCoordinates,r.show=this.enabled&&this.showCoordinates&&this._opInfo.moved.value};d();const g=this.ad(f.createNextAnimateFrameEvent(this.enabledChanged,this.showCircleChanged,this.showCoordinatesChanged,this._opInfo.moved.changed));this.ad(g.don(d))}{const d=()=>{s.xAxisShow=r.xAxisShow=this.xAxisShow,s.yAxisShow=r.yAxisShow=this.yAxisShow};d();const g=this.ad(f.createNextAnimateFrameEvent(this.xAxisShowChanged,this.yAxisShowChanged));this.ad(g.don(d))}{const d=()=>{o.color=this._opInfo.constraintMode.value!=="none"?[1,1,0,.6]:[1,1,0,.3],f0(s,this._opInfo.constraintMode.value,this._opInfo.step.value)};d(),this.dispose(this._opInfo.constraintMode.changed.disposableOn(d))}const c=this._pickingXYProcessing(e),h=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 g=>{const p=()=>{const w=[...this.position??Kn.defaults.position];this._opInfo.targetPosition.value=this._opInfo.originPosition.value=w},m=()=>this._opInfo.targetHeading.value=this._opInfo.originHeading.value=this.heading,_=()=>this._opInfo.originDimensions.value=i.value;g.disposer.dispose((p(),this.positionChanged.don(p))),g.disposer.dispose((m(),this.headingChanged.don(m))),g.disposer.dispose((_(),i.changed.don(_)));const v={constraintMode:"none",startDragPos:[0,0,0]},y=w=>{const x={position:s.position??Kn.defaults.position,heading:s.heading??Kn.defaults.heading,dimensions:s.dimensions??Kn.defaults.dimensions};e.viewer&&Op(w,e.viewer,x,this.axisSnapPixelSize,v,{x:this.disableX,y:this.disableY,xy:this.disableXY}),this._opInfo.constraintMode.value=v.constraintMode,this._opInfo.movingPosition.value=this._opInfo.draggingStartPosition.value=v.startDragPos};g.disposer.dispose(e.pointerMoveEvent.don(w=>{w.pointerEvent&&y(w.pointerEvent)})),await f.step(g,w=>new Promise((x,C)=>{w.disposer.dispose(C),w.disposer.dispose(e.pointerDownEvent.don(P=>{P.pointerEvent&&y(P.pointerEvent),P.pointerEvent&&P.pointerEvent.button===0&&v.constraintMode!=="none"&&x()}))}))}),this.dragStarted.emit(),this._opInfo.step.value=!1,await f.step(d,async g=>{if(e.incrementDisabledInputStack(),console.log("检查地图交互编辑模式",e.disabledInputStack),g.disposer.dispose(()=>{e.decrementDisabledInputStack()}),["xy","x","y"].includes(this._opInfo.constraintMode.value)){const p=f.geoRhumbHeading(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value),m=f.geoRhumbDistance(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value);c.restart(void 0,p,m),g.disposer.dispose(()=>c.cancel())}else console.warn(`pickingInfo.constraintMode error! ${this._opInfo.constraintMode.value}`);await f.step(g,p=>new Promise((m,_)=>{p.disposer.dispose(_),p.disposer.dispose(e.pointerUpEvent.don(()=>{m()})),p.disposer.dispose(e.pointerOutEvent.don(()=>m()))}))});while(!0)})),u=()=>{this.enabled?h.restart():h.isRunning&&h.cancel()};u(),this.ad(this.enabledChanged.don(u))}}};E(Kn,"defaults",{...$e.defaults,heading:0,dimensions:[200,200,200],xAxisColor:[1,0,0,1],yAxisColor:[0,1,0,1]});let Ci=Kn;(n=>{n.createDefaultProps=()=>({...$e.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})})(Ci||(Ci={})),f.extendClassProps(Ci.prototype,Ci.createDefaultProps);function f0(n,t,e){n.xAxisColor=[1,0,0,.99],n.yAxisColor=[0,1,0,.99],t==="x"?n.xAxisColor=e?[1,1,0,.8]:[1,1,0,.99]:t==="y"?n.yAxisColor=e?[1,1,0,.8]:[1,1,0,.99]:t==="xy"&&(n.xAxisColor=e?[1,1,0,.8]:[1,1,0,.99],n.yAxisColor=e?[1,1,0,.8]:[1,1,0,.99])}class br extends f.Destroyable{constructor(e){super();E(this,"_vectorLayer");E(this,"_feature");E(this,"_circleCanvas");E(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 h,u,d;const s=(h=this._circleCanvas)==null?void 0:h.getContext("2d");if(!s)return;const r=this.color,o=`rgba(${r[0]*255|0}, ${r[1]*255|0}, ${r[2]*255|0}, ${r[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,${r[3]})`,s.stroke(),s.lineWidth=4,s.beginPath(),s.arc(128,128,64,0,Math.PI*2,!1),s.strokeStyle=o,s.stroke();let a=this.circleRotation*Math.PI/180;a=Math.atan2(Math.sin(a),Math.cos(a));const l=a<0;s.lineWidth=3,s.beginPath(),s.moveTo(128,128),s.arc(128,128,64,0,a,l),s.lineTo(128,128),s.fillStyle=`rgba(${r[0]*255|0}, ${r[1]*255|0}, ${r[2]*255|0}, 0.5)`,s.fill(),s.save(),s.font="16px console",s.textBaseline="middle",s.textAlign="center";const c=`${this.circleRotation.toFixed(1)}°`;s.translate(128,128),s.rotate(Math.PI*.5),s.rotate(a*.5),s.translate(-128,-128),s.fillStyle="white",s.fillText(c,128,54),s.restore(),(d=(u=this._feature)==null?void 0:u.changed)==null||d.call(u)};e();const i=this.ad(f.createNextAnimateFrameEvent(this.colorChanged,this.circleRotationChanged,this.circleStartRotationChanged,this.circleEndRotationChanged));this.ad(i.don(e))}_createVectorLayer(e){var r;const i=new Ge;this._feature=new je({geometry:new Ne([0,0])});const s=()=>{if(!this._circleCanvas)return new Pt;const o=this.pixelSize??300;return new Pt({image:new Dn({img:this._circleCanvas,width:o,height:o,anchor:[.5,.5],anchorXUnits:"fraction",anchorYUnits:"fraction"}),text:new qs({text:"",font:"0px console"})})};this._feature.setStyle(s),i.addFeature(this._feature),this._vectorLayer=new ti({source:i,zIndex:1e3});{const o=()=>{if(!this.position||!this._feature)return;const a=dt([this.position[0],this.position[1]]),l=this._feature.getGeometry();l==null||l.setCoordinates(a)};o(),this.dispose(this.positionChanged.disposableOn(o))}{const o=()=>{this._vectorLayer&&this._vectorLayer.setVisible(this.show)};o(),this.dispose(this.showChanged.disposableOn(o))}{const o=()=>{this._feature&&this._feature.setStyle(s)};o(),this.dispose(this.colorChanged.disposableOn(o)),this.dispose(this.circleRotationChanged.disposableOn(o)),this.dispose(this.pixelSizeChanged.disposableOn(o))}(r=e.viewer)==null||r.addLayer(this._vectorLayer),this.d(()=>{var o;return(o=e.viewer)==null?void 0:o.removeLayer(this._vectorLayer)})}_createDebugFeature(e){var r;const i=new Ge;this._debugFeature=new je({geometry:new Ne([0,0])}),this._debugFeature.setStyle(new Pt({image:new Qe({radius:5,fill:new Ht({color:"red"})})})),i.addFeature(this._debugFeature);const s=new ti({source:i,zIndex:1001});{const o=()=>{s.setVisible(this.debug)};o(),this.dispose(this.debugChanged.disposableOn(o))}{const o=()=>{if(!this.position||!this._debugFeature)return;const a=dt([this.position[0],this.position[1]]),l=this._debugFeature.getGeometry();l==null||l.setCoordinates(a)};o(),this.dispose(this.positionChanged.disposableOn(o))}(r=e.viewer)==null||r.addLayer(s),this.d(()=>{var o;return(o=e.viewer)==null?void 0:o.removeLayer(s)})}}E(br,"defaults",{position:[116.39,39.9,0]}),(n=>{n.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})})(br||(br={})),f.extendClassProps(br.prototype,br.createDefaultProps);function g0(n,t){const i=n.getViewport().getBoundingClientRect();return[t.clientX-i.left,t.clientY-i.top]}class hR extends f.HasOwner{constructor(t){super(t);const{olViewer:e}=this.owner;let i;this.dispose(()=>this.owner.hoveredPlaneType="none");const s=this._createRotatorMoveProcessing();this.dispose(e.pointerMoveEvent.disposableOn(r=>{const o=i=this._getStartInfo(r.pointerEvent);this.owner.hoveredPlaneType=(o==null?void 0:o.currentPlaneType)??"none"})),this.dispose(e.pointerDownEvent.disposableOn(r=>{i&&i.currentPlaneType!=="none"&&(s.restart(void 0,e,i),i=void 0)})),this.dispose(e.dblclickEvent.disposableOn(r=>{const o=this._getStartInfo(r.pointerEvent);o&&o.currentPlaneType!=="none"||(this.owner.enabled=!1)}))}_createRotatorMoveProcessing(){return this.ad(f.createProcessingFromAsyncFunc(async(t,e,i)=>{const s=this.owner.circle;e.incrementDisabledInputStack(),t.disposer.dispose(()=>e.decrementDisabledInputStack()),this.owner.movingPlaneType=i.currentPlaneType,t.disposer.dispose(()=>{this.owner.movingPlaneType="none"});const r=i.pointerId;t.disposer.dispose(e.pointerMoveEvent.don(l=>{if(!i||!l.pointerEvent)return;const c=e.viewer,h=[];c.getInteractions().forEach(w=>{var C,P,b;const x=(C=w==null?void 0:w.constructor)==null?void 0:C.name;(x==="DragPan"||x==="MouseWheelZoom"||x==="DoubleClickZoom"||x==="PinchZoom"||x==="DragRotate"||x==="PinchRotate")&&(h.push([w,((P=w.getActive)==null?void 0:P.call(w))??!0]),(b=w.setActive)==null||b.call(w,!1))}),t.disposer.dispose(()=>h.forEach(([w,x])=>{var C;return(C=w.setActive)==null?void 0:C.call(w,x)}));let u=i.startAngle,d=0;const g=l.pointerEvent,p=g0(e.viewer,g);if(i.currentPlaneType==="none")return;const m=this._calculateAngle(p);if(m===null)return;let _=m-u;_>180&&(_-=360),_<-180&&(_+=360),d+=_,u=m;let v=i.startRotation+d;v>360&&(v=360),v<-360&&(v=-360),this.owner.previewRotation=v;const y=this.owner.circle;y.circleStartRotation=0,y.circleEndRotation=0})),t.disposer.dispose(()=>{s.circleStartRotation=0,s.circleEndRotation=0}),await f.step(t,l=>new Promise((c,h)=>{l.disposer.dispose(h),l.disposer.dispose(e.pointerUpEvent.don(u=>{u.pointerEvent.pointerId===r&&c()})),l.disposer.dispose(e.pointerOutEvent.don(u=>{u.pointerEvent.pointerId===r&&c()}))}));const[,o,a]=this.owner.selfRotation;this.owner.selfRotation=[this.owner.previewRotation,o,a]}))}_calculateAngle(t){const{olViewer:e}=this.owner,i=e.viewer;if(!i||!this.owner.position)return null;const s=dt([this.owner.position[0],this.owner.position[1]]),r=i.getPixelFromCoordinate(s);if(!r)return null;const o=t[0]-r[0],a=t[1]-r[1],l=Math.sqrt(o*o+a*a),c=this.owner.pixelSize/4;if(l<c*.8||l>c*1.2)return null;let h=Math.atan2(a,o);return h=(h*180/Math.PI+360)%360,h}_getStartInfo(t){const{olViewer:e}=this.owner;if(!this.owner.position)return;const i=g0(this.owner.olViewer.viewer,t),s=t.pointerId,r=this._calculateAngle(i);return{currentPlaneType:r!==null?"heading":"none",startRotation:this.owner.selfRotation[0],startAngle:r||0,pointerId:s}}}class qn extends $e{constructor(e){super();E(this,"_hoveredPlaneType",this.disposeVar(f.react("none")));E(this,"_movingPlaneType",this.disposeVar(f.react("none")));E(this,"_previewRotation",this.disposeVar(f.react(0)));E(this,"_circle");E(this,"_rotatorRunningResetting");this._olViewer=e;const i=this._olViewer;this._rotatorRunningResetting=this.disposeVar(new f.ObjResettingWithEvent(this.enabledChanged,()=>{if(this.enabled)return new hR(this)})),this._circle=this._createRotatorCircle(i);const s=()=>{var r;this.previewRotation=((r=this.selfRotation)==null?void 0:r[0])??0};s(),this.dispose(this.selfRotationChanged.disposableOn(s)),this.dispose(this.enabledChanged.disposableOn(r=>{r&&s()}));{const r=()=>{this.circle.show=this.enabled};r(),this.dispose(this.enabledChanged.disposableOn(r))}}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 i=this.ad(new br(e));this.dispose(f.track([i,"position"],[this,"position"])),this.dispose(f.track([i,"pixelSize"],[this,"pixelSize"])),this.dispose(f.track([i,"debug"],[this,"debug"]));{const s=()=>{i.circleRotation=this.previewRotation};s(),this.dispose(this.previewRotationChanged.disposableOn(s))}{const s=()=>{const r=this.movingPlaneType==="heading",o=this.hoveredPlaneType==="heading",l=[0,0,1,r||o?1:.8];i.color=l};s(),this.dispose(this.movingPlaneTypeChanged.disposableOn(s)),this.dispose(this.hoveredPlaneTypeChanged.disposableOn(s))}return i}}E(qn,"rotationNum",{heading:0}),E(qn,"rotationFuncs",{heading:([e,i,s])=>[0,i,s]}),(n=>{n.createDefaultProps=()=>({...$e.createDefaultProps(),rotation:f.reactArray([0,0,0]),selfRotation:f.reactArray([0,0,0]),pixelSize:300,showHelper:!1,debug:!1})})(qn||(qn={})),f.extendClassProps(qn.prototype,qn.createDefaultProps);const ks=class ks extends f.Destroyable{get startPosition(){return this.positions&&this.positions[0]}set startPosition(t){this.positions=[t??ks.defaults.positions[0],this.stopPosition??ks.defaults.positions[1]]}get startPositionChanged(){return this.positionsChanged}get stopPosition(){return this.positions&&this.positions[1]}set stopPosition(t){this.positions=[this.startPosition??ks.defaults.positions[0],t??ks.defaults.positions[1]]}get stopPositionChanged(){return this.positionsChanged}constructor(t,e){if(super(),!t.viewer)return;const s=this.ad(new fe(t,e));s.arcType="RHUMB";const r=this.ad(new xi(t,e));this.ad(f.track([s,"allowPicking"],[this,"allowPicking"])),this.ad(f.track([r,"allowPicking"],[this,"allowPicking"]));{const o=()=>{s.show=r.show=this.show};o(),this.ad(this.showChanged.don(o))}{const o=()=>{s.width=this.width/2,r.pixelSize=this.width};o(),this.ad(this.widthChanged.don(o))}{const o=()=>{s.color=r.color=this.color};o(),this.ad(this.colorChanged.don(o))}{const o=()=>{s.positions=this.positions,r.position=this.stopPosition};o(),this.dispose(this.startPositionChanged.disposableOn(o)),this.dispose(this.stopPositionChanged.disposableOn(o))}}};E(ks,"defaults",{positions:[[0,0,0],[0,0,1e6]]});let Fs=ks;(n=>{n.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:f.reactPositions(n.defaults.positions),width:10,color:f.reactArray([1,0,0,1])})})(Fs||(Fs={})),f.extendClassProps(Fs.prototype,Fs.createDefaultProps);class dn extends $e{constructor(e){super();E(this,"_lastPosition");E(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))});E(this,"_scaleAxis");E(this,"_pickingXYProcessing",e=>this.disposeVar(new f.Processing((i,s,r)=>{const o=[0,0,0];return e.pointerMoveEvent.disposableOn(a=>{if(!a.pointerEvent||!e.viewer)return;const l=e.viewer.getEventPixel(a.pointerEvent),c=e.viewer.getCoordinateFromPixel(l);if(!c)return;const[h,u]=ae(c);o[0]=h,o[1]=u,o[2]=0,this._opInfo.constraintMode.value==="x"?Vn(this._opInfo.originPosition.value,this._opInfo.originHeading.value+90,o,o):this._opInfo.constraintMode.value==="y"?Vn(this._opInfo.originPosition.value,this._opInfo.originHeading.value,o,o):this._opInfo.constraintMode.value==="xy"||console.warn("should not be here!"),this._opInfo.movingPosition.value=o,this._lastPosition||(this._lastPosition=[...this._opInfo.draggingStartPosition.value]);const d=[0,0,0];if(f.geoRhumbDestination(o,r,s,d),this._opInfo.targetPosition.value=d,!this._axisPixelInfo)return;const g=this._axisPixelInfo,p=e.viewer.getEventPixel(a.pointerEvent),m=g.len*g.len,_=((p[0]-g.a[0])*g.v[0]+(p[1]-g.a[1])*g.v[1])/m,v=Math.max(-2,Math.min(2,_)),y=v===0?0:v>0?1:-1;let w=0;y===0?w=0:y===g.sideStart||g.sideStart===0?w=Math.max(0,Math.abs(v)-Math.abs(g.tStart)):w=Math.abs(v);const x=(v>=0?1:-1)*w,C=this.scaleSensitivity??.6,P=Math.max(.1,1+C*x),[b,R,I]=g.baseScale;let S=b,F=R;g.mode==="y"?S=Math.max(.01,b*P):g.mode==="x"&&(F=Math.max(.01,R*P)),this.scale=[S,F,I??0]})})));E(this,"_axisPixelInfo");console.log("here ScaleEditing constructor",e.viewer);const i=e.viewer;if(i){this.ad(new im(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:r,xAxis:o}=this._scaleAxis,a=this._opInfo.constraintMode.value,l=this._opInfo.step.value;r.color=[0,1,0,.99],o.color=[1,0,0,.99],a==="x"?o.color=l?[1,1,0,.8]:[1,1,0,.99]:a==="y"&&(r.color=l?[1,1,0,.8]:[1,1,0,.99])};s(),this.dispose(this._opInfo.constraintMode.changed.disposableOn(s)),this.dispose(this._opInfo.step.changed.disposableOn(s))}{const s=()=>{if(!this._scaleAxis)return;const{position:o=dn.defaults.position}=this;console.log("ScaleEditing.defaults.position",o);const{yAxis:a,xAxis:l}=this._scaleAxis;l.startPosition=a.startPosition=o;const c=f.geoRhumbDestination(o,this._opInfo.originDimensions.value[0],90);c&&(l.stopPosition=c);const h=f.geoRhumbDestination(o,this._opInfo.originDimensions.value[1],0);h&&(a.stopPosition=h)};s();const r=this.ad(f.createNextAnimateFrameEvent(this.positionChanged,this._opInfo.originDimensions.changed));this.ad(r.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((r,o)=>r===this._opInfo.targetPosition.value[o])){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),r=()=>{const h=[...this.position??dn.defaults.position];e.editingHeightOffset&&(h[2]-=e.editingHeightOffset),this._opInfo.targetPosition.value=this._opInfo.originPosition.value=h},o={constraintMode:"none",startDragPos:[0,0,0]},a=h=>{if(!this.position||!this._scaleAxis)return;const u={position:this.position,dimensions:this._opInfo.originDimensions.value,heading:this._opInfo.originHeading.value||0};kp(i,h,u,this.axisSnapPixelSize,o);const d=i.getView().getProjection(),g=i.getEventPixel(h),p=I=>i.getPixelFromCoordinate(dt([I[0],I[1]],d)),{xAxis:m,yAxis:_}=this._scaleAxis,v=p(m.startPosition),y=p(m.stopPosition),w=p(_.startPosition),x=p(_.stopPosition),C=p0(g,v,y),P=p0(g,w,x),b=this.axisSnapPixelSize??10;let R="none";if((C.dist<=b||P.dist<=b)&&(R=C.dist<=P.dist?"x":"y"),this._opInfo.constraintMode.value=R,o.constraintMode=R,R==="x"||R==="y"){const I=i.getCoordinateFromPixel(g);if(I){const[S,F]=ae(I),k=[S,F,this._opInfo.originPosition.value[2]??0];R==="x"?Vn(this._opInfo.originPosition.value,this._opInfo.originHeading.value+90,k,k):Vn(this._opInfo.originPosition.value,this._opInfo.originHeading.value,k,k),o.startDragPos=k,this._opInfo.movingPosition.value=this._opInfo.draggingStartPosition.value=k}}else o.startDragPos=[0,0,0],this._opInfo.movingPosition.value=this._opInfo.draggingStartPosition.value=[0,0,0]},l=this.disposeVar(f.createProcessingFromAsyncFunc(async h=>{this._opInfo.step.value=!0,this._opInfo.constraintMode.value="none",h.disposer.dispose(()=>{this._opInfo.constraintMode.value="none"}),await f.step(h,async u=>{u.disposer.dispose((r(),this.positionChanged.disposableOn(r))),u.disposer.dispose(e.pointerMoveEvent.disposableOn(d=>{d.pointerEvent&&a(d.pointerEvent)})),await f.step(u,d=>new Promise((g,p)=>{d.disposer.dispose(p),d.disposer.dispose(e.pointerDownEvent.don(m=>{if(m.pointerEvent&&a(m.pointerEvent),m.pointerEvent&&m.pointerEvent.button===0&&this._opInfo.constraintMode.value!=="none"){{const _=o.constraintMode==="x"?"x":"y",{xAxis:v,yAxis:y}=this._scaleAxis,w=_==="x"?v:y,x=i.getView().getProjection(),C=L=>i.getPixelFromCoordinate(dt([L[0],L[1]],x)),P=C(w.startPosition),b=C(w.stopPosition),R=[b[0]-P[0],b[1]-P[1]],I=Math.hypot(R[0],R[1])||1,S=i.getEventPixel(m.pointerEvent),F=((S[0]-P[0])*R[0]+(S[1]-P[1])*R[1])/(I*I),k=Math.max(-1,Math.min(1,F)),T=k===0?0:k>0?1:-1;this._axisPixelInfo={a:P,v:R,len:I,tStart:k,sideStart:T,mode:_,baseScale:[this.scale[0]??1,this.scale[1]??1,this.scale[2]??0]}}g()}}))}))}),this._opInfo.step.value=!1,await f.step(h,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),g=f.geoRhumbDistance(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value);s.restart(void 0,d,g),u.disposer.dispose(()=>s.cancel())}await f.step(u,d=>new Promise((g,p)=>{d.disposer.dispose(p),d.disposer.dispose(e.pointerUpEvent.don(()=>{g()})),d.disposer.dispose(e.pointerOutEvent.don(()=>{g()}))})),this._lastPosition=void 0,this._axisPixelInfo=void 0}),l.restart()})),c=()=>{this.enabled?l.restart():l.isRunning&&l.cancel()};c(),this.dispose(this.enabledChanged.disposableOn(c))}}}get scaleAxis(){return this._scaleAxis}_createScaleAxis(e,i){const s=this.ad(new Fs(e));return s.width=10,this.ad(f.track([s,"show"],[this,"enabled"])),s}}(n=>{n.createDefaultProps=()=>({...$e.createDefaultProps(),scale:f.reactArray([1,1,0]),axisPixelSize:100,axisSnapPixelSize:10,scaleSensitivity:.8})})(dn||(dn={})),f.extendClassProps(dn.prototype,dn.createDefaultProps);function p0(n,t,e){const i=e[0]-t[0],s=e[1]-t[1],r=n[0]-t[0],o=n[1]-t[1],a=i*r+s*o,l=i*i+s*s;let c=l>0?Math.max(0,Math.min(1,a/l)):0;const h=t[0]+c*i,u=t[1]+c*s,d=n[0]-h,g=n[1]-u;return{dist:Math.hypot(d,g),t:c}}const mn=class mn extends Se{constructor(e){super();E(this,"_editingPoints",this.disposeVar(new f.ObservableArray));E(this,"_cancelEvent",this.disposeVar(new f.Event));E(this,"_currentProcess");E(this,"_menuPoiEnabled",this.disposeVar(f.react(!1)));E(this,"_status",this.disposeVar(f.react("None")));E(this,"_positionsChanged",this.ad(new f.Event));E(this,"_cursorInfo");this._olViewer=e,console.log("imgaeUrl:",mn.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(i=>{for(let{start:s,deleteCount:r,items:o}of i){for(const a of o)a.menuPoi.enabled=this.menuPoiEnabled??!1;for(let a=s;a<s+r;++a)this.editingPoints.get(a).destroy()}})),this.dispose(this.menuPoiEnabledChanged.disposableOn(()=>{for(let i of this.editingPoints)i.menuPoi.enabled=this.menuPoiEnabled??!1})),this.dispose(e.dblclickEvent.don(i=>{this.ad(f.nextAnimateFrame(()=>{var s;((s=i.pointerEvent)==null?void 0:s.button)===0&&this.enabled&&this.currentProcess&&this.currentProcess.cancel()}))})),this.dispose(this.enabledChanged.disposableOn(i=>{this._currentProcess&&(i?this._currentProcess.restart():this._currentProcess.isRunning&&this._currentProcess.cancel())}));{const i=()=>{this.polylineShow=this.olViewer.editingLineShow};i(),this.ad(this.olViewer.editingLineShowChanged.don(i))}}get editingPoints(){return this._editingPoints}get cancelEvent(){return this._cancelEvent}cancel(){this._cancelEvent.emit()}get currentProcess(){return this._currentProcess}set currentProcess(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 i of this._editingPoints)i.position&&e.push([...i.position]);return e}resetPositions(e){if(this.enabled??mn.defaults.enabled)return console.warn("MultiPointsEditing.resetPositions error: this.enabled === true"),!1;const i=e||[];return!(i.length===this.editingPoints.length&&i.every((s,r)=>s.every((o,a)=>{const l=this.editingPoints.get(r);return l.position&&l.position[a]===o})))}forceResetPositions(e){(this.enabled??mn.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 i=this.ad(new fe(e));this.ad(f.track([i,"color"],[this,"polylineColor"])),this.ad(f.track([i,"width"],[this,"polylineWidth"])),this.ad(f.track([i,"show"],[this,"polylineShow"])),this.ad(f.track([i,"arcType"],[this,"polylineArcType"])),this.ad(f.track([i,"loop"],[this,"loop"]));{const s=()=>{const r=[];for(const o of this.getPositions())o[2]-=e.editingHeightOffset??0,r.push(o);i.positions=r};s(),this.ad(this.positionsChanged.don(s))}}_createCursorInfo(e){const i=this._cursorInfo=this.ad(new f.CursorInfo(e.container,f.CursorFloatDiv));this.dispose(this.statusChanged.disposableOn(()=>{const s=this.status;if(i){if(!this.hideCursorInfo){i.show=!1;return}s==="Adding"?(i.text="右键/BackSpace键:删除上一个控制点;Esc键或左键双击:退出添加状态,进入修改状态",i.show=!0):s==="Modifying"||s==="Modifying_Point"?(i.text="Esc键或左键双击:退出编辑状态",i.show=!0):s==="None"&&(i.text="",i.show=!1)}}))}};E(mn,"baseImageUrl",f.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/img/")),E(mn,"defaults",{...Se.defaults,debug:!1,polylineShow:!1,polylineWidth:1,polylineColor:[1,1,1,1],polylineArcType:"GEODESIC",maxPointsNum:Number.MAX_SAFE_INTEGER,loop:!1,firstControlPointImageUrl:mn.baseImageUrl+"point-green.png",otherControlPointImageUrl:mn.baseImageUrl+"point-yellow.png"});let ei=mn;(n=>{n.createDefaultProps=()=>({...Se.createDefaultProps(),loop:!1,debug:!1,polylineShow:!0,polylineWidth:1,polylineColor:f.reactArray([1,1,1,1]),polylineArcType:"GEODESIC",maxPointsNum:Number.MAX_SAFE_INTEGER,firstControlPointImageUrl:n.baseImageUrl+"point-green.png",otherControlPointImageUrl:n.baseImageUrl+"point-yellow.png",hideCursorInfo:!1,middlePointShow:!0})})(ei||(ei={})),f.extendClassProps(ei.prototype,ei.createDefaultProps);let uR=0;class Gd extends f.Destroyable{constructor(e,i){super();E(this,"_position",this.disposeVar(f.reactArrayWithUndefined(void 0)));E(this,"_id",uR++);E(this,"_menuPoi");i&&(this.position=i),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 rr(e.olViewer));s.enabled=!1,this.ad(f.track([s,"show"],[e,"enabled"]));{const r=()=>{if(this.position===void 0){s.position=void 0;return}const o=[...this.position];o[2]=0,s.position=o,e.positionsChanged.emit()};r(),this.d(this.positionChanged.don(r))}{const r=()=>{const o=e.editingPoints.indexOf(this)+1;o!==0&&(s.title=`控制点${o}`,o===1?s.imageUri=e.firstControlPointImageUrl??ei.defaults.firstControlPointImageUrl:s.imageUri=e.otherControlPointImageUrl??ei.defaults.otherControlPointImageUrl)};r(),this.dispose(e.editingPoints.changedEvent.disposableOn(r))}}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 Vd extends Gd{constructor(t,e){super(t,e)}}class qt extends ei{constructor(e){super(e);E(this,"_deletePreviousPointWhileAddingEvent",this.disposeVar(new f.Event));E(this,"placeEditing");if(!e.viewer)return;const i=this.placeEditing=this.ad(new Ei(e));i.enabled=!1,this.currentProcess=this.disposeVar(f.createProcessingFromAsyncFunc(async s=>{s.disposer.dispose(()=>{(this.debug??qt.defaults.debug)&&console.log("---editing canceled~~~"),this.status="None",this.enabled=!1}),(this.debug??qt.defaults.debug)&&console.log("直接进入Adding状态"),this.status="Adding",await s.promise(f.step(s,async r=>{const o=r.disposer,a=o.ad(this._addingEditingProcessing());o.dispose(()=>"adding canceled!"),o.dispose(this.cancelEvent.disposableOn(()=>a.cancel())),await r.promise(new Promise(l=>{o.dispose(a.completeEvent.disposableOnce(l))}))}))})),this.dispose(e.clickEvent.don(s=>{var r;((r=s.pointerEvent)==null?void 0:r.button)===2&&this.deletePreviousPointWhileAdding()}))}deletePreviousPointWhileAdding(){this._deletePreviousPointWhileAddingEvent.emit()}resetPositions(e){if(!super.resetPositions(e))return!0;const i=e?e.map(s=>new Vd(this,s)):[];return this.editingPoints.splice(0,this.editingPoints.length,...i),!0}_addingEditingProcessing(){const e=()=>{if(this.maxPointsNum!==void 0)return this.editingPoints.length>=this.maxPointsNum&&(this.debug??qt.defaults.debug)&&console.log("impl.positionEditors.length >= impl.maxPointsNum"),this.editingPoints.length>=this.maxPointsNum},i=f.createProcessingFromAsyncFunc(async s=>{let r=this.editingPoints.length;this.menuPoiEnabled=!1;do if(!await s.promise(f.step(s,async a=>{let l;!e()&&(l=a.disposer.disposeVar(new m0(this,r)));const h=a.disposer.disposeVar(new _0(this,r));return a.disposer.dispose(this._deletePreviousPointWhileAddingEvent.disposableOn(()=>h.do())),await a.promise(new Promise(u=>{l&&a.disposer.dispose(l.overEvent.disposableOnce(d=>{d?(r++,u(!0)):u(!1)})),a.disposer.dispose(h.overEvent.disposableOnce(d=>{d?(r--,u(!0)):u(!1)})),a.disposer.dispose(this.cancelEvent.disposableOn(()=>u(!1)))}))})))break;while(!0)});return i.start(),i}}(n=>{n.createDefaultProps=()=>({...ei.createDefaultProps()})})(qt||(qt={})),f.extendClassProps(qt.prototype,qt.createDefaultProps);class m0 extends f.Destroyable{constructor(e,i){super();E(this,"_overEvent",this.disposeVar(new f.Event));const{placeEditing:s}=e;let r=new Vd(e,void 0);e.editingPoints.splice(i,0,r);const o=()=>{(e.debug??qt.defaults.debug)&&console.log("delete currentPosEditor");const c=e.editingPoints.indexOf(r);if(c===-1)throw new Error("currentPosEditor not found");e.editingPoints.splice(c,1)};if(s.enabled??!1)throw console.error("placeEditing.enabled is true!"),new Error("placeEditing.enabled is true!");this.dispose(f.track([r,"position"],[s,"position"])),s.enabled=!0;let a=!1;const l=()=>{o(),this._overEvent.emit(!1)};this.dispose(()=>{s.enabled=!1,!a&&l()}),this.dispose(s.overEvent.disposableOnce(()=>{a=!0,r.position===void 0?l():this._overEvent.emit(!0)})),(e.debug??qt.defaults.debug)&&console.log(`PointAdding creating! index(${i})`),this.dispose(()=>{(e.debug??qt.defaults.debug)&&console.log(`PointAdding destroying! index(${i})`)})}get overEvent(){return this._overEvent}}function y0(n,t){const e=n.editingPoints,i=t-1;return i<0?(console.warn("previousIndex < 0, cannot delete the point!"),!1):(e.splice(i,1),!0)}class _0 extends f.Destroyable{constructor(e,i){super();E(this,"_overEvent",this.disposeVar(new f.Event));E(this,"_doEvent",this.disposeVar(new f.Event));this.dispose(this._doEvent.disposableOn(()=>this._overEvent.emit(y0(e,i)))),(e.debug??qt.defaults.debug)&&console.log(`PreviousPointDeleting creating! currentIndex(${i})`),this.dispose(()=>{(e.debug??qt.defaults.debug)&&console.log(`PreviousPointDeleting destroying! currentIndex(${i})`)})}get overEvent(){return this._overEvent}do(){return this._doEvent.emit()}}class v0 extends qt{constructor(t){super(t),this.loop=!1}}class w0 extends qt{constructor(t){super(t),this.loop=!0}}class pc extends Gd{constructor(t,e){super(t,e);{const{menuPoi:i}=this;i.commands=[["add","增加控制点","",Rt.baseImageUrl+"add.png"],["delete","删除当前控制点","",Rt.baseImageUrl+"delete.png"],["modify","修改当前控制点","",Rt.baseImageUrl+"modify.png"]],i.clickCommandName="modify",i.rightClickCommandName="delete",this.dispose(i.commandEvent.disposableOn(s=>{t.menuPoiCommand(this,s)})),this.dispose(i.dbclickEvent.disposableOn(()=>{t.menuPoiCommand(this,"dbClick")}))}if(t.middlePointShow){const i=this.ad(new zi(t.olViewer));{i.imageUri=t.firstControlPointImageUrl??Rt.defaults.firstControlPointImageUrl,i.tooltip="点击增加一个控制点",i.bgColor=[0,0,0,.6],i.fgColor=[1,1,1,1],i.size=[8,8],i.originRatioAndOffset=[.5,.5,0,0];{const s=()=>{if(!(t.enabled??Rt.defaults.enabled)){i.enabled=!1,i.show=!1;return}do{const o=t.editingPoints.indexOf(this);if(o===-1)break;const a=t.editingPoints.length;if(a===0){console.error("impl.positionEditors.length === 0!");break}if(!(t.loop??Rt.defaults.loop)&&o+1>=a)break;const c=this.position;if(!c)break;let h=(o+1)%a;const d=t.editingPoints.get(h).position;if(!d)break;const g=Jh(c,d);if(!g)break;g[2]-=t.olViewer.editingHeightOffset??0,i.position=g;const p=t.editingPoints.length<(t.maxPointsNum??Rt.defaults.maxPointsNum);i.enabled=p,i.show=p;return}while(!1);i.enabled=!1,i.show=!1};s(),this.dispose(t.positionsChanged.disposableOn(s)),this.dispose(t.loopChanged.disposableOn(s)),this.dispose(t.enabledChanged.disposableOn(s))}this.dispose(i.clickEvent.disposableOn(s=>{if(s.button!==0||t.editingPoints.length>=(t.maxPointsNum??Rt.defaults.maxPointsNum))return;const r=t.editingPoints.indexOf(this);if(r===-1)return;const o=i.position?[...i.position]:void 0;o&&(o[2]+=t.olViewer.editingHeightOffset??0);let a=new pc(t,o);t.editingPoints.splice(r+1,0,a),t.modify(a)}))}}}}class Rt extends ei{constructor(e){super(e);E(this,"_menuPoiCommand",this.disposeVar(new f.Event));E(this,"_forceModifyPosEditorEvent",this.disposeVar(new f.Event));E(this,"_overEvent",this.disposeVar(new f.Event));E(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 dR(this.editingPoints.get(0),this)}))}const i=this.translationEditing=this.disposeVar(new Ci(e));i.enabled=!1,this.currentProcess=this.disposeVar(f.createProcessingFromAsyncFunc(async s=>{s.disposer.dispose(()=>{(this.debug??Rt.defaults.debug)&&console.log("---editing canceled~~~"),this.status="None",this.enabled=!1});let r=-1;do if((this.debug??Rt.defaults.debug)&&console.log("进入Modifying修改状态"),this.status="Modifying",r=await s.promise(f.step(s,async o=>{const a=o.disposer,l=a.ad(new fR(this));return a.dispose(()=>"modifying canceled!"),this.editingPoints.length>0&&l.modify(this.editingPoints.get(r===-1||r>=this.editingPoints.length?0:r)),a.dispose(this.cancelEvent.disposableOn(()=>l.cancel())),a.dispose(this._forceModifyPosEditorEvent.disposableOn(h=>l.modify(h))),await o.promise(new Promise(h=>{a.dispose(l.overEvent.disposableOnce(u=>{h(u)}))}))})),r===-1){(this.debug??Rt.defaults.debug)&&console.log("退出编辑状态");break}else{if(this.editingPoints.length>=(this.maxPointsNum??Rt.defaults.maxPointsNum))return;if(this.editingPoints.length===0){console.error("impl.positionEditors.length === 0!");return}this.loop??Rt.defaults.loop;const a=this.editingPoints.get(r-1).position;if(!a)return;let l=r%this.editingPoints.length;const h=this.editingPoints.get(l).position;if(!h)return;const u=Jh(a,h);if(!u)return;u&&(u[2]+=this.olViewer.editingHeightOffset??0);let d=new pc(this,u);this.editingPoints.splice(r,0,d)}while(!0);this.status="None",this.enabled=!1}))}menuPoiCommand(e,i){this._menuPoiCommand.emit(e,i)}modify(e){this._forceModifyPosEditorEvent.emit(e)}resetPositions(e){if(!super.resetPositions(e))return!0;const i=e?e.map(s=>new pc(this,s)):[];return this.editingPoints.splice(0,this.editingPoints.length,...i),!0}get overEvent(){return this._overEvent}}(n=>{n.createDefaultProps=()=>({...ei.createDefaultProps(),moveWithFirstPosition:!1})})(Rt||(Rt={})),f.extendClassProps(Rt.prototype,Rt.createDefaultProps);class dR extends f.Destroyable{constructor(t,e){super(),this._firstPositionEditor=t,this.multiPointsModifyEditing=e,this._firstPositionEditor.positionChanged.disposableOn((i,s)=>{if(i===void 0||s===void 0)return;var r=[i[0]-s[0],i[1]-s[1],i[2]-s[2]];const o=this.multiPointsModifyEditing.editingPoints.length;for(let a=1;a<o;a++){const l=this.multiPointsModifyEditing.editingPoints.get(a),c=l.position;c!==void 0&&(l.position=[c[0]+r[0],c[1]+r[1],c[2]+r[2]])}})}}class fR extends f.Destroyable{constructor(e){super();E(this,"_overEvent",this.disposeVar(new f.Event));E(this,"_cancelEvent",this.disposeVar(new f.Event));E(this,"_forceModifyPosEditorEvent",this.disposeVar(new f.Event));e.menuPoiEnabled=!0,this.dispose(()=>e.menuPoiEnabled=!1);let i;const s=()=>{i==null||i.destroy(),i=void 0,e.status="Modifying"};this.dispose(s);const r=o=>{s(),e.status="Modifying_Point",i=new gR(e,o),i.dispose(i.overEvent.disposableOn(()=>{s()}))};this.dispose(this._forceModifyPosEditorEvent.disposableOn(r)),this.dispose(e._menuPoiCommand.disposableOn((o,a)=>{if(a==="delete"){if(e.editingPoints.length<=2)return;const l=e.editingPoints.indexOf(o);if(l===-1)throw console.error("posEditor not found"),new Error("posEditor not found");e.editingPoints.splice(l,1)}else if(a==="modify")r(o);else if(a==="add"){const l=e.editingPoints.indexOf(o);if(l===-1)throw console.error("posEditor not found"),new Error("posEditor not found");this._overEvent.emit(l+1)}else a==="dbClick"?this._overEvent.emit(-1):alert(`未知的commandName(${a})`)})),this.dispose(this._cancelEvent.disposableOn(()=>{this._overEvent.emit(-1)}))}get overEvent(){return this._overEvent}cancel(){this._cancelEvent.emit()}modify(e){this._forceModifyPosEditorEvent.emit(e)}}class gR extends f.Destroyable{constructor(e,i){super();E(this,"_overEvent",this.disposeVar(new f.Event));this._modifying=e,this._posEditor=i,this.dispose(this._posEditor.toDestroyEvent.disposableOn(()=>{this._overEvent.emit()}));const{translationEditing:s}=this._modifying;if(s.enabled=!0,s.heading=0,this.dispose(()=>{s.enabled=!1}),!this._posEditor.position)throw console.error("!this._posEditor.position"),new Error("!this._posEditor.position");s.position=this._posEditor.position,this.dispose(f.track([this._posEditor,"position"],[s,"position"])),this.dispose(s.enabledChanged.disposableOnce(r=>{r||this._overEvent.emit()}))}get overEvent(){return this._overEvent}}class x0 extends Rt{constructor(t){super(t),this.loop=!1}}class E0 extends Rt{constructor(t){super(t),this.loop=!0}}class Ls extends qt{init(){const t=this.startPosition;if(!t)return;const e=this.distance,i=this.rotation,s=e*Math.cos(i[1]*Math.PI/180),r=f.geoDestination(t,s,i[0]);if(!r){this.positions=[t];return}const o=e*Math.sin(i[1]*Math.PI/180);r[2]+=o,this.positions=[t,r],this.editingPoints.length==2&&(this.editingPoints.get(0).position=t,this.editingPoints.get(1).position=r)}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 i=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 r=this.endPosition[2]-this.startPosition[2],o=Math.atan(r/s)*180/Math.PI,a=Math.sqrt(s*s+r*r);this.rotation=[i,o,0],this.distance=a};e(),this.ad(this.positionsChanged.don(e))}}}(n=>{n.createDefaultProps=()=>({...qt.createDefaultProps(),startPosition:f.reactArrayWithUndefined(void 0),endPosition:f.reactArrayWithUndefined(void 0),rotation:f.reactArray([90,0,0]),distance:f.react(1)})})(Ls||(Ls={})),f.extendClassProps(Ls.prototype,Ls.createDefaultProps);class fn extends Rt{init(){const t=this.startPosition;if(!t)return;const e=this.distance,i=this.rotation,s=e*Math.cos(i[1]*Math.PI/180),r=f.geoDestination(t,s,i[0]);if(!r){this.positions=[t];return}const o=e*Math.sin(i[1]*Math.PI/180);r[2]+=o,this.positions=[t,r],this.editingPoints.length==2&&(this.editingPoints.get(0).position=t,this.editingPoints.get(1).position=r)}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","增加控制点","",Rt.baseImageUrl+"add.png"],["delete","删除当前控制点","",Rt.baseImageUrl+"delete.png"],["modify","修改当前控制点","",Rt.baseImageUrl+"modify.png"]],this.rotation=[90,0,0],this.distance=1;break}this.endPosition=this.positions[1];for(let l of this.editingPoints)l.menuPoi.commands=[["delete","删除当前控制点","",Rt.baseImageUrl+"delete.png"],["modify","修改当前控制点","",Rt.baseImageUrl+"modify.png"]];const i=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 r=this.endPosition[2]-this.startPosition[2],o=Math.atan(r/s)*180/Math.PI,a=Math.sqrt(s*s+r*r);this.rotation=[i,o,0],this.distance=a}while(!1)};this.ad(this.positionsChanged.don(e))}}}(n=>{n.createDefaultProps=()=>({...Rt.createDefaultProps(),startPosition:f.reactArrayWithUndefined(void 0),endPosition:f.reactArrayWithUndefined(void 0),rotation:f.reactArray([0,0,0]),distance:f.react(0)})})(fn||(fn={})),f.extendClassProps(fn.prototype,fn.createDefaultProps);class pR extends qt{constructor(t){super(t),this.loop=!1,this.polylineShow=!1}}class mR extends Rt{constructor(t){super(t),this.loop=!1,this.polylineShow=!1,this.middlePointShow=!1}}class Uo extends qt{constructor(t){super(t),t.viewer||(this.loop=!1);{const e=()=>{if(!this.positions||this.positions.length<2){this.visibilityPositions=void 0;return}const i=[...this.positions[0]];i[2]-=t.editingHeightOffset??0,this.visibilityPositions=this.positions.map(s=>(s[2]-=t.editingHeightOffset??0,[i,s]))};e(),this.ad(this.positionsChanged.don(e))}}createPolyline(t){const e=this.ad(new $i(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"]))}}(n=>{n.createDefaultProps=()=>({...qt.createDefaultProps(),visibilityPositions:f.reactPositionsSet(void 0)})})(Uo||(Uo={})),f.extendClassProps(Uo.prototype,Uo.createDefaultProps);class $o extends Rt{constructor(t){if(super(t),!!t.viewer){this.loop=!1,this.middlePointShow=!1;{const e=()=>{if(!this.positions||this.positions.length<2)return;const i=[...this.positions[0]];i[2]-=t.editingHeightOffset??0,this.visibilityPositions=this.positions.map(s=>(s[2]-=t.editingHeightOffset??0,[i,s]))};e(),this.ad(this.positionsChanged.don(e))}}}createPolyline(t){const e=this.ad(new $i(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"]))}}(n=>{n.createDefaultProps=()=>({...Rt.createDefaultProps(),visibilityPositions:f.reactPositionsSet(void 0)})})($o||($o={})),f.extendClassProps($o.prototype,$o.createDefaultProps);class yR extends fn{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,i,s){super(e,i,s??!0);E(this,"_supportEditing",this.disposeVar(f.react(!0)));E(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}}function mc(n,t){return n+360*Math.round((t-n)/360)}function _R(n){const t=n.map(([s])=>(s%360+360)%360).sort((s,r)=>s-r);let e=-1,i=t[0];for(let s=0;s<t.length;s++){const r=t[s+1]??t[0]+360,o=r-t[s];o>e&&(e=o,i=(r+t[s]+360)/2)}return i=mc(i,0),f.getMinMaxCorner(n.map(([s,r,o])=>[mc(s,i),r,o])).center}function vR(n,t,e){const i=Mi(n.slice(0,2),"EPSG:4326",e),s=Mi([t[0],t[1]],"EPSG:4326",e),r=s[0]-i[0],o=s[1]-i[1];return([a,l,c])=>{const h=Mi([mc(a,n[0]),l],"EPSG:4326",e),u=Mi([h[0]+r,h[1]+o],e,"EPSG:4326");return[u[0],u[1],c]}}const oa=class oa extends Xe{constructor(t,e){var u;super(Array.isArray(t)?t[0]:t,e,!0);const i=(u=e.viewer)==null?void 0:u.getView().getProjection();if(!i)return;const s=this.currentEditing=this.ad(new Ci(e));if(this.ad(s.enabledChanged.don(d=>{d||this.ad(f.nextAnimateFrame(()=>this.destroy()))})),!Array.isArray(t)&&"position"in t){this.ad(f.bind([s,"position"],[t,"position"]));return}const r=Array.isArray(t)?t:[t],o=d=>Array.isArray(d)&&d.length===3&&d.every(Number.isFinite),a=()=>r.flatMap(d=>{const g="position"in d,p=g?[d.position]:d.points;return!(p!=null&&p.length)||!p.every(o)?[]:[{item:d,single:g,points:p.map(m=>[...m])}]});let l=a();if(!l.length){this.supportEditing=!1,this.destroy();return}let c=_R(l.flatMap(d=>d.points));s.position=c;let h=c[0];this.ad(s.dragStarted.don(()=>{l=a(),s.position&&(c=[...s.position],h=c[0])})),this.ad(s.positionChanged.don(d=>{if(!d)return;h=mc(d[0],h);const g=vR(c,[h,d[1],d[2]],i);for(const{item:p,single:m,points:_}of l)m?p.position=g(_[0]):p.points=_.map(g)}))}};E(oa,"type",oa.registerEditing("ESOlViewer",f.ESJEditingMode.Translation,oa));let yc=oa;function C0(){const n=f.createProcessingFromAsyncFunc(async(t,e,i,s,r=!0)=>{const o=Array.isArray(s)?[...s]:[s];if(o.length===0){console.warn("无有效编辑模式,editingModes 为:",o);return}const a=i.editingID;console.log("编辑模式为:editingModes",o),e.editingEvent.emit({objectIDs:[i.parentID],editingID:a,type:"start",add:{modes:o}});const l=()=>{e.notSupportEditingCount=0,e.editingEvent.emit({objectIDs:[i.parentID],editingID:a,type:"end",add:{modes:o}}),n.isRunning&&n.cancel()};t.disposer.ad(l),t.disposer.ad(i.toDestroyEvent.don(l));const c=u=>{u.code==="Escape"&&l()};document.body.addEventListener("keydown",c),t.disposer.ad(()=>document.body.removeEventListener("keydown",c));const h=async u=>{if(!n.isRunning)return;const d=o[u%o.length],g=await f.step(t,async m=>{const _=m.disposer,v=f.EngineObject.contextEditing.getEngineObjConstructor(d,e.typeName);if(!v||!i.supportEditingModes().includes(d))return console.log(`未找到编辑模式或不支持当前编辑模式 ${d},已跳过,请检查输入`),e.editingEvent.emit({objectIDs:[i.parentID],editingID:a,type:"changedFailed",add:{cMode:d,cIndex:u}}),e.notSupportEditingCount++,"next";const y=new v(i,e);if(_.ad(()=>{!y.isDestroyed()&&y.destroy()}),y.supportEditing)e.editingEvent.emit({objectIDs:[i.parentID],editingID:a,type:"changed",add:{cMode:d,cIndex:u}}),e.notSupportEditingCount=0;else return console.log(`编辑模式 ${d} 不支持,已跳过`),e.editingEvent.emit({objectIDs:[i.parentID],editingID:a,type:"changedFailed",add:{cMode:d,cIndex:u}}),e.notSupportEditingCount++,"next";return await m.promise(new Promise(x=>{if(y.isDestroyed())return x("next");if(_.ad(y.toDestroyEvent.don(()=>{console.log(`编辑模式 ${d} 结束`),x("next")})),r){const C=P=>{P.code==="Space"&&(console.log(`编辑模式 ${d} 切换到下一模式`),x("next"))};document.body.addEventListener("keydown",C),_.ad(()=>document.body.removeEventListener("keydown",C)),_.ad(e.dblclickEvent.don(()=>x("done")))}else _.ad(e.dblclickEvent.don(()=>x("done")))}))});if(e.notSupportEditingCount===o.length||g==="done")return;const p=r?(u+1)%o.length:u+1;if(!(!r&&p>=o.length))return await Promise.resolve(),h(p)};await h(0)});return n}function wR(){const n=f.createProcessingFromAsyncFunc(async(t,e,i,s)=>{e.editingEvent.emit({objectIDs:i.map(l=>l.parentID),editingID:s,type:"start"});const r=()=>{e.editingEvent.emit({objectIDs:i.map(l=>l.parentID),editingID:s,type:"end"}),n.isRunning&&n.cancel()};t.disposer.ad(r);const o=l=>{l.code=="Escape"&&r()};document.body.addEventListener("keydown",o),t.disposer.ad(()=>document.body.removeEventListener("keydown",o));const a=new yc(i,e);t.disposer.ad(()=>{!a.isDestroyed()&&a.destroy()}),await t.promise(new Promise(l=>{a.isDestroyed()&&l(),t.disposer.ad(a.toDestroyEvent.don(()=>{console.log("移动结束"),l()})),t.disposer.ad(e.dblclickEvent.don(()=>l()))}))});return n}const aa=class aa extends Xe{constructor(t,e){super(t,e,!0);const i=this.currentEditing=this.ad(new Ei(e));this.ad(e.clickEvent.don(s=>{var r;((r=s.pointerEvent)==null?void 0:r.button)==2&&(i.enabled=!0)})),Reflect.has(t,"position")?(this.ad(f.bind([i,"position"],[t,"position"])),i.enabled=!i.position||f.equalsN3(i.position,[0,0,0])):this.supportEditing=!1}};E(aa,"type",aa.registerEditing("ESOlViewer",f.ESJEditingMode.Place,aa));let Wd=aa;const la=class la extends Xe{constructor(t,e){super(t,e,!0);const i=this.currentEditing=this.ad(new dn(e));if(this.ad(i.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([i,"position"],[s,"position"])),this.ad(f.bind([i,"scale"],[s,"scale"]))}else throw new Error(`ScaleEditingWrapper:${t.typeName} 缩放属性无法绑定缩放编辑`)}};E(la,"type",la.registerEditing("ESOlViewer",f.ESJEditingMode.Scale,la));let Ud=la;const ca=class ca extends Xe{constructor(e,i){super(e,i,!0);E(this,"_olViewer");E(this,"positionBindRemove");this._olViewer=i;const s=e;this.ad(()=>this.clear()),f.equalsN3(s.position,[0,0,0])?this.switchEditing(f.ESJEditingMode.Place):this.switchEditing(f.ESJEditingMode.Translation),this.ad(i.clickEvent.don(r=>{var o,a;((o=r.pointerEvent)==null?void 0:o.button)==0&&this.currentEditing instanceof Ei&&this.switchEditing(f.ESJEditingMode.Translation),((a=r.pointerEvent)==null?void 0:a.button)==2&&this.currentEditing instanceof Ci&&this.switchEditing(f.ESJEditingMode.Place)}))}clear(){var e;(e=this.positionBindRemove)==null||e.call(this),this.currentEditing&&!this.currentEditing.isDestroyed()&&this.currentEditing.destroy(),this.currentEditing=this.positionBindRemove=void 0}switchEditing(e){this.clear(),this.currentEditing=e==f.ESJEditingMode.Place?new Ei(this._olViewer):new Ci(this._olViewer),this.currentEditing.enabled=!0,this.positionBindRemove=f.bind([this.currentEditing,"position"],[this.sceneObject,"position"])}};E(ca,"type",ca.registerEditing("ESOlViewer",f.ESJEditingMode.SinglePoint,ca));let $d=ca;const ha=class ha extends Xe{constructor(t,e){super(t,e,!0);const i=this.currentEditing=this.ad(new v0(e));if(this.ad(i.enabledChanged.don(s=>{s||this.ad(f.nextAnimateFrame(()=>this.destroy()))})),Reflect.has(t,"points")){const s=()=>i.positions=t.points??[];s(),this.ad(t.pointsChanged.don(()=>{i.enabled||s()})),i.enabled=!0,this.ad(f.track([t,"points"],[i,"positions"]))}else this.supportEditing=!1}};E(ha,"type",ha.registerEditing("ESOlViewer",f.ESJEditingMode.LineStringAppend,ha));let Xd=ha;const ua=class ua extends Xe{constructor(t,e){super(t,e,!0);const i=this.currentEditing=this.ad(new x0(e));if(this.ad(i.enabledChanged.don(s=>{s||this.ad(f.nextAnimateFrame(()=>this.destroy()))})),Reflect.has(t,"points")){const s=()=>{i.positions=t.points??[]};s(),this.ad(t.pointsChanged.don(()=>{i.enabled||s()})),i.enabled=!0,this.ad(f.track([t,"points"],[i,"positions"]))}else this.supportEditing=!1}};E(ua,"type",ua.registerEditing("ESOlViewer",f.ESJEditingMode.LineStringInsert,ua));let Yd=ua;const da=class da extends Xe{constructor(t,e){super(t,e,!0);const i=this.currentEditing=this.ad(new w0(e));if(this.ad(i.enabledChanged.don(s=>{!s&&this.ad(f.nextAnimateFrame(()=>{this.destroy()}))})),Reflect.has(t,"points")){const s=()=>{i.positions=t.points??[]};s(),this.ad(t.pointsChanged.don(()=>{i.enabled||s()})),i.enabled=!0,this.ad(f.track([t,"points"],[i,"positions"]))}else this.supportEditing=!1}};E(da,"type",da.registerEditing("ESOlViewer",f.ESJEditingMode.CircularAppend,da));let Hd=da;const fa=class fa extends Xe{constructor(t,e){super(t,e,!0);const i=this.currentEditing=this.ad(new E0(e));if(this.ad(i.enabledChanged.don(s=>{!s&&this.ad(f.nextAnimateFrame(()=>{this.destroy()}))})),Reflect.has(t,"points")){const s=()=>i.positions=t.points??[];s(),this.ad(t.pointsChanged.don(()=>!i.enabled&&s())),i.enabled=!0,this.ad(f.track([t,"points"],[i,"positions"]))}else this.supportEditing=!1}};E(fa,"type",fa.registerEditing("ESOlViewer",f.ESJEditingMode.CircularInsert,fa));let Bd=fa;const ga=class ga extends Xe{constructor(t,e){super(t,e,!0);const i=this.currentEditing=this.ad(new Ls(e));if(this.ad(i.enabledChanged.don(s=>{!s&&this.ad(f.nextAnimateFrame(()=>{this.destroy()}))})),Reflect.has(t,"position")){const s=t;if(this.ad(f.bind([i,"startPosition"],[s,"position"])),this.ad(nu([i,"rotation"],[s,"rotation"])),Reflect.has(s,"far"))this.ad(f.bind([i,"distance"],[s,"far"]));else if(Reflect.has(s,"radius"))this.ad(f.bind([i,"distance"],[s,"radius"]));else if(Reflect.has(s,"distance"))this.ad(f.bind([i,"distance"],[s,"distance"]));else{const r=e.viewer,o=r==null?void 0:r.getView(),a=(o==null?void 0:o.getResolution())??1;i.distance=Math.max(1,a*100)}}else if(Reflect.has(t,"points")){const s=t,r=()=>i.positions=s.points??[];r(),this.ad(s.pointsChanged.don(()=>!i.enabled&&r())),this.ad(f.track([s,"points"],[i,"positions"]))}else throw new Error(`DoublePointsAppendEditingWrapper:${t.typeName} 坐标属性无法绑定双点追加编辑`);i.startPosition&&!f.equalsN3(i.startPosition,[0,0,0])&&i.init(),i.enabled=!0}};E(ga,"type",ga.registerEditing("ESOlViewer",f.ESJEditingMode.DoublePointsAppend,ga));let Zd=ga;const pa=class pa extends Xe{constructor(t,e){var o;super(t,e,!0);const i=e.viewer;if(!i)return;const s=this.currentEditing=this.ad(new fn(e));if(Reflect.has(t,"position")){const a=t;if(this.ad(f.bind([s,"startPosition"],[a,"position"])),this.ad(nu([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 l=((o=i.getView())==null?void 0:o.getResolution())??1;s.distance=Math.max(1,l*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 l=()=>s.positions=a.points??[];l(),this.ad(a.pointsChanged.don(()=>!s.enabled&&l())),this.ad(f.track([a,"points"],[s,"positions"]))}else throw new Error(`DoublePointsModifyEditingWrapper:${t.typeName} 坐标属性无法绑定双点修改编辑`);s.init(),s.enabled=!0;const r=this.ad(f.createNextAnimateFrameEvent(s.enabledChanged,s.startPositionChanged));this.ad(r.don(()=>{(!s.enabled||!s.startPosition||f.equalsN3(s.startPosition,[0,0,0]))&&this.destroy()}))}};E(pa,"type",pa.registerEditing("ESOlViewer",f.ESJEditingMode.DoublePointsModify,pa));let jd=pa;const ma=class ma extends Xe{constructor(e,i){var r;super(e,i,!0);E(this,"_olViewer");E(this,"bindRemove",[]);this._olViewer=i;const s=e;this.ad(()=>this.clear()),f.equalsN3(s.position,[0,0,0])||Reflect.has(s,"points")&&((r=s.points)==null?void 0:r.length)==0?this.switchEditing(f.ESJEditingMode.DoublePointsAppend):this.switchEditing(f.ESJEditingMode.DoublePointsModify)}clear(){this.bindRemove.forEach(e=>e==null?void 0:e()),this.currentEditing&&!this.currentEditing.isDestroyed()&&this.currentEditing.destroy(),this.currentEditing=void 0,this.bindRemove=[]}switchEditing(e){this.clear();const i=this._olViewer,s=this.sceneObject,r=this.currentEditing=e==f.ESJEditingMode.DoublePointsAppend?new Ls(i):new fn(i);if(this.bindRemove.push(r.enabledChanged.don(o=>{!o&&this.ad(f.nextAnimateFrame(()=>this.destroy()))})),Reflect.has(s,"position")){const o=s;if(this.bindRemove.push(f.bind([r,"startPosition"],[o,"position"])),this.bindRemove.push(nu([r,"rotation"],[o,"rotation"])),Reflect.has(o,"far"))this.bindRemove.push(f.bind([r,"distance"],[o,"far"]));else if(Reflect.has(o,"radius"))this.bindRemove.push(f.bind([r,"distance"],[o,"radius"]));else if(Reflect.has(o,"distance"))this.bindRemove.push(f.bind([r,"distance"],[o,"distance"]));else{const a=i.viewer,l=a==null?void 0:a.getView(),c=(l==null?void 0:l.getResolution())??1;r.distance=Math.max(1,c*100)}}else if(Reflect.has(s,"points")){r instanceof fn&&(r.moveWithFirstPosition=!1);const o=s,a=()=>r.positions=o.points??[];a(),this.bindRemove.push(o.pointsChanged.don(()=>!r.enabled&&a())),this.bindRemove.push(f.track([o,"points"],[r,"positions"]))}else throw new Error(`DoublePointsWrapper:${s.typeName} 坐标属性无法绑定双点编辑`);e==f.ESJEditingMode.DoublePointsAppend?this.bindRemove.push(i.clickEvent.don(o=>{var a;r.editingPoints.length==r.maxPointsNum&&((a=o.pointerEvent)==null?void 0:a.button)==0&&this.switchEditing(f.ESJEditingMode.DoublePointsModify)})):r.init(),r.enabled=!0}};E(ma,"type",ma.registerEditing("ESOlViewer",f.ESJEditingMode.DoublePoints,ma));let qd=ma;const ya=class ya extends Xe{constructor(t,e){super(t,e,!0);const i=this.currentEditing=this.ad(new qn(e));if(i.rotation=[90,0,0],this.ad(i.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([i,"position"],[s,"position"])),this.ad(f.bind([i,"selfRotation"],[s,"rotation"]));return}else throw new Error(`OlRotationEditingWrapper:${t.typeName} 旋转属性无法绑定旋转编辑`)}};E(ya,"type",ya.registerEditing("ESOlViewer",f.ESJEditingMode.Rotation,ya));let Kd=ya;M.AddEditingPoint=Vd,M.BaseEditingWrapper=Xe,M.CircularAppendEditing=w0,M.CircularAppendEditingWrapper=Hd,M.CircularInsertEditing=E0,M.CircularInsertEditingWrapper=Bd,M.CurrentScale=im,M.DoublePointsAppendEditing=Ls,M.DoublePointsAppendEditingWrapper=Zd,M.DoublePointsModifyEditing=fn,M.DoublePointsModifyEditingWrapper=jd,M.DoublePointsWrapper=qd,M.ESOlViewer=ki,M.EditingPoint=Gd,M.FPSMonitor=Mp,M.GeoCanvasPoi=an,M.HeightModifyEditing=yR,M.ImageLabel2D=i0,M.LineStringAppendEditing=v0,M.LineStringAppendEditingWrapper=Xd,M.LineStringInsertEditing=x0,M.LineStringInsertEditingWrapper=Yd,M.MultiPointsAppendEditing=qt,M.OLCurrentScale=Np,M.OlCanvasAndDivSwitchPoi=b1,M.OlCanvasPoi=eu,M.OlCursorPositionInfo=hm,M.OlDivPoi=su,M.OlESAreaMeasurement=Cd,M.OlESDirectionMeasurement=bd,M.OlESDistanceMeasurement=Pd,M.OlESGeoIcon=Rd,M.OlESGeoLineString=Go,M.OlESGeoPoint=Id,M.OlESGeoPoints=Sd,M.OlESGeoPolygon=ko,M.OlESGeoPolygonImpl=As,M.OlESGeoPolygonWithFire=Td,M.OlESImageLabel=Md,M.OlESImageryLayer=Ad,M.OlESLabel=Ed,M.OlESLocationMeasurement=Dd,M.OlESMVTLayer=Fd,M.OlESObjectWithLocation=zo,M.OlESPath=Od,M.OlESTextLabel=zd,M.OlESXYZLayer=Nd,M.OlGeoCanvasImagePoi=zi,M.OlGeoCanvasMenuPoi=rr,M.OlGeoCustomDivPoi=de,M.OlGeoDivTextPoi=Wn,M.OlImageriesManager=um,M.OlImagery=xd,M.OlLabelManager=dm,M.OlMultiPoint=Zn,M.OlPickingManager=gm,M.OlPoint=xi,M.OlPoisContext=am,M.OlPolygon=un,M.OlPolyline=fe,M.OlRotationEditing=qn,M.OlRotationEditingWrapper=Kd,M.OlView=Ms,M.OlViewChanged=Fx,M.OlViewerExtensions=pm,M.PlaceEditing=Ei,M.PlaceEditingWrapper=Wd,M.PointAdding=m0,M.PreviousPointDeleting=_0,M.ScaleEditing=dn,M.ScaleEditingWrapper=Ud,M.ScatterAppendEditing=pR,M.ScatterModifyEditing=mR,M.SinglePointEditingWrapper=$d,M.TranslationEditing=Ci,M.TranslationEditingWrapper=yc,M.VisibilityAppendEditing=Uo,M.VisibilityModifyEditing=$o,M.WASDController=Sp,M.cameraHeightToOlZoom=Gn,M.capture=Rp,M.cesiumHeightToOlZoom=Gn,M.compute2DPickingConstraint=Nx,M.compute2DPickingInfoWithCoordinates=kp,M.computePickingInfoWithCoordinates2D=Op,M.createEditingSystemProcessing=C0,M.createHelperLine=zx,M.createMoveObjectsProcessing=wR,M.defaultFlyToRotation=Ap,M.deletePreviousPoint=y0,M.flyExtent=_o,M.flyTo=on,M.flyToWithParam=Dx,M.flyToWithPosition=jh,M.flyToWithPositions=Ax,M.fromCartesian=Ux,M.fromCartesian2=$p,M.fromCartesian3=Xp,M.fromCartesian4=Hp,M.fromCartographic=Xx,M.fromColor=Hx,M.fromDistanceDisplayCondition=Kx,M.fromEllipsoid=s1,M.fromHeadingPitchRoll=jx,M.fromNearFarScalar=Zx,M.fromQuaternion=Qx,M.fromRectangle=i1,M.geoNeareastPointOnRhumbLine=Vn,M.geoNeareastPointOnRhumbLine2=kx,M.getCameraPosition=Fp,M.getCenterFromPositions=d1,M.getFlatMidPoint=Jh,M.getInverseModelMatrix=Jp,M.getMinMaxCoordinates=nm,M.getModelMatrixFromPosition=Kh,M.getOlZoomFromCameraHeight=Tp,M.getOlZoomFromCesiumHeight=Tp,M.getPointsExtent=dl,M.getViewerExtensions=ln,M.localPositionToPosition=em,M.localPositionsToPositions=u1,M.moveAllPositionsWithCenter=f1,M.olFlyTo=Dp,M.olZoomToCameraHeight=sr,M.olZoomToCesiumHeight=sr,M.orbitAroundPoint=Ip,M.pickOlPosition=Lp,M.positionAndRotationToQuaternion=t1,M.positionFromCartesian=Vp,M.positionToCartesian=fl,M.positionToLocalPosition=tm,M.positionsToLocalPositions=h1,M.setViewerExtensions=vl,M.toCartesian=Wx,M.toCartesian2=Up,M.toCartesian3=gl,M.toCartesian4=Yp,M.toCartographic=$x,M.toColor=Yx,M.toDistanceDisplayCondition=qx,M.toEllipsoid=n1,M.toHeadingPitchRoll=Bp,M.toNearFarScalar=Bx,M.toQuaternion=Jx,M.toRectangle=e1,M.visualizeCenterPoint=Mx,Object.defineProperty(M,Symbol.toStringTag,{value:"Module"})}));
|