wertyz-vue 3.10.21 → 3.10.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/wMapNext.js CHANGED
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("ol/Map"),require("ol/View"),require("ol/proj"),require("ol/source"),require("ol/layer/Tile"),require("ol/source/Vector"),require("ol/layer/VectorImage"),require("ol/layer/Vector"),require("ol-ext/layer/AnimatedCluster"),require("ol/geom"),require("ol/Feature"),require("ol/style"),require("ol/Overlay"),require("ol/extent"),require("ol/interaction/Modify"),require("ol/interaction/Draw"),require("ol/events/condition"),require("ol-contextmenu/dist/ol-contextmenu.js")):"function"==typeof define&&define.amd?define("wertyzvue",["ol/Map","ol/View","ol/proj","ol/source","ol/layer/Tile","ol/source/Vector","ol/layer/VectorImage","ol/layer/Vector","ol-ext/layer/AnimatedCluster","ol/geom","ol/Feature","ol/style","ol/Overlay","ol/extent","ol/interaction/Modify","ol/interaction/Draw","ol/events/condition","ol-contextmenu/dist/ol-contextmenu.js"],e):"object"==typeof exports?exports.wertyzvue=e(require("ol/Map"),require("ol/View"),require("ol/proj"),require("ol/source"),require("ol/layer/Tile"),require("ol/source/Vector"),require("ol/layer/VectorImage"),require("ol/layer/Vector"),require("ol-ext/layer/AnimatedCluster"),require("ol/geom"),require("ol/Feature"),require("ol/style"),require("ol/Overlay"),require("ol/extent"),require("ol/interaction/Modify"),require("ol/interaction/Draw"),require("ol/events/condition"),require("ol-contextmenu/dist/ol-contextmenu.js")):t.wertyzvue=e(t["ol/Map"],t["ol/View"],t["ol/proj"],t["ol/source"],t["ol/layer/Tile"],t["ol/source/Vector"],t["ol/layer/VectorImage"],t["ol/layer/Vector"],t["ol-ext/layer/AnimatedCluster"],t["ol/geom"],t["ol/Feature"],t["ol/style"],t["ol/Overlay"],t["ol/extent"],t["ol/interaction/Modify"],t["ol/interaction/Draw"],t["ol/events/condition"],t["ol-contextmenu/dist/ol-contextmenu.js"])}(self,(t,i,n,s,r,o,a,l,h,c,u,d,g,f,p,_,m,y)=>(()=>{"use strict";var x={1005:t=>{t.exports=a},1189:t=>{t.exports=i},1273:t=>{t.exports=s},1849:t=>{t.exports=d},2085:t=>{t.exports=h},2418:t=>{t.exports=u},2617:t=>{t.exports=o},2948:t=>{t.exports=g},3139:t=>{t.exports=_},4275:t=>{t.exports=m},5327:t=>{t.exports=y},5922:t=>{t.exports=r},5993:t=>{t.exports=l},7604:t=>{t.exports=c},7963:t=>{t.exports=p},8218:e=>{e.exports=t},8407:t=>{t.exports=n},8432:t=>{t.exports=f}},S={};function v(t){var e=S[t];if(void 0!==e)return e.exports;var i=S[t]={exports:{}};return x[t](i,i.exports,v),i.exports}v.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return v.d(e,{a:e}),e},v.d=(t,e)=>{for(var i in e)v.o(e,i)&&!v.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},v.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),v.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var w={};v.r(w),v.d(w,{ClusterLayerWrapper:()=>ph,ContextMenuWrapper:()=>Fh,ContextMenuWrapperItem:()=>kh,Control:()=>Lh,DrawCircleWrapper:()=>Th,DrawPolygonWrapper:()=>bh,DrawWrapper:()=>Eh,FeatureCircleBuilder:()=>xh,FeatureLineStringBuilder:()=>Sh,FeaturePointBuilder:()=>mh,FeaturePolygonBuilder:()=>yh,GEOMETRY:()=>rh,Interaction:()=>Ih,LayerWrapper:()=>fh,MapControl:()=>Ah,MapProcessor:()=>uh,MapProcessorCluster:()=>dh,MapWrapper:()=>gh,ModifyWrapper:()=>Rh,OverlayWrapper:()=>vh,Processor:()=>ch,SelectWrapper:()=>Mh,calculateCentroid:()=>Ch,calculateDistance:()=>lh,calculateDistanceLine:()=>hh,calculateMidPoint:()=>wh,prepareLatitude:()=>oh,prepareLongitude:()=>ah});var C=v(8218),I=v.n(C),M=v(1189),R=v.n(M),E=v(8407),b=v(1273),T=v(5922),L=v.n(T),A=v(2617),k=v.n(A),F=v(1005),O=v.n(F),P=v(5993),D=v.n(P),W=v(2085),G=v.n(W),z=v(7604),B=v(2418),N=v.n(B),Y=v(1849),X=v(2948),V=v.n(X),Z=v(8432),j=v(7963),K=v.n(j),q=v(3139),$=v.n(q);const H="add",U="remove",J="propertychange",Q="change";const tt=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function et(t,e){return t>e?1:t<e?-1:0}function it(t,e){return t<e?1:t>e?-1:0}function nt(t,e,i){if(t[0]<=e)return 0;const n=t.length;if(e<=t[n-1])return n-1;if("function"==typeof i){for(let s=1;s<n;++s){const n=t[s];if(n===e)return s;if(n<e)return i(e,t[s-1],n)>0?s-1:s}return n-1}if(i>0){for(let i=1;i<n;++i)if(t[i]<e)return i-1;return n-1}if(i<0){for(let i=1;i<n;++i)if(t[i]<=e)return i;return n-1}for(let i=1;i<n;++i){if(t[i]==e)return i;if(t[i]<e)return t[i-1]-e<e-t[i]?i-1:i}return n-1}function st(t,e,i){for(;e<i;){const n=t[e];t[e]=t[i],t[i]=n,++e,--i}}function rt(t,e){const i=Array.isArray(e)?e:[e],n=i.length;for(let e=0;e<n;e++)t[t.length]=i[e]}function ot(t,e){const i=t.length;if(i!==e.length)return!1;for(let n=0;n<i;n++)if(t[n]!==e[n])return!1;return!0}function at(){return!0}function lt(){}function ht(t){for(const e in t)delete t[e]}function ct(t){let e;for(e in t)return!1;return!e}const ut=class{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};const dt=class extends tt{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),n=i[t]||(i[t]=[]);n.includes(e)||n.push(e)}dispatchEvent(t){const e="string"==typeof t,i=e?t:t.type,n=this.listeners_&&this.listeners_[i];if(!n)return;const s=e?new ut(t):t;s.target||(s.target=this.eventTarget_||this);const r=this.dispatching_||(this.dispatching_={}),o=this.pendingRemovals_||(this.pendingRemovals_={});let a;i in r||(r[i]=0,o[i]=0),++r[i];for(let t=0,e=n.length;t<e;++t)if(a="handleEvent"in n[t]?n[t].handleEvent(s):n[t].call(this,s),!1===a||s.propagationStopped){a=!1;break}if(0===--r[i]){let t=o[i];for(delete o[i];t--;)this.removeEventListener(i,lt);delete r[i]}return a}disposeInternal(){this.listeners_&&ht(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)}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const n=i.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=lt,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}};function gt(t,e,i,n,s){if(s){const s=i;i=function(r){return t.removeEventListener(e,i),s.call(n??this,r)}}else n&&n!==t&&(i=i.bind(n));const r={target:t,type:e,listener:i};return t.addEventListener(e,i),r}function ft(t,e,i,n){return gt(t,e,i,n,!0)}function pt(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),ht(t))}class _t extends dt{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(Q)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=gt(this,t[s],e);return n}return gt(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const n=t.length;i=new Array(n);for(let s=0;s<n;++s)i[s]=ft(this,t[s],e)}else i=ft(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)!function(t){if(Array.isArray(t))for(let e=0,i=t.length;e<i;++e)pt(t[e]);else pt(t)}(i);else if(Array.isArray(t))for(let i=0,n=t.length;i<n;++i)this.removeEventListener(t[i],e);else this.removeEventListener(t,e)}}_t.prototype.on,_t.prototype.once,_t.prototype.un;const mt=_t;function yt(){throw new Error("Unimplemented abstract method.")}let xt=0;function St(t){return t.ol_uid||(t.ol_uid=String(++xt))}class vt extends ut{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}const wt=class extends mt{constructor(t){super(),this.on,this.once,this.un,St(this),this.values_=null,void 0!==t&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new vt(i,t,e)),i=J,this.hasListener(i)&&this.dispatchEvent(new vt(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const n=this.values_||(this.values_={});if(i)n[t]=e;else{const i=n[t];n[t]=e,i!==e&&this.notify(t,i)}}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],ct(this.values_)&&(this.values_=null),e||this.notify(t,i)}}},Ct="length";class It extends ut{constructor(t,e,i){super(t),this.element=e,this.index=i}}const Mt=class extends wt{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t||[],this.unique_)for(let t=0,e=this.array_.length;t<e;++t)this.assertUnique_(this.array_[t],t);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,i=t.length;e<i;++e)this.push(t[e]);return this}forEach(t){const e=this.array_;for(let i=0,n=e.length;i<n;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(Ct)}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 It(H,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){this.unique_&&this.assertUnique_(t);const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,n=e.length;i<n;++i)if(e[i]===t)return this.removeAt(i)}removeAt(t){if(t<0||t>=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new It(U,e,t)),e}setAt(t,e){if(t>=this.getLength())return void this.insertAt(t,e);if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const i=this.array_[t];this.array_[t]=e,this.dispatchEvent(new It(U,i,t)),this.dispatchEvent(new It(H,e,t))}updateLength_(){this.set(Ct,this.array_.length)}assertUnique_(t,e){for(let i=0,n=this.array_.length;i<n;++i)if(this.array_[i]===t&&i!==e)throw new Error("Duplicate item added to a unique collection")}};function Rt(t,e){if(!t)throw new Error(e)}class Et extends wt{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("function"==typeof t.getSimplifiedGeometry){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new Et(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_&&(pt(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=gt(t,Q,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?function(t){if("function"==typeof t)return t;let e;if(Array.isArray(t))e=t;else{Rt("function"==typeof t.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`");e=[t]}return function(){return e}}(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_()}}const bt=Et,Tt="singleclick";const Lt=function(){return!1},At=function(t){return t.type==Tt},kt=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Ft=0,Ot=1,Pt=0,Dt=1,Wt=2,Gt=4,zt=8,Bt=16;function Nt(t,e,i){return i?(i[0]=t[0]-e,i[1]=t[1]-e,i[2]=t[2]+e,i[3]=t[3]+e,i):[t[0]-e,t[1]-e,t[2]+e,t[3]+e]}function Yt(t,e,i){let n,s;return n=e<t[0]?t[0]-e:t[2]<e?e-t[2]:0,s=i<t[1]?t[1]-i:t[3]<i?i-t[3]:0,n*n+s*s}function Xt(t,e){return Zt(t,e[0],e[1])}function Vt(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]}function Zt(t,e,i){return t[0]<=e&&e<=t[2]&&t[1]<=i&&i<=t[3]}function jt(t,e){const i=t[0],n=t[1],s=t[2],r=t[3],o=e[0],a=e[1];let l=Pt;return o<i?l|=Bt:o>s&&(l|=Gt),a<n?l|=zt:a>r&&(l|=Wt),l===Pt&&(l=Dt),l}function Kt(t,e,i,n,s){return s?(s[0]=t,s[1]=e,s[2]=i,s[3]=n,s):[t,e,i,n]}function qt(t){return Kt(1/0,1/0,-1/0,-1/0,t)}function $t(t,e){e[0]<t[0]&&(t[0]=e[0]),e[0]>t[2]&&(t[2]=e[0]),e[1]<t[1]&&(t[1]=e[1]),e[1]>t[3]&&(t[3]=e[1])}function Ht(t,e,i,n,s){for(;i<n;i+=s)Ut(t,e[i],e[i+1]);return t}function Ut(t,e,i){t[0]=Math.min(t[0],e),t[1]=Math.min(t[1],i),t[2]=Math.max(t[2],e),t[3]=Math.max(t[3],i)}function Jt(t){return[t[0],t[1]]}function Qt(t){return[t[2],t[1]]}function te(t){return[(t[0]+t[2])/2,(t[1]+t[3])/2]}function ee(t,e,i,n,s){const[r,o,a,l,h,c,u,d]=function(t,e,i,n){const s=e*n[0]/2,r=e*n[1]/2,o=Math.cos(i),a=Math.sin(i),l=s*o,h=s*a,c=r*o,u=r*a,d=t[0],g=t[1];return[d-l+u,g-h-c,d-l-u,g-h+c,d+l-u,g+h+c,d+l+u,g+h-c,d-l+u,g-h-c]}(t,e,i,n);return Kt(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 ie(t){return t[3]-t[1]}function ne(t){return[t[0],t[3]]}function se(t){return[t[2],t[3]]}function re(t){return t[2]-t[0]}function oe(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function ae(t){return t[2]<t[0]||t[3]<t[1]}function le(t,e,i,n){if(ae(t))return qt(i);let s=[];if(n>1){const e=t[2]-t[0],i=t[3]-t[1];for(let r=0;r<n;++r)s.push(t[0]+e*r/n,t[1],t[2],t[1]+i*r/n,t[2]-e*r/n,t[3],t[0],t[3]-i*r/n)}else s=[t[0],t[1],t[2],t[1],t[2],t[3],t[0],t[3]];e(s,s,2);const r=[],o=[];for(let t=0,e=s.length;t<e;t+=2)r.push(s[t]),o.push(s[t+1]);return function(t,e,i){return Kt(Math.min.apply(null,t),Math.min.apply(null,e),Math.max.apply(null,t),Math.max.apply(null,e),i)}(r,o,i)}function he(t,e){const i=e.getExtent(),n=te(t);if(e.canWrapX()&&(n[0]<i[0]||n[0]>=i[2])){const e=re(i),s=Math.floor((n[0]-i[0])/e)*e;t[0]-=s,t[2]-=s}return t}function ce(t,e){let i=!0;for(let n=t.length-1;n>=0;--n)if(t[n]!=e[n]){i=!1;break}return i}function ue(t,e){if(e.canWrapX()){const i=re(e.getExtent()),n=function(t,e,i){const n=e.getExtent();let s=0;e.canWrapX()&&(t[0]<n[0]||t[0]>n[2])&&(i=i||re(n),s=Math.floor((t[0]-n[0])/i));return s}(t,e,i);n&&(t[0]-=n*i)}return t}const de="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"",ge=(de.includes("safari")&&!de.includes("chrom")&&(de.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(de)),de.includes("webkit")&&de.includes("edge"),de.includes("macintosh"),"undefined"!=typeof devicePixelRatio&&devicePixelRatio,"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope),fe="undefined"!=typeof Image&&Image.prototype.decode;!function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch{}}();function pe(t,e,i,n){let s;return s=i&&i.length?i.shift():ge?new OffscreenCanvas(t||300,e||300):document.createElement("canvas"),t&&(s.width=t),e&&(s.height=e),s.getContext("2d",n)}let _e;function me(){return _e||(_e=pe(1,1)),_e}const ye={info:1,warn:2,error:3,none:4};let xe=ye.info;const Se={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};const ve=class{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,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_||Se[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_}},we=6378137,Ce=Math.PI*we,Ie=[-Ce,-Ce,Ce,Ce],Me=[-180,-85,180,85],Re=we*Math.log(Math.tan(Math.PI/2));class Ee extends ve{constructor(t){super({code:t,units:"m",extent:Ie,global:!0,worldExtent:Me,getPointResolution:function(t,e){return t/Math.cosh(e[1]/we)}})}}const be=[new Ee("EPSG:3857"),new Ee("EPSG:102100"),new Ee("EPSG:102113"),new Ee("EPSG:900913"),new Ee("http://www.opengis.net/def/crs/EPSG/0/3857"),new Ee("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Te(t,e,i,n){const s=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(s));for(let i=0;i<s;i+=n){e[i]=Ce*t[i]/180;let n=we*Math.log(Math.tan(Math.PI*(+t[i+1]+90)/360));n>Re?n=Re:n<-Re&&(n=-Re),e[i+1]=n}return e}function Le(t,e,i,n){const s=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(s));for(let i=0;i<s;i+=n)e[i]=180*t[i]/Ce,e[i+1]=360*Math.atan(Math.exp(t[i+1]/we))/Math.PI-90;return e}const Ae=[-180,-90,180,90],ke=6378137*Math.PI/180;class Fe extends ve{constructor(t,e){super({code:t,units:"degrees",extent:Ae,axisOrientation:e,global:!0,metersPerUnit:ke,worldExtent:Ae})}}const Oe=[new Fe("CRS:84"),new Fe("EPSG:4326","neu"),new Fe("urn:ogc:def:crs:OGC:1.3:CRS84"),new Fe("urn:ogc:def:crs:OGC:2:84"),new Fe("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Fe("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Fe("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Pe={};let De={};function We(t,e,i){const n=t.getCode(),s=e.getCode();n in De||(De[n]={}),De[n][s]=i}function Ge(t,e){return t in De&&e in De[t]?De[t][e]:null}function ze(t,e,i){return Math.min(Math.max(t,e),i)}function Be(t,e,i,n,s,r){const o=s-i,a=r-n;if(0!==o||0!==a){const l=((t-i)*o+(e-n)*a)/(o*o+a*a);l>1?(i=s,n=r):l>0&&(i+=o*l,n+=a*l)}return Ne(t,e,i,n)}function Ne(t,e,i,n){const s=i-t,r=n-e;return s*s+r*r}function Ye(t){return 180*t/Math.PI}function Xe(t){return t*Math.PI/180}function Ve(t,e){const i=t%e;return i*e<0?i+e:i}function Ze(t,e,i){return t+i*(e-t)}function je(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function Ke(t,e,i){if(t>=e&&t<i)return t;const n=i-e;return((t-e)%n+n)%n+e}const qe=.9996,$e=.00669438,He=$e*$e,Ue=He*$e,Je=$e/(1-$e),Qe=Math.sqrt(1-$e),ti=(1-Qe)/(1+Qe),ei=ti*ti,ii=ei*ti,ni=ii*ti,si=ni*ti,ri=.9983242984503243,oi=15*He/256+45*Ue/1024,ai=35*Ue/3072,li=1.5*ti-27/32*ii+269/512*si,hi=21/16*ei-55/32*ni,ci=151/96*ii-417/128*si,ui=1097/512*ni,di=6378137;function gi(t,e,i){const n=t-5e5,s=(i.north?e:e-1e7)/qe/(di*ri),r=s+li*Math.sin(2*s)+hi*Math.sin(4*s)+ci*Math.sin(6*s)+ui*Math.sin(8*s),o=Math.sin(r),a=o*o,l=Math.cos(r),h=o/l,c=h*h,u=c*c,d=1-$e*a,g=Math.sqrt(1-$e*a),f=Je*l**2,p=f*f,_=n/(di/g*qe),m=_*_,y=m*_,x=y*_,S=x*_,v=r-h/((1-$e)/d)*(m/2-x/24*(5+3*c+10*f-4*p-9*Je))+S*_/720*(61+90*c+298*f+45*u-252*Je-3*p);let w=(_-y/6*(1+2*c+f)+S/120*(5-2*f+28*c-3*p+8*Je+24*u))/l;return w=Ke(w+Xe(pi(i.number)),-Math.PI,Math.PI),[Ye(w),Ye(v)]}function fi(t,e,i){t=Ke(t,-180,180),e<-80?e=-80:e>84&&(e=84);const n=Xe(e),s=Math.sin(n),r=Math.cos(n),o=s/r,a=o*o,l=a*a,h=Xe(t),c=Xe(pi(i.number)),u=di/Math.sqrt(1-$e*s**2),d=Je*r**2,g=r*Ke(h-c,-Math.PI,Math.PI),f=g*g,p=f*g,_=p*g,m=_*g,y=m*g,x=di*(ri*n-.002514607064228144*Math.sin(2*n)+oi*Math.sin(4*n)-ai*Math.sin(6*n)),S=qe*u*(g+p/6*(1-a+d)+m/120*(5-18*a+l+72*d-58*Je))+5e5;let v=qe*(x+u*o*(f/2+_/24*(5-a+9*d+4*d**2)+y/720*(61-58*a+l+600*d-330*Je)));return i.north||(v+=1e7),[S,v]}function pi(t){return 6*(t-1)-180+3}const _i=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function mi(t){let e=0;for(const i of _i){const n=t.match(i);if(n){e=parseInt(n[1]);break}}if(!e)return null;let i=0,n=!1;return e>32700&&e<32761?i=e-32700:e>32600&&e<32661&&(n=!0,i=e-32600),i?{number:i,north:n}:null}function yi(t,e){return function(i,n,s,r){const o=i.length;s=s>1?s:2,r=r??s,n||(n=s>2?i.slice():new Array(o));for(let s=0;s<o;s+=r){const r=i[s],o=i[s+1],a=t(r,o,e);n[s]=a[0],n[s+1]=a[1]}return n}}const xi=[function(t){const e=mi(t.getCode());return e?{forward:yi(fi,e),inverse:yi(gi,e)}:null}],Si=[function(t){return mi(t)?new ve({code:t,units:"m"}):null}];let vi=!0;function wi(t){vi=!(void 0===t||t)}function Ci(t,e){if(void 0!==e)for(let i=0,n=t.length;i<n;++i)e[i]=t[i];else e=t.slice();return e}function Ii(t){!function(t,e){Pe[t]=e}(t.getCode(),t),We(t,t,Ci)}function Mi(t){if("string"!=typeof t)return t;const e=Pe[i=t]||Pe[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null;var i;if(e)return e;for(const e of Si){const i=e(t);if(i)return i}return null}function Ri(t){!function(t){t.forEach(Ii)}(t),t.forEach(function(e){t.forEach(function(t){e!==t&&We(e,t,Ci)})})}function Ei(t,e){return t?"string"==typeof t?Mi(t):t:Mi(e)}function bi(t,e){const i=t.getCode(),n=e.getCode();let s=Ge(i,n);if(s)return s;let r=null,o=null;for(const i of xi)r||(r=i(t)),o||(o=i(e));if(!r&&!o)return null;const a="EPSG:4326";if(o)if(r)s=Ti(r.inverse,o.forward);else{const t=Ge(i,a);t&&(s=Ti(t,o.forward))}else{const t=Ge(a,n);t&&(s=Ti(r.inverse,t))}return s&&(Ii(t),Ii(e),We(t,e,s)),s}function Ti(t,e){return function(i,n,s,r){return n=t(i,n,s,r),e(n,n,s,r)}}function Li(t,e){return bi(Mi(t),Mi(e))}function Ai(t,e,i){const n=Li(e,i);if(!n){const t=Mi(e).getCode(),n=Mi(i).getCode();throw new Error(`No transform available between ${t} and ${n}`)}return n(t,void 0,t.length)}function ki(t,e,i,n){return le(t,Li(e,i),void 0,n)}let Fi=null;function Oi(){return Fi}function Pi(t,e){return Fi?Ai(t,e,Fi):t}function Di(t,e){return Fi?Ai(t,Fi,e):(vi&&!ce(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(vi=!1,function(...t){xe>ye.warn||console.warn(...t)}("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t)}function Wi(t,e){return Fi?ki(t,e,Fi):t}function Gi(t,e){return Fi?ki(t,Fi,e):t}function zi(t,e){if(!Fi)return t;const i=Mi(e).getMetersPerUnit(),n=Fi.getMetersPerUnit();return i&&n?t*i/n:t}var Bi,Ni,Yi;Ri(be),Ri(Oe),Bi=be,Ni=Te,Yi=Le,Oe.forEach(function(t){Bi.forEach(function(e){We(t,e,Ni),We(e,t,Yi)})});const Xi="prerender",Vi="postrender",Zi="precompose",ji=0,Ki=1,qi=2,$i=3,Hi=[NaN,NaN,NaN,0];let Ui;const Ji=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Qi=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,tn=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,en=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function nn(t,e){return t.endsWith("%")?Number(t.substring(0,t.length-1))/e:Number(t)}function sn(t){throw new Error('failed to parse "'+t+'" as color')}function rn(t){if(t.toLowerCase().startsWith("rgb")){const e=t.match(Qi)||t.match(Ji)||t.match(tn);if(e){const t=e[4],i=100/255;return[ze(nn(e[1],i)+.5|0,0,255),ze(nn(e[2],i)+.5|0,0,255),ze(nn(e[3],i)+.5|0,0,255),void 0!==t?ze(nn(t,100),0,1):1]}sn(t)}if(t.startsWith("#")){if(en.test(t)){const e=t.substring(1),i=e.length<=4?1:2,n=[0,0,0,255];for(let t=0,s=e.length;t<s;t+=i){let s=parseInt(e.substring(t,t+i),16);1===i&&(s+=s<<4),n[t/i]=s}return n[3]=n[3]/255,n}sn(t)}const e=(Ui||(Ui=pe(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),Ui);e.fillStyle="#abcdef";let i=e.fillStyle;e.fillStyle=t,e.fillStyle===i&&(e.fillStyle="#fedcba",i=e.fillStyle,e.fillStyle=t,e.fillStyle===i&&sn(t));const n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return rn(n);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);const s=Array.from(e.getImageData(0,0,1,1).data);return s[3]=je(s[3]/255,3),s}const on={};let an=0;function ln(t){if(4===t.length)return t;const e=t.slice();return e[3]=1,e}function hn(t){return t>.0031308?269.025*Math.pow(t,1/2.4)-14.025:3294.6*t}function cn(t){return t>.2068965?Math.pow(t,3):108/841*(t-4/29)}function un(t){return t>10.314724?Math.pow((t+14.025)/269.025,2.4):t/3294.6}function dn(t){return t>.0088564?Math.pow(t,1/3):t/(108/841)+4/29}function gn(t){const e=un(t[0]),i=un(t[1]),n=un(t[2]),s=dn(.222488403*e+.716873169*i+.06060791*n),r=500*(dn(.452247074*e+.399439023*i+.148375274*n)-s),o=200*(s-dn(.016863605*e+.117638439*i+.865350722*n)),a=Math.atan2(o,r)*(180/Math.PI);return[116*s-16,Math.sqrt(r*r+o*o),a<0?a+360:a,t[3]]}function fn(t){if("none"===t)return Hi;if(on.hasOwnProperty(t))return on[t];if(an>=1024){let t=0;for(const e in on)3&t++||(delete on[e],--an)}const e=rn(t);4!==e.length&&sn(t);for(const i of e)isNaN(i)&&sn(t);return on[t]=e,++an,e}function pn(t){return Array.isArray(t)?t:fn(t)}function _n(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let i=t[1];i!=(0|i)&&(i=i+.5|0);let n=t[2];n!=(0|n)&&(n=n+.5|0);return"rgba("+e+","+i+","+n+","+(void 0===t[3]?1:Math.round(1e3*t[3])/1e3)+")"}function mn(t,e){return e&&(t.src=e),t.src&&fe?new Promise((e,i)=>t.decode().then(()=>e(t)).catch(n=>t.complete&&t.width?e(t):i(n))):function(t,e){return new Promise((i,n)=>{function s(){o(),i(t)}function r(){o(),n(new Error("Image load error"))}function o(){t.removeEventListener("load",s),t.removeEventListener("error",r)}t.addEventListener("load",s),t.addEventListener("error",r),e&&(t.src=e)})}(t)}class yn{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];3&t++||i.hasListener()||(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e,i){const n=xn(t,e,i);return n in this.cache_?this.cache_[n]:null}getPattern(t,e,i){const n=xn(t,e,i);return n in this.patternCache_?this.patternCache_[n]:null}set(t,e,i,n,s){const r=xn(t,e,i),o=r in this.cache_;this.cache_[r]=n,s&&(n.getImageState()===ji&&n.load(),n.getImageState()===Ki?n.ready().then(()=>{this.patternCache_[r]=me().createPattern(n.getImage(1),"repeat")}):this.patternCache_[r]=me().createPattern(n.getImage(1),"repeat")),o||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function xn(t,e,i){return e+":"+t+":"+(i?pn(i):"null")}const Sn=new yn;let vn=null;class wn extends dt{constructor(t,e,i,n,s){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i,this.canvas_={},this.color_=s,this.imageState_=void 0===n?ji:n,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(void 0===this.tainted_&&this.imageState_===qi){vn||(vn=pe(1,1,void 0,{willReadFrequently:!0})),vn.drawImage(this.image_,0,0);try{vn.getImageData(0,0,1,1),this.tainted_=!1}catch{vn=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(Q)}handleImageError_(){this.imageState_=$i,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=qi,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=pe(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_===ji){this.image_||this.initializeImage_(),this.imageState_=Ki;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&mn(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_!==qi)return;const e=this.image_,i=pe(Math.ceil(e.width*t),Math.ceil(e.height*t)),n=i.canvas;var s;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle="string"==typeof(s=this.color_)?s:_n(s),i.fillRect(0,0,n.width/t,n.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=n}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(this.imageState_===qi||this.imageState_===$i)t();else{const e=()=>{this.imageState_!==qi&&this.imageState_!==$i||(this.removeEventListener(Q,e),t())};this.addEventListener(Q,e)}})),this.ready_}}function Cn(t,e,i,n,s,r){let o=void 0===e?void 0:Sn.get(e,i,s);return o||(o=new wn(t,t&&"src"in t?t.src||void 0:e,i,n,s),Sn.set(e,i,s,o,r)),r&&o&&!Sn.getPattern(e,i,s)&&Sn.set(e,i,s,o,r),o}const In=wn;function Mn(t){return t?Array.isArray(t)?_n(t):"object"==typeof t&&"src"in t?function(t){if(!t.offset||!t.size)return Sn.getPattern(t.src,"anonymous",t.color);const e=t.src+":"+t.offset,i=Sn.getPattern(e,void 0,t.color);if(i)return i;const n=Sn.get(t.src,"anonymous",null);if(n.getImageState()!==qi)return null;const s=pe(t.size[0],t.size[1]);return s.drawImage(n.getImage(1),t.offset[0],t.offset[1],t.size[0],t.size[1],0,0,t.size[0],t.size[1]),Cn(s.canvas,e,void 0,qi,t.color,!0),Sn.getPattern(e,void 0,t.color)}(t):t:null}function Rn(t,e,i,n,s){s=void 0!==s?s:[];let r=0;for(let o=e;o<i;o+=n)s[r++]=t.slice(o,o+n);return s.length=r,s}function En(t,e,i,n,s){s=void 0!==s?s:[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];s[r++]=Rn(t,e,a,n,s[r]),e=a}return s.length=r,s}function bn(t,e,i,n,s){s=void 0!==s?s:[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];s[r++]=1===a.length&&a[0]===e?[]:En(t,e,a,n,s[r]),e=a[a.length-1]}return s.length=r,s}const Tn=class{drawCustom(t,e,i,n,s){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}},Ln=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))","?\\s*([-,\\\"\\'\\sa-z0-9]+?)\\s*$"].join(""),"i"),An=["style","variant","weight","size","lineHeight","family"],kn={normal:400,bold:700},Fn=function(t){const e=t.match(Ln);if(!e)return null;const i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let t=0,n=An.length;t<n;++t){const n=e[t+1];void 0!==n&&(i[An[t]]="string"==typeof n?n.trim():n)}return isNaN(Number(i.weight))&&i.weight in kn&&(i.weight=kn[i.weight]),i.families=i.family.split(/,\s?/).map(t=>t.trim().replace(/^['"]|['"]$/g,"")),i},On="10px sans-serif",Pn="#000",Dn="round",Wn=[],Gn="round",zn="#000",Bn="center",Nn="middle",Yn=[0,0,0,0],Xn=new wt;let Vn,Zn=null;const jn={},Kn=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function qn(t,e,i){return`${t} ${e} 16px "${i}"`}const $n=function(){const t=100;let e,i;async function n(t){await i.ready;const e=await i.load(t);if(0===e.length)return!1;const n=Fn(t),s=n.families[0].toLowerCase(),r=n.weight;return e.some(t=>{const e=t.family.replace(/^['"]|['"]$/g,"").toLowerCase(),i=kn[t.weight]||t.weight;return e===s&&t.style===n.style&&i==r})}async function s(){await i.ready;let r=!0;const o=Xn.getProperties(),a=Object.keys(o).filter(e=>o[e]<t);for(let e=a.length-1;e>=0;--e){const i=a[e];let s=o[i];s<t&&(await n(i)?(ht(jn),Xn.set(i,t)):(s+=10,Xn.set(i,s,!0),s<t&&(r=!1)))}e=void 0,r||(e=setTimeout(s,100))}return async function(t){i||(i=ge?self.fonts:document.fonts);const n=Fn(t);if(!n)return;const r=n.families;let o=!1;for(const t of r){if(Kn.has(t))continue;const e=qn(n.style,n.weight,t);void 0===Xn.get(e)&&(Xn.set(e,0,!0),o=!0)}o&&(clearTimeout(e),e=setTimeout(s,100))}}(),Hn=function(){let t;return function(e){let i=jn[e];if(null==i){if(ge){const t=Fn(e),n=Un(e,"Žg");i=(isNaN(Number(t.lineHeight))?1.2:Number(t.lineHeight))*(n.actualBoundingBoxAscent+n.actualBoundingBoxDescent)}else t||(t=document.createElement("div"),t.innerHTML="M",t.style.minHeight="0",t.style.maxHeight="none",t.style.height="auto",t.style.padding="0",t.style.border="none",t.style.position="absolute",t.style.display="block",t.style.left="-99999px"),t.style.font=e,document.body.appendChild(t),i=t.offsetHeight,document.body.removeChild(t);jn[e]=i}return i}}();function Un(t,e){return Zn||(Zn=pe(1,1)),t!=Vn&&(Zn.font=t,Vn=Zn.font),Zn.measureText(e)}function Jn(t,e){return Un(t,e).width}function Qn(t,e,i){if(e in i)return i[e];const n=e.split("\n").reduce((e,i)=>Math.max(e,Jn(t,i)),0);return i[e]=n,n}function ts(t,e,i,n,s,r,o,a,l,h,c){t.save(),1!==i&&(void 0===t.globalAlpha?t.globalAlpha=t=>t.globalAlpha*=i:t.globalAlpha*=i),e&&t.transform.apply(t,e),n.contextInstructions?(t.translate(l,h),t.scale(c[0],c[1]),function(t,e){const i=t.contextInstructions;for(let t=0,n=i.length;t<n;t+=2)Array.isArray(i[t+1])?e[i[t]].apply(e,i[t+1]):e[i[t]]=i[t+1]}(n,t)):c[0]<0||c[1]<0?(t.translate(l,h),t.scale(c[0],c[1]),t.drawImage(n,s,r,o,a,0,0,o,a)):t.drawImage(n,s,r,o,a,l,h,o*c[0],a*c[1]),t.restore()}const es={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},is=[es.FILL],ns=[es.STROKE],ss=[es.BEGIN_PATH],rs=[es.CLOSE_PATH],os=es;const as=class extends Tn{constructor(t,e,i,n){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=n,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return 1==e?t:t.map(function(t){return t*e})}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),n=this.tmpCoordinate_,s=this.coordinates;let r=s.length;for(let o=0,a=t.length;o<a;o+=e)n[0]=t[o],n[1]=t[o+1],Xt(i,n)&&(s[r++]=n[0],s[r++]=n[1]);return r}appendFlatLineCoordinates(t,e,i,n,s,r){const o=this.coordinates;let a=o.length;const l=this.getBufferedMaxExtent();r&&(e+=n);let h=t[e],c=t[e+1];const u=this.tmpCoordinate_;let d,g,f,p=!0;for(d=e+n;d<i;d+=n)u[0]=t[d],u[1]=t[d+1],f=jt(l,u),f!==g?(p&&(o[a++]=h,o[a++]=c,p=!1),o[a++]=u[0],o[a++]=u[1]):f===Dt?(o[a++]=u[0],o[a++]=u[1],p=!1):p=!0,h=u[0],c=u[1],g=f;return(s&&p||d===e+n)&&(o[a++]=h,o[a++]=c),a}drawCustomCoordinates_(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r],a=this.appendFlatLineCoordinates(t,e,o,n,!1,!1);s.push(a),e=o}return e}drawCustom(t,e,i,n,s){this.beginGeometry(t,e,s);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 e=t.getEndss();d=0;for(let t=0,i=e.length;t<i;++t){const i=[];d=this.drawCustomCoordinates_(l,d,e[t],o,i),u.push(i)}this.instructions.push([os.CUSTOM,a,u,t,i,bn,s]),this.hitDetectionInstructions.push([os.CUSTOM,a,u,t,n||i,bn,s]);break;case"Polygon":case"MultiLineString":c=[],l="Polygon"==r?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),d=this.drawCustomCoordinates_(l,0,t.getEnds(),o,c),this.instructions.push([os.CUSTOM,a,c,t,i,En,s]),this.hitDetectionInstructions.push([os.CUSTOM,a,c,t,n||i,En,s]);break;case"LineString":case"Circle":l=t.getFlatCoordinates(),h=this.appendFlatLineCoordinates(l,0,l.length,o,!1,!1),this.instructions.push([os.CUSTOM,a,h,t,i,Rn,s]),this.hitDetectionInstructions.push([os.CUSTOM,a,h,t,n||i,Rn,s]);break;case"MultiPoint":l=t.getFlatCoordinates(),h=this.appendFlatPointCoordinates(l,o),h>a&&(this.instructions.push([os.CUSTOM,a,h,t,i,Rn,s]),this.hitDetectionInstructions.push([os.CUSTOM,a,h,t,n||i,Rn,s]));break;case"Point":l=t.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([os.CUSTOM,a,h,t,i,void 0,s]),this.hitDetectionInstructions.push([os.CUSTOM,a,h,t,n||i,void 0,s])}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[os.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[os.BEGIN_GEOMETRY,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;let e;t.reverse();const i=t.length;let n,s,r=-1;for(e=0;e<i;++e)n=t[e],s=n[0],s==os.END_GEOMETRY?r=e:s==os.BEGIN_GEOMETRY&&(n[2]=e,st(this.hitDetectionInstructions,r,e),r=-1)}fillStyleToState(t,e={}){if(t){const i=t.getColor();e.fillPatternScale=i&&"object"==typeof i&&"src"in i?this.pixelRatio:1,e.fillStyle=Mn(i||Pn)}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const i=t.getColor();e.strokeStyle=Mn(i||zn);const n=t.getLineCap();e.lineCap=void 0!==n?n:Dn;const s=t.getLineDash();e.lineDash=s?s.slice():Wn;const r=t.getLineDashOffset();e.lineDashOffset=r||0;const o=t.getLineJoin();e.lineJoin=void 0!==o?o:Gn;const a=t.getWidth();e.lineWidth=void 0!==a?a:1;const l=t.getMiterLimit();e.miterLimit=void 0!==l?l:10,e.lineWidth>this.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0;return e}setFillStrokeStyle(t,e){const i=this.state;this.fillStyleToState(t,i),this.strokeStyleToState(e,i)}createFill(t){const e=t.fillStyle,i=[os.SET_FILL_STYLE,e];return"string"!=typeof e&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[os.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;"string"==typeof i&&t.currentFillStyle==i||(this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,n=t.lineCap,s=t.lineDash,r=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,l=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||s!=t.currentLineDash&&!ot(t.currentLineDash,s)||t.currentLineDashOffset!=r||t.currentLineJoin!=o||t.currentLineWidth!=a||t.currentMiterLimit!=l)&&(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=s,t.currentLineDashOffset=r,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=l)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[os.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=(t=this.maxExtent,e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t.slice()),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;Nt(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}var t,e;return this.bufferedMaxExtent_}};const ls=class extends as{constructor(t,e,i,n){super(t,e,i,n),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e,i){if(!this.image_||this.maxExtent&&!Xt(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),s=t.getStride(),r=this.coordinates.length,o=this.appendFlatPointCoordinates(n,s);this.instructions.push([os.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([os.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,i){if(!this.image_)return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),s=[];for(let e=0,i=n.length;e<i;e+=t.getStride())this.maxExtent&&!Xt(this.maxExtent,n.slice(e,e+2))||s.push(n[e],n[e+1]);const r=this.coordinates.length,o=this.appendFlatPointCoordinates(s,2);this.instructions.push([os.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([os.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(),n=t.getSize(),s=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=s[0],this.originY_=s[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}};const hs=class extends as{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinates_(t,e,i,n){const s=this.coordinates.length,r=this.appendFlatLineCoordinates(t,e,i,n,!1,!1),o=[os.MOVE_TO_LINE_TO,s,r];return this.instructions.push(o),this.hitDetectionInstructions.push(o),i}drawLineString(t,e,i){const n=this.state,s=n.strokeStyle,r=n.lineWidth;if(void 0===s||void 0===r)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([os.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Wn,0],ss);const o=t.getFlatCoordinates(),a=t.getStride();this.drawFlatCoordinates_(o,0,o.length,a),this.hitDetectionInstructions.push(ns),this.endGeometry(e)}drawMultiLineString(t,e,i){const n=this.state,s=n.strokeStyle,r=n.lineWidth;if(void 0===s||void 0===r)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([os.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Wn,0],ss);const o=t.getEnds(),a=t.getFlatCoordinates(),l=t.getStride();let h=0;for(let t=0,e=o.length;t<e;++t)h=this.drawFlatCoordinates_(a,h,o[t],l);this.hitDetectionInstructions.push(ns),this.endGeometry(e)}finish(){const t=this.state;return null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&this.instructions.push(ns),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(ns),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(ss)}};function cs(t,e,i,n,s,r,o){const a=(i-e)/n;if(a<3){for(;e<i;e+=n)r[o++]=t[e],r[o++]=t[e+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const h=[e,i-n];let c=0;for(;h.length>0;){const i=h.pop(),r=h.pop();let o=0;const a=t[r],u=t[r+1],d=t[i],g=t[i+1];for(let e=r+n;e<i;e+=n){const i=Be(t[e],t[e+1],a,u,d,g);i>o&&(c=e,o=i)}o>s&&(l[(c-e)/n]=1,r+n<c&&h.push(r,c),c+n<i&&h.push(c,i))}for(let i=0;i<a;++i)l[i]&&(r[o++]=t[e+i*n],r[o++]=t[e+i*n+1]);return o}function us(t,e){return e*Math.round(t/e)}function ds(t,e,i,n,s,r,o){if(e==i)return o;let a,l,h=us(t[e],s),c=us(t[e+1],s);e+=n,r[o++]=h,r[o++]=c;do{if(a=us(t[e],s),l=us(t[e+1],s),(e+=n)==i)return r[o++]=a,r[o++]=l,o}while(a==h&&l==c);for(;e<i;){const i=us(t[e],s),u=us(t[e+1],s);if(e+=n,i==a&&u==l)continue;const d=a-h,g=l-c,f=i-h,p=u-c;d*p==g*f&&(d<0&&f<d||d==f||d>0&&f>d)&&(g<0&&p<g||g==p||g>0&&p>g)?(a=i,l=u):(r[o++]=a,r[o++]=l,h=a,c=l,a=i,l=u)}return r[o++]=a,r[o++]=l,o}function gs(t,e,i,n,s,r,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l];o=ds(t,e,h,n,s,r,o),a.push(o),e=h}return o}const fs=class extends as{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinatess_(t,e,i,n){const s=this.state,r=void 0!==s.fillStyle,o=void 0!==s.strokeStyle,a=i.length;this.instructions.push(ss),this.hitDetectionInstructions.push(ss);for(let s=0;s<a;++s){const r=i[s],a=this.coordinates.length,l=this.appendFlatLineCoordinates(t,e,r,n,!0,!o),h=[os.MOVE_TO_LINE_TO,a,l];this.instructions.push(h),this.hitDetectionInstructions.push(h),o&&(this.instructions.push(rs),this.hitDetectionInstructions.push(rs)),e=r}return r&&(this.instructions.push(is),this.hitDetectionInstructions.push(is)),o&&(this.instructions.push(ns),this.hitDetectionInstructions.push(ns)),e}drawCircle(t,e,i){const n=this.state,s=n.fillStyle,r=n.strokeStyle;if(void 0===s&&void 0===r)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([os.SET_FILL_STYLE,Pn]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([os.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Wn,0]);const o=t.getFlatCoordinates(),a=t.getStride(),l=this.coordinates.length;this.appendFlatLineCoordinates(o,0,o.length,a,!1,!1);const h=[os.CIRCLE,l];this.instructions.push(ss,h),this.hitDetectionInstructions.push(ss,h),void 0!==n.fillStyle&&(this.instructions.push(is),this.hitDetectionInstructions.push(is)),void 0!==n.strokeStyle&&(this.instructions.push(ns),this.hitDetectionInstructions.push(ns)),this.endGeometry(e)}drawPolygon(t,e,i){const n=this.state,s=n.fillStyle,r=n.strokeStyle;if(void 0===s&&void 0===r)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([os.SET_FILL_STYLE,Pn]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([os.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Wn,0]);const o=t.getEnds(),a=t.getOrientedFlatCoordinates(),l=t.getStride();this.drawFlatCoordinatess_(a,0,o,l),this.endGeometry(e)}drawMultiPolygon(t,e,i){const n=this.state,s=n.fillStyle,r=n.strokeStyle;if(void 0===s&&void 0===r)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([os.SET_FILL_STYLE,Pn]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([os.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Wn,0]);const o=t.getEndss(),a=t.getOrientedFlatCoordinates(),l=t.getStride();let h=0;for(let t=0,e=o.length;t<e;++t)h=this.drawFlatCoordinatess_(a,h,o[t],l);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const t=this.tolerance;if(0!==t){const e=this.coordinates;for(let i=0,n=e.length;i<n;++i)e[i]=us(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;this.updateFillStyle(t,this.createFill),this.updateStrokeStyle(t,this.applyStroke)}};function ps(t,e,i,n,s){const r=[];let o=i,a=0,l=e.slice(i,2);for(;a<t&&o+s<n;){const[i,n]=l.slice(-2),h=e[o+s],c=e[o+s+1],u=Math.sqrt((h-i)*(h-i)+(c-n)*(c-n));if(a+=u,a>=t){const e=(t-a+u)/u,d=Ze(i,h,e),g=Ze(n,c,e);l.push(d,g),r.push(l),l=[d,g],a==t&&(o+=s),a=0}else if(a<t)l.push(e[o+s],e[o+s+1]),o+=s;else{const t=u-a,e=Ze(i,h,t/u),d=Ze(n,c,t/u);l.push(e,d),r.push(l),l=[e,d],a=0,o+=s}}return a>0&&r.push(l),r}function _s(t,e,i,n,s){let r,o,a,l,h,c,u,d,g,f,p=i,_=i,m=0,y=0,x=i;for(o=i;o<n;o+=s){const i=e[o],n=e[o+1];void 0!==h&&(g=i-h,f=n-c,l=Math.sqrt(g*g+f*f),void 0!==u&&(y+=a,r=Math.acos((u*g+d*f)/(a*l)),r>t&&(y>m&&(m=y,p=x,_=o),y=0,x=o-s)),a=l,u=g,d=f),h=i,c=n}return y+=l,y>m?[x,o]:[p,_]}const ms={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};const ys=class extends as{constructor(t,e,i,n){super(t,e,i,n),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[Pn]={fillStyle:Pn},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e,i){const n=this.textFillState_,s=this.textStrokeState_,r=this.textState_;if(""===this.text_||!r||!n&&!s)return;const o=this.coordinates;let a=o.length;const l=t.getType();let h=null,c=t.getStride();if("line"!==r.placement||"LineString"!=l&&"MultiLineString"!=l&&"Polygon"!=l&&"MultiPolygon"!=l){let n=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||n.push(h[2]/this.resolution),c=3;break;case"MultiPolygon":const e=t.getFlatInteriorPoints();h=[];for(let t=0,i=e.length;t<i;t+=3)r.overflow||n.push(e[t+2]/this.resolution),h.push(e[t],e[t+1]);if(0===h.length)return;c=2}const s=this.appendFlatPointCoordinates(h,c);if(s===a)return;if(n&&(s-a)/2!==h.length/c){let t=a/2;n=n.filter((e,i)=>{const n=o[2*(t+i)]===h[i*c]&&o[2*(t+i)+1]===h[i*c+1];return n||--t,n})}this.saveTextStates_();const u=r.backgroundFill?this.createFill(this.fillStyleToState(r.backgroundFill)):null,d=r.backgroundStroke?this.createStroke(this.strokeStyleToState(r.backgroundStroke)):null;this.beginGeometry(t,e,i);let g=r.padding;if(g!=Yn&&(r.scale[0]<0||r.scale[1]<0)){let t=r.padding[0],e=r.padding[1],i=r.padding[2],n=r.padding[3];r.scale[0]<0&&(e=-e,n=-n),r.scale[1]<0&&(t=-t,i=-i),g=[t,e,i,n]}const f=this.pixelRatio;this.instructions.push([os.DRAW_IMAGE,a,s,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,g==Yn?Yn:g.map(function(t){return t*f}),u,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]);const p=1/f,_=u?u.slice(0):null;_&&(_[1]=Pn),this.hitDetectionInstructions.push([os.DRAW_IMAGE,a,s,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[p,p],NaN,this.declutterMode_,this.declutterImageWithText_,g,_,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?Pn:this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]),this.endGeometry(e)}else{if(!oe(this.maxExtent,t.getExtent()))return;let n;if(h=t.getFlatCoordinates(),"LineString"==l)n=[h.length];else if("MultiLineString"==l)n=t.getEnds();else if("Polygon"==l)n=t.getEnds().slice(0,1);else if("MultiPolygon"==l){const e=t.getEndss();n=[];for(let t=0,i=e.length;t<i;++t)n.push(e[t][0])}this.beginGeometry(t,e,i);const s=r.repeat,u=s?void 0:r.textAlign;let d=0;for(let t=0,e=n.length;t<e;++t){let e;e=s?ps(s*this.resolution,h,d,n[t],c):[h.slice(d,n[t])];for(let i=0,s=e.length;i<s;++i){const s=e[i];let l=0,h=s.length;if(null==u){const t=_s(r.maxAngle,s,0,s.length,2);l=t[0],h=t[1]}for(let t=l;t<h;t+=c)o.push(s[t],s[t+1]);const g=o.length;d=n[t],this.drawChars_(a,g),a=g}}this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,n=this.strokeKey_;t&&(n in this.strokeStates||(this.strokeStates[n]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const s=this.textKey_;s in this.textStates||(this.textStates[s]={font:e.font,textAlign:e.textAlign||Bn,justify:e.justify,textBaseline:e.textBaseline||Nn,scale:e.scale});const r=this.fillKey_;i&&(r in this.fillStates||(this.fillStates[r]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,n=this.textState_,s=this.strokeKey_,r=this.textKey_,o=this.fillKey_;this.saveTextStates_();const a=this.pixelRatio,l=ms[n.textBaseline],h=this.textOffsetY_*a,c=this.text_,u=i?i.lineWidth*Math.abs(n.scale[0])/2:0;this.instructions.push([os.DRAW_CHARS,t,e,l,n.overflow,o,n.maxAngle,a,h,s,u*a,c,r,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([os.DRAW_CHARS,t,e,l,n.overflow,o?Pn:o,n.maxAngle,a,h,s,u*a,c,r,1/a,this.declutterMode_,this.textKeepUpright_])}setTextStyle(t,e){let i,n,s;if(t){const e=t.getFill();e?(n=this.textFillState_,n||(n={},this.textFillState_=n),n.fillStyle=Mn(e.getColor()||Pn)):(n=null,this.textFillState_=n);const r=t.getStroke();if(r){s=this.textStrokeState_,s||(s={},this.textStrokeState_=s);const t=r.getLineDash(),e=r.getLineDashOffset(),i=r.getWidth(),n=r.getMiterLimit();s.lineCap=r.getLineCap()||Dn,s.lineDash=t?t.slice():Wn,s.lineDashOffset=void 0===e?0:e,s.lineJoin=r.getLineJoin()||Gn,s.lineWidth=void 0===i?1:i,s.miterLimit=void 0===n?10:n,s.strokeStyle=Mn(r.getColor()||zn)}else s=null,this.textStrokeState_=s;i=this.textState_;const o=t.getFont()||On;$n(o);const a=t.getScaleArray();i.overflow=t.getOverflow(),i.font=o,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||Nn,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||Yn,i.scale=void 0===a?[1,1]:a;const l=t.getOffsetX(),h=t.getOffsetY(),c=t.getRotateWithView(),u=t.getKeepUpright(),d=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=void 0===l?0:l,this.textOffsetY_=void 0===h?0:h,this.textRotateWithView_=void 0!==c&&c,this.textKeepUpright_=void 0===u||u,this.textRotation_=void 0===d?0:d,this.strokeKey_=s?("string"==typeof s.strokeStyle?s.strokeStyle:St(s.strokeStyle))+s.lineCap+s.lineDashOffset+"|"+s.lineWidth+s.lineJoin+s.miterLimit+"["+s.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=n&&n.fillStyle?"string"==typeof n.fillStyle?n.fillStyle:"|"+St(n.fillStyle):""}else this.text_="";this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}},xs={Circle:fs,Default:as,Image:ls,LineString:hs,Polygon:fs,Text:ys};const Ss=class{constructor(t,e,i,n){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=n,this.resolution_=i,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const i=this.buildersByZIndex_[e];for(const n in i){const s=i[n].finish();t[e][n]=s}}return t}getBuilder(t,e){const i=void 0!==t?t.toString():"0";let n=this.buildersByZIndex_[i];void 0===n&&(n={},this.buildersByZIndex_[i]=n);let s=n[e];if(void 0===s){s=new(0,xs[e])(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[e]=s}return s}};function vs(t,e,i,n,s,r,o){r=r||[],o=o||2;let a=0;for(let l=e;l<i;l+=n){const e=t[l],i=t[l+1];r[a++]=s[0]*e+s[2]*i+s[4],r[a++]=s[1]*e+s[3]*i+s[5];for(let e=2;e<o;e++)r[a++]=t[l+e]}return r&&r.length!=a&&(r.length=a),r}function ws(t,e,i,n,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 s=e;s<i;s+=n){const e=t[s]-h,i=t[s+1]-c;o[u++]=h+e*a-i*l,o[u++]=c+e*l+i*a;for(let e=s+2;e<s+n;++e)o[u++]=t[e]}return o&&o.length!=u&&(o.length=u),o}new Array(6);function Cs(t,e){const i=e[0],n=e[1];return e[0]=t[0]*i+t[2]*n+t[4],e[1]=t[1]*i+t[3]*n+t[5],e}function Is(t,e,i,n,s,r,o,a){const l=Math.sin(r),h=Math.cos(r);return t[0]=n*h,t[1]=s*l,t[2]=-n*l,t[3]=s*h,t[4]=o*n*h-a*n*l+e,t[5]=o*s*l+a*s*h+i,t}function Ms(t,e){const i=(n=e)[0]*n[3]-n[1]*n[2];var n;Rt(0!==i,"Transformation matrix cannot be inverted");const s=e[0],r=e[1],o=e[2],a=e[3],l=e[4],h=e[5];return t[0]=a/i,t[1]=-r/i,t[2]=-o/i,t[3]=s/i,t[4]=(o*h-a*l)/i,t[5]=-(s*h-r*l)/i,t}const Rs=[1e5,1e5,1e5,1e5,2,2];function Es(t){return"matrix("+t.join(", ")+")"}function bs(t){return t.substring(7,t.length-1).split(",").map(parseFloat)}function Ts(t,e,i,n){let s=t[e],r=t[e+1],o=0;for(let a=e+n;a<i;a+=n){const e=t[a],i=t[a+1];o+=Math.sqrt((e-s)*(e-s)+(i-r)*(i-r)),s=e,r=i}return o}function Ls(t,e,i,n,s,r,o,a,l,h,c,u,d=!0){let g=t[e],f=t[e+1],p=0,_=0,m=0,y=0;function x(){p=g,_=f,g=t[e+=n],f=t[e+1],y+=m,m=Math.sqrt((g-p)*(g-p)+(f-_)*(f-_))}do{x()}while(e<i-n&&y+m<r);let S=0===m?0:(r-y)/m;const v=Ze(p,g,S),w=Ze(_,f,S),C=e-n,I=y,M=r+a*l(h,s,c);for(;e<i-n&&y+m<M;)x();S=0===m?0:(M-y)/m;const R=Ze(p,g,S),E=Ze(_,f,S);let b=!1;if(d)if(u){const t=[v,w,R,E];ws(t,0,4,2,u,t,t),b=t[0]>t[2]}else b=v>R;const T=Math.PI,L=[],A=C+n===e;let k;if(m=0,y=I,g=t[e=C],f=t[e+1],A){x(),k=Math.atan2(f-_,g-p),b&&(k+=k>0?-T:T);const t=(R+v)/2,e=(E+w)/2;return L[0]=[t,e,(M-r)/2,k,s],L}for(let t=0,u=(s=s.replace(/\n/g," ")).length;t<u;){x();let d=Math.atan2(f-_,g-p);if(b&&(d+=d>0?-T:T),void 0!==k){let t=d-k;if(t+=t>T?-2*T:t<-T?2*T:0,Math.abs(t)>o)return null}k=d;const v=t;let w=0;for(;t<u;++t){const o=a*l(h,s[b?u-t-1:t],c);if(e+n<i&&y+m<r+w+o/2)break;w+=o}if(t===v)continue;const C=b?s.substring(u-v,u-t):s.substring(v,t);S=0===m?0:(r+w/2-y)/m;const I=Ze(p,g,S),M=Ze(_,f,S);L.push([I,M,w/2,d,C]),r+=w}return L}const As=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(me(),{get:(t,e)=>{if("function"==typeof me()[e])return this.push_(e),this.pushMethodArgs_},set:(t,e,i)=>(this.push_(e,i),!0)})}push_(...t){const e=this.instructions_,i=this.zIndex+this.offset_;e[i]||(e[i]=[]),e[i].push(...t)}pushMethodArgs_=(...t)=>(this.push_(t),this);pushFunction(t){this.push_(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach(e=>{for(let i=0,n=e.length;i<n;++i){const n=e[i];if("function"==typeof n){n(t);continue}const s=e[++i];if("function"==typeof t[n])t[n](...s);else{if("function"==typeof s){t[n]=s(t);continue}t[n]=s}}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}},ks=[1/0,1/0,-1/0,-1/0],Fs=[],Os=[],Ps=[],Ds=[];function Ws(t){return t[3].declutterBox}const Gs=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 zs(t,e){return"start"===e?e=Gs.test(t)?"right":"left":"end"===e&&(e=Gs.test(t)?"left":"right"),ms[e]}function Bs(t,e,i){return i>0&&t.push("\n",""),t.push(e,""),t}function Ns(t,e,i){return i%2==0&&(t+=e),t}const Ys=class{constructor(t,e,i,n,s){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=[1,0,0,1,0,0],this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=s?new As:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,n){const s=t+e+i+n;if(this.labels_[s])return this.labels_[s];const r=n?this.strokeStates[n]:null,o=i?this.fillStates[i]:null,a=this.textStates[e],l=this.pixelRatio,h=[a.scale[0]*l,a.scale[1]*l],c=a.justify?ms[a.justify]:zs(Array.isArray(t)?t[0]:t,a.textAlign||Bn),u=n&&r.lineWidth?r.lineWidth:0,d=Array.isArray(t)?t:String(t).split("\n").reduce(Bs,[]),{width:g,height:f,widths:p,heights:_,lineWidths:m}=function(t,e){const i=[],n=[],s=[];let r=0,o=0,a=0,l=0;for(let h=0,c=e.length;h<=c;h+=2){const u=e[h];if("\n"===u||h===c){r=Math.max(r,o),s.push(o),o=0,a+=l,l=0;continue}const d=e[h+1]||t.font,g=Jn(d,u);i.push(g),o+=g;const f=Hn(d);n.push(f),l=Math.max(l,f)}return{width:r,height:a,widths:i,heights:n,lineWidths:s}}(a,d),y=g+u,x=[],S=(y+2)*h[0],v=(f+u)*h[1],w={width:S<0?Math.floor(S):Math.ceil(S),height:v<0?Math.floor(v):Math.ceil(v),contextInstructions:x};1==h[0]&&1==h[1]||x.push("scale",h),n&&(x.push("strokeStyle",r.strokeStyle),x.push("lineWidth",u),x.push("lineCap",r.lineCap),x.push("lineJoin",r.lineJoin),x.push("miterLimit",r.miterLimit),x.push("setLineDash",[r.lineDash]),x.push("lineDashOffset",r.lineDashOffset)),i&&x.push("fillStyle",o.fillStyle),x.push("textBaseline","middle"),x.push("textAlign","center");const C=.5-c;let I=c*y+C*u;const M=[],R=[];let E,b=0,T=0,L=0,A=0;for(let t=0,e=d.length;t<e;t+=2){const e=d[t];if("\n"===e){T+=b,b=0,I=c*y+C*u,++A;continue}const s=d[t+1]||a.font;s!==E&&(n&&M.push("font",s),i&&R.push("font",s),E=s),b=Math.max(b,_[L]);const r=[e,I+C*p[L]+c*(p[L]-m[A]),.5*(u+b)+T];I+=p[L],n&&M.push("strokeText",r),i&&R.push("fillText",r),++L}return Array.prototype.push.apply(x,M),Array.prototype.push.apply(x,R),this.labels_[s]=w,w}replayTextBackground_(t,e,i,n,s,r,o){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,n),t.lineTo.apply(t,s),t.lineTo.apply(t,e),r&&(this.alignAndScaleFill_=r[2],t.fillStyle=r[1],this.fill_(t)),o&&(this.setStrokeStyle_(t,o),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,n,s,r,o,a,l,h,c,u,d,g,f,p){let _=i-(o*=u[0]),m=n-(a*=u[1]);const y=s+l>t?t-l:s,x=r+h>e?e-h:r,S=g[3]+y*u[0]+g[1],v=g[0]+x*u[1]+g[2],w=_-g[3],C=m-g[0];let I;return(f||0!==c)&&(Fs[0]=w,Ds[0]=w,Fs[1]=C,Os[1]=C,Os[0]=w+S,Ps[0]=Os[0],Ps[1]=C+v,Ds[1]=Ps[1]),0!==c?(I=Is([1,0,0,1,0,0],i,n,1,1,c,-i,-n),Cs(I,Fs),Cs(I,Os),Cs(I,Ps),Cs(I,Ds),Kt(Math.min(Fs[0],Os[0],Ps[0],Ds[0]),Math.min(Fs[1],Os[1],Ps[1],Ds[1]),Math.max(Fs[0],Os[0],Ps[0],Ds[0]),Math.max(Fs[1],Os[1],Ps[1],Ds[1]),ks)):Kt(Math.min(w,w+S),Math.min(C,C+v),Math.max(w,w+S),Math.max(C,C+v),ks),d&&(_=Math.round(_),m=Math.round(m)),{drawImageX:_,drawImageY:m,drawImageW:y,drawImageH:x,originX:l,originY:h,declutterBox:{minX:ks[0],minY:ks[1],maxX:ks[2],maxY:ks[3],value:p},canvasTransform:I,scale:u}}replayImageOrLabel_(t,e,i,n,s,r,o){const a=!(!r&&!o),l=n.declutterBox,h=o?o[2]*n.scale[0]/2:0;return l.minX-h<=e[0]&&l.maxX+h>=0&&l.minY-h<=e[1]&&l.maxY+h>=0&&(a&&this.replayTextBackground_(t,Fs,Os,Ps,Ds,r,o),ts(t,n.canvasTransform,s,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=Cs(this.renderedTransform_,[0,0]),n=512*this.pixelRatio;t.save(),t.translate(i[0]%n,i[1]%n),1!==e&&t.scale(e,e),t.rotate(this.viewRotation_)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],e[1]&&(t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6]))}drawLabelWithPointPlacement_(t,e,i,n){const s=this.textStates[e],r=this.createLabel(t,e,n,i),o=this.strokeStates[i],a=this.pixelRatio,l=zs(Array.isArray(t)?t[0]:t,s.textAlign||Bn),h=ms[s.textBaseline||Nn],c=o&&o.lineWidth?o.lineWidth:0;return{label:r,anchorX:l*(r.width/a-2*s.scale[0])+2*(.5-l)*c,anchorY:h*r.height/a+2*(.5-h)*c}}execute_(t,e,i,n,s,r,o,a){const l=this.zIndexContext_;let h;var c,u;this.pixelCoordinates_&&ot(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=vs(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),c=this.renderedTransform_,u=i,c[0]=u[0],c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5]);let d=0;const g=n.length;let f,p,_,m,y,x,S,v,w,C,I,M,R,E=0,b=0,T=0;const L=this.coordinateCache_,A=this.viewRotation_,k=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,F={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:A},O=this.instructions!=n||this.overlaps?0:200;let P,D,W,G;for(;d<g;){const i=n[d];switch(i[0]){case os.BEGIN_GEOMETRY:P=i[1],G=i[3],P.getGeometry()?void 0===o||oe(o,G.getExtent())?++d:d=i[2]+1:d=i[2],l&&(l.zIndex=i[4]);break;case os.BEGIN_PATH:b>O&&(this.fill_(t),b=0),T>O&&(t.stroke(),T=0),b||T||(t.beginPath(),y=NaN,x=NaN),++d;break;case os.CIRCLE:E=i[1];const n=h[E],c=h[E+1],u=h[E+2]-n,g=h[E+3]-c,z=Math.sqrt(u*u+g*g);t.moveTo(n+z,c),t.arc(n,c,z,0,2*Math.PI,!0),++d;break;case os.CLOSE_PATH:t.closePath(),++d;break;case os.CUSTOM:E=i[1],f=i[2];const B=i[3],N=i[4],Y=i[5];F.geometry=B,F.feature=P,d in L||(L[d]=[]);const X=L[d];Y?Y(h,E,f,2,X):(X[0]=h[E],X[1]=h[E+1],X.length=2),l&&(l.zIndex=i[6]),N(X,F),++d;break;case os.DRAW_IMAGE:E=i[1],f=i[2],w=i[3],p=i[4],_=i[5];let V=i[6];const Z=i[7],j=i[8],K=i[9],q=i[10];let $=i[11];const H=i[12];let U=i[13];m=i[14]||"declutter";const J=i[15];if(!w&&i.length>=20){C=i[19],I=i[20],M=i[21],R=i[22];const t=this.drawLabelWithPointPlacement_(C,I,M,R);w=t.label,i[3]=w;const e=i[23];p=(t.anchorX-e)*this.pixelRatio,i[4]=p;const n=i[24];_=(t.anchorY-n)*this.pixelRatio,i[5]=_,V=w.height,i[6]=V,U=w.width,i[13]=U}let Q,tt,et,it;i.length>25&&(Q=i[25]),i.length>17?(tt=i[16],et=i[17],it=i[18]):(tt=Yn,et=null,it=null),q&&k?$+=A:q||k||($-=A);let nt=0;for(;E<f;E+=2){if(Q&&Q[nt++]<U/this.pixelRatio)continue;const i=this.calculateImageOrLabelDimensions_(w.width,w.height,h[E],h[E+1],U,V,p,_,j,K,$,H,s,tt,!!et||!!it,P),n=[t,e,w,i,Z,et,it];if(a){let t,e,s,r,o;if(J){const i=f-E;if(!J[i]){J[i]={args:n,declutterMode:m};continue}const r=J[i];t=r.args,e=r.declutterMode,delete J[i],s=Ws(t)}if(!t||"declutter"===e&&a.collides(s)||(r=!0),"declutter"===m&&a.collides(i.declutterBox)||(o=!0),"declutter"===e&&"declutter"===m){const t=r&&o;r=t,o=t}r&&("none"!==e&&a.insert(s),this.replayImageOrLabel_.apply(this,t)),o&&("none"!==m&&a.insert(i.declutterBox),this.replayImageOrLabel_.apply(this,n))}else this.replayImageOrLabel_.apply(this,n)}++d;break;case os.DRAW_CHARS:const st=i[1],rt=i[2],ot=i[3],at=i[4];R=i[5];const lt=i[6],ht=i[7],ct=i[8];M=i[9];const ut=i[10];C=i[11],Array.isArray(C)&&(C=C.reduce(Ns,"")),I=i[12];const dt=[i[13],i[13]];m=i[14]||"declutter";const gt=i[15],ft=this.textStates[I],pt=ft.font,_t=[ft.scale[0]*ht,ft.scale[1]*ht];let mt;pt in this.widths_?mt=this.widths_[pt]:(mt={},this.widths_[pt]=mt);const yt=Ts(h,st,rt,2),xt=Math.abs(_t[0])*Qn(pt,C,mt);if(at||xt<=yt){const i=Ls(h,st,rt,2,C,(yt-xt)*zs(C,this.textStates[I].textAlign),lt,Math.abs(_t[0]),Qn,pt,mt,k?0:this.viewRotation_,gt);t:if(i){const n=[];let s,r,o,l,h;if(M)for(s=0,r=i.length;s<r;++s){h=i[s],o=h[4],l=this.createLabel(o,I,"",M),p=h[2]+(_t[0]<0?-ut:ut),_=ot*l.height+2*(.5-ot)*ut*_t[1]/_t[0]-ct;const r=this.calculateImageOrLabelDimensions_(l.width,l.height,h[0],h[1],l.width,l.height,p,_,0,0,h[3],dt,!1,Yn,!1,P);if(a&&"declutter"===m&&a.collides(r.declutterBox))break t;n.push([t,e,l,r,1,null,null])}if(R)for(s=0,r=i.length;s<r;++s){h=i[s],o=h[4],l=this.createLabel(o,I,R,""),p=h[2],_=ot*l.height-ct;const r=this.calculateImageOrLabelDimensions_(l.width,l.height,h[0],h[1],l.width,l.height,p,_,0,0,h[3],dt,!1,Yn,!1,P);if(a&&"declutter"===m&&a.collides(r.declutterBox))break t;n.push([t,e,l,r,1,null,null])}a&&"none"!==m&&a.load(n.map(Ws));for(let t=0,e=n.length;t<e;++t)this.replayImageOrLabel_.apply(this,n[t])}}++d;break;case os.END_GEOMETRY:if(void 0!==r){P=i[1];const t=r(P,G,m);if(t)return t}++d;break;case os.FILL:O?b++:this.fill_(t),++d;break;case os.MOVE_TO_LINE_TO:for(E=i[1],f=i[2],D=h[E],W=h[E+1],t.moveTo(D,W),y=D+.5|0,x=W+.5|0,E+=2;E<f;E+=2)D=h[E],W=h[E+1],S=D+.5|0,v=W+.5|0,E!=f-2&&S===y&&v===x||(t.lineTo(D,W),y=S,x=v);++d;break;case os.SET_FILL_STYLE:this.alignAndScaleFill_=i[2],b&&(this.fill_(t),b=0,T&&(t.stroke(),T=0)),t.fillStyle=i[1],++d;break;case os.SET_STROKE_STYLE:T&&(t.stroke(),T=0),this.setStrokeStyle_(t,i),++d;break;case os.STROKE:O?T++:t.stroke(),++d;break;default:++d}}b&&this.fill_(t),T&&t.stroke()}execute(t,e,i,n,s,r){this.viewRotation_=n,this.execute_(t,e,i,this.instructions,s,void 0,void 0,r)}executeHitDetection(t,e,i,n,s){return this.viewRotation_=i,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,n,s)}},Xs=["Polygon","Circle","LineString","Image","Text","Default"],Vs=["Image","Text"],Zs=Xs.filter(t=>!Vs.includes(t));const js={};const Ks=class{constructor(t,e,i,n,s,r,o){this.maxExtent_=t,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=r,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=[1,0,0,1,0,0],this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(s,o)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(const i in t){let n=this.executorsByZIndex_[i];void 0===n&&(n={},this.executorsByZIndex_[i]=n);const s=t[i];for(const t in s){const i=s[t];n[t]=new Ys(this.resolution_,this.pixelRatio_,this.overlaps_,i,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let e=0,n=t.length;e<n;++e)if(t[e]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,n,s,r){const o=2*(n=Math.round(n))+1,a=Is(this.hitDetectionTransform_,n+.5,n+.5,1/e,-1/e,-i,-t[0],-t[1]),l=!this.hitDetectionContext_;l&&(this.hitDetectionContext_=pe(o,o));const h=this.hitDetectionContext_;let c;h.canvas.width!==o||h.canvas.height!==o?(h.canvas.width=o,h.canvas.height=o):l||h.clearRect(0,0,o,o),void 0!==this.renderBuffer_&&(c=[1/0,1/0,-1/0,-1/0],$t(c,t),Nt(c,e*(this.renderBuffer_+n),c));const u=function(t){if(void 0!==js[t])return js[t];const e=2*t+1,i=t*t,n=new Array(i+1);for(let s=0;s<=t;++s)for(let r=0;r<=t;++r){const o=s*s+r*r;if(o>i)break;let a=n[o];a||(a=[],n[o]=a),a.push(4*((t+s)*e+(t+r))+3),s>0&&a.push(4*((t-s)*e+(t+r))+3),r>0&&(a.push(4*((t+s)*e+(t-r))+3),s>0&&a.push(4*((t-s)*e+(t-r))+3))}const s=[];for(let t=0,e=n.length;t<e;++t)n[t]&&s.push(...n[t]);return js[t]=s,s}(n);let d;function g(t,e,i){const a=h.getImageData(0,0,o,o).data;for(let l=0,c=u.length;l<c;l++)if(a[u[l]]>0){if(!r||"none"===i||"Image"!==d&&"Text"!==d||r.includes(t)){const i=(u[l]-3)/4,r=n-i%o,a=n-(i/o|0),h=s(t,e,r*r+a*a);if(h)return h}h.clearRect(0,0,o,o);break}}const f=Object.keys(this.executorsByZIndex_).map(Number);let p,_,m,y,x;for(f.sort(et),p=f.length-1;p>=0;--p){const t=f[p].toString();for(m=this.executorsByZIndex_[t],_=Xs.length-1;_>=0;--_)if(d=Xs[_],y=m[d],void 0!==y&&(x=y.executeHitDetection(h,a,i,g,c),x))return x}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],s=e[2],r=e[3],o=[i,n,i,r,s,r,s,n];return vs(o,0,8,2,t,o),o}isEmpty(){return ct(this.executorsByZIndex_)}execute(t,e,i,n,s,r,o){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(o?it:et),r=r||Xs;const l=Xs.length;for(let h=0,c=a.length;h<c;++h){const c=a[h].toString(),u=this.executorsByZIndex_[c];for(let c=0,d=r.length;c<d;++c){const d=r[c],g=u[d];if(void 0!==g){const r=null===o?void 0:g.getZIndexContext(),c=r?r.getContext():t,u=this.maxExtent_&&"Image"!==d&&"Text"!==d;if(u&&(c.save(),this.clip(c,i)),r&&"Text"!==d&&"Image"!==d?r.pushFunction(t=>g.execute(t,e,i,n,s,o)):g.execute(c,e,i,n,s,o),u&&c.restore(),r){r.offset();const t=a[h]*l+Xs.indexOf(d);this.deferredZIndexContexts_[t]||(this.deferredZIndexContexts_[t]=[]),this.deferredZIndexContexts_[t].push(r)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(et);for(let i=0,n=e.length;i<n;++i)t[e[i]].forEach(t=>{t.draw(this.renderedContext_),t.clear()}),t[e[i]].length=0}};function qs(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}class $s{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=qs(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new $s({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 yt()}getImage(t){return yt()}getHitDetectionImage(){return yt()}getPixelRatio(t){return 1}getImageState(){return yt()}getImageSize(){return yt()}getOrigin(){return yt()}getSize(){return yt()}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_=qs(t)}listenImageChange(t){yt()}load(){yt()}unlistenImageChange(t){yt()}ready(){return Promise.resolve()}}const Hs=$s;function Us(t,e,i,n){return void 0!==i&&void 0!==n?[i/t,n/e]:void 0!==i?i/t:void 0!==n?n/e:1}class Js extends Hs{constructor(t){const e=void 0!==(t=t||{}).opacity?t.opacity:1,i=void 0!==t.rotation?t.rotation:0,n=void 0!==t.scale?t.scale:1,s=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:i,scale:n,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:s,declutterMode:t.declutterMode}),this.anchor_=void 0!==t.anchor?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==t.anchorOrigin?t.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==t.anchorXUnits?t.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==t.anchorYUnits?t.anchorYUnits:"fraction",this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null;const r=void 0!==t.img?t.img:null;let o,a=t.src;if(Rt(!(void 0!==a&&r),"`image` and `src` cannot be provided at the same time"),void 0!==a&&0!==a.length||!r||(a=r.src||St(r)),Rt(void 0!==a&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),Rt(!((void 0!==t.width||void 0!==t.height)&&void 0!==t.scale),"`width` or `height` cannot be provided together with `scale`"),void 0!==t.src?o=ji:void 0!==r&&(o="complete"in r?r.complete?r.src?qi:ji:Ki:qi),this.color_=void 0!==t.color?pn(t.color):null,this.iconImage_=Cn(r,a,this.crossOrigin_,o,this.color_),this.offset_=void 0!==t.offset?t.offset:[0,0],this.offsetOrigin_=void 0!==t.offsetOrigin?t.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==t.size?t.size:null,this.initialOptions_,void 0!==t.width||void 0!==t.height){let e,i;if(t.size)[e,i]=t.size;else{const n=this.getImage(1);if(n.width&&n.height)e=n.width,i=n.height;else if(n instanceof HTMLImageElement){this.initialOptions_=t;const e=()=>{if(this.unlistenImageChange(e),!this.initialOptions_)return;const i=this.iconImage_.getSize();this.setScale(Us(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(Us(e,i,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 Js({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:null!==this.size_?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 e=this.getSize();if("fraction"==this.anchorXUnits_||"fraction"==this.anchorYUnits_){if(!e)return null;t=this.anchor_.slice(),"fraction"==this.anchorXUnits_&&(t[0]*=e[0]),"fraction"==this.anchorYUnits_&&(t[1]*=e[1])}if("top-left"!=this.anchorOrigin_){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),"top-right"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[0]=-t[0]+e[0]),"bottom-left"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[1]=-t[1]+e[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("top-left"!=this.offsetOrigin_){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[0]=i[0]-e[0]-t[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(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();return this.size_?this.size_[0]*t[0]:this.iconImage_.getImageState()==qi?this.iconImage_.getSize()[0]*t[0]:void 0}getHeight(){const t=this.getScaleArray();return this.size_?this.size_[1]*t[1]:this.iconImage_.getImageState()==qi?this.iconImage_.getSize()[1]*t[1]:void 0}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(Q,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(Q,t)}ready(){return this.iconImage_.ready()}}const Qs=Js,tr=[1,0,0,1,0,0],er=[NaN,NaN];const ir=class extends wt{constructor(){super(),this.extent_=[1/0,1/0,-1/0,-1/0],this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=function(t){let e,i,n;return function(){const s=Array.prototype.slice.call(arguments);return i&&this===n&&ot(s,i)||(n=this,i=s,e=t.apply(this,arguments)),e}}((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const n=this.clone();return n.applyTransform(i),n.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return yt()}closestPointXY(t,e,i,n){return yt()}containsXY(t,e){return 0===this.closestPointXY(t,e,er,Number.MIN_VALUE)}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 yt()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&qt(t),this.extentRevision_=this.getRevision()}return function(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t}(this.extent_,t)}rotate(t,e){yt()}scale(t,e,i){yt()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return yt()}getType(){return yt()}applyTransform(t){yt()}intersectsExtent(t){return yt()}translate(t,e){yt()}transform(t,e){const i=Mi(t),n="tile-pixels"==i.getUnits()?function(t,n,s){const r=i.getExtent(),o=i.getWorldExtent(),a=ie(o)/ie(r);Is(tr,o[0],o[3],a,-a,0,0,0);const l=vs(t,0,t.length,s,tr,n),h=Li(i,e);return h?h(l,l,s):l}:Li(i,e);return this.applyTransform(n),this}};function nr(t){let e;return"XY"==t?e=2:"XYZ"==t||"XYM"==t?e=3:"XYZM"==t&&(e=4),e}const sr=class extends ir{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return e=this.flatCoordinates,i=0,n=this.flatCoordinates.length,s=this.stride,Ht(qt(t),e,i,n,s);var e,i,n,s}getCoordinates(){return yt()}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||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&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=nr(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){yt()}setLayout(t,e,i){let n;if(t)n=nr(t);else{for(let t=0;t<i;++t){if(0===e.length)return this.layout="XY",void(this.stride=2);e=e[0]}n=e.length,t=function(t){let e;2==t?e="XY":3==t?e="XYZ":4==t&&(e="XYZM");return e}(n)}this.layout=t,this.stride=n}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();ws(i,0,i.length,n,t,e,i),this.changed()}}scale(t,e,i){void 0===e&&(e=t),i||(i=te(this.getExtent()));const n=this.getFlatCoordinates();if(n){const s=this.getStride();!function(t,e,i,n,s,r,o,a){a=a||[];const l=o[0],h=o[1];let c=0;for(let o=e;o<i;o+=n){const e=t[o]-l,i=t[o+1]-h;a[c++]=l+s*e,a[c++]=h+r*i;for(let e=o+2;e<o+n;++e)a[c++]=t[e]}a&&a.length!=c&&(a.length=c)}(n,0,n.length,s,t,e,i,n),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();!function(t,e,i,n,s,r,o){o=o||[];let a=0;for(let l=e;l<i;l+=n){o[a++]=t[l]+s,o[a++]=t[l+1]+r;for(let e=l+2;e<l+n;++e)o[a++]=t[e]}o&&o.length!=a&&(o.length=a)}(i,0,i.length,n,t,e,i),this.changed()}}};const rr=class extends Tn{constructor(t,e,i,n,s,r,o){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=n,this.transformRotation_=n?je(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=s,this.squaredTolerance_=r,this.userTransform_=o,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_=[1,0,0,1,0,0]}drawImages_(t,e,i,n){if(!this.image_)return;const s=vs(t,e,i,n,this.transform_,this.pixelCoordinates_),r=this.context_,o=this.tmpLocalTransform_,a=r.globalAlpha;1!=this.imageOpacity_&&(r.globalAlpha=a*this.imageOpacity_);let l=this.imageRotation_;0===this.transformRotation_&&(l-=this.viewRotation_),this.imageRotateWithView_&&(l+=this.viewRotation_);for(let t=0,e=s.length;t<e;t+=2){const e=s[t]-this.imageAnchorX_,i=s[t+1]-this.imageAnchorY_;if(0!==l||1!=this.imageScale_[0]||1!=this.imageScale_[1]){const t=e+this.imageAnchorX_,n=i+this.imageAnchorY_;Is(o,t,n,1,1,l,-t,-n),r.save(),r.transform.apply(r,o),r.translate(t,n),r.scale(this.imageScale_[0],this.imageScale_[1]),r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),r.restore()}else r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,e,i,this.imageWidth_,this.imageHeight_)}1!=this.imageOpacity_&&(r.globalAlpha=a)}drawText_(t,e,i,n){if(!this.textState_||""===this.text_)return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const s=vs(t,e,i,n,this.transform_,this.pixelCoordinates_),r=this.context_;let o=this.textRotation_;for(0===this.transformRotation_&&(o-=this.viewRotation_),this.textRotateWithView_&&(o+=this.viewRotation_);e<i;e+=n){const t=s[e]+this.textOffsetX_,i=s[e+1]+this.textOffsetY_;0!==o||1!=this.textScale_[0]||1!=this.textScale_[1]?(r.save(),r.translate(t-this.textOffsetX_,i-this.textOffsetY_),r.rotate(o),r.translate(this.textOffsetX_,this.textOffsetY_),r.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&r.strokeText(this.text_,0,0),this.textFillState_&&r.fillText(this.text_,0,0),r.restore()):(this.textStrokeState_&&r.strokeText(this.text_,t,i),this.textFillState_&&r.fillText(this.text_,t,i))}}moveToLineTo_(t,e,i,n,s){const r=this.context_,o=vs(t,e,i,n,this.transform_,this.pixelCoordinates_);r.moveTo(o[0],o[1]);let a=o.length;s&&(a-=2);for(let t=2;t<a;t+=2)r.lineTo(o[t],o[t+1]);return s&&r.closePath(),i}drawRings_(t,e,i,n){for(let s=0,r=i.length;s<r;++s)e=this.moveToLineTo_(t,e,i[s],n,!0);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),oe(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=function(t,e,i){const n=t.getFlatCoordinates();if(!n)return null;const s=t.getStride();return vs(n,0,n.length,s,e,i)}(t,this.transform_,this.pixelCoordinates_),i=e[2]-e[0],n=e[3]-e[1],s=Math.sqrt(i*i+n*n),r=this.context_;r.beginPath(),r.arc(e[0],e[1],s,0,2*Math.PI),this.fillState_&&r.fill(),this.strokeState_&&r.stroke()}""!==this.text_&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t)}}drawFeature(t,e){const i=e.getGeometryFunction()(t);i&&(this.setStyle(e),this.drawGeometry(i))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let t=0,i=e.length;t<i;++t)this.drawGeometry(e[t])}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_)),oe(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(oe(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();let n=0;const s=t.getEnds(),r=t.getStride();e.beginPath();for(let t=0,e=s.length;t<e;++t)n=this.moveToLineTo_(i,n,s[t],r,!1);e.stroke()}if(""!==this.text_){const e=t.getFlatMidpoints();this.drawText_(e,0,e.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),oe(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_)),oe(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getOrientedFlatCoordinates();let n=0;const s=t.getEndss(),r=t.getStride();e.beginPath();for(let t=0,e=s.length;t<e;++t){const e=s[t];n=this.drawRings_(i,n,e,r)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,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),ot(i.lineDash,t.lineDash)||e.setLineDash(i.lineDash=t.lineDash),i.lineDashOffset!=t.lineDashOffset&&(i.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),i.lineJoin!=t.lineJoin&&(i.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),i.lineWidth!=t.lineWidth&&(i.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),i.miterLimit!=t.miterLimit&&(i.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),i.strokeStyle!=t.strokeStyle&&(i.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){const e=this.context_,i=this.contextTextState_,n=t.textAlign?t.textAlign:Bn;i?(i.font!=t.font&&(i.font=t.font,e.font=t.font),i.textAlign!=n&&(i.textAlign=n,e.textAlign=n),i.textBaseline!=t.textBaseline&&(i.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=n,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:n,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(t){const e=t.getColor();this.fillState_={fillStyle:Mn(e||Pn)}}else this.fillState_=null;if(e){const t=e.getColor(),i=e.getLineCap(),n=e.getLineDash(),s=e.getLineDashOffset(),r=e.getLineJoin(),o=e.getWidth(),a=e.getMiterLimit(),l=n||Wn;this.strokeState_={lineCap:void 0!==i?i:Dn,lineDash:1===this.pixelRatio_?l:l.map(t=>t*this.pixelRatio_),lineDashOffset:(s||0)*this.pixelRatio_,lineJoin:void 0!==r?r:Gn,lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:Mn(t||zn)}}else this.strokeState_=null}setImageStyle(t){let e;if(!t||!(e=t.getSize()))return void(this.image_=null);const i=t.getPixelRatio(this.pixelRatio_),n=t.getAnchor(),s=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const r=t.getScaleArray();this.imageScale_=[r[0]*this.pixelRatio_/i,r[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.textFillState_={fillStyle:Mn(t||Pn)}}else this.textFillState_=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),n=i.getLineDash(),s=i.getLineDashOffset(),r=i.getLineJoin(),o=i.getWidth(),a=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:Dn,lineDash:n||Wn,lineDashOffset:s||0,lineJoin:void 0!==r?r:Gn,lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:10,strokeStyle:Mn(t||zn)}}else this.textStrokeState_=null;const n=t.getFont(),s=t.getOffsetX(),r=t.getOffsetY(),o=t.getRotateWithView(),a=t.getRotation(),l=t.getScaleArray(),h=t.getText(),c=t.getTextAlign(),u=t.getTextBaseline();this.textState_={font:void 0!==n?n:On,textAlign:void 0!==c?c:Bn,textBaseline:void 0!==u?u:Nn},this.text_=void 0!==h?Array.isArray(h)?h.reduce((t,e,i)=>t+(i%2?" ":e),""):h:"",this.textOffsetX_=void 0!==s?this.pixelRatio_*s:0,this.textOffsetY_=void 0!==r?this.pixelRatio_*r:0,this.textRotateWithView_=void 0!==o&&o,this.textRotation_=void 0!==a?a:0,this.textScale_=[this.pixelRatio_*l[0],this.pixelRatio_*l[1]]}else this.text_=""}},or=.5;const ar={Point:function(t,e,i,n,s,r){const o=i.getImage(),a=i.getText(),l=a&&a.getText(),h=r&&o&&l?{}:void 0;if(o){if(o.getImageState()!=qi)return;const r=t.getBuilder(i.getZIndex(),"Image");r.setImageStyle(o,h),r.drawPoint(e,n,s)}if(l){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a,h),r.drawText(e,n,s)}},LineString:function(t,e,i,n,s){const r=i.getStroke();if(r){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,r),o.drawLineString(e,n,s)}const o=i.getText();if(o&&o.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(o),r.drawText(e,n,s)}},Polygon:function(t,e,i,n,s){const r=i.getFill(),o=i.getStroke();if(r||o){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(r,o),a.drawPolygon(e,n,s)}const a=i.getText();if(a&&a.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,n,s)}},MultiPoint:function(t,e,i,n,s,r){const o=i.getImage(),a=o&&0!==o.getOpacity(),l=i.getText(),h=l&&l.getText(),c=r&&a&&h?{}:void 0;if(a){if(o.getImageState()!=qi)return;const r=t.getBuilder(i.getZIndex(),"Image");r.setImageStyle(o,c),r.drawMultiPoint(e,n,s)}if(h){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(l,c),r.drawText(e,n,s)}},MultiLineString:function(t,e,i,n,s){const r=i.getStroke();if(r){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,r),o.drawMultiLineString(e,n,s)}const o=i.getText();if(o&&o.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(o),r.drawText(e,n,s)}},MultiPolygon:function(t,e,i,n,s){const r=i.getFill(),o=i.getStroke();if(o||r){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(r,o),a.drawMultiPolygon(e,n,s)}const a=i.getText();if(a&&a.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,n,s)}},GeometryCollection:function(t,e,i,n,s,r){const o=e.getGeometriesArray();let a,l;for(a=0,l=o.length;a<l;++a){(0,ar[o[a].getType()])(t,o[a],i,n,s,r)}},Circle:function(t,e,i,n,s){const r=i.getFill(),o=i.getStroke();if(r||o){const a=t.getBuilder(i.getZIndex(),"Circle");a.setFillStrokeStyle(r,o),a.drawCircle(e,n,s)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n)}}};function lr(t,e){return parseInt(St(t),10)-parseInt(St(e),10)}function hr(t,e){const i=cr(t,e);return i*i}function cr(t,e){return.5*t/e}function ur(t,e,i,n,s,r,o,a){const l=[],h=i.getImage();if(h){let t=!0;const e=h.getImageState();e==qi||e==$i?t=!1:e==ji&&h.load(),t&&l.push(h.ready())}const c=i.getFill();c&&c.loading()&&l.push(c.ready());const u=l.length>0;return u&&Promise.all(l).then(()=>s(null)),function(t,e,i,n,s,r,o){const a=i.getGeometryFunction()(e);if(!a)return;const l=a.simplifyTransformed(n,s),h=i.getRenderer();if(h)dr(t,l,i,e,o);else{(0,ar[l.getType()])(t,l,i,e,o,r)}}(t,e,i,n,r,o,a),u}function dr(t,e,i,n,s){if("GeometryCollection"==e.getType()){const r=e.getGeometries();for(let e=0,o=r.length;e<o;++e)dr(t,r[e],i,n,s);return}t.getBuilder(i.getZIndex(),"Default").drawCustom(e,n,i.getRenderer(),i.getHitDetectionRenderer(),s)}const gr=class extends ut{constructor(t,e,i,n){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=n}};const fr=class extends mt{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=5}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return yt()}getData(t){return null}prepareFrame(t){return yt()}renderFrame(t,e){return yt()}forEachFeatureAtCoordinate(t,e,i,n,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;e.getState()!==qi&&e.getState()!==$i||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=qi&&e!=$i&&t.addEventListener(Q,this.boundHandleImageChange_),e==ji&&(t.load(),e=t.getState()),e==qi}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}},pr=[];let _r=null;const mr=class extends fr{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=[1,0,0,1,0,0],this.pixelTransform=[1,0,0,1,0,0],this.inversePixelTransform=[1,0,0,1,0,0],this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){let n;_r||(_r=pe(1,1,void 0,{willReadFrequently:!0})),_r.clearRect(0,0,1,1);try{_r.drawImage(t,e,i,1,1,0,0,1,1),n=_r.getImageData(0,0,1,1).data}catch{return _r=null,null}return n}getBackground(t){let e=this.getLayer().getBackground();return"function"==typeof e&&(e=e(t.viewState.resolution)),e||void 0}useContainer(t,e,i){const n=this.getLayer().getClassName();let s,r;if(t&&t.className===n&&(!i||t&&t.style.backgroundColor&&ot(pn(t.style.backgroundColor),pn(i)))){const e=t.firstElementChild;e instanceof HTMLCanvasElement&&(r=e.getContext("2d"))}if(r&&function(t,e){const i=bs(t),n=bs(e);for(let t=0;t<6;++t)if(0!==Math.round((i[t]-n[t])*Rs[t]))return!1;return!0}(r.canvas.style.transform,e)?(this.container=t,this.context=r,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){s=document.createElement("div"),s.className=n;let t=s.style;t.position="absolute",t.width="100%",t.height="100%",r=pe();const e=r.canvas;s.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=s,this.context=r}this.containerReused||!i||this.container.style.backgroundColor||(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const n=ne(i),s=se(i),r=Qt(i),o=Jt(i);Cs(e.coordinateToPixelTransform,n),Cs(e.coordinateToPixelTransform,s),Cs(e.coordinateToPixelTransform,r),Cs(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;Cs(a,n),Cs(a,s),Cs(a,r),Cs(a,o),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.clip()}prepareContainer(t,e){const i=t.extent,n=t.viewState.resolution,s=t.viewState.rotation,r=t.pixelRatio,o=Math.round(re(i)/n*r),a=Math.round(ie(i)/n*r);Is(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/r,1/r,s,-o/2,-a/2),Ms(this.inversePixelTransform,this.pixelTransform);const l=Es(this.pixelTransform);if(this.useContainer(e,l,this.getBackground(t)),!this.containerReused){const t=this.context.canvas;t.width!=o||t.height!=a?(t.width=o,t.height=a):this.context.clearRect(0,0,o,a),l!==t.style.transform&&(t.style.transform=l)}}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const s=new gr(t,this.inversePixelTransform,i,e);n.dispatchEvent(s)}}preRender(t,e){this.frameState=e,e.declutter||this.dispatchRenderEvent_(Xi,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(Vi,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new As),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(Xi,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(Vi,this.context,t))}getRenderTransform(t,e,i,n,s,r,o){const a=s/2,l=r/2,h=n/e,c=-h,u=-t[0]+o,d=-t[1];return Is(this.tempTransform,a,l,h,c,-i,u,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}};const yr=class extends mr{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipped_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=[1/0,1/0,-1/0,-1/0],this.wrappedRenderedExtent_=[1/0,1/0,-1/0,-1/0],this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(t,e,i){const n=e.extent,s=e.viewState,r=s.center,o=s.resolution,a=s.projection,l=s.rotation,h=a.getExtent(),c=this.getLayer().getSource(),u=this.getLayer().getDeclutter(),d=e.pixelRatio,g=e.viewHints,f=!(g[Ft]||g[Ot]),p=this.context,_=Math.round(re(n)/o*d),m=Math.round(ie(n)/o*d),y=c.getWrapX()&&a.canWrapX(),x=y?re(h):null,S=y?Math.ceil((n[2]-h[2])/x)+1:1;let v=y?Math.floor((n[0]-h[0])/x):0;do{let n=this.getRenderTransform(r,o,0,d,_,m,v*x);e.declutter&&(n=n.slice(0)),t.execute(p,[p.canvas.width,p.canvas.height],n,l,f,void 0===i?Xs:i?Vs:Zs,i?u&&e.declutter[u]:void 0)}while(++v<S)}setDrawContext_(){1!==this.opacity_&&(this.targetContext_=this.context,this.context=pe(this.context.canvas.width,this.context.canvas.height,pr))}resetDrawContext_(){if(1!==this.opacity_&&this.targetContext_){const t=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=t,function(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}(this.context),pr.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(t){this.replayGroup_&&this.getLayer().getDeclutter()&&this.renderWorlds(this.replayGroup_,t,!0)}renderDeferredInternal(t){this.replayGroup_&&(this.replayGroup_.renderDeferred(),this.clipped_&&this.context.restore(),this.resetDrawContext_())}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex];this.opacity_=i.opacity;const n=t.viewState;this.prepareContainer(t,e);const s=this.context,r=this.replayGroup_;let o=r&&!r.isEmpty();if(!o){if(!(this.getLayer().hasListener(Xi)||this.getLayer().hasListener(Vi)))return this.container}this.setDrawContext_(),this.preRender(s,t);const a=n.projection;if(this.clipped_=!1,o&&i.extent&&this.clipping){const e=Gi(i.extent,a);o=oe(e,t.extent),this.clipped_=o&&!Vt(e,t.extent),this.clipped_&&this.clipUnrotated(s,t,e)}return o&&this.renderWorlds(r,t,!this.getLayer().getDeclutter()&&void 0),!t.declutter&&this.clipped_&&s.restore(),this.postRender(s,t),this.renderedRotation_!==n.rotation&&(this.renderedRotation_=n.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise(e=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=this.frameState.size.slice(),e=this.renderedCenter_,i=this.renderedResolution_,n=this.renderedRotation_,s=this.renderedProjection_,r=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],l=t[0]*or,h=t[1]*or;a.push(this.getRenderTransform(e,i,n,or,l,h,0).slice());const c=o.getSource(),u=s.getExtent();if(c.getWrapX()&&s.canWrapX()&&!Vt(u,r)){let t=r[0];const s=re(u);let o,c=0;for(;t<u[0];)--c,o=s*c,a.push(this.getRenderTransform(e,i,n,or,l,h,o).slice()),t+=s;for(c=0,t=r[2];t>u[2];)++c,o=s*c,a.push(this.getRenderTransform(e,i,n,or,l,h,o).slice()),t-=s}const d=Oi();this.hitDetectionImageData_=function(t,e,i,n,s,r,o,a,l){const h=l?Wi(s,l):s,c=pe(t[0]*or,t[1]*or);c.imageSmoothingEnabled=!1;const u=c.canvas,d=new rr(c,or,s,null,o,a,l?bi(Oi(),l):null),g=i.length,f=Math.floor(16777215/g),p={};for(let t=1;t<=g;++t){const e=i[t-1],s=e.getStyleFunction()||n;if(!s)continue;let o=s(e,r);if(!o)continue;Array.isArray(o)||(o=[o]);const a=(t*f).toString(16).padStart(7,"#00000");for(let t=0,i=o.length;t<i;++t){const i=o[t],n=i.getGeometryFunction()(e);if(!n||!oe(h,n.getExtent()))continue;const s=i.clone(),r=s.getFill();r&&r.setColor(a);const l=s.getStroke();l&&(l.setColor(a),l.setLineDash(null)),s.setText(void 0);const c=i.getImage();if(c){const t=c.getImageSize();if(!t)continue;const e=pe(t[0],t[1],void 0,{alpha:!1}),i=e.canvas;e.fillStyle=a,e.fillRect(0,0,i.width,i.height),s.setImage(new Qs({img:i,anchor:c.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:c.getOrigin(),opacity:1,size:c.getSize(),scale:c.getScale(),rotation:c.getRotation(),rotateWithView:c.getRotateWithView()}))}const u=s.getZIndex()||0;let d=p[u];d||(d={},p[u]=d,d.Polygon=[],d.Circle=[],d.LineString=[],d.Point=[]);const g=n.getType();if("GeometryCollection"===g){const t=n.getGeometriesArrayRecursive();for(let e=0,i=t.length;e<i;++e){const i=t[e];d[i.getType().replace("Multi","")].push(i,s)}}else d[g.replace("Multi","")].push(n,s)}}const _=Object.keys(p).map(Number).sort(et);for(let t=0,i=_.length;t<i;++t){const i=p[_[t]];for(const t in i){const n=i[t];for(let t=0,i=n.length;t<i;t+=2){d.setStyle(n[t+1]);for(let i=0,s=e.length;i<s;++i)d.setTransform(e[i]),d.drawGeometry(n[t])}}}return c.getImageData(0,0,u.width,u.height)}(t,a,this.renderedFeatures_,o.getStyleFunction(),r,i,n,hr(i,this.renderedPixelRatio_),d?s:null)}e(function(t,e,i){const n=[];if(i){const s=Math.floor(Math.round(t[0])*or),r=Math.floor(Math.round(t[1])*or),o=4*(ze(s,0,i.width-1)+ze(r,0,i.height-1)*i.width),a=i.data[o],l=i.data[o+1],h=i.data[o+2]+256*(l+256*a),c=Math.floor(16777215/e.length);h&&h%c===0&&n.push(e[h/c-1])}return n}(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,n,s){if(!this.replayGroup_)return;const r=e.viewState.resolution,o=e.viewState.rotation,a=this.getLayer(),l={},h=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,r,o,i,function(t,e,i){const r=St(t),o=l[r];if(o){if(!0!==o&&i<o.distanceSq){if(0===i)return l[r]=!0,s.splice(s.lastIndexOf(o),1),n(t,a,e);o.geometry=e,o.distanceSq=i}}else{if(0===i)return l[r]=!0,n(t,a,e);s.push(l[r]={feature:t,layer:a,geometry:e,distanceSq:i,callback:n})}},h?e.declutter?.[h]?.all().map(t=>t.value):null)}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const n=t.viewHints[Ft],s=t.viewHints[Ot],r=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!r&&n||!o&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=t.extent,l=t.viewState,h=l.projection,c=l.resolution,u=t.pixelRatio,d=e.getRevision(),g=e.getRenderBuffer();let f=e.getRenderOrder();void 0===f&&(f=lr);const p=l.center.slice(),_=Nt(a,g*c),m=_.slice(),y=[_.slice()],x=h.getExtent();if(i.getWrapX()&&h.canWrapX()&&!Vt(x,t.extent)){const t=re(x),e=Math.max(re(_)/2,t);_[0]=x[0]-e,_[2]=x[2]+e,ue(p,h);const i=he(y[0],h);i[0]<x[0]&&i[2]<x[2]?y.push([i[0]+t,i[1],i[2]+t,i[3]]):i[0]>x[0]&&i[2]>x[2]&&y.push([i[0]-t,i[1],i[2]-t,i[3]])}if(this.ready&&this.renderedResolution_==c&&this.renderedRevision_==d&&this.renderedRenderOrder_==f&&this.renderedFrameDeclutter_===!!t.declutter&&Vt(this.wrappedRenderedExtent_,_))return ot(this.renderedExtent_,m)||(this.hitDetectionImageData_=null,this.renderedExtent_=m),this.renderedCenter_=p,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const S=new Ss(cr(c,u),_,c,u),v=Oi();let w;if(v){for(let t=0,e=y.length;t<e;++t){const e=Wi(y[t],h);i.loadFeatures(e,zi(c,h),v)}w=bi(v,h)}else for(let t=0,e=y.length;t<e;++t)i.loadFeatures(y[t],c,h);const C=hr(c,u);let I=!0;const M=(t,i)=>{let n;const s=t.getStyleFunction()||e.getStyleFunction();if(s&&(n=s(t,c)),n){const e=this.renderFeature(t,C,n,S,w,this.getLayer().getDeclutter(),i);I=I&&!e}},R=Wi(_,h),E=i.getFeaturesInExtent(R);f&&E.sort(f);for(let t=0,e=E.length;t<e;++t)M(E[t],t);this.renderedFeatures_=E,this.ready=I;const b=S.finish(),T=new Ks(_,c,u,i.getOverlaps(),b,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=c,this.renderedRevision_=d,this.renderedRenderOrder_=f,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=m,this.wrappedRenderedExtent_=_,this.renderedCenter_=p,this.renderedProjection_=h,this.renderedPixelRatio_=u,this.replayGroup_=T,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,n,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=ur(n,t,i[l],e,this.boundHandleStyleImageChange_,s,r,o)||a;else a=ur(n,t,i,e,this.boundHandleStyleImageChange_,s,r,o);return a}};function xr(t,e,i=0,n=t.length-1,s=vr){for(;n>i;){if(n-i>600){const r=n-i+1,o=e-i+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);xr(t,e,Math.max(i,Math.floor(e-o*l/r+h)),Math.min(n,Math.floor(e+(r-o)*l/r+h)),s)}const r=t[e];let o=i,a=n;for(Sr(t,i,e),s(t[n],r)>0&&Sr(t,i,n);o<a;){for(Sr(t,o,a),o++,a--;s(t[o],r)<0;)o++;for(;s(t[a],r)>0;)a--}0===s(t[i],r)?Sr(t,i,a):(a++,Sr(t,a,n)),a<=e&&(i=a+1),e<=a&&(n=a-1)}}function Sr(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function vr(t,e){return t<e?-1:t>e?1:0}class wr{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const i=[];if(!Or(t,e))return i;const n=this.toBBox,s=[];for(;e;){for(let r=0;r<e.children.length;r++){const o=e.children[r],a=e.leaf?n(o):o;Or(t,a)&&(e.leaf?i.push(o):Fr(t,a)?this._all(o,i):s.push(o))}e=s.pop()}return i}collides(t){let e=this.data;if(!Or(t,e))return!1;const i=[];for(;e;){for(let n=0;n<e.children.length;n++){const s=e.children[n],r=e.leaf?this.toBBox(s):s;if(Or(t,r)){if(e.leaf||Fr(t,r))return!0;i.push(s)}}e=i.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(let e=0;e<t.length;e++)this.insert(t[e]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const t=this.data;this.data=e,e=t}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=Pr([]),this}remove(t,e){if(!t)return this;let i=this.data;const n=this.toBBox(t),s=[],r=[];let o,a,l;for(;i||s.length;){if(i||(i=s.pop(),a=s[s.length-1],o=r.pop(),l=!0),i.leaf){const n=Cr(t,i.children,e);if(-1!==n)return i.children.splice(n,1),s.push(i),this._condense(s),this}l||i.leaf||!Fr(i,n)?a?(o++,i=a.children[o],l=!1):i=null:(s.push(i),r.push(o),o=0,a=i,i=i.children[0])}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const i=[];for(;t;)t.leaf?e.push(...t.children):i.push(...t.children),t=i.pop();return e}_build(t,e,i,n){const s=i-e+1;let r,o=this._maxEntries;if(s<=o)return r=Pr(t.slice(e,i+1)),Ir(r,this.toBBox),r;n||(n=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,n-1))),r=Pr([]),r.leaf=!1,r.height=n;const a=Math.ceil(s/o),l=a*Math.ceil(Math.sqrt(o));Dr(t,e,i,l,this.compareMinX);for(let s=e;s<=i;s+=l){const e=Math.min(s+l-1,i);Dr(t,s,e,a,this.compareMinY);for(let i=s;i<=e;i+=a){const s=Math.min(i+a-1,e);r.children.push(this._build(t,i,s,n-1))}}return Ir(r,this.toBBox),r}_chooseSubtree(t,e,i,n){for(;n.push(e),!e.leaf&&n.length-1!==i;){let i,n=1/0,s=1/0;for(let r=0;r<e.children.length;r++){const o=e.children[r],a=Tr(o),l=Ar(t,o)-a;l<s?(s=l,n=a<n?a:n,i=o):l===s&&a<n&&(n=a,i=o)}e=i||e.children[0]}return e}_insert(t,e,i){const n=i?t:this.toBBox(t),s=[],r=this._chooseSubtree(n,this.data,e,s);for(r.children.push(t),Rr(r,n);e>=0&&s[e].children.length>this._maxEntries;)this._split(s,e),e--;this._adjustParentBBoxes(n,s,e)}_split(t,e){const i=t[e],n=i.children.length,s=this._minEntries;this._chooseSplitAxis(i,s,n);const r=this._chooseSplitIndex(i,s,n),o=Pr(i.children.splice(r,i.children.length-r));o.height=i.height,o.leaf=i.leaf,Ir(i,this.toBBox),Ir(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)}_splitRoot(t,e){this.data=Pr([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Ir(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let n,s=1/0,r=1/0;for(let o=e;o<=i-e;o++){const e=Mr(t,0,o,this.toBBox),a=Mr(t,o,i,this.toBBox),l=kr(e,a),h=Tr(e)+Tr(a);l<s?(s=l,n=o,r=h<r?h:r):l===s&&h<r&&(r=h,n=o)}return n||i-e}_chooseSplitAxis(t,e,i){const n=t.leaf?this.compareMinX:Er,s=t.leaf?this.compareMinY:br;this._allDistMargin(t,e,i,n)<this._allDistMargin(t,e,i,s)&&t.children.sort(n)}_allDistMargin(t,e,i,n){t.children.sort(n);const s=this.toBBox,r=Mr(t,0,e,s),o=Mr(t,i-e,i,s);let a=Lr(r)+Lr(o);for(let n=e;n<i-e;n++){const e=t.children[n];Rr(r,t.leaf?s(e):e),a+=Lr(r)}for(let n=i-e-1;n>=e;n--){const e=t.children[n];Rr(o,t.leaf?s(e):e),a+=Lr(o)}return a}_adjustParentBBoxes(t,e,i){for(let n=i;n>=0;n--)Rr(e[n],t)}_condense(t){for(let e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children,e.splice(e.indexOf(t[i]),1)):this.clear():Ir(t[i],this.toBBox)}}function Cr(t,e,i){if(!i)return e.indexOf(t);for(let n=0;n<e.length;n++)if(i(t,e[n]))return n;return-1}function Ir(t,e){Mr(t,0,t.children.length,e,t)}function Mr(t,e,i,n,s){s||(s=Pr(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let r=e;r<i;r++){const e=t.children[r];Rr(s,t.leaf?n(e):e)}return s}function Rr(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function Er(t,e){return t.minX-e.minX}function br(t,e){return t.minY-e.minY}function Tr(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Lr(t){return t.maxX-t.minX+(t.maxY-t.minY)}function Ar(t,e){return(Math.max(e.maxX,t.maxX)-Math.min(e.minX,t.minX))*(Math.max(e.maxY,t.maxY)-Math.min(e.minY,t.minY))}function kr(t,e){const i=Math.max(t.minX,e.minX),n=Math.max(t.minY,e.minY),s=Math.min(t.maxX,e.maxX),r=Math.min(t.maxY,e.maxY);return Math.max(0,s-i)*Math.max(0,r-n)}function Fr(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function Or(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function Pr(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Dr(t,e,i,n,s){const r=[e,i];for(;r.length;){if((i=r.pop())-(e=r.pop())<=n)continue;const o=e+Math.ceil((i-e)/n/2)*n;xr(t,o,e,i,s),r.push(e,o,o,i)}}let Wr=0;const Gr=1<<Wr++,zr=1<<Wr++,Br=1<<Wr++,Nr=1<<Wr++,Yr=1<<Wr++,Xr=1<<Wr++,Vr=Math.pow(2,6)-1,Zr={[Gr]:"boolean",[zr]:"number",[Br]:"string",[Nr]:"color",[Yr]:"number[]",[Xr]:"size"},jr=Object.keys(Zr).map(Number).sort(et);function Kr(t){const e=[];for(const i of jr)qr(t,i)&&e.push(Zr[i]);return 0===e.length?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function qr(t,e){return(t&e)===e}function $r(t,e){return t===e}class Hr{constructor(t,e){if(!function(t){return t in Zr}(t))throw new Error(`literal expressions must have a specific type, got ${Kr(t)}`);this.type=t,this.value=e}}class Ur{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function Jr(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1,mapState:!1}}function Qr(t,e,i){switch(typeof t){case"boolean":if($r(e,Br))return new Hr(Br,t?"true":"false");if(!qr(e,Gr))throw new Error(`got a boolean, but expected ${Kr(e)}`);return new Hr(Gr,t);case"number":if($r(e,Xr))return new Hr(Xr,qs(t));if($r(e,Gr))return new Hr(Gr,!!t);if($r(e,Br))return new Hr(Br,t.toString());if(!qr(e,zr))throw new Error(`got a number, but expected ${Kr(e)}`);return new Hr(zr,t);case"string":if($r(e,Nr))return new Hr(Nr,fn(t));if($r(e,Gr))return new Hr(Gr,!!t);if(!qr(e,Br))throw new Error(`got a string, but expected ${Kr(e)}`);return new Hr(Br,t)}if(!Array.isArray(t))throw new Error("expression must be an array or a primitive value");if(0===t.length)throw new Error("empty expression");if("string"==typeof t[0])return function(t,e,i){const n=t[0],s=qo[n];if(!s)throw new Error(`unknown operator: ${n}`);return s(t,e,i)}(t,e,i);for(const e of t)if("number"!=typeof e)throw new Error("expected an array of numbers");if($r(e,Xr)){if(2!==t.length)throw new Error(`expected an array of two values for a size, got ${t.length}`);return new Hr(Xr,t)}if($r(e,Nr)){if(3===t.length)return new Hr(Nr,[...t,1]);if(4===t.length)return new Hr(Nr,t);throw new Error(`expected an array of 3 or 4 values for a color, got ${t.length}`)}if(!qr(e,Yr))throw new Error(`got an array of numbers, but expected ${Kr(e)}`);return new Hr(Yr,t)}const to="get",eo="var",io="concat",no="geometry-type",so="line-metric",ro="any",oo="all",ao="!",lo="resolution",ho="zoom",co="time",uo="==",go="!=",fo=">",po=">=",_o="<",mo="<=",yo="*",xo="/",So="+",vo="-",wo="clamp",Co="%",Io="^",Mo="abs",Ro="floor",Eo="ceil",bo="round",To="sin",Lo="cos",Ao="atan",ko="sqrt",Fo="match",Oo="between",Po="interpolate",Do="coalesce",Wo="case",Go="in",zo="number",Bo="string",No="array",Yo="color",Xo="id",Vo="band",Zo="palette",jo="to-string",Ko="has",qo={[to]:ia(Jo(1,1/0),$o),[eo]:ia(Jo(1,1),function(t,e,i){const n=t[1];if("string"!=typeof n)throw new Error("expected a string argument for var operation");return i.variables.add(n),[new Hr(Br,n)]}),[Ko]:ia(Jo(1,1/0),$o),[Xo]:ia(function(t,e,i){i.featureId=!0},Uo),[io]:ia(Jo(2,1/0),ta(Br)),[no]:ia(function(t,e,i){i.geometryType=!0},Uo),[so]:ia(Uo),[lo]:ia(Ho,Uo),[ho]:ia(Ho,Uo),[co]:ia(Ho,Uo),[ro]:ia(Jo(2,1/0),ta(Gr)),[oo]:ia(Jo(2,1/0),ta(Gr)),[ao]:ia(Jo(1,1),ta(Gr)),[uo]:ia(Jo(2,2),ta(Vr)),[go]:ia(Jo(2,2),ta(Vr)),[fo]:ia(Jo(2,2),ta(zr)),[po]:ia(Jo(2,2),ta(zr)),[_o]:ia(Jo(2,2),ta(zr)),[mo]:ia(Jo(2,2),ta(zr)),[yo]:ia(Jo(2,1/0),Qo),[Do]:ia(Jo(2,1/0),Qo),[xo]:ia(Jo(2,2),ta(zr)),[So]:ia(Jo(2,1/0),ta(zr)),[vo]:ia(Jo(2,2),ta(zr)),[wo]:ia(Jo(3,3),ta(zr)),[Co]:ia(Jo(2,2),ta(zr)),[Io]:ia(Jo(2,2),ta(zr)),[Mo]:ia(Jo(1,1),ta(zr)),[Ro]:ia(Jo(1,1),ta(zr)),[Eo]:ia(Jo(1,1),ta(zr)),[bo]:ia(Jo(1,1),ta(zr)),[To]:ia(Jo(1,1),ta(zr)),[Lo]:ia(Jo(1,1),ta(zr)),[Ao]:ia(Jo(1,2),ta(zr)),[ko]:ia(Jo(1,1),ta(zr)),[Fo]:ia(Jo(4,1/0),ea,function(t,e,i){const n=t.length-1,s=Br|zr|Gr,r=Qr(t[1],s,i),o=Qr(t[t.length-1],e,i),a=new Array(n-2);for(let e=0;e<n-2;e+=2){try{const n=Qr(t[e+2],r.type,i);a[e]=n}catch(t){throw new Error(`failed to parse argument ${e+1} of match expression: ${t.message}`)}try{const n=Qr(t[e+3],o.type,i);a[e+1]=n}catch(t){throw new Error(`failed to parse argument ${e+2} of match expression: ${t.message}`)}}return[r,...a,o]}),[Oo]:ia(Jo(3,3),ta(zr)),[Po]:ia(Jo(6,1/0),ea,function(t,e,i){const n=t[1];let s;switch(n[0]){case"linear":s=1;break;case"exponential":const t=n[1];if("number"!=typeof t||t<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(t)} instead`);s=t;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(n)}`)}const r=new Hr(zr,s);let o;try{o=Qr(t[2],zr,i)}catch(t){throw new Error(`failed to parse argument 1 in interpolate expression: ${t.message}`)}const a=new Array(t.length-3);for(let n=0;n<a.length;n+=2){try{const e=Qr(t[n+3],zr,i);a[n]=e}catch(t){throw new Error(`failed to parse argument ${n+2} for interpolate expression: ${t.message}`)}try{const s=Qr(t[n+4],e,i);a[n+1]=s}catch(t){throw new Error(`failed to parse argument ${n+3} for interpolate expression: ${t.message}`)}}return[r,o,...a]}),[Wo]:ia(Jo(3,1/0),function(t,e,i){const n=t[0],s=t.length-1;if(s%2==0)throw new Error(`expected an odd number of arguments for ${n}, got ${s} instead`)},function(t,e,i){const n=Qr(t[t.length-1],e,i),s=new Array(t.length-1);for(let e=0;e<s.length-1;e+=2){try{const n=Qr(t[e+1],Gr,i);s[e]=n}catch(t){throw new Error(`failed to parse argument ${e} of case expression: ${t.message}`)}try{const r=Qr(t[e+2],n.type,i);s[e+1]=r}catch(t){throw new Error(`failed to parse argument ${e+1} of case expression: ${t.message}`)}}return s[s.length-1]=n,s}),[Go]:ia(Jo(2,2),function(t,e,i){let n,s=t[2];if(!Array.isArray(s))throw new Error('the second argument for the "in" operator must be an array');if("string"==typeof s[0]){if("literal"!==s[0])throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');if(!Array.isArray(s[1]))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array');s=s[1],n=Br}else n=zr;const r=new Array(s.length);for(let t=0;t<r.length;t++)try{const e=Qr(s[t],n,i);r[t]=e}catch(e){throw new Error(`failed to parse haystack item ${t} for "in" expression: ${e.message}`)}return[Qr(t[1],n,i),...r]}),[zo]:ia(Jo(1,1/0),ta(Vr)),[Bo]:ia(Jo(1,1/0),ta(Vr)),[No]:ia(Jo(1,1/0),ta(zr)),[Yo]:ia(Jo(1,4),ta(zr)),[Vo]:ia(Jo(1,3),ta(zr)),[Zo]:ia(Jo(2,2),function(t,e,i){let n;try{n=Qr(t[1],zr,i)}catch(t){throw new Error(`failed to parse first argument in palette expression: ${t.message}`)}const s=t[2];if(!Array.isArray(s))throw new Error("the second argument of palette must be an array");const r=new Array(s.length);for(let t=0;t<r.length;t++){let e;try{e=Qr(s[t],Nr,i)}catch(e){throw new Error(`failed to parse color at index ${t} in palette expression: ${e.message}`)}if(!(e instanceof Hr))throw new Error(`the palette color at index ${t} must be a literal value`);r[t]=e}return[n,...r]}),[jo]:ia(Jo(1,1),ta(Gr|zr|Br|Nr))};function $o(t,e,i){const n=t.length-1,s=new Array(n);for(let e=0;e<n;++e){const n=t[e+1];switch(typeof n){case"number":s[e]=new Hr(zr,n);break;case"string":s[e]=new Hr(Br,n);break;default:throw new Error(`expected a string key or numeric array index for a get operation, got ${n}`)}0===e&&i.properties.add(String(n))}return s}function Ho(t,e,i){i.mapState=!0}function Uo(t,e,i){const n=t[0];if(1!==t.length)throw new Error(`expected no arguments for ${n} operation`);return[]}function Jo(t,e){return function(i,n,s){const r=i[0],o=i.length-1;if(t===e){if(o!==t){throw new Error(`expected ${t} argument${1===t?"":"s"} for ${r}, got ${o}`)}}else if(o<t||o>e){throw new Error(`expected ${e===1/0?`${t} or more`:`${t} to ${e}`} arguments for ${r}, got ${o}`)}}}function Qo(t,e,i){const n=t.length-1,s=new Array(n);for(let r=0;r<n;++r){const n=Qr(t[r+1],e,i);s[r]=n}return s}function ta(t){return function(e,i,n){const s=e.length-1,r=new Array(s);for(let i=0;i<s;++i){const s=Qr(e[i+1],t,n);r[i]=s}return r}}function ea(t,e,i){const n=t[0],s=t.length-1;if(s%2==1)throw new Error(`expected an even number of arguments for operation ${n}, got ${s} instead`)}function ia(...t){return function(e,i,n){const s=e[0];let r;for(let s=0;s<t.length;s++){const o=t[s](e,i,n);if(s==t.length-1){if(!o)throw new Error("expected last argument validator to return the parsed args");r=o}}return new Ur(i,s,...r)}}function na(t){if(!t)return"";const e=t.getType();switch(e){case"Point":case"LineString":case"Polygon":return e;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return e.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return na(t.getGeometries()[0]);default:return""}}function sa(t,e,i){return ra(Qr(t,e,i),i)}function ra(t,e){if(t instanceof Hr){if(t.type===Nr&&"string"==typeof t.value){const e=fn(t.value);return function(){return e}}return function(){return t.value}}const i=t.operator;switch(i){case zo:case Bo:case Do:return function(t,e){const i=t.operator,n=t.args.length,s=new Array(n);for(let i=0;i<n;++i)s[i]=ra(t.args[i],e);switch(i){case Do:return t=>{for(let e=0;e<n;++e){const i=s[e](t);if(null!=i)return i}throw new Error("Expected one of the values to be non-null")};case zo:case Bo:return t=>{for(let e=0;e<n;++e){const n=s[e](t);if(typeof n===i)return n}throw new Error(`Expected one of the values to be a ${i}`)};default:throw new Error(`Unsupported assertion operator ${i}`)}}(t,e);case to:case eo:case Ko:return function(t){const e=t.args[0],i=e.value;switch(t.operator){case to:return e=>{const n=t.args;let s=e.properties[i];for(let t=1,e=n.length;t<e;++t){s=s[n[t].value]}return s};case eo:return t=>t.variables[i];case Ko:return e=>{const n=t.args;if(!(i in e.properties))return!1;let s=e.properties[i];for(let t=1,e=n.length;t<e;++t){const e=n[t].value;if(!s||!Object.hasOwn(s,e))return!1;s=s[e]}return!0};default:throw new Error(`Unsupported accessor operator ${t.operator}`)}}(t);case Xo:return t=>t.featureId;case no:return t=>t.geometryType;case io:{const i=t.args.map(t=>ra(t,e));return t=>"".concat(...i.map(e=>e(t).toString()))}case lo:return t=>t.resolution;case ro:case oo:case Oo:case Go:case ao:return function(t,e){const i=t.operator,n=t.args.length,s=new Array(n);for(let i=0;i<n;++i)s[i]=ra(t.args[i],e);switch(i){case ro:return t=>{for(let e=0;e<n;++e)if(s[e](t))return!0;return!1};case oo:return t=>{for(let e=0;e<n;++e)if(!s[e](t))return!1;return!0};case Oo:return t=>{const e=s[0](t),i=s[1](t),n=s[2](t);return e>=i&&e<=n};case Go:return t=>{const e=s[0](t);for(let i=1;i<n;++i)if(e===s[i](t))return!0;return!1};case ao:return t=>!s[0](t);default:throw new Error(`Unsupported logical operator ${i}`)}}(t,e);case uo:case go:case _o:case mo:case fo:case po:return function(t,e){const i=t.operator,n=ra(t.args[0],e),s=ra(t.args[1],e);switch(i){case uo:return t=>n(t)===s(t);case go:return t=>n(t)!==s(t);case _o:return t=>n(t)<s(t);case mo:return t=>n(t)<=s(t);case fo:return t=>n(t)>s(t);case po:return t=>n(t)>=s(t);default:throw new Error(`Unsupported comparison operator ${i}`)}}(t,e);case yo:case xo:case So:case vo:case wo:case Co:case Io:case Mo:case Ro:case Eo:case bo:case To:case Lo:case Ao:case ko:return function(t,e){const i=t.operator,n=t.args.length,s=new Array(n);for(let i=0;i<n;++i)s[i]=ra(t.args[i],e);switch(i){case yo:return t=>{let e=1;for(let i=0;i<n;++i)e*=s[i](t);return e};case xo:return t=>s[0](t)/s[1](t);case So:return t=>{let e=0;for(let i=0;i<n;++i)e+=s[i](t);return e};case vo:return t=>s[0](t)-s[1](t);case wo:return t=>{const e=s[0](t),i=s[1](t);if(e<i)return i;const n=s[2](t);return e>n?n:e};case Co:return t=>s[0](t)%s[1](t);case Io:return t=>Math.pow(s[0](t),s[1](t));case Mo:return t=>Math.abs(s[0](t));case Ro:return t=>Math.floor(s[0](t));case Eo:return t=>Math.ceil(s[0](t));case bo:return t=>Math.round(s[0](t));case To:return t=>Math.sin(s[0](t));case Lo:return t=>Math.cos(s[0](t));case Ao:return 2===n?t=>Math.atan2(s[0](t),s[1](t)):t=>Math.atan(s[0](t));case ko:return t=>Math.sqrt(s[0](t));default:throw new Error(`Unsupported numeric operator ${i}`)}}(t,e);case Wo:return function(t,e){const i=t.args.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=ra(t.args[s],e);return t=>{for(let e=0;e<i-1;e+=2){if(n[e](t))return n[e+1](t)}return n[i-1](t)}}(t,e);case Fo:return function(t,e){const i=t.args.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=ra(t.args[s],e);return t=>{const e=n[0](t);for(let s=1;s<i-1;s+=2)if(e===n[s](t))return n[s+1](t);return n[i-1](t)}}(t,e);case Po:return function(t,e){const i=t.args.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=ra(t.args[s],e);return t=>{const e=n[0](t),s=n[1](t);let r,o;for(let a=2;a<i;a+=2){const i=n[a](t);let l=n[a+1](t);const h=Array.isArray(l);if(h&&(l=ln(l)),i>=s)return 2===a?l:h?aa(e,s,r,o,i,l):oa(e,s,r,o,i,l);r=i,o=l}return o}}(t,e);case jo:return function(t,e){const i=t.operator,n=t.args.length,s=new Array(n);for(let i=0;i<n;++i)s[i]=ra(t.args[i],e);if(i===jo)return e=>{const i=s[0](e);return t.args[0].type===Nr?_n(i):i.toString()};throw new Error(`Unsupported convert operator ${i}`)}(t,e);default:throw new Error(`Unsupported operator ${i}`)}}function oa(t,e,i,n,s,r){const o=s-i;if(0===o)return n;const a=e-i;return n+(1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1))*(r-n)}function aa(t,e,i,n,s,r){if(0===s-i)return n;const o=gn(n),a=gn(r);let l=a[2]-o[2];l>180?l-=360:l<-180&&(l+=360);return function(t){const e=(t[0]+16)/116,i=t[1],n=t[2]*Math.PI/180,s=cn(e),r=cn(e+i/500*Math.cos(n)),o=cn(e-i/200*Math.sin(n)),a=hn(3.021973625*r-1.617392459*s-.404875592*o),l=hn(-.943766287*r+1.916279586*s+.027607165*o),h=hn(.069407491*r-.22898585*s+1.159737864*o);return[ze(a+.5|0,0,255),ze(l+.5|0,0,255),ze(h+.5|0,0,255),t[3]]}([oa(t,e,i,o[0],s,a[0]),oa(t,e,i,o[1],s,a[1]),o[2]+oa(t,e,i,0,s,l),oa(t,e,i,n[3],s,r[3])])}class la extends Hs{constructor(t){super({opacity:1,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,rotation:void 0!==t.rotation?t.rotation:0,scale:void 0!==t.scale?t.scale:1,displacement:void 0!==t.displacement?t.displacement:[0,0],declutterMode:t.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=void 0!==t.fill?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius=t.radius,this.radius2_=t.radius2,this.angle_=void 0!==t.angle?t.angle:0,this.stroke_=void 0!==t.stroke?t.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?Ki:qi,this.imageState_===Ki&&this.ready().then(()=>this.imageState_=qi),this.render()}clone(){const t=this.getScale(),e=new la({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){const e=this.fill_?.getKey(),i=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let n=Sn.get(i,null,null)?.getImage(1);if(!n){const e=this.renderOptions_,s=Math.ceil(e.size*t),r=pe(s,s);this.draw_(e,r,t),n=r.canvas,Sn.set(i,null,null,new In(n,void 0,null,qi,null))}return n}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(0===e||this.points_===1/0||"bevel"!==t&&"miter"!==t)return e;let n=this.radius,s=void 0===this.radius2_?n:this.radius2_;if(n<s){const t=n;n=s,s=t}const r=void 0===this.radius2_?this.points_:2*this.points_,o=2*Math.PI/r,a=s*Math.sin(o),l=n-Math.sqrt(s*s-a*a),h=Math.sqrt(a*a+l*l),c=h/a;if("miter"===t&&c<=i)return c*e;const u=e/2/c,d=e/2*(l/h),g=Math.sqrt((n+u)*(n+u)+d*d)-n;if(void 0===this.radius2_||"bevel"===t)return 2*g;const f=n*Math.sin(o),p=s-Math.sqrt(n*n-f*f),_=Math.sqrt(f*f+p*p)/f;if(_<=i){const t=_*e/2-s-n;return 2*Math.max(g,t)}return 2*g}createRenderOptions(){let t,e=Dn,i=Gn,n=0,s=null,r=0,o=0;this.stroke_&&(t=Mn(this.stroke_.getColor()??zn),o=this.stroke_.getWidth()??1,s=this.stroke_.getLineDash(),r=this.stroke_.getLineDashOffset()??0,i=this.stroke_.getLineJoin()??Gn,e=this.stroke_.getLineCap()??Dn,n=this.stroke_.getMiterLimit()??10);const a=this.calculateLineJoinSize_(i,o,n),l=Math.max(this.radius,this.radius2_||0);return{strokeStyle:t,strokeWidth:o,size:Math.ceil(2*l+a),lineCap:e,lineDash:s,lineDashOffset:r,lineJoin:i,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let t=this.fill_.getColor();null===t&&(t=Pn),e.fillStyle=Mn(t),e.fill()}t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){let e;if(this.fill_){let i=this.fill_.getColor(),n=0;"string"==typeof i&&(i=pn(i)),null===i?n=1:Array.isArray(i)&&(n=4===i.length?i[3]:1),0===n&&(e=pe(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_;const i=this.radius;if(e===1/0)t.arc(0,0,i,0,2*Math.PI);else{const n=void 0===this.radius2_?i:this.radius2_;void 0!==this.radius2_&&(e*=2);const s=this.angle_-Math.PI/2,r=2*Math.PI/e;for(let o=0;o<e;o++){const e=s+o*r,a=o%2==0?i:n;t.lineTo(a*Math.cos(e),a*Math.sin(e))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=Pn,e.fill(),t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}}const ha=la;class ca extends ha{constructor(t){super({points:1/0,fill:(t=t||{radius:5}).fill,radius:t.radius,stroke:t.stroke,scale:void 0!==t.scale?t.scale:1,rotation:void 0!==t.rotation?t.rotation:0,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,displacement:void 0!==t.displacement?t.displacement:[0,0],declutterMode:t.declutterMode})}clone(){const t=this.getScale(),e=new ca({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 ua=ca;class da{constructor(t){t=t||{},this.patternImage_=null,this.color_=null,void 0!==t.color&&this.setColor(t.color)}clone(){const t=this.getColor();return new da({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){if(null!==t&&"object"==typeof t&&"src"in t){const e=Cn(null,t.src,"anonymous",void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));e.ready().then(()=>{this.patternImage_=null}),e.getImageState()===ji&&e.load(),e.getImageState()===Ki&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?St(t):"object"==typeof t&&"src"in t?t.src+":"+t.offset:pn(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}const ga=da;class fa{constructor(t){t=t||{},this.color_=void 0!==t.color?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=void 0!==t.lineDash?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 fa({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 pa=fa;class _a{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=xa,void 0!==t.geometry&&this.setGeometry(t.geometry),this.fill_=void 0!==t.fill?t.fill:null,this.image_=void 0!==t.image?t.image:null,this.renderer_=void 0!==t.renderer?t.renderer:null,this.hitDetectionRenderer_=void 0!==t.hitDetectionRenderer?t.hitDetectionRenderer:null,this.stroke_=void 0!==t.stroke?t.stroke:null,this.text_=void 0!==t.text?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&"object"==typeof t&&(t=t.clone()),new _a({geometry:t??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=xa,this.geometry_=t}setZIndex(t){this.zIndex_=t}}let ma=null;function ya(t,e){if(!ma){const t=new ga({color:"rgba(255,255,255,0.4)"}),e=new pa({color:"#3399CC",width:1.25});ma=[new _a({image:new ua({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return ma}function xa(t){return t.getGeometry()}const Sa=_a;class va{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.keepUpright_=t.keepUpright,this.scale_=t.scale,this.scaleArray_=qs(void 0!==t.scale?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_=void 0!==t.fill?t.fill:new ga({color:"#333"}),this.maxAngle_=void 0!==t.maxAngle?t.maxAngle:Math.PI/4,this.placement_=void 0!==t.placement?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=void 0!==t.stroke?t.stroke:null,this.offsetX_=void 0!==t.offsetX?t.offsetX:0,this.offsetY_=void 0!==t.offsetY?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=void 0===t.padding?null:t.padding,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new va({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setKeepUpright(t){this.keepUpright_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=qs(void 0!==t?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}}const wa=va;function Ca(t){return!0}function Ia(t){const e=Jr(),i=function(t,e){const i=t.length,n=new Array(i);for(let s=0;s<i;++s){const i=t[s],r="filter"in i?sa(i.filter,Gr,e):Ca;let o;if(Array.isArray(i.style)){const t=i.style.length;o=new Array(t);for(let n=0;n<t;++n)o[n]=Ra(i.style[n],e)}else o=[Ra(i.style,e)];n[s]={filter:r,styles:o}}return function(e){const s=[];let r=!1;for(let o=0;o<i;++o){if((0,n[o].filter)(e)&&(!t[o].else||!r)){r=!0;for(const t of n[o].styles){const i=t(e);i&&s.push(i)}}}return s}}(t,e),n={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""};return function(t,s){if(n.properties=t.getPropertiesInternal(),n.resolution=s,e.featureId){const e=t.getId();n.featureId=void 0!==e?e:null}return e.geometryType&&(n.geometryType=na(t.getGeometry())),i(n)}}function Ma(t){const e=Jr(),i=t.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=Ra(t[s],e);const s={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""},r=new Array(i);return function(t,o){if(s.properties=t.getPropertiesInternal(),s.resolution=o,e.featureId){const e=t.getId();s.featureId=void 0!==e?e:null}let a=0;for(let t=0;t<i;++t){const e=n[t](s);e&&(r[a]=e,a+=1)}return r.length=a,r}}function Ra(t,e){const i=Ea(t,"",e),n=ba(t,"",e),s=function(t,e){const i="text-",n=La(t,i+"value",e);if(!n)return null;const s=Ea(t,i,e),r=Ea(t,i+"background-",e),o=ba(t,i,e),a=ba(t,i+"background-",e),l=La(t,i+"font",e),h=Ta(t,i+"max-angle",e),c=Ta(t,i+"offset-x",e),u=Ta(t,i+"offset-y",e),d=Aa(t,i+"overflow",e),g=La(t,i+"placement",e),f=Ta(t,i+"repeat",e),p=Da(t,i+"scale",e),_=Aa(t,i+"rotate-with-view",e),m=Ta(t,i+"rotation",e),y=La(t,i+"align",e),x=La(t,i+"justify",e),S=La(t,i+"baseline",e),v=Aa(t,i+"keep-upright",e),w=Fa(t,i+"padding",e),C=Ba(t,i+"declutter-mode"),I=new wa({declutterMode:C});return function(t){if(I.setText(n(t)),s&&I.setFill(s(t)),r&&I.setBackgroundFill(r(t)),o&&I.setStroke(o(t)),a&&I.setBackgroundStroke(a(t)),l&&I.setFont(l(t)),h&&I.setMaxAngle(h(t)),c&&I.setOffsetX(c(t)),u&&I.setOffsetY(u(t)),d&&I.setOverflow(d(t)),g){const e=g(t);if("point"!==e&&"line"!==e)throw new Error("Expected point or line for text-placement");I.setPlacement(e)}if(f&&I.setRepeat(f(t)),p&&I.setScale(p(t)),_&&I.setRotateWithView(_(t)),m&&I.setRotation(m(t)),y){const e=y(t);if("left"!==e&&"center"!==e&&"right"!==e&&"end"!==e&&"start"!==e)throw new Error("Expected left, right, center, start, or end for text-align");I.setTextAlign(e)}if(x){const e=x(t);if("left"!==e&&"right"!==e&&"center"!==e)throw new Error("Expected left, right, or center for text-justify");I.setJustify(e)}if(S){const e=S(t);if("bottom"!==e&&"top"!==e&&"middle"!==e&&"alphabetic"!==e&&"hanging"!==e)throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");I.setTextBaseline(e)}return w&&I.setPadding(w(t)),v&&I.setKeepUpright(v(t)),I}}(t,e),r=function(t,e){if("icon-src"in t)return function(t,e){const i="icon-",n=i+"src",s=Ya(t[n],n),r=Oa(t,i+"anchor",e),o=Da(t,i+"scale",e),a=Ta(t,i+"opacity",e),l=Oa(t,i+"displacement",e),h=Ta(t,i+"rotation",e),c=Aa(t,i+"rotate-with-view",e),u=Ga(t,i+"anchor-origin"),d=za(t,i+"anchor-x-units"),g=za(t,i+"anchor-y-units"),f=function(t,e){const i=t[e];if(void 0===i)return;return Va(i,e)}(t,i+"color"),p=function(t,e){const i=t[e];if(void 0===i)return;if("string"!=typeof i)throw new Error(`Expected a string for ${e}`);return i}(t,i+"cross-origin"),_=function(t,e){const i=t[e];if(void 0===i)return;return Na(i,e)}(t,i+"offset"),m=Ga(t,i+"offset-origin"),y=Wa(t,i+"width"),x=Wa(t,i+"height"),S=function(t,e){const i=t[e];if(void 0===i)return;if("number"==typeof i)return qs(i);if(!Array.isArray(i))throw new Error(`Expected a number or size array for ${e}`);if(2!==i.length||"number"!=typeof i[0]||"number"!=typeof i[1])throw new Error(`Expected a number or size array for ${e}`);return i}(t,i+"size"),v=Ba(t,i+"declutter-mode"),w=new Qs({src:s,anchorOrigin:u,anchorXUnits:d,anchorYUnits:g,color:f,crossOrigin:p,offset:_,offsetOrigin:m,height:x,width:y,size:S,declutterMode:v});return function(t){return a&&w.setOpacity(a(t)),l&&w.setDisplacement(l(t)),h&&w.setRotation(h(t)),c&&w.setRotateWithView(c(t)),o&&w.setScale(o(t)),r&&w.setAnchor(r(t)),w}}(t,e);if("shape-points"in t)return function(t,e){const i="shape-",n=i+"points",s=i+"radius",r=Xa(t[n],n),o=Xa(t[s],s),a=Ea(t,i,e),l=ba(t,i,e),h=Da(t,i+"scale",e),c=Oa(t,i+"displacement",e),u=Ta(t,i+"rotation",e),d=Aa(t,i+"rotate-with-view",e),g=Wa(t,i+"radius2"),f=Wa(t,i+"angle"),p=Ba(t,i+"declutter-mode"),_=new ha({points:r,radius:o,radius2:g,angle:f,declutterMode:p});return function(t){return a&&_.setFill(a(t)),l&&_.setStroke(l(t)),c&&_.setDisplacement(c(t)),u&&_.setRotation(u(t)),d&&_.setRotateWithView(d(t)),h&&_.setScale(h(t)),_}}(t,e);if("circle-radius"in t)return function(t,e){const i="circle-",n=Ea(t,i,e),s=ba(t,i,e),r=Ta(t,i+"radius",e),o=Da(t,i+"scale",e),a=Oa(t,i+"displacement",e),l=Ta(t,i+"rotation",e),h=Aa(t,i+"rotate-with-view",e),c=Ba(t,i+"declutter-mode"),u=new ua({radius:5,declutterMode:c});return function(t){return r&&u.setRadius(r(t)),n&&u.setFill(n(t)),s&&u.setStroke(s(t)),a&&u.setDisplacement(a(t)),l&&u.setRotation(l(t)),h&&u.setRotateWithView(h(t)),o&&u.setScale(o(t)),u}}(t,e);return null}(t,e),o=Ta(t,"z-index",e);if(!(i||n||s||r||ct(t)))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(t));const a=new Sa;return function(t){let e=!0;if(i){const n=i(t);n&&(e=!1),a.setFill(n)}if(n){const i=n(t);i&&(e=!1),a.setStroke(i)}if(s){const i=s(t);i&&(e=!1),a.setText(i)}if(r){const i=r(t);i&&(e=!1),a.setImage(i)}return o&&a.setZIndex(o(t)),e?null:a}}function Ea(t,e,i){let n;if(e+"fill-pattern-src"in t)n=function(t,e,i){const n=La(t,e+"pattern-src",i),s=Pa(t,e+"pattern-offset",i),r=Pa(t,e+"pattern-size",i),o=ka(t,e+"color",i);return function(t){return{src:n(t),offset:s&&s(t),size:r&&r(t),color:o&&o(t)}}}(t,e+"fill-",i);else{if("none"===t[e+"fill-color"])return t=>null;n=ka(t,e+"fill-color",i)}if(!n)return null;const s=new ga;return function(t){const e=n(t);return e===Hi?null:(s.setColor(e),s)}}function ba(t,e,i){const n=Ta(t,e+"stroke-width",i),s=ka(t,e+"stroke-color",i);if(!n&&!s)return null;const r=La(t,e+"stroke-line-cap",i),o=La(t,e+"stroke-line-join",i),a=Fa(t,e+"stroke-line-dash",i),l=Ta(t,e+"stroke-line-dash-offset",i),h=Ta(t,e+"stroke-miter-limit",i),c=new pa;return function(t){if(s){const e=s(t);if(e===Hi)return null;c.setColor(e)}if(n&&c.setWidth(n(t)),r){const e=r(t);if("butt"!==e&&"round"!==e&&"square"!==e)throw new Error("Expected butt, round, or square line cap");c.setLineCap(e)}if(o){const e=o(t);if("bevel"!==e&&"round"!==e&&"miter"!==e)throw new Error("Expected bevel, round, or miter line join");c.setLineJoin(e)}return a&&c.setLineDash(a(t)),l&&c.setLineDashOffset(l(t)),h&&c.setMiterLimit(h(t)),c}}function Ta(t,e,i){if(!(e in t))return;const n=sa(t[e],zr,i);return function(t){return Xa(n(t),e)}}function La(t,e,i){if(!(e in t))return null;const n=sa(t[e],Br,i);return function(t){return Ya(n(t),e)}}function Aa(t,e,i){if(!(e in t))return null;const n=sa(t[e],Gr,i);return function(t){const i=n(t);if("boolean"!=typeof i)throw new Error(`Expected a boolean for ${e}`);return i}}function ka(t,e,i){if(!(e in t))return null;const n=sa(t[e],Nr,i);return function(t){return Va(n(t),e)}}function Fa(t,e,i){if(!(e in t))return null;const n=sa(t[e],Yr,i);return function(t){return Na(n(t),e)}}function Oa(t,e,i){if(!(e in t))return null;const n=sa(t[e],Yr,i);return function(t){const i=Na(n(t),e);if(2!==i.length)throw new Error(`Expected two numbers for ${e}`);return i}}function Pa(t,e,i){if(!(e in t))return null;const n=sa(t[e],Yr,i);return function(t){return Za(n(t),e)}}function Da(t,e,i){if(!(e in t))return null;const n=sa(t[e],Yr|zr,i);return function(t){return function(t,e){if("number"==typeof t)return t;return Za(t,e)}(n(t),e)}}function Wa(t,e){const i=t[e];if(void 0!==i){if("number"!=typeof i)throw new Error(`Expected a number for ${e}`);return i}}function Ga(t,e){const i=t[e];if(void 0!==i){if("bottom-left"!==i&&"bottom-right"!==i&&"top-left"!==i&&"top-right"!==i)throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return i}}function za(t,e){const i=t[e];if(void 0!==i){if("pixels"!==i&&"fraction"!==i)throw new Error(`Expected pixels or fraction for ${e}`);return i}}function Ba(t,e){const i=t[e];if(void 0!==i){if("string"!=typeof i)throw new Error(`Expected a string for ${e}`);if("declutter"!==i&&"obstacle"!==i&&"none"!==i)throw new Error(`Expected declutter, obstacle, or none for ${e}`);return i}}function Na(t,e){if(!Array.isArray(t))throw new Error(`Expected an array for ${e}`);const i=t.length;for(let n=0;n<i;++n)if("number"!=typeof t[n])throw new Error(`Expected an array of numbers for ${e}`);return t}function Ya(t,e){if("string"!=typeof t)throw new Error(`Expected a string for ${e}`);return t}function Xa(t,e){if("number"!=typeof t)throw new Error(`Expected a number for ${e}`);return t}function Va(t,e){if("string"==typeof t)return t;const i=Na(t,e),n=i.length;if(n<3||n>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return i}function Za(t,e){const i=Na(t,e);if(2!==i.length)throw new Error(`Expected an array of two numbers for ${e}`);return i}const ja={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function Ka(t,e,i){return function(n,s,r,o,a){if(!n)return;if(!s&&!e)return n;const l=e?0:r[0]*s,h=e?0:r[1]*s,c=a?a[0]:0,u=a?a[1]:0;let d=t[0]+l/2+c,g=t[2]-l/2+c,f=t[1]+h/2+u,p=t[3]-h/2+u;d>g&&(d=(g+d)/2,g=d),f>p&&(f=(p+f)/2,p=f);let _=ze(n[0],d,g),m=ze(n[1],f,p);if(o&&i&&s){const t=30*s;_+=-t*Math.log(1+Math.max(0,d-n[0])/t)+t*Math.log(1+Math.max(0,n[0]-g)/t),m+=-t*Math.log(1+Math.max(0,f-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-p)/t)}return[_,m]}}function qa(t){return t}function $a(t){return 1-function(t){return Math.pow(t,3)}(1-t)}function Ha(t){return 3*t*t-2*t*t*t}function Ua(t,e,i,n){let s=0;const r=t[i-n],o=t[i-n+1];let a=0,l=0;for(;e<i;e+=n){const i=t[e]-r,n=t[e+1]-o;s+=l*i-a*n,a=i,l=n}return s/2}function Ja(t,e,i,n){let s=0;for(let r=0,o=i.length;r<o;++r){const o=i[r];s+=Ua(t,e,o,n),e=o}return s}function Qa(t,e,i,n,s,r,o){const a=t[e],l=t[e+1],h=t[i]-a,c=t[i+1]-l;let u;if(0===h&&0===c)u=e;else{const d=((s-a)*h+(r-l)*c)/(h*h+c*c);if(d>1)u=i;else{if(d>0){for(let s=0;s<n;++s)o[s]=Ze(t[e+s],t[i+s],d);return void(o.length=n)}u=e}}for(let e=0;e<n;++e)o[e]=t[u+e];o.length=n}function tl(t,e,i,n,s){let r=t[e],o=t[e+1];for(e+=n;e<i;e+=n){const i=t[e],n=t[e+1],a=Ne(r,o,i,n);a>s&&(s=a),r=i,o=n}return s}function el(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r];s=tl(t,e,o,n,s),e=o}return s}function il(t,e,i,n,s,r,o,a,l,h,c){if(e==i)return h;let u,d;if(0===s){if(d=Ne(o,a,t[e],t[e+1]),d<h){for(u=0;u<n;++u)l[u]=t[e+u];return l.length=n,d}return h}c=c||[NaN,NaN];let g=e+n;for(;g<i;)if(Qa(t,g-n,g,n,o,a,c),d=Ne(o,a,c[0],c[1]),d<h){for(h=d,u=0;u<n;++u)l[u]=c[u];l.length=n,g+=n}else g+=n*Math.max((Math.sqrt(d)-Math.sqrt(h))/s|0,1);if(r&&(Qa(t,i-n,e,n,o,a,c),d=Ne(o,a,c[0],c[1]),d<h)){for(h=d,u=0;u<n;++u)l[u]=c[u];l.length=n}return h}function nl(t,e,i,n,s,r,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=i.length;u<d;++u){const d=i[u];h=il(t,e,d,n,s,r,o,a,l,h,c),e=d}return h}function sl(t,e,i,n){for(let s=0,r=i.length;s<r;++s){const r=i[s];for(let i=0;i<n;++i)t[e++]=r[i]}return e}function rl(t,e,i,n,s){s=s||[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=sl(t,e,i[o],n);s[r++]=a,e=a}return s.length=r,s}class al extends sr{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}clone(){return new al(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,n){return n<Yt(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(tl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),il(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,n))}getArea(){return Ua(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Rn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=cs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new al(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=sl(this.flatCoordinates,0,t,this.stride),this.changed()}}const ll=al;class hl extends sr{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new hl(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const s=this.flatCoordinates,r=Ne(t,e,s[0],s[1]);if(r<n){const t=this.stride;for(let e=0;e<t;++e)i[e]=s[e];return i.length=t,r}return n}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return function(t,e){const i=t[0],n=t[1];return Kt(i,n,i,n,e)}(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return Zt(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=function(t,e,i){for(let n=0,s=i.length;n<s;++n)t[e++]=i[n];return e}(this.flatCoordinates,0,t,this.stride),this.changed()}}const cl=hl;function ul(t,e,i,n,s){const r=function(t,e){let i;return i=e(Jt(t)),i||(i=e(Qt(t)),i||(i=e(se(t)),i||(i=e(ne(t)),i||!1)))}(s,function(s){return!dl(t,e,i,n,s[0],s[1])});return!r}function dl(t,e,i,n,s,r){let o=0,a=t[i-n],l=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];l<=r?n>r&&(i-a)*(r-l)-(s-a)*(n-l)>0&&o++:n<=r&&(i-a)*(r-l)-(s-a)*(n-l)<0&&o--,a=i,l=n}return 0!==o}function gl(t,e,i,n,s,r){if(0===i.length)return!1;if(!dl(t,e,i[0],n,s,r))return!1;for(let e=1,o=i.length;e<o;++e)if(dl(t,i[e-1],i[e],n,s,r))return!1;return!0}function fl(t,e,i,n,s,r,o){let a,l,h,c,u,d,g;const f=s[r+1],p=[];for(let s=0,r=i.length;s<r;++s){const r=i[s];for(c=t[r-n],d=t[r-n+1],a=e;a<r;a+=n)u=t[a],g=t[a+1],(f<=d&&g<=f||d<=f&&f<=g)&&(h=(f-d)/(g-d)*(u-c)+c,p.push(h)),c=u,d=g}let _=NaN,m=-1/0;for(p.sort(et),c=p[0],a=1,l=p.length;a<l;++a){u=p[a];const s=Math.abs(u-c);s>m&&(h=(c+u)/2,gl(t,e,i,n,h,f)&&(_=h,m=s)),c=u}return isNaN(_)&&(_=s[r]),o?(o.push(_,f,m),o):[_,f,m]}function pl(t,e,i,n,s,r){return r=r??Ht([1/0,1/0,-1/0,-1/0],t,e,i,n),!!oe(s,r)&&(r[0]>=s[0]&&r[2]<=s[2]||r[1]>=s[1]&&r[3]<=s[3]||function(t,e,i,n,s){let r;for(e+=n;e<i;e+=n)if(r=s(t.slice(e-n,e),t.slice(e,e+n)),r)return r;return!1}(t,e,i,n,function(t,e){return function(t,e,i){let n=!1;const s=jt(t,e),r=jt(t,i);if(s===Dt||r===Dt)n=!0;else{const o=t[0],a=t[1],l=t[2],h=t[3],c=e[0],u=e[1],d=i[0],g=i[1],f=(g-u)/(d-c);let p,_;r&Wt&&!(s&Wt)&&(p=d-(g-h)/f,n=p>=o&&p<=l),n||!(r&Gt)||s&Gt||(_=g-(d-l)*f,n=_>=a&&_<=h),n||!(r&zt)||s&zt||(p=d-(g-a)/f,n=p>=o&&p<=l),n||!(r&Bt)||s&Bt||(_=g-(d-o)*f,n=_>=a&&_<=h)}return n}(s,t,e)}))}function _l(t,e,i,n,s){if(!function(t,e,i,n,s){return!!(pl(t,e,i,n,s)||dl(t,e,i,n,s[0],s[1])||dl(t,e,i,n,s[0],s[3])||dl(t,e,i,n,s[2],s[1])||dl(t,e,i,n,s[2],s[3]))}(t,e,i[0],n,s))return!1;if(1===i.length)return!0;for(let e=1,r=i.length;e<r;++e)if(ul(t,i[e-1],i[e],n,s)&&!pl(t,i[e-1],i[e],n,s))return!1;return!0}function ml(t,e,i,n){for(;e<i-n;){for(let s=0;s<n;++s){const r=t[e+s];t[e+s]=t[i-n+s],t[i-n+s]=r}e+=n,i-=n}}function yl(t,e,i,n){let s=0,r=t[i-n],o=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];s+=(i-r)*(n+o),r=i,o=n}return 0===s?void 0:s>0}function xl(t,e,i,n,s){s=void 0!==s&&s;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=yl(t,e,o,n);if(0===r){if(s&&a||!s&&!a)return!1}else if(s&&!a||!s&&a)return!1;e=o}return!0}function Sl(t,e,i,n,s){s=void 0!==s&&s;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=yl(t,e,o,n);(0===r?s&&a||!s&&!a:s&&!a||!s&&a)&&ml(t,e,o,n),e=o}return e}class vl extends sr{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,void 0!==e&&i?(this.setFlatCoordinates(e,t),this.ends_=i):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?rt(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new vl(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Yt(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(el(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),nl(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return gl(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return Ja(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),Sl(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,En(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=te(this.getExtent());this.flatInteriorPoint_=fl(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new cl(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new ll(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,n=[];let s=0;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=new ll(e.slice(s,o),t);n.push(a),s=o}return n}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;xl(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Sl(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=gs(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new vl(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return _l(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=rl(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}function wl(t){if(ae(t))throw new Error("Cannot create polygon from empty extent");const e=t[0],i=t[1],n=t[2],s=t[3],r=[e,i,e,s,n,s,n,i,e,i];return new vl(r,"XY",[r.length])}function Cl(t,e,i,n){const s=re(e)/i[0],r=ie(e)/i[1];return n?Math.min(t,Math.max(s,r)):Math.min(t,Math.min(s,r))}function Il(t,e,i){let n=Math.min(t,e);return n*=Math.log(1+50*Math.max(0,t/e-1))/50+1,i&&(n=Math.max(n,i),n/=Math.log(1+50*Math.max(0,i/t-1))/50+1),ze(n,i/2,2*e)}function Ml(t,e,i,n,s){return i=void 0===i||i,function(r,o,a,l){if(void 0!==r){const o=n?Cl(t,n,a,s):t;return i&&l?Il(r,o,e):ze(r,e,o)}}}function Rl(t){if(void 0!==t)return 0}function El(t){if(void 0!==t)return t}function bl(t,e){setTimeout(function(){t(e)},0)}function Tl(t){return!(t.sourceCenter&&t.targetCenter&&!ce(t.sourceCenter,t.targetCenter))&&(t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation)}function Ll(t,e,i,n,s){const r=Math.cos(-s);let o=Math.sin(-s),a=t[0]*r-t[1]*o,l=t[1]*r+t[0]*o;a+=(e[0]/2-i[0])*n,l+=(i[1]-e[1]/2)*n,o=-o;return[a*r-l*o,l*r+a*o]}const Al=class extends wt{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Ei(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&&wi(),t.center&&(t.center=Di(t.center,this.projection_)),t.extent&&(t.extent=Gi(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const t in ja)delete e[t];this.setProperties(e,!0);const i=function(t){let e,i,n;const s=28,r=2;let o=void 0!==t.minZoom?t.minZoom:0,a=void 0!==t.maxZoom?t.maxZoom:s;const l=void 0!==t.zoomFactor?t.zoomFactor:r,h=void 0!==t.multiWorld&&t.multiWorld,c=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,u=void 0!==t.showFullExtent&&t.showFullExtent,d=Ei(t.projection,"EPSG:3857"),g=d.getExtent();let f=t.constrainOnlyCenter,p=t.extent;h||p||!d.isGlobal()||(f=!1,p=g);if(void 0!==t.resolutions){const s=t.resolutions;i=s[o],n=void 0!==s[a]?s[a]:s[s.length-1],e=t.constrainResolution?function(t,e,i,n){return e=void 0===e||e,function(s,r,o,a){if(void 0!==s){const l=t[0],h=t[t.length-1],c=i?Cl(l,i,o,n):l;if(a)return e?Il(s,c,h):ze(s,h,c);const u=Math.min(c,s),d=Math.floor(nt(t,u,r));return t[d]>c&&d<t.length-1?t[d+1]:t[d]}}}(s,c,!f&&p,u):Ml(i,n,c,!f&&p,u)}else{const h=(g?Math.max(re(g),ie(g)):360*Se.degrees/d.getMetersPerUnit())/256/Math.pow(r,0),_=h/Math.pow(r,s-0);i=t.maxResolution,void 0!==i?o=0:i=h/Math.pow(l,o),n=t.minResolution,void 0===n&&(n=void 0!==t.maxZoom?void 0!==t.maxResolution?i/Math.pow(l,a):h/Math.pow(l,a):_),a=o+Math.floor(Math.log(i/n)/Math.log(l)),n=i/Math.pow(l,a-o),e=t.constrainResolution?function(t,e,i,n,s,r){return n=void 0===n||n,i=void 0!==i?i:0,function(o,a,l,h){if(void 0!==o){const c=s?Cl(e,s,l,r):e;if(h)return n?Il(o,c,i):ze(o,i,c);const u=1e-9,d=Math.ceil(Math.log(e/c)/Math.log(t)-u),g=-a*(.5-u)+.5,f=Math.min(c,o),p=Math.floor(Math.log(e/f)/Math.log(t)+g),_=Math.max(d,p);return ze(e/Math.pow(t,_),i,c)}}}(l,i,n,c,!f&&p,u):Ml(i,n,c,!f&&p,u)}return{constraint:e,maxResolution:i,minResolution:n,minZoom:o,zoomFactor:l}}(t);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=i.minZoom;const n=function(t){if(void 0!==t.extent){const e=void 0===t.smoothExtentConstraint||t.smoothExtentConstraint;return Ka(t.extent,t.constrainOnlyCenter,e)}const e=Ei(t.projection,"EPSG:3857");if(!0!==t.multiWorld&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,Ka(t,!1,!1)}return qa}(t),s=i.constraint,r=function(t){const e=void 0===t.enableRotation||t.enableRotation;if(e){const e=t.constrainRotation;return void 0===e||!0===e?function(t){const e=void 0===t?Xe(5):t;return function(t,i){return i||void 0===t?t:Math.abs(t)<=e?0:t}}():!1===e?El:"number"==typeof e?function(t){const e=2*Math.PI/t;return function(t,i){return i?t:void 0!==t?t=Math.floor(t/e+.5)*e:void 0}}(e):El}return Rl}(t);this.constraints_={center:n,resolution:s,rotation:r},this.setRotation(void 0!==t.rotation?t.rotation:0),this.setCenterInternal(void 0!==t.center?t.center:null),void 0!==t.resolution?this.setResolution(t.resolution):void 0!==t.zoom&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const i=this.getCenterInternal();if(i){const n=t||[0,0,0,0];e=e||[0,0,0,0];const s=this.getResolution(),r=s/2*(n[3]-e[3]+e[1]-n[1]),o=s/2*(n[0]-e[0]+e[2]-n[2]);this.setCenterInternal([i[0]+r,i[1]-o])}}getUpdatedOptions_(t){const e=this.getProperties();return void 0!==e.resolution?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 t=0;t<e.length;++t){let i=arguments[t];i.center&&(i=Object.assign({},i),i.center=Di(i.center,this.getProjection())),i.anchor&&(i=Object.assign({},i),i.anchor=Di(i.anchor,this.getProjection())),e[t]=i}this.animateInternal.apply(this,e)}animateInternal(t){let e,i=arguments.length;i>1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i);let n=0;for(;n<i&&!this.isDef();++n){const t=arguments[n];t.center&&this.setCenterInternal(t.center),void 0!==t.zoom?this.setZoom(t.zoom):t.resolution&&this.setResolution(t.resolution),void 0!==t.rotation&&this.setRotation(t.rotation)}if(n===i)return void(e&&bl(e,!0));let s=Date.now(),r=this.targetCenter_.slice(),o=this.targetResolution_,a=this.targetRotation_;const l=[];for(;n<i;++n){const t=arguments[n],i={start:s,complete:!1,anchor:t.anchor,duration:void 0!==t.duration?t.duration:1e3,easing:t.easing||Ha,callback:e};if(t.center&&(i.sourceCenter=r,i.targetCenter=t.center.slice(),r=i.targetCenter),void 0!==t.zoom?(i.sourceResolution=o,i.targetResolution=this.getResolutionForZoom(t.zoom),o=i.targetResolution):t.resolution&&(i.sourceResolution=o,i.targetResolution=t.resolution,o=i.targetResolution),void 0!==t.rotation){i.sourceRotation=a;const e=Ve(t.rotation-a+Math.PI,2*Math.PI)-Math.PI;i.targetRotation=a+e,a=i.targetRotation}Tl(i)?i.complete=!0:s+=i.duration,l.push(i)}this.animations_.push(l),this.setHint(Ft,1),this.updateAnimations_()}getAnimating(){return this.hints_[Ft]>0}getInteracting(){return this.hints_[Ot]>0}cancelAnimations(){let t;this.setHint(Ft,-this.hints_[Ft]);for(let e=0,i=this.animations_.length;e<i;++e){const i=this.animations_[e];if(i[0].callback&&bl(i[0].callback,!1),!t)for(let e=0,n=i.length;e<n;++e){const n=i[e];if(!n.complete){t=n.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(void 0!==this.updateAnimationKey_&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let i=this.animations_.length-1;i>=0;--i){const n=this.animations_[i];let s=!0;for(let i=0,r=n.length;i<r;++i){const r=n[i];if(r.complete)continue;const o=t-r.start;let a=r.duration>0?o/r.duration:1;a>=1?(r.complete=!0,a=1):s=!1;const l=r.easing(a);if(r.sourceCenter){const t=r.sourceCenter[0],e=r.sourceCenter[1],i=r.targetCenter[0],n=r.targetCenter[1];this.nextCenter_=r.targetCenter;const s=t+l*(i-t),o=e+l*(n-e);this.targetCenter_=[s,o]}if(r.sourceResolution&&r.targetResolution){const t=1===l?r.targetResolution:r.sourceResolution+l*(r.targetResolution-r.sourceResolution);if(r.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,r.anchor)}this.nextResolution_=r.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==r.sourceRotation&&void 0!==r.targetRotation){const t=1===l?Ve(r.targetRotation+Math.PI,2*Math.PI)-Math.PI:r.sourceRotation+l*(r.targetRotation-r.sourceRotation);if(r.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,r.anchor)}this.nextRotation_=r.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!r.complete)break}if(s){this.animations_[i]=null,this.setHint(Ft,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=n[0].callback;t&&bl(t,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const n=this.getCenterInternal();var s,r;return void 0!==n&&(i=[n[0]-e[0],n[1]-e[1]],function(t,e){const i=Math.cos(e),n=Math.sin(e),s=t[0]*i-t[1]*n,r=t[1]*i+t[0]*n;t[0]=s,t[1]=r}(i,t-this.getRotation()),r=e,(s=i)[0]+=+r[0],s[1]+=+r[1]),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),s=this.getResolution();if(void 0!==n&&void 0!==s){i=[e[0]-t*(e[0]-n[0])/s,e[1]-t*(e[1]-n[1])/s]}return i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?Pi(t,this.getProjection()):t}getCenterInternal(){return this.get(ja.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){return Wi(this.calculateExtentInternal(t),this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();Rt(e,"The view center is not defined");const i=this.getResolution();Rt(void 0!==i,"The view resolution is not defined");const n=this.getRotation();return Rt(void 0!==n,"The view rotation is not defined"),ee(e,i,n,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(ja.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(Gi(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=re(t)/e[0],n=ie(t)/e[1];return Math.max(i,n)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,n=Math.log(e/i)/Math.log(t);return function(i){return e/Math.pow(t,i*n)}}getRotation(){return this.get(ja.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,s=Math.log(i/n)/e;return function(t){return Math.log(i/t)/e/s}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let n=this.getCenterInternal();const s=this.padding_;if(s){const t=this.getViewportSizeMinusPadding_();n=Ll(n,this.getViewportSize_(),[t[0]/2+s[3],t[1]/2+s[0]],e,i)}return{center:n.slice(0),projection:void 0!==t?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 void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,n=this.minZoom_||0;if(this.resolutions_){const s=nt(this.resolutions_,t,1);n=s,e=this.resolutions_[s],i=s==this.resolutions_.length-1?2:e/this.resolutions_[s+1]}else e=this.maxResolution_,i=this.zoomFactor_;return n+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.resolutions_?.length){if(1===this.resolutions_.length)return this.resolutions_[0];const e=ze(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,ze(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(Rt(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){Rt(!ae(t),"Cannot fit empty extent provided as `geometry`");i=wl(Gi(t,this.getProjection()))}else if("Circle"===t.getType()){const e=Gi(t.getExtent(),this.getProjection());i=wl(e),i.rotate(this.getRotation(),te(e))}else{const e=Oi();i=e?t.clone().transform(e,this.getProjection()):t}this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),s=t.getFlatCoordinates(),r=t.getStride();let o=1/0,a=1/0,l=-1/0,h=-1/0;for(let t=0,e=s.length;t<e;t+=r){const e=s[t]*i-s[t+1]*n,r=s[t]*n+s[t+1]*i;o=Math.min(o,e),a=Math.min(a,r),l=Math.max(l,e),h=Math.max(h,r)}return[o,a,l,h]}fitInternal(t,e){let i=(e=e||{}).size;i||(i=this.getViewportSizeMinusPadding_());const n=void 0!==e.padding?e.padding:[0,0,0,0],s=void 0!==e.nearest&&e.nearest;let r;r=void 0!==e.minResolution?e.minResolution:void 0!==e.maxZoom?this.getResolutionForZoom(e.maxZoom):0;const o=this.rotatedExtentForGeometry(t);let a=this.getResolutionForExtentInternal(o,[i[0]-n[1]-n[3],i[1]-n[0]-n[2]]);a=isNaN(a)?r:Math.max(a,r),a=this.getConstrainedResolution(a,s?0:1);const l=this.getRotation(),h=Math.sin(l),c=Math.cos(l),u=te(o);u[0]+=(n[1]-n[3])/2*a,u[1]+=(n[0]-n[2])/2*a;const d=u[0]*c-u[1]*h,g=u[1]*c+u[0]*h,f=this.getConstrainedCenter([d,g],a),p=e.callback?e.callback:lt;void 0!==e.duration?this.animateInternal({resolution:a,center:f,duration:e.duration,easing:e.easing},p):(this.targetResolution_=a,this.targetCenter_=f,this.applyTargetState_(!1,!0),bl(p,!0))}centerOn(t,e,i){this.centerOnInternal(Di(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(Ll(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,n){let s;const r=this.padding_;if(r&&t){const o=this.getViewportSizeMinusPadding_(-i),a=Ll(t,n,[o[0]/2+r[3],o[1]/2+r[0]],e,i);s=[t[0]-a[0],t[1]-a[1]]}return s}isDef(){return!!this.getCenterInternal()&&void 0!==this.getResolution()}adjustCenter(t){const e=Pi(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&&Di(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.getViewportSize_(this.getRotation()),s=this.constraints_.resolution(this.targetResolution_*t,0,n,i);e&&(this.targetCenter_=this.calculateCenterZoom(s,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=Di(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.constraints_.rotation(this.targetRotation_+t,i);e&&(this.targetCenter_=this.calculateCenterRotate(n,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t?Di(t,this.getProjection()):t)}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const i=this.getAnimating()||this.getInteracting()||e,n=this.constraints_.rotation(this.targetRotation_,i),s=this.getViewportSize_(n),r=this.constraints_.resolution(this.targetResolution_,0,s,i),o=this.constraints_.center(this.targetCenter_,r,s,i,this.calculateCenterShift(this.targetCenter_,r,n,s));this.get(ja.ROTATION)!==n&&this.set(ja.ROTATION,n),this.get(ja.RESOLUTION)!==r&&(this.set(ja.RESOLUTION,r),this.set("zoom",this.getZoom(),!0)),o&&this.get(ja.CENTER)&&ce(this.get(ja.CENTER),o)||this.set(ja.CENTER,o),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=void 0!==t?t:200;const n=e||0,s=this.constraints_.rotation(this.targetRotation_),r=this.getViewportSize_(s),o=this.constraints_.resolution(this.targetResolution_,n,r),a=this.constraints_.center(this.targetCenter_,o,r,!1,this.calculateCenterShift(this.targetCenter_,o,s,r));if(0===t&&!this.cancelAnchor_)return this.targetResolution_=o,this.targetRotation_=s,this.targetCenter_=a,void this.applyTargetState_();i=i||(0===t?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,this.getResolution()===o&&this.getRotation()===s&&this.getCenterInternal()&&ce(this.getCenterInternal(),a)||(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:a,resolution:o,duration:t,easing:$a,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Ot,1)}endInteraction(t,e,i){i=i&&Di(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(Ot,-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)}},kl="opacity",Fl="visible",Ol="extent",Pl="zIndex",Dl="maxResolution",Wl="minResolution",Gl="maxZoom",zl="minZoom",Bl="source",Nl="map";const Yl=class extends wt{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);"object"==typeof t.properties&&(delete e.properties,Object.assign(e,t.properties)),e[kl]=void 0!==t.opacity?t.opacity:1,Rt("number"==typeof e[kl],"Layer opacity must be a number"),e[Fl]=void 0===t.visible||t.visible,e[Pl]=t.zIndex,e[Dl]=void 0!==t.maxResolution?t.maxResolution:1/0,e[Wl]=void 0!==t.minResolution?t.minResolution:0,e[zl]=void 0!==t.minZoom?t.minZoom:-1/0,e[Gl]=void 0!==t.maxZoom?t.maxZoom:1/0,this.className_=void 0!==e.className?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:void 0===t||t},i=this.getZIndex();return e.opacity=ze(Math.round(100*this.getOpacity())/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==i||e.managed?i:1/0,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 yt()}getLayerStatesArray(t){return yt()}getExtent(){return this.get(Ol)}getMaxResolution(){return this.get(Dl)}getMinResolution(){return this.get(Wl)}getMinZoom(){return this.get(zl)}getMaxZoom(){return this.get(Gl)}getOpacity(){return this.get(kl)}getSourceState(){return yt()}getVisible(){return this.get(Fl)}getZIndex(){return this.get(Pl)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(Ol,t)}setMaxResolution(t){this.set(Dl,t)}setMinResolution(t){this.set(Wl,t)}setMaxZoom(t){this.set(Gl,t)}setMinZoom(t){this.set(zl,t)}setOpacity(t){Rt("number"==typeof t,"Layer opacity must be a number"),this.set(kl,t)}setVisible(t){this.set(Fl,t)}setZIndex(t){this.set(Pl,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}};const Xl=class extends Yl{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(Bl,this.handleSourcePropertyChange_);const i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return(t=t||[]).push(this),t}getLayerStatesArray(t){return(t=t||[]).push(this.getLayerState()),t}getSource(){return this.get(Bl)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),this.sourceReady_||"ready"!==this.getSource().getState()||(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(pt(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=gt(t,Q,this.handleSourceChange_,this),"ready"===t.getState()&&(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?this.renderer_.getData(t):null}isVisible(t){let e;const i=this.getMapInternal();let n;if(!t&&i&&(t=i.getView()),e=t instanceof Al?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),e.layerStatesArray){if(n=e.layerStatesArray.find(t=>t.layer===this),!n)return!1}else n=this.getLayerState();const s=this.getExtent();return function(t,e){if(!t.visible)return!1;const i=e.resolution;if(i<t.minResolution||i>=t.maxResolution)return!1;const n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}(n,e.viewState)&&(!s||oe(s,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];let i=e(t instanceof Al?t.getViewStateAndExtent():t);return Array.isArray(i)||(i=[i]),i}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){const e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set(Nl,t)}getMapInternal(){return this.get(Nl)}setMap(t){this.mapPrecomposeKey_&&(pt(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(pt(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=gt(t,Zi,this.handlePrecompose_,this),this.mapRenderKey_=gt(this,Q,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);Rt(!e.some(t=>t.layer===i.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(i)}setSource(t){this.set(Bl,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}},Vl="renderOrder";const Zl=class extends Xl{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=t.declutter?String(t.declutter):void 0,this.renderBuffer_=void 0!==t.renderBuffer?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=void 0!==t.updateWhileAnimating&&t.updateWhileAnimating,this.updateWhileInteracting_=void 0!==t.updateWhileInteracting&&t.updateWhileInteracting}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(Vl)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const i=this.getDeclutter();i in t.declutter==!1&&(t.declutter[i]=new wr(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(Vl,t)}setStyle(t){this.style_=void 0===t?ya:t;const e=function(t){if(void 0===t)return ya;if(!t)return null;if("function"==typeof t)return t;if(t instanceof Sa)return t;if(!Array.isArray(t))return Ma([t]);if(0===t.length)return[];const e=t.length,i=t[0];if(i instanceof Sa){const i=new Array(e);for(let n=0;n<e;++n){const e=t[n];if(!(e instanceof Sa))throw new Error("Expected a list of style instances");i[n]=e}return i}if("style"in i){const i=new Array(e);for(let n=0;n<e;++n){const e=t[n];if(!("style"in e))throw new Error("Expected a list of rules with a style property");i[n]=e}return Ia(i)}const n=t;return Ma(n)}(t);this.styleFunction_=null===t?void 0:function(t){let e;if("function"==typeof t)e=t;else{let i;Array.isArray(t)?i=t:(Rt("function"==typeof t.getZIndex,"Expected an `Style` or an array of `Style`"),i=[t]),e=function(){return i}}return e}(e),this.changed()}setDeclutter(t){this.declutter_=t?String(t):void 0,this.changed()}};const jl=class extends Zl{constructor(t){super(t)}createRenderer(){return new yr(this)}},Kl="active";const ql=class extends wt{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(Kl)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(Kl,t)}setMap(t){this.map_=t}},$l="select";class Hl extends ut{constructor(t,e,i,n){super(t),this.selected=e,this.deselected=i,this.mapBrowserEvent=n}}const Ul={};class Jl extends ql{constructor(t){let e;if(super(),this.on,this.once,this.un,t=t||{},this.boundAddFeature_=this.addFeature_.bind(this),this.boundRemoveFeature_=this.removeFeature_.bind(this),this.condition_=t.condition?t.condition:At,this.addCondition_=t.addCondition?t.addCondition:Lt,this.removeCondition_=t.removeCondition?t.removeCondition:Lt,this.toggleCondition_=t.toggleCondition?t.toggleCondition:kt,this.multi_=!!t.multi&&t.multi,this.filter_=t.filter?t.filter:at,this.hitTolerance_=t.hitTolerance?t.hitTolerance:0,this.style_=void 0!==t.style?t.style:function(){const t=function(){const t={},e=[255,255,255,1],i=[0,153,255,1];return t.Polygon=[new _a({fill:new ga({color:[255,255,255,.5]})})],t.MultiPolygon=t.Polygon,t.LineString=[new _a({stroke:new pa({color:e,width:5})}),new _a({stroke:new pa({color:i,width:3})})],t.MultiLineString=t.LineString,t.Circle=t.Polygon.concat(t.LineString),t.Point=[new _a({image:new ua({radius:6,fill:new ga({color:i}),stroke:new pa({color:e,width:1.5})}),zIndex:1/0})],t.MultiPoint=t.Point,t.GeometryCollection=t.Polygon.concat(t.LineString,t.Point),t}();return rt(t.Polygon,t.LineString),rt(t.GeometryCollection,t.LineString),function(e){return e.getGeometry()?t[e.getGeometry().getType()]:null}}(),this.features_=t.features||new Mt,t.layers)if("function"==typeof t.layers)e=t.layers;else{const i=t.layers;e=function(t){return i.includes(t)}}else e=at;this.layerFilter_=e,this.featureLayerAssociation_={}}addFeatureLayerAssociation_(t,e){this.featureLayerAssociation_[St(t)]=e}getFeatures(){return this.features_}getHitTolerance(){return this.hitTolerance_}getLayer(t){return this.featureLayerAssociation_[St(t)]}setHitTolerance(t){this.hitTolerance_=t}setMap(t){this.getMap()&&this.style_&&this.features_.forEach(this.restorePreviousStyle_.bind(this)),super.setMap(t),t?(this.features_.addEventListener(H,this.boundAddFeature_),this.features_.addEventListener(U,this.boundRemoveFeature_),this.style_&&this.features_.forEach(this.applySelectedStyle_.bind(this))):(this.features_.removeEventListener(H,this.boundAddFeature_),this.features_.removeEventListener(U,this.boundRemoveFeature_))}addFeature_(t){const e=t.element;if(this.style_&&this.applySelectedStyle_(e),!this.getLayer(e)){const t=this.getMap().getAllLayers().find(function(t){if(t instanceof jl&&t.getSource()&&t.getSource().hasFeature(e))return t});t&&this.addFeatureLayerAssociation_(e,t)}}removeFeature_(t){this.style_&&this.restorePreviousStyle_(t.element)}getStyle(){return this.style_}applySelectedStyle_(t){const e=St(t);e in Ul||(Ul[e]=t.getStyle()),t.setStyle(this.style_)}restorePreviousStyle_(t){const e=this.getMap().getInteractions().getArray();for(let i=e.length-1;i>=0;--i){const n=e[i];if(n!==this&&n instanceof Jl&&n.getStyle()&&-1!==n.getFeatures().getArray().lastIndexOf(t))return void t.setStyle(n.getStyle())}const i=St(t);t.setStyle(Ul[i]),delete Ul[i]}removeFeatureLayerAssociation_(t){delete this.featureLayerAssociation_[St(t)]}handleEvent(t){if(!this.condition_(t))return!0;const e=this.addCondition_(t),i=this.removeCondition_(t),n=this.toggleCondition_(t),s=!e&&!i&&!n,r=t.map,o=this.getFeatures(),a=[],l=[];if(s){ht(this.featureLayerAssociation_),r.forEachFeatureAtPixel(t.pixel,(t,e)=>{if(t instanceof bt&&this.filter_(t,e))return this.addFeatureLayerAssociation_(t,e),l.push(t),!this.multi_},{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(let t=o.getLength()-1;t>=0;--t){const e=o.item(t),i=l.indexOf(e);i>-1?l.splice(i,1):(o.remove(e),a.push(e))}0!==l.length&&o.extend(l)}else{r.forEachFeatureAtPixel(t.pixel,(t,s)=>{if(t instanceof bt&&this.filter_(t,s))return!e&&!n||o.getArray().includes(t)?(i||n)&&o.getArray().includes(t)&&(a.push(t),this.removeFeatureLayerAssociation_(t)):(this.addFeatureLayerAssociation_(t,s),l.push(t)),!this.multi_},{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(let t=a.length-1;t>=0;--t)o.remove(a[t]);o.extend(l)}return(l.length>0||a.length>0)&&this.dispatchEvent(new Hl($l,l,a,t)),!0}}const Ql=Jl;var th=v(4275),eh=v(5327),ih=v.n(eh);const nh="postrender";const sh=class extends wt{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(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&this.element?.remove();for(let t=0,e=this.listenerKeys.length;t<e;++t)pt(this.listenerKeys[t]);if(this.listenerKeys.length=0,this.map_=t,t){const e=this.target_??t.getOverlayContainerStopEvent();this.element&&e.appendChild(this.element),this.render!==lt&&this.listenerKeys.push(gt(t,nh,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_="string"==typeof t?document.getElementById(t):t}},rh={POINT:"Point",LINE:"LineString",POLYGON:"Polygon",CIRCLE:"Circle"};function oh(t){return t>90||t<-90?t/1e5:t}function ah(t){return t>180||t<-180?t/1e5:t}function lh(t,e){const i=.017453292519943295,n=Math.cos,s=oh(t.latitude),r=oh(e.latitude),o=ah(t.longitude),a=ah(e.longitude),l=.5-n((r-s)*i)/2+n(s*i)*n(r*i)*(1-n((a-o)*i))/2;return Math.round(12742*Math.asin(Math.sqrt(l))*1e3)}function hh(t){let e=0;return t.forEach((i,n)=>{void 0!==t[n+1]&&(e+=lh(i,t[n+1]))}),e}class ch{layerWrapper=null;featureBuilder=null;modifyWrapper=null;overlayWrapper=null;layerWrapper=null;contextMenuWrapper=null;selectWrapper=null;drawWrappers=[];mapControls=[];constructor(){}getLayerWrapper(){return this.layerWrapper}getModifyWrapper(){return this.modifyWrapper}getOverlayWrapper(){return this.overlayWrapper}getDrawWrappers(){return this.drawWrappers}getSelectWrapper(){return this.selectWrapper}getContextMenuWrapper(){return this.contextMenuWrapper}getMapControls(){return this.mapControls}includeModify(t){if(!this.layerWrapper)throw new Error("LayerWrapper is null");this.modifyWrapper=new Rh({...t,source:this.layerWrapper.getSource()})}includeSelect(t){if(!this.layerWrapper)throw new Error("LayerWrapper is null");this.selectWrapper=new Mh({...t,layerWrapper:this.layerWrapper})}includeOverlay(t){this.overlayWrapper=new vh({...t})}includeDraw(t,e){t.source=this.layerWrapper.getSource(),e===rh.CIRCLE?this.drawWrappers.push(new Th(t)):e===rh.POLYGON&&this.drawWrappers.push(new bh(t))}includeControl(t){this.mapControls.push(new Ah(t))}includeContextMenu(t){this.contextMenuWrapper=new Fh(t)}setData(t,e=!1){this.featureBuilder&&(this.layerWrapper.removeAllFeatures(e),this.addData(t))}addData(t){if(this.featureBuilder){const e=this.featureBuilder.create(t);this.layerWrapper.addFeatures(Array.isArray(e)?e:[e])}}getDrawWrapperByType(t){return this.drawWrappers.find(e=>e.options.type===t)}setFeatureCoordinates(t,e){if(this.featureBuilder){const i=this.layerWrapper.getFeatureById(t);i&&this.featureBuilder.setCoordinate(i,e)}}setFeatureStyle(t,e){if(this.featureBuilder){const i=this.layerWrapper.getFeatureById(t);i&&this.featureBuilder.setStyle(i,e)}}}class uh extends ch{constructor(t){super(),this.layerWrapper=new fh(t)}}class dh extends ch{constructor(t){super(),this.layerWrapper=new ph(t)}}class gh{map=null;tileLayer=null;mapEvents={};options={hitTolerance:10};static EVENTS={CLICK:"click",SINGLECLICK:"singleclick",MOVEEND:"moveend",POINTERMOVE:"pointermove"};constructor(t=null,e={}){t&&this.init(t,e)}init(t,e={}){const i={zoom:e.zoom?e.zoom:4,center:(0,E.fromLonLat)(e.center?e.center:[0,0])},n={source:new b.OSM({})};this.tileLayer=new(L())(n);const s={target:t,layers:[this.tileLayer],view:new(R())(i)};this.map=new(I())(s),this.initEvents(),this.options.hitTolerance=void 0!==e.hitTolerance?e.hitTolerance:10}initEvents(){for(const t in gh.EVENTS)this.map.on(gh.EVENTS[t],e=>this.#t(gh.EVENTS[t],e))}getMap(){return this.map}getTileLayer(){return this.tileLayer}getViewPortCoordinates(){return this.map.getView().calculateExtent(this.map.getSize())}getViewCenter(){return(0,E.transform)(this.map.getView().getCenter(),"EPSG:3857","EPSG:4326")}addLayer(t){console.log(t.getLayer()),this.map.addLayer(t.getLayer())}removeLayer(t){this.map.removeLayer(t.getLayer())}addOverlay(t){t&&t.getOverlay()&&this.map.addOverlay(t.getOverlay())}addControl(t){t&&t.getControl()&&this.map.addControl(t.getControl())}addInteraction(t){t&&t.getInteraction()&&this.map.addInteraction(t.getInteraction())}getFeatureFromPixel(t){return this.map.forEachFeatureAtPixel(t,t=>t)}getLayerFromPixel(t){return this.map.forEachFeatureAtPixel(t,(t,e)=>e)}getZoomLevel(){return this.map.getView().getZoom()}fitToLayer(t,e={}){if(t.getSource().getFeatures().length>0){const i={size:this.map.getSize(),maxZoom:e.zoom?e.zoom:20,padding:e.padding?e.padding:[30,30,30,30],duration:e.duration?e.duration:0},n=t.getSource().getExtent();this.map.getView().fit(n,i)}}fitToFeature(t,e={}){const i={size:this.map.getSize(),maxZoom:e.zoom?e.zoom:20,padding:e.padding?e.padding:[20,20,20,20],duration:e.duration?e.duration:0},n=t.getGeometry().getExtent();this.map.getView().fit(n,i)}on(t,e){this.mapEvents.hasOwnProperty(t)?this.mapEvents[t].push(e):this.mapEvents[t]=[e]}off(t,e){this.mapEvents.hasOwnProperty(t)&&(this.mapEvents[t]=this.mapEvents[t].filter(t=>t!==e))}#t(t,e){this.mapEvents.hasOwnProperty(t)&&this.mapEvents[t].forEach(t=>{void 0!==e.pixel?this.map.forEachFeatureAtPixel(e.pixel,(i,n)=>{setTimeout(t(i,n,e),1)},{hitTolerance:this.options.hitTolerance}):setTimeout(t(e),1)})}addProcessor(t){this.addLayer(t.getLayerWrapper()),this.addInteraction(t.getModifyWrapper()),this.addOverlay(t.getOverlayWrapper()),this.addControl(t.getContextMenuWrapper()),this.addInteraction(t.getSelectWrapper()),t.drawWrappers.forEach(t=>this.addInteraction(t)),t.getMapControls().forEach(t=>this.addControl(t))}}class fh{layer=null;source=null;sourceEvents={};static EVENTS={ADD_FEATURE:"addfeature"};constructor(t={}){this.source=new(k())({wrapX:!1});const e={name:t?.name??"Layer",style:t?.style??new Y.Style,zIndex:t?.zIndex??1,opacity:t?.opacity??1,source:this.source};t.useVectorImage?this.layer=new(O())(e):this.layer=new(D())(e),this.initEvents()}initEvents(){for(const t in fh.EVENTS)this.source.on(fh.EVENTS[t],e=>this.#t(fh.EVENTS[t],e))}addFeatures(t){this.source.addFeatures(t)}addFeature(t){this.source.addFeature(t)}removeAllFeatures(t=!1){this.source.clear(t)}removeFeatures(t){this.source.removeFeatures(t)}removeFeature(t){this.source.removeFeature(t)}removeFeatureById(t){const e=this.getFeatureById(t);e&&this.removeFeature(e)}removeFeaturesByProperty(t,e){this.removeFeatures(this.getFeaturesByProperty(t,e))}getFeatureById(t){return this.source.getFeatureById(t)}getFeaturesByProperty(t,e){const i=[];return this.source.getFeatures.forEach(n=>{n.get("properties")[t]===e&&i.push(n)}),i}getAllFeatures(){return this.source.getFeatures()}getLayer(){return this.layer}getSource(){return this.source}getName(){return this.layer.get("name")}show(){this.layer.setVisible(!0)}hide(){this.layer.setVisible(!1)}setStyle(t){this.layer.setStyle(t)}on(t,e){this.sourceEvents.hasOwnProperty(t)?this.sourceEvents[t].push(e):this.sourceEvents[t]=[e]}off(t,e){this.sourceEvents.hasOwnProperty(t)&&(this.sourceEvents[t]=this.sourceEvents[t].filter(t=>t!==e))}#t(t,e){this.sourceEvents.hasOwnProperty(t)&&this.sourceEvents[t].forEach(t=>{setTimeout(t(e),1)})}}class ph extends fh{cluster=null;constructor(t){super(t);const e={source:this.source,distance:t?.distance??50};this.cluster=new b.Cluster(e);const i={name:t?.name??"ClusterLayer",style:t?.style??new Y.Style,zIndex:t?.zIndex??1,animationDuration:t?.animationDuration??200,options:t?.opacity??1,source:this.cluster};this.layer=new(G())(i),console.log(this.source)}setDistance(t){this.cluster.setDistance(t)}}class _h{options={style:null,idKey:null,nestedKey:null};constructor(t={}){this.options.style=void 0!==t.style?t.style:null,this.options.idKey=void 0!==t.idKey?t.idKey:null,this.options.nestedKey=void 0!==t.nestedKey?t.nestedKey:null}getOLCoordinate(t){const e=ah(t.longitude),i=oh(t.latitude);return(0,E.fromLonLat)([e,i])}setId(t,e,i){this.options.idKey?t.setId(i[this.options.idKey]):void 0!==e.id?t.setId(e.id):void 0!==i.id&&t.setId(i.id)}setStyle(t,e=null){t.setStyle(e??this.options?.style??null)}setCoordinate(t,e){t.getGeometry().setCoordinates(this.getOLCoordinate(e))}createFeatures(t){return t.map(t=>this.createFeature(t))}createFeature(t){throw new Error("Method is not implemented")}}class mh extends _h{constructor(t={}){super(t)}createFeature(t){const e=this.options.nestedKey?t[this.options.nestedKey]:t,i=this.getOLCoordinate(e),n={geometry:new z.Point(i)},s=new(N())(n);return s.set("properties",t),this.setId(s,e,t),this.setStyle(s,t?.style??null),s}create(t){return Array.isArray(t)?this.createFeatures(t):this.createFeature(t)}}class yh extends _h{constructor(t={}){super(t)}parsePoints(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i].coordinate;e.push(this.getOLCoordinate(n))}return[e]}createFeature(t){console.log(t);const e=this.parsePoints(t.points),i={geometry:new z.Polygon(e)},n=new(N())(i);return n.set("properties",t),this.setId(n,t,t),this.setStyle(n,t?.style??null),n}create(t){return Array.isArray(t)?this.createFeatures(t):this.createFeature(t)}}class xh extends _h{constructor(t={}){super(t)}createFeature(t){const e=this.options.nestedKey?t[this.options.nestedKey]:t,i=this.getOLCoordinate(e);console.log(i);const n={geometry:new z.Circle(i,t.radius)},s=new(N())(n);return s.set("properties",t),this.setId(s,e,t),this.setStyle(s,t?.style??null),s}create(t){return Array.isArray(t)?this.createFeatures(t):this.createFeature(t)}}class Sh extends _h{constructor(t={}){super(t)}parsePoints(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i].coordinate;e.push(this.getOLCoordinate(n))}return e}createFeature(t){const e=this.parsePoints(t.points),i={geometry:new z.LineString(e)},n=new(N())(i);return n.set("properties",t),this.setId(n,t,t),this.setStyle(n,t?.style??null),n}create(t){return Array.isArray(t)?this.createFeatures(t):this.createFeature(t)}}class vh{overlay=null;constructor(t={}){const e={element:document.getElementById(void 0!==t.element?t.element:null),offset:void 0!==t.offset?t.offset:[0,-30],positioning:"bottom-center"};this.overlay=new(V())(e)}getOverlay(){return this.overlay}setPositionByFeature(t){if(t){let e=t.getGeometry().getExtent();this.overlay.setPosition((0,Z.getCenter)(e))}else this.overlay.setPosition(void 0)}setContent(t){element.innerHTML=t}show(t,e){void 0!==e&&this.setContent(e),void 0!==t&&this.setPositionByFeature(t)}hide(){this.overlay.setPosition(void 0)}}function wh(t){return{latitude:(t[0].latitude+t[1].latitude)/2,longitude:(t[0].longitude+t[1].longitude)/2}}function Ch(t){const e={latitude:0,longitude:0},i=t.length;for(let n=0;n<i;n++){let i=t[n];e.latitude+=i.latitude,e.longitude+=i.longitude}return e.latitude/=i,e.longitude/=i,e}class Ih{interaction=null;constructor(){}setActive(t){this.interaction.setActive(t)}getInteraction(){return this.interaction}_parseCircleCoordinates(t){const e=t.getGeometry().getCenter(),i=t.getGeometry().getRadius(),n=(0,E.toLonLat)(e);return{longitude:n[0].toFixed(5),latitude:n[1].toFixed(5),radius:i}}_parsePointCoordinates(t){const e=(0,E.toLonLat)(t.getGeometry().getCoordinates());return{longitude:e[0].toFixed(5),latitude:e[1].toFixed(5),id:t.getId()}}_parsePolygonCoordinates(t){const e=t.getGeometry().getCoordinates()[0],i=[];for(let t=0,n=e.length;t<n;t++){const n=(0,E.toLonLat)(e[t]);i.push({longitude:n[0].toFixed(5),latitude:n[1].toFixed(5),order:t+1})}return{id:t.getId(),points:i}}_parseLSCoordinates(t){const e=t.getGeometry().getCoordinates();if(!this.options.editFirstAndLastPoint){const i=e[0],n=e[e.length-1],s=this.oldCoordinates[0],r=this.oldCoordinates[this.oldCoordinates.length-1];if(i[0]!==s[0]||i[1]!==s[1]||n[0]!==r[0]||n[1]!==r[1])return t.getGeometry().setCoordinates(this.oldCoordinates),void(this.oldCoordinates=null)}return{id:t.getId(),points:e.map((t,e)=>{const i=(0,E.toLonLat)(t);return{order:e+1,longitude:+(1e5*i[0]).toFixed(0),latitude:+(1e5*i[1]).toFixed(0)}})}}}class Mh extends Ih{options={layerWrapper:null,style:null,hitTolerance:5,selectedHandler:null,deselectedHandler:null,alwaysOneSelected:!0,active:!1};lastSelectedId=null;constructor(t){super(),this.options=t,console.log(this.options);const e={layers:this.options.layerWrapper?[this.options.layerWrapper.getLayer()]:[],style:this.options.style,hitTolerance:this.options?.hitTolerance??5,condition:this.options?.condition??th.click};console.log(e),this.options.alwaysOneSelected&&(e.toggleCondition=ol.events.condition.never,e.filter=function(t){return null===lastSelectedId||(t.getId()===lastSelectedId||null===lastSelectedId)}),this.interaction=new Ql(e),this.interaction.on("select",t=>console.log(t)),this.setActive(this.options?.active??!1)}getSelectedFeatures(){return this.interaction.getFeatures()}clear(){this.interaction.getFeatures().clear(),this.lastSelectedId=null}addFeatures(t){this.interaction.getFeatures().push(...t)}#e(t){console.log(t),this.options.deselectedHandler&&(t.deselected.length>0?this.options.deselected(t,t.deselected[0].get("properties")):this.options.deselected(t,null)),this.options.selectedHandler&&(t.selected.length>0?(this.options.selected(t,t.selected[0].get("properties")),void 0!==this.options.alwaysOneSelected&&this.options.alwaysOneSelected&&(lastSelectedId=t.selected[0].getId())):(this.options.selected(e,null),void 0!==this.options.alwaysOneSelected&&this.options.alwaysOneSelected&&this.interaction.getFeatures().push(t.deselected[0])))}}class Rh extends Ih{options={source:null,features:[],startModifyHandler:null,endModifyHandler:null,hitDteection:null,style:null,alwaysOneFeature:!0,editFirstAndLastPoint:!1};oldCoordinates=null;constructor(t){super(),this.options=t;const e={source:this.options.source,features:this.options.features,hitDetection:this.options.hitDetection??10,style:this.options.style,active:this.options.active??!1,deleteCondition:th.shiftKeyOnly};this.options.editFirstAndLastPoint||(e.vertexFilter=(t,e)=>{if(console.log(e),e.getType()===rh.LINE){const i=e.getCoordinates(),n=t[0]===i[0][0]&&t[1]===i[0][1],s=t[0]===i[i.length-1][0]&&t[1]===i[i.length-1][1];return!(n||s)}return!0}),this.interaction=new(K())(e),this.interaction.on("modifystart",this.#i.bind(this)),this.interaction.on("modifyend",this.#n.bind(this)),this.setActive(!1)}#n(t){const e=t.features.getArray();this.options.endModifyHandler&&this.options.endModifyHandler(this.#s(e),e)}#i(t){const e=t.features.getArray()[0].getGeometry().getCoordinates();this.oldCoordinates=e,this.options.startModifyHandler&&this.options.startModifyHandler(t)}#s(t){if(!this.options.alwaysOneFeature)return t.map(t=>{let e=t.getGeometry().getCoordinates();return e.length>=2&&Array.isArray(e[0])?this._parseLSCoordinates(t):1===e.length?this._parsePolygonCoordinates(t):this._parsePointCoordinates(t)});{const e=t[0],i=e.getGeometry().getCoordinates();for(let e=1;e<t.length;e++){const i=t[e],n=i.get("properties").coordinate,s=(0,E.fromLonLat)([+n.longitude,+n.latitude]);i.getGeometry().setCoordinates(s)}if(i.length>=2&&Array.isArray(i[0]))return[this._parseLSCoordinates(e)];if(1!==i.length)return[this._parsePointCoordinates(e)];this._parsePolygonCoordinates(e)}}}class Eh extends Ih{options={source:null,style:null,type:null,endDrawHandler:null,startDrawHandler:null,active:!1};constructor(t=null){super(),this.options=t;const e={source:this.options.source,style:this.options.style,type:this.options.type,active:this.options?.active??!1};this.interaction=new($())(e),this.interaction.on("drawend",this.drawEndEvent.bind(this)),this.interaction.on("drawstart",this.drawStartEvent.bind(this)),this.setActive(!1)}drawEndEvent(){throw new Error("Not implemented method")}drawStartEvent(){this.options.startDrawHandler&&this.options.startDrawHandler()}}class bh extends Eh{constructor(t){t.type=rh.POLYGON,super(t)}drawEndEvent(t){if(this.options.endDrawHandler){const e=t.feature;this.options.endDrawHandler(this._parsePolygonCoordinates(e),rh.POLYGON,t.feature)}}}class Th extends Eh{constructor(t){t.type=rh.CIRCLE,super(t)}drawEndEvent(t){if(this.options.endDrawHandler){const e=t.feature;this.options.endDrawHandler(this._parseCircleCoordinates(e),rh.CIRCLE,t.feature)}}}class Lh{control=null;getControl(){return this.control}}class Ah extends Lh{constructor(t){super();const e=document.createElement("button");e.innerHTML=t?.text??"*";const i=document.createElement("div");i.className="ol-unselectable ol-control "+(t?.className??""),i.appendChild(e),t.clickHandler&&i.addEventListener("click",t.clickHandler.bind(this),!1),this.control=new sh({element:i})}}class kh{text=null;classname=null;callback=null;icon=null;items=null;constructor(){return this}setText(t){return this.text=t,this}setClassName(t){return this.classname=t,this}setCallback(t){return this.callback=t,this}setIcon(t){return this.icon=t,this}setItems(t){return this.items=t,this}addItem(t){return this.items||(this.items=[]),this.items.push(t),this}}class Fh extends Lh{options={items:[],defaultItems:!1,width:null};constructor(t){super(),this.options=t,this.coordinates=null;const e={items:this.options?.items??[],defaultItems:this.options?.defaultItems??!1,width:this.options?.width??170};this.control=new(ih())(e)}addItems(t){this.control.extend(t)}addItem(t){this.control.push(t)}removeItems(){this.control.clear()}removeLastItem(){this.control.pop()}}return w})());
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("ol-ext/layer/AnimatedCluster"),require("ol-contextmenu/dist/ol-contextmenu.js")):"function"==typeof define&&define.amd?define("wertyzvue",["ol-ext/layer/AnimatedCluster","ol-contextmenu/dist/ol-contextmenu.js"],e):"object"==typeof exports?exports.wertyzvue=e(require("ol-ext/layer/AnimatedCluster"),require("ol-contextmenu/dist/ol-contextmenu.js")):t.wertyzvue=e(t["ol-ext/layer/AnimatedCluster"],t["ol-contextmenu/dist/ol-contextmenu.js"])}(self,(t,e)=>(()=>{"use strict";var i={2085:e=>{e.exports=t},5327:t=>{t.exports=e}},n={};function s(t){var e=n[t];if(void 0!==e)return e.exports;var r=n[t]={exports:{}};return i[t](r,r.exports,s),r.exports}s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},s.d=(t,e)=>{for(var i in e)s.o(e,i)&&!s.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};s.r(r),s.d(r,{ClusterLayerWrapper:()=>Sg,ContextMenuWrapper:()=>Xg,ContextMenuWrapperItem:()=>Ng,Control:()=>zg,DrawCircleWrapper:()=>Gg,DrawPolygonWrapper:()=>Og,DrawWrapper:()=>Dg,FeatureCircleBuilder:()=>Rg,FeatureLineStringBuilder:()=>Mg,FeaturePointBuilder:()=>Ig,FeaturePolygonBuilder:()=>Tg,GEOMETRY:()=>gg,Interaction:()=>Lg,LayerWrapper:()=>wg,MapControl:()=>Wg,MapProcessor:()=>xg,MapProcessorCluster:()=>vg,MapWrapper:()=>Cg,ModifyWrapper:()=>kg,OverlayWrapper:()=>Pg,Processor:()=>yg,SelectWrapper:()=>Ag,calculateCentroid:()=>bg,calculateDistance:()=>pg,calculateDistanceLine:()=>mg,calculateMidPoint:()=>Fg,prepareLatitude:()=>_g,prepareLongitude:()=>fg});const o="add",a="remove",h="propertychange",l="change",c="error",u="contextmenu",d="click",g="dblclick",_="keydown",f="keypress",p="load",m="touchmove",y="wheel";const x=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function v(t,e){return t>e?1:t<e?-1:0}function C(t,e){return t<e?1:t>e?-1:0}function w(t,e,i){if(t[0]<=e)return 0;const n=t.length;if(e<=t[n-1])return n-1;if("function"==typeof i){for(let s=1;s<n;++s){const n=t[s];if(n===e)return s;if(n<e)return i(e,t[s-1],n)>0?s-1:s}return n-1}if(i>0){for(let i=1;i<n;++i)if(t[i]<e)return i-1;return n-1}if(i<0){for(let i=1;i<n;++i)if(t[i]<=e)return i;return n-1}for(let i=1;i<n;++i){if(t[i]==e)return i;if(t[i]<e)return t[i-1]-e<e-t[i]?i-1:i}return n-1}function S(t,e,i){for(;e<i;){const n=t[e];t[e]=t[i],t[i]=n,++e,--i}}function E(t,e){const i=Array.isArray(e)?e:[e],n=i.length;for(let e=0;e<n;e++)t[t.length]=i[e]}function I(t,e){const i=t.length;if(i!==e.length)return!1;for(let n=0;n<i;n++)if(t[n]!==e[n])return!1;return!0}function T(){return!0}function R(){return!1}function M(){}function P(t){let e,i,n;return function(){const s=Array.prototype.slice.call(arguments);return i&&this===n&&I(s,i)||(n=this,i=s,e=t.apply(this,arguments)),e}}function F(t){return function(){let e;try{e=t()}catch(t){return Promise.reject(t)}return e instanceof Promise?e:Promise.resolve(e)}()}function b(t){for(const e in t)delete t[e]}function L(t){let e;for(e in t)return!1;return!e}const A=class{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};const k=class extends x{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),n=i[t]||(i[t]=[]);n.includes(e)||n.push(e)}dispatchEvent(t){const e="string"==typeof t,i=e?t:t.type,n=this.listeners_&&this.listeners_[i];if(!n)return;const s=e?new A(t):t;s.target||(s.target=this.eventTarget_||this);const r=this.dispatching_||(this.dispatching_={}),o=this.pendingRemovals_||(this.pendingRemovals_={});let a;i in r||(r[i]=0,o[i]=0),++r[i];for(let t=0,e=n.length;t<e;++t)if(a="handleEvent"in n[t]?n[t].handleEvent(s):n[t].call(this,s),!1===a||s.propagationStopped){a=!1;break}if(0===--r[i]){let t=o[i];for(delete o[i];t--;)this.removeEventListener(i,M);delete r[i]}return a}disposeInternal(){this.listeners_&&b(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)}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const n=i.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=M,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}};function D(t,e,i,n,s){if(s){const s=i;i=function(r){return t.removeEventListener(e,i),s.call(n??this,r)}}else n&&n!==t&&(i=i.bind(n));const r={target:t,type:e,listener:i};return t.addEventListener(e,i),r}function O(t,e,i,n){return D(t,e,i,n,!0)}function G(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),b(t))}class z extends k{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(l)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=D(this,t[s],e);return n}return D(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const n=t.length;i=new Array(n);for(let s=0;s<n;++s)i[s]=O(this,t[s],e)}else i=O(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)!function(t){if(Array.isArray(t))for(let e=0,i=t.length;e<i;++e)G(t[e]);else G(t)}(i);else if(Array.isArray(t))for(let i=0,n=t.length;i<n;++i)this.removeEventListener(t[i],e);else this.removeEventListener(t,e)}}z.prototype.on,z.prototype.once,z.prototype.un;const W=z;function N(){throw new Error("Unimplemented abstract method.")}let X=0;function B(t){return t.ol_uid||(t.ol_uid=String(++X))}class K extends A{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}const V=class extends W{constructor(t){super(),this.on,this.once,this.un,B(this),this.values_=null,void 0!==t&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new K(i,t,e)),i=h,this.hasListener(i)&&this.dispatchEvent(new K(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const n=this.values_||(this.values_={});if(i)n[t]=e;else{const i=n[t];n[t]=e,i!==e&&this.notify(t,i)}}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],L(this.values_)&&(this.values_=null),e||this.notify(t,i)}}},j="length";class Y extends A{constructor(t,e,i){super(t),this.element=e,this.index=i}}const Z=class extends V{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t??[],this.unique_)for(let t=1,e=this.array_.length;t<e;++t)this.assertUnique_(this.array_[t],t);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,i=t.length;e<i;++e)this.push(t[e]);return this}forEach(t){const e=this.array_;for(let i=0,n=e.length;i<n;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(j)}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 Y(o,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,n=e.length;i<n;++i)if(e[i]===t)return this.removeAt(i)}removeAt(t){if(t<0||t>=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new Y(a,e,t)),e}setAt(t,e){if(t>=this.getLength())return void this.insertAt(t,e);if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const i=this.array_[t];this.array_[t]=e,this.dispatchEvent(new Y(a,i,t)),this.dispatchEvent(new Y(o,e,t))}updateLength_(){this.set(j,this.array_.length)}assertUnique_(t,e){const i=this.array_;for(let n=0,s=i.length;n<s;++n)if(i[n]===t&&n!==e)throw new Error("Duplicate item added to a unique collection")}};const U=class extends A{constructor(t,e,i){super(t),this.map=e,this.frameState=void 0!==i?i:null}};const H=class extends U{constructor(t,e,i,n,s,r){super(t,e,s),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=void 0!==n&&n,this.activePointers=r}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(t){this.pixel_=t}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(t){this.coordinate_=t}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}},q={SINGLECLICK:"singleclick",CLICK:d,DBLCLICK:g,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},$="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"",J=($.includes("safari")&&!$.includes("chrom")&&($.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test($)),$.includes("webkit")&&!$.includes("edge")),Q=$.includes("macintosh"),tt="undefined"!=typeof devicePixelRatio?devicePixelRatio:1,et="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,it="undefined"!=typeof Image&&Image.prototype.decode,nt="function"==typeof createImageBitmap,st=function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch{}return t}(),rt="pointermove",ot="pointerdown";const at=class extends k{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=void 0===e?1:e,this.down_=null;const i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=D(i,ot,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=D(i,rt,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(m,this.boundHandleTouchMove_,!!st&&{passive:!1})}emulateClick_(t){let e=new H(q.CLICK,this.map_,t);this.dispatchEvent(e),void 0!==this.clickTimeoutId_?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new H(q.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const e=new H(q.SINGLECLICK,this.map_,t);this.dispatchEvent(e)},250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==q.POINTERUP||e.type==q.POINTERCANCEL){delete this.trackedTouches_[i];for(const t in this.trackedTouches_)if(this.trackedTouches_[t].target!==e.target){delete this.trackedTouches_[t];break}}else e.type!=q.POINTERDOWN&&e.type!=q.POINTERMOVE||(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new H(q.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_),0===this.activePointers_.length&&(this.dragListenerKeys_.forEach(G),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return 0===t.button}handlePointerDown_(t){this.emulateClicks_=0===this.activePointers_.length,this.updateActivePointers_(t);const e=new H(q.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),0===this.dragListenerKeys_.length){const t=this.map_.getOwnerDocument();this.dragListenerKeys_.push(D(t,q.POINTERMOVE,this.handlePointerMove_,this),D(t,q.POINTERUP,this.handlePointerUp_,this),D(this.element_,q.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==t&&this.dragListenerKeys_.push(D(this.element_.getRootNode(),q.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new H(q.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 H(q.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;e&&!e.defaultPrevented||"boolean"==typeof t.cancelable&&!0!==t.cancelable||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_&&(G(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(m,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(G(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(G),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},ht="postrender",lt="movestart",ct="moveend",ut="loadstart",dt="loadend",gt="layergroup",_t="size",ft="target",pt="view",mt=0,yt=1,xt=2,vt=3,Ct=4;function wt(t,e){if(!t)throw new Error(e)}const St=1/0;const Et=class{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,b(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const n=this.keyFunction_(i);return delete this.queuedElements_[n],i}enqueue(t){wt(!(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!=St&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(t){return 2*t+1}getRightChildIndex_(t){return 2*t+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 0===this.elements_.length}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,n=e.length,s=e[t],r=i[t],o=t;for(;t<n>>1;){const s=this.getLeftChildIndex_(t),r=this.getRightChildIndex_(t),o=r<n&&i[r]<i[s]?r:s;e[t]=e[o],i[t]=i[o],t=o}e[t]=s,i[t]=r,this.siftDown_(o,t)}siftDown_(t,e){const i=this.elements_,n=this.priorities_,s=i[e],r=n[e];for(;e>t;){const t=this.getParentIndex_(e);if(!(n[t]>r))break;i[e]=i[t],n[e]=n[t],e=t}i[e]=s,n[e]=r}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let n=0;const s=e.length;let r,o,a;for(o=0;o<s;++o)r=e[o],a=t(r),a==St?delete this.queuedElements_[this.keyFunction_(r)]:(i[n]=a,e[n++]=r);e.length=n,i.length=n,this.heapify_()}};const It=class extends Et{constructor(t,e){super(e=>t.apply(null,e),t=>t[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);if(e){t[0].addEventListener(l,this.boundHandleTileChange_)}return e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===xt||i===vt||i===Ct){i!==vt&&e.removeEventListener(l,this.boundHandleTileChange_);const t=e.getKey();t in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[t],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i=0;for(;this.tilesLoading_<t&&i<e&&this.getCount()>0;){const t=this.dequeue()[0],e=t.getKey();t.getState()!==mt||e in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[e]=!0,++this.tilesLoading_,++i,t.load())}}};const Tt=0,Rt=1,Mt={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function Pt(t,e,i){return Math.min(Math.max(t,e),i)}function Ft(t,e,i,n,s,r){const o=s-i,a=r-n;if(0!==o||0!==a){const h=((t-i)*o+(e-n)*a)/(o*o+a*a);h>1?(i=s,n=r):h>0&&(i+=o*h,n+=a*h)}return bt(t,e,i,n)}function bt(t,e,i,n){const s=i-t,r=n-e;return s*s+r*r}function Lt(t){return 180*t/Math.PI}function At(t){return t*Math.PI/180}function kt(t,e){const i=t%e;return i*e<0?i+e:i}function Dt(t,e,i){return t+i*(e-t)}function Ot(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function Gt(t,e){return Math.floor(Ot(t,e))}function zt(t,e){return Math.ceil(Ot(t,e))}function Wt(t,e,i){if(t>=e&&t<i)return t;const n=i-e;return((t-e)%n+n)%n+e}function Nt(t,e,i){return function(n,s,r,o,a){if(!n)return;if(!s&&!e)return n;const h=e?0:r[0]*s,l=e?0:r[1]*s,c=a?a[0]:0,u=a?a[1]:0;let d=t[0]+h/2+c,g=t[2]-h/2+c,_=t[1]+l/2+u,f=t[3]-l/2+u;d>g&&(d=(g+d)/2,g=d),_>f&&(_=(f+_)/2,f=_);let p=Pt(n[0],d,g),m=Pt(n[1],_,f);if(o&&i&&s){const t=30*s;p+=-t*Math.log(1+Math.max(0,d-n[0])/t)+t*Math.log(1+Math.max(0,n[0]-g)/t),m+=-t*Math.log(1+Math.max(0,_-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-f)/t)}return[p,m]}}function Xt(t){return t}const Bt=0,Kt=1,Vt=2,jt=4,Yt=8,Zt=16;function Ut(t){const e=ie();for(let i=0,n=t.length;i<n;++i)le(e,t[i]);return e}function Ht(t,e,i){return i?(i[0]=t[0]-e,i[1]=t[1]-e,i[2]=t[2]+e,i[3]=t[3]+e,i):[t[0]-e,t[1]-e,t[2]+e,t[3]+e]}function qt(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t.slice()}function $t(t,e,i){let n,s;return n=e<t[0]?t[0]-e:t[2]<e?e-t[2]:0,s=i<t[1]?t[1]-i:t[3]<i?i-t[3]:0,n*n+s*s}function Jt(t,e){return te(t,e[0],e[1])}function Qt(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]}function te(t,e,i){return t[0]<=e&&e<=t[2]&&t[1]<=i&&i<=t[3]}function ee(t,e){const i=t[0],n=t[1],s=t[2],r=t[3],o=e[0],a=e[1];let h=Bt;return o<i?h|=Zt:o>s&&(h|=jt),a<n?h|=Yt:a>r&&(h|=Vt),h===Bt&&(h=Kt),h}function ie(){return[1/0,1/0,-1/0,-1/0]}function ne(t,e,i,n,s){return s?(s[0]=t,s[1]=e,s[2]=i,s[3]=n,s):[t,e,i,n]}function se(t){return ne(1/0,1/0,-1/0,-1/0,t)}function re(t,e){const i=t[0],n=t[1];return ne(i,n,i,n,e)}function oe(t,e,i,n,s){return ce(se(s),t,e,i,n)}function ae(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function he(t,e){return e[0]<t[0]&&(t[0]=e[0]),e[2]>t[2]&&(t[2]=e[2]),e[1]<t[1]&&(t[1]=e[1]),e[3]>t[3]&&(t[3]=e[3]),t}function le(t,e){e[0]<t[0]&&(t[0]=e[0]),e[0]>t[2]&&(t[2]=e[0]),e[1]<t[1]&&(t[1]=e[1]),e[1]>t[3]&&(t[3]=e[1])}function ce(t,e,i,n,s){for(;i<n;i+=s)ue(t,e[i],e[i+1]);return t}function ue(t,e,i){t[0]=Math.min(t[0],e),t[1]=Math.min(t[1],i),t[2]=Math.max(t[2],e),t[3]=Math.max(t[3],i)}function de(t,e){let i;return i=e(_e(t)),i||(i=e(fe(t)),i||(i=e(Se(t)),i||(i=e(we(t)),i||!1)))}function ge(t){let e=0;return Te(t)||(e=Ee(t)*ve(t)),e}function _e(t){return[t[0],t[1]]}function fe(t){return[t[2],t[1]]}function pe(t){return[(t[0]+t[2])/2,(t[1]+t[3])/2]}function me(t,e){let i;if("bottom-left"===e)i=_e(t);else if("bottom-right"===e)i=fe(t);else if("top-left"===e)i=we(t);else{if("top-right"!==e)throw new Error("Invalid corner");i=Se(t)}return i}function ye(t,e,i,n,s){const[r,o,a,h,l,c,u,d]=xe(t,e,i,n);return ne(Math.min(r,a,l,u),Math.min(o,h,c,d),Math.max(r,a,l,u),Math.max(o,h,c,d),s)}function xe(t,e,i,n){const s=e*n[0]/2,r=e*n[1]/2,o=Math.cos(i),a=Math.sin(i),h=s*o,l=s*a,c=r*o,u=r*a,d=t[0],g=t[1];return[d-h+u,g-l-c,d-h-u,g-l+c,d+h-u,g+l+c,d+h+u,g+l-c,d-h+u,g-l-c]}function ve(t){return t[3]-t[1]}function Ce(t,e,i){const n=i||[1/0,1/0,-1/0,-1/0];return Ie(t,e)?(t[0]>e[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]<e[2]?n[2]=t[2]:n[2]=e[2],t[3]<e[3]?n[3]=t[3]:n[3]=e[3]):se(n),n}function we(t){return[t[0],t[3]]}function Se(t){return[t[2],t[3]]}function Ee(t){return t[2]-t[0]}function Ie(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function Te(t){return t[2]<t[0]||t[3]<t[1]}function Re(t,e,i,n){if(Te(t))return se(i);let s=[];if(n>1){const e=t[2]-t[0],i=t[3]-t[1];for(let r=0;r<n;++r)s.push(t[0]+e*r/n,t[1],t[2],t[1]+i*r/n,t[2]-e*r/n,t[3],t[0],t[3]-i*r/n)}else s=[t[0],t[1],t[2],t[1],t[2],t[3],t[0],t[3]];e(s,s,2);const r=[],o=[];for(let t=0,e=s.length;t<e;t+=2)r.push(s[t]),o.push(s[t+1]);return function(t,e,i){return ne(Math.min.apply(null,t),Math.min.apply(null,e),Math.max.apply(null,t),Math.max.apply(null,e),i)}(r,o,i)}function Me(t,e){const i=e.getExtent(),n=pe(t);if(e.canWrapX()&&(n[0]<i[0]||n[0]>=i[2])){const e=Ee(i),s=Math.floor((n[0]-i[0])/e)*e;t[0]-=s,t[2]-=s}return t}function Pe(t,e,i){if(e.canWrapX()){const n=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[n[0],t[1],n[2],t[3]]];Me(t,e);const s=Ee(n);if(Ee(t)>s&&!i)return[[n[0],t[1],n[2],t[3]]];if(t[0]<n[0])return[[t[0]+s,t[1],n[2],t[3]],[n[0],t[1],t[2],t[3]]];if(t[2]>n[2])return[[t[0],t[1],n[2],t[3]],[n[0],t[1],t[2]-s,t[3]]]}return[t]}function Fe(t,e){return t[0]+=+e[0],t[1]+=+e[1],t}function be(t,e){const i=t[0],n=t[1],s=e[0],r=e[1],o=s[0],a=s[1],h=r[0],l=r[1],c=h-o,u=l-a,d=0===c&&0===u?0:(c*(i-o)+u*(n-a))/(c*c+u*u||0);let g,_;return d<=0?(g=o,_=a):d>=1?(g=h,_=l):(g=o+d*c,_=a+d*u),[g,_]}function Le(t,e){let i=!0;for(let n=t.length-1;n>=0;--n)if(t[n]!=e[n]){i=!1;break}return i}function Ae(t,e){const i=Math.cos(e),n=Math.sin(e),s=t[0]*i-t[1]*n,r=t[1]*i+t[0]*n;return t[0]=s,t[1]=r,t}function ke(t,e){return t[0]*=e,t[1]*=e,t}function De(t,e){const i=t[0]-e[0],n=t[1]-e[1];return i*i+n*n}function Oe(t,e){return Math.sqrt(De(t,e))}function Ge(t,e){if(e.canWrapX()){const i=Ee(e.getExtent()),n=function(t,e,i){const n=e.getExtent();let s=0;e.canWrapX()&&(t[0]<n[0]||t[0]>n[2])&&(i=i||Ee(n),s=Math.floor((t[0]-n[0])/i));return s}(t,e,i);n&&(t[0]-=n*i)}return t}function ze(t){return Math.pow(t,3)}function We(t){return 1-ze(1-t)}function Ne(t){return 3*t*t-2*t*t*t}function Xe(t){return t}const Be={info:1,warn:2,error:3,none:4};let Ke=Be.info;function Ve(...t){Ke>Be.warn||console.warn(...t)}const je={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};const Ye=class{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,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_||je[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_}},Ze=6378137,Ue=Math.PI*Ze,He=[-Ue,-Ue,Ue,Ue],qe=[-180,-85,180,85],$e=Ze*Math.log(Math.tan(Math.PI/2));class Je extends Ye{constructor(t){super({code:t,units:"m",extent:He,global:!0,worldExtent:qe,getPointResolution:function(t,e){return t/Math.cosh(e[1]/Ze)}})}}const Qe=[new Je("EPSG:3857"),new Je("EPSG:102100"),new Je("EPSG:102113"),new Je("EPSG:900913"),new Je("http://www.opengis.net/def/crs/EPSG/0/3857"),new Je("http://www.opengis.net/gml/srs/epsg.xml#3857")];function ti(t,e,i,n){const s=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(s));for(let i=0;i<s;i+=n){e[i]=Ue*t[i]/180;let n=Ze*Math.log(Math.tan(Math.PI*(+t[i+1]+90)/360));n>$e?n=$e:n<-$e&&(n=-$e),e[i+1]=n}return e}function ei(t,e,i,n){const s=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(s));for(let i=0;i<s;i+=n)e[i]=180*t[i]/Ue,e[i+1]=360*Math.atan(Math.exp(t[i+1]/Ze))/Math.PI-90;return e}const ii=[-180,-90,180,90],ni=6378137*Math.PI/180;class si extends Ye{constructor(t,e){super({code:t,units:"degrees",extent:ii,axisOrientation:e,global:!0,metersPerUnit:ni,worldExtent:ii})}}const ri=[new si("CRS:84"),new si("EPSG:4326","neu"),new si("urn:ogc:def:crs:OGC:1.3:CRS84"),new si("urn:ogc:def:crs:OGC:2:84"),new si("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new si("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new si("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let oi={};let ai={};function hi(t,e,i){const n=t.getCode(),s=e.getCode();n in ai||(ai[n]={}),ai[n][s]=i}function li(t,e){return t in ai&&e in ai[t]?ai[t][e]:null}const ci=.9996,ui=.00669438,di=ui*ui,gi=di*ui,_i=ui/(1-ui),fi=Math.sqrt(1-ui),pi=(1-fi)/(1+fi),mi=pi*pi,yi=mi*pi,xi=yi*pi,vi=xi*pi,Ci=.9983242984503243,wi=15*di/256+45*gi/1024,Si=35*gi/3072,Ei=1.5*pi-27/32*yi+269/512*vi,Ii=21/16*mi-55/32*xi,Ti=151/96*yi-417/128*vi,Ri=1097/512*xi,Mi=6378137;function Pi(t,e,i){const n=t-5e5,s=(i.north?e:e-1e7)/ci/(Mi*Ci),r=s+Ei*Math.sin(2*s)+Ii*Math.sin(4*s)+Ti*Math.sin(6*s)+Ri*Math.sin(8*s),o=Math.sin(r),a=o*o,h=Math.cos(r),l=o/h,c=l*l,u=c*c,d=1-ui*a,g=Math.sqrt(1-ui*a),_=_i*h**2,f=_*_,p=n/(Mi/g*ci),m=p*p,y=m*p,x=y*p,v=x*p,C=r-l/((1-ui)/d)*(m/2-x/24*(5+3*c+10*_-4*f-9*_i))+v*p/720*(61+90*c+298*_+45*u-252*_i-3*f);let w=(p-y/6*(1+2*c+_)+v/120*(5-2*_+28*c-3*f+8*_i+24*u))/h;return w=Wt(w+At(bi(i.number)),-Math.PI,Math.PI),[Lt(w),Lt(C)]}function Fi(t,e,i){t=Wt(t,-180,180),e<-80?e=-80:e>84&&(e=84);const n=At(e),s=Math.sin(n),r=Math.cos(n),o=s/r,a=o*o,h=a*a,l=At(t),c=At(bi(i.number)),u=Mi/Math.sqrt(1-ui*s**2),d=_i*r**2,g=r*Wt(l-c,-Math.PI,Math.PI),_=g*g,f=_*g,p=f*g,m=p*g,y=m*g,x=Mi*(Ci*n-.002514607064228144*Math.sin(2*n)+wi*Math.sin(4*n)-Si*Math.sin(6*n)),v=ci*u*(g+f/6*(1-a+d)+m/120*(5-18*a+h+72*d-58*_i))+5e5;let C=ci*(x+u*o*(_/2+p/24*(5-a+9*d+4*d**2)+y/720*(61-58*a+h+600*d-330*_i)));return i.north||(C+=1e7),[v,C]}function bi(t){return 6*(t-1)-180+3}const Li=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function Ai(t){let e=0;for(const i of Li){const n=t.match(i);if(n){e=parseInt(n[1]);break}}if(!e)return null;let i=0,n=!1;return e>32700&&e<32761?i=e-32700:e>32600&&e<32661&&(n=!0,i=e-32600),i?{number:i,north:n}:null}function ki(t,e){return function(i,n,s,r){const o=i.length;s=s>1?s:2,r=r??s,n||(n=s>2?i.slice():new Array(o));for(let s=0;s<o;s+=r){const r=i[s],o=i[s+1],a=t(r,o,e);n[s]=a[0],n[s+1]=a[1]}return n}}const Di=6371008.8;function Oi(t,e,i){i=i||Di;const n=At(t[1]),s=At(e[1]),r=(s-n)/2,o=At(e[0]-t[0])/2,a=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(s);return 2*i*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}const Gi=[function(t){const e=Ai(t.getCode());return e?{forward:ki(Fi,e),inverse:ki(Pi,e)}:null}],zi=[function(t){return Ai(t)?new Ye({code:t,units:"m"}):null}];let Wi=!0;function Ni(t){Wi=!(void 0===t||t)}function Xi(t,e){if(void 0!==e)for(let i=0,n=t.length;i<n;++i)e[i]=t[i];else e=t.slice();return e}function Bi(t){!function(t,e){oi[t]=e}(t.getCode(),t),hi(t,t,Xi)}function Ki(t){if("string"!=typeof t)return t;const e=oi[i=t]||oi[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null;var i;if(e)return e;for(const e of zi){const i=e(t);if(i)return i}return null}function Vi(t,e,i,n){let s;const r=(t=Ki(t)).getPointResolutionFunc();if(r){if(s=r(e,i),n&&n!==t.getUnits()){const e=t.getMetersPerUnit();e&&(s=s*e/je[n])}}else{const r=t.getUnits();if("degrees"==r&&!n||"degrees"==n)s=e;else{const o=$i(t,Ki("EPSG:4326"));if(o||"degrees"===r){let t=[i[0]-e/2,i[1],i[0]+e/2,i[1],i[0],i[1]-e/2,i[0],i[1]+e/2];t=o(t,t,2);s=(Oi(t.slice(0,2),t.slice(2,4))+Oi(t.slice(4,6),t.slice(6,8)))/2}else s=e*t.getMetersPerUnit();const a=n?je[n]:t.getMetersPerUnit();void 0!==a&&(s/=a)}}return s}function ji(t){!function(t){t.forEach(Bi)}(t),t.forEach(function(e){t.forEach(function(t){e!==t&&hi(e,t,Xi)})})}function Yi(t,e){return t?"string"==typeof t?Ki(t):t:Ki(e)}function Zi(t){return function(e,i,n,s){const r=e.length;n=void 0!==n?n:2,s=s??n,i=void 0!==i?i:new Array(r);for(let o=0;o<r;o+=s){const r=t(e.slice(o,o+n)),a=r.length;for(let t=0,n=s;t<n;++t)i[o+t]=t>=a?e[o+t]:r[t]}return i}}function Ui(t,e){return Ni(),tn(t,"EPSG:4326",void 0!==e?e:"EPSG:3857")}function Hi(t,e){const i=tn(t,void 0!==e?e:"EPSG:3857","EPSG:4326"),n=i[0];return(n<-180||n>180)&&(i[0]=kt(n+180,360)-180),i}function qi(t,e){if(t===e)return!0;const i=t.getUnits()===e.getUnits();if(t.getCode()===e.getCode())return i;return $i(t,e)===Xi&&i}function $i(t,e){const i=t.getCode(),n=e.getCode();let s=li(i,n);if(s)return s;let r=null,o=null;for(const i of Gi)r||(r=i(t)),o||(o=i(e));if(!r&&!o)return null;const a="EPSG:4326";if(o)if(r)s=Ji(r.inverse,o.forward);else{const t=li(i,a);t&&(s=Ji(t,o.forward))}else{const t=li(a,n);t&&(s=Ji(r.inverse,t))}return s&&(Bi(t),Bi(e),hi(t,e,s)),s}function Ji(t,e){return function(i,n,s,r){return n=t(i,n,s,r),e(n,n,s,r)}}function Qi(t,e){return $i(Ki(t),Ki(e))}function tn(t,e,i){const n=Qi(e,i);if(!n){const t=Ki(e).getCode(),n=Ki(i).getCode();throw new Error(`No transform available between ${t} and ${n}`)}return n(t,void 0,t.length)}function en(t,e,i,n){return Re(t,Qi(e,i),void 0,n)}let nn=null;function sn(){return nn}function rn(t,e){return nn?tn(t,e,nn):t}function on(t,e){return nn?tn(t,nn,e):(Wi&&!Le(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(Wi=!1,Ve("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t)}function an(t,e){return nn?en(t,e,nn):t}function hn(t,e){return nn?en(t,nn,e):t}function ln(t,e){if(!nn)return t;const i=Ki(e).getMetersPerUnit(),n=nn.getMetersPerUnit();return i&&n?t*i/n:t}var cn,un,dn;ji(Qe),ji(ri),cn=Qe,un=ti,dn=ei,ri.forEach(function(t){cn.forEach(function(e){hi(t,e,un),hi(e,t,dn)})});new Array(6);function gn(t,e){const i=e[0],n=e[1];return e[0]=t[0]*i+t[2]*n+t[4],e[1]=t[1]*i+t[3]*n+t[5],e}function _n(t,e,i,n,s,r,o,a){const h=Math.sin(r),l=Math.cos(r);return t[0]=n*l,t[1]=s*h,t[2]=-n*h,t[3]=s*l,t[4]=o*n*l-a*n*h+e,t[5]=o*s*h+a*s*l+i,t}function fn(t,e){const i=(n=e)[0]*n[3]-n[1]*n[2];var n;wt(0!==i,"Transformation matrix cannot be inverted");const s=e[0],r=e[1],o=e[2],a=e[3],h=e[4],l=e[5];return t[0]=a/i,t[1]=-r/i,t[2]=-o/i,t[3]=s/i,t[4]=(o*l-a*h)/i,t[5]=-(s*l-r*h)/i,t}const pn=[1e5,1e5,1e5,1e5,2,2];function mn(t){return"matrix("+t.join(", ")+")"}function yn(t){return t.substring(7,t.length-1).split(",").map(parseFloat)}function xn(t,e,i,n,s,r,o){r=r||[],o=o||2;let a=0;for(let h=e;h<i;h+=n){const e=t[h],i=t[h+1];r[a++]=s[0]*e+s[2]*i+s[4],r[a++]=s[1]*e+s[3]*i+s[5];for(let e=2;e<o;e++)r[a++]=t[h+e]}return r&&r.length!=a&&(r.length=a),r}function vn(t,e,i,n,s,r,o){o=o||[];const a=Math.cos(s),h=Math.sin(s),l=r[0],c=r[1];let u=0;for(let s=e;s<i;s+=n){const e=t[s]-l,i=t[s+1]-c;o[u++]=l+e*a-i*h,o[u++]=c+e*h+i*a;for(let e=s+2;e<s+n;++e)o[u++]=t[e]}return o&&o.length!=u&&(o.length=u),o}const Cn=[1,0,0,1,0,0],wn=[NaN,NaN];const Sn=class extends V{constructor(){super(),this.extent_=[1/0,1/0,-1/0,-1/0],this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=P((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const n=this.clone();return n.applyTransform(i),n.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return N()}closestPointXY(t,e,i,n){return N()}containsXY(t,e){return 0===this.closestPointXY(t,e,wn,Number.MIN_VALUE)}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 N()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&se(t),this.extentRevision_=this.getRevision()}return function(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t}(this.extent_,t)}rotate(t,e){N()}scale(t,e,i){N()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return N()}getType(){return N()}applyTransform(t){N()}intersectsExtent(t){return N()}translate(t,e){N()}transform(t,e){const i=Ki(t),n="tile-pixels"==i.getUnits()?function(t,n,s){const r=i.getExtent(),o=i.getWorldExtent(),a=ve(o)/ve(r);_n(Cn,o[0],o[3],a,-a,0,0,0);const h=xn(t,0,t.length,s,Cn,n),l=Qi(i,e);return l?l(h,h,s):h}:Qi(i,e);return this.applyTransform(n),this}};function En(t){let e;return"XY"==t?e=2:"XYZ"==t||"XYM"==t?e=3:"XYZM"==t&&(e=4),e}const In=class extends Sn{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return oe(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return N()}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||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&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=En(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){N()}setLayout(t,e,i){let n;if(t)n=En(t);else{for(let t=0;t<i;++t){if(0===e.length)return this.layout="XY",void(this.stride=2);e=e[0]}n=e.length,t=function(t){let e;2==t?e="XY":3==t?e="XYZ":4==t&&(e="XYZM");return e}(n)}this.layout=t,this.stride=n}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();vn(i,0,i.length,n,t,e,i),this.changed()}}scale(t,e,i){void 0===e&&(e=t),i||(i=pe(this.getExtent()));const n=this.getFlatCoordinates();if(n){const s=this.getStride();!function(t,e,i,n,s,r,o,a){a=a||[];const h=o[0],l=o[1];let c=0;for(let o=e;o<i;o+=n){const e=t[o]-h,i=t[o+1]-l;a[c++]=h+s*e,a[c++]=l+r*i;for(let e=o+2;e<o+n;++e)a[c++]=t[e]}a&&a.length!=c&&(a.length=c)}(n,0,n.length,s,t,e,i,n),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();!function(t,e,i,n,s,r,o){o=o||[];let a=0;for(let h=e;h<i;h+=n){o[a++]=t[h]+s,o[a++]=t[h+1]+r;for(let e=h+2;e<h+n;++e)o[a++]=t[e]}o&&o.length!=a&&(o.length=a)}(i,0,i.length,n,t,e,i),this.changed()}}};function Tn(t,e,i,n){let s=0;const r=t[i-n],o=t[i-n+1];let a=0,h=0;for(;e<i;e+=n){const i=t[e]-r,n=t[e+1]-o;s+=h*i-a*n,a=i,h=n}return s/2}function Rn(t,e,i,n){let s=0;for(let r=0,o=i.length;r<o;++r){const o=i[r];s+=Tn(t,e,o,n),e=o}return s}function Mn(t,e,i,n,s,r,o){const a=t[e],h=t[e+1],l=t[i]-a,c=t[i+1]-h;let u;if(0===l&&0===c)u=e;else{const d=((s-a)*l+(r-h)*c)/(l*l+c*c);if(d>1)u=i;else{if(d>0){for(let s=0;s<n;++s)o[s]=Dt(t[e+s],t[i+s],d);return void(o.length=n)}u=e}}for(let e=0;e<n;++e)o[e]=t[u+e];o.length=n}function Pn(t,e,i,n,s){let r=t[e],o=t[e+1];for(e+=n;e<i;e+=n){const i=t[e],n=t[e+1],a=bt(r,o,i,n);a>s&&(s=a),r=i,o=n}return s}function Fn(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r];s=Pn(t,e,o,n,s),e=o}return s}function bn(t,e,i,n,s,r,o,a,h,l,c){if(e==i)return l;let u,d;if(0===s){if(d=bt(o,a,t[e],t[e+1]),d<l){for(u=0;u<n;++u)h[u]=t[e+u];return h.length=n,d}return l}c=c||[NaN,NaN];let g=e+n;for(;g<i;)if(Mn(t,g-n,g,n,o,a,c),d=bt(o,a,c[0],c[1]),d<l){for(l=d,u=0;u<n;++u)h[u]=c[u];h.length=n,g+=n}else g+=n*Math.max((Math.sqrt(d)-Math.sqrt(l))/s|0,1);if(r&&(Mn(t,i-n,e,n,o,a,c),d=bt(o,a,c[0],c[1]),d<l)){for(l=d,u=0;u<n;++u)h[u]=c[u];h.length=n}return l}function Ln(t,e,i,n,s,r,o,a,h,l,c){c=c||[NaN,NaN];for(let u=0,d=i.length;u<d;++u){const d=i[u];l=bn(t,e,d,n,s,r,o,a,h,l,c),e=d}return l}function An(t,e,i,n){for(let n=0,s=i.length;n<s;++n)t[e++]=i[n];return e}function kn(t,e,i,n){for(let s=0,r=i.length;s<r;++s){const r=i[s];for(let i=0;i<n;++i)t[e++]=r[i]}return e}function Dn(t,e,i,n,s){s=s||[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=kn(t,e,i[o],n);s[r++]=a,e=a}return s.length=r,s}function On(t,e,i,n,s){s=void 0!==s?s:[];let r=0;for(let o=e;o<i;o+=n)s[r++]=t.slice(o,o+n);return s.length=r,s}function Gn(t,e,i,n,s){s=void 0!==s?s:[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];s[r++]=On(t,e,a,n,s[r]),e=a}return s.length=r,s}function zn(t,e,i,n,s){s=void 0!==s?s:[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];s[r++]=1===a.length&&a[0]===e?[]:Gn(t,e,a,n,s[r]),e=a[a.length-1]}return s.length=r,s}function Wn(t,e,i,n,s,r,o){const a=(i-e)/n;if(a<3){for(;e<i;e+=n)r[o++]=t[e],r[o++]=t[e+1];return o}const h=new Array(a);h[0]=1,h[a-1]=1;const l=[e,i-n];let c=0;for(;l.length>0;){const i=l.pop(),r=l.pop();let o=0;const a=t[r],u=t[r+1],d=t[i],g=t[i+1];for(let e=r+n;e<i;e+=n){const i=Ft(t[e],t[e+1],a,u,d,g);i>o&&(c=e,o=i)}o>s&&(h[(c-e)/n]=1,r+n<c&&l.push(r,c),c+n<i&&l.push(c,i))}for(let i=0;i<a;++i)h[i]&&(r[o++]=t[e+i*n],r[o++]=t[e+i*n+1]);return o}function Nn(t,e,i,n,s,r,o,a){for(let h=0,l=i.length;h<l;++h){const l=i[h];o=Wn(t,e,l,n,s,r,o),a.push(o),e=l}return o}function Xn(t,e){return e*Math.round(t/e)}function Bn(t,e,i,n,s,r,o){if(e==i)return o;let a,h,l=Xn(t[e],s),c=Xn(t[e+1],s);e+=n,r[o++]=l,r[o++]=c;do{if(a=Xn(t[e],s),h=Xn(t[e+1],s),(e+=n)==i)return r[o++]=a,r[o++]=h,o}while(a==l&&h==c);for(;e<i;){const i=Xn(t[e],s),u=Xn(t[e+1],s);if(e+=n,i==a&&u==h)continue;const d=a-l,g=h-c,_=i-l,f=u-c;d*f==g*_&&(d<0&&_<d||d==_||d>0&&_>d)&&(g<0&&f<g||g==f||g>0&&f>g)?(a=i,h=u):(r[o++]=a,r[o++]=h,l=a,c=h,a=i,h=u)}return r[o++]=a,r[o++]=h,o}function Kn(t,e,i,n,s,r,o,a){for(let h=0,l=i.length;h<l;++h){const l=i[h];o=Bn(t,e,l,n,s,r,o),a.push(o),e=l}return o}class Vn extends In{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}clone(){return new Vn(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,n){return n<$t(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Pn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),bn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,n))}getArea(){return Tn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return On(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=Wn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new Vn(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=kn(this.flatCoordinates,0,t,this.stride),this.changed()}}const jn=Vn;class Yn extends In{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new Yn(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const s=this.flatCoordinates,r=bt(t,e,s[0],s[1]);if(r<n){const t=this.stride;for(let e=0;e<t;++e)i[e]=s[e];return i.length=t,r}return n}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return re(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return te(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=An(this.flatCoordinates,0,t,this.stride),this.changed()}}const Zn=Yn;function Un(t,e,i,n,s){return!de(s,function(s){return!Hn(t,e,i,n,s[0],s[1])})}function Hn(t,e,i,n,s,r){let o=0,a=t[i-n],h=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];h<=r?n>r&&(i-a)*(r-h)-(s-a)*(n-h)>0&&o++:n<=r&&(i-a)*(r-h)-(s-a)*(n-h)<0&&o--,a=i,h=n}return 0!==o}function qn(t,e,i,n,s,r){if(0===i.length)return!1;if(!Hn(t,e,i[0],n,s,r))return!1;for(let e=1,o=i.length;e<o;++e)if(Hn(t,i[e-1],i[e],n,s,r))return!1;return!0}function $n(t,e,i,n,s,r,o){let a,h,l,c,u,d,g;const _=s[r+1],f=[];for(let s=0,r=i.length;s<r;++s){const r=i[s];for(c=t[r-n],d=t[r-n+1],a=e;a<r;a+=n)u=t[a],g=t[a+1],(_<=d&&g<=_||d<=_&&_<=g)&&(l=(_-d)/(g-d)*(u-c)+c,f.push(l)),c=u,d=g}let p=NaN,m=-1/0;for(f.sort(v),c=f[0],a=1,h=f.length;a<h;++a){u=f[a];const s=Math.abs(u-c);s>m&&(l=(c+u)/2,qn(t,e,i,n,l,_)&&(p=l,m=s)),c=u}return isNaN(p)&&(p=s[r]),o?(o.push(p,_,m),o):[p,_,m]}function Jn(t,e,i,n,s){let r=[];for(let o=0,a=i.length;o<a;++o){const a=i[o];r=$n(t,e,a,n,s,2*o,r),e=a[a.length-1]}return r}function Qn(t,e,i,n,s){let r;for(e+=n;e<i;e+=n)if(r=s(t.slice(e-n,e),t.slice(e,e+n)),r)return r;return!1}function ts(t,e,i,n,s,r){return r=r??ce([1/0,1/0,-1/0,-1/0],t,e,i,n),!!Ie(s,r)&&(r[0]>=s[0]&&r[2]<=s[2]||r[1]>=s[1]&&r[3]<=s[3]||Qn(t,e,i,n,function(t,e){return function(t,e,i){let n=!1;const s=ee(t,e),r=ee(t,i);if(s===Kt||r===Kt)n=!0;else{const o=t[0],a=t[1],h=t[2],l=t[3],c=e[0],u=e[1],d=i[0],g=i[1],_=(g-u)/(d-c);let f,p;r&Vt&&!(s&Vt)&&(f=d-(g-l)/_,n=f>=o&&f<=h),n||!(r&jt)||s&jt||(p=g-(d-h)*_,n=p>=a&&p<=l),n||!(r&Yt)||s&Yt||(f=d-(g-a)/_,n=f>=o&&f<=h),n||!(r&Zt)||s&Zt||(p=g-(d-o)*_,n=p>=a&&p<=l)}return n}(s,t,e)}))}function es(t,e,i,n,s){return!!ts(t,e,i,n,s)||(!!Hn(t,e,i,n,s[0],s[1])||(!!Hn(t,e,i,n,s[0],s[3])||(!!Hn(t,e,i,n,s[2],s[1])||!!Hn(t,e,i,n,s[2],s[3]))))}function is(t,e,i,n,s){if(!es(t,e,i[0],n,s))return!1;if(1===i.length)return!0;for(let e=1,r=i.length;e<r;++e)if(Un(t,i[e-1],i[e],n,s)&&!ts(t,i[e-1],i[e],n,s))return!1;return!0}function ns(t,e,i,n){for(;e<i-n;){for(let s=0;s<n;++s){const r=t[e+s];t[e+s]=t[i-n+s],t[i-n+s]=r}e+=n,i-=n}}function ss(t,e,i,n){let s=0,r=t[i-n],o=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];s+=(i-r)*(n+o),r=i,o=n}return 0===s?void 0:s>0}function rs(t,e,i,n,s){s=void 0!==s&&s;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=ss(t,e,o,n);if(0===r){if(s&&a||!s&&!a)return!1}else if(s&&!a||!s&&a)return!1;e=o}return!0}function os(t,e,i,n,s){s=void 0!==s&&s;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=ss(t,e,o,n);(0===r?s&&a||!s&&!a:s&&!a||!s&&a)&&ns(t,e,o,n),e=o}return e}function as(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r)e=os(t,e,i[r],n,s);return e}class hs extends In{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,void 0!==e&&i?(this.setFlatCoordinates(e,t),this.ends_=i):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?E(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new hs(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<$t(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Fn(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Ln(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return qn(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return Rn(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),os(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,Gn(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=pe(this.getExtent());this.flatInteriorPoint_=$n(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Zn(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new jn(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,n=[];let s=0;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=new jn(e.slice(s,o),t);n.push(a),s=o}return n}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;rs(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=os(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=Kn(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new hs(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return is(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=Dn(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}const ls=hs;function cs(t){if(Te(t))throw new Error("Cannot create polygon from empty extent");const e=t[0],i=t[1],n=t[2],s=t[3],r=[e,i,e,s,n,s,n,i,e,i];return new hs(r,"XY",[r.length])}function us(t,e,i){e=e||32;const n=t.getStride(),s=t.getLayout(),r=t.getCenter(),o=n*(e+1),a=new Array(o);for(let t=0;t<o;t+=n){a[t]=0,a[t+1]=0;for(let e=2;e<n;e++)a[t+e]=r[e]}const h=[a.length],l=new hs(a,s,h);return function(t,e,i,n){const s=t.getFlatCoordinates(),r=t.getStride(),o=s.length/r-1,a=n||0;for(let t=0;t<=o;++t){const n=t*r,h=a+2*kt(t,o)*Math.PI/o;s[n]=e[0]+i*Math.cos(h),s[n+1]=e[1]+i*Math.sin(h)}t.changed()}(l,r,t.getRadius(),i),l}function ds(t,e,i,n){const s=Ee(e)/i[0],r=ve(e)/i[1];return n?Math.min(t,Math.max(s,r)):Math.min(t,Math.min(s,r))}function gs(t,e,i){let n=Math.min(t,e);return n*=Math.log(1+50*Math.max(0,t/e-1))/50+1,i&&(n=Math.max(n,i),n/=Math.log(1+50*Math.max(0,i/t-1))/50+1),Pt(n,i/2,2*e)}function _s(t,e,i,n,s){return i=void 0===i||i,function(r,o,a,h){if(void 0!==r){const o=n?ds(t,n,a,s):t;return i&&h?gs(r,o,e):Pt(r,e,o)}}}function fs(t){if(void 0!==t)return 0}function ps(t){if(void 0!==t)return t}const ms=256;function ys(t,e){setTimeout(function(){t(e)},0)}function xs(t){return!(t.sourceCenter&&t.targetCenter&&!Le(t.sourceCenter,t.targetCenter))&&(t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation)}function vs(t,e,i,n,s){const r=Math.cos(-s);let o=Math.sin(-s),a=t[0]*r-t[1]*o,h=t[1]*r+t[0]*o;a+=(e[0]/2-i[0])*n,h+=(i[1]-e[1]/2)*n,o=-o;return[a*r-h*o,h*r+a*o]}const Cs=class extends V{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Yi(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&&Ni(),t.center&&(t.center=on(t.center,this.projection_)),t.extent&&(t.extent=hn(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const t in Mt)delete e[t];this.setProperties(e,!0);const i=function(t){let e,i,n;const s=28,r=2;let o=void 0!==t.minZoom?t.minZoom:0,a=void 0!==t.maxZoom?t.maxZoom:s;const h=void 0!==t.zoomFactor?t.zoomFactor:r,l=void 0!==t.multiWorld&&t.multiWorld,c=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,u=void 0!==t.showFullExtent&&t.showFullExtent,d=Yi(t.projection,"EPSG:3857"),g=d.getExtent();let _=t.constrainOnlyCenter,f=t.extent;l||f||!d.isGlobal()||(_=!1,f=g);if(void 0!==t.resolutions){const s=t.resolutions;i=s[o],n=void 0!==s[a]?s[a]:s[s.length-1],e=t.constrainResolution?function(t,e,i,n){return e=void 0===e||e,function(s,r,o,a){if(void 0!==s){const h=t[0],l=t[t.length-1],c=i?ds(h,i,o,n):h;if(a)return e?gs(s,c,l):Pt(s,l,c);const u=Math.min(c,s),d=Math.floor(w(t,u,r));return t[d]>c&&d<t.length-1?t[d+1]:t[d]}}}(s,c,!_&&f,u):_s(i,n,c,!_&&f,u)}else{const l=(g?Math.max(Ee(g),ve(g)):360*je.degrees/d.getMetersPerUnit())/ms/Math.pow(r,0),p=l/Math.pow(r,s-0);i=t.maxResolution,void 0!==i?o=0:i=l/Math.pow(h,o),n=t.minResolution,void 0===n&&(n=void 0!==t.maxZoom?void 0!==t.maxResolution?i/Math.pow(h,a):l/Math.pow(h,a):p),a=o+Math.floor(Math.log(i/n)/Math.log(h)),n=i/Math.pow(h,a-o),e=t.constrainResolution?function(t,e,i,n,s,r){return n=void 0===n||n,i=void 0!==i?i:0,function(o,a,h,l){if(void 0!==o){const c=s?ds(e,s,h,r):e;if(l)return n?gs(o,c,i):Pt(o,i,c);const u=1e-9,d=Math.ceil(Math.log(e/c)/Math.log(t)-u),g=-a*(.5-u)+.5,_=Math.min(c,o),f=Math.floor(Math.log(e/_)/Math.log(t)+g),p=Math.max(d,f);return Pt(e/Math.pow(t,p),i,c)}}}(h,i,n,c,!_&&f,u):_s(i,n,c,!_&&f,u)}return{constraint:e,maxResolution:i,minResolution:n,minZoom:o,zoomFactor:h}}(t);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=i.minZoom;const n=function(t){if(void 0!==t.extent){const e=void 0===t.smoothExtentConstraint||t.smoothExtentConstraint;return Nt(t.extent,t.constrainOnlyCenter,e)}const e=Yi(t.projection,"EPSG:3857");if(!0!==t.multiWorld&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,Nt(t,!1,!1)}return Xt}(t),s=i.constraint,r=function(t){const e=void 0===t.enableRotation||t.enableRotation;if(e){const e=t.constrainRotation;return void 0===e||!0===e?function(t){const e=void 0===t?At(5):t;return function(t,i){return i||void 0===t?t:Math.abs(t)<=e?0:t}}():!1===e?ps:"number"==typeof e?function(t){const e=2*Math.PI/t;return function(t,i){return i?t:void 0!==t?t=Math.floor(t/e+.5)*e:void 0}}(e):ps}return fs}(t);this.constraints_={center:n,resolution:s,rotation:r},this.setRotation(void 0!==t.rotation?t.rotation:0),this.setCenterInternal(void 0!==t.center?t.center:null),void 0!==t.resolution?this.setResolution(t.resolution):void 0!==t.zoom&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const i=this.getCenterInternal();if(i){const n=t||[0,0,0,0];e=e||[0,0,0,0];const s=this.getResolution(),r=s/2*(n[3]-e[3]+e[1]-n[1]),o=s/2*(n[0]-e[0]+e[2]-n[2]);this.setCenterInternal([i[0]+r,i[1]-o])}}getUpdatedOptions_(t){const e=this.getProperties();return void 0!==e.resolution?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 t=0;t<e.length;++t){let i=arguments[t];i.center&&(i=Object.assign({},i),i.center=on(i.center,this.getProjection())),i.anchor&&(i=Object.assign({},i),i.anchor=on(i.anchor,this.getProjection())),e[t]=i}this.animateInternal.apply(this,e)}animateInternal(t){let e,i=arguments.length;i>1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i);let n=0;for(;n<i&&!this.isDef();++n){const t=arguments[n];t.center&&this.setCenterInternal(t.center),void 0!==t.zoom?this.setZoom(t.zoom):t.resolution&&this.setResolution(t.resolution),void 0!==t.rotation&&this.setRotation(t.rotation)}if(n===i)return void(e&&ys(e,!0));let s=Date.now(),r=this.targetCenter_.slice(),o=this.targetResolution_,a=this.targetRotation_;const h=[];for(;n<i;++n){const t=arguments[n],i={start:s,complete:!1,anchor:t.anchor,duration:void 0!==t.duration?t.duration:1e3,easing:t.easing||Ne,callback:e};if(t.center&&(i.sourceCenter=r,i.targetCenter=t.center.slice(),r=i.targetCenter),void 0!==t.zoom?(i.sourceResolution=o,i.targetResolution=this.getResolutionForZoom(t.zoom),o=i.targetResolution):t.resolution&&(i.sourceResolution=o,i.targetResolution=t.resolution,o=i.targetResolution),void 0!==t.rotation){i.sourceRotation=a;const e=kt(t.rotation-a+Math.PI,2*Math.PI)-Math.PI;i.targetRotation=a+e,a=i.targetRotation}xs(i)?i.complete=!0:s+=i.duration,h.push(i)}this.animations_.push(h),this.setHint(Tt,1),this.updateAnimations_()}getAnimating(){return this.hints_[Tt]>0}getInteracting(){return this.hints_[Rt]>0}cancelAnimations(){let t;this.setHint(Tt,-this.hints_[Tt]);for(let e=0,i=this.animations_.length;e<i;++e){const i=this.animations_[e];if(i[0].callback&&ys(i[0].callback,!1),!t)for(let e=0,n=i.length;e<n;++e){const n=i[e];if(!n.complete){t=n.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(void 0!==this.updateAnimationKey_&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let i=this.animations_.length-1;i>=0;--i){const n=this.animations_[i];let s=!0;for(let i=0,r=n.length;i<r;++i){const r=n[i];if(r.complete)continue;const o=t-r.start;let a=r.duration>0?o/r.duration:1;a>=1?(r.complete=!0,a=1):s=!1;const h=r.easing(a);if(r.sourceCenter){const t=r.sourceCenter[0],e=r.sourceCenter[1],i=r.targetCenter[0],n=r.targetCenter[1];this.nextCenter_=r.targetCenter;const s=t+h*(i-t),o=e+h*(n-e);this.targetCenter_=[s,o]}if(r.sourceResolution&&r.targetResolution){const t=1===h?r.targetResolution:r.sourceResolution+h*(r.targetResolution-r.sourceResolution);if(r.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,r.anchor)}this.nextResolution_=r.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==r.sourceRotation&&void 0!==r.targetRotation){const t=1===h?kt(r.targetRotation+Math.PI,2*Math.PI)-Math.PI:r.sourceRotation+h*(r.targetRotation-r.sourceRotation);if(r.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,r.anchor)}this.nextRotation_=r.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!r.complete)break}if(s){this.animations_[i]=null,this.setHint(Tt,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=n[0].callback;t&&ys(t,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const n=this.getCenterInternal();return void 0!==n&&(i=[n[0]-e[0],n[1]-e[1]],Ae(i,t-this.getRotation()),Fe(i,e)),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),s=this.getResolution();if(void 0!==n&&void 0!==s){i=[e[0]-t*(e[0]-n[0])/s,e[1]-t*(e[1]-n[1])/s]}return i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?rn(t,this.getProjection()):t}getCenterInternal(){return this.get(Mt.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){return an(this.calculateExtentInternal(t),this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();wt(e,"The view center is not defined");const i=this.getResolution();wt(void 0!==i,"The view resolution is not defined");const n=this.getRotation();return wt(void 0!==n,"The view rotation is not defined"),ye(e,i,n,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(Mt.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(hn(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=Ee(t)/e[0],n=ve(t)/e[1];return Math.max(i,n)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,n=Math.log(e/i)/Math.log(t);return function(i){return e/Math.pow(t,i*n)}}getRotation(){return this.get(Mt.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,s=Math.log(i/n)/e;return function(t){return Math.log(i/t)/e/s}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let n=this.getCenterInternal();const s=this.padding_;if(s){const t=this.getViewportSizeMinusPadding_();n=vs(n,this.getViewportSize_(),[t[0]/2+s[3],t[1]/2+s[0]],e,i)}return{center:n.slice(0),projection:void 0!==t?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 void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,n=this.minZoom_||0;if(this.resolutions_){const s=w(this.resolutions_,t,1);n=s,e=this.resolutions_[s],i=s==this.resolutions_.length-1?2:e/this.resolutions_[s+1]}else e=this.maxResolution_,i=this.zoomFactor_;return n+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.resolutions_?.length){if(1===this.resolutions_.length)return this.resolutions_[0];const e=Pt(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,Pt(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(wt(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){wt(!Te(t),"Cannot fit empty extent provided as `geometry`");i=cs(hn(t,this.getProjection()))}else if("Circle"===t.getType()){const e=hn(t.getExtent(),this.getProjection());i=cs(e),i.rotate(this.getRotation(),pe(e))}else{const e=sn();i=e?t.clone().transform(e,this.getProjection()):t}this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),s=t.getFlatCoordinates(),r=t.getStride();let o=1/0,a=1/0,h=-1/0,l=-1/0;for(let t=0,e=s.length;t<e;t+=r){const e=s[t]*i-s[t+1]*n,r=s[t]*n+s[t+1]*i;o=Math.min(o,e),a=Math.min(a,r),h=Math.max(h,e),l=Math.max(l,r)}return[o,a,h,l]}fitInternal(t,e){let i=(e=e||{}).size;i||(i=this.getViewportSizeMinusPadding_());const n=void 0!==e.padding?e.padding:[0,0,0,0],s=void 0!==e.nearest&&e.nearest;let r;r=void 0!==e.minResolution?e.minResolution:void 0!==e.maxZoom?this.getResolutionForZoom(e.maxZoom):0;const o=this.rotatedExtentForGeometry(t);let a=this.getResolutionForExtentInternal(o,[i[0]-n[1]-n[3],i[1]-n[0]-n[2]]);a=isNaN(a)?r:Math.max(a,r),a=this.getConstrainedResolution(a,s?0:1);const h=this.getRotation(),l=Math.sin(h),c=Math.cos(h),u=pe(o);u[0]+=(n[1]-n[3])/2*a,u[1]+=(n[0]-n[2])/2*a;const d=u[0]*c-u[1]*l,g=u[1]*c+u[0]*l,_=this.getConstrainedCenter([d,g],a),f=e.callback?e.callback:M;void 0!==e.duration?this.animateInternal({resolution:a,center:_,duration:e.duration,easing:e.easing},f):(this.targetResolution_=a,this.targetCenter_=_,this.applyTargetState_(!1,!0),ys(f,!0))}centerOn(t,e,i){this.centerOnInternal(on(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(vs(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,n){let s;const r=this.padding_;if(r&&t){const o=this.getViewportSizeMinusPadding_(-i),a=vs(t,n,[o[0]/2+r[3],o[1]/2+r[0]],e,i);s=[t[0]-a[0],t[1]-a[1]]}return s}isDef(){return!!this.getCenterInternal()&&void 0!==this.getResolution()}adjustCenter(t){const e=rn(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&&on(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.getViewportSize_(this.getRotation()),s=this.constraints_.resolution(this.targetResolution_*t,0,n,i);e&&(this.targetCenter_=this.calculateCenterZoom(s,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=on(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.constraints_.rotation(this.targetRotation_+t,i);e&&(this.targetCenter_=this.calculateCenterRotate(n,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t?on(t,this.getProjection()):t)}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const i=this.getAnimating()||this.getInteracting()||e,n=this.constraints_.rotation(this.targetRotation_,i),s=this.getViewportSize_(n),r=this.constraints_.resolution(this.targetResolution_,0,s,i),o=this.constraints_.center(this.targetCenter_,r,s,i,this.calculateCenterShift(this.targetCenter_,r,n,s));this.get(Mt.ROTATION)!==n&&this.set(Mt.ROTATION,n),this.get(Mt.RESOLUTION)!==r&&(this.set(Mt.RESOLUTION,r),this.set("zoom",this.getZoom(),!0)),o&&this.get(Mt.CENTER)&&Le(this.get(Mt.CENTER),o)||this.set(Mt.CENTER,o),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=void 0!==t?t:200;const n=e||0,s=this.constraints_.rotation(this.targetRotation_),r=this.getViewportSize_(s),o=this.constraints_.resolution(this.targetResolution_,n,r),a=this.constraints_.center(this.targetCenter_,o,r,!1,this.calculateCenterShift(this.targetCenter_,o,s,r));if(0===t&&!this.cancelAnchor_)return this.targetResolution_=o,this.targetRotation_=s,this.targetCenter_=a,void this.applyTargetState_();i=i||(0===t?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,this.getResolution()===o&&this.getRotation()===s&&this.getCenterInternal()&&Le(this.getCenterInternal(),a)||(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:a,resolution:o,duration:t,easing:We,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Rt,1)}endInteraction(t,e,i){i=i&&on(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(Rt,-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)}},ws="ol-hidden",Ss="ol-unselectable",Es="ol-control",Is="ol-collapsed",Ts=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))","?\\s*([-,\\\"\\'\\sa-z0-9]+?)\\s*$"].join(""),"i"),Rs=["style","variant","weight","size","lineHeight","family"],Ms={normal:400,bold:700},Ps=function(t){const e=t.match(Ts);if(!e)return null;const i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let t=0,n=Rs.length;t<n;++t){const n=e[t+1];void 0!==n&&(i[Rs[t]]="string"==typeof n?n.trim():n)}return isNaN(Number(i.weight))&&i.weight in Ms&&(i.weight=Ms[i.weight]),i.families=i.family.split(/,\s?/).map(t=>t.trim().replace(/^['"]|['"]$/g,"")),i};function Fs(t,e,i,n){let s;return s=i&&i.length?i.shift():et?new class extends OffscreenCanvas{style={}}(t??300,e??150):document.createElement("canvas"),t&&(s.width=t),e&&(s.height=e),s.getContext("2d",n)}let bs;function Ls(){return bs||(bs=Fs(1,1)),bs}function As(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function ks(t){let e=t.offsetWidth;const i=getComputedStyle(t);return e+=parseInt(i.marginLeft,10)+parseInt(i.marginRight,10),e}function Ds(t){let e=t.offsetHeight;const i=getComputedStyle(t);return e+=parseInt(i.marginTop,10)+parseInt(i.marginBottom,10),e}function Os(t,e){const i=e.parentNode;i&&i.replaceChild(t,e)}function Gs(t){for(;t.lastChild;)t.lastChild.remove()}function zs(){return new Proxy({childNodes:[],appendChild:function(t){return this.childNodes.push(t),t},remove:function(){},removeChild:function(t){const e=this.childNodes.indexOf(t);if(-1===e)throw new Error("Node to remove was not found");return this.childNodes.splice(e,1),t},insertBefore:function(t,e){const i=this.childNodes.indexOf(e);if(-1===i)throw new Error("Reference node not found");return this.childNodes.splice(i,0,t),t},style:{}},{get:(t,e,i)=>"firstElementChild"===e?t.childNodes.length>0?t.childNodes[0]:null:Reflect.get(t,e,i)})}function Ws(t){return"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas}const Ns=class extends V{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(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&this.element?.remove();for(let t=0,e=this.listenerKeys.length;t<e;++t)G(this.listenerKeys[t]);if(this.listenerKeys.length=0,this.map_=t,t){const e=this.target_??t.getOverlayContainerStopEvent();this.element&&e.appendChild(this.element),this.render!==M&&this.listenerKeys.push(D(t,ht,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_="string"==typeof t?document.getElementById(t):t}};const Xs=class extends Ns{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=void 0===t.collapsed||t.collapsed,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=void 0!==t.collapsible,this.collapsible_=void 0===t.collapsible||t.collapsible,this.collapsible_||(this.collapsed_=!1),this.attributions_=t.attributions;const e=void 0!==t.className?t.className:"ol-attribution",i=void 0!==t.tipLabel?t.tipLabel:"Attributions",n=void 0!==t.expandClassName?t.expandClassName:e+"-expand",s=void 0!==t.collapseLabel?t.collapseLabel:"›",r=void 0!==t.collapseClassName?t.collapseClassName:e+"-collapse";"string"==typeof s?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=s,this.collapseLabel_.className=r):this.collapseLabel_=s;const o=void 0!==t.label?t.label:"i";"string"==typeof o?(this.label_=document.createElement("span"),this.label_.textContent=o,this.label_.className=n):this.label_=o;const a=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(a),this.toggleButton_.addEventListener(d,this.handleClick_.bind(this),!1);const h=e+" "+Ss+" "+Es+(this.collapsed_&&this.collapsible_?" "+Is:"")+(this.collapsible_?"":" ol-uncollapsible"),l=this.element;l.className=h,l.appendChild(this.toggleButton_),l.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=this.getMap().getAllLayers(),i=new Set(e.flatMap(e=>e.getAttributions(t)));if(void 0!==this.attributions_&&(Array.isArray(this.attributions_)?this.attributions_.forEach(t=>i.add(t)):i.add(this.attributions_)),!this.overrideCollapsible_){const t=!e.some(t=>!1===t.getSource()?.getAttributionsCollapsible());this.setCollapsible(t)}return Array.from(i)}async updateElement_(t){if(!t)return void(this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1));const e=await Promise.all(this.collectSourceAttributions_(t).map(t=>F(()=>t))),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!I(e,this.renderedAttributions_)){Gs(this.ulElement_);for(let t=0,i=e.length;t<i;++t){const i=document.createElement("li");i.innerHTML=e[t],this.ulElement_.appendChild(i)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(Is),this.collapsed_?Os(this.collapseLabel_,this.label_):Os(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 Bs=class extends Ns{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target});const e=void 0!==t.className?t.className:"ol-rotate",i=void 0!==t.label?t.label:"⇧",n=void 0!==t.compassClassName?t.compassClassName:"ol-compass";this.label_=null,"string"==typeof i?(this.label_=document.createElement("span"),this.label_.className=n,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(n));const s=t.tipLabel?t.tipLabel:"Reset rotation",r=document.createElement("button");r.className=e+"-reset",r.setAttribute("type","button"),r.title=s,r.appendChild(this.label_),r.addEventListener(d,this.handleClick_.bind(this),!1);const o=e+" "+Ss+" "+Es,a=this.element;a.className=o,a.appendChild(r),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=void 0!==t.duration?t.duration:250,this.autoHide_=void 0===t.autoHide||t.autoHide,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(ws)}handleClick_(t){t.preventDefault(),void 0!==this.callResetNorth_?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const t=this.getMap().getView();if(!t)return;const e=t.getRotation();void 0!==e&&(this.duration_>0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:We}):t.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const t="rotate("+i+"rad)";if(this.autoHide_){const t=this.element.classList.contains(ws);t||0!==i?t&&0!==i&&this.element.classList.remove(ws):this.element.classList.add(ws)}this.label_.style.transform=t}this.rotation_=i}};const Ks=class extends Ns{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=void 0!==t.className?t.className:"ol-zoom",i=void 0!==t.delta?t.delta:1,n=void 0!==t.zoomInClassName?t.zoomInClassName:e+"-in",s=void 0!==t.zoomOutClassName?t.zoomOutClassName:e+"-out",r=void 0!==t.zoomInLabel?t.zoomInLabel:"+",o=void 0!==t.zoomOutLabel?t.zoomOutLabel:"–",a=void 0!==t.zoomInTipLabel?t.zoomInTipLabel:"Zoom in",h=void 0!==t.zoomOutTipLabel?t.zoomOutTipLabel:"Zoom out",l=document.createElement("button");l.className=n,l.setAttribute("type","button"),l.title=a,l.appendChild("string"==typeof r?document.createTextNode(r):r),l.addEventListener(d,this.handleClick_.bind(this,i),!1);const c=document.createElement("button");c.className=s,c.setAttribute("type","button"),c.title=h,c.appendChild("string"==typeof o?document.createTextNode(o):o),c.addEventListener(d,this.handleClick_.bind(this,-i),!1);const u=e+" "+Ss+" "+Es,g=this.element;g.className=u,g.appendChild(l),g.appendChild(c),this.duration_=void 0!==t.duration?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const e=this.getMap().getView();if(!e)return;const i=e.getZoom();if(void 0!==i){const n=e.getConstrainedZoom(i+t);this.duration_>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:n,duration:this.duration_,easing:We})):e.setZoom(n)}}};const Vs=class{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;let i=e-3;for(;i>0&&this.points_[i+2]>t;)i-=3;const n=this.points_[e+2]-this.points_[i+2];if(n<1e3/60)return!1;const s=this.points_[e]-this.points_[i],r=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(r,s),this.initialVelocity_=Math.sqrt(s*s+r*r)/n,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}},js="active";function Ys(t,e,i,n){const s=t.getZoom();if(void 0===s)return;const r=t.getConstrainedZoom(s+e),o=t.getResolutionForZoom(r);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:o,anchor:i,duration:void 0!==n?n:250,easing:We})}const Zs=class extends V{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(js)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(js,t)}setMap(t){this.map_=t}};const Us=class extends Zs{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:250}handleEvent(t){let e=!1;if(t.type==q.DBLCLICK){const i=t.originalEvent,n=t.map,s=t.coordinate,r=i.shiftKey?-this.delta_:this.delta_;Ys(n.getView(),r,s,this.duration_),i.preventDefault(),e=!0}return!e}};function Hs(t){const e=arguments;return function(t){let i=!0;for(let n=0,s=e.length;n<s&&(i=i&&e[n](t),i);++n);return i}}const qs=function(t){const e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},$s=function(t){const e=t.map.getTargetElement(),i=e.getRootNode();return!(i instanceof ShadowRoot?i.host:e).hasAttribute("tabindex")||function(t){const e=t.map.getTargetElement(),i=e.getRootNode(),n=t.map.getOwnerDocument().activeElement;return i instanceof ShadowRoot?i.host.contains(n):e.contains(n)}(t)},Js=T,Qs=function(t){const e=t.originalEvent;return"pointerId"in e&&0==e.button&&!(J&&Q&&e.ctrlKey)},tr=R,er=function(t){return t.type==q.SINGLECLICK},ir=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},nr=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},sr=function(t){const e=t.originalEvent,i=e.target.tagName;return"INPUT"!==i&&"SELECT"!==i&&"TEXTAREA"!==i&&!e.target.isContentEditable},rr=function(t){const e=t.originalEvent;return"pointerId"in e&&"mouse"==e.pointerType},or=function(t){const e=t.originalEvent;return"pointerId"in e&&e.isPrimary&&0===e.button};function ar(t){const e=t.length;let i=0,n=0;for(let s=0;s<e;s++)i+=t[s].clientX,n+=t[s].clientY;return{clientX:i/e,clientY:n/e}}const hr=class extends Zs{constructor(t){super(t=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==q.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==q.POINTERUP){const e=this.handleUpEvent(t);this.handlingDownUpSequence=e&&this.targetPointers.length>0}}else if(t.type==q.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==q.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}};const lr=class extends hr{constructor(t){super({stopDown:R}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:Hs(ir,or);this.condition_=t.onFocusOnly?Hs($s,e):e,this.noKinetic_=!1}handleDragEvent(t){const e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());const i=this.targetPointers,n=e.getEventPixel(ar(i));if(i.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(n[0],n[1]),this.lastCentroid){const e=[this.lastCentroid[0]-n[0],n[1]-this.lastCentroid[1]],i=t.map.getView();ke(e,i.getResolution()),Ae(e,i.getRotation()),i.adjustCenterInternal(e)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=n,this.lastPointersCount_=i.length,t.originalEvent.preventDefault()}handleUpEvent(t){const e=t.map,i=e.getView();if(0===this.targetPointers.length){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const t=this.kinetic_.getDistance(),n=this.kinetic_.getAngle(),s=i.getCenterInternal(),r=e.getPixelFromCoordinateInternal(s),o=e.getCoordinateFromPixelInternal([r[0]-t*Math.cos(n),r[1]-t*Math.sin(n)]);i.animateInternal({center:i.getConstrainedCenter(o),duration:500,easing:We})}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 e=t.map.getView();return this.lastCentroid=null,e.getAnimating()&&e.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}};const cr=class extends hr{constructor(t){t=t||{},super({stopDown:R}),this.condition_=t.condition?t.condition:qs,this.lastAngle_=void 0,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){if(!rr(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===fs)return;const n=e.getSize(),s=t.pixel,r=Math.atan2(n[1]/2-s[1],s[0]-n[0]/2);if(void 0!==this.lastAngle_){const t=r-this.lastAngle_;i.adjustRotationInternal(-t)}this.lastAngle_=r}handleUpEvent(t){if(!rr(t))return!0;return t.map.getView().endInteraction(this.duration_),!1}handleDownEvent(t){if(!rr(t))return!1;if(Qs(t)&&this.condition_(t)){return t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0}return!1}};const ur=class extends x{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,i="px",n=this.element_.style;n.left=Math.min(t[0],e[0])+i,n.top=Math.min(t[1],e[1])+i,n.width=Math.abs(e[0]-t[0])+i,n.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;const t=this.startPixel_,e=this.endPixel_,i=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);i[4]=i[0].slice(),this.geometry_?this.geometry_.setCoordinates([i]):this.geometry_=new ls([i])}getGeometry(){return this.geometry_}},dr="boxstart",gr="boxdrag",_r="boxend",fr="boxcancel";class pr extends A{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}const mr=class extends hr{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new ur(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??Qs,this.boxEndCondition_=t.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const n=i[0]-e[0],s=i[1]-e[1];return n*n+s*s>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new pr(gr,t.coordinate,t)))}handleUpEvent(t){if(!this.startPixel_)return!1;const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new pr(e?_r:fr,t.coordinate,t)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(t){return!!this.condition_(t)&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new pr(dr,t.coordinate,t)),!0)}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new pr(fr,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new pr(fr,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}};const yr=class extends mr{constructor(t){super({condition:(t=t||{}).condition?t.condition:nr,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=void 0!==t.duration?t.duration:200,this.out_=void 0!==t.out&&t.out}onBoxEnd(t){const e=this.getMap().getView();let i=this.getGeometry();if(this.out_){const t=e.rotatedExtentForGeometry(i),n=e.getResolutionForExtentInternal(t),s=e.getResolution()/n;i=i.clone(),i.scale(s*s)}e.fitInternal(i,{duration:this.duration_,easing:We})}},xr="ArrowLeft",vr="ArrowUp",Cr="ArrowRight",wr="ArrowDown";const Sr=class extends Zs{constructor(t){super(),t=t||{},this.defaultCondition_=function(t){return ir(t)&&sr(t)},this.condition_=void 0!==t.condition?t.condition:this.defaultCondition_,this.duration_=void 0!==t.duration?t.duration:100,this.pixelDelta_=void 0!==t.pixelDelta?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==_){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&(n==wr||n==xr||n==Cr||n==vr)){const s=t.map.getView(),r=s.getResolution()*this.pixelDelta_;let o=0,a=0;n==wr?a=-r:n==xr?o=-r:n==Cr?o=r:a=r;const h=[o,a];Ae(h,s.getRotation()),function(t,e,i){const n=t.getCenterInternal();if(n){const s=[n[0]+e[0],n[1]+e[1]];t.animateInternal({duration:void 0!==i?i:250,easing:Xe,center:t.getConstrainedCenter(s)})}}(s,h,this.duration_),i.preventDefault(),e=!0}}return!e}};const Er=class extends Zs{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(t){return!function(t){const e=t.originalEvent;return Q?e.metaKey:e.ctrlKey}(t)&&sr(t)},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:100}handleEvent(t){let e=!1;if(t.type==_||t.type==f){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&("+"===n||"-"===n)){const s=t.map,r="+"===n?this.delta_:-this.delta_;Ys(s.getView(),r,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}};const Ir=class extends Zs{constructor(t){super(t=t||{}),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=void 0!==t.maxDelta?t.maxDelta:1,this.duration_=void 0!==t.duration?t.duration:250,this.timeout_=void 0!==t.timeout?t.timeout:80,this.useAnchor_=void 0===t.useAnchor||t.useAnchor,this.constrainResolution_=void 0!==t.constrainResolution&&t.constrainResolution;const e=t.condition?t.condition:Js;this.condition_=t.onFocusOnly?Hs($s,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();if(!t)return;t.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(t){if(!this.condition_(t))return!0;if(t.type!==y)return!0;const e=t.map,i=t.originalEvent;i.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.pixel);let n=i.deltaY;switch(i.deltaMode){case WheelEvent.DOM_DELTA_LINE:n*=40;break;case WheelEvent.DOM_DELTA_PAGE:n*=300}if(0===n)return!1;this.lastDelta_=n;const s=Date.now();void 0===this.startTime_&&(this.startTime_=s),(!this.mode_||s-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(n)<4?"trackpad":"wheel");const r=e.getView();if("trackpad"===this.mode_&&!r.getConstrainResolution()&&!this.constrainResolution_)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(r.getAnimating()&&r.cancelAnimations(),r.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),r.adjustZoom(-n/this.deltaPerZoom_,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=s,!1;this.totalDelta_+=n;const o=Math.max(this.timeout_-(s-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,e),o),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-Pt(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),Ys(e,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}};const Tr=class extends hr{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=R),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=void 0!==t.threshold?t.threshold:.3,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){let e=0;const i=this.targetPointers[0],n=this.targetPointers[1],s=Math.atan2(n.clientY-i.clientY,n.clientX-i.clientX);if(void 0!==this.lastAngle_){const t=s-this.lastAngle_;this.rotationDelta_+=t,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=t}this.lastAngle_=s;const r=t.map,o=r.getView();o.getConstraints().rotation!==fs&&(this.anchor_=r.getCoordinateFromPixelInternal(r.getEventPixel(ar(this.targetPointers))),this.rotating_&&(r.render(),o.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){if(this.targetPointers.length<2){return t.map.getView().endInteraction(this.duration_),!1}return!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 Rr=class extends hr{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=R),super(e),this.anchor_=null,this.duration_=void 0!==t.duration?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],n=this.targetPointers[1],s=i.clientX-n.clientX,r=i.clientY-n.clientY,o=Math.sqrt(s*s+r*r);void 0!==this.lastDistance_&&(e=this.lastDistance_/o),this.lastDistance_=o;const a=t.map,h=a.getView();1!=e&&(this.lastScaleDelta_=e),this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(ar(this.targetPointers))),a.render(),h.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const e=t.map.getView(),i=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,i),!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 Mr="opacity",Pr="visible",Fr="extent",br="zIndex",Lr="maxResolution",Ar="minResolution",kr="maxZoom",Dr="minZoom",Or="source",Gr="map";const zr=class extends V{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);"object"==typeof t.properties&&(delete e.properties,Object.assign(e,t.properties)),e[Mr]=void 0!==t.opacity?t.opacity:1,wt("number"==typeof e[Mr],"Layer opacity must be a number"),e[Pr]=void 0===t.visible||t.visible,e[br]=t.zIndex,e[Lr]=void 0!==t.maxResolution?t.maxResolution:1/0,e[Ar]=void 0!==t.minResolution?t.minResolution:0,e[Dr]=void 0!==t.minZoom?t.minZoom:-1/0,e[kr]=void 0!==t.maxZoom?t.maxZoom:1/0,this.className_=void 0!==e.className?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:void 0===t||t},i=this.getZIndex();return e.opacity=Pt(Math.round(100*this.getOpacity())/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==i||e.managed?i:1/0,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 N()}getLayerStatesArray(t){return N()}getExtent(){return this.get(Fr)}getMaxResolution(){return this.get(Lr)}getMinResolution(){return this.get(Ar)}getMinZoom(){return this.get(Dr)}getMaxZoom(){return this.get(kr)}getOpacity(){return this.get(Mr)}getSourceState(){return N()}getVisible(){return this.get(Pr)}getZIndex(){return this.get(br)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(Fr,t)}setMaxResolution(t){this.set(Lr,t)}setMinResolution(t){this.set(Ar,t)}setMaxZoom(t){this.set(kr,t)}setMinZoom(t){this.set(Dr,t)}setOpacity(t){wt("number"==typeof t,"Layer opacity must be a number"),this.set(Mr,t)}setVisible(t){this.set(Pr,t)}setZIndex(t){this.set(br,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},Wr="addlayer",Nr="removelayer";class Xr extends A{constructor(t,e){super(t),this.layer=e}}const Br="layers";class Kr extends zr{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(Br,this.handleLayersChanged_),i?Array.isArray(i)?i=new Z(i.slice(),{unique:!0}):wt("function"==typeof i.getArray,"Expected `layers` to be an array or a `Collection`"):i=new Z(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(G),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(D(t,o,this.handleLayersAdd_,this),D(t,a,this.handleLayersRemove_,this));for(const t in this.listenerKeys_)this.listenerKeys_[t].forEach(G);b(this.listenerKeys_);const e=t.getArray();for(let t=0,i=e.length;t<i;t++){const i=e[t];this.registerLayerListeners_(i),this.dispatchEvent(new Xr(Wr,i))}this.changed()}registerLayerListeners_(t){const e=[D(t,h,this.handleLayerChange_,this),D(t,l,this.handleLayerChange_,this)];t instanceof Kr&&e.push(D(t,Wr,this.handleLayerGroupAdd_,this),D(t,Nr,this.handleLayerGroupRemove_,this)),this.listenerKeys_[B(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new Xr(Wr,t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new Xr(Nr,t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new Xr(Wr,e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=B(e);this.listenerKeys_[i].forEach(G),delete this.listenerKeys_[i],this.dispatchEvent(new Xr(Nr,e)),this.changed()}getLayers(){return this.get(Br)}setLayers(t){const e=this.getLayers();if(e){const t=e.getArray();for(let e=0,i=t.length;e<i;++e)this.dispatchEvent(new Xr(Nr,t[e]))}this.set(Br,t)}getLayersArray(t){return t=void 0!==t?t:[],this.getLayers().forEach(function(e){e.getLayersArray(t)}),t}getLayerStatesArray(t){const e=void 0!==t?t:[],i=e.length;this.getLayers().forEach(function(t){t.getLayerStatesArray(e)});const n=this.getLayerState();let s=n.zIndex;t||void 0!==n.zIndex||(s=0);for(let t=i,r=e.length;t<r;t++){const i=e[t];i.opacity*=n.opacity,i.visible=i.visible&&n.visible,i.maxResolution=Math.min(i.maxResolution,n.maxResolution),i.minResolution=Math.max(i.minResolution,n.minResolution),i.minZoom=Math.max(i.minZoom,n.minZoom),i.maxZoom=Math.min(i.maxZoom,n.maxZoom),void 0!==n.extent&&(void 0!==i.extent?i.extent=Ce(i.extent,n.extent):i.extent=n.extent),void 0===i.zIndex&&(i.zIndex=s)}return e}getSourceState(){return"ready"}}const Vr=Kr,jr="prerender",Yr="postrender",Zr="precompose",Ur="postcompose",Hr="rendercomplete";function qr(t,e){if(!t.visible)return!1;const i=e.resolution;if(i<t.minResolution||i>=t.maxResolution)return!1;const n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}const $r=class extends zr{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(Or,this.handleSourcePropertyChange_);const i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return(t=t||[]).push(this),t}getLayerStatesArray(t){return(t=t||[]).push(this.getLayerState()),t}getSource(){return this.get(Or)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),this.sourceReady_||"ready"!==this.getSource().getState()||(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(G(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=D(t,l,this.handleSourceChange_,this),"ready"===t.getState()&&(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?this.renderer_.getData(t):null}isVisible(t){let e;const i=this.getMapInternal();let n;if(!t&&i&&(t=i.getView()),e=t instanceof Cs?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),e.layerStatesArray){if(n=e.layerStatesArray.find(t=>t.layer===this),!n)return!1}else n=this.getLayerState();const s=this.getExtent();return qr(n,e.viewState)&&(!s||Ie(s,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];let i=e(t instanceof Cs?t.getViewStateAndExtent():t);return Array.isArray(i)||(i=[i]),i}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){const e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set(Gr,t)}getMapInternal(){return this.get(Gr)}setMap(t){this.mapPrecomposeKey_&&(G(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(G(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=D(t,Zr,this.handlePrecompose_,this),this.mapRenderKey_=D(this,l,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);wt(!e.some(t=>t.layer===i.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(i)}setSource(t){this.set(Or,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}};function Jr(t,e,i=0,n=t.length-1,s=to){for(;n>i;){if(n-i>600){const r=n-i+1,o=e-i+1,a=Math.log(r),h=.5*Math.exp(2*a/3),l=.5*Math.sqrt(a*h*(r-h)/r)*(o-r/2<0?-1:1);Jr(t,e,Math.max(i,Math.floor(e-o*h/r+l)),Math.min(n,Math.floor(e+(r-o)*h/r+l)),s)}const r=t[e];let o=i,a=n;for(Qr(t,i,e),s(t[n],r)>0&&Qr(t,i,n);o<a;){for(Qr(t,o,a),o++,a--;s(t[o],r)<0;)o++;for(;s(t[a],r)>0;)a--}0===s(t[i],r)?Qr(t,i,a):(a++,Qr(t,a,n)),a<=e&&(i=a+1),e<=a&&(n=a-1)}}function Qr(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function to(t,e){return t<e?-1:t>e?1:0}class eo{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const i=[];if(!_o(t,e))return i;const n=this.toBBox,s=[];for(;e;){for(let r=0;r<e.children.length;r++){const o=e.children[r],a=e.leaf?n(o):o;_o(t,a)&&(e.leaf?i.push(o):go(t,a)?this._all(o,i):s.push(o))}e=s.pop()}return i}collides(t){let e=this.data;if(!_o(t,e))return!1;const i=[];for(;e;){for(let n=0;n<e.children.length;n++){const s=e.children[n],r=e.leaf?this.toBBox(s):s;if(_o(t,r)){if(e.leaf||go(t,r))return!0;i.push(s)}}e=i.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(let e=0;e<t.length;e++)this.insert(t[e]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const t=this.data;this.data=e,e=t}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=fo([]),this}remove(t,e){if(!t)return this;let i=this.data;const n=this.toBBox(t),s=[],r=[];let o,a,h;for(;i||s.length;){if(i||(i=s.pop(),a=s[s.length-1],o=r.pop(),h=!0),i.leaf){const n=io(t,i.children,e);if(-1!==n)return i.children.splice(n,1),s.push(i),this._condense(s),this}h||i.leaf||!go(i,n)?a?(o++,i=a.children[o],h=!1):i=null:(s.push(i),r.push(o),o=0,a=i,i=i.children[0])}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const i=[];for(;t;)t.leaf?e.push(...t.children):i.push(...t.children),t=i.pop();return e}_build(t,e,i,n){const s=i-e+1;let r,o=this._maxEntries;if(s<=o)return r=fo(t.slice(e,i+1)),no(r,this.toBBox),r;n||(n=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,n-1))),r=fo([]),r.leaf=!1,r.height=n;const a=Math.ceil(s/o),h=a*Math.ceil(Math.sqrt(o));po(t,e,i,h,this.compareMinX);for(let s=e;s<=i;s+=h){const e=Math.min(s+h-1,i);po(t,s,e,a,this.compareMinY);for(let i=s;i<=e;i+=a){const s=Math.min(i+a-1,e);r.children.push(this._build(t,i,s,n-1))}}return no(r,this.toBBox),r}_chooseSubtree(t,e,i,n){for(;n.push(e),!e.leaf&&n.length-1!==i;){let i,n=1/0,s=1/0;for(let r=0;r<e.children.length;r++){const o=e.children[r],a=ho(o),h=co(t,o)-a;h<s?(s=h,n=a<n?a:n,i=o):h===s&&a<n&&(n=a,i=o)}e=i||e.children[0]}return e}_insert(t,e,i){const n=i?t:this.toBBox(t),s=[],r=this._chooseSubtree(n,this.data,e,s);for(r.children.push(t),ro(r,n);e>=0&&s[e].children.length>this._maxEntries;)this._split(s,e),e--;this._adjustParentBBoxes(n,s,e)}_split(t,e){const i=t[e],n=i.children.length,s=this._minEntries;this._chooseSplitAxis(i,s,n);const r=this._chooseSplitIndex(i,s,n),o=fo(i.children.splice(r,i.children.length-r));o.height=i.height,o.leaf=i.leaf,no(i,this.toBBox),no(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)}_splitRoot(t,e){this.data=fo([t,e]),this.data.height=t.height+1,this.data.leaf=!1,no(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let n,s=1/0,r=1/0;for(let o=e;o<=i-e;o++){const e=so(t,0,o,this.toBBox),a=so(t,o,i,this.toBBox),h=uo(e,a),l=ho(e)+ho(a);h<s?(s=h,n=o,r=l<r?l:r):h===s&&l<r&&(r=l,n=o)}return n||i-e}_chooseSplitAxis(t,e,i){const n=t.leaf?this.compareMinX:oo,s=t.leaf?this.compareMinY:ao;this._allDistMargin(t,e,i,n)<this._allDistMargin(t,e,i,s)&&t.children.sort(n)}_allDistMargin(t,e,i,n){t.children.sort(n);const s=this.toBBox,r=so(t,0,e,s),o=so(t,i-e,i,s);let a=lo(r)+lo(o);for(let n=e;n<i-e;n++){const e=t.children[n];ro(r,t.leaf?s(e):e),a+=lo(r)}for(let n=i-e-1;n>=e;n--){const e=t.children[n];ro(o,t.leaf?s(e):e),a+=lo(o)}return a}_adjustParentBBoxes(t,e,i){for(let n=i;n>=0;n--)ro(e[n],t)}_condense(t){for(let e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children,e.splice(e.indexOf(t[i]),1)):this.clear():no(t[i],this.toBBox)}}function io(t,e,i){if(!i)return e.indexOf(t);for(let n=0;n<e.length;n++)if(i(t,e[n]))return n;return-1}function no(t,e){so(t,0,t.children.length,e,t)}function so(t,e,i,n,s){s||(s=fo(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let r=e;r<i;r++){const e=t.children[r];ro(s,t.leaf?n(e):e)}return s}function ro(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function oo(t,e){return t.minX-e.minX}function ao(t,e){return t.minY-e.minY}function ho(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function lo(t){return t.maxX-t.minX+(t.maxY-t.minY)}function co(t,e){return(Math.max(e.maxX,t.maxX)-Math.min(e.minX,t.minX))*(Math.max(e.maxY,t.maxY)-Math.min(e.minY,t.minY))}function uo(t,e){const i=Math.max(t.minX,e.minX),n=Math.max(t.minY,e.minY),s=Math.min(t.maxX,e.maxX),r=Math.min(t.maxY,e.maxY);return Math.max(0,s-i)*Math.max(0,r-n)}function go(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function _o(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function fo(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function po(t,e,i,n,s){const r=[e,i];for(;r.length;){if((i=r.pop())-(e=r.pop())<=n)continue;const o=e+Math.ceil((i-e)/n/2)*n;Jr(t,o,e,i,s),r.push(e,o,o,i)}}const mo=[NaN,NaN,NaN,0];let yo;const xo=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,vo=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Co=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,wo=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function So(t,e){return t.endsWith("%")?Number(t.substring(0,t.length-1))/e:Number(t)}function Eo(t){throw new Error('failed to parse "'+t+'" as color')}function Io(t){if(t.toLowerCase().startsWith("rgb")){const e=t.match(vo)||t.match(xo)||t.match(Co);if(e){const t=e[4],i=100/255;return[Pt(So(e[1],i)+.5|0,0,255),Pt(So(e[2],i)+.5|0,0,255),Pt(So(e[3],i)+.5|0,0,255),void 0!==t?Pt(So(t,100),0,1):1]}Eo(t)}if(t.startsWith("#")){if(wo.test(t)){const e=t.substring(1),i=e.length<=4?1:2,n=[0,0,0,255];for(let t=0,s=e.length;t<s;t+=i){let s=parseInt(e.substring(t,t+i),16);1===i&&(s+=s<<4),n[t/i]=s}return n[3]=n[3]/255,n}Eo(t)}const e=(yo||(yo=Fs(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),yo);e.fillStyle="#abcdef";let i=e.fillStyle;e.fillStyle=t,e.fillStyle===i&&(e.fillStyle="#fedcba",i=e.fillStyle,e.fillStyle=t,e.fillStyle===i&&Eo(t));const n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return Io(n);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);const s=Array.from(e.getImageData(0,0,1,1).data);return s[3]=Ot(s[3]/255,3),s}const To={};let Ro=0;function Mo(t){if(4===t.length)return t;const e=t.slice();return e[3]=1,e}function Po(t){return t>.0031308?269.025*Math.pow(t,1/2.4)-14.025:3294.6*t}function Fo(t){return t>.2068965?Math.pow(t,3):108/841*(t-4/29)}function bo(t){return t>10.314724?Math.pow((t+14.025)/269.025,2.4):t/3294.6}function Lo(t){return t>.0088564?Math.pow(t,1/3):t/(108/841)+4/29}function Ao(t){const e=bo(t[0]),i=bo(t[1]),n=bo(t[2]),s=Lo(.222488403*e+.716873169*i+.06060791*n),r=500*(Lo(.452247074*e+.399439023*i+.148375274*n)-s),o=200*(s-Lo(.016863605*e+.117638439*i+.865350722*n)),a=Math.atan2(o,r)*(180/Math.PI);return[116*s-16,Math.sqrt(r*r+o*o),a<0?a+360:a,t[3]]}function ko(t){if("none"===t)return mo;if(To.hasOwnProperty(t))return To[t];if(Ro>=1024){let t=0;for(const e in To)3&t++||(delete To[e],--Ro)}const e=Io(t);4!==e.length&&Eo(t);for(const i of e)isNaN(i)&&Eo(t);return To[t]=e,++Ro,e}function Do(t){return Array.isArray(t)?t:ko(t)}function Oo(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let i=t[1];i!=(0|i)&&(i=i+.5|0);let n=t[2];n!=(0|n)&&(n=n+.5|0);return"rgba("+e+","+i+","+n+","+(void 0===t[3]?1:Math.round(1e3*t[3])/1e3)+")"}function Go(t){return t[0]>0&&t[1]>0}function zo(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}let Wo=0;const No=1<<Wo++,Xo=1<<Wo++,Bo=1<<Wo++,Ko=1<<Wo++,Vo=1<<Wo++,jo=1<<Wo++,Yo=Math.pow(2,6)-1,Zo={[No]:"boolean",[Xo]:"number",[Bo]:"string",[Ko]:"color",[Vo]:"number[]",[jo]:"size"},Uo=Object.keys(Zo).map(Number).sort(v);function Ho(t){const e=[];for(const i of Uo)qo(t,i)&&e.push(Zo[i]);return 0===e.length?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function qo(t,e){return(t&e)===e}function $o(t,e){return t===e}class Jo{constructor(t,e){if(!function(t){return t in Zo}(t))throw new Error(`literal expressions must have a specific type, got ${Ho(t)}`);this.type=t,this.value=e}}class Qo{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function ta(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1,mapState:!1}}function ea(t,e,i){switch(typeof t){case"boolean":if($o(e,Bo))return new Jo(Bo,t?"true":"false");if(!qo(e,No))throw new Error(`got a boolean, but expected ${Ho(e)}`);return new Jo(No,t);case"number":if($o(e,jo))return new Jo(jo,zo(t));if($o(e,No))return new Jo(No,!!t);if($o(e,Bo))return new Jo(Bo,t.toString());if(!qo(e,Xo))throw new Error(`got a number, but expected ${Ho(e)}`);return new Jo(Xo,t);case"string":if($o(e,Ko))return new Jo(Ko,ko(t));if($o(e,No))return new Jo(No,!!t);if(!qo(e,Bo))throw new Error(`got a string, but expected ${Ho(e)}`);return new Jo(Bo,t)}if(!Array.isArray(t))throw new Error("expression must be an array or a primitive value");if(0===t.length)throw new Error("empty expression");if("string"==typeof t[0])return function(t,e,i){const n=t[0],s=Ha[n];if(!s)throw new Error(`unknown operator: ${n}`);return s(t,e,i)}(t,e,i);for(const e of t)if("number"!=typeof e)throw new Error("expected an array of numbers");if($o(e,jo)){if(2!==t.length)throw new Error(`expected an array of two values for a size, got ${t.length}`);return new Jo(jo,t)}if($o(e,Ko)){if(3===t.length)return new Jo(Ko,[...t,1]);if(4===t.length)return new Jo(Ko,t);throw new Error(`expected an array of 3 or 4 values for a color, got ${t.length}`)}if(!qo(e,Vo))throw new Error(`got an array of numbers, but expected ${Ho(e)}`);return new Jo(Vo,t)}const ia="get",na="var",sa="concat",ra="geometry-type",oa="line-metric",aa="any",ha="all",la="!",ca="resolution",ua="zoom",da="time",ga="==",_a="!=",fa=">",pa=">=",ma="<",ya="<=",xa="*",va="/",Ca="+",wa="-",Sa="clamp",Ea="%",Ia="^",Ta="abs",Ra="floor",Ma="ceil",Pa="round",Fa="sin",ba="cos",La="atan",Aa="sqrt",ka="match",Da="between",Oa="interpolate",Ga="coalesce",za="case",Wa="in",Na="number",Xa="string",Ba="array",Ka="color",Va="id",ja="band",Ya="palette",Za="to-string",Ua="has",Ha={[ia]:nh(Qa(1,1/0),qa),[na]:nh(Qa(1,1),function(t,e,i){const n=t[1];if("string"!=typeof n)throw new Error("expected a string argument for var operation");return i.variables.add(n),[new Jo(Bo,n)]}),[Ua]:nh(Qa(1,1/0),qa),[Va]:nh(function(t,e,i){i.featureId=!0},Ja),[sa]:nh(Qa(2,1/0),eh(Bo)),[ra]:nh(function(t,e,i){i.geometryType=!0},Ja),[oa]:nh(Ja),[ca]:nh($a,Ja),[ua]:nh($a,Ja),[da]:nh($a,Ja),[aa]:nh(Qa(2,1/0),eh(No)),[ha]:nh(Qa(2,1/0),eh(No)),[la]:nh(Qa(1,1),eh(No)),[ga]:nh(Qa(2,2),eh(Yo)),[_a]:nh(Qa(2,2),eh(Yo)),[fa]:nh(Qa(2,2),eh(Xo)),[pa]:nh(Qa(2,2),eh(Xo)),[ma]:nh(Qa(2,2),eh(Xo)),[ya]:nh(Qa(2,2),eh(Xo)),[xa]:nh(Qa(2,1/0),th),[Ga]:nh(Qa(2,1/0),th),[va]:nh(Qa(2,2),eh(Xo)),[Ca]:nh(Qa(2,1/0),eh(Xo)),[wa]:nh(Qa(2,2),eh(Xo)),[Sa]:nh(Qa(3,3),eh(Xo)),[Ea]:nh(Qa(2,2),eh(Xo)),[Ia]:nh(Qa(2,2),eh(Xo)),[Ta]:nh(Qa(1,1),eh(Xo)),[Ra]:nh(Qa(1,1),eh(Xo)),[Ma]:nh(Qa(1,1),eh(Xo)),[Pa]:nh(Qa(1,1),eh(Xo)),[Fa]:nh(Qa(1,1),eh(Xo)),[ba]:nh(Qa(1,1),eh(Xo)),[La]:nh(Qa(1,2),eh(Xo)),[Aa]:nh(Qa(1,1),eh(Xo)),[ka]:nh(Qa(4,1/0),ih,function(t,e,i){const n=t.length-1,s=Bo|Xo|No,r=ea(t[1],s,i),o=ea(t[t.length-1],e,i),a=new Array(n-2);for(let e=0;e<n-2;e+=2){try{const n=ea(t[e+2],r.type,i);a[e]=n}catch(t){throw new Error(`failed to parse argument ${e+1} of match expression: ${t.message}`)}try{const n=ea(t[e+3],o.type,i);a[e+1]=n}catch(t){throw new Error(`failed to parse argument ${e+2} of match expression: ${t.message}`)}}return[r,...a,o]}),[Da]:nh(Qa(3,3),eh(Xo)),[Oa]:nh(Qa(6,1/0),ih,function(t,e,i){const n=t[1];let s;switch(n[0]){case"linear":s=1;break;case"exponential":const t=n[1];if("number"!=typeof t||t<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(t)} instead`);s=t;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(n)}`)}const r=new Jo(Xo,s);let o;try{o=ea(t[2],Xo,i)}catch(t){throw new Error(`failed to parse argument 1 in interpolate expression: ${t.message}`)}const a=new Array(t.length-3);for(let n=0;n<a.length;n+=2){try{const e=ea(t[n+3],Xo,i);a[n]=e}catch(t){throw new Error(`failed to parse argument ${n+2} for interpolate expression: ${t.message}`)}try{const s=ea(t[n+4],e,i);a[n+1]=s}catch(t){throw new Error(`failed to parse argument ${n+3} for interpolate expression: ${t.message}`)}}return[r,o,...a]}),[za]:nh(Qa(3,1/0),function(t,e,i){const n=t[0],s=t.length-1;if(s%2==0)throw new Error(`expected an odd number of arguments for ${n}, got ${s} instead`)},function(t,e,i){const n=ea(t[t.length-1],e,i),s=new Array(t.length-1);for(let e=0;e<s.length-1;e+=2){try{const n=ea(t[e+1],No,i);s[e]=n}catch(t){throw new Error(`failed to parse argument ${e} of case expression: ${t.message}`)}try{const r=ea(t[e+2],n.type,i);s[e+1]=r}catch(t){throw new Error(`failed to parse argument ${e+1} of case expression: ${t.message}`)}}return s[s.length-1]=n,s}),[Wa]:nh(Qa(2,2),function(t,e,i){let n,s=t[2];if(!Array.isArray(s))throw new Error('the second argument for the "in" operator must be an array');if("string"==typeof s[0]){if("literal"!==s[0])throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');if(!Array.isArray(s[1]))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array');s=s[1],n=Bo}else n=Xo;const r=new Array(s.length);for(let t=0;t<r.length;t++)try{const e=ea(s[t],n,i);r[t]=e}catch(e){throw new Error(`failed to parse haystack item ${t} for "in" expression: ${e.message}`)}return[ea(t[1],n,i),...r]}),[Na]:nh(Qa(1,1/0),eh(Yo)),[Xa]:nh(Qa(1,1/0),eh(Yo)),[Ba]:nh(Qa(1,1/0),eh(Xo)),[Ka]:nh(Qa(1,4),eh(Xo)),[ja]:nh(Qa(1,3),eh(Xo)),[Ya]:nh(Qa(2,2),function(t,e,i){let n;try{n=ea(t[1],Xo,i)}catch(t){throw new Error(`failed to parse first argument in palette expression: ${t.message}`)}const s=t[2];if(!Array.isArray(s))throw new Error("the second argument of palette must be an array");const r=new Array(s.length);for(let t=0;t<r.length;t++){let e;try{e=ea(s[t],Ko,i)}catch(e){throw new Error(`failed to parse color at index ${t} in palette expression: ${e.message}`)}if(!(e instanceof Jo))throw new Error(`the palette color at index ${t} must be a literal value`);r[t]=e}return[n,...r]}),[Za]:nh(Qa(1,1),eh(No|Xo|Bo|Ko))};function qa(t,e,i){const n=t.length-1,s=new Array(n);for(let e=0;e<n;++e){const n=t[e+1];switch(typeof n){case"number":s[e]=new Jo(Xo,n);break;case"string":s[e]=new Jo(Bo,n);break;default:throw new Error(`expected a string key or numeric array index for a get operation, got ${n}`)}0===e&&i.properties.add(String(n))}return s}function $a(t,e,i){i.mapState=!0}function Ja(t,e,i){const n=t[0];if(1!==t.length)throw new Error(`expected no arguments for ${n} operation`);return[]}function Qa(t,e){return function(i,n,s){const r=i[0],o=i.length-1;if(t===e){if(o!==t){throw new Error(`expected ${t} argument${1===t?"":"s"} for ${r}, got ${o}`)}}else if(o<t||o>e){throw new Error(`expected ${e===1/0?`${t} or more`:`${t} to ${e}`} arguments for ${r}, got ${o}`)}}}function th(t,e,i){const n=t.length-1,s=new Array(n);for(let r=0;r<n;++r){const n=ea(t[r+1],e,i);s[r]=n}return s}function eh(t){return function(e,i,n){const s=e.length-1,r=new Array(s);for(let i=0;i<s;++i){const s=ea(e[i+1],t,n);r[i]=s}return r}}function ih(t,e,i){const n=t[0],s=t.length-1;if(s%2==1)throw new Error(`expected an even number of arguments for operation ${n}, got ${s} instead`)}function nh(...t){return function(e,i,n){const s=e[0];let r;for(let s=0;s<t.length;s++){const o=t[s](e,i,n);if(s==t.length-1){if(!o)throw new Error("expected last argument validator to return the parsed args");r=o}}return new Qo(i,s,...r)}}function sh(t){if(!t)return"";const e=t.getType();switch(e){case"Point":case"LineString":case"Polygon":return e;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return e.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return sh(t.getGeometries()[0]);default:return""}}function rh(t,e,i){return oh(ea(t,e,i),i)}function oh(t,e){if(t instanceof Jo){if(t.type===Ko&&"string"==typeof t.value){const e=ko(t.value);return function(){return e}}return function(){return t.value}}const i=t.operator;switch(i){case Na:case Xa:case Ga:return function(t,e){const i=t.operator,n=t.args.length,s=new Array(n);for(let i=0;i<n;++i)s[i]=oh(t.args[i],e);switch(i){case Ga:return t=>{for(let e=0;e<n;++e){const i=s[e](t);if(null!=i)return i}throw new Error("Expected one of the values to be non-null")};case Na:case Xa:return t=>{for(let e=0;e<n;++e){const n=s[e](t);if(typeof n===i)return n}throw new Error(`Expected one of the values to be a ${i}`)};default:throw new Error(`Unsupported assertion operator ${i}`)}}(t,e);case ia:case na:case Ua:return function(t){const e=t.args[0],i=e.value;switch(t.operator){case ia:return e=>{const n=t.args;let s=e.properties[i];for(let t=1,e=n.length;t<e;++t){s=s[n[t].value]}return s};case na:return t=>t.variables[i];case Ua:return e=>{const n=t.args;if(!(i in e.properties))return!1;let s=e.properties[i];for(let t=1,e=n.length;t<e;++t){const e=n[t].value;if(!s||!Object.hasOwn(s,e))return!1;s=s[e]}return!0};default:throw new Error(`Unsupported accessor operator ${t.operator}`)}}(t);case Va:return t=>t.featureId;case ra:return t=>t.geometryType;case sa:{const i=t.args.map(t=>oh(t,e));return t=>"".concat(...i.map(e=>e(t).toString()))}case ca:return t=>t.resolution;case aa:case ha:case Da:case Wa:case la:return function(t,e){const i=t.operator,n=t.args.length,s=new Array(n);for(let i=0;i<n;++i)s[i]=oh(t.args[i],e);switch(i){case aa:return t=>{for(let e=0;e<n;++e)if(s[e](t))return!0;return!1};case ha:return t=>{for(let e=0;e<n;++e)if(!s[e](t))return!1;return!0};case Da:return t=>{const e=s[0](t),i=s[1](t),n=s[2](t);return e>=i&&e<=n};case Wa:return t=>{const e=s[0](t);for(let i=1;i<n;++i)if(e===s[i](t))return!0;return!1};case la:return t=>!s[0](t);default:throw new Error(`Unsupported logical operator ${i}`)}}(t,e);case ga:case _a:case ma:case ya:case fa:case pa:return function(t,e){const i=t.operator,n=oh(t.args[0],e),s=oh(t.args[1],e);switch(i){case ga:return t=>n(t)===s(t);case _a:return t=>n(t)!==s(t);case ma:return t=>n(t)<s(t);case ya:return t=>n(t)<=s(t);case fa:return t=>n(t)>s(t);case pa:return t=>n(t)>=s(t);default:throw new Error(`Unsupported comparison operator ${i}`)}}(t,e);case xa:case va:case Ca:case wa:case Sa:case Ea:case Ia:case Ta:case Ra:case Ma:case Pa:case Fa:case ba:case La:case Aa:return function(t,e){const i=t.operator,n=t.args.length,s=new Array(n);for(let i=0;i<n;++i)s[i]=oh(t.args[i],e);switch(i){case xa:return t=>{let e=1;for(let i=0;i<n;++i)e*=s[i](t);return e};case va:return t=>s[0](t)/s[1](t);case Ca:return t=>{let e=0;for(let i=0;i<n;++i)e+=s[i](t);return e};case wa:return t=>s[0](t)-s[1](t);case Sa:return t=>{const e=s[0](t),i=s[1](t);if(e<i)return i;const n=s[2](t);return e>n?n:e};case Ea:return t=>s[0](t)%s[1](t);case Ia:return t=>Math.pow(s[0](t),s[1](t));case Ta:return t=>Math.abs(s[0](t));case Ra:return t=>Math.floor(s[0](t));case Ma:return t=>Math.ceil(s[0](t));case Pa:return t=>Math.round(s[0](t));case Fa:return t=>Math.sin(s[0](t));case ba:return t=>Math.cos(s[0](t));case La:return 2===n?t=>Math.atan2(s[0](t),s[1](t)):t=>Math.atan(s[0](t));case Aa:return t=>Math.sqrt(s[0](t));default:throw new Error(`Unsupported numeric operator ${i}`)}}(t,e);case za:return function(t,e){const i=t.args.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=oh(t.args[s],e);return t=>{for(let e=0;e<i-1;e+=2){if(n[e](t))return n[e+1](t)}return n[i-1](t)}}(t,e);case ka:return function(t,e){const i=t.args.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=oh(t.args[s],e);return t=>{const e=n[0](t);for(let s=1;s<i-1;s+=2)if(e===n[s](t))return n[s+1](t);return n[i-1](t)}}(t,e);case Oa:return function(t,e){const i=t.args.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=oh(t.args[s],e);return t=>{const e=n[0](t),s=n[1](t);let r,o;for(let a=2;a<i;a+=2){const i=n[a](t);let h=n[a+1](t);const l=Array.isArray(h);if(l&&(h=Mo(h)),i>=s)return 2===a?h:l?hh(e,s,r,o,i,h):ah(e,s,r,o,i,h);r=i,o=h}return o}}(t,e);case Za:return function(t,e){const i=t.operator,n=t.args.length,s=new Array(n);for(let i=0;i<n;++i)s[i]=oh(t.args[i],e);if(i===Za)return e=>{const i=s[0](e);return t.args[0].type===Ko?Oo(i):i.toString()};throw new Error(`Unsupported convert operator ${i}`)}(t,e);default:throw new Error(`Unsupported operator ${i}`)}}function ah(t,e,i,n,s,r){const o=s-i;if(0===o)return n;const a=e-i;return n+(1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1))*(r-n)}function hh(t,e,i,n,s,r){if(0===s-i)return n;const o=Ao(n),a=Ao(r);let h=a[2]-o[2];h>180?h-=360:h<-180&&(h+=360);return function(t){const e=(t[0]+16)/116,i=t[1],n=t[2]*Math.PI/180,s=Fo(e),r=Fo(e+i/500*Math.cos(n)),o=Fo(e-i/200*Math.sin(n)),a=Po(3.021973625*r-1.617392459*s-.404875592*o),h=Po(-.943766287*r+1.916279586*s+.027607165*o),l=Po(.069407491*r-.22898585*s+1.159737864*o);return[Pt(a+.5|0,0,255),Pt(h+.5|0,0,255),Pt(l+.5|0,0,255),t[3]]}([ah(t,e,i,o[0],s,a[0]),ah(t,e,i,o[1],s,a[1]),o[2]+ah(t,e,i,0,s,h),ah(t,e,i,n[3],s,r[3])])}const lh=0,ch=1,uh=2,dh=3,gh=4;function _h(t,e){return e&&(t.src=e),t.src&&it?new Promise((e,i)=>t.decode().then(()=>e(t)).catch(n=>t.complete&&t.width?e(t):i(n))):function(t,e){return new Promise((i,n)=>{function s(){o(),i(t)}function r(){o(),n(new Error("Image load error"))}function o(){t.removeEventListener("load",s),t.removeEventListener("error",r)}t.addEventListener("load",s),t.addEventListener("error",r),e&&(t.src=e)})}(t)}const fh=class extends k{constructor(t,e,i,n){super(),this.extent=t,this.pixelRatio_=i,this.resolution=e,this.state="function"==typeof n?lh:n,this.image_=null,this.loader="function"==typeof n?n:null}changed(){this.dispatchEvent(l)}getExtent(){return this.extent}getImage(){return this.image_}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){if(this.state==lh&&this.loader){this.state=ch,this.changed();const t=this.getResolution(),e=Array.isArray(t)?t[0]:t;F(()=>this.loader(this.getExtent(),e,this.getPixelRatio())).then(t=>{"image"in t&&(this.image_=t.image),"extent"in t&&(this.extent=t.extent),"resolution"in t&&(this.resolution=t.resolution),"pixelRatio"in t&&(this.pixelRatio_=t.pixelRatio),(t instanceof HTMLImageElement||nt&&t instanceof ImageBitmap||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement)&&(this.image_=t),this.state=uh}).catch(t=>{this.state=dh,console.error(t)}).finally(()=>this.changed())}}setImage(t){this.image_=t}setResolution(t){this.resolution=t}};class ph{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];3&t++||i.hasListener()||(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e,i){const n=mh(t,e,i);return n in this.cache_?this.cache_[n]:null}getPattern(t,e,i){const n=mh(t,e,i);return n in this.patternCache_?this.patternCache_[n]:null}set(t,e,i,n,s){const r=mh(t,e,i),o=r in this.cache_;this.cache_[r]=n,s&&(n.getImageState()===lh&&n.load(),n.getImageState()===ch?n.ready().then(()=>{this.patternCache_[r]=Ls().createPattern(n.getImage(1),"repeat")}):this.patternCache_[r]=Ls().createPattern(n.getImage(1),"repeat")),o||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function mh(t,e,i){return e+":"+t+":"+(i?Do(i):"null")}const yh=new ph;let xh=null;class vh extends k{constructor(t,e,i,n,s){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i,this.canvas_={},this.color_=s,this.imageState_=void 0===n?lh:n,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(void 0===this.tainted_&&this.imageState_===uh){xh||(xh=Fs(1,1,void 0,{willReadFrequently:!0})),xh.drawImage(this.image_,0,0);try{xh.getImageData(0,0,1,1),this.tainted_=!1}catch{xh=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(l)}handleImageError_(){this.imageState_=dh,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=uh,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=Fs(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_===lh){this.image_||this.initializeImage_(),this.imageState_=ch;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&_h(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_!==uh)return;const e=this.image_,i=Fs(Math.ceil(e.width*t),Math.ceil(e.height*t)),n=i.canvas;var s;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle="string"==typeof(s=this.color_)?s:Oo(s),i.fillRect(0,0,n.width/t,n.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=n}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(this.imageState_===uh||this.imageState_===dh)t();else{const e=()=>{this.imageState_!==uh&&this.imageState_!==dh||(this.removeEventListener(l,e),t())};this.addEventListener(l,e)}})),this.ready_}}function Ch(t,e,i,n,s,r){let o=void 0===e?void 0:yh.get(e,i,s);return o||(o=new vh(t,t&&"src"in t?t.src||void 0:e,i,n,s),yh.set(e,i,s,o,r)),r&&o&&!yh.getPattern(e,i,s)&&yh.set(e,i,s,o,r),o}const wh=vh;function Sh(t){return t?Array.isArray(t)?Oo(t):"object"==typeof t&&"src"in t?function(t){if(!t.offset||!t.size)return yh.getPattern(t.src,"anonymous",t.color);const e=t.src+":"+t.offset,i=yh.getPattern(e,void 0,t.color);if(i)return i;const n=yh.get(t.src,"anonymous",null);if(n.getImageState()!==uh)return null;const s=Fs(t.size[0],t.size[1]);return s.drawImage(n.getImage(1),t.offset[0],t.offset[1],t.size[0],t.size[1],0,0,t.size[0],t.size[1]),Ch(s.canvas,e,void 0,uh,t.color,!0),yh.getPattern(e,void 0,t.color)}(t):t:null}const Eh="10px sans-serif",Ih="#000",Th="round",Rh=[],Mh="round",Ph="#000",Fh="center",bh="middle",Lh=[0,0,0,0],Ah=new V;let kh,Dh=null;const Oh={},Gh=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function zh(t,e,i){return`${t} ${e} 16px "${i}"`}const Wh=function(){const t=100;let e,i;async function n(t){await i.ready;const e=await i.load(t);if(0===e.length)return!1;const n=Ps(t),s=n.families[0].toLowerCase(),r=n.weight;return e.some(t=>{const e=t.family.replace(/^['"]|['"]$/g,"").toLowerCase(),i=Ms[t.weight]||t.weight;return e===s&&t.style===n.style&&i==r})}async function s(){await i.ready;let r=!0;const o=Ah.getProperties(),a=Object.keys(o).filter(e=>o[e]<t);for(let e=a.length-1;e>=0;--e){const i=a[e];let s=o[i];s<t&&(await n(i)?(b(Oh),Ah.set(i,t)):(s+=10,Ah.set(i,s,!0),s<t&&(r=!1)))}e=void 0,r||(e=setTimeout(s,100))}return async function(t){i||(i=et?self.fonts:document.fonts);const n=Ps(t);if(!n)return;const r=n.families;let o=!1;for(const t of r){if(Gh.has(t))continue;const e=zh(n.style,n.weight,t);void 0===Ah.get(e)&&(Ah.set(e,0,!0),o=!0)}o&&(clearTimeout(e),e=setTimeout(s,100))}}(),Nh=function(){let t;return function(e){let i=Oh[e];if(null==i){if(et){const t=Ps(e),n=Xh(e,"Žg");i=(isNaN(Number(t.lineHeight))?1.2:Number(t.lineHeight))*(n.actualBoundingBoxAscent+n.actualBoundingBoxDescent)}else t||(t=document.createElement("div"),t.innerHTML="M",t.style.minHeight="0",t.style.maxHeight="none",t.style.height="auto",t.style.padding="0",t.style.border="none",t.style.position="absolute",t.style.display="block",t.style.left="-99999px"),t.style.font=e,document.body.appendChild(t),i=t.offsetHeight,document.body.removeChild(t);Oh[e]=i}return i}}();function Xh(t,e){return Dh||(Dh=Fs(1,1)),t!=kh&&(Dh.font=t,kh=Dh.font),Dh.measureText(e)}function Bh(t,e){return Xh(t,e).width}function Kh(t,e,i){if(e in i)return i[e];const n=e.split("\n").reduce((e,i)=>Math.max(e,Bh(t,i)),0);return i[e]=n,n}function Vh(t,e,i,n,s,r,o,a,h,l,c){t.save(),1!==i&&(void 0===t.globalAlpha?t.globalAlpha=t=>t.globalAlpha*=i:t.globalAlpha*=i),e&&t.transform.apply(t,e),n.contextInstructions?(t.translate(h,l),t.scale(c[0],c[1]),function(t,e){const i=t.contextInstructions;for(let t=0,n=i.length;t<n;t+=2)Array.isArray(i[t+1])?e[i[t]].apply(e,i[t+1]):e[i[t]]=i[t+1]}(n,t)):c[0]<0||c[1]<0?(t.translate(h,l),t.scale(c[0],c[1]),t.drawImage(n,s,r,o,a,0,0,o,a)):t.drawImage(n,s,r,o,a,h,l,o*c[0],a*c[1]),t.restore()}class jh{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=zo(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new jh({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 N()}getImage(t){return N()}getHitDetectionImage(){return N()}getPixelRatio(t){return 1}getImageState(){return N()}getImageSize(){return N()}getOrigin(){return N()}getSize(){return N()}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_=zo(t)}listenImageChange(t){N()}load(){N()}unlistenImageChange(t){N()}ready(){return Promise.resolve()}}const Yh=jh;class Zh extends Yh{constructor(t){super({opacity:1,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,rotation:void 0!==t.rotation?t.rotation:0,scale:void 0!==t.scale?t.scale:1,displacement:void 0!==t.displacement?t.displacement:[0,0],declutterMode:t.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=void 0!==t.fill?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius=t.radius,this.radius2_=t.radius2,this.angle_=void 0!==t.angle?t.angle:0,this.stroke_=void 0!==t.stroke?t.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?ch:uh,this.imageState_===ch&&this.ready().then(()=>this.imageState_=uh),this.render()}clone(){const t=this.getScale(),e=new Zh({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){const e=this.fill_?.getKey(),i=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let n=yh.get(i,null,null)?.getImage(1);if(!n){const e=this.renderOptions_,s=Math.ceil(e.size*t),r=Fs(s,s);this.draw_(e,r,t),n=r.canvas,yh.set(i,null,null,new wh(n,void 0,null,uh,null))}return n}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(0===e||this.points_===1/0||"bevel"!==t&&"miter"!==t)return e;let n=this.radius,s=void 0===this.radius2_?n:this.radius2_;if(n<s){const t=n;n=s,s=t}const r=void 0===this.radius2_?this.points_:2*this.points_,o=2*Math.PI/r,a=s*Math.sin(o),h=n-Math.sqrt(s*s-a*a),l=Math.sqrt(a*a+h*h),c=l/a;if("miter"===t&&c<=i)return c*e;const u=e/2/c,d=e/2*(h/l),g=Math.sqrt((n+u)*(n+u)+d*d)-n;if(void 0===this.radius2_||"bevel"===t)return 2*g;const _=n*Math.sin(o),f=s-Math.sqrt(n*n-_*_),p=Math.sqrt(_*_+f*f)/_;if(p<=i){const t=p*e/2-s-n;return 2*Math.max(g,t)}return 2*g}createRenderOptions(){let t,e=Th,i=Mh,n=0,s=null,r=0,o=0;this.stroke_&&(t=Sh(this.stroke_.getColor()??Ph),o=this.stroke_.getWidth()??1,s=this.stroke_.getLineDash(),r=this.stroke_.getLineDashOffset()??0,i=this.stroke_.getLineJoin()??Mh,e=this.stroke_.getLineCap()??Th,n=this.stroke_.getMiterLimit()??10);const a=this.calculateLineJoinSize_(i,o,n),h=Math.max(this.radius,this.radius2_||0);return{strokeStyle:t,strokeWidth:o,size:Math.ceil(2*h+a),lineCap:e,lineDash:s,lineDashOffset:r,lineJoin:i,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let t=this.fill_.getColor();null===t&&(t=Ih),e.fillStyle=Sh(t),e.fill()}t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){let e;if(this.fill_){let i=this.fill_.getColor(),n=0;"string"==typeof i&&(i=Do(i)),null===i?n=1:Array.isArray(i)&&(n=4===i.length?i[3]:1),0===n&&(e=Fs(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_;const i=this.radius;if(e===1/0)t.arc(0,0,i,0,2*Math.PI);else{const n=void 0===this.radius2_?i:this.radius2_;void 0!==this.radius2_&&(e*=2);const s=this.angle_-Math.PI/2,r=2*Math.PI/e;for(let o=0;o<e;o++){const e=s+o*r,a=o%2==0?i:n;t.lineTo(a*Math.cos(e),a*Math.sin(e))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=Ih,e.fill(),t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}}const Uh=Zh;class Hh extends Uh{constructor(t){super({points:1/0,fill:(t=t||{radius:5}).fill,radius:t.radius,stroke:t.stroke,scale:void 0!==t.scale?t.scale:1,rotation:void 0!==t.rotation?t.rotation:0,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,displacement:void 0!==t.displacement?t.displacement:[0,0],declutterMode:t.declutterMode})}clone(){const t=this.getScale(),e=new Hh({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 qh=Hh;class $h{constructor(t){t=t||{},this.patternImage_=null,this.color_=null,void 0!==t.color&&this.setColor(t.color)}clone(){const t=this.getColor();return new $h({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){if(null!==t&&"object"==typeof t&&"src"in t){const e=Ch(null,t.src,"anonymous",void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));e.ready().then(()=>{this.patternImage_=null}),e.getImageState()===lh&&e.load(),e.getImageState()===ch&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?B(t):"object"==typeof t&&"src"in t?t.src+":"+t.offset:Do(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}const Jh=$h;function Qh(t,e,i,n){return void 0!==i&&void 0!==n?[i/t,n/e]:void 0!==i?i/t:void 0!==n?n/e:1}class tl extends Yh{constructor(t){const e=void 0!==(t=t||{}).opacity?t.opacity:1,i=void 0!==t.rotation?t.rotation:0,n=void 0!==t.scale?t.scale:1,s=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:i,scale:n,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:s,declutterMode:t.declutterMode}),this.anchor_=void 0!==t.anchor?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==t.anchorOrigin?t.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==t.anchorXUnits?t.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==t.anchorYUnits?t.anchorYUnits:"fraction",this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null;const r=void 0!==t.img?t.img:null;let o,a=t.src;if(wt(!(void 0!==a&&r),"`image` and `src` cannot be provided at the same time"),void 0!==a&&0!==a.length||!r||(a=r.src||B(r)),wt(void 0!==a&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),wt(!((void 0!==t.width||void 0!==t.height)&&void 0!==t.scale),"`width` or `height` cannot be provided together with `scale`"),void 0!==t.src?o=lh:void 0!==r&&(o="complete"in r?r.complete?r.src?uh:lh:ch:uh),this.color_=void 0!==t.color?Do(t.color):null,this.iconImage_=Ch(r,a,this.crossOrigin_,o,this.color_),this.offset_=void 0!==t.offset?t.offset:[0,0],this.offsetOrigin_=void 0!==t.offsetOrigin?t.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==t.size?t.size:null,this.initialOptions_,void 0!==t.width||void 0!==t.height){let e,i;if(t.size)[e,i]=t.size;else{const n=this.getImage(1);if(n.width&&n.height)e=n.width,i=n.height;else if(n instanceof HTMLImageElement){this.initialOptions_=t;const e=()=>{if(this.unlistenImageChange(e),!this.initialOptions_)return;const i=this.iconImage_.getSize();this.setScale(Qh(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(Qh(e,i,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 tl({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:null!==this.size_?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 e=this.getSize();if("fraction"==this.anchorXUnits_||"fraction"==this.anchorYUnits_){if(!e)return null;t=this.anchor_.slice(),"fraction"==this.anchorXUnits_&&(t[0]*=e[0]),"fraction"==this.anchorYUnits_&&(t[1]*=e[1])}if("top-left"!=this.anchorOrigin_){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),"top-right"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[0]=-t[0]+e[0]),"bottom-left"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[1]=-t[1]+e[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("top-left"!=this.offsetOrigin_){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[0]=i[0]-e[0]-t[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(t){this.iconImage_=Ch(null,t,this.crossOrigin_,lh,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();return this.size_?this.size_[0]*t[0]:this.iconImage_.getImageState()==uh?this.iconImage_.getSize()[0]*t[0]:void 0}getHeight(){const t=this.getScaleArray();return this.size_?this.size_[1]*t[1]:this.iconImage_.getImageState()==uh?this.iconImage_.getSize()[1]*t[1]:void 0}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(l,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(l,t)}ready(){return this.iconImage_.ready()}}const el=tl;class il{constructor(t){t=t||{},this.color_=void 0!==t.color?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=void 0!==t.lineDash?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 il({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 nl=il;class sl{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=hl,void 0!==t.geometry&&this.setGeometry(t.geometry),this.fill_=void 0!==t.fill?t.fill:null,this.image_=void 0!==t.image?t.image:null,this.renderer_=void 0!==t.renderer?t.renderer:null,this.hitDetectionRenderer_=void 0!==t.hitDetectionRenderer?t.hitDetectionRenderer:null,this.stroke_=void 0!==t.stroke?t.stroke:null,this.text_=void 0!==t.text?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&"object"==typeof t&&(t=t.clone()),new sl({geometry:t??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=hl,this.geometry_=t}setZIndex(t){this.zIndex_=t}}let rl=null;function ol(t,e){if(!rl){const t=new Jh({color:"rgba(255,255,255,0.4)"}),e=new nl({color:"#3399CC",width:1.25});rl=[new sl({image:new qh({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return rl}function al(){const t={},e=[255,255,255,1],i=[0,153,255,1];return t.Polygon=[new sl({fill:new Jh({color:[255,255,255,.5]})})],t.MultiPolygon=t.Polygon,t.LineString=[new sl({stroke:new nl({color:e,width:5})}),new sl({stroke:new nl({color:i,width:3})})],t.MultiLineString=t.LineString,t.Circle=t.Polygon.concat(t.LineString),t.Point=[new sl({image:new qh({radius:6,fill:new Jh({color:i}),stroke:new nl({color:e,width:1.5})}),zIndex:1/0})],t.MultiPoint=t.Point,t.GeometryCollection=t.Polygon.concat(t.LineString,t.Point),t}function hl(t){return t.getGeometry()}const ll=sl;class cl{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.keepUpright_=t.keepUpright,this.scale_=t.scale,this.scaleArray_=zo(void 0!==t.scale?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_=void 0!==t.fill?t.fill:new Jh({color:"#333"}),this.maxAngle_=void 0!==t.maxAngle?t.maxAngle:Math.PI/4,this.placement_=void 0!==t.placement?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=void 0!==t.stroke?t.stroke:null,this.offsetX_=void 0!==t.offsetX?t.offsetX:0,this.offsetY_=void 0!==t.offsetY?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=void 0===t.padding?null:t.padding,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new cl({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof Jh?this.getFill().clone():this.getFill(),stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setKeepUpright(t){this.keepUpright_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=zo(void 0!==t?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}}const ul=cl;function dl(t){return!0}function gl(t){const e=ta(),i=function(t,e){const i=t.length,n=new Array(i);for(let s=0;s<i;++s){const i=t[s],r="filter"in i?rh(i.filter,No,e):dl;let o;if(Array.isArray(i.style)){const t=i.style.length;o=new Array(t);for(let n=0;n<t;++n)o[n]=fl(i.style[n],e)}else o=[fl(i.style,e)];n[s]={filter:r,styles:o}}return function(e){const s=[];let r=!1;for(let o=0;o<i;++o){if((0,n[o].filter)(e)&&(!t[o].else||!r)){r=!0;for(const t of n[o].styles){const i=t(e);i&&s.push(i)}}}return s}}(t,e),n={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""};return function(t,s){if(n.properties=t.getPropertiesInternal(),n.resolution=s,e.featureId){const e=t.getId();n.featureId=void 0!==e?e:null}return e.geometryType&&(n.geometryType=sh(t.getGeometry())),i(n)}}function _l(t){const e=ta(),i=t.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=fl(t[s],e);const s={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""},r=new Array(i);return function(t,o){if(s.properties=t.getPropertiesInternal(),s.resolution=o,e.featureId){const e=t.getId();s.featureId=void 0!==e?e:null}let a=0;for(let t=0;t<i;++t){const e=n[t](s);e&&(r[a]=e,a+=1)}return r.length=a,r}}function fl(t,e){const i=pl(t,"",e),n=ml(t,"",e),s=function(t,e){const i="text-",n=xl(t,i+"value",e);if(!n)return null;const s=pl(t,i,e),r=pl(t,i+"background-",e),o=ml(t,i,e),a=ml(t,i+"background-",e),h=xl(t,i+"font",e),l=yl(t,i+"max-angle",e),c=yl(t,i+"offset-x",e),u=yl(t,i+"offset-y",e),d=vl(t,i+"overflow",e),g=xl(t,i+"placement",e),_=yl(t,i+"repeat",e),f=Il(t,i+"scale",e),p=vl(t,i+"rotate-with-view",e),m=yl(t,i+"rotation",e),y=xl(t,i+"align",e),x=xl(t,i+"justify",e),v=xl(t,i+"baseline",e),C=vl(t,i+"keep-upright",e),w=wl(t,i+"padding",e),S=Pl(t,i+"declutter-mode"),E=new ul({declutterMode:S});return function(t){if(E.setText(n(t)),s&&E.setFill(s(t)),r&&E.setBackgroundFill(r(t)),o&&E.setStroke(o(t)),a&&E.setBackgroundStroke(a(t)),h&&E.setFont(h(t)),l&&E.setMaxAngle(l(t)),c&&E.setOffsetX(c(t)),u&&E.setOffsetY(u(t)),d&&E.setOverflow(d(t)),g){const e=g(t);if("point"!==e&&"line"!==e)throw new Error("Expected point or line for text-placement");E.setPlacement(e)}if(_&&E.setRepeat(_(t)),f&&E.setScale(f(t)),p&&E.setRotateWithView(p(t)),m&&E.setRotation(m(t)),y){const e=y(t);if("left"!==e&&"center"!==e&&"right"!==e&&"end"!==e&&"start"!==e)throw new Error("Expected left, right, center, start, or end for text-align");E.setTextAlign(e)}if(x){const e=x(t);if("left"!==e&&"right"!==e&&"center"!==e)throw new Error("Expected left, right, or center for text-justify");E.setJustify(e)}if(v){const e=v(t);if("bottom"!==e&&"top"!==e&&"middle"!==e&&"alphabetic"!==e&&"hanging"!==e)throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");E.setTextBaseline(e)}return w&&E.setPadding(w(t)),C&&E.setKeepUpright(C(t)),E}}(t,e),r=function(t,e){if("icon-src"in t)return function(t,e){const i="icon-",n=i+"src",s=bl(t[n],n),r=Sl(t,i+"anchor",e),o=Il(t,i+"scale",e),a=yl(t,i+"opacity",e),h=Sl(t,i+"displacement",e),l=yl(t,i+"rotation",e),c=vl(t,i+"rotate-with-view",e),u=Rl(t,i+"anchor-origin"),d=Ml(t,i+"anchor-x-units"),g=Ml(t,i+"anchor-y-units"),_=function(t,e){const i=t[e];if(void 0===i)return;return Al(i,e)}(t,i+"color"),f=function(t,e){const i=t[e];if(void 0===i)return;if("string"!=typeof i)throw new Error(`Expected a string for ${e}`);return i}(t,i+"cross-origin"),p=function(t,e){const i=t[e];if(void 0===i)return;return Fl(i,e)}(t,i+"offset"),m=Rl(t,i+"offset-origin"),y=Tl(t,i+"width"),x=Tl(t,i+"height"),v=function(t,e){const i=t[e];if(void 0===i)return;if("number"==typeof i)return zo(i);if(!Array.isArray(i))throw new Error(`Expected a number or size array for ${e}`);if(2!==i.length||"number"!=typeof i[0]||"number"!=typeof i[1])throw new Error(`Expected a number or size array for ${e}`);return i}(t,i+"size"),C=Pl(t,i+"declutter-mode"),w=new el({src:s,anchorOrigin:u,anchorXUnits:d,anchorYUnits:g,color:_,crossOrigin:f,offset:p,offsetOrigin:m,height:x,width:y,size:v,declutterMode:C});return function(t){return a&&w.setOpacity(a(t)),h&&w.setDisplacement(h(t)),l&&w.setRotation(l(t)),c&&w.setRotateWithView(c(t)),o&&w.setScale(o(t)),r&&w.setAnchor(r(t)),w}}(t,e);if("shape-points"in t)return function(t,e){const i="shape-",n=i+"points",s=i+"radius",r=Ll(t[n],n),o=Ll(t[s],s),a=pl(t,i,e),h=ml(t,i,e),l=Il(t,i+"scale",e),c=Sl(t,i+"displacement",e),u=yl(t,i+"rotation",e),d=vl(t,i+"rotate-with-view",e),g=Tl(t,i+"radius2"),_=Tl(t,i+"angle"),f=Pl(t,i+"declutter-mode"),p=new Uh({points:r,radius:o,radius2:g,angle:_,declutterMode:f});return function(t){return a&&p.setFill(a(t)),h&&p.setStroke(h(t)),c&&p.setDisplacement(c(t)),u&&p.setRotation(u(t)),d&&p.setRotateWithView(d(t)),l&&p.setScale(l(t)),p}}(t,e);if("circle-radius"in t)return function(t,e){const i="circle-",n=pl(t,i,e),s=ml(t,i,e),r=yl(t,i+"radius",e),o=Il(t,i+"scale",e),a=Sl(t,i+"displacement",e),h=yl(t,i+"rotation",e),l=vl(t,i+"rotate-with-view",e),c=Pl(t,i+"declutter-mode"),u=new qh({radius:5,declutterMode:c});return function(t){return r&&u.setRadius(r(t)),n&&u.setFill(n(t)),s&&u.setStroke(s(t)),a&&u.setDisplacement(a(t)),h&&u.setRotation(h(t)),l&&u.setRotateWithView(l(t)),o&&u.setScale(o(t)),u}}(t,e);return null}(t,e),o=yl(t,"z-index",e);if(!(i||n||s||r||L(t)))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(t));const a=new ll;return function(t){let e=!0;if(i){const n=i(t);n&&(e=!1),a.setFill(n)}if(n){const i=n(t);i&&(e=!1),a.setStroke(i)}if(s){const i=s(t);i&&(e=!1),a.setText(i)}if(r){const i=r(t);i&&(e=!1),a.setImage(i)}return o&&a.setZIndex(o(t)),e?null:a}}function pl(t,e,i){let n;if(e+"fill-pattern-src"in t)n=function(t,e,i){const n=xl(t,e+"pattern-src",i),s=El(t,e+"pattern-offset",i),r=El(t,e+"pattern-size",i),o=Cl(t,e+"color",i);return function(t){return{src:n(t),offset:s&&s(t),size:r&&r(t),color:o&&o(t)}}}(t,e+"fill-",i);else{if("none"===t[e+"fill-color"])return t=>null;n=Cl(t,e+"fill-color",i)}if(!n)return null;const s=new Jh;return function(t){const e=n(t);return e===mo?null:(s.setColor(e),s)}}function ml(t,e,i){const n=yl(t,e+"stroke-width",i),s=Cl(t,e+"stroke-color",i);if(!n&&!s)return null;const r=xl(t,e+"stroke-line-cap",i),o=xl(t,e+"stroke-line-join",i),a=wl(t,e+"stroke-line-dash",i),h=yl(t,e+"stroke-line-dash-offset",i),l=yl(t,e+"stroke-miter-limit",i),c=new nl;return function(t){if(s){const e=s(t);if(e===mo)return null;c.setColor(e)}if(n&&c.setWidth(n(t)),r){const e=r(t);if("butt"!==e&&"round"!==e&&"square"!==e)throw new Error("Expected butt, round, or square line cap");c.setLineCap(e)}if(o){const e=o(t);if("bevel"!==e&&"round"!==e&&"miter"!==e)throw new Error("Expected bevel, round, or miter line join");c.setLineJoin(e)}return a&&c.setLineDash(a(t)),h&&c.setLineDashOffset(h(t)),l&&c.setMiterLimit(l(t)),c}}function yl(t,e,i){if(!(e in t))return;const n=rh(t[e],Xo,i);return function(t){return Ll(n(t),e)}}function xl(t,e,i){if(!(e in t))return null;const n=rh(t[e],Bo,i);return function(t){return bl(n(t),e)}}function vl(t,e,i){if(!(e in t))return null;const n=rh(t[e],No,i);return function(t){const i=n(t);if("boolean"!=typeof i)throw new Error(`Expected a boolean for ${e}`);return i}}function Cl(t,e,i){if(!(e in t))return null;const n=rh(t[e],Ko,i);return function(t){return Al(n(t),e)}}function wl(t,e,i){if(!(e in t))return null;const n=rh(t[e],Vo,i);return function(t){return Fl(n(t),e)}}function Sl(t,e,i){if(!(e in t))return null;const n=rh(t[e],Vo,i);return function(t){const i=Fl(n(t),e);if(2!==i.length)throw new Error(`Expected two numbers for ${e}`);return i}}function El(t,e,i){if(!(e in t))return null;const n=rh(t[e],Vo,i);return function(t){return kl(n(t),e)}}function Il(t,e,i){if(!(e in t))return null;const n=rh(t[e],Vo|Xo,i);return function(t){return function(t,e){if("number"==typeof t)return t;return kl(t,e)}(n(t),e)}}function Tl(t,e){const i=t[e];if(void 0!==i){if("number"!=typeof i)throw new Error(`Expected a number for ${e}`);return i}}function Rl(t,e){const i=t[e];if(void 0!==i){if("bottom-left"!==i&&"bottom-right"!==i&&"top-left"!==i&&"top-right"!==i)throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return i}}function Ml(t,e){const i=t[e];if(void 0!==i){if("pixels"!==i&&"fraction"!==i)throw new Error(`Expected pixels or fraction for ${e}`);return i}}function Pl(t,e){const i=t[e];if(void 0!==i){if("string"!=typeof i)throw new Error(`Expected a string for ${e}`);if("declutter"!==i&&"obstacle"!==i&&"none"!==i)throw new Error(`Expected declutter, obstacle, or none for ${e}`);return i}}function Fl(t,e){if(!Array.isArray(t))throw new Error(`Expected an array for ${e}`);const i=t.length;for(let n=0;n<i;++n)if("number"!=typeof t[n])throw new Error(`Expected an array of numbers for ${e}`);return t}function bl(t,e){if("string"!=typeof t)throw new Error(`Expected a string for ${e}`);return t}function Ll(t,e){if("number"!=typeof t)throw new Error(`Expected a number for ${e}`);return t}function Al(t,e){if("string"==typeof t)return t;const i=Fl(t,e),n=i.length;if(n<3||n>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return i}function kl(t,e){const i=Fl(t,e);if(2!==i.length)throw new Error(`Expected an array of two numbers for ${e}`);return i}const Dl="renderOrder";const Ol=class extends $r{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=t.declutter?String(t.declutter):void 0,this.renderBuffer_=void 0!==t.renderBuffer?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=void 0!==t.updateWhileAnimating&&t.updateWhileAnimating,this.updateWhileInteracting_=void 0!==t.updateWhileInteracting&&t.updateWhileInteracting}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(Dl)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const i=this.getDeclutter();i in t.declutter==!1&&(t.declutter[i]=new eo(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(Dl,t)}setStyle(t){this.style_=void 0===t?ol:t;const e=function(t){if(void 0===t)return ol;if(!t)return null;if("function"==typeof t)return t;if(t instanceof ll)return t;if(!Array.isArray(t))return _l([t]);if(0===t.length)return[];const e=t.length,i=t[0];if(i instanceof ll){const i=new Array(e);for(let n=0;n<e;++n){const e=t[n];if(!(e instanceof ll))throw new Error("Expected a list of style instances");i[n]=e}return i}if("style"in i){const i=new Array(e);for(let n=0;n<e;++n){const e=t[n];if(!("style"in e))throw new Error("Expected a list of rules with a style property");i[n]=e}return gl(i)}const n=t;return _l(n)}(t);this.styleFunction_=null===t?void 0:function(t){let e;if("function"==typeof t)e=t;else{let i;Array.isArray(t)?i=t:(wt("function"==typeof t.getZIndex,"Expected an `Style` or an array of `Style`"),i=[t]),e=function(){return i}}return e}(e),this.changed()}setDeclutter(t){this.declutter_=t?String(t):void 0,this.changed()}};const Gl=class extends A{constructor(t,e,i,n){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=n}};function zl(t,e){yh.expire()}const Wl=class extends x{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){N()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,n=t.pixelToCoordinateTransform;_n(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),fn(n,i)}forEachFeatureAtCoordinate(t,e,i,n,s,r,o,a){let h;const l=e.viewState;function c(t,e,i,n){return s.call(r,e,t?i:null,n)}const u=l.projection,d=Ge(t.slice(),u),g=[[0,0]];if(u.canWrapX()&&n){const t=Ee(u.getExtent());g.push([-t,0],[t,0])}const _=e.layerStatesArray,f=_.length,p=[],m=[];for(let n=0;n<g.length;n++)for(let s=f-1;s>=0;--s){const r=_[s],u=r.layer;if(u.hasRenderer()&&qr(r,l)&&o.call(a,u)){const s=u.getRenderer(),o=u.getSource();if(s&&o){const a=o.getWrapX()?d:t,l=c.bind(null,r.managed);m[0]=a[0]+g[n][0],m[1]=a[1]+g[n][1],h=s.forEachFeatureAtCoordinate(m,e,i,l,p)}if(h)return h}}if(0===p.length)return;const y=1/p.length;return p.forEach((t,e)=>t.distanceSq+=e*y),p.sort((t,e)=>t.distanceSq-e.distanceSq),p.some(t=>h=t.callback(t.feature,t.layer,t.geometry)),h}hasFeatureAtCoordinate(t,e,i,n,s,r){return void 0!==this.forEachFeatureAtCoordinate(t,e,i,n,T,this,s,r)}getMap(){return this.map_}renderFrame(t){N()}scheduleExpireIconCache(t){yh.canExpireCache()&&t.postRenderFunctions.push(zl)}};const Nl=class extends Wl{constructor(t){super(t),this.fontChangeListenerKey_=D(Ah,h,t.redrawText,t),this.element_=et?zs():document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=Ss+" ol-layers";const i=t.getViewport();i&&i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const n=new Gl(t,void 0,e);i.dispatchEvent(n)}}disposeInternal(){G(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(t){if(!t)return void(this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1));this.calculateMatrices2D(t),this.dispatchRenderEvent(Zr,t);const e=t.layerStatesArray.sort((t,e)=>t.zIndex-e.zIndex);e.some(t=>t.layer instanceof Ol&&t.layer.getDeclutter())&&(t.declutter={});const i=t.viewState;this.children_.length=0;const n=[];let s=null;for(let r=0,o=e.length;r<o;++r){const o=e[r];t.layerIndex=r;const a=o.layer,h=a.getSourceState();if(!qr(o,i)||"ready"!=h&&"undefined"!=h){a.unrender();continue}const l=a.render(t,s);l&&(l!==s&&(this.children_.push(l),s=l),n.push(o))}this.declutter(t,n),function(t,e){const i=t.childNodes;for(let n=0;;++n){const s=i[n],r=e[n];if(!s&&!r)break;s!==r&&(s?r?t.insertBefore(r,s):(t.removeChild(s),--n):t.appendChild(r))}}(this.element_,this.children_);const r=this.getMap().getTargetElement();if(Ws(r)){const t=r.getContext("2d");for(const e of this.children_){const i=e.firstElementChild||e,n=e.style.backgroundColor;if(n&&(!Ws(i)||i.width>0)&&(t.fillStyle=n,t.fillRect(0,0,r.width,r.height)),Ws(i)&&i.width>0){const n=e.style.opacity||i.style.opacity;t.globalAlpha=""===n?1:Number(n);const s=i.style.transform;if(s)t.setTransform(...yn(s));else{const e=parseFloat(i.style.width)/i.width,n=parseFloat(i.style.height)/i.height;t.setTransform(e,0,0,n,0,0)}t.drawImage(i,0,0)}}t.globalAlpha=1,t.setTransform(1,0,0,1,0,0)}this.dispatchRenderEvent(Ur,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){if(t.declutter){for(let i=e.length-1;i>=0;--i){const n=e[i],s=n.layer;s.getDeclutter()&&s.renderDeclutter(t,n)}e.forEach(e=>e.layer.renderDeferred(t))}}};function Xl(t){t instanceof $r?t.setMapInternal(null):t instanceof Vr&&t.getLayers().forEach(Xl)}function Bl(t,e){if(t instanceof $r)t.setMapInternal(e);else if(t instanceof Vr){const i=t.getLayers().getArray();for(let t=0,n=i.length;t<n;++t)Bl(i[t],e)}}const Kl=class extends V{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=function(t){let e=null;void 0!==t.keyboardEventTarget&&(e="string"==typeof t.keyboardEventTarget?document.getElementById(t.keyboardEventTarget):t.keyboardEventTarget);const i={},n=t.layers&&"function"==typeof t.layers.getLayers?t.layers:new Vr({layers:t.layers});let s,r,o;i[gt]=n,i[ft]=t.target,i[pt]=t.view instanceof Cs?t.view:new Cs,void 0!==t.controls&&(Array.isArray(t.controls)?s=new Z(t.controls.slice()):(wt("function"==typeof t.controls.getArray,"Expected `controls` to be an array or an `ol/Collection.js`"),s=t.controls));void 0!==t.interactions&&(Array.isArray(t.interactions)?r=new Z(t.interactions.slice()):(wt("function"==typeof t.interactions.getArray,"Expected `interactions` to be an array or an `ol/Collection.js`"),r=t.interactions));void 0!==t.overlays?Array.isArray(t.overlays)?o=new Z(t.overlays.slice()):(wt("function"==typeof t.overlays.getArray,"Expected `overlays` to be an array or an `ol/Collection.js`"),o=t.overlays):o=new Z;return{controls:s,interactions:r,keyboardEventTarget:e,overlays:o,values:i}}(t);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=void 0!==t.maxTilesLoading?t.maxTilesLoading:16,this.pixelRatio_=void 0!==t.pixelRatio?t.pixelRatio:tt,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=[1,0,0,1,0,0],this.pixelToCoordinateTransform_=[1,0,0,1,0,0],this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,et||(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,et||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=e.controls||(et?new Z:function(t){t=t||{};const e=new Z;return(void 0===t.zoom||t.zoom)&&e.push(new Ks(t.zoomOptions)),(void 0===t.rotate||t.rotate)&&e.push(new Bs(t.rotateOptions)),(void 0===t.attribution||t.attribution)&&e.push(new Xs(t.attributionOptions)),e}()),this.interactions=e.interactions||(et?new Z:function(t){t=t||{};const e=new Z,i=new Vs(-.005,.05,100);return(void 0===t.altShiftDragRotate||t.altShiftDragRotate)&&e.push(new cr),(void 0===t.doubleClickZoom||t.doubleClickZoom)&&e.push(new Us({delta:t.zoomDelta,duration:t.zoomDuration})),(void 0===t.dragPan||t.dragPan)&&e.push(new lr({onFocusOnly:t.onFocusOnly,kinetic:i})),(void 0===t.pinchRotate||t.pinchRotate)&&e.push(new Tr),(void 0===t.pinchZoom||t.pinchZoom)&&e.push(new Rr({duration:t.zoomDuration})),(void 0===t.keyboard||t.keyboard)&&(e.push(new Sr),e.push(new Er({delta:t.zoomDelta,duration:t.zoomDuration}))),(void 0===t.mouseWheelZoom||t.mouseWheelZoom)&&e.push(new Ir({onFocusOnly:t.onFocusOnly,duration:t.zoomDuration})),(void 0===t.shiftDragZoom||t.shiftDragZoom)&&e.push(new yr({duration:t.zoomDuration})),e}({onFocusOnly:!0})),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new It(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(gt,this.handleLayerGroupChanged_),this.addChangeListener(pt,this.handleViewChanged_),this.addChangeListener(_t,this.handleSizeChanged_),this.addChangeListener(ft,this.handleTargetChanged_),this.setProperties(e.values);const i=this;!t.view||t.view instanceof Cs||t.view.then(function(t){i.setView(new Cs(t))}),this.controls.addEventListener(o,t=>{t.element.setMap(this)}),this.controls.addEventListener(a,t=>{t.element.setMap(null)}),this.interactions.addEventListener(o,t=>{t.element.setMap(this)}),this.interactions.addEventListener(a,t=>{t.element.setMap(null)}),this.overlays_.addEventListener(o,t=>{this.addOverlayInternal_(t.element)}),this.overlays_.addEventListener(a,t=>{const e=t.element.getId();void 0!==e&&delete this.overlayIdIndex_[e.toString()],t.element.setMap(null)}),this.controls.forEach(t=>{t.setMap(this)}),this.interactions.forEach(t=>{t.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){Bl(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();void 0!==e&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const n=this.getCoordinateFromPixelInternal(t),s=void 0!==(i=void 0!==i?i:{}).hitTolerance?i.hitTolerance:0,r=void 0!==i.layerFilter?i.layerFilter:T,o=!1!==i.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(n,this.frameState_,s,o,e,null,r,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,function(t){i.push(t)},e),i}getAllLayers(){const t=[];return function e(i){i.forEach(function(i){i instanceof Vr?e(i.getLayers()):t.push(i)})}(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t),n=void 0!==(e=void 0!==e?e:{}).layerFilter?e.layerFilter:T,s=void 0!==e.hitTolerance?e.hitTolerance:0,r=!1!==e.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,s,r,n,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const e=this.viewport_.getBoundingClientRect(),i=this.getSize(),n=e.width/i[0],s=e.height/i[1],r="changedTouches"in t?t.changedTouches[0]:t;return[(r.clientX-e.left)/n,(r.clientY-e.top)/s]}getTarget(){return this.get(ft)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return rn(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?gn(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return void 0!==e?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(gt)}setLayers(t){const e=this.getLayerGroup();if(t instanceof Z)return void e.setLayers(t);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 i=t[e];if(!i.visible)continue;const n=i.layer.getRenderer();if(n&&!n.ready)return!0;const s=i.layer.getSource();if(s&&s.loading)return!0}return!1}getPixelFromCoordinate(t){const e=on(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?gn(e.coordinateToPixelTransform,t.slice(0,2)):null}getRenderer(){return this.renderer_}getSize(){return this.get(_t)}getView(){return this.get(pt)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,i,n){return function(t,e,i,n,s){if(!t||!(i in t.wantedTiles))return St;if(!t.wantedTiles[i][e.getKey()])return St;const r=t.viewState.center,o=n[0]-r[0],a=n[1]-r[1];return 65536*Math.log(s)+Math.sqrt(o*o+a*a)/s}(this.frameState_,t,e,i,n)}handleBrowserEvent(t,e){e=e||t.type;const i=new H(e,this,t);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,i=e.type;if(i===ot||i===y||i===_){const t=this.getOwnerDocument(),i=this.viewport_.getRootNode?this.viewport_.getRootNode():t,n=e.target,s=i instanceof ShadowRoot?i.host===n?i.host.ownerDocument:i:i===t?t.documentElement:i;if(this.overlayContainerStopEvent_.contains(n)||!s.contains(n))return}if(t.frameState=this.frameState_,!1!==this.dispatchEvent(t)){const e=this.getInteractions().getArray().slice();for(let i=e.length-1;i>=0;i--){const n=e[i];if(n.getMap()!==this||!n.getActive()||!this.getTargetElement())continue;if(!n.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let i=this.maxTilesLoading_,n=i;if(t){const e=t.viewHints;if(e[Tt]||e[Rt]){const e=Date.now()-t.time>8;i=e?0:8,n=e?0:2}}e.getTilesLoading()<i&&(e.reprioritize(),e.loadMoreTiles(i,n))}t&&this.renderer_&&!t.animate&&(this.renderComplete_?(this.hasListener(Hr)&&this.renderer_.dispatchRenderEvent(Hr,t),!1===this.loaded_&&(this.loaded_=!0,this.dispatchEvent(new U(dt,this,t)))):!0===this.loaded_&&(this.loaded_=!1,this.dispatchEvent(new U(ut,this,t))));const i=this.postRenderFunctions_;if(t)for(let e=0,n=i.length;e<n;++e)i[e](this,t);i.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let t=0,e=this.targetChangeHandlerKeys_.length;t<e;++t)G(this.targetChangeHandlerKeys_[t]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(u,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(y,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!Ws(this.targetElement_)){this.resizeObserver_?.unobserve(this.targetElement_);const t=this.targetElement_.getRootNode();t instanceof ShadowRoot&&this.resizeObserver_.unobserve(t.host),this.setSize(void 0)}const t=this.getTarget(),e="string"==typeof t?document.getElementById(t):t;if(this.targetElement_=e,e){if(Ws(e)||e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new Nl(this)),!Ws(e)){this.mapBrowserEventHandler_=new at(this,this.moveTolerance_);for(const t in q)this.mapBrowserEventHandler_.addEventListener(q[t],this.handleMapBrowserEvent.bind(this));let t;if(this.viewport_.addEventListener(u,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(y,this.boundHandleBrowserEvent_,!!st&&{passive:!1}),this.keyboardEventTarget_)t=this.keyboardEventTarget_;else{const i=e.getRootNode();t=i instanceof ShadowRoot?i.host:e}if(this.targetChangeHandlerKeys_=[D(t,_,this.handleBrowserEvent,this),D(t,f,this.handleBrowserEvent,this)],e instanceof HTMLElement){const t=e.getRootNode();t instanceof ShadowRoot&&this.resizeObserver_.observe(t.host),this.resizeObserver_?.observe(e)}}this.updateSize()}else 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)}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(G(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(G(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=D(t,h,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=D(t,l,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(G),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new Xr("addlayer",t)),this.layerGroupPropertyListenerKeys_=[D(t,h,this.render,this),D(t,l,this.render,this),D(t,"addlayer",this.handleLayerAdd_,this),D(t,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;const t=this.frameState_.layerStatesArray;for(let e=0,i=t.length;e<i;++e){const i=t[e].layer;i.hasRenderer()&&i.getRenderer().handleFontsChanged()}}render(){this.renderer_&&void 0===this.animationDelayKey_&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){return this.getLayerGroup().getLayers().remove(t)}handleLayerRemove_(t){Xl(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),i=this.getView(),n=this.frameState_;let s=null;if(void 0!==e&&Go(e)&&i&&i.isDef()){const n=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),r=i.getState();if(s={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:ye(r.center,r.resolution,r.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:r,viewHints:n,wantedTiles:{},mapId:B(this),renderTargets:{}},r.nextCenter&&r.nextResolution){const t=isNaN(r.nextRotation)?r.rotation:r.nextRotation;s.nextExtent=ye(r.nextCenter,r.nextResolution,t,e)}}if(this.frameState_=s,this.renderer_.renderFrame(s),s){if(s.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,s.postRenderFunctions),n){(!this.previousExtent_||!Te(this.previousExtent_)&&!ae(s.extent,this.previousExtent_))&&(this.dispatchEvent(new U(lt,this,n)),this.previousExtent_=se(this.previousExtent_))}this.previousExtent_&&!s.viewHints[Tt]&&!s.viewHints[Rt]&&!ae(s.extent,this.previousExtent_)&&(this.dispatchEvent(new U(ct,this,s)),qt(s.extent,this.previousExtent_))}this.dispatchEvent(new U(ht,this,s)),this.renderComplete_=(this.hasListener(ut)||this.hasListener(dt)||this.hasListener(Hr))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new Xr("removelayer",e)),this.set(gt,t)}setSize(t){this.set(_t,t)}setTarget(t){this.set(ft,t)}setView(t){if(!t||t instanceof Cs)return void this.set(pt,t);this.set(pt,new Cs);const e=this;t.then(function(t){e.setView(new Cs(t))})}updateSize(){const t=this.getTargetElement();let e;if(t){let i,n;if(Ws(t))i=t.width,n=t.height;else{const e=getComputedStyle(t);i=t.offsetWidth-parseFloat(e.borderLeftWidth)-parseFloat(e.paddingLeft)-parseFloat(e.paddingRight)-parseFloat(e.borderRightWidth),n=t.offsetHeight-parseFloat(e.borderTopWidth)-parseFloat(e.paddingTop)-parseFloat(e.paddingBottom)-parseFloat(e.borderBottomWidth)}isNaN(i)||isNaN(n)||(e=[Math.max(0,i),Math.max(0,n)],!Go(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&Ve("No map visible because the map container's width or height are 0."))}const i=this.getSize();!e||i&&I(e,i)||(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}};class Vl extends V{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("function"==typeof t.getSimplifiedGeometry){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new Vl(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_&&(G(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=D(t,l,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?function(t){if("function"==typeof t)return t;let e;if(Array.isArray(t))e=t;else{wt("function"==typeof t.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`");e=[t]}return function(){return e}}(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_()}}const jl=Vl;let Yl=!1;function Zl(t,e){return function(i,n,s,r,o){!function(t,e,i,n,s,r,o){const a=new XMLHttpRequest;a.open("GET","function"==typeof t?t(i,n,s):t,!0),"arraybuffer"==e.getType()&&(a.responseType="arraybuffer"),a.withCredentials=Yl,a.onload=function(t){if(!a.status||a.status>=200&&a.status<300){const t=e.getType();try{let n;"text"==t||"json"==t?n=a.responseText:"xml"==t?n=a.responseXML||a.responseText:"arraybuffer"==t&&(n=a.response),n?r(e.readFeatures(n,{extent:i,featureProjection:s}),e.readProjection(n)):o()}catch{o()}}else o()},a.onerror=o,a.send()}(t,e,i,n,s,(t,e)=>{this.addFeatures(t),void 0!==r&&r(t)},()=>{this.changed(),void 0!==o&&o()})}}function Ul(t,e){return[[-1/0,-1/0,1/0,1/0]]}function Hl(t,e,i,n){const s=[];let r=[1/0,1/0,-1/0,-1/0];for(let o=0,a=i.length;o<a;++o){const a=i[o];r=oe(t,e,a[0],n),s.push((r[0]+r[2])/2,(r[1]+r[3])/2),e=a[a.length-1]}return s}function ql(t,e,i,n,s,r,o){let a,h;const l=(i-e)/n;if(1===l)a=e;else if(2===l)a=e,h=s;else if(0!==l){let r=t[e],o=t[e+1],l=0;const c=[0];for(let s=e+n;s<i;s+=n){const e=t[s],i=t[s+1];l+=Math.sqrt((e-r)*(e-r)+(i-o)*(i-o)),c.push(l),r=e,o=i}const u=s*l,d=function(t,e,i){let n,s;i=i||v;let r=0,o=t.length,a=!1;for(;r<o;)n=r+(o-r>>1),s=+i(t[n],e),s<0?r=n+1:(o=n,a=!s);return a?r:~r}(c,u);d<0?(h=(u-c[-d-2])/(c[-d-1]-c[-d-2]),a=e+(-d-2)*n):a=e+d*n}o=o>1?o:2,r=r||new Array(o);for(let e=0;e<o;++e)r[e]=void 0===a?NaN:void 0===h?t[a+e]:Dt(t[a+e],t[a+n+e],h);return r}function $l(t,e,i,n,s,r){if(i==e)return null;let o;if(s<t[e+n-1])return r?(o=t.slice(e,e+n),o[n-1]=s,o):null;if(t[i-1]<s)return r?(o=t.slice(i-n,i),o[n-1]=s,o):null;if(s==t[e+n-1])return t.slice(e,e+n);let a=e/n,h=i/n;for(;a<h;){const e=a+h>>1;s<t[(e+1)*n-1]?h=e:a=e+1}const l=t[a*n-1];if(s==l)return t.slice((a-1)*n,(a-1)*n+n);const c=(s-l)/(t[(a+1)*n-1]-l);o=[];for(let e=0;e<n-1;++e)o.push(Dt(t[(a-1)*n+e],t[a*n+e],c));return o.push(s),o}const Jl=[1,0,0,1,0,0];class Ql{constructor(t,e,i,n,s,r){this.styleFunction,this.extent_,this.id_=r,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=s,this.squaredTolerance_,this.stride_=n,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_="Point"===this.type_?re(this.flatCoordinates_):oe(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=pe(this.getExtent());this.flatInteriorPoints_=$n(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=function(t,e){const i=[];let n,s=0,r=0;for(let o=0,a=e.length;o<a;++o){const a=e[o],h=ss(t,s,a,2);if(void 0===n&&(n=h),h===n)i.push(e.slice(r,o+1));else{if(0===i.length)continue;i[i.length-1].push(e[r])}r=o+1,s=a}return i}(this.flatCoordinates_,this.ends_),e=Hl(this.flatCoordinates_,0,t,2);this.flatInteriorPoints_=Jn(this.flatCoordinates_,0,t,2,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=ql(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const i=this.ends_;for(let n=0,s=i.length;n<s;++n){const s=i[n],r=ql(t,e,s,2,.5);E(this.flatMidpoints_,r),e=s}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(t){return this}simplifyTransformed(t,e){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(t){const e=(t=Ki(t)).getExtent(),i=t.getWorldExtent();if(e&&i){const t=ve(i)/ve(e);_n(Jl,i[0],i[3],t,-t,0,0,0),xn(this.flatCoordinates_,0,this.flatCoordinates_.length,2,Jl,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new Ql(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=P((t,e)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const i=this.simplifiedGeometry_.getFlatCoordinates();let n;switch(this.type_){case"LineString":i.length=Wn(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),n=[i.length];break;case"MultiLineString":n=[],i.length=Nn(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,n);break;case"Polygon":n=[],i.length=Kn(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,n)}return n&&(this.simplifiedGeometry_=new Ql(this.type_,i,n,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}Ql.prototype.getFlatCoordinates=Ql.prototype.getOrientedFlatCoordinates;const tc=Ql;const ec=class{constructor(t){this.rbush_=new eo(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 n=0,s=e.length;n<s;n++){const s=t[n],r=e[n],o={minX:s[0],minY:s[1],maxX:s[2],maxY:s[3],value:r};i[n]=o,this.items_[B(r)]=o}this.rbush_.load(i)}remove(t){const e=B(t),i=this.items_[e];return delete this.items_[e],null!==this.rbush_.remove(i)}update(t,e){const i=this.items_[B(e)];ae([i.minX,i.minY,i.maxX,i.maxY],t)||(this.remove(e),this.insert(t,e))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).map(function(t){return t.value})}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,e){return this.forEach_(this.getInExtent(t),e)}forEach_(t,e){let i;for(let n=0,s=t.length;n<s;n++)if(i=e(t[n]),i)return i;return i}isEmpty(){return L(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return ne(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]}};function ic(t){return t?"function"==typeof t?t:(Array.isArray(t)||(t=[t]),e=>t):null}const nc=class extends V{constructor(t){super(),this.projection=Ki(t.projection),this.attributions_=ic(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible??!0,this.loading=!1,this.state_=void 0!==t.state?t.state:"ready",this.wrapX_=void 0!==t.wrapX&&t.wrapX,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;const e=this;this.viewPromise_=new Promise(function(t,i){e.viewResolver=t,e.viewRejector=i})}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_=ic(t),this.changed()}setState(t){this.state_=t,this.changed()}},sc="addfeature",rc="changefeature",oc="clear",ac="removefeature",hc="featuresloadstart",lc="featuresloadend",cc="featuresloaderror";class uc extends A{constructor(t,e,i){super(t),this.feature=e,this.features=i}}const dc=class extends nc{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:void 0===t.wrapX||t.wrapX}),this.on,this.once,this.un,this.loader_=M,this.format_=t.format||null,this.overlaps_=void 0===t.overlaps||t.overlaps,this.url_=t.url,void 0!==t.loader?this.loader_=t.loader:void 0!==this.url_&&(wt(this.format_,"`format` must be set when `url` is set"),this.loader_=Zl(this.url_,this.format_)),this.strategy_=void 0!==t.strategy?t.strategy:Ul;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let i,n;this.featuresRtree_=e?new ec:null,this.loadedExtentsRtree_=new ec,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null,Array.isArray(t.features)?n=t.features:t.features&&(i=t.features,n=i.getArray()),e||void 0!==i||(i=new Z(n)),void 0!==n&&this.addFeaturesInternal(n),void 0!==i&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=B(t);if(!this.addToIndex_(e,t))return void(this.featuresCollection_&&this.featuresCollection_.remove(t));this.setupChangeEvents_(e,t);const i=t.getGeometry();if(i){const e=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(e,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new uc(sc,t))}setupChangeEvents_(t,e){e instanceof tc||(this.featureChangeKeys_[t]=[D(e,l,this.handleFeatureChange_,this),D(e,h,this.handleFeatureChange_,this)])}addToIndex_(t,e){let i=!0;if(void 0!==e.getId()){const t=String(e.getId());if(t in this.idIndex_)if(e instanceof tc){const n=this.idIndex_[t];n instanceof tc?Array.isArray(n)?n.push(e):this.idIndex_[t]=[n,e]:i=!1}else i=!1;else this.idIndex_[t]=e}return i&&(wt(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],n=[];for(let e=0,n=t.length;e<n;e++){const n=t[e],s=B(n);this.addToIndex_(s,n)&&i.push(n)}for(let t=0,s=i.length;t<s;t++){const s=i[t],r=B(s);this.setupChangeEvents_(r,s);const o=s.getGeometry();if(o){const t=o.getExtent();e.push(t),n.push(s)}else this.nullGeometryFeatures_[r]=s}if(this.featuresRtree_&&this.featuresRtree_.load(e,n),this.hasListener(sc))for(let t=0,e=i.length;t<e;t++)this.dispatchEvent(new uc(sc,i[t]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(sc,function(i){e||(e=!0,t.push(i.feature),e=!1)}),this.addEventListener(ac,function(i){e||(e=!0,t.remove(i.feature),e=!1)}),t.addEventListener(o,t=>{e||(e=!0,this.addFeature(t.element),e=!1)}),t.addEventListener(a,t=>{e||(e=!0,this.removeFeature(t.element),e=!1)}),this.featuresCollection_=t}clear(t){if(t){for(const t in this.featureChangeKeys_){this.featureChangeKeys_[t].forEach(G)}this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(t=>{this.removeFeatureInternal(t)});for(const t in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[t])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new uc(oc);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(i){const n=i.getGeometry();if(n instanceof tc||n.intersectsCoordinate(t))return e(i)})}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,function(i){const n=i.getGeometry();if(n instanceof tc||n.intersectsExtent(t)){const t=e(i);if(t)return t}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),L(this.nullGeometryFeatures_)||E(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,function(t){e.push(t)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const i=Pe(t,e);return[].concat(...i.map(t=>this.featuresRtree_.getInExtent(t)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],n=t[1];let s=null;const r=[NaN,NaN];let o=1/0;const a=[-1/0,-1/0,1/0,1/0];return e=e||T,this.featuresRtree_.forEachInExtent(a,function(t){if(e(t)){const e=t.getGeometry(),h=o;if(o=e instanceof tc?0:e.closestPointXY(i,n,r,o),o<h){s=t;const e=Math.sqrt(o);a[0]=i-e,a[1]=n-e,a[2]=i+e,a[3]=n+e}}}),s}getExtent(t){return this.featuresRtree_.getExtent(t)}getFeatureById(t){const e=this.idIndex_[t.toString()];return void 0!==e?e:null}getFeatureByUid(t){const e=this.uidIndex_[t];return void 0!==e?e:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){const e=t.target,i=B(e),n=e.getGeometry();if(n){const t=n.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(t,e)):this.featuresRtree_&&this.featuresRtree_.update(t,e)}else i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[i]=e);const s=e.getId();if(void 0!==s){const t=s.toString();this.idIndex_[t]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[t]=e)}else this.removeFromIdIndex_(e),this.uidIndex_[i]=e;this.changed(),this.dispatchEvent(new uc(rc,e))}hasFeature(t){const e=t.getId();return void 0!==e?e in this.idIndex_:B(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&L(this.nullGeometryFeatures_):!this.featuresCollection_||0===this.featuresCollection_.getLength()}loadFeatures(t,e,i){const n=this.loadedExtentsRtree_,s=this.strategy_(t,e,i);for(let t=0,r=s.length;t<r;++t){const r=s[t];n.forEachInExtent(r,function(t){return Qt(t.extent,r)})||(++this.loadingExtentsCount_,this.dispatchEvent(new uc(hc)),this.loader_.call(this,r,e,i,t=>{--this.loadingExtentsCount_,this.dispatchEvent(new uc(lc,void 0,t))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new uc(cc))}),n.insert(r,{extent:r.slice()}))}this.loading=!(this.loader_.length<4)&&this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_,i=e.forEachInExtent(t,function(e){if(ae(e.extent,t))return e});i&&e.remove(i)}removeFeatures(t){let e=!1;for(let i=0,n=t.length;i<n;++i)e=this.removeFeatureInternal(t[i])||e;e&&this.changed()}removeFeature(t){if(!t)return;this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=B(t);if(!(e in this.uidIndex_))return!1;e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t);const i=this.featureChangeKeys_[e];i?.forEach(G),delete this.featureChangeKeys_[e];const n=t.getId();if(void 0!==n){const e=n.toString(),i=this.idIndex_[e];i===t?delete this.idIndex_[e]:Array.isArray(i)&&(i.splice(i.indexOf(t),1),1===i.length&&(this.idIndex_[e]=i[0]))}return delete this.uidIndex_[e],this.hasListener(ac)&&this.dispatchEvent(new uc(ac,t)),!0}removeFromIdIndex_(t){for(const e in this.idIndex_)if(this.idIndex_[e]===t){delete this.idIndex_[e];break}}setLoader(t){this.loader_=t}setUrl(t){wt(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(Zl(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}};const gc=class extends dc{constructor(t){super({attributions:(t=t||{}).attributions,wrapX:t.wrapX}),this.resolution=void 0,this.distance=void 0!==t.distance?t.distance:20,this.minDistance=t.minDistance||0,this.interpolationRatio=0,this.features=[],this.geometryFunction=t.geometryFunction||function(t){const e=t.getGeometry();return wt(!e||"Point"===e.getType(),"The default `geometryFunction` can only handle `Point` or null geometries"),e},this.createCustomCluster_=t.createCluster,this.source=null,this.boundRefresh_=this.refresh.bind(this),this.updateDistance(this.distance,this.minDistance),this.setSource(t.source||null)}clear(t){this.features.length=0,super.clear(t)}getDistance(){return this.distance}getSource(){return this.source}loadFeatures(t,e,i){this.source?.loadFeatures(t,e,i),e!==this.resolution&&(this.resolution=e,this.refresh())}setDistance(t){this.updateDistance(t,this.minDistance)}setMinDistance(t){this.updateDistance(this.distance,t)}getMinDistance(){return this.minDistance}setSource(t){this.source&&this.source.removeEventListener(l,this.boundRefresh_),this.source=t,t&&t.addEventListener(l,this.boundRefresh_),this.refresh()}refresh(){this.clear(),this.cluster(),this.addFeatures(this.features)}updateDistance(t,e){const i=0===t?0:Math.min(e,t)/t,n=t!==this.distance||this.interpolationRatio!==i;this.distance=t,this.minDistance=e,this.interpolationRatio=i,n&&this.refresh()}cluster(){if(void 0===this.resolution||!this.source)return;const t=[1/0,1/0,-1/0,-1/0],e=this.distance*this.resolution,i=this.source.getFeatures(),n={};for(let s=0,r=i.length;s<r;s++){const r=i[s];if(!(B(r)in n)){const i=this.geometryFunction(r);if(i){re(i.getCoordinates(),t),Ht(t,e,t);const s=this.source.getFeaturesInExtent(t).filter(function(t){const e=B(t);return!(e in n)&&(n[e]=!0,!0)});this.features.push(this.createCluster(s,t))}}}}createCluster(t,e){const i=[0,0];for(let e=t.length-1;e>=0;--e){const n=this.geometryFunction(t[e]);n?Fe(i,n.getCoordinates()):t.splice(e,1)}ke(i,1/t.length);const n=pe(e),s=this.interpolationRatio,r=new Zn([i[0]*(1-s)+n[0]*s,i[1]*(1-s)+n[1]*s]);return this.createCustomCluster_?this.createCustomCluster_(r,t):new jl({geometry:r,features:t})}};const _c=class extends k{constructor(t,e,i){super(),i=i||{},this.tileCoord=t,this.state=e,this.key="",this.transition_=void 0===i.transition?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(l)}release(){this.setState(Ct)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==Ct){if(this.state!==vt&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){N()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(i){if(-1===i)return 1}else i=e,this.transitionStarts_[t]=i;const n=e-i+1e3/60;return n>=this.transition_?1:ze(n/this.transition_)}inTransition(t){return!!this.transition_&&-1!==this.transitionStarts_[t]}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}disposeInternal(){this.release(),super.disposeInternal()}};const fc=class extends _c{constructor(t,e,i,n,s,r){super(t,e,r),this.crossOrigin_=n,this.src_=i,this.key=i,this.image_,et?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,null!==n&&(this.image_.crossOrigin=n)),this.unlisten_=null,this.tileLoadFunction_=s}getImage(){return this.image_}setImage(t){this.image_=t,this.state=xt,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}handleImageError_(){this.state=vt,this.unlistenImage_(),this.image_=function(){const t=Fs(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}(),this.changed()}handleImageLoad_(){if(et)this.state=xt;else{const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=xt:this.state=Ct}this.unlistenImage_(),this.changed()}load(){this.state==vt&&(this.state=mt,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==mt&&(this.state=yt,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=function(t,e,i){const n=t;let s=!0,r=!1,o=!1;const a=[O(n,p,function(){o=!0,r||e()})];return n.src&&it?(r=!0,n.decode().then(function(){s&&e()}).catch(function(t){s&&(o?e():i())})):a.push(O(n,c,i)),function(){s=!1,a.forEach(G)}}(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}};let pc;const mc=[];function yc(t,e,i,n,s){t.beginPath(),t.moveTo(0,0),t.lineTo(e,i),t.lineTo(n,s),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,n)+1,Math.max(i,s)),t.restore()}function xc(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function vc(t,e,i,n){const s=tn(i,e,t);let r=Vi(e,n,i);const o=e.getMetersPerUnit();void 0!==o&&(r*=o);const a=t.getMetersPerUnit();void 0!==a&&(r/=a);const h=t.getExtent();if(!h||Jt(h,s)){const e=Vi(t,r,s)/r;isFinite(e)&&e>0&&(r/=e)}return r}function Cc(t,e,i,n,s,r,o,a,h,l,c,u,d,g){const _=Fs(Math.round(i*t),Math.round(i*e),mc);if(u||(_.imageSmoothingEnabled=!1),0===h.length)return _.canvas;function f(t){return Math.round(t*i)/i}_.scale(i,i),_.globalCompositeOperation="lighter";const p=[1/0,1/0,-1/0,-1/0];let m;h.forEach(function(t,e,i){he(p,t.extent)});const y=i/n,x=(u?1:1+Math.pow(2,-24))/y;if(!d||1!==h.length||0!==l){if(m=Fs(Math.round(Ee(p)*y),Math.round(ve(p)*y),mc),u||(m.imageSmoothingEnabled=!1),s&&g){const t=(s[0]-p[0])*y,e=-(s[3]-p[3])*y,i=Ee(s)*y,n=ve(s)*y;m.rect(t,e,i,n),m.clip()}h.forEach(function(t,e,i){if(t.image.width>0&&t.image.height>0){if(t.clipExtent){m.save();const e=(t.clipExtent[0]-p[0])*y,i=-(t.clipExtent[3]-p[3])*y,n=Ee(t.clipExtent)*y,s=ve(t.clipExtent)*y;m.rect(u?e:Math.round(e),u?i:Math.round(i),u?n:Math.round(e+n)-Math.round(e),u?s:Math.round(i+s)-Math.round(i)),m.clip()}const e=(t.extent[0]-p[0])*y,i=-(t.extent[3]-p[3])*y,n=Ee(t.extent)*y,s=ve(t.extent)*y;m.drawImage(t.image,l,l,t.image.width-2*l,t.image.height-2*l,u?e:Math.round(e),u?i:Math.round(i),u?n:Math.round(e+n)-Math.round(e),u?s:Math.round(i+s)-Math.round(i)),t.clipExtent&&m.restore()}})}const v=we(o);return a.getTriangles().forEach(function(t,e,i){const n=t.source,s=t.target;let o=n[0][0],a=n[0][1],l=n[1][0],c=n[1][1],d=n[2][0],g=n[2][1];const y=f((s[0][0]-v[0])/r),C=f(-(s[0][1]-v[1])/r),w=f((s[1][0]-v[0])/r),S=f(-(s[1][1]-v[1])/r),E=f((s[2][0]-v[0])/r),I=f(-(s[2][1]-v[1])/r),T=o,R=a;o=0,a=0,l-=T,c-=R,d-=T,g-=R;const M=function(t){const e=t.length;for(let i=0;i<e;i++){let n=i,s=Math.abs(t[i][i]);for(let r=i+1;r<e;r++){const e=Math.abs(t[r][i]);e>s&&(s=e,n=r)}if(0===s)return null;const r=t[n];t[n]=t[i],t[i]=r;for(let n=i+1;n<e;n++){const s=-t[n][i]/t[i][i];for(let r=i;r<e+1;r++)i==r?t[n][r]=0:t[n][r]+=s*t[i][r]}}const i=new Array(e);for(let n=e-1;n>=0;n--){i[n]=t[n][e]/t[n][n];for(let s=n-1;s>=0;s--)t[s][e]-=t[s][n]*i[n]}return i}([[l,c,0,0,w-y],[d,g,0,0,E-y],[0,0,l,c,S-C],[0,0,d,g,I-C]]);if(!M)return;if(_.save(),_.beginPath(),function(){if(void 0===pc){const t=Fs(6,6,mc);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",yc(t,4,5,4,0),yc(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;pc=xc(e,0)||xc(e,4)||xc(e,8),As(t),mc.push(t.canvas)}return pc}()||!u){_.moveTo(w,S);const t=4,e=y-w,i=C-S;for(let n=0;n<t;n++)_.lineTo(w+f((n+1)*e/t),S+f(n*i/(t-1))),n!=t-1&&_.lineTo(w+f((n+1)*e/t),S+f((n+1)*i/(t-1)));_.lineTo(E,I)}else _.moveTo(w,S),_.lineTo(y,C),_.lineTo(E,I);let P;if(_.clip(),_.transform(M[0],M[2],M[1],M[3],y,C),_.translate(p[0]-T,p[3]-R),m)P=m.canvas,_.scale(x,-x);else{const t=h[0],e=t.extent;P=t.image,_.scale(Ee(e)/P.width,-ve(e)/P.height)}_.drawImage(P,0,0),_.restore()}),m&&(As(m),mc.push(m.canvas)),c&&(_.save(),_.globalCompositeOperation="source-over",_.strokeStyle="black",_.lineWidth=1,a.getTriangles().forEach(function(t,e,i){const n=t.target,s=(n[0][0]-v[0])/r,o=-(n[0][1]-v[1])/r,a=(n[1][0]-v[0])/r,h=-(n[1][1]-v[1])/r,l=(n[2][0]-v[0])/r,c=-(n[2][1]-v[1])/r;_.beginPath(),_.moveTo(a,h),_.lineTo(s,o),_.lineTo(l,c),_.closePath(),_.stroke()}),_.restore()),_.canvas}const wc=class{constructor(t,e,i,n,s,r,o){this.sourceProj_=t,this.targetProj_=e;let a={};const h=o?Zi(t=>gn(o,tn(t,this.targetProj_,this.sourceProj_))):Qi(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){const e=t[0]+"/"+t[1];return a[e]||(a[e]=h(t)),a[e]},this.maxSourceExtent_=n,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&Ee(n)>=Ee(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Ee(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?Ee(this.targetProj_.getExtent()):null;const l=we(i),c=Se(i),u=fe(i),d=_e(i),g=this.transformInv_(l),_=this.transformInv_(c),f=this.transformInv_(u),p=this.transformInv_(d),m=10+(r?Math.max(0,Math.ceil(Math.log2(ge(i)/(r*r*256*256)))):0);if(this.addQuad_(l,c,u,d,g,_,f,p,m),this.wrapsXInSource_){let t=1/0;this.triangles_.forEach(function(e,i,n){t=Math.min(t,e.source[0][0],e.source[1][0],e.source[2][0])}),this.triangles_.forEach(e=>{if(Math.max(e.source[0][0],e.source[1][0],e.source[2][0])-t>this.sourceWorldWidth_/2){const i=[[e.source[0][0],e.source[0][1]],[e.source[1][0],e.source[1][1]],[e.source[2][0],e.source[2][1]]];i[0][0]-t>this.sourceWorldWidth_/2&&(i[0][0]-=this.sourceWorldWidth_),i[1][0]-t>this.sourceWorldWidth_/2&&(i[1][0]-=this.sourceWorldWidth_),i[2][0]-t>this.sourceWorldWidth_/2&&(i[2][0]-=this.sourceWorldWidth_);const n=Math.min(i[0][0],i[1][0],i[2][0]);Math.max(i[0][0],i[1][0],i[2][0])-n<this.sourceWorldWidth_/2&&(e.source=i)}})}a={}}addTriangle_(t,e,i,n,s,r){this.triangles_.push({source:[n,s,r],target:[t,e,i]})}addQuad_(t,e,i,n,s,r,o,a,h){const l=Ut([s,r,o,a]),c=this.sourceWorldWidth_?Ee(l)/this.sourceWorldWidth_:null,u=this.sourceWorldWidth_,d=this.sourceProj_.canWrapX()&&c>.5&&c<1;let g=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){g=Ee(Ut([t,e,i,n]))/this.targetWorldWidth_>.25||g}!d&&this.sourceProj_.isGlobal()&&c&&(g=c>.25||g)}if(!g&&this.maxSourceExtent_&&isFinite(l[0])&&isFinite(l[1])&&isFinite(l[2])&&isFinite(l[3])&&!Ie(l,this.maxSourceExtent_))return;let _=0;if(!(g||isFinite(s[0])&&isFinite(s[1])&&isFinite(r[0])&&isFinite(r[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])))if(h>0)g=!0;else if(_=(isFinite(s[0])&&isFinite(s[1])?0:8)+(isFinite(r[0])&&isFinite(r[1])?0:4)+(isFinite(o[0])&&isFinite(o[1])?0:2)+(isFinite(a[0])&&isFinite(a[1])?0:1),1!=_&&2!=_&&4!=_&&8!=_)return;if(h>0){if(!g){const e=[(t[0]+i[0])/2,(t[1]+i[1])/2],n=this.transformInv_(e);let r;if(d){r=(kt(s[0],u)+kt(o[0],u))/2-kt(n[0],u)}else r=(s[0]+o[0])/2-n[0];const a=(s[1]+o[1])/2-n[1];g=r*r+a*a>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const l=[(e[0]+i[0])/2,(e[1]+i[1])/2],c=this.transformInv_(l),u=[(n[0]+t[0])/2,(n[1]+t[1])/2],d=this.transformInv_(u);this.addQuad_(t,e,l,u,s,r,c,d,h-1),this.addQuad_(u,l,i,n,d,c,o,a,h-1)}else{const l=[(t[0]+e[0])/2,(t[1]+e[1])/2],c=this.transformInv_(l),u=[(i[0]+n[0])/2,(i[1]+n[1])/2],d=this.transformInv_(u);this.addQuad_(t,l,u,n,s,c,d,a,h-1),this.addQuad_(l,e,i,u,c,r,o,d,h-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}11&_||this.addTriangle_(t,i,n,s,o,a),14&_||this.addTriangle_(t,i,e,s,o,r),_&&(13&_||this.addTriangle_(e,n,t,r,a,s),7&_||this.addTriangle_(e,n,i,r,a,o))}calculateSourceExtent(){const t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach(function(e,i,n){const s=e.source;le(t,s[0]),le(t,s[1]),le(t,s[2])}),t}getTriangles(){return this.triangles_}};const Sc=class extends _c{constructor(t,e,i,n,s,r,o,a,h,l,c,u){super(s,mt,u),this.renderEdges_=void 0!==c&&c,this.pixelRatio_=o,this.gutter_=a,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=n,this.wrappedTileCoord_=r||s,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;const d=n.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let _=this.sourceTileGrid_.getExtent();const f=g?Ce(d,g):d;if(0===ge(f))return void(this.state=Ct);const p=t.getExtent();p&&(_=_?Ce(_,p):p);const m=n.getResolution(this.wrappedTileCoord_[0]),y=function(t,e,i,n){const s=pe(i);let r=vc(t,e,s,n);return(!isFinite(r)||r<=0)&&de(i,function(i){return r=vc(t,e,i,n),isFinite(r)&&r>0}),r}(t,i,f,m);if(!isFinite(y)||y<=0)return void(this.state=Ct);const x=void 0!==l?l:.5;if(this.triangulation_=new wc(t,i,f,_,y*x,m),0===this.triangulation_.getTriangles().length)return void(this.state=Ct);this.sourceZ_=e.getZForResolution(y);let v=this.triangulation_.calculateSourceExtent();if(_&&(t.canWrapX()?(v[1]=Pt(v[1],_[1],_[3]),v[3]=Pt(v[3],_[1],_[3])):v=Ce(v,_)),ge(v)){let i=0,n=0;t.canWrapX()&&(i=Ee(p),n=Math.floor((v[0]-p[0])/i));Pe(v.slice(),t,!0).forEach(t=>{const s=e.getTileRangeForExtentAndZ(t,this.sourceZ_);for(let t=s.minX;t<=s.maxX;t++)for(let e=s.minY;e<=s.maxY;e++){const s=h(this.sourceZ_,t,e,o);if(s){const t=n*i;this.sourceTiles_.push({tile:s,offset:t})}}++n}),0===this.sourceTiles_.length&&(this.state=Ct)}else this.state=Ct}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{const i=e.tile;if(i&&i.getState()==xt){const n=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);n[0]+=e.offset,n[2]+=e.offset;const s=this.clipExtent_?.slice();s&&(s[0]+=e.offset,s[2]+=e.offset),t.push({extent:n,clipExtent:s,image:i.getImage()})}}),this.sourceTiles_.length=0,0===t.length)this.state=vt;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),n="number"==typeof i?i:i[0],s="number"==typeof i?i:i[1],r=this.targetTileGrid_.getResolution(e),o=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Cc(n,s,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),r,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=xt}this.changed()}load(){if(this.state==mt){this.state=yt,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{const i=e.getState();if(i==mt||i==yt){t++;const i=D(e,l,n=>{const s=e.getState();s!=xt&&s!=vt&&s!=Ct||(G(i),t--,0===t&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(i)}}),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:t},e,i){t.getState()==mt&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(G),this.sourcesListenerKeys_=null}release(){this.canvas_&&(As(this.canvas_.getContext("2d")),mc.push(this.canvas_),this.canvas_=null),super.release()}};function Ec(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function Ic(t,e,i){return t+"/"+e+"/"+i}function Tc(t,e,i,n,s){return`${B(t)},${e},${Ic(i,n,s)}`}class Rc{constructor(t,e,i,n){this.minX=t,this.maxX=e,this.minY=i,this.maxY=n}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function Mc(t,e,i,n,s){return void 0!==s?(s.minX=t,s.maxX=e,s.minY=i,s.maxY=n,s):new Rc(t,e,i,n)}const Pc=Rc,Fc=[0,0,0];const bc=class{constructor(t){let e;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,wt(function(t,e,i){const n=e||v;return t.every(function(e,s){if(0===s)return!0;const r=n(t[s-1],e);return!(r>0||i&&0===r)})}(this.resolutions_,(t,e)=>e-t,!0),"`resolutions` must be sorted in descending order"),!t.origins)for(let t=0,i=this.resolutions_.length-1;t<i;++t)if(e){if(this.resolutions_[t]/this.resolutions_[t+1]!==e){e=void 0;break}}else e=this.resolutions_[t]/this.resolutions_[t+1];this.zoomFactor_=e,this.maxZoom=this.resolutions_.length-1,this.origin_=void 0!==t.origin?t.origin:null,this.origins_=null,void 0!==t.origins&&(this.origins_=t.origins,wt(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const i=t.extent;void 0===i||this.origin_||this.origins_||(this.origin_=we(i)),wt(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,void 0!==t.tileSizes&&(this.tileSizes_=t.tileSizes,wt(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=void 0!==t.tileSize?t.tileSize:this.tileSizes_?null:ms,wt(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=void 0!==i?i:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],void 0!==t.sizes?this.fullTileRanges_=t.sizes.map((t,e)=>{const n=new Pc(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1));if(i){const t=this.getTileRangeForExtentAndZ(i,e);n.minX=Math.max(t.minX,n.minX),n.maxX=Math.min(t.maxX,n.maxX),n.minY=Math.max(t.minY,n.minY),n.maxY=Math.min(t.maxY,n.maxY)}return n}):i&&this.calculateTileRanges_(i)}forEachTileCoord(t,e,i){const n=this.getTileRangeForExtentAndZ(t,e);for(let t=n.minX,s=n.maxX;t<=s;++t)for(let s=n.minY,r=n.maxY;s<=r;++s)i([e,t,s])}forEachTileCoordParentTileRange(t,e,i,n){let s,r,o,a=null,h=t[0]-1;for(2===this.zoomFactor_?(r=t[1],o=t[2]):a=this.getTileCoordExtent(t,n);h>=this.minZoom;){if(void 0!==r&&void 0!==o?(r=Math.floor(r/2),o=Math.floor(o/2),s=Mc(r,r,o,o,i)):s=this.getTileRangeForExtentAndZ(a,h,i),e(h,s))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(2===this.zoomFactor_){const i=2*t[1],n=2*t[2];return Mc(i,i+1,n,n+1,e)}const n=this.getTileCoordExtent(t,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(n,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,i){if(e>this.maxZoom||e<this.minZoom)return null;const n=t[0],s=t[1],r=t[2];if(e===n)return Mc(s,r,s,r,i);if(this.zoomFactor_){const t=Math.pow(this.zoomFactor_,e-n),o=Math.floor(s*t),a=Math.floor(r*t);if(e<n)return Mc(o,o,a,a,i);return Mc(o,Math.floor(t*(s+1))-1,a,Math.floor(t*(r+1))-1,i)}const o=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(o,e,i)}getTileRangeForExtentAndZ(t,e,i){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,Fc);const n=Fc[1],s=Fc[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,Fc);return Mc(n,Fc[1],s,Fc[2],i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),n=zo(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*n[0]*i,e[1]-(t[2]+.5)*n[1]*i]}getTileCoordExtent(t,e){const i=this.getOrigin(t[0]),n=this.getResolution(t[0]),s=zo(this.getTileSize(t[0]),this.tmpSize_),r=i[0]+t[1]*s[0]*n,o=i[1]-(t[2]+1)*s[1]*n;return ne(r,o,r+s[0]*n,o+s[1]*n,e)}getTileCoordForCoordAndResolution(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,i)}getTileCoordForXYAndResolution_(t,e,i,n,s){const r=this.getZForResolution(i),o=i/this.getResolution(r),a=this.getOrigin(r),h=zo(this.getTileSize(r),this.tmpSize_);let l=o*(t-a[0])/i/h[0],c=o*(a[1]-e)/i/h[1];return n?(l=zt(l,5)-1,c=zt(c,5)-1):(l=Gt(l,5),c=Gt(c,5)),Ec(r,l,c,s)}getTileCoordForXYAndZ_(t,e,i,n,s){const r=this.getOrigin(i),o=this.getResolution(i),a=zo(this.getTileSize(i),this.tmpSize_);let h=(t-r[0])/o/a[0],l=(r[1]-e)/o/a[1];return n?(h=zt(h,5)-1,l=zt(l,5)-1):(h=Gt(h,5),l=Gt(l,5)),Ec(i,h,l,s)}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){return Pt(w(this.resolutions_,t,e||0),this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return es(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,i=new Array(e);for(let n=this.minZoom;n<e;++n)i[n]=this.getTileRangeForExtentAndZ(t,n);this.fullTileRanges_=i}};function Lc(t){let e=t.getDefaultTileGrid();return e||(e=function(t,e,i,n){const s=kc(t);return function(t,e,i,n){n=void 0!==n?n:"top-left";const s=Ac(t,e,i);return new bc({extent:t,origin:me(t,n),resolutions:s,tileSize:i})}(s,e,i,n)}(t),t.setDefaultTileGrid(e)),e}function Ac(t,e,i,n){e=void 0!==e?e:42,i=zo(void 0!==i?i:ms);const s=ve(t),r=Ee(t);n=n>0?n:Math.max(r/i[0],s/i[1]);const o=e+1,a=new Array(o);for(let t=0;t<o;++t)a[t]=n/Math.pow(2,t);return a}function kc(t){let e=(t=Ki(t)).getExtent();if(!e){const i=180*je.degrees/t.getMetersPerUnit();e=ne(-i,-i,i,i)}return e}const Dc=/\{z\}/g,Oc=/\{x\}/g,Gc=/\{y\}/g,zc=/\{-y\}/g;function Wc(t,e){return function(i,n,s){if(!i)return;let r;const o=i[0];if(e){const t=e.getFullTileRange(o);t&&(r=t.getHeight()-1)}return function(t,e,i,n,s){return t.replace(Dc,e.toString()).replace(Oc,i.toString()).replace(Gc,n.toString()).replace(zc,function(){if(void 0===s)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(s-n).toString()})}(t,o,i[1],i[2],r)}}function Nc(t,e){const i=t.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=Wc(t[s],e);return function(t){if(1===t.length)return t[0];return function(e,i,n){if(!e)return;const s=function(t){return e=t[0],i=t[1],n=t[2],(i<<e)+n;var e,i,n}(e),r=kt(s,t.length);return t[r](e,i,n)}}(n)}class Xc extends A{constructor(t,e){super(t),this.tile=e}}const Bc=class extends nc{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:t.projection,state:t.state,wrapX:t.wrapX,interpolate:t.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=void 0!==t.tilePixelRatio?t.tilePixelRatio:1,this.tileGrid=void 0!==t.tileGrid?t.tileGrid:null;const e=[256,256];this.tileGrid&&zo(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tmpSize=[0,0],this.key_=t.key||B(this),this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,n,s,r){return N()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:Lc(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const n=this.getTileGridForProjection(i),s=this.getTilePixelRatio(e),r=zo(n.getTileSize(t),this.tmpSize);return 1==s?r:(o=r,a=s,void 0===(h=this.tmpSize)&&(h=[0,0]),h[0]=o[0]*a+.5|0,h[1]=o[1]*a+.5|0,h);var o,a,h}getTileCoordForTileUrlFunction(t,e){const i=void 0!==e?e:this.getProjection(),n=void 0!==e?this.getTileGridForProjection(i):this.tileGrid||this.getTileGridForProjection(i);return this.getWrapX()&&i.isGlobal()&&(t=function(t,e,i){const n=e[0],s=t.getTileCoordCenter(e),r=kc(i);if(!Jt(r,s)){const e=Ee(r),i=Math.ceil((r[0]-s[0])/e);return s[0]+=e*i,t.getTileCoordForCoordAndZ(s,n)}return e}(n,t,i)),function(t,e){const i=t[0],n=t[1],s=t[2];if(e.getMinZoom()>i||i>e.getMaxZoom())return!1;const r=e.getFullTileRange(i);return!r||r.containsXY(n,s)}(t,n)?t:null}clear(){}refresh(){this.clear(),super.refresh()}},Kc="tileloadstart",Vc="tileloadend",jc="tileloaderror";class Yc extends Bc{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===Yc.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),n=e.getState();let s;n==yt?(this.tileLoadingKeys_[i]=!0,s=Kc):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],s=n==vt?jc:n==xt?Vc:void 0),null!=s&&this.dispatchEvent(new Xc(s,e))}setTileLoadFunction(t){this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,void 0!==e?this.setKey(e):this.changed()}setUrl(t){const e=function(t){const e=[];let i=/\{([a-z])-([a-z])\}/.exec(t);if(i){const n=i[1].charCodeAt(0),s=i[2].charCodeAt(0);let r;for(r=n;r<=s;++r)e.push(t.replace(i[0],String.fromCharCode(r)));return e}if(i=/\{(\d+)-(\d+)\}/.exec(t),i){const n=parseInt(i[2],10);for(let s=parseInt(i[1],10);s<=n;s++)e.push(t.replace(i[0],s.toString()));return e}return e.push(t),e}(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(Nc(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}}const Zc=Yc;function Uc(t,e){if(et){const i=t.getCrossOrigin();let n="same-origin",s="same-origin";return"anonymous"===i||""===i?(n="cors",s="omit"):"use-credentials"===i&&(n="cors",s="include"),void fetch(e,{mode:n,credentials:s}).then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.blob()}).then(t=>createImageBitmap(t)).then(e=>{const i=t.getImage();i.width=e.width,i.height=e.height;i.getContext("2d").drawImage(e,0,0),e.close?.(),i.dispatchEvent(new Event("load"))}).catch(()=>{t.getImage().dispatchEvent(new Event("error"))})}t.getImage().src=e}const Hc=class extends Zc{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:Uc,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:void 0===t.interpolate||t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=void 0!==t.crossOrigin?t.crossOrigin:null,this.tileClass=void 0!==t.tileClass?t.tileClass:fc,this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(t){return this.getProjection()&&t&&!qi(this.getProjection(),t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||qi(e,t)))return this.tileGrid;const i=B(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=Lc(t)),this.tileGridForProjection[i]}createTile_(t,e,i,n,s,r){const o=[t,e,i],a=this.getTileCoordForTileUrlFunction(o,s),h=a?this.tileUrlFunction(a,n,s):void 0,c=new this.tileClass(o,void 0!==h?mt:Ct,void 0!==h?h:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return c.key=r,c.addEventListener(l,this.handleTileChange.bind(this)),c}getTile(t,e,i,n,s,r){const o=this.getProjection();if(!o||!s||qi(o,s))return this.getTileInternal(t,e,i,n,o||s);const a=[t,e,i],h=this.getKey(),l=this.getTileGridForProjection(o),c=this.getTileGridForProjection(s),u=this.getTileCoordForTileUrlFunction(a,s),d=new Sc(o,l,s,c,a,u,this.getTilePixelRatio(n),this.getGutter(),(t,e,i,n)=>this.getTileInternal(t,e,i,n,o,r),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return d.key=h,d}getTileInternal(t,e,i,n,s,r){const o=this.getKey(),a=Tc(this,o,t,e,i);if(r&&r.containsKey(a)){return r.get(a)}const h=this.createTile_(t,e,i,n,s,o);return r?.set(a,h),h}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){const i=Ki(t);if(i){const t=B(i);t in this.tileGridForProjection||(this.tileGridForProjection[t]=e)}}};const qc=class extends Hc{constructor(t){const e=void 0!==(t=t||{}).projection?t.projection:"EPSG:3857",i=void 0!==t.tileGrid?t.tileGrid:function(t){const e=t||{},i=e.extent||Ki("EPSG:3857").getExtent(),n={extent:i,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:Ac(i,e.maxZoom,e.tileSize,e.maxResolution)};return new bc(n)}({extent:kc(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,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.gutter_=void 0!==t.gutter?t.gutter:0}getGutter(){return this.gutter_}};const $c=class extends qc{constructor(t){let e;e=void 0!==(t=t||{}).attributions?t.attributions:['&#169; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.'];const i=void 0!==t.crossOrigin?t.crossOrigin:"anonymous",n=void 0!==t.url?t.url:"https://tile.openstreetmap.org/{z}/{x}/{y}.png";super({attributions:e,attributionsCollapsible:!1,cacheSize:t.cacheSize,crossOrigin:i,interpolate:t.interpolate,maxZoom:void 0!==t.maxZoom?t.maxZoom:19,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileLoadFunction:(e,i)=>{const n=e.getImage();!et&&n instanceof HTMLImageElement&&(n.referrerPolicy="origin-when-cross-origin"),(t.tileLoadFunction||Uc)(e,i)},transition:t.transition,url:n,wrapX:t.wrapX,zDirection:t.zDirection})}};function Jc(t){return t instanceof Image||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageBitmap?t:null}const Qc=new Error("disposed");const tu=[256,256];const eu=class extends _c{constructor(t){const e=mt;super(t.tileCoord,e,{transition:t.transition,interpolate:t.interpolate}),this.loader_=t.loader,this.data_=null,this.error_=null,this.size_=t.size||null,this.controller_=t.controller||null}getSize(){if(this.size_)return this.size_;const t=Jc(this.data_);return t?[t.width,t.height]:tu}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==mt&&this.state!==vt)return;this.state=yt,this.changed();const t=this;this.loader_().then(function(e){t.data_=e,t.state=xt,t.changed()}).catch(function(e){t.error_=e,t.state=vt,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(Qc),this.controller_=null),super.disposeInternal()}};const iu=class{constructor(t){this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const t=this.pop();t instanceof x&&t.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const i=this.entries_[t];return wt(void 0!==i,"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 wt(void 0!==e,"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,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.key_;return t}getValues(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(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){wt(!(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 nu=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(Ls(),{get:(t,e)=>{if("function"==typeof Ls()[e])return this.push_(e),this.pushMethodArgs_},set:(t,e,i)=>(this.push_(e,i),!0)})}push_(...t){const e=this.instructions_,i=this.zIndex+this.offset_;e[i]||(e[i]=[]),e[i].push(...t)}pushMethodArgs_=(...t)=>(this.push_(t),this);pushFunction(t){this.push_(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach(e=>{for(let i=0,n=e.length;i<n;++i){const n=e[i];if("function"==typeof n){n(t);continue}const s=e[++i];if("function"==typeof t[n])t[n](...s);else{if("function"==typeof s){t[n]=s(t);continue}t[n]=s}}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}};const su=class extends W{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=5}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return N()}getData(t){return null}prepareFrame(t){return N()}renderFrame(t,e){return N()}forEachFeatureAtCoordinate(t,e,i,n,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;e.getState()!==uh&&e.getState()!==dh||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=uh&&e!=dh&&t.addEventListener(l,this.boundHandleImageChange_),e==lh&&(t.load(),e=t.getState()),e==uh}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}},ru=[];let ou=null;const au=class extends su{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=[1,0,0,1,0,0],this.pixelTransform=[1,0,0,1,0,0],this.inversePixelTransform=[1,0,0,1,0,0],this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){let n;ou||(ou=Fs(1,1,void 0,{willReadFrequently:!0})),ou.clearRect(0,0,1,1);try{ou.drawImage(t,e,i,1,1,0,0,1,1),n=ou.getImageData(0,0,1,1).data}catch{return ou=null,null}return n}getBackground(t){let e=this.getLayer().getBackground();return"function"==typeof e&&(e=e(t.viewState.resolution)),e||void 0}useContainer(t,e,i){const n=this.getLayer().getClassName();let s,r;if(t&&t.className===n&&(!i||t&&t.style.backgroundColor&&I(Do(t.style.backgroundColor),Do(i)))){const e=t.firstElementChild;Ws(e)&&(r=e.getContext("2d"))}if(r&&function(t,e){const i=yn(t),n=yn(e);for(let t=0;t<6;++t)if(0!==Math.round((i[t]-n[t])*pn[t]))return!1;return!0}(r.canvas.style.transform,e)?(this.container=t,this.context=r,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){s=et?zs():document.createElement("div"),s.className=n;let t=s.style;t.position="absolute",t.width="100%",t.height="100%",r=Fs();const e=r.canvas;s.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=s,this.context=r}this.containerReused||!i||this.container.style.backgroundColor||(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const n=we(i),s=Se(i),r=fe(i),o=_e(i);gn(e.coordinateToPixelTransform,n),gn(e.coordinateToPixelTransform,s),gn(e.coordinateToPixelTransform,r),gn(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;gn(a,n),gn(a,s),gn(a,r),gn(a,o),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.clip()}prepareContainer(t,e){const i=t.extent,n=t.viewState.resolution,s=t.viewState.rotation,r=t.pixelRatio,o=Math.round(Ee(i)/n*r),a=Math.round(ve(i)/n*r);_n(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/r,1/r,s,-o/2,-a/2),fn(this.inversePixelTransform,this.pixelTransform);const h=mn(this.pixelTransform);if(this.useContainer(e,h,this.getBackground(t)),!this.containerReused){const t=this.context.canvas;t.width!=o||t.height!=a?(t.width=o,t.height=a):this.context.clearRect(0,0,o,a),h!==t.style.transform&&(t.style.transform=h)}}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const s=new Gl(t,this.inversePixelTransform,i,e);n.dispatchEvent(s)}}preRender(t,e){this.frameState=e,e.declutter||this.dispatchRenderEvent_(jr,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(Yr,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new nu),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(jr,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(Yr,this.context,t))}getRenderTransform(t,e,i,n,s,r,o){const a=s/2,h=r/2,l=n/e,c=-l,u=-t[0]+o,d=-t[1];return _n(this.tempTransform,a,h,l,c,-i,u,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}};function hu(t,e,i){if(!(i in t))return t[i]=new Set([e]),!0;const n=t[i],s=n.has(e);return s||n.add(e),!s}function lu(t,e,i){const n=t[i];return!!n&&n.delete(e)}function cu(t,e){const i=t.layerStatesArray[t.layerIndex];i.extent&&(e=Ce(e,hn(i.extent,t.viewState.projection)));const n=i.layer.getRenderSource();if(!n.getWrapX()){const i=n.getTileGridForProjection(t.viewState.projection).getExtent();i&&(e=Ce(e,i))}return e}const uu=class extends au{constructor(t,e){super(t),e=e||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=[1/0,1/0,-1/0,-1/0],this.tempTileRange_=new Pc(0,0,0,0),this.tempTileCoord_=Ec(0,0,0);const i=void 0!==e.cacheSize?e.cacheSize:512;this.tileCache_=new iu(i),this.sourceTileCache_=null,this.maxStaleKeys=.5*i}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new iu(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,n){const s=this.tileCache_,r=this.getLayer().getSource(),o=Tc(r,r.getKey(),t,e,i);let a;if(s.containsKey(o))a=s.get(o);else{const h=n.viewState.projection,l=r.getProjection();if(a=r.getTile(t,e,i,n.pixelRatio,h,!l||qi(l,h)?void 0:this.getSourceTileCache()),!a)return null;s.set(o,a)}return a}getTile(t,e,i,n){const s=this.getOrCreateTile(t,e,i,n);return s||null}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=gn(e.pixelToCoordinateTransform,t.slice()),s=i.getExtent();if(s&&!Jt(s,n))return null;const r=e.viewState,o=i.getRenderSource(),a=o.getTileGridForProjection(r.projection),h=o.getTilePixelRatio(e.pixelRatio);for(let t=a.getZForResolution(r.resolution);t>=a.getMinZoom();--t){const i=a.getTileCoordForCoordAndZ(n,t),s=this.getTile(t,i[1],i[2],e);if(!s||s.getState()!==xt)continue;const l=a.getOrigin(t),c=zo(a.getTileSize(t)),u=a.getResolution(t);let d;if(s instanceof fc||s instanceof Sc)d=s.getImage();else{if(!(s instanceof eu))continue;if(d=Jc(s.getData()),!d)continue}const g=Math.floor(h*((n[0]-l[0])/u-i[1]*c[0])),_=Math.floor(h*((l[1]-n[1])/u-i[2]*c[1])),f=Math.round(h*o.getGutterForProjection(r.projection));return this.getImageData(d,g+f,_+f)}return null}prepareFrame(t){this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;const e=this.getLayer().getSource();if(!e)return!1;const i=e.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==i&&(this.renderedSourceRevision_=i,this.renderedSourceKey_===e.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=i,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(t,e,i,n,s){const r=t.viewState,o=this.getLayer(),a=o.getRenderSource(),h=a.getTileGridForProjection(r.projection),l=B(a);l in t.wantedTiles||(t.wantedTiles[l]={});const c=t.wantedTiles[l],u=o.getMapInternal(),d=Math.max(i-s,h.getMinZoom(),h.getZForResolution(Math.min(o.getMaxResolution(),u?u.getView().getResolutionForZoom(Math.max(o.getMinZoom(),0)):h.getResolution(0)),a.zDirection)),g=r.rotation,_=g?xe(r.center,r.resolution,g,t.size):void 0;for(let s=i;s>=d;--s){const i=h.getTileRangeForExtentAndZ(e,s,this.tempTileRange_),r=h.getResolution(s);for(let e=i.minX;e<=i.maxX;++e)for(let o=i.minY;o<=i.maxY;++o){if(g&&!h.tileCoordIntersectsViewport([s,e,o],_))continue;const i=this.getTile(s,e,o,t);if(!i)continue;if(!hu(n,i,s))continue;const a=i.getKey();if(c[a]=!0,i.getState()===mt&&!t.tileQueue.isKeyQueued(a)){const n=Ec(s,e,o,this.tempTileCoord_);t.tileQueue.enqueue([i,l,h.getTileCoordCenter(n),r])}}}}findStaleTile_(t,e){const i=this.tileCache_,n=t[0],s=t[1],r=t[2],o=this.getStaleKeys();for(let t=0;t<o.length;++t){const a=Tc(this.getLayer().getSource(),o[t],n,s,r);if(i.containsKey(a)){const t=i.peek(a);if(t.getState()===xt)return t.endTransition(B(this)),hu(e,t,n),!0}}return!1}findAltTiles_(t,e,i,n){const s=t.getTileRangeForTileCoordAndZ(e,i,this.tempTileRange_);if(!s)return!1;let r=!0;const o=this.tileCache_,a=this.getLayer().getRenderSource(),h=a.getKey();for(let t=s.minX;t<=s.maxX;++t)for(let e=s.minY;e<=s.maxY;++e){const s=Tc(a,h,i,t,e);let l=!1;if(o.containsKey(s)){const t=o.peek(s);t.getState()===xt&&(hu(n,t,i),l=!0)}l||(r=!1)}return r}renderFrame(t,e){this.renderComplete=!0;const i=t.layerStatesArray[t.layerIndex],n=t.viewState,s=n.projection,r=n.resolution,o=n.center,a=t.pixelRatio,h=this.getLayer(),l=h.getSource(),c=l.getTileGridForProjection(s),u=c.getZForResolution(r,l.zDirection),d=c.getResolution(u),g=l.getKey();this.renderedSourceKey_?this.renderedSourceKey_!==g&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=g):this.renderedSourceKey_=g;let _=t.extent;const f=l.getTilePixelRatio(a);this.prepareContainer(t,e);const p=this.context.canvas.width,m=this.context.canvas.height,y=i.extent&&hn(i.extent,s);y&&(_=Ce(_,hn(i.extent,s)));const x=d*p/2/f,C=d*m/2/f,w=[o[0]-x,o[1]-C,o[0]+x,o[1]+C],S={};this.renderedTiles.length=0;const E=h.getPreload();if(t.nextExtent&&this.enqueueTilesForNextExtent()){const e=c.getZForResolution(n.nextResolution,l.zDirection),i=cu(t,t.nextExtent);this.enqueueTiles(t,i,e,S,E)}const I=cu(t,_);if(this.enqueueTiles(t,I,u,S,0),E>0&&setTimeout(()=>{this.enqueueTiles(t,I,u-1,S,E-1)},0),!(u in S))return this.container;const T=B(this),R=t.time;for(const e of S[u]){const i=e.getState();if(i===Ct)continue;const n=e.tileCoord;if(i===xt){if(1===e.getAlpha(T,R)){e.endTransition(T);continue}}i!==vt&&(this.renderComplete=!1);if(this.findStaleTile_(n,S)){lu(S,e,u),t.animate=!0;continue}if(this.findAltTiles_(c,n,u+1,S))continue;const s=c.getMinZoom();for(let t=u-1;t>=s;--t){if(this.findAltTiles_(c,n,t,S))break}}const M=d/r*a/f,P=this.getRenderContext(t);_n(this.tempTransform,p/2,m/2,M,M,0,-p/2,-m/2),i.extent&&this.clipUnrotated(P,t,y),l.getInterpolate()||(P.imageSmoothingEnabled=!1),this.preRender(P,t);const F=Object.keys(S).map(Number);let b;F.sort(v);const L=[],A=[];for(let e=F.length-1;e>=0;--e){const i=F[e],n=l.getTilePixelSize(i,a,s),r=c.getResolution(i)/d,o=n[0]*r*M,h=n[1]*r*M,u=c.getTileCoordForCoordAndZ(we(w),i),g=c.getTileCoordExtent(u),_=gn(this.tempTransform,[f*(g[0]-w[0])/d,f*(w[3]-g[3])/d]),p=f*l.getGutterForProjection(s);for(const e of S[i]){if(e.getState()!==xt)continue;const n=e.tileCoord,s=u[1]-n[1],r=Math.round(_[0]-(s-1)*o),a=u[2]-n[2],c=Math.round(_[1]-(a-1)*h),d=Math.round(_[0]-s*o),g=Math.round(_[1]-a*h),f=r-d,m=c-g,y=1===F.length;let x=!1;b=[d,g,d+f,g,d+f,g+m,d,g+m];for(let t=0,e=L.length;t<e;++t)if(!y&&i<A[t]){const e=L[t];Ie([d,g,d+f,g+m],[e[0],e[3],e[4],e[7]])&&(x||(P.save(),x=!0),P.beginPath(),P.moveTo(b[0],b[1]),P.lineTo(b[2],b[3]),P.lineTo(b[4],b[5]),P.lineTo(b[6],b[7]),P.moveTo(e[6],e[7]),P.lineTo(e[4],e[5]),P.lineTo(e[2],e[3]),P.lineTo(e[0],e[1]),P.clip())}L.push(b),A.push(i),this.drawTile(e,t,d,g,f,m,p,y),x&&P.restore(),this.renderedTiles.unshift(e),this.updateUsedTiles(t.usedTiles,l,e)}}if(this.renderedResolution=d,this.extentChanged=!this.renderedExtent_||!ae(this.renderedExtent_,w),this.renderedExtent_=w,this.renderedPixelRatio=a,this.postRender(this.context,t),i.extent&&P.restore(),P.imageSmoothingEnabled=!0,this.renderComplete){const e=(t,e)=>{const i=B(l),n=e.wantedTiles[i],s=n?Object.keys(n).length:0;this.updateCacheSize(s),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};t.postRenderFunctions.push(e)}return this.container}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,2*t)}drawTile(t,e,i,n,s,r,o,a){let h;if(t instanceof eu){if(h=Jc(t.getData()),!h)throw new Error("Rendering array data is not yet supported")}else h=this.getTileImage(t);if(!h)return;const l=this.getRenderContext(e),c=B(this),u=e.layerStatesArray[e.layerIndex],d=u.opacity*(a?t.getAlpha(c,e.time):1),g=d!==l.globalAlpha;g&&(l.save(),l.globalAlpha=d),l.drawImage(h,o,o,h.width-2*o,h.height-2*o,i,n,s,r),g&&l.restore(),d!==u.opacity?e.animate=!0:a&&t.endTransition(c)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}updateUsedTiles(t,e,i){const n=B(e);n in t||(t[n]={}),t[n][i.getKey()]=!0}},du="preload",gu="useInterimTilesOnError";const _u=class extends $r{constructor(t){t=t||{};const e=Object.assign({},t),i=t.cacheSize;delete t.cacheSize,delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=i,this.setPreload(void 0!==t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(du)}setPreload(t){this.set(du,t)}getUseInterimTilesOnError(){return this.get(gu)}setUseInterimTilesOnError(t){this.set(gu,t)}getData(t){return super.getData(t)}};const fu=class extends _u{constructor(t){super(t)}createRenderer(){return new uu(this,{cacheSize:this.getCacheSize()})}};const pu=class extends fh{constructor(t,e,i,n,s){super(t,e,i,void 0!==s?lh:uh),this.loader_=void 0!==s?s:null,this.canvas_=n,this.error_=null}getError(){return this.error_}handleLoad_(t){t?(this.error_=t,this.state=dh):this.state=uh,this.changed()}load(){this.state==lh&&(this.state=ch,this.changed(),this.loader_(this.handleLoad_.bind(this)))}getImage(){return this.canvas_}};const mu=class extends au{constructor(t){super(t),this.image=null}getImage(){return this.image?this.image.getImage():null}prepareFrame(t){const e=t.layerStatesArray[t.layerIndex],i=t.pixelRatio,n=t.viewState,s=n.resolution,r=this.getLayer().getSource(),o=t.viewHints;let a=t.extent;if(void 0!==e.extent&&(a=Ce(a,hn(e.extent,n.projection))),!o[Tt]&&!o[Rt]&&!Te(a))if(r){const t=n.projection,e=r.getImage(a,s,i,t);e&&(this.loadImage(e)?this.image=e:e.getState()===gh&&(this.image=null))}else this.image=null;return!!this.image}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=gn(e.pixelToCoordinateTransform,t.slice()),s=i.getExtent();if(s&&!Jt(s,n))return null;const r=this.image.getExtent(),o=this.image.getImage(),a=Ee(r),h=Math.floor(o.width*((n[0]-r[0])/a));if(h<0||h>=o.width)return null;const l=ve(r),c=Math.floor(o.height*((r[3]-n[1])/l));return c<0||c>=o.height?null:this.getImageData(o,h,c)}renderFrame(t,e){const i=this.image,n=i.getExtent(),s=i.getResolution(),[r,o]=Array.isArray(s)?s:[s,s],a=i.getPixelRatio(),h=t.layerStatesArray[t.layerIndex],l=t.pixelRatio,c=t.viewState,u=c.center,d=c.resolution,g=l*r/(d*a),_=l*o/(d*a);this.prepareContainer(t,e);const f=this.context.canvas.width,p=this.context.canvas.height,m=this.getRenderContext(t);let y=!1,x=!0;if(h.extent){const e=hn(h.extent,c.projection);x=Ie(e,t.extent),y=x&&!Qt(e,t.extent),y&&this.clipUnrotated(m,t,e)}const v=i.getImage(),C=_n(this.tempTransform,f/2,p/2,g,_,0,a*(n[0]-u[0])/r,a*(u[1]-n[3])/o);this.renderedResolution=o*l/a;const w=v.width*C[0],S=v.height*C[3];if(this.getLayer().getSource().getInterpolate()||(m.imageSmoothingEnabled=!1),this.preRender(m,t),x&&w>=.5&&S>=.5){const t=C[4],e=C[5],i=h.opacity;1!==i&&(m.save(),m.globalAlpha=i),m.drawImage(v,0,0,+v.width,+v.height,t,e,w,S),1!==i&&m.restore()}return this.postRender(this.context,t),y&&m.restore(),m.imageSmoothingEnabled=!0,this.container}};const yu=class{drawCustom(t,e,i,n,s){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}},xu={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},vu=[xu.FILL],Cu=[xu.STROKE],wu=[xu.BEGIN_PATH],Su=[xu.CLOSE_PATH],Eu=xu;const Iu=class extends yu{constructor(t,e,i,n){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=n,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return 1==e?t:t.map(function(t){return t*e})}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),n=this.tmpCoordinate_,s=this.coordinates;let r=s.length;for(let o=0,a=t.length;o<a;o+=e)n[0]=t[o],n[1]=t[o+1],Jt(i,n)&&(s[r++]=n[0],s[r++]=n[1]);return r}appendFlatLineCoordinates(t,e,i,n,s,r){const o=this.coordinates;let a=o.length;const h=this.getBufferedMaxExtent();r&&(e+=n);let l=t[e],c=t[e+1];const u=this.tmpCoordinate_;let d,g,_,f=!0;for(d=e+n;d<i;d+=n)u[0]=t[d],u[1]=t[d+1],_=ee(h,u),_!==g?(f&&(o[a++]=l,o[a++]=c,f=!1),o[a++]=u[0],o[a++]=u[1]):_===Kt?(o[a++]=u[0],o[a++]=u[1],f=!1):f=!0,l=u[0],c=u[1],g=_;return(s&&f||d===e+n)&&(o[a++]=l,o[a++]=c),a}drawCustomCoordinates_(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r],a=this.appendFlatLineCoordinates(t,e,o,n,!1,!1);s.push(a),e=o}return e}drawCustom(t,e,i,n,s){this.beginGeometry(t,e,s);const r=t.getType(),o=t.getStride(),a=this.coordinates.length;let h,l,c,u,d;switch(r){case"MultiPolygon":h=t.getOrientedFlatCoordinates(),u=[];const e=t.getEndss();d=0;for(let t=0,i=e.length;t<i;++t){const i=[];d=this.drawCustomCoordinates_(h,d,e[t],o,i),u.push(i)}this.instructions.push([Eu.CUSTOM,a,u,t,i,zn,s]),this.hitDetectionInstructions.push([Eu.CUSTOM,a,u,t,n||i,zn,s]);break;case"Polygon":case"MultiLineString":c=[],h="Polygon"==r?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),d=this.drawCustomCoordinates_(h,0,t.getEnds(),o,c),this.instructions.push([Eu.CUSTOM,a,c,t,i,Gn,s]),this.hitDetectionInstructions.push([Eu.CUSTOM,a,c,t,n||i,Gn,s]);break;case"LineString":case"Circle":h=t.getFlatCoordinates(),l=this.appendFlatLineCoordinates(h,0,h.length,o,!1,!1),this.instructions.push([Eu.CUSTOM,a,l,t,i,On,s]),this.hitDetectionInstructions.push([Eu.CUSTOM,a,l,t,n||i,On,s]);break;case"MultiPoint":h=t.getFlatCoordinates(),l=this.appendFlatPointCoordinates(h,o),l>a&&(this.instructions.push([Eu.CUSTOM,a,l,t,i,On,s]),this.hitDetectionInstructions.push([Eu.CUSTOM,a,l,t,n||i,On,s]));break;case"Point":h=t.getFlatCoordinates(),this.coordinates.push(h[0],h[1]),l=this.coordinates.length,this.instructions.push([Eu.CUSTOM,a,l,t,i,void 0,s]),this.hitDetectionInstructions.push([Eu.CUSTOM,a,l,t,n||i,void 0,s])}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[Eu.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[Eu.BEGIN_GEOMETRY,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;let e;t.reverse();const i=t.length;let n,s,r=-1;for(e=0;e<i;++e)n=t[e],s=n[0],s==Eu.END_GEOMETRY?r=e:s==Eu.BEGIN_GEOMETRY&&(n[2]=e,S(this.hitDetectionInstructions,r,e),r=-1)}fillStyleToState(t,e={}){if(t){const i=t.getColor();e.fillPatternScale=i&&"object"==typeof i&&"src"in i?this.pixelRatio:1,e.fillStyle=Sh(i||Ih)}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const i=t.getColor();e.strokeStyle=Sh(i||Ph);const n=t.getLineCap();e.lineCap=void 0!==n?n:Th;const s=t.getLineDash();e.lineDash=s?s.slice():Rh;const r=t.getLineDashOffset();e.lineDashOffset=r||0;const o=t.getLineJoin();e.lineJoin=void 0!==o?o:Mh;const a=t.getWidth();e.lineWidth=void 0!==a?a:1;const h=t.getMiterLimit();e.miterLimit=void 0!==h?h:10,e.lineWidth>this.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0;return e}setFillStrokeStyle(t,e){const i=this.state;this.fillStyleToState(t,i),this.strokeStyleToState(e,i)}createFill(t){const e=t.fillStyle,i=[Eu.SET_FILL_STYLE,e];return"string"!=typeof e&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[Eu.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;"string"==typeof i&&t.currentFillStyle==i||(this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,n=t.lineCap,s=t.lineDash,r=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,h=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||s!=t.currentLineDash&&!I(t.currentLineDash,s)||t.currentLineDashOffset!=r||t.currentLineJoin!=o||t.currentLineWidth!=a||t.currentMiterLimit!=h)&&(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=s,t.currentLineDashOffset=r,t.currentLineJoin=o,t.currentLineWidth=a,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=[Eu.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=qt(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;Ht(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}};const Tu=class extends Iu{constructor(t,e,i,n){super(t,e,i,n),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e,i){if(!this.image_||this.maxExtent&&!Jt(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),s=t.getStride(),r=this.coordinates.length,o=this.appendFlatPointCoordinates(n,s);this.instructions.push([Eu.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([Eu.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,i){if(!this.image_)return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),s=[];for(let e=0,i=n.length;e<i;e+=t.getStride())this.maxExtent&&!Jt(this.maxExtent,n.slice(e,e+2))||s.push(n[e],n[e+1]);const r=this.coordinates.length,o=this.appendFlatPointCoordinates(s,2);this.instructions.push([Eu.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([Eu.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(),n=t.getSize(),s=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=s[0],this.originY_=s[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}};const Ru=class extends Iu{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinates_(t,e,i,n){const s=this.coordinates.length,r=this.appendFlatLineCoordinates(t,e,i,n,!1,!1),o=[Eu.MOVE_TO_LINE_TO,s,r];return this.instructions.push(o),this.hitDetectionInstructions.push(o),i}drawLineString(t,e,i){const n=this.state,s=n.strokeStyle,r=n.lineWidth;if(void 0===s||void 0===r)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([Eu.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Rh,0],wu);const o=t.getFlatCoordinates(),a=t.getStride();this.drawFlatCoordinates_(o,0,o.length,a),this.hitDetectionInstructions.push(Cu),this.endGeometry(e)}drawMultiLineString(t,e,i){const n=this.state,s=n.strokeStyle,r=n.lineWidth;if(void 0===s||void 0===r)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([Eu.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Rh,0],wu);const o=t.getEnds(),a=t.getFlatCoordinates(),h=t.getStride();let l=0;for(let t=0,e=o.length;t<e;++t)l=this.drawFlatCoordinates_(a,l,o[t],h);this.hitDetectionInstructions.push(Cu),this.endGeometry(e)}finish(){const t=this.state;return null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&this.instructions.push(Cu),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(Cu),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(wu)}};const Mu=class extends Iu{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinatess_(t,e,i,n){const s=this.state,r=void 0!==s.fillStyle,o=void 0!==s.strokeStyle,a=i.length;this.instructions.push(wu),this.hitDetectionInstructions.push(wu);for(let s=0;s<a;++s){const r=i[s],a=this.coordinates.length,h=this.appendFlatLineCoordinates(t,e,r,n,!0,!o),l=[Eu.MOVE_TO_LINE_TO,a,h];this.instructions.push(l),this.hitDetectionInstructions.push(l),o&&(this.instructions.push(Su),this.hitDetectionInstructions.push(Su)),e=r}return r&&(this.instructions.push(vu),this.hitDetectionInstructions.push(vu)),o&&(this.instructions.push(Cu),this.hitDetectionInstructions.push(Cu)),e}drawCircle(t,e,i){const n=this.state,s=n.fillStyle,r=n.strokeStyle;if(void 0===s&&void 0===r)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([Eu.SET_FILL_STYLE,Ih]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([Eu.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Rh,0]);const o=t.getFlatCoordinates(),a=t.getStride(),h=this.coordinates.length;this.appendFlatLineCoordinates(o,0,o.length,a,!1,!1);const l=[Eu.CIRCLE,h];this.instructions.push(wu,l),this.hitDetectionInstructions.push(wu,l),void 0!==n.fillStyle&&(this.instructions.push(vu),this.hitDetectionInstructions.push(vu)),void 0!==n.strokeStyle&&(this.instructions.push(Cu),this.hitDetectionInstructions.push(Cu)),this.endGeometry(e)}drawPolygon(t,e,i){const n=this.state,s=n.fillStyle,r=n.strokeStyle;if(void 0===s&&void 0===r)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([Eu.SET_FILL_STYLE,Ih]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([Eu.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Rh,0]);const o=t.getEnds(),a=t.getOrientedFlatCoordinates(),h=t.getStride();this.drawFlatCoordinatess_(a,0,o,h),this.endGeometry(e)}drawMultiPolygon(t,e,i){const n=this.state,s=n.fillStyle,r=n.strokeStyle;if(void 0===s&&void 0===r)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([Eu.SET_FILL_STYLE,Ih]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([Eu.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Rh,0]);const o=t.getEndss(),a=t.getOrientedFlatCoordinates(),h=t.getStride();let l=0;for(let t=0,e=o.length;t<e;++t)l=this.drawFlatCoordinatess_(a,l,o[t],h);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const t=this.tolerance;if(0!==t){const e=this.coordinates;for(let i=0,n=e.length;i<n;++i)e[i]=Xn(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;this.updateFillStyle(t,this.createFill),this.updateStrokeStyle(t,this.applyStroke)}};function Pu(t,e,i,n,s){const r=[];let o=i,a=0,h=e.slice(i,2);for(;a<t&&o+s<n;){const[i,n]=h.slice(-2),l=e[o+s],c=e[o+s+1],u=Math.sqrt((l-i)*(l-i)+(c-n)*(c-n));if(a+=u,a>=t){const e=(t-a+u)/u,d=Dt(i,l,e),g=Dt(n,c,e);h.push(d,g),r.push(h),h=[d,g],a==t&&(o+=s),a=0}else if(a<t)h.push(e[o+s],e[o+s+1]),o+=s;else{const t=u-a,e=Dt(i,l,t/u),d=Dt(n,c,t/u);h.push(e,d),r.push(h),h=[e,d],a=0,o+=s}}return a>0&&r.push(h),r}function Fu(t,e,i,n,s){let r,o,a,h,l,c,u,d,g,_,f=i,p=i,m=0,y=0,x=i;for(o=i;o<n;o+=s){const i=e[o],n=e[o+1];void 0!==l&&(g=i-l,_=n-c,h=Math.sqrt(g*g+_*_),void 0!==u&&(y+=a,r=Math.acos((u*g+d*_)/(a*h)),r>t&&(y>m&&(m=y,f=x,p=o),y=0,x=o-s)),a=h,u=g,d=_),l=i,c=n}return y+=h,y>m?[x,o]:[f,p]}const bu={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};const Lu=class extends Iu{constructor(t,e,i,n){super(t,e,i,n),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[Ih]={fillStyle:Ih},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e,i){const n=this.textFillState_,s=this.textStrokeState_,r=this.textState_;if(""===this.text_||!r||!n&&!s)return;const o=this.coordinates;let a=o.length;const h=t.getType();let l=null,c=t.getStride();if("line"!==r.placement||"LineString"!=h&&"MultiLineString"!=h&&"Polygon"!=h&&"MultiPolygon"!=h){let n=r.overflow?null:[];switch(h){case"Point":case"MultiPoint":l=t.getFlatCoordinates();break;case"LineString":l=t.getFlatMidpoint();break;case"Circle":l=t.getCenter();break;case"MultiLineString":l=t.getFlatMidpoints(),c=2;break;case"Polygon":l=t.getFlatInteriorPoint(),r.overflow||n.push(l[2]/this.resolution),c=3;break;case"MultiPolygon":const e=t.getFlatInteriorPoints();l=[];for(let t=0,i=e.length;t<i;t+=3)r.overflow||n.push(e[t+2]/this.resolution),l.push(e[t],e[t+1]);if(0===l.length)return;c=2}const s=this.appendFlatPointCoordinates(l,c);if(s===a)return;if(n&&(s-a)/2!==l.length/c){let t=a/2;n=n.filter((e,i)=>{const n=o[2*(t+i)]===l[i*c]&&o[2*(t+i)+1]===l[i*c+1];return n||--t,n})}this.saveTextStates_();const u=r.backgroundFill?this.createFill(this.fillStyleToState(r.backgroundFill)):null,d=r.backgroundStroke?this.createStroke(this.strokeStyleToState(r.backgroundStroke)):null;this.beginGeometry(t,e,i);let g=r.padding;if(g!=Lh&&(r.scale[0]<0||r.scale[1]<0)){let t=r.padding[0],e=r.padding[1],i=r.padding[2],n=r.padding[3];r.scale[0]<0&&(e=-e,n=-n),r.scale[1]<0&&(t=-t,i=-i),g=[t,e,i,n]}const _=this.pixelRatio;this.instructions.push([Eu.DRAW_IMAGE,a,s,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,g==Lh?Lh:g.map(function(t){return t*_}),u,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]);const f=1/_,p=u?u.slice(0):null;p&&(p[1]=Ih),this.hitDetectionInstructions.push([Eu.DRAW_IMAGE,a,s,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[f,f],NaN,this.declutterMode_,this.declutterImageWithText_,g,p,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?Ih:this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]),this.endGeometry(e)}else{if(!Ie(this.maxExtent,t.getExtent()))return;let n;if(l=t.getFlatCoordinates(),"LineString"==h)n=[l.length];else if("MultiLineString"==h)n=t.getEnds();else if("Polygon"==h)n=t.getEnds().slice(0,1);else if("MultiPolygon"==h){const e=t.getEndss();n=[];for(let t=0,i=e.length;t<i;++t)n.push(e[t][0])}this.beginGeometry(t,e,i);const s=r.repeat,u=s?void 0:r.textAlign;let d=0;for(let t=0,e=n.length;t<e;++t){let e;e=s?Pu(s*this.resolution,l,d,n[t],c):[l.slice(d,n[t])];for(let i=0,s=e.length;i<s;++i){const s=e[i];let h=0,l=s.length;if(null==u){const t=Fu(r.maxAngle,s,0,s.length,2);h=t[0],l=t[1]}for(let t=h;t<l;t+=c)o.push(s[t],s[t+1]);const g=o.length;d=n[t],this.drawChars_(a,g),a=g}}this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,n=this.strokeKey_;t&&(n in this.strokeStates||(this.strokeStates[n]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const s=this.textKey_;s in this.textStates||(this.textStates[s]={font:e.font,textAlign:e.textAlign||Fh,justify:e.justify,textBaseline:e.textBaseline||bh,scale:e.scale});const r=this.fillKey_;i&&(r in this.fillStates||(this.fillStates[r]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,n=this.textState_,s=this.strokeKey_,r=this.textKey_,o=this.fillKey_;this.saveTextStates_();const a=this.pixelRatio,h=bu[n.textBaseline],l=this.textOffsetY_*a,c=this.text_,u=i?i.lineWidth*Math.abs(n.scale[0])/2:0;this.instructions.push([Eu.DRAW_CHARS,t,e,h,n.overflow,o,n.maxAngle,a,l,s,u*a,c,r,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([Eu.DRAW_CHARS,t,e,h,n.overflow,o?Ih:o,n.maxAngle,a,l,s,u*a,c,r,1/a,this.declutterMode_,this.textKeepUpright_])}setTextStyle(t,e){let i,n,s;if(t){const e=t.getFill();e?(n=this.textFillState_,n||(n={},this.textFillState_=n),n.fillStyle=Sh(e.getColor()||Ih)):(n=null,this.textFillState_=n);const r=t.getStroke();if(r){s=this.textStrokeState_,s||(s={},this.textStrokeState_=s);const t=r.getLineDash(),e=r.getLineDashOffset(),i=r.getWidth(),n=r.getMiterLimit();s.lineCap=r.getLineCap()||Th,s.lineDash=t?t.slice():Rh,s.lineDashOffset=void 0===e?0:e,s.lineJoin=r.getLineJoin()||Mh,s.lineWidth=void 0===i?1:i,s.miterLimit=void 0===n?10:n,s.strokeStyle=Sh(r.getColor()||Ph)}else s=null,this.textStrokeState_=s;i=this.textState_;const o=t.getFont()||Eh;Wh(o);const a=t.getScaleArray();i.overflow=t.getOverflow(),i.font=o,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||bh,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||Lh,i.scale=void 0===a?[1,1]:a;const h=t.getOffsetX(),l=t.getOffsetY(),c=t.getRotateWithView(),u=t.getKeepUpright(),d=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=void 0===h?0:h,this.textOffsetY_=void 0===l?0:l,this.textRotateWithView_=void 0!==c&&c,this.textKeepUpright_=void 0===u||u,this.textRotation_=void 0===d?0:d,this.strokeKey_=s?("string"==typeof s.strokeStyle?s.strokeStyle:B(s.strokeStyle))+s.lineCap+s.lineDashOffset+"|"+s.lineWidth+s.lineJoin+s.miterLimit+"["+s.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=n&&n.fillStyle?"string"==typeof n.fillStyle?n.fillStyle:"|"+B(n.fillStyle):""}else this.text_="";this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}},Au={Circle:Mu,Default:Iu,Image:Tu,LineString:Ru,Polygon:Mu,Text:Lu};const ku=class{constructor(t,e,i,n){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=n,this.resolution_=i,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const i=this.buildersByZIndex_[e];for(const n in i){const s=i[n].finish();t[e][n]=s}}return t}getBuilder(t,e){const i=void 0!==t?t.toString():"0";let n=this.buildersByZIndex_[i];void 0===n&&(n={},this.buildersByZIndex_[i]=n);let s=n[e];if(void 0===s){s=new(0,Au[e])(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[e]=s}return s}};function Du(t,e,i,n){let s=t[e],r=t[e+1],o=0;for(let a=e+n;a<i;a+=n){const e=t[a],i=t[a+1];o+=Math.sqrt((e-s)*(e-s)+(i-r)*(i-r)),s=e,r=i}return o}function Ou(t,e,i,n,s,r,o,a,h,l,c,u,d=!0){let g=t[e],_=t[e+1],f=0,p=0,m=0,y=0;function x(){f=g,p=_,g=t[e+=n],_=t[e+1],y+=m,m=Math.sqrt((g-f)*(g-f)+(_-p)*(_-p))}do{x()}while(e<i-n&&y+m<r);let v=0===m?0:(r-y)/m;const C=Dt(f,g,v),w=Dt(p,_,v),S=e-n,E=y,I=r+a*h(l,s,c);for(;e<i-n&&y+m<I;)x();v=0===m?0:(I-y)/m;const T=Dt(f,g,v),R=Dt(p,_,v);let M=!1;if(d)if(u){const t=[C,w,T,R];vn(t,0,4,2,u,t,t),M=t[0]>t[2]}else M=C>T;const P=Math.PI,F=[],b=S+n===e;let L;if(m=0,y=E,g=t[e=S],_=t[e+1],b){x(),L=Math.atan2(_-p,g-f),M&&(L+=L>0?-P:P);const t=(T+C)/2,e=(R+w)/2;return F[0]=[t,e,(I-r)/2,L,s],F}for(let t=0,u=(s=s.replace(/\n/g," ")).length;t<u;){x();let d=Math.atan2(_-p,g-f);if(M&&(d+=d>0?-P:P),void 0!==L){let t=d-L;if(t+=t>P?-2*P:t<-P?2*P:0,Math.abs(t)>o)return null}L=d;const C=t;let w=0;for(;t<u;++t){const o=a*h(l,s[M?u-t-1:t],c);if(e+n<i&&y+m<r+w+o/2)break;w+=o}if(t===C)continue;const S=M?s.substring(u-C,u-t):s.substring(C,t);v=0===m?0:(r+w/2-y)/m;const E=Dt(f,g,v),I=Dt(p,_,v);F.push([E,I,w/2,d,S]),r+=w}return F}const Gu=[1/0,1/0,-1/0,-1/0],zu=[],Wu=[],Nu=[],Xu=[];function Bu(t){return t[3].declutterBox}const Ku=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 Vu(t,e){return"start"===e?e=Ku.test(t)?"right":"left":"end"===e&&(e=Ku.test(t)?"left":"right"),bu[e]}function ju(t,e,i){return i>0&&t.push("\n",""),t.push(e,""),t}function Yu(t,e,i){return i%2==0&&(t+=e),t}const Zu=class{constructor(t,e,i,n,s){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=[1,0,0,1,0,0],this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=s?new nu:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,n){const s=t+e+i+n;if(this.labels_[s])return this.labels_[s];const r=n?this.strokeStates[n]:null,o=i?this.fillStates[i]:null,a=this.textStates[e],h=this.pixelRatio,l=[a.scale[0]*h,a.scale[1]*h],c=a.justify?bu[a.justify]:Vu(Array.isArray(t)?t[0]:t,a.textAlign||Fh),u=n&&r.lineWidth?r.lineWidth:0,d=Array.isArray(t)?t:String(t).split("\n").reduce(ju,[]),{width:g,height:_,widths:f,heights:p,lineWidths:m}=function(t,e){const i=[],n=[],s=[];let r=0,o=0,a=0,h=0;for(let l=0,c=e.length;l<=c;l+=2){const u=e[l];if("\n"===u||l===c){r=Math.max(r,o),s.push(o),o=0,a+=h,h=0;continue}const d=e[l+1]||t.font,g=Bh(d,u);i.push(g),o+=g;const _=Nh(d);n.push(_),h=Math.max(h,_)}return{width:r,height:a,widths:i,heights:n,lineWidths:s}}(a,d),y=g+u,x=[],v=(y+2)*l[0],C=(_+u)*l[1],w={width:v<0?Math.floor(v):Math.ceil(v),height:C<0?Math.floor(C):Math.ceil(C),contextInstructions:x};1==l[0]&&1==l[1]||x.push("scale",l),n&&(x.push("strokeStyle",r.strokeStyle),x.push("lineWidth",u),x.push("lineCap",r.lineCap),x.push("lineJoin",r.lineJoin),x.push("miterLimit",r.miterLimit),x.push("setLineDash",[r.lineDash]),x.push("lineDashOffset",r.lineDashOffset)),i&&x.push("fillStyle",o.fillStyle),x.push("textBaseline","middle"),x.push("textAlign","center");const S=.5-c;let E=c*y+S*u;const I=[],T=[];let R,M=0,P=0,F=0,b=0;for(let t=0,e=d.length;t<e;t+=2){const e=d[t];if("\n"===e){P+=M,M=0,E=c*y+S*u,++b;continue}const s=d[t+1]||a.font;s!==R&&(n&&I.push("font",s),i&&T.push("font",s),R=s),M=Math.max(M,p[F]);const r=[e,E+S*f[F]+c*(f[F]-m[b]),.5*(u+M)+P];E+=f[F],n&&I.push("strokeText",r),i&&T.push("fillText",r),++F}return Array.prototype.push.apply(x,I),Array.prototype.push.apply(x,T),this.labels_[s]=w,w}replayTextBackground_(t,e,i,n,s,r,o){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,n),t.lineTo.apply(t,s),t.lineTo.apply(t,e),r&&(this.alignAndScaleFill_=r[2],t.fillStyle=r[1],this.fill_(t)),o&&(this.setStrokeStyle_(t,o),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,n,s,r,o,a,h,l,c,u,d,g,_,f){let p=i-(o*=u[0]),m=n-(a*=u[1]);const y=s+h>t?t-h:s,x=r+l>e?e-l:r,v=g[3]+y*u[0]+g[1],C=g[0]+x*u[1]+g[2],w=p-g[3],S=m-g[0];let E;return(_||0!==c)&&(zu[0]=w,Xu[0]=w,zu[1]=S,Wu[1]=S,Wu[0]=w+v,Nu[0]=Wu[0],Nu[1]=S+C,Xu[1]=Nu[1]),0!==c?(E=_n([1,0,0,1,0,0],i,n,1,1,c,-i,-n),gn(E,zu),gn(E,Wu),gn(E,Nu),gn(E,Xu),ne(Math.min(zu[0],Wu[0],Nu[0],Xu[0]),Math.min(zu[1],Wu[1],Nu[1],Xu[1]),Math.max(zu[0],Wu[0],Nu[0],Xu[0]),Math.max(zu[1],Wu[1],Nu[1],Xu[1]),Gu)):ne(Math.min(w,w+v),Math.min(S,S+C),Math.max(w,w+v),Math.max(S,S+C),Gu),d&&(p=Math.round(p),m=Math.round(m)),{drawImageX:p,drawImageY:m,drawImageW:y,drawImageH:x,originX:h,originY:l,declutterBox:{minX:Gu[0],minY:Gu[1],maxX:Gu[2],maxY:Gu[3],value:f},canvasTransform:E,scale:u}}replayImageOrLabel_(t,e,i,n,s,r,o){const a=!(!r&&!o),h=n.declutterBox,l=o?o[2]*n.scale[0]/2:0;return h.minX-l<=e[0]&&h.maxX+l>=0&&h.minY-l<=e[1]&&h.maxY+l>=0&&(a&&this.replayTextBackground_(t,zu,Wu,Nu,Xu,r,o),Vh(t,n.canvasTransform,s,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=gn(this.renderedTransform_,[0,0]),n=512*this.pixelRatio;t.save(),t.translate(i[0]%n,i[1]%n),1!==e&&t.scale(e,e),t.rotate(this.viewRotation_)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],e[1]&&(t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6]))}drawLabelWithPointPlacement_(t,e,i,n){const s=this.textStates[e],r=this.createLabel(t,e,n,i),o=this.strokeStates[i],a=this.pixelRatio,h=Vu(Array.isArray(t)?t[0]:t,s.textAlign||Fh),l=bu[s.textBaseline||bh],c=o&&o.lineWidth?o.lineWidth:0;return{label:r,anchorX:h*(r.width/a-2*s.scale[0])+2*(.5-h)*c,anchorY:l*r.height/a+2*(.5-l)*c}}execute_(t,e,i,n,s,r,o,a){const h=this.zIndexContext_;let l;var c,u;this.pixelCoordinates_&&I(i,this.renderedTransform_)?l=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),l=xn(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),c=this.renderedTransform_,u=i,c[0]=u[0],c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5]);let d=0;const g=n.length;let _,f,p,m,y,x,v,C,w,S,E,T,R,M=0,P=0,F=0;const b=this.coordinateCache_,L=this.viewRotation_,A=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,k={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:L},D=this.instructions!=n||this.overlaps?0:200;let O,G,z,W;for(;d<g;){const i=n[d];switch(i[0]){case Eu.BEGIN_GEOMETRY:O=i[1],W=i[3],O.getGeometry()?void 0===o||Ie(o,W.getExtent())?++d:d=i[2]+1:d=i[2],h&&(h.zIndex=i[4]);break;case Eu.BEGIN_PATH:P>D&&(this.fill_(t),P=0),F>D&&(t.stroke(),F=0),P||F||(t.beginPath(),y=NaN,x=NaN),++d;break;case Eu.CIRCLE:M=i[1];const n=l[M],c=l[M+1],u=l[M+2]-n,g=l[M+3]-c,I=Math.sqrt(u*u+g*g);t.moveTo(n+I,c),t.arc(n,c,I,0,2*Math.PI,!0),++d;break;case Eu.CLOSE_PATH:t.closePath(),++d;break;case Eu.CUSTOM:M=i[1],_=i[2];const N=i[3],X=i[4],B=i[5];k.geometry=N,k.feature=O,d in b||(b[d]=[]);const K=b[d];B?B(l,M,_,2,K):(K[0]=l[M],K[1]=l[M+1],K.length=2),h&&(h.zIndex=i[6]),X(K,k),++d;break;case Eu.DRAW_IMAGE:M=i[1],_=i[2],w=i[3],f=i[4],p=i[5];let V=i[6];const j=i[7],Y=i[8],Z=i[9],U=i[10];let H=i[11];const q=i[12];let $=i[13];m=i[14]||"declutter";const J=i[15];if(!w&&i.length>=20){S=i[19],E=i[20],T=i[21],R=i[22];const t=this.drawLabelWithPointPlacement_(S,E,T,R);w=t.label,i[3]=w;const e=i[23];f=(t.anchorX-e)*this.pixelRatio,i[4]=f;const n=i[24];p=(t.anchorY-n)*this.pixelRatio,i[5]=p,V=w.height,i[6]=V,$=w.width,i[13]=$}let Q,tt,et,it;i.length>25&&(Q=i[25]),i.length>17?(tt=i[16],et=i[17],it=i[18]):(tt=Lh,et=null,it=null),U&&A?H+=L:U||A||(H-=L);let nt=0;for(;M<_;M+=2){if(Q&&Q[nt++]<$/this.pixelRatio)continue;const i=this.calculateImageOrLabelDimensions_(w.width,w.height,l[M],l[M+1],$,V,f,p,Y,Z,H,q,s,tt,!!et||!!it,O),n=[t,e,w,i,j,et,it];if(a){let t,e,s,r,o;if(J){const i=_-M;if(!J[i]){J[i]={args:n,declutterMode:m};continue}const r=J[i];t=r.args,e=r.declutterMode,delete J[i],s=Bu(t)}if(!t||"declutter"===e&&a.collides(s)||(r=!0),"declutter"===m&&a.collides(i.declutterBox)||(o=!0),"declutter"===e&&"declutter"===m){const t=r&&o;r=t,o=t}r&&("none"!==e&&a.insert(s),this.replayImageOrLabel_.apply(this,t)),o&&("none"!==m&&a.insert(i.declutterBox),this.replayImageOrLabel_.apply(this,n))}else this.replayImageOrLabel_.apply(this,n)}++d;break;case Eu.DRAW_CHARS:const st=i[1],rt=i[2],ot=i[3],at=i[4];R=i[5];const ht=i[6],lt=i[7],ct=i[8];T=i[9];const ut=i[10];S=i[11],Array.isArray(S)&&(S=S.reduce(Yu,"")),E=i[12];const dt=[i[13],i[13]];m=i[14]||"declutter";const gt=i[15],_t=this.textStates[E],ft=_t.font,pt=[_t.scale[0]*lt,_t.scale[1]*lt];let mt;ft in this.widths_?mt=this.widths_[ft]:(mt={},this.widths_[ft]=mt);const yt=Du(l,st,rt,2),xt=Math.abs(pt[0])*Kh(ft,S,mt);if(at||xt<=yt){const i=Ou(l,st,rt,2,S,(yt-xt)*Vu(S,this.textStates[E].textAlign),ht,Math.abs(pt[0]),Kh,ft,mt,A?0:this.viewRotation_,gt);t:if(i){const n=[];let s,r,o,h,l;if(T)for(s=0,r=i.length;s<r;++s){l=i[s],o=l[4],h=this.createLabel(o,E,"",T),f=l[2]+(pt[0]<0?-ut:ut),p=ot*h.height+2*(.5-ot)*ut*pt[1]/pt[0]-ct;const r=this.calculateImageOrLabelDimensions_(h.width,h.height,l[0],l[1],h.width,h.height,f,p,0,0,l[3],dt,!1,Lh,!1,O);if(a&&"declutter"===m&&a.collides(r.declutterBox))break t;n.push([t,e,h,r,1,null,null])}if(R)for(s=0,r=i.length;s<r;++s){l=i[s],o=l[4],h=this.createLabel(o,E,R,""),f=l[2],p=ot*h.height-ct;const r=this.calculateImageOrLabelDimensions_(h.width,h.height,l[0],l[1],h.width,h.height,f,p,0,0,l[3],dt,!1,Lh,!1,O);if(a&&"declutter"===m&&a.collides(r.declutterBox))break t;n.push([t,e,h,r,1,null,null])}a&&"none"!==m&&a.load(n.map(Bu));for(let t=0,e=n.length;t<e;++t)this.replayImageOrLabel_.apply(this,n[t])}}++d;break;case Eu.END_GEOMETRY:if(void 0!==r){O=i[1];const t=r(O,W,m);if(t)return t}++d;break;case Eu.FILL:D?P++:this.fill_(t),++d;break;case Eu.MOVE_TO_LINE_TO:for(M=i[1],_=i[2],G=l[M],z=l[M+1],t.moveTo(G,z),y=G+.5|0,x=z+.5|0,M+=2;M<_;M+=2)G=l[M],z=l[M+1],v=G+.5|0,C=z+.5|0,M!=_-2&&v===y&&C===x||(t.lineTo(G,z),y=v,x=C);++d;break;case Eu.SET_FILL_STYLE:this.alignAndScaleFill_=i[2],P&&(this.fill_(t),P=0,F&&(t.stroke(),F=0)),t.fillStyle=i[1],++d;break;case Eu.SET_STROKE_STYLE:F&&(t.stroke(),F=0),this.setStrokeStyle_(t,i),++d;break;case Eu.STROKE:D?F++:t.stroke(),++d;break;default:++d}}P&&this.fill_(t),F&&t.stroke()}execute(t,e,i,n,s,r){this.viewRotation_=n,this.execute_(t,e,i,this.instructions,s,void 0,void 0,r)}executeHitDetection(t,e,i,n,s){return this.viewRotation_=i,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,n,s)}},Uu=["Polygon","Circle","LineString","Image","Text","Default"],Hu=["Image","Text"],qu=Uu.filter(t=>!Hu.includes(t));const $u={};const Ju=class{constructor(t,e,i,n,s,r,o){this.maxExtent_=t,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=r,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=[1,0,0,1,0,0],this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(s,o)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(const i in t){let n=this.executorsByZIndex_[i];void 0===n&&(n={},this.executorsByZIndex_[i]=n);const s=t[i];for(const t in s){const i=s[t];n[t]=new Zu(this.resolution_,this.pixelRatio_,this.overlaps_,i,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let e=0,n=t.length;e<n;++e)if(t[e]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,n,s,r){const o=2*(n=Math.round(n))+1,a=_n(this.hitDetectionTransform_,n+.5,n+.5,1/e,-1/e,-i,-t[0],-t[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=Fs(o,o));const l=this.hitDetectionContext_;let c;l.canvas.width!==o||l.canvas.height!==o?(l.canvas.width=o,l.canvas.height=o):h||l.clearRect(0,0,o,o),void 0!==this.renderBuffer_&&(c=[1/0,1/0,-1/0,-1/0],le(c,t),Ht(c,e*(this.renderBuffer_+n),c));const u=function(t){if(void 0!==$u[t])return $u[t];const e=2*t+1,i=t*t,n=new Array(i+1);for(let s=0;s<=t;++s)for(let r=0;r<=t;++r){const o=s*s+r*r;if(o>i)break;let a=n[o];a||(a=[],n[o]=a),a.push(4*((t+s)*e+(t+r))+3),s>0&&a.push(4*((t-s)*e+(t+r))+3),r>0&&(a.push(4*((t+s)*e+(t-r))+3),s>0&&a.push(4*((t-s)*e+(t-r))+3))}const s=[];for(let t=0,e=n.length;t<e;++t)n[t]&&s.push(...n[t]);return $u[t]=s,s}(n);let d;function g(t,e,i){const a=l.getImageData(0,0,o,o).data;for(let h=0,c=u.length;h<c;h++)if(a[u[h]]>0){if(!r||"none"===i||"Image"!==d&&"Text"!==d||r.includes(t)){const i=(u[h]-3)/4,r=n-i%o,a=n-(i/o|0),l=s(t,e,r*r+a*a);if(l)return l}l.clearRect(0,0,o,o);break}}const _=Object.keys(this.executorsByZIndex_).map(Number);let f,p,m,y,x;for(_.sort(v),f=_.length-1;f>=0;--f){const t=_[f].toString();for(m=this.executorsByZIndex_[t],p=Uu.length-1;p>=0;--p)if(d=Uu[p],y=m[d],void 0!==y&&(x=y.executeHitDetection(l,a,i,g,c),x))return x}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],s=e[2],r=e[3],o=[i,n,i,r,s,r,s,n];return xn(o,0,8,2,t,o),o}isEmpty(){return L(this.executorsByZIndex_)}execute(t,e,i,n,s,r,o){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(o?C:v),r=r||Uu;const h=Uu.length;for(let l=0,c=a.length;l<c;++l){const c=a[l].toString(),u=this.executorsByZIndex_[c];for(let c=0,d=r.length;c<d;++c){const d=r[c],g=u[d];if(void 0!==g){const r=null===o?void 0:g.getZIndexContext(),c=r?r.getContext():t,u=this.maxExtent_&&"Image"!==d&&"Text"!==d;if(u&&(c.save(),this.clip(c,i)),r&&"Text"!==d&&"Image"!==d?r.pushFunction(t=>g.execute(t,e,i,n,s,o)):g.execute(c,e,i,n,s,o),u&&c.restore(),r){r.offset();const t=a[l]*h+Uu.indexOf(d);this.deferredZIndexContexts_[t]||(this.deferredZIndexContexts_[t]=[]),this.deferredZIndexContexts_[t].push(r)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(v);for(let i=0,n=e.length;i<n;++i)t[e[i]].forEach(t=>{t.draw(this.renderedContext_),t.clear()}),t[e[i]].length=0}};const Qu=class extends yu{constructor(t,e,i,n,s,r,o){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=n,this.transformRotation_=n?Ot(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=s,this.squaredTolerance_=r,this.userTransform_=o,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_=[1,0,0,1,0,0]}drawImages_(t,e,i,n){if(!this.image_)return;const s=xn(t,e,i,n,this.transform_,this.pixelCoordinates_),r=this.context_,o=this.tmpLocalTransform_,a=r.globalAlpha;1!=this.imageOpacity_&&(r.globalAlpha=a*this.imageOpacity_);let h=this.imageRotation_;0===this.transformRotation_&&(h-=this.viewRotation_),this.imageRotateWithView_&&(h+=this.viewRotation_);for(let t=0,e=s.length;t<e;t+=2){const e=s[t]-this.imageAnchorX_,i=s[t+1]-this.imageAnchorY_;if(0!==h||1!=this.imageScale_[0]||1!=this.imageScale_[1]){const t=e+this.imageAnchorX_,n=i+this.imageAnchorY_;_n(o,t,n,1,1,h,-t,-n),r.save(),r.transform.apply(r,o),r.translate(t,n),r.scale(this.imageScale_[0],this.imageScale_[1]),r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),r.restore()}else r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,e,i,this.imageWidth_,this.imageHeight_)}1!=this.imageOpacity_&&(r.globalAlpha=a)}drawText_(t,e,i,n){if(!this.textState_||""===this.text_)return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const s=xn(t,e,i,n,this.transform_,this.pixelCoordinates_),r=this.context_;let o=this.textRotation_;for(0===this.transformRotation_&&(o-=this.viewRotation_),this.textRotateWithView_&&(o+=this.viewRotation_);e<i;e+=n){const t=s[e]+this.textOffsetX_,i=s[e+1]+this.textOffsetY_;0!==o||1!=this.textScale_[0]||1!=this.textScale_[1]?(r.save(),r.translate(t-this.textOffsetX_,i-this.textOffsetY_),r.rotate(o),r.translate(this.textOffsetX_,this.textOffsetY_),r.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&r.strokeText(this.text_,0,0),this.textFillState_&&r.fillText(this.text_,0,0),r.restore()):(this.textStrokeState_&&r.strokeText(this.text_,t,i),this.textFillState_&&r.fillText(this.text_,t,i))}}moveToLineTo_(t,e,i,n,s){const r=this.context_,o=xn(t,e,i,n,this.transform_,this.pixelCoordinates_);r.moveTo(o[0],o[1]);let a=o.length;s&&(a-=2);for(let t=2;t<a;t+=2)r.lineTo(o[t],o[t+1]);return s&&r.closePath(),i}drawRings_(t,e,i,n){for(let s=0,r=i.length;s<r;++s)e=this.moveToLineTo_(t,e,i[s],n,!0);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Ie(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=function(t,e,i){const n=t.getFlatCoordinates();if(!n)return null;const s=t.getStride();return xn(n,0,n.length,s,e,i)}(t,this.transform_,this.pixelCoordinates_),i=e[2]-e[0],n=e[3]-e[1],s=Math.sqrt(i*i+n*n),r=this.context_;r.beginPath(),r.arc(e[0],e[1],s,0,2*Math.PI),this.fillState_&&r.fill(),this.strokeState_&&r.stroke()}""!==this.text_&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t)}}drawFeature(t,e){const i=e.getGeometryFunction()(t);i&&(this.setStyle(e),this.drawGeometry(i))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let t=0,i=e.length;t<i;++t)this.drawGeometry(e[t])}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_)),Ie(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(Ie(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();let n=0;const s=t.getEnds(),r=t.getStride();e.beginPath();for(let t=0,e=s.length;t<e;++t)n=this.moveToLineTo_(i,n,s[t],r,!1);e.stroke()}if(""!==this.text_){const e=t.getFlatMidpoints();this.drawText_(e,0,e.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Ie(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_)),Ie(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getOrientedFlatCoordinates();let n=0;const s=t.getEndss(),r=t.getStride();e.beginPath();for(let t=0,e=s.length;t<e;++t){const e=s[t];n=this.drawRings_(i,n,e,r)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,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),I(i.lineDash,t.lineDash)||e.setLineDash(i.lineDash=t.lineDash),i.lineDashOffset!=t.lineDashOffset&&(i.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),i.lineJoin!=t.lineJoin&&(i.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),i.lineWidth!=t.lineWidth&&(i.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),i.miterLimit!=t.miterLimit&&(i.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),i.strokeStyle!=t.strokeStyle&&(i.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){const e=this.context_,i=this.contextTextState_,n=t.textAlign?t.textAlign:Fh;i?(i.font!=t.font&&(i.font=t.font,e.font=t.font),i.textAlign!=n&&(i.textAlign=n,e.textAlign=n),i.textBaseline!=t.textBaseline&&(i.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=n,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:n,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(t){const e=t.getColor();this.fillState_={fillStyle:Sh(e||Ih)}}else this.fillState_=null;if(e){const t=e.getColor(),i=e.getLineCap(),n=e.getLineDash(),s=e.getLineDashOffset(),r=e.getLineJoin(),o=e.getWidth(),a=e.getMiterLimit(),h=n||Rh;this.strokeState_={lineCap:void 0!==i?i:Th,lineDash:1===this.pixelRatio_?h:h.map(t=>t*this.pixelRatio_),lineDashOffset:(s||0)*this.pixelRatio_,lineJoin:void 0!==r?r:Mh,lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:Sh(t||Ph)}}else this.strokeState_=null}setImageStyle(t){let e;if(!t||!(e=t.getSize()))return void(this.image_=null);const i=t.getPixelRatio(this.pixelRatio_),n=t.getAnchor(),s=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const r=t.getScaleArray();this.imageScale_=[r[0]*this.pixelRatio_/i,r[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.textFillState_={fillStyle:Sh(t||Ih)}}else this.textFillState_=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),n=i.getLineDash(),s=i.getLineDashOffset(),r=i.getLineJoin(),o=i.getWidth(),a=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:Th,lineDash:n||Rh,lineDashOffset:s||0,lineJoin:void 0!==r?r:Mh,lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:10,strokeStyle:Sh(t||Ph)}}else this.textStrokeState_=null;const n=t.getFont(),s=t.getOffsetX(),r=t.getOffsetY(),o=t.getRotateWithView(),a=t.getRotation(),h=t.getScaleArray(),l=t.getText(),c=t.getTextAlign(),u=t.getTextBaseline();this.textState_={font:void 0!==n?n:Eh,textAlign:void 0!==c?c:Fh,textBaseline:void 0!==u?u:bh},this.text_=void 0!==l?Array.isArray(l)?l.reduce((t,e,i)=>t+(i%2?" ":e),""):l:"",this.textOffsetX_=void 0!==s?this.pixelRatio_*s:0,this.textOffsetY_=void 0!==r?this.pixelRatio_*r:0,this.textRotateWithView_=void 0!==o&&o,this.textRotation_=void 0!==a?a:0,this.textScale_=[this.pixelRatio_*h[0],this.pixelRatio_*h[1]]}else this.text_=""}},td=.5;const ed={Point:function(t,e,i,n,s,r){const o=i.getImage(),a=i.getText(),h=a&&a.getText(),l=r&&o&&h?{}:void 0;if(o){if(o.getImageState()!=uh)return;const r=t.getBuilder(i.getZIndex(),"Image");r.setImageStyle(o,l),r.drawPoint(e,n,s)}if(h){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a,l),r.drawText(e,n,s)}},LineString:function(t,e,i,n,s){const r=i.getStroke();if(r){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,r),o.drawLineString(e,n,s)}const o=i.getText();if(o&&o.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(o),r.drawText(e,n,s)}},Polygon:function(t,e,i,n,s){const r=i.getFill(),o=i.getStroke();if(r||o){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(r,o),a.drawPolygon(e,n,s)}const a=i.getText();if(a&&a.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,n,s)}},MultiPoint:function(t,e,i,n,s,r){const o=i.getImage(),a=o&&0!==o.getOpacity(),h=i.getText(),l=h&&h.getText(),c=r&&a&&l?{}:void 0;if(a){if(o.getImageState()!=uh)return;const r=t.getBuilder(i.getZIndex(),"Image");r.setImageStyle(o,c),r.drawMultiPoint(e,n,s)}if(l){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(h,c),r.drawText(e,n,s)}},MultiLineString:function(t,e,i,n,s){const r=i.getStroke();if(r){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,r),o.drawMultiLineString(e,n,s)}const o=i.getText();if(o&&o.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(o),r.drawText(e,n,s)}},MultiPolygon:function(t,e,i,n,s){const r=i.getFill(),o=i.getStroke();if(o||r){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(r,o),a.drawMultiPolygon(e,n,s)}const a=i.getText();if(a&&a.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,n,s)}},GeometryCollection:function(t,e,i,n,s,r){const o=e.getGeometriesArray();let a,h;for(a=0,h=o.length;a<h;++a){(0,ed[o[a].getType()])(t,o[a],i,n,s,r)}},Circle:function(t,e,i,n,s){const r=i.getFill(),o=i.getStroke();if(r||o){const a=t.getBuilder(i.getZIndex(),"Circle");a.setFillStrokeStyle(r,o),a.drawCircle(e,n,s)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n)}}};function id(t,e){return parseInt(B(t),10)-parseInt(B(e),10)}function nd(t,e){const i=sd(t,e);return i*i}function sd(t,e){return.5*t/e}function rd(t,e,i,n,s,r,o,a){const h=[],l=i.getImage();if(l){let t=!0;const e=l.getImageState();e==uh||e==dh?t=!1:e==lh&&l.load(),t&&h.push(l.ready())}const c=i.getFill();c&&c.loading()&&h.push(c.ready());const u=h.length>0;return u&&Promise.all(h).then(()=>s(null)),function(t,e,i,n,s,r,o){const a=i.getGeometryFunction()(e);if(!a)return;const h=a.simplifyTransformed(n,s),l=i.getRenderer();if(l)od(t,h,i,e,o);else{(0,ed[h.getType()])(t,h,i,e,o,r)}}(t,e,i,n,r,o,a),u}function od(t,e,i,n,s){if("GeometryCollection"==e.getType()){const r=e.getGeometries();for(let e=0,o=r.length;e<o;++e)od(t,r[e],i,n,s);return}t.getBuilder(i.getZIndex(),"Default").drawCustom(e,n,i.getRenderer(),i.getHitDetectionRenderer(),s)}const ad=class extends au{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipped_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=[1/0,1/0,-1/0,-1/0],this.wrappedRenderedExtent_=[1/0,1/0,-1/0,-1/0],this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(t,e,i){const n=e.extent,s=e.viewState,r=s.center,o=s.resolution,a=s.projection,h=s.rotation,l=a.getExtent(),c=this.getLayer().getSource(),u=this.getLayer().getDeclutter(),d=e.pixelRatio,g=e.viewHints,_=!(g[Tt]||g[Rt]),f=this.context,p=Math.round(Ee(n)/o*d),m=Math.round(ve(n)/o*d),y=c.getWrapX()&&a.canWrapX(),x=y?Ee(l):null,v=y?Math.ceil((n[2]-l[2])/x)+1:1;let C=y?Math.floor((n[0]-l[0])/x):0;do{let n=this.getRenderTransform(r,o,0,d,p,m,C*x);e.declutter&&(n=n.slice(0)),t.execute(f,[f.canvas.width,f.canvas.height],n,h,_,void 0===i?Uu:i?Hu:qu,i?u&&e.declutter[u]:void 0)}while(++C<v)}setDrawContext_(){1!==this.opacity_&&(this.targetContext_=this.context,this.context=Fs(this.context.canvas.width,this.context.canvas.height,ru))}resetDrawContext_(){if(1!==this.opacity_&&this.targetContext_){const t=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=t,As(this.context),ru.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(t){this.replayGroup_&&this.getLayer().getDeclutter()&&this.renderWorlds(this.replayGroup_,t,!0)}renderDeferredInternal(t){this.replayGroup_&&(this.replayGroup_.renderDeferred(),this.clipped_&&this.context.restore(),this.resetDrawContext_())}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex];this.opacity_=i.opacity;const n=t.viewState;this.prepareContainer(t,e);const s=this.context,r=this.replayGroup_;let o=r&&!r.isEmpty();if(!o){if(!(this.getLayer().hasListener(jr)||this.getLayer().hasListener(Yr)))return this.container}this.setDrawContext_(),this.preRender(s,t);const a=n.projection;if(this.clipped_=!1,o&&i.extent&&this.clipping){const e=hn(i.extent,a);o=Ie(e,t.extent),this.clipped_=o&&!Qt(e,t.extent),this.clipped_&&this.clipUnrotated(s,t,e)}return o&&this.renderWorlds(r,t,!this.getLayer().getDeclutter()&&void 0),!t.declutter&&this.clipped_&&s.restore(),this.postRender(s,t),this.renderedRotation_!==n.rotation&&(this.renderedRotation_=n.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise(e=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=this.frameState.size.slice(),e=this.renderedCenter_,i=this.renderedResolution_,n=this.renderedRotation_,s=this.renderedProjection_,r=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],h=t[0]*td,l=t[1]*td;a.push(this.getRenderTransform(e,i,n,td,h,l,0).slice());const c=o.getSource(),u=s.getExtent();if(c.getWrapX()&&s.canWrapX()&&!Qt(u,r)){let t=r[0];const s=Ee(u);let o,c=0;for(;t<u[0];)--c,o=s*c,a.push(this.getRenderTransform(e,i,n,td,h,l,o).slice()),t+=s;for(c=0,t=r[2];t>u[2];)++c,o=s*c,a.push(this.getRenderTransform(e,i,n,td,h,l,o).slice()),t-=s}const d=sn();this.hitDetectionImageData_=function(t,e,i,n,s,r,o,a,h){const l=h?an(s,h):s,c=Fs(t[0]*td,t[1]*td);c.imageSmoothingEnabled=!1;const u=c.canvas,d=new Qu(c,td,s,null,o,a,h?$i(sn(),h):null),g=i.length,_=Math.floor(16777215/g),f={};for(let t=1;t<=g;++t){const e=i[t-1],s=e.getStyleFunction()||n;if(!s)continue;let o=s(e,r);if(!o)continue;Array.isArray(o)||(o=[o]);const a=(t*_).toString(16).padStart(7,"#00000");for(let t=0,i=o.length;t<i;++t){const i=o[t],n=i.getGeometryFunction()(e);if(!n||!Ie(l,n.getExtent()))continue;const s=i.clone(),r=s.getFill();r&&r.setColor(a);const h=s.getStroke();h&&(h.setColor(a),h.setLineDash(null)),s.setText(void 0);const c=i.getImage();if(c){const t=c.getImageSize();if(!t)continue;const e=Fs(t[0],t[1],void 0,{alpha:!1}),i=e.canvas;e.fillStyle=a,e.fillRect(0,0,i.width,i.height),s.setImage(new el({img:i,anchor:c.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:c.getOrigin(),opacity:1,size:c.getSize(),scale:c.getScale(),rotation:c.getRotation(),rotateWithView:c.getRotateWithView()}))}const u=s.getZIndex()||0;let d=f[u];d||(d={},f[u]=d,d.Polygon=[],d.Circle=[],d.LineString=[],d.Point=[]);const g=n.getType();if("GeometryCollection"===g){const t=n.getGeometriesArrayRecursive();for(let e=0,i=t.length;e<i;++e){const i=t[e];d[i.getType().replace("Multi","")].push(i,s)}}else d[g.replace("Multi","")].push(n,s)}}const p=Object.keys(f).map(Number).sort(v);for(let t=0,i=p.length;t<i;++t){const i=f[p[t]];for(const t in i){const n=i[t];for(let t=0,i=n.length;t<i;t+=2){d.setStyle(n[t+1]);for(let i=0,s=e.length;i<s;++i)d.setTransform(e[i]),d.drawGeometry(n[t])}}}return c.getImageData(0,0,u.width,u.height)}(t,a,this.renderedFeatures_,o.getStyleFunction(),r,i,n,nd(i,this.renderedPixelRatio_),d?s:null)}e(function(t,e,i){const n=[];if(i){const s=Math.floor(Math.round(t[0])*td),r=Math.floor(Math.round(t[1])*td),o=4*(Pt(s,0,i.width-1)+Pt(r,0,i.height-1)*i.width),a=i.data[o],h=i.data[o+1],l=i.data[o+2]+256*(h+256*a),c=Math.floor(16777215/e.length);l&&l%c===0&&n.push(e[l/c-1])}return n}(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,n,s){if(!this.replayGroup_)return;const r=e.viewState.resolution,o=e.viewState.rotation,a=this.getLayer(),h={},l=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,r,o,i,function(t,e,i){const r=B(t),o=h[r];if(o){if(!0!==o&&i<o.distanceSq){if(0===i)return h[r]=!0,s.splice(s.lastIndexOf(o),1),n(t,a,e);o.geometry=e,o.distanceSq=i}}else{if(0===i)return h[r]=!0,n(t,a,e);s.push(h[r]={feature:t,layer:a,geometry:e,distanceSq:i,callback:n})}},l?e.declutter?.[l]?.all().map(t=>t.value):null)}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const n=t.viewHints[Tt],s=t.viewHints[Rt],r=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!r&&n||!o&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=t.extent,h=t.viewState,l=h.projection,c=h.resolution,u=t.pixelRatio,d=e.getRevision(),g=e.getRenderBuffer();let _=e.getRenderOrder();void 0===_&&(_=id);const f=h.center.slice(),p=Ht(a,g*c),m=p.slice(),y=[p.slice()],x=l.getExtent();if(i.getWrapX()&&l.canWrapX()&&!Qt(x,t.extent)){const t=Ee(x),e=Math.max(Ee(p)/2,t);p[0]=x[0]-e,p[2]=x[2]+e,Ge(f,l);const i=Me(y[0],l);i[0]<x[0]&&i[2]<x[2]?y.push([i[0]+t,i[1],i[2]+t,i[3]]):i[0]>x[0]&&i[2]>x[2]&&y.push([i[0]-t,i[1],i[2]-t,i[3]])}if(this.ready&&this.renderedResolution_==c&&this.renderedRevision_==d&&this.renderedRenderOrder_==_&&this.renderedFrameDeclutter_===!!t.declutter&&Qt(this.wrappedRenderedExtent_,p))return I(this.renderedExtent_,m)||(this.hitDetectionImageData_=null,this.renderedExtent_=m),this.renderedCenter_=f,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const v=new ku(sd(c,u),p,c,u),C=sn();let w;if(C){for(let t=0,e=y.length;t<e;++t){const e=an(y[t],l);i.loadFeatures(e,ln(c,l),C)}w=$i(C,l)}else for(let t=0,e=y.length;t<e;++t)i.loadFeatures(y[t],c,l);const S=nd(c,u);let E=!0;const T=(t,i)=>{let n;const s=t.getStyleFunction()||e.getStyleFunction();if(s&&(n=s(t,c)),n){const e=this.renderFeature(t,S,n,v,w,this.getLayer().getDeclutter(),i);E=E&&!e}},R=an(p,l),M=i.getFeaturesInExtent(R);_&&M.sort(_);for(let t=0,e=M.length;t<e;++t)T(M[t],t);this.renderedFeatures_=M,this.ready=E;const P=v.finish(),F=new Ju(p,c,u,i.getOverlaps(),P,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=c,this.renderedRevision_=d,this.renderedRenderOrder_=_,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=m,this.wrappedRenderedExtent_=p,this.renderedCenter_=f,this.renderedProjection_=l,this.renderedPixelRatio_=u,this.replayGroup_=F,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,n,s,r,o){if(!i)return!1;let a=!1;if(Array.isArray(i))for(let h=0,l=i.length;h<l;++h)a=rd(n,t,i[h],e,this.boundHandleStyleImageChange_,s,r,o)||a;else a=rd(n,t,i,e,this.boundHandleStyleImageChange_,s,r,o);return a}};const hd=class extends mu{constructor(t){super(t),this.vectorRenderer_=new ad(t),this.layerImageRatio_=t.getImageRatio(),this.coordinateToVectorPixelTransform_=[1,0,0,1,0,0],this.renderedPixelToCoordinateTransform_=null}disposeInternal(){this.vectorRenderer_.dispose(),super.disposeInternal()}getFeatures(t){if(!this.vectorRenderer_)return Promise.resolve([]);const e=gn(this.coordinateToVectorPixelTransform_,gn(this.renderedPixelToCoordinateTransform_,t.slice()));return this.vectorRenderer_.getFeatures(e)}handleFontsChanged(){this.vectorRenderer_.handleFontsChanged()}prepareFrame(t){const e=t.pixelRatio,i=t.viewState,n=i.resolution,s=t.viewHints,r=this.vectorRenderer_;let o=t.extent;1!==this.layerImageRatio_&&(o=o.slice(0),function(t,e){const i=(t[2]-t[0])/2*(e-1),n=(t[3]-t[1])/2*(e-1);t[0]-=i,t[2]+=i,t[1]-=n,t[3]+=n}(o,this.layerImageRatio_));const a=Ee(o)/n,h=ve(o)/n;if(!s[Tt]&&!s[Rt]&&!Te(o)){r.useContainer(null,null);const s=r.context,c=t.layerStatesArray[t.layerIndex],u=Object.assign({},c,{opacity:1}),d=Object.assign({},t,{extent:o,size:[a,h],viewState:Object.assign({},t.viewState,{rotation:0}),layerStatesArray:[u],layerIndex:0,declutter:null}),g=this.getLayer().getDeclutter();g&&(d.declutter={[g]:new eo(9)});const _=new pu(o,n,e,s.canvas,function(t){r.prepareFrame(d)&&r.replayGroupChanged&&(r.clipping=!1,r.renderFrame(d,null),r.renderDeclutter(d),r.renderDeferred(d),t())});_.addEventListener(l,()=>{if(_.getState()!==uh)return;this.image=_;const t=_.getPixelRatio(),n=(s=_.getResolution(),(Array.isArray(s)?Math.min(...s):s)*e/t);var s;this.renderedResolution=n,this.coordinateToVectorPixelTransform_=_n(this.coordinateToVectorPixelTransform_,a/2,h/2,1/n,-1/n,0,-i.center[0],-i.center[1])}),_.load()}return this.image&&(this.renderedPixelToCoordinateTransform_=t.pixelToCoordinateTransform.slice()),!this.getLayer().getSource()?.loading&&!!this.image}preRender(){}postRender(){}renderDeclutter(){}forEachFeatureAtCoordinate(t,e,i,n,s){return this.vectorRenderer_?this.vectorRenderer_.forEachFeatureAtCoordinate(t,e,i,n,s):super.forEachFeatureAtCoordinate(t,e,i,n,s)}};const ld=class extends Ol{constructor(t){t=t||{};const e=Object.assign({},t);delete e.imageRatio,super(e),this.imageRatio_=void 0!==t.imageRatio?t.imageRatio:1}getImageRatio(){return this.imageRatio_}createRenderer(){return new hd(this)}};const cd=class extends Ol{constructor(t){super(t)}createRenderer(){return new ad(this)}};var ud=s(2085),dd=s.n(ud);class gd extends In{constructor(t,e,i){super(),void 0!==i&&void 0===e?this.setFlatCoordinates(i,t):(e=e||0,this.setCenterAndRadius(t,e,i))}clone(){const t=new gd(this.flatCoordinates.slice(),void 0,this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const s=this.flatCoordinates,r=t-s[0],o=e-s[1],a=r*r+o*o;if(a<n){if(0===a)for(let t=0;t<this.stride;++t)i[t]=s[t];else{const t=this.getRadius()/Math.sqrt(a);i[0]=s[0]+t*r,i[1]=s[1]+t*o;for(let t=2;t<this.stride;++t)i[t]=s[t]}return i.length=this.stride,a}return n}containsXY(t,e){const i=this.flatCoordinates,n=t-i[0],s=e-i[1];return n*n+s*s<=this.getRadiusSquared_()}getCenter(){return this.flatCoordinates.slice(0,this.stride)}computeExtent(t){const e=this.flatCoordinates,i=e[this.stride]-e[0];return ne(e[0]-i,e[1]-i,e[0]+i,e[1]+i,t)}getRadius(){return Math.sqrt(this.getRadiusSquared_())}getRadiusSquared_(){const t=this.flatCoordinates[this.stride]-this.flatCoordinates[0],e=this.flatCoordinates[this.stride+1]-this.flatCoordinates[1];return t*t+e*e}getType(){return"Circle"}intersectsExtent(t){if(Ie(t,this.getExtent())){const e=this.getCenter();return t[0]<=e[0]&&t[2]>=e[0]||(t[1]<=e[1]&&t[3]>=e[1]||de(t,this.intersectsCoordinate.bind(this)))}return!1}setCenter(t){const e=this.stride,i=this.flatCoordinates[e]-this.flatCoordinates[0],n=t.slice();n[e]=n[0]+i;for(let i=1;i<e;++i)n[e+i]=t[i];this.setFlatCoordinates(this.layout,n),this.changed()}setCenterAndRadius(t,e,i){this.setLayout(i,t,0),this.flatCoordinates||(this.flatCoordinates=[]);const n=this.flatCoordinates;let s=An(n,0,t,this.stride);n[s++]=n[0]+e;for(let t=1,e=this.stride;t<e;++t)n[s++]=n[t];n.length=s,this.changed()}getCoordinates(){return null}setCoordinates(t,e){}setRadius(t){this.flatCoordinates[this.stride]=this.flatCoordinates[0]+t,this.changed()}rotate(t,e){const i=this.getCenter(),n=this.getStride();this.setCenter(vn(i,0,i.length,n,t,e,i)),this.changed()}}gd.prototype.transform;const _d=gd;class fd extends In{constructor(t,e){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}appendCoordinate(t){E(this.flatCoordinates,t),this.changed()}clone(){const t=new fd(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<$t(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Pn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),bn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,i,n))}forEachSegment(t){return Qn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinateAtM(t,e){return"XYM"!=this.layout&&"XYZM"!=this.layout?null:(e=void 0!==e&&e,$l(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return On(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return ql(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return Du(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){const e=[];return e.length=Wn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new fd(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return ts(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,this.getExtent())}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=kn(this.flatCoordinates,0,t,this.stride),this.changed()}}const pd=fd,md="element",yd="map",xd="offset",vd="position",Cd="positioning";const wd=class extends V{constructor(t){super(),this.on,this.once,this.un,this.options=t,this.id=t.id,this.insertFirst=void 0===t.insertFirst||t.insertFirst,this.stopEvent=void 0===t.stopEvent||t.stopEvent,this.element=document.createElement("div"),this.element.className=void 0!==t.className?t.className:"ol-overlay-container ol-selectable",this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=!0===t.autoPan?{}:t.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(md,this.handleElementChanged),this.addChangeListener(yd,this.handleMapChanged),this.addChangeListener(xd,this.handleOffsetChanged),this.addChangeListener(vd,this.handlePositionChanged),this.addChangeListener(Cd,this.handlePositioningChanged),void 0!==t.element&&this.setElement(t.element),this.setOffset(void 0!==t.offset?t.offset:[0,0]),this.setPositioning(t.positioning||"top-left"),void 0!==t.position&&this.setPosition(t.position)}getElement(){return this.get(md)}getId(){return this.id}getMap(){return this.get(yd)||null}getOffset(){return this.get(xd)}getPosition(){return this.get(vd)}getPositioning(){return this.get(Cd)}handleElementChanged(){Gs(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){this.mapPostrenderListenerKey&&(this.element?.remove(),G(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=D(t,ht,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(md,t)}setMap(t){this.set(yd,t)}setOffset(t){this.set(xd,t)}setPosition(t){this.set(vd,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get(vd))return;const i=this.getRect(e.getTargetElement(),e.getSize()),n=this.getElement(),s=this.getRect(n,[ks(n),Ds(n)]),r=void 0===(t=t||{}).margin?20:t.margin;if(!Qt(i,s)){const n=s[0]-i[0],o=i[2]-s[2],a=s[1]-i[1],h=i[3]-s[3],l=[0,0];if(n<0?l[0]=n-r:o<0&&(l[0]=Math.abs(o)+r),a<0?l[1]=a-r:h<0&&(l[1]=Math.abs(h)+r),0!==l[0]||0!==l[1]){const i=e.getView().getCenterInternal(),n=e.getPixelFromCoordinateInternal(i);if(!n)return;const s=[n[0]+l[0],n[1]+l[1]],r=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(s),duration:r.duration,easing:r.easing})}}}getRect(t,e){const i=t.getBoundingClientRect(),n=i.left+window.pageXOffset,s=i.top+window.pageYOffset;return[n,s,n+e[0],s+e[1]]}setPositioning(t){this.set(Cd,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)return void this.setVisible(!1);const i=t.getPixelFromCoordinate(e),n=t.getSize();this.updateRenderedPosition(i,n)}updateRenderedPosition(t,e){const i=this.element.style,n=this.getOffset(),s=this.getPositioning();this.setVisible(!0);let r="0%",o="0%";"bottom-right"==s||"center-right"==s||"top-right"==s?r="-100%":"bottom-center"!=s&&"center-center"!=s&&"top-center"!=s||(r="-50%"),"bottom-left"==s||"bottom-center"==s||"bottom-right"==s?o="-100%":"center-left"!=s&&"center-center"!=s&&"center-right"!=s||(o="-50%");const a=`translate(${r}, ${o}) translate(${`${t[0]+n[0]}px`}, ${`${t[1]+n[1]}px`})`;this.rendered.transform_!=a&&(this.rendered.transform_=a,i.transform=a)}getOptions(){return this.options}};class Sd extends In{constructor(t,e,i){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(t[0]))this.setCoordinates(t,e);else if(void 0!==e&&i)this.setFlatCoordinates(e,t),this.ends_=i;else{const e=t,i=[],n=[];for(let t=0,s=e.length;t<s;++t){E(i,e[t].getFlatCoordinates()),n.push(i.length)}const s=0===e.length?this.getLayout():e[0].getLayout();this.setFlatCoordinates(s,i),this.ends_=n}}appendLineString(t){E(this.flatCoordinates,t.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Sd(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<$t(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Fn(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Ln(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,t,e,i,n))}getCoordinateAtM(t,e,i){return"XYM"!=this.layout&&"XYZM"!=this.layout||0===this.flatCoordinates.length?null:(e=void 0!==e&&e,i=void 0!==i&&i,function(t,e,i,n,s,r,o){if(o)return $l(t,e,i[i.length-1],n,s,r);let a;if(s<t[n-1])return r?(a=t.slice(0,n),a[n-1]=s,a):null;if(t[t.length-1]<s)return r?(a=t.slice(t.length-n),a[n-1]=s,a):null;for(let r=0,o=i.length;r<o;++r){const o=i[r];if(e!=o){if(s<t[e+n-1])return null;if(s<=t[o-1])return $l(t,e,o,n,s,!1);e=o}}return null}(this.flatCoordinates,0,this.ends_,this.stride,t,e,i))}getCoordinates(){return Gn(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new pd(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLineStrings(){const t=this.flatCoordinates,e=this.ends_,i=this.layout,n=[];let s=0;for(let r=0,o=e.length;r<o;++r){const o=e[r],a=new pd(t.slice(s,o),i);n.push(a),s=o}return n}getLength(){const t=this.ends_;let e=0,i=0;for(let n=0,s=t.length;n<s;++n)i+=Du(this.flatCoordinates,e,t[n],this.stride),e=t[n];return i}getFlatMidpoints(){const t=[],e=this.flatCoordinates;let i=0;const n=this.ends_,s=this.stride;for(let r=0,o=n.length;r<o;++r){const o=n[r];E(t,ql(e,i,o,s,.5)),i=o}return t}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=Nn(this.flatCoordinates,0,this.ends_,this.stride,t,e,0,i),new Sd(e,"XY",i)}getType(){return"MultiLineString"}intersectsExtent(t){return function(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){if(ts(t,e,i[r],n,s))return!0;e=i[r]}return!1}(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=Dn(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}const Ed=Sd;class Id extends In{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){E(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){const t=new Id(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<$t(this.getExtent(),t,e))return n;const s=this.flatCoordinates,r=this.stride;for(let o=0,a=s.length;o<a;o+=r){const a=bt(t,e,s[o],s[o+1]);if(a<n){n=a;for(let t=0;t<r;++t)i[t]=s[o+t];i.length=r}}return n}getCoordinates(){return On(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){const e=this.flatCoordinates.length/this.stride;return t<0||e<=t?null:new Zn(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){const t=this.flatCoordinates,e=this.layout,i=this.stride,n=[];for(let s=0,r=t.length;s<r;s+=i){const r=new Zn(t.slice(s,s+i),e);n.push(r)}return n}getType(){return"MultiPoint"}intersectsExtent(t){const e=this.flatCoordinates,i=this.stride;for(let n=0,s=e.length;n<s;n+=i){if(te(t,e[n],e[n+1]))return!0}return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=kn(this.flatCoordinates,0,t,this.stride),this.changed()}}const Td=Id;class Rd extends In{constructor(t,e,i){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!i&&!Array.isArray(t[0])){const n=t,s=[],r=[];for(let t=0,e=n.length;t<e;++t){const e=n[t],i=s.length,o=e.getEnds();for(let t=0,e=o.length;t<e;++t)o[t]+=i;E(s,e.getFlatCoordinates()),r.push(o)}e=0===n.length?this.getLayout():n[0].getLayout(),t=s,i=r}void 0!==e&&i?(this.setFlatCoordinates(e,t),this.endss_=i):this.setCoordinates(t,e)}appendPolygon(t){let e;if(this.flatCoordinates){const i=this.flatCoordinates.length;E(this.flatCoordinates,t.getFlatCoordinates()),e=t.getEnds().slice();for(let t=0,n=e.length;t<n;++t)e[t]+=i}else this.flatCoordinates=t.getFlatCoordinates().slice(),e=t.getEnds().slice(),this.endss_.push();this.endss_.push(e),this.changed()}clone(){const t=this.endss_.length,e=new Array(t);for(let i=0;i<t;++i)e[i]=this.endss_[i].slice();const i=new Rd(this.flatCoordinates.slice(),this.layout,e);return i.applyProperties(this),i}closestPointXY(t,e,i,n){return n<$t(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(function(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r];s=Fn(t,e,o,n,s),e=o[o.length-1]}return s}(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),function(t,e,i,n,s,r,o,a,h,l,c){c=c||[NaN,NaN];for(let u=0,d=i.length;u<d;++u){const d=i[u];l=Ln(t,e,d,n,s,r,o,a,h,l,c),e=d[d.length-1]}return l}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return function(t,e,i,n,s,r){if(0===i.length)return!1;for(let o=0,a=i.length;o<a;++o){const a=i[o];if(qn(t,e,a,n,s,r))return!0;e=a[a.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)}getArea(){return function(t,e,i,n){let s=0;for(let r=0,o=i.length;r<o;++r){const o=i[r];s+=Rn(t,e,o,n),e=o[o.length-1]}return s}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),as(e,0,this.endss_,this.stride,t)):e=this.flatCoordinates,zn(e,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const t=Hl(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Jn(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new Td(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;!function(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r];if(!rs(t,e,o,n,s))return!1;o.length&&(e=o[o.length-1])}return!0}(t,0,this.endss_,this.stride)?(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=as(this.orientedFlatCoordinates_,0,this.endss_,this.stride)):this.orientedFlatCoordinates_=t,this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=function(t,e,i,n,s,r,o,a){for(let h=0,l=i.length;h<l;++h){const l=i[h],c=[];o=Kn(t,e,l,n,s,r,o,c),a.push(c),e=l[l.length-1]}return o}(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),e,0,i),new Rd(e,"XY",i)}getPolygon(t){if(t<0||this.endss_.length<=t)return null;let e;if(0===t)e=0;else{const i=this.endss_[t-1];e=i[i.length-1]}const i=this.endss_[t].slice(),n=i[i.length-1];if(0!==e)for(let t=0,n=i.length;t<n;++t)i[t]-=e;return new ls(this.flatCoordinates.slice(e,n),this.layout,i)}getPolygons(){const t=this.layout,e=this.flatCoordinates,i=this.endss_,n=[];let s=0;for(let r=0,o=i.length;r<o;++r){const o=i[r].slice(),a=o[o.length-1];if(0!==s)for(let t=0,e=o.length;t<e;++t)o[t]-=s;const h=new ls(e.slice(s,a),t,o);n.push(h),s=a}return n}getType(){return"MultiPolygon"}intersectsExtent(t){return function(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r];if(is(t,e,o,n,s))return!0;e=o[o.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,3),this.flatCoordinates||(this.flatCoordinates=[]);const i=function(t,e,i,n,s){s=s||[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=Dn(t,e,i[o],n,s[r]);0===a.length&&(a[0]=e),s[r++]=a,e=a[a.length-1]}return s.length=r,s}(this.flatCoordinates,0,t,this.stride,this.endss_);if(0===i.length)this.flatCoordinates.length=0;else{const t=i[i.length-1];this.flatCoordinates.length=0===t.length?0:t[t.length-1]}this.changed()}}const Md=Rd;class Pd extends Sn{constructor(t){super(),this.geometries_=t,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(G),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const t=this.geometries_;for(let e=0,i=t.length;e<i;++e)this.changeEventsKeys_.push(D(t[e],l,this.changed,this))}clone(){const t=new Pd(Fd(this.geometries_));return t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<$t(this.getExtent(),t,e))return n;const s=this.geometries_;for(let r=0,o=s.length;r<o;++r)n=s[r].closestPointXY(t,e,i,n);return n}containsXY(t,e){const i=this.geometries_;for(let n=0,s=i.length;n<s;++n)if(i[n].containsXY(t,e))return!0;return!1}computeExtent(t){se(t);const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)he(t,e[i].getExtent());return t}getGeometries(){return Fd(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let t=[];const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)e[i].getType()===this.getType()?t=t.concat(e[i].getGeometriesArrayRecursive()):t.push(e[i]);return t}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=[],i=this.geometries_;let n=!1;for(let s=0,r=i.length;s<r;++s){const r=i[s],o=r.getSimplifiedGeometry(t);e.push(o),o!==r&&(n=!0)}if(n){return new Pd(e)}return this.simplifiedGeometryMaxMinSquaredTolerance=t,this}getType(){return"GeometryCollection"}intersectsExtent(t){const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)if(e[i].intersectsExtent(t))return!0;return!1}isEmpty(){return 0===this.geometries_.length}rotate(t,e){const i=this.geometries_;for(let n=0,s=i.length;n<s;++n)i[n].rotate(t,e);this.changed()}scale(t,e,i){i||(i=pe(this.getExtent()));const n=this.geometries_;for(let s=0,r=n.length;s<r;++s)n[s].scale(t,e,i);this.changed()}setGeometries(t){this.setGeometriesArray(Fd(t))}setGeometriesArray(t){this.unlistenGeometriesChange_(),this.geometries_=t,this.listenGeometriesChange_(),this.changed()}applyTransform(t){const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)e[i].applyTransform(t);this.changed()}translate(t,e){const i=this.geometries_;for(let n=0,s=i.length;n<s;++n)i[n].translate(t,e);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function Fd(t){return t.map(t=>t.clone())}const bd=Pd;function Ld(t,e){const i=t.length;return e<0?t[e+i]:e>=i?t[e-i]:t[e]}function Ad(t,e){const i=t.length;let n=Math.floor(e);const s=e-n;n>=i?n-=i:n<0&&(n+=i);let r=n+1;r>=i&&(r-=i);const o=t[n],a=o[0],h=o[1],l=t[r];return[a+(l[0]-a)*s,h+(l[1]-h)*s]}const kd={index:-1,endIndex:NaN,closestTargetDistance:1/0};function Dd(t,e,i,n){const s=t[0],r=t[1];let o=1/0,a=-1,h=NaN;for(let t=0;t<e.targets.length;++t){const i=e.targets[t],n=i.coordinates;let l,c=1/0;for(let t=0;t<n.length-1;++t){const e=Bd(s,r,n[t],n[t+1]);e.squaredDistance<c&&(c=e.squaredDistance,l=t+e.along)}c<o&&(o=c,i.ring&&e.targetIndex===t&&(i.endIndex>i.startIndex?l<i.startIndex&&(l+=n.length):i.endIndex<i.startIndex&&l>i.startIndex&&(l-=n.length)),h=l,a=t)}const l=e.targets[a];let c=l.ring;if(e.targetIndex===a&&c){const t=Ad(l.coordinates,h);Oe(i.getPixelFromCoordinate(t),i.getPixelFromCoordinate(e.startCoord))>n&&(c=!1)}if(c){const t=l.coordinates,e=t.length,i=l.startIndex,n=h;if(i<n){const s=Nd(t,i,n);Nd(t,i,n-e)<s&&(h-=e)}else{const s=Nd(t,i,n);Nd(t,i,n+e)<s&&(h+=e)}}return kd.index=a,kd.endIndex=h,kd.closestTargetDistance=o,kd}function Od(t,e){const i=[];for(let n=0;n<e.length;++n){Gd(t,e[n].getGeometry(),i)}return i}function Gd(t,e,i){if(e instanceof pd)zd(t,e.getCoordinates(),!1,i);else{if(e instanceof Ed){const n=e.getCoordinates();for(let e=0,s=n.length;e<s;++e)zd(t,n[e],!1,i);return}if(e instanceof ls){const n=e.getCoordinates();for(let e=0,s=n.length;e<s;++e)zd(t,n[e],!0,i);return}if(e instanceof Md){const n=e.getCoordinates();for(let e=0,s=n.length;e<s;++e){const s=n[e];for(let e=0,n=s.length;e<n;++e)zd(t,s[e],!0,i)}return}if(e instanceof bd){const n=e.getGeometries();for(let e=0;e<n.length;++e)Gd(t,n[e],i);return}}}function zd(t,e,i,n){const s=t[0],r=t[1];for(let t=0,o=e.length-1;t<o;++t){const o=Bd(s,r,e[t],e[t+1]);if(0===o.squaredDistance){const s=t+o.along;return void n.push({coordinates:e,ring:i,startIndex:s,endIndex:s})}}}function Wd(t,e){return bt(t[0],t[1],e[0],e[1])}function Nd(t,e,i){let n,s;e<i?(n=e,s=i):(n=i,s=e);const r=Math.ceil(n),o=Math.floor(s);if(r>o){return Wd(Ad(t,n),Ad(t,s))}let a=0;if(n<r){a+=Wd(Ad(t,n),Ld(t,r))}if(o<s){a+=Wd(Ld(t,o),Ad(t,s))}for(let e=r;e<o-1;++e){a+=Wd(Ld(t,e),Ld(t,e+1))}return a}const Xd={along:0,squaredDistance:0};function Bd(t,e,i,n){const s=i[0],r=i[1],o=n[0]-s,a=n[1]-r;let h=0,l=s,c=r;return 0===o&&0===a||(h=Pt(((t-s)*o+(e-r)*a)/(o*o+a*a),0,1),l+=o*h,c+=a*h),Xd.along=h,Xd.squaredDistance=Ot(bt(t,e,l,c),10),Xd}const Kd=[0,0,0,0],Vd=[],jd="modifystart",Yd="modifyend";function Zd(t,e,i){let n;switch(e){case"LineString":n=t;break;case"MultiLineString":case"Polygon":n=t[i[0]];break;case"MultiPolygon":n=t[i[1]][i[0]]}return n}class Ud extends A{constructor(t,e,i){super(t),this.features=e,this.mapBrowserEvent=i}}function Hd(t,e){return t.index-e.index}function qd(t,e,i){const n=e.geometry;if("Circle"===n.getType()){let s=n;if(1===e.index){const e=sn();e&&(s=s.clone().transform(e,i));const n=De(s.getCenter(),on(t,i)),r=Math.sqrt(n)-s.getRadius();return r*r}}const s=on(t,i);return Vd[0]=on(e.segment[0],i),Vd[1]=on(e.segment[1],i),function(t,e){return De(t,be(t,e))}(s,Vd)}function $d(t,e,i){const n=e.geometry;if("Circle"===n.getType()&&1===e.index){let e=n;const s=sn();return s&&(e=e.clone().transform(s,i)),rn(e.getClosestPoint(on(t,i)),i)}const s=on(t,i);return Vd[0]=on(e.segment[0],i),Vd[1]=on(e.segment[1],i),rn(be(s,Vd),i)}function Jd(){const t=al();return function(e,i){return t.Point}}const Qd=class extends hr{constructor(t){let e;if(super(t),this.on,this.once,this.un,this.boundHandleFeatureChange_=this.handleFeatureChange_.bind(this),this.condition_=t.condition?t.condition:or,this.defaultDeleteCondition_=function(t){return function(t){const e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey}(t)&&er(t)},this.deleteCondition_=t.deleteCondition?t.deleteCondition:this.defaultDeleteCondition_,this.insertVertexCondition_=t.insertVertexCondition?t.insertVertexCondition:Js,this.vertexFeature_=null,this.vertexSegments_=null,this.lastCoordinate_=[0,0],this.ignoreNextSingleClick_=!1,this.featuresBeingModified_=null,this.rBush_=new ec,this.pixelTolerance_=void 0!==t.pixelTolerance?t.pixelTolerance:10,this.snappedToVertex_=!1,this.changingFeature_=!1,this.dragSegments_=[],this.overlay_=new cd({source:new dc({useSpatialIndex:!1,wrapX:!!t.wrapX}),style:t.style?t.style:Jd(),updateWhileAnimating:!0,updateWhileInteracting:!0}),this.SEGMENT_WRITERS_={Point:this.writePointGeometry_.bind(this),LineString:this.writeLineStringGeometry_.bind(this),LinearRing:this.writeLineStringGeometry_.bind(this),Polygon:this.writePolygonGeometry_.bind(this),MultiPoint:this.writeMultiPointGeometry_.bind(this),MultiLineString:this.writeMultiLineStringGeometry_.bind(this),MultiPolygon:this.writeMultiPolygonGeometry_.bind(this),Circle:this.writeCircleGeometry_.bind(this),GeometryCollection:this.writeGeometryCollectionGeometry_.bind(this)},this.source_=null,this.traceSource_=t.traceSource||t.source||null,this.traceCondition_,this.setTrace(t.trace||!1),this.traceState_={active:!1},this.traceSegments_=null,this.hitDetection_=null,t.features?e=t.features:t.source&&(this.source_=t.source,e=new Z(this.source_.getFeatures()),this.source_.addEventListener(sc,this.handleSourceAdd_.bind(this)),this.source_.addEventListener(ac,this.handleSourceRemove_.bind(this))),!e)throw new Error("The modify interaction requires features, a source or a layer");t.hitDetection&&(this.hitDetection_=t.hitDetection),this.features_=e,this.features_.forEach(this.addFeature_.bind(this)),this.features_.addEventListener(o,this.handleFeatureAdd_.bind(this)),this.features_.addEventListener(a,this.handleFeatureRemove_.bind(this)),this.lastPointerEvent_=null,this.delta_=[0,0],this.snapToPointer_=void 0===t.snapToPointer?!this.hitDetection_:t.snapToPointer}setTrace(t){let e;e=t?!0===t?Js:t:tr,this.traceCondition_=e}addFeature_(t){const e=t.getGeometry();if(e){const i=this.SEGMENT_WRITERS_[e.getType()];i&&i(t,e)}const i=this.getMap();i&&i.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastCoordinate_),t.addEventListener(l,this.boundHandleFeatureChange_)}willModifyFeatures_(t,e){if(!this.featuresBeingModified_){this.featuresBeingModified_=new Z;const i=this.featuresBeingModified_.getArray();for(let t=0,n=e.length;t<n;++t){const n=e[t].feature;n&&!i.includes(n)&&this.featuresBeingModified_.push(n)}0===this.featuresBeingModified_.getLength()?this.featuresBeingModified_=null:this.dispatchEvent(new Ud(jd,this.featuresBeingModified_,t))}}removeFeature_(t){this.removeFeatureSegmentData_(t),this.vertexFeature_&&0===this.features_.getLength()&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.removeEventListener(l,this.boundHandleFeatureChange_)}removeFeatureSegmentData_(t){const e=this.rBush_,i=[];e.forEach(function(e){t===e.feature&&i.push(e)});for(let t=i.length-1;t>=0;--t){const n=i[t];for(let t=this.dragSegments_.length-1;t>=0;--t)this.dragSegments_[t][0]===n&&this.dragSegments_.splice(t,1);e.remove(n)}}setActive(t){this.vertexFeature_&&!t&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),super.setActive(t)}setMap(t){this.overlay_.setMap(t),super.setMap(t)}getOverlay(){return this.overlay_}handleSourceAdd_(t){t.feature&&this.features_.push(t.feature)}handleSourceRemove_(t){t.feature&&this.features_.remove(t.feature)}handleFeatureAdd_(t){this.addFeature_(t.element)}handleFeatureChange_(t){if(!this.changingFeature_){const e=t.target;this.removeFeature_(e),this.addFeature_(e)}}handleFeatureRemove_(t){this.removeFeature_(t.element)}writePointGeometry_(t,e){const i=e.getCoordinates(),n={feature:t,geometry:e,segment:[i,i]};this.rBush_.insert(e.getExtent(),n)}writeMultiPointGeometry_(t,e){const i=e.getCoordinates();for(let n=0,s=i.length;n<s;++n){const s=i[n],r={feature:t,geometry:e,depth:[n],index:n,segment:[s,s]};this.rBush_.insert(e.getExtent(),r)}}writeLineStringGeometry_(t,e){const i=e.getCoordinates();for(let n=0,s=i.length-1;n<s;++n){const s=i.slice(n,n+2),r={feature:t,geometry:e,index:n,segment:s};this.rBush_.insert(Ut(s),r)}}writeMultiLineStringGeometry_(t,e){const i=e.getCoordinates();for(let n=0,s=i.length;n<s;++n){const s=i[n];for(let i=0,r=s.length-1;i<r;++i){const r=s.slice(i,i+2),o={feature:t,geometry:e,depth:[n],index:i,segment:r};this.rBush_.insert(Ut(r),o)}}}writePolygonGeometry_(t,e){const i=e.getCoordinates();for(let n=0,s=i.length;n<s;++n){const s=i[n];for(let i=0,r=s.length-1;i<r;++i){const r=s.slice(i,i+2),o={feature:t,geometry:e,depth:[n],index:i,segment:r};this.rBush_.insert(Ut(r),o)}}}writeMultiPolygonGeometry_(t,e){const i=e.getCoordinates();for(let n=0,s=i.length;n<s;++n){const s=i[n];for(let i=0,r=s.length;i<r;++i){const r=s[i];for(let s=0,o=r.length-1;s<o;++s){const o=r.slice(s,s+2),a={feature:t,geometry:e,depth:[i,n],index:s,segment:o};this.rBush_.insert(Ut(o),a)}}}}writeCircleGeometry_(t,e){const i=e.getCenter(),n={feature:t,geometry:e,index:0,segment:[i,i]},s={feature:t,geometry:e,index:1,segment:[i,i]},r=[n,s];n.featureSegments=r,s.featureSegments=r,this.rBush_.insert(re(i),n);let o=e;const a=sn();if(a&&this.getMap()){const t=this.getMap().getView().getProjection();o=o.clone().transform(a,t),o=us(o).transform(t,a)}this.rBush_.insert(o.getExtent(),s)}writeGeometryCollectionGeometry_(t,e){const i=e.getGeometriesArray();for(let e=0;e<i.length;++e){const n=i[e];(0,this.SEGMENT_WRITERS_[n.getType()])(t,n)}}createOrUpdateVertexFeature_(t,e,i,n){let s=this.vertexFeature_;if(s){s.getGeometry().setCoordinates(t)}else s=new jl(new Zn(t)),this.vertexFeature_=s,this.overlay_.getSource().addFeature(s);return s.set("features",e),s.set("geometries",i),s.set("existing",n),s}handleEvent(t){if(!t.originalEvent)return!0;let e;return this.lastPointerEvent_=t,t.map.getView().getInteracting()||t.type!=q.POINTERMOVE||this.handlingDownUpSequence||this.handlePointerMove_(t),this.vertexFeature_&&this.deleteCondition_(t)&&(e=!(t.type!=q.SINGLECLICK||!this.ignoreNextSingleClick_)||this.removePoint()),t.type==q.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),super.handleEvent(t)&&!e}findInsertVerticesAndUpdateDragSegments_(t){this.handlePointerAtPixel_(t),this.dragSegments_.length=0,this.featuresBeingModified_=null;if(!this.vertexFeature_)return;const e=this.getMap().getView().getProjection(),i=[],n=this.vertexFeature_.getGeometry().getCoordinates(),s=Ut([n]),r=this.rBush_.getInExtent(s),o={};r.sort(Hd);for(let s=0,a=r.length;s<a;++s){const a=r[s],h=a.segment;let l=B(a.geometry);const c=a.depth;if(c&&(l+="-"+c.join("-")),o[l]||(o[l]=new Array(2)),"Circle"===a.geometry.getType()&&1===a.index){Le($d(t,a,e),n)&&!o[l][0]&&(this.dragSegments_.push([a,0]),o[l][0]=a);continue}if(!Le(h[0],n)||o[l][0])if(!Le(h[1],n)||o[l][1])!(B(h)in this.vertexSegments_)||o[l][0]||o[l][1]||i.push(a);else{if(o[l][0]&&0===o[l][0].index){let t=a.geometry.getCoordinates();switch(a.geometry.getType()){case"LineString":case"MultiLineString":continue;case"MultiPolygon":t=t[c[1]];case"Polygon":if(a.index!==t[c[0]].length-2)continue}}this.dragSegments_.push([a,1]),o[l][1]=a}else this.dragSegments_.push([a,0]),o[l][0]=a}return i}deactivateTrace_(){this.traceState_={active:!1}}updateTrace_(t){const e=this.traceState_;if(!e.active)return;if(-1===e.targetIndex){if(Oe(t.map.getPixelFromCoordinate(e.startCoord),t.pixel)<this.pixelTolerance_)return}const i=Dd(t.coordinate,e,t.map,this.pixelTolerance_);if(-1===e.targetIndex&&Math.sqrt(i.closestTargetDistance)/t.map.getView().getResolution()>this.pixelTolerance_)return;if(e.targetIndex!==i.index){if(-1!==e.targetIndex){const t=e.targets[e.targetIndex];this.removeTracedCoordinates_(t.startIndex,t.endIndex)}else for(const t of this.traceSegments_){const e=t[0],i=e.geometry,n=t[1],s=i.getCoordinates();Zd(s,i.getType(),e.depth).splice(e.index+n,1),i.setCoordinates(s),0===n&&(e.index-=1)}const t=e.targets[i.index];this.addTracedCoordinates_(t,t.startIndex,i.endIndex)}else{const t=e.targets[e.targetIndex];this.addOrRemoveTracedCoordinates_(t,i.endIndex)}e.targetIndex=i.index;e.targets[e.targetIndex].endIndex=i.endIndex}getTraceCandidates_(t){const e=this.getMap(),i=this.pixelTolerance_,n=Ut([e.getCoordinateFromPixel([t.pixel[0]-i,t.pixel[1]+i]),e.getCoordinateFromPixel([t.pixel[0]+i,t.pixel[1]-i])]);return this.traceSource_.getFeaturesInExtent(n)}toggleTraceState_(t){if(!this.traceSource_||!this.traceCondition_(t))return;if(this.traceState_.active)return this.deactivateTrace_(),void(this.traceSegments_=null);const e=this.getTraceCandidates_(t);if(0===e.length)return;const i=Od(t.coordinate,e);i.length&&(this.traceState_={active:!0,startCoord:t.coordinate.slice(),targets:i,targetIndex:-1})}addOrRemoveTracedCoordinates_(t,e){const i=t.startIndex<=t.endIndex;i===t.startIndex<=e?i&&e>t.endIndex||!i&&e<t.endIndex?this.addTracedCoordinates_(t,t.endIndex,e):(i&&e<t.endIndex||!i&&e>t.endIndex)&&this.removeTracedCoordinates_(e,t.endIndex):(this.removeTracedCoordinates_(t.startIndex,t.endIndex),this.addTracedCoordinates_(t,t.startIndex,e))}removeTracedCoordinates_(t,e){if(t===e)return;let i=0;if(t<e){const n=Math.ceil(t);let s=Math.floor(e);s===e&&(s-=1),i=s-n+1}else{const n=Math.floor(t);let s=Math.ceil(e);s===e&&(s+=1),i=n-s+1}if(i>0)for(const t of this.traceSegments_){const e=t[0],n=e.geometry,s=t[1];let r=t[0].index+1;1===s&&(r-=i);const o=n.getCoordinates();Zd(o,n.getType(),e.depth).splice(r,i),n.setCoordinates(o),1===s&&(e.index-=i)}}addTracedCoordinates_(t,e,i){if(e===i)return;const n=[];if(e<i){const s=Math.ceil(e);let r=Math.floor(i);r===i&&(r-=1);for(let e=s;e<=r;++e)n.push(Ld(t.coordinates,e))}else{const s=Math.floor(e);let r=Math.ceil(i);r===i&&(r+=1);for(let e=s;e>=r;--e)n.push(Ld(t.coordinates,e))}if(n.length)for(const t of this.traceSegments_){const e=t[0],i=e.geometry,s=t[1],r=e.index+1;0===s&&n.reverse();const o=i.getCoordinates();Zd(o,i.getType(),e.depth).splice(r,0,...n),i.setCoordinates(o),1===s&&(e.index+=n.length)}}updateGeometry_(t,e){const i=e[0],n=i.depth;let s;const r=i.segment,o=i.geometry,a=e[1];for(;t.length<o.getStride();)t.push(r[a][t.length]);switch(o.getType()){case"Point":s=t,r[0]=t,r[1]=t;break;case"MultiPoint":s=o.getCoordinates(),s[i.index]=t,r[0]=t,r[1]=t;break;case"LineString":s=o.getCoordinates(),s[i.index+a]=t,r[a]=t;break;case"MultiLineString":case"Polygon":s=o.getCoordinates(),s[n[0]][i.index+a]=t,r[a]=t;break;case"MultiPolygon":s=o.getCoordinates(),s[n[1]][n[0]][i.index+a]=t,r[a]=t;break;case"Circle":const e=o;if(r[0]=t,r[1]=t,0===i.index)this.changingFeature_=!0,e.setCenter(t),this.changingFeature_=!1;else{this.changingFeature_=!0;const i=this.getMap().getView().getProjection();let n=Oe(on(e.getCenter(),i),on(t,i));const s=sn();if(s){const t=e.clone().transform(s,i);t.setRadius(n),n=t.transform(i,s).getRadius()}e.setRadius(n),this.changingFeature_=!1}}s&&this.setGeometryCoordinates_(o,s)}handleDragEvent(t){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(t,this.dragSegments_.map(([t])=>t));const e=[t.coordinate[0]+this.delta_[0],t.coordinate[1]+this.delta_[1]],i=[],n=[],s=this.traceState_.active&&!this.traceSegments_?this.traceState_.startCoord:null;if(s){this.traceSegments_=[];for(const e of this.dragSegments_){Oe(be(s,e[0].segment),s)/t.map.getView().getResolution()<1&&this.traceSegments_.push(e)}}for(let t=0,s=this.dragSegments_.length;t<s;++t){const s=this.dragSegments_[t],r=s[0],o=r.feature;i.includes(o)||i.push(o);const a=r.geometry;n.includes(a)||n.push(a),this.updateGeometry_(e,s)}this.updateTrace_(t),this.createOrUpdateVertexFeature_(e,i,n,!0)}handleDownEvent(t){if(!this.condition_(t))return!1;const e=t.coordinate,i=this.findInsertVerticesAndUpdateDragSegments_(e);if(i?.length&&this.insertVertexCondition_(t)&&(this.willModifyFeatures_(t,i),this.vertexFeature_)){const t=this.vertexFeature_.getGeometry().getCoordinates();for(let e=i.length-1;e>=0;--e)this.insertVertex_(i[e],t);this.ignoreNextSingleClick_=!0}return!!this.vertexFeature_}handleUpEvent(t){for(let e=this.dragSegments_.length-1;e>=0;--e){const i=this.dragSegments_[e][0],n=i.geometry;if("Circle"===n.getType()){const e=n,s=e.getCenter(),r=i.featureSegments[0],o=i.featureSegments[1];r.segment[0]=s,r.segment[1]=s,o.segment[0]=s,o.segment[1]=s,this.rBush_.update(re(s),r);let a=e;const h=sn();if(h){const e=t.map.getView().getProjection();a=a.clone().transform(h,e),a=us(a).transform(e,h)}this.rBush_.update(a.getExtent(),o)}else this.rBush_.update(Ut(i.segment),i)}return this.featuresBeingModified_&&(this.toggleTraceState_(t),this.dispatchEvent(new Ud(Yd,this.featuresBeingModified_,t)),this.featuresBeingModified_=null),!1}handlePointerMove_(t){this.lastCoordinate_=t.coordinate,this.handlePointerAtPixel_(this.lastCoordinate_)}handlePointerAtPixel_(t){const e=this.getMap(),i=e.getPixelFromCoordinate(t),n=e.getView().getProjection(),s=function(e,i){return qd(t,e,n)-qd(t,i,n)};let r,o;if(this.hitDetection_){const t="object"==typeof this.hitDetection_?t=>t===this.hitDetection_:void 0;e.forEachFeatureAtPixel(i,(t,e,i)=>{i&&"Point"===i.getType()&&(i=new Zn(rn(i.getCoordinates(),n)));const s=i||t.getGeometry();if(s&&"Point"===s.getType()&&t instanceof jl&&this.features_.getArray().includes(t)){o=s;const e=t.getGeometry().getFlatCoordinates().slice(0,2);r=[{feature:t,geometry:o,segment:[e,e]}]}return!0},{layerFilter:t})}if(!r){const i=an(Ht(hn(re(t,Kd),n),e.getView().getResolution()*this.pixelTolerance_,Kd),n);r=this.rBush_.getInExtent(i)}if(r&&r.length>0){const a=r.sort(s)[0],h=a.segment;let l=$d(t,a,n);const c=e.getPixelFromCoordinate(l);let u=Oe(i,c);if(o||u<=this.pixelTolerance_){const i={};if(i[B(h)]=!0,this.snapToPointer_||(this.delta_[0]=l[0]-t[0],this.delta_[1]=l[1]-t[1]),"Circle"===a.geometry.getType()&&1===a.index)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(l,[a.feature],[a.geometry],this.snappedToVertex_);else{const t=e.getPixelFromCoordinate(h[0]),n=e.getPixelFromCoordinate(h[1]),s=De(c,t),o=De(c,n);if(u=Math.sqrt(Math.min(s,o)),this.snappedToVertex_=u<=this.pixelTolerance_,!this.snappedToVertex_&&!this.insertVertexCondition_(this.lastPointerEvent_))return void(this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null));this.snappedToVertex_&&(l=s>o?h[1]:h[0]),this.createOrUpdateVertexFeature_(l,[a.feature],[a.geometry],this.snappedToVertex_);const d={};d[B(a.geometry)]=!0;for(let t=1,e=r.length;t<e;++t){const e=r[t].segment;if(!(Le(h[0],e[0])&&Le(h[1],e[1])||Le(h[0],e[1])&&Le(h[1],e[0])))break;{const n=B(r[t].geometry);n in d||(d[n]=!0,i[B(e)]=!0)}}}return void(this.vertexSegments_=i)}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)}insertVertex_(t,e){const i=t.segment,n=t.feature,s=t.geometry,r=t.depth,o=t.index;let a;for(;e.length<s.getStride();)e.push(0);switch(s.getType()){case"MultiLineString":case"Polygon":a=s.getCoordinates(),a[r[0]].splice(o+1,0,e);break;case"MultiPolygon":a=s.getCoordinates(),a[r[1]][r[0]].splice(o+1,0,e);break;case"LineString":a=s.getCoordinates(),a.splice(o+1,0,e);break;default:return!1}this.setGeometryCoordinates_(s,a);const h=this.rBush_;h.remove(t),this.updateSegmentIndices_(s,o,r,1);const l={segment:[i[0],e],feature:n,geometry:s,depth:r,index:o};h.insert(Ut(l.segment),l),this.dragSegments_.push([l,1]);const c={segment:[e,i[1]],feature:n,geometry:s,depth:r,index:o+1};return h.insert(Ut(c.segment),c),this.dragSegments_.push([c,0]),!0}updatePointer_(t){return t&&this.findInsertVerticesAndUpdateDragSegments_(t),this.vertexFeature_?.getGeometry().getCoordinates()}getPoint(){const t=this.vertexFeature_?.getGeometry().getCoordinates();return t?rn(t,this.getMap().getView().getProjection()):null}canRemovePoint(){if(!this.vertexFeature_)return!1;if(this.vertexFeature_.get("geometries").every(t=>"Circle"===t.getType()||t.getType().endsWith("Point")))return!1;const t=this.vertexFeature_.getGeometry().getCoordinates();return this.rBush_.getInExtent(Ut([t])).some(({segment:e})=>Le(e[0],t)||Le(e[1],t))}removePoint(t){if(t&&(t=on(t,this.getMap().getView().getProjection()),this.updatePointer_(t)),!this.lastPointerEvent_||this.lastPointerEvent_&&this.lastPointerEvent_.type!=q.POINTERDRAG){const t=this.lastPointerEvent_;this.willModifyFeatures_(t,this.dragSegments_.map(([t])=>t));const e=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new Ud(Yd,this.featuresBeingModified_,t)),this.featuresBeingModified_=null,e}return!1}removeVertex_(){const t=this.dragSegments_,e={};let i,n,s,r,o,a,h,l,c,u,d,g=!1;for(o=t.length-1;o>=0;--o)s=t[o],u=s[0],d=B(u.feature),u.depth&&(d+="-"+u.depth.join("-")),d in e||(e[d]={}),0===s[1]?(e[d].right=u,e[d].index=u.index):1==s[1]&&(e[d].left=u,e[d].index=u.index+1);for(d in e){switch(c=e[d].right,h=e[d].left,a=e[d].index,l=a-1,u=void 0!==h?h:c,l<0&&(l=0),r=u.geometry,n=r.getCoordinates(),i=n,g=!1,r.getType()){case"MultiLineString":n[u.depth[0]].length>2&&(n[u.depth[0]].splice(a,1),g=!0);break;case"LineString":n.length>2&&(n.splice(a,1),g=!0);break;case"MultiPolygon":i=i[u.depth[1]];case"Polygon":i=i[u.depth[0]],i.length>4&&(a==i.length-1&&(a=0),i.splice(a,1),g=!0,0===a&&(i.pop(),i.push(i[0]),l=i.length-1))}if(g){this.setGeometryCoordinates_(r,n);const e=[];if(void 0!==h&&(this.rBush_.remove(h),e.push(h.segment[0])),void 0!==c&&(this.rBush_.remove(c),e.push(c.segment[1])),void 0!==h&&void 0!==c){const t={depth:u.depth,feature:u.feature,geometry:u.geometry,index:l,segment:e};this.rBush_.insert(Ut(t.segment),t)}this.updateSegmentIndices_(r,a,u.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.length=0}}return g}canInsertPoint(){if(!this.vertexFeature_)return!1;if(this.vertexFeature_.get("geometries").every(t=>"Circle"===t.getType()||t.getType().endsWith("Point")))return!1;const t=this.vertexFeature_.getGeometry().getCoordinates();return this.rBush_.getInExtent(Ut([t])).some(({segment:e})=>!(Le(e[0],t)||Le(e[1],t)))}insertPoint(t){const e=t?on(t,this.getMap().getView().getProjection()):this.vertexFeature_?.getGeometry().getCoordinates();if(!e)return!1;return this.findInsertVerticesAndUpdateDragSegments_(e).reduce((t,i)=>t||this.insertVertex_(i,e),!1)}setGeometryCoordinates_(t,e){this.changingFeature_=!0,t.setCoordinates(e),this.changingFeature_=!1}updateSegmentIndices_(t,e,i,n){this.rBush_.forEachInExtent(t.getExtent(),function(s){s.geometry===t&&(void 0===i||void 0===s.depth||I(s.depth,i))&&s.index>e&&(s.index+=n)})}},tg="drawstart",eg="drawend",ig="drawabort";class ng extends A{constructor(t,e){super(t),this.feature=e}}function sg(){const t=al();return function(e,i){return t[e.getGeometry().getType()]}}const rg=class extends hr{constructor(t){const e=t;e.stopDown||(e.stopDown=R),super(e),this.on,this.once,this.un,this.options_=t,this.shouldHandle_=!1,this.downPx_=null,this.downTimeout_,this.lastDragTime_,this.pointerType_,this.freehand_=!1,this.source_=t.source?t.source:null,this.features_=t.features?t.features:null,this.snapTolerance_=t.snapTolerance?t.snapTolerance:12,this.type_=t.type,this.mode_=function(t){switch(t){case"Point":case"MultiPoint":return"Point";case"LineString":case"MultiLineString":return"LineString";case"Polygon":case"MultiPolygon":return"Polygon";case"Circle":return"Circle";default:throw new Error("Invalid type: "+t)}}(this.type_),this.stopClick_=!!t.stopClick,this.ignoreNextUpEvent_=!1,this.minPoints_=t.minPoints?t.minPoints:"Polygon"===this.mode_?3:2,this.maxPoints_="Circle"===this.mode_?2:t.maxPoints?t.maxPoints:1/0,this.finishCondition_=t.finishCondition?t.finishCondition:T,this.geometryLayout_=t.geometryLayout?t.geometryLayout:"XY";let i=t.geometryFunction;if(!i){const t=this.mode_;if("Circle"===t)i=(t,e,i)=>{const n=e||new _d([NaN,NaN]),s=on(t[0],i),r=De(s,on(t[t.length-1],i));n.setCenterAndRadius(s,Math.sqrt(r),this.geometryLayout_);const o=sn();return o&&n.transform(i,o),n};else{let e;"Point"===t?e=Zn:"LineString"===t?e=pd:"Polygon"===t&&(e=ls),i=(i,n,s)=>(n?"Polygon"===t?i[0].length?n.setCoordinates([i[0].concat([i[0][0]])],this.geometryLayout_):n.setCoordinates([],this.geometryLayout_):n.setCoordinates(i,this.geometryLayout_):n=new e(i,this.geometryLayout_),n)}}this.geometryFunction_=i,this.dragVertexDelay_=void 0!==t.dragVertexDelay?t.dragVertexDelay:500,this.finishCoordinate_=null,this.sketchFeature_=null,this.sketchPoint_=null,this.sketchCoords_=null,this.sketchLine_=null,this.sketchLineCoords_=null,this.squaredClickTolerance_=t.clickTolerance?t.clickTolerance*t.clickTolerance:36,this.overlay_=new cd({source:new dc({useSpatialIndex:!1,wrapX:!!t.wrapX&&t.wrapX}),style:t.style?t.style:sg(),updateWhileInteracting:!0}),this.geometryName_=t.geometryName,this.condition_=t.condition?t.condition:ir,this.freehandCondition_,t.freehand?this.freehandCondition_=Js:this.freehandCondition_=t.freehandCondition?t.freehandCondition:nr,this.traceCondition_,this.setTrace(t.trace||!1),this.traceState_={active:!1},this.traceSource_=t.traceSource||t.source||null,this.addChangeListener(js,this.updateState_)}setTrace(t){let e;e=t?!0===t?Js:t:tr,this.traceCondition_=e}setMap(t){super.setMap(t),this.updateState_()}setFreehand(t){this.freehand_=t,this.freehand_?this.freehandCondition_=Js:this.freehandCondition_=this.options_&&this.options_.freehandCondition?this.options_.freehandCondition:nr}getOverlay(){return this.overlay_}getFreehand(){return this.freehand_}handleEvent(t){t.originalEvent.type===u&&t.originalEvent.preventDefault(),this.freehand_="Point"!==this.mode_&&this.freehandCondition_(t);let e=t.type===q.POINTERMOVE,i=!0;if(!this.freehand_&&this.lastDragTime_&&t.type===q.POINTERDRAG){Date.now()-this.lastDragTime_>=this.dragVertexDelay_?(this.downPx_=t.pixel,this.shouldHandle_=!this.freehand_,e=!0):this.lastDragTime_=void 0,this.shouldHandle_&&void 0!==this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0)}return this.freehand_&&t.type===q.POINTERDRAG&&null!==this.sketchFeature_?(this.addToDrawing_(t.coordinate),i=!1):this.freehand_&&t.type===q.POINTERDOWN?i=!1:e&&this.getPointerCount()<2?(i=t.type===q.POINTERMOVE,i&&this.freehand_?(this.handlePointerMove_(t),this.shouldHandle_&&t.originalEvent.preventDefault()):("mouse"===t.originalEvent.pointerType||t.type===q.POINTERDRAG&&void 0===this.downTimeout_)&&this.handlePointerMove_(t)):t.type===q.DBLCLICK&&(i=!1),super.handleEvent(t)&&i}handleDownEvent(t){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=t.pixel,this.finishCoordinate_||this.startDrawing_(t.coordinate),!0):this.condition_(t)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(()=>{this.handlePointerMove_(new H(q.POINTERMOVE,t.map,t.originalEvent,!1,t.frameState))},this.dragVertexDelay_),this.downPx_=t.pixel,!0):(this.lastDragTime_=void 0,!1)}deactivateTrace_(){this.traceState_={active:!1}}toggleTraceState_(t){if(!this.traceSource_||!this.traceCondition_(t))return;if(this.traceState_.active)return void this.deactivateTrace_();const e=this.getMap(),i=Ut([e.getCoordinateFromPixel([t.pixel[0]-this.snapTolerance_,t.pixel[1]+this.snapTolerance_]),e.getCoordinateFromPixel([t.pixel[0]+this.snapTolerance_,t.pixel[1]-this.snapTolerance_])]),n=this.traceSource_.getFeaturesInExtent(i);if(0===n.length)return;const s=Od(t.coordinate,n);s.length&&(this.traceState_={active:!0,startCoord:t.coordinate.slice(),targets:s,targetIndex:-1})}addOrRemoveTracedCoordinates_(t,e){const i=t.startIndex<=t.endIndex;i===t.startIndex<=e?i&&e>t.endIndex||!i&&e<t.endIndex?this.addTracedCoordinates_(t,t.endIndex,e):(i&&e<t.endIndex||!i&&e>t.endIndex)&&this.removeTracedCoordinates_(e,t.endIndex):(this.removeTracedCoordinates_(t.startIndex,t.endIndex),this.addTracedCoordinates_(t,t.startIndex,e))}removeTracedCoordinates_(t,e){if(t===e)return;let i=0;if(t<e){const n=Math.ceil(t);let s=Math.floor(e);s===e&&(s-=1),i=s-n+1}else{const n=Math.floor(t);let s=Math.ceil(e);s===e&&(s+=1),i=n-s+1}i>0&&this.removeLastPoints_(i)}addTracedCoordinates_(t,e,i){if(e===i)return;const n=[];if(e<i){const s=Math.ceil(e);let r=Math.floor(i);r===i&&(r-=1);for(let e=s;e<=r;++e)n.push(Ld(t.coordinates,e))}else{const s=Math.floor(e);let r=Math.ceil(i);r===i&&(r+=1);for(let e=s;e>=r;--e)n.push(Ld(t.coordinates,e))}n.length&&this.appendCoordinates(n)}updateTrace_(t){const e=this.traceState_;if(!e.active)return;if(-1===e.targetIndex){if(Oe(t.map.getPixelFromCoordinate(e.startCoord),t.pixel)<this.snapTolerance_)return}const i=Dd(t.coordinate,e,this.getMap(),this.snapTolerance_);if(e.targetIndex!==i.index){if(-1!==e.targetIndex){const t=e.targets[e.targetIndex];this.removeTracedCoordinates_(t.startIndex,t.endIndex)}const t=e.targets[i.index];this.addTracedCoordinates_(t,t.startIndex,i.endIndex)}else{const t=e.targets[e.targetIndex];this.addOrRemoveTracedCoordinates_(t,i.endIndex)}e.targetIndex=i.index;const n=e.targets[e.targetIndex];n.endIndex=i.endIndex;const s=Ad(n.coordinates,n.endIndex),r=this.getMap().getPixelFromCoordinate(s);t.coordinate=s,t.pixel=[Math.round(r[0]),Math.round(r[1])]}handleDragEvent(t){this.ignoreNextUpEvent_=!0,super.handleDragEvent(t)}handleUpEvent(t){let e=!0;if(0===this.getPointerCount()){this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(t);const i=this.traceState_.active;if(this.ignoreNextUpEvent_||this.toggleTraceState_(t),this.shouldHandle_){const n=!this.finishCoordinate_;n&&this.startDrawing_(t.coordinate),!n&&this.freehand_?this.finishDrawing():this.freehand_||n&&"Point"!==this.mode_||(this.atFinish_(t.pixel,i)?this.finishCondition_(t)&&this.finishDrawing():this.addToDrawing_(t.coordinate)),e=!1}else this.freehand_&&this.abortDrawing()}return this.ignoreNextUpEvent_=!1,!e&&this.stopClick_&&t.preventDefault(),e}handlePointerMove_(t){if(this.pointerType_=t.originalEvent.pointerType,this.downPx_&&(!this.freehand_&&this.shouldHandle_||this.freehand_&&!this.shouldHandle_)){const e=this.downPx_,i=t.pixel,n=e[0]-i[0],s=e[1]-i[1],r=n*n+s*s;if(this.shouldHandle_=this.freehand_?r>this.squaredClickTolerance_:r<=this.squaredClickTolerance_,!this.shouldHandle_)return}this.finishCoordinate_?(this.updateTrace_(t),this.modifyDrawing_(t.coordinate)):this.createOrUpdateSketchPoint_(t.coordinate.slice())}atFinish_(t,e){let i=!1;if(this.sketchFeature_){let n=!1,s=[this.finishCoordinate_];const r=this.mode_;if("Point"===r)i=!0;else if("Circle"===r)i=2===this.sketchCoords_.length;else if("LineString"===r)n=!e&&this.sketchCoords_.length>this.minPoints_;else if("Polygon"===r){const t=this.sketchCoords_;n=t[0].length>this.minPoints_,s=[t[0][0],t[0][t[0].length-2]],s=e?[t[0][0]]:[t[0][0],t[0][t[0].length-2]]}if(n){const e=this.getMap();for(let n=0,r=s.length;n<r;n++){const r=s[n],o=e.getPixelFromCoordinate(r),a=t[0]-o[0],h=t[1]-o[1],l=this.freehand_?1:this.snapTolerance_;if(i=Math.sqrt(a*a+h*h)<=l,i){this.finishCoordinate_=r;break}}}}return i}createOrUpdateSketchPoint_(t){if(this.sketchPoint_){this.sketchPoint_.getGeometry().setCoordinates(t)}else this.sketchPoint_=new jl(new Zn(t)),this.updateSketchFeatures_()}createOrUpdateCustomSketchLine_(t){this.sketchLine_||(this.sketchLine_=new jl);const e=t.getLinearRing(0);let i=this.sketchLine_.getGeometry();i?(i.setFlatCoordinates(e.getLayout(),e.getFlatCoordinates()),i.changed()):(i=new pd(e.getFlatCoordinates(),e.getLayout()),this.sketchLine_.setGeometry(i))}startDrawing_(t){const e=this.getMap().getView().getProjection(),i=En(this.geometryLayout_);for(;t.length<i;)t.push(0);this.finishCoordinate_=t,"Point"===this.mode_?this.sketchCoords_=t.slice():"Polygon"===this.mode_?(this.sketchCoords_=[[t.slice(),t.slice()]],this.sketchLineCoords_=this.sketchCoords_[0]):this.sketchCoords_=[t.slice(),t.slice()],this.sketchLineCoords_&&(this.sketchLine_=new jl(new pd(this.sketchLineCoords_)));const n=this.geometryFunction_(this.sketchCoords_,void 0,e);this.sketchFeature_=new jl,this.geometryName_&&this.sketchFeature_.setGeometryName(this.geometryName_),this.sketchFeature_.setGeometry(n),this.updateSketchFeatures_(),this.dispatchEvent(new ng(tg,this.sketchFeature_))}modifyDrawing_(t){const e=this.getMap(),i=this.sketchFeature_.getGeometry(),n=e.getView().getProjection(),s=En(this.geometryLayout_);let r,o;for(;t.length<s;)t.push(0);if("Point"===this.mode_?o=this.sketchCoords_:"Polygon"===this.mode_?(r=this.sketchCoords_[0],o=r[r.length-1],this.atFinish_(e.getPixelFromCoordinate(t))&&(t=this.finishCoordinate_.slice())):(r=this.sketchCoords_,o=r[r.length-1]),o[0]=t[0],o[1]=t[1],this.geometryFunction_(this.sketchCoords_,i,n),this.sketchPoint_){this.sketchPoint_.getGeometry().setCoordinates(t)}if("Polygon"===i.getType()&&"Polygon"!==this.mode_)this.createOrUpdateCustomSketchLine_(i);else if(this.sketchLineCoords_){this.sketchLine_.getGeometry().setCoordinates(this.sketchLineCoords_)}this.updateSketchFeatures_()}addToDrawing_(t){const e=this.sketchFeature_.getGeometry(),i=this.getMap().getView().getProjection();let n,s;const r=this.mode_;return"LineString"===r||"Circle"===r?(this.finishCoordinate_=t.slice(),s=this.sketchCoords_,s.length>=this.maxPoints_&&(this.freehand_?s.pop():n=!0),s.push(t.slice()),this.geometryFunction_(s,e,i)):"Polygon"===r&&(s=this.sketchCoords_[0],s.length>=this.maxPoints_&&(this.freehand_?s.pop():n=!0),s.push(t.slice()),n&&(this.finishCoordinate_=s[0]),this.geometryFunction_(this.sketchCoords_,e,i)),this.createOrUpdateSketchPoint_(t.slice()),this.updateSketchFeatures_(),n?this.finishDrawing():this.sketchFeature_}removeLastPoints_(t){if(!this.sketchFeature_)return;const e=this.sketchFeature_.getGeometry(),i=this.getMap().getView().getProjection(),n=this.mode_;for(let s=0;s<t;++s){let t;if("LineString"===n||"Circle"===n){if(t=this.sketchCoords_,t.splice(-2,1),t.length>=2){this.finishCoordinate_=t[t.length-2].slice();const e=this.finishCoordinate_.slice();t[t.length-1]=e,this.createOrUpdateSketchPoint_(e)}this.geometryFunction_(t,e,i),"Polygon"===e.getType()&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(e)}else if("Polygon"===n){t=this.sketchCoords_[0],t.splice(-2,1);const n=this.sketchLine_.getGeometry();if(t.length>=2){const e=t[t.length-2].slice();t[t.length-1]=e,this.createOrUpdateSketchPoint_(e)}n.setCoordinates(t),this.geometryFunction_(this.sketchCoords_,e,i)}if(1===t.length){this.abortDrawing();break}}this.updateSketchFeatures_()}removeLastPoint(){this.removeLastPoints_(1)}finishDrawing(){const t=this.abortDrawing_();if(!t)return null;let e=this.sketchCoords_;const i=t.getGeometry(),n=this.getMap().getView().getProjection();return"LineString"===this.mode_?(e.pop(),this.geometryFunction_(e,i,n)):"Polygon"===this.mode_&&(e[0].pop(),this.geometryFunction_(e,i,n),e=i.getCoordinates()),"MultiPoint"===this.type_?t.setGeometry(new Td([e])):"MultiLineString"===this.type_?t.setGeometry(new Ed([e])):"MultiPolygon"===this.type_&&t.setGeometry(new Md([e])),this.dispatchEvent(new ng(eg,t)),this.features_&&this.features_.push(t),this.source_&&this.source_.addFeature(t),t}abortDrawing_(){this.finishCoordinate_=null;const t=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),this.deactivateTrace_(),t}abortDrawing(){const t=this.abortDrawing_();t&&this.dispatchEvent(new ng(ig,t))}appendCoordinates(t){const e=this.mode_,i=!this.sketchFeature_;let n;if(i&&this.startDrawing_(t[0]),"LineString"===e||"Circle"===e)n=this.sketchCoords_;else{if("Polygon"!==e)return;n=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[]}i&&n.shift(),n.pop();for(let e=0;e<t.length;e++)this.addToDrawing_(t[e]);const s=t[t.length-1];this.sketchFeature_=this.addToDrawing_(s),this.modifyDrawing_(s)}extend(t){const e=t.getGeometry();this.sketchFeature_=t,this.sketchCoords_=e.getCoordinates();const i=this.sketchCoords_[this.sketchCoords_.length-1];this.finishCoordinate_=i.slice(),this.sketchCoords_.push(i.slice()),this.sketchPoint_=new jl(new Zn(i)),this.updateSketchFeatures_(),this.dispatchEvent(new ng(tg,this.sketchFeature_))}updateSketchFeatures_(){const t=[];this.sketchFeature_&&t.push(this.sketchFeature_),this.sketchLine_&&t.push(this.sketchLine_),this.sketchPoint_&&t.push(this.sketchPoint_);const e=this.overlay_.getSource();e.clear(!0),e.addFeatures(t)}updateState_(){const t=this.getMap(),e=this.getActive();t&&e||this.abortDrawing(),this.overlay_.setMap(e?t:null)}},og="select";class ag extends A{constructor(t,e,i,n){super(t),this.selected=e,this.deselected=i,this.mapBrowserEvent=n}}const hg={};class lg extends Zs{constructor(t){let e;if(super(),this.on,this.once,this.un,t=t||{},this.boundAddFeature_=this.addFeature_.bind(this),this.boundRemoveFeature_=this.removeFeature_.bind(this),this.condition_=t.condition?t.condition:er,this.addCondition_=t.addCondition?t.addCondition:tr,this.removeCondition_=t.removeCondition?t.removeCondition:tr,this.toggleCondition_=t.toggleCondition?t.toggleCondition:nr,this.multi_=!!t.multi&&t.multi,this.filter_=t.filter?t.filter:T,this.hitTolerance_=t.hitTolerance?t.hitTolerance:0,this.style_=void 0!==t.style?t.style:function(){const t=al();return E(t.Polygon,t.LineString),E(t.GeometryCollection,t.LineString),function(e){return e.getGeometry()?t[e.getGeometry().getType()]:null}}(),this.features_=t.features||new Z,t.layers)if("function"==typeof t.layers)e=t.layers;else{const i=t.layers;e=function(t){return i.includes(t)}}else e=T;this.layerFilter_=e,this.featureLayerAssociation_={}}addFeatureLayerAssociation_(t,e){this.featureLayerAssociation_[B(t)]=e}getFeatures(){return this.features_}getHitTolerance(){return this.hitTolerance_}getLayer(t){return this.featureLayerAssociation_[B(t)]}setHitTolerance(t){this.hitTolerance_=t}setMap(t){this.getMap()&&this.style_&&this.features_.forEach(this.restorePreviousStyle_.bind(this)),super.setMap(t),t?(this.features_.addEventListener(o,this.boundAddFeature_),this.features_.addEventListener(a,this.boundRemoveFeature_),this.style_&&this.features_.forEach(this.applySelectedStyle_.bind(this))):(this.features_.removeEventListener(o,this.boundAddFeature_),this.features_.removeEventListener(a,this.boundRemoveFeature_))}addFeature_(t){const e=t.element;if(this.style_&&this.applySelectedStyle_(e),!this.getLayer(e)){const t=this.findLayerOfFeature_(e);t&&this.addFeatureLayerAssociation_(e,t)}}removeFeature_(t){this.style_&&this.restorePreviousStyle_(t.element)}findLayerOfFeature_(t){return this.getMap().getAllLayers().find(function(e){if(e instanceof cd&&e.getSource()&&e.getSource().hasFeature(t))return e})}getStyle(){return this.style_}applySelectedStyle_(t){const e=B(t);e in hg||(hg[e]=t.getStyle()),t.setStyle(this.style_)}restorePreviousStyle_(t){const e=this.getMap().getInteractions().getArray();for(let i=e.length-1;i>=0;--i){const n=e[i];if(n!==this&&n instanceof lg&&n.getStyle()&&-1!==n.getFeatures().getArray().lastIndexOf(t))return void t.setStyle(n.getStyle())}const i=B(t);t.setStyle(hg[i]),delete hg[i]}removeFeatureLayerAssociation_(t){delete this.featureLayerAssociation_[B(t)]}selectFeatureInternal_(t,e,i){if(!(t instanceof jl))return;if(!this.filter_(t,e))return;const n=this.getFeatures();return n.getArray().includes(t)||(this.addFeatureLayerAssociation_(t,e),n.push(t),i?.push(t)),t}selectFeature(t){const e=this.findLayerOfFeature_(t);if(!this.layerFilter_(e))return!1;const i=this.selectFeatureInternal_(t,e);return i&&this.dispatchEvent(new ag(og,[i],[],void 0)),!!i}removeFeatureInternal_(t,e){const i=this.getFeatures();if(t instanceof jl&&i.getArray().includes(t))return i.remove(t),this.removeFeatureLayerAssociation_(t),e?.push(t),t}deselectFeature(t){const e=this.removeFeatureInternal_(t);return e&&this.dispatchEvent(new ag(og,[],[e],void 0)),!!e}toggleFeature(t){this.deselectFeature(t)||this.selectFeature(t)}clearSelection(){b(this.featureLayerAssociation_);const t=this.getFeatures(),e=t.getArray().slice();t.clear(),0!==e.length&&this.dispatchEvent(new ag(og,[],e,void 0))}handleEvent(t){if(!this.condition_(t))return!0;const e=this.addCondition_(t),i=this.removeCondition_(t),n=this.toggleCondition_(t),s=!e&&!i&&!n,r=t.map,o=this.getFeatures(),a=[],h=[];if(s){let e=!1;r.forEachFeatureAtPixel(t.pixel,(t,i)=>{if(e=!0,this.selectFeatureInternal_(t,i,h))return!this.multi_},{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(let t=o.getLength()-1;t>=0;--t){const i=o.item(t);(h.length>0&&!h.includes(i)||!e)&&this.removeFeatureInternal_(i,a)}}else r.forEachFeatureAtPixel(t.pixel,(t,s)=>{let r;if((i||n)&&(r=this.removeFeatureInternal_(t,a)),!e&&!n||r||(r=this.selectFeatureInternal_(t,s,h)),r)return!this.multi_},{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});return(h.length>0||a.length>0)&&this.dispatchEvent(new ag(og,h,a,t)),!0}}const cg=lg;var ug=s(5327),dg=s.n(ug);const gg={POINT:"Point",LINE:"LineString",POLYGON:"Polygon",CIRCLE:"Circle"};function _g(t){return t>90||t<-90?t/1e5:t}function fg(t){return t>180||t<-180?t/1e5:t}function pg(t,e){const i=.017453292519943295,n=Math.cos,s=_g(t.latitude),r=_g(e.latitude),o=fg(t.longitude),a=fg(e.longitude),h=.5-n((r-s)*i)/2+n(s*i)*n(r*i)*(1-n((a-o)*i))/2;return Math.round(12742*Math.asin(Math.sqrt(h))*1e3)}function mg(t){let e=0;return t.forEach((i,n)=>{void 0!==t[n+1]&&(e+=pg(i,t[n+1]))}),e}class yg{layerWrapper=null;featureBuilder=null;modifyWrapper=null;overlayWrapper=null;layerWrapper=null;contextMenuWrapper=null;selectWrapper=null;drawWrappers=[];mapControls=[];constructor(){}getLayerWrapper(){return this.layerWrapper}getModifyWrapper(){return this.modifyWrapper}getOverlayWrapper(){return this.overlayWrapper}getDrawWrappers(){return this.drawWrappers}getSelectWrapper(){return this.selectWrapper}getContextMenuWrapper(){return this.contextMenuWrapper}getMapControls(){return this.mapControls}includeModify(t){if(!this.layerWrapper)throw new Error("LayerWrapper is null");this.modifyWrapper=new kg({...t,source:this.layerWrapper.getSource()})}includeSelect(t){if(!this.layerWrapper)throw new Error("LayerWrapper is null");console.log("include select"),this.selectWrapper=new Ag({...t,layerWrapper:this.layerWrapper})}includeOverlay(t){this.overlayWrapper=new Pg({...t})}includeDraw(t,e){t.source=this.layerWrapper.getSource(),e===gg.CIRCLE?this.drawWrappers.push(new Gg(t)):e===gg.POLYGON&&this.drawWrappers.push(new Og(t))}includeControl(t){this.mapControls.push(new Wg(t))}includeContextMenu(t){this.contextMenuWrapper=new Xg(t)}setData(t,e=!1){this.featureBuilder&&(this.layerWrapper.removeAllFeatures(e),this.addData(t))}addData(t){if(this.featureBuilder){const e=this.featureBuilder.create(t);this.layerWrapper.addFeatures(Array.isArray(e)?e:[e])}}getDrawWrapperByType(t){return this.drawWrappers.find(e=>e.options.type===t)}setFeatureCoordinates(t,e){if(this.featureBuilder){const i=this.layerWrapper.getFeatureById(t);i&&this.featureBuilder.setCoordinate(i,e)}}setFeatureStyle(t,e){if(this.featureBuilder){const i=this.layerWrapper.getFeatureById(t);i&&this.featureBuilder.setStyle(i,e)}}}class xg extends yg{constructor(t){super(),this.layerWrapper=new wg(t)}}class vg extends yg{constructor(t){super(),this.layerWrapper=new Sg(t)}}class Cg{map=null;tileLayer=null;options={hitTolerance:10};static EVENTS={CLICK:"click",SINGLECLICK:"singleclick",MOVEEND:"moveend",POINTERMOVE:"pointermove"};constructor(t=null,e={}){t&&this.init(t,e)}init(t,e={}){const i={zoom:e.zoom?e.zoom:4,center:Ui(e.center?e.center:[0,0])},n={source:new $c({})};this.tileLayer=new fu(n);const s={target:t,layers:[this.tileLayer],view:new Cs(i)};this.map=new Kl(s),this.options.hitTolerance=void 0!==e.hitTolerance?e.hitTolerance:10}getMap(){return this.map}getTileLayer(){return this.tileLayer}getViewPortCoordinates(){return this.map.getView().calculateExtent(this.map.getSize())}getViewCenter(){return tn(this.map.getView().getCenter(),"EPSG:3857","EPSG:4326")}addLayer(t){this.map.addLayer(t.getLayer())}removeLayer(t){this.map.removeLayer(t.getLayer())}addOverlay(t){t&&t.getOverlay()&&this.map.addOverlay(t.getOverlay())}addControl(t){t&&t.getControl()&&this.map.addControl(t.getControl())}addInteraction(t){t&&t.getInteraction()&&this.map.addInteraction(t.getInteraction())}getFeatureFromPixel(t){return this.map.forEachFeatureAtPixel(t,t=>t)}getLayerFromPixel(t){return this.map.forEachFeatureAtPixel(t,(t,e)=>e)}getZoomLevel(){return this.map.getView().getZoom()}fitToLayer(t,e={}){if(t.getSource().getFeatures().length>0){const i={size:this.map.getSize(),maxZoom:e.zoom?e.zoom:20,padding:e.padding?e.padding:[30,30,30,30],duration:e.duration?e.duration:0},n=t.getSource().getExtent();this.map.getView().fit(n,i)}}fitToFeature(t,e={}){const i={size:this.map.getSize(),maxZoom:e.zoom?e.zoom:20,padding:e.padding?e.padding:[20,20,20,20],duration:e.duration?e.duration:0},n=t.getGeometry().getExtent();this.map.getView().fit(n,i)}on(t,e){if(!Object.values(Cg.EVENTS).includes(t))throw new Error("Event name is not defined");this.map.on(t,t=>this.#t(t,e))}off(t,e){if(!Object.values(Cg.EVENTS).includes(t))throw new Error("Event name is not defined");this.map.un(t,t=>this.#t(t,e))}#t(t,e){if("function"!=typeof e)throw new Error("Handler is not a function");void 0!==t.pixel?this.map.forEachFeatureAtPixel(t.pixel,(i,n)=>{setTimeout(e(i,n,t),1)},{hitTolerance:this.options.hitTolerance}):setTimeout(e(t),1)}addProcessor(t){this.addLayer(t.getLayerWrapper()),this.addInteraction(t.getModifyWrapper()),this.addOverlay(t.getOverlayWrapper()),this.addControl(t.getContextMenuWrapper()),this.addInteraction(t.getSelectWrapper()),t.drawWrappers.forEach(t=>this.addInteraction(t)),t.getMapControls().forEach(t=>this.addControl(t))}clear(){this.map.getLayers().forEach(t=>{t.getSource().clear()}),this.map.setTarget(null)}}class wg{layer=null;source=null;sourceEvents={};static EVENTS={ADD_FEATURE:"addfeature"};constructor(t={}){this.source=new dc({wrapX:!1});const e={name:t?.name??"Layer",style:t?.style??new ll,zIndex:t?.zIndex??1,opacity:t?.opacity??1,source:this.source};t.useVectorImage?this.layer=new ld(e):this.layer=new cd(e)}addFeatures(t){this.source.addFeatures(t)}addFeature(t){this.source.addFeature(t)}removeAllFeatures(t=!1){this.source.clear(t)}removeFeatures(t){this.source.removeFeatures(t)}removeFeature(t){this.source.removeFeature(t)}removeFeatureById(t){const e=this.getFeatureById(t);e&&this.removeFeature(e)}removeFeaturesByProperty(t,e){this.removeFeatures(this.getFeaturesByProperty(t,e))}getFeatureById(t){return this.source.getFeatureById(t)}getFeaturesByProperty(t,e){const i=[];return this.source.getFeatures.forEach(n=>{n.get("properties")[t]===e&&i.push(n)}),i}getAllFeatures(){return this.source.getFeatures()}getLayer(){return this.layer}getSource(){return this.source}getName(){return this.layer.get("name")}show(){this.layer.setVisible(!0)}hide(){this.layer.setVisible(!1)}setStyle(t){this.layer.setStyle(t)}on(t,e){if(!Object.values(wg.EVENTS).includes(t))throw new Error("Event name is not defined");this.source.on(t,t=>this.#t(t,e))}off(t,e){if(!Object.values(wg.EVENTS).includes(t))throw new Error("Event name is not defined");this.source.un(t,t=>this.#t(t,e))}#t(t,e){if("function"!=typeof e)throw new Error("Handler is not a function");setTimeout(e(t),1)}}class Sg extends wg{cluster=null;constructor(t){super(t);const e={source:this.source,distance:t?.distance??50};this.cluster=new gc(e);const i={name:t?.name??"ClusterLayer",style:t?.style??new ll,zIndex:t?.zIndex??1,animationDuration:t?.animationDuration??200,options:t?.opacity??1,source:this.cluster};this.layer=new(dd())(i),console.log(this.source)}setDistance(t){this.cluster.setDistance(t)}}class Eg{options={style:null,idKey:null,nestedKey:null};constructor(t={}){this.options.style=void 0!==t.style?t.style:null,this.options.idKey=void 0!==t.idKey?t.idKey:null,this.options.nestedKey=void 0!==t.nestedKey?t.nestedKey:null}getOLCoordinate(t){return Ui([fg(t.longitude),_g(t.latitude)])}setId(t,e,i){this.options.idKey?t.setId(i[this.options.idKey]):void 0!==e.id?t.setId(e.id):void 0!==i.id&&t.setId(i.id)}setStyle(t,e=null){t.setStyle(e??this.options?.style??null)}setCoordinate(t,e){t.getGeometry().setCoordinates(this.getOLCoordinate(e))}createFeatures(t){return t.map(t=>this.createFeature(t))}createFeature(t){throw new Error("Method is not implemented")}}class Ig extends Eg{constructor(t={}){super(t)}createFeature(t){const e=this.options.nestedKey?t[this.options.nestedKey]:t,i=this.getOLCoordinate(e),n=new Zn(i),s=new jl({geometry:n});return s.set("properties",t),this.setId(s,e,t),this.setStyle(s,t?.style??null),s}create(t){return Array.isArray(t)?this.createFeatures(t):this.createFeature(t)}}class Tg extends Eg{constructor(t={}){super(t)}parsePoints(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i].coordinate;e.push(this.getOLCoordinate(n))}return[e]}createFeature(t){console.log(t);const e=this.parsePoints(t.points),i=new ls(e),n=new jl({geometry:i});return n.set("properties",t),this.setId(n,t,t),this.setStyle(n,t?.style??null),n}create(t){return Array.isArray(t)?this.createFeatures(t):this.createFeature(t)}}class Rg extends Eg{constructor(t={}){super(t)}createFeature(t){const e=this.options.nestedKey?t[this.options.nestedKey]:t,i=this.getOLCoordinate(e);console.log(i);const n=new _d(i,t.radius),s=new jl({geometry:n});return s.set("properties",t),this.setId(s,e,t),this.setStyle(s,t?.style??null),s}create(t){return Array.isArray(t)?this.createFeatures(t):this.createFeature(t)}}class Mg extends Eg{constructor(t={}){super(t)}parsePoints(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i].coordinate;e.push(this.getOLCoordinate(n))}return e}createFeature(t){const e=this.parsePoints(t.points),i=new pd(e),n=new jl({geometry:i});return n.set("properties",t),this.setId(n,t,t),this.setStyle(n,t?.style??null),n}create(t){return Array.isArray(t)?this.createFeatures(t):this.createFeature(t)}}class Pg{overlay=null;constructor(t={}){const e={element:document.getElementById(void 0!==t.element?t.element:null),offset:void 0!==t.offset?t.offset:[0,-30],positioning:"bottom-center"};this.overlay=new wd(e)}getOverlay(){return this.overlay}setPositionByFeature(t){if(t){let e=t.getGeometry().getExtent();this.overlay.setPosition(pe(e))}else this.overlay.setPosition(void 0)}setContent(t){element.innerHTML=t}show(t,e){void 0!==e&&this.setContent(e),void 0!==t&&this.setPositionByFeature(t)}hide(){this.overlay.setPosition(void 0)}}function Fg(t){return{latitude:(t[0].latitude+t[1].latitude)/2,longitude:(t[0].longitude+t[1].longitude)/2}}function bg(t){const e={latitude:0,longitude:0},i=t.length;for(let n=0;n<i;n++){let i=t[n];e.latitude+=i.latitude,e.longitude+=i.longitude}return e.latitude/=i,e.longitude/=i,e}class Lg{interaction=null;constructor(){}setActive(t){this.interaction.setActive(t)}getInteraction(){return this.interaction}_parseCircleCoordinates(t){const e=t.getGeometry().getCenter(),i=t.getGeometry().getRadius(),n=Hi(e);return{longitude:n[0].toFixed(5),latitude:n[1].toFixed(5),radius:i}}_parsePointCoordinates(t){const e=Hi(t.getGeometry().getCoordinates());return{longitude:e[0].toFixed(5),latitude:e[1].toFixed(5),id:t.getId()}}_parsePolygonCoordinates(t){const e=t.getGeometry().getCoordinates()[0],i=[];for(let t=0,n=e.length;t<n;t++){const n=Hi(e[t]);i.push({longitude:n[0].toFixed(5),latitude:n[1].toFixed(5),order:t+1})}return{id:t.getId(),points:i}}_parseLSCoordinates(t){const e=t.getGeometry().getCoordinates();if(!this.options.editFirstAndLastPoint){const i=e[0],n=e[e.length-1],s=this.oldCoordinates[0],r=this.oldCoordinates[this.oldCoordinates.length-1];if(i[0]!==s[0]||i[1]!==s[1]||n[0]!==r[0]||n[1]!==r[1])return t.getGeometry().setCoordinates(this.oldCoordinates),void(this.oldCoordinates=null)}return{id:t.getId(),points:e.map((t,e)=>{const i=Hi(t);return{order:e+1,longitude:+(1e5*i[0]).toFixed(0),latitude:+(1e5*i[1]).toFixed(0)}})}}}class Ag extends Lg{options={layerWrapper:null,style:null,hitTolerance:5,selectedHandler:null,deselectedHandler:null,alwaysOneSelected:!1,active:!1};constructor(t){super(),this.options=t;const e={layers:this.options.layerWrapper?[this.options.layerWrapper.getLayer()]:[],style:this.options?.style??null,hitTolerance:this.options?.hitTolerance??5,condition:this.options?.condition??er};this.interaction=new cg(e),this.interaction.on("select",this.#e.bind(this)),this.setActive(this.options?.active??!1)}getSelectedFeatures(){return this.interaction.getFeatures()}clear(){this.interaction.getFeatures().clear()}addFeatures(t){this.interaction.getFeatures().push(...t)}setFeatures(t){this.clear(),this.interaction.getFeatures().push(...t)}#e(t){this.options.deselectedHandler&&(t.deselected.length>0?this.options.deselectedHandler(t,t.deselected[0].get("properties")):this.options.deselectedHandler(t,null)),this.options.selectedHandler&&(t.selected.length>0?this.options.selectedHandler(t,t.selected[0].get("properties")):this.options.selectedHandler(t,null))}}class kg extends Lg{options={source:null,features:[],startModifyHandler:null,endModifyHandler:null,hitDteection:null,style:null,alwaysOneFeature:!0,editFirstAndLastPoint:!1};oldCoordinates=null;constructor(t){super(),this.options=t;const e={source:this.options.source,features:this.options.features,hitDetection:this.options.hitDetection??10,style:this.options.style,active:this.options.active??!1,deleteCondition:nr};this.options.editFirstAndLastPoint||(e.vertexFilter=(t,e)=>{if(console.log(e),e.getType()===gg.LINE){const i=e.getCoordinates(),n=t[0]===i[0][0]&&t[1]===i[0][1],s=t[0]===i[i.length-1][0]&&t[1]===i[i.length-1][1];return!(n||s)}return!0}),this.interaction=new Qd(e),this.interaction.on("modifystart",this.#i.bind(this)),this.interaction.on("modifyend",this.#n.bind(this)),this.setActive(!1)}#n(t){const e=t.features.getArray();this.options.endModifyHandler&&this.options.endModifyHandler(this.#s(e),e)}#i(t){const e=t.features.getArray()[0].getGeometry().getCoordinates();this.oldCoordinates=e,this.options.startModifyHandler&&this.options.startModifyHandler(t)}#s(t){if(!this.options.alwaysOneFeature)return t.map(t=>{let e=t.getGeometry().getCoordinates();return e.length>=2&&Array.isArray(e[0])?this._parseLSCoordinates(t):1===e.length?this._parsePolygonCoordinates(t):this._parsePointCoordinates(t)});{const e=t[0],i=e.getGeometry().getCoordinates();for(let e=1;e<t.length;e++){const i=t[e],n=i.get("properties").coordinate,s=Ui([+n.longitude,+n.latitude]);i.getGeometry().setCoordinates(s)}if(i.length>=2&&Array.isArray(i[0]))return[this._parseLSCoordinates(e)];if(1!==i.length)return[this._parsePointCoordinates(e)];this._parsePolygonCoordinates(e)}}}class Dg extends Lg{options={source:null,style:null,type:null,endDrawHandler:null,startDrawHandler:null,active:!1};constructor(t=null){super(),this.options=t;const e={source:this.options.source,style:this.options.style,type:this.options.type,active:this.options?.active??!1};this.interaction=new rg(e),this.interaction.on("drawend",this.drawEndEvent.bind(this)),this.interaction.on("drawstart",this.drawStartEvent.bind(this)),this.setActive(!1)}drawEndEvent(){throw new Error("Not implemented method")}drawStartEvent(){this.options.startDrawHandler&&this.options.startDrawHandler()}}class Og extends Dg{constructor(t){t.type=gg.POLYGON,super(t)}drawEndEvent(t){if(this.options.endDrawHandler){const e=t.feature;this.options.endDrawHandler(this._parsePolygonCoordinates(e),gg.POLYGON,t.feature)}}}class Gg extends Dg{constructor(t){t.type=gg.CIRCLE,super(t)}drawEndEvent(t){if(this.options.endDrawHandler){const e=t.feature;this.options.endDrawHandler(this._parseCircleCoordinates(e),gg.CIRCLE,t.feature)}}}class zg{control=null;getControl(){return this.control}}class Wg extends zg{constructor(t){super();const e=document.createElement("button");e.innerHTML=t?.text??"*";const i=document.createElement("div");i.className="ol-unselectable ol-control "+(t?.className??""),i.appendChild(e),t.clickHandler&&i.addEventListener("click",t.clickHandler.bind(this),!1),this.control=new Ns({element:i})}}class Ng{text=null;classname=null;callback=null;icon=null;items=null;constructor(){return this}setText(t){return this.text=t,this}setClassName(t){return this.classname=t,this}setCallback(t){return this.callback=t,this}setIcon(t){return this.icon=t,this}setItems(t){return this.items=t,this}addItem(t){return this.items||(this.items=[]),this.items.push(t),this}}class Xg extends zg{options={items:[],defaultItems:!1,width:null};constructor(t){super(),this.options=t,this.coordinates=null;const e={items:this.options?.items??[],defaultItems:this.options?.defaultItems??!1,width:this.options?.width??170};this.control=new(dg())(e)}addItems(t){this.control.extend(t)}addItem(t){this.control.push(t)}removeItems(){this.control.clear()}removeLastItem(){this.control.pop()}}return r})());