const Et={ADD:"add",REMOVE:"remove"},gi={PROPERTYCHANGE:"propertychange"},W={CHANGE:"change",ERROR:"error",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",TOUCHMOVE:"touchmove",WHEEL:"wheel"};class Xn{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function Cl(n,t,e){let i,s;e=e||oe;let r=0,o=n.length,a=!1;for(;r>1),s=+e(n[i],t),s<0?r=i+1:(o=i,a=!s);return a?r:~r}function oe(n,t){return n>t?1:nt?-1:0}function tr(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;s0?s-1:s}return i-1}if(e>0){for(let s=1;s0||o===0)})}function Ki(){return!0}function Wn(){return!1}function Zi(){}function $o(n){let t,e,i;return function(){const s=Array.prototype.slice.call(arguments);return(!e||this!==i||!ve(s,e))&&(i=this,e=s,t=n.apply(this,arguments)),t}}function Il(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 en(n){for(const t in n)delete n[t]}function _i(n){let t;for(t in n)return!1;return!t}class ce{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}class Yn extends Xn{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 ce(t):t;r.target||(r.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});i in o||(o[i]=0,a[i]=0),++o[i];let l;for(let h=0,c=s.length;h0:!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]=Zi,++this.pendingRemovals_[t]):(i.splice(s,1),i.length===0&&delete this.listeners_[t]))}}function V(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 Sn(n,t,e,i){return V(n,t,e,i,!0)}function tt(n){n&&n.target&&(n.target.removeEventListener(n.type,n.listener),en(n))}class nn extends Yn{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(W.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,s=new Array(i);for(let r=0;r0;)this.pop()}extend(t){for(let e=0,i=t.length;ethis.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 dn(Et.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=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new dn(Et.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 dn(Et.REMOVE,s,t)),this.dispatchEvent(new dn(Et.ADD,e,t))}updateLength_(){this.set(Br.LENGTH,this.array_.length)}assertUnique_(t,e){const i=this.array_;for(let s=0,r=i.length;s{this.clickTimeoutId_=void 0;const i=new ye(nt.SINGLECLICK,this.map_,t);this.dispatchEvent(i)},250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==nt.POINTERUP||e.type==nt.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==nt.POINTERDOWN||e.type==nt.POINTERMOVE)&&(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new ye(nt.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(tt),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 ye(nt.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(V(i,nt.POINTERMOVE,this.handlePointerMove_,this),V(i,nt.POINTERUP,this.handlePointerUp_,this),V(this.element_,nt.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==i&&this.dragListenerKeys_.push(V(this.element_.getRootNode(),nt.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new ye(nt.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 ye(nt.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_&&(tt(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(W.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(tt(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(tt),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const Ee={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},ft={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},D={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function q(n,t){if(!n)throw new Error(t)}const vn=1/0;class Dl{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,en(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){q(!(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!=vn?(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>1;){const l=this.getLeftChildIndex_(t),h=this.getRightChildIndex_(t),c=ht;){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;at.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(W.CHANGE,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===D.LOADED||i===D.ERROR||i===D.EMPTY){i!==D.ERROR&&e.removeEventListener(W.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_0;){const s=this.dequeue()[0],r=s.getKey();s.getState()===D.IDLE&&!(r in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[r]=!0,++this.tilesLoading_,++i,s.load())}}}function Pl(n,t,e,i,s){if(!n||!(e in n.wantedTiles)||!n.wantedTiles[e][t.getKey()])return vn;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 gt={ANIMATING:0,INTERACTING:1},Wt={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function et(n,t,e){return Math.min(Math.max(n,t),e)}function Fl(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 hi(n,t,e,i)}function hi(n,t,e,i){const s=e-n,r=i-t;return s*s+r*r}function kl(n){const t=n.length;for(let i=0;ir&&(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=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 Ur(n){return n*180/Math.PI}function Te(n){return n*Math.PI/180}function ci(n,t){const e=n%t;return e*t<0?e+t:e}function Lt(n,t,e){return n+e*(t-n)}function Kn(n,t){const e=Math.pow(10,t);return Math.round(n*e)/e}function fn(n,t){return Math.floor(Kn(n,t))}function gn(n,t){return Math.ceil(Kn(n,t))}function Gs(n,t,e){if(n>=t&&nf&&(d=(f+d)/2,f=d),g>m&&(g=(m+g)/2,m=g);let _=et(i[0],d,f),p=et(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),p+=-E*Math.log(1+Math.max(0,g-i[1])/E)+E*Math.log(1+Math.max(0,i[1]-m)/E)}return[_,p]})}function Nl(n){return n}const lt={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function jr(n){const t=zt();for(let e=0,i=n.length;es&&(l=l|lt.RIGHT),ar&&(l=l|lt.ABOVE),l===lt.UNKNOWN&&(l=lt.INTERSECTING),l}function zt(){return[1/0,1/0,-1/0,-1/0]}function Se(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 Zn(n){return Se(1/0,1/0,-1/0,-1/0,n)}function sa(n,t){const e=n[0],i=n[1];return Se(e,i,e,i,t)}function nr(n,t,e,i,s){const r=Zn(s);return ra(r,n,t,e,i)}function Bi(n,t){return n[0]==t[0]&&n[2]==t[2]&&n[1]==t[1]&&n[3]==t[3]}function Gl(n,t){return t[0]n[2]&&(n[2]=t[2]),t[1]n[3]&&(n[3]=t[3]),n}function Wi(n,t){t[0]n[2]&&(n[2]=t[0]),t[1]n[3]&&(n[3]=t[1])}function ra(n,t,e,i,s){for(;et[0]?i[0]=n[0]:i[0]=t[0],n[1]>t[1]?i[1]=n[1]:i[1]=t[1],n[2]=t[0]&&n[1]<=t[3]&&n[3]>=t[1]}function jn(n){return n[2]=o&&m<=l),!i&&r<.RIGHT&&!(s<.RIGHT)&&(_=f-(d-l)*g,i=_>=a&&_<=h),!i&&r<.BELOW&&!(s<.BELOW)&&(m=d-(f-a)/g,i=m>=o&&m<=l),!i&&r<.LEFT&&!(s<.LEFT)&&(_=f-(d-o)*g,i=_>=a&&_<=h)}return i}function la(n,t){const e=t.getExtent(),i=Ye(n);if(t.canWrapX()&&(i[0]=e[2])){const s=J(e),o=Math.floor((i[0]-e[0])/s)*s;n[0]-=o,n[2]-=o}return n}function ha(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]]];la(n,t);const s=J(i);if(J(n)>s&&!e)return[[i[0],n[1],i[2],n[3]]];if(n[0]i[2])return[[n[0],n[1],i[2],n[3]],[i[0],n[1],n[2]-s,n[3]]]}return[n]}function Kl(n,t){return n[0]+=+t[0],n[1]+=+t[1],n}function Ln(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 sr(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 Zl(n,t){return n[0]*=t,n[1]*=t,n}function ca(n,t){if(t.canWrapX()){const e=J(t.getExtent()),i=Bl(n,t,e);i&&(n[0]-=i*e)}return n}function Bl(n,t,e){const i=t.getExtent();let s=0;return t.canWrapX()&&(n[0]i[2])&&(e=e||J(i),s=Math.floor((n[0]-i[0])/e)),s}function ua(n){return Math.pow(n,3)}function wi(n){return 1-ua(1-n)}function Ul(n){return 3*n*n-2*n*n*n}function Vl(n){return n}const jl=63710088e-1;function Hr(n,t,e){e=e||jl;const i=Te(n[1]),s=Te(t[1]),r=(s-i)/2,o=Te(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 da(...n){console.warn(...n)}const rr={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class or{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=t.extent!==void 0?t.extent:null,this.worldExtent_=t.worldExtent!==void 0?t.worldExtent:null,this.axisOrientation_=t.axisOrientation!==void 0?t.axisOrientation:"enu",this.global_=t.global!==void 0?t.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||rr[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 sn=6378137,ai=Math.PI*sn,Hl=[-ai,-ai,ai,ai],ql=[-180,-85,180,85],_n=sn*Math.log(Math.tan(Math.PI/2));class qe extends or{constructor(t){super({code:t,units:"m",extent:Hl,global:!0,worldExtent:ql,getPointResolution:function(e,i){return e/Math.cosh(i[1]/sn)}})}}const qr=[new qe("EPSG:3857"),new qe("EPSG:102100"),new qe("EPSG:102113"),new qe("EPSG:900913"),new qe("http://www.opengis.net/def/crs/EPSG/0/3857"),new qe("http://www.opengis.net/gml/srs/epsg.xml#3857")];function $l(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_n?o=_n:o<-_n&&(o=-_n),t[r+1]=o}return t}function Jl(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;reo&&(t=eo);const i=Te(t),s=Math.sin(i),r=Math.cos(i),o=s/r,a=o*o,l=a*a,h=Te(n),c=ma(e.number),u=Te(c),d=Mn/Math.sqrt(1-Gt*s**2),f=Fe*r**2,g=r*Gs(h-u,-Math.PI,Math.PI),m=g*g,_=m*g,p=_*g,E=p*g,C=E*g,y=Mn*(_a*i-nh*Math.sin(2*i)+sh*Math.sin(4*i)-rh*Math.sin(6*i)),x=An*d*(g+_/6*(1-a+f)+E/120*(5-18*a+l+72*f-58*Fe))+5e5;let R=An*(y+d*o*(m/2+p/24*(5-a+9*f+4*f**2)+C/720*(61-58*a+l+600*f-330*Fe)));return e.north||(R+=1e7),[x,R]}function ma(n){return(n-1)*6-180+3}const gh=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function pa(n){let t=0;for(const s of gh){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 io(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=l?t[o+h]:a[h]}return e})}function mf(n,t){return ya(),dr(n,"EPSG:4326","EPSG:3857")}function Tn(n,t){if(n===t)return!0;const e=n.getUnits()===t.getUnits();return(n.getCode()===t.getCode()||ur(n,t)===hr)&&e}function ur(n,t){const e=n.getCode(),i=t.getCode();let s=fs(e,i);if(s)return s;let r=null,o=null;for(const l of ph)r||(r=l(n)),o||(o=l(t));if(!r&&!o)return null;const a="EPSG:4326";if(o)if(r)s=gs(r.inverse,o.forward);else{const l=fs(e,a);l&&(s=gs(l,o.forward))}else{const l=fs(a,i);l&&(s=gs(r.inverse,l))}return s&&(Zs(n),Zs(t),Ui(n,t,s)),s}function gs(n,t){return function(e,i,s,r){return i=n(e,i,s,r),t(i,i,s,r)}}function bn(n,t){const e=It(n),i=It(t);return ur(e,i)}function dr(n,t,e){const i=bn(t,e);if(!i){const s=It(t).getCode(),r=It(e).getCode();throw new Error(`No transform available between ${s} and ${r}`)}return i(n,void 0,n.length)}function Bs(n,t){return n}function ne(n,t){return Ks&&!Ln(n,[0,0])&&n[0]>=-180&&n[0]<=180&&n[1]>=-90&&n[1]<=90&&(Ks=!1,da("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),n}function Ea(n,t){return n}function Ce(n,t){return n}function wh(){so(qr),so(Jr),xh(Jr,qr,$l,Jl)}wh();new Array(6);function Zt(){return[1,0,0,1,0,0]}function Rh(n,t){return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n}function ht(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 he(n,t,e,i,s,r,o,a){const l=Math.sin(r),h=Math.cos(r);return n[0]=i*h,n[1]=s*l,n[2]=-i*l,n[3]=s*h,n[4]=o*i*h-a*i*l+t,n[5]=o*s*l+a*s*h+e,n}function xa(n,t){const e=Th(t);q(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 Th(n){return n[0]*n[3]-n[1]*n[2]}const Ih=[1e5,1e5,1e5,1e5,2,2];function Sh(n){return"matrix("+n.join(", ")+")"}function Us(n){return n.substring(7,n.length-1).split(",").map(parseFloat)}function vh(n,t){const e=Us(n),i=Us(t);for(let s=0;s<6;++s)if(Math.round((e[s]-i[s])*Ih[s])!==0)return!1;return!0}function Ie(n,t,e,i,s,r,o){r=r||[],o=o||2;let a=0;for(let l=t;l{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 U()}closestPointXY(t,e,i,s){return U()}containsXY(t,e){return this.closestPointXY(t,e,Mh,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 U()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&Zn(e),this.extentRevision_=this.getRevision()}return Wl(this.extent_,t)}rotate(t,e){U()}scale(t,e,i){U()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return U()}getType(){return U()}applyTransform(t){U()}intersectsExtent(t){return U()}translate(t,e){U()}transform(t,e){const i=It(t),s=i.getUnits()=="tile-pixels"?function(r,o,a){const l=i.getExtent(),h=i.getWorldExtent(),c=yt(h)/yt(l);he(ro,h[0],h[3],c,-c,0,0,0);const u=Ie(r,0,r.length,a,ro,o),d=bn(i,e);return d?d(u,u,a):u}:bn(i,e);return this.applyTransform(s),this}}class fr extends bh{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return nr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return U()}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().length1)u=e;else if(d>0){for(let f=0;fs&&(s=h),r=a,o=l}return s}function Fh(n,t,e,i,s){for(let r=0,o=e.length;r0;){const u=h.pop(),d=h.pop();let f=0;const g=n[d],m=n[d+1],_=n[u],p=n[u+1];for(let E=d+i;Ef&&(c=E,f=x)}f>s&&(l[(c-t)/i]=1,d+i0&&m>f)&&(g<0&&_0&&_>g)){h=u,c=d;continue}r[o++]=h,r[o++]=c,a=h,l=c,h=u,c=d}return r[o++]=h,r[o++]=c,o}function Sa(n,t,e,i,s,r,o,a){for(let l=0,h=e.length;lr&&(h-a)*(r-l)-(s-a)*(c-l)>0&&o++:c<=r&&(h-a)*(r-l)-(s-a)*(c-l)<0&&o--,a=h,l=c}return o!==0}function va(n,t,e,i,s,r){if(e.length===0||!ke(n,t,e[0],i,s,r))return!1;for(let o=1,a=e.length;op&&(h=(c+u)/2,va(n,t,e,i,h,g)&&(_=h,p=E)),c=u}return isNaN(_)&&(_=s[r]),o?(o.push(_,g,p),o):[_,g,p]}function Yh(n,t,e,i,s){let r=[];for(let o=0,a=e.length;o=s[0]&&r[2]<=s[2]||r[1]>=s[1]&&r[3]<=s[3]?!0:Kh(n,t,e,i,function(o,a){return Yl(s,o,a)}):!1}function Aa(n,t,e,i,s){return!!(La(n,t,e,i,s)||ke(n,t,e,i,s[0],s[1])||ke(n,t,e,i,s[0],s[3])||ke(n,t,e,i,s[2],s[1])||ke(n,t,e,i,s[2],s[3]))}function Zh(n,t,e,i,s){if(!Aa(n,t,e[0],i,s))return!1;if(e.length===1)return!0;for(let r=1,o=e.length;r0}function Uh(n,t,e,i,s){s=s!==void 0?s:!1;for(let r=0,o=e.length;rc&&d1&&typeof arguments[e-1]=="function"&&(i=arguments[e-1],--e);let s=0;for(;s0}getInteracting(){return this.hints_[gt.INTERACTING]>0}cancelAnimations(){this.setHint(gt.ANIMATING,-this.hints_[gt.ANIMATING]);let t;for(let e=0,i=this.animations_.length;e=0;--i){const s=this.animations_[i];let r=!0;for(let o=0,a=s.length;o0?h/l.duration:1;c>=1?(l.complete=!0,c=1):r=!1;const u=l.easing(c);if(l.sourceCenter){const d=l.sourceCenter[0],f=l.sourceCenter[1],g=l.targetCenter[0],m=l.targetCenter[1];this.nextCenter_=l.targetCenter;const _=d+u*(g-d),p=f+u*(m-f);this.targetCenter_=[_,p]}if(l.sourceResolution&&l.targetResolution){const d=u===1?l.targetResolution:l.sourceResolution+u*(l.targetResolution-l.sourceResolution);if(l.anchor){const f=this.getViewportSize_(this.getRotation()),g=this.constraints_.resolution(d,0,f,!0);this.targetCenter_=this.calculateCenterZoom(g,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=d,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){const d=u===1?ci(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(gt.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const o=s[0].callback;o&&mn(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]],sr(i,t-this.getRotation()),Kl(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&&Bs(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 Ea(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();q(e,"The view center is not defined");const i=this.getResolution();q(i!==void 0,"The view resolution is not defined");const s=this.getRotation();return q(s!==void 0,"The view rotation is not defined"),Ws(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(Ce(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=J(t)/e[0],s=yt(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=ms(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=tr(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=et(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,et(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(q(Array.isArray(t)||typeof t.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){q(!jn(t),"Cannot fit empty extent provided as `geometry`");const s=Ce(t,this.getProjection());i=co(s)}else if(t.getType()==="Circle"){const s=Ce(t.getExtent(),this.getProjection());i=co(s),i.rotate(this.getRotation(),Ye(s))}else i=t;this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),s=Math.sin(-e),r=t.getFlatCoordinates(),o=t.getStride();let a=1/0,l=1/0,h=-1/0,c=-1/0;for(let u=0,d=r.length;ui.trim().replace(/^['"]|['"]$/g,"")),e};function ot(n,t,e,i){let s;return e&&e.length?s=e.shift():At?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 ps;function On(){return ps||(ps=ot(1,1)),ps}function Jn(n){const t=n.canvas;t.width=1,t.height=1,n.clearRect(0,0,1,1)}function mo(n,t){const e=t.parentNode;e&&e.replaceChild(n,t)}function sc(n){for(;n.lastChild;)n.lastChild.remove()}function rc(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 Ma(){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 we(n){return typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas}class Rr extends $t{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;es.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=>Il(()=>s))),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!ve(e,this.renderedAttributions_)){sc(this.ulElement_);for(let s=0,r=e.length;s0&&i%(2*Math.PI)!==0?e.animate({rotation:0,duration:this.duration_,easing:wi}):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(pn);!r&&i===0?this.element.classList.add(pn):r&&i!==0&&this.element.classList.remove(pn)}this.label_.style.transform=s}this.rotation_=i}}class lc extends Rr{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=t.className!==void 0?t.className:"ol-zoom",i=t.delta!==void 0?t.delta:1,s=t.zoomInClassName!==void 0?t.zoomInClassName:e+"-in",r=t.zoomOutClassName!==void 0?t.zoomOutClassName:e+"-out",o=t.zoomInLabel!==void 0?t.zoomInLabel:"+",a=t.zoomOutLabel!==void 0?t.zoomOutLabel:"–",l=t.zoomInTipLabel!==void 0?t.zoomInTipLabel:"Zoom in",h=t.zoomOutTipLabel!==void 0?t.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=s,c.setAttribute("type","button"),c.title=l,c.appendChild(typeof o=="string"?document.createTextNode(o):o),c.addEventListener(W.CLICK,this.handleClick_.bind(this,i),!1);const u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=h,u.appendChild(typeof a=="string"?document.createTextNode(a):a),u.addEventListener(W.CLICK,this.handleClick_.bind(this,-i),!1);const d=e+" "+$n+" "+wr,f=this.element;f.className=d,f.appendChild(c),f.appendChild(u),this.duration_=t.duration!==void 0?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const i=this.getMap().getView();if(!i)return;const s=i.getZoom();if(s!==void 0){const r=i.getConstrainedZoom(s+t);this.duration_>0?(i.getAnimating()&&i.cancelAnimations(),i.animate({zoom:r,duration:this.duration_,easing:wi})):i.setZoom(r)}}}function hc(n){n=n||{};const t=new Ft;return(n.zoom!==void 0?n.zoom:!0)&&t.push(new lc(n.zoomOptions)),(n.rotate!==void 0?n.rotate:!0)&&t.push(new ac(n.rotateOptions)),(n.attribution!==void 0?n.attribution:!0)&&t.push(new oc(n.attributionOptions)),t}class cc{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]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 po={ACTIVE:"active"};class rn extends $t{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(po.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(po.ACTIVE,t)}setMap(t){this.map_=t}}function uc(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:Vl,center:n.getConstrainedCenter(s)})}}function Tr(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:wi})}class dc extends rn{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==nt.DBLCLICK){const i=t.originalEvent,s=t.map,r=t.coordinate,o=i.shiftKey?-this.delta_:this.delta_,a=s.getView();Tr(a,o,r,this.duration_),i.preventDefault(),e=!0}return!e}}function Hs(n){const t=arguments;return function(e){let i=!0;for(let s=0,r=t.length;s0}}else if(t.type==nt.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==nt.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 Ir(n){const t=n.length;let e=0,i=0;for(let s=0;s0&&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 xc extends on{constructor(t){t=t||{},super({stopDown:Wn}),this.condition_=t.condition?t.condition:fc,this.lastAngle_=void 0,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){if(!ys(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===xr)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 ys(t)?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){return ys(t)&&Da(t)&&this.condition_(t)?(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}class Cc extends Xn{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 ji([s])}getGeometry(){return this.geometry_}}const $e={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class Ai extends ce{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}class wc extends on{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new Cc(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??Da,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($e.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?$e.BOXEND:$e.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($e.BOXSTART,t.coordinate,t)),!0):!1}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Ai($e.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Ai($e.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}}class Rc extends wc{constructor(t){t=t||{};const e=t.condition?t.condition:pc;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:wi})}}const De={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};class Tc extends rn{constructor(t){super(),t=t||{},this.defaultCondition_=function(e){return Oa(e)&&Pa(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==W.KEYDOWN){const i=t.originalEvent,s=i.key;if(this.condition_(t)&&(s==De.DOWN||s==De.LEFT||s==De.RIGHT||s==De.UP)){const o=t.map.getView(),a=o.getResolution()*this.pixelDelta_;let l=0,h=0;s==De.DOWN?h=-a:s==De.LEFT?l=-a:s==De.RIGHT?l=a:h=a;const c=[l,h];sr(c,o.getRotation()),uc(o,c,this.duration_),i.preventDefault(),e=!0}}return!e}}class Ic extends rn{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(e){return!mc(e)&&Pa(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==W.KEYDOWN||t.type==W.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();Tr(a,o,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}}const Sc=40,vc=300;class Lc extends rn{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:_c;this.condition_=t.onFocusOnly?Hs(ba,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!==W.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*=Sc;break;case WheelEvent.DOM_DELTA_PAGE:r*=vc;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=-et(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),Tr(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 Ac extends on{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=Wn),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!==xr&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(Ir(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 Mc extends on{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=Wn),super(e),this.anchor_=null,this.duration_=t.duration!==void 0?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],s=this.targetPointers[1],r=i.clientX-s.clientX,o=i.clientY-s.clientY,a=Math.sqrt(r*r+o*o);this.lastDistance_!==void 0&&(e=this.lastDistance_/a),this.lastDistance_=a;const l=t.map,h=l.getView();e!=1&&(this.lastScaleDelta_=e),this.anchor_=l.getCoordinateFromPixelInternal(l.getEventPixel(Ir(this.targetPointers))),l.render(),h.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const i=t.map.getView(),s=this.lastScaleDelta_>1?1:-1;return i.endInteraction(this.duration_,s),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}function bc(n){n=n||{};const t=new Ft,e=new cc(-.005,.05,100);return(n.altShiftDragRotate!==void 0?n.altShiftDragRotate:!0)&&t.push(new xc),(n.doubleClickZoom!==void 0?n.doubleClickZoom:!0)&&t.push(new dc({delta:n.zoomDelta,duration:n.zoomDuration})),(n.dragPan!==void 0?n.dragPan:!0)&&t.push(new Ec({onFocusOnly:n.onFocusOnly,kinetic:e})),(n.pinchRotate!==void 0?n.pinchRotate:!0)&&t.push(new Ac),(n.pinchZoom!==void 0?n.pinchZoom:!0)&&t.push(new Mc({duration:n.zoomDuration})),(n.keyboard!==void 0?n.keyboard:!0)&&(t.push(new Tc),t.push(new Ic({delta:n.zoomDelta,duration:n.zoomDuration}))),(n.mouseWheelZoom!==void 0?n.mouseWheelZoom:!0)&&t.push(new Lc({onFocusOnly:n.onFocusOnly,duration:n.zoomDuration})),(n.shiftDragZoom!==void 0?n.shiftDragZoom:!0)&&t.push(new Rc({duration:n.zoomDuration})),t}const $={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 Fa extends $t{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[$.OPACITY]=t.opacity!==void 0?t.opacity:1,q(typeof e[$.OPACITY]=="number","Layer opacity must be a number"),e[$.VISIBLE]=t.visible!==void 0?t.visible:!0,e[$.Z_INDEX]=t.zIndex,e[$.MAX_RESOLUTION]=t.maxResolution!==void 0?t.maxResolution:1/0,e[$.MIN_RESOLUTION]=t.minResolution!==void 0?t.minResolution:0,e[$.MIN_ZOOM]=t.minZoom!==void 0?t.minZoom:-1/0,e[$.MAX_ZOOM]=t.maxZoom!==void 0?t.maxZoom:1/0,this.className_=e.className!==void 0?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:t===void 0?!0:t},i=this.getZIndex();return e.opacity=et(Math.round(this.getOpacity()*100)/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=i===void 0&&!e.managed?1/0:i,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return U()}getLayerStatesArray(t){return U()}getExtent(){return this.get($.EXTENT)}getMaxResolution(){return this.get($.MAX_RESOLUTION)}getMinResolution(){return this.get($.MIN_RESOLUTION)}getMinZoom(){return this.get($.MIN_ZOOM)}getMaxZoom(){return this.get($.MAX_ZOOM)}getOpacity(){return this.get($.OPACITY)}getSourceState(){return U()}getVisible(){return this.get($.VISIBLE)}getZIndex(){return this.get($.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set($.EXTENT,t)}setMaxResolution(t){this.set($.MAX_RESOLUTION,t)}setMinResolution(t){this.set($.MIN_RESOLUTION,t)}setMaxZoom(t){this.set($.MAX_ZOOM,t)}setMinZoom(t){this.set($.MIN_ZOOM,t)}setOpacity(t){q(typeof t=="number","Layer opacity must be a number"),this.set($.OPACITY,t)}setVisible(t){this.set($.VISIBLE,t)}setZIndex(t){this.set($.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}const de={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"};class xe extends ce{constructor(t,e){super(t),this.layer=e}}const Es={LAYERS:"layers"};class Ri extends Fa{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(Es.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new Ft(i.slice(),{unique:!0}):q(typeof i.getArray=="function","Expected `layers` to be an array or a `Collection`"):i=new Ft(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(tt),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(V(t,Et.ADD,this.handleLayersAdd_,this),V(t,Et.REMOVE,this.handleLayersRemove_,this));for(const i in this.listenerKeys_)this.listenerKeys_[i].forEach(tt);en(this.listenerKeys_);const e=t.getArray();for(let i=0,s=e.length;i{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 re?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 Sr(s,e.viewState)&&(!r||wt(r,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];const i=t instanceof re?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($.MAP,t)}getMapInternal(){return this.get($.MAP)}setMap(t){this.mapPrecomposeKey_&&(tt(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(tt(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=V(t,kt.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=V(this,W.CHANGE,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);q(!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($.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 Sr(n,t){if(!n.visible)return!1;const e=t.resolution;if(e=n.maxResolution)return!1;const i=t.zoom;return i>n.minZoom&&i<=n.maxZoom}function ka(n,t,e=0,i=n.length-1,s=Dc){for(;i>e;){if(i-e>600){const l=i-e+1,h=t-e+1,c=Math.log(l),u=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*u*(l-u)/l)*(h-l/2<0?-1:1),f=Math.max(e,Math.floor(t-h*u/l+d)),g=Math.min(i,Math.floor(t+(l-h)*u/l+d));ka(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);o0;)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 Dc(n,t){return nt?1:0}let Na=class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const i=[];if(!En(t,e))return i;const s=this.toBBox,r=[];for(;e;){for(let o=0;o=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=si(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,Je(i,this.toBBox),Je(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)}_splitRoot(t,e){this.data=si([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Je(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),h=Fi(t,a,i,this.toBBox),c=Nc(l,h),u=xs(l)+xs(h);c=e;h--){const c=t.children[h];ki(a,t.leaf?r(c):c),l+=yn(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():Je(t[e],this.toBBox)}};function Oc(n,t,e){if(!e)return t.indexOf(n);for(let i=0;i=n.minX&&t.maxY>=n.minY}function si(n){return{children:n,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function yo(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;ka(n,o,t,e,s),r.push(t,o,o,e)}}const vr=[NaN,NaN,NaN,0];let ws;function Gc(){return ws||(ws=ot(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),ws}const zc=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Xc=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Wc=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Yc=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function xn(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 Ga(n){if(n.toLowerCase().startsWith("rgb")){const r=n.match(Xc)||n.match(zc)||n.match(Wc);if(r){const o=r[4],a=100/255;return[et(xn(r[1],a)+.5|0,0,255),et(xn(r[2],a)+.5|0,0,255),et(xn(r[3],a)+.5|0,0,255),o!==void 0?et(xn(o,100),0,1):1]}Yi(n)}if(n.startsWith("#")){if(Yc.test(n)){const r=n.substring(1),o=r.length<=4?1:2,a=[0,0,0,255];for(let l=0,h=r.length;l.0031308?Math.pow(n,1/2.4)*269.025-14.025:n*3294.6}function Is(n){return n>.2068965?Math.pow(n,3):(n-4/29)*(108/841)}function Ss(n){return n>10.314724?Math.pow((n+14.025)/269.025,2.4):n/3294.6}function vs(n){return n>.0088564?Math.pow(n,1/3):n/(108/841)+4/29}function Eo(n){const t=Ss(n[0]),e=Ss(n[1]),i=Ss(n[2]),s=vs(t*.222488403+e*.716873169+i*.06060791),r=500*(vs(t*.452247074+e*.399439023+i*.148375274)-s),o=200*(s-vs(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 Uc(n){const t=(n[0]+16)/116,e=n[1],i=n[2]*Math.PI/180,s=Is(t),r=Is(t+e/500*Math.cos(i)),o=Is(t-e/200*Math.sin(i)),a=Ts(r*3.021973625-s*1.617392459-o*.404875592),l=Ts(r*-.943766287+s*1.916279586+o*.027607165),h=Ts(r*.069407491-s*.22898585+o*1.159737864);return[et(a+.5|0,0,255),et(l+.5|0,0,255),et(h+.5|0,0,255),n[3]]}function Lr(n){if(n==="none")return vr;if(bi.hasOwnProperty(n))return bi[n];if(Rs>=Zc){let e=0;for(const i in bi)(e++&3)===0&&(delete bi[i],--Rs)}const t=Ga(n);t.length!==4&&Yi(n);for(const e of t)isNaN(e)&&Yi(n);return bi[n]=t,++Rs,t}function yi(n){return Array.isArray(n)?n:Lr(n)}function Ar(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 xo(n){return n[0]>0&&n[1]>0}function Vc(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 Tt(n,t){return Array.isArray(n)?n:(t===void 0?t=[n,n]:(t[0]=n,t[1]=n),t)}let Be=0;const pt=1<",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"},$c={[w.Get]:N(z(1,1/0),Co),[w.Var]:N(z(1,1),Jc),[w.Has]:N(z(1,1/0),Co),[w.Id]:N(Qc,Qe),[w.Concat]:N(z(2,1/0),H(xt)),[w.GeometryType]:N(tu,Qe),[w.LineMetric]:N(Qe),[w.Resolution]:N(Ls,Qe),[w.Zoom]:N(Ls,Qe),[w.Time]:N(Ls,Qe),[w.Any]:N(z(2,1/0),H(pt)),[w.All]:N(z(2,1/0),H(pt)),[w.Not]:N(z(1,1),H(pt)),[w.Equal]:N(z(2,2),H(Cn)),[w.NotEqual]:N(z(2,2),H(Cn)),[w.GreaterThan]:N(z(2,2),H(B)),[w.GreaterThanOrEqualTo]:N(z(2,2),H(B)),[w.LessThan]:N(z(2,2),H(B)),[w.LessThanOrEqualTo]:N(z(2,2),H(B)),[w.Multiply]:N(z(2,1/0),wo),[w.Coalesce]:N(z(2,1/0),wo),[w.Divide]:N(z(2,2),H(B)),[w.Add]:N(z(2,1/0),H(B)),[w.Subtract]:N(z(2,2),H(B)),[w.Clamp]:N(z(3,3),H(B)),[w.Mod]:N(z(2,2),H(B)),[w.Pow]:N(z(2,2),H(B)),[w.Abs]:N(z(1,1),H(B)),[w.Floor]:N(z(1,1),H(B)),[w.Ceil]:N(z(1,1),H(B)),[w.Round]:N(z(1,1),H(B)),[w.Sin]:N(z(1,1),H(B)),[w.Cos]:N(z(1,1),H(B)),[w.Atan]:N(z(1,2),H(B)),[w.Sqrt]:N(z(1,1),H(B)),[w.Match]:N(z(4,1/0),Ro,iu),[w.Between]:N(z(3,3),H(B)),[w.Interpolate]:N(z(6,1/0),Ro,nu),[w.Case]:N(z(3,1/0),eu,su),[w.In]:N(z(2,2),ru),[w.Number]:N(z(1,1/0),H(Cn)),[w.String]:N(z(1,1/0),H(Cn)),[w.Array]:N(z(1,1/0),H(B)),[w.Color]:N(z(1,4),H(B)),[w.Band]:N(z(1,3),H(B)),[w.Palette]:N(z(2,2),ou),[w.ToString]:N(z(1,1),H(pt|B|xt|Kt))};function Co(n,t,e){const i=n.length-1,s=new Array(i);for(let r=0;rt){const a=t===1/0?`${n} or more`:`${n} to ${t}`;throw new Error(`expected ${a} arguments for ${r}, got ${o}`)}}}function wo(n,t,e){const i=n.length-1,s=new Array(i);for(let r=0;ri.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 uu(n);case w.Equal:case w.NotEqual:case w.LessThan:case w.LessThanOrEqualTo:case w.GreaterThan:case w.GreaterThanOrEqualTo:return cu(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 du(n);case w.Case:return fu(n);case w.Match:return gu(n);case w.Interpolate:return _u(n);case w.ToString:return mu(n);default:throw new Error(`Unsupported operator ${e}`)}}function lu(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r{for(let o=0;o{for(let o=0;o{const r=n.args;let o=s.properties[i];for(let a=1,l=r.length;as.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;ai(r)===s(r);case w.NotEqual:return r=>i(r)!==s(r);case w.LessThan:return r=>i(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 uu(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r{for(let o=0;o{for(let o=0;o{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!s[0](r);default:throw new Error(`Unsupported logical operator ${e}`)}}function du(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r{let o=1;for(let a=0;as[0](r)/s[1](r);case w.Add:return r=>{let o=0;for(let a=0;as[0](r)-s[1](r);case w.Clamp:return r=>{const o=s[0](r),a=s[1](r);if(ol?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 fu(n,t){const e=n.args.length,i=new Array(e);for(let s=0;s{for(let r=0;r{const r=i[0](s);for(let o=1;o{const r=i[0](s),o=i[1](s);let a,l;for(let h=2;h=o)return h===2?u:d?pu(r,o,a,l,c,u):Xi(r,o,a,l,c,u);a=c,l=u}return l}}function mu(n,t){const e=n.operator,i=n.args.length,s=new Array(i);for(let r=0;r{const o=s[0](r);return n.args[0].type===Kt?Ar(o):o.toString()};default: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 pu(n,t,e,i,s,r){if(s-e===0)return i;const a=Eo(i),l=Eo(r);let h=l[2]-a[2];h>180?h-=360:h<-180&&(h+=360);const c=[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,h),Xi(n,t,e,i[3],s,r[3])];return Uc(c)}const X={IDLE:0,LOADING:1,LOADED:2,ERROR:3};function yu(n,t,e){const i=n;let s=!0,r=!1,o=!1;const a=[Sn(i,W.LOAD,function(){o=!0,r||t()})];return i.src&&Qo?(r=!0,i.decode().then(function(){s&&t()}).catch(function(l){s&&(o?t():e())})):a.push(Sn(i,W.ERROR,e)),function(){s=!1,a.forEach(tt)}}function Eu(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 xu(n,t){return t&&(n.src=t),n.src&&Qo?new Promise((e,i)=>n.decode().then(()=>e(n)).catch(s=>n.complete&&n.width?e(n):i(s))):Eu(n)}class Cu{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,i){const s=As(t,e,i);return s in this.cache_?this.cache_[s]:null}getPattern(t,e,i){const s=As(t,e,i);return s in this.patternCache_?this.patternCache_[s]:null}set(t,e,i,s,r){const o=As(t,e,i),a=o in this.cache_;this.cache_[o]=s,r&&(s.getImageState()===X.IDLE&&s.load(),s.getImageState()===X.LOADING?s.ready().then(()=>{this.patternCache_[o]=On().createPattern(s.getImage(1),"repeat")}):this.patternCache_[o]=On().createPattern(s.getImage(1),"repeat")),a||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function As(n,t,e){const i=e?yi(e):"null";return t+":"+n+":"+i}const Nt=new Cu;let Di=null;class Ya extends Yn{constructor(t,e,i,s,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i,this.canvas_={},this.color_=r,this.imageState_=s===void 0?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_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===X.LOADED){Di||(Di=ot(1,1,void 0,{willReadFrequently:!0})),Di.drawImage(this.image_,0,0);try{Di.getImageData(0,0,1,1),this.tainted_=!1}catch{Di=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(W.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_}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&&xu(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=Kc(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(W.CHANGE,e),t())};this.addEventListener(W.CHANGE,e)}})),this.ready_}}function Pn(n,t,e,i,s,r){let o=t===void 0?void 0:Nt.get(t,e,s);return o||(o=new Ya(n,n&&"src"in n?n.src||void 0:t,e,i,s),Nt.set(t,e,s,o,r)),r&&o&&!Nt.getPattern(t,e,s)&&Nt.set(t,e,s,o,r),o}function qt(n){return n?Array.isArray(n)?Ar(n):typeof n=="object"&&"src"in n?wu(n):n:null}function wu(n){if(!n.offset||!n.size)return Nt.getPattern(n.src,"anonymous",n.color);const t=n.src+":"+n.offset,e=Nt.getPattern(t,void 0,n.color);if(e)return e;const i=Nt.get(n.src,"anonymous",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]),Pn(s.canvas,t,void 0,X.LOADED,n.color,!0),Nt.getPattern(t,void 0,n.color)}const Ka="10px sans-serif",Ct="#000",Ei="round",ae=[],le=0,xi="round",Hi=10,qi="#000",$i="center",Fn="middle",Ne=[0,0,0,0],Ji=1,ri=new $t;let Oi=null,To;const qs={},Ru=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Tu(n,t,e){return`${n} ${t} 16px "${e}"`}const Iu=(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(),h=a.weight;return o.some(c=>{const u=c.family.replace(/^['"]|['"]$/g,"").toLowerCase(),d=Vs[c.weight]||c.weight;return u===l&&c.style===a.style&&d==h})}async function s(){await e.ready;let r=!0;const o=ri.getProperties(),a=Object.keys(o).filter(l=>o[l]<100);for(let l=a.length-1;l>=0;--l){const h=a[l];let c=o[h];c<100&&(await i(h)?(en(qs),ri.set(h,100)):(c+=10,ri.set(h,c,!0),c<100&&(r=!1)))}t=void 0,r||(t=setTimeout(s,100))}return async function(r){e||(e=At?self.fonts:document.fonts);const o=js(r);if(!o)return;const a=o.families;let l=!1;for(const h of a){if(Ru.has(h))continue;const c=Tu(o.style,o.weight,h);ri.get(c)===void 0&&(ri.set(c,0,!0),l=!0)}l&&(clearTimeout(t),t=setTimeout(s,100))}})(),Su=(function(){let n;return function(t){let e=qs[t];if(e==null){if(At){const i=js(t),s=Za(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);qs[t]=e}return e}})();function Za(n,t){return Oi||(Oi=ot(1,1)),n!=To&&(Oi.font=n,To=Oi.font),Oi.measureText(t)}function Ba(n,t){return Za(n,t).width}function Io(n,t,e){if(t in e)return e[t];const i=t.split(` `).reduce((s,r)=>Math.max(s,Ba(n,r)),0);return e[t]=i,i}function vu(n,t){const e=[],i=[],s=[];let r=0,o=0,a=0,l=0;for(let h=0,c=t.length;h<=c;h+=2){const u=t[h];if(u===` `||h===c){r=Math.max(r,o),s.push(o),o=0,a+=l,l=0;continue}const d=t[h+1]||n.font,f=Ba(d,u);e.push(f),o+=f;const g=Su(d);i.push(g),l=Math.max(l,g)}return{width:r,height:a,widths:e,heights:i,lineWidths:s}}function Lu(n,t,e,i,s,r,o,a,l,h,c){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,h),n.scale(c[0],c[1]),Au(i,n)):c[0]<0||c[1]<0?(n.translate(l,h),n.scale(c[0],c[1]),n.drawImage(i,s,r,o,a,0,0,o,a)):n.drawImage(i,s,r,o,a,l,h,o*c[0],a*c[1]),n.restore()}function Au(n,t){const e=n.contextInstructions;for(let i=0,s=e.length;ithis.imageState_=X.LOADED),this.render()}clone(){const t=this.getScale(),e=new es({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=Nt.get(i,null,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,Nt.set(i,null,null,new Ya(s,void 0,null,X.LOADED,null))}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}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(e===0||this.points_===1/0||t!=="bevel"&&t!=="miter")return e;let s=this.radius,r=this.radius2_===void 0?s:this.radius2_;if(s{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?j(t):typeof t=="object"&&"src"in t?t.src+":"+t.offset:yi(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}function So(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 ns extends ts{constructor(t){t=t||{};const e=t.opacity!==void 0?t.opacity:1,i=t.rotation!==void 0?t.rotation:0,s=t.scale!==void 0?t.scale:1,r=t.rotateWithView!==void 0?t.rotateWithView:!1;super({opacity:e,rotation:i,scale:s,displacement:t.displacement!==void 0?t.displacement:[0,0],rotateWithView:r,declutterMode:t.declutterMode}),this.anchor_=t.anchor!==void 0?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=t.anchorOrigin!==void 0?t.anchorOrigin:"top-left",this.anchorXUnits_=t.anchorXUnits!==void 0?t.anchorXUnits:"fraction",this.anchorYUnits_=t.anchorYUnits!==void 0?t.anchorYUnits:"fraction",this.crossOrigin_=t.crossOrigin!==void 0?t.crossOrigin:null;const o=t.img!==void 0?t.img:null;let a=t.src;q(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||j(o)),q(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),q(!((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?yi(t.color):null,this.iconImage_=Pn(o,a,this.crossOrigin_,l,this.color_),this.offset_=t.offset!==void 0?t.offset:[0,0],this.offsetOrigin_=t.offsetOrigin!==void 0?t.offsetOrigin:"top-left",this.origin_=null,this.size_=t.size!==void 0?t.size:null,this.initialOptions_,t.width!==void 0||t.height!==void 0){let h,c;if(t.size)[h,c]=t.size;else{const u=this.getImage(1);if(u.width&&u.height)h=u.width,c=u.height;else if(u instanceof HTMLImageElement){this.initialOptions_=t;const d=()=>{if(this.unlistenImageChange(d),!this.initialOptions_)return;const f=this.iconImage_.getSize();this.setScale(So(f[0],f[1],t.width,t.height))};this.listenImageChange(d);return}}h!==void 0&&this.setScale(So(h,c,t.width,t.height))}}clone(){let t,e,i;return this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new ns({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:i,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const s=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!s)return null;t=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(t[0]*=s[0]),this.anchorYUnits_=="fraction"&&(t[1]*=s[1])}if(this.anchorOrigin_!="top-left"){if(!s)return null;t===this.anchor_&&(t=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(t[0]=-t[0]+s[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(t[1]=-t[1]+s[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if(this.offsetOrigin_!="top-left"){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(t[0]=i[0]-e[0]-t[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(t){this.iconImage_=Pn(null,t,this.crossOrigin_,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(W.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(W.CHANGE,t)}ready(){return this.iconImage_.ready()}}class ss{constructor(t){t=t||{},this.color_=t.color!==void 0?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=t.lineDash!==void 0?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.width_=t.width}clone(){const t=this.getColor();return new ss({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setWidth(t){this.width_=t}}class Xe{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=vo,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 Xe({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_=vo,this.geometry_=t}setZIndex(t){this.zIndex_=t}}function Mu(n){let t;if(typeof n=="function")t=n;else{let e;Array.isArray(n)?e=n:(q(typeof n.getZIndex=="function","Expected an `Style` or an array of `Style`"),e=[n]),t=function(){return e}}return t}let Ms=null;function Ua(n,t){if(!Ms){const e=new Ci({color:"rgba(255,255,255,0.4)"}),i=new ss({color:"#3399CC",width:1.25});Ms=[new Xe({image:new is({fill:e,stroke:i,radius:5}),fill:e,stroke:i})]}return Ms}function vo(n){return n.getGeometry()}const bu="#333";class br{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_=Tt(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 Ci({color:bu}),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 br({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 Ci?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_=Tt(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 Du(n){return!0}function Ou(n){const t=za(),e=Pu(n,t),i=Wa();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=Xa(s.getGeometry())),e(i)}}function Lo(n){const t=za(),e=n.length,i=new Array(e);for(let o=0;onull;i=Dr(n,t+"fill-color",e)}if(!i)return null;const s=new Ci;return function(r){const o=i(r);return o===vr?null:(s.setColor(o),s)}}function tn(n,t,e){const i=Rt(n,t+"stroke-width",e),s=Dr(n,t+"stroke-color",e);if(!i&&!s)return null;const r=se(n,t+"stroke-line-cap",e),o=se(n,t+"stroke-line-join",e),a=Va(n,t+"stroke-line-dash",e),l=Rt(n,t+"stroke-line-dash-offset",e),h=Rt(n,t+"stroke-miter-limit",e),c=new ss;return function(u){if(s){const d=s(u);if(d===vr)return null;c.setColor(d)}if(i&&c.setWidth(i(u)),r){const d=r(u);if(d!=="butt"&&d!=="round"&&d!=="square")throw new Error("Expected butt, round, or square line cap");c.setLineCap(d)}if(o){const d=o(u);if(d!=="bevel"&&d!=="round"&&d!=="miter")throw new Error("Expected bevel, round, or miter line join");c.setLineJoin(d)}return a&&c.setLineDash(a(u)),l&&c.setLineDashOffset(l(u)),h&&c.setMiterLimit(h(u)),c}}function Fu(n,t){const e="text-",i=se(n,e+"value",t);if(!i)return null;const s=Qi(n,e,t),r=Qi(n,e+"background-",t),o=tn(n,e,t),a=tn(n,e+"background-",t),l=se(n,e+"font",t),h=Rt(n,e+"max-angle",t),c=Rt(n,e+"offset-x",t),u=Rt(n,e+"offset-y",t),d=di(n,e+"overflow",t),f=se(n,e+"placement",t),g=Rt(n,e+"repeat",t),m=rs(n,e+"scale",t),_=di(n,e+"rotate-with-view",t),p=Rt(n,e+"rotation",t),E=se(n,e+"align",t),C=se(n,e+"justify",t),y=se(n,e+"baseline",t),x=di(n,e+"keep-upright",t),R=Va(n,e+"padding",t),I=os(n,e+"declutter-mode"),T=new br({declutterMode:I});return function(v){if(T.setText(i(v)),s&&T.setFill(s(v)),r&&T.setBackgroundFill(r(v)),o&&T.setStroke(o(v)),a&&T.setBackgroundStroke(a(v)),l&&T.setFont(l(v)),h&&T.setMaxAngle(h(v)),c&&T.setOffsetX(c(v)),u&&T.setOffsetY(u(v)),d&&T.setOverflow(d(v)),f){const L=f(v);if(L!=="point"&&L!=="line")throw new Error("Expected point or line for text-placement");T.setPlacement(L)}if(g&&T.setRepeat(g(v)),m&&T.setScale(m(v)),_&&T.setRotateWithView(_(v)),p&&T.setRotation(p(v)),E){const L=E(v);if(L!=="left"&&L!=="center"&&L!=="right"&&L!=="end"&&L!=="start")throw new Error("Expected left, right, center, start, or end for text-align");T.setTextAlign(L)}if(C){const L=C(v);if(L!=="left"&&L!=="right"&&L!=="center")throw new Error("Expected left, right, or center for text-justify");T.setJustify(L)}if(y){const L=y(v);if(L!=="bottom"&&L!=="top"&&L!=="middle"&&L!=="alphabetic"&&L!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");T.setTextBaseline(L)}return R&&T.setPadding(R(v)),x&&T.setKeepUpright(x(v)),T}}function ku(n,t){return"icon-src"in n?Nu(n,t):"shape-points"in n?Gu(n,t):"circle-radius"in n?zu(n,t):null}function Nu(n,t){const e="icon-",i=e+"src",s=ja(n[i],i),r=kn(n,e+"anchor",t),o=rs(n,e+"scale",t),a=Rt(n,e+"opacity",t),l=kn(n,e+"displacement",t),h=Rt(n,e+"rotation",t),c=di(n,e+"rotate-with-view",t),u=Mo(n,e+"anchor-origin"),d=bo(n,e+"anchor-x-units"),f=bo(n,e+"anchor-y-units"),g=Zu(n,e+"color"),m=Yu(n,e+"cross-origin"),_=Ku(n,e+"offset"),p=Mo(n,e+"offset-origin"),E=Nn(n,e+"width"),C=Nn(n,e+"height"),y=Wu(n,e+"size"),x=os(n,e+"declutter-mode"),R=new ns({src:s,anchorOrigin:u,anchorXUnits:d,anchorYUnits:f,color:g,crossOrigin:m,offset:_,offsetOrigin:p,height:C,width:E,size:y,declutterMode:x});return function(I){return a&&R.setOpacity(a(I)),l&&R.setDisplacement(l(I)),h&&R.setRotation(h(I)),c&&R.setRotateWithView(c(I)),o&&R.setScale(o(I)),r&&R.setAnchor(r(I)),R}}function Gu(n,t){const e="shape-",i=e+"points",s=e+"radius",r=Js(n[i],i),o=Js(n[s],s),a=Qi(n,e,t),l=tn(n,e,t),h=rs(n,e+"scale",t),c=kn(n,e+"displacement",t),u=Rt(n,e+"rotation",t),d=di(n,e+"rotate-with-view",t),f=Nn(n,e+"radius2"),g=Nn(n,e+"angle"),m=os(n,e+"declutter-mode"),_=new es({points:r,radius:o,radius2:f,angle:g,declutterMode:m});return function(p){return a&&_.setFill(a(p)),l&&_.setStroke(l(p)),c&&_.setDisplacement(c(p)),u&&_.setRotation(u(p)),d&&_.setRotateWithView(d(p)),h&&_.setScale(h(p)),_}}function zu(n,t){const e="circle-",i=Qi(n,e,t),s=tn(n,e,t),r=Rt(n,e+"radius",t),o=rs(n,e+"scale",t),a=kn(n,e+"displacement",t),l=Rt(n,e+"rotation",t),h=di(n,e+"rotate-with-view",t),c=os(n,e+"declutter-mode"),u=new is({radius:5,declutterMode:c});return function(d){return r&&u.setRadius(r(d)),i&&u.setFill(i(d)),s&&u.setStroke(s(d)),a&&u.setDisplacement(a(d)),l&&u.setRotation(l(d)),h&&u.setRotateWithView(h(d)),o&&u.setScale(o(d)),u}}function Rt(n,t,e){if(!(t in n))return;const i=ue(n[t],B,e);return function(s){return Js(i(s),t)}}function se(n,t,e){if(!(t in n))return null;const i=ue(n[t],xt,e);return function(s){return ja(i(s),t)}}function Xu(n,t,e){const i=se(n,t+"pattern-src",e),s=Ao(n,t+"pattern-offset",e),r=Ao(n,t+"pattern-size",e),o=Dr(n,t+"color",e);return function(a){return{src:i(a),offset:s&&s(a),size:r&&r(a),color:o&&o(a)}}}function di(n,t,e){if(!(t in n))return null;const i=ue(n[t],pt,e);return function(s){const r=i(s);if(typeof r!="boolean")throw new Error(`Expected a boolean for ${t}`);return r}}function Dr(n,t,e){if(!(t in n))return null;const i=ue(n[t],Kt,e);return function(s){return Ha(i(s),t)}}function Va(n,t,e){if(!(t in n))return null;const i=ue(n[t],Ke,e);return function(s){return an(i(s),t)}}function kn(n,t,e){if(!(t in n))return null;const i=ue(n[t],Ke,e);return function(s){const r=an(i(s),t);if(r.length!==2)throw new Error(`Expected two numbers for ${t}`);return r}}function Ao(n,t,e){if(!(t in n))return null;const i=ue(n[t],Ke,e);return function(s){return qa(i(s),t)}}function rs(n,t,e){if(!(t in n))return null;const i=ue(n[t],Ke|B,e);return function(s){return Bu(i(s),t)}}function Nn(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 Wu(n,t){const e=n[t];if(e!==void 0){if(typeof e=="number")return Tt(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 Yu(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 Mo(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 bo(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 Ku(n,t){const e=n[t];if(e!==void 0)return an(e,t)}function os(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 Zu(n,t){const e=n[t];if(e!==void 0)return Ha(e,t)}function an(n,t){if(!Array.isArray(n))throw new Error(`Expected an array for ${t}`);const e=n.length;for(let i=0;i4)throw new Error(`Expected a color with 3 or 4 values for ${t}`);return e}function qa(n,t){const e=an(n,t);if(e.length!==2)throw new Error(`Expected an array of two numbers for ${t}`);return e}function Bu(n,t){return typeof n=="number"?n:qa(n,t)}const Do={RENDER_ORDER:"renderOrder"};class $a extends Qn{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(Do.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 Na(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(Do.RENDER_ORDER,t)}setStyle(t){this.style_=t===void 0?Ua:t;const e=Uu(t);this.styleFunction_=t===null?void 0:Mu(e),this.changed()}setDeclutter(t){this.declutter_=t?String(t):void 0,this.changed()}}function Uu(n){if(n===void 0)return Ua;if(!n)return null;if(typeof n=="function"||n instanceof Xe)return n;if(!Array.isArray(n))return Lo([n]);if(n.length===0)return[];const t=n.length,e=n[0];if(e instanceof Xe){const s=new Array(t);for(let r=0;r=0;--x){const R=m[x],I=R.layer;if(I.hasRenderer()&&Sr(R,c)&&a.call(l,I)){const T=I.getRenderer(),v=I.getSource();if(T&&v){const L=v.getWrapX()?f:t,k=u.bind(null,R.managed);E[0]=L[0]+g[y][0],E[1]=L[1]+g[y][1],h=T.forEachFeatureAtCoordinate(E,e,i,k,p)}if(h)return h}}if(p.length===0)return;const C=1/p.length;return p.forEach((y,x)=>y.distanceSq+=x*C),p.sort((y,x)=>y.distanceSq-x.distanceSq),p.some(y=>h=y.callback(y.feature,y.layer,y.geometry)),h}hasFeatureAtCoordinate(t,e,i,s,r,o){return this.forEachFeatureAtCoordinate(t,e,i,s,Ki,this,r,o)!==void 0}getMap(){return this.map_}renderFrame(t){U()}scheduleExpireIconCache(t){Nt.canExpireCache()&&t.postRenderFunctions.push(ju)}}function ju(n,t){Nt.expire()}class Hu extends Vu{constructor(t){super(t),this.fontChangeListenerKey_=V(ri,gi.PROPERTYCHANGE,t.redrawText,t),this.element_=At?Ma():document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=$n+" 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 Ja(t,void 0,e);i.dispatchEvent(s)}}disposeInternal(){tt(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(kt.PRECOMPOSE,t);const e=t.layerStatesArray.sort((h,c)=>h.zIndex-c.zIndex);e.some(h=>h.layer instanceof $a&&h.layer.getDeclutter())&&(t.declutter={});const s=t.viewState;this.children_.length=0;const r=[];let o=null;for(let h=0,c=e.length;h0)&&(h.fillStyle=d,h.fillRect(0,0,l.width,l.height)),we(u)&&u.width>0){const f=c.style.opacity||u.style.opacity;h.globalAlpha=f===""?1:Number(f);const g=u.style.transform;if(g)h.setTransform(...Us(g));else{const m=parseFloat(u.style.width)/u.width,_=parseFloat(u.style.height)/u.height;h.setTransform(m,0,0,_,0,0)}h.drawImage(u,0,0)}}h.globalAlpha=1,h.setTransform(1,0,0,1,0,0)}this.dispatchRenderEvent(kt.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 Qa(n){if(n instanceof Qn){n.setMapInternal(null);return}n instanceof Ri&&n.getLayers().forEach(Qa)}function tl(n,t){if(n instanceof Qn){n.setMapInternal(t);return}if(n instanceof Ri){const e=n.getLayers().getArray();for(let i=0,s=e.length;ithis.updateSize())),this.controls=e.controls||(At?new Ft:hc()),this.interactions=e.interactions||(At?new Ft:bc({onFocusOnly:!0})),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new Ol(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(ft.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(ft.VIEW,this.handleViewChanged_),this.addChangeListener(ft.SIZE,this.handleSizeChanged_),this.addChangeListener(ft.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const i=this;t.view&&!(t.view instanceof re)&&t.view.then(function(s){i.setView(new re(s))}),this.controls.addEventListener(Et.ADD,s=>{s.element.setMap(this)}),this.controls.addEventListener(Et.REMOVE,s=>{s.element.setMap(null)}),this.interactions.addEventListener(Et.ADD,s=>{s.element.setMap(this)}),this.interactions.addEventListener(Et.REMOVE,s=>{s.element.setMap(null)}),this.overlays_.addEventListener(Et.ADD,s=>{this.addOverlayInternal_(s.element)}),this.overlays_.addEventListener(Et.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){tl(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:Ki,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 Ri?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:Ki,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(ft.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return Bs(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?ht(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(ft.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof Ft){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=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[gt.ANIMATING]||o[gt.INTERACTING]){const a=Date.now()-t.time>8;s=a?0:8,r=a?0:2}}e.getTilesLoading(){this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new xe("removelayer",e)),this.set(ft.LAYERGROUP,t)}setSize(t){this.set(ft.SIZE,t)}setTarget(t){this.set(ft.TARGET,t)}setView(t){if(!t||t instanceof re){this.set(ft.VIEW,t);return}this.set(ft.VIEW,new re);const e=this;t.then(function(i){e.setView(new re(i))})}updateSize(){const t=this.getTargetElement();let e;if(t){let s,r;if(we(t))s=t.width,r=t.height;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)],!xo(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&da("No map visible because the map container's width or height are 0."))}const i=this.getSize();e&&(!i||!ve(e,i))&&(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}}function qu(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 Ri({layers:n.layers});e[ft.LAYERGROUP]=i,e[ft.TARGET]=n.target,e[ft.VIEW]=n.view instanceof re?n.view:new re;let s;n.controls!==void 0&&(Array.isArray(n.controls)?s=new Ft(n.controls.slice()):(q(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 Ft(n.interactions.slice()):(q(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 Ft(n.overlays.slice()):(q(typeof n.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=n.overlays):o=new Ft,{controls:s,interactions:r,keyboardEventTarget:t,overlays:o,values:e}}class Or extends Yn{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(W.CHANGE)}release(){this.setState(D.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==D.EMPTY){if(this.state!==D.ERROR&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){U()}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:ua(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 el extends Or{constructor(t,e,i,s,r,o){super(t,e,o),this.crossOrigin_=s,this.src_=i,this.key=i,this.image_,At?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,s!==null&&(this.image_.crossOrigin=s)),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=D.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}handleImageError_(){this.state=D.ERROR,this.unlistenImage_(),this.image_=$u(),this.changed()}handleImageLoad_(){if(At)this.state=D.LOADED;else{const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=D.LOADED:this.state=D.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==D.ERROR&&(this.state=D.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==D.IDLE&&(this.state=D.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=yu(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 $u(){const n=ot(1,1);return n.fillStyle="rgba(0,0,0,0)",n.fillRect(0,0,1,1),n.canvas}let bs;const fi=[];function Oo(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 Ds(n,t){return Math.abs(n[t*4]-210)>2||Math.abs(n[t*4+3]-.75*255)>2}function Ju(){if(bs===void 0){const n=ot(6,6,fi);n.globalCompositeOperation="lighter",n.fillStyle="rgba(210, 0, 0, 0.75)",Oo(n,4,5,4,0),Oo(n,4,5,0,5);const t=n.getImageData(0,0,3,3).data;bs=Ds(t,0)||Ds(t,4)||Ds(t,8),Jn(n),fi.push(n.canvas)}return bs}function Po(n,t,e,i){const s=dr(e,t,n);let r=no(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||mi(l,s)){const h=no(n,r,s)/r;isFinite(h)&&h>0&&(r/=h)}return r}function Qu(n,t,e,i){const s=Ye(e);let r=Po(n,t,s,i);return(!isFinite(r)||r<=0)&&oa(e,function(o){return r=Po(n,t,o,i),isFinite(r)&&r>0}),r}function td(n,t,e,i,s,r,o,a,l,h,c,u,d,f){const g=ot(Math.round(e*n),Math.round(e*t),fi);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 _=zt();l.forEach(function(x,R,I){Gl(_,x.extent)});let p;const E=e/i,C=(u?1:1+Math.pow(2,-24))/E;p=ot(Math.round(J(_)*E),Math.round(yt(_)*E),fi),u||(p.imageSmoothingEnabled=!1),l.forEach(function(x,R,I){if(x.image.width>0&&x.image.height>0){if(x.clipExtent){p.save();const b=(x.clipExtent[0]-_[0])*E,A=-(x.clipExtent[3]-_[3])*E,M=J(x.clipExtent)*E,Y=yt(x.clipExtent)*E;p.rect(u?b:Math.round(b),u?A:Math.round(A),u?M:Math.round(b+M)-Math.round(b),u?Y:Math.round(A+Y)-Math.round(A)),p.clip()}const T=(x.extent[0]-_[0])*E,v=-(x.extent[3]-_[3])*E,L=J(x.extent)*E,k=yt(x.extent)*E;p.drawImage(x.image,h,h,x.image.width-2*h,x.image.height-2*h,u?T:Math.round(T),u?v:Math.round(v),u?L:Math.round(T+L)-Math.round(T),u?k:Math.round(v+k)-Math.round(v)),x.clipExtent&&p.restore()}});const y=Ze(o);return a.getTriangles().forEach(function(x,R,I){const T=x.source,v=x.target;let L=T[0][0],k=T[0][1],b=T[1][0],A=T[1][1],M=T[2][0],Y=T[2][1];const F=m((v[0][0]-y[0])/r),G=m(-(v[0][1]-y[1])/r),P=m((v[1][0]-y[0])/r),K=m(-(v[1][1]-y[1])/r),Z=m((v[2][0]-y[0])/r),Q=m(-(v[2][1]-y[1])/r),S=L,ut=k;L=0,k=0,b-=S,A-=ut,M-=S,Y-=ut;const _t=[[b,A,0,0,P-F],[M,Y,0,0,Z-F],[0,0,b,A,K-G],[0,0,M,Y,Q-G]],st=kl(_t);if(!st)return;if(g.save(),g.beginPath(),Ju()||!u){g.moveTo(P,K);const dt=4,Ut=F-P,Xt=G-K;for(let vt=0;vtht(a,dr(C,this.targetProj_,this.sourceProj_))):bn(this.targetProj_,this.sourceProj_);this.transformInv_=function(C){const y=C[0]+"/"+C[1];return l[y]||(l[y]=h(C)),l[y]},this.maxSourceExtent_=s,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&J(s)>=J(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?J(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?J(this.targetProj_.getExtent()):null;const c=Ze(i),u=Vn(i),d=Un(i),f=Bn(i),g=this.transformInv_(c),m=this.transformInv_(u),_=this.transformInv_(d),p=this.transformInv_(f),E=ed+(o?Math.max(0,Math.ceil(Math.log2(Xs(i)/(o*o*256*256)))):0);if(this.addQuad_(c,u,d,f,g,m,_,p,E),this.wrapsXInSource_){let C=1/0;this.triangles_.forEach(function(y,x,R){C=Math.min(C,y.source[0][0],y.source[1][0],y.source[2][0])}),this.triangles_.forEach(y=>{if(Math.max(y.source[0][0],y.source[1][0],y.source[2][0])-C>this.sourceWorldWidth_/2){const x=[[y.source[0][0],y.source[0][1]],[y.source[1][0],y.source[1][1]],[y.source[2][0],y.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 R=Math.min(x[0][0],x[1][0],x[2][0]);Math.max(x[0][0],x[1][0],x[2][0])-R.5&&u<1;let g=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const _=jr([t,e,i,s]);g=J(_)/this.targetWorldWidth_>Fo||g}!f&&this.sourceProj_.isGlobal()&&u&&(g=u>Fo||g)}if(!g&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!wt(c,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(h>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(h>0){if(!g){const _=[(t[0]+i[0])/2,(t[1]+i[1])/2],p=this.transformInv_(_);let E;f?E=(ci(r[0],d)+ci(a[0],d))/2-ci(p[0],d):E=(r[0]+a[0])/2-p[0];const C=(r[1]+a[1])/2-p[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],p=this.transformInv_(_),E=[(s[0]+t[0])/2,(s[1]+t[1])/2],C=this.transformInv_(E);this.addQuad_(t,e,_,E,r,o,p,C,h-1),this.addQuad_(E,_,i,s,C,p,a,l,h-1)}else{const _=[(t[0]+e[0])/2,(t[1]+e[1])/2],p=this.transformInv_(_),E=[(i[0]+s[0])/2,(i[1]+s[1])/2],C=this.transformInv_(E);this.addQuad_(t,_,E,s,r,p,C,l,h-1),this.addQuad_(_,e,i,E,p,o,a,C,h-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=zt();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 nd=.5;class il extends Or{constructor(t,e,i,s,r,o,a,l,h,c,u,d){super(r,D.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?ze(f,g):f;if(Xs(_)===0){this.state=D.EMPTY;return}const p=t.getExtent();p&&(m?m=ze(m,p):m=p);const E=s.getResolution(this.wrappedTileCoord_[0]),C=Qu(t,i,_,E);if(!isFinite(C)||C<=0){this.state=D.EMPTY;return}const y=c!==void 0?c:nd;if(this.triangulation_=new id(t,i,_,m,C*y,E),this.triangulation_.getTriangles().length===0){this.state=D.EMPTY;return}this.sourceZ_=e.getZForResolution(C);let x=this.triangulation_.calculateSourceExtent();if(m&&(t.canWrapX()?(x[1]=et(x[1],m[1],m[3]),x[3]=et(x[3],m[1],m[3])):x=ze(x,m)),!Xs(x))this.state=D.EMPTY;else{let R=0,I=0;t.canWrapX()&&(R=J(p),I=Math.floor((x[0]-p[0])/R)),ha(x.slice(),t,!0).forEach(v=>{const L=e.getTileRangeForExtentAndZ(v,this.sourceZ_);for(let k=L.minX;k<=L.maxX;k++)for(let b=L.minY;b<=L.maxY;b++){const A=h(this.sourceZ_,k,b,a);if(A){const M=I*R;this.sourceTiles_.push({tile:A,offset:M})}}++I}),this.sourceTiles_.length===0&&(this.state=D.EMPTY)}}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{const i=e.tile;if(i&&i.getState()==D.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=D.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_=td(s,r,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=D.LOADED}this.changed()}load(){if(this.state==D.IDLE){this.state=D.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{const i=e.getState();if(i==D.IDLE||i==D.LOADING){t++;const s=V(e,W.CHANGE,r=>{const o=e.getState();(o==D.LOADED||o==D.ERROR||o==D.EMPTY)&&(tt(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()==D.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(tt),this.sourcesListenerKeys_=null}release(){this.canvas_&&(Jn(this.canvas_.getContext("2d")),fi.push(this.canvas_),this.canvas_=null),super.release()}}function Gn(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 In(n,t,e,i,s){return`${j(n)},${t},${sd(e,i,s)}`}function rd(n){return od(n[0],n[1],n[2])}function od(n,t,e){return(t<e||e>t.getMaxZoom())return!1;const r=t.getFullTileRange(e);return r?r.containsXY(i,s):!0}class Pr{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.minXthis.maxX&&(this.maxX=t.maxX),t.minYthis.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 ti(n,t,e,i,s){return s!==void 0?(s.minX=n,s.maxX=t,s.minY=e,s.maxY=i,s):new Pr(n,t,e,i)}const ei=[0,0,0],ge=5;class nl{constructor(t){this.minZoom=t.minZoom!==void 0?t.minZoom:0,this.resolutions_=t.resolutions,q(Tl(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{const o=new Pr(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,h=t[0]-1;for(this.zoomFactor_===2?(o=t[1],a=t[2]):l=this.getTileCoordExtent(t,s);h>=this.minZoom;){if(o!==void 0&&a!==void 0?(o=Math.floor(o/2),a=Math.floor(a/2),r=ti(o,o,a,a,i)):r=this.getTileRangeForExtentAndZ(l,h,i),e(h,r))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]this.maxZoom||e0?i:Math.max(r/e[0],s/e[1]);const o=t+1,a=new Array(o);for(let l=0;ln):null}class Cd extends ol{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&&Tt(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tmpSize=[0,0],this.key_=t.key||j(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 U()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:sl(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const s=this.getTileGridForProjection(i),r=this.getTilePixelRatio(e),o=Tt(s.getTileSize(t),this.tmpSize);return r==1?o:Vc(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 wd extends ce{constructor(t,e){super(t),this.tile=e}}const Os={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};class kr extends Cd{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===kr.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=j(e),s=e.getState();let r;s==D.LOADING?(this.tileLoadingKeys_[i]=!0,r=Os.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=s==D.ERROR?Os.TILELOADERROR:s==D.LOADED?Os.TILELOADEND:void 0),r!=null&&this.dispatchEvent(new wd(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=pd(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join(` `);this.generateTileUrlFunction_?this.setTileUrlFunction(Ed(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}}class Rd extends kr{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:al,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate!==void 0?t.interpolate:!0,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=t.crossOrigin!==void 0?t.crossOrigin:null,this.tileClass=t.tileClass!==void 0?t.tileClass:el,this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(t){return this.getProjection()&&t&&!Tn(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||Tn(e,t)))return this.tileGrid;const i=j(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=sl(t)),this.tileGridForProjection[i]}createTile_(t,e,i,s,r,o){const a=[t,e,i],l=this.getTileCoordForTileUrlFunction(a,r),h=l?this.tileUrlFunction(l,s,r):void 0,c=new this.tileClass(a,h!==void 0?D.IDLE:D.EMPTY,h!==void 0?h:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return c.key=o,c.addEventListener(W.CHANGE,this.handleTileChange.bind(this)),c}getTile(t,e,i,s,r,o){const a=this.getProjection();if(!a||!r||Tn(a,r))return this.getTileInternal(t,e,i,s,a||r);const l=[t,e,i],h=this.getKey(),c=this.getTileGridForProjection(a),u=this.getTileGridForProjection(r),d=this.getTileCoordForTileUrlFunction(l,r),f=new il(a,c,r,u,l,d,this.getTilePixelRatio(s),this.getGutter(),(g,m,_,p)=>this.getTileInternal(g,m,_,p,a,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return f.key=h,f}getTileInternal(t,e,i,s,r,o){const a=this.getKey(),l=In(this,a,t,e,i);if(o&&o.containsKey(l))return o.get(l);const h=this.createTile_(t,e,i,s,r,a);return o?.set(l,h),h}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){const i=It(t);if(i){const s=j(i);s in this.tileGridForProjection||(this.tileGridForProjection[s]=e)}}}function al(n,t){if(At){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"),fetch(t,{mode:i,credentials:s}).then(r=>{if(!r.ok)throw new Error(`HTTP ${r.status}`);return r.blob()}).then(r=>createImageBitmap(r)).then(r=>{const o=n.getImage();o.width=r.width,o.height=r.height,o.getContext("2d").drawImage(r,0,0),r.close?.(),o.dispatchEvent(new Event("load"))}).catch(()=>{n.getImage().dispatchEvent(new Event("error"))});return}n.getImage().src=t}class Td extends Rd{constructor(t){t=t||{};const e=t.projection!==void 0?t.projection:"EPSG:3857",i=t.tileGrid!==void 0?t.tileGrid:cd({extent:Fr(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX: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 Id='© OpenStreetMap contributors.';class Ef extends Td{constructor(t){t=t||{};let e;t.attributions!==void 0?e=t.attributions:e=[Id];const i=t.crossOrigin!==void 0?t.crossOrigin:"anonymous",s=t.url!==void 0?t.url:"https://tile.openstreetmap.org/{z}/{x}/{y}.png";super({attributions:e,attributionsCollapsible:!1,cacheSize:t.cacheSize,crossOrigin:i,interpolate:t.interpolate,maxZoom:t.maxZoom!==void 0?t.maxZoom:19,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileLoadFunction:(r,o)=>{const a=r.getImage();!At&&a instanceof HTMLImageElement&&(a.referrerPolicy="origin-when-cross-origin"),(t.tileLoadFunction||al)(r,o)},transition:t.transition,url:s,wrapX:t.wrapX,zDirection:t.zDirection})}}function Qs(n){return n instanceof Image||n instanceof HTMLCanvasElement||n instanceof HTMLVideoElement||n instanceof ImageBitmap?n:null}const Sd=new Error("disposed"),vd=[256,256];class No extends Or{constructor(t){const e=D.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=Qs(this.data_);return t?[t.width,t.height]:vd}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==D.IDLE&&this.state!==D.ERROR)return;this.state=D.LOADING,this.changed();const t=this;this.loader_().then(function(e){t.data_=e,t.state=D.LOADED,t.changed()}).catch(function(e){t.error_=e,t.state=D.ERROR,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(Sd),this.controller_=null),super.disposeInternal()}}class Go{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 Xn&&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 q(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 q(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){q(!(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 ll{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(On(),{get:(t,e)=>{if(typeof On()[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;ithis.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return U()}getData(t){return null}prepareFrame(t){return U()}renderFrame(t,e){return U()}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(W.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 zo=[];let oi=null;function Md(){oi=ot(1,1,void 0,{willReadFrequently:!0})}class hl extends Ad{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){oi||Md(),oi.clearRect(0,0,1,1);let s;try{oi.drawImage(t,e,i,1,1,0,0,1,1),s=oi.getImageData(0,0,1,1).data}catch{return oi=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&&ve(yi(t.style.backgroundColor),yi(i)))){const a=t.firstElementChild;we(a)&&(o=a.getContext("2d"))}if(o&&vh(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=At?Ma():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=Ze(i),r=Vn(i),o=Un(i),a=Bn(i);ht(e.coordinateToPixelTransform,s),ht(e.coordinateToPixelTransform,r),ht(e.coordinateToPixelTransform,o),ht(e.coordinateToPixelTransform,a);const l=this.inversePixelTransform;ht(l,s),ht(l,r),ht(l,o),ht(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(J(i)/s*o),l=Math.round(yt(i)/s*o);he(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/o,1/o,r,-a/2,-l/2),xa(this.inversePixelTransform,this.pixelTransform);const h=Sh(this.pixelTransform);if(this.useContainer(e,h,this.getBackground(t)),!this.containerReused){const c=this.context.canvas;c.width!=a||c.height!=l?(c.width=a,c.height=l):this.context.clearRect(0,0,a,l),h!==c.style.transform&&(c.style.transform=h)}}dispatchRenderEvent_(t,e,i){const s=this.getLayer();if(s.hasListener(t)){const r=new Ja(t,this.inversePixelTransform,i,e);s.dispatchEvent(r)}}preRender(t,e){this.frameState=e,!e.declutter&&this.dispatchRenderEvent_(kt.PRERENDER,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(kt.POSTRENDER,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new ll),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(kt.PRERENDER,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(kt.POSTRENDER,this.context,t))}getRenderTransform(t,e,i,s,r,o,a){const l=r/2,h=o/2,c=s/e,u=-c,d=-t[0]+a,f=-t[1];return he(this.tempTransform,l,h,c,u,-i,d,f)}disposeInternal(){delete this.frameState,super.disposeInternal()}}function Ps(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 bd(n,t,e){const i=n[e];return i?i.delete(t):!1}function Xo(n,t){const e=n.layerStatesArray[n.layerIndex];e.extent&&(t=ze(t,Ce(e.extent,n.viewState.projection)));const i=e.layer.getRenderSource();if(!i.getWrapX()){const s=i.getTileGridForProjection(n.viewState.projection).getExtent();s&&(t=ze(t,s))}return t}class Dd extends hl{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=zt(),this.tempTileRange_=new Pr(0,0,0,0),this.tempTileCoord_=Gn(0,0,0);const i=e.cacheSize!==void 0?e.cacheSize:512;this.tileCache_=new Go(i),this.sourceTileCache_=null,this.maxStaleKeys=i*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new Go(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,s){const r=this.tileCache_,a=this.getLayer().getSource(),l=In(a,a.getKey(),t,e,i);let h;if(r.containsKey(l))h=r.get(l);else{const c=s.viewState.projection,u=a.getProjection();if(h=a.getTile(t,e,i,s.pixelRatio,c,!u||Tn(u,c)?void 0:this.getSourceTileCache()),!h)return null;r.set(l,h)}return h}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=ht(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!mi(r,s))return null;const o=e.viewState,a=i.getRenderSource(),l=a.getTileGridForProjection(o.projection),h=a.getTilePixelRatio(e.pixelRatio);for(let c=l.getZForResolution(o.resolution);c>=l.getMinZoom();--c){const u=l.getTileCoordForCoordAndZ(s,c),d=this.getTile(c,u[1],u[2],e);if(!d||d.getState()!==D.LOADED)continue;const f=l.getOrigin(c),g=Tt(l.getTileSize(c)),m=l.getResolution(c);let _;if(d instanceof el||d instanceof il)_=d.getImage();else if(d instanceof No){if(_=Qs(d.getData()),!_)continue}else continue;const p=Math.floor(h*((s[0]-f[0])/m-u[1]*g[0])),E=Math.floor(h*((f[1]-s[1])/m-u[2]*g[1])),C=Math.round(h*a.getGutterForProjection(o.projection));return this.getImageData(_,p+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(),h=l.getTileGridForProjection(o.projection),c=j(l);c in t.wantedTiles||(t.wantedTiles[c]={});const u=t.wantedTiles[c],d=a.getMapInternal(),f=Math.max(i-r,h.getMinZoom(),h.getZForResolution(Math.min(a.getMaxResolution(),d?d.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):h.getResolution(0)),l.zDirection)),g=o.rotation,m=g?aa(o.center,o.resolution,g,t.size):void 0;for(let _=i;_>=f;--_){const p=h.getTileRangeForExtentAndZ(e,_,this.tempTileRange_),E=h.getResolution(_);for(let C=p.minX;C<=p.maxX;++C)for(let y=p.minY;y<=p.maxY;++y){if(g&&!h.tileCoordIntersectsViewport([_,C,y],m))continue;const x=this.getTile(_,C,y,t);if(!x||!Ps(s,x,_))continue;const I=x.getKey();if(u[I]=!0,x.getState()===D.IDLE&&!t.tileQueue.isKeyQueued(I)){const T=Gn(_,C,y,this.tempTileCoord_);t.tileQueue.enqueue([x,c,h.getTileCoordCenter(T),E])}}}}findStaleTile_(t,e){const i=this.tileCache_,s=t[0],r=t[1],o=t[2],a=this.getStaleKeys();for(let l=0;l0&&setTimeout(()=>{this.enqueueTiles(t,v,d-1,I,T-1)},0),!(d in I))return this.container;const L=j(this),k=t.time;for(const P of I[d]){const K=P.getState();if(K===D.EMPTY)continue;const Z=P.tileCoord;if(K===D.LOADED&&P.getAlpha(L,k)===1){P.endTransition(L);continue}if(K!==D.ERROR&&(this.renderComplete=!1),this.findStaleTile_(Z,I)){bd(I,P,d),t.animate=!0;continue}if(this.findAltTiles_(u,Z,d+1,I))continue;const ut=u.getMinZoom();for(let _t=d-1;_t>=ut&&!this.findAltTiles_(u,Z,_t,I);--_t);}const b=f/o*l/_,A=this.getRenderContext(t);he(this.tempTransform,p/2,E/2,b,b,0,-p/2,-E/2),i.extent&&this.clipUnrotated(A,t,C),c.getInterpolate()||(A.imageSmoothingEnabled=!1),this.preRender(A,t);const M=Object.keys(I).map(Number);M.sort(oe);let Y;const F=[],G=[];for(let P=M.length-1;P>=0;--P){const K=M[P],Z=c.getTilePixelSize(K,l,r),S=u.getResolution(K)/f,ut=Z[0]*S*b,_t=Z[1]*S*b,st=u.getTileCoordForCoordAndZ(Ze(R),K),St=u.getTileCoordExtent(st),dt=ht(this.tempTransform,[_*(St[0]-R[0])/f,_*(R[3]-St[3])/f]),Ut=_*c.getGutterForProjection(r);for(const Xt of I[K]){if(Xt.getState()!==D.LOADED)continue;const vt=Xt.tileCoord,hn=st[1]-vt[1],as=Math.round(dt[0]-(hn-1)*ut),Ti=st[2]-vt[2],Le=Math.round(dt[1]-(Ti-1)*_t),Mt=Math.round(dt[0]-hn*ut),Vt=Math.round(dt[1]-Ti*_t),Ue=as-Mt,Ve=Le-Vt,Ii=M.length===1;let Ae=!1;Y=[Mt,Vt,Mt+Ue,Vt,Mt+Ue,Vt+Ve,Mt,Vt+Ve];for(let je=0,He=F.length;je{const Q=j(c),S=Z.wantedTiles[Q],ut=S?Object.keys(S).length:0;this.updateCacheSize(ut),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};t.postRenderFunctions.push(P)}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 h;if(t instanceof No){if(h=Qs(t.getData()),!h)throw new Error("Rendering array data is not yet supported")}else h=this.getTileImage(t);if(!h)return;const c=this.getRenderContext(e),u=j(this),d=e.layerStatesArray[e.layerIndex],f=d.opacity*(l?t.getAlpha(u,e.time):1),g=f!==c.globalAlpha;g&&(c.save(),c.globalAlpha=f),c.drawImage(h,a,a,h.width-2*a,h.height-2*a,i,s,r,o),g&&c.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=j(e);s in t||(t[s]={}),t[s][i.getKey()]=!0}}const wn={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class Od extends Qn{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(wn.PRELOAD)}setPreload(t){this.set(wn.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(wn.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(wn.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}}class xf extends Od{constructor(t){super(t)}createRenderer(){return new Dd(this,{cacheSize:this.getCacheSize()})}}class cl extends $t{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 cl(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_&&(tt(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=V(t,W.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?Pd(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 Pd(n){if(typeof n=="function")return n;let t;return Array.isArray(n)?t=n:(q(typeof n.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),t=[n]),function(){return t}}function Wo(n,t,e,i,s,r,o){let a,l;const h=(e-t)/i;if(h===1)a=t;else if(h===2)a=t,l=s;else if(h!==0){let c=n[t],u=n[t+1],d=0;const f=[0];for(let _=t+i;_1?o:2,r=r||new Array(o);for(let c=0;c>1;su*this.pixelRatio_),lineDashOffset:(o||le)*this.pixelRatio_,lineJoin:a!==void 0?a:xi,lineWidth:(l!==void 0?l:Ji)*this.pixelRatio_,miterLimit:h!==void 0?h:Hi,strokeStyle:qt(i||qi)}}}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:qt(f||Ct)}}const i=t.getStroke();if(!i)this.textStrokeState_=null;else{const f=i.getColor(),g=i.getLineCap(),m=i.getLineDash(),_=i.getLineDashOffset(),p=i.getLineJoin(),E=i.getWidth(),C=i.getMiterLimit();this.textStrokeState_={lineCap:g!==void 0?g:Ei,lineDash:m||ae,lineDashOffset:_||le,lineJoin:p!==void 0?p:xi,lineWidth:E!==void 0?E:Ji,miterLimit:C!==void 0?C:Hi,strokeStyle:qt(f||qi)}}const s=t.getFont(),r=t.getOffsetX(),o=t.getOffsetY(),a=t.getRotateWithView(),l=t.getRotation(),h=t.getScaleArray(),c=t.getText(),u=t.getTextAlign(),d=t.getTextBaseline();this.textState_={font:s!==void 0?s:Ka,textAlign:u!==void 0?u:$i,textBaseline:d!==void 0?d:Fn},this.text_=c!==void 0?Array.isArray(c)?c.reduce((f,g,m)=>f+=m%2?" ":g,""):c:"",this.textOffsetX_=r!==void 0?this.pixelRatio_*r:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*h[0],this.pixelRatio_*h[1]]}}}const Nd=.5,dl={Point:Bd,LineString:Yd,Polygon:Vd,MultiPoint:Ud,MultiLineString:Kd,MultiPolygon:Zd,GeometryCollection:Wd,Circle:zd};function Gd(n,t){return parseInt(j(n),10)-parseInt(j(t),10)}function Yo(n,t){const e=fl(n,t);return e*e}function fl(n,t){return Nd*n/t}function zd(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 Ko(n,t,e,i,s,r,o,a){const l=[],h=e.getImage();if(h){let d=!0;const f=h.getImageState();f==X.LOADED||f==X.ERROR?d=!1:f==X.IDLE&&h.load(),d&&l.push(h.ready())}const c=e.getFill();c&&c.loading()&&l.push(c.ready());const u=l.length>0;return u&&Promise.all(l).then(()=>s(null)),Xd(n,t,e,i,r,o,a),u}function Xd(n,t,e,i,s,r,o){const a=e.getGeometryFunction()(t);if(!a)return;const l=a.simplifyTransformed(i,s);if(e.getRenderer())gl(n,l,e,t,o);else{const c=dl[l.getType()];c(n,l,e,t,o,r)}}function gl(n,t,e,i,s){if(t.getType()=="GeometryCollection"){const o=t.getGeometries();for(let a=0,l=o.length;a=200&&a.status<300){const h=t.getType();try{let c;h=="text"||h=="json"?c=a.responseText:h=="xml"?c=a.responseXML||a.responseText:h=="arraybuffer"&&(c=a.response),c?r(t.readFeatures(c,{extent:e,featureProjection:s}),t.readProjection(c)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function Zo(n,t){return function(e,i,s,r,o){Hd(n,t,e,i,s,(a,l)=>{this.addFeatures(a),r!==void 0&&r(a)},()=>{this.changed(),o!==void 0&&o()})}}function qd(n,t){return[[-1/0,-1/0,1/0,1/0]]}function $d(n,t,e,i){const s=[];let r=zt();for(let o=0,a=e.length;o{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=gr(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),s=[i.length];break;case"MultiLineString":s=[],i.length=zh(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,s);break;case"Polygon":s=[],i.length=Sa(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 Uo{constructor(t){this.rbush_=new Na(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_[j(e)]=i}load(t,e){const i=new Array(e.length);for(let s=0,r=e.length;s{e||(e=!0,this.addFeature(i.element),e=!1)}),t.addEventListener(Et.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(tt);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 _e(Pt.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(),_i(this.nullGeometryFeatures_)||er(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=ha(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||Ki,this.featuresRtree_.forEachInExtent(l,function(h){if(e(h)){const c=h.getGeometry(),u=a;if(a=c instanceof Yt?0:c.closestPointXY(i,s,o,a),a{--this.loadingExtentsCount_,this.dispatchEvent(new _e(Pt.FEATURESLOADEND,void 0,c))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new _e(Pt.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(Bi(s.extent,t))return s});i&&e.remove(i)}removeFeatures(t){let e=!1;for(let i=0,s=t.length;il&&(this.instructions.push([O.CUSTOM,l,c,t,i,li,r]),this.hitDetectionInstructions.push([O.CUSTOM,l,c,t,s||i,li,r]));break;case"Point":h=t.getFlatCoordinates(),this.coordinates.push(h[0],h[1]),c=this.coordinates.length,this.instructions.push([O.CUSTOM,l,c,t,i,void 0,r]),this.hitDetectionInstructions.push([O.CUSTOM,l,c,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;ethis.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0;return e}setFillStrokeStyle(t,e){const i=this.state;this.fillStyleToState(t,i),this.strokeStyleToState(e,i)}createFill(t){const e=t.fillStyle,i=[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,h=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=s||r!=t.currentLineDash&&!ve(t.currentLineDash,r)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=l||t.currentMiterLimit!=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=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_=ea(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;ir(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class Jd extends ln{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&&!mi(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,h=s.length;l=n){const g=(n-a+f)/f,m=Lt(h,u,g),_=Lt(c,d,g);l.push(m,_),r.push(l),l=[m,_],a==n&&(o+=s),a=0}else if(a0&&r.push(l),r}function ef(n,t,e,i,s){let r=e,o=e,a=0,l=0,h=e,c,u,d,f,g,m,_,p,E,C;for(u=e;un&&(l>a&&(a=l,r=h,o=u),l=0,h=u-s)),d=f,_=E,p=C),g=y,m=x}return l+=f,l>a?[h,u]:[r,o]}const zn={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class nf extends ln{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[Ct]={fillStyle:Ct},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 h=t.getType();let c=null,u=t.getStride();if(o.placement==="line"&&(h=="LineString"||h=="MultiLineString"||h=="Polygon"||h=="MultiPolygon")){if(!wt(this.maxExtent,t.getExtent()))return;let d;if(c=t.getFlatCoordinates(),h=="LineString")d=[c.length];else if(h=="MultiLineString")d=t.getEnds();else if(h=="Polygon")d=t.getEnds().slice(0,1);else if(h=="MultiPolygon"){const _=t.getEndss();d=[];for(let p=0,E=_.length;p{const I=a[(y+R)*2]===c[R*u]&&a[(y+R)*2+1]===c[R*u+1];return I||--y,I})}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(_!=Ne&&(o.scale[0]<0||o.scale[1]<0)){let y=o.padding[0],x=o.padding[1],R=o.padding[2],I=o.padding[3];o.scale[0]<0&&(x=-x,I=-I),o.scale[1]<0&&(y=-y,R=-R),_=[y,x,R,I]}const p=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_,_==Ne?Ne:_.map(function(y){return y*p}),g,m,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]);const E=1/p,C=g?g.slice(0):null;C&&(C[1]=Ct),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_?Ct: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||$i,justify:e.justify,textBaseline:e.textBaseline||Fn,scale:e.scale});const o=this.fillKey_;i&&(o in this.fillStates||(this.fillStates[o]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,s=this.textState_,r=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();const l=this.pixelRatio,h=zn[s.textBaseline],c=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,h,s.overflow,a,s.maxAngle,l,c,r,d*l,u,o,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([O.DRAW_CHARS,t,e,h,s.overflow,a&&Ct,s.maxAngle,l,c,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=qt(o.getColor()||Ct)):(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(),p=a.getWidth(),E=a.getMiterLimit();r.lineCap=a.getLineCap()||Ei,r.lineDash=m?m.slice():ae,r.lineDashOffset=_===void 0?le:_,r.lineJoin=a.getLineJoin()||xi,r.lineWidth=p===void 0?Ji:p,r.miterLimit=E===void 0?Hi:E,r.strokeStyle=qt(a.getColor()||qi)}i=this.textState_;const l=t.getFont()||Ka;Iu(l);const h=t.getScaleArray();i.overflow=t.getOverflow(),i.font=l,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||Fn,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||Ne,i.scale=h===void 0?[1,1]:h;const c=t.getOffsetX(),u=t.getOffsetY(),d=t.getRotateWithView(),f=t.getKeepUpright(),g=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=c===void 0?0:c,this.textOffsetY_=u===void 0?0:u,this.textRotateWithView_=d===void 0?!1:d,this.textKeepUpright_=f===void 0?!0:f,this.textRotation_=g===void 0?0:g,this.strokeKey_=r?(typeof r.strokeStyle=="string"?r.strokeStyle:j(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:"|"+j(s.fillStyle):""}this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}const sf={Circle:jo,Default:ln,Image:Jd,LineString:Qd,Polygon:jo,Text:nf};class rf{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=sf[e];r=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),s[e]=r}return r}}function of(n,t,e,i,s,r,o,a,l,h,c,u,d=!0){let f=n[t],g=n[t+1],m=0,_=0,p=0,E=0;function C(){m=f,_=g,t+=i,f=n[t],g=n[t+1],E+=p,p=Math.sqrt((f-m)*(f-m)+(g-_)*(g-_))}do C();while(tG[2]}else b=x>L;const A=Math.PI,M=[],Y=I+i===t;t=I,p=0,E=T,f=n[t],g=n[t+1];let F;if(Y){C(),F=Math.atan2(g-_,f-m),b&&(F+=F>0?-A:A);const G=(L+x)/2,P=(k+R)/2;return M[0]=[G,P,(v-r)/2,F,s],M}s=s.replace(/\n/g," ");for(let G=0,P=s.length;G0?-A:A),F!==void 0){let st=K-F;if(st+=st>A?-2*A:st<-A?2*A:0,Math.abs(st)>o)return null}F=K;const Z=G;let Q=0;for(;G0&&n.push(` `,""),n.push(t,""),n}function lf(n,t,e){return e%2===0&&(n+=t),n}class hf{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 ll: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],h=this.pixelRatio,c=[l.scale[0]*h,l.scale[1]*h],u=l.justify?zn[l.justify]:Fs(Array.isArray(t)?t[0]:t,l.textAlign||$i),d=s&&o.lineWidth?o.lineWidth:0,f=Array.isArray(t)?t:String(t).split(` `).reduce(af,[]),{width:g,height:m,widths:_,heights:p,lineWidths:E}=vu(l,f),C=g+d,y=[],x=(C+2)*c[0],R=(m+d)*c[1],I={width:x<0?Math.floor(x):Math.ceil(x),height:R<0?Math.floor(R):Math.ceil(R),contextInstructions:y};(c[0]!=1||c[1]!=1)&&y.push("scale",c),s&&(y.push("strokeStyle",o.strokeStyle),y.push("lineWidth",d),y.push("lineCap",o.lineCap),y.push("lineJoin",o.lineJoin),y.push("miterLimit",o.miterLimit),y.push("setLineDash",[o.lineDash]),y.push("lineDashOffset",o.lineDashOffset)),i&&y.push("fillStyle",a.fillStyle),y.push("textBaseline","middle"),y.push("textAlign","center");const T=.5-u;let v=u*C+T*d;const L=[],k=[];let b=0,A=0,M=0,Y=0,F;for(let G=0,P=f.length;Gt?t-h:r,y=o+c>e?e-c:o,x=g[3]+C*d[0]+g[1],R=g[0]+y*d[1]+g[2],I=p-g[3],T=E-g[0];(m||u!==0)&&(me[0]=I,pe[0]=I,me[1]=T,ee[1]=T,ee[0]=I+x,ie[0]=ee[0],ie[1]=T+R,pe[1]=ie[1]);let v;return u!==0?(v=he(Zt(),i,s,1,1,u,-i,-s),ht(v,me),ht(v,ee),ht(v,ie),ht(v,pe),Se(Math.min(me[0],ee[0],ie[0],pe[0]),Math.min(me[1],ee[1],ie[1],pe[1]),Math.max(me[0],ee[0],ie[0],pe[0]),Math.max(me[1],ee[1],ie[1],pe[1]),ii)):Se(Math.min(I,I+x),Math.min(T,T+R),Math.max(I,I+x),Math.max(T,T+R),ii),f&&(p=Math.round(p),E=Math.round(E)),{drawImageX:p,drawImageY:E,drawImageW:C,drawImageH:y,originX:h,originY:c,declutterBox:{minX:ii[0],minY:ii[1],maxX:ii[2],maxY:ii[3],value:_},canvasTransform:v,scale:d}}replayImageOrLabel_(t,e,i,s,r,o,a){const l=!!(o||a),h=s.declutterBox,c=a?a[2]*s.scale[0]/2:0;return h.minX-c<=e[0]&&h.maxX+c>=0&&h.minY-c<=e[1]&&h.maxY+c>=0&&(l&&this.replayTextBackground_(t,me,ee,ie,pe,o,a),Lu(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=ht(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.rotate(this.viewRotation_)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],e[1]&&(t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6]))}drawLabelWithPointPlacement_(t,e,i,s){const r=this.textStates[e],o=this.createLabel(t,e,s,i),a=this.strokeStates[i],l=this.pixelRatio,h=Fs(Array.isArray(t)?t[0]:t,r.textAlign||$i),c=zn[r.textBaseline||Fn],u=a&&a.lineWidth?a.lineWidth:0,d=o.width/l-2*r.scale[0],f=h*d+2*(.5-h)*u,g=c*o.height/l+2*(.5-c)*u;return{label:o,anchorX:f,anchorY:g}}execute_(t,e,i,s,r,o,a,l){const h=this.zIndexContext_;let c;this.pixelCoordinates_&&ve(i,this.renderedTransform_)?c=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),c=Ie(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),Rh(this.renderedTransform_,i));let u=0;const d=s.length;let f=0,g,m,_,p,E,C,y,x,R,I,T,v,L,k=0,b=0;const A=this.coordinateCache_,M=this.viewRotation_,Y=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,F={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:M},G=this.instructions!=s||this.overlaps?0:200;let P,K,Z,Q;for(;uG&&(this.fill_(t),k=0),b>G&&(t.stroke(),b=0),!k&&!b&&(t.beginPath(),E=NaN,C=NaN),++u;break;case O.CIRCLE:f=S[1];const _t=c[f],st=c[f+1],St=c[f+2],dt=c[f+3],Ut=St-_t,Xt=dt-st,vt=Math.sqrt(Ut*Ut+Xt*Xt);t.moveTo(_t+vt,st),t.arc(_t,st,vt,0,2*Math.PI,!0),++u;break;case O.CLOSE_PATH:t.closePath(),++u;break;case O.CUSTOM:f=S[1],g=S[2];const hn=S[3],as=S[4],Ti=S[5];F.geometry=hn,F.feature=P,u in A||(A[u]=[]);const Le=A[u];Ti?Ti(c,f,g,2,Le):(Le[0]=c[f],Le[1]=c[f+1],Le.length=2),h&&(h.zIndex=S[6]),as(Le,F),++u;break;case O.DRAW_IMAGE:f=S[1],g=S[2],R=S[3],m=S[4],_=S[5];let Mt=S[6];const Vt=S[7],Ue=S[8],Ve=S[9],Ii=S[10];let Ae=S[11];const je=S[12];let He=S[13];p=S[14]||"declutter";const at=S[15];if(!R&&S.length>=20){I=S[19],T=S[20],v=S[21],L=S[22];const bt=this.drawLabelWithPointPlacement_(I,T,v,L);R=bt.label,S[3]=R;const Me=S[23];m=(bt.anchorX-Me)*this.pixelRatio,S[4]=m;const Dt=S[24];_=(bt.anchorY-Dt)*this.pixelRatio,S[5]=_,Mt=R.height,S[6]=Mt,He=R.width,S[13]=He}let ls;S.length>25&&(ls=S[25]);let hs,cn,un;S.length>17?(hs=S[16],cn=S[17],un=S[18]):(hs=Ne,cn=null,un=null),Ii&&Y?Ae+=M:!Ii&&!Y&&(Ae-=M);let ml=0;for(;f!_l.includes(n));class uf{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 hf(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;s0){if(!o||I==="none"||f!=="Image"&&f!=="Text"||o.includes(x)){const k=(d[v]-3)/4,b=s-k%a,A=s-(k/a|0),M=r(x,R,b*b+A*A);if(M)return M}c.clearRect(0,0,a,a);break}}const m=Object.keys(this.executorsByZIndex_).map(Number);m.sort(oe);let _,p,E,C,y;for(_=m.length-1;_>=0;--_){const x=m[_].toString();for(E=this.executorsByZIndex_[x],p=Pe.length-1;p>=0;--p)if(f=Pe[p],C=E[f],C!==void 0&&(y=C.executeHitDetection(c,l,i,g,u),y))return y}}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 Ie(a,0,8,2,t,a),a}isEmpty(){return _i(this.executorsByZIndex_)}execute(t,e,i,s,r,o,a){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?wl:oe),o=o||Pe;const h=Pe.length;for(let c=0,u=l.length;cp.execute(x,e,i,s,r,a)),y&&C.restore(),E){E.offset();const x=l[c]*h+Pe.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(oe);for(let i=0,s=e.length;i{r.draw(this.renderedContext_),r.clear()}),t[e[i]].length=0}}const ks={};function df(n){if(ks[n]!==void 0)return ks[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{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_,h=this.getLayer(),c=[],u=i[0]*Ht,d=i[1]*Ht;c.push(this.getRenderTransform(s,r,o,Ht,u,d,0).slice());const f=h.getSource(),g=a.getExtent();if(f.getWrapX()&&a.canWrapX()&&!Pi(g,l)){let m=l[0];const _=J(g);let p=0,E;for(;mg[2];)++p,E=_*p,c.push(this.getRenderTransform(s,r,o,Ht,u,d,E).slice()),m-=_}this.hitDetectionImageData_=ff(i,c,this.renderedFeatures_,h.getStyleFunction(),l,r,o,Yo(r,this.renderedPixelRatio_))}e(gf(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,s,r){if(!this.replayGroup_)return;const o=e.viewState.resolution,a=e.viewState.rotation,l=this.getLayer(),h={},c=function(d,f,g){const m=j(d),_=h[m];if(_){if(_!==!0&&g<_.distanceSq){if(g===0)return h[m]=!0,r.splice(r.lastIndexOf(_),1),s(d,l,f);_.geometry=f,_.distanceSq=g}}else{if(g===0)return h[m]=!0,s(d,l,f);r.push(h[m]={feature:d,layer:l,geometry:f,distanceSq:g,callback:s})}},u=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,o,a,i,c,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[gt.ANIMATING],r=t.viewHints[gt.INTERACTING],o=e.getUpdateWhileAnimating(),a=e.getUpdateWhileInteracting();if(this.ready&&!o&&s||!a&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const l=t.extent,h=t.viewState,c=h.projection,u=h.resolution,d=t.pixelRatio,f=e.getRevision(),g=e.getRenderBuffer();let m=e.getRenderOrder();m===void 0&&(m=Gd);const _=h.center.slice(),p=ir(l,g*u),E=p.slice(),C=[p.slice()],y=c.getExtent();if(i.getWrapX()&&c.canWrapX()&&!Pi(y,t.extent)){const M=J(y),Y=Math.max(J(p)/2,M);p[0]=y[0]-Y,p[2]=y[2]+Y,ca(_,c);const F=la(C[0],c);F[0]y[0]&&F[2]>y[2]&&C.push([F[0]-M,F[1],F[2]-M,F[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==f&&this.renderedRenderOrder_==m&&this.renderedFrameDeclutter_===!!t.declutter&&Pi(this.wrappedRenderedExtent_,p))return ve(this.renderedExtent_,E)||(this.hitDetectionImageData_=null,this.renderedExtent_=E),this.renderedCenter_=_,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const x=new rf(fl(u,d),p,u,d);let R;for(let M=0,Y=C.length;M{let F;const G=M.getStyleFunction()||e.getStyleFunction();if(G&&(F=G(M,u)),F){const P=this.renderFeature(M,I,F,x,R,this.getLayer().getDeclutter(),Y);T=T&&!P}},L=Ea(p),k=i.getFeaturesInExtent(L);m&&k.sort(m);for(let M=0,Y=k.length;M