1import{d as va,r as Sa,o as La,h as Aa,v as Ma,a as ba,b as Oa,e as nr}from"../js/app.main-4c5f2bc8.js";class Pa{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}const Qt=Pa,ti={PROPERTYCHANGE:"propertychange"};class Da{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}const ms=Da;function Le(n,t){return n>t?1:n<t?-1:0}function ps(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 Fa(n,t,e){for(;t<e;){const i=n[t];n[t]=n[e],n[e]=i,++t,--e}}function eo(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 me(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 ka(n,t,e){const i=t||Le;return n.every(function(s,r){if(r===0)return!0;const o=i(n[r-1],s);return!(o>0||e&&o===0)})}function Ei(){return!0}function Cn(){return!1}function ei(){}function Na(n){let t=!1,e,i,s;return function(){const r=Array.prototype.slice.call(arguments);return(!t||this!==s||!me(r,i))&&(t=!0,s=this,i=r,e=n.apply(this,arguments)),e}}function bi(n){for(const t in n)delete n[t]}function xi(n){let t;for(t in n)return!1;return!t}class Ga extends ms{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 Qt(t):t;r.target||(r.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});i in o||(o[i]=0,a[i]=0),++o[i];let l;for(let h=0,c=s.length;h<c;++h)if("handleEvent"in s[h]?l=s[h].handleEvent(r):l=s[h].call(this,r),l===!1||r.propagationStopped){l=!1;break}if(--o[i]===0){let h=a[i];for(delete a[i];h--;)this.removeEventListener(i,ei);delete o[i]}return l}disposeInternal(){this.listeners_&&bi(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return this.listeners_?t?t in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(t,e){const i=this.listeners_&&this.listeners_[t];if(i){const s=i.indexOf(e);s!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[s]=ei,++this.pendingRemovals_[t]):(i.splice(s,1),i.length===0&&delete this.listeners_[t]))}}}const Rn=Ga,F={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};function W(n,t,e,i,s){if(i&&i!==n&&(e=e.bind(i)),s){const o=e;e=function(){n.removeEventListener(t,e),o.apply(this,arguments)}}const r={target:n,type:t,listener:e};return n.addEventListener(t,e),r}function on(n,t,e,i){return W(n,t,e,i,!0)}function Q(n){n&&n.target&&(n.target.removeEventListener(n.type,n.listener),bi(n))}class Tn extends Rn{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(F.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]=W(this,t[r],e);return s}return W(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]=on(this,t[r],e)}else i=on(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)Xa(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)}}Tn.prototype.on;Tn.prototype.once;Tn.prototype.un;function Xa(n){if(Array.isArray(n))for(let t=0,e=n.length;t<e;++t)Q(n[t]);else Q(n)}const io=Tn;function Y(){throw new Error("Unimplemented abstract method.")}let Wa=0;function B(n){return n.ol_uid||(n.ol_uid=String(++Wa))}class sr extends Qt{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}class za extends io{constructor(t){super(),this.on,this.once,this.un,B(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_}
1hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new sr(i,t,e)),i=ti.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new sr(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],xi(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}const Pt=za;function X(n,t){if(!n)throw new Error(t)}class ys extends Pt{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 ys(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_&&(Q(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=W(t,F.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?Ya(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 Ya(n){if(typeof n=="function")return n;let t;return Array.isArray(n)?t=n:(X(typeof n.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),t=[n]),function(){return t}}const Ba=ys,M={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function no(n){return Math.pow(n,3)}function oi(n){return 1-no(1-n)}function Ka(n){return 3*n*n-2*n*n*n}function Za(n){return n}class Va extends Rn{constructor(t,e,i){super(),i=i||{},this.tileCoord=t,this.state=e,this.interimTile=null,this.key="",this.transition_=i.transition===void 0?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(F.CHANGE)}release(){this.state===M.ERROR&&this.setState(M.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getInterimTile(){if(!this.interimTile)return this;let t=this.interimTile;do{if(t.getState()==M.LOADED)return this.transition_=0,t;t=t.interimTile}while(t);return this}refreshInterimChain(){if(!this.interimTile)return;let t=this.interimTile,e=this;do{if(t.getState()==M.LOADED){t.interimTile=null;break}else t.getState()==M.LOADING?e=t:t.getState()==M.IDLE?e.interimTile=t.interimTile:e=t;t=e.interimTile}while(t)}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==M.ERROR&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}load(){Y()}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:no(s/this.transition_)}inTransition(t){return this.transition_?this.transitionStarts_[t]!==-1:!1}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}}const so=Va,fe=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",Ua=fe.includes("firefox"),ja=fe.includes("safari")&&!fe.includes("chrom");
1ja&&(fe.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(fe));const Ha=fe.includes("webkit")&&!fe.includes("edge"),ro=fe.includes("macintosh"),oo=typeof devicePixelRatio<"u"?devicePixelRatio:1,Es=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,ao=typeof Image<"u"&&Image.prototype.decode,lo=function(){let n=!1;try{const t=Object.defineProperty({},"passive",{get:function(){n=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch{}return n}();function dt(n,t,e,i){let s;return e&&e.length?s=e.shift():Es?s=new OffscreenCanvas(n||300,t||300):s=document.createElement("canvas"),n&&(s.width=n),t&&(s.height=t),s.getContext("2d",i)}function wn(n){const t=n.canvas;t.width=1,t.height=1,n.clearRect(0,0,1,1)}function $a(n){let t=n.offsetWidth;const e=getComputedStyle(n);return t+=parseInt(e.marginLeft,10)+parseInt(e.marginRight,10),t}function qa(n){let t=n.offsetHeight;const e=getComputedStyle(n);return t+=parseInt(e.marginTop,10)+parseInt(e.marginBottom,10),t}function rr(n,t){const e=t.parentNode;e&&e.replaceChild(n,t)}function an(n){return n&&n.parentNode?n.parentNode.removeChild(n):null}function ho(n){for(;n.lastChild;)n.removeChild(n.lastChild)}function Ja(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)}}}const q={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function Qa(n,t,e){const i=n;let s=!0,r=!1,o=!1;const a=[on(i,F.LOAD,function(){o=!0,r||t()})];return i.src&&ao?(r=!0,i.decode().then(function(){s&&t()}).catch(function(l){s&&(o?t():e())})):a.push(on(i,F.ERROR,e)),function(){s=!1,a.forEach(Q)}}function tl(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),t&&(n.src=t)})}function el(n,t){return t&&(n.src=t),ao?new Promise((e,i)=>n.decode().then(()=>e(n),i)):tl(n)}class il extends so{constructor(t,e,i,s,r,o){super(t,e,o),this.crossOrigin_=s,this.src_=i,this.key=i,this.image_=new Image,s!==null&&(this.image_.crossOrigin=s),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=M.LOADED,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=M.ERROR,this.unlistenImage_(),this.image_=nl(),this.changed()}handleImageLoad_(){const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=M.LOADED:this.state=M.EMPTY,this.unlistenImage_(),this.changed()}load(){this.state==M.ERROR&&(this.state=M.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==M.IDLE&&(this.state=M.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=Qa(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function nl(){const n=dt(1,1);return n.fillStyle="rgba(0,0,0,0)",n.fillRect(0,0,1,1),n.canvas}const co=il,sl=.5,st={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function or(n){const t=bt();for(let e=0,i=n.length;e<i;++e)mi(t,n[e]);return t}function xs(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 uo(n,t){return t?(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t):n.slice()}function fo(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 In(n,t){return go(n,t[0],t[1])}function Re(n,t){return n[0]<=t[0]&&t[2]<=n[2]&&n[1]<=t[1]&&t[3]<=n[3]}function go(n,t,e){return n[0]<=t&&t<=n[2]&&n[1]<=e&&e<=n[3]}function is(n,t){const e=n[0],i=n[1],s=n[2],r=n[3],o=t[0],a=t[1];let l=st.UNKNOWN;return o<e?l=l|st.LEFT:o>s&&(l=l|st.RIGHT),a<i?l=l|st.BELOW:a>r&&(l=l|st.ABOVE),l===st.UNKNOWN&&(l=st.INTERSECTING),l}function bt(){return[1/0,1/0,-1/0,-1/0]}function ge(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 vn(n){return ge(1/0,1/0,-1/0,-1/0,n)}function rl(n,t){const e=n[0],i=n[1];return ge(e,i,e,i,t)}function ol(n,t,e,i,s){const r=vn(s);return _o(r,n,t,e,i)}function Ci(n,t){return n[0]==t[0]&&n[2]==t[2]&&n[1]==t[1]&&n[3]==t[3]}function al(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 mi(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 _o(n,t,e,i,s){for(;e<i;e+=s)ll(n,t[e],t[e+1]);return n}function ll(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 mo(n,t){let e;return e=t(Sn(n)),e||(e=t(Ln(n)),e)||(e=t(An(n)),e)||(e=t(Me(n)),e)?e:!1}function ns(n){let t=0;return Mn(n)||(t=J(n)*zt(n)),t}function Sn(n){return[n[0],n[1]]}function Ln(n){return[n[2],n[1]]}function ii(n){return[(n[0]+n[2])/2,(n[1]+n[3])/2]}function hl(n,t){let e;if(t==="bottom-left")e=Sn(n);else if(t==="bottom-right")e=Ln(n);else if(t==="top-left")e=Me(n);else if(t==="top-right")e=An(n);else throw new Error("Invalid corner");return e}function ss(n,t,e,i,s){const[r,o,a,l,h,c,u,d]=rs(n,t,e,i);return ge(Math.min(r,a,h,u),Math.min(o,l,c,d),Math.max(r,a,h,u),Math.max(o,l,c,d),s)}function rs(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,h=s*a,c=r*o,u=r*a,d=n[0],f=n[1];return[d-l+u,f-h-c,d-l-u,f-h+c,d+l-u,f+h+c,d+l+u,f+h-c,d-l+u,f-h-c]}function zt(n){return n[3]-n[1]}function pi(n,t,e){const i=e||bt();return pt(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]):vn(i),i}function Me(n){return[n[0],n[3]]}function An(n){return[n[2],n[3]]}function J(n){return n[2]-n[0]}function pt(n,t){return n[0]<=t[2]&&n[2]>=t[0]&&n[1]<=t[3]&&n[3]>=t[1]}function Mn(n){return n[2]<n[0]||n[3]<n[1]}function cl(n,t){return t?(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t):n}function ul(n,t,e){let i=!1;const s=is(n,t),r=is(n,e);if(s===st.INTERSECTING||r===st.INTERSECTING)i=!0;else{const o=n[0],a=n[1],l=n[2],h=n[3],c=t[0],u=t[1],d=e[0],f=e[1],g=(f-u)/(d-c);let _,m;r&st.ABOVE&&!(s&st.ABOVE)&&(_=d-(f-h)/g,i=_>=o&&_<=l),!i&&r&st.RIGHT&&!(s&st.RIGHT)&&(m=f-(d-l)*g,i=m>=a&&m<=h),!i&&r&st.BELOW&&!(s&st.BELOW)&&(_=d-(f-a)/g,i=_>
1=o&&_<=l),!i&&r&st.LEFT&&!(s&st.LEFT)&&(m=f-(d-o)*g,i=m>=a&&m<=h)}return i}function po(n,t){const e=t.getExtent(),i=ii(n);if(t.canWrapX()&&(i[0]<e[0]||i[0]>=e[2])){const s=J(e),o=Math.floor((i[0]-e[0])/s)*s;n[0]-=o,n[2]-=o}return n}function dl(n,t){if(t.canWrapX()){const e=t.getExtent();if(!isFinite(n[0])||!isFinite(n[2]))return[[e[0],n[1],e[2],n[3]]];po(n,t);const i=J(e);if(J(n)>i)return[[e[0],n[1],e[2],n[3]]];if(n[0]<e[0])return[[n[0]+i,n[1],e[2],n[3]],[e[0],n[1],n[2],n[3]]];if(n[2]>e[2])return[[n[0],n[1],e[2],n[3]],[e[0],n[1],n[2]-i,n[3]]]}return[n]}const Ri={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class fl{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_||Ri[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 yo=fl,Oi=6378137,Ue=Math.PI*Oi,gl=[-Ue,-Ue,Ue,Ue],_l=[-180,-85,180,85],Ui=Oi*Math.log(Math.tan(Math.PI/2));class Ne extends yo{constructor(t){super({code:t,units:"m",extent:gl,global:!0,worldExtent:_l,getPointResolution:function(e,i){return e/Math.cosh(i[1]/Oi)}})}}const ar=[new Ne("EPSG:3857"),new Ne("EPSG:102100"),new Ne("EPSG:102113"),new Ne("EPSG:900913"),new Ne("http://www.opengis.net/def/crs/EPSG/0/3857"),new Ne("http://www.opengis.net/gml/srs/epsg.xml#3857")];function ml(n,t,e){const i=n.length;e=e>1?e:2,t===void 0&&(e>2?t=n.slice():t=new Array(i));for(let s=0;s<i;s+=e){t[s]=Ue*n[s]/180;let r=Oi*Math.log(Math.tan(Math.PI*(+n[s+1]+90)/360));r>Ui?r=Ui:r<-Ui&&(r=-Ui),t[s+1]=r}return t}function pl(n,t,e){const i=n.length;e=e>1?e:2,t===void 0&&(e>2?t=n.slice():t=new Array(i));for(let s=0;s<i;s+=e)t[s]=180*n[s]/Ue,t[s+1]=360*Math.atan(Math.exp(n[s+1]/Oi))/Math.PI-90;return t}const yl=6378137,lr=[-180,-90,180,90],El=Math.PI*yl/180;class Ee extends yo{constructor(t,e){super({code:t,units:"degrees",extent:lr,axisOrientation:e,global:!0,metersPerUnit:El,worldExtent:lr})}}const hr=[new Ee("CRS:84"),new Ee("EPSG:4326","neu"),new Ee("urn:ogc:def:crs:OGC:1.3:CRS84"),new Ee("urn:ogc:def:crs:OGC:2:84"),new Ee("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Ee("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Ee("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let os={};function xl(n){return os[n]||os[n.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function Cl(n,t){os[n]=t}let $e={};function ln(n,t,e){const i=n.getCode(),s=t.getCode();i in $e||($e[i]={}),$e[i][s]=e}function Rl(n,t){let e;return n in $e&&t in $e[n]&&(e=$e[n][t]),e}function et(n,t,e){return Math.min(Math.max(n,t),e)}function Tl(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 qe(n,t,e,i)}function qe(n,t,e,i){const s=e-n,r=i-t;return s*s+r*r}function wl(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 h=i;h<t+1;h++)i==h?n[a][h]=0:n[a][h]+=l*n[i][h]}}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 rn(n){return n*Math.PI/180}function Je(n,t){const e=n%t;return e*t<0?e+t:e}function Mt(n,t,e){return n+e*(t-n)}function Cs(n,t){const e=Math.pow(10,t);return Math.round(n*e)/e}function ji(n,t){return Math.floor(Cs(n,t))}function Hi(n,t){return Math.ceil(Cs(n,t))}function Il(n,t){return n[0]+=+t[0],n[1]+=+t[1],n}function hn(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 Rs(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 vl(n,t){return n[0]*=t,n[1]*=t,n}function Eo(n,t){if(t.canWrapX()){const e=J(t.getExtent()),i=Sl(n,t,e);i&&(n[0]-=i*e)}return n}function Sl(n,t,e){const i=t.getExtent();let s=0;return t.canWrapX()&&(n[0]<i[0]||n[0]>i[2])&&(e=e||J(i),s=Math.floor((n[0]-i[0])/e)),s}const Ll=63710088e-1;function cr(n,t,e){e=e||Ll;const i=rn(n[1]),s=rn(t[1]),r=(s-i)/2,o=rn(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))}const xo={info:1,warn:2,error:3,none:4};let Al=xo.info;function Co(...n){Al>xo.warn||console.warn(...n)}let as=!0;function Ro(n){as=!(n===void 0?!0:n)}function Ts(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 To(n,t){if(t!==void 0&&n!==t){for(let e=0,i=n.length;e<i;++e)t[e]=n[e];n=t}return n}function Ml(n){Cl(n.getCode(),n),ln(n,n,Ts)}
1function bl(n){n.forEach(Ml)}function Ot(n){return typeof n=="string"?xl(n):n||null}function ur(n,t,e,i){n=Ot(n);let s;const r=n.getPointResolutionFunc();if(r){if(s=r(t,e),i&&i!==n.getUnits()){const o=n.getMetersPerUnit();o&&(s=s*o/Ri[i])}}else{const o=n.getUnits();if(o=="degrees"&&!i||i=="degrees")s=t;else{const a=Is(n,Ot("EPSG:4326"));if(a===To&&o!=="degrees")s=t*n.getMetersPerUnit();else{let h=[e[0]-t/2,e[1],e[0]+t/2,e[1],e[0],e[1]-t/2,e[0],e[1]+t/2];h=a(h,h,2);const c=cr(h.slice(0,2),h.slice(2,4)),u=cr(h.slice(4,6),h.slice(6,8));s=(c+u)/2}const l=i?Ri[i]:n.getMetersPerUnit();l!==void 0&&(s/=l)}}return s}function dr(n){bl(n),n.forEach(function(t){n.forEach(function(e){t!==e&&ln(t,e,Ts)})})}function Ol(n,t,e,i){n.forEach(function(s){t.forEach(function(r){ln(s,r,e),ln(r,s,i)})})}function ws(n,t){return n?typeof n=="string"?Ot(n):n:Ot(t)}function fr(n,t){return Ro(),wo(n,"EPSG:4326",t!==void 0?t:"EPSG:3857")}function Ye(n,t){if(n===t)return!0;const e=n.getUnits()===t.getUnits();return(n.getCode()===t.getCode()||Is(n,t)===Ts)&&e}function Is(n,t){const e=n.getCode(),i=t.getCode();let s=Rl(e,i);return s||(s=To),s}function cn(n,t){const e=Ot(n),i=Ot(t);return Is(e,i)}function wo(n,t,e){return cn(t,e)(n,void 0,n.length)}function ls(n,t){return n}function jt(n,t){return as&&!hn(n,[0,0])&&n[0]>=-180&&n[0]<=180&&n[1]>=-90&&n[1]<=90&&(as=!1,Co("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),n}function Io(n,t){return n}function Te(n,t){return n}function Pl(){dr(ar),dr(hr),Ol(hr,ar,ml,pl)}Pl();const Dl=10,gr=.25;class Fl{constructor(t,e,i,s,r,o){this.sourceProj_=t,this.targetProj_=e;let a={};const l=cn(this.targetProj_,this.sourceProj_);this.transformInv_=function(y){const x=y[0]+"/"+y[1];return a[x]||(a[x]=l(y)),a[x]},this.maxSourceExtent_=s,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&J(s)>=J(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?J(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?J(this.targetProj_.getExtent()):null;const h=Me(i),c=An(i),u=Ln(i),d=Sn(i),f=this.transformInv_(h),g=this.transformInv_(c),_=this.transformInv_(u),m=this.transformInv_(d),p=Dl+(o?Math.max(0,Math.ceil(Math.log2(ns(i)/(o*o*256*256)))):0);if(this.addQuad_(h,c,u,d,f,g,_,m,p),this.wrapsXInSource_){let y=1/0;this.triangles_.forEach(function(x,E,C){y=Math.min(y,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])-y>this.sourceWorldWidth_/2){const E=[[x.source[0][0],x.source[0][1]],[x.source[1][0],x.source[1][1]],[x.source[2][0],x.source[2][1]]];E[0][0]-y>this.sourceWorldWidth_/2&&(E[0][0]-=this.sourceWorldWidth_),E[1][0]-y>this.sourceWorldWidth_/2&&(E[1][0]-=this.sourceWorldWidth_),E[2][0]-y>this.sourceWorldWidth_/2&&(E[2][0]-=this.sourceWorldWidth_);const C=Math.min(E[0][0],E[1][0],E[2][0]);Math.max(E[0][0],E[1][0],E[2][0])-C<this.sourceWorldWidth_/2&&(x.source=E)}})}a={}}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,h){const c=or([r,o,a,l]),u=this.sourceWorldWidth_?J(c)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,f=this.sourceProj_.canWrapX()&&u>.5&&u<1;let g=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const m=or([t,e,i,s]);g=J(m)/this.targetWorldWidth_>gr||g}!f&&this.sourceProj_.isGlobal()&&u&&(g=u>gr||g)}if(!g&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!pt(c,this.maxSourceExtent_))return;let _=0;if(!g&&(!isFinite(r[0])||!isFinite(r[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(h>0)g=!0;else if(_=(!isFinite(r[0])||!isFinite(r[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),_!=1&&_!=2&&_!=4&&_!=8)return}if(h>0){if(!g){const m=[(t[0]+i[0])/2,(t[1]+i[1])/2],p=this.transformInv_(m);let y;f?y=(Je(r[0],d)+Je(a[0],d))/2-Je(p[0],d):y=(r[0]+a[0])/2-p[0];const x=(r[1]+a[1])/2-p[1];g=y*y+x*x>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const m=[(e[0]+i[0])/2,(e[1]+i[1])/2],p=this.transformInv_(m),y=[(s[0]+t[0])/2,(s[1]+t[1])/2],x=this.transformInv_(y);this.addQuad_(t,e,m,y,r,o,p,x,h-1),this.addQuad_(y,m,i,s,x,p,a,l,h-1)}else{const m=[(t[0]+e[0])/2,(t[1]+e[1])/2],p=this.transformInv_(m),y=[(i[0]+s[0])/2,(i[1]+s[1])/2],x=this.transformInv_(y);this.addQuad_(t,m,y,s,r,p,x,l,h-1),this.addQuad_(m,e,i,y,p,o,a,x,h-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}_&11||this.addTriangle_(t,i,s,r,a,l),_&14||this.addTriangle_(t,i,e,r,a,o),_&&(_&13||this.addTriangle_(e,s,t,o,l,r),_&7||this.addTriangle_(e,s,i,o,l,a))}calculateSourceExtent(){const t=bt();return this.triangles_.forEach(function(e,i,s){const r=e.source;mi(t,r[0]),mi(t,r[1]),mi(t,r[2])}),t}getTriangles(){return this.triangles_}}const kl=Fl;let Yn;const Qe=[];function _r(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(
1)}function Bn(n,t){return Math.abs(n[t*4]-210)>2||Math.abs(n[t*4+3]-.75*255)>2}function Nl(){if(Yn===void 0){const n=dt(6,6,Qe);n.globalCompositeOperation="lighter",n.fillStyle="rgba(210, 0, 0, 0.75)",_r(n,4,5,4,0),_r(n,4,5,0,5);const t=n.getImageData(0,0,3,3).data;Yn=Bn(t,0)||Bn(t,4)||Bn(t,8),wn(n),Qe.push(n.canvas)}return Yn}function mr(n,t,e,i){const s=wo(e,t,n);let r=ur(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||In(l,s)){const h=ur(n,r,s)/r;isFinite(h)&&h>0&&(r/=h)}return r}function Gl(n,t,e,i){const s=ii(e);let r=mr(n,t,s,i);return(!isFinite(r)||r<=0)&&mo(e,function(o){return r=mr(n,t,o,i),isFinite(r)&&r>0}),r}function Xl(n,t,e,i,s,r,o,a,l,h,c,u){const d=dt(Math.round(e*n),Math.round(e*t),Qe);if(u||(d.imageSmoothingEnabled=!1),l.length===0)return d.canvas;d.scale(e,e);function f(E){return Math.round(E*e)/e}d.globalCompositeOperation="lighter";const g=bt();l.forEach(function(E,C,R){al(g,E.extent)});const _=J(g),m=zt(g),p=dt(Math.round(e*_/i),Math.round(e*m/i),Qe);u||(p.imageSmoothingEnabled=!1);const y=e/i;l.forEach(function(E,C,R){const T=E.extent[0]-g[0],w=-(E.extent[3]-g[3]),A=J(E.extent),P=zt(E.extent);E.image.width>0&&E.image.height>0&&p.drawImage(E.image,h,h,E.image.width-2*h,E.image.height-2*h,T*y,w*y,A*y,P*y)});const x=Me(o);
1return a.getTriangles().forEach(function(E,C,R){const T=E.source,w=E.target;let A=T[0][0],P=T[0][1],z=T[1][0],G=T[1][1],k=T[2][0],it=T[2][1];const L=f((w[0][0]-x[0])/r),O=f(-(w[0][1]-x[1])/r),S=f((w[1][0]-x[0])/r),D=f(-(w[1][1]-x[1])/r),j=f((w[2][0]-x[0])/r),V=f(-(w[2][1]-x[1])/r),nt=A,v=P;A=0,P=0,z-=nt,G-=v,k-=nt,it-=v;const Et=[[z,G,0,0,S-L],[k,it,0,0,j-L],[0,0,z,G,D-O],[0,0,k,it,V-O]],K=wl(Et);if(K){if(d.save(),d.beginPath(),Nl()||!u){d.moveTo(S,D);const H=4,te=L-S,Dt=O-D;for(let ot=0;ot<H;ot++)d.lineTo(S+f((ot+1)*te/H),D+f(ot*Dt/(H-1))),ot!=H-1&&d.lineTo(S+f((ot+1)*te/H),D+f((ot+1)*Dt/(H-1)));d.lineTo(j,V)}else d.moveTo(S,D),d.lineTo(L,O),d.lineTo(j,V);d.clip(),d.transform(K[0],K[2],K[1],K[3],L,O),d.translate(g[0]-nt,g[3]-v),d.scale(i/e,-i/e),d.drawImage(p.canvas,0,0),d.restore()}}),wn(p),Qe.push(p.canvas),c&&(d.save(),d.globalCompositeOperation="source-over",d.strokeStyle="black",d.lineWidth=1,a.getTriangles().forEach(function(E,C,R){const T=E.target,w=(T[0][0]-x[0])/r,A=-(T[0][1]-x[1])/r,P=(T[1][0]-x[0])/r,z=-(T[1][1]-x[1])/r,G=(T[2][0]-x[0])/r,k=-(T[2][1]-x[1])/r;d.beginPath(),d.moveTo(P,z),d.lineTo(w,A),d.lineTo(G,k),d.closePath(),d.stroke()}),d.restore()),d.canvas}class Wl extends so{constructor(t,e,i,s,r,o,a,l,h,c,u,d){super(r,M.IDLE,{interpolate:!!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;const f=s.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let _=this.sourceTileGrid_.getExtent();const m=g?pi(f,g):f;if(ns(m)===0){this.state=M.EMPTY;return}const p=t.getExtent();p&&(_?_=pi(_,p):_=p);const y=s.getResolution(this.wrappedTileCoord_[0]),x=Gl(t,i,m,y);if(!isFinite(x)||x<=0){this.state=M.EMPTY;return}const E=c!==void 0?c:sl;if(this.triangulation_=new kl(t,i,m,_,x*E,y),this.triangulation_.getTriangles().length===0){this.state=M.EMPTY;return}this.sourceZ_=e.getZForResolution(x);let C=this.triangulation_.calculateSourceExtent();if(_&&(t.canWrapX()?(C[1]=et(C[1],_[1],_[3]),C[3]=et(C[3],_[1],_[3])):C=pi(C,_)),!ns(C))this.state=M.EMPTY;else{const R=e.getTileRangeForExtentAndZ(C,this.sourceZ_);for(let T=R.minX;T<=R.maxX;T++)for(let w=R.minY;w<=R.maxY;w++){const A=h(this.sourceZ_,T,w,a);A&&this.sourceTiles_.push(A)}this.sourceTiles_.length===0&&(this.state=M.EMPTY)}}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{e&&e.getState()==M.LOADED&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})}),this.sourceTiles_.length=0,t.length===0)this.state=M.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_=Xl(s,r,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=M.LOADED}this.changed()}load(){if(this.state==M.IDLE){this.state=M.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(e=>{const i=e.getState();if(i==M.IDLE||i==M.LOADING){t++;const s=W(e,F.CHANGE,function(r){const o=e.getState();(o==M.LOADED||o==M.ERROR||o==M.EMPTY)&&(Q(s),t--,t===0&&(this.unlistenSources_(),this.reproject_()))},this);this.sourcesListenerKeys_.push(s)}}),t===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function(e,i,s){e.getState()==M.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(Q),this.sourcesListenerKeys_=null}release(){this.canvas_&&(wn(this.canvas_.getContext("2d")),Qe.push(this.canvas_),this.canvas_=null),super.release()}}const hs=Wl;class zl{constructor(t){this.highWaterMark=t!==void 0?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.pop()}clear(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const i=this.entries_[t];return X(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 X(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){if(this.containsKey(t))return this.entries_[t].value_}pop(){const t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){X(!(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}}const Yl=zl;function pr(n,t,e,i){return i!==void 0?(i[0]=n,i[1]=t,i[2]=e,i):[n,t,e]}function bn(n,t,e){return n+"/"+t+"/"+e}function vo(n){return bn(n[0],n[1],n[2])}function Bl(n){return n.split("/").map(Number)}function Kl(n){return(n[1]<<n[0])+n[2]}function Zl(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}class Vl extends Yl{clear(){for(;this.getCount()>0;)this.pop().release();super.clear()}expireCache(t){for(;this.canExpireCache()&&!(this.peekLast().getKey()in t);)this.pop().release()}pruneExceptNewestZ(){if(this.getCount()===0)return;const t=this.peekFirstKey(),i=Bl(t)[0];this.forEach(s=>
1{s.tileCoord[0]!==i&&(this.remove(vo(s.tileCoord)),s.release())})}}const So=Vl,Kn={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};class Ul extends Pt{constructor(t){super(),this.projection=Ot(t.projection),this.attributions_=yr(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible!==void 0?t.attributionsCollapsible:!0,this.loading=!1,this.state_=t.state!==void 0?t.state:"ready",this.wrapX_=t.wrapX!==void 0?t.wrapX:!1,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;const e=this;this.viewPromise_=new Promise(function(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_=yr(t),this.changed()}setState(t){this.state_=t,this.changed()}}function yr(n){return n?Array.isArray(n)?function(t){return n}:typeof n=="function"?n:function(t){return[n]}:null}const Lo=Ul;class Ao{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)}
1getHeight(){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 Ge(n,t,e,i,s){return s!==void 0?(s.minX=n,s.maxX=t,s.minY=e,s.maxY=i,s):new Ao(n,t,e,i)}const Mo=Ao,jl=42,vs=256;function Hl(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 $l(n,t,e,i,s){return!mo(s,function(o){return!we(n,t,e,i,o[0],o[1])})}function we(n,t,e,i,s,r){let o=0,a=n[e-i],l=n[e-i+1];for(;t<e;t+=i){const h=n[t],c=n[t+1];l<=r?c>r&&(h-a)*(r-l)-(s-a)*(c-l)>0&&o++:c<=r&&(h-a)*(r-l)-(s-a)*(c-l)<0&&o--,a=h,l=c}return o!==0}function bo(n,t,e,i,s,r){if(e.length===0||!we(n,t,e[0],i,s,r))return!1;for(let o=1,a=e.length;o<a;++o)if(we(n,e[o-1],e[o],i,s,r))return!1;return!0}function Oo(n,t,e,i,s){const r=_o(bt(),n,t,e,i);return pt(s,r)?Re(s,r)||r[0]>=s[0]&&r[2]<=s[2]||r[1]>=s[1]&&r[3]<=s[3]?!0:Hl(n,t,e,i,function(o,a){return ul(s,o,a)}):!1}function Po(n,t,e,i,s){return!!(Oo(n,t,e,i,s)||we(n,t,e,i,s[0],s[1])||we(n,t,e,i,s[0],s[3])||we(n,t,e,i,s[2],s[1])||we(n,t,e,i,s[2],s[3]))}function ql(n,t,e,i,s){if(!Po(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($l(n,e[r-1],e[r],i,s)&&!Oo(n,e[r-1],e[r],i,s))return!1;return!0}function Er(n){return n[0]>0&&n[1]>0}function Jl(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 Rt(n,t){return Array.isArray(n)?n:(t===void 0?t=[n,n]:(t[0]=n,t[1]=n),t)}const Xe=[0,0,0],se=5;class Ql{constructor(t){this.minZoom=t.minZoom!==void 0?t.minZoom:0,this.resolutions_=t.resolutions,X(ka(this.resolutions_,function(s,r){return r-s},!0),"`resolutions` must be sorted in descending order");let e;if(!t.origins){for(let s=0,r=this.resolutions_.length-1;s<r;++s)if(!e)e=this.resolutions_[s]/this.resolutions_[s+1];else if(this.resolutions_[s]/this.resolutions_[s+1]!==e){e=void 0;break}}this.zoomFactor_=e,this.maxZoom=this.resolutions_.length-1,this.origin_=t.origin!==void 0?t.origin:null,this.origins_=null,t.origins!==void 0&&(this.origins_=t.origins,X(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_=Me(i)),X(!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,X(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:vs,X(!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(function(s,r){const o=new Mo(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},this):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,h=t[0]-1;for(this.zoomFactor_===2?(o=t[1],a=t[2]):l=this.getTileCoordExtent(t,s);h>=this.minZoom;){if(this.zoomFactor_===2?(o=Math.floor(o/2),a=Math.floor(a/2),r=Ge(o,o,a,a,i)):r=this.getTileRangeForExtentAndZ(l,h,i),e(h,r))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]<this.maxZoom){if(this.zoomFactor_===2){const r=t[1]*2,o=t[2]*2;return Ge(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 Ge(r,o,r,o,i);if(this.zoomFactor_){const l=Math.pow(this.zoomFactor_,e-s),h=Math.floor(r*l),c=Math.floor(o*l);if(e<s)return Ge(h,h,c,c,i);const u=Math.floor(l*(r+1))-1,d=Math.floor(l*(o+1))-1;return Ge(h,u,c,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,Xe);const s=Xe[1],r=Xe[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,Xe);const o=Xe[1],a=Xe[2];return Ge(s,o,r,a,i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),s=Rt(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=Rt(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,h=a+r[1]*s;return ge(o,a,l,h,e)}
1getTileCoordForCoordAndResolution(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),h=Rt(this.getTileSize(o),this.tmpSize_);let c=a*(t-l[0])/i/h[0],u=a*(l[1]-e)/i/h[1];return s?(c=Hi(c,se)-1,u=Hi(u,se)-1):(c=ji(c,se),u=ji(u,se)),pr(o,c,u,r)}getTileCoordForXYAndZ_(t,e,i,s,r){const o=this.getOrigin(i),a=this.getResolution(i),l=Rt(this.getTileSize(i),this.tmpSize_);let h=(t-o[0])/a/l[0],c=(o[1]-e)/a/l[1];return s?(h=Hi(h,se)-1,c=Hi(c,se)-1):(h=ji(h,se),c=ji(c,se)),pr(i,h,c,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=ps(this.resolutions_,t,e||0);return et(i,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return Po(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}}const Do=Ql;function Fo(n){let t=n.getDefaultTileGrid();return t||(t=nh(n),n.setDefaultTileGrid(t)),t}function th(n,t,e){const i=t[0],s=n.getTileCoordCenter(t),r=Ss(e);if(!In(r,s)){const o=J(r),a=Math.ceil((r[0]-s[0])/o);return s[0]+=o*a,n.getTileCoordForCoordAndZ(s,i)}return t}function eh(n,t,e,i){i=i!==void 0?i:"top-left";const s=ko(n,t,e);return new Do({extent:n,origin:hl(n,i),resolutions:s,tileSize:e})}function ih(n){const t=n||{},e=t.extent||Ot("EPSG:3857").getExtent(),i={extent:e,minZoom:t.minZoom,tileSize:t.tileSize,resolutions:ko(e,t.maxZoom,t.tileSize,t.maxResolution)};return new Do(i)}function ko(n,t,e,i){t=t!==void 0?t:jl,e=Rt(e!==void 0?e:vs);const s=zt(n),r=J(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 nh(n,t,e,i){const s=Ss(n);return eh(s,t,e,i)}function Ss(n){n=Ot(n);let t=n.getExtent();if(!t){const e=180*Ri.degrees/n.getMetersPerUnit();t=ge(-e,-e,e,e)}return t}class sh extends Lo{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:t.projection,state:t.state,wrapX:t.wrapX,interpolate:t.interpolate}),this.on,this.once,this.un,this.opaque_=t.opaque!==void 0?t.opaque:!1,this.tilePixelRatio_=t.tilePixelRatio!==void 0?t.tilePixelRatio:1,this.tileGrid=t.tileGrid!==void 0?t.tileGrid:null;const e=[256,256];this.tileGrid&&Rt(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tileCache=new So(t.cacheSize||0),this.tmpSize=[0,0],this.key_=t.key||"",this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}canExpireCache(){return this.tileCache.canExpireCache()}expireCache(t,e){const i=this.getTileCacheForProjection(t);i&&i.expireCache(e)}forEachLoadedTile(t,e,i,s){const r=this.getTileCacheForProjection(t);if(!r)return!1;let o=!0,a,l,h;for(let c=i.minX;c<=i.maxX;++c)for(let u=i.minY;u<=i.maxY;++u)l=bn(e,c,u),h=!1,r.containsKey(l)&&(a=r.get(l),h=a.getState()===M.LOADED,h&&(h=s(a)!==!1)),h||(o=!1);return o}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getOpaque(t){return this.opaque_}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,s,r){return Y()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:Fo(t)}getTileCacheForProjection(t){const e=this.getProjection();return X(e===null||Ye(e,t),"A VectorTile source can only be rendered if it has a projection compatible with the view projection."),this.tileCache}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const s=this.getTileGridForProjection(i),r=this.getTilePixelRatio(e),o=Rt(s.getTileSize(t),this.tmpSize);return r==1?o:Jl(o,r,this.tmpSize)}getTileCoordForTileUrlFunction(t,e){e=e!==void 0?e:this.getProjection();const i=this.getTileGridForProjection(e);return this.getWrapX()&&e.isGlobal()&&(t=th(i,t,e)),Zl(t,i)?t:null}clear(){this.tileCache.clear()}refresh(){this.clear(),super.refresh()}updateCacheSize(t,e){const i=this.getTileCacheForProjection(e);t>i.highWaterMark&&(i.highWaterMark=t)}useTile(t,e,i,s){}}class rh extends Qt{constructor(t,e){super(t),this.tile=e}}const oh=sh;function ah(n,t){const e=/\{z\}/g,i=/\{x\}/g,s=/\{y\}/g,r=/\{-y\}/g;return function(o,a,l){if(o)return n.replace(e,o[0].toString()).replace(i,o[1].toString()).replace(s,o[2].toString()).replace(r,function(){const h=o[0],c=t.getFullTileRange(h);return X(c,"The {-y} placeholder requires a tile grid with extent"),(c.getHeight()-o[2]-1).toString()})}}function lh(n,t){const e=n.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=ah(n[s],t);return hh(i)}
1function hh(n){return n.length===1?n[0]:function(t,e,i){if(!t)return;const s=Kl(t),r=Je(s,n.length);return n[r](t,e,i)}}function ch(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}class Ls extends oh{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===Ls.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=B(e),s=e.getState();let r;s==M.LOADING?(this.tileLoadingKeys_[i]=!0,r=Kn.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=s==M.ERROR?Kn.TILELOADERROR:s==M.LOADED?Kn.TILELOADEND:void 0),r!=null&&this.dispatchEvent(new rh(r,e))}setTileLoadFunction(t){this.tileCache.clear(),this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,this.tileCache.pruneExceptNewestZ(),typeof e<"u"?this.setKey(e):this.changed()}setUrl(t){const e=ch(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join(` 2`);this.generateTileUrlFunction_?this.setTileUrlFunction(lh(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}useTile(t,e,i){const s=bn(t,e,i);this.tileCache.containsKey(s)&&this.tileCache.get(s)}}const uh=Ls;class dh extends uh{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:fh,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate!==void 0?t.interpolate:!0,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=t.crossOrigin!==void 0?t.crossOrigin:null,this.tileClass=t.tileClass!==void 0?t.tileClass:co,this.tileCacheForProjection={},this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}canExpireCache(){if(this.tileCache.canExpireCache())return!0;for(const t in this.tileCacheForProjection)if(this.tileCacheForProjection[t].canExpireCache())return!0;return!1}expireCache(t,e){const i=this.getTileCacheForProjection(t);this.tileCache.expireCache(this.tileCache==i?e:{});for(const s in this.tileCacheForProjection){const r=this.tileCacheForProjection[s];r.expireCache(r==i?e:{})}}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}getOpaque(t){return this.getProjection()&&t&&!Ye(this.getProjection(),t)?!1:super.getOpaque(t)}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||Ye(e,t)))return this.tileGrid;const i=B(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=Fo(t)),this.tileGridForProjection[i]}getTileCacheForProjection(t){const e=this.getProjection();if(!e||Ye(e,t))return this.tileCache;
2const i=B(t);return i in this.tileCacheForProjection||(this.tileCacheForProjection[i]=new So(this.tileCache.highWaterMark)),this.tileCacheForProjection[i]}createTile_(t,e,i,s,r,o){const a=[t,e,i],l=this.getTileCoordForTileUrlFunction(a,r),h=l?this.tileUrlFunction(l,s,r):void 0,c=new this.tileClass(a,h!==void 0?M.IDLE:M.EMPTY,h!==void 0?h:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return c.key=o,c.addEventListener(F.CHANGE,this.handleTileChange.bind(this)),c}getTile(t,e,i,s,r){const o=this.getProjection();if(!o||!r||Ye(o,r))return this.getTileInternal(t,e,i,s,o||r);const a=this.getTileCacheForProjection(r),l=[t,e,i];let h;const c=vo(l);a.containsKey(c)&&(h=a.get(c));const u=this.getKey();if(h&&h.key==u)return h;const d=this.getTileGridForProjection(o),f=this.getTileGridForProjection(r),g=this.getTileCoordForTileUrlFunction(l,r),_=new hs(o,d,r,f,l,g,this.getTilePixelRatio(s),this.getGutter(),(m,p,y,x)=>this.getTileInternal(m,p,y,x,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.getInterpolate());return _.key=u,h?(_.interimTile=h,_.refreshInterimChain(),a.replace(c,_)):a.set(c,_),_}getTileInternal(t,e,i,s,r){let o=null;const a=bn(t,e,i),l=this.getKey();if(!this.tileCache.containsKey(a))o=this.createTile_(t,e,i,s,r,l),this.tileCache.set(a,o);else if(o=this.tileCache.get(a),o.key!=l){const h=o;o=this.createTile_(t,e,i,s,r,l),h.getState()==M.IDLE?o.interimTile=h.interimTile:o.interimTile=h,o.refreshInterimChain(),this.tileCache.replace(a,o)}return o}setRenderReprojectionEdges(t){if(this.renderReprojectionEdges_!=t){this.renderReprojectionEdges_=t;for(const e in this.tileCacheForProjection)this.tileCacheForProjection[e].clear();this.changed()}}setTileGridForProjection(t,e){const i=Ot(t);if(i){const s=B(i);s in this.tileGridForProjection||(this.tileGridForProjection[s]=e)}}clear(){super.clear();for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear()}}function fh(n,t){n.getImage().src=t}const gh=dh;class _h extends gh{constructor(t){t=t||{};const e=t.projection!==void 0?t.projection:"EPSG:3857",i=t.tileGrid!==void 0?t.tileGrid:ih({extent:Ss(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,opaque:t.opaque,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid: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 mh=_h,ph='© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.';class yh extends mh{constructor(t){t=t||{};let e;t.attributions!==void 0?e=t.attributions:e=[ph];const i=t.crossOrigin!==void 0?t.crossOrigin:"anonymous",s=t.url!==void 0?t.url:"https://tile.openstreetmap.org/{z}/{x}/{y}.png";super({attributions:e,attributionsCollapsible:!1,cacheSize:t.cacheSize,crossOrigin:i,interpolate:t.interpolate,maxZoom:t.maxZoom!==void 0?t.maxZoom:19,opaque:t.opaque!==void 0?t.opaque:!0,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileLoadFunction:t.tileLoadFunction,transition:t.transition,url:s,wrapX:t.wrapX,zDirection:t.zDirection})}}const Eh=yh,_t={ADD:"add",REMOVE:"remove"},xr={LENGTH:"length"};class $i extends Qt{constructor(t,e,i){super(t),this.element=e,this.index=i}}class xh extends Pt{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t||[],this.unique_)for(let i=0,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(xr.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 $i(_t.ADD,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){this.unique_&&this.assertUnique_(t);const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,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 $i(_t.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 $i(_t.REMOVE,s,t)),this.dispatchEvent(new $i(_t.ADD,e,t))}updateLength_(){this.set(xr.LENGTH,this.array_.length)}assertUnique_(t,e){for(let i=0,s=this.array_.length;i<s;++i)if(this.array_[i]===t&&i!==e)throw new Error("Duplicate item added to a unique collection")}}const Nt=xh;new Array(6);function Xt(){return[1,0,0,1,0,0]}function Ch(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 Rh(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 rt(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 Th(n,t,e){return Ch(n,t,0,0,e,0,0)}function _e(n,t,e,i,s,r,o,a){const l=Math.sin(r),h=Math.cos(r);return n[0]=i*h,n[1]=s*l,n[2]=-i*l,n[3]=s*h,n[4]=o*i*h-a*i*l+t,n[5]=o*s*l+a*s*h+e,n}function As(n,t){const e=wh(t);X(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 wh(n){return n[0]*n[3]-n[1]*n[2]}let Cr;function No(n){const t="matrix("+n.join(", ")+")";if(Es)return t;const e=Cr||(Cr=document.createElement("div"));return e.style.transform=t,e.style.transform}const Ih=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,vh=/^([a-z]*)$|^hsla?\(.*\)$/i;function Go(n){return typeof n=="string"?n:Xo(n)}function Sh(n){const t=document.createElement("div");if(t.style.color=n,t.style.color!==""){document.body.appendChild(t);const e=getComputedStyle(t).color;return document.body.removeChild(t),e}return""}const Lh=function(){const t={};let e=0;return function(i){let s;if(t.hasOwnProperty(i))s=t[i];else{if(e>=1024){let r=0;for(const o in t)r++&3||(delete t[o],--e)}s=Ah(i),t[i]=s,++e}return s}}();function un(n){return Array.isArray(n)?n:Lh(n)}function Ah(n){let t,e,i,s,r;if(vh.exec(n)&&(n=Sh(n)),Ih.exec(n)){const o=n.length-1;let a;o<=4?a=1:a=2;const l=o===4||o===8;t=parseInt(n.substr(1+0*a,a),16),e=parseInt(n.substr(1+1*a,a),16),i=parseInt(n.substr(1+2*a,a),16),l?s=parseInt(n.substr(1+3*a,a),16):s=255,a==1&&(t=(t<<4)+t,e=(e<<4)+e,i=(i<<4)+i,l&&(s=(s<<4)+s)),r=[t,e,i,s/255]}else if(n.startsWith("rgba("))r=n.slice(5,-1).split(",").map(Number),Rr(r);else if(n.startsWith("rgb("))r=n.slice(4,-1).split(",").map(Number),r.push(1),Rr(r);else throw new Error("Invalid color");return r}function Rr(n){return n[0]=et(n[0]+.5|0,0,255),n[1]=et(n[1]+.5|0,0,255),n[2]=et(n[2]+.5|0,0,255),n[3]=et(n[3],0,1),n}function Xo(n){let t=n[0];t!=(t|0)&&(t=t+.5|0);let e=n[1];
2e!=(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]*100)/100;return"rgba("+t+","+e+","+i+","+s+")"}class Mh{constructor(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}clear(){this.cache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];!(t++&3)&&!i.hasListener()&&(delete this.cache_[e],--this.cacheSize_)}}}get(t,e,i){const s=Tr(t,e,i);return s in this.cache_?this.cache_[s]:null}set(t,e,i,s){const r=Tr(t,e,i);this.cache_[r]=s,++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function Tr(n,t,e){const i=e?Go(e):"null";return t+":"+n+":"+i}const dn=new Mh,U={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 bh extends Pt{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[U.OPACITY]=t.opacity!==void 0?t.opacity:1,X(typeof e[U.OPACITY]=="number","Layer opacity must be a number"),e[U.VISIBLE]=t.visible!==void 0?t.visible:!0,e[U.Z_INDEX]=t.zIndex,e[U.MAX_RESOLUTION]=t.maxResolution!==void 0?t.maxResolution:1/0,e[U.MIN_RESOLUTION]=t.minResolution!==void 0?t.minResolution:0,e[U.MIN_ZOOM]=t.minZoom!==void 0?t.minZoom:-1/0,e[U.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=et(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 Y()}getLayerStatesArray(t){return Y()}getExtent(){return this.get(U.EXTENT)}getMaxResolution(){return this.get(U.MAX_RESOLUTION)}getMinResolution(){return this.get(U.MIN_RESOLUTION)}getMinZoom(){return this.get(U.MIN_ZOOM)}getMaxZoom(){return this.get(U.MAX_ZOOM)}getOpacity(){return this.get(U.OPACITY)}getSourceState(){return Y()}getVisible(){return this.get(U.VISIBLE)}getZIndex(){return this.get(U.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(U.EXTENT,t)}setMaxResolution(t){this.set(U.MAX_RESOLUTION,t)}setMinResolution(t){this.set(U.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(U.MAX_ZOOM,t)}setMinZoom(t){this.set(U.MIN_ZOOM,t)}setOpacity(t){X(typeof t=="number","Layer opacity must be a number"),this.set(U.OPACITY,t)}setVisible(t){this.set(U.VISIBLE,t)}setZIndex(t){this.set(U.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}const Wo=bh,Wt={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"}
2,ct={ANIMATING:0,INTERACTING:1},St={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function wr(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,h=t?0:r[1]*s,c=a?a[0]:0,u=a?a[1]:0;let d=n[0]+l/2+c,f=n[2]-l/2+c,g=n[1]+h/2+u,_=n[3]-h/2+u;d>f&&(d=(f+d)/2,f=d),g>_&&(g=(_+g)/2,_=g);let m=et(i[0],d,f),p=et(i[1],g,_);if(o&&e&&s){const y=30*s;m+=-y*Math.log(1+Math.max(0,d-i[0])/y)+y*Math.log(1+Math.max(0,i[0]-f)/y),p+=-y*Math.log(1+Math.max(0,g-i[1])/y)+y*Math.log(1+Math.max(0,i[1]-_)/y)}return[m,p]}}function Oh(n){return n}function Ms(n,t,e,i){const s=J(t)/e[0],r=zt(t)/e[1];return i?Math.min(n,Math.max(s,r)):Math.min(n,Math.min(s,r))}function bs(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),et(i,e/2,t*2)}function Ph(n,t,e,i){return t=t!==void 0?t:!0,function(s,r,o,a){if(s!==void 0){const l=n[0],h=n[n.length-1],c=e?Ms(l,e,o,i):l;if(a)return t?bs(s,c,h):et(s,h,c);const u=Math.min(c,s),d=Math.floor(ps(n,u,r));return n[d]>c&&d<n.length-1?n[d+1]:n[d]}}}function Dh(n,t,e,i,s,r){return i=i!==void 0?i:!0,e=e!==void 0?e:0,function(o,a,l,h){if(o!==void 0){const c=s?Ms(t,s,l,r):t;if(h)return i?bs(o,c,e):et(o,e,c);const u=1e-9,d=Math.ceil(Math.log(t/c)/Math.log(n)-u),f=-a*(.5-u)+.5,g=Math.min(c,o),_=Math.floor(Math.log(t/g)/Math.log(n)+f),m=Math.max(d,_),p=t/Math.pow(n,m);return et(p,e,c)}}}function Ir(n,t,e,i,s){return e=e!==void 0?e:!0,function(r,o,a,l){if(r!==void 0){const h=i?Ms(n,i,a,s):n;return!e||!l?et(r,t,h):bs(r,h,t)}}}function Os(n){if(n!==void 0)return 0}function vr(n){if(n!==void 0)return n}function Fh(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 kh(n){return n=n||rn(5),function(t,e){if(e)return t;if(t!==void 0)return Math.abs(t)<=n?0:t}}function Se(n,t,e,i,s,r){r=r||[];let o=0;for(let a=t;a<e;a+=i){const l=n[a],h=n[a+1];r[o++]=s[0]*l+s[2]*h+s[4],r[o++]=s[1]*l+s[3]*h+s[5]}return r&&r.length!=o&&(r.length=o),r}function zo(n,t,e,i,s,r,o){o=o||[];const a=Math.cos(s),l=Math.sin(s),h=r[0],c=r[1];let u=0;for(let d=t;d<e;d+=i){const f=n[d]-h,g=n[d+1]-c;o[u++]=h+f*a-g*l,o[u++]=c+f*l+g*a;for(let _=d+2;_<d+i;++_)o[u++]=n[_]}return o&&o.length!=u&&(o.length=u),o}function Nh(n,t,e,i,s,r,o,a){a=a||[];const l=o[0],h=o[1];let c=0;for(let u=t;u<e;u+=i){const d=n[u]-l,f=n[u+1]-h;a[c++]=l+s*d,a[c++]=h+r*f;for(let g=u+2;g<u+i;++g)a[c++]=n[g]}return a&&a.length!=c&&(a.length=c),a}function Gh(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 h=l+2;h<l+i;++h)o[a++]=n[h]}return o&&o.length!=a&&(o.length=a),o}const Sr=Xt();class Xh extends Pt{constructor(){super(),this.extent_=bt(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=Na(function(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 Y()}closestPointXY(t,e,i,s){return Y()}containsXY(t,e){const i=this.getClosestPoint([t,e]);return i[0]===t&&i[1]===e}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return Y()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&vn(e),this.extentRevision_=this.getRevision()}return cl(this.extent_,t)}rotate(t,e){Y()}scale(t,e,i){Y()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return Y()}getType(){return Y()}applyTransform(t){Y()}intersectsExtent(t){return Y()}translate(t,e){Y()}transform(t,e){const i=Ot(t),s=i.getUnits()=="tile-pixels"?function(r,o,a){const l=i.getExtent(),h=i.getWorldExtent(),c=zt(h)/zt(l);return _e(Sr,h[0],h[3],c,-c,0,0,0),Se(r,0,r.length,a,Sr,o),cn(i,e)(r,o,a)}:cn(i,e);return this.applyTransform(s),this}}const Wh=Xh;class zh extends Wh{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates=null}computeExtent(t){return ol(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return Y()}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=Lr(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){Y()}setLayout(t,e,i){let s;if(t)s=Lr(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=Yh(s)}this.layout=t,this.stride=s}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const s=this.getStride();zo(i,0,i.length,s,t,e,i),this.changed()}}scale(t,e,i){e===void 0&&(e=t),i||(i=ii(this.getExtent()));const s=this.getFlatCoordinates();if(s){const r=this.getStride();Nh(s,0,s.length,r,t,e,i,s),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const s=this.getStride();Gh(i,0,i.length,s,t,e,i),this.changed()}}}function Yh(n){let t;return n==2?t="XY":n==3?t="XYZ":n==4&&(t="XYZM"),t}function Lr(n){let t;return n=="XY"?t=2:n=="XYZ"||n=="XYM"?t=3:n=="XYZM"&&(t=4),t}function Bh(n,t,e){const i=n.getFlatCoordinates();if(!i)return null;const s=n.getStride();return Se(i,0,i.length,s,t,e)}const Ps=zh;function Ar(n,t,e,i,s,r,o){const a=n[t],l=n[t+1],h=n[e]-a,c=n[e+1]-l;let u;if(h===0&&c===0)u=t;else{const d=((s-a)*h+(r-l)*c)/(h*h+c*c);if(d>1)u=e;else if(d>0){for(let f=0;f<i;++f)o[f]=Mt(n[t+f],n[e+f],d);o.length=i;return}else u=t}for(let d=0;d<i;++d)o[d]=n[u+d];o.length=i}function Yo(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],h=qe(r,o,a,l);h>s&&(s=h),r=a,o=l}return s}function Kh(n,t,e,i,s){for(let r=0,o=e.length;r<o;++r){const a=e[r];s=Yo(n,t,a,i,s),t=a}return s}function Bo(n,t,e,i,s,r,o,a,l,h,c){if(t==e)return h;let u,d;if(s===0){if(d=qe(o,a,n[t],n[t+1]),d<h){for(u=0;
2u<i;++u)l[u]=n[t+u];return l.length=i,d}return h}c=c||[NaN,NaN];let f=t+i;for(;f<e;)if(Ar(n,f-i,f,i,o,a,c),d=qe(o,a,c[0],c[1]),d<h){for(h=d,u=0;u<i;++u)l[u]=c[u];l.length=i,f+=i}else f+=i*Math.max((Math.sqrt(d)-Math.sqrt(h))/s|0,1);if(r&&(Ar(n,e-i,t,i,o,a,c),d=qe(o,a,c[0],c[1]),d<h)){for(h=d,u=0;u<i;++u)l[u]=c[u];l.length=i}return h}function Zh(n,t,e,i,s,r,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=e.length;u<d;++u){const f=e[u];h=Bo(n,t,f,i,s,r,o,a,l,h,c),t=f}return h}function Vh(n,t,e,i){for(let s=0,r=e.length;s<r;++s)n[t++]=e[s];return t}function Ko(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 Uh(n,t,e,i,s){s=s||[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=Ko(n,t,e[o],i);s[r++]=l,t=l}return s.length=r,s}function jh(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 h=[t,e-i];let c=0;for(;h.length>0;){const u=h.pop(),d=h.pop();let f=0;const g=n[d],_=n[d+1],m=n[u],p=n[u+1];for(let y=d+i;y<u;y+=i){const x=n[y],E=n[y+1],C=Tl(x,E,g,_,m,p);C>f&&(c=y,f=C)}f>s&&(l[(c-t)/i]=1,d+i<c&&h.push(d,c),c+i<u&&h.push(c,u))}for(let u=0;u<a;++u)l[u]&&(r[o++]=n[t+u*i],r[o++]=n[t+u*i+1]);return o}function Ce(n,t){return t*Math.round(n/t)}function Hh(n,t,e,i,s,r,o){if(t==e)return o;let a=Ce(n[t],s),l=Ce(n[t+1],s);t+=i,r[o++]=a,r[o++]=l;let h,c;do if(h=Ce(n[t],s),c=Ce(n[t+1],s),t+=i,t==e)return r[o++]=h,r[o++]=c,o;while(h==a&&c==l);for(;t<e;){const u=Ce(n[t],s),d=Ce(n[t+1],s);if(t+=i,u==h&&d==c)continue;const f=h-a,g=c-l,_=u-a,m=d-l;if(f*m==g*_&&(f<0&&_<f||f==_||f>0&&_>f)&&(g<0&&m<g||g==m||g>0&&m>g)){h=u,c=d;continue}r[o++]=h,r[o++]=c,a=h,l=c,h=u,c=d}return r[o++]=h,r[o++]=c,o}function $h(n,t,e,i,s,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l];o=Hh(n,t,c,i,s,r,o),a.push(o),t=c}return o}function je(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 fn(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++]=je(n,t,l,i,s[r]),t=l}return s.length=r,s}function Mr(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?[]:fn(n,t,l,i,s[r]),t=l[l.length-1]}return s.length=r,s}function Zo(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+=o*a-r*l,r=a,o=l}return s/2}function qh(n,t,e,i){let s=0;for(let r=0,o=e.length;r<o;++r){const a=e[r];s+=Zo(n,t,a,i),t=a}return s}class gn extends Ps{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 gn(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,s){return s<fo(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Yo(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Bo(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,s))}getArea(){return Zo(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return je(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=jh(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new gn(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Ko(this.flatCoordinates,0,t,this.stride),this.changed()}}const br=gn;class Ds extends Ps{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new Ds(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,s){const r=this.flatCoordinates,o=qe(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?this.flatCoordinates.slice():[]}computeExtent(t){return rl(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return go(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Vh(this.flatCoordinates,0,t,this.stride),this.changed()}}const Vo=Ds;function Jh(n,t,e,i,s,r,o){let a,l,h,c,u,d,f;
2const g=s[r+1],_=[];for(let y=0,x=e.length;y<x;++y){const E=e[y];for(c=n[E-i],d=n[E-i+1],a=t;a<E;a+=i)u=n[a],f=n[a+1],(g<=d&&f<=g||d<=g&&g<=f)&&(h=(g-d)/(f-d)*(u-c)+c,_.push(h)),c=u,d=f}let m=NaN,p=-1/0;for(_.sort(Le),c=_[0],a=1,l=_.length;a<l;++a){u=_[a];const y=Math.abs(u-c);y>p&&(h=(c+u)/2,bo(n,t,e,i,h,g)&&(m=h,p=y)),c=u}return isNaN(m)&&(m=s[r]),o?(o.push(m,g,p),o):[m,g,p]}function Qh(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 Uo(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 tc(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=Uo(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 Or(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=Uo(n,t,a,i);(r===0?s&&l||!s&&!l:s&&!l||!s&&l)&&Qh(n,t,a,i),t=a}return t}class Ti extends Ps{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?eo(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Ti(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,s){return s<fo(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Kh(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Zh(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,s))}containsXY(t,e){return bo(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return qh(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),Or(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,fn(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=ii(this.getExtent());this.flatInteriorPoint_=Jh(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Vo(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new br(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],h=new br(e.slice(r,l),t);s.push(h),r=l}return s}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;tc(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Or(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=$h(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new Ti(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return ql(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=Uh(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}}function Pr(n){if(Mn(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 Ti(r,"XY",[r.length])}const Zn=0;class ec extends Pt{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=ws(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&&Ro(),t.center&&(t.center=jt(t.center,this.projection_)),t.extent&&(t.extent=Te(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const a in St)delete e[a];this.setProperties(e,!0);const i=nc(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=ic(t),r=i.constraint,o=sc(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=jt(s.center,this.getProjection())),s.anchor&&(s=Object.assign({},s),s.anchor=jt(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 c=arguments[s];c.center&&this.setCenterInternal(c.center),c.zoom!==void 0?this.setZoom(c.zoom):c.resolution&&this.setResolution(c.resolution),c.rotation!==void 0&&this.setRotation(c.rotation)}if(s===e){i&&qi(i,!0);return}let r=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_;const h=[];for(;s<e;++s){const c=arguments[s],u={start:r,complete:!1,anchor:c.anchor,duration:c.duration!==void 0?c.duration:1e3,easing:c.easing||Ka,callback:i};if(c.center&&(u.sourceCenter=o,u.targetCenter=c.center.slice(),o=u.targetCenter),c.zoom!==void 0?(u.sourceResolution=a,u.targetResolution=this.getResolutionForZoom(c.zoom),a=u.targetResolution):c.resolution&&(u.sourceResolution=a,u.targetResolution=c.resolution,a=u.targetResolution),c.rotation!==void 0){u.sourceRotation=l;const d=Je(c.rotation-l+Math.PI,2*Math.PI)-Math.PI;u.targetRotation=l+d,l=u.targetRotation}rc(u)?u.complete=!0:r+=u.duration,h.push(u)}this.animations_.push(h),this.setHint(ct.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[ct.ANIMATING]>0}getInteracting(){return this.hints_[ct.INTERACTING]>0}cancelAnimations(){this.setHint(ct.ANIMATING,-this.hints_[ct.ANIMATING]);let t;for(let e=0,i=this.animations_.length;e<i;++e){const s=this.animations_[e];
2if(s[0].callback&&qi(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 h=t-l.start;let c=l.duration>0?h/l.duration:1;c>=1?(l.complete=!0,c=1):r=!1;const u=l.easing(c);if(l.sourceCenter){const d=l.sourceCenter[0],f=l.sourceCenter[1],g=l.targetCenter[0],_=l.targetCenter[1];this.nextCenter_=l.targetCenter;const m=d+u*(g-d),p=f+u*(_-f);this.targetCenter_=[m,p]}if(l.sourceResolution&&l.targetResolution){const d=u===1?l.targetResolution:l.sourceResolution+u*(l.targetResolution-l.sourceResolution);if(l.anchor){const f=this.getViewportSize_(this.getRotation()),g=this.constraints_.resolution(d,0,f,!0);this.targetCenter_=this.calculateCenterZoom(g,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=d,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){const d=u===1?Je(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+u*(l.targetRotation-l.sourceRotation);if(l.anchor){const f=this.constraints_.rotation(d,!0);this.targetCenter_=this.calculateCenterRotate(f,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=d}if(this.applyTargetState_(!0),e=!0,!l.complete)break}if(r){this.animations_[i]=null,this.setHint(ct.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const o=s[0].callback;o&&qi(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]],Rs(i,t-this.getRotation()),Il(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&&ls(t,this.getProjection())}getCenterInternal(){return this.get(St.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 Io(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();X(e,"The view center is not defined");const i=this.getResolution();X(i!==void 0,"The view resolution is not defined");const s=this.getRotation();return X(s!==void 0,"The view rotation is not defined"),ss(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(St.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(Te(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=J(t)/e[0],s=zt(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(St.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=Vn(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=ps(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){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;const e=et(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,et(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}
2fit(t,e){let i;if(X(Array.isArray(t)||typeof t.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){X(!Mn(t),"Cannot fit empty extent provided as `geometry`");const s=Te(t,this.getProjection());i=Pr(s)}else if(t.getType()==="Circle"){const s=Te(t.getExtent(),this.getProjection());i=Pr(s),i.rotate(this.getRotation(),ii(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,h=-1/0,c=-1/0;for(let u=0,d=r.length;u<d;u+=o){const f=r[u]*i-r[u+1]*s,g=r[u]*s+r[u+1]*i;a=Math.min(a,f),l=Math.min(l,g),h=Math.max(h,f),c=Math.max(c,g)}return[a,l,h,c]}fitInternal(t,e){e=e||{};let i=e.size;i||(i=this.getViewportSizeMinusPadding_());const 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 h=this.getRotation(),c=Math.sin(h),u=Math.cos(h),d=ii(a);d[0]+=(s[1]-s[3])/2*l,d[1]+=(s[0]-s[2])/2*l;const f=d[0]*u-d[1]*c,g=d[1]*u+d[0]*c,_=this.getConstrainedCenter([f,g],l),m=e.callback?e.callback:ei;e.duration!==void 0?this.animateInternal({resolution:l,center:_,duration:e.duration,easing:e.easing},m):(this.targetResolution_=l,this.targetCenter_=_,this.applyTargetState_(!1,!0),qi(m,!0))}centerOn(t,e,i){this.centerOnInternal(jt(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(Vn(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=Vn(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=ls(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&&jt(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=jt(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&&jt(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(St.ROTATION)!==s&&this.set(St.ROTATION,s),this.get(St.RESOLUTION)!==o&&(this.set(St.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(St.CENTER)||!hn(this.get(St.CENTER),a))&&this.set(St.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()||!hn(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:r,center:l,resolution:a,duration:t,easing:oi,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(ct.INTERACTING,1)}
2endInteraction(t,e,i){i=i&&jt(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(ct.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 qi(n,t){setTimeout(function(){n(t)},0)}function ic(n){if(n.extent!==void 0){const e=n.smoothExtentConstraint!==void 0?n.smoothExtentConstraint:!0;return wr(n.extent,n.constrainOnlyCenter,e)}const t=ws(n.projection,"EPSG:3857");if(n.multiWorld!==!0&&t.isGlobal()){const e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,wr(e,!1,!1)}return Oh}function nc(n){let t,e,i,o=n.minZoom!==void 0?n.minZoom:Zn,a=n.maxZoom!==void 0?n.maxZoom:28;const l=n.zoomFactor!==void 0?n.zoomFactor:2,h=n.multiWorld!==void 0?n.multiWorld:!1,c=n.smoothResolutionConstraint!==void 0?n.smoothResolutionConstraint:!0,u=n.showFullExtent!==void 0?n.showFullExtent:!1,d=ws(n.projection,"EPSG:3857"),f=d.getExtent();let g=n.constrainOnlyCenter,_=n.extent;if(!h&&!_&&d.isGlobal()&&(g=!1,_=f),n.resolutions!==void 0){const m=n.resolutions;e=m[o],i=m[a]!==void 0?m[a]:m[m.length-1],n.constrainResolution?t=Ph(m,c,!g&&_,u):t=Ir(e,i,c,!g&&_,u)}else{const p=(f?Math.max(J(f),zt(f)):360*Ri.degrees/d.getMetersPerUnit())/vs/Math.pow(2,Zn),y=p/Math.pow(2,28-Zn);e=n.maxResolution,e!==void 0?o=0:e=p/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=p/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=Dh(l,e,i,c,!g&&_,u):t=Ir(e,i,c,!g&&_,u)}return{constraint:t,maxResolution:e,minResolution:i,minZoom:o,zoomFactor:l}}function sc(n){if(n.enableRotation!==void 0?n.enableRotation:!0){const e=n.constrainRotation;return e===void 0||e===!0?kh():e===!1?vr:typeof e=="number"?Fh(e):vr}return Os}function rc(n){return!(n.sourceCenter&&n.targetCenter&&!hn(n.sourceCenter,n.targetCenter)||n.sourceResolution!==n.targetResolution||n.sourceRotation!==n.targetRotation)}function Vn(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 h=a*r-l*o,c=l*r+a*o;return[h,c]}const Ft=ec;class oc extends Wo{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(U.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(U.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.get
2Source().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(Q(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=W(t,F.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 Ft?e={viewState:t.getState(),extent:t.calculateExtent()}:e=t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray());let s;e.layerStatesArray?s=e.layerStatesArray.find(o=>o.layer===this):s=this.getLayerState();const r=this.getExtent();return Fs(s,e.viewState)&&(!r||pt(r,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];let e;const i=this.getSource();if(i&&(e=i.getAttributions()),!e)return[];const s=t instanceof Ft?t.getViewStateAndExtent():t;let r=e(s);return Array.isArray(r)||(r=[r]),r}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}setMapInternal(t){t||this.unrender(),this.set(U.MAP,t)}getMapInternal(){return this.get(U.MAP)}setMap(t){this.mapPrecomposeKey_&&(Q(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(Q(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=W(t,Wt.PRECOMPOSE,function(e){const s=e.frameState.layerStatesArray,r=this.getLayerState(!1);X(!s.some(function(o){return o.layer===r.layer}),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),s.push(r)},this),this.mapRenderKey_=W(this,F.CHANGE,t.render,t),this.changed())}setSource(t){this.set(U.SOURCE,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}disposeInternal(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),super.disposeInternal()}}function Fs(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 On=oc;class ac extends ms{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){Y()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,s=t.pixelToCoordinateTransform;_e(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),As(s,i)}forEachFeatureAtCoordinate(t,e,i,s,r,o,a,l){let h;const c=e.viewState;function u(E,C,R,T){return r.call(o,C,E?R:null,T)}const d=c.projection,f=Eo(t.slice(),d),g=[[0,0]];if(d.canWrapX()&&s){const E=d.getExtent(),C=J(E);g.push([-C,0],[C,0])}const _=e.layerStatesArray,m=_.length,p=[],y=[];for(let E=0;E<g.length;E++)for(let C=m-1;C>=0;--C){const R=_[C],T=R.layer;if(T.hasRenderer()&&Fs(R,c)&&a.call(l,T)){const w=T.getRenderer(),A=T.getSource();if(w&&A){const P=A.getWrapX()?f:t,z=u.bind(null,R.managed);y[0]=P[0]+g[E][0],y[1]=P[1]+g[E][1],h=w.forEachFeatureAtCoordinate(y,e,i,z,p)}if(h)return h}}if(p.length===0)return;const x=1/p.length;return p.forEach((E,C)=>E.distanceSq+=C*x),p.sort((E,C)=>E.distanceSq-C.distanceSq),p.some(E=>h=E.callback(E.feature,E.layer,E.geometry)),h}hasFeatureAtCoordinate(t,e,i,s,r,o){return this.forEachFeatureAtCoordinate(t,e,i,s,Ei,this,r,o)!==void 0}getMap(){return this.map_}renderFrame(t){Y()}flushDeclutterItems(t){}scheduleExpireIconCache(t){dn.canExpireCache()&&t.postRenderFunctions.push(lc)}}function lc(n,t){dn.expire()}const hc=ac;class cc extends Qt{constructor(t,e,i,s){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=s}}const jo=cc,Ji="ol-hidden",uc="ol-selectable",Pn="ol-unselectable",ks="ol-control",Dr="ol-collapsed",dc=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}
2(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z]+?)\\s*$`].join(""),"i"),Fr=["style","variant","weight","size","lineHeight","family"],Ho=function(n){const t=n.match(dc);if(!t)return null;const e={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"};for(let i=0,s=Fr.length;i<s;++i){const r=t[i+1];r!==void 0&&(e[Fr[i]]=r)}return e.families=e.family.split(/,\s?/),e},$o="10px sans-serif",mt="#000",ni="round",qt=[],Jt=0,si="round",wi=10,Ii="#000",vi="center",_n="middle",Ie=[0,0,0,0],Si=1,Ht=new Pt;let Be=null,cs;const us={},fc=function(){const t="32px ",e=["monospace","serif"],i=e.length,s="wmytzilWMYTZIL@#/&?$%10";let r,o;function a(h,c,u){let d=!0;for(let f=0;f<i;++f){const g=e[f];if(o=mn(h+" "+c+" "+t+g,s),u!=g){const _=mn(h+" "+c+" "+t+u+","+g,s);d=d&&_!=o}}return!!d}function l(){let h=!0;const c=Ht.getKeys();for(let u=0,d=c.length;u<d;++u){const f=c[u];Ht.get(f)<100&&(a.apply(this,f.split(` 3`))?(bi(us),Be=null,cs=void 0,Ht.set(f,100)):(Ht.set(f,Ht.get(f)+1,!0),h=!1))}h&&(clearInterval(r),r=void 0)}return function(h){const c=Ho(h);if(!c)return;const u=c.families;for(let d=0,f=u.length;d<f;++d){const g=u[d],_=c.style+` 4`+c.weight+` 5`+g;Ht.get(_)===void 0&&(Ht.set(_,100,!0),a(c.style,c.weight,g)||(Ht.set(_,0,!0),r===void 0&&(r=setInterval(l,32))))}}}(),gc=function(){let n;return function(t){let e=us[t];if(e==null){if(Es){const i=Ho(t),s=qo(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);us[t]=e}return e}}();function qo(n,t){return Be||(Be=dt(1,1)),n!=cs&&(Be.font=n,cs=Be.font),Be.measureText(t)}function mn(n,t){return qo(n,t).width}function kr(n,t,e){if(t in e)return e[t];const i=t.split(` 6`).reduce((s,r)=>Math.max(s,mn(n,r)),0);return e[t]=i,i}function _c(n,t){const e=[],i=[],s=[];let r=0,o=0,a=0,l=0;for(let h=0,c=t.length;h<=c;h+=2){const u=t[h];if(u===` 7`||h===c){r=Math.max(r,o),s.push(o),o=0,a+=l;continue}const d=t[h+1]||n.font,f=mn(d,u);e.push(f),o+=f;const g=gc(d);i.push(g),l=Math.max(l,g)}return{width:r,height:a,widths:e,heights:i,lineWidths:s}}function mc(n,t,e,i,s,r,o,a,l,h,c){n.save(),e!==1&&(n.globalAlpha*=e),t&&n.transform.apply(n,t),i.contextInstructions?(n.translate(l,h),n.scale(c[0],c[1]),pc(i,n)):c[0]<0||c[1]<0?(n.translate(l,h),n.scale(c[0],c[1]),n.drawImage(i,s,r,o,a,0,0,o,a)):n.drawImage(i,s,r,o,a,l,h,o*c[0],a*c[1]),n.restore()}function pc(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 yc extends hc{constructor(t){super(t),this.fontChangeListenerKey_=W(Ht,ti.PROPERTYCHANGE,t.redrawText.bind(t)),this.element_=document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=Pn+" ol-layers";const i=t.getViewport();i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0,this.declutterLayers_=[]}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const s=new jo(t,void 0,e);i.dispatchEvent(s)}}disposeInternal(){Q(this.fontChangeListenerKey_),this.element_.parentNode.removeChild(this.element_),super.disposeInternal()}renderFrame(t){if(!t){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(t),this.dispatchRenderEvent(Wt.PRECOMPOSE,t);const e=t.layerStatesArray.sort(function(o,a){return o.zIndex-a.zIndex}),i=t.viewState;this.children_.length=0;const s=this.declutterLayers_;s.length=0;let r=null;for(let o=0,a=e.length;o<a;++o){const l=e[o];t.layerIndex=o;const h=l.layer,c=h.getSourceState();if(!Fs(l,i)||c!="ready"&&c!="undefined"){h.unrender();continue}const u=h.render(t,r);u&&(u!==r&&(this.children_.push(u),r=u),"getDeclutter"in h&&s.push(h))}this.flushDeclutterItems(t),Ja(this.element_,this.children_),this.dispatchRenderEvent(Wt.POSTCOMPOSE,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}flushDeclutterItems(t){const e=this.declutterLayers_;for(let i=e.length-1;i>=0;--i)e[i].renderDeclutter(t);e.length=0}}const Ec=yc;class he extends Qt{constructor(t,e){super(t),this.layer=e}}const Un={LAYERS:"layers"};class Ns extends Wo{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(Un.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new Nt(i.slice(),{unique:!0}):X(typeof i.getArray=="function","Expected `layers` to be an array or a `Collection`"):i=new Nt(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(Q),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(W(t,_t.ADD,this.handleLayersAdd_,this),W(t,_t.REMOVE,this.handleLayersRemove_,this));
7for(const i in this.listenerKeys_)this.listenerKeys_[i].forEach(Q);bi(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 he("addlayer",r))}this.changed()}registerLayerListeners_(t){const e=[W(t,ti.PROPERTYCHANGE,this.handleLayerChange_,this),W(t,F.CHANGE,this.handleLayerChange_,this)];t instanceof Ns&&e.push(W(t,"addlayer",this.handleLayerGroupAdd_,this),W(t,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[B(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new he("addlayer",t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new he("removelayer",t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new he("addlayer",e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=B(e);this.listenerKeys_[i].forEach(Q),delete this.listenerKeys_[i],this.dispatchEvent(new he("removelayer",e)),this.changed()}getLayers(){return this.get(Un.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 he("removelayer",i[s]))}this.set(Un.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=pi(l.extent,s.extent):l.extent=s.extent),l.zIndex===void 0&&(l.zIndex=r)}return e}getSourceState(){return"ready"}}const Dn=Ns;class xc extends Qt{constructor(t,e,i){super(t),this.map=e,this.frameState=i!==void 0?i:null}}const Ke=xc;class Cc extends Ke{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 le=Cc,tt={SINGLECLICK:"singleclick",CLICK:F.CLICK,DBLCLICK:F.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},ds={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};class Rc extends Rn{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=e===void 0?1:e,this.down_=null;const i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=W(i,ds.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=W(i,ds.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(F.TOUCHMOVE,this.boundHandleTouchMove_,lo?{passive:!1}:!1)}emulateClick_(t){let e=new le(tt.CLICK,this.map_,t);this.dispatchEvent(e),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new le(tt.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const i=new le(tt.SINGLECLICK,this.map_,t);this.dispatchEvent(i)},250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==tt.POINTERUP||e.type==tt.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==tt.POINTERDOWN||e.type==tt.POINTERMOVE)&&(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new le(tt.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(Q),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 le(tt.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);
7if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),this.dragListenerKeys_.length===0){const i=this.map_.getOwnerDocument();this.dragListenerKeys_.push(W(i,tt.POINTERMOVE,this.handlePointerMove_,this),W(i,tt.POINTERUP,this.handlePointerUp_,this),W(this.element_,tt.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==i&&this.dragListenerKeys_.push(W(this.element_.getRootNode(),tt.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new le(tt.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!!(this.down_&&this.isMoving_(t));this.dispatchEvent(new le(tt.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;(!e||e.defaultPrevented)&&(typeof t.cancelable!="boolean"||t.cancelable===!0)&&t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(Q(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(F.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(Q(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(Q),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const Tc=Rc,$t={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},lt={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},pn=1/0;class wc{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,bi(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){X(!(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!=pn?(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),h=this.getRightChildIndex_(t),c=h<s&&i[h]<i[l]?h:l;e[t]=e[c],i[t]=i[c],t=c}e[t]=r,i[t]=o,this.siftDown_(a,t)}siftDown_(t,e){const i=this.elements_,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==pn?delete this.queuedElements_[this.keyFunction_(o)]:(i[s]=l,e[s++]=o);e.length=s,i.length=s,this.heapify_()}}const Ic=wc;class vc extends Ic{constructor(t,e){super(function(i){return t.apply(null,i)},function(i){return 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(F.CHANGE,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===M.LOADED||i===M.ERROR||i===M.EMPTY){i!==M.ERROR&&e.removeEventListener(F.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,s,r,o;for(;this.tilesLoading_<t&&i<e&&this.getCount()>0;)r=this.dequeue()[0],o=r.getKey(),s=r.getState(),s===M.IDLE&&!(o in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[o]=!0,++this.tilesLoading_,++i,r.load())}}const Sc=vc;function Lc(n,t,e,i,s){if(!n||!(e in n.wantedTiles)||!n.wantedTiles[e][t.getKey()])return pn;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 Ac extends Pt{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(){an(this.element),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&an(this.element);for(let e=0,i=this.listenerKeys.length;e<i;++e)Q(this.listenerKeys[e]);this.listenerKeys.length=0,this.map_=t,t&&((this.target_?this.target_:t.getOverlayContainerStopEvent()).appendChild(this.element),this.render!==ei&&this.listenerKeys.push(W(t,$t.POSTRENDER,this.render,this)),t.render())}render(t){}setTarget(t){this.target_=typeof t=="string"?document.getElementById(t):t}}const Gs=Ac;class Mc extends Gs{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=t.collapsed!==void 0?t.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=t.collapsible!==void 0,this.collapsible_=t.collapsible!==void 0?t.collapsible:!0,this.collapsible_||(this.collapsed_=!1);const e=t.className!==void 0?t.className:"ol-attribution",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";
7typeof 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(F.CLICK,this.handleClick_.bind(this),!1);const h=e+" "+Pn+" "+ks+(this.collapsed_&&this.collapsible_?" "+Dr:"")+(this.collapsible_?"":" ol-uncollapsible"),c=this.element;c.className=h,c.appendChild(this.toggleButton_),c.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=Array.from(new Set(this.getMap().getAllLayers().flatMap(s=>s.getAttributions(t)))),i=!this.getMap().getAllLayers().some(s=>s.getSource()&&s.getSource().getAttributionsCollapsible()===!1);return this.overrideCollapsible_||this.setCollapsible(i),e}updateElement_(t){if(!t){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const e=this.collectSourceAttributions_(t),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!me(e,this.renderedAttributions_)){ho(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(Dr),this.collapsed_?rr(this.collapseLabel_,this.label_):rr(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(t){this.userCollapsed_=t,!(!this.collapsible_||this.collapsed_===t)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(t){this.updateElement_(t.frameState)}}const bc=Mc;class Oc extends Gs{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(F.CLICK,this.handleClick_.bind(this),!1);const a=e+" "+Pn+" "+ks,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(Ji)}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:oi}):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(Ji);!r&&i===0?this.element.classList.add(Ji):r&&i!==0&&this.element.classList.remove(Ji)}this.label_.style.transform=s}this.rotation_=i}}const Pc=Oc;class Dc extends Gs{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",h=t.zoomOutTipLabel!==void 0?t.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=s,c.setAttribute("type","button"),c.title=l,c.appendChild(typeof o=="str
7ing"?document.createTextNode(o):o),c.addEventListener(F.CLICK,this.handleClick_.bind(this,i),!1);const u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=h,u.appendChild(typeof a=="string"?document.createTextNode(a):a),u.addEventListener(F.CLICK,this.handleClick_.bind(this,-i),!1);const d=e+" "+Pn+" "+ks,f=this.element;f.className=d,f.appendChild(c),f.appendChild(u),this.duration_=t.duration!==void 0?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const i=this.getMap().getView();if(!i)return;const 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:oi})):i.setZoom(r)}}}const Fc=Dc;function kc(n){n=n||{};const t=new Nt;return(n.zoom!==void 0?n.zoom:!0)&&t.push(new Fc(n.zoomOptions)),(n.rotate!==void 0?n.rotate:!0)&&t.push(new Pc(n.rotateOptions)),(n.attribution!==void 0?n.attribution:!0)&&t.push(new bc(n.attributionOptions)),t}const Nr={ACTIVE:"active"};class Nc extends Pt{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(Nr.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(Nr.ACTIVE,t)}setMap(t){this.map_=t}}function Gc(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:Za,center:n.getConstrainedCenter(s)})}}function Xs(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:oi})}const Pi=Nc;class Xc extends Pi{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:250}handleEvent(t){let e=!1;if(t.type==tt.DBLCLICK){const i=t.originalEvent,s=t.map,r=t.coordinate,o=i.shiftKey?-this.delta_:this.delta_,a=s.getView();Xs(a,o,r,this.duration_),i.preventDefault(),e=!0}return!e}}const Wc=Xc;class zc extends Pi{constructor(t){t=t||{},super(t),t.handleDownEvent&&(this.handleDownEvent=t.handleDownEvent),t.handleDragEvent&&(this.handleDragEvent=t.handleDragEvent),t.handleMoveEvent&&(this.handleMoveEvent=t.handleMoveEvent),t.handleUpEvent&&(this.handleUpEvent=t.handleUpEvent),t.stopDown&&(this.stopDown=t.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(t){return!1}handleDragEvent(t){}handleEvent(t){if(!t.originalEvent)return!0;let e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==tt.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==tt.POINTERUP){const i=this.handleUpEvent(t);this.handlingDownUpSequence=i&&this.targetPointers.length>0}}else if(t.type==tt.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==tt.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}}function Ws(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}}const Di=zc;function fs(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 Yc=function(n){const t=n.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Bc=function(n){const t=n.map.getTargetElement(),e=n.map.getOwnerDocument().activeElement;return t.contains(e)},Jo=function(n){return n.map.getTargetElement().hasAttribute("tabindex")?Bc(n):!0},Kc=Ei,Qo=function(n){const t=n.originalEvent;return t.button==0&&!(Ha&&ro&&t.ctrlKey)},ta=function(n){const t=n.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},Zc=function(n){const t=n.originalEvent;return ro?t.metaKey:t.ctrlKey},Vc=function(n){const t=n.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},ea=function(n){const t=n.originalEvent,e=t.target.tagName;return e!=="INPUT"&&e!=="SELECT"&&e!=="TEXTAREA"&&!t.target.isContentEditable},jn=function(n){const t=n.originalEvent;return X(t!==void 0,"mapBrowserEvent must originate from a pointer event"),t.pointerType=="mouse"},Uc=function(n){const t=n.originalEvent;return X(t!==void 0,"mapBrowserEvent must originate from a pointer event"),t.isPrimary&&t.button===0};
7class jc extends Di{constructor(t){super({stopDown:Cn}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:fs(ta,Uc);this.condition_=t.onFocusOnly?fs(Jo,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(Ws(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();vl(r,a.getResolution()),Rs(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:oi})}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}}const Hc=jc;class $c extends Di{constructor(t){t=t||{},super({stopDown:Cn}),this.condition_=t.condition?t.condition:Yc,this.lastAngle_=void 0,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){if(!jn(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===Os)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 jn(t)?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){return jn(t)&&Qo(t)&&this.condition_(t)?(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}const qc=$c;class Jc extends ms{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(){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 Ti([s])}getGeometry(){return this.geometry_}}const Qc=Jc,Qi={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class Hn extends Qt{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}class tu extends Di{constructor(t){super(),this.on,this.once,this.un,t=t||{},this.box_=new Qc(t.className||"ol-dragbox"),this.minArea_=t.minArea!==void 0?t.minArea:64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition?t.condition:Qo,this.boxEndCondition_=t.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.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new Hn(Qi.BO
7XDRAG,t.coordinate,t))}handleUpEvent(t){this.box_.setMap(null);const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new Hn(e?Qi.BOXEND:Qi.BOXCANCEL,t.coordinate,t)),!1}handleDownEvent(t){return this.condition_(t)?(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new Hn(Qi.BOXSTART,t.coordinate,t)),!0):!1}onBoxEnd(t){}}const eu=tu;class iu extends eu{constructor(t){t=t||{};const e=t.condition?t.condition:Vc;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:oi})}}const nu=iu,xe={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};class su extends Pi{constructor(t){super(),t=t||{},this.defaultCondition_=function(e){return ta(e)&&ea(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==F.KEYDOWN){const i=t.originalEvent,s=i.key;if(this.condition_(t)&&(s==xe.DOWN||s==xe.LEFT||s==xe.RIGHT||s==xe.UP)){const o=t.map.getView(),a=o.getResolution()*this.pixelDelta_;let l=0,h=0;s==xe.DOWN?h=-a:s==xe.LEFT?l=-a:s==xe.RIGHT?l=a:h=a;const c=[l,h];Rs(c,o.getRotation()),Gc(o,c,this.duration_),i.preventDefault(),e=!0}}return!e}}const ru=su;class ou extends Pi{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(e){return!Zc(e)&&ea(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==F.KEYDOWN||t.type==F.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();Xs(a,o,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}}const au=ou;class lu{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_}}const hu=lu;class cu extends Pi{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:Kc;this.condition_=t.onFocusOnly?fs(Jo,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();if(!t)return;t.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_)}handleEvent(t){if(!this.condition_(t)||t.type!==F.WHEEL)return!0;const i=t.map,s=t.originalEvent;s.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.coordinate);let r;if(t.type==F.WHEEL&&(r=s.deltaY,Ua&&s.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(r/=oo),s.deltaMode===WheelEvent.DOM_DELTA_LINE&&(r*=40)),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_),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();
7let i=-et(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),Xs(e,i,this.lastAnchor_,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}}const uu=cu;class du extends Di{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=Cn),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!==Os&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(Ws(this.targetPointers))),this.rotating_&&(o.render(),a.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){return this.targetPointers.length<2?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}const fu=du;class gu extends Di{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=Cn),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,h=l.getView();e!=1&&(this.lastScaleDelta_=e),this.anchor_=l.getCoordinateFromPixelInternal(l.getEventPixel(Ws(this.targetPointers))),l.render(),h.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}}const _u=gu;function mu(n){n=n||{};const t=new Nt,e=new hu(-.005,.05,100);return(n.altShiftDragRotate!==void 0?n.altShiftDragRotate:!0)&&t.push(new qc),(n.doubleClickZoom!==void 0?n.doubleClickZoom:!0)&&t.push(new Wc({delta:n.zoomDelta,duration:n.zoomDuration})),(n.dragPan!==void 0?n.dragPan:!0)&&t.push(new Hc({onFocusOnly:n.onFocusOnly,kinetic:e})),(n.pinchRotate!==void 0?n.pinchRotate:!0)&&t.push(new fu),(n.pinchZoom!==void 0?n.pinchZoom:!0)&&t.push(new _u({duration:n.zoomDuration})),(n.keyboard!==void 0?n.keyboard:!0)&&(t.push(new ru),t.push(new au({delta:n.zoomDelta,duration:n.zoomDuration}))),(n.mouseWheelZoom!==void 0?n.mouseWheelZoom:!0)&&t.push(new uu({onFocusOnly:n.onFocusOnly,duration:n.zoomDuration})),(n.shiftDragZoom!==void 0?n.shiftDragZoom:!0)&&t.push(new nu({duration:n.zoomDuration})),t}function ia(n){if(n instanceof On){n.setMapInternal(null);return}n instanceof Dn&&n.getLayers().forEach(ia)}function na(n,t){if(n instanceof On){n.setMapInternal(t);return}if(n instanceof Dn){const e=n.getLayers().getArray();for(let i=0,s=e.length;i<s;++i)na(e[i],t)}}class pu extends Pt{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=yu(t);this.renderComplete_,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=t.maxTilesLoading!==void 0?t.maxTilesLoading:16,this.pixelRatio_=t.pixelRatio!==void 0?t.pixelRatio:oo,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Xt(),this.pixelToCoordinateTransform_=Xt(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_),this.mapBrowserEventHandler_=null,this.moveTolerance_=t.moveTolerance,this.keyboardEventTarget_=e.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,this.resizeObserver_=new ResizeObserver(()=>this.updateSize()),this.controls=e.controls||kc(),this.interactions=e.interactions||mu({onFocusOnly:!0}
7),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new Sc(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(lt.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(lt.VIEW,this.handleViewChanged_),this.addChangeListener(lt.SIZE,this.handleSizeChanged_),this.addChangeListener(lt.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const i=this;t.view&&!(t.view instanceof Ft)&&t.view.then(function(s){i.setView(new Ft(s))}),this.controls.addEventListener(_t.ADD,s=>{s.element.setMap(this)}),this.controls.addEventListener(_t.REMOVE,s=>{s.element.setMap(null)}),this.interactions.addEventListener(_t.ADD,s=>{s.element.setMap(this)}),this.interactions.addEventListener(_t.REMOVE,s=>{s.element.setMap(null)}),this.overlays_.addEventListener(_t.ADD,s=>{this.addOverlayInternal_(s.element)}),this.overlays_.addEventListener(_t.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){na(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();e!==void 0&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const 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:Ei,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 Dn?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:Ei,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(lt.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return ls(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?rt(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(lt.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof Nt){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=jt(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}
7getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?rt(e.coordinateToPixelTransform,t.slice(0,2)):null}getRenderer(){return this.renderer_}getSize(){return this.get(lt.SIZE)}getView(){return this.get(lt.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 Lc(this.frameState_,t,e,i,s)}handleBrowserEvent(t,e){e=e||t.type;const i=new le(e,this,t);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,i=e.type;if(i===ds.POINTERDOWN||i===F.WHEEL||i===F.KEYDOWN){const s=this.getOwnerDocument(),r=this.viewport_.getRootNode?this.viewport_.getRootNode():s,o=e.target;if(this.overlayContainerStopEvent_.contains(o)||!(r===s?s.documentElement:r).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[ct.ANIMATING]||o[ct.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_===!0?(this.hasListener(Wt.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Wt.RENDERCOMPLETE,t),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Ke($t.LOADEND,this,t)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Ke($t.LOADSTART,this,t))));const i=this.postRenderFunctions_;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_(){if(this.mapBrowserEventHandler_){for(let i=0,s=this.targetChangeHandlerKeys_.length;i<s;++i)Q(this.targetChangeHandlerKeys_[i]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(F.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(F.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,an(this.viewport_)}if(this.targetElement_){this.resizeObserver_.unobserve(this.targetElement_);const i=this.targetElement_.getRootNode();i instanceof ShadowRoot&&this.resizeObserver_.unobserve(i.host),this.setSize(void 0)}const t=this.getTarget(),e=typeof t=="string"?document.getElementById(t):t;if(this.targetElement_=e,!e)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new Ec(this)),this.mapBrowserEventHandler_=new Tc(this,this.moveTolerance_);for(const r in tt)this.mapBrowserEventHandler_.addEventListener(tt[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(F.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(F.WHEEL,this.boundHandleBrowserEvent_,lo?{passive:!1}:!1);const i=this.keyboardEventTarget_?this.keyboardEventTarget_:e;this.targetChangeHandlerKeys_=[W(i,F.KEYDOWN,this.handleBrowserEvent,this),W(i,F.KEYPRESS,this.handleBrowserEvent,this)];const s=e.getRootNode();s instanceof ShadowRoot&&this.resizeObserver_.observe(s.host),this.resizeObserver_.observe(e)}this.updateSize()}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(Q(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(Q(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(),this.viewPropertyListenerKey_=W(t,ti.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=W(t,F.CHANGE,this.handleViewPropertyChanged_,this),t.resolve
7Constraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(Q),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new he("addlayer",t)),this.layerGroupPropertyListenerKeys_=[W(t,ti.PROPERTYCHANGE,this.render,this),W(t,F.CHANGE,this.render,this),W(t,"addlayer",this.handleLayerAdd_,this),W(t,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){const t=this.getLayerGroup().getLayerStatesArray();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_))}flushDeclutterItems(){const t=this.frameState_;t&&this.renderer_.flushDeclutterItems(t)}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){return this.getLayerGroup().getLayers().remove(t)}handleLayerRemove_(t){ia(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&&Er(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_,declutterTree:null,extent:ss(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:B(this),renderTargets:{}},a.nextCenter&&a.nextResolution){const l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;r.nextExtent=ss(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_||!Mn(this.previousExtent_)&&!Ci(r.extent,this.previousExtent_))&&(this.dispatchEvent(new Ke($t.MOVESTART,this,s)),this.previousExtent_=vn(this.previousExtent_)),this.previousExtent_&&!r.viewHints[ct.ANIMATING]&&!r.viewHints[ct.INTERACTING]&&!Ci(r.extent,this.previousExtent_)&&(this.dispatchEvent(new Ke($t.MOVEEND,this,r)),uo(r.extent,this.previousExtent_))),this.dispatchEvent(new Ke($t.POSTRENDER,this,r)),this.renderComplete_=this.hasListener($t.LOADSTART)||this.hasListener($t.LOADEND)||this.hasListener(Wt.RENDERCOMPLETE)?!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady():void 0,this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new he("removelayer",e)),this.set(lt.LAYERGROUP,t)}setSize(t){this.set(lt.SIZE,t)}setTarget(t){this.set(lt.TARGET,t)}setView(t){if(!t||t instanceof Ft){this.set(lt.VIEW,t);return}this.set(lt.VIEW,new Ft);const e=this;t.then(function(i){e.setView(new Ft(i))})}updateSize(){const t=this.getTargetElement();let e;if(t){const s=getComputedStyle(t),r=t.offsetWidth-parseFloat(s.borderLeftWidth)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)-parseFloat(s.borderRightWidth),o=t.offsetHeight-parseFloat(s.borderTopWidth)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)-parseFloat(s.borderBottomWidth);!isNaN(r)&&!isNaN(o)&&(e=[r,o],!Er(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&Co("No map visible because the map container's width or height are 0."))}const i=this.getSize();e&&(!i||!me(e,i))&&(this.setSize(e),this.updateViewportSize_())}updateViewportSize_(){const t=this.getView();if(t){let e;const i=getComputedStyle(this.viewport_);i.width&&i.height&&(e=[parseInt(i.width,10),parseInt(i.height,10)]),t.setViewportSize(e)}}}function yu(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 Dn({layers:n.layers});e[lt.LAYERGROUP]=i,e[lt.TARGET]=n.target,e[lt.VIEW]=n.view instanceof Ft?n.view:new Ft;let s;n.controls!==void 0&&(Array.isArray(n.controls)?s=new Nt(n.controls.slice()):(X(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 Nt(n.interactions.slice()):(X(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 Nt(n.overlays.slice()):(X(typeof n.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=n.overlays):o=new Nt,{controls:s,interactions:r,keyboardEventTarget:t,overlays:o,values:e}}
7const Eu=pu,at={ELEMENT:"element",MAP:"map",OFFSET:"offset",POSITION:"position",POSITIONING:"positioning"};class xu extends Pt{constructor(t){super(),this.on,this.once,this.un,this.options=t,this.id=t.id,this.insertFirst=t.insertFirst!==void 0?t.insertFirst:!0,this.stopEvent=t.stopEvent!==void 0?t.stopEvent:!0,this.element=document.createElement("div"),this.element.className=t.className!==void 0?t.className:"ol-overlay-container "+uc,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=t.autoPan===!0?{}:t.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(at.ELEMENT,this.handleElementChanged),this.addChangeListener(at.MAP,this.handleMapChanged),this.addChangeListener(at.OFFSET,this.handleOffsetChanged),this.addChangeListener(at.POSITION,this.handlePositionChanged),this.addChangeListener(at.POSITIONING,this.handlePositioningChanged),t.element!==void 0&&this.setElement(t.element),this.setOffset(t.offset!==void 0?t.offset:[0,0]),this.setPositioning(t.positioning||"top-left"),t.position!==void 0&&this.setPosition(t.position)}getElement(){return this.get(at.ELEMENT)}getId(){return this.id}getMap(){return this.get(at.MAP)||null}getOffset(){return this.get(at.OFFSET)}getPosition(){return this.get(at.POSITION)}getPositioning(){return this.get(at.POSITIONING)}handleElementChanged(){ho(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){this.mapPostrenderListenerKey&&(an(this.element),Q(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=W(t,$t.POSTRENDER,this.render,this),this.updatePixelPosition();const e=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?e.insertBefore(this.element,e.childNodes[0]||null):e.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(t){this.set(at.ELEMENT,t)}setMap(t){this.set(at.MAP,t)}setOffset(t){this.set(at.OFFSET,t)}setPosition(t){this.set(at.POSITION,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get(at.POSITION))return;const i=this.getRect(e.getTargetElement(),e.getSize()),s=this.getElement(),r=this.getRect(s,[$a(s),qa(s)]);t=t||{};const o=t.margin===void 0?20:t.margin;if(!Re(i,r)){const a=r[0]-i[0],l=i[2]-r[2],h=r[1]-i[1],c=i[3]-r[3],u=[0,0];if(a<0?u[0]=a-o:l<0&&(u[0]=Math.abs(l)+o),h<0?u[1]=h-o:c<0&&(u[1]=Math.abs(c)+o),u[0]!==0||u[1]!==0){const d=e.getView().getCenterInternal(),f=e.getPixelFromCoordinateInternal(d);if(!f)return;const g=[f[0]+u[0],f[1]+u[1]],_=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(g),duration:_.duration,easing:_.easing})}}}getRect(t,e){const i=t.getBoundingClientRect(),s=i.left+window.pageXOffset,r=i.top+window.pageYOffset;return[s,r,s+e[0],r+e[1]]}setPositioning(t){this.set(at.POSITIONING,t)}setVisible(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)}updatePixelPosition(){const t=this.getMap(),e=this.getPosition();if(!t||!t.isRendered()||!e){this.setVisible(!1);return}const i=t.getPixelFromCoordinate(e),s=t.getSize();this.updateRenderedPosition(i,s)}updateRenderedPosition(t,e){const i=this.element.style,s=this.getOffset(),r=this.getPositioning();this.setVisible(!0);const o=Math.round(t[0]+s[0])+"px",a=Math.round(t[1]+s[1])+"px";let l="0%",h="0%";r=="bottom-right"||r=="center-right"||r=="top-right"?l="-100%":(r=="bottom-center"||r=="center-center"||r=="top-center")&&(l="-50%"),r=="bottom-left"||r=="bottom-center"||r=="bottom-right"?h="-100%":(r=="center-left"||r=="center-center"||r=="center-right")&&(h="-50%");const c=`translate(${l}, ${h}) translate(${o}, ${a})`;this.rendered.transform_!=c&&(this.rendered.transform_=c,i.transform=c)}getOptions(){return this.options}}const Cu=xu;function Ru(n,t,e,i,s){sa(n,t,e||0,i||n.length-1,s||Tu)}function sa(n,t,e,i,s){for(;i>e;){if(i-e>600){var r=i-e+1,o=t-e+1,a=Math.log(r),l=.5*Math.exp(2*a/3),h=.5*Math.sqrt(a*l*(r-l)/r)*(o-r/2<0?-1:1),c=Math.max(e,Math.floor(t-o*l/r+h)),u=Math.min(i,Math.floor(t+(r-o)*l/r+h));sa(n,t,c,u,s)}var d=n[t],f=e,g=i;for(di(n,e,t),s(n[i],d)>0&&di(n,e,i);f<g;){for(di(n,f,g),f++,g--;s(n[f],d)<0;)f++;for(;s(n[g],d)>0;)g--}s(n[e],d)===0?di(n,e,g):(g++,di(n,g,i)),g<=t&&(e=g+1),t<=g&&(i=g-1)}}function di(n,t,e){var i=n[t];n[t]=n[e],n[e]=i}function Tu(n,t){return n<t?-1:n>t?1:0}let ra=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(!en(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;en(t,l)&&(e.leaf?i.push(a):qn(t,l)?this._all(a,i):r.push(a))}e=r.pop()}return i}collides(t){let e=this.data;if(!en(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(en(t,o)){if(e.leaf||qn(t,o))return!0;
7i.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=Ze([]),this}remove(t,e){if(!t)return this;let i=this.data;const s=this.toBBox(t),r=[],o=[];let a,l,h;for(;i||r.length;){if(i||(i=r.pop(),l=r[r.length-1],a=o.pop(),h=!0),i.leaf){const c=wu(t,i.children,e);if(c!==-1)return i.children.splice(c,1),r.push(i),this._condense(r),this}!h&&!i.leaf&&qn(i,s)?(r.push(i),o.push(a),a=0,l=i,i=i.children[0]):l?(a++,i=l.children[a],h=!1):i=null}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const i=[];for(;t;)t.leaf?e.push(...t.children):i.push(...t.children),t=i.pop();return e}_build(t,e,i,s){const r=i-e+1;let o=this._maxEntries,a;if(r<=o)return a=Ze(t.slice(e,i+1)),We(a,this.toBBox),a;s||(s=Math.ceil(Math.log(r)/Math.log(o)),o=Math.ceil(r/Math.pow(o,s-1))),a=Ze([]),a.leaf=!1,a.height=s;const l=Math.ceil(r/o),h=l*Math.ceil(Math.sqrt(o));Gr(t,e,i,h,this.compareMinX);for(let c=e;c<=i;c+=h){const u=Math.min(c+h-1,i);Gr(t,c,u,l,this.compareMinY);for(let d=c;d<=u;d+=l){const f=Math.min(d+l-1,u);a.children.push(this._build(t,d,f,s-1))}}return We(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 h=e.children[l],c=$n(h),u=Su(t,h)-c;u<o?(o=u,r=c<r?c:r,a=h):u===o&&c<r&&(r=c,a=h)}e=a||e.children[0]}return e}_insert(t,e,i){const s=i?t:this.toBBox(t),r=[],o=this._chooseSubtree(s,this.data,e,r);for(o.children.push(t),_i(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=Ze(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,We(i,this.toBBox),We(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)}_splitRoot(t,e){this.data=Ze([t,e]),this.data.height=t.height+1,this.data.leaf=!1,We(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=gi(t,0,a,this.toBBox),h=gi(t,a,i,this.toBBox),c=Lu(l,h),u=$n(l)+$n(h);c<r?(r=c,s=a,o=u<o?u:o):c===r&&u<o&&(o=u,s=a)}return s||i-e}_chooseSplitAxis(t,e,i){const s=t.leaf?this.compareMinX:Iu,r=t.leaf?this.compareMinY:vu,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=gi(t,0,e,r),a=gi(t,i-e,i,r);let l=tn(o)+tn(a);for(let h=e;h<i-e;h++){const c=t.children[h];_i(o,t.leaf?r(c):c),l+=tn(o)}for(let h=i-e-1;h>=e;h--){const c=t.children[h];_i(a,t.leaf?r(c):c),l+=tn(a)}return l}_adjustParentBBoxes(t,e,i){for(let s=i;s>=0;s--)_i(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():We(t[e],this.toBBox)}};function wu(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 We(n,t){gi(n,0,n.children.length,t,n)}function gi(n,t,e,i,s){s||(s=Ze(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];_i(s,n.leaf?i(o):o)}return s}function _i(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 Iu(n,t){return n.minX-t.minX}function vu(n,t){return n.minY-t.minY}function $n(n){return(n.maxX-n.minX)*(n.maxY-n.minY)}function tn(n){return n.maxX-n.minX+(n.maxY-n.minY)}function Su(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 Lu(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 qn(n,t){return n.minX<=t.minX&&n.minY<=t.minY&&t.maxX<=n.maxX&&t.maxY<=n.maxY}function en(n,t){return t.minX<=n.maxX&&t.minY<=n.maxY&&t.maxX>=n.minX&&t.maxY>=n.minY}function Ze(n){return{children:n,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Gr(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;Ru(n,o,t,e,s),r.push(t,o,o,e)}}class Au{constructor(t){this.rbush_=new ra(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_[B(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_[B(a)]=l}this.rbush_.load(i)}remove(t){const e=B(t),i=this.items_[e];return delete this.items_[e],this.rbush_.remove(i)!==null}update(t,e){const i=this.items_[B(e)],s=[i.minX,i.minY,i.maxX,i.maxY];Ci(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 xi(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return ge(e.minX,e.minY,e.maxX,e.maxY,t)}concat(t){this.rbush_.load(t.rbush_.all());for(const e in t.items_)this.items_[e]=t.items_[e]}}const Xr=Au,Lt={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVE
7FEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function Mu(n,t){return[[-1/0,-1/0,1/0,1/0]]}let bu=!1;function Ou(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=bu,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){const h=t.getType();let c;h=="json"||h=="text"?c=a.responseText:h=="xml"?(c=a.responseXML,c||(c=new DOMParser().parseFromString(a.responseText,"application/xml"))):h=="arraybuffer"&&(c=a.response),c?r(t.readFeatures(c,{extent:e,featureProjection:s}),t.readProjection(c)):o()}else o()},a.onerror=o,a.send()}function Wr(n,t){return function(e,i,s,r,o){const a=this;Ou(n,t,e,i,s,function(l,h){a.addFeatures(l),r!==void 0&&r(l)},o||ei)}}class re extends Qt{constructor(t,e,i){super(t),this.feature=e,this.features=i}}class Pu extends Lo{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_=ei,this.format_=t.format,this.overlaps_=t.overlaps===void 0?!0:t.overlaps,this.url_=t.url,t.loader!==void 0?this.loader_=t.loader:this.url_!==void 0&&(X(this.format_,"`format` must be set when `url` is set"),this.loader_=Wr(this.url_,this.format_)),this.strategy_=t.strategy!==void 0?t.strategy:Mu;const e=t.useSpatialIndex!==void 0?t.useSpatialIndex:!0;this.featuresRtree_=e?new Xr:null,this.loadedExtentsRtree_=new Xr,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 Nt(s)),s!==void 0&&this.addFeaturesInternal(s),i!==void 0&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=B(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 re(Lt.ADDFEATURE,t))}setupChangeEvents_(t,e){this.featureChangeKeys_[t]=[W(e,F.CHANGE,this.handleFeatureChange_,this),W(e,ti.PROPERTYCHANGE,this.handleFeatureChange_,this)]}addToIndex_(t,e){let i=!0;const s=e.getId();return s!==void 0&&(s.toString()in this.idIndex_?i=!1:this.idIndex_[s.toString()]=e),i&&(X(!(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=B(a);this.addToIndex_(l,a)&&i.push(a)}for(let r=0,o=i.length;r<o;r++){const a=i[r],l=B(a);this.setupChangeEvents_(l,a);const h=a.getGeometry();if(h){const c=h.getExtent();e.push(c),s.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(e,s),this.hasListener(Lt.ADDFEATURE))for(let r=0,o=i.length;r<o;r++)this.dispatchEvent(new re(Lt.ADDFEATURE,i[r]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(Lt.ADDFEATURE,function(i){e||(e=!0,t.push(i.feature),e=!1)}),this.addEventListener(Lt.REMOVEFEATURE,function(i){e||(e=!0,t.remove(i.feature),e=!1)}),t.addEventListener(_t.ADD,i=>{e||(e=!0,this.addFeature(i.element),e=!1)}),t.addEventListener(_t.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(Q);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){const i=s=>{this.removeFeatureInternal(s)};this.featuresRtree_.forEach(i);for(const s in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[s])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new re(Lt.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){if(s.getGeometry().intersectsCoordinate(t))return e(s)})}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,function(i){if(i.getGeometry().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(),xi(this.nullGeometryFeatures_)||eo(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=dl(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||Ei,this.featuresRtree_.forEachInExtent(l,function(h){if(e(h)){const c=h.getGeometry(),u=a;if(a=c.closestPointXY(i,s,o,a),a<u){r=h;const d=Math.sqrt(a);l[0]=i-d,l[1]=s-d,l[2]=i+d,l[3]=s+d}}}),r}getExtent(t){return this.featuresRtree_.getExtent(t)}getFeatureById(t){const e=this.idIndex_[t.toString()];return e!==void 0?e:null}getFeatureByUid(t){const e=this.uidIndex_[t];return e!==void 0?e:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){const e=t.target,i=B(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)}
7else this.removeFromIdIndex_(e),this.uidIndex_[i]=e;this.changed(),this.dispatchEvent(new re(Lt.CHANGEFEATURE,e))}hasFeature(t){const e=t.getId();return e!==void 0?e in this.idIndex_:B(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&xi(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(c){return Re(c.extent,l)})||(++this.loadingExtentsCount_,this.dispatchEvent(new re(Lt.FEATURESLOADSTART)),this.loader_.call(this,l,e,i,c=>{--this.loadingExtentsCount_,this.dispatchEvent(new re(Lt.FEATURESLOADEND,void 0,c))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new re(Lt.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_;let i;e.forEachInExtent(t,function(s){if(Ci(s.extent,t))return i=s,!0}),i&&e.remove(i)}removeFeature(t){if(!t)return;const e=B(t);e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t),this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=B(t),i=this.featureChangeKeys_[e];if(!i)return;i.forEach(Q),delete this.featureChangeKeys_[e];const s=t.getId();return s!==void 0&&delete this.idIndex_[s.toString()],delete this.uidIndex_[e],this.dispatchEvent(new re(Lt.REMOVEFEATURE,t)),t}removeFromIdIndex_(t){let e=!1;for(const i in this.idIndex_)if(this.idIndex_[i]===t){delete this.idIndex_[i],e=!0;break}return e}setLoader(t){this.loader_=t}setUrl(t){X(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(Wr(t,this.format_))}}const Du=Pu;class zs{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=Rt(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new zs({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 Y()}getImage(t){return Y()}getHitDetectionImage(){return Y()}getPixelRatio(t){return 1}getImageState(){return Y()}getImageSize(){return Y()}getOrigin(){return Y()}getSize(){return Y()}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_=Rt(t)}listenImageChange(t){Y()}load(){Y()}unlistenImageChange(t){Y()}}const oa=zs;function Gt(n){return Array.isArray(n)?Xo(n):n}class Ys extends oa{constructor(t){const e=t.rotateWithView!==void 0?t.rotateWithView:!1;super({opacity:1,rotateWithView:e,rotation:t.rotation!==void 0?t.rotation:0,scale:t.scale!==void 0?t.scale:1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode}),this.canvas_=void 0,this.hitDetectionCanvas_=null,this.fill_=t.fill!==void 0?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius_=t.radius!==void 0?t.radius:t.radius1,this.radius2_=t.radius2,this.angle_=t.angle!==void 0?t.angle:0,this.stroke_=t.stroke!==void 0?t.stroke:null,this.size_=null,this.renderOptions_=null,this.render()}clone(){const t=this.getScale(),e=new Ys({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_;if(!t)return null;const e=this.getDisplacement(),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.createHitDetectionCanvas_(this.renderOptions_),this.hitDetectionCanvas_}getImage(t){let e=this.canvas_[t];if(!e){const i=this.renderOptions_,s=dt(i.size*t,i.size*t);this.draw_(i,s,t),e=s.canvas,this.canvas_[t]=e}return e}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return q.LOADED}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius_}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,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 R=s;
7s=r,r=R}const o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=r*Math.sin(a),h=Math.sqrt(r*r-l*l),c=s-h,u=Math.sqrt(l*l+c*c),d=u/l;if(t==="miter"&&d<=i)return d*e;const f=e/2/d,g=e/2*(c/u),m=Math.sqrt((s+f)*(s+f)+g*g)-s;if(this.radius2_===void 0||t==="bevel")return m*2;const p=s*Math.sin(a),y=Math.sqrt(s*s-p*p),x=r-y,C=Math.sqrt(p*p+x*x)/p;if(C<=i){const R=C*e/2-r-s;return 2*Math.max(m,R)}return m*2}createRenderOptions(){let t=ni,e=si,i=0,s=null,r=0,o,a=0;this.stroke_&&(o=this.stroke_.getColor(),o===null&&(o=Ii),o=Gt(o),a=this.stroke_.getWidth(),a===void 0&&(a=Si),s=this.stroke_.getLineDash(),r=this.stroke_.getLineDashOffset(),e=this.stroke_.getLineJoin(),e===void 0&&(e=si),t=this.stroke_.getLineCap(),t===void 0&&(t=ni),i=this.stroke_.getMiterLimit(),i===void 0&&(i=wi));const l=this.calculateLineJoinSize_(e,a,i),h=Math.max(this.radius_,this.radius2_||0),c=Math.ceil(2*h+l);return{strokeStyle:o,strokeWidth:a,size:c,lineCap:t,lineDash:s,lineDashOffset:r,lineJoin:e,miterLimit:i}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.canvas_={},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=mt),e.fillStyle=Gt(s),e.fill()}this.stroke_&&(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){if(this.fill_){let e=this.fill_.getColor(),i=0;if(typeof e=="string"&&(e=un(e)),e===null?i=1:Array.isArray(e)&&(i=e.length===4?e[3]:1),i===0){const s=dt(t.size,t.size);this.hitDetectionCanvas_=s.canvas,this.drawHitDetectionCanvas_(t,s)}}this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.getImage(1))}createPath_(t){let e=this.points_;const 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,h=a%2===0?i:s;t.lineTo(h*Math.cos(l),h*Math.sin(l))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=mt,e.fill(),this.stroke_&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}}const aa=Ys;class Bs extends aa{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 Bs({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}setRadius(t){this.radius_=t,this.render()}}const la=Bs;class Ks{constructor(t){t=t||{},this.color_=t.color!==void 0?t.color:null}clone(){const t=this.getColor();return new Ks({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){this.color_=t}}const Zs=Ks;let fi=null;class Fu extends Rn{constructor(t,e,i,s,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i,this.canvas_={},this.color_=r,this.imageState_=s===void 0?q.IDLE:s,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===q.LOADED){fi||(fi=dt(1,1,void 0,{willReadFrequently:!0})),fi.drawImage(this.image_,0,0);try{fi.getImageData(0,0,1,1),this.tainted_=!1}catch{fi=null,this.tainted_=!0}}return this.tainted_===!0}
7dispatchChangeEvent_(){this.dispatchEvent(F.CHANGE)}handleImageError_(){this.imageState_=q.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=q.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=dt(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_===q.IDLE){this.image_||this.initializeImage_(),this.imageState_=q.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&el(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_!==q.LOADED)return;const e=this.image_,i=document.createElement("canvas");i.width=Math.ceil(e.width*t),i.height=Math.ceil(e.height*t);const s=i.getContext("2d");s.scale(t,t),s.drawImage(e,0,0),s.globalCompositeOperation="multiply",s.fillStyle=Go(this.color_),s.fillRect(0,0,i.width/t,i.height/t),s.globalCompositeOperation="destination-in",s.drawImage(e,0,0),this.canvas_[t]=i}}function ku(n,t,e,i,s){let r=t===void 0?void 0:dn.get(t,e,s);return r||(r=new Fu(n,n instanceof HTMLImageElement?n.src||void 0:t,e,i,s),dn.set(t,e,s,r)),r}function zr(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 Vs extends oa{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;const o=t.img!==void 0?t.img:null;let a=t.src;X(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||B(o)),X(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),X(!((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=q.IDLE:o!==void 0&&(o instanceof HTMLImageElement?o.complete?l=o.src?q.LOADED:q.IDLE:l=q.LOADING:l=q.LOADED),this.color_=t.color!==void 0?un(t.color):null,this.iconImage_=ku(o,a,this.crossOrigin_,l,this.color_),this.offset_=t.offset!==void 0?t.offset:[0,0],this.offsetOrigin_=t.offsetOrigin!==void 0?t.offsetOrigin:"top-left",this.origin_=null,this.size_=t.size!==void 0?t.size:null,t.width!==void 0||t.height!==void 0){let h,c;if(t.size)[h,c]=t.size;else{const u=this.getImage(1);if(u.width&&u.height)h=u.width,c=u.height;else if(u instanceof HTMLImageElement){this.initialOptions_=t;const d=()=>{if(this.unlistenImageChange(d),!this.initialOptions_)return;const f=this.iconImage_.getSize();this.setScale(zr(f[0],f[1],t.width,t.height))};this.listenImageChange(d);return}}h!==void 0&&this.setScale(zr(h,c,t.width,t.height))}}clone(){let t,e,i;return this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new Vs({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,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_}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if(this.offsetOrigin_!="top-left"){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(t[0]=i[0]-e[0]-t[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();if(this.size_)return this.size_[0]*t[0];if(this.iconImage_.getImageState()==q.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()==q.LOADED)return this.iconImage_.getSize()[1]*t[1]}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(F.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(F.CHANGE,t)}}const Us=Vs;class js{constructor(t){t=t||{},this.color_=t.color!==void 0?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=t.lineDash!==void 0?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.width_=t.width}clone(){const t=this.getColor();return new js({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setWidth(t){this.width_=t}}const ha=js;class Fn{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=Yr,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 Fn({geometry:t,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer(),stroke:this.getStroke()?this.get
7Stroke().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_=Yr,this.geometry_=t}setZIndex(t){this.zIndex_=t}}function Nu(n){let t;if(typeof n=="function")t=n;else{let e;Array.isArray(n)?e=n:(X(typeof n.getZIndex=="function","Expected an `Style` or an array of `Style`"),e=[n]),t=function(){return e}}return t}let Jn=null;function Gu(n,t){if(!Jn){const e=new Zs({color:"rgba(255,255,255,0.4)"}),i=new ha({color:"#3399CC",width:1.25});Jn=[new Fn({image:new la({fill:e,stroke:i,radius:5}),fill:e,stroke:i})]}return Jn}function Yr(n){return n.getGeometry()}const yi=Fn,Xu="#333";class Hs{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.scale_=t.scale,this.scaleArray_=Rt(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 Zs({color:Xu}),this.maxAngle_=t.maxAngle!==void 0?t.maxAngle:Math.PI/4,this.placement_=t.placement!==void 0?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=t.stroke!==void 0?t.stroke:null,this.offsetX_=t.offsetX!==void 0?t.offsetX:0,this.offsetY_=t.offsetY!==void 0?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=t.padding===void 0?null:t.padding}clone(){const t=this.getScale();return new Hs({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=Rt(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}
7setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}}const Wu=Hs;function zu(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],h=n[a+1];o+=Math.sqrt((l-s)*(l-s)+(h-r)*(h-r)),s=l,r=h}return o}let ai=0;const ht=1<<ai++,N=1<<ai++,ri=1<<ai++,$s=1<<ai++,Fi=1<<ai++,At=Math.pow(2,ai)-1,ca={[ht]:"boolean",[N]:"number",[ri]:"string",[$s]:"color",[Fi]:"number[]"},Yu=Object.keys(ca).map(Number).sort(Le);function yn(n){const t=[];for(const e of Yu)Bu(n,e)&&t.push(ca[e]);return t.length===0?"untyped":t.length<3?t.join(" or "):t.slice(0,-1).join(", ")+", or "+t[t.length-1]}function Bu(n,t){return(n&t)===t}function ua(n,t){return!!(n&t)}class ue{constructor(t,e){this.type=t,this.value=e}}class Ku{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function da(){return{variables:new Set,properties:new Set}}function kn(n,t){switch(typeof n){case"boolean":return new ue(ht,n);case"number":return new ue(N,n);case"string":return new ue(ri,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 Hu(n,t);for(const i of n)if(typeof i!="number")throw new Error("Expected an array of numbers");let e=Fi;return(n.length===3||n.length===4)&&(e|=$s),new ue(e,n)}const I={Number:"number",String:"string",Get:"get",Var:"var",Any:"any",All:"all",Not:"!",Resolution:"resolution",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"},Zu={[I.Number]:Z($(1,1/0,At),N),[I.String]:Z($(1,1/0,At),ri),[I.Get]:Z(Vu,At),[I.Var]:Z(Uu,At),[I.Resolution]:Z(ju,N),[I.Any]:Z($(2,1/0,ht),ht),[I.All]:Z($(2,1/0,ht),ht),[I.Not]:Z($(1,1,ht),ht),[I.Equal]:Z($(2,2,At),ht),[I.NotEqual]:Z($(2,2,At),ht),[I.GreaterThan]:Z($(2,2,At),ht),[I.GreaterThanOrEqualTo]:Z($(2,2,At),ht),[I.LessThan]:Z($(2,2,At),ht),[I.LessThanOrEqualTo]:Z($(2,2,At),ht),[I.Multiply]:Z($(2,1/0,N),N),[I.Divide]:Z($(2,2,N),N),[I.Add]:Z($(2,1/0,N),N),[I.Subtract]:Z($(2,2,N),N),[I.Clamp]:Z($(3,3,N),N),[I.Mod]:Z($(2,2,N),N),[I.Pow]:Z($(2,2,N),N),[I.Abs]:Z($(1,1,N),N),[I.Floor]:Z($(1,1,N),N),[I.Ceil]:Z($(1,1,N),N),[I.Round]:Z($(1,1,N),N),[I.Sin]:Z($(1,1,N),N),[I.Cos]:Z($(1,1,N),N),[I.Atan]:Z($(1,2,N),N),[I.Sqrt]:Z($(1,1,N),N),[I.Match]:Z($(4,1/0,ri|N),At)};function Vu(n,t){if(n.length!==2)throw new Error("Expected 1 argument for get operation");const e=kn(n[1],t);if(!(e instanceof ue))throw new Error("Expected a literal argument for get operation");if(typeof e.value!="string")throw new Error("Expected a string argument for get operation");return t.properties.add(e.value),[e]}function Uu(n,t){if(n.length!==2)throw new Error("Expected 1 argument for var operation");const e=kn(n[1],t);if(!(e instanceof ue))throw new Error("Expected a literal argument for var operation");if(typeof e.value!="string")throw new Error("Expected a string argument for get operation");return t.variables.add(e.value),[e]}function ju(n,t){const e=n[0];if(n.length!==1)throw new Error(`Expected no arguments for ${e} operation`);return[]}function $(n,t,e){return function(i,s){const r=i[0],o=i.length-1;if(n===t){if(o!==n){const l=n===1?"":"s";throw new Error(`Expected ${n} argument${l} for operation ${r}, got ${o}`)}}else if(o<n||o>t)throw new Error(`Expected ${n} to ${t} arguments for operation ${r}, got ${o}`);const a=new Array(o);for(let l=0;l<o;++l){const h=kn(i[l+1],s);if(!ua(e,h.type)){const c=yn(e),u=yn(h.type);throw new Error(`Unexpected type for argument ${l} of ${r} operation : got ${c} but expected ${u}`)}a[l]=h}return a}}function Z(n,t){return function(e,i){const s=e[0],r=n(e,i);return new Ku(t,s,...r)}}function Hu(n,t){const e=n[0],i=Zu[e];if(!i)throw new Error(`Unknown operator: ${e}`);return i(n,t)}function fa(){return{variables:{},properties:{},resolution:NaN}}function pe(n,t,e){const i=kn(n,e);if(!ua(t,i.type)){const s=yn(t),r=yn(i.type);throw new Error(`Expected expression to be of type ${s}, got ${r}`)}return Ae(i)}function Ae(n,t){if(n instanceof ue)return function(){return n.value};const e=n.operator;switch(e){case I.Number:case I.String:return $u(n);case I.Get:case I.Var:return qu(n);case I.Resolution:return i=>i.resolution;case I.Any:case I.All:case I.Not:return Qu(n);case I.Equal:case I.NotEqual:case I.LessThan:case I.LessThanOrEqualTo:case I.GreaterThan:case I.GreaterThanOrEqualTo:return Ju(n);case I.Multiply:case I.Divide:case I.Add:case I.Subtract:case I.Clamp:case I.Mod:case I.Pow:case I.Abs:case I.Floor:case I.Ceil:case I.Round:case I.Sin:case I.C
7os:case I.Atan:case I.Sqrt:return td(n);case I.Match:return ed(n);default:throw new Error(`Unsupported operator ${e}`)}}function $u(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=Ae(n.args[r]);switch(e){case I.Number:case I.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 qu(n,t){const e=n.args[0];if(!(e instanceof ue))throw new Error("Expected literal name");const i=e.value;if(typeof i!="string")throw new Error("Expected string name");switch(n.operator){case I.Get:return s=>s.properties[i];case I.Var:return s=>s.variables[i];default:throw new Error(`Unsupported accessor operator ${n.operator}`)}}function Ju(n,t){const e=n.operator,i=Ae(n.args[0]),s=Ae(n.args[1]);switch(e){case I.Equal:return r=>i(r)===s(r);case I.NotEqual:return r=>i(r)!==s(r);case I.LessThan:return r=>i(r)<s(r);case I.LessThanOrEqualTo:return r=>i(r)<=s(r);case I.GreaterThan:return r=>i(r)>s(r);case I.GreaterThanOrEqualTo:return r=>i(r)>=s(r);default:throw new Error(`Unsupported comparison operator ${e}`)}}function Qu(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=Ae(n.args[r]);switch(e){case I.Any:return r=>{for(let o=0;o<i;++o)if(s[o](r))return!0;return!1};case I.All:return r=>{for(let o=0;o<i;++o)if(!s[o](r))return!1;return!0};case I.Not:return r=>!s[0](r);default:throw new Error(`Unsupported logical operator ${e}`)}}function td(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=Ae(n.args[r]);switch(e){case I.Multiply:return r=>{let o=1;for(let a=0;a<i;++a)o*=s[a](r);return o};case I.Divide:return r=>s[0](r)/s[1](r);case I.Add:return r=>{let o=0;for(let a=0;a<i;++a)o+=s[a](r);return o};case I.Subtract:return r=>s[0](r)-s[1](r);case I.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 I.Mod:return r=>s[0](r)%s[1](r);case I.Pow:return r=>Math.pow(s[0](r),s[1](r));case I.Abs:return r=>Math.abs(s[0](r));case I.Floor:return r=>Math.floor(s[0](r));case I.Ceil:return r=>Math.ceil(s[0](r));case I.Round:return r=>Math.round(s[0](r));case I.Sin:return r=>Math.sin(s[0](r));case I.Cos:return r=>Math.cos(s[0](r));case I.Atan:return i===2?r=>Math.atan2(s[0](r),s[1](r)):r=>Math.atan(s[0](r));case I.Sqrt:return r=>Math.sqrt(s[0](r));default:throw new Error(`Unsupported numeric operator ${e}`)}}function ed(n,t){const e=n.args.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=Ae(n.args[s]);return s=>{const r=i[0](s);for(let o=1;o<e;o+=2)if(r===i[o](s))return i[o+1](s);return i[e-1](s)}}function id(n){return!0}function nd(n){const t=da(),e=sd(n,t),i=fa();return function(s,r){return i.properties=s.getPropertiesInternal(),i.resolution=r,e(i)}}function Br(n){const t=da(),e=n.length,i=new Array(e);for(let o=0;o<e;++o)i[o]=gs(n[o],t);const s=fa(),r=new Array(e);return function(o,a){s.properties=o.getPropertiesInternal(),s.resolution=a;for(let l=0;l<e;++l)r[l]=i[l](s);return r}}function sd(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?pe(r.filter,ht,t):id;let a;if(Array.isArray(r.style)){const l=r.style.length;a=new Array(l);for(let h=0;h<l;++h)a[h]=gs(r.style[h],t)}else a=[gs(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 h of i[a].styles){const c=h(s);c&&r.push(c)}}}return r}}function gs(n,t){const e=Li(n,"",t),i=Ai(n,"",t),s=rd(n,t),r=od(n,t),o=yt(n,"z-index",t),a=new yi;return function(l){let h=!0;if(e){const c=e(l);c&&(h=!1),a.setFill(c)}if(i){const c=i(l);c&&(h=!1),a.setStroke(c)}if(s){const c=s(l);c&&(h=!1),a.setText(c)}if(r){const c=r(l);c&&(h=!1),a.setImage(c)}return o&&a.setZIndex(o(l)),h?null:a}}function Li(n,t,e){const i=ga(n,t+"fill-color",e);if(!i)return null;const s=new Zs;return function(r){const o=i(r);return o==="none"?null:(s.setColor(o),s)}}function Ai(n,t,e){const i=yt(n,t+"stroke-width",e),s=ga(n,t+"stroke-color",e);if(!i&&!s)return null;const r=ce(n,t+"stroke-line-cap",e),o=ce(n,t+"stroke-line-join",e),a=_a(n,t+"stroke-line-dash",e),l=yt(n,t+"stroke-line-dash-offset",e),h=yt(n,t+"stroke-miter-limit",e),c=new ha;return function(u){if(s){const d=s(u);if(d==="none")return null;c.setColor(d)}if(i&&c.setWidth(i(u)),r){const d=r(u);if(d!=="butt"&&d!=="round"&&d!=="square")throw new Error("Expected butt, round, or square line cap");c.setLineCap(d)}if(o){const d=o(u);if(d!=="bevel"&&d!=="round"&&d!=="miter")throw new Error("Expected bevel, round, or miter line join");c.setLineJoin(d)}
7return a&&c.setLineDash(a(u)),l&&c.setLineDashOffset(l(u)),h&&c.setMiterLimit(h(u)),c}}function rd(n,t){const e="text-",i=ce(n,e+"value",t);if(!i)return null;const s=Li(n,e,t),r=Li(n,e+"background-",t),o=Ai(n,e,t),a=Ai(n,e+"background-",t),l=ce(n,e+"font",t),h=yt(n,e+"max-angle",t),c=yt(n,e+"offset-x",t),u=yt(n,e+"offset-y",t),d=Mi(n,e+"overflow",t),f=ce(n,e+"placement",t),g=yt(n,e+"repeat",t),_=Nn(n,e+"scale",t),m=Mi(n,e+"rotate-with-view",t),p=yt(n,e+"rotation",t),y=ce(n,e+"align",t),x=ce(n,e+"justify",t),E=ce(n,e+"baseline",t),C=_a(n,e+"padding",t),R=new Wu({});return function(T){if(R.setText(i(T)),s&&R.setFill(s(T)),r&&R.setBackgroundFill(r(T)),o&&R.setStroke(o(T)),a&&R.setBackgroundStroke(a(T)),l&&R.setFont(l(T)),h&&R.setMaxAngle(h(T)),c&&R.setOffsetX(c(T)),u&&R.setOffsetY(u(T)),d&&R.setOverflow(d(T)),f){const w=f(T);if(w!=="point"&&w!=="line")throw new Error("Expected point or line for text-placement");R.setPlacement(w)}if(g&&R.setRepeat(g(T)),_&&R.setScale(_(T)),m&&R.setRotateWithView(m(T)),p&&R.setRotation(p(T)),y){const w=y(T);if(w!=="left"&&w!=="center"&&w!=="right"&&w!=="end"&&w!=="start")throw new Error("Expected left, right, center, start, or end for text-align");R.setTextAlign(w)}if(x){const w=x(T);if(w!=="left"&&w!=="right"&&w!=="center")throw new Error("Expected left, right, or center for text-justify");R.setJustify(w)}if(E){const w=E(T);if(w!=="bottom"&&w!=="top"&&w!=="middle"&&w!=="alphabetic"&&w!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");R.setTextBaseline(w)}return C&&R.setPadding(C(T)),R}}function od(n,t){return"icon-src"in n?ad(n,t):"shape-points"in n?ld(n,t):"circle-radius"in n?hd(n,t):null}function ad(n,t){const e="icon-",i=e+"src",s=ma(n[i],i),r=En(n,e+"anchor",t),o=Nn(n,e+"scale",t),a=yt(n,e+"opacity",t),l=En(n,e+"displacement",t),h=yt(n,e+"rotation",t),c=Mi(n,e+"rotate-with-view",t),u=Kr(n,e+"anchor-origin"),d=Zr(n,e+"anchor-x-units"),f=Zr(n,e+"anchor-y-units"),g=fd(n,e+"color"),_=ud(n,e+"cross-origin"),m=dd(n,e+"offset"),p=Kr(n,e+"offset-origin"),y=He(n,e+"width"),x=He(n,e+"height"),E=cd(n,e+"size"),C=qs(n,e+"declutter"),R=new Us({src:s,anchorOrigin:u,anchorXUnits:d,anchorYUnits:f,color:g,crossOrigin:_,offset:m,offsetOrigin:p,height:x,width:y,size:E,declutterMode:C});return function(T){return a&&R.setOpacity(a(T)),l&&R.setDisplacement(l(T)),h&&R.setRotation(h(T)),c&&R.setRotateWithView(c(T)),o&&R.setScale(o(T)),r&&R.setAnchor(r(T)),R}}function ld(n,t){const e="shape-",i=e+"points",s=pa(n[i],i),r=Li(n,e,t),o=Ai(n,e,t),a=Nn(n,e+"scale",t),l=En(n,e+"displacement",t),h=yt(n,e+"rotation",t),c=Mi(n,e+"rotate-with-view",t),u=He(n,e+"radius"),d=He(n,e+"radius1"),f=He(n,e+"radius2"),g=He(n,e+"angle"),_=qs(n,e+"declutter-mode"),m=new aa({points:s,radius:u,radius1:d,radius2:f,angle:g,declutterMode:_});return function(p){return r&&m.setFill(r(p)),o&&m.setStroke(o(p)),l&&m.setDisplacement(l(p)),h&&m.setRotation(h(p)),c&&m.setRotateWithView(c(p)),a&&m.setScale(a(p)),m}}function hd(n,t){const e="circle-",i=Li(n,e,t),s=Ai(n,e,t),r=yt(n,e+"radius",t),o=Nn(n,e+"scale",t),a=En(n,e+"displacement",t),l=yt(n,e+"rotation",t),h=Mi(n,e+"rotate-with-view",t),c=qs(n,e+"declutter-mode"),u=new la({radius:5,declutterMode:c});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)),h&&u.setRotateWithView(h(d)),o&&u.setScale(o(d)),u}}function yt(n,t,e){if(!(t in n))return;const i=pe(n[t],N,e);return function(s){return pa(i(s),t)}}function ce(n,t,e){if(!(t in n))return null;const i=pe(n[t],ri,e);return function(s){return ma(i(s),t)}}function Mi(n,t,e){if(!(t in n))return null;const i=pe(n[t],ht,e);return function(s){const r=i(s);if(typeof r!="boolean")throw new Error(`Expected a boolean for ${t}`);return r}}function ga(n,t,e){if(!(t in n))return null;const i=pe(n[t],$s|ri,e);return function(s){return ya(i(s),t)}}function _a(n,t,e){if(!(t in n))return null;const i=pe(n[t],Fi,e);return function(s){return ki(i(s),t)}}function En(n,t,e){if(!(t in n))return null;const i=pe(n[t],Fi,e);return function(s){const r=ki(i(s),t);
7if(r.length!==2)throw new Error(`Expected two numbers for ${t}`);return r}}function Nn(n,t,e){if(!(t in n))return null;const i=pe(n[t],Fi|N,e);return function(s){return gd(i(s),t)}}function He(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 cd(n,t){const e=n[t];if(e!==void 0){if(typeof e=="number")return Rt(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 ud(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 Kr(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 Zr(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 dd(n,t){const e=n[t];if(e!==void 0)return ki(e,t)}function qs(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 fd(n,t){const e=n[t];if(e!==void 0)return ya(e,t)}function ki(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 ma(n,t){if(typeof n!="string")throw new Error(`Expected a string for ${t}`);return n}function pa(n,t){if(typeof n!="number")throw new Error(`Expected a number for ${t}`);return n}function ya(n,t){if(typeof n=="string")return n;const e=ki(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 gd(n,t){if(typeof n=="number")return n;const e=ki(n,t);if(e.length!==2)throw new Error(`Expected an array of two numbers for ${t}`);return e}const Vr={RENDER_ORDER:"renderOrder"};class _d extends On{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=t.declutter!==void 0?t.declutter:!1,this.renderBuffer_=t.renderBuffer!==void 0?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=t.updateWhileAnimating!==void 0?t.updateWhileAnimating:!1,this.updateWhileInteracting_=t.updateWhileInteracting!==void 0?t.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(Vr.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t){t.declutterTree||(t.declutterTree=new ra(9)),this.getRenderer().renderDeclutter(t)}setRenderOrder(t){this.set(Vr.RENDER_ORDER,t)}setStyle(t){this.style_=md(t),this.styleFunction_=t===null?void 0:Nu(this.style_),this.changed()}}function md(n){if(n===void 0)return Gu;if(!n)return null;if(typeof n=="function"||n instanceof yi)return n;if(!Array.isArray(n))return Br([n]);if(n.length===0)return[];const t=n.length,e=n[0];if(e instanceof yi){const s=new Array(t);for(let r=0;r<t;++r){const o=n[r];if(!(o instanceof yi))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 nd(s)}return Br(n)}const pd=_d,Ni={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},nn=[Ni.FILL],de=[Ni.STROKE],ve=[Ni.BEGIN_PATH],Ur=[Ni.CLOSE_PATH],b=Ni;class yd{drawCustom(t,e,i,s){}drawGeometry(t){}setStyle(t){}drawCircle(t,e){}drawFeature(t,e){}drawGeometryCollection(t,e){}drawLineString(t,e){}drawMultiLineString(t,e){}drawMultiPoint(t,e){}drawMultiPolygon(t,e){}drawPoint(t,e){}drawPolygon(t,e){}drawText(t,e){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}const Ea=yd;
7class Ed extends Ea{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],In(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 h=this.getBufferedMaxExtent();o&&(e+=s);let c=t[e],u=t[e+1];const d=this.tmpCoordinate_;let f=!0,g,_,m;for(g=e+s;g<i;g+=s)d[0]=t[g],d[1]=t[g+1],m=is(h,d),m!==_?(f&&(a[l++]=c,a[l++]=u,f=!1),a[l++]=d[0],a[l++]=d[1]):m===st.INTERSECTING?(a[l++]=d[0],a[l++]=d[1],f=!1):f=!0,c=d[0],u=d[1],_=m;return(r&&f||g===e+s)&&(a[l++]=c,a[l++]=u),l}drawCustomCoordinates_(t,e,i,s,r){for(let o=0,a=i.length;o<a;++o){const l=i[o],h=this.appendFlatLineCoordinates(t,e,l,s,!1,!1);r.push(h),e=l}return e}drawCustom(t,e,i,s){this.beginGeometry(t,e);const r=t.getType(),o=t.getStride(),a=this.coordinates.length;let l,h,c,u,d;switch(r){case"MultiPolygon":l=t.getOrientedFlatCoordinates(),u=[];const f=t.getEndss();d=0;for(let g=0,_=f.length;g<_;++g){const m=[];d=this.drawCustomCoordinates_(l,d,f[g],o,m),u.push(m)}this.instructions.push([b.CUSTOM,a,u,t,i,Mr]),this.hitDetectionInstructions.push([b.CUSTOM,a,u,t,s||i,Mr]);break;case"Polygon":case"MultiLineString":c=[],l=r=="Polygon"?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),d=this.drawCustomCoordinates_(l,0,t.getEnds(),o,c),this.instructions.push([b.CUSTOM,a,c,t,i,fn]),this.hitDetectionInstructions.push([b.CUSTOM,a,c,t,s||i,fn]);break;case"LineString":case"Circle":l=t.getFlatCoordinates(),h=this.appendFlatLineCoordinates(l,0,l.length,o,!1,!1),this.instructions.push([b.CUSTOM,a,h,t,i,je]),this.hitDetectionInstructions.push([b.CUSTOM,a,h,t,s||i,je]);break;case"MultiPoint":l=t.getFlatCoordinates(),h=this.appendFlatPointCoordinates(l,o),h>a&&(this.instructions.push([b.CUSTOM,a,h,t,i,je]),this.hitDetectionInstructions.push([b.CUSTOM,a,h,t,s||i,je]));break;case"Point":l=t.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([b.CUSTOM,a,h,t,i]),this.hitDetectionInstructions.push([b.CUSTOM,a,h,t,s||i]);break}this.endGeometry(e)}beginGeometry(t,e){this.beginGeometryInstruction1_=[b.BEGIN_GEOMETRY,e,0,t],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[b.BEGIN_GEOMETRY,e,0,t],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;t.reverse();let e;const i=t.length;let s,r,o=-1;for(e=0;e<i;++e)s=t[e],r=s[0],r==b.END_GEOMETRY?o=e:r==b.BEGIN_GEOMETRY&&(s[2]=e,Fa(this.hitDetectionInstructions,o,e),o=-1)}setFillStrokeStyle(t,e){const i=this.state;if(t){const s=t.getColor();i.fillStyle=Gt(s||mt)}else i.fillStyle=void 0;if(e){const s=e.getColor();i.strokeStyle=Gt(s||Ii);const r=e.getLineCap();i.lineCap=r!==void 0?r:ni;const o=e.getLineDash();i.lineDash=o?o.slice():qt;const a=e.getLineDashOffset();i.lineDashOffset=a||Jt;const l=e.getLineJoin();i.lineJoin=l!==void 0?l:si;const h=e.getWidth();i.lineWidth=h!==void 0?h:Si;const c=e.getMiterLimit();i.miterLimit=c!==void 0?c:wi,i.lineWidth>this.maxLineWidth&&(this.maxLineWidth=i.lineWidth,this.bufferedMaxExtent_=null)}else i.strokeStyle=void 0,i.lineCap=void 0,i.lineDash=null,i.lineDashOffset=void 0,i.lineJoin=void 0,i.lineWidth=void 0,i.miterLimit=void 0}createFill(t){const e=t.fillStyle,i=[b.SET_FILL_STYLE,e];return typeof e!="string"&&i.push(!0),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[b.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;
7(typeof i!="string"||t.currentFillStyle!=i)&&(i!==void 0&&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,h=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=s||r!=t.currentLineDash&&!me(t.currentLineDash,r)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=l||t.currentMiterLimit!=h)&&(i!==void 0&&e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=s,t.currentLineDash=r,t.currentLineDashOffset=o,t.currentLineJoin=a,t.currentLineWidth=l,t.currentMiterLimit=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[b.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=uo(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;xs(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}const Gi=Ed;class xd extends Gi{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){if(!this.image_)return;this.beginGeometry(t,e);const i=t.getFlatCoordinates(),s=t.getStride(),r=this.coordinates.length,o=this.appendFlatPointCoordinates(i,s);this.instructions.push([b.DRAW_IMAGE,r,o,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([b.DRAW_IMAGE,r,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e){if(!this.image_)return;this.beginGeometry(t,e);const i=t.getFlatCoordinates(),s=t.getStride(),r=this.coordinates.length,o=this.appendFlatPointCoordinates(i,s);this.instructions.push([b.DRAW_IMAGE,r,o,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([b.DRAW_IMAGE,r,o,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}}const Cd=xd;class Rd extends Gi{constructor(t,e,i,s){super(t,e,i,s)}drawFlatCoordinates_(t,e,i,s){const r=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,i,s,!1,!1),a=[b.MOVE_TO_LINE_TO,r,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),i}drawLineString(t,e){const i=this.state,s=i.strokeStyle,r=i.lineWidth;if(s===void 0||r===void 0)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([b.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,qt,Jt],ve);const o=t.getFlatCoordinates(),a=t.getStride();this.drawFlatCoordinates_(o,0,o.length,a),this.hitDetectionInstructions.push(de),this.endGeometry(e)}drawMultiLineString(t,e){const i=this.state,s=i.strokeStyle,r=i.lineWidth;if(s===void 0||r===void 0)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([b.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,qt,Jt],ve);const o=t.getEnds(),a=t.getFlatCoordinates(),l=t.getStride();let h=0;for(let c=0,u=o.length;c<u;++c)h=this.drawFlatCoordinates_(a,h,o[c],l);this.hitDetectionInstructions.push(de),this.endGeometry(e)}finish(){const t=this.state;return t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&this.instructions.push(de),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(de),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(ve)}}const Td=Rd;class wd extends Gi{constructor(t,e,i,s){super(t,e,i,s)}drawFlatCoordinatess_(t,e,i,s){const r=this.state,o=r.fillStyle!==void 0,a=r.strokeStyle!==void 0,l=i.length;this.instructions.push(ve),this.hitDetectionInstructions.push(ve);for(let h=0;h<l;++h){const c=i[h],u=this.coordinates.length,d=this.appendFlatLineCoordinates(t,e,c,s,!0,!a),f=[b.MO
7VE_TO_LINE_TO,u,d];this.instructions.push(f),this.hitDetectionInstructions.push(f),a&&(this.instructions.push(Ur),this.hitDetectionInstructions.push(Ur)),e=c}return o&&(this.instructions.push(nn),this.hitDetectionInstructions.push(nn)),a&&(this.instructions.push(de),this.hitDetectionInstructions.push(de)),e}drawCircle(t,e){const i=this.state,s=i.fillStyle,r=i.strokeStyle;if(s===void 0&&r===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e),i.fillStyle!==void 0&&this.hitDetectionInstructions.push([b.SET_FILL_STYLE,mt]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([b.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,qt,Jt]);const o=t.getFlatCoordinates(),a=t.getStride(),l=this.coordinates.length;this.appendFlatLineCoordinates(o,0,o.length,a,!1,!1);const h=[b.CIRCLE,l];this.instructions.push(ve,h),this.hitDetectionInstructions.push(ve,h),i.fillStyle!==void 0&&(this.instructions.push(nn),this.hitDetectionInstructions.push(nn)),i.strokeStyle!==void 0&&(this.instructions.push(de),this.hitDetectionInstructions.push(de)),this.endGeometry(e)}drawPolygon(t,e){const i=this.state,s=i.fillStyle,r=i.strokeStyle;if(s===void 0&&r===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e),i.fillStyle!==void 0&&this.hitDetectionInstructions.push([b.SET_FILL_STYLE,mt]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([b.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,qt,Jt]);const o=t.getEnds(),a=t.getOrientedFlatCoordinates(),l=t.getStride();this.drawFlatCoordinatess_(a,0,o,l),this.endGeometry(e)}drawMultiPolygon(t,e){const i=this.state,s=i.fillStyle,r=i.strokeStyle;if(s===void 0&&r===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e),i.fillStyle!==void 0&&this.hitDetectionInstructions.push([b.SET_FILL_STYLE,mt]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([b.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,qt,Jt]);const o=t.getEndss(),a=t.getOrientedFlatCoordinates(),l=t.getStride();let h=0;for(let c=0,u=o.length;c<u;++c)h=this.drawFlatCoordinatess_(a,h,o[c],l);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]=Ce(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;t.fillStyle!==void 0&&this.updateFillStyle(t,this.createFill),t.strokeStyle!==void 0&&this.updateStrokeStyle(t,this.applyStroke)}}const jr=wd;function Id(n,t,e,i,s){const r=[];let o=e,a=0,l=t.slice(e,2);for(;a<n&&o+s<i;){const[h,c]=l.slice(-2),u=t[o+s],d=t[o+s+1],f=Math.sqrt((u-h)*(u-h)+(d-c)*(d-c));if(a+=f,a>=n){const g=(n-a+f)/f,_=Mt(h,u,g),m=Mt(c,d,g);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 g=f-a,_=Mt(h,u,g/f),m=Mt(c,d,g/f);l.push(_,m),r.push(l),l=[_,m],a=0,o+=s}}return a>0&&r.push(l),r}function vd(n,t,e,i,s){let r=e,o=e,a=0,l=0,h=e,c,u,d,f,g,_,m,p,y,x;for(u=e;u<i;u+=s){const E=t[u],C=t[u+1];g!==void 0&&(y=E-g,x=C-_,f=Math.sqrt(y*y+x*x),m!==void 0&&(l+=d,c=Math.acos((m*y+p*x)/(d*f)),c>n&&(l>a&&(a=l,r=h,o=u),l=0,h=u-s)),d=f,m=y,p=x),g=E,_=C}return l+=f,l>a?[h,u]:[r,o]}const xn={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class Sd extends Gi{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.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[mt]={fillStyle:mt},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e){const i=this.textFillState_,s=this.textStrokeState_,r=this.textState_;if(this.text_===""||!r||!i&&!s)return;const o=this.coordinates;let a=o.length;const l=t.getType();let h=null,c=t.getStride();if(r.placement==="line"&&(l=="LineString"||l=="MultiLineString"||l=="Polygon"||l=="MultiPolygon")){if(!pt(this.getBufferedMaxExtent(),t.getExtent()))return;let u;if(h=t.getFlatCoordinates(),l=="LineString")u=[h.length];else if(l=="MultiLineString")u=t.getEnds();else if(l=="Polygon")u=t.getEnds().slice(0,1);else if(l=="MultiPolygon"){const _=t.getEndss();u=[];for(let m=0,p=_.length;m<p;++m)u.push(_[m][0])}this.beginGeometry(t,e);const d=r.repeat,f=d?void 0:r.textAlign;let g=0;for(let _=0,m=u.length;_<m;++_){let p;d?p=Id(d*this.resolution,h,g,u[_],c):p=[h.slice(g,u[_])];for(let y=0,x=p.length;y<x;++y){const E=p[y];let C=0,R=E.length;if(f==null){const w=vd(r.maxAngle,E,0,E.length,2);C=w[0],R=w[1]}for(let w=C;w<R;w+=c)o.push(E[w],E[w+1]);const T=o.length;g=u[_],this.drawChars_(a,T),a=T}}this.endGeometry(e)}else{let u=r.overflow?null:[];switch(l){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(),c=2;break;case"Polygon":h=t.getFlatInteriorPoint(),r.overflow||u.push(h[2]/this.resolution),c=3;break;case"MultiPolygon":const p=t.getFlatInteriorPoints();h=[];for(let y=0,x=p.length;y<x;y+=3)r.overflow||u.push(p[y+2]/this.resolution),h.push(p[y],p[y+1]);if(h.length===0)return;c=2;break}const d=this.appendFlatPointCoordinates(h,c);if(d===a)return;if(u&&(d-a)/2!==h.length/c){let p=a/2;u=u.filter((y,x)=>
7{const E=o[(p+x)*2]===h[x*c]&&o[(p+x)*2+1]===h[x*c+1];return E||--p,E})}this.saveTextStates_(),(r.backgroundFill||r.backgroundStroke)&&(this.setFillStrokeStyle(r.backgroundFill,r.backgroundStroke),r.backgroundFill&&this.updateFillStyle(this.state,this.createFill),r.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(t,e);let f=r.padding;if(f!=Ie&&(r.scale[0]<0||r.scale[1]<0)){let p=r.padding[0],y=r.padding[1],x=r.padding[2],E=r.padding[3];r.scale[0]<0&&(y=-y,E=-E),r.scale[1]<0&&(p=-p,x=-x),f=[p,y,x,E]}const g=this.pixelRatio;this.instructions.push([b.DRAW_IMAGE,a,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,void 0,this.declutterImageWithText_,f==Ie?Ie:f.map(function(p){return p*g}),!!r.backgroundFill,!!r.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,u]);const _=1/g,m=this.state.fillStyle;r.backgroundFill&&(this.state.fillStyle=mt,this.hitDetectionInstructions.push(this.createFill(this.state))),this.hitDetectionInstructions.push([b.DRAW_IMAGE,a,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[_,_],NaN,void 0,this.declutterImageWithText_,f,!!r.backgroundFill,!!r.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?mt:this.fillKey_,this.textOffsetX_,this.textOffsetY_,u]),r.backgroundFill&&(this.state.fillStyle=m,this.hitDetectionInstructions.push(this.createFill(this.state))),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||vi,justify:e.justify,textBaseline:e.textBaseline||_n,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,h=xn[s.textBaseline],c=this.textOffsetY_*l,u=this.text_,d=i?i.lineWidth*Math.abs(s.scale[0])/2:0;this.instructions.push([b.DRAW_CHARS,t,e,h,s.overflow,a,s.maxAngle,l,c,r,d*l,u,o,1]),this.hitDetectionInstructions.push([b.DRAW_CHARS,t,e,h,s.overflow,a&&mt,s.maxAngle,l,c,r,d*l,u,o,1/l])}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=Gt(o.getColor()||mt)):(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 g=a.getLineDash(),_=a.getLineDashOffset(),m=a.getWidth(),p=a.getMiterLimit();r.lineCap=a.getLineCap()||ni,r.lineDash=g?g.slice():qt,r.lineDashOffset=_===void 0?Jt:_,r.lineJoin=a.getLineJoin()||si,r.lineWidth=m===void 0?Si:m,r.miterLimit=p===void 0?wi:p,r.strokeStyle=Gt(a.getColor()||Ii)}i=this.textState_;const l=t.getFont()||$o;fc(l);const h=t.getScaleArray();i.overflow=t.getOverflow(),i.font=l,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||_n,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||Ie,i.scale=h===void 0?[1,1]:h;const c=t.getOffsetX(),u=t.getOffsetY(),d=t.getRotateWithView(),f=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=c===void 0?0:c,this.textOffsetY_=u===void 0?0:u,this.textRotateWithView_=d===void 0?!1:d,this.textRotation_=f===void 0?0:f,this.strokeKey_=r?(typeof r.strokeStyle=="string"?r.strokeStyle:B(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?typeof s.fillStyle=="string"?s.fillStyle:"|"+B(s.fillStyle):""}this.declutterImageWithText_=e}}const Ld={Circle:jr,Default:Gi,Image:Cd,LineString:Td,Polygon:jr,Text:Sd};class Ad{constructor(t,e,i,s){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=s,this.resolution_=i,this.buildersByZIndex_
7={}}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=Ld[e];r=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),s[e]=r}return r}}const Hr=Ad;class Md extends io{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.declutterExecutorGroup=null}getFeatures(t){return Y()}getData(t){return null}prepareFrame(t){return Y()}renderFrame(t,e){return Y()}loadedTileCallback(t,e,i){t[e]||(t[e]={}),t[e][i.tileCoord.toString()]=i}createLoadedTileFinder(t,e,i){return(s,r)=>{const o=this.loadedTileCallback.bind(this,i,s);return t.forEachLoadedTile(e,s,r,o)}}forEachFeatureAtCoordinate(t,e,i,s,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;(e.getState()===q.LOADED||e.getState()===q.ERROR)&&this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=q.LOADED&&e!=q.ERROR&&t.addEventListener(F.CHANGE,this.boundHandleImageChange_),e==q.IDLE&&(t.load(),e=t.getState()),e==q.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&t.getSourceState()==="ready"&&t.changed()}disposeInternal(){delete this.layer_,super.disposeInternal()}}const bd=Md,$r=[];let Ve=null;function Od(){Ve=dt(1,1,void 0,{willReadFrequently:!0})}class Pd extends bd{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=Xt(),this.pixelTransform=Xt(),this.inversePixelTransform=Xt(),this.context=null,this.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(t,e,i){Ve||Od(),Ve.clearRect(0,0,1,1);let s;try{Ve.drawImage(t,e,i,1,1,0,0,1,1),s=Ve.getImageData(0,0,1,1).data}catch{return Ve=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&&me(un(t.style.backgroundColor),un(i)))){const a=t.firstElementChild;a instanceof HTMLCanvasElement&&(o=a.getContext("2d"))}if(o&&o.canvas.style.transform===e?(this.container=t,this.context=o,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){r=document.createElement("div"),r.className=s;let a=r.style;a.position="absolute",a.width="100%",a.height="100%",o=dt();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=Me(i),r=An(i),o=Ln(i),a=Sn(i);rt(e.coordinateToPixelTransform,s),rt(e.coordinateToPixelTransform,r),rt(e.coordinateToPixelTransform,o),rt(e.coordinateToPixelTransform,a);const l=this.inversePixelTransform;rt(l,s),rt(l,r),rt(l,o),rt(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])
7),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.lineTo(Math.round(a[0]),Math.round(a[1])),t.clip()}dispatchRenderEvent_(t,e,i){const s=this.getLayer();if(s.hasListener(t)){const r=new jo(t,this.inversePixelTransform,i,e);s.dispatchEvent(r)}}preRender(t,e){this.frameState=e,this.dispatchRenderEvent_(Wt.PRERENDER,t,e)}postRender(t,e){this.dispatchRenderEvent_(Wt.POSTRENDER,t,e)}getRenderTransform(t,e,i,s,r,o,a){const l=r/2,h=o/2,c=s/e,u=-c,d=-t[0]+a,f=-t[1];return _e(this.tempTransform,l,h,c,u,-i,d,f)}disposeInternal(){delete this.frameState,super.disposeInternal()}}const xa=Pd;function Dd(n,t,e,i,s,r,o,a,l,h,c,u){let d=n[t],f=n[t+1],g=0,_=0,m=0,p=0;function y(){g=d,_=f,t+=i,d=n[t],f=n[t+1],p+=m,m=Math.sqrt((d-g)*(d-g)+(f-_)*(f-_))}do y();while(t<e-i&&p+m<r);let x=m===0?0:(r-p)/m;const E=Mt(g,d,x),C=Mt(_,f,x),R=t-i,T=p,w=r+a*l(h,s,c);for(;t<e-i&&p+m<w;)y();x=m===0?0:(w-p)/m;const A=Mt(g,d,x),P=Mt(_,f,x);let z;if(u){const O=[E,C,A,P];zo(O,0,4,2,u,O,O),z=O[0]>O[2]}else z=E>A;const G=Math.PI,k=[],it=R+i===t;t=R,m=0,p=T,d=n[t],f=n[t+1];let L;if(it){y(),L=Math.atan2(f-_,d-g),z&&(L+=L>0?-G:G);const O=(A+E)/2,S=(P+C)/2;return k[0]=[O,S,(w-r)/2,L,s],k}s=s.replace(/\n/g," ");for(let O=0,S=s.length;O<S;){y();let D=Math.atan2(f-_,d-g);if(z&&(D+=D>0?-G:G),L!==void 0){let K=D-L;if(K+=K>G?-2*G:K<-G?2*G:0,Math.abs(K)>o)return null}L=D;const j=O;let V=0;for(;O<S;++O){const K=z?S-O-1:O,H=a*l(h,s[K],c);if(t+i<e&&p+m<r+V+H/2)break;V+=H}if(O===j)continue;const nt=z?s.substring(S-j,S-O):s.substring(j,O);x=m===0?0:(r+V/2-p)/m;const v=Mt(g,d,x),Et=Mt(_,f,x);k.push([v,Et,V/2,D,nt]),r+=V}return k}const ze=bt(),oe=[],Vt=[],Ut=[],ae=[];function qr(n){return n[3].declutterBox}const Jr=new RegExp("["+String.fromCharCode(1425)+"-"+String.fromCharCode(2303)+String.fromCharCode(64285)+"-"+String.fromCharCode(65023)+String.fromCharCode(65136)+"-"+String.fromCharCode(65276)+String.fromCharCode(67584)+"-"+String.fromCharCode(69631)+String.fromCharCode(124928)+"-"+String.fromCharCode(126975)+"]");function Qn(n,t){return t==="start"?t=Jr.test(n)?"right":"left":t==="end"&&(t=Jr.test(n)?"left":"right"),xn[t]}function Fd(n,t,e){return e>0&&n.push(` 8`,""),n.push(t,""),n}class kd{constructor(t,e,i,s){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignFill_,this.instructions=s.instructions,this.coordinates=s.coordinates,this.coordinateCache_={},this.renderedTransform_=Xt(),this.hitDetectionInstructions=s.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=s.fillStates||{},this.strokeStates=s.strokeStates||{},this.textStates=s.textStates||{},this.widths_={},this.labels_={}}createLabel(t,e,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],h=this.pixelRatio,c=[l.scale[0]*h,l.scale[1]*h],u=Array.isArray(t),d=l.justify?xn[l.justify]:Qn(Array.isArray(t)?t[0]:t,l.textAlign||vi),f=s&&o.lineWidth?o.lineWidth:0,g=u?t:t.split(` 9`).reduce(Fd,[]),{width:_,height:m,widths:p,heights:y,lineWidths:x}=_c(l,g),E=_+f,C=[],R=(E+2)*c[0],T=(m+f)*c[1],w={width:R<0?Math.floor(R):Math.ceil(R),height:T<0?Math.floor(T):Math.ceil(T),contextInstructions:C};(c[0]!=1||c[1]!=1)&&C.push("scale",c),s&&(C.push("strokeStyle",o.strokeStyle),C.push("lineWidth",f),C.push("lineCap",o.lineCap),C.push("lineJoin",o.lineJoin),C.push("miterLimit",o.miterLimit),C.push("setLineDash",[o.lineDash]),C.push("lineDashOffset",o.lineDashOffset)),i&&C.push("fillStyle",a.fillStyle),C.push("textBaseline","middle"),C.push("textAlign","center");const A=.5-d;let P=d*E+A*f;const z=[],G=[];let k=0,it=0,L=0,O=0,S;for(let D=0,j=g.length;D<j;D+=2){const V=g[D];if(V===` 10`){it+=k,k=0,P=d*E+A*f,++O;continue}const nt=g[D+1]||l.font;nt!==S&&(s&&z.push("font",nt),i&&G.push("font",nt),S=nt),k=Math.max(k,y[L]);const v=[V,P+A*p[L]+d*(p[L]-x[O]),.5*(f+k)+it];P+=p[L],s&&z.push("strokeText",v),i&&G.push("fillText",v),++L}return Array.prototype.push.apply(C,z),Array.prototype.push.apply(C,G),this.labels_[r]=w,w}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.alignFill_=o[2],this.fill_(t)),a&&(this.setStrokeStyle_(t,a),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,s,r,o,a,l,h,c,u,d,f,g,_,m){a*=d[0],l*=d[1];let p=i-a,y=s-l;const x=r+h>
10t?t-h:r,E=o+c>e?e-c:o,C=g[3]+x*d[0]+g[1],R=g[0]+E*d[1]+g[2],T=p-g[3],w=y-g[0];(_||u!==0)&&(oe[0]=T,ae[0]=T,oe[1]=w,Vt[1]=w,Vt[0]=T+C,Ut[0]=Vt[0],Ut[1]=w+R,ae[1]=Ut[1]);let A;return u!==0?(A=_e(Xt(),i,s,1,1,u,-i,-s),rt(A,oe),rt(A,Vt),rt(A,Ut),rt(A,ae),ge(Math.min(oe[0],Vt[0],Ut[0],ae[0]),Math.min(oe[1],Vt[1],Ut[1],ae[1]),Math.max(oe[0],Vt[0],Ut[0],ae[0]),Math.max(oe[1],Vt[1],Ut[1],ae[1]),ze)):ge(Math.min(T,T+C),Math.min(w,w+R),Math.max(T,T+C),Math.max(w,w+R),ze),f&&(p=Math.round(p),y=Math.round(y)),{drawImageX:p,drawImageY:y,drawImageW:x,drawImageH:E,originX:h,originY:c,declutterBox:{minX:ze[0],minY:ze[1],maxX:ze[2],maxY:ze[3],value:m},canvasTransform:A,scale:d}}replayImageOrLabel_(t,e,i,s,r,o,a){const l=!!(o||a),h=s.declutterBox,c=t.canvas,u=a?a[2]*s.scale[0]/2:0;return h.minX-u<=c.width/e&&h.maxX+u>=0&&h.minY-u<=c.height/e&&h.maxY+u>=0&&(l&&this.replayTextBackground_(t,oe,Vt,Ut,ae,o,a),mc(t,s.canvasTransform,r,i,s.originX,s.originY,s.drawImageW,s.drawImageH,s.drawImageX,s.drawImageY,s.scale)),!0}fill_(t){if(this.alignFill_){const e=rt(this.renderedTransform_,[0,0]),i=512*this.pixelRatio;t.save(),t.translate(e[0]%i,e[1]%i),t.rotate(this.viewRotation_)}t.fill(),this.alignFill_&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6])}drawLabelWithPointPlacement_(t,e,i,s){const r=this.textStates[e],o=this.createLabel(t,e,s,i),a=this.strokeStates[i],l=this.pixelRatio,h=Qn(Array.isArray(t)?t[0]:t,r.textAlign||vi),c=xn[r.textBaseline||_n],u=a&&a.lineWidth?a.lineWidth:0,d=o.width/l-2*r.scale[0],f=h*d+2*(.5-h)*u,g=c*o.height/l+2*(.5-c)*u;return{label:o,anchorX:f,anchorY:g}}execute_(t,e,i,s,r,o,a,l){let h;this.pixelCoordinates_&&me(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=Se(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),Rh(this.renderedTransform_,i));let c=0;const u=s.length;let d=0,f,g,_,m,p,y,x,E,C,R,T,w,A=0,P=0,z=null,G=null;const k=this.coordinateCache_,it=this.viewRotation_,L=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,O={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:it},S=this.instructions!=s||this.overlaps?0:200;let D,j,V,nt;for(;c<u;){const v=s[c];switch(v[0]){case b.BEGIN_GEOMETRY:D=v[1],nt=v[3],D.getGeometry()?a!==void 0&&!pt(a,nt.getExtent())?c=v[2]+1:++c:c=v[2];break;case b.BEGIN_PATH:A>S&&(this.fill_(t),A=0),P>S&&(t.stroke(),P=0),!A&&!P&&(t.beginPath(),m=NaN,p=NaN),++c;break;case b.CIRCLE:d=v[1];const K=h[d],H=h[d+1],te=h[d+2],Dt=h[d+3],ot=te-K,Yt=Dt-H,be=Math.sqrt(ot*ot+Yt*Yt);t.moveTo(K+be,H),t.arc(K,H,be,0,2*Math.PI,!0),++c;break;case b.CLOSE_PATH:t.closePath(),++c;break;case b.CUSTOM:d=v[1],f=v[2];const Xi=v[3],Oe=v[4],Wi=v.length==6?v[5]:void 0;O.geometry=Xi,O.feature=D,c in k||(k[c]=[]);const ee=k[c];Wi?Wi(h,d,f,2,ee):(ee[0]=h[d],ee[1]=h[d+1],ee.length=2),Oe(ee,O),++c;break;case b.DRAW_IMAGE:d=v[1],f=v[2],E=v[3],g=v[4],_=v[5];let li=v[6];const ie=v[7],zi=v[8],Yi=v[9],Bi=v[10];let Pe=v[11];const Gn=v[12];let ft=v[13];const Tt=v[14],vt=v[15];if(!E&&v.length>=20){C=v[19],R=v[20],T=v[21],w=v[22];const xt=this.drawLabelWithPointPlacement_(C,R,T,w);E=xt.label,v[3]=E;const ke=v[23];g=(xt.anchorX-ke)*this.pixelRatio,v[4]=g;const wt=v[24];_=(xt.anchorY-wt)*this.pixelRatio,v[5]=_,li=E.height,v[6]=li,ft=E.width,v[13]=ft}let Bt;v.length>25&&(Bt=v[25]);let De,ye,ne;v.length>17?(De=v[16],ye=v[17],ne=v[18]):(De=Ie,ye=!1,ne=!1),Bi&&L?Pe+=it:!Bi&&!L&&(Pe-=it);let Fe=0;for(;d<f;d+=2){if(Bt&&Bt[Fe++]<ft/this.pixelRatio)continue;const xt=this.calculateImageOrLabelDimensions_(E.width,E.height,h[d],h[d+1],ft,li,g,_,zi,Yi,Pe,Gn,r,De,ye||ne,D),ke=[t,e,E,xt,ie,ye?z:null,ne?G:null];if(l){if(Tt==="none")continue;if(Tt==="obstacle"){l.insert(xt.declutterBox);continue}else{let wt,Kt;if(vt){const Ct=f-d;if(!vt[Ct]){vt[Ct]=ke;continue}if(wt=vt[Ct],delete vt[Ct],Kt=qr(wt),l.collides(Kt))continue}if(l.collides(xt.declutterBox))continue;wt&&(l.insert(Kt),this.replayImageOrLabel_.apply(this,wt)),l.insert(xt.declutterBox)}}this.replayImageOrLabel_.apply(this,ke)}++c;break;case b.DRAW_CHARS:const Ki=v[1],ut=v[2],Xn=v[3],Ta=v[4];w=v[5];const wa=v[6],Js=v[7],Qs=v[8];T=v[9];const Wn=v[10];C=v[11],R=v[12];const tr=[v[13],v[13]],zn=this.textStates[R],hi=zn.font,ci=[zn.scale[0]*Js,zn.scale[1]*Js];let ui;hi in this.widths_?ui=this.widths_[hi]:(ui={},this.widths_[hi]=ui);const er=zu(h,Ki,ut,2),ir=Math.abs(ci[0])*kr(hi,C,ui);if(Ta||ir<=er){const xt=this.textStates[R].textAlign,ke=(er-ir)*Qn(C,xt),wt=Dd(h,Ki,ut,2,C,ke,wa,Math.abs(ci[0]),kr,hi,ui,L?0:this.viewRotation_);t:if(wt){const Kt=[];let Ct,Zi,Vi,gt,It;if(T)for(Ct=0,Zi=wt.length;Ct<Zi;
10++Ct){It=wt[Ct],Vi=It[4],gt=this.createLabel(Vi,R,"",T),g=It[2]+(ci[0]<0?-Wn:Wn),_=Xn*gt.height+(.5-Xn)*2*Wn*ci[1]/ci[0]-Qs;const Zt=this.calculateImageOrLabelDimensions_(gt.width,gt.height,It[0],It[1],gt.width,gt.height,g,_,0,0,It[3],tr,!1,Ie,!1,D);if(l&&l.collides(Zt.declutterBox))break t;Kt.push([t,e,gt,Zt,1,null,null])}if(w)for(Ct=0,Zi=wt.length;Ct<Zi;++Ct){It=wt[Ct],Vi=It[4],gt=this.createLabel(Vi,R,w,""),g=It[2],_=Xn*gt.height-Qs;const Zt=this.calculateImageOrLabelDimensions_(gt.width,gt.height,It[0],It[1],gt.width,gt.height,g,_,0,0,It[3],tr,!1,Ie,!1,D);if(l&&l.collides(Zt.declutterBox))break t;Kt.push([t,e,gt,Zt,1,null,null])}l&&l.load(Kt.map(qr));for(let Zt=0,Ia=Kt.length;Zt<Ia;++Zt)this.replayImageOrLabel_.apply(this,Kt[Zt])}}++c;break;case b.END_GEOMETRY:if(o!==void 0){D=v[1];const xt=o(D,nt);if(xt)return xt}++c;break;case b.FILL:S?A++:this.fill_(t),++c;break;case b.MOVE_TO_LINE_TO:for(d=v[1],f=v[2],j=h[d],V=h[d+1],y=j+.5|0,x=V+.5|0,(y!==m||x!==p)&&(t.moveTo(j,V),m=y,p=x),d+=2;d<f;d+=2)j=h[d],V=h[d+1],y=j+.5|0,x=V+.5|0,(d==f-2||y!==m||x!==p)&&(t.lineTo(j,V),m=y,p=x);++c;break;case b.SET_FILL_STYLE:z=v,this.alignFill_=v[2],A&&(this.fill_(t),A=0,P&&(t.stroke(),P=0)),t.fillStyle=v[1],++c;break;case b.SET_STROKE_STYLE:G=v,P&&(t.stroke(),P=0),this.setStrokeStyle_(t,v),++c;break;case b.STROKE:S?P++:t.stroke(),++c;break;default:++c;break}}A&&this.fill_(t),P&&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,1,e,this.hitDetectionInstructions,!0,s,r)}}const Nd=kd,ts=["Polygon","Circle","LineString","Image","Text","Default"];class Gd{constructor(t,e,i,s,r,o){this.maxExtent_=t,this.overlaps_=s,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=Xt(),this.createExecutors_(r)}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){for(const e in t){let i=this.executorsByZIndex_[e];i===void 0&&(i={},this.executorsByZIndex_[e]=i);const s=t[e];for(const r in s){const o=s[r];i[r]=new Nd(this.resolution_,this.pixelRatio_,this.overlaps_,o)}}}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){s=Math.round(s);const a=s*2+1,l=_e(this.hitDetectionTransform_,s+.5,s+.5,1/e,-1/e,-i,-t[0],-t[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=dt(a,a,void 0,{willReadFrequently:!0}));const c=this.hitDetectionContext_;c.canvas.width!==a||c.canvas.height!==a?(c.canvas.width=a,c.canvas.height=a):h||c.clearRect(0,0,a,a);let u;this.renderBuffer_!==void 0&&(u=bt(),mi(u,t),xs(u,e*(this.renderBuffer_+s),u));const d=Xd(s);let f;function g(C,R){const T=c.getImageData(0,0,a,a).data;for(let w=0,A=d.length;w<A;w++)if(T[d[w]]>0){if(!o||f!=="Image"&&f!=="Text"||o.includes(C)){const P=(d[w]-3)/4,z=s-P%a,G=s-(P/a|0),k=r(C,R,z*z+G*G);if(k)return k}c.clearRect(0,0,a,a);break}}const _=Object.keys(this.executorsByZIndex_).map(Number);_.sort(Le);let m,p,y,x,E;for(m=_.length-1;m>=0;--m){const C=_[m].toString();for(y=this.executorsByZIndex_[C],p=ts.length-1;p>=0;--p)if(f=ts[p],x=y[f],x!==void 0&&(E=x.executeHitDetection(c,l,i,g,u),E))return E}}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 Se(a,0,8,2,t,a),a}isEmpty(){return xi(this.executorsByZIndex_)}execute(t,e,i,s,r,o,a){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(Le),this.maxExtent_&&(t.save(),this.clip(t,i)),o=o||ts;let h,c,u,d,f,g;for(a&&l.reverse(),h=0,c=l.length;h<c;++h){const _=l[h].toString();for(f=this.executorsByZIndex_[_],u=0,d=o.length;u<d;++u){const m=o[u];g=f[m],g!==void 0&&g.execute(t,e,i,s,r,a)}}this.maxExtent_&&t.restore()}}const es={};function Xd(n){if(es[n]!==void 0)return es[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 es[n]=s,s}const Qr=Gd;
10class Wd extends Ea{constructor(t,e,i,s,r,o,a){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=s,this.transformRotation_=s?Cs(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_=Xt()}drawImages_(t,e,i,s){if(!this.image_)return;const r=Se(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 h=this.imageRotation_;this.transformRotation_===0&&(h-=this.viewRotation_),this.imageRotateWithView_&&(h+=this.viewRotation_);for(let c=0,u=r.length;c<u;c+=2){const d=r[c]-this.imageAnchorX_,f=r[c+1]-this.imageAnchorY_;if(h!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const g=d+this.imageAnchorX_,_=f+this.imageAnchorY_;_e(a,g,_,1,1,h,-g,-_),o.save(),o.transform.apply(o,a),o.translate(g,_),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.restore()}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,d,f,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(t,e,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=Se(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_,h=r[e+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.save(),o.translate(l-this.textOffsetX_,h-this.textOffsetY_),o.rotate(a),o.translate(this.textOffsetX_,this.textOffsetY_),o.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&o.strokeText(this.text_,0,0),this.textFillState_&&o.fillText(this.text_,0,0),o.restore()):(this.textStrokeState_&&o.strokeText(this.text_,l,h),this.textFillState_&&o.fillText(this.text_,l,h))}}moveToLineTo_(t,e,i,s,r){const o=this.context_,a=Se(t,e,i,s,this.transform_,this.pixelCoordinates_);o.moveTo(a[0],a[1]);let l=a.length;r&&(l-=2);for(let h=2;h<l;h+=2)o.lineTo(a[h],a[h+1]);return r&&o.closePath(),i}drawRings_(t,e,i,s){for(let r=0,o=i.length;r<o;++r)e=this.moveToLineTo_(t,e,i[r],s,!0);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!pt(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=Bh(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_)),!!pt(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(i,0,i.length,t.getStride(),!1),e.stroke()}if(this.text_!==""){const e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getExtent();if(pt(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,h=o.length;l<h;++l)r=this.moveToLineTo_(s,r,o[l],a,!1);i.stroke()}if(this.text_!==""){const i=t.getFlatMidpoints();this.drawText_(i,0,i.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!pt(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride()),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){const e=t.getFlatInteriorPoint();this.drawText_(e,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!pt(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getOrientedFlatCoordinates();let s=0;const r=t.getEndss(),o=t.getStride();e.beginPath();for(let a=0,l=r.length;a<l;++a){const h=r[a];s=this.drawRings_(i,s,h,o)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,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),me(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:vi;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:Gt(i||mt)}}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(),h=e.getMiterLimit(),c=r||qt;this.strokeState_={lineCap:s!==void 0?s:ni,lineDash:this.pixelRatio_===1?c:c.map(u=>u*this.pixelRatio_),lineDashOffset:(o||Jt)*this.pixelRatio_,lineJoin:a!==void 0?a:si,lineWidth:(l!==void 0?l:Si)*this.pixelRatio_,miter
10Limit:h!==void 0?h:wi,strokeStyle:Gt(i||Ii)}}}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 f=e.getColor();this.textFillState_={fillStyle:Gt(f||mt)}}const i=t.getStroke();if(!i)this.textStrokeState_=null;else{const f=i.getColor(),g=i.getLineCap(),_=i.getLineDash(),m=i.getLineDashOffset(),p=i.getLineJoin(),y=i.getWidth(),x=i.getMiterLimit();this.textStrokeState_={lineCap:g!==void 0?g:ni,lineDash:_||qt,lineDashOffset:m||Jt,lineJoin:p!==void 0?p:si,lineWidth:y!==void 0?y:Si,miterLimit:x!==void 0?x:wi,strokeStyle:Gt(f||Ii)}}const s=t.getFont(),r=t.getOffsetX(),o=t.getOffsetY(),a=t.getRotateWithView(),l=t.getRotation(),h=t.getScaleArray(),c=t.getText(),u=t.getTextAlign(),d=t.getTextBaseline();this.textState_={font:s!==void 0?s:$o,textAlign:u!==void 0?u:vi,textBaseline:d!==void 0?d:_n},this.text_=c!==void 0?Array.isArray(c)?c.reduce((f,g,_)=>f+=_%2?" ":g,""):c:"",this.textOffsetX_=r!==void 0?this.pixelRatio_*r:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*h[0],this.pixelRatio_*h[1]]}}}const zd=Wd,kt=.5;function Yd(n,t,e,i,s,r,o){const a=n[0]*kt,l=n[1]*kt,h=dt(a,l);h.imageSmoothingEnabled=!1;const c=h.canvas,u=new zd(h,kt,s,null,o),d=e.length,f=Math.floor((256*256*256-1)/d),g={};for(let m=1;m<=d;++m){const p=e[m-1],y=p.getStyleFunction()||i;if(!y)continue;let x=y(p,r);if(!x)continue;Array.isArray(x)||(x=[x]);const C=(m*f).toString(16).padStart(7,"#00000");for(let R=0,T=x.length;R<T;++R){const w=x[R],A=w.getGeometryFunction()(p);if(!A||!pt(s,A.getExtent()))continue;const P=w.clone(),z=P.getFill();z&&z.setColor(C);const G=P.getStroke();G&&(G.setColor(C),G.setLineDash(null)),P.setText(void 0);const k=w.getImage();if(k){const S=k.getImageSize();if(!S)continue;const D=dt(S[0],S[1],void 0,{alpha:!1}),j=D.canvas;D.fillStyle=C,D.fillRect(0,0,j.width,j.height),P.setImage(new Us({img:j,anchor:k.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:k.getOrigin(),opacity:1,size:k.getSize(),scale:k.get
10Scale(),rotation:k.getRotation(),rotateWithView:k.getRotateWithView()}))}const it=P.getZIndex()||0;let L=g[it];L||(L={},g[it]=L,L.Polygon=[],L.Circle=[],L.LineString=[],L.Point=[]);const O=A.getType();if(O==="GeometryCollection"){const S=A.getGeometriesArrayRecursive();for(let D=0,j=S.length;D<j;++D){const V=S[D];L[V.getType().replace("Multi","")].push(V,P)}}else L[O.replace("Multi","")].push(A,P)}}const _=Object.keys(g).map(Number).sort(Le);for(let m=0,p=_.length;m<p;++m){const y=g[_[m]];for(const x in y){const E=y[x];for(let C=0,R=E.length;C<R;C+=2){u.setStyle(E[C+1]);for(let T=0,w=t.length;T<w;++T)u.setTransform(t[T]),u.drawGeometry(E[C])}}}return h.getImageData(0,0,c.width,c.height)}function Bd(n,t,e){const i=[];if(e){const s=Math.floor(Math.round(n[0])*kt),r=Math.floor(Math.round(n[1])*kt),o=(et(s,0,e.width-1)+et(r,0,e.height-1)*e.width)*4,a=e.data[o],l=e.data[o+1],c=e.data[o+2]+256*(l+256*a),u=Math.floor((256*256*256-1)/t.length);c&&c%u===0&&i.push(t[c/u-1])}return i}const Kd=.5,Ca={Point:Qd,LineString:$d,Polygon:ef,MultiPoint:tf,MultiLineString:qd,MultiPolygon:Jd,GeometryCollection:Hd,Circle:Ud};function Zd(n,t){return parseInt(B(n),10)-parseInt(B(t),10)}function Vd(n,t){const e=_s(n,t);return e*e}function _s(n,t){return Kd*n/t}function Ud(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)}const a=e.getText();if(a&&a.getText()){const l=(s||n).getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i)}}function to(n,t,e,i,s,r,o){let a=!1;const l=e.getImage();if(l){const h=l.getImageState();h==q.LOADED||h==q.ERROR?l.unlistenImageChange(s):(h==q.IDLE&&l.load(),l.listenImageChange(s),a=!0)}return jd(n,t,e,i,r,o),a}function jd(n,t,e,i,s,r){const o=e.getGeometryFunction()(t);if(!o)return;const a=o.simplifyTransformed(i,s);if(e.getRenderer())Ra(n,a,e,t);else{const h=Ca[a.getType()];h(n,a,e,t,r)}}function Ra(n,t,e,i){if(t.getType()=="GeometryCollection"){const r=t.getGeometries();for(let o=0,a=r.length;o<a;++o)Ra(n,r[o],e,i);return}n.getBuilder(e.getZIndex(),"Default").drawCustom(t,i,e.getRenderer(),e.getHitDetectionRenderer())}function Hd(n,t,e,i,s){const r=t.getGeometriesArray();let o,a;for(o=0,a=r.length;o<a;++o){const l=Ca[r[o].getType()];l(n,r[o],e,i,s)}}function $d(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)}const o=e.getText();if(o&&o.getText()){const a=(s||n).getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,i)}}function qd(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)}const o=e.getText();if(o&&o.getText()){const a=(s||n).getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,i)}}function Jd(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)}const a=e.getText();if(a&&a.getText()){const l=(s||n).getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i)}}function Qd(n,t,e,i,s){const r=e.getImage(),o=e.getText();let a;if(r){if(r.getImageState()!=q.LOADED)return;let l=n;if(s){const c=r.getDeclutterMode();if(c!=="none")if(l=s,c==="obstacle"){const u=n.getBuilder(e.getZIndex(),"Image");u.setImageStyle(r,a),u.drawPoint(t,i)}else o&&o.getText()&&(a={})}const h=l.getBuilder(e.getZIndex(),"Image");h.setImageStyle(r,a),h.drawPoint(t,i)}if(o&&o.getText()){let l=n;s&&(l=s);const h=l.getBuilder(e.getZIndex(),"Text");h.setTextStyle(o,a),h.drawText(t,i)}}function tf(n,t,e,i,s){const r=e.getImage(),o=e.getText();let a;if(r){if(r.getImageState()!=q.LOADED)return;let l=n;if(s){const c=r.getDeclutterMode();if(c!=="none")if(l=s,c==="obstacle"){const u=n.getBuilder(e.getZIndex(),"Image");u.setImageStyle(r,a),u.drawMultiPoint(t,i)}else o&&o.getText()&&(a={})}const h=l.getBuilder(e.getZIndex(),"Image");h.setImageStyle(r,a),h.drawMultiPoint(t,i)}if(o&&o.getText()){let l=n;s&&(l=s);const h=l.getBuilder(e.getZIndex(),"Text");h.setTextStyle(o,a),h.drawText(t,i)}}
10function ef(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)}const a=e.getText();if(a&&a.getText()){const l=(s||n).getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i)}}class nf extends xa{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=bt(),this.wrappedRenderedExtent_=bt(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedRenderOrder_=null,this.replayGroup_=null,this.replayGroupChanged=!0,this.declutterExecutorGroup=null,this.clipping=!0,this.compositionContext_=null,this.opacity_=1}renderWorlds(t,e,i){const s=e.extent,r=e.viewState,o=r.center,a=r.resolution,l=r.projection,h=r.rotation,c=l.getExtent(),u=this.getLayer().getSource(),d=e.pixelRatio,f=e.viewHints,g=!(f[ct.ANIMATING]||f[ct.INTERACTING]),_=this.compositionContext_,m=Math.round(e.size[0]*d),p=Math.round(e.size[1]*d),y=u.getWrapX()&&l.canWrapX(),x=y?J(c):null,E=y?Math.ceil((s[2]-c[2])/x)+1:1;let C=y?Math.floor((s[0]-c[0])/x):0;do{const R=this.getRenderTransform(o,a,h,d,m,p,C*x);t.execute(_,1,R,h,g,void 0,i)}while(++C<E)}setupCompositionContext_(){if(this.opacity_!==1){const t=dt(this.context.canvas.width,this.context.canvas.height,$r);this.compositionContext_=t}else this.compositionContext_=this.context}releaseCompositionContext_(){if(this.opacity_!==1){const t=this.context.globalAlpha;this.context.globalAlpha=this.opacity_,this.context.drawImage(this.compositionContext_.canvas,0,0),this.context.globalAlpha=t,wn(this.compositionContext_),$r.push(this.compositionContext_.canvas),this.compositionContext_=null}}renderDeclutter(t){this.declutterExecutorGroup&&(this.setupCompositionContext_(),this.renderWorlds(this.declutterExecutorGroup,t,t.declutterTree),this.releaseCompositionContext_())}renderFrame(t,e){const i=t.pixelRatio,s=t.layerStatesArray[t.layerIndex];Th(this.pixelTransform,1/i,1/i),As(this.inversePixelTransform,this.pixelTransform);const r=No(this.pixelTransform);this.useContainer(e,r,this.getBackground(t));const o=this.context,a=o.canvas,l=this.replayGroup_,h=this.declutterExecutorGroup;let c=l&&!l.isEmpty()||h&&!h.isEmpty();if(!c&&!(this.getLayer().hasListener(Wt.PRERENDER)||this.getLayer().hasListener(Wt.POSTRENDER)))return null;const u=Math.round(t.size[0]*i),d=Math.round(t.size[1]*i);a.width!=u||a.height!=d?(a.width=u,a.height=d,a.style.transform!==r&&(a.style.transform=r)):this.containerReused||o.clearRect(0,0,u,d),this.preRender(o,t);const f=t.viewState;f.projection,this.opacity_=s.opacity,this.setupCompositionContext_();let g=!1;if(c&&s.extent&&this.clipping){const _=Te(s.extent);c=pt(_,t.extent),g=c&&!Re(_,t.extent),g&&this.clipUnrotated(this.compositionContext_,t,_)}return c&&this.renderWorlds(l,t),g&&this.compositionContext_.restore(),this.releaseCompositionContext_(),this.postRender(o,t),this.renderedRotation_!==f.rotation&&(this.renderedRotation_=f.rotation,this.hitDetectionImageData_=null),this.container}getFeatures(t){return new Promise(e=>{if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const i=[this.context.canvas.width,this.context.canvas.height];rt(this.pixelTransform,i);const s=this.renderedCenter_,r=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,h=this.getLayer(),c=[],u=i[0]*kt,d=i[1]*kt;c.push(this.getRenderTransform(s,r,o,kt,u,d,0).slice());const f=h.getSource(),g=a.getExtent();if(f.getWrapX()&&a.canWrapX()&&!Re(g,l)){let _=l[0];const m=J(g);let p=0,y;for(;_<g[0];)--p,y=m*p,c.push(this.getRenderTransform(s,r,o,kt,u,d,y).slice()),_+=m;for(p=0,_=l[2];_>g[2];)++p,y=m*p,c.push(this.getRenderTransform(s,r,o,kt,u,d,y).slice()),_-=m}this.hitDetectionImageData_=Yd(i,c,this.renderedFeatures_,h.getStyleFunction(),l,r,o)}e(Bd(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,s,r){if(!this.replayGroup_)return;const o=e.viewState.resolution,a=e.viewState.rotation,l=this.getLayer(),h={}
10,c=function(f,g,_){const m=B(f),p=h[m];if(p){if(p!==!0&&_<p.distanceSq){if(_===0)return h[m]=!0,r.splice(r.lastIndexOf(p),1),s(f,l,g);p.geometry=g,p.distanceSq=_}}else{if(_===0)return h[m]=!0,s(f,l,g);r.push(h[m]={feature:f,layer:l,geometry:g,distanceSq:_,callback:s})}};let u;const d=[this.replayGroup_];return this.declutterExecutorGroup&&d.push(this.declutterExecutorGroup),d.some(f=>u=f.forEachFeatureAtCoordinate(t,o,a,i,c,f===this.declutterExecutorGroup&&e.declutterTree?e.declutterTree.all().map(g=>g.value):null)),u}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[ct.ANIMATING],r=t.viewHints[ct.INTERACTING],o=e.getUpdateWhileAnimating(),a=e.getUpdateWhileInteracting();if(this.ready&&!o&&s||!a&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const l=t.extent,h=t.viewState,c=h.projection,u=h.resolution,d=t.pixelRatio,f=e.getRevision(),g=e.getRenderBuffer();let _=e.getRenderOrder();_===void 0&&(_=Zd);const m=h.center.slice(),p=xs(l,g*u),y=p.slice(),x=[p.slice()],E=c.getExtent();if(i.getWrapX()&&c.canWrapX()&&!Re(E,t.extent)){const L=J(E),O=Math.max(J(p)/2,L);p[0]=E[0]-O,p[2]=E[2]+O,Eo(m,c);const S=po(x[0],c);S[0]<E[0]&&S[2]<E[2]?x.push([S[0]+L,S[1],S[2]+L,S[3]]):S[0]>E[0]&&S[2]>E[2]&&x.push([S[0]-L,S[1],S[2]-L,S[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==f&&this.renderedRenderOrder_==_&&Re(this.wrappedRenderedExtent_,p))return me(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=m,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const C=new Hr(_s(u,d),p,u,d);let R;this.getLayer().getDeclutter()&&(R=new Hr(_s(u,d),p,u,d));let T;for(let L=0,O=x.length;L<O;++L)i.loadFeatures(x[L],u,c);const w=Vd(u,d);let A=!0;const P=L=>{let O;const S=L.getStyleFunction()||e.getStyleFunction();if(S&&(O=S(L,u)),O){const D=this.renderFeature(L,w,O,C,T,R);A=A&&!D}},z=Io(p),G=i.getFeaturesInExtent(z);_&&G.sort(_);for(let L=0,O=G.length;L<O;++L)P(G[L]);this.renderedFeatures_=G,this.ready=A;const k=C.finish(),it=new Qr(p,u,d,i.getOverlaps(),k,e.getRenderBuffer());return R&&(this.declutterExecutorGroup=new Qr(p,u,d,i.getOverlaps(),R.finish(),e.getRenderBuffer())),this.renderedResolution_=u,this.renderedRevision_=f,this.renderedRenderOrder_=_,this.renderedExtent_=y,this.wrappedRenderedExtent_=p,this.renderedCenter_=m,this.renderedProjection_=c,this.replayGroup_=it,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,s,r,o){if(!i)return!1;let a=!1;if(Array.isArray(i))for(let l=0,h=i.length;l<h;++l)a=to(s,t,i[l],e,this.boundHandleStyleImageChange_,r,o)||a;else a=to(s,t,i,e,this.boundHandleStyleImageChange_,r,o);return a}}const sf=nf;class rf extends pd{constructor(t){super(t)}createRenderer(){return new sf(this)}}const of=rf,sn={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class af extends On{constructor(t){t=t||{};const e=Object.assign({},t);delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.setPreload(t.preload!==void 0?t.preload:0),this.setUseInterimTilesOnError(t.useInterimTilesOnError!==void 0?t.useInterimTilesOnError:!0)}getPreload(){return this.get(sn.PRELOAD)}setPreload(t){this.set(sn.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(sn.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(sn.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}}const lf=af;class hf extends xa{constructor(t){super(t),this.extentChanged=!0,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedRevision,this.renderedTiles=[],this.newTiles_=!1,this.tmpExtent=bt(),this.tmpTileRange_=new Mo(0,0,0,0)}isDrawableTile(t){const e=this.getLayer(),i=t.getState(),s=e.getUseInterimTilesOnError();return i==M.LOADED||i==M.EMPTY||i==M.ERROR&&!s}getTile(t,e,i,s){const r=s.pixelRatio,o=s.viewState.projection,a=this.getLayer();let h=a.getSource().getTile(t,e,i,r,o);return h.getState()==M.ERROR&&a.getUseInterimTilesOnError()&&a.getPreload()>0&&(this.newTiles_=!0),this.isDrawableTile(h)||(h=h.getInterimTile()),h}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),s=rt(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!In(r,s))return null;const o=e.pixelRatio,a=e.viewState.projection,l=e.viewState,h=i.getRenderSource(),c=h.getTileGridForProjection(l.projection),u=h.getTilePixelRatio(e.pixelRatio);for(let d=c.getZForResolution(l.resolution);d>=c.getMinZoom();--d){const f=c.getTileCoordForCoordAndZ(s,d),g=h.getTile(d,f[1],f[2],o,a);if(!(g instanceof co||g instanceof hs)||g instanceof hs&&g.getState()===M.EMPTY)return null;if(g.getState()!==M.LOADED)continue;const _=c.getOrigin(d),m=Rt(c.getTileSize(d)),p=c.getResolution(d),y=Math.floor(u*((s[0]-_[0])/p-f[1]*m[0])),x=Math.floor(u*((_[1]-s[1])/p-f[2]*m[1])),E=Math.round(u*h.getGutterForProjection(l.projection));return this.getImageData(g.getImage(),y+E,x+E)}return null}loadedTileCallback(t,e,i){return this.isDrawableTile(i)?super.loadedTileCallback(t,e,i):!1}prepareFrame(t){return!!this.getLayer().getSource()}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex],s=t.viewState,r=s.projection,o=s.resolution,a=s.center,l=s.rotation,h=t.pixelRatio,c=this.getLayer(),u=c.getSource(),d=u.getRevision(),f=u.getTileGridForProjection(r),g=f.getZForResolution(o,u.zDirection),_=f.getResolution(g);let m=t.extent;const p=t.viewState.resolution,y=u.getTilePixelRatio(h),x=Math.round(J(m)/p*h),E=Math.round(zt(m)/p*h),C=i.extent&&Te(i.extent);C&&(m=pi(m,Te(i.extent)));const R=_*x/2/y,T=_*E/2/y,w=[a[0]-R,a[1]-T,a[0]+R,a[1]+T],A=f.getTileRangeForExtentAndZ(m,g),P={};P[g]={};const z=this.createLoadedTileFinder(u,r,P),G=this.tmpExtent,k=this.tmpTileRange_;this.newTiles_=!1;const it=l?rs(s.center,p,l,t.size):void 0;for(let Et=A.minX;Et<=A.maxX;++Et)for(let K=A.minY;K<=A.maxY;++K){if(l&&!f.tileCoordIntersectsViewport([g,Et,K],it))continue;const H=this.getTile(g,Et,K,t);if(this.isDrawableTile(H)){const ot=B(this);if(H.getState()==M.LOADED){P[g][H.tileCoord.toString()]=H;let Yt=H.inTransition(ot);Yt&&i.opacity!==1&&(H.endTransition(ot),Yt=!1),!this.newTiles_&&(Yt||!this.renderedTiles.includes(H))&&(this.newTiles_=!0)}if(H.getAlpha(ot,t.time)===1)continue}const te=f.getTileCoordChildTileRange(H.tileCoord,k,G);let Dt=!1;te&&(Dt=z(g+1,te)),Dt||f.forEachTileCoordParentTileRange(H.tileCoord,z,k,G)}const L=_/o*h/y;_e(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/h,1/h,l,-x/2,-E/2);const O=No(this.pixelTransform);
10this.useContainer(e,O,this.getBackground(t));const S=this.context,D=S.canvas;As(this.inversePixelTransform,this.pixelTransform),_e(this.tempTransform,x/2,E/2,L,L,0,-x/2,-E/2),D.width!=x||D.height!=E?(D.width=x,D.height=E):this.containerReused||S.clearRect(0,0,x,E),C&&this.clipUnrotated(S,t,C),u.getInterpolate()||(S.imageSmoothingEnabled=!1),this.preRender(S,t),this.renderedTiles.length=0;let j=Object.keys(P).map(Number);j.sort(Le);let V,nt,v;i.opacity===1&&(!this.containerReused||u.getOpaque(t.viewState.projection))?j=j.reverse():(V=[],nt=[]);for(let Et=j.length-1;Et>=0;--Et){const K=j[Et],H=u.getTilePixelSize(K,h,r),Dt=f.getResolution(K)/_,ot=H[0]*Dt*L,Yt=H[1]*Dt*L,be=f.getTileCoordForCoordAndZ(Me(w),K),Xi=f.getTileCoordExtent(be),Oe=rt(this.tempTransform,[y*(Xi[0]-w[0])/_,y*(w[3]-Xi[3])/_]),Wi=y*u.getGutterForProjection(r),ee=P[K];for(const li in ee){const ie=ee[li],zi=ie.tileCoord,Yi=be[1]-zi[1],Bi=Math.round(Oe[0]-(Yi-1)*ot),Pe=be[2]-zi[2],Gn=Math.round(Oe[1]-(Pe-1)*Yt),ft=Math.round(Oe[0]-Yi*ot),Tt=Math.round(Oe[1]-Pe*Yt),vt=Bi-ft,Bt=Gn-Tt,De=g===K,ye=De&&ie.getAlpha(B(this),t.time)!==1;let ne=!1;if(!ye)if(V){v=[ft,Tt,ft+vt,Tt,ft+vt,Tt+Bt,ft,Tt+Bt];for(let Fe=0,Ki=V.length;Fe<Ki;++Fe)if(g!==K&&K<nt[Fe]){const ut=V[Fe];pt([ft,Tt,ft+vt,Tt+Bt],[ut[0],ut[3],ut[4],ut[7]])&&(ne||(S.save(),ne=!0),S.beginPath(),S.moveTo(v[0],v[1]),S.lineTo(v[2],v[3]),S.lineTo(v[4],v[5]),S.lineTo(v[6],v[7]),S.moveTo(ut[6],ut[7]),S.lineTo(ut[4],ut[5]),S.lineTo(ut[2],ut[3]),S.lineTo(ut[0],ut[1]),S.clip())}V.push(v),nt.push(K)}else S.clearRect(ft,Tt,vt,Bt);this.drawTileImage(ie,t,ft,Tt,vt,Bt,Wi,De),V&&!ye?(ne&&S.restore(),this.renderedTiles.unshift(ie)):this.renderedTiles.push(ie),this.updateUsedTiles(t.usedTiles,u,ie)}}return this.renderedRevision=d,this.renderedResolution=_,this.extentChanged=!this.renderedExtent_||!Ci(this.renderedExtent_,w),this.renderedExtent_=w,this.renderedPixelRatio=h,this.renderedProjection=r,this.manageTilePyramid(t,u,f,h,r,m,g,c.getPreload()),this.scheduleExpireCache(t,u),this.postRender(S,t),i.extent&&S.restore(),S.imageSmoothingEnabled=!0,O!==D.style.transform&&(D.style.transform=O),this.container}drawTileImage(t,e,i,s,r,o,a,l){const h=this.getTileImage(t);if(!h)return;const c=B(this),u=e.layerStatesArray[e.layerIndex],d=u.opacity*(l?t.getAlpha(c,e.time):1),f=d!==this.context.globalAlpha;f&&(this.context.save(),this.context.globalAlpha=d),this.context.drawImage(h,a,a,h.width-2*a,h.height-2*a,i,s,r,o),f&&this.context.restore(),d!==u.opacity?e.animate=!0:l&&t.endTransition(c)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}scheduleExpireCache(t,e){if(e.canExpireCache()){const i=function(s,r,o){const a=B(s);a in o.usedTiles&&s.expireCache(o.viewState.projection,o.usedTiles[a])}.bind(null,e);t.postRenderFunctions.push(i)}}updateUsedTiles(t,e,i){const s=B(e);s in t||(t[s]={}),t[s][i.getKey()]=!0}manageTilePyramid(t,e,i,s,r,o,a,l,h){const c=B(e);c in t.wantedTiles||(t.wantedTiles[c]={});const u=t.wantedTiles[c],d=t.tileQueue,f=i.getMinZoom(),g=t.viewState.rotation,_=g?rs(t.viewState.center,t.viewState.resolution,g,t.size):void 0;let m=0,p,y,x,E,C,R;for(R=f;R<=a;++R)for(y=i.getTileRangeForExtentAndZ(o,R,y),x=i.getResolution(R),E=y.minX;E<=y.maxX;++E)for(C=y.minY;C<=y.maxY;++C)g&&!i.tileCoordIntersectsViewport([R,E,C],_)||(a-R<=l?(++m,p=e.getTile(R,E,C,s,r),p.getState()==M.IDLE&&(u[p.getKey()]=!0,d.isKeyQueued(p.getKey())||d.enqueue([p,c,i.getTileCoordCenter(p.tileCoord),x])),h!==void 0&&h(p)):e.useTile(R,E,C,r));e.updateCacheSize(m,r)}}const cf=hf;class uf extends lf{constructor(t){super(t)}createRenderer(){return new cf(this)}}const df=uf,ff={class:"sv-map"},gf=nr("div",{id:"sv-map"},[nr("div",{id:"sv-map-popup"})],-1),_f=[gf],mf="/ui/svg/location-dot-solid.svg",Ef=va({__name:"SvMap",props:{lat:{},lon:{},name:{},address:{}},setup(n){const t=n;let e;const i=()=>{e.classList.contains("show")&&e.classList.remove("show")},s={format:"json",addressdetails:1,q:t.address?.trim(),limit:1};let r,o;const a=Sa(!1),l=()=>{fetch("https://nominatim.openstreetmap.org?"+new URLSearchParams(s)).then(function(c){if(!c.ok)throw new Error("Response was not OK");return c.json()}).then(function(c){c.length&&(o=parseFloat(c[0].lat),r=parseFloat(c[0].lon),o&&r&&(a.value=!0,h()))}).catch(c=>{console.error("Error:",c)})};La(()=>{!t.lat||!t.lon?t.address?.trim()!=""&&l():(o=parseFloat(t.lat.replace(",",".")),r=parseFloat(t.lon.replace(",",".")),o&&r&&(a.value=!0,h()))});const h=()=>{e=document.querySelector("#sv-map-popup");const c=new Ba({geometry:new Vo(fr([r,o])),name:t.name??""}),u=new yi({image:new Us({anchor:[.5,36],anchorXUnits:"fraction",anchorYUnits:"pixels",src:mf})});c.setStyle(u);const d=new Du({features:[c]}),f=new of({source:d}),g=new Eu({layers:[new df({source:new Eh}),f],target:document.querySelector("#sv-map"),view:new Ft({center:fr([r,o]),zoom:12})}),_=new Cu({element:e,positioning:"bottom-center",stopEvent:!1,offset:[0,-20]});g.addOverlay(_),g.on("click",function(m){const p=g.forEachFeatureAtPixel(m.pixel,function(y){return y});i(),p&&(_.setPosition(m.coordinate),e.classList.add("show"),e.innerHTML=p.get("name"))}),g.on("pointermove",function(m){const p=g.getEventPixel(m.originalEvent),y=g.hasFeatureAtPixel(p);g.getTarget().style.cursor=y?"pointer":""}),g.on("movestart",i)};return(c,u)=>Aa((ba(),Oa("div",ff,_f,512)),[[Ma,a.value]])}});
10export{Ef as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.