Files
WGDashboard/src/static/dist/WGDashboardAdmin/assets/Vector-C7_esFoa.js
2026-04-02 09:29:09 +02:00

8 lines
299 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const xt={ADD:"add",REMOVE:"remove"},fi={PROPERTYCHANGE:"propertychange"},Y={CHANGE:"change",ERROR:"error",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",TOUCHMOVE:"touchmove",WHEEL:"wheel"};class Zn{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function vl(n,t,e){let i,s;e=e||le;let r=0,o=n.length,a=!1;for(;r<o;)i=r+(o-r>>1),s=+e(n[i],t),s<0?r=i+1:(o=i,a=!s);return a?r:~r}function le(n,t){return n>t?1:n<t?-1:0}function Ll(n,t){return n<t?1:n>t?-1:0}function sr(n,t,e){if(n[0]<=t)return 0;const i=n.length;if(t<=n[i-1])return i-1;if(typeof e=="function"){for(let s=1;s<i;++s){const r=n[s];if(r===t)return s;if(r<t)return e(t,n[s-1],r)>0?s-1:s}return i-1}if(e>0){for(let s=1;s<i;++s)if(n[s]<t)return s-1;return i-1}if(e<0){for(let s=1;s<i;++s)if(n[s]<=t)return s;return i-1}for(let s=1;s<i;++s){if(n[s]==t)return s;if(n[s]<t)return n[s-1]-t<t-n[s]?s-1:s}return i-1}function Al(n,t,e){for(;t<e;){const i=n[t];n[t]=n[e],n[e]=i,++t,--e}}function rr(n,t){const e=Array.isArray(t)?t:[t],i=e.length;for(let s=0;s<i;s++)n[n.length]=e[s]}function Me(n,t){const e=n.length;if(e!==t.length)return!1;for(let i=0;i<e;i++)if(n[i]!==t[i])return!1;return!0}function Ml(n,t,e){const i=t||le;return n.every(function(s,r){if(r===0)return!0;const o=i(n[r-1],s);return!(o>0||o===0)})}function Zi(){return!0}function Bn(){return!1}function Bi(){}function ea(n){let t,e,i;return function(){const s=Array.prototype.slice.call(arguments);return(!e||this!==i||!Me(s,e))&&(i=this,e=s,t=n.apply(this,arguments)),t}}function Ol(n){function t(){let e;try{e=n()}catch(i){return Promise.reject(i)}return e instanceof Promise?e:Promise.resolve(e)}return t()}function nn(n){for(const t in n)delete n[t]}function gi(n){let t;for(t in n)return!1;return!t}class de{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}class Un extends Zn{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),s=i[t]||(i[t]=[]);s.includes(e)||s.push(e)}dispatchEvent(t){const e=typeof t=="string",i=e?t:t.type,s=this.listeners_&&this.listeners_[i];if(!s)return;const r=e?new de(t):t;r.target||(r.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});i in o||(o[i]=0,a[i]=0),++o[i];let l;for(let c=0,h=s.length;c<h;++c)if("handleEvent"in s[c]?l=s[c].handleEvent(r):l=s[c].call(this,r),l===!1||r.propagationStopped){l=!1;break}if(--o[i]===0){let c=a[i];for(delete a[i];c--;)this.removeEventListener(i,Bi);delete o[i]}return l}disposeInternal(){this.listeners_&&nn(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return this.listeners_?t?t in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const s=i.indexOf(e);s!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[s]=Bi,++this.pendingRemovals_[t]):(i.splice(s,1),i.length===0&&delete this.listeners_[t]))}}function j(n,t,e,i,s){if(s){const o=e;e=function(a){return n.removeEventListener(t,e),o.call(i??this,a)}}else i&&i!==n&&(e=e.bind(i));const r={target:n,type:t,listener:e};return n.addEventListener(t,e),r}function bn(n,t,e,i){return j(n,t,e,i,!0)}function it(n){n&&n.target&&(n.target.removeEventListener(n.type,n.listener),nn(n))}class sn extends Un{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(Y.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=j(this,t[r],e);return s}return j(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const s=t.length;i=new Array(s);for(let r=0;r<s;++r)i[r]=bn(this,t[r],e)}else i=bn(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)bl(i);else if(Array.isArray(t))for(let s=0,r=t.length;s<r;++s)this.removeEventListener(t[s],e);else this.removeEventListener(t,e)}}sn.prototype.on;sn.prototype.once;sn.prototype.un;function bl(n){if(Array.isArray(n))for(let t=0,e=n.length;t<e;++t)it(n[t]);else it(n)}function V(){throw new Error("Unimplemented abstract method.")}let Pl=0;function H(n){return n.ol_uid||(n.ol_uid=String(++Pl))}class jr extends de{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}class Qt extends sn{constructor(t){super(),this.on,this.once,this.un,H(this),this.values_=null,t!==void 0&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new jr(i,t,e)),i=fi.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new jr(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const s=this.values_||(this.values_={});if(i)s[t]=e;else{const r=s[t];s[t]=e,r!==e&&this.notify(t,r)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],gi(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}const Hr={LENGTH:"length"};class pn extends de{constructor(t,e,i){super(t),this.element=e,this.index=i}}class Pt extends Qt{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t??[],this.unique_)for(let i=1,s=this.array_.length;i<s;++i)this.assertUnique_(this.array_[i],i);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,i=t.length;e<i;++e)this.push(t[e]);return this}forEach(t){const e=this.array_;for(let i=0,s=e.length;i<s;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(Hr.LENGTH)}insertAt(t,e){if(t<0||t>this.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new pn(xt.ADD,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,s=e.length;i<s;++i)if(e[i]===t)return this.removeAt(i)}removeAt(t){if(t<0||t>=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new pn(xt.REMOVE,e,t)),e}setAt(t,e){const i=this.getLength();if(t>=i){this.insertAt(t,e);return}if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const s=this.array_[t];this.array_[t]=e,this.dispatchEvent(new pn(xt.REMOVE,s,t)),this.dispatchEvent(new pn(xt.ADD,e,t))}updateLength_(){this.set(Hr.LENGTH,this.array_.length)}assertUnique_(t,e){const i=this.array_;for(let s=0,r=i.length;s<r;++s)if(i[s]===t&&s!==e)throw new Error("Duplicate item added to a unique collection")}}class ii extends de{constructor(t,e,i){super(t),this.map=e,this.frameState=i!==void 0?i:null}}class Ce extends ii{constructor(t,e,i,s,r,o){super(t,e,r),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=s!==void 0?s:!1,this.activePointers=o}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(t){this.pixel_=t}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(t){this.coordinate_=t}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}}const rt={SINGLECLICK:"singleclick",CLICK:Y.CLICK,DBLCLICK:Y.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},Ye=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",Dl=Ye.includes("safari")&&!Ye.includes("chrom");Dl&&(Ye.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(Ye));const Fl=Ye.includes("webkit")&&!Ye.includes("edge"),ia=Ye.includes("macintosh"),kl=typeof devicePixelRatio<"u"?devicePixelRatio:1,Dt=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,na=typeof Image<"u"&&Image.prototype.decode,sa=(function(){let n=!1;try{const t=Object.defineProperty({},"passive",{get:function(){n=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch{}return n})(),Ws={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown"};class Nl extends Un{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=e===void 0?1:e,this.down_=null;const i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=j(i,Ws.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=j(i,Ws.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(Y.TOUCHMOVE,this.boundHandleTouchMove_,sa?{passive:!1}:!1)}emulateClick_(t){let e=new Ce(rt.CLICK,this.map_,t);this.dispatchEvent(e),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new Ce(rt.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const i=new Ce(rt.SINGLECLICK,this.map_,t);this.dispatchEvent(i)},250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==rt.POINTERUP||e.type==rt.POINTERCANCEL){delete this.trackedTouches_[i];for(const s in this.trackedTouches_)if(this.trackedTouches_[s].target!==e.target){delete this.trackedTouches_[s];break}}else(e.type==rt.POINTERDOWN||e.type==rt.POINTERMOVE)&&(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new Ce(rt.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(it),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return t.button===0}handlePointerDown_(t){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(t);const e=new Ce(rt.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),this.dragListenerKeys_.length===0){const i=this.map_.getOwnerDocument();this.dragListenerKeys_.push(j(i,rt.POINTERMOVE,this.handlePointerMove_,this),j(i,rt.POINTERUP,this.handlePointerUp_,this),j(this.element_,rt.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==i&&this.dragListenerKeys_.push(j(this.element_.getRootNode(),rt.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new Ce(rt.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 Ce(rt.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;(!e||e.defaultPrevented)&&(typeof t.cancelable!="boolean"||t.cancelable===!0)&&t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(it(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(Y.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(it(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(it),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const we={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},gt={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},b={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function J(n,t){if(!n)throw new Error(t)}const Pn=1/0;class Gl{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,nn(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];t.length==1?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const s=this.keyFunction_(i);return delete this.queuedElements_[s],i}enqueue(t){J(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=Pn?(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(t){return t*2+1}getRightChildIndex_(t){return t*2+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return this.elements_.length===0}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,s=e.length,r=e[t],o=i[t],a=t;for(;t<s>>1;){const l=this.getLeftChildIndex_(t),c=this.getRightChildIndex_(t),h=c<s&&i[c]<i[l]?c:l;e[t]=e[h],i[t]=i[h],t=h}e[t]=r,i[t]=o,this.siftDown_(a,t)}siftDown_(t,e){const i=this.elements_,s=this.priorities_,r=i[e],o=s[e];for(;e>t;){const a=this.getParentIndex_(e);if(s[a]>o)i[e]=i[a],s[e]=s[a],e=a;else break}i[e]=r,s[e]=o}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let s=0;const r=e.length;let o,a,l;for(a=0;a<r;++a)o=e[a],l=t(o),l==Pn?delete this.queuedElements_[this.keyFunction_(o)]:(i[s]=l,e[s++]=o);e.length=s,i.length=s,this.heapify_()}}class zl extends Gl{constructor(t,e){super(i=>t.apply(null,i),i=>i[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);return e&&t[0].addEventListener(Y.CHANGE,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===b.LOADED||i===b.ERROR||i===b.EMPTY){i!==b.ERROR&&e.removeEventListener(Y.CHANGE,this.boundHandleTileChange_);const s=e.getKey();s in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[s],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i=0;for(;this.tilesLoading_<t&&i<e&&this.getCount()>0;){const s=this.dequeue()[0],r=s.getKey();s.getState()===b.IDLE&&!(r in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[r]=!0,++this.tilesLoading_,++i,s.load())}}}function Xl(n,t,e,i,s){if(!n||!(e in n.wantedTiles)||!n.wantedTiles[e][t.getKey()])return Pn;const r=n.viewState.center,o=i[0]-r[0],a=i[1]-r[1];return 65536*Math.log(s)+Math.sqrt(o*o+a*a)/s}const _t={ANIMATING:0,INTERACTING:1},Wt={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function nt(n,t,e){return Math.min(Math.max(n,t),e)}function Wl(n,t,e,i,s,r){const o=s-e,a=r-i;if(o!==0||a!==0){const l=((n-e)*o+(t-i)*a)/(o*o+a*a);l>1?(e=s,i=r):l>0&&(e+=o*l,i+=a*l)}return li(n,t,e,i)}function li(n,t,e,i){const s=e-n,r=i-t;return s*s+r*r}function Yl(n){const t=n.length;for(let i=0;i<t;i++){let s=i,r=Math.abs(n[i][i]);for(let a=i+1;a<t;a++){const l=Math.abs(n[a][i]);l>r&&(r=l,s=a)}if(r===0)return null;const o=n[s];n[s]=n[i],n[i]=o;for(let a=i+1;a<t;a++){const l=-n[a][i]/n[i][i];for(let c=i;c<t+1;c++)i==c?n[a][c]=0:n[a][c]+=l*n[i][c]}}const e=new Array(t);for(let i=t-1;i>=0;i--){e[i]=n[i][t]/n[i][i];for(let s=i-1;s>=0;s--)n[s][t]-=n[s][i]*e[i]}return e}function qr(n){return n*180/Math.PI}function ve(n){return n*Math.PI/180}function hi(n,t){const e=n%t;return e*t<0?e+t:e}function St(n,t,e){return n+e*(t-n)}function Vn(n,t){const e=Math.pow(10,t);return Math.round(n*e)/e}function yn(n,t){return Math.floor(Vn(n,t))}function En(n,t){return Math.ceil(Vn(n,t))}function Ys(n,t,e){if(n>=t&&n<e)return n;const i=e-t;return((n-t)%i+i)%i+t}function $r(n,t,e){return(function(i,s,r,o,a){if(!i)return;if(!s&&!t)return i;const l=t?0:r[0]*s,c=t?0:r[1]*s,h=a?a[0]:0,u=a?a[1]:0;let d=n[0]+l/2+h,f=n[2]-l/2+h,g=n[1]+c/2+u,m=n[3]-c/2+u;d>f&&(d=(f+d)/2,f=d),g>m&&(g=(m+g)/2,m=g);let _=nt(i[0],d,f),y=nt(i[1],g,m);if(o&&e&&s){const E=30*s;_+=-E*Math.log(1+Math.max(0,d-i[0])/E)+E*Math.log(1+Math.max(0,i[0]-f)/E),y+=-E*Math.log(1+Math.max(0,g-i[1])/E)+E*Math.log(1+Math.max(0,i[1]-m)/E)}return[_,y]})}function Kl(n){return n}const ht={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Jr(n){const t=Gt();for(let e=0,i=n.length;e<i;++e)Wi(t,n[e]);return t}function or(n,t,e){return e?(e[0]=n[0]-t,e[1]=n[1]-t,e[2]=n[2]+t,e[3]=n[3]+t,e):[n[0]-t,n[1]-t,n[2]+t,n[3]+t]}function ra(n,t){return t?(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t):n.slice()}function oa(n,t,e){let i,s;return t<n[0]?i=n[0]-t:n[2]<t?i=t-n[2]:i=0,e<n[1]?s=n[1]-e:n[3]<e?s=e-n[3]:s=0,i*i+s*s}function _i(n,t){return aa(n,t[0],t[1])}function Di(n,t){return n[0]<=t[0]&&t[2]<=n[2]&&n[1]<=t[1]&&t[3]<=n[3]}function aa(n,t,e){return n[0]<=t&&t<=n[2]&&n[1]<=e&&e<=n[3]}function Ks(n,t){const e=n[0],i=n[1],s=n[2],r=n[3],o=t[0],a=t[1];let l=ht.UNKNOWN;return o<e?l=l|ht.LEFT:o>s&&(l=l|ht.RIGHT),a<i?l=l|ht.BELOW:a>r&&(l=l|ht.ABOVE),l===ht.UNKNOWN&&(l=ht.INTERSECTING),l}function Gt(){return[1/0,1/0,-1/0,-1/0]}function Ae(n,t,e,i,s){return s?(s[0]=n,s[1]=t,s[2]=e,s[3]=i,s):[n,t,e,i]}function jn(n){return Ae(1/0,1/0,-1/0,-1/0,n)}function la(n,t){const e=n[0],i=n[1];return Ae(e,i,e,i,t)}function ar(n,t,e,i,s){const r=jn(s);return ha(r,n,t,e,i)}function Ui(n,t){return n[0]==t[0]&&n[2]==t[2]&&n[1]==t[1]&&n[3]==t[3]}function Zl(n,t){return t[0]<n[0]&&(n[0]=t[0]),t[2]>n[2]&&(n[2]=t[2]),t[1]<n[1]&&(n[1]=t[1]),t[3]>n[3]&&(n[3]=t[3]),n}function Wi(n,t){t[0]<n[0]&&(n[0]=t[0]),t[0]>n[2]&&(n[2]=t[0]),t[1]<n[1]&&(n[1]=t[1]),t[1]>n[3]&&(n[3]=t[1])}function ha(n,t,e,i,s){for(;e<i;e+=s)Bl(n,t[e],t[e+1]);return n}function Bl(n,t,e){n[0]=Math.min(n[0],t),n[1]=Math.min(n[1],e),n[2]=Math.max(n[2],t),n[3]=Math.max(n[3],e)}function ca(n,t){let e;return e=t(Hn(n)),e||(e=t(qn(n)),e)||(e=t($n(n)),e)||(e=t(Ue(n)),e)?e:!1}function Zs(n){let t=0;return rn(n)||(t=tt(n)*Et(n)),t}function Hn(n){return[n[0],n[1]]}function qn(n){return[n[2],n[1]]}function Ke(n){return[(n[0]+n[2])/2,(n[1]+n[3])/2]}function Ul(n,t){let e;if(t==="bottom-left")e=Hn(n);else if(t==="bottom-right")e=qn(n);else if(t==="top-left")e=Ue(n);else if(t==="top-right")e=$n(n);else throw new Error("Invalid corner");return e}function Bs(n,t,e,i,s){const[r,o,a,l,c,h,u,d]=ua(n,t,e,i);return Ae(Math.min(r,a,c,u),Math.min(o,l,h,d),Math.max(r,a,c,u),Math.max(o,l,h,d),s)}function ua(n,t,e,i){const s=t*i[0]/2,r=t*i[1]/2,o=Math.cos(e),a=Math.sin(e),l=s*o,c=s*a,h=r*o,u=r*a,d=n[0],f=n[1];return[d-l+u,f-c-h,d-l-u,f-c+h,d+l-u,f+c+h,d+l+u,f+c-h,d-l+u,f-c-h]}function Et(n){return n[3]-n[1]}function Xe(n,t,e){const i=e||Gt();return Rt(n,t)?(n[0]>t[0]?i[0]=n[0]:i[0]=t[0],n[1]>t[1]?i[1]=n[1]:i[1]=t[1],n[2]<t[2]?i[2]=n[2]:i[2]=t[2],n[3]<t[3]?i[3]=n[3]:i[3]=t[3]):jn(i),i}function Ue(n){return[n[0],n[3]]}function $n(n){return[n[2],n[3]]}function tt(n){return n[2]-n[0]}function Rt(n,t){return n[0]<=t[2]&&n[2]>=t[0]&&n[1]<=t[3]&&n[3]>=t[1]}function rn(n){return n[2]<n[0]||n[3]<n[1]}function Vl(n,t){return t?(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t):n}function jl(n,t,e){let i=!1;const s=Ks(n,t),r=Ks(n,e);if(s===ht.INTERSECTING||r===ht.INTERSECTING)i=!0;else{const o=n[0],a=n[1],l=n[2],c=n[3],h=t[0],u=t[1],d=e[0],f=e[1],g=(f-u)/(d-h);let m,_;r&ht.ABOVE&&!(s&ht.ABOVE)&&(m=d-(f-c)/g,i=m>=o&&m<=l),!i&&r&ht.RIGHT&&!(s&ht.RIGHT)&&(_=f-(d-l)*g,i=_>=a&&_<=c),!i&&r&ht.BELOW&&!(s&ht.BELOW)&&(m=d-(f-a)/g,i=m>=o&&m<=l),!i&&r&ht.LEFT&&!(s&ht.LEFT)&&(_=f-(d-o)*g,i=_>=a&&_<=c)}return i}function da(n,t){const e=t.getExtent(),i=Ke(n);if(t.canWrapX()&&(i[0]<e[0]||i[0]>=e[2])){const s=tt(e),o=Math.floor((i[0]-e[0])/s)*s;n[0]-=o,n[2]-=o}return n}function fa(n,t,e){if(t.canWrapX()){const i=t.getExtent();if(!isFinite(n[0])||!isFinite(n[2]))return[[i[0],n[1],i[2],n[3]]];da(n,t);const s=tt(i);if(tt(n)>s&&!e)return[[i[0],n[1],i[2],n[3]]];if(n[0]<i[0])return[[n[0]+s,n[1],i[2],n[3]],[i[0],n[1],n[2],n[3]]];if(n[2]>i[2])return[[n[0],n[1],i[2],n[3]],[i[0],n[1],n[2]-s,n[3]]]}return[n]}function Hl(n,t){return n[0]+=+t[0],n[1]+=+t[1],n}function Dn(n,t){let e=!0;for(let i=n.length-1;i>=0;--i)if(n[i]!=t[i]){e=!1;break}return e}function lr(n,t){const e=Math.cos(t),i=Math.sin(t),s=n[0]*e-n[1]*i,r=n[1]*e+n[0]*i;return n[0]=s,n[1]=r,n}function ql(n,t){return n[0]*=t,n[1]*=t,n}function ga(n,t){if(t.canWrapX()){const e=tt(t.getExtent()),i=$l(n,t,e);i&&(n[0]-=i*e)}return n}function $l(n,t,e){const i=t.getExtent();let s=0;return t.canWrapX()&&(n[0]<i[0]||n[0]>i[2])&&(e=e||tt(i),s=Math.floor((n[0]-i[0])/e)),s}function Jl(n,t,e){const i=Math.sqrt((t[0]-n[0])*(t[0]-n[0])+(t[1]-n[1])*(t[1]-n[1])),s=[(t[0]-n[0])/i,(t[1]-n[1])/i],r=[-s[1],s[0]],o=Math.sqrt((e[0]-n[0])*(e[0]-n[0])+(e[1]-n[1])*(e[1]-n[1])),a=[(e[0]-n[0])/o,(e[1]-n[1])/o];let l=i===0||o===0?0:Math.acos(nt(a[0]*s[0]+a[1]*s[1],-1,1));return l=Math.max(l,1e-5),a[0]*r[0]+a[1]*r[1]>0?l:Math.PI*2-l}function _a(n){return Math.pow(n,3)}function xi(n){return 1-_a(1-n)}function Ql(n){return 3*n*n-2*n*n*n}function th(n){return n}const eh=63710088e-1;function Qr(n,t,e){e=e||eh;const i=ve(n[1]),s=ve(t[1]),r=(s-i)/2,o=ve(t[0]-n[0])/2,a=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(i)*Math.cos(s);return 2*e*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function ma(...n){console.warn(...n)}const hr={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class cr{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=t.extent!==void 0?t.extent:null,this.worldExtent_=t.worldExtent!==void 0?t.worldExtent:null,this.axisOrientation_=t.axisOrientation!==void 0?t.axisOrientation:"enu",this.global_=t.global!==void 0?t.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||hr[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!!(t&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!!(this.global_&&t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}}const on=6378137,oi=Math.PI*on,ih=[-oi,-oi,oi,oi],nh=[-180,-85,180,85],xn=on*Math.log(Math.tan(Math.PI/2));class He extends cr{constructor(t){super({code:t,units:"m",extent:ih,global:!0,worldExtent:nh,getPointResolution:function(e,i){return e/Math.cosh(i[1]/on)}})}}const to=[new He("EPSG:3857"),new He("EPSG:102100"),new He("EPSG:102113"),new He("EPSG:900913"),new He("http://www.opengis.net/def/crs/EPSG/0/3857"),new He("http://www.opengis.net/gml/srs/epsg.xml#3857")];function sh(n,t,e,i){const s=n.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=n.slice():t=new Array(s));for(let r=0;r<s;r+=i){t[r]=oi*n[r]/180;let o=on*Math.log(Math.tan(Math.PI*(+n[r+1]+90)/360));o>xn?o=xn:o<-xn&&(o=-xn),t[r+1]=o}return t}function rh(n,t,e,i){const s=n.length;e=e>1?e:2,i=i??e,t===void 0&&(e>2?t=n.slice():t=new Array(s));for(let r=0;r<s;r+=i)t[r]=180*n[r]/oi,t[r+1]=360*Math.atan(Math.exp(n[r+1]/on))/Math.PI-90;return t}const oh=6378137,eo=[-180,-90,180,90],ah=Math.PI*oh/180;class be extends cr{constructor(t,e){super({code:t,units:"degrees",extent:eo,axisOrientation:e,global:!0,metersPerUnit:ah,worldExtent:eo})}}const io=[new be("CRS:84"),new be("EPSG:4326","neu"),new be("urn:ogc:def:crs:OGC:1.3:CRS84"),new be("urn:ogc:def:crs:OGC:2:84"),new be("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new be("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new be("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Us={};function lh(n){return Us[n]||Us[n.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function hh(n,t){Us[n]=t}let ci={};function Vi(n,t,e){const i=n.getCode(),s=t.getCode();i in ci||(ci[i]={}),ci[i][s]=e}function ps(n,t){return n in ci&&t in ci[n]?ci[n][t]:null}const Fn=.9996,Nt=.00669438,Jn=Nt*Nt,Qn=Jn*Nt,ke=Nt/(1-Nt),no=Math.sqrt(1-Nt),mi=(1-no)/(1+no),pa=mi*mi,ur=pa*mi,dr=ur*mi,ya=dr*mi,Ea=1-Nt/4-3*Jn/64-5*Qn/256,ch=3*Nt/8+3*Jn/32+45*Qn/1024,uh=15*Jn/256+45*Qn/1024,dh=35*Qn/3072,fh=3/2*mi-27/32*ur+269/512*ya,gh=21/16*pa-55/32*dr,_h=151/96*ur-417/128*ya,mh=1097/512*dr,kn=6378137;function ph(n,t,e){const i=n-5e5,o=(e.north?t:t-1e7)/Fn/(kn*Ea),a=o+fh*Math.sin(2*o)+gh*Math.sin(4*o)+_h*Math.sin(6*o)+mh*Math.sin(8*o),l=Math.sin(a),c=l*l,h=Math.cos(a),u=l/h,d=u*u,f=d*d,g=1-Nt*c,m=Math.sqrt(1-Nt*c),_=kn/m,y=(1-Nt)/g,E=ke*h**2,C=E*E,p=i/(_*Fn),x=p*p,S=x*p,L=S*p,I=L*p,R=I*p,v=a-u/y*(x/2-L/24*(5+3*d+10*E-4*C-9*ke))+R/720*(61+90*d+298*E+45*f-252*ke-3*C);let k=(p-S/6*(1+2*d+E)+I/120*(5-2*E+28*d-3*C+8*ke+24*f))/h;return k=Ys(k+ve(xa(e.number)),-Math.PI,Math.PI),[qr(k),qr(v)]}const so=-80,ro=84,yh=-180,Eh=180;function xh(n,t,e){n=Ys(n,yh,Eh),t<so?t=so:t>ro&&(t=ro);const i=ve(t),s=Math.sin(i),r=Math.cos(i),o=s/r,a=o*o,l=a*a,c=ve(n),h=xa(e.number),u=ve(h),d=kn/Math.sqrt(1-Nt*s**2),f=ke*r**2,g=r*Ys(c-u,-Math.PI,Math.PI),m=g*g,_=m*g,y=_*g,E=y*g,C=E*g,p=kn*(Ea*i-ch*Math.sin(2*i)+uh*Math.sin(4*i)-dh*Math.sin(6*i)),x=Fn*d*(g+_/6*(1-a+f)+E/120*(5-18*a+l+72*f-58*ke))+5e5;let S=Fn*(p+d*o*(m/2+y/24*(5-a+9*f+4*f**2)+C/720*(61-58*a+l+600*f-330*ke)));return e.north||(S+=1e7),[x,S]}function xa(n){return(n-1)*6-180+3}const Ch=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function Ca(n){let t=0;for(const s of Ch){const r=n.match(s);if(r){t=parseInt(r[1]);break}}if(!t)return null;let e=0,i=!1;return t>32700&&t<32761?e=t-32700:t>32600&&t<32661&&(i=!0,e=t-32600),e?{number:e,north:i}:null}function oo(n,t){return function(e,i,s,r){const o=e.length;s=s>1?s:2,r=r??s,i||(s>2?i=e.slice():i=new Array(o));for(let a=0;a<o;a+=r){const l=e[a],c=e[a+1],h=n(l,c,t);i[a]=h[0],i[a+1]=h[1]}return i}}function wh(n){return Ca(n)?new cr({code:n,units:"m"}):null}function Rh(n){const t=Ca(n.getCode());return t?{forward:oo(xh,t),inverse:oo(ph,t)}:null}const Ih=[Rh],Th=[wh];let Vs=!0;function wa(n){Vs=!1}function fr(n,t){if(t!==void 0){for(let e=0,i=n.length;e<i;++e)t[e]=n[e];t=t}else t=n.slice();return t}function js(n){hh(n.getCode(),n),Vi(n,n,fr)}function Sh(n){n.forEach(js)}function Tt(n){if(typeof n!="string")return n;const t=lh(n);if(t)return t;for(const e of Th){const i=e(n);if(i)return i}return null}function ao(n,t,e,i){n=Tt(n);let s;const r=n.getPointResolutionFunc();if(r)s=r(t,e);else{const o=n.getUnits();if(o=="degrees"&&!i||i=="degrees")s=t;else{const a=_r(n,Tt("EPSG:4326"));if(!a&&o!=="degrees")s=t*n.getMetersPerUnit();else{let c=[e[0]-t/2,e[1],e[0]+t/2,e[1],e[0],e[1]-t/2,e[0],e[1]+t/2];c=a(c,c,2);const h=Qr(c.slice(0,2),c.slice(2,4)),u=Qr(c.slice(4,6),c.slice(6,8));s=(h+u)/2}const l=n.getMetersPerUnit();l!==void 0&&(s/=l)}}return s}function lo(n){Sh(n),n.forEach(function(t){n.forEach(function(e){t!==e&&Vi(t,e,fr)})})}function vh(n,t,e,i){n.forEach(function(s){t.forEach(function(r){Vi(s,r,e),Vi(r,s,i)})})}function gr(n,t){return n?typeof n=="string"?Tt(n):n:Tt(t)}function Lh(n){return(function(t,e,i,s){const r=t.length;i=i!==void 0?i:2,s=s??i,e=e!==void 0?e:new Array(r);for(let o=0;o<r;o+=s){const a=n(t.slice(o,o+i)),l=a.length;for(let c=0,h=s;c<h;++c)e[o+c]=c>=l?t[o+c]:a[c]}return e})}function Sf(n,t){return wa(),mr(n,"EPSG:4326","EPSG:3857")}function An(n,t){if(n===t)return!0;const e=n.getUnits()===t.getUnits();return(n.getCode()===t.getCode()||_r(n,t)===fr)&&e}function _r(n,t){const e=n.getCode(),i=t.getCode();let s=ps(e,i);if(s)return s;let r=null,o=null;for(const l of Ih)r||(r=l(n)),o||(o=l(t));if(!r&&!o)return null;const a="EPSG:4326";if(o)if(r)s=ys(r.inverse,o.forward);else{const l=ps(e,a);l&&(s=ys(l,o.forward))}else{const l=ps(a,i);l&&(s=ys(r.inverse,l))}return s&&(js(n),js(t),Vi(n,t,s)),s}function ys(n,t){return function(e,i,s,r){return i=n(e,i,s,r),t(i,i,s,r)}}function Nn(n,t){const e=Tt(n),i=Tt(t);return _r(e,i)}function mr(n,t,e){const i=Nn(t,e);if(!i){const s=Tt(t).getCode(),r=Tt(e).getCode();throw new Error(`No transform available between ${s} and ${r}`)}return i(n,void 0,n.length)}function Hs(n,t){return n}function re(n,t){return Vs&&!Dn(n,[0,0])&&n[0]>=-180&&n[0]<=180&&n[1]>=-90&&n[1]<=90&&(Vs=!1,ma("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),n}function Ra(n,t){return n}function Ie(n,t){return n}function Ah(){lo(to),lo(io),vh(io,to,sh,rh)}Ah();new Array(6);function Zt(){return[1,0,0,1,0,0]}function Mh(n,t){return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n}function ct(n,t){const e=t[0],i=t[1];return t[0]=n[0]*e+n[2]*i+n[4],t[1]=n[1]*e+n[3]*i+n[5],t}function ue(n,t,e,i,s,r,o,a){const l=Math.sin(r),c=Math.cos(r);return n[0]=i*c,n[1]=s*l,n[2]=-i*l,n[3]=s*c,n[4]=o*i*c-a*i*l+t,n[5]=o*s*l+a*s*c+e,n}function Ia(n,t){const e=Oh(t);J(e!==0,"Transformation matrix cannot be inverted");const i=t[0],s=t[1],r=t[2],o=t[3],a=t[4],l=t[5];return n[0]=o/e,n[1]=-s/e,n[2]=-r/e,n[3]=i/e,n[4]=(r*l-o*a)/e,n[5]=-(i*l-s*a)/e,n}function Oh(n){return n[0]*n[3]-n[1]*n[2]}const bh=[1e5,1e5,1e5,1e5,2,2];function Ph(n){return"matrix("+n.join(", ")+")"}function qs(n){return n.substring(7,n.length-1).split(",").map(parseFloat)}function Dh(n,t){const e=qs(n),i=qs(t);for(let s=0;s<6;++s)if(Math.round((e[s]-i[s])*bh[s])!==0)return!1;return!0}function Le(n,t,e,i,s,r,o){r=r||[],o=o||2;let a=0;for(let l=t;l<e;l+=i){const c=n[l],h=n[l+1];r[a++]=s[0]*c+s[2]*h+s[4],r[a++]=s[1]*c+s[3]*h+s[5];for(let u=2;u<o;u++)r[a++]=n[l+u]}return r&&r.length!=a&&(r.length=a),r}function Ta(n,t,e,i,s,r,o){o=o||[];const a=Math.cos(s),l=Math.sin(s),c=r[0],h=r[1];let u=0;for(let d=t;d<e;d+=i){const f=n[d]-c,g=n[d+1]-h;o[u++]=c+f*a-g*l,o[u++]=h+f*l+g*a;for(let m=d+2;m<d+i;++m)o[u++]=n[m]}return o&&o.length!=u&&(o.length=u),o}function Fh(n,t,e,i,s,r,o,a){a=a||[];const l=o[0],c=o[1];let h=0;for(let u=t;u<e;u+=i){const d=n[u]-l,f=n[u+1]-c;a[h++]=l+s*d,a[h++]=c+r*f;for(let g=u+2;g<u+i;++g)a[h++]=n[g]}return a&&a.length!=h&&(a.length=h),a}function kh(n,t,e,i,s,r,o){o=o||[];let a=0;for(let l=t;l<e;l+=i){o[a++]=n[l]+s,o[a++]=n[l+1]+r;for(let c=l+2;c<l+i;++c)o[a++]=n[c]}return o&&o.length!=a&&(o.length=a),o}const ho=Zt(),Nh=[NaN,NaN];class Gh extends Qt{constructor(){super(),this.extent_=Gt(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=ea((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const s=this.clone();return s.applyTransform(i),s.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return V()}closestPointXY(t,e,i,s){return V()}containsXY(t,e){return this.closestPointXY(t,e,Nh,Number.MIN_VALUE)===0}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return V()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&jn(e),this.extentRevision_=this.getRevision()}return Vl(this.extent_,t)}rotate(t,e){V()}scale(t,e,i){V()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return V()}getType(){return V()}applyTransform(t){V()}intersectsExtent(t){return V()}translate(t,e){V()}transform(t,e){const i=Tt(t),s=i.getUnits()=="tile-pixels"?function(r,o,a){const l=i.getExtent(),c=i.getWorldExtent(),h=Et(c)/Et(l);ue(ho,c[0],c[3],h,-h,0,0,0);const u=Le(r,0,r.length,a,ho,o),d=Nn(i,e);return d?d(u,u,a):u}:Nn(i,e);return this.applyTransform(s),this}}class pr extends Gh{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return ar(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return V()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=co(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){V()}setLayout(t,e,i){let s;if(t)s=co(t);else{for(let r=0;r<i;++r){if(e.length===0){this.layout="XY",this.stride=2;return}e=e[0]}s=e.length,t=zh(s)}this.layout=t,this.stride=s}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const s=this.getStride();Ta(i,0,i.length,s,t,e,i),this.changed()}}scale(t,e,i){e===void 0&&(e=t),i||(i=Ke(this.getExtent()));const s=this.getFlatCoordinates();if(s){const r=this.getStride();Fh(s,0,s.length,r,t,e,i,s),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const s=this.getStride();kh(i,0,i.length,s,t,e,i),this.changed()}}}function zh(n){let t;return n==2?t="XY":n==3?t="XYZ":n==4&&(t="XYZM"),t}function co(n){let t;return n=="XY"?t=2:n=="XYZ"||n=="XYM"?t=3:n=="XYZM"&&(t=4),t}function Xh(n,t,e){const i=n.getFlatCoordinates();if(!i)return null;const s=n.getStride();return Le(i,0,i.length,s,t,e)}function Sa(n,t,e,i){let s=0;const r=n[e-i],o=n[e-i+1];let a=0,l=0;for(;t<e;t+=i){const c=n[t]-r,h=n[t+1]-o;s+=l*c-a*h,a=c,l=h}return s/2}function Wh(n,t,e,i){let s=0;for(let r=0,o=e.length;r<o;++r){const a=e[r];s+=Sa(n,t,a,i),t=a}return s}function uo(n,t,e,i,s,r,o){const a=n[t],l=n[t+1],c=n[e]-a,h=n[e+1]-l;let u;if(c===0&&h===0)u=t;else{const d=((s-a)*c+(r-l)*h)/(c*c+h*h);if(d>1)u=e;else if(d>0){for(let f=0;f<i;++f)o[f]=St(n[t+f],n[e+f],d);o.length=i;return}else u=t}for(let d=0;d<i;++d)o[d]=n[u+d];o.length=i}function va(n,t,e,i,s){let r=n[t],o=n[t+1];for(t+=i;t<e;t+=i){const a=n[t],l=n[t+1],c=li(r,o,a,l);c>s&&(s=c),r=a,o=l}return s}function Yh(n,t,e,i,s){for(let r=0,o=e.length;r<o;++r){const a=e[r];s=va(n,t,a,i,s),t=a}return s}function La(n,t,e,i,s,r,o,a,l,c,h){if(t==e)return c;let u,d;if(s===0){if(d=li(o,a,n[t],n[t+1]),d<c){for(u=0;u<i;++u)l[u]=n[t+u];return l.length=i,d}return c}h=h||[NaN,NaN];let f=t+i;for(;f<e;)if(uo(n,f-i,f,i,o,a,h),d=li(o,a,h[0],h[1]),d<c){for(c=d,u=0;u<i;++u)l[u]=h[u];l.length=i,f+=i}else f+=i*Math.max((Math.sqrt(d)-Math.sqrt(c))/s|0,1);if(r&&(uo(n,e-i,t,i,o,a,h),d=li(o,a,h[0],h[1]),d<c)){for(c=d,u=0;u<i;++u)l[u]=h[u];l.length=i}return c}function Kh(n,t,e,i,s,r,o,a,l,c,h){h=h||[NaN,NaN];for(let u=0,d=e.length;u<d;++u){const f=e[u];c=La(n,t,f,i,s,r,o,a,l,c,h),t=f}return c}function Zh(n,t,e,i){for(let s=0,r=e.length;s<r;++s)n[t++]=e[s];return t}function Aa(n,t,e,i){for(let s=0,r=e.length;s<r;++s){const o=e[s];for(let a=0;a<i;++a)n[t++]=o[a]}return t}function Bh(n,t,e,i,s){s=s||[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=Aa(n,t,e[o],i);s[r++]=l,t=l}return s.length=r,s}function ai(n,t,e,i,s){s=s!==void 0?s:[];let r=0;for(let o=t;o<e;o+=i)s[r++]=n.slice(o,o+i);return s.length=r,s}function Gn(n,t,e,i,s){s=s!==void 0?s:[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];s[r++]=ai(n,t,l,i,s[r]),t=l}return s.length=r,s}function fo(n,t,e,i,s){s=s!==void 0?s:[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];s[r++]=l.length===1&&l[0]===t?[]:Gn(n,t,l,i,s[r]),t=l[l.length-1]}return s.length=r,s}function yr(n,t,e,i,s,r,o){const a=(e-t)/i;if(a<3){for(;t<e;t+=i)r[o++]=n[t],r[o++]=n[t+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const c=[t,e-i];let h=0;for(;c.length>0;){const u=c.pop(),d=c.pop();let f=0;const g=n[d],m=n[d+1],_=n[u],y=n[u+1];for(let E=d+i;E<u;E+=i){const C=n[E],p=n[E+1],x=Wl(C,p,g,m,_,y);x>f&&(h=E,f=x)}f>s&&(l[(h-t)/i]=1,d+i<h&&c.push(d,h),h+i<u&&c.push(h,u))}for(let u=0;u<a;++u)l[u]&&(r[o++]=n[t+u*i],r[o++]=n[t+u*i+1]);return o}function Uh(n,t,e,i,s,r,o,a){for(let l=0,c=e.length;l<c;++l){const h=e[l];o=yr(n,t,h,i,s,r,o),a.push(o),t=h}return o}function De(n,t){return t*Math.round(n/t)}function Vh(n,t,e,i,s,r,o){if(t==e)return o;let a=De(n[t],s),l=De(n[t+1],s);t+=i,r[o++]=a,r[o++]=l;let c,h;do if(c=De(n[t],s),h=De(n[t+1],s),t+=i,t==e)return r[o++]=c,r[o++]=h,o;while(c==a&&h==l);for(;t<e;){const u=De(n[t],s),d=De(n[t+1],s);if(t+=i,u==c&&d==h)continue;const f=c-a,g=h-l,m=u-a,_=d-l;if(f*_==g*m&&(f<0&&m<f||f==m||f>0&&m>f)&&(g<0&&_<g||g==_||g>0&&_>g)){c=u,h=d;continue}r[o++]=c,r[o++]=h,a=c,l=h,c=u,h=d}return r[o++]=c,r[o++]=h,o}function Ma(n,t,e,i,s,r,o,a){for(let l=0,c=e.length;l<c;++l){const h=e[l];o=Vh(n,t,h,i,s,r,o),a.push(o),t=h}return o}class ji extends pr{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,e!==void 0&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}clone(){return new ji(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,s){return s<oa(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(va(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),La(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,s))}getArea(){return Sa(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return ai(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=yr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new ji(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Aa(this.flatCoordinates,0,t,this.stride),this.changed()}}class Er extends pr{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new Er(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,s){const r=this.flatCoordinates,o=li(t,e,r[0],r[1]);if(o<s){const a=this.stride;for(let l=0;l<a;++l)i[l]=r[l];return i.length=a,o}return s}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return la(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return aa(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Zh(this.flatCoordinates,0,t,this.stride),this.changed()}}function jh(n,t,e,i,s){return!ca(s,function(o){return!Ne(n,t,e,i,o[0],o[1])})}function Ne(n,t,e,i,s,r){let o=0,a=n[e-i],l=n[e-i+1];for(;t<e;t+=i){const c=n[t],h=n[t+1];l<=r?h>r&&(c-a)*(r-l)-(s-a)*(h-l)>0&&o++:h<=r&&(c-a)*(r-l)-(s-a)*(h-l)<0&&o--,a=c,l=h}return o!==0}function Oa(n,t,e,i,s,r){if(e.length===0||!Ne(n,t,e[0],i,s,r))return!1;for(let o=1,a=e.length;o<a;++o)if(Ne(n,e[o-1],e[o],i,s,r))return!1;return!0}function xr(n,t,e,i,s,r,o){let a,l,c,h,u,d,f;const g=s[r+1],m=[];for(let E=0,C=e.length;E<C;++E){const p=e[E];for(h=n[p-i],d=n[p-i+1],a=t;a<p;a+=i)u=n[a],f=n[a+1],(g<=d&&f<=g||d<=g&&g<=f)&&(c=(g-d)/(f-d)*(u-h)+h,m.push(c)),h=u,d=f}let _=NaN,y=-1/0;for(m.sort(le),h=m[0],a=1,l=m.length;a<l;++a){u=m[a];const E=Math.abs(u-h);E>y&&(c=(h+u)/2,Oa(n,t,e,i,c,g)&&(_=c,y=E)),h=u}return isNaN(_)&&(_=s[r]),o?(o.push(_,g,y),o):[_,g,y]}function Hh(n,t,e,i,s){let r=[];for(let o=0,a=e.length;o<a;++o){const l=e[o];r=xr(n,t,l,i,s,2*o,r),t=l[l.length-1]}return r}function qh(n,t,e,i,s){let r;for(t+=i;t<e;t+=i)if(r=s(n.slice(t-i,t),n.slice(t,t+i)),r)return r;return!1}function ba(n,t,e,i,s,r){return r=r??ha(Gt(),n,t,e,i),Rt(s,r)?r[0]>=s[0]&&r[2]<=s[2]||r[1]>=s[1]&&r[3]<=s[3]?!0:qh(n,t,e,i,function(o,a){return jl(s,o,a)}):!1}function Pa(n,t,e,i,s){return!!(ba(n,t,e,i,s)||Ne(n,t,e,i,s[0],s[1])||Ne(n,t,e,i,s[0],s[3])||Ne(n,t,e,i,s[2],s[1])||Ne(n,t,e,i,s[2],s[3]))}function $h(n,t,e,i,s){if(!Pa(n,t,e[0],i,s))return!1;if(e.length===1)return!0;for(let r=1,o=e.length;r<o;++r)if(jh(n,e[r-1],e[r],i,s)&&!ba(n,e[r-1],e[r],i,s))return!1;return!0}function Jh(n,t,e,i){for(;t<e-i;){for(let s=0;s<i;++s){const r=n[t+s];n[t+s]=n[e-i+s],n[e-i+s]=r}t+=i,e-=i}}function Cr(n,t,e,i){let s=0,r=n[e-i],o=n[e-i+1];for(;t<e;t+=i){const a=n[t],l=n[t+1];s+=(a-r)*(l+o),r=a,o=l}return s===0?void 0:s>0}function Qh(n,t,e,i,s){s=s!==void 0?s:!1;for(let r=0,o=e.length;r<o;++r){const a=e[r],l=Cr(n,t,a,i);if(r===0){if(s&&l||!s&&!l)return!1}else if(s&&!l||!s&&l)return!1;t=a}return!0}function go(n,t,e,i,s){s=s!==void 0?s:!1;for(let r=0,o=e.length;r<o;++r){const a=e[r],l=Cr(n,t,a,i);(r===0?s&&l||!s&&!l:s&&!l||!s&&l)&&Jh(n,t,a,i),t=a}return t}function tc(n,t){const e=[];let i=0,s=0,r;for(let o=0,a=t.length;o<a;++o){const l=t[o],c=Cr(n,i,l,2);if(r===void 0&&(r=c),c===r)e.push(t.slice(s,o+1));else{if(e.length===0)continue;e[e.length-1].push(t[s])}s=o+1,i=l}return e}class Hi extends pr{constructor(t,e,i){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,e!==void 0&&i?(this.setFlatCoordinates(e,t),this.ends_=i):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?rr(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Hi(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,s){return s<oa(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Yh(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Kh(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,s))}containsXY(t,e){return Oa(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return Wh(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),go(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=Ke(this.getExtent());this.flatInteriorPoint_=xr(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Er(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new ji(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,s=[];let r=0;for(let o=0,a=i.length;o<a;++o){const l=i[o],c=new ji(e.slice(r,l),t);s.push(c),r=l}return s}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;Qh(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=go(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=Ma(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new Hi(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return $h(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=Bh(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}}function _o(n){if(rn(n))throw new Error("Cannot create polygon from empty extent");const t=n[0],e=n[1],i=n[2],s=n[3],r=[t,e,t,s,i,s,i,e,t,e];return new Hi(r,"XY",[r.length])}function wr(n,t,e,i){const s=tt(t)/e[0],r=Et(t)/e[1];return i?Math.min(n,Math.max(s,r)):Math.min(n,Math.min(s,r))}function Rr(n,t,e){let i=Math.min(n,t);const s=50;return i*=Math.log(1+s*Math.max(0,n/t-1))/s+1,e&&(i=Math.max(i,e),i/=Math.log(1+s*Math.max(0,e/n-1))/s+1),nt(i,e/2,t*2)}function ec(n,t,e,i){return t=t!==void 0?t:!0,(function(s,r,o,a){if(s!==void 0){const l=n[0],c=n[n.length-1],h=e?wr(l,e,o,i):l;if(a)return t?Rr(s,h,c):nt(s,c,h);const u=Math.min(h,s),d=Math.floor(sr(n,u,r));return n[d]>h&&d<n.length-1?n[d+1]:n[d]}})}function ic(n,t,e,i,s,r){return i=i!==void 0?i:!0,e=e!==void 0?e:0,(function(o,a,l,c){if(o!==void 0){const h=s?wr(t,s,l,r):t;if(c)return i?Rr(o,h,e):nt(o,e,h);const u=1e-9,d=Math.ceil(Math.log(t/h)/Math.log(n)-u),f=-a*(.5-u)+.5,g=Math.min(h,o),m=Math.floor(Math.log(t/g)/Math.log(n)+f),_=Math.max(d,m),y=t/Math.pow(n,_);return nt(y,e,h)}})}function mo(n,t,e,i,s){return e=e!==void 0?e:!0,(function(r,o,a,l){if(r!==void 0){const c=i?wr(n,i,a,s):n;return!e||!l?nt(r,t,c):Rr(r,c,t)}})}function Ir(n){if(n!==void 0)return 0}function po(n){if(n!==void 0)return n}function nc(n){const t=2*Math.PI/n;return(function(e,i){if(i)return e;if(e!==void 0)return e=Math.floor(e/t+.5)*t,e})}function sc(n){const t=ve(5);return(function(e,i){return i||e===void 0?e:Math.abs(e)<=t?0:e})}const rc=42,Tr=256,Es=0;class ae extends Qt{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=gr(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&&wa(),t.center&&(t.center=re(t.center,this.projection_)),t.extent&&(t.extent=Ie(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const a in Wt)delete e[a];this.setProperties(e,!0);const i=ac(t);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=i.minZoom;const s=oc(t),r=i.constraint,o=lc(t);this.constraints_={center:s,resolution:r,rotation:o},this.setRotation(t.rotation!==void 0?t.rotation:0),this.setCenterInternal(t.center!==void 0?t.center:null),t.resolution!==void 0?this.setResolution(t.resolution):t.zoom!==void 0&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const i=this.getCenterInternal();if(i){const s=t||[0,0,0,0];e=e||[0,0,0,0];const r=this.getResolution(),o=r/2*(s[3]-e[3]+e[1]-s[1]),a=r/2*(s[0]-e[0]+e[2]-s[2]);this.setCenterInternal([i[0]+o,i[1]-a])}}getUpdatedOptions_(t){const e=this.getProperties();return e.resolution!==void 0?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let i=0;i<e.length;++i){let s=arguments[i];s.center&&(s=Object.assign({},s),s.center=re(s.center,this.getProjection())),s.anchor&&(s=Object.assign({},s),s.anchor=re(s.anchor,this.getProjection())),e[i]=s}this.animateInternal.apply(this,e)}animateInternal(t){let e=arguments.length,i;e>1&&typeof arguments[e-1]=="function"&&(i=arguments[e-1],--e);let s=0;for(;s<e&&!this.isDef();++s){const h=arguments[s];h.center&&this.setCenterInternal(h.center),h.zoom!==void 0?this.setZoom(h.zoom):h.resolution&&this.setResolution(h.resolution),h.rotation!==void 0&&this.setRotation(h.rotation)}if(s===e){i&&Cn(i,!0);return}let r=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_;const c=[];for(;s<e;++s){const h=arguments[s],u={start:r,complete:!1,anchor:h.anchor,duration:h.duration!==void 0?h.duration:1e3,easing:h.easing||Ql,callback:i};if(h.center&&(u.sourceCenter=o,u.targetCenter=h.center.slice(),o=u.targetCenter),h.zoom!==void 0?(u.sourceResolution=a,u.targetResolution=this.getResolutionForZoom(h.zoom),a=u.targetResolution):h.resolution&&(u.sourceResolution=a,u.targetResolution=h.resolution,a=u.targetResolution),h.rotation!==void 0){u.sourceRotation=l;const d=hi(h.rotation-l+Math.PI,2*Math.PI)-Math.PI;u.targetRotation=l+d,l=u.targetRotation}hc(u)?u.complete=!0:r+=u.duration,c.push(u)}this.animations_.push(c),this.setHint(_t.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[_t.ANIMATING]>0}getInteracting(){return this.hints_[_t.INTERACTING]>0}cancelAnimations(){this.setHint(_t.ANIMATING,-this.hints_[_t.ANIMATING]);let t;for(let e=0,i=this.animations_.length;e<i;++e){const s=this.animations_[e];if(s[0].callback&&Cn(s[0].callback,!1),!t)for(let r=0,o=s.length;r<o;++r){const a=s[r];if(!a.complete){t=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let i=this.animations_.length-1;i>=0;--i){const s=this.animations_[i];let r=!0;for(let o=0,a=s.length;o<a;++o){const l=s[o];if(l.complete)continue;const c=t-l.start;let h=l.duration>0?c/l.duration:1;h>=1?(l.complete=!0,h=1):r=!1;const u=l.easing(h);if(l.sourceCenter){const d=l.sourceCenter[0],f=l.sourceCenter[1],g=l.targetCenter[0],m=l.targetCenter[1];this.nextCenter_=l.targetCenter;const _=d+u*(g-d),y=f+u*(m-f);this.targetCenter_=[_,y]}if(l.sourceResolution&&l.targetResolution){const d=u===1?l.targetResolution:l.sourceResolution+u*(l.targetResolution-l.sourceResolution);if(l.anchor){const f=this.getViewportSize_(this.getRotation()),g=this.constraints_.resolution(d,0,f,!0);this.targetCenter_=this.calculateCenterZoom(g,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=d,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){const d=u===1?hi(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+u*(l.targetRotation-l.sourceRotation);if(l.anchor){const f=this.constraints_.rotation(d,!0);this.targetCenter_=this.calculateCenterRotate(f,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=d}if(this.applyTargetState_(!0),e=!0,!l.complete)break}if(r){this.animations_[i]=null,this.setHint(_t.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const o=s[0].callback;o&&Cn(o,!0)}}this.animations_=this.animations_.filter(Boolean),e&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const s=this.getCenterInternal();return s!==void 0&&(i=[s[0]-e[0],s[1]-e[1]],lr(i,t-this.getRotation()),Hl(i,e)),i}calculateCenterZoom(t,e){let i;const s=this.getCenterInternal(),r=this.getResolution();if(s!==void 0&&r!==void 0){const o=e[0]-t*(e[0]-s[0])/r,a=e[1]-t*(e[1]-s[1])/r;i=[o,a]}return i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],s=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(s*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(s*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t&&Hs(t,this.getProjection())}getCenterInternal(){return this.get(Wt.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return t!==void 0?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){const e=this.calculateExtentInternal(t);return Ra(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();J(e,"The view center is not defined");const i=this.getResolution();J(i!==void 0,"The view resolution is not defined");const s=this.getRotation();return J(s!==void 0,"The view rotation is not defined"),Bs(e,i,s,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(Wt.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(Ie(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=tt(t)/e[0],s=Et(t)/e[1];return Math.max(i,s)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,s=Math.log(e/i)/Math.log(t);return(function(r){return e/Math.pow(t,r*s)})}getRotation(){return this.get(Wt.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),s=this.minResolution_,r=Math.log(i/s)/e;return(function(o){return Math.log(i/o)/e/r})}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let s=this.getCenterInternal();const r=this.padding_;if(r){const o=this.getViewportSizeMinusPadding_();s=xs(s,this.getViewportSize_(),[o[0]/2+r[3],o[1]/2+r[0]],e,i)}return{center:s.slice(0),projection:t!==void 0?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return e!==void 0&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e=this.minZoom_||0,i,s;if(this.resolutions_){const r=sr(this.resolutions_,t,1);e=r,i=this.resolutions_[r],r==this.resolutions_.length-1?s=2:s=i/this.resolutions_[r+1]}else i=this.maxResolution_,s=this.zoomFactor_;return e+Math.log(i/t)/Math.log(s)}getResolutionForZoom(t){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];const e=nt(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,nt(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(J(Array.isArray(t)||typeof t.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){J(!rn(t),"Cannot fit empty extent provided as `geometry`");const s=Ie(t,this.getProjection());i=_o(s)}else if(t.getType()==="Circle"){const s=Ie(t.getExtent(),this.getProjection());i=_o(s),i.rotate(this.getRotation(),Ke(s))}else i=t;this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),s=Math.sin(-e),r=t.getFlatCoordinates(),o=t.getStride();let a=1/0,l=1/0,c=-1/0,h=-1/0;for(let u=0,d=r.length;u<d;u+=o){const f=r[u]*i-r[u+1]*s,g=r[u]*s+r[u+1]*i;a=Math.min(a,f),l=Math.min(l,g),c=Math.max(c,f),h=Math.max(h,g)}return[a,l,c,h]}fitInternal(t,e){e=e||{};let i=e.size;i||(i=this.getViewportSizeMinusPadding_());const s=e.padding!==void 0?e.padding:[0,0,0,0],r=e.nearest!==void 0?e.nearest:!1;let o;e.minResolution!==void 0?o=e.minResolution:e.maxZoom!==void 0?o=this.getResolutionForZoom(e.maxZoom):o=0;const a=this.rotatedExtentForGeometry(t);let l=this.getResolutionForExtentInternal(a,[i[0]-s[1]-s[3],i[1]-s[0]-s[2]]);l=isNaN(l)?o:Math.max(l,o),l=this.getConstrainedResolution(l,r?0:1);const c=this.getRotation(),h=Math.sin(c),u=Math.cos(c),d=Ke(a);d[0]+=(s[1]-s[3])/2*l,d[1]+=(s[0]-s[2])/2*l;const f=d[0]*u-d[1]*h,g=d[1]*u+d[0]*h,m=this.getConstrainedCenter([f,g],l),_=e.callback?e.callback:Bi;e.duration!==void 0?this.animateInternal({resolution:l,center:m,duration:e.duration,easing:e.easing},_):(this.targetResolution_=l,this.targetCenter_=m,this.applyTargetState_(!1,!0),Cn(_,!0))}centerOn(t,e,i){this.centerOnInternal(re(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(xs(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,s){let r;const o=this.padding_;if(o&&t){const a=this.getViewportSizeMinusPadding_(-i),l=xs(t,s,[a[0]/2+o[3],a[1]/2+o[0]],e,i);r=[t[0]-l[0],t[1]-l[1]]}return r}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(t){const e=Hs(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&&re(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const i=this.getAnimating()||this.getInteracting(),s=this.getViewportSize_(this.getRotation()),r=this.constraints_.resolution(this.targetResolution_*t,0,s,i);e&&(this.targetCenter_=this.calculateCenterZoom(r,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=re(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const i=this.getAnimating()||this.getInteracting(),s=this.constraints_.rotation(this.targetRotation_+t,i);e&&(this.targetCenter_=this.calculateCenterRotate(s,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t&&re(t,this.getProjection()))}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const i=this.getAnimating()||this.getInteracting()||e,s=this.constraints_.rotation(this.targetRotation_,i),r=this.getViewportSize_(s),o=this.constraints_.resolution(this.targetResolution_,0,r,i),a=this.constraints_.center(this.targetCenter_,o,r,i,this.calculateCenterShift(this.targetCenter_,o,s,r));this.get(Wt.ROTATION)!==s&&this.set(Wt.ROTATION,s),this.get(Wt.RESOLUTION)!==o&&(this.set(Wt.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Wt.CENTER)||!Dn(this.get(Wt.CENTER),a))&&this.set(Wt.CENTER,a),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=t!==void 0?t:200;const s=e||0,r=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(r),a=this.constraints_.resolution(this.targetResolution_,s,o),l=this.constraints_.center(this.targetCenter_,a,o,!1,this.calculateCenterShift(this.targetCenter_,a,r,o));if(t===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=r,this.targetCenter_=l,this.applyTargetState_();return}i=i||(t===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==r||!this.getCenterInternal()||!Dn(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:r,center:l,resolution:a,duration:t,easing:xi,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(_t.INTERACTING,1)}endInteraction(t,e,i){i=i&&re(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(_t.INTERACTING,-1),this.resolveConstraints(t,e,i))}getConstrainedCenter(t,e){const i=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,e||this.getResolution(),i)}getConstrainedZoom(t,e){const i=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(i,e))}getConstrainedResolution(t,e){e=e||0;const i=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,i)}}function Cn(n,t){setTimeout(function(){n(t)},0)}function oc(n){if(n.extent!==void 0){const e=n.smoothExtentConstraint!==void 0?n.smoothExtentConstraint:!0;return $r(n.extent,n.constrainOnlyCenter,e)}const t=gr(n.projection,"EPSG:3857");if(n.multiWorld!==!0&&t.isGlobal()){const e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,$r(e,!1,!1)}return Kl}function ac(n){let t,e,i,o=n.minZoom!==void 0?n.minZoom:Es,a=n.maxZoom!==void 0?n.maxZoom:28;const l=n.zoomFactor!==void 0?n.zoomFactor:2,c=n.multiWorld!==void 0?n.multiWorld:!1,h=n.smoothResolutionConstraint!==void 0?n.smoothResolutionConstraint:!0,u=n.showFullExtent!==void 0?n.showFullExtent:!1,d=gr(n.projection,"EPSG:3857"),f=d.getExtent();let g=n.constrainOnlyCenter,m=n.extent;if(!c&&!m&&d.isGlobal()&&(g=!1,m=f),n.resolutions!==void 0){const _=n.resolutions;e=_[o],i=_[a]!==void 0?_[a]:_[_.length-1],n.constrainResolution?t=ec(_,h,!g&&m,u):t=mo(e,i,h,!g&&m,u)}else{const y=(f?Math.max(tt(f),Et(f)):360*hr.degrees/d.getMetersPerUnit())/Tr/Math.pow(2,Es),E=y/Math.pow(2,28-Es);e=n.maxResolution,e!==void 0?o=0:e=y/Math.pow(l,o),i=n.minResolution,i===void 0&&(n.maxZoom!==void 0?n.maxResolution!==void 0?i=e/Math.pow(l,a):i=y/Math.pow(l,a):i=E),a=o+Math.floor(Math.log(e/i)/Math.log(l)),i=e/Math.pow(l,a-o),n.constrainResolution?t=ic(l,e,i,h,!g&&m,u):t=mo(e,i,h,!g&&m,u)}return{constraint:t,maxResolution:e,minResolution:i,minZoom:o,zoomFactor:l}}function lc(n){if(n.enableRotation!==void 0?n.enableRotation:!0){const e=n.constrainRotation;return e===void 0||e===!0?sc():e===!1?po:typeof e=="number"?nc(e):po}return Ir}function hc(n){return!(n.sourceCenter&&n.targetCenter&&!Dn(n.sourceCenter,n.targetCenter)||n.sourceResolution!==n.targetResolution||n.sourceRotation!==n.targetRotation)}function xs(n,t,e,i,s){const r=Math.cos(-s);let o=Math.sin(-s),a=n[0]*r-n[1]*o,l=n[1]*r+n[0]*o;a+=(t[0]/2-e[0])*i,l+=(e[1]-t[1]/2)*i,o=-o;const c=a*r-l*o,h=l*r+a*o;return[c,h]}const wn="ol-hidden",ts="ol-unselectable",Sr="ol-control",yo="ol-collapsed",cc=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"),Eo=["style","variant","weight","size","lineHeight","family"],$s={normal:400,bold:700},Js=function(n){const t=n.match(cc);if(!t)return null;const e={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let i=0,s=Eo.length;i<s;++i){const r=t[i+1];r!==void 0&&(e[Eo[i]]=typeof r=="string"?r.trim():r)}return isNaN(Number(e.weight))&&e.weight in $s&&(e.weight=$s[e.weight]),e.families=e.family.split(/,\s?/).map(i=>i.trim().replace(/^['"]|['"]$/g,"")),e};function ot(n,t,e,i){let s;return e&&e.length?s=e.shift():Dt?s=new class extends OffscreenCanvas{style={}}(n??300,t??150):s=document.createElement("canvas"),n&&(s.width=n),t&&(s.height=t),s.getContext("2d",i)}let Cs;function zn(){return Cs||(Cs=ot(1,1)),Cs}function es(n){const t=n.canvas;t.width=1,t.height=1,n.clearRect(0,0,1,1)}function xo(n,t){const e=t.parentNode;e&&e.replaceChild(n,t)}function uc(n){for(;n.lastChild;)n.lastChild.remove()}function dc(n,t){const e=n.childNodes;for(let i=0;;++i){const s=e[i],r=t[i];if(!s&&!r)break;if(s!==r){if(!s){n.appendChild(r);continue}if(!r){n.removeChild(s),--i;continue}n.insertBefore(r,s)}}}function Da(){return new Proxy({childNodes:[],appendChild:function(t){return this.childNodes.push(t),t},remove:function(){},removeChild:function(t){const e=this.childNodes.indexOf(t);if(e===-1)throw new Error("Node to remove was not found");return this.childNodes.splice(e,1),t},insertBefore:function(t,e){const i=this.childNodes.indexOf(e);if(i===-1)throw new Error("Reference node not found");return this.childNodes.splice(i,0,t),t},style:{}},{get(t,e,i){return e==="firstElementChild"?t.childNodes.length>0?t.childNodes[0]:null:Reflect.get(t,e,i)}})}function Te(n){return typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas}class vr extends Qt{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 e=0,i=this.listenerKeys.length;e<i;++e)it(this.listenerKeys[e]);if(this.listenerKeys.length=0,this.map_=t,t){const e=this.target_??t.getOverlayContainerStopEvent();this.element&&e.appendChild(this.element),this.render!==Bi&&this.listenerKeys.push(j(t,we.POSTRENDER,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_=typeof t=="string"?document.getElementById(t):t}}class fc extends vr{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=t.collapsed!==void 0?t.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=t.collapsible!==void 0,this.collapsible_=t.collapsible!==void 0?t.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=t.attributions;const e=t.className!==void 0?t.className:"ol-attribution",i=t.tipLabel!==void 0?t.tipLabel:"Attributions",s=t.expandClassName!==void 0?t.expandClassName:e+"-expand",r=t.collapseLabel!==void 0?t.collapseLabel:"",o=t.collapseClassName!==void 0?t.collapseClassName:e+"-collapse";typeof r=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=r,this.collapseLabel_.className=o):this.collapseLabel_=r;const a=t.label!==void 0?t.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=s):this.label_=a;const l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=i,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(Y.CLICK,this.handleClick_.bind(this),!1);const c=e+" "+ts+" "+Sr+(this.collapsed_&&this.collapsible_?" "+yo:"")+(this.collapsible_?"":" ol-uncollapsible"),h=this.element;h.className=c,h.appendChild(this.toggleButton_),h.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=this.getMap().getAllLayers(),i=new Set(e.flatMap(s=>s.getAttributions(t)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(s=>i.add(s)):i.add(this.attributions_)),!this.overrideCollapsible_){const s=!e.some(r=>r.getSource()?.getAttributionsCollapsible()===!1);this.setCollapsible(s)}return Array.from(i)}async updateElement_(t){if(!t){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const e=await Promise.all(this.collectSourceAttributions_(t).map(s=>Ol(()=>s))),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!Me(e,this.renderedAttributions_)){uc(this.ulElement_);for(let s=0,r=e.length;s<r;++s){const o=document.createElement("li");o.innerHTML=e[s],this.ulElement_.appendChild(o)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(yo),this.collapsed_?xo(this.collapseLabel_,this.label_):xo(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(t){this.userCollapsed_=t,!(!this.collapsible_||this.collapsed_===t)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(t){this.updateElement_(t.frameState)}}class gc extends vr{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target});const e=t.className!==void 0?t.className:"ol-rotate",i=t.label!==void 0?t.label:"⇧",s=t.compassClassName!==void 0?t.compassClassName:"ol-compass";this.label_=null,typeof i=="string"?(this.label_=document.createElement("span"),this.label_.className=s,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(s));const r=t.tipLabel?t.tipLabel:"Reset rotation",o=document.createElement("button");o.className=e+"-reset",o.setAttribute("type","button"),o.title=r,o.appendChild(this.label_),o.addEventListener(Y.CLICK,this.handleClick_.bind(this),!1);const a=e+" "+ts+" "+Sr,l=this.element;l.className=a,l.appendChild(o),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=t.duration!==void 0?t.duration:250,this.autoHide_=t.autoHide!==void 0?t.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(wn)}handleClick_(t){t.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const e=this.getMap().getView();if(!e)return;const i=e.getRotation();i!==void 0&&(this.duration_>0&&i%(2*Math.PI)!==0?e.animate({rotation:0,duration:this.duration_,easing:xi}):e.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const s="rotate("+i+"rad)";if(this.autoHide_){const r=this.element.classList.contains(wn);!r&&i===0?this.element.classList.add(wn):r&&i!==0&&this.element.classList.remove(wn)}this.label_.style.transform=s}this.rotation_=i}}class _c extends vr{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=t.className!==void 0?t.className:"ol-zoom",i=t.delta!==void 0?t.delta:1,s=t.zoomInClassName!==void 0?t.zoomInClassName:e+"-in",r=t.zoomOutClassName!==void 0?t.zoomOutClassName:e+"-out",o=t.zoomInLabel!==void 0?t.zoomInLabel:"+",a=t.zoomOutLabel!==void 0?t.zoomOutLabel:"",l=t.zoomInTipLabel!==void 0?t.zoomInTipLabel:"Zoom in",c=t.zoomOutTipLabel!==void 0?t.zoomOutTipLabel:"Zoom out",h=document.createElement("button");h.className=s,h.setAttribute("type","button"),h.title=l,h.appendChild(typeof o=="string"?document.createTextNode(o):o),h.addEventListener(Y.CLICK,this.handleClick_.bind(this,i),!1);const u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=c,u.appendChild(typeof a=="string"?document.createTextNode(a):a),u.addEventListener(Y.CLICK,this.handleClick_.bind(this,-i),!1);const d=e+" "+ts+" "+Sr,f=this.element;f.className=d,f.appendChild(h),f.appendChild(u),this.duration_=t.duration!==void 0?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const i=this.getMap().getView();if(!i)return;const s=i.getZoom();if(s!==void 0){const r=i.getConstrainedZoom(s+t);this.duration_>0?(i.getAnimating()&&i.cancelAnimations(),i.animate({zoom:r,duration:this.duration_,easing:xi})):i.setZoom(r)}}}function mc(n){n=n||{};const t=new Pt;return(n.zoom===void 0||n.zoom)&&t.push(new _c(n.zoomOptions)),(n.rotate===void 0||n.rotate)&&t.push(new gc(n.rotateOptions)),(n.attribution===void 0||n.attribution)&&t.push(new fc(n.attributionOptions)),t}class pc{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;let i=e-3;for(;i>0&&this.points_[i+2]>t;)i-=3;const s=this.points_[e+2]-this.points_[i+2];if(s<1e3/60)return!1;const r=this.points_[e]-this.points_[i],o=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(o,r),this.initialVelocity_=Math.sqrt(r*r+o*o)/s,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}const Co={ACTIVE:"active"};class an extends Qt{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(Co.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(Co.ACTIVE,t)}setMap(t){this.map_=t}}function yc(n,t,e){const i=n.getCenterInternal();if(i){const s=[i[0]+t[0],i[1]+t[1]];n.animateInternal({duration:e!==void 0?e:250,easing:th,center:n.getConstrainedCenter(s)})}}function Lr(n,t,e,i){const s=n.getZoom();if(s===void 0)return;const r=n.getConstrainedZoom(s+t),o=n.getResolutionForZoom(r);n.getAnimating()&&n.cancelAnimations(),n.animate({resolution:o,anchor:e,duration:i!==void 0?i:250,easing:xi})}class Ec extends an{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:250}handleEvent(t){let e=!1;if(t.type==rt.DBLCLICK){const i=t.originalEvent,s=t.map,r=t.coordinate,o=i.shiftKey?-this.delta_:this.delta_,a=s.getView();Lr(a,o,r,this.duration_),i.preventDefault(),e=!0}return!e}}function Qs(n){const t=arguments;return function(e){let i=!0;for(let s=0,r=t.length;s<r&&(i=i&&t[s](e),!!i);++s);return i}}const xc=function(n){const t=n.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Cc=function(n){const t=n.map.getTargetElement(),e=t.getRootNode(),i=n.map.getOwnerDocument().activeElement;return e instanceof ShadowRoot?e.host.contains(i):t.contains(i)},Fa=function(n){const t=n.map.getTargetElement(),e=t.getRootNode();return(e instanceof ShadowRoot?e.host:t).hasAttribute("tabindex")?Cc(n):!0},wc=Zi,ka=function(n){const t=n.originalEvent;return"pointerId"in t&&t.button==0&&!(Fl&&ia&&t.ctrlKey)},Na=function(n){const t=n.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},Rc=function(n){const t=n.originalEvent;return ia?t.metaKey:t.ctrlKey},Ic=function(n){const t=n.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Ga=function(n){const t=n.originalEvent,e=t.target.tagName;return e!=="INPUT"&&e!=="SELECT"&&e!=="TEXTAREA"&&!t.target.isContentEditable},ws=function(n){const t=n.originalEvent;return"pointerId"in t&&t.pointerType=="mouse"},Tc=function(n){const t=n.originalEvent;return"pointerId"in t&&t.isPrimary&&t.button===0};class ln extends an{constructor(t){t=t||{},super(t),t.handleDownEvent&&(this.handleDownEvent=t.handleDownEvent),t.handleDragEvent&&(this.handleDragEvent=t.handleDragEvent),t.handleMoveEvent&&(this.handleMoveEvent=t.handleMoveEvent),t.handleUpEvent&&(this.handleUpEvent=t.handleUpEvent),t.stopDown&&(this.stopDown=t.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(t){return!1}handleDragEvent(t){}handleEvent(t){if(!t.originalEvent)return!0;let e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==rt.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==rt.POINTERUP){const i=this.handleUpEvent(t);this.handlingDownUpSequence=i&&this.targetPointers.length>0}}else if(t.type==rt.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==rt.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}}function Ar(n){const t=n.length;let e=0,i=0;for(let s=0;s<t;s++)e+=n[s].clientX,i+=n[s].clientY;return{clientX:e/t,clientY:i/t}}class Sc extends ln{constructor(t){super({stopDown:Bn}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:Qs(Na,Tc);this.condition_=t.onFocusOnly?Qs(Fa,e):e,this.noKinetic_=!1}handleDragEvent(t){const e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());const i=this.targetPointers,s=e.getEventPixel(Ar(i));if(i.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(s[0],s[1]),this.lastCentroid){const r=[this.lastCentroid[0]-s[0],s[1]-this.lastCentroid[1]],a=t.map.getView();ql(r,a.getResolution()),lr(r,a.getRotation()),a.adjustCenterInternal(r)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=s,this.lastPointersCount_=i.length,t.originalEvent.preventDefault()}handleUpEvent(t){const e=t.map,i=e.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const s=this.kinetic_.getDistance(),r=this.kinetic_.getAngle(),o=i.getCenterInternal(),a=e.getPixelFromCoordinateInternal(o),l=e.getCoordinateFromPixelInternal([a[0]-s*Math.cos(r),a[1]-s*Math.sin(r)]);i.animateInternal({center:i.getConstrainedCenter(l),duration:500,easing:xi})}return this.panning_&&(this.panning_=!1,i.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(t){if(this.targetPointers.length>0&&this.condition_(t)){const i=t.map.getView();return this.lastCentroid=null,i.getAnimating()&&i.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}}class vc extends ln{constructor(t){t=t||{},super({stopDown:Bn}),this.condition_=t.condition?t.condition:xc,this.lastAngle_=void 0,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){if(!ws(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===Ir)return;const s=e.getSize(),r=t.pixel,o=Math.atan2(s[1]/2-r[1],r[0]-s[0]/2);if(this.lastAngle_!==void 0){const a=o-this.lastAngle_;i.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(t){return ws(t)?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){return ws(t)&&ka(t)&&this.condition_(t)?(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}class Lc extends Zn{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,i="px",s=this.element_.style;s.left=Math.min(t[0],e[0])+i,s.top=Math.min(t[1],e[1])+i,s.width=Math.abs(e[0]-t[0])+i,s.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;const t=this.startPixel_,e=this.endPixel_,s=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);s[4]=s[0].slice(),this.geometry_?this.geometry_.setCoordinates([s]):this.geometry_=new Hi([s])}getGeometry(){return this.geometry_}}const qe={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class Ai extends de{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}class Ac extends ln{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new Lc(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??ka,this.boxEndCondition_=t.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const s=i[0]-e[0],r=i[1]-e[1];return s*s+r*r>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new Ai(qe.BOXDRAG,t.coordinate,t)))}handleUpEvent(t){if(!this.startPixel_)return!1;const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new Ai(e?qe.BOXEND:qe.BOXCANCEL,t.coordinate,t)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(t){return this.condition_(t)?(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new Ai(qe.BOXSTART,t.coordinate,t)),!0):!1}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Ai(qe.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Ai(qe.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}}class Mc extends Ac{constructor(t){t=t||{};const e=t.condition?t.condition:Ic;super({condition:e,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=t.duration!==void 0?t.duration:200,this.out_=t.out!==void 0?t.out:!1}onBoxEnd(t){const i=this.getMap().getView();let s=this.getGeometry();if(this.out_){const r=i.rotatedExtentForGeometry(s),o=i.getResolutionForExtentInternal(r),a=i.getResolution()/o;s=s.clone(),s.scale(a*a)}i.fitInternal(s,{duration:this.duration_,easing:xi})}}const Pe={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};class Oc extends an{constructor(t){super(),t=t||{},this.defaultCondition_=function(e){return Na(e)&&Ga(e)},this.condition_=t.condition!==void 0?t.condition:this.defaultCondition_,this.duration_=t.duration!==void 0?t.duration:100,this.pixelDelta_=t.pixelDelta!==void 0?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==Y.KEYDOWN){const i=t.originalEvent,s=i.key;if(this.condition_(t)&&(s==Pe.DOWN||s==Pe.LEFT||s==Pe.RIGHT||s==Pe.UP)){const o=t.map.getView(),a=o.getResolution()*this.pixelDelta_;let l=0,c=0;s==Pe.DOWN?c=-a:s==Pe.LEFT?l=-a:s==Pe.RIGHT?l=a:c=a;const h=[l,c];lr(h,o.getRotation()),yc(o,h,this.duration_),i.preventDefault(),e=!0}}return!e}}class bc extends an{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(e){return!Rc(e)&&Ga(e)},this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:100}handleEvent(t){let e=!1;if(t.type==Y.KEYDOWN||t.type==Y.KEYPRESS){const i=t.originalEvent,s=i.key;if(this.condition_(t)&&(s==="+"||s==="-")){const r=t.map,o=s==="+"?this.delta_:-this.delta_,a=r.getView();Lr(a,o,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}}const Pc=40,Dc=300;class Fc extends an{constructor(t){t=t||{},super(t),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=t.maxDelta!==void 0?t.maxDelta:1,this.duration_=t.duration!==void 0?t.duration:250,this.timeout_=t.timeout!==void 0?t.timeout:80,this.useAnchor_=t.useAnchor!==void 0?t.useAnchor:!0,this.constrainResolution_=t.constrainResolution!==void 0?t.constrainResolution:!1;const e=t.condition?t.condition:wc;this.condition_=t.onFocusOnly?Qs(Fa,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();if(!t)return;t.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(t){if(!this.condition_(t)||t.type!==Y.WHEEL)return!0;const i=t.map,s=t.originalEvent;s.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.pixel);let r=s.deltaY;switch(s.deltaMode){case WheelEvent.DOM_DELTA_LINE:r*=Pc;break;case WheelEvent.DOM_DELTA_PAGE:r*=Dc;break}if(r===0)return!1;this.lastDelta_=r;const o=Date.now();this.startTime_===void 0&&(this.startTime_=o),(!this.mode_||o-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(r)<4?"trackpad":"wheel");const a=i.getView();if(this.mode_==="trackpad"&&!(a.getConstrainResolution()||this.constrainResolution_))return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(a.getAnimating()&&a.cancelAnimations(),a.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),a.adjustZoom(-r/this.deltaPerZoom_,this.lastAnchor_?i.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=o,!1;this.totalDelta_+=r;const l=Math.max(this.timeout_-(o-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,i),l),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-nt(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),Lr(e,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}}class kc extends ln{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=Bn),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=t.threshold!==void 0?t.threshold:.3,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){let e=0;const i=this.targetPointers[0],s=this.targetPointers[1],r=Math.atan2(s.clientY-i.clientY,s.clientX-i.clientX);if(this.lastAngle_!==void 0){const l=r-this.lastAngle_;this.rotationDelta_+=l,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=l}this.lastAngle_=r;const o=t.map,a=o.getView();a.getConstraints().rotation!==Ir&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(Ar(this.targetPointers))),this.rotating_&&(o.render(),a.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){return this.targetPointers.length<2?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}class Nc extends ln{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=Bn),super(e),this.anchor_=null,this.duration_=t.duration!==void 0?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],s=this.targetPointers[1],r=i.clientX-s.clientX,o=i.clientY-s.clientY,a=Math.sqrt(r*r+o*o);this.lastDistance_!==void 0&&(e=this.lastDistance_/a),this.lastDistance_=a;const l=t.map,c=l.getView();e!=1&&(this.lastScaleDelta_=e),this.anchor_=l.getCoordinateFromPixelInternal(l.getEventPixel(Ar(this.targetPointers))),l.render(),c.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const i=t.map.getView(),s=this.lastScaleDelta_>1?1:-1;return i.endInteraction(this.duration_,s),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}function Gc(n){n=n||{};const t=new Pt,e=new pc(-.005,.05,100);return(n.altShiftDragRotate===void 0||n.altShiftDragRotate)&&t.push(new vc),(n.doubleClickZoom===void 0||n.doubleClickZoom)&&t.push(new Ec({delta:n.zoomDelta,duration:n.zoomDuration})),(n.dragPan===void 0||n.dragPan)&&t.push(new Sc({onFocusOnly:n.onFocusOnly,kinetic:e})),(n.pinchRotate===void 0||n.pinchRotate)&&t.push(new kc),(n.pinchZoom===void 0||n.pinchZoom)&&t.push(new Nc({duration:n.zoomDuration})),(n.keyboard===void 0||n.keyboard)&&(t.push(new Oc),t.push(new bc({delta:n.zoomDelta,duration:n.zoomDuration}))),(n.mouseWheelZoom===void 0||n.mouseWheelZoom)&&t.push(new Fc({onFocusOnly:n.onFocusOnly,duration:n.zoomDuration})),(n.shiftDragZoom===void 0||n.shiftDragZoom)&&t.push(new Mc({duration:n.zoomDuration})),t}const Q={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};class za extends Qt{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);typeof t.properties=="object"&&(delete e.properties,Object.assign(e,t.properties)),e[Q.OPACITY]=t.opacity!==void 0?t.opacity:1,J(typeof e[Q.OPACITY]=="number","Layer opacity must be a number"),e[Q.VISIBLE]=t.visible!==void 0?t.visible:!0,e[Q.Z_INDEX]=t.zIndex,e[Q.MAX_RESOLUTION]=t.maxResolution!==void 0?t.maxResolution:1/0,e[Q.MIN_RESOLUTION]=t.minResolution!==void 0?t.minResolution:0,e[Q.MIN_ZOOM]=t.minZoom!==void 0?t.minZoom:-1/0,e[Q.MAX_ZOOM]=t.maxZoom!==void 0?t.maxZoom:1/0,this.className_=e.className!==void 0?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:t===void 0?!0:t},i=this.getZIndex();return e.opacity=nt(Math.round(this.getOpacity()*100)/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=i===void 0&&!e.managed?1/0:i,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return V()}getLayerStatesArray(t){return V()}getExtent(){return this.get(Q.EXTENT)}getMaxResolution(){return this.get(Q.MAX_RESOLUTION)}getMinResolution(){return this.get(Q.MIN_RESOLUTION)}getMinZoom(){return this.get(Q.MIN_ZOOM)}getMaxZoom(){return this.get(Q.MAX_ZOOM)}getOpacity(){return this.get(Q.OPACITY)}getSourceState(){return V()}getVisible(){return this.get(Q.VISIBLE)}getZIndex(){return this.get(Q.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(Q.EXTENT,t)}setMaxResolution(t){this.set(Q.MAX_RESOLUTION,t)}setMinResolution(t){this.set(Q.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(Q.MAX_ZOOM,t)}setMinZoom(t){this.set(Q.MIN_ZOOM,t)}setOpacity(t){J(typeof t=="number","Layer opacity must be a number"),this.set(Q.OPACITY,t)}setVisible(t){this.set(Q.VISIBLE,t)}setZIndex(t){this.set(Q.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}const _e={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"};class Re extends de{constructor(t,e){super(t),this.layer=e}}const Rs={LAYERS:"layers"};class Ci extends za{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(Rs.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new Pt(i.slice(),{unique:!0}):J(typeof i.getArray=="function","Expected `layers` to be an array or a `Collection`"):i=new Pt(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(it),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(j(t,xt.ADD,this.handleLayersAdd_,this),j(t,xt.REMOVE,this.handleLayersRemove_,this));for(const i in this.listenerKeys_)this.listenerKeys_[i].forEach(it);nn(this.listenerKeys_);const e=t.getArray();for(let i=0,s=e.length;i<s;i++){const r=e[i];this.registerLayerListeners_(r),this.dispatchEvent(new Re(_e.ADDLAYER,r))}this.changed()}registerLayerListeners_(t){const e=[j(t,fi.PROPERTYCHANGE,this.handleLayerChange_,this),j(t,Y.CHANGE,this.handleLayerChange_,this)];t instanceof Ci&&e.push(j(t,_e.ADDLAYER,this.handleLayerGroupAdd_,this),j(t,_e.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[H(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new Re(_e.ADDLAYER,t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new Re(_e.REMOVELAYER,t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new Re(_e.ADDLAYER,e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=H(e);this.listenerKeys_[i].forEach(it),delete this.listenerKeys_[i],this.dispatchEvent(new Re(_e.REMOVELAYER,e)),this.changed()}getLayers(){return this.get(Rs.LAYERS)}setLayers(t){const e=this.getLayers();if(e){const i=e.getArray();for(let s=0,r=i.length;s<r;++s)this.dispatchEvent(new Re(_e.REMOVELAYER,i[s]))}this.set(Rs.LAYERS,t)}getLayersArray(t){return t=t!==void 0?t:[],this.getLayers().forEach(function(e){e.getLayersArray(t)}),t}getLayerStatesArray(t){const e=t!==void 0?t:[],i=e.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(e)});const s=this.getLayerState();let r=s.zIndex;!t&&s.zIndex===void 0&&(r=0);for(let o=i,a=e.length;o<a;o++){const l=e[o];l.opacity*=s.opacity,l.visible=l.visible&&s.visible,l.maxResolution=Math.min(l.maxResolution,s.maxResolution),l.minResolution=Math.max(l.minResolution,s.minResolution),l.minZoom=Math.max(l.minZoom,s.minZoom),l.maxZoom=Math.min(l.maxZoom,s.maxZoom),s.extent!==void 0&&(l.extent!==void 0?l.extent=Xe(l.extent,s.extent):l.extent=s.extent),l.zIndex===void 0&&(l.zIndex=r)}return e}getSourceState(){return"ready"}}const Ft={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};class is extends za{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(Q.SOURCE,this.handleSourcePropertyChange_);const i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return t=t||[],t.push(this),t}getLayerStatesArray(t){return t=t||[],t.push(this.getLayerState()),t}getSource(){return this.get(Q.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(it(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=j(t,Y.CHANGE,this.handleSourceChange_,this),t.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return!this.renderer_||!this.rendered?null:this.renderer_.getData(t)}isVisible(t){let e;const i=this.getMapInternal();!t&&i&&(t=i.getView()),t instanceof ae?e={viewState:t.getState(),extent:t.calculateExtent()}:e=t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray());let s;if(e.layerStatesArray){if(s=e.layerStatesArray.find(o=>o.layer===this),!s)return!1}else s=this.getLayerState();const r=this.getExtent();return Mr(s,e.viewState)&&(!r||Rt(r,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];const i=t instanceof ae?t.getViewStateAndExtent():t;let s=e(i);return Array.isArray(s)||(s=[s]),s}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){const e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set(Q.MAP,t)}getMapInternal(){return this.get(Q.MAP)}setMap(t){this.mapPrecomposeKey_&&(it(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(it(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=j(t,Ft.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=j(this,Y.CHANGE,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);J(!e.some(s=>s.layer===i.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(i)}setSource(t){this.set(Q.SOURCE,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}}function Mr(n,t){if(!n.visible)return!1;const e=t.resolution;if(e<n.minResolution||e>=n.maxResolution)return!1;const i=t.zoom;return i>n.minZoom&&i<=n.maxZoom}function Xa(n,t,e=0,i=n.length-1,s=zc){for(;i>e;){if(i-e>600){const l=i-e+1,c=t-e+1,h=Math.log(l),u=.5*Math.exp(2*h/3),d=.5*Math.sqrt(h*u*(l-u)/l)*(c-l/2<0?-1:1),f=Math.max(e,Math.floor(t-c*u/l+d)),g=Math.min(i,Math.floor(t+(l-c)*u/l+d));Xa(n,t,f,g,s)}const r=n[t];let o=e,a=i;for(Mi(n,e,t),s(n[i],r)>0&&Mi(n,e,i);o<a;){for(Mi(n,o,a),o++,a--;s(n[o],r)<0;)o++;for(;s(n[a],r)>0;)a--}s(n[e],r)===0?Mi(n,e,a):(a++,Mi(n,a,i)),a<=t&&(e=a+1),t<=a&&(i=a-1)}}function Mi(n,t,e){const i=n[t];n[t]=n[e],n[e]=i}function zc(n,t){return n<t?-1:n>t?1:0}let Wa=class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const i=[];if(!In(t,e))return i;const s=this.toBBox,r=[];for(;e;){for(let o=0;o<e.children.length;o++){const a=e.children[o],l=e.leaf?s(a):a;In(t,l)&&(e.leaf?i.push(a):Ts(t,l)?this._all(a,i):r.push(a))}e=r.pop()}return i}collides(t){let e=this.data;if(!In(t,e))return!1;const i=[];for(;e;){for(let s=0;s<e.children.length;s++){const r=e.children[s],o=e.leaf?this.toBBox(r):r;if(In(t,o)){if(e.leaf||Ts(t,o))return!0;i.push(r)}}e=i.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let i=0;i<t.length;i++)this.insert(t[i]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=e;else if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const i=this.data;this.data=e,e=i}this._insert(e,this.data.height-e.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=ni([]),this}remove(t,e){if(!t)return this;let i=this.data;const s=this.toBBox(t),r=[],o=[];let a,l,c;for(;i||r.length;){if(i||(i=r.pop(),l=r[r.length-1],a=o.pop(),c=!0),i.leaf){const h=Xc(t,i.children,e);if(h!==-1)return i.children.splice(h,1),r.push(i),this._condense(r),this}!c&&!i.leaf&&Ts(i,s)?(r.push(i),o.push(a),a=0,l=i,i=i.children[0]):l?(a++,i=l.children[a],c=!1):i=null}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const i=[];for(;t;)t.leaf?e.push(...t.children):i.push(...t.children),t=i.pop();return e}_build(t,e,i,s){const r=i-e+1;let o=this._maxEntries,a;if(r<=o)return a=ni(t.slice(e,i+1)),$e(a,this.toBBox),a;s||(s=Math.ceil(Math.log(r)/Math.log(o)),o=Math.ceil(r/Math.pow(o,s-1))),a=ni([]),a.leaf=!1,a.height=s;const l=Math.ceil(r/o),c=l*Math.ceil(Math.sqrt(o));wo(t,e,i,c,this.compareMinX);for(let h=e;h<=i;h+=c){const u=Math.min(h+c-1,i);wo(t,h,u,l,this.compareMinY);for(let d=h;d<=u;d+=l){const f=Math.min(d+l-1,u);a.children.push(this._build(t,d,f,s-1))}}return $e(a,this.toBBox),a}_chooseSubtree(t,e,i,s){for(;s.push(e),!(e.leaf||s.length-1===i);){let r=1/0,o=1/0,a;for(let l=0;l<e.children.length;l++){const c=e.children[l],h=Is(c),u=Kc(t,c)-h;u<o?(o=u,r=h<r?h:r,a=c):u===o&&h<r&&(r=h,a=c)}e=a||e.children[0]}return e}_insert(t,e,i){const s=i?t:this.toBBox(t),r=[],o=this._chooseSubtree(s,this.data,e,r);for(o.children.push(t),ki(o,s);e>=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(s,r,e)}_split(t,e){const i=t[e],s=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,s);const o=this._chooseSplitIndex(i,r,s),a=ni(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,$e(i,this.toBBox),$e(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)}_splitRoot(t,e){this.data=ni([t,e]),this.data.height=t.height+1,this.data.leaf=!1,$e(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let s,r=1/0,o=1/0;for(let a=e;a<=i-e;a++){const l=Fi(t,0,a,this.toBBox),c=Fi(t,a,i,this.toBBox),h=Zc(l,c),u=Is(l)+Is(c);h<r?(r=h,s=a,o=u<o?u:o):h===r&&u<o&&(o=u,s=a)}return s||i-e}_chooseSplitAxis(t,e,i){const s=t.leaf?this.compareMinX:Wc,r=t.leaf?this.compareMinY:Yc,o=this._allDistMargin(t,e,i,s),a=this._allDistMargin(t,e,i,r);o<a&&t.children.sort(s)}_allDistMargin(t,e,i,s){t.children.sort(s);const r=this.toBBox,o=Fi(t,0,e,r),a=Fi(t,i-e,i,r);let l=Rn(o)+Rn(a);for(let c=e;c<i-e;c++){const h=t.children[c];ki(o,t.leaf?r(h):h),l+=Rn(o)}for(let c=i-e-1;c>=e;c--){const h=t.children[c];ki(a,t.leaf?r(h):h),l+=Rn(a)}return l}_adjustParentBBoxes(t,e,i){for(let s=i;s>=0;s--)ki(e[s],t)}_condense(t){for(let e=t.length-1,i;e>=0;e--)t[e].children.length===0?e>0?(i=t[e-1].children,i.splice(i.indexOf(t[e]),1)):this.clear():$e(t[e],this.toBBox)}};function Xc(n,t,e){if(!e)return t.indexOf(n);for(let i=0;i<t.length;i++)if(e(n,t[i]))return i;return-1}function $e(n,t){Fi(n,0,n.children.length,t,n)}function Fi(n,t,e,i,s){s||(s=ni(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let r=t;r<e;r++){const o=n.children[r];ki(s,n.leaf?i(o):o)}return s}function ki(n,t){return n.minX=Math.min(n.minX,t.minX),n.minY=Math.min(n.minY,t.minY),n.maxX=Math.max(n.maxX,t.maxX),n.maxY=Math.max(n.maxY,t.maxY),n}function Wc(n,t){return n.minX-t.minX}function Yc(n,t){return n.minY-t.minY}function Is(n){return(n.maxX-n.minX)*(n.maxY-n.minY)}function Rn(n){return n.maxX-n.minX+(n.maxY-n.minY)}function Kc(n,t){return(Math.max(t.maxX,n.maxX)-Math.min(t.minX,n.minX))*(Math.max(t.maxY,n.maxY)-Math.min(t.minY,n.minY))}function Zc(n,t){const e=Math.max(n.minX,t.minX),i=Math.max(n.minY,t.minY),s=Math.min(n.maxX,t.maxX),r=Math.min(n.maxY,t.maxY);return Math.max(0,s-e)*Math.max(0,r-i)}function Ts(n,t){return n.minX<=t.minX&&n.minY<=t.minY&&t.maxX<=n.maxX&&t.maxY<=n.maxY}function In(n,t){return t.minX<=n.maxX&&t.minY<=n.maxY&&t.maxX>=n.minX&&t.maxY>=n.minY}function ni(n){return{children:n,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function wo(n,t,e,i,s){const r=[t,e];for(;r.length;){if(e=r.pop(),t=r.pop(),e-t<=i)continue;const o=t+Math.ceil((e-t)/i/2)*i;Xa(n,o,t,e,s),r.push(t,o,o,e)}}const Or=[NaN,NaN,NaN,0];let Ss;function Bc(){return Ss||(Ss=ot(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),Ss}const Uc=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Vc=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,jc=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Hc=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function Tn(n,t){return n.endsWith("%")?Number(n.substring(0,n.length-1))/t:Number(n)}function Yi(n){throw new Error('failed to parse "'+n+'" as color')}function Ya(n){if(n.toLowerCase().startsWith("rgb")){const r=n.match(Vc)||n.match(Uc)||n.match(jc);if(r){const o=r[4],a=100/255;return[nt(Tn(r[1],a)+.5|0,0,255),nt(Tn(r[2],a)+.5|0,0,255),nt(Tn(r[3],a)+.5|0,0,255),o!==void 0?nt(Tn(o,100),0,1):1]}Yi(n)}if(n.startsWith("#")){if(Hc.test(n)){const r=n.substring(1),o=r.length<=4?1:2,a=[0,0,0,255];for(let l=0,c=r.length;l<c;l+=o){let h=parseInt(r.substring(l,l+o),16);o===1&&(h+=h<<4),a[l/o]=h}return a[3]=a[3]/255,a}Yi(n)}const t=Bc();t.fillStyle="#abcdef";let e=t.fillStyle;t.fillStyle=n,t.fillStyle===e&&(t.fillStyle="#fedcba",e=t.fillStyle,t.fillStyle=n,t.fillStyle===e&&Yi(n));const i=t.fillStyle;if(i.startsWith("#")||i.startsWith("rgba"))return Ya(i);t.clearRect(0,0,1,1),t.fillRect(0,0,1,1);const s=Array.from(t.getImageData(0,0,1,1).data);return s[3]=Vn(s[3]/255,3),s}function qc(n){return typeof n=="string"?n:Pr(n)}const $c=1024,Oi={};let vs=0;function Jc(n){if(n.length===4)return n;const t=n.slice();return t[3]=1,t}function Ls(n){return n>.0031308?Math.pow(n,1/2.4)*269.025-14.025:n*3294.6}function As(n){return n>.2068965?Math.pow(n,3):(n-4/29)*(108/841)}function Ms(n){return n>10.314724?Math.pow((n+14.025)/269.025,2.4):n/3294.6}function Os(n){return n>.0088564?Math.pow(n,1/3):n/(108/841)+4/29}function Ro(n){const t=Ms(n[0]),e=Ms(n[1]),i=Ms(n[2]),s=Os(t*.222488403+e*.716873169+i*.06060791),r=500*(Os(t*.452247074+e*.399439023+i*.148375274)-s),o=200*(s-Os(t*.016863605+e*.117638439+i*.865350722)),a=Math.atan2(o,r)*(180/Math.PI);return[116*s-16,Math.sqrt(r*r+o*o),a<0?a+360:a,n[3]]}function Qc(n){const t=(n[0]+16)/116,e=n[1],i=n[2]*Math.PI/180,s=As(t),r=As(t+e/500*Math.cos(i)),o=As(t-e/200*Math.sin(i)),a=Ls(r*3.021973625-s*1.617392459-o*.404875592),l=Ls(r*-.943766287+s*1.916279586+o*.027607165),c=Ls(r*.069407491-s*.22898585+o*1.159737864);return[nt(a+.5|0,0,255),nt(l+.5|0,0,255),nt(c+.5|0,0,255),n[3]]}function br(n){if(n==="none")return Or;if(Oi.hasOwnProperty(n))return Oi[n];if(vs>=$c){let e=0;for(const i in Oi)(e++&3)===0&&(delete Oi[i],--vs)}const t=Ya(n);t.length!==4&&Yi(n);for(const e of t)isNaN(e)&&Yi(n);return Oi[n]=t,++vs,t}function Ze(n){return Array.isArray(n)?n:br(n)}function Pr(n){let t=n[0];t!=(t|0)&&(t=t+.5|0);let e=n[1];e!=(e|0)&&(e=e+.5|0);let i=n[2];i!=(i|0)&&(i=i+.5|0);const s=n[3]===void 0?1:Math.round(n[3]*1e3)/1e3;return"rgba("+t+","+e+","+i+","+s+")"}function Io(n){return n[0]>0&&n[1]>0}function tu(n,t,e){return e===void 0&&(e=[0,0]),e[0]=n[0]*t+.5|0,e[1]=n[1]*t+.5|0,e}function It(n,t){return Array.isArray(n)?n:(t===void 0?t=[n,n]:(t[0]=n,t[1]=n),t)}let Ve=0;const yt=1<<Ve++,Z=1<<Ve++,Ct=1<<Ve++,Kt=1<<Ve++,Be=1<<Ve++,Ni=1<<Ve++,Sn=Math.pow(2,Ve)-1,Dr={[yt]:"boolean",[Z]:"number",[Ct]:"string",[Kt]:"color",[Be]:"number[]",[Ni]:"size"},eu=Object.keys(Dr).map(Number).sort(le);function iu(n){return n in Dr}function Gi(n){const t=[];for(const e of eu)zi(n,e)&&t.push(Dr[e]);return t.length===0?"untyped":t.length<3?t.join(" or "):t.slice(0,-1).join(", ")+", or "+t[t.length-1]}function zi(n,t){return(n&t)===t}function me(n,t){return n===t}class at{constructor(t,e){if(!iu(t))throw new Error(`literal expressions must have a specific type, got ${Gi(t)}`);this.type=t,this.value=e}}class nu{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function Ka(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1,mapState:!1}}function dt(n,t,e){switch(typeof n){case"boolean":{if(me(t,Ct))return new at(Ct,n?"true":"false");if(!zi(t,yt))throw new Error(`got a boolean, but expected ${Gi(t)}`);return new at(yt,n)}case"number":{if(me(t,Ni))return new at(Ni,It(n));if(me(t,yt))return new at(yt,!!n);if(me(t,Ct))return new at(Ct,n.toString());if(!zi(t,Z))throw new Error(`got a number, but expected ${Gi(t)}`);return new at(Z,n)}case"string":{if(me(t,Kt))return new at(Kt,br(n));if(me(t,yt))return new at(yt,!!n);if(!zi(t,Ct))throw new Error(`got a string, but expected ${Gi(t)}`);return new at(Ct,n)}}if(!Array.isArray(n))throw new Error("expression must be an array or a primitive value");if(n.length===0)throw new Error("empty expression");if(typeof n[0]=="string")return gu(n,t,e);for(const i of n)if(typeof i!="number")throw new Error("expected an array of numbers");if(me(t,Ni)){if(n.length!==2)throw new Error(`expected an array of two values for a size, got ${n.length}`);return new at(Ni,n)}if(me(t,Kt)){if(n.length===3)return new at(Kt,[...n,1]);if(n.length===4)return new at(Kt,n);throw new Error(`expected an array of 3 or 4 values for a color, got ${n.length}`)}if(!zi(t,Be))throw new Error(`got an array of numbers, but expected ${Gi(t)}`);return new at(Be,n)}const w={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",LineMetric:"line-metric",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string",Has:"has"},su={[w.Get]:N(W(1,1/0),To),[w.Var]:N(W(1,1),ru),[w.Has]:N(W(1,1/0),To),[w.Id]:N(ou,Je),[w.Concat]:N(W(2,1/0),$(Ct)),[w.GeometryType]:N(au,Je),[w.LineMetric]:N(Je),[w.Resolution]:N(bs,Je),[w.Zoom]:N(bs,Je),[w.Time]:N(bs,Je),[w.Any]:N(W(2,1/0),$(yt)),[w.All]:N(W(2,1/0),$(yt)),[w.Not]:N(W(1,1),$(yt)),[w.Equal]:N(W(2,2),$(Sn)),[w.NotEqual]:N(W(2,2),$(Sn)),[w.GreaterThan]:N(W(2,2),$(Z)),[w.GreaterThanOrEqualTo]:N(W(2,2),$(Z)),[w.LessThan]:N(W(2,2),$(Z)),[w.LessThanOrEqualTo]:N(W(2,2),$(Z)),[w.Multiply]:N(W(2,1/0),So),[w.Coalesce]:N(W(2,1/0),So),[w.Divide]:N(W(2,2),$(Z)),[w.Add]:N(W(2,1/0),$(Z)),[w.Subtract]:N(W(2,2),$(Z)),[w.Clamp]:N(W(3,3),$(Z)),[w.Mod]:N(W(2,2),$(Z)),[w.Pow]:N(W(2,2),$(Z)),[w.Abs]:N(W(1,1),$(Z)),[w.Floor]:N(W(1,1),$(Z)),[w.Ceil]:N(W(1,1),$(Z)),[w.Round]:N(W(1,1),$(Z)),[w.Sin]:N(W(1,1),$(Z)),[w.Cos]:N(W(1,1),$(Z)),[w.Atan]:N(W(1,2),$(Z)),[w.Sqrt]:N(W(1,1),$(Z)),[w.Match]:N(W(4,1/0),vo,hu),[w.Between]:N(W(3,3),$(Z)),[w.Interpolate]:N(W(6,1/0),vo,cu),[w.Case]:N(W(3,1/0),lu,uu),[w.In]:N(W(2,2),du),[w.Number]:N(W(1,1/0),$(Sn)),[w.String]:N(W(1,1/0),$(Sn)),[w.Array]:N(W(1,1/0),$(Z)),[w.Color]:N(W(1,4),$(Z)),[w.Band]:N(W(1,3),$(Z)),[w.Palette]:N(W(2,2),fu),[w.ToString]:N(W(1,1),$(yt|Z|Ct|Kt))};function To(n,t,e){const i=n.length-1,s=new Array(i);for(let r=0;r<i;++r){const o=n[r+1];switch(typeof o){case"number":{s[r]=new at(Z,o);break}case"string":{s[r]=new at(Ct,o);break}default:throw new Error(`expected a string key or numeric array index for a get operation, got ${o}`)}r===0&&e.properties.add(String(o))}return s}function ru(n,t,e){const i=n[1];if(typeof i!="string")throw new Error("expected a string argument for var operation");return e.variables.add(i),[new at(Ct,i)]}function ou(n,t,e){e.featureId=!0}function au(n,t,e){e.geometryType=!0}function bs(n,t,e){e.mapState=!0}function Je(n,t,e){const i=n[0];if(n.length!==1)throw new Error(`expected no arguments for ${i} operation`);return[]}function W(n,t){return function(e,i,s){const r=e[0],o=e.length-1;if(n===t){if(o!==n){const a=n===1?"":"s";throw new Error(`expected ${n} argument${a} for ${r}, got ${o}`)}}else if(o<n||o>t){const a=t===1/0?`${n} or more`:`${n} to ${t}`;throw new Error(`expected ${a} arguments for ${r}, got ${o}`)}}}function So(n,t,e){const i=n.length-1,s=new Array(i);for(let r=0;r<i;++r){const o=dt(n[r+1],t,e);s[r]=o}return s}function $(n){return function(t,e,i){const s=t.length-1,r=new Array(s);for(let o=0;o<s;++o){const a=dt(t[o+1],n,i);r[o]=a}return r}}function lu(n,t,e){const i=n[0],s=n.length-1;if(s%2===0)throw new Error(`expected an odd number of arguments for ${i}, got ${s} instead`)}function vo(n,t,e){const i=n[0],s=n.length-1;if(s%2===1)throw new Error(`expected an even number of arguments for operation ${i}, got ${s} instead`)}function hu(n,t,e){const i=n.length-1,s=Ct|Z|yt,r=dt(n[1],s,e),o=dt(n[n.length-1],t,e),a=new Array(i-2);for(let l=0;l<i-2;l+=2){try{const c=dt(n[l+2],r.type,e);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+1} of match expression: ${c.message}`)}try{const c=dt(n[l+3],o.type,e);a[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+2} of match expression: ${c.message}`)}}return[r,...a,o]}function cu(n,t,e){const i=n[1];let s;switch(i[0]){case"linear":s=1;break;case"exponential":const l=i[1];if(typeof l!="number"||l<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(l)} instead`);s=l;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(i)}`)}const r=new at(Z,s);let o;try{o=dt(n[2],Z,e)}catch(l){throw new Error(`failed to parse argument 1 in interpolate expression: ${l.message}`)}const a=new Array(n.length-3);for(let l=0;l<a.length;l+=2){try{const c=dt(n[l+3],Z,e);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${c.message}`)}try{const c=dt(n[l+4],t,e);a[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${c.message}`)}}return[r,o,...a]}function uu(n,t,e){const i=dt(n[n.length-1],t,e),s=new Array(n.length-1);for(let r=0;r<s.length-1;r+=2){try{const o=dt(n[r+1],yt,e);s[r]=o}catch(o){throw new Error(`failed to parse argument ${r} of case expression: ${o.message}`)}try{const o=dt(n[r+2],i.type,e);s[r+1]=o}catch(o){throw new Error(`failed to parse argument ${r+1} of case expression: ${o.message}`)}}return s[s.length-1]=i,s}function du(n,t,e){let i=n[2];if(!Array.isArray(i))throw new Error('the second argument for the "in" operator must be an array');let s;if(typeof i[0]=="string"){if(i[0]!=="literal")throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');if(!Array.isArray(i[1]))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array');i=i[1],s=Ct}else s=Z;const r=new Array(i.length);for(let a=0;a<r.length;a++)try{const l=dt(i[a],s,e);r[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[dt(n[1],s,e),...r]}function fu(n,t,e){let i;try{i=dt(n[1],Z,e)}catch(o){throw new Error(`failed to parse first argument in palette expression: ${o.message}`)}const s=n[2];if(!Array.isArray(s))throw new Error("the second argument of palette must be an array");const r=new Array(s.length);for(let o=0;o<r.length;o++){let a;try{a=dt(s[o],Kt,e)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof at))throw new Error(`the palette color at index ${o} must be a literal value`);r[o]=a}return[i,...r]}function N(...n){return function(t,e,i){const s=t[0];let r;for(let o=0;o<n.length;o++){const a=n[o](t,e,i);if(o==n.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");r=a}}return new nu(e,s,...r)}}function gu(n,t,e){const i=n[0],s=su[i];if(!s)throw new Error(`unknown operator: ${i}`);return s(n,t,e)}function Za(n){if(!n)return"";const t=n.getType();switch(t){case"Point":case"LineString":case"Polygon":return t;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return t.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return Za(n.getGeometries()[0]);default:return""}}function Ba(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function Jt(n,t,e){const i=dt(n,t,e);return Bt(i)}function Bt(n,t){if(n instanceof at){if(n.type===Kt&&typeof n.value=="string"){const i=br(n.value);return function(){return i}}return function(){return n.value}}const e=n.operator;switch(e){case w.Number:case w.String:case w.Coalesce:return _u(n);case w.Get:case w.Var:case w.Has:return mu(n);case w.Id:return i=>i.featureId;case w.GeometryType:return i=>i.geometryType;case w.Concat:{const i=n.args.map(s=>Bt(s));return s=>"".concat(...i.map(r=>r(s).toString()))}case w.Resolution:return i=>i.resolution;case w.Any:case w.All:case w.Between:case w.In:case w.Not:return yu(n);case w.Equal:case w.NotEqual:case w.LessThan:case w.LessThanOrEqualTo:case w.GreaterThan:case w.GreaterThanOrEqualTo:return pu(n);case w.Multiply:case w.Divide:case w.Add:case w.Subtract:case w.Clamp:case w.Mod:case w.Pow:case w.Abs:case w.Floor:case w.Ceil:case w.Round:case w.Sin:case w.Cos:case w.Atan:case w.Sqrt:return Eu(n);case w.Case:return xu(n);case w.Match:return Cu(n);case w.Interpolate:return wu(n);case w.ToString:return Ru(n);default:throw new Error(`Unsupported operator ${e}`)}}function _u(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=Bt(n.args[r]);switch(e){case w.Coalesce:return r=>{for(let o=0;o<i;++o){const a=s[o](r);if(typeof a<"u"&&a!==null)return a}throw new Error("Expected one of the values to be non-null")};case w.Number:case w.String:return r=>{for(let o=0;o<i;++o){const a=s[o](r);if(typeof a===e)return a}throw new Error(`Expected one of the values to be a ${e}`)};default:throw new Error(`Unsupported assertion operator ${e}`)}}function mu(n,t){const i=n.args[0].value;switch(n.operator){case w.Get:return s=>{const r=n.args;let o=s.properties[i];for(let a=1,l=r.length;a<l;++a){const h=r[a].value;o=o[h]}return o};case w.Var:return s=>s.variables[i];case w.Has:return s=>{const r=n.args;if(!(i in s.properties))return!1;let o=s.properties[i];for(let a=1,l=r.length;a<l;++a){const h=r[a].value;if(!o||!Object.hasOwn(o,h))return!1;o=o[h]}return!0};default:throw new Error(`Unsupported accessor operator ${n.operator}`)}}function pu(n,t){const e=n.operator,i=Bt(n.args[0]),s=Bt(n.args[1]);switch(e){case w.Equal:return r=>i(r)===s(r);case w.NotEqual:return r=>i(r)!==s(r);case w.LessThan:return r=>i(r)<s(r);case w.LessThanOrEqualTo:return r=>i(r)<=s(r);case w.GreaterThan:return r=>i(r)>s(r);case w.GreaterThanOrEqualTo:return r=>i(r)>=s(r);default:throw new Error(`Unsupported comparison operator ${e}`)}}function yu(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=Bt(n.args[r]);switch(e){case w.Any:return r=>{for(let o=0;o<i;++o)if(s[o](r))return!0;return!1};case w.All:return r=>{for(let o=0;o<i;++o)if(!s[o](r))return!1;return!0};case w.Between:return r=>{const o=s[0](r),a=s[1](r),l=s[2](r);return o>=a&&o<=l};case w.In:return r=>{const o=s[0](r);for(let a=1;a<i;++a)if(o===s[a](r))return!0;return!1};case w.Not:return r=>!s[0](r);default:throw new Error(`Unsupported logical operator ${e}`)}}function Eu(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=Bt(n.args[r]);switch(e){case w.Multiply:return r=>{let o=1;for(let a=0;a<i;++a)o*=s[a](r);return o};case w.Divide:return r=>s[0](r)/s[1](r);case w.Add:return r=>{let o=0;for(let a=0;a<i;++a)o+=s[a](r);return o};case w.Subtract:return r=>s[0](r)-s[1](r);case w.Clamp:return r=>{const o=s[0](r),a=s[1](r);if(o<a)return a;const l=s[2](r);return o>l?l:o};case w.Mod:return r=>s[0](r)%s[1](r);case w.Pow:return r=>Math.pow(s[0](r),s[1](r));case w.Abs:return r=>Math.abs(s[0](r));case w.Floor:return r=>Math.floor(s[0](r));case w.Ceil:return r=>Math.ceil(s[0](r));case w.Round:return r=>Math.round(s[0](r));case w.Sin:return r=>Math.sin(s[0](r));case w.Cos:return r=>Math.cos(s[0](r));case w.Atan:return i===2?r=>Math.atan2(s[0](r),s[1](r)):r=>Math.atan(s[0](r));case w.Sqrt:return r=>Math.sqrt(s[0](r));default:throw new Error(`Unsupported numeric operator ${e}`)}}function xu(n,t){const e=n.args.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=Bt(n.args[s]);return s=>{for(let r=0;r<e-1;r+=2)if(i[r](s))return i[r+1](s);return i[e-1](s)}}function Cu(n,t){const e=n.args.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=Bt(n.args[s]);return s=>{const r=i[0](s);for(let o=1;o<e-1;o+=2)if(r===i[o](s))return i[o+1](s);return i[e-1](s)}}function wu(n,t){const e=n.args.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=Bt(n.args[s]);return s=>{const r=i[0](s),o=i[1](s);let a,l;for(let c=2;c<e;c+=2){const h=i[c](s);let u=i[c+1](s);const d=Array.isArray(u);if(d&&(u=Jc(u)),h>=o)return c===2?u:d?Iu(r,o,a,l,h,u):Xi(r,o,a,l,h,u);a=h,l=u}return l}}function Ru(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=Bt(n.args[r]);if(e===w.ToString)return r=>{const o=s[0](r);return n.args[0].type===Kt?Pr(o):o.toString()};throw new Error(`Unsupported convert operator ${e}`)}function Xi(n,t,e,i,s,r){const o=s-e;if(o===0)return i;const a=t-e,l=n===1?a/o:(Math.pow(n,a)-1)/(Math.pow(n,o)-1);return i+l*(r-i)}function Iu(n,t,e,i,s,r){if(s-e===0)return i;const a=Ro(i),l=Ro(r);let c=l[2]-a[2];c>180?c-=360:c<-180&&(c+=360);const h=[Xi(n,t,e,a[0],s,l[0]),Xi(n,t,e,a[1],s,l[1]),a[2]+Xi(n,t,e,0,s,c),Xi(n,t,e,i[3],s,r[3])];return Qc(h)}const X={IDLE:0,LOADING:1,LOADED:2,ERROR:3};function Tu(n,t,e){const i=n;let s=!0,r=!1,o=!1;const a=[bn(i,Y.LOAD,function(){o=!0,r||t()})];return i.src&&na?(r=!0,i.decode().then(function(){s&&t()}).catch(function(l){s&&(o?t():e())})):a.push(bn(i,Y.ERROR,e)),function(){s=!1,a.forEach(it)}}function Su(n,t){return new Promise((e,i)=>{function s(){o(),e(n)}function r(){o(),i(new Error("Image load error"))}function o(){n.removeEventListener("load",s),n.removeEventListener("error",r)}n.addEventListener("load",s),n.addEventListener("error",r)})}function vu(n,t){return t&&(n.src=t),n.src&&na?new Promise((e,i)=>n.decode().then(()=>e(n)).catch(s=>n.complete&&n.width?e(n):i(s))):Su(n)}class Lu{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];(t++&3)===0&&!i.hasListener()&&(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e){const i=Ps(t,e);return i in this.cache_?this.cache_[i]:null}getPattern(t,e){const i=Ps(t,e);return i in this.patternCache_?this.patternCache_[i]:null}set(t,e,i,s){const r=Ps(t,e),o=r in this.cache_;this.cache_[r]=i,s&&(i.getImageState()===X.IDLE&&i.load(),i.getImageState()===X.LOADING?i.ready().then(()=>{this.patternCache_[r]=zn().createPattern(i.getImage(1),"repeat")}):this.patternCache_[r]=zn().createPattern(i.getImage(1),"repeat")),o||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function Ps(n,t){const e=t?Ze(t):"null";return n+":"+e}const kt=new Lu;let bi=null;class Ua extends Un{constructor(t,e,i,s,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i?.crossOrigin,this.referrerPolicy_=i?.referrerPolicy,this.canvas_={},this.color_=r,this.imageState_=s===void 0?X.IDLE:s,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===X.LOADED){bi||(bi=ot(1,1,void 0,{willReadFrequently:!0})),bi.drawImage(this.image_,0,0);try{bi.getImageData(0,0,1,1),this.tainted_=!1}catch{bi=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(Y.CHANGE)}handleImageError_(){this.imageState_=X.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=X.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}setImage(t){this.image_=t}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=ot(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_===X.IDLE){this.image_||this.initializeImage_(),this.imageState_=X.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&vu(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_!==X.LOADED)return;const e=this.image_,i=ot(Math.ceil(e.width*t),Math.ceil(e.height*t)),s=i.canvas;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle=qc(this.color_),i.fillRect(0,0,s.width/t,s.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=s}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(this.imageState_===X.LOADED||this.imageState_===X.ERROR)t();else{const e=()=>{(this.imageState_===X.LOADED||this.imageState_===X.ERROR)&&(this.removeEventListener(Y.CHANGE,e),t())};this.addEventListener(Y.CHANGE,e)}})),this.ready_}}function Ki(n,t,e,i,s,r){let o=t===void 0?void 0:kt.get(t,s);return o||(o=new Ua(n,n&&"src"in n?n.src||void 0:t,e,i,s),kt.set(t,s,o,r)),r&&o&&!kt.getPattern(t,s)&&kt.set(t,s,o,r),o}function $t(n){return n?Array.isArray(n)?Pr(n):typeof n=="object"&&"src"in n?Au(n):n:null}function Au(n){if(!n.offset||!n.size)return kt.getPattern(n.src,n.color);const t=n.src+":"+n.offset,e=kt.getPattern(t,n.color);if(e)return e;const i=kt.get(n.src,null);if(i.getImageState()!==X.LOADED)return null;const s=ot(n.size[0],n.size[1]);return s.drawImage(i.getImage(1),n.offset[0],n.offset[1],n.size[0],n.size[1],0,0,n.size[0],n.size[1]),Ki(s.canvas,t,void 0,X.LOADED,n.color,!0),kt.getPattern(t,n.color)}const Va="10px sans-serif",wt="#000",pi="round",he=[],ce=0,yi="round",qi=10,Mu=0,$i="#000",Ji="center",Xn="middle",Ge=[0,0,0,0],Qi=1,si=new Qt;let Pi=null,Lo;const tr={},Ou=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function bu(n,t,e){return`${n} ${t} 16px "${e}"`}const Pu=(function(){let t,e;async function i(r){await e.ready;const o=await e.load(r);if(o.length===0)return!1;const a=Js(r),l=a.families[0].toLowerCase(),c=a.weight;return o.some(h=>{const u=h.family.replace(/^['"]|['"]$/g,"").toLowerCase(),d=$s[h.weight]||h.weight;return u===l&&h.style===a.style&&d==c})}async function s(){await e.ready;let r=!0;const o=si.getProperties(),a=Object.keys(o).filter(l=>o[l]<100);for(let l=a.length-1;l>=0;--l){const c=a[l];let h=o[c];h<100&&(await i(c)?(nn(tr),si.set(c,100)):(h+=10,si.set(c,h,!0),h<100&&(r=!1)))}t=void 0,r||(t=setTimeout(s,100))}return async function(r){e||(e=Dt?self.fonts:document.fonts);const o=Js(r);if(!o)return;const a=o.families;let l=!1;for(const c of a){if(Ou.has(c))continue;const h=bu(o.style,o.weight,c);si.get(h)===void 0&&(si.set(h,0,!0),l=!0)}l&&(clearTimeout(t),t=setTimeout(s,100))}})(),Du=(function(){let n;return function(t){let e=tr[t];if(e==null){if(Dt){const i=Js(t),s=ja(t,"Žg");e=(isNaN(Number(i.lineHeight))?1.2:Number(i.lineHeight))*(s.actualBoundingBoxAscent+s.actualBoundingBoxDescent)}else n||(n=document.createElement("div"),n.innerHTML="M",n.style.minHeight="0",n.style.maxHeight="none",n.style.height="auto",n.style.padding="0",n.style.border="none",n.style.position="absolute",n.style.display="block",n.style.left="-99999px"),n.style.font=t,document.body.appendChild(n),e=n.offsetHeight,document.body.removeChild(n);tr[t]=e}return e}})();function ja(n,t){return Pi||(Pi=ot(1,1)),n!=Lo&&(Pi.font=n,Lo=Pi.font),Pi.measureText(t)}function Ha(n,t){return ja(n,t).width}function Ao(n,t,e){if(t in e)return e[t];const i=t.split(`
`).reduce((s,r)=>Math.max(s,Ha(n,r)),0);return e[t]=i,i}function Fu(n,t){const e=[],i=[],s=[];let r=0,o=0,a=0,l=0;for(let c=0,h=t.length;c<=h;c+=2){const u=t[c];if(u===`
`||c===h){r=Math.max(r,o),s.push(o),o=0,a+=l,l=0;continue}const d=t[c+1]||n.font,f=Ha(d,u);e.push(f),o+=f;const g=Du(d);i.push(g),l=Math.max(l,g)}return{width:r,height:a,widths:e,heights:i,lineWidths:s}}function ku(n,t,e,i,s,r,o,a,l,c,h){n.save(),e!==1&&(n.globalAlpha===void 0?n.globalAlpha=u=>u.globalAlpha*=e:n.globalAlpha*=e),t&&n.transform.apply(n,t),i.contextInstructions?(n.translate(l,c),n.scale(h[0],h[1]),Nu(i,n)):h[0]<0||h[1]<0?(n.translate(l,c),n.scale(h[0],h[1]),n.drawImage(i,s,r,o,a,0,0,o,a)):n.drawImage(i,s,r,o,a,l,c,o*h[0],a*h[1]),n.restore()}function Nu(n,t){const e=n.contextInstructions;for(let i=0,s=e.length;i<s;i+=2)Array.isArray(e[i+1])?t[e[i]].apply(t,e[i+1]):t[e[i]]=e[i+1]}class ns{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=It(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new ns({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 V()}getImage(t){return V()}getHitDetectionImage(){return V()}getPixelRatio(t){return 1}getImageState(){return V()}getImageSize(){return V()}getOrigin(){return V()}getSize(){return V()}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_=It(t)}listenImageChange(t){V()}load(){V()}unlistenImageChange(t){V()}ready(){return Promise.resolve()}}class ss extends ns{constructor(t){super({opacity:1,rotateWithView:t.rotateWithView!==void 0?t.rotateWithView:!1,rotation:t.rotation!==void 0?t.rotation:0,scale:t.scale!==void 0?t.scale:1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=t.fill!==void 0?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius=t.radius,this.radius2_=t.radius2,this.angle_=t.angle!==void 0?t.angle:0,this.stroke_=t.stroke!==void 0?t.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?X.LOADING:X.LOADED,this.imageState_===X.LOADING&&this.ready().then(()=>this.imageState_=X.LOADED),this.render()}clone(){const t=this.getScale(),e=new ss({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 s=kt.get(i,null)?.getImage(1);if(!s){const r=this.renderOptions_,o=Math.ceil(r.size*t),a=ot(o,o);this.draw_(r,a,t),s=a.canvas;const l=new Ua(s,void 0,null,X.LOADED,null);kt.set(i,null,l),createImageBitmap(s).then(c=>{l.setImage(c)})}return s}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(t){this.radius!==t&&(this.radius=t,this.render())}getRadius2(){return this.radius2_}setRadius2(t){this.radius2_!==t&&(this.radius2_=t,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(e===0||this.points_===1/0||t!=="bevel"&&t!=="miter")return e;let s=this.radius,r=this.radius2_===void 0?s:this.radius2_;if(s<r){const S=s;s=r,r=S}const o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=r*Math.sin(a),c=Math.sqrt(r*r-l*l),h=s-c,u=Math.sqrt(l*l+h*h),d=u/l;if(t==="miter"&&d<=i)return d*e;const f=e/2/d,g=e/2*(h/u),_=Math.sqrt((s+f)*(s+f)+g*g)-s;if(this.radius2_===void 0||t==="bevel")return _*2;const y=s*Math.sin(a),E=Math.sqrt(s*s-y*y),C=r-E,x=Math.sqrt(y*y+C*C)/y;if(x<=i){const S=x*e/2-r-s;return 2*Math.max(_,S)}return _*2}createRenderOptions(){let t=pi,e=yi,i=0,s=null,r=0,o,a=0;this.stroke_&&(o=$t(this.stroke_.getColor()??$i),a=this.stroke_.getWidth()??Qi,s=this.stroke_.getLineDash(),r=this.stroke_.getLineDashOffset()??0,e=this.stroke_.getLineJoin()??yi,t=this.stroke_.getLineCap()??pi,i=this.stroke_.getMiterLimit()??qi);const l=this.calculateLineJoinSize_(e,a,i),c=Math.max(this.radius,this.radius2_||0),h=Math.ceil(2*c+l);return{strokeStyle:o,strokeWidth:a,size:h,lineCap:t,lineDash:s,lineDashOffset:r,lineJoin:e,miterLimit:i}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let s=this.fill_.getColor();s===null&&(s=wt),e.fillStyle=$t(s),e.fill()}t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){let e;if(this.fill_){let i=this.fill_.getColor(),s=0;typeof i=="string"&&(i=Ze(i)),i===null?s=1:Array.isArray(i)&&(s=i.length===4?i[3]:1),s===0&&(e=ot(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_;const i=this.radius;if(e===1/0)t.arc(0,0,i,0,2*Math.PI);else{const s=this.radius2_===void 0?i:this.radius2_;this.radius2_!==void 0&&(e*=2);const r=this.angle_-Math.PI/2,o=2*Math.PI/e;for(let a=0;a<e;a++){const l=r+a*o,c=a%2===0?i:s;t.lineTo(c*Math.cos(l),c*Math.sin(l))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=wt,e.fill(),t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}}class rs extends ss{constructor(t){t=t||{radius:5},super({points:1/0,fill:t.fill,radius:t.radius,stroke:t.stroke,scale:t.scale!==void 0?t.scale:1,rotation:t.rotation!==void 0?t.rotation:0,rotateWithView:t.rotateWithView!==void 0?t.rotateWithView:!1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode})}clone(){const t=this.getScale(),e=new rs({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}}class Ei{constructor(t){t=t||{},this.patternImage_=null,this.color_=null,t.color!==void 0&&this.setColor(t.color)}clone(){const t=this.getColor();return new Ei({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){if(t!==null&&typeof t=="object"&&"src"in t){const e=Ki(null,t.src,{crossOrigin:"anonymous"},void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));e.ready().then(()=>{this.patternImage_=null}),e.getImageState()===X.IDLE&&e.load(),e.getImageState()===X.LOADING&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?H(t):typeof t=="object"&&"src"in t?t.src+":"+t.offset:Ze(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}function Mo(n,t,e,i){return e!==void 0&&i!==void 0?[e/n,i/t]:e!==void 0?e/n:i!==void 0?i/t:1}class os extends ns{constructor(t){t=t||{};const e=t.opacity!==void 0?t.opacity:1,i=t.rotation!==void 0?t.rotation:0,s=t.scale!==void 0?t.scale:1,r=t.rotateWithView!==void 0?t.rotateWithView:!1;super({opacity:e,rotation:i,scale:s,displacement:t.displacement!==void 0?t.displacement:[0,0],rotateWithView:r,declutterMode:t.declutterMode}),this.anchor_=t.anchor!==void 0?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=t.anchorOrigin!==void 0?t.anchorOrigin:"top-left",this.anchorXUnits_=t.anchorXUnits!==void 0?t.anchorXUnits:"fraction",this.anchorYUnits_=t.anchorYUnits!==void 0?t.anchorYUnits:"fraction",this.crossOrigin_=t.crossOrigin!==void 0?t.crossOrigin:null,this.referrerPolicy_=t.referrerPolicy;const o=t.img!==void 0?t.img:null;let a=t.src;J(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||H(o)),J(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),J(!((t.width!==void 0||t.height!==void 0)&&t.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(t.src!==void 0?l=X.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?X.LOADED:X.IDLE:l=X.LOADING:l=X.LOADED),this.color_=t.color!==void 0?Ze(t.color):null,this.iconImage_=Ki(o,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},l,this.color_),this.offset_=t.offset!==void 0?t.offset:[0,0],this.offsetOrigin_=t.offsetOrigin!==void 0?t.offsetOrigin:"top-left",this.origin_=null,this.size_=t.size!==void 0?t.size:null,this.initialOptions_,t.width!==void 0||t.height!==void 0){let c,h;if(t.size)[c,h]=t.size;else{const u=this.getImage(1);if(u.width&&u.height)c=u.width,h=u.height;else if(u instanceof HTMLImageElement){this.initialOptions_=t;const d=()=>{if(this.unlistenImageChange(d),!this.initialOptions_)return;const f=this.iconImage_.getSize();this.setScale(Mo(f[0],f[1],t.width,t.height))};this.listenImageChange(d);return}}c!==void 0&&this.setScale(Mo(c,h,t.width,t.height))}}clone(){let t,e,i;return this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new os({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:i,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const s=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!s)return null;t=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(t[0]*=s[0]),this.anchorYUnits_=="fraction"&&(t[1]*=s[1])}if(this.anchorOrigin_!="top-left"){if(!s)return null;t===this.anchor_&&(t=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(t[0]=-t[0]+s[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(t[1]=-t[1]+s[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(t){const e=t?Ze(t):null;if(this.color_===e||this.color_&&e&&this.color_.length===e.length&&this.color_.every((o,a)=>o===e[a]))return;this.color_=e;const i=this.getSrc(),s=i!==void 0?null:this.getHitDetectionImage(),r=i!==void 0?X.IDLE:this.iconImage_.getImageState();this.iconImage_=Ki(s,i,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},r,this.color_)}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if(this.offsetOrigin_!="top-left"){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(t[0]=i[0]-e[0]-t[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(t){this.iconImage_=Ki(null,t,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},X.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();if(this.size_)return this.size_[0]*t[0];if(this.iconImage_.getImageState()==X.LOADED)return this.iconImage_.getSize()[0]*t[0]}getHeight(){const t=this.getScaleArray();if(this.size_)return this.size_[1]*t[1];if(this.iconImage_.getImageState()==X.LOADED)return this.iconImage_.getSize()[1]*t[1]}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(Y.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(Y.CHANGE,t)}ready(){return this.iconImage_.ready()}}class as{constructor(t){t=t||{},this.color_=t.color!==void 0?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=t.lineDash!==void 0?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.offset_=t.offset,this.width_=t.width}clone(){const t=this.getColor();return new as({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),offset:this.getOffset(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setOffset(t){this.offset_=t}setWidth(t){this.width_=t}}class We{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=Oo,t.geometry!==void 0&&this.setGeometry(t.geometry),this.fill_=t.fill!==void 0?t.fill:null,this.image_=t.image!==void 0?t.image:null,this.renderer_=t.renderer!==void 0?t.renderer:null,this.hitDetectionRenderer_=t.hitDetectionRenderer!==void 0?t.hitDetectionRenderer:null,this.stroke_=t.stroke!==void 0?t.stroke:null,this.text_=t.text!==void 0?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&typeof t=="object"&&(t=t.clone()),new We({geometry:t??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){typeof t=="function"?this.geometryFunction_=t:typeof t=="string"?this.geometryFunction_=function(e){return e.get(t)}:t?t!==void 0&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=Oo,this.geometry_=t}setZIndex(t){this.zIndex_=t}}function Gu(n){let t;if(typeof n=="function")t=n;else{let e;Array.isArray(n)?e=n:(J(typeof n.getZIndex=="function","Expected an `Style` or an array of `Style`"),e=[n]),t=function(){return e}}return t}let Ds=null;function qa(n,t){if(!Ds){const e=new Ei({color:"rgba(255,255,255,0.4)"}),i=new as({color:"#3399CC",width:1.25});Ds=[new We({image:new rs({fill:e,stroke:i,radius:5}),fill:e,stroke:i})]}return Ds}function Oo(n){return n.getGeometry()}const zu="#333";class Fr{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_=It(t.scale!==void 0?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.repeat_=t.repeat,this.textBaseline_=t.textBaseline,this.fill_=t.fill!==void 0?t.fill:new Ei({color:zu}),this.maxAngle_=t.maxAngle!==void 0?t.maxAngle:Math.PI/4,this.placement_=t.placement!==void 0?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=t.stroke!==void 0?t.stroke:null,this.offsetX_=t.offsetX!==void 0?t.offsetX:0,this.offsetY_=t.offsetY!==void 0?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=t.padding===void 0?null:t.padding,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new Fr({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 Ei?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_=It(t!==void 0?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}}function Xu(n){return!0}function Wu(n){const t=Ka(),e=Yu(n,t),i=Ba();return function(s,r){if(i.properties=s.getPropertiesInternal(),i.resolution=r,t.featureId){const o=s.getId();o!==void 0?i.featureId=o:i.featureId=null}return t.geometryType&&(i.geometryType=Za(s.getGeometry())),e(i)}}function bo(n){const t=Ka(),e=n.length,i=new Array(e);for(let o=0;o<e;++o)i[o]=er(n[o],t);const s=Ba(),r=new Array(e);return function(o,a){if(s.properties=o.getPropertiesInternal(),s.resolution=a,t.featureId){const c=o.getId();c!==void 0?s.featureId=c:s.featureId=null}let l=0;for(let c=0;c<e;++c){const h=i[c](s);h&&(r[l]=h,l+=1)}return r.length=l,r}}function Yu(n,t){const e=n.length,i=new Array(e);for(let s=0;s<e;++s){const r=n[s],o="filter"in r?Jt(r.filter,yt,t):Xu;let a;if(Array.isArray(r.style)){const l=r.style.length;a=new Array(l);for(let c=0;c<l;++c)a[c]=er(r.style[c],t)}else a=[er(r.style,t)];i[s]={filter:o,styles:a}}return function(s){const r=[];let o=!1;for(let a=0;a<e;++a){const l=i[a].filter;if(l(s)&&!(n[a].else&&o)){o=!0;for(const c of i[a].styles){const h=c(s);h&&r.push(h)}}}return r}}function er(n,t){const e=tn(n,"",t),i=en(n,"",t),s=Ku(n,t),r=Zu(n,t),o=ut(n,"z-index",t);if(!e&&!i&&!s&&!r&&!gi(n))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(n));const a=new We;return function(l){let c=!0;if(e){const h=e(l);h&&(c=!1),a.setFill(h)}if(i){const h=i(l);h&&(c=!1),a.setStroke(h)}if(s){const h=s(l);h&&(c=!1),a.setText(h)}if(r){const h=r(l);h&&(c=!1),a.setImage(h)}return o&&a.setZIndex(o(l)),c?null:a}}function tn(n,t,e){let i;if(t+"fill-pattern-src"in n)i=ju(n,t+"fill-",e);else{if(n[t+"fill-color"]==="none")return r=>null;i=ls(n,t+"fill-color",e)}if(!i)return null;const s=new Ei;return function(r){const o=i(r);return o===Or?null:(s.setColor(o),s)}}function en(n,t,e){const i=ut(n,t+"stroke-width",e),s=ls(n,t+"stroke-color",e);if(!i&&!s)return null;const r=oe(n,t+"stroke-line-cap",e),o=oe(n,t+"stroke-line-join",e),a=$a(n,t+"stroke-line-dash",e),l=ut(n,t+"stroke-line-dash-offset",e),c=ut(n,t+"stroke-miter-limit",e),h=ut(n,t+"stroke-offset",e),u=new as;return function(d){if(s){const f=s(d);if(f===Or)return null;u.setColor(f)}if(i&&u.setWidth(i(d)),r){const f=r(d);if(f!=="butt"&&f!=="round"&&f!=="square")throw new Error("Expected butt, round, or square line cap");u.setLineCap(f)}if(o){const f=o(d);if(f!=="bevel"&&f!=="round"&&f!=="miter")throw new Error("Expected bevel, round, or miter line join");u.setLineJoin(f)}return a&&u.setLineDash(a(d)),l&&u.setLineDashOffset(l(d)),c&&u.setMiterLimit(c(d)),h&&u.setOffset(h(d)),u}}function Ku(n,t){const e="text-",i=oe(n,e+"value",t);if(!i)return null;const s=tn(n,e,t),r=tn(n,e+"background-",t),o=en(n,e,t),a=en(n,e+"background-",t),l=oe(n,e+"font",t),c=ut(n,e+"max-angle",t),h=ut(n,e+"offset-x",t),u=ut(n,e+"offset-y",t),d=ui(n,e+"overflow",t),f=oe(n,e+"placement",t),g=ut(n,e+"repeat",t),m=hs(n,e+"scale",t),_=ui(n,e+"rotate-with-view",t),y=ut(n,e+"rotation",t),E=oe(n,e+"align",t),C=oe(n,e+"justify",t),p=oe(n,e+"baseline",t),x=ui(n,e+"keep-upright",t),S=$a(n,e+"padding",t),L=cs(n,e+"declutter-mode"),I=new Fr({declutterMode:L});return function(R){if(I.setText(i(R)),s&&I.setFill(s(R)),r&&I.setBackgroundFill(r(R)),o&&I.setStroke(o(R)),a&&I.setBackgroundStroke(a(R)),l&&I.setFont(l(R)),c&&I.setMaxAngle(c(R)),h&&I.setOffsetX(h(R)),u&&I.setOffsetY(u(R)),d&&I.setOverflow(d(R)),f){const v=f(R);if(v!=="point"&&v!=="line")throw new Error("Expected point or line for text-placement");I.setPlacement(v)}if(g&&I.setRepeat(g(R)),m&&I.setScale(m(R)),_&&I.setRotateWithView(_(R)),y&&I.setRotation(y(R)),E){const v=E(R);if(v!=="left"&&v!=="center"&&v!=="right"&&v!=="end"&&v!=="start")throw new Error("Expected left, right, center, start, or end for text-align");I.setTextAlign(v)}if(C){const v=C(R);if(v!=="left"&&v!=="right"&&v!=="center")throw new Error("Expected left, right, or center for text-justify");I.setJustify(v)}if(p){const v=p(R);if(v!=="bottom"&&v!=="top"&&v!=="middle"&&v!=="alphabetic"&&v!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");I.setTextBaseline(v)}return S&&I.setPadding(S(R)),x&&I.setKeepUpright(x(R)),I}}function Zu(n,t){return"icon-src"in n?Bu(n,t):"shape-points"in n?Uu(n,t):"circle-radius"in n?Vu(n,t):null}function Bu(n,t){const e="icon-",i=e+"src",s=Ja(n[i],i),r=Wn(n,e+"anchor",t),o=hs(n,e+"scale",t),a=ut(n,e+"opacity",t),l=Wn(n,e+"displacement",t),c=ut(n,e+"rotation",t),h=ui(n,e+"rotate-with-view",t),u=Do(n,e+"anchor-origin"),d=Fo(n,e+"anchor-x-units"),f=Fo(n,e+"anchor-y-units"),g=fe(n,e+"color");let m,_=null;g!==void 0&&(Array.isArray(g)&&g.length>0&&typeof g[0]=="string"?_=ls(n,e+"color",t):m=Qa(g,e+"color"));const y=qu(n,e+"cross-origin"),E=$u(n,e+"offset"),C=Do(n,e+"offset-origin"),p=ir(n,e+"width"),x=ir(n,e+"height"),S=Hu(n,e+"size"),L=cs(n,e+"declutter-mode"),I={src:s,anchorOrigin:u,anchorXUnits:d,anchorYUnits:f,crossOrigin:y,offset:E,offsetOrigin:C,height:x,width:p,size:S,declutterMode:L};let R=null;return function(v){if(R)_&&R.setColor(_(v));else{const k=_?_(v):m;R=new os(k!==void 0?Object.assign({},I,{color:k}):Object.assign({},I))}return a&&R.setOpacity(a(v)),l&&R.setDisplacement(l(v)),c&&R.setRotation(c(v)),h&&R.setRotateWithView(h(v)),o&&R.setScale(o(v)),r&&R.setAnchor(r(v)),R}}function Uu(n,t){const e="shape-",i=e+"points",s=e+"radius",r=kr(n[i],i);if(!(s in n))throw new Error(`Expected a number for ${s}`);const o=ut(n,s,t),a=typeof n[s]=="number"?n[s]:5,l=e+"radius2",c=ut(n,l,t),h=typeof n[l]=="number"?n[l]:void 0,u=tn(n,e,t),d=en(n,e,t),f=hs(n,e+"scale",t),g=Wn(n,e+"displacement",t),m=ut(n,e+"rotation",t),_=ui(n,e+"rotate-with-view",t),y=ir(n,e+"angle"),E=cs(n,e+"declutter-mode"),C=new ss({points:r,radius:a,radius2:h,angle:y,declutterMode:E});return function(p){return o&&C.setRadius(o(p)),c&&C.setRadius2(c(p)),u&&C.setFill(u(p)),d&&C.setStroke(d(p)),g&&C.setDisplacement(g(p)),m&&C.setRotation(m(p)),_&&C.setRotateWithView(_(p)),f&&C.setScale(f(p)),C}}function Vu(n,t){const e="circle-",i=tn(n,e,t),s=en(n,e,t),r=ut(n,e+"radius",t),o=hs(n,e+"scale",t),a=Wn(n,e+"displacement",t),l=ut(n,e+"rotation",t),c=ui(n,e+"rotate-with-view",t),h=cs(n,e+"declutter-mode"),u=new rs({radius:5,declutterMode:h});return function(d){return r&&u.setRadius(r(d)),i&&u.setFill(i(d)),s&&u.setStroke(s(d)),a&&u.setDisplacement(a(d)),l&&u.setRotation(l(d)),c&&u.setRotateWithView(c(d)),o&&u.setScale(o(d)),u}}function fe(n,t){if(!(t in n))return;const e=n[t];return e===void 0?void 0:e}function ut(n,t,e){const i=fe(n,t);if(i===void 0)return;const s=Jt(i,Z,e);return function(r){return kr(s(r),t)}}function oe(n,t,e){const i=fe(n,t);if(i===void 0)return null;const s=Jt(i,Ct,e);return function(r){return Ja(s(r),t)}}function ju(n,t,e){const i=oe(n,t+"pattern-src",e),s=Po(n,t+"pattern-offset",e),r=Po(n,t+"pattern-size",e),o=ls(n,t+"color",e);return function(a){return{src:i(a),offset:s&&s(a),size:r&&r(a),color:o&&o(a)}}}function ui(n,t,e){const i=fe(n,t);if(i===void 0)return null;const s=Jt(i,yt,e);return function(r){const o=s(r);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${t}`);return o}}function ls(n,t,e){const i=fe(n,t);if(i===void 0)return null;const s=Jt(i,Kt,e);return function(r){return Qa(s(r),t)}}function $a(n,t,e){const i=fe(n,t);if(i===void 0)return null;if(Array.isArray(i)&&(i.length===0||typeof i[0]!="string")){const r=i.map((o,a)=>{if(typeof o=="number")return()=>o;const l=Jt(o,Z,e);return function(c){return kr(l(c),`${t}[${a}]`)}});return function(o){const a=new Array(r.length);for(let l=0;l<r.length;++l)a[l]=r[l](o);return a}}const s=Jt(i,Be,e);return function(r){return hn(s(r),t)}}function Wn(n,t,e){const i=fe(n,t);if(i===void 0)return null;const s=Jt(i,Be,e);return function(r){const o=hn(s(r),t);if(o.length!==2)throw new Error(`Expected two numbers for ${t}`);return o}}function Po(n,t,e){const i=fe(n,t);if(i===void 0)return null;const s=Jt(i,Be,e);return function(r){return tl(s(r),t)}}function hs(n,t,e){const i=fe(n,t);if(i===void 0)return null;const s=Jt(i,Be|Z,e);return function(r){return Ju(s(r),t)}}function ir(n,t){const e=n[t];if(e!==void 0){if(typeof e!="number")throw new Error(`Expected a number for ${t}`);return e}}function Hu(n,t){const e=n[t];if(e!==void 0){if(typeof e=="number")return It(e);if(!Array.isArray(e))throw new Error(`Expected a number or size array for ${t}`);if(e.length!==2||typeof e[0]!="number"||typeof e[1]!="number")throw new Error(`Expected a number or size array for ${t}`);return e}}function qu(n,t){const e=n[t];if(e!==void 0){if(typeof e!="string")throw new Error(`Expected a string for ${t}`);return e}}function Do(n,t){const e=n[t];if(e!==void 0){if(e!=="bottom-left"&&e!=="bottom-right"&&e!=="top-left"&&e!=="top-right")throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${t}`);return e}}function Fo(n,t){const e=n[t];if(e!==void 0){if(e!=="pixels"&&e!=="fraction")throw new Error(`Expected pixels or fraction for ${t}`);return e}}function $u(n,t){const e=n[t];if(e!==void 0)return hn(e,t)}function cs(n,t){const e=n[t];if(e!==void 0){if(typeof e!="string")throw new Error(`Expected a string for ${t}`);if(e!=="declutter"&&e!=="obstacle"&&e!=="none")throw new Error(`Expected declutter, obstacle, or none for ${t}`);return e}}function hn(n,t){if(!Array.isArray(n))throw new Error(`Expected an array for ${t}`);const e=n.length;for(let i=0;i<e;++i)if(typeof n[i]!="number")throw new Error(`Expected an array of numbers for ${t}`);return n}function Ja(n,t){if(typeof n!="string")throw new Error(`Expected a string for ${t}`);return n}function kr(n,t){if(typeof n!="number")throw new Error(`Expected a number for ${t}`);return n}function Qa(n,t){if(typeof n=="string")return n;const e=hn(n,t),i=e.length;if(i<3||i>4)throw new Error(`Expected a color with 3 or 4 values for ${t}`);return e}function tl(n,t){const e=hn(n,t);if(e.length!==2)throw new Error(`Expected an array of two numbers for ${t}`);return e}function Ju(n,t){return typeof n=="number"?n:tl(n,t)}const ko={RENDER_ORDER:"renderOrder"};class el extends is{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=t.declutter?String(t.declutter):void 0,this.renderBuffer_=t.renderBuffer!==void 0?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=t.updateWhileAnimating!==void 0?t.updateWhileAnimating:!1,this.updateWhileInteracting_=t.updateWhileInteracting!==void 0?t.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(ko.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const i=this.getDeclutter();i in t.declutter||(t.declutter[i]=new Wa(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(ko.RENDER_ORDER,t)}setStyle(t){this.style_=t===void 0?qa:t;const e=Qu(t);this.styleFunction_=t===null?void 0:Gu(e),this.changed()}setDeclutter(t){this.declutter_=t?String(t):void 0,this.changed()}}function Qu(n){if(n===void 0)return qa;if(!n)return null;if(typeof n=="function"||n instanceof We)return n;if(!Array.isArray(n))return bo([n]);if(n.length===0)return[];const t=n.length,e=n[0];if(e instanceof We){const s=new Array(t);for(let r=0;r<t;++r){const o=n[r];if(!(o instanceof We))throw new Error("Expected a list of style instances");s[r]=o}return s}if("style"in e){const s=new Array(t);for(let r=0;r<t;++r){const o=n[r];if(!("style"in o))throw new Error("Expected a list of rules with a style property");s[r]=o}return Wu(s)}return bo(n)}class il extends de{constructor(t,e,i,s){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=s}}class td extends Zn{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){V()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,s=t.pixelToCoordinateTransform;ue(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),Ia(s,i)}forEachFeatureAtCoordinate(t,e,i,s,r,o,a,l){let c;const h=e.viewState;function u(p,x,S,L){return r.call(o,x,p?S:null,L)}const d=h.projection,f=ga(t.slice(),d),g=[[0,0]];if(d.canWrapX()&&s){const p=d.getExtent(),x=tt(p);g.push([-x,0],[x,0])}const m=e.layerStatesArray,_=m.length,y=[],E=[];for(let p=0;p<g.length;p++)for(let x=_-1;x>=0;--x){const S=m[x],L=S.layer;if(L.hasRenderer()&&Mr(S,h)&&a.call(l,L)){const I=L.getRenderer(),R=L.getSource();if(I&&R){const v=R.getWrapX()?f:t,k=u.bind(null,S.managed);E[0]=v[0]+g[p][0],E[1]=v[1]+g[p][1],c=I.forEachFeatureAtCoordinate(E,e,i,k,y)}if(c)return c}}if(y.length===0)return;const C=1/y.length;return y.forEach((p,x)=>p.distanceSq+=x*C),y.sort((p,x)=>p.distanceSq-x.distanceSq),y.some(p=>c=p.callback(p.feature,p.layer,p.geometry)),c}hasFeatureAtCoordinate(t,e,i,s,r,o){return this.forEachFeatureAtCoordinate(t,e,i,s,Zi,this,r,o)!==void 0}getMap(){return this.map_}renderFrame(t){V()}scheduleExpireIconCache(t){kt.canExpireCache()&&t.postRenderFunctions.push(ed)}}function ed(n,t){kt.expire()}class id extends td{constructor(t){super(t),this.fontChangeListenerKey_=j(si,fi.PROPERTYCHANGE,t.redrawText,t),this.element_=Dt?Da():document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=ts+" ol-layers";const i=t.getViewport();i&&i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const s=new il(t,void 0,e);i.dispatchEvent(s)}}disposeInternal(){it(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(t){if(!t){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(t),this.dispatchRenderEvent(Ft.PRECOMPOSE,t);const e=t.layerStatesArray.sort((c,h)=>c.zIndex-h.zIndex);e.some(c=>c.layer instanceof el&&c.layer.getDeclutter())&&(t.declutter={});const s=t.viewState;this.children_.length=0;const r=[];let o=null;for(let c=0,h=e.length;c<h;++c){const u=e[c];t.layerIndex=c;const d=u.layer,f=d.getSourceState();if(!Mr(u,s)||f!="ready"&&f!="undefined"){d.unrender();continue}const g=d.render(t,o);g&&(g!==o&&(this.children_.push(g),o=g),r.push(u))}this.declutter(t,r),dc(this.element_,this.children_);const l=this.getMap().getTargetElement();if(Te(l)){const c=l.getContext("2d");for(const h of this.children_){const u=h.firstElementChild||h,d=h.style.backgroundColor;if(d&&(!Te(u)||u.width>0)&&(c.fillStyle=d,c.fillRect(0,0,l.width,l.height)),Te(u)&&u.width>0){c.save();const f=h.style.opacity||u.style.opacity;c.globalAlpha=f===""?1:Number(f);const g=u.style.transform;if(g)c.transform(...qs(g));else{const m=parseFloat(u.style.width)/u.width,_=parseFloat(u.style.height)/u.height;c.transform(m,0,0,_,0,0)}c.drawImage(u,0,0),c.restore()}}}this.dispatchRenderEvent(Ft.POSTCOMPOSE,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){if(t.declutter){for(let i=e.length-1;i>=0;--i){const s=e[i],r=s.layer;r.getDeclutter()&&r.renderDeclutter(t,s)}e.forEach(i=>i.layer.renderDeferred(t))}}}function nl(n){if(n instanceof is){n.setMapInternal(null);return}n instanceof Ci&&n.getLayers().forEach(nl)}function sl(n,t){if(n instanceof is){n.setMapInternal(t);return}if(n instanceof Ci){const e=n.getLayers().getArray();for(let i=0,s=e.length;i<s;++i)sl(e[i],t)}}class Lf extends Qt{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=nd(t);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=t.maxTilesLoading!==void 0?t.maxTilesLoading:16,this.pixelRatio_=t.pixelRatio!==void 0?t.pixelRatio:kl,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Zt(),this.pixelToCoordinateTransform_=Zt(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,Dt||(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,Dt||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=e.controls||(Dt?new Pt:mc()),this.interactions=e.interactions||(Dt?new Pt:Gc({onFocusOnly:!0})),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new zl(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(gt.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(gt.VIEW,this.handleViewChanged_),this.addChangeListener(gt.SIZE,this.handleSizeChanged_),this.addChangeListener(gt.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const i=this;t.view&&!(t.view instanceof ae)&&t.view.then(function(s){i.setView(new ae(s))}),this.controls.addEventListener(xt.ADD,s=>{s.element.setMap(this)}),this.controls.addEventListener(xt.REMOVE,s=>{s.element.setMap(null)}),this.interactions.addEventListener(xt.ADD,s=>{s.element.setMap(this)}),this.interactions.addEventListener(xt.REMOVE,s=>{s.element.setMap(null)}),this.overlays_.addEventListener(xt.ADD,s=>{this.addOverlayInternal_(s.element)}),this.overlays_.addEventListener(xt.REMOVE,s=>{const r=s.element.getId();r!==void 0&&delete this.overlayIdIndex_[r.toString()],s.element.setMap(null)}),this.controls.forEach(s=>{s.setMap(this)}),this.interactions.forEach(s=>{s.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){sl(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();e!==void 0&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const s=this.getCoordinateFromPixelInternal(t);i=i!==void 0?i:{};const r=i.hitTolerance!==void 0?i.hitTolerance:0,o=i.layerFilter!==void 0?i.layerFilter:Zi,a=i.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(s,this.frameState_,r,a,e,null,o,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,function(s){i.push(s)},e),i}getAllLayers(){const t=[];function e(i){i.forEach(function(s){s instanceof Ci?e(s.getLayers()):t.push(s)})}return e(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t);e=e!==void 0?e:{};const s=e.layerFilter!==void 0?e.layerFilter:Zi,r=e.hitTolerance!==void 0?e.hitTolerance:0,o=e.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,r,o,s,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const i=this.viewport_.getBoundingClientRect(),s=this.getSize(),r=i.width/s[0],o=i.height/s[1],a="changedTouches"in t?t.changedTouches[0]:t;return[(a.clientX-i.left)/r,(a.clientY-i.top)/o]}getTarget(){return this.get(gt.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return Hs(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?ct(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return e!==void 0?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(gt.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof Pt){e.setLayers(t);return}const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e<i;++e){const s=t[e];if(!s.visible)continue;const r=s.layer.getRenderer();if(r&&!r.ready)return!0;const o=s.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(t){const e=re(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?ct(e.coordinateToPixelTransform,t.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(t){this.pixelRatio_!==t&&(this.pixelRatio_=t,this.render())}getRenderer(){return this.renderer_}getSize(){return this.get(gt.SIZE)}getView(){return this.get(gt.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,i,s){return Xl(this.frameState_,t,e,i,s)}handleBrowserEvent(t,e){e=e||t.type;const i=new Ce(e,this,t);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,i=e.type;if(i===Ws.POINTERDOWN||i===Y.WHEEL||i===Y.KEYDOWN){const s=this.getOwnerDocument(),r=this.viewport_.getRootNode?this.viewport_.getRootNode():s,o=e.target,a=r instanceof ShadowRoot?r.host===o?r.host.ownerDocument:r:r===s?s.documentElement:r;if(this.overlayContainerStopEvent_.contains(o)||!a.contains(o))return}if(t.frameState=this.frameState_,this.dispatchEvent(t)!==!1){const s=this.getInteractions().getArray().slice();for(let r=s.length-1;r>=0;r--){const o=s[r];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let s=this.maxTilesLoading_,r=s;if(t){const o=t.viewHints;if(o[_t.ANIMATING]||o[_t.INTERACTING]){const a=Date.now()-t.time>8;s=a?0:8,r=a?0:2}}e.getTilesLoading()<s&&(e.reprioritize(),e.loadMoreTiles(s,r))}t&&this.renderer_&&!t.animate&&(this.renderComplete_?(this.hasListener(Ft.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Ft.RENDERCOMPLETE,t),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new ii(we.LOADEND,this,t)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new ii(we.LOADSTART,this,t))));const i=this.postRenderFunctions_;if(t)for(let s=0,r=i.length;s<r;++s)i[s](this,t);i.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let i=0,s=this.targetChangeHandlerKeys_.length;i<s;++i)it(this.targetChangeHandlerKeys_[i]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(Y.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(Y.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!Te(this.targetElement_)){this.resizeObserver_?.unobserve(this.targetElement_);const i=this.targetElement_.getRootNode();i instanceof ShadowRoot&&this.resizeObserver_.unobserve(i.host),this.setSize(void 0)}const t=this.getTarget(),e=typeof t=="string"?document.getElementById(t):t;if(this.targetElement_=e,!e)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{if(Te(e)||e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new id(this)),!Te(e)){this.mapBrowserEventHandler_=new Nl(this,this.moveTolerance_);for(const s in rt)this.mapBrowserEventHandler_.addEventListener(rt[s],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(Y.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(Y.WHEEL,this.boundHandleBrowserEvent_,sa?{passive:!1}:!1);let i;if(this.keyboardEventTarget_)i=this.keyboardEventTarget_;else{const s=e.getRootNode();i=s instanceof ShadowRoot?s.host:e}if(this.targetChangeHandlerKeys_=[j(i,Y.KEYDOWN,this.handleBrowserEvent,this),j(i,Y.KEYPRESS,this.handleBrowserEvent,this)],e instanceof HTMLElement){const s=e.getRootNode();s instanceof ShadowRoot&&this.resizeObserver_.observe(s.host),this.resizeObserver_?.observe(e)}}this.updateSize()}}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(it(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(it(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=j(t,fi.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=j(t,Y.CHANGE,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(it),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new Re("addlayer",t)),this.layerGroupPropertyListenerKeys_=[j(t,fi.PROPERTYCHANGE,this.render,this),j(t,Y.CHANGE,this.render,this),j(t,"addlayer",this.handleLayerAdd_,this),j(t,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;const t=this.frameState_.layerStatesArray;for(let e=0,i=t.length;e<i;++e){const s=t[e].layer;s.hasRenderer()&&s.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){return this.getLayerGroup().getLayers().remove(t)}handleLayerRemove_(t){nl(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),i=this.getView(),s=this.frameState_;let r=null;if(e!==void 0&&Io(e)&&i&&i.isDef()){const o=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=i.getState();if(r={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:Bs(a.center,a.resolution,a.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:H(this),renderTargets:{}},a.nextCenter&&a.nextResolution){const l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;r.nextExtent=Bs(a.nextCenter,a.nextResolution,l,e)}}this.frameState_=r,this.renderer_.renderFrame(r),r&&(r.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,r.postRenderFunctions),s&&(!this.previousExtent_||!rn(this.previousExtent_)&&!Ui(r.extent,this.previousExtent_))&&(this.dispatchEvent(new ii(we.MOVESTART,this,s)),this.previousExtent_=jn(this.previousExtent_)),this.previousExtent_&&!r.viewHints[_t.ANIMATING]&&!r.viewHints[_t.INTERACTING]&&!Ui(r.extent,this.previousExtent_)&&(this.dispatchEvent(new ii(we.MOVEEND,this,r)),ra(r.extent,this.previousExtent_))),this.dispatchEvent(new ii(we.POSTRENDER,this,r)),this.renderComplete_=(this.hasListener(we.LOADSTART)||this.hasListener(we.LOADEND)||this.hasListener(Ft.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new Re("removelayer",e)),this.set(gt.LAYERGROUP,t)}setSize(t){this.set(gt.SIZE,t)}setTarget(t){this.set(gt.TARGET,t)}setView(t){if(!t||t instanceof ae){this.set(gt.VIEW,t);return}this.set(gt.VIEW,new ae);const e=this;t.then(function(i){e.setView(new ae(i))})}updateSize(){const t=this.getTargetElement();let e;if(t){let s,r;if(Te(t)){const o=t.getContext("2d").getTransform();s=t.width/o.a,r=t.height/o.d}else{const o=getComputedStyle(t);s=t.offsetWidth-parseFloat(o.borderLeftWidth)-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight)-parseFloat(o.borderRightWidth),r=t.offsetHeight-parseFloat(o.borderTopWidth)-parseFloat(o.paddingTop)-parseFloat(o.paddingBottom)-parseFloat(o.borderBottomWidth)}!isNaN(s)&&!isNaN(r)&&(e=[Math.max(0,s),Math.max(0,r)],!Io(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&ma("No map visible because the map container's width or height are 0."))}const i=this.getSize();e&&(!i||!Me(e,i))&&(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}}function nd(n){let t=null;n.keyboardEventTarget!==void 0&&(t=typeof n.keyboardEventTarget=="string"?document.getElementById(n.keyboardEventTarget):n.keyboardEventTarget);const e={},i=n.layers&&typeof n.layers.getLayers=="function"?n.layers:new Ci({layers:n.layers});e[gt.LAYERGROUP]=i,e[gt.TARGET]=n.target,e[gt.VIEW]=n.view instanceof ae?n.view:new ae;let s;n.controls!==void 0&&(Array.isArray(n.controls)?s=new Pt(n.controls.slice()):(J(typeof n.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),s=n.controls));let r;n.interactions!==void 0&&(Array.isArray(n.interactions)?r=new Pt(n.interactions.slice()):(J(typeof n.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),r=n.interactions));let o;return n.overlays!==void 0?Array.isArray(n.overlays)?o=new Pt(n.overlays.slice()):(J(typeof n.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=n.overlays):o=new Pt,{controls:s,interactions:r,keyboardEventTarget:t,overlays:o,values:e}}class Nr{constructor(t,e,i,s){this.minX=t,this.maxX=e,this.minY=i,this.maxY=s}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function Qe(n,t,e,i,s){return s!==void 0?(s.minX=n,s.maxX=t,s.minY=e,s.maxY=i,s):new Nr(n,t,e,i)}function Yn(n,t,e,i){return i!==void 0?(i[0]=n,i[1]=t,i[2]=e,i):[n,t,e]}function sd(n,t,e){return n+"/"+t+"/"+e}function Mn(n,t,e,i,s){return`${H(n)},${t},${sd(e,i,s)}`}function rd(n){return od(n[0],n[1],n[2])}function od(n,t,e){return(t<<n)+e}function ad(n,t){const e=n[0],i=n[1],s=n[2];if(t.getMinZoom()>e||e>t.getMaxZoom())return!1;const r=t.getFullTileRange(e);return r?r.containsXY(i,s):!0}const ti=[0,0,0],pe=5;class rl{constructor(t){this.minZoom=t.minZoom!==void 0?t.minZoom:0,this.resolutions_=t.resolutions,J(Ml(this.resolutions_,(s,r)=>r-s),"`resolutions` must be sorted in descending order");let e;if(!t.origins){for(let s=0,r=this.resolutions_.length-1;s<r;++s)if(!e)e=this.resolutions_[s]/this.resolutions_[s+1];else if(this.resolutions_[s]/this.resolutions_[s+1]!==e){e=void 0;break}}this.zoomFactor_=e,this.maxZoom=this.resolutions_.length-1,this.origin_=t.origin!==void 0?t.origin:null,this.origins_=null,t.origins!==void 0&&(this.origins_=t.origins,J(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const i=t.extent;i!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=Ue(i)),J(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,t.tileSizes!==void 0&&(this.tileSizes_=t.tileSizes,J(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=t.tileSize!==void 0?t.tileSize:this.tileSizes_?null:Tr,J(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=i!==void 0?i:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],t.sizes!==void 0?this.fullTileRanges_=t.sizes.map((s,r)=>{const o=new Nr(Math.min(0,s[0]),Math.max(s[0]-1,-1),Math.min(0,s[1]),Math.max(s[1]-1,-1));if(i){const a=this.getTileRangeForExtentAndZ(i,r);o.minX=Math.max(a.minX,o.minX),o.maxX=Math.min(a.maxX,o.maxX),o.minY=Math.max(a.minY,o.minY),o.maxY=Math.min(a.maxY,o.maxY)}return o}):i&&this.calculateTileRanges_(i)}forEachTileCoord(t,e,i){const s=this.getTileRangeForExtentAndZ(t,e);for(let r=s.minX,o=s.maxX;r<=o;++r)for(let a=s.minY,l=s.maxY;a<=l;++a)i([e,r,a])}forEachTileCoordParentTileRange(t,e,i,s){let r,o,a,l=null,c=t[0]-1;for(this.zoomFactor_===2?(o=t[1],a=t[2]):l=this.getTileCoordExtent(t,s);c>=this.minZoom;){if(o!==void 0&&a!==void 0?(o=Math.floor(o/2),a=Math.floor(a/2),r=Qe(o,o,a,a,i)):r=this.getTileRangeForExtentAndZ(l,c,i),e(c,r))return!0;--c}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getOrigins(){return this.origins_}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]<this.maxZoom){if(this.zoomFactor_===2){const r=t[1]*2,o=t[2]*2;return Qe(r,r+1,o,o+1,e)}const s=this.getTileCoordExtent(t,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(s,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,i){if(e>this.maxZoom||e<this.minZoom)return null;const s=t[0],r=t[1],o=t[2];if(e===s)return Qe(r,o,r,o,i);if(this.zoomFactor_){const l=Math.pow(this.zoomFactor_,e-s),c=Math.floor(r*l),h=Math.floor(o*l);if(e<s)return Qe(c,c,h,h,i);const u=Math.floor(l*(r+1))-1,d=Math.floor(l*(o+1))-1;return Qe(c,u,h,d,i)}const a=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,e,i)}getTileRangeForExtentAndZ(t,e,i){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,ti);const s=ti[1],r=ti[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,ti);const o=ti[1],a=ti[2];return Qe(s,o,r,a,i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),s=It(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*s[0]*i,e[1]-(t[2]+.5)*s[1]*i]}getTileCoordExtent(t,e){const i=this.getOrigin(t[0]),s=this.getResolution(t[0]),r=It(this.getTileSize(t[0]),this.tmpSize_),o=i[0]+t[1]*r[0]*s,a=i[1]-(t[2]+1)*r[1]*s,l=o+r[0]*s,c=a+r[1]*s;return Ae(o,a,l,c,e)}getTileCoordForCoordAndResolution(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,i)}getTileCoordForXYAndResolution_(t,e,i,s,r){const o=this.getZForResolution(i),a=i/this.getResolution(o),l=this.getOrigin(o),c=It(this.getTileSize(o),this.tmpSize_);let h=a*(t-l[0])/i/c[0],u=a*(l[1]-e)/i/c[1];return s?(h=En(h,pe)-1,u=En(u,pe)-1):(h=yn(h,pe),u=yn(u,pe)),Yn(o,h,u,r)}getTileCoordForXYAndZ_(t,e,i,s,r){const o=this.getOrigin(i),a=this.getResolution(i),l=It(this.getTileSize(i),this.tmpSize_);let c=(t-o[0])/a/l[0],h=(o[1]-e)/a/l[1];return s?(c=En(c,pe)-1,h=En(h,pe)-1):(c=yn(c,pe),h=yn(h,pe)),Yn(i,c,h,r)}getTileCoordForCoordAndZ(t,e,i){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,i)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){const i=sr(this.resolutions_,t,e||0);return nt(i,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return Pa(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,i=new Array(e);for(let s=this.minZoom;s<e;++s)i[s]=this.getTileRangeForExtentAndZ(t,s);this.fullTileRanges_=i}}function ol(n){let t=n.getDefaultTileGrid();return t||(t=ud(n),n.setDefaultTileGrid(t)),t}function ld(n,t,e){const i=t[0],s=n.getTileCoordCenter(t),r=Gr(e);if(!_i(r,s)){const o=tt(r),a=Math.ceil((r[0]-s[0])/o);return s[0]+=o*a,n.getTileCoordForCoordAndZ(s,i)}return t}function hd(n,t,e,i){i=i!==void 0?i:"top-left";const s=al(n,t,e);return new rl({extent:n,origin:Ul(n,i),resolutions:s,tileSize:e})}function cd(n){const t=n||{},e=t.extent||Tt("EPSG:3857").getExtent(),i={extent:e,minZoom:t.minZoom,tileSize:t.tileSize,resolutions:al(e,t.maxZoom,t.tileSize,t.maxResolution)};return new rl(i)}function al(n,t,e,i){t=t!==void 0?t:rc,e=It(e!==void 0?e:Tr);const s=Et(n),r=tt(n);i=i>0?i:Math.max(r/e[0],s/e[1]);const o=t+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=i/Math.pow(2,l);return a}function ud(n,t,e,i){const s=Gr(n);return hd(s,t,e,i)}function Gr(n){n=Tt(n);let t=n.getExtent();if(!t){const e=180*hr.degrees/n.getMetersPerUnit();t=Ae(-e,-e,e,e)}return t}class zr extends Un{constructor(t,e,i){super(),i=i||{},this.tileCoord=t,this.state=e,this.key="",this.transition_=i.transition===void 0?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(Y.CHANGE)}release(){this.setState(b.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==b.EMPTY){if(this.state!==b.ERROR&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){V()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(!i)i=e,this.transitionStarts_[t]=i;else if(i===-1)return 1;const s=e-i+1e3/60;return s>=this.transition_?1:_a(s/this.transition_)}inTransition(t){return this.transition_?this.transitionStarts_[t]!==-1:!1}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}disposeInternal(){this.release(),super.disposeInternal()}}class ll extends zr{constructor(t,e,i,s,r,o){super(t,e,o),this.crossOrigin_=s?.crossOrigin,this.referrerPolicy_=s?.referrerPolicy,this.src_=i,this.key=i,this.image_,Dt?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=b.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=b.ERROR,this.unlistenImage_(),this.image_=dd(),this.changed()}handleImageLoad_(){if(Dt)this.state=b.LOADED;else{const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=b.LOADED:this.state=b.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==b.ERROR&&(this.state=b.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==b.IDLE&&(this.state=b.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=Tu(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}}function dd(){const n=ot(1,1);return n.fillStyle="rgba(0,0,0,0)",n.fillRect(0,0,1,1),n.canvas}let Fs;const di=[];function No(n,t,e,i,s){n.beginPath(),n.moveTo(0,0),n.lineTo(t,e),n.lineTo(i,s),n.closePath(),n.save(),n.clip(),n.fillRect(0,0,Math.max(t,i)+1,Math.max(e,s)),n.restore()}function ks(n,t){return Math.abs(n[t*4]-210)>2||Math.abs(n[t*4+3]-.75*255)>2}function fd(){if(Fs===void 0){const n=ot(6,6,di);n.globalCompositeOperation="lighter",n.fillStyle="rgba(210, 0, 0, 0.75)",No(n,4,5,4,0),No(n,4,5,0,5);const t=n.getImageData(0,0,3,3).data;Fs=ks(t,0)||ks(t,4)||ks(t,8),es(n),di.push(n.canvas)}return Fs}function Go(n,t,e,i){const s=mr(e,t,n);let r=ao(t,i,e);const o=t.getMetersPerUnit();o!==void 0&&(r*=o);const a=n.getMetersPerUnit();a!==void 0&&(r/=a);const l=n.getExtent();if(!l||_i(l,s)){const c=ao(n,r,s)/r;isFinite(c)&&c>0&&(r/=c)}return r}function gd(n,t,e,i){const s=Ke(e);let r=Go(n,t,s,i);return(!isFinite(r)||r<=0)&&ca(e,function(o){return r=Go(n,t,o,i),isFinite(r)&&r>0}),r}function _d(n,t,e,i,s,r,o,a,l,c,h,u,d,f){const g=ot(Math.round(e*n),Math.round(e*t),di);if(u||(g.imageSmoothingEnabled=!1),l.length===0)return g.canvas;g.scale(e,e);function m(x){return Math.round(x*e)/e}g.globalCompositeOperation="lighter";const _=Gt();l.forEach(function(x,S,L){Zl(_,x.extent)});let y;const E=e/i,C=(u?1:1+Math.pow(2,-24))/E;y=ot(Math.round(tt(_)*E),Math.round(Et(_)*E),di),u||(y.imageSmoothingEnabled=!1),l.forEach(function(x,S,L){if(x.image.width>0&&x.image.height>0){if(x.clipExtent){y.save();const P=(x.clipExtent[0]-_[0])*E,M=-(x.clipExtent[3]-_[3])*E,K=tt(x.clipExtent)*E,A=Et(x.clipExtent)*E;y.rect(u?P:Math.round(P),u?M:Math.round(M),u?K:Math.round(P+K)-Math.round(P),u?A:Math.round(M+A)-Math.round(M)),y.clip()}const I=(x.extent[0]-_[0])*E,R=-(x.extent[3]-_[3])*E,v=tt(x.extent)*E,k=Et(x.extent)*E;y.drawImage(x.image,c,c,x.image.width-2*c,x.image.height-2*c,u?I:Math.round(I),u?R:Math.round(R),u?v:Math.round(I+v)-Math.round(I),u?k:Math.round(R+k)-Math.round(R)),x.clipExtent&&y.restore()}});const p=Ue(o);return a.getTriangles().forEach(function(x,S,L){const I=x.source,R=x.target;let v=I[0][0],k=I[0][1],P=I[1][0],M=I[1][1],K=I[2][0],A=I[2][1];const z=m((R[0][0]-p[0])/r),G=m(-(R[0][1]-p[1])/r),F=m((R[1][0]-p[0])/r),D=m(-(R[1][1]-p[1])/r),B=m((R[2][0]-p[0])/r),U=m(-(R[2][1]-p[1])/r),q=v,et=k;v=0,k=0,P-=q,M-=et,K-=q,A-=et;const mt=[[P,M,0,0,F-z],[K,A,0,0,B-z],[0,0,P,M,D-G],[0,0,K,A,U-G]],T=Yl(mt);if(!T)return;if(g.save(),g.beginPath(),fd()||!u){g.moveTo(F,D);const lt=4,zt=z-F,Ut=G-D;for(let Lt=0;Lt<lt;Lt++)g.lineTo(F+m((Lt+1)*zt/lt),D+m(Lt*Ut/(lt-1))),Lt!=lt-1&&g.lineTo(F+m((Lt+1)*zt/lt),D+m((Lt+1)*Ut/(lt-1)));g.lineTo(B,U)}else g.moveTo(F,D),g.lineTo(z,G),g.lineTo(B,U);g.clip(),g.transform(T[0],T[2],T[1],T[3],z,G),g.translate(_[0]-q,_[3]-et);let vt;if(y)vt=y.canvas,g.scale(C,-C);else{const lt=l[0],zt=lt.extent;vt=lt.image,g.scale(tt(zt)/vt.width,-Et(zt)/vt.height)}g.drawImage(vt,0,0),g.restore()}),y&&(es(y),di.push(y.canvas)),h&&(g.save(),g.globalCompositeOperation="source-over",g.strokeStyle="black",g.lineWidth=1,a.getTriangles().forEach(function(x,S,L){const I=x.target,R=(I[0][0]-p[0])/r,v=-(I[0][1]-p[1])/r,k=(I[1][0]-p[0])/r,P=-(I[1][1]-p[1])/r,M=(I[2][0]-p[0])/r,K=-(I[2][1]-p[1])/r;g.beginPath(),g.moveTo(k,P),g.lineTo(R,v),g.lineTo(M,K),g.closePath(),g.stroke()}),g.restore()),g.canvas}const md=10,zo=.25;class pd{constructor(t,e,i,s,r,o,a){this.sourceProj_=t,this.targetProj_=e;let l={};const c=a?Lh(C=>ct(a,mr(C,this.targetProj_,this.sourceProj_))):Nn(this.targetProj_,this.sourceProj_);this.transformInv_=function(C){const p=C[0]+"/"+C[1];return l[p]||(l[p]=c(C)),l[p]},this.maxSourceExtent_=s,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&tt(s)>=tt(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?tt(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?tt(this.targetProj_.getExtent()):null;const h=Ue(i),u=$n(i),d=qn(i),f=Hn(i),g=this.transformInv_(h),m=this.transformInv_(u),_=this.transformInv_(d),y=this.transformInv_(f),E=md+(o?Math.max(0,Math.ceil(Math.log2(Zs(i)/(o*o*256*256)))):0);if(this.addQuad_(h,u,d,f,g,m,_,y,E),this.wrapsXInSource_){let C=1/0;this.triangles_.forEach(function(p,x,S){C=Math.min(C,p.source[0][0],p.source[1][0],p.source[2][0])}),this.triangles_.forEach(p=>{if(Math.max(p.source[0][0],p.source[1][0],p.source[2][0])-C>this.sourceWorldWidth_/2){const x=[[p.source[0][0],p.source[0][1]],[p.source[1][0],p.source[1][1]],[p.source[2][0],p.source[2][1]]];x[0][0]-C>this.sourceWorldWidth_/2&&(x[0][0]-=this.sourceWorldWidth_),x[1][0]-C>this.sourceWorldWidth_/2&&(x[1][0]-=this.sourceWorldWidth_),x[2][0]-C>this.sourceWorldWidth_/2&&(x[2][0]-=this.sourceWorldWidth_);const S=Math.min(x[0][0],x[1][0],x[2][0]);Math.max(x[0][0],x[1][0],x[2][0])-S<this.sourceWorldWidth_/2&&(p.source=x)}})}l={}}addTriangle_(t,e,i,s,r,o){this.triangles_.push({source:[s,r,o],target:[t,e,i]})}addQuad_(t,e,i,s,r,o,a,l,c){const h=Jr([r,o,a,l]),u=this.sourceWorldWidth_?tt(h)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,f=this.sourceProj_.canWrapX()&&u>.5&&u<1;let g=!1;if(c>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const _=Jr([t,e,i,s]);g=tt(_)/this.targetWorldWidth_>zo||g}!f&&this.sourceProj_.isGlobal()&&u&&(g=u>zo||g)}if(!g&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3])&&!Rt(h,this.maxSourceExtent_))return;let m=0;if(!g&&(!isFinite(r[0])||!isFinite(r[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(c>0)g=!0;else if(m=(!isFinite(r[0])||!isFinite(r[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),m!=1&&m!=2&&m!=4&&m!=8)return}if(c>0){if(!g){const _=[(t[0]+i[0])/2,(t[1]+i[1])/2],y=this.transformInv_(_);let E;f?E=(hi(r[0],d)+hi(a[0],d))/2-hi(y[0],d):E=(r[0]+a[0])/2-y[0];const C=(r[1]+a[1])/2-y[1];g=E*E+C*C>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const _=[(e[0]+i[0])/2,(e[1]+i[1])/2],y=this.transformInv_(_),E=[(s[0]+t[0])/2,(s[1]+t[1])/2],C=this.transformInv_(E);this.addQuad_(t,e,_,E,r,o,y,C,c-1),this.addQuad_(E,_,i,s,C,y,a,l,c-1)}else{const _=[(t[0]+e[0])/2,(t[1]+e[1])/2],y=this.transformInv_(_),E=[(i[0]+s[0])/2,(i[1]+s[1])/2],C=this.transformInv_(E);this.addQuad_(t,_,E,s,r,y,C,l,c-1),this.addQuad_(_,e,i,E,y,o,a,C,c-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(m&11)==0&&this.addTriangle_(t,i,s,r,a,l),(m&14)==0&&this.addTriangle_(t,i,e,r,a,o),m&&((m&13)==0&&this.addTriangle_(e,s,t,o,l,r),(m&7)==0&&this.addTriangle_(e,s,i,o,l,a))}calculateSourceExtent(){const t=Gt();return this.triangles_.forEach(function(e,i,s){const r=e.source;Wi(t,r[0]),Wi(t,r[1]),Wi(t,r[2])}),t}getTriangles(){return this.triangles_}}const yd=.5;class hl extends zr{constructor(t,e,i,s,r,o,a,l,c,h,u,d){super(r,b.IDLE,d),this.renderEdges_=u!==void 0?u:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=s,this.wrappedTileCoord_=o||r,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;const f=s.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let m=this.sourceTileGrid_.getExtent();const _=g?Xe(f,g):f;if(Zs(_)===0){this.state=b.EMPTY;return}const y=t.getExtent();y&&(m?m=Xe(m,y):m=y);const E=s.getResolution(this.wrappedTileCoord_[0]),C=gd(t,i,_,E);if(!isFinite(C)||C<=0){this.state=b.EMPTY;return}const p=h!==void 0?h:yd;if(this.triangulation_=new pd(t,i,_,m,C*p,E),this.triangulation_.getTriangles().length===0){this.state=b.EMPTY;return}this.sourceZ_=e.getZForResolution(C);let x=this.triangulation_.calculateSourceExtent();if(m&&(t.canWrapX()?(x[1]=nt(x[1],m[1],m[3]),x[3]=nt(x[3],m[1],m[3])):x=Xe(x,m)),!Zs(x))this.state=b.EMPTY;else{let S=0,L=0;t.canWrapX()&&(S=tt(y),L=Math.floor((x[0]-y[0])/S)),fa(x.slice(),t,!0).forEach(R=>{const v=e.getTileRangeForExtentAndZ(R,this.sourceZ_);for(let k=v.minX;k<=v.maxX;k++)for(let P=v.minY;P<=v.maxY;P++){const M=L*S;this.sourceTiles_.push({getTile:()=>c(this.sourceZ_,k,P,a),offset:M})}++L}),this.sourceTiles_.length===0&&(this.state=b.EMPTY)}}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{const i=e.tile;if(i&&i.getState()==b.LOADED){const s=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);s[0]+=e.offset,s[2]+=e.offset;const r=this.clipExtent_?.slice();r&&(r[0]+=e.offset,r[2]+=e.offset),t.push({extent:s,clipExtent:r,image:i.getImage()})}}),this.sourceTiles_.length=0,t.length===0)this.state=b.ERROR;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),s=typeof i=="number"?i:i[0],r=typeof i=="number"?i:i[1],o=this.targetTileGrid_.getResolution(e),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=_d(s,r,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=b.LOADED}this.changed()}load(){for(const t of this.sourceTiles_)t.tile=t.getTile();if(this.state==b.IDLE){this.state=b.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{const i=e.getState();if(i==b.IDLE||i==b.LOADING){t++;const s=j(e,Y.CHANGE,r=>{const o=e.getState();(o==b.LOADED||o==b.ERROR||o==b.EMPTY)&&(it(s),t--,t===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(s)}}),t===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:e},i,s){e.getState()==b.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(it),this.sourcesListenerKeys_=null}release(){this.canvas_&&(es(this.canvas_.getContext("2d")),di.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}}const Ed=/\{z\}/g,xd=/\{x\}/g,Cd=/\{y\}/g,wd=/\{-y\}/g;function Rd(n,t,e,i,s){return n.replace(Ed,t.toString()).replace(xd,e.toString()).replace(Cd,i.toString()).replace(wd,function(){if(s===void 0)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(s-i).toString()})}function Id(n){const t=[];let e=/\{([a-z])-([a-z])\}/.exec(n);if(e){const i=e[1].charCodeAt(0),s=e[2].charCodeAt(0);let r;for(r=i;r<=s;++r)t.push(n.replace(e[0],String.fromCharCode(r)));return t}if(e=/\{(\d+)-(\d+)\}/.exec(n),e){const i=parseInt(e[2],10);for(let s=parseInt(e[1],10);s<=i;s++)t.push(n.replace(e[0],s.toString()));return t}return t.push(n),t}function Td(n,t){return(function(e,i,s){if(!e)return;let r;const o=e[0];if(t){const a=t.getFullTileRange(o);a&&(r=a.getHeight()-1)}return Rd(n,o,e[1],e[2],r)})}function Sd(n,t){const e=n.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=Td(n[s],t);return vd(i)}function vd(n){return n.length===1?n[0]:(function(t,e,i){if(!t)return;const s=rd(t),r=hi(s,n.length);return n[r](t,e,i)})}class cl extends Qt{constructor(t){super(),this.projection=Tt(t.projection),this.attributions_=Xo(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible??!0,this.loading=!1,this.state_=t.state!==void 0?t.state:"ready",this.wrapX_=t.wrapX!==void 0?t.wrapX:!1,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;const e=this;this.viewPromise_=new Promise(function(i,s){e.viewResolver=i,e.viewRejector=s})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(t){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=Xo(t),this.changed()}setState(t){this.state_=t,this.changed()}}function Xo(n){return n?typeof n=="function"?n:(Array.isArray(n)||(n=[n]),t=>n):null}class Ld extends cl{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:t.projection,state:t.state,wrapX:t.wrapX,interpolate:t.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=t.tilePixelRatio!==void 0?t.tilePixelRatio:1,this.tileGrid=t.tileGrid!==void 0?t.tileGrid:null;const e=[256,256];this.tileGrid&&It(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tmpSize=[0,0],this.key_=t.key||H(this),this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,s,r,o){return V()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:ol(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const s=this.getTileGridForProjection(i),r=this.getTilePixelRatio(e),o=It(s.getTileSize(t),this.tmpSize);return r==1?o:tu(o,r,this.tmpSize)}getTileCoordForTileUrlFunction(t,e){const i=e!==void 0?e:this.getProjection(),s=e!==void 0?this.getTileGridForProjection(i):this.tileGrid||this.getTileGridForProjection(i);return this.getWrapX()&&i.isGlobal()&&(t=ld(s,t,i)),ad(t,s)?t:null}clear(){}refresh(){this.clear(),super.refresh()}}class Ad extends de{constructor(t,e){super(t),this.tile=e}}const Ns={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};class Xr extends Ld{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===Xr.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=H(e),s=e.getState();let r;s==b.LOADING?(this.tileLoadingKeys_[i]=!0,r=Ns.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=s==b.ERROR?Ns.TILELOADERROR:s==b.LOADED?Ns.TILELOADEND:void 0),r!=null&&this.dispatchEvent(new Ad(r,e))}setTileLoadFunction(t){this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,typeof e<"u"?this.setKey(e):this.changed()}setUrl(t){const e=Id(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join(`
`);this.generateTileUrlFunction_?this.setTileUrlFunction(Sd(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}}class Md extends Xr{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:Od,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate!==void 0?t.interpolate:!0,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=t.crossOrigin!==void 0?t.crossOrigin:null,this.referrerPolicy=t.referrerPolicy,this.tileClass=t.tileClass!==void 0?t.tileClass:ll,this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(t){return this.getProjection()&&t&&!An(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||An(e,t)))return this.tileGrid;const i=H(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=ol(t)),this.tileGridForProjection[i]}createTile_(t,e,i,s,r,o){const a=[t,e,i],l=this.getTileCoordForTileUrlFunction(a,r),c=l?this.tileUrlFunction(l,s,r):void 0,h=new this.tileClass(a,c!==void 0?b.IDLE:b.EMPTY,c!==void 0?c:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return h.key=o,h.addEventListener(Y.CHANGE,this.handleTileChange.bind(this)),h}getTile(t,e,i,s,r,o){const a=this.getProjection();if(!a||!r||An(a,r))return this.getTileInternal(t,e,i,s,a||r);const l=[t,e,i],c=this.getKey(),h=this.getTileGridForProjection(a),u=this.getTileGridForProjection(r),d=this.getTileCoordForTileUrlFunction(l,r),f=new hl(a,h,r,u,l,d,this.getTilePixelRatio(s),this.getGutter(),(g,m,_,y)=>this.getTileInternal(g,m,_,y,a,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return f.key=c,f}getTileInternal(t,e,i,s,r,o){const a=this.getKey(),l=Mn(this,a,t,e,i);if(o&&o.containsKey(l))return o.get(l);const c=this.createTile_(t,e,i,s,r,a);return o?.set(l,c),c}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){const i=Tt(t);if(i){const s=H(i);s in this.tileGridForProjection||(this.tileGridForProjection[s]=e)}}}function Od(n,t){if(Dt){const e=n.getCrossOrigin();let i="same-origin",s="same-origin";e==="anonymous"||e===""?(i="cors",s="omit"):e==="use-credentials"&&(i="cors",s="include");const r={mode:i,credentials:s,referrerPolicy:n.getReferrerPolicy()};fetch(t,r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.blob()}).then(o=>createImageBitmap(o)).then(o=>{const a=n.getImage();a.width=o.width,a.height=o.height,a.getContext("2d").drawImage(o,0,0),o.close?.(),a.dispatchEvent(new Event("load"))}).catch(()=>{n.getImage().dispatchEvent(new Event("error"))});return}n.getImage().src=t}class bd extends Md{constructor(t){t=t||{};const e=t.projection!==void 0?t.projection:"EPSG:3857",i=t.tileGrid!==void 0?t.tileGrid:cd({extent:Gr(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,interpolate:t.interpolate,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX!==void 0?t.wrapX:!0,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.gutter_=t.gutter!==void 0?t.gutter:0}getGutter(){return this.gutter_}}const Pd='&#169; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.';class Af extends bd{constructor(t){t=t||{};let e;t.attributions!==void 0?e=t.attributions:e=[Pd];const i=t.url!==void 0?t.url:"https://tile.openstreetmap.org/{z}/{x}/{y}.png";super({attributions:e,attributionsCollapsible:!1,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin!==void 0?t.crossOrigin:"anonymous",referrerPolicy:t.referrerPolicy||"origin-when-cross-origin",interpolate:t.interpolate,maxZoom:t.maxZoom!==void 0?t.maxZoom:19,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileLoadFunction:t.tileLoadFunction,transition:t.transition,url:i,wrapX:t.wrapX,zDirection:t.zDirection})}}function nr(n){return n instanceof Image||n instanceof HTMLCanvasElement||n instanceof HTMLVideoElement||n instanceof ImageBitmap?n:null}const Dd=new Error("disposed"),Fd=[256,256];class Wo extends zr{constructor(t){const e=b.IDLE;super(t.tileCoord,e,{transition:t.transition,interpolate:t.interpolate}),this.loader_=t.loader,this.data_=null,this.error_=null,this.size_=t.size||null,this.controller_=t.controller||null}getSize(){if(this.size_)return this.size_;const t=nr(this.data_);return t?[t.width,t.height]:Fd}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==b.IDLE&&this.state!==b.ERROR)return;this.state=b.LOADING,this.changed();const t=this;this.loader_().then(function(e){t.data_=e,t.state=b.LOADED,t.changed()}).catch(function(e){t.error_=e,t.state=b.ERROR,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(Dd),this.controller_=null),super.disposeInternal()}}class Yo{constructor(t){this.highWaterMark=t!==void 0?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const t=this.pop();t instanceof Zn&&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 J(i!==void 0,"Tried to get a value for a key that does not exist in the cache"),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_}remove(t){const e=this.entries_[t];return J(e!==void 0,"Tried to get a value for a key that does not exist in the cache"),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e=0,i;for(i=this.newest_;i;i=i.older)t[e++]=i.key_;return t}getValues(){const t=new Array(this.count_);let e=0,i;for(i=this.newest_;i;i=i.older)t[e++]=i.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){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){J(!(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}}class ul{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(zn(),{get:(t,e)=>{if(typeof zn()[e]=="function")return this.push_(e),this.pushMethodArgs_},set:(t,e,i)=>(this.push_(e,i),!0)})}push_(...t){const e=this.instructions_,i=this.zIndex+this.offset_;e[i]||(e[i]=[]),e[i].push(...t)}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,s=e.length;i<s;++i){const r=e[i];if(typeof r=="function"){r(t);continue}const o=e[++i];if(typeof t[r]=="function")t[r](...o);else{if(typeof o=="function"){t[r]=o(t);continue}t[r]=o}}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}}const kd=5;class Nd extends sn{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=kd}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return V()}getData(t){return null}prepareFrame(t){return V()}renderFrame(t,e){return V()}forEachFeatureAtCoordinate(t,e,i,s,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;(e.getState()===X.LOADED||e.getState()===X.ERROR)&&this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=X.LOADED&&e!=X.ERROR&&t.addEventListener(Y.CHANGE,this.boundHandleImageChange_),e==X.IDLE&&(t.load(),e=t.getState()),e==X.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&t.getSourceState()==="ready"&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}}const Ko=[];let ri=null;function Gd(){ri=ot(1,1,void 0,{willReadFrequently:!0})}class dl extends Nd{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=Zt(),this.pixelTransform=Zt(),this.inversePixelTransform=Zt(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){ri||Gd(),ri.clearRect(0,0,1,1);let s;try{ri.drawImage(t,e,i,1,1,0,0,1,1),s=ri.getImageData(0,0,1,1).data}catch{return ri=null,null}return s}getBackground(t){let i=this.getLayer().getBackground();return typeof i=="function"&&(i=i(t.viewState.resolution)),i||void 0}useContainer(t,e,i){const s=this.getLayer().getClassName();let r,o;if(t&&t.className===s&&(!i||t&&t.style.backgroundColor&&Me(Ze(t.style.backgroundColor),Ze(i)))){const a=t.firstElementChild;Te(a)&&(o=a.getContext("2d"))}if(o&&Dh(o.canvas.style.transform,e)?(this.container=t,this.context=o,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){r=Dt?Da():document.createElement("div"),r.className=s;let a=r.style;a.position="absolute",a.width="100%",a.height="100%",o=ot();const l=o.canvas;r.appendChild(l),a=l.style,a.position="absolute",a.left="0",a.transformOrigin="top left",this.container=r,this.context=o}!this.containerReused&&i&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const s=Ue(i),r=$n(i),o=qn(i),a=Hn(i);ct(e.coordinateToPixelTransform,s),ct(e.coordinateToPixelTransform,r),ct(e.coordinateToPixelTransform,o),ct(e.coordinateToPixelTransform,a);const l=this.inversePixelTransform;ct(l,s),ct(l,r),ct(l,o),ct(l,a),t.save(),t.beginPath(),t.moveTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.lineTo(Math.round(a[0]),Math.round(a[1])),t.clip()}prepareContainer(t,e){const i=t.extent,s=t.viewState.resolution,r=t.viewState.rotation,o=t.pixelRatio,a=Math.round(tt(i)/s*o),l=Math.round(Et(i)/s*o);ue(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/o,1/o,r,-a/2,-l/2),Ia(this.inversePixelTransform,this.pixelTransform);const c=Ph(this.pixelTransform);if(this.useContainer(e,c,this.getBackground(t)),!this.containerReused){const h=this.context.canvas;h.width!=a||h.height!=l?(h.width=a,h.height=l):this.context.clearRect(0,0,a,l),c!==h.style.transform&&(h.style.transform=c)}}dispatchRenderEvent_(t,e,i){const s=this.getLayer();if(s.hasListener(t)){const r=new il(t,this.inversePixelTransform,i,e);s.dispatchEvent(r)}}preRender(t,e){this.frameState=e,!e.declutter&&this.dispatchRenderEvent_(Ft.PRERENDER,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(Ft.POSTRENDER,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new ul),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(Ft.PRERENDER,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(Ft.POSTRENDER,this.context,t))}getRenderTransform(t,e,i,s,r,o,a){const l=r/2,c=o/2,h=s/e,u=-h,d=-t[0]+a,f=-t[1];return ue(this.tempTransform,l,c,h,u,-i,d,f)}disposeInternal(){delete this.frameState,super.disposeInternal()}}function Gs(n,t,e){if(!(e in n))return n[e]=new Set([t]),!0;const i=n[e],s=i.has(t);return s||i.add(t),!s}function zd(n,t,e){const i=n[e];return i?i.delete(t):!1}function Zo(n,t){const e=n.layerStatesArray[n.layerIndex];e.extent&&(t=Xe(t,Ie(e.extent,n.viewState.projection)));const i=e.layer.getRenderSource();if(!i.getWrapX()){const s=i.getTileGridForProjection(n.viewState.projection).getExtent();s&&(t=Xe(t,s))}return t}class Xd extends dl{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=Gt(),this.tempTileRange_=new Nr(0,0,0,0),this.tempTileCoord_=Yn(0,0,0);const i=e.cacheSize!==void 0?e.cacheSize:512;this.tileCache_=new Yo(i),this.sourceTileCache_=null,this.maxStaleKeys=i*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new Yo(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,s){const r=this.tileCache_,a=this.getLayer().getSource(),l=Mn(a,a.getKey(),t,e,i);let c;if(r.containsKey(l))c=r.get(l);else{const h=s.viewState.projection,u=a.getProjection();if(c=a.getTile(t,e,i,s.pixelRatio,h,!u||An(u,h)?void 0:this.getSourceTileCache()),!c)return null;r.set(l,c)}return c}getTile(t,e,i,s){const r=this.getOrCreateTile(t,e,i,s);return r||null}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),s=ct(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!_i(r,s))return null;const o=e.viewState,a=i.getRenderSource(),l=a.getTileGridForProjection(o.projection),c=a.getTilePixelRatio(e.pixelRatio);for(let h=l.getZForResolution(o.resolution);h>=l.getMinZoom();--h){const u=l.getTileCoordForCoordAndZ(s,h),d=this.getTile(h,u[1],u[2],e);if(!d||d.getState()!==b.LOADED)continue;const f=l.getOrigin(h),g=It(l.getTileSize(h)),m=l.getResolution(h);let _;if(d instanceof ll||d instanceof hl)_=d.getImage();else if(d instanceof Wo){if(_=nr(d.getData()),!_)continue}else continue;const y=Math.floor(c*((s[0]-f[0])/m-u[1]*g[0])),E=Math.floor(c*((f[1]-s[1])/m-u[2]*g[1])),C=Math.round(c*a.getGutterForProjection(o.projection));return this.getImageData(_,y+C,E+C)}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,s,r){const o=t.viewState,a=this.getLayer(),l=a.getRenderSource(),c=l.getTileGridForProjection(o.projection),h=H(l);h in t.wantedTiles||(t.wantedTiles[h]={});const u=t.wantedTiles[h],d=a.getMapInternal(),f=Math.max(i-r,c.getMinZoom(),c.getZForResolution(Math.min(a.getMaxResolution(),d?d.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):c.getResolution(0)),l.zDirection)),g=o.rotation,m=g?ua(o.center,o.resolution,g,t.size):void 0;for(let _=i;_>=f;--_){const y=c.getTileRangeForExtentAndZ(e,_,this.tempTileRange_),E=c.getResolution(_);for(let C=y.minX;C<=y.maxX;++C)for(let p=y.minY;p<=y.maxY;++p){if(g&&!c.tileCoordIntersectsViewport([_,C,p],m))continue;const x=this.getTile(_,C,p,t);if(!x||!Gs(s,x,_))continue;const L=x.getKey();if(u[L]=!0,x.getState()===b.IDLE&&!t.tileQueue.isKeyQueued(L)){const I=Yn(_,C,p,this.tempTileCoord_);t.tileQueue.enqueue([x,h,c.getTileCoordCenter(I),E])}}}}findStaleTile_(t,e){const i=this.tileCache_,s=t[0],r=t[1],o=t[2],a=this.getStaleKeys();for(let l=0;l<a.length;++l){const c=Mn(this.getLayer().getSource(),a[l],s,r,o);if(i.containsKey(c)){const h=i.peek(c);if(h.getState()===b.LOADED)return h.endTransition(H(this)),Gs(e,h,s),!0}}return!1}findAltTiles_(t,e,i,s){const r=t.getTileRangeForTileCoordAndZ(e,i,this.tempTileRange_);if(!r)return!1;let o=!0;const a=this.tileCache_,l=this.getLayer().getRenderSource(),c=l.getKey();for(let h=r.minX;h<=r.maxX;++h)for(let u=r.minY;u<=r.maxY;++u){const d=Mn(l,c,i,h,u);let f=!1;if(a.containsKey(d)){const g=a.peek(d);g.getState()===b.LOADED&&(Gs(s,g,i),f=!0)}f||(o=!1)}return o}renderFrame(t,e){this.renderComplete=!0;const i=t.layerStatesArray[t.layerIndex],s=t.viewState,r=s.projection,o=s.resolution,a=s.center,l=t.pixelRatio,c=this.getLayer(),h=c.getSource(),u=h.getTileGridForProjection(r),d=u.getZForResolution(o,h.zDirection),f=u.getResolution(d),g=h.getKey();this.renderedSourceKey_?this.renderedSourceKey_!==g&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=g):this.renderedSourceKey_=g;let m=t.extent;const _=h.getTilePixelRatio(l);this.prepareContainer(t,e);const y=this.context.canvas.width,E=this.context.canvas.height,C=i.extent&&Ie(i.extent);C&&(m=Xe(m,Ie(i.extent)));const p=f*y/2/_,x=f*E/2/_,S=[a[0]-p,a[1]-x,a[0]+p,a[1]+x],L={};this.renderedTiles.length=0;const I=c.getPreload();if(t.nextExtent&&this.enqueueTilesForNextExtent()){const F=u.getZForResolution(s.nextResolution,h.zDirection),D=Zo(t,t.nextExtent);this.enqueueTiles(t,D,F,L,I)}const R=Zo(t,m);if(this.enqueueTiles(t,R,d,L,0),I>0&&setTimeout(()=>{this.enqueueTiles(t,R,d-1,L,I-1)},0),!(d in L))return this.container;const v=H(this),k=t.time;for(const F of L[d]){const D=F.getState();if(D===b.EMPTY)continue;const B=F.tileCoord;if(D===b.LOADED&&F.getAlpha(v,k)===1){F.endTransition(v);continue}if(D!==b.ERROR&&(this.renderComplete=!1),this.findStaleTile_(B,L)){zd(L,F,d),t.animate=!0;continue}if(this.findAltTiles_(u,B,d+1,L))continue;const et=u.getMinZoom();for(let mt=d-1;mt>=et&&!this.findAltTiles_(u,B,mt,L);--mt);}const P=f/o*l/_,M=this.getRenderContext(t);ue(this.tempTransform,y/2,E/2,P,P,0,-y/2,-E/2),i.extent&&this.clipUnrotated(M,t,C),h.getInterpolate()||(M.imageSmoothingEnabled=!1),this.preRender(M,t);const K=Object.keys(L).map(Number);K.sort(le);let A;const z=[],G=[];for(let F=K.length-1;F>=0;--F){const D=K[F],B=h.getTilePixelSize(D,l,r),q=u.getResolution(D)/f,et=B[0]*q*P,mt=B[1]*q*P,T=u.getTileCoordForCoordAndZ(Ue(S),D),vt=u.getTileCoordExtent(T),lt=ct(this.tempTransform,[_*(vt[0]-S[0])/f,_*(S[3]-vt[3])/f]),zt=_*h.getGutterForProjection(r);for(const Ut of L[D]){if(Ut.getState()!==b.LOADED)continue;const Lt=Ut.tileCoord,wi=T[1]-Lt[1],un=Math.round(lt[0]-(wi-1)*et),Ri=T[2]-Lt[2],us=Math.round(lt[1]-(Ri-1)*mt),Vt=Math.round(lt[0]-wi*et),Xt=Math.round(lt[1]-Ri*mt),jt=un-Vt,ge=us-Xt,dn=K.length===1;let Ii=!1;A=[Vt,Xt,Vt+jt,Xt,Vt+jt,Xt+ge,Vt,Xt+ge];for(let je=0,fn=z.length;je<fn;++je)if(!dn&&D<G[je]){const ft=z[je];Rt([Vt,Xt,Vt+jt,Xt+ge],[ft[0],ft[3],ft[4],ft[7]])&&(Ii||(M.save(),Ii=!0),M.beginPath(),M.moveTo(A[0],A[1]),M.lineTo(A[2],A[3]),M.lineTo(A[4],A[5]),M.lineTo(A[6],A[7]),M.moveTo(ft[6],ft[7]),M.lineTo(ft[4],ft[5]),M.lineTo(ft[2],ft[3]),M.lineTo(ft[0],ft[1]),M.clip())}z.push(A),G.push(D),this.drawTile(Ut,t,Vt,Xt,jt,ge,zt,dn),Ii&&M.restore(),this.renderedTiles.unshift(Ut),this.updateUsedTiles(t.usedTiles,h,Ut)}}if(this.renderedResolution=f,this.extentChanged=!this.renderedExtent_||!Ui(this.renderedExtent_,S),this.renderedExtent_=S,this.renderedPixelRatio=l,this.postRender(this.context,t),i.extent&&M.restore(),M.imageSmoothingEnabled=!0,this.renderComplete){const F=(D,B)=>{const U=H(h),q=B.wantedTiles[U],et=q?Object.keys(q).length:0;this.updateCacheSize(et),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};t.postRenderFunctions.push(F)}return this.container}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,t*2)}drawTile(t,e,i,s,r,o,a,l){let c;if(t instanceof Wo){if(c=nr(t.getData()),!c)throw new Error("Rendering array data is not yet supported")}else c=this.getTileImage(t);if(!c)return;const h=this.getRenderContext(e),u=H(this),d=e.layerStatesArray[e.layerIndex],f=d.opacity*(l?t.getAlpha(u,e.time):1),g=f!==h.globalAlpha;g&&(h.save(),h.globalAlpha=f),h.drawImage(c,a,a,c.width-2*a,c.height-2*a,i,s,r,o),g&&h.restore(),f!==d.opacity?e.animate=!0:l&&t.endTransition(u)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}updateUsedTiles(t,e,i){const s=H(e);s in t||(t[s]={}),t[s][i.getKey()]=!0}}const vn={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class Wd extends is{constructor(t){t=t||{};const e=Object.assign({},t),i=t.cacheSize;delete t.cacheSize,delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=i,this.setPreload(t.preload!==void 0?t.preload:0),this.setUseInterimTilesOnError(t.useInterimTilesOnError!==void 0?t.useInterimTilesOnError:!0)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(vn.PRELOAD)}setPreload(t){this.set(vn.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(vn.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(vn.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}}class Mf extends Wd{constructor(t){super(t)}createRenderer(){return new Xd(this,{cacheSize:this.getCacheSize()})}}class fl extends Qt{constructor(t){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),t)if(typeof t.getSimplifiedGeometry=="function"){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new fl(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_&&(it(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=j(t,Y.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?Yd(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}}function Yd(n){if(typeof n=="function")return n;let t;return Array.isArray(n)?t=n:(J(typeof n.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),t=[n]),function(){return t}}function Bo(n,t,e,i,s,r,o){let a,l;const c=(e-t)/i;if(c===1)a=t;else if(c===2)a=t,l=s;else if(c!==0){let h=n[t],u=n[t+1],d=0;const f=[0];for(let _=t+i;_<e;_+=i){const y=n[_],E=n[_+1];d+=Math.sqrt((y-h)*(y-h)+(E-u)*(E-u)),f.push(d),h=y,u=E}const g=s*d,m=vl(f,g);m<0?(l=(g-f[-m-2])/(f[-m-1]-f[-m-2]),a=t+(-m-2)*i):a=t+m*i}o=o>1?o:2,r=r||new Array(o);for(let h=0;h<o;++h)r[h]=a===void 0?NaN:l===void 0?n[a+h]:St(n[a+h],n[a+i+h],l);return r}function Of(n,t,e,i,s,r){if(e==t)return null;let o;if(s<n[t+i-1])return r?(o=n.slice(t,t+i),o[i-1]=s,o):null;if(n[e-1]<s)return r?(o=n.slice(e-i,e),o[i-1]=s,o):null;if(s==n[t+i-1])return n.slice(t,t+i);let a=t/i,l=e/i;for(;a<l;){const d=a+l>>1;s<n[(d+1)*i-1]?l=d:a=d+1}const c=n[a*i-1];if(s==c)return n.slice((a-1)*i,(a-1)*i+i);const h=n[(a+1)*i-1],u=(s-c)/(h-c);o=[];for(let d=0;d<i-1;++d)o.push(St(n[(a-1)*i+d],n[a*i+d],u));return o.push(s),o}function Kd(n,t,e,i){let s=n[t],r=n[t+1],o=0;for(let a=t+i;a<e;a+=i){const l=n[a],c=n[a+1];o+=Math.sqrt((l-s)*(l-s)+(c-r)*(c-r)),s=l,r=c}return o}function Zd(n,t,e,i,s,r){s=s??[],r=r??t;const o=n[0],a=n[1],l=n[n.length-4],c=n[n.length-3];let h,u,d,f,g,m,_,y,E=0;for(let C=0;C<n.length;C+=t){d=h,f=u,g=void 0,m=void 0,C+t<n.length&&(g=n[C+t],m=n[C+t+1]),i&&C===0&&(d=l,f=c),i&&C===n.length-2&&(g=o,m=a),h=n[C],u=n[C+1],[_,y]=On(h,u,d,f,g,m,e),s[E++]=_,s[E++]=y;for(let p=2;p<r;p++)s[E++]=n[C+p]}return s.length!=E&&(s.length=E),s}function On(n,t,e,i,s,r,o){let a,l;e!==void 0&&i!==void 0?(a=n-e,l=t-i):s!==void 0&&r!==void 0?(a=s-n,l=r-t):(a=1,l=0);const c=Math.hypot(a,l),h=a/c,u=l/c;if(a=-u,l=h,e===void 0||i===void 0)return[n+a*o,t+l*o];if(s===void 0||r===void 0)return[n+a*o,t+l*o];const d=Jl([n,t],[e,i],[s,r]);if(Math.cos(d)>.998)return[n+h*o,t+u*o];const f=Math.cos(d/2),g=Math.sin(d/2),m=g*a+f*l,_=-f*a+g*l,y=m*(1/g),E=_*(1/g);return[n+y*o,t+E*o]}class gl{drawCustom(t,e,i,s,r){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}class Bd extends gl{constructor(t,e,i,s,r,o,a){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=s,this.transformRotation_=s?Vn(Math.atan2(s[1],s[0]),10):0,this.viewRotation_=r,this.squaredTolerance_=o,this.userTransform_=a,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=Zt()}drawImages_(t,e,i,s){if(!this.image_)return;const r=Le(t,e,i,s,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=l*this.imageOpacity_);let c=this.imageRotation_;this.transformRotation_===0&&(c-=this.viewRotation_),this.imageRotateWithView_&&(c+=this.viewRotation_);for(let h=0,u=r.length;h<u;h+=2){const d=r[h]-this.imageAnchorX_,f=r[h+1]-this.imageAnchorY_;if(c!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const g=d+this.imageAnchorX_,m=f+this.imageAnchorY_;ue(a,g,m,1,1,c,-g,-m),o.save(),o.transform.apply(o,a),o.translate(g,m),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.restore()}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,d,f,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(t,e,i,s){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const r=Le(t,e,i,s,this.transform_,this.pixelCoordinates_),o=this.context_;let a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);e<i;e+=s){const l=r[e]+this.textOffsetX_,c=r[e+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.save(),o.translate(l-this.textOffsetX_,c-this.textOffsetY_),o.rotate(a),o.translate(this.textOffsetX_,this.textOffsetY_),o.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&o.strokeText(this.text_,0,0),this.textFillState_&&o.fillText(this.text_,0,0),o.restore()):(this.textStrokeState_&&o.strokeText(this.text_,l,c),this.textFillState_&&o.fillText(this.text_,l,c))}}moveToLineTo_(t,e,i,s,r,o){const a=this.context_;let l=Le(t,e,i,s,this.transform_,this.pixelCoordinates_);Math.abs(o)>0&&(l=Zd(l,s,o,r,l)),a.moveTo(l[0],l[1]);let c=l.length;r&&(c-=2);for(let h=2;h<c;h+=2)a.lineTo(l[h],l[h+1]);return r&&a.closePath(),i}drawRings_(t,e,i,s,r){for(let o=0,a=i.length;o<a;++o)e=this.moveToLineTo_(t,e,i[o],s,!0,r);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Rt(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=Xh(t,this.transform_,this.pixelCoordinates_),i=e[2]-e[0],s=e[3]-e[1],r=Math.sqrt(i*i+s*s),o=this.context_;o.beginPath(),o.arc(e[0],e[1],r,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}this.text_!==""&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t);break}}drawFeature(t,e){const i=e.getGeometryFunction()(t);i&&(this.setStyle(e),this.drawGeometry(i))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let i=0,s=e.length;i<s;++i)this.drawGeometry(e[i])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),this.text_!==""&&this.drawText_(e,0,e.length,i)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),this.text_!==""&&this.drawText_(e,0,e.length,i)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Rt(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(i,0,i.length,t.getStride(),!1,this.strokeState_.strokeOffset),e.stroke()}if(this.text_!==""){const e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getExtent();if(Rt(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const i=this.context_,s=t.getFlatCoordinates();let r=0;const o=t.getEnds(),a=t.getStride();i.beginPath();for(let l=0,c=o.length;l<c;++l)r=this.moveToLineTo_(s,r,o[l],a,!1,this.strokeState_.strokeOffset);i.stroke()}if(this.text_!==""){const i=t.getFlatMidpoints();this.drawText_(i,0,i.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Rt(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.strokeState_?.strokeOffset),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_)),!!Rt(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getOrientedFlatCoordinates();let s=0;const r=t.getEndss(),o=t.getStride();e.beginPath();for(let a=0,l=r.length;a<l;++a){const c=r[a];s=this.drawRings_(i,s,c,o,this.strokeState_?.strokeOffset)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,i=this.contextFillState_;i?i.fillStyle!=t.fillStyle&&(i.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=t.lineCap&&(i.lineCap=t.lineCap,e.lineCap=t.lineCap),Me(i.lineDash,t.lineDash)||e.setLineDash(i.lineDash=t.lineDash),i.lineDashOffset!=t.lineDashOffset&&(i.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),i.lineJoin!=t.lineJoin&&(i.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),i.lineWidth!=t.lineWidth&&(i.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),i.miterLimit!=t.miterLimit&&(i.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),i.strokeStyle!=t.strokeStyle&&(i.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){const e=this.context_,i=this.contextTextState_,s=t.textAlign?t.textAlign:Ji;i?(i.font!=t.font&&(i.font=t.font,e.font=t.font),i.textAlign!=s&&(i.textAlign=s,e.textAlign=s),i.textBaseline!=t.textBaseline&&(i.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=s,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:s,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(!t)this.fillState_=null;else{const i=t.getColor();this.fillState_={fillStyle:$t(i||wt)}}if(!e)this.strokeState_=null;else{const i=e.getColor(),s=e.getLineCap(),r=e.getLineDash(),o=e.getLineDashOffset(),a=e.getLineJoin(),l=e.getWidth(),c=e.getMiterLimit(),h=r||he,u=e.getOffset();this.strokeState_={lineCap:s!==void 0?s:pi,lineDash:this.pixelRatio_===1?h:h.map(d=>d*this.pixelRatio_),lineDashOffset:(o||ce)*this.pixelRatio_,lineJoin:a!==void 0?a:yi,lineWidth:(l!==void 0?l:Qi)*this.pixelRatio_,miterLimit:c!==void 0?c:qi,strokeStyle:$t(i||$i),strokeOffset:(u??0)*this.pixelRatio_}}}setImageStyle(t){let e;if(!t||!(e=t.getSize())){this.image_=null;return}const i=t.getPixelRatio(this.pixelRatio_),s=t.getAnchor(),r=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=s[0]*i,this.imageAnchorY_=s[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const o=t.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/i,o[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(!t)this.text_="";else{const e=t.getFill();if(!e)this.textFillState_=null;else{const f=e.getColor();this.textFillState_={fillStyle:$t(f||wt)}}const i=t.getStroke();if(!i)this.textStrokeState_=null;else{const f=i.getColor(),g=i.getLineCap(),m=i.getLineDash(),_=i.getLineDashOffset(),y=i.getLineJoin(),E=i.getWidth(),C=i.getMiterLimit();this.textStrokeState_={lineCap:g!==void 0?g:pi,lineDash:m||he,lineDashOffset:_||ce,lineJoin:y!==void 0?y:yi,lineWidth:E!==void 0?E:Qi,miterLimit:C!==void 0?C:qi,strokeStyle:$t(f||$i)}}const s=t.getFont(),r=t.getOffsetX(),o=t.getOffsetY(),a=t.getRotateWithView(),l=t.getRotation(),c=t.getScaleArray(),h=t.getText(),u=t.getTextAlign(),d=t.getTextBaseline();this.textState_={font:s!==void 0?s:Va,textAlign:u!==void 0?u:Ji,textBaseline:d!==void 0?d:Xn},this.text_=h!==void 0?Array.isArray(h)?h.reduce((f,g,m)=>f+=m%2?" ":g,""):h:"",this.textOffsetX_=r!==void 0?this.pixelRatio_*r:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*c[0],this.pixelRatio_*c[1]]}}}const Ud=.5,_l={Point:tf,LineString:$d,Polygon:nf,MultiPoint:ef,MultiLineString:Jd,MultiPolygon:Qd,GeometryCollection:qd,Circle:jd};function Vd(n,t){return parseInt(H(n),10)-parseInt(H(t),10)}function Uo(n,t){const e=ml(n,t);return e*e}function ml(n,t){return Ud*n/t}function jd(n,t,e,i,s){const r=e.getFill(),o=e.getStroke();if(r||o){const l=n.getBuilder(e.getZIndex(),"Circle");l.setFillStrokeStyle(r,o),l.drawCircle(t,i,s)}const a=e.getText();if(a&&a.getText()){const l=n.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i)}}function Vo(n,t,e,i,s,r,o,a){const l=[],c=e.getImage();if(c){let d=!0;const f=c.getImageState();f==X.LOADED||f==X.ERROR?d=!1:f==X.IDLE&&c.load(),d&&l.push(c.ready())}const h=e.getFill();h&&h.loading()&&l.push(h.ready());const u=l.length>0;return u&&Promise.all(l).then(()=>s(null)),Hd(n,t,e,i,r,o,a),u}function Hd(n,t,e,i,s,r,o){const a=e.getGeometryFunction()(t);if(!a)return;const l=a.simplifyTransformed(i,s);if(e.getRenderer())pl(n,l,e,t,o);else{const h=_l[l.getType()];h(n,l,e,t,o,r)}}function pl(n,t,e,i,s){if(t.getType()=="GeometryCollection"){const o=t.getGeometries();for(let a=0,l=o.length;a<l;++a)pl(n,o[a],e,i,s);return}n.getBuilder(e.getZIndex(),"Default").drawCustom(t,i,e.getRenderer(),e.getHitDetectionRenderer(),s)}function qd(n,t,e,i,s,r){const o=t.getGeometriesArray();let a,l;for(a=0,l=o.length;a<l;++a){const c=_l[o[a].getType()];c(n,o[a],e,i,s,r)}}function $d(n,t,e,i,s){const r=e.getStroke();if(r){const a=n.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,r),a.drawLineString(t,i,s)}const o=e.getText();if(o&&o.getText()){const a=n.getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,i,s)}}function Jd(n,t,e,i,s){const r=e.getStroke();if(r){const a=n.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,r),a.drawMultiLineString(t,i,s)}const o=e.getText();if(o&&o.getText()){const a=n.getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,i,s)}}function Qd(n,t,e,i,s){const r=e.getFill(),o=e.getStroke();if(o||r){const l=n.getBuilder(e.getZIndex(),"Polygon");l.setFillStrokeStyle(r,o),l.drawMultiPolygon(t,i,s)}const a=e.getText();if(a&&a.getText()){const l=n.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i,s)}}function tf(n,t,e,i,s,r){const o=e.getImage(),a=e.getText(),l=a&&a.getText(),c=r&&o&&l?{}:void 0;if(o){if(o.getImageState()!=X.LOADED)return;const h=n.getBuilder(e.getZIndex(),"Image");h.setImageStyle(o,c),h.drawPoint(t,i,s)}if(l){const h=n.getBuilder(e.getZIndex(),"Text");h.setTextStyle(a,c),h.drawText(t,i,s)}}function ef(n,t,e,i,s,r){const o=e.getImage(),a=o&&o.getOpacity()!==0,l=e.getText(),c=l&&l.getText(),h=r&&a&&c?{}:void 0;if(a){if(o.getImageState()!=X.LOADED)return;const u=n.getBuilder(e.getZIndex(),"Image");u.setImageStyle(o,h),u.drawMultiPoint(t,i,s)}if(c){const u=n.getBuilder(e.getZIndex(),"Text");u.setTextStyle(l,h),u.drawText(t,i,s)}}function nf(n,t,e,i,s){const r=e.getFill(),o=e.getStroke();if(r||o){const l=n.getBuilder(e.getZIndex(),"Polygon");l.setFillStrokeStyle(r,o),l.drawPolygon(t,i,s)}const a=e.getText();if(a&&a.getText()){const l=n.getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i,s)}}let sf=!1;function rf(n,t,e,i,s,r,o){const a=new XMLHttpRequest;a.open("GET",typeof n=="function"?n(e,i,s):n,!0),t.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=sf,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){const c=t.getType();try{let h;c=="text"||c=="json"?h=a.responseText:c=="xml"?h=a.responseXML||a.responseText:c=="arraybuffer"&&(h=a.response),h?r(t.readFeatures(h,{extent:e,featureProjection:s}),t.readProjection(h)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function jo(n,t){return function(e,i,s,r,o){rf(n,t,e,i,s,(a,l)=>{this.addFeatures(a),r!==void 0&&r(a)},()=>{this.changed(),o!==void 0&&o()})}}function of(n,t){return[[-1/0,-1/0,1/0,1/0]]}function af(n,t,e,i){const s=[];let r=Gt();for(let o=0,a=e.length;o<a;++o){const l=e[o];r=ar(n,t,l[0],i),s.push((r[0]+r[2])/2,(r[1]+r[3])/2),t=l[l.length-1]}return s}const Ho=Zt();class Yt{constructor(t,e,i,s,r,o){this.styleFunction,this.extent_,this.id_=o,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=r,this.squaredTolerance_,this.stride_=s,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?la(this.flatCoordinates_):ar(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=Ke(this.getExtent());this.flatInteriorPoints_=xr(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=tc(this.flatCoordinates_,this.ends_),e=af(this.flatCoordinates_,0,t,2);this.flatInteriorPoints_=Hh(this.flatCoordinates_,0,t,2,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=Bo(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const i=this.ends_;for(let s=0,r=i.length;s<r;++s){const o=i[s],a=Bo(t,e,o,2,.5);rr(this.flatMidpoints_,a),e=o}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(t){return this}simplifyTransformed(t,e){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(t){t=Tt(t);const e=t.getExtent(),i=t.getWorldExtent();if(e&&i){const s=Et(i)/Et(e);ue(Ho,i[0],i[3],s,-s,0,0,0),Le(this.flatCoordinates_,0,this.flatCoordinates_.length,2,Ho,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new Yt(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=ea((t,e)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const i=this.simplifiedGeometry_.getFlatCoordinates();let s;switch(this.type_){case"LineString":i.length=yr(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),s=[i.length];break;case"MultiLineString":s=[],i.length=Uh(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,s);break;case"Polygon":s=[],i.length=Ma(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,s);break}return s&&(this.simplifiedGeometry_=new Yt(this.type_,i,s,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}Yt.prototype.getFlatCoordinates=Yt.prototype.getOrientedFlatCoordinates;class qo{constructor(t){this.rbush_=new Wa(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_[H(e)]=i}load(t,e){const i=new Array(e.length);for(let s=0,r=e.length;s<r;s++){const o=t[s],a=e[s],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};i[s]=l,this.items_[H(a)]=l}this.rbush_.load(i)}remove(t){const e=H(t),i=this.items_[e];return delete this.items_[e],this.rbush_.remove(i)!==null}update(t,e){const i=this.items_[H(e)],s=[i.minX,i.minY,i.maxX,i.maxY];Ui(s,t)||(this.remove(e),this.insert(t,e))}getAll(){return this.rbush_.all().map(function(e){return e.value})}getInExtent(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).map(function(s){return s.value})}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,e){return this.forEach_(this.getInExtent(t),e)}forEach_(t,e){let i;for(let s=0,r=t.length;s<r;s++)if(i=e(t[s]),i)return i;return i}isEmpty(){return gi(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return Ae(e.minX,e.minY,e.maxX,e.maxY,t)}concat(t){this.rbush_.load(t.rbush_.all());for(const e in t.items_)this.items_[e]=t.items_[e]}}const bt={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};class ye extends de{constructor(t,e,i){super(t),this.feature=e,this.features=i}}class bf extends cl{constructor(t){t=t||{},super({attributions:t.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:t.wrapX!==void 0?t.wrapX:!0}),this.on,this.once,this.un,this.loader_=Bi,this.format_=t.format||null,this.overlaps_=t.overlaps===void 0?!0:t.overlaps,this.url_=t.url,t.loader!==void 0?this.loader_=t.loader:this.url_!==void 0&&(J(this.format_,"`format` must be set when `url` is set"),this.loader_=jo(this.url_,this.format_)),this.strategy_=t.strategy!==void 0?t.strategy:of;const e=t.useSpatialIndex!==void 0?t.useSpatialIndex:!0;this.featuresRtree_=e?new qo:null,this.loadedExtentsRtree_=new qo,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let i,s;Array.isArray(t.features)?s=t.features:t.features&&(i=t.features,s=i.getArray()),!e&&i===void 0&&(i=new Pt(s)),s!==void 0&&this.addFeaturesInternal(s),i!==void 0&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=H(t);if(!this.addToIndex_(e,t)){this.featuresCollection_&&this.featuresCollection_.remove(t);return}this.setupChangeEvents_(e,t);const i=t.getGeometry();if(i){const s=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(s,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new ye(bt.ADDFEATURE,t))}setupChangeEvents_(t,e){e instanceof Yt||(this.featureChangeKeys_[t]=[j(e,Y.CHANGE,this.handleFeatureChange_,this),j(e,fi.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(t,e){let i=!0;if(e.getId()!==void 0){const s=String(e.getId());if(!(s in this.idIndex_))this.idIndex_[s]=e;else if(e instanceof Yt){const r=this.idIndex_[s];r instanceof Yt?Array.isArray(r)?r.push(e):this.idIndex_[s]=[r,e]:i=!1}else i=!1}return i&&(J(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],s=[];for(let r=0,o=t.length;r<o;r++){const a=t[r],l=H(a);this.addToIndex_(l,a)&&i.push(a)}for(let r=0,o=i.length;r<o;r++){const a=i[r],l=H(a);this.setupChangeEvents_(l,a);const c=a.getGeometry();if(c){const h=c.getExtent();e.push(h),s.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(e,s),this.hasListener(bt.ADDFEATURE))for(let r=0,o=i.length;r<o;r++)this.dispatchEvent(new ye(bt.ADDFEATURE,i[r]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(bt.ADDFEATURE,function(i){e||(e=!0,t.push(i.feature),e=!1)}),this.addEventListener(bt.REMOVEFEATURE,function(i){e||(e=!0,t.remove(i.feature),e=!1)}),t.addEventListener(xt.ADD,i=>{e||(e=!0,this.addFeature(i.element),e=!1)}),t.addEventListener(xt.REMOVE,i=>{e||(e=!0,this.removeFeature(i.element),e=!1)}),this.featuresCollection_=t}clear(t){if(t){for(const i in this.featureChangeKeys_)this.featureChangeKeys_[i].forEach(it);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(i=>{this.removeFeatureInternal(i)});for(const i in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[i])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new ye(bt.CLEAR);this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const i=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(i,function(s){const r=s.getGeometry();if(r instanceof Yt||r.intersectsCoordinate(t))return e(s)})}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,function(i){const s=i.getGeometry();if(s instanceof Yt||s.intersectsExtent(t)){const r=e(i);if(r)return r}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),gi(this.nullGeometryFeatures_)||rr(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,function(i){e.push(i)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const s=fa(t,e);return[].concat(...s.map(r=>this.featuresRtree_.getInExtent(r)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],s=t[1];let r=null;const o=[NaN,NaN];let a=1/0;const l=[-1/0,-1/0,1/0,1/0];return e=e||Zi,this.featuresRtree_.forEachInExtent(l,function(c){if(e(c)){const h=c.getGeometry(),u=a;if(a=h instanceof Yt?0:h.closestPointXY(i,s,o,a),a<u){r=c;const d=Math.sqrt(a);l[0]=i-d,l[1]=s-d,l[2]=i+d,l[3]=s+d}}}),r}getExtent(t){return this.featuresRtree_?.getExtent(t)??null}getFeatureById(t){const e=this.idIndex_[t.toString()];return e!==void 0?e:null}getFeatureByUid(t){const e=this.uidIndex_[t];return e!==void 0?e:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){const e=t.target,i=H(e),s=e.getGeometry();if(!s)i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[i]=e);else{const o=s.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(o,e)):this.featuresRtree_&&this.featuresRtree_.update(o,e)}const r=e.getId();if(r!==void 0){const o=r.toString();this.idIndex_[o]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[o]=e)}else this.removeFromIdIndex_(e),this.uidIndex_[i]=e;this.changed(),this.dispatchEvent(new ye(bt.CHANGEFEATURE,e))}hasFeature(t){const e=t.getId();return e!==void 0?e in this.idIndex_:H(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&gi(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(t,e,i){const s=this.loadedExtentsRtree_,r=this.strategy_(t,e,i);for(let o=0,a=r.length;o<a;++o){const l=r[o];s.forEachInExtent(l,function(h){return Di(h.extent,l)})||(++this.loadingExtentsCount_,this.dispatchEvent(new ye(bt.FEATURESLOADSTART)),this.loader_.call(this,l,e,i,h=>{--this.loadingExtentsCount_,this.dispatchEvent(new ye(bt.FEATURESLOADEND,void 0,h))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new ye(bt.FEATURESLOADERROR))}),s.insert(l,{extent:l.slice()}))}this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_,i=e.forEachInExtent(t,function(s){if(Ui(s.extent,t))return s});i&&e.remove(i)}removeFeatures(t){let e=!1;for(let i=0,s=t.length;i<s;++i)e=this.removeFeatureInternal(t[i])||e;e&&this.changed()}removeFeature(t){if(!t)return;this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=H(t);if(!(e in this.uidIndex_))return!1;e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t),this.featureChangeKeys_[e]?.forEach(it),delete this.featureChangeKeys_[e];const s=t.getId();if(s!==void 0){const r=s.toString(),o=this.idIndex_[r];o===t?delete this.idIndex_[r]:Array.isArray(o)&&(o.splice(o.indexOf(t),1),o.length===1&&(this.idIndex_[r]=o[0]))}return delete this.uidIndex_[e],this.hasListener(bt.REMOVEFEATURE)&&this.dispatchEvent(new ye(bt.REMOVEFEATURE,t)),!0}removeFromIdIndex_(t){for(const e in this.idIndex_)if(this.idIndex_[e]===t){delete this.idIndex_[e];break}}setLoader(t){this.loader_=t}setUrl(t){J(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(jo(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}}const O={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},Ln=[O.FILL],Se=[O.STROKE],ze=[O.BEGIN_PATH],$o=[O.CLOSE_PATH];class cn extends gl{constructor(t,e,i,s){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=s,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return e==1?t:t.map(function(i){return i*e})}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),s=this.tmpCoordinate_,r=this.coordinates;let o=r.length;for(let a=0,l=t.length;a<l;a+=e)s[0]=t[a],s[1]=t[a+1],_i(i,s)&&(r[o++]=s[0],r[o++]=s[1]);return o}appendFlatLineCoordinates(t,e,i,s,r,o){const a=this.coordinates;let l=a.length;const c=this.getBufferedMaxExtent();o&&(e+=s);let h=t[e],u=t[e+1];const d=this.tmpCoordinate_;let f=!0,g,m,_;for(g=e+s;g<i;g+=s)d[0]=t[g],d[1]=t[g+1],_=Ks(c,d),_!==m?(f&&(a[l++]=h,a[l++]=u,f=!1),a[l++]=d[0],a[l++]=d[1]):_===ht.INTERSECTING?(a[l++]=d[0],a[l++]=d[1],f=!1):f=!0,h=d[0],u=d[1],m=_;return(r&&f||g===e+s)&&(a[l++]=h,a[l++]=u),l}drawCustomCoordinates_(t,e,i,s,r){for(let o=0,a=i.length;o<a;++o){const l=i[o],c=this.appendFlatLineCoordinates(t,e,l,s,!1,!1);r.push(c),e=l}return e}drawCustom(t,e,i,s,r){this.beginGeometry(t,e,r);const o=t.getType(),a=t.getStride(),l=this.coordinates.length;let c,h,u,d,f;switch(o){case"MultiPolygon":c=t.getOrientedFlatCoordinates(),d=[];const g=t.getEndss();f=0;for(let m=0,_=g.length;m<_;++m){const y=[];f=this.drawCustomCoordinates_(c,f,g[m],a,y),d.push(y)}this.instructions.push([O.CUSTOM,l,d,t,i,fo,r]),this.hitDetectionInstructions.push([O.CUSTOM,l,d,t,s||i,fo,r]);break;case"Polygon":case"MultiLineString":u=[],c=o=="Polygon"?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),f=this.drawCustomCoordinates_(c,0,t.getEnds(),a,u),this.instructions.push([O.CUSTOM,l,u,t,i,Gn,r]),this.hitDetectionInstructions.push([O.CUSTOM,l,u,t,s||i,Gn,r]);break;case"LineString":case"Circle":c=t.getFlatCoordinates(),h=this.appendFlatLineCoordinates(c,0,c.length,a,!1,!1),this.instructions.push([O.CUSTOM,l,h,t,i,ai,r]),this.hitDetectionInstructions.push([O.CUSTOM,l,h,t,s||i,ai,r]);break;case"MultiPoint":c=t.getFlatCoordinates(),h=this.appendFlatPointCoordinates(c,a),h>l&&(this.instructions.push([O.CUSTOM,l,h,t,i,ai,r]),this.hitDetectionInstructions.push([O.CUSTOM,l,h,t,s||i,ai,r]));break;case"Point":c=t.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),h=this.coordinates.length,this.instructions.push([O.CUSTOM,l,h,t,i,void 0,r]),this.hitDetectionInstructions.push([O.CUSTOM,l,h,t,s||i,void 0,r]);break}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[O.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[O.BEGIN_GEOMETRY,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;t.reverse();let e;const i=t.length;let s,r,o=-1;for(e=0;e<i;++e)s=t[e],r=s[0],r==O.END_GEOMETRY?o=e:r==O.BEGIN_GEOMETRY&&(s[2]=e,Al(this.hitDetectionInstructions,o,e),o=-1)}fillStyleToState(t,e={}){if(t){const i=t.getColor();e.fillPatternScale=i&&typeof i=="object"&&"src"in i?this.pixelRatio:1,e.fillStyle=$t(i||wt)}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const i=t.getColor();e.strokeStyle=$t(i||$i);const s=t.getLineCap();e.lineCap=s!==void 0?s:pi;const r=t.getLineDash();e.lineDash=r?r.slice():he;const o=t.getLineDashOffset();e.lineDashOffset=o||ce;const a=t.getLineJoin();e.lineJoin=a!==void 0?a:yi;const l=t.getWidth();e.lineWidth=l!==void 0?l:Qi;const c=t.getMiterLimit();e.miterLimit=c!==void 0?c:qi;const h=t.getOffset();e.strokeOffset=h??Mu,e.lineWidth>this.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0,e.strokeOffset=void 0;return e}setFillStrokeStyle(t,e){const i=this.state;this.fillStyleToState(t,i),this.strokeStyleToState(e,i)}createFill(t){const e=t.fillStyle,i=[O.SET_FILL_STYLE,e];return typeof e!="string"&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[O.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;(typeof i!="string"||t.currentFillStyle!=i)&&(this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,s=t.lineCap,r=t.lineDash,o=t.lineDashOffset,a=t.lineJoin,l=t.lineWidth,c=t.miterLimit,h=t.strokeOffset;(t.currentStrokeStyle!=i||t.currentLineCap!=s||r!=t.currentLineDash&&!Me(t.currentLineDash,r)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=l||t.currentMiterLimit!=c||t.currentStrokeOffset!=h)&&(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=s,t.currentLineDash=r,t.currentLineDashOffset=o,t.currentLineJoin=a,t.currentLineWidth=l,t.currentMiterLimit=c,t.currentStrokeOffset=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[O.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=ra(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;or(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class lf extends cn{constructor(t,e,i,s){super(t,e,i,s),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e,i){if(!this.image_||this.maxExtent&&!_i(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);const s=t.getFlatCoordinates(),r=t.getStride(),o=this.coordinates.length,a=this.appendFlatPointCoordinates(s,r);this.instructions.push([O.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([O.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i);const s=t.getFlatCoordinates(),r=[];for(let l=0,c=s.length;l<c;l+=t.getStride())(!this.maxExtent||_i(this.maxExtent,s.slice(l,l+2)))&&r.push(s[l],s[l+1]);const o=this.coordinates.length,a=this.appendFlatPointCoordinates(r,2);this.instructions.push([O.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([O.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const i=t.getAnchor(),s=t.getSize(),r=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=s[1],this.opacity_=t.getOpacity(),this.originX_=r[0],this.originY_=r[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=s[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}class hf extends cn{constructor(t,e,i,s){super(t,e,i,s)}drawFlatCoordinates_(t,e,i,s,r){const o=this.coordinates.length,a=this.appendFlatLineCoordinates(t,e,i,s,!1,!1);return this.instructions.push([O.MOVE_TO_LINE_TO,o,a,r*this.pixelRatio]),this.hitDetectionInstructions.push([O.MOVE_TO_LINE_TO,o,a,r]),i}drawLineString(t,e,i){const s=this.state,r=s.strokeStyle,o=s.lineWidth,a=s.strokeOffset;if(r===void 0||o===void 0)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([O.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,he,ce],ze);const l=t.getFlatCoordinates(),c=t.getStride();this.drawFlatCoordinates_(l,0,l.length,c,a),this.hitDetectionInstructions.push(Se),this.endGeometry(e)}drawMultiLineString(t,e,i){const s=this.state,r=s.strokeStyle,o=s.lineWidth,a=s.strokeOffset;if(r===void 0||o===void 0)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([O.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,he,ce],ze);const l=t.getEnds(),c=t.getFlatCoordinates(),h=t.getStride();let u=0;for(let d=0,f=l.length;d<f;++d)u=this.drawFlatCoordinates_(c,u,l[d],h,a);this.hitDetectionInstructions.push(Se),this.endGeometry(e)}finish(){const t=this.state;return t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&this.instructions.push(Se),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(Se),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(ze)}}class Jo extends cn{constructor(t,e,i,s){super(t,e,i,s)}drawFlatCoordinatess_(t,e,i,s,r){const o=this.state,a=o.fillStyle!==void 0,l=o.strokeStyle!==void 0,c=i.length;this.instructions.push(ze),this.hitDetectionInstructions.push(ze);for(let h=0;h<c;++h){const u=i[h],d=this.coordinates.length,f=this.appendFlatLineCoordinates(t,e,u,s,!0,!l);this.instructions.push([O.MOVE_TO_LINE_TO,d,f,r*this.pixelRatio,!0]),this.hitDetectionInstructions.push([O.MOVE_TO_LINE_TO,d,f,r,!0]),l&&(this.instructions.push($o),this.hitDetectionInstructions.push($o)),e=u}return a&&(this.instructions.push(Ln),this.hitDetectionInstructions.push(Ln)),l&&(this.instructions.push(Se),this.hitDetectionInstructions.push(Se)),e}drawCircle(t,e,i){const s=this.state,r=s.fillStyle,o=s.strokeStyle,a=s.strokeOffset;if(r===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawCircle(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([O.SET_FILL_STYLE,wt]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([O.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,he,ce]);const l=t.getFlatCoordinates(),c=t.getStride(),h=this.coordinates.length;this.appendFlatLineCoordinates(l,0,l.length,c,!1,!1);const u=[O.CIRCLE,h,a];this.instructions.push(ze,u),this.hitDetectionInstructions.push(ze,u),s.fillStyle!==void 0&&(this.instructions.push(Ln),this.hitDetectionInstructions.push(Ln)),s.strokeStyle!==void 0&&(this.instructions.push(Se),this.hitDetectionInstructions.push(Se)),this.endGeometry(e)}drawPolygon(t,e,i){const s=this.state,r=s.fillStyle,o=s.strokeStyle,a=s.strokeOffset;if(r===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([O.SET_FILL_STYLE,wt]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([O.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,he,ce]);const l=t.getEnds(),c=t.getOrientedFlatCoordinates(),h=t.getStride();this.drawFlatCoordinatess_(c,0,l,h,a),this.endGeometry(e)}drawMultiPolygon(t,e,i){const s=this.state,r=s.fillStyle,o=s.strokeStyle,a=s.strokeOffset;if(r===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawMultiPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),s.fillStyle!==void 0&&this.hitDetectionInstructions.push([O.SET_FILL_STYLE,wt]),s.strokeStyle!==void 0&&this.hitDetectionInstructions.push([O.SET_STROKE_STYLE,s.strokeStyle,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,he,ce]);const l=t.getEndss(),c=t.getOrientedFlatCoordinates(),h=t.getStride();let u=0;for(let d=0,f=l.length;d<f;++d)u=this.drawFlatCoordinatess_(c,u,l[d],h,a);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const t=this.tolerance;if(t!==0){const e=this.coordinates;for(let i=0,s=e.length;i<s;++i)e[i]=De(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;this.updateFillStyle(t,this.createFill),this.updateStrokeStyle(t,this.applyStroke)}handleStrokeOffset_(t){const e=this.state,i=e.fillStyle,s=e.strokeStyle,r=e.strokeOffset;return Math.abs(r)>0&&i!==void 0&&s!==void 0?(e.strokeStyle=void 0,e.strokeOffset=0,t(),e.fillStyle=void 0,e.strokeStyle=s,e.strokeOffset=r,t(),e.fillStyle=i,!0):!1}}function cf(n,t,e,i,s){const r=[];let o=e,a=0,l=t.slice(e,2);for(;a<n&&o+s<i;){const[c,h]=l.slice(-2),u=t[o+s],d=t[o+s+1],f=Math.sqrt((u-c)*(u-c)+(d-h)*(d-h));if(a+=f,a>=n){const g=(n-a+f)/f,m=St(c,u,g),_=St(h,d,g);l.push(m,_),r.push(l),l=[m,_],a==n&&(o+=s),a=0}else if(a<n)l.push(t[o+s],t[o+s+1]),o+=s;else{const g=f-a,m=St(c,u,g/f),_=St(h,d,g/f);l.push(m,_),r.push(l),l=[m,_],a=0,o+=s}}return a>0&&r.push(l),r}function uf(n,t,e,i,s){let r=e,o=e,a=0,l=0,c=e,h,u,d,f,g,m,_,y,E,C;for(u=e;u<i;u+=s){const p=t[u],x=t[u+1];g!==void 0&&(E=p-g,C=x-m,f=Math.sqrt(E*E+C*C),_!==void 0&&(l+=d,h=Math.acos((_*E+y*C)/(d*f)),h>n&&(l>a&&(a=l,r=c,o=u),l=0,c=u-s)),d=f,_=E,y=C),g=p,m=x}return l+=f,l>a?[c,u]:[r,o]}const Kn={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class df extends cn{constructor(t,e,i,s){super(t,e,i,s),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[wt]={fillStyle:wt},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e,i){const s=this.textFillState_,r=this.textStrokeState_,o=this.textState_;if(this.text_===""||!o||!s&&!r)return;const a=this.coordinates;let l=a.length;const c=t.getType();let h=null,u=t.getStride();if(o.placement==="line"&&(c=="LineString"||c=="MultiLineString"||c=="Polygon"||c=="MultiPolygon")){if(!Rt(this.maxExtent,t.getExtent()))return;let d;if(h=t.getFlatCoordinates(),c=="LineString")d=[h.length];else if(c=="MultiLineString")d=t.getEnds();else if(c=="Polygon")d=t.getEnds().slice(0,1);else if(c=="MultiPolygon"){const _=t.getEndss();d=[];for(let y=0,E=_.length;y<E;++y)d.push(_[y][0])}this.beginGeometry(t,e,i);const f=o.repeat,g=f?void 0:o.textAlign;let m=0;for(let _=0,y=d.length;_<y;++_){let E;f?E=cf(f*this.resolution,h,m,d[_],u):E=[h.slice(m,d[_])];for(let C=0,p=E.length;C<p;++C){const x=E[C];let S=0,L=x.length;if(g==null){const R=uf(o.maxAngle,x,0,x.length,2);S=R[0],L=R[1]}for(let R=S;R<L;R+=u)a.push(x[R],x[R+1]);const I=a.length;m=d[_],this.drawChars_(l,I),l=I}}this.endGeometry(e)}else{let d=o.overflow?null:[];switch(c){case"Point":case"MultiPoint":h=t.getFlatCoordinates();break;case"LineString":h=t.getFlatMidpoint();break;case"Circle":h=t.getCenter();break;case"MultiLineString":h=t.getFlatMidpoints(),u=2;break;case"Polygon":h=t.getFlatInteriorPoint(),o.overflow||d.push(h[2]/this.resolution),u=3;break;case"MultiPolygon":const p=t.getFlatInteriorPoints();h=[];for(let x=0,S=p.length;x<S;x+=3)o.overflow||d.push(p[x+2]/this.resolution),h.push(p[x],p[x+1]);if(h.length===0)return;u=2;break}const f=this.appendFlatPointCoordinates(h,u);if(f===l)return;if(d&&(f-l)/2!==h.length/u){let p=l/2;d=d.filter((x,S)=>{const L=a[(p+S)*2]===h[S*u]&&a[(p+S)*2+1]===h[S*u+1];return L||--p,L})}this.saveTextStates_();const g=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,m=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(t,e,i);let _=o.padding;if(_!=Ge&&(o.scale[0]<0||o.scale[1]<0)){let p=o.padding[0],x=o.padding[1],S=o.padding[2],L=o.padding[3];o.scale[0]<0&&(x=-x,L=-L),o.scale[1]<0&&(p=-p,S=-S),_=[p,x,S,L]}const y=this.pixelRatio;this.instructions.push([O.DRAW_IMAGE,l,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,_==Ge?Ge:_.map(function(p){return p*y}),g,m,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]);const E=1/y,C=g?g.slice(0):null;C&&(C[1]=wt),this.hitDetectionInstructions.push([O.DRAW_IMAGE,l,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[E,E],NaN,this.declutterMode_,this.declutterImageWithText_,_,C,m,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?wt:this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]),this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,s=this.strokeKey_;t&&(s in this.strokeStates||(this.strokeStates[s]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const r=this.textKey_;r in this.textStates||(this.textStates[r]={font:e.font,textAlign:e.textAlign||Ji,justify:e.justify,textBaseline:e.textBaseline||Xn,scale:e.scale});const o=this.fillKey_;i&&(o in this.fillStates||(this.fillStates[o]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,s=this.textState_,r=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();const l=this.pixelRatio,c=Kn[s.textBaseline],h=this.textOffsetY_*l,u=this.text_,d=i?i.lineWidth*Math.abs(s.scale[0])/2:0;this.instructions.push([O.DRAW_CHARS,t,e,c,s.overflow,a,s.maxAngle,l,h,r,d*l,u,o,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([O.DRAW_CHARS,t,e,c,s.overflow,a&&wt,s.maxAngle,l,h,r,d*l,u,o,1/l,this.declutterMode_,this.textKeepUpright_])}setTextStyle(t,e){let i,s,r;if(!t)this.text_="";else{const o=t.getFill();o?(s=this.textFillState_,s||(s={},this.textFillState_=s),s.fillStyle=$t(o.getColor()||wt)):(s=null,this.textFillState_=s);const a=t.getStroke();if(!a)r=null,this.textStrokeState_=r;else{r=this.textStrokeState_,r||(r={},this.textStrokeState_=r);const m=a.getLineDash(),_=a.getLineDashOffset(),y=a.getWidth(),E=a.getMiterLimit();r.lineCap=a.getLineCap()||pi,r.lineDash=m?m.slice():he,r.lineDashOffset=_===void 0?ce:_,r.lineJoin=a.getLineJoin()||yi,r.lineWidth=y===void 0?Qi:y,r.miterLimit=E===void 0?qi:E,r.strokeStyle=$t(a.getColor()||$i)}i=this.textState_;const l=t.getFont()||Va;Pu(l);const c=t.getScaleArray();i.overflow=t.getOverflow(),i.font=l,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||Xn,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||Ge,i.scale=c===void 0?[1,1]:c;const h=t.getOffsetX(),u=t.getOffsetY(),d=t.getRotateWithView(),f=t.getKeepUpright(),g=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=h===void 0?0:h,this.textOffsetY_=u===void 0?0:u,this.textRotateWithView_=d===void 0?!1:d,this.textKeepUpright_=f===void 0?!0:f,this.textRotation_=g===void 0?0:g,this.strokeKey_=r?(typeof r.strokeStyle=="string"?r.strokeStyle:H(r.strokeStyle))+r.lineCap+r.lineDashOffset+"|"+r.lineWidth+r.lineJoin+r.miterLimit+"["+r.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=s&&s.fillStyle?typeof s.fillStyle=="string"?s.fillStyle:"|"+H(s.fillStyle):""}this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}const ff={Circle:Jo,Default:cn,Image:lf,LineString:hf,Polygon:Jo,Text:df};class gf{constructor(t,e,i,s){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=s,this.resolution_=i,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const i=this.buildersByZIndex_[e];for(const s in i){const r=i[s].finish();t[e][s]=r}}return t}getBuilder(t,e){const i=t!==void 0?t.toString():"0";let s=this.buildersByZIndex_[i];s===void 0&&(s={},this.buildersByZIndex_[i]=s);let r=s[e];if(r===void 0){const o=ff[e];r=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),s[e]=r}return r}}function _f(n,t,e,i,s,r,o,a,l,c,h,u,d=!0){let f=n[t],g=n[t+1],m=0,_=0,y=0,E=0;function C(){m=f,_=g,t+=i,f=n[t],g=n[t+1],E+=y,y=Math.sqrt((f-m)*(f-m)+(g-_)*(g-_))}do C();while(t<e-i&&E+y<r);let p=y===0?0:(r-E)/y;const x=St(m,f,p),S=St(_,g,p),L=t-i,I=E,R=r+a*l(c,s,h);for(;t<e-i&&E+y<R;)C();p=y===0?0:(R-E)/y;const v=St(m,f,p),k=St(_,g,p);let P=!1;if(d)if(u){const G=[x,S,v,k];Ta(G,0,4,2,u,G,G),P=G[0]>G[2]}else P=x>v;const M=Math.PI,K=[],A=L+i===t;t=L,y=0,E=I,f=n[t],g=n[t+1];let z;if(A){C(),z=Math.atan2(g-_,f-m),P&&(z+=z>0?-M:M);const G=(v+x)/2,F=(k+S)/2;return K[0]=[G,F,(R-r)/2,z,s],K}s=s.replace(/\n/g," ");for(let G=0,F=s.length;G<F;){C();let D=Math.atan2(g-_,f-m);if(P&&(D+=D>0?-M:M),z!==void 0){let T=D-z;if(T+=T>M?-2*M:T<-M?2*M:0,Math.abs(T)>o)return null}z=D;const B=G;let U=0;for(;G<F;++G){const T=P?F-G-1:G,vt=a*l(c,s[T],h);if(t+i<e&&E+y<r+U+vt/2)break;U+=vt}if(G===B)continue;const q=P?s.substring(F-B,F-G):s.substring(B,G);p=y===0?0:(r+U/2-E)/y;const et=St(m,f,p),mt=St(_,g,p);K.push([et,mt,U/2,D,q]),r+=U}return K}const ei=Gt(),Ee=[],ne=[],se=[],xe=[];function Qo(n){return n[3].declutterBox}const ta=new RegExp("[֑-ࣿיִ-﷿ﹰ-ﻼࠀ-࿿-]");function zs(n,t){return t==="start"?t=ta.test(n)?"right":"left":t==="end"&&(t=ta.test(n)?"left":"right"),Kn[t]}function mf(n,t,e){return e>0&&n.push(`
`,""),n.push(t,""),n}function pf(n,t,e){return e%2===0&&(n+=t),n}class yf{constructor(t,e,i,s,r){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=s.instructions,this.coordinates=s.coordinates,this.coordinateCache_={},this.renderedTransform_=Zt(),this.hitDetectionInstructions=s.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=s.fillStates||{},this.strokeStates=s.strokeStates||{},this.textStates=s.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=r?new ul:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,s){const r=t+e+i+s;if(this.labels_[r])return this.labels_[r];const o=s?this.strokeStates[s]:null,a=i?this.fillStates[i]:null,l=this.textStates[e],c=this.pixelRatio,h=[l.scale[0]*c,l.scale[1]*c],u=l.justify?Kn[l.justify]:zs(Array.isArray(t)?t[0]:t,l.textAlign||Ji),d=s&&o.lineWidth?o.lineWidth:0,f=Array.isArray(t)?t:String(t).split(`
`).reduce(mf,[]),{width:g,height:m,widths:_,heights:y,lineWidths:E}=Fu(l,f),C=g+d,p=[],x=(C+2)*h[0],S=(m+d)*h[1],L={width:x<0?Math.floor(x):Math.ceil(x),height:S<0?Math.floor(S):Math.ceil(S),contextInstructions:p};(h[0]!=1||h[1]!=1)&&p.push("scale",h),s&&(p.push("strokeStyle",o.strokeStyle),p.push("lineWidth",d),p.push("lineCap",o.lineCap),p.push("lineJoin",o.lineJoin),p.push("miterLimit",o.miterLimit),p.push("setLineDash",[o.lineDash]),p.push("lineDashOffset",o.lineDashOffset)),i&&p.push("fillStyle",a.fillStyle),p.push("textBaseline","middle"),p.push("textAlign","center");const I=.5-u;let R=u*C+I*d;const v=[],k=[];let P=0,M=0,K=0,A=0,z;for(let G=0,F=f.length;G<F;G+=2){const D=f[G];if(D===`
`){M+=P,P=0,R=u*C+I*d,++A;continue}const B=f[G+1]||l.font;B!==z&&(s&&v.push("font",B),i&&k.push("font",B),z=B),P=Math.max(P,y[K]);const U=[D,R+I*_[K]+u*(_[K]-E[A]),.5*(d+P)+M];R+=_[K],s&&v.push("strokeText",U),i&&k.push("fillText",U),++K}return Array.prototype.push.apply(p,v),Array.prototype.push.apply(p,k),this.labels_[r]=L,L}replayTextBackground_(t,e,i,s,r,o,a){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,s),t.lineTo.apply(t,r),t.lineTo.apply(t,e),o&&(this.alignAndScaleFill_=o[2],t.fillStyle=o[1],this.fill_(t)),a&&(this.setStrokeStyle_(t,a),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,s,r,o,a,l,c,h,u,d,f,g,m,_){a*=d[0],l*=d[1];let y=i-a,E=s-l;const C=r+c>t?t-c:r,p=o+h>e?e-h:o,x=g[3]+C*d[0]+g[1],S=g[0]+p*d[1]+g[2],L=y-g[3],I=E-g[0];(m||u!==0)&&(Ee[0]=L,xe[0]=L,Ee[1]=I,ne[1]=I,ne[0]=L+x,se[0]=ne[0],se[1]=I+S,xe[1]=se[1]);let R;return u!==0?(R=ue(Zt(),i,s,1,1,u,-i,-s),ct(R,Ee),ct(R,ne),ct(R,se),ct(R,xe),Ae(Math.min(Ee[0],ne[0],se[0],xe[0]),Math.min(Ee[1],ne[1],se[1],xe[1]),Math.max(Ee[0],ne[0],se[0],xe[0]),Math.max(Ee[1],ne[1],se[1],xe[1]),ei)):Ae(Math.min(L,L+x),Math.min(I,I+S),Math.max(L,L+x),Math.max(I,I+S),ei),f&&(y=Math.round(y),E=Math.round(E)),{drawImageX:y,drawImageY:E,drawImageW:C,drawImageH:p,originX:c,originY:h,declutterBox:{minX:ei[0],minY:ei[1],maxX:ei[2],maxY:ei[3],value:_},canvasTransform:R,scale:d}}replayImageOrLabel_(t,e,i,s,r,o,a){const l=!!(o||a),c=s.declutterBox,h=a?a[2]*s.scale[0]/2:0;return c.minX-h<=e[0]&&c.maxX+h>=0&&c.minY-h<=e[1]&&c.maxY+h>=0&&(l&&this.replayTextBackground_(t,Ee,ne,se,xe,o,a),ku(t,s.canvasTransform,r,i,s.originX,s.originY,s.drawImageW,s.drawImageH,s.drawImageX,s.drawImageY,s.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=ct(this.renderedTransform_,[0,0]),s=512*this.pixelRatio;t.save(),t.translate(i[0]%s,i[1]%s),e!==1&&t.scale(e,e)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],e[1]&&(t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6]))}drawLabelWithPointPlacement_(t,e,i,s){const r=this.textStates[e],o=this.createLabel(t,e,s,i),a=this.strokeStates[i],l=this.pixelRatio,c=zs(Array.isArray(t)?t[0]:t,r.textAlign||Ji),h=Kn[r.textBaseline||Xn],u=a&&a.lineWidth?a.lineWidth:0,d=o.width/l-2*r.scale[0],f=c*d+2*(.5-c)*u,g=h*o.height/l+2*(.5-h)*u;return{label:o,anchorX:f,anchorY:g}}execute_(t,e,i,s,r,o,a,l){const c=this.zIndexContext_;let h;this.pixelCoordinates_&&Me(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=Le(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),Mh(this.renderedTransform_,i));let u=0;const d=s.length;let f=0,g,m,_,y,E,C,p,x,S,L,I,R,v,k,P,M,K=0,A=0;const z=this.coordinateCache_,G=this.viewRotation_,F=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,D={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:G},B=this.instructions!=s||this.overlaps?0:200;let U,q,et,mt;for(;u<d;){const T=s[u];switch(T[0]){case O.BEGIN_GEOMETRY:U=T[1],mt=T[3],U.getGeometry()?a!==void 0&&!Rt(a,mt.getExtent())?u=T[2]+1:++u:u=T[2],c&&(c.zIndex=T[4]);break;case O.BEGIN_PATH:K>B&&(this.fill_(t),K=0),A>B&&(t.stroke(),A=0),!K&&!A&&(t.beginPath(),x=NaN,S=NaN),++u;break;case O.CIRCLE:f=T[1],y=T[2]??0;const lt=h[f],zt=h[f+1],Ut=h[f+2]-y,Lt=h[f+3]-y,wi=Ut-lt,un=Lt-zt,Ri=Math.sqrt(wi*wi+un*un);t.moveTo(lt+Ri,zt),t.arc(lt,zt,Ri,0,2*Math.PI,!0),++u;break;case O.CLOSE_PATH:t.closePath(),++u;break;case O.CUSTOM:f=T[1],g=T[2];const us=T[3],Vt=T[4],Xt=T[5];D.geometry=us,D.feature=U,u in z||(z[u]=[]);const jt=z[u];Xt?Xt(h,f,g,2,jt):(jt[0]=h[f],jt[1]=h[f+1],jt.length=2),c&&(c.zIndex=T[6]),Vt(jt,D),++u;break;case O.DRAW_IMAGE:f=T[1],g=T[2],R=T[3],m=T[4],_=T[5];let ge=T[6];const dn=T[7],Ii=T[8],je=T[9],fn=T[10];let ft=T[11];const Cl=T[12];let gn=T[13];p=T[14]||"declutter";const Ti=T[15];if(!R&&T.length>=20){v=T[19],k=T[20],P=T[21],M=T[22];const At=this.drawLabelWithPointPlacement_(v,k,P,M);R=At.label,T[3]=R;const Oe=T[23];m=(At.anchorX-Oe)*this.pixelRatio,T[4]=m;const Mt=T[24];_=(At.anchorY-Mt)*this.pixelRatio,T[5]=_,ge=R.height,T[6]=ge,gn=R.width,T[13]=gn}let ds;T.length>25&&(ds=T[25]);let fs,_n,mn;T.length>17?(fs=T[16],_n=T[17],mn=T[18]):(fs=Ge,_n=null,mn=null),fn&&F?ft+=G:!fn&&!F&&(ft-=G);let wl=0;for(;f<g;f+=2){if(ds&&ds[wl++]<gn/this.pixelRatio)continue;const At=this.calculateImageOrLabelDimensions_(R.width,R.height,h[f],h[f+1],gn,ge,m,_,Ii,je,ft,Cl,r,fs,!!_n||!!mn,U),Oe=[t,e,R,At,dn,_n,mn];if(l){let Mt,Ht,Ot;if(Ti){const st=g-f;if(!Ti[st]){Ti[st]={args:Oe,declutterMode:p};continue}const pt=Ti[st];Mt=pt.args,Ht=pt.declutterMode,delete Ti[st],Ot=Qo(Mt)}let te,ee;if(Mt&&(Ht!=="declutter"||!l.collides(Ot))&&(te=!0),(p!=="declutter"||!l.collides(At.declutterBox))&&(ee=!0),Ht==="declutter"&&p==="declutter"){const st=te&&ee;te=st,ee=st}te&&(Ht!=="none"&&l.insert(Ot),this.replayImageOrLabel_.apply(this,Mt)),ee&&(p!=="none"&&l.insert(At.declutterBox),this.replayImageOrLabel_.apply(this,Oe))}else this.replayImageOrLabel_.apply(this,Oe)}++u;break;case O.DRAW_CHARS:const Wr=T[1],Yr=T[2],gs=T[3],Rl=T[4];M=T[5];const Il=T[6],Kr=T[7],Zr=T[8];P=T[9];const _s=T[10];v=T[11],Array.isArray(v)&&(v=v.reduce(pf,"")),k=T[12];const Br=[T[13],T[13]];p=T[14]||"declutter";const Tl=T[15],ms=this.textStates[k],Si=ms.font,vi=[ms.scale[0]*Kr,ms.scale[1]*Kr];let Li;Si in this.widths_?Li=this.widths_[Si]:(Li={},this.widths_[Si]=Li);const Ur=Kd(h,Wr,Yr,2),Vr=Math.abs(vi[0])*Ao(Si,v,Li);if(Rl||Vr<=Ur){const At=this.textStates[k].textAlign,Oe=(Ur-Vr)*zs(v,At),Mt=_f(h,Wr,Yr,2,v,Oe,Il,Math.abs(vi[0]),Ao,Si,Li,F?0:this.viewRotation_,Tl);t:if(Mt){const Ht=[];let Ot,te,ee,st,pt;if(P)for(Ot=0,te=Mt.length;Ot<te;++Ot){pt=Mt[Ot],ee=pt[4],st=this.createLabel(ee,k,"",P),m=pt[2]+(vi[0]<0?-_s:_s),_=gs*st.height+(.5-gs)*2*_s*vi[1]/vi[0]-Zr;const ie=this.calculateImageOrLabelDimensions_(st.width,st.height,pt[0],pt[1],st.width,st.height,m,_,0,0,pt[3],Br,!1,Ge,!1,U);if(l&&p==="declutter"&&l.collides(ie.declutterBox))break t;Ht.push([t,e,st,ie,1,null,null])}if(M)for(Ot=0,te=Mt.length;Ot<te;++Ot){pt=Mt[Ot],ee=pt[4],st=this.createLabel(ee,k,M,""),m=pt[2],_=gs*st.height-Zr;const ie=this.calculateImageOrLabelDimensions_(st.width,st.height,pt[0],pt[1],st.width,st.height,m,_,0,0,pt[3],Br,!1,Ge,!1,U);if(l&&p==="declutter"&&l.collides(ie.declutterBox))break t;Ht.push([t,e,st,ie,1,null,null])}l&&p!=="none"&&l.load(Ht.map(Qo));for(let ie=0,Sl=Ht.length;ie<Sl;++ie)this.replayImageOrLabel_.apply(this,Ht[ie])}}++u;break;case O.END_GEOMETRY:if(o!==void 0){U=T[1];const At=o(U,mt,p);if(At)return At}++u;break;case O.FILL:B?K++:this.fill_(t),++u;break;case O.MOVE_TO_LINE_TO:for(f=T[1],g=T[2],y=T[3],E=T[4]??!1,q=h[f],et=h[f+1],y&&(C=f,[q,et]=On(q,et,E?h[g-4]:void 0,E?h[g-3]:void 0,h[f+2],h[f+3],y)),t.moveTo(q,et),x=q+.5|0,S=et+.5|0,f+=2;f<g;f+=2)q=h[f],et=h[f+1],L=q+.5|0,I=et+.5|0,(f==g-2||L!==x||I!==S)&&(y&&(f==g-2?[q,et]=On(q,et,h[f-2],h[f-1],E?h[C+2]:void 0,E?h[C+3]:void 0,y):[q,et]=On(q,et,h[f-2],h[f-1],h[f+2],h[f+3],y)),t.lineTo(q,et),x=L,S=I);++u;break;case O.SET_FILL_STYLE:this.alignAndScaleFill_=T[2],K&&(this.fill_(t),K=0,A&&(t.stroke(),A=0)),t.fillStyle=T[1],++u;break;case O.SET_STROKE_STYLE:A&&(t.stroke(),A=0),this.setStrokeStyle_(t,T),++u;break;case O.STROKE:B?A++:t.stroke(),++u;break;default:++u;break}}K&&this.fill_(t),A&&t.stroke()}execute(t,e,i,s,r,o){this.viewRotation_=s,this.execute_(t,e,i,this.instructions,r,void 0,void 0,o)}executeHitDetection(t,e,i,s,r){return this.viewRotation_=i,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,s,r)}}const Fe=["Polygon","Circle","LineString","Image","Text","Default"],yl=["Image","Text"],Ef=Fe.filter(n=>!yl.includes(n));let El=!1,xl=!1;function xf(){let n=0;const t=i=>{const s=ot(1,1,null,{willReadFrequently:i});let r=0;const o=performance.now();for(;performance.now()-o<50;++r)s.fillStyle=`rgba(255,0,${r%256},1)`,s.fillRect(0,0,1,1),s.getImageData(0,0,1,1);return n=r>n?r:n,r};El={[t(!0)]:!0,[t(!1)]:!1,[t(void 0)]:void 0}[n],xl=!0}class Cf{constructor(t,e,i,s,r,o,a){this.maxExtent_=t,this.overlaps_=s,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=Zt(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(r,a)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(const i in t){let s=this.executorsByZIndex_[i];s===void 0&&(s={},this.executorsByZIndex_[i]=s);const r=t[i];for(const o in r){const a=r[o];s[o]=new yf(this.resolution_,this.pixelRatio_,this.overlaps_,a,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let s=0,r=t.length;s<r;++s)if(t[s]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,s,r,o){xl===!1&&xf(),s=Math.round(s);const a=s*2+1,l=ue(this.hitDetectionTransform_,s+.5,s+.5,1/e,-1/e,-i,-t[0],-t[1]),c=!this.hitDetectionContext_;c&&(this.hitDetectionContext_=ot(a,a,null,{willReadFrequently:El}));const h=this.hitDetectionContext_;h.canvas.width!==a||h.canvas.height!==a?(h.canvas.width=a,h.canvas.height=a):c||h.clearRect(0,0,a,a);let u;this.renderBuffer_!==void 0&&(u=Gt(),Wi(u,t),or(u,e*(this.renderBuffer_+s),u));const d=wf(s);let f;function g(x,S,L){const I=h.getImageData(0,0,a,a).data;for(let R=0,v=d.length;R<v;R++)if(I[d[R]]>0){if(!o||L==="none"||f!=="Image"&&f!=="Text"||o.includes(x)){const k=(d[R]-3)/4,P=s-k%a,M=s-(k/a|0),K=r(x,S,P*P+M*M);if(K)return K}h.clearRect(0,0,a,a);break}}const m=Object.keys(this.executorsByZIndex_).map(Number);m.sort(le);let _,y,E,C,p;for(_=m.length-1;_>=0;--_){const x=m[_].toString();for(E=this.executorsByZIndex_[x],y=Fe.length-1;y>=0;--y)if(f=Fe[y],C=E[f],C!==void 0&&(p=C.executeHitDetection(h,l,i,g,u),p))return p}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],s=e[1],r=e[2],o=e[3],a=[i,s,i,o,r,o,r,s];return Le(a,0,8,2,t,a),a}isEmpty(){return gi(this.executorsByZIndex_)}execute(t,e,i,s,r,o,a){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?Ll:le),o=o||Fe;const c=Fe.length;for(let h=0,u=l.length;h<u;++h){const d=l[h].toString(),f=this.executorsByZIndex_[d];for(let g=0,m=o.length;g<m;++g){const _=o[g],y=f[_];if(y!==void 0){const E=a===null?void 0:y.getZIndexContext(),C=E?E.getContext():t,p=this.maxExtent_&&_!=="Image"&&_!=="Text";if(p&&(C.save(),this.clip(C,i)),!E||_==="Text"||_==="Image"?y.execute(C,e,i,s,r,a):E.pushFunction(x=>y.execute(x,e,i,s,r,a)),p&&C.restore(),E){E.offset();const x=l[h]*c+Fe.indexOf(_);this.deferredZIndexContexts_[x]||(this.deferredZIndexContexts_[x]=[]),this.deferredZIndexContexts_[x].push(E)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(le);for(let i=0,s=e.length;i<s;++i)t[e[i]].forEach(r=>{r.draw(this.renderedContext_),r.clear()}),t[e[i]].length=0}}const Xs={};function wf(n){if(Xs[n]!==void 0)return Xs[n];const t=n*2+1,e=n*n,i=new Array(e+1);for(let r=0;r<=n;++r)for(let o=0;o<=n;++o){const a=r*r+o*o;if(a>e)break;let l=i[a];l||(l=[],i[a]=l),l.push(((n+r)*t+(n+o))*4+3),r>0&&l.push(((n-r)*t+(n+o))*4+3),o>0&&(l.push(((n+r)*t+(n-o))*4+3),r>0&&l.push(((n-r)*t+(n-o))*4+3))}const s=[];for(let r=0,o=i.length;r<o;++r)i[r]&&s.push(...i[r]);return Xs[n]=s,s}const qt=.5;function Rf(n,t,e,i,s,r,o,a,l){const c=s,h=n[0]*qt,u=n[1]*qt,d=ot(h,u);d.imageSmoothingEnabled=!1;const f=d.canvas,g=new Bd(d,qt,s,null,o,a,null),m=e.length,_=Math.floor((256*256*256-1)/m),y={};for(let C=1;C<=m;++C){const p=e[C-1],x=p.getStyleFunction()||i;if(!x)continue;let S=x(p,r);if(!S)continue;Array.isArray(S)||(S=[S]);const I=(C*_).toString(16).padStart(7,"#00000");for(let R=0,v=S.length;R<v;++R){const k=S[R],P=k.getGeometryFunction()(p);if(!P||!Rt(c,P.getExtent()))continue;const M=k.clone(),K=M.getFill();K&&K.setColor(I);const A=M.getStroke();A&&(A.setColor(I),A.setLineDash(null)),M.setText(void 0);const z=k.getImage();if(z){const B=z.getImageSize();if(!B)continue;const U=ot(B[0],B[1],void 0,{alpha:!1}),q=U.canvas;U.fillStyle=I,U.fillRect(0,0,q.width,q.height),M.setImage(new os({img:q,anchor:z.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:z.getOrigin(),opacity:1,size:z.getSize(),scale:z.getScale(),rotation:z.getRotation(),rotateWithView:z.getRotateWithView()}))}const G=M.getZIndex()||0;let F=y[G];F||(F={},y[G]=F,F.Polygon=[],F.Circle=[],F.LineString=[],F.Point=[]);const D=P.getType();if(D==="GeometryCollection"){const B=P.getGeometriesArrayRecursive();for(let U=0,q=B.length;U<q;++U){const et=B[U];F[et.getType().replace("Multi","")].push(et,M)}}else F[D.replace("Multi","")].push(P,M)}}const E=Object.keys(y).map(Number).sort(le);for(let C=0,p=E.length;C<p;++C){const x=y[E[C]];for(const S in x){const L=x[S];for(let I=0,R=L.length;I<R;I+=2){g.setStyle(L[I+1]);for(let v=0,k=t.length;v<k;++v)g.setTransform(t[v]),g.drawGeometry(L[I])}}}return d.getImageData(0,0,f.width,f.height)}function If(n,t,e){const i=[];if(e){const s=Math.floor(Math.round(n[0])*qt),r=Math.floor(Math.round(n[1])*qt),o=(nt(s,0,e.width-1)+nt(r,0,e.height-1)*e.width)*4,a=e.data[o],l=e.data[o+1],h=e.data[o+2]+256*(l+256*a),u=Math.floor((256*256*256-1)/t.length);h&&h%u===0&&i.push(t[h/u-1])}return i}class Tf extends dl{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=Gt(),this.wrappedRenderedExtent_=Gt(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(t,e,i){const s=e.extent,r=e.viewState,o=r.center,a=r.resolution,l=r.projection,c=r.rotation,h=l.getExtent(),u=this.getLayer().getSource(),d=this.getLayer().getDeclutter(),f=e.pixelRatio,g=e.viewHints,m=!(g[_t.ANIMATING]||g[_t.INTERACTING]),_=this.context,y=Math.round(tt(s)/a*f),E=Math.round(Et(s)/a*f),C=u.getWrapX()&&l.canWrapX(),p=C?tt(h):null,x=C?Math.ceil((s[2]-h[2])/p)+(this.extendX_?2:1):1;let S=C?Math.floor((s[0]-h[0])/p)-(this.extendX_?1:0):0;do{let L=this.getRenderTransform(o,a,0,f,y,E,S*p);e.declutter&&(L=L.slice(0)),t.execute(_,[_.canvas.width,_.canvas.height],L,c,m,i===void 0?Fe:i?yl:Ef,i?d&&e.declutter[d]:void 0)}while(++S<x)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=ot(this.context.canvas.width,this.context.canvas.height,Ko))}resetDrawContext_(){if(this.opacity_!==1&&this.targetContext_){const t=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=t,es(this.context),Ko.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(t){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,t,!0)}renderDeferredInternal(t){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,t,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex];this.opacity_=i.opacity;const s=t.viewState;this.prepareContainer(t,e);const r=this.context,o=this.replayGroup_;let a=o&&!o.isEmpty();if(!a&&!(this.getLayer().hasListener(Ft.PRERENDER)||this.getLayer().hasListener(Ft.POSTRENDER)))return this.container;this.setDrawContext_(),this.preRender(r,t),s.projection,this.clipExtent_=null;let l=!1;if(a&&i.extent&&this.clipping){const c=Ie(i.extent);a=Rt(c,t.extent),a&&!Di(c,t.extent)&&(t.declutter?this.clipExtent_=c:(this.clipUnrotated(r,t,c),l=!0))}return a&&this.renderWorlds(o,t,this.getLayer().getDeclutter()?!1:void 0),l&&r.restore(),this.postRender(r,t),this.renderedRotation_!==s.rotation&&(this.renderedRotation_=s.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise(e=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const i=this.frameState.size.slice(),s=this.renderedCenter_,r=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,c=this.getLayer(),h=[],u=i[0]*qt,d=i[1]*qt;h.push(this.getRenderTransform(s,r,o,qt,u,d,0).slice());const f=c.getSource(),g=a.getExtent();if(f.getWrapX()&&a.canWrapX()&&!Di(g,l)){let m=l[0];const _=tt(g);let y=0,E;for(;m<g[0];)--y,E=_*y,h.push(this.getRenderTransform(s,r,o,qt,u,d,E).slice()),m+=_;for(y=0,m=l[2];m>g[2];)++y,E=_*y,h.push(this.getRenderTransform(s,r,o,qt,u,d,E).slice()),m-=_}this.hitDetectionImageData_=Rf(i,h,this.renderedFeatures_,c.getStyleFunction(),l,r,o,Uo(r,this.renderedPixelRatio_))}e(If(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,s,r){if(!this.replayGroup_)return;const o=e.viewState.resolution,a=e.viewState.rotation,l=this.getLayer(),c={},h=function(d,f,g){const m=H(d),_=c[m];if(_){if(_!==!0&&g<_.distanceSq){if(g===0)return c[m]=!0,r.splice(r.lastIndexOf(_),1),s(d,l,f);_.geometry=f,_.distanceSq=g}}else{if(g===0)return c[m]=!0,s(d,l,f);r.push(c[m]={feature:d,layer:l,geometry:f,distanceSq:g,callback:s})}},u=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,o,a,i,h,u?e.declutter?.[u]?.all().map(d=>d.value):null)}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const s=t.viewHints[_t.ANIMATING],r=t.viewHints[_t.INTERACTING],o=e.getUpdateWhileAnimating(),a=e.getUpdateWhileInteracting();if(this.ready&&!o&&s||!a&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const l=t.extent,c=t.viewState,h=c.projection,u=c.resolution,d=t.pixelRatio,f=e.getRevision(),g=e.getRenderBuffer();let m=e.getRenderOrder();m===void 0&&(m=Vd);const _=c.center.slice(),y=or(l,g*u),E=y.slice(),C=[y.slice()],p=h.getExtent(),x=i.getWrapX()&&h.canWrapX();if(this.extendX_=!1,x){const A=i.getExtent();A&&!rn(A)&&(this.extendX_=A[0]<p[0]||A[2]>p[2])}if(x&&(!Di(p,t.extent)||this.extendX_)){const A=tt(p),z=Math.max(tt(y)/2,A);let G=p[0],F=p[2];this.extendX_&&(G-=A,F+=A),y[0]=G-z,y[2]=F+z,ga(_,h);const D=da(C[0],h);D[0]<p[0]&&D[2]<p[2]?C.push([D[0]+A,D[1],D[2]+A,D[3]]):D[0]>p[0]&&D[2]>p[2]&&C.push([D[0]-A,D[1],D[2]-A,D[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedPixelRatio_===d&&this.renderedRevision_==f&&this.renderedRenderOrder_==m&&this.renderedFrameDeclutter_===!!t.declutter&&Di(this.wrappedRenderedExtent_,y))return Me(this.renderedExtent_,E)||(this.hitDetectionImageData_=null,this.renderedExtent_=E),this.renderedCenter_=_,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const S=new gf(ml(u,d),y,u,d);let L;for(let A=0,z=C.length;A<z;++A)i.loadFeatures(C[A],u,h);const I=Uo(u,d);let R=!0;const v=(A,z)=>{let G;const F=A.getStyleFunction()||e.getStyleFunction();if(F&&(G=F(A,u)),G){const D=this.renderFeature(A,I,G,S,L,this.getLayer().getDeclutter(),z);R=R&&!D}},k=Ra(y),P=i.getFeaturesInExtent(k);m&&P.sort(m);for(let A=0,z=P.length;A<z;++A)v(P[A],A);this.renderedFeatures_=P,this.ready=R;const M=S.finish(),K=new Cf(y,u,d,i.getOverlaps(),M,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=u,this.renderedRevision_=f,this.renderedRenderOrder_=m,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=E,this.wrappedRenderedExtent_=y,this.renderedCenter_=_,this.renderedProjection_=h,this.renderedPixelRatio_=d,this.replayGroup_=K,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,s,r,o,a){if(!i)return!1;let l=!1;if(Array.isArray(i))for(let c=0,h=i.length;c<h;++c)l=Vo(s,t,i[c],e,this.boundHandleStyleImageChange_,r,o,a)||l;else l=Vo(s,t,i,e,this.boundHandleStyleImageChange_,r,o,a);return l}}class Pf extends el{constructor(t){super(t)}createRenderer(){return new Tf(this)}}export{rs as C,fl as F,Lf as M,Af as O,Er as P,pr as S,Mf as T,ae as V,La as a,Bo as b,oa as c,Kd as d,rr as e,qh as f,yr as g,ba as h,ai as i,Aa as j,Sf as k,Of as l,va as m,bf as n,Pf as o,We as p,as as q,Ei as r,th as s};