runbir-tools 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +217 -0
- package/dist/logo.svg +254 -0
- package/dist/runbir-tools.css +1 -0
- package/dist/runbir-tools.es.js +24628 -0
- package/dist/runbir-tools.umd.js +8 -0
- package/package.json +76 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
(function(s,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(s=typeof globalThis<"u"?globalThis:s||self,e(s.MyComponentLibrary={},s.Vue))})(this,function(exports,vue){"use strict";var ze=Object.defineProperty;var Ve=(s,e,t)=>e in s?ze(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var se=(s,e,t)=>Ve(s,typeof e!="symbol"?e+"":e,t);var _documentCurrentScript=typeof document<"u"?document.currentScript:null;const __vite_glob_0_0="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKTWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVN3WJP3Fj7f92UPVkLY8LGXbIEAIiOsCMgQWaIQkgBhhBASQMWFiApWFBURnEhVxILVCkidiOKgKLhnQYqIWotVXDjuH9yntX167+3t+9f7vOec5/zOec8PgBESJpHmomoAOVKFPDrYH49PSMTJvYACFUjgBCAQ5svCZwXFAADwA3l4fnSwP/wBr28AAgBw1S4kEsfh/4O6UCZXACCRAOAiEucLAZBSAMguVMgUAMgYALBTs2QKAJQAAGx5fEIiAKoNAOz0ST4FANipk9wXANiiHKkIAI0BAJkoRyQCQLsAYFWBUiwCwMIAoKxAIi4EwK4BgFm2MkcCgL0FAHaOWJAPQGAAgJlCLMwAIDgCAEMeE80DIEwDoDDSv+CpX3CFuEgBAMDLlc2XS9IzFLiV0Bp38vDg4iHiwmyxQmEXKRBmCeQinJeb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q8WNmnLeAMuowapnh1DfgW+Ab4OfSLaQ4Bp9Hnv1vy2F0HLgLHgCPALCUQG8AvG+BlPvpps814wI/AQCkLKvGAPTE3lDMLrLwCfYp41qSQP+GAVEUEFWahehNdOp2/vd0xHv0aOGeqFOM4ItGApVJ4Ypvx7sNzma8p93xnftdMLOyURPXwo8ABE0oOot/huGKG7ZgZzk5+TFEVATYNPIF+HbAPOAXcBP793xxmcQDr5GAI+BCpRs18LptPY0TlM54KcAW4AlxOcn8Ax1n/gndBNBMAAAAASUVORK5CYII=",CollectionEventType={ADD:"add",REMOVE:"remove"},ObjectEventType={PROPERTYCHANGE:"propertychange"},EventType={CHANGE:"change",ERROR:"error",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",TOUCHMOVE:"touchmove",WHEEL:"wheel"};class Disposable{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function binarySearch(s,e,t){let i,n;t=t||ascending;let r=0,o=s.length,a=!1;for(;r<o;)i=r+(o-r>>1),n=+t(s[i],e),n<0?r=i+1:(o=i,a=!n);return a?r:~r}function ascending(s,e){return s>e?1:s<e?-1:0}function descending(s,e){return s<e?1:s>e?-1:0}function linearFindNearest(s,e,t){if(s[0]<=e)return 0;const i=s.length;if(e<=s[i-1])return i-1;if(typeof t=="function"){for(let n=1;n<i;++n){const r=s[n];if(r===e)return n;if(r<e)return t(e,s[n-1],r)>0?n-1:n}return i-1}if(t>0){for(let n=1;n<i;++n)if(s[n]<e)return n-1;return i-1}if(t<0){for(let n=1;n<i;++n)if(s[n]<=e)return n;return i-1}for(let n=1;n<i;++n){if(s[n]==e)return n;if(s[n]<e)return s[n-1]-e<e-s[n]?n-1:n}return i-1}function reverseSubArray(s,e,t){for(;e<t;){const i=s[e];s[e]=s[t],s[t]=i,++e,--t}}function extend$2(s,e){const t=Array.isArray(e)?e:[e],i=t.length;for(let n=0;n<i;n++)s[s.length]=t[n]}function equals$2(s,e){const t=s.length;if(t!==e.length)return!1;for(let i=0;i<t;i++)if(s[i]!==e[i])return!1;return!0}function isSorted(s,e,t){const i=e||ascending;return s.every(function(n,r){if(r===0)return!0;const o=i(s[r-1],n);return!(o>0||o===0)})}function TRUE(){return!0}function FALSE(){return!1}function VOID(){}function memoizeOne(s){let e,t,i;return function(){const n=Array.prototype.slice.call(arguments);return(!t||this!==i||!equals$2(n,t))&&(i=this,t=n,e=s.apply(this,arguments)),e}}function toPromise(s){function e(){let t;try{t=s()}catch(i){return Promise.reject(i)}return t instanceof Promise?t:Promise.resolve(t)}return e()}function clear(s){for(const e in s)delete s[e]}function isEmpty$1(s){let e;for(e in s)return!1;return!e}class BaseEvent{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}class Target extends Disposable{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;const i=this.listeners_||(this.listeners_={}),n=i[e]||(i[e]=[]);n.includes(t)||n.push(t)}dispatchEvent(e){const t=typeof e=="string",i=t?e:e.type,n=this.listeners_&&this.listeners_[i];if(!n)return;const r=t?new BaseEvent(e):e;r.target||(r.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});i in o||(o[i]=0,a[i]=0),++o[i];let l;for(let c=0,h=n.length;c<h;++c)if("handleEvent"in n[c]?l=n[c].handleEvent(r):l=n[c].call(this,r),l===!1||r.propagationStopped){l=!1;break}if(--o[i]===0){let c=a[i];for(delete a[i];c--;)this.removeEventListener(i,VOID);delete o[i]}return l}disposeInternal(){this.listeners_&&clear(this.listeners_)}getListeners(e){return this.listeners_&&this.listeners_[e]||void 0}hasListener(e){return this.listeners_?e?e in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(e,t){if(!this.listeners_)return;const i=this.listeners_[e];if(!i)return;const n=i.indexOf(t);n!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(i[n]=VOID,++this.pendingRemovals_[e]):(i.splice(n,1),i.length===0&&delete this.listeners_[e]))}}function listen(s,e,t,i,n){if(n){const o=t;t=function(a){return s.removeEventListener(e,t),o.call(i??this,a)}}else i&&i!==s&&(t=t.bind(i));const r={target:s,type:e,listener:t};return s.addEventListener(e,t),r}function listenOnce(s,e,t,i){return listen(s,e,t,i,!0)}function unlistenByKey(s){s&&s.target&&(s.target.removeEventListener(s.type,s.listener),clear(s))}class Observable extends Target{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(EventType.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){const i=e.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=listen(this,e[r],t);return n}return listen(this,e,t)}onceInternal(e,t){let i;if(Array.isArray(e)){const n=e.length;i=new Array(n);for(let r=0;r<n;++r)i[r]=listenOnce(this,e[r],t)}else i=listenOnce(this,e,t);return t.ol_key=i,i}unInternal(e,t){const i=t.ol_key;if(i)unByKey(i);else if(Array.isArray(e))for(let n=0,r=e.length;n<r;++n)this.removeEventListener(e[n],t);else this.removeEventListener(e,t)}}Observable.prototype.on,Observable.prototype.once,Observable.prototype.un;function unByKey(s){if(Array.isArray(s))for(let e=0,t=s.length;e<t;++e)unlistenByKey(s[e]);else unlistenByKey(s)}function abstract(){throw new Error("Unimplemented abstract method.")}let uidCounter_=0;function getUid(s){return s.ol_uid||(s.ol_uid=String(++uidCounter_))}class ObjectEvent extends BaseEvent{constructor(e,t,i){super(e),this.key=t,this.oldValue=i}}class BaseObject extends Observable{constructor(e){super(),this.on,this.once,this.un,getUid(this),this.values_=null,e!==void 0&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(e,t){let i;i=`change:${e}`,this.hasListener(i)&&this.dispatchEvent(new ObjectEvent(i,e,t)),i=ObjectEventType.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new ObjectEvent(i,e,t))}addChangeListener(e,t){this.addEventListener(`change:${e}`,t)}removeChangeListener(e,t){this.removeEventListener(`change:${e}`,t)}set(e,t,i){const n=this.values_||(this.values_={});if(i)n[e]=t;else{const r=n[e];n[e]=t,r!==t&&this.notify(e,r)}}setProperties(e,t){for(const i in e)this.set(i,e[i],t)}applyProperties(e){e.values_&&Object.assign(this.values_||(this.values_={}),e.values_)}unset(e,t){if(this.values_&&e in this.values_){const i=this.values_[e];delete this.values_[e],isEmpty$1(this.values_)&&(this.values_=null),t||this.notify(e,i)}}}const Property$3={LENGTH:"length"};class CollectionEvent extends BaseEvent{constructor(e,t,i){super(e),this.element=t,this.index=i}}class Collection extends BaseObject{constructor(e,t){if(super(),this.on,this.once,this.un,t=t||{},this.unique_=!!t.unique,this.array_=e||[],this.unique_)for(let i=0,n=this.array_.length;i<n;++i)this.assertUnique_(this.array_[i],i);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(e){for(let t=0,i=e.length;t<i;++t)this.push(e[t]);return this}forEach(e){const t=this.array_;for(let i=0,n=t.length;i<n;++i)e(t[i],i,t)}getArray(){return this.array_}item(e){return this.array_[e]}getLength(){return this.get(Property$3.LENGTH)}insertAt(e,t){if(e<0||e>this.getLength())throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new CollectionEvent(CollectionEventType.ADD,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){this.unique_&&this.assertUnique_(e);const t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){const t=this.array_;for(let i=0,n=t.length;i<n;++i)if(t[i]===e)return this.removeAt(i)}removeAt(e){if(e<0||e>=this.getLength())return;const t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new CollectionEvent(CollectionEventType.REMOVE,t,e)),t}setAt(e,t){const i=this.getLength();if(e>=i){this.insertAt(e,t);return}if(e<0)throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t,e);const n=this.array_[e];this.array_[e]=t,this.dispatchEvent(new CollectionEvent(CollectionEventType.REMOVE,n,e)),this.dispatchEvent(new CollectionEvent(CollectionEventType.ADD,t,e))}updateLength_(){this.set(Property$3.LENGTH,this.array_.length)}assertUnique_(e,t){for(let i=0,n=this.array_.length;i<n;++i)if(this.array_[i]===e&&i!==t)throw new Error("Duplicate item added to a unique collection")}}class MapEvent extends BaseEvent{constructor(e,t,i){super(e),this.map=t,this.frameState=i!==void 0?i:null}}class MapBrowserEvent extends MapEvent{constructor(e,t,i,n,r,o){super(e,t,r),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=n!==void 0?n:!1,this.activePointers=o}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(e){this.pixel_=e}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(e){this.coordinate_=e}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}}const MapBrowserEventType={SINGLECLICK:"singleclick",CLICK:EventType.CLICK,DBLCLICK:EventType.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},ua=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",SAFARI=ua.includes("safari")&&!ua.includes("chrom");SAFARI&&(ua.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(ua));const WEBKIT=ua.includes("webkit")&&!ua.includes("edge"),MAC=ua.includes("macintosh"),DEVICE_PIXEL_RATIO=typeof devicePixelRatio<"u"?devicePixelRatio:1,WORKER_OFFSCREEN_CANVAS=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,IMAGE_DECODE=typeof Image<"u"&&Image.prototype.decode,CREATE_IMAGE_BITMAP=typeof createImageBitmap=="function",PASSIVE_EVENT_LISTENERS=function(){let s=!1;try{const e=Object.defineProperty({},"passive",{get:function(){s=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch{}return s}(),PointerEventType={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown"};class MapBrowserEventHandler extends Target{constructor(e,t){super(e),this.map_=e,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=t===void 0?1:t,this.down_=null;const i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=listen(i,PointerEventType.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=listen(i,PointerEventType.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(EventType.TOUCHMOVE,this.boundHandleTouchMove_,PASSIVE_EVENT_LISTENERS?{passive:!1}:!1)}emulateClick_(e){let t=new MapBrowserEvent(MapBrowserEventType.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new MapBrowserEvent(MapBrowserEventType.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const i=new MapBrowserEvent(MapBrowserEventType.SINGLECLICK,this.map_,e);this.dispatchEvent(i)},250)}updateActivePointers_(e){const t=e,i=t.pointerId;if(t.type==MapBrowserEventType.POINTERUP||t.type==MapBrowserEventType.POINTERCANCEL){delete this.trackedTouches_[i];for(const n in this.trackedTouches_)if(this.trackedTouches_[n].target!==t.target){delete this.trackedTouches_[n];break}}else(t.type==MapBrowserEventType.POINTERDOWN||t.type==MapBrowserEventType.POINTERMOVE)&&(this.trackedTouches_[i]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);const t=new MapBrowserEvent(MapBrowserEventType.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(unlistenByKey),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return e.button===0}handlePointerDown_(e){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(e);const t=new MapBrowserEvent(MapBrowserEventType.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);if(this.dispatchEvent(t),this.down_=new PointerEvent(e.type,e),Object.defineProperty(this.down_,"target",{writable:!1,value:e.target}),this.dragListenerKeys_.length===0){const i=this.map_.getOwnerDocument();this.dragListenerKeys_.push(listen(i,MapBrowserEventType.POINTERMOVE,this.handlePointerMove_,this),listen(i,MapBrowserEventType.POINTERUP,this.handlePointerUp_,this),listen(this.element_,MapBrowserEventType.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==i&&this.dragListenerKeys_.push(listen(this.element_.getRootNode(),MapBrowserEventType.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;const t=new MapBrowserEvent(MapBrowserEventType.POINTERDRAG,this.map_,e,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(t)}}relayMoveEvent_(e){this.originalPointerMoveEvent_=e;const t=!!(this.down_&&this.isMoving_(e));this.dispatchEvent(new MapBrowserEvent(MapBrowserEventType.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){const t=this.originalPointerMoveEvent_;(!t||t.defaultPrevented)&&(typeof e.cancelable!="boolean"||e.cancelable===!0)&&e.preventDefault()}isMoving_(e){return this.dragging_||Math.abs(e.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(e.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(unlistenByKey(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(EventType.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(unlistenByKey(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(unlistenByKey),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const MapEventType={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},MapProperty={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},TileState={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function assert(s,e){if(!s)throw new Error(e)}const DROP=1/0;class PriorityQueue{constructor(e,t){this.priorityFunction_=e,this.keyFunction_=t,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,clear(this.queuedElements_)}dequeue(){const e=this.elements_,t=this.priorities_,i=e[0];e.length==1?(e.length=0,t.length=0):(e[0]=e.pop(),t[0]=t.pop(),this.siftUp_(0));const n=this.keyFunction_(i);return delete this.queuedElements_[n],i}enqueue(e){assert(!(this.keyFunction_(e)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const t=this.priorityFunction_(e);return t!=DROP?(this.elements_.push(e),this.priorities_.push(t),this.queuedElements_[this.keyFunction_(e)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(e){return e*2+1}getRightChildIndex_(e){return e*2+2}getParentIndex_(e){return e-1>>1}heapify_(){let e;for(e=(this.elements_.length>>1)-1;e>=0;e--)this.siftUp_(e)}isEmpty(){return this.elements_.length===0}isKeyQueued(e){return e in this.queuedElements_}isQueued(e){return this.isKeyQueued(this.keyFunction_(e))}siftUp_(e){const t=this.elements_,i=this.priorities_,n=t.length,r=t[e],o=i[e],a=e;for(;e<n>>1;){const l=this.getLeftChildIndex_(e),c=this.getRightChildIndex_(e),h=c<n&&i[c]<i[l]?c:l;t[e]=t[h],i[e]=i[h],e=h}t[e]=r,i[e]=o,this.siftDown_(a,e)}siftDown_(e,t){const i=this.elements_,n=this.priorities_,r=i[t],o=n[t];for(;t>e;){const a=this.getParentIndex_(t);if(n[a]>o)i[t]=i[a],n[t]=n[a],t=a;else break}i[t]=r,n[t]=o}reprioritize(){const e=this.priorityFunction_,t=this.elements_,i=this.priorities_;let n=0;const r=t.length;let o,a,l;for(a=0;a<r;++a)o=t[a],l=e(o),l==DROP?delete this.queuedElements_[this.keyFunction_(o)]:(i[n]=l,t[n++]=o);t.length=n,i.length=n,this.heapify_()}}class TileQueue extends PriorityQueue{constructor(e,t){super(i=>e.apply(null,i),i=>i[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=t,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(e){const t=super.enqueue(e);return t&&e[0].addEventListener(EventType.CHANGE,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){const t=e.target,i=t.getState();if(i===TileState.LOADED||i===TileState.ERROR||i===TileState.EMPTY){i!==TileState.ERROR&&t.removeEventListener(EventType.CHANGE,this.boundHandleTileChange_);const n=t.getKey();n in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[n],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(e,t){let i=0;for(;this.tilesLoading_<e&&i<t&&this.getCount()>0;){const n=this.dequeue()[0],r=n.getKey();n.getState()===TileState.IDLE&&!(r in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[r]=!0,++this.tilesLoading_,++i,n.load())}}}function getTilePriority(s,e,t,i,n){if(!s||!(t in s.wantedTiles)||!s.wantedTiles[t][e.getKey()])return DROP;const r=s.viewState.center,o=i[0]-r[0],a=i[1]-r[1];return 65536*Math.log(n)+Math.sqrt(o*o+a*a)/n}const ViewHint={ANIMATING:0,INTERACTING:1},ViewProperty={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function clamp(s,e,t){return Math.min(Math.max(s,e),t)}function squaredSegmentDistance(s,e,t,i,n,r){const o=n-t,a=r-i;if(o!==0||a!==0){const l=((s-t)*o+(e-i)*a)/(o*o+a*a);l>1?(t=n,i=r):l>0&&(t+=o*l,i+=a*l)}return squaredDistance(s,e,t,i)}function squaredDistance(s,e,t,i){const n=t-s,r=i-e;return n*n+r*r}function solveLinearSystem(s){const e=s.length;for(let i=0;i<e;i++){let n=i,r=Math.abs(s[i][i]);for(let a=i+1;a<e;a++){const l=Math.abs(s[a][i]);l>r&&(r=l,n=a)}if(r===0)return null;const o=s[n];s[n]=s[i],s[i]=o;for(let a=i+1;a<e;a++){const l=-s[a][i]/s[i][i];for(let c=i;c<e+1;c++)i==c?s[a][c]=0:s[a][c]+=l*s[i][c]}}const t=new Array(e);for(let i=e-1;i>=0;i--){t[i]=s[i][e]/s[i][i];for(let n=i-1;n>=0;n--)s[n][e]-=s[n][i]*t[i]}return t}function toDegrees(s){return s*180/Math.PI}function toRadians(s){return s*Math.PI/180}function modulo(s,e){const t=s%e;return t*e<0?t+e:t}function lerp(s,e,t){return s+t*(e-s)}function toFixed(s,e){const t=Math.pow(10,e);return Math.round(s*t)/t}function floor(s,e){return Math.floor(toFixed(s,e))}function ceil(s,e){return Math.ceil(toFixed(s,e))}function wrap(s,e,t){if(s>=e&&s<t)return s;const i=t-e;return((s-e)%i+i)%i+e}function createExtent(s,e,t){return function(i,n,r,o,a){if(!i)return;if(!n&&!e)return i;const l=e?0:r[0]*n,c=e?0:r[1]*n,h=a?a[0]:0,u=a?a[1]:0;let d=s[0]+l/2+h,g=s[2]-l/2+h,f=s[1]+c/2+u,m=s[3]-c/2+u;d>g&&(d=(g+d)/2,g=d),f>m&&(f=(m+f)/2,m=f);let p=clamp(i[0],d,g),_=clamp(i[1],f,m);if(o&&t&&n){const y=30*n;p+=-y*Math.log(1+Math.max(0,d-i[0])/y)+y*Math.log(1+Math.max(0,i[0]-g)/y),_+=-y*Math.log(1+Math.max(0,f-i[1])/y)+y*Math.log(1+Math.max(0,i[1]-m)/y)}return[p,_]}}function none$1(s){return s}const Relationship={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function boundingExtent(s){const e=createEmpty();for(let t=0,i=s.length;t<i;++t)extendCoordinate(e,s[t]);return e}function buffer(s,e,t){return t?(t[0]=s[0]-e,t[1]=s[1]-e,t[2]=s[2]+e,t[3]=s[3]+e,t):[s[0]-e,s[1]-e,s[2]+e,s[3]+e]}function clone(s,e){return e?(e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=s[3],e):s.slice()}function closestSquaredDistanceXY(s,e,t){let i,n;return e<s[0]?i=s[0]-e:s[2]<e?i=e-s[2]:i=0,t<s[1]?n=s[1]-t:s[3]<t?n=t-s[3]:n=0,i*i+n*n}function containsCoordinate(s,e){return containsXY(s,e[0],e[1])}function containsExtent(s,e){return s[0]<=e[0]&&e[2]<=s[2]&&s[1]<=e[1]&&e[3]<=s[3]}function containsXY(s,e,t){return s[0]<=e&&e<=s[2]&&s[1]<=t&&t<=s[3]}function coordinateRelationship(s,e){const t=s[0],i=s[1],n=s[2],r=s[3],o=e[0],a=e[1];let l=Relationship.UNKNOWN;return o<t?l=l|Relationship.LEFT:o>n&&(l=l|Relationship.RIGHT),a<i?l=l|Relationship.BELOW:a>r&&(l=l|Relationship.ABOVE),l===Relationship.UNKNOWN&&(l=Relationship.INTERSECTING),l}function createEmpty(){return[1/0,1/0,-1/0,-1/0]}function createOrUpdate$2(s,e,t,i,n){return n?(n[0]=s,n[1]=e,n[2]=t,n[3]=i,n):[s,e,t,i]}function createOrUpdateEmpty(s){return createOrUpdate$2(1/0,1/0,-1/0,-1/0,s)}function createOrUpdateFromCoordinate(s,e){const t=s[0],i=s[1];return createOrUpdate$2(t,i,t,i,e)}function createOrUpdateFromFlatCoordinates(s,e,t,i,n){const r=createOrUpdateEmpty(n);return extendFlatCoordinates(r,s,e,t,i)}function equals$1(s,e){return s[0]==e[0]&&s[2]==e[2]&&s[1]==e[1]&&s[3]==e[3]}function extend$1(s,e){return e[0]<s[0]&&(s[0]=e[0]),e[2]>s[2]&&(s[2]=e[2]),e[1]<s[1]&&(s[1]=e[1]),e[3]>s[3]&&(s[3]=e[3]),s}function extendCoordinate(s,e){e[0]<s[0]&&(s[0]=e[0]),e[0]>s[2]&&(s[2]=e[0]),e[1]<s[1]&&(s[1]=e[1]),e[1]>s[3]&&(s[3]=e[1])}function extendFlatCoordinates(s,e,t,i,n){for(;t<i;t+=n)extendXY(s,e[t],e[t+1]);return s}function extendXY(s,e,t){s[0]=Math.min(s[0],e),s[1]=Math.min(s[1],t),s[2]=Math.max(s[2],e),s[3]=Math.max(s[3],t)}function forEachCorner(s,e){let t;return t=e(getBottomLeft(s)),t||(t=e(getBottomRight(s)),t)||(t=e(getTopRight(s)),t)||(t=e(getTopLeft(s)),t)?t:!1}function getArea(s){let e=0;return isEmpty(s)||(e=getWidth(s)*getHeight(s)),e}function getBottomLeft(s){return[s[0],s[1]]}function getBottomRight(s){return[s[2],s[1]]}function getCenter(s){return[(s[0]+s[2])/2,(s[1]+s[3])/2]}function getCorner(s,e){let t;if(e==="bottom-left")t=getBottomLeft(s);else if(e==="bottom-right")t=getBottomRight(s);else if(e==="top-left")t=getTopLeft(s);else if(e==="top-right")t=getTopRight(s);else throw new Error("Invalid corner");return t}function getForViewAndSize(s,e,t,i,n){const[r,o,a,l,c,h,u,d]=getRotatedViewport(s,e,t,i);return createOrUpdate$2(Math.min(r,a,c,u),Math.min(o,l,h,d),Math.max(r,a,c,u),Math.max(o,l,h,d),n)}function getRotatedViewport(s,e,t,i){const n=e*i[0]/2,r=e*i[1]/2,o=Math.cos(t),a=Math.sin(t),l=n*o,c=n*a,h=r*o,u=r*a,d=s[0],g=s[1];return[d-l+u,g-c-h,d-l-u,g-c+h,d+l-u,g+c+h,d+l+u,g+c-h,d-l+u,g-c-h]}function getHeight(s){return s[3]-s[1]}function getIntersection(s,e,t){const i=t||createEmpty();return intersects$1(s,e)?(s[0]>e[0]?i[0]=s[0]:i[0]=e[0],s[1]>e[1]?i[1]=s[1]:i[1]=e[1],s[2]<e[2]?i[2]=s[2]:i[2]=e[2],s[3]<e[3]?i[3]=s[3]:i[3]=e[3]):createOrUpdateEmpty(i),i}function getTopLeft(s){return[s[0],s[3]]}function getTopRight(s){return[s[2],s[3]]}function getWidth(s){return s[2]-s[0]}function intersects$1(s,e){return s[0]<=e[2]&&s[2]>=e[0]&&s[1]<=e[3]&&s[3]>=e[1]}function isEmpty(s){return s[2]<s[0]||s[3]<s[1]}function returnOrUpdate(s,e){return e?(e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=s[3],e):s}function intersectsSegment(s,e,t){let i=!1;const n=coordinateRelationship(s,e),r=coordinateRelationship(s,t);if(n===Relationship.INTERSECTING||r===Relationship.INTERSECTING)i=!0;else{const o=s[0],a=s[1],l=s[2],c=s[3],h=e[0],u=e[1],d=t[0],g=t[1],f=(g-u)/(d-h);let m,p;r&Relationship.ABOVE&&!(n&Relationship.ABOVE)&&(m=d-(g-c)/f,i=m>=o&&m<=l),!i&&r&Relationship.RIGHT&&!(n&Relationship.RIGHT)&&(p=g-(d-l)*f,i=p>=a&&p<=c),!i&&r&Relationship.BELOW&&!(n&Relationship.BELOW)&&(m=d-(g-a)/f,i=m>=o&&m<=l),!i&&r&Relationship.LEFT&&!(n&Relationship.LEFT)&&(p=g-(d-o)*f,i=p>=a&&p<=c)}return i}function wrapX$2(s,e){const t=e.getExtent(),i=getCenter(s);if(e.canWrapX()&&(i[0]<t[0]||i[0]>=t[2])){const n=getWidth(t),o=Math.floor((i[0]-t[0])/n)*n;s[0]-=o,s[2]-=o}return s}function wrapAndSliceX(s,e,t){if(e.canWrapX()){const i=e.getExtent();if(!isFinite(s[0])||!isFinite(s[2]))return[[i[0],s[1],i[2],s[3]]];wrapX$2(s,e);const n=getWidth(i);if(getWidth(s)>n&&!t)return[[i[0],s[1],i[2],s[3]]];if(s[0]<i[0])return[[s[0]+n,s[1],i[2],s[3]],[i[0],s[1],s[2],s[3]]];if(s[2]>i[2])return[[s[0],s[1],i[2],s[3]],[i[0],s[1],s[2]-n,s[3]]]}return[s]}function add$2(s,e){return s[0]+=+e[0],s[1]+=+e[1],s}function equals(s,e){let t=!0;for(let i=s.length-1;i>=0;--i)if(s[i]!=e[i]){t=!1;break}return t}function rotate$1(s,e){const t=Math.cos(e),i=Math.sin(e),n=s[0]*t-s[1]*i,r=s[1]*t+s[0]*i;return s[0]=n,s[1]=r,s}function scale$2(s,e){return s[0]*=e,s[1]*=e,s}function wrapX$1(s,e){if(e.canWrapX()){const t=getWidth(e.getExtent()),i=getWorldsAway(s,e,t);i&&(s[0]-=i*t)}return s}function getWorldsAway(s,e,t){const i=e.getExtent();let n=0;return e.canWrapX()&&(s[0]<i[0]||s[0]>i[2])&&(t=t||getWidth(i),n=Math.floor((s[0]-i[0])/t)),n}function easeIn(s){return Math.pow(s,3)}function easeOut(s){return 1-easeIn(1-s)}function inAndOut(s){return 3*s*s-2*s*s*s}function linear(s){return s}const DEFAULT_RADIUS=63710088e-1;function getDistance(s,e,t){t=t||DEFAULT_RADIUS;const i=toRadians(s[1]),n=toRadians(e[1]),r=(n-i)/2,o=toRadians(e[0]-s[0])/2,a=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(i)*Math.cos(n);return 2*t*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function warn(...s){console.warn(...s)}const METERS_PER_UNIT$1={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class Projection{constructor(e){this.code_=e.code,this.units_=e.units,this.extent_=e.extent!==void 0?e.extent:null,this.worldExtent_=e.worldExtent!==void 0?e.worldExtent:null,this.axisOrientation_=e.axisOrientation!==void 0?e.axisOrientation:"enu",this.global_=e.global!==void 0?e.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=e.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=e.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||METERS_PER_UNIT$1[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!!(e&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!!(this.global_&&e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}}const RADIUS$1=6378137,HALF_SIZE=Math.PI*RADIUS$1,EXTENT$1=[-HALF_SIZE,-HALF_SIZE,HALF_SIZE,HALF_SIZE],WORLD_EXTENT=[-180,-85,180,85],MAX_SAFE_Y=RADIUS$1*Math.log(Math.tan(Math.PI/2));class EPSG3857Projection extends Projection{constructor(e){super({code:e,units:"m",extent:EXTENT$1,global:!0,worldExtent:WORLD_EXTENT,getPointResolution:function(t,i){return t/Math.cosh(i[1]/RADIUS$1)}})}}const PROJECTIONS$1=[new EPSG3857Projection("EPSG:3857"),new EPSG3857Projection("EPSG:102100"),new EPSG3857Projection("EPSG:102113"),new EPSG3857Projection("EPSG:900913"),new EPSG3857Projection("http://www.opengis.net/def/crs/EPSG/0/3857"),new EPSG3857Projection("http://www.opengis.net/gml/srs/epsg.xml#3857")];function fromEPSG4326(s,e,t,i){const n=s.length;t=t>1?t:2,i=i??t,e===void 0&&(t>2?e=s.slice():e=new Array(n));for(let r=0;r<n;r+=i){e[r]=HALF_SIZE*s[r]/180;let o=RADIUS$1*Math.log(Math.tan(Math.PI*(+s[r+1]+90)/360));o>MAX_SAFE_Y?o=MAX_SAFE_Y:o<-MAX_SAFE_Y&&(o=-MAX_SAFE_Y),e[r+1]=o}return e}function toEPSG4326(s,e,t,i){const n=s.length;t=t>1?t:2,i=i??t,e===void 0&&(t>2?e=s.slice():e=new Array(n));for(let r=0;r<n;r+=i)e[r]=180*s[r]/HALF_SIZE,e[r+1]=360*Math.atan(Math.exp(s[r+1]/RADIUS$1))/Math.PI-90;return e}const RADIUS=6378137,EXTENT=[-180,-90,180,90],METERS_PER_UNIT=Math.PI*RADIUS/180;class EPSG4326Projection extends Projection{constructor(e,t){super({code:e,units:"degrees",extent:EXTENT,axisOrientation:t,global:!0,metersPerUnit:METERS_PER_UNIT,worldExtent:EXTENT})}}const PROJECTIONS=[new EPSG4326Projection("CRS:84"),new EPSG4326Projection("EPSG:4326","neu"),new EPSG4326Projection("urn:ogc:def:crs:OGC:1.3:CRS84"),new EPSG4326Projection("urn:ogc:def:crs:OGC:2:84"),new EPSG4326Projection("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new EPSG4326Projection("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new EPSG4326Projection("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let cache$1={};function get$3(s){return cache$1[s]||cache$1[s.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function add$1(s,e){cache$1[s]=e}let transforms={};function add(s,e,t){const i=s.getCode(),n=e.getCode();i in transforms||(transforms[i]={}),transforms[i][n]=t}function get$2(s,e){return s in transforms&&e in transforms[s]?transforms[s][e]:null}const K0=.9996,E=.00669438,E2=E*E,E3=E2*E,E_P2=E/(1-E),SQRT_E=Math.sqrt(1-E),_E=(1-SQRT_E)/(1+SQRT_E),_E2=_E*_E,_E3=_E2*_E,_E4=_E3*_E,_E5=_E4*_E,M1=1-E/4-3*E2/64-5*E3/256,M2=3*E/8+3*E2/32+45*E3/1024,M3=15*E2/256+45*E3/1024,M4=35*E3/3072,P2=3/2*_E-27/32*_E3+269/512*_E5,P3=21/16*_E2-55/32*_E4,P4=151/96*_E3-417/128*_E5,P5=1097/512*_E4,R=6378137;function toLonLat(s,e,t){const i=s-5e5,o=(t.north?e:e-1e7)/K0/(R*M1),a=o+P2*Math.sin(2*o)+P3*Math.sin(4*o)+P4*Math.sin(6*o)+P5*Math.sin(8*o),l=Math.sin(a),c=l*l,h=Math.cos(a),u=l/h,d=u*u,g=d*d,f=1-E*c,m=Math.sqrt(1-E*c),p=R/m,_=(1-E)/f,y=E_P2*h**2,A=y*y,x=i/(p*K0),C=x*x,T=C*x,S=T*x,w=S*x,I=w*x,L=a-u/_*(C/2-S/24*(5+3*d+10*y-4*A-9*E_P2))+I/720*(61+90*d+298*y+45*g-252*E_P2-3*A);let D=(x-T/6*(1+2*d+y)+w/120*(5-2*y+28*d-3*A+8*E_P2+24*g))/h;return D=wrap(D+toRadians(zoneToCentralLongitude(t.number)),-Math.PI,Math.PI),[toDegrees(D),toDegrees(L)]}const MIN_LATITUDE=-80,MAX_LATITUDE=84,MIN_LONGITUDE=-180,MAX_LONGITUDE=180;function fromLonLat(s,e,t){s=wrap(s,MIN_LONGITUDE,MAX_LONGITUDE),e<MIN_LATITUDE?e=MIN_LATITUDE:e>MAX_LATITUDE&&(e=MAX_LATITUDE);const i=toRadians(e),n=Math.sin(i),r=Math.cos(i),o=n/r,a=o*o,l=a*a,c=toRadians(s),h=zoneToCentralLongitude(t.number),u=toRadians(h),d=R/Math.sqrt(1-E*n**2),g=E_P2*r**2,f=r*wrap(c-u,-Math.PI,Math.PI),m=f*f,p=m*f,_=p*f,y=_*f,A=y*f,x=R*(M1*i-M2*Math.sin(2*i)+M3*Math.sin(4*i)-M4*Math.sin(6*i)),C=K0*d*(f+p/6*(1-a+g)+y/120*(5-18*a+l+72*g-58*E_P2))+5e5;let T=K0*(x+d*o*(m/2+_/24*(5-a+9*g+4*g**2)+A/720*(61-58*a+l+600*g-330*E_P2)));return t.north||(T+=1e7),[C,T]}function zoneToCentralLongitude(s){return(s-1)*6-180+3}const epsgRegExes=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function zoneFromCode(s){let e=0;for(const n of epsgRegExes){const r=s.match(n);if(r){e=parseInt(r[1]);break}}if(!e)return null;let t=0,i=!1;return e>32700&&e<32761?t=e-32700:e>32600&&e<32661&&(i=!0,t=e-32600),t?{number:t,north:i}:null}function makeTransformFunction(s,e){return function(t,i,n,r){const o=t.length;n=n>1?n:2,r=r??n,i||(n>2?i=t.slice():i=new Array(o));for(let a=0;a<o;a+=r){const l=t[a],c=t[a+1],h=s(l,c,e);i[a]=h[0],i[a+1]=h[1]}return i}}function makeProjection(s){return zoneFromCode(s)?new Projection({code:s,units:"m"}):null}function makeTransforms(s){const e=zoneFromCode(s.getCode());return e?{forward:makeTransformFunction(fromLonLat,e),inverse:makeTransformFunction(toLonLat,e)}:null}const transformFactories=[makeTransforms],projectionFactories=[makeProjection];let showCoordinateWarning=!0;function disableCoordinateWarning(s){showCoordinateWarning=!1}function cloneTransform(s,e){if(e!==void 0){for(let t=0,i=s.length;t<i;++t)e[t]=s[t];e=e}else e=s.slice();return e}function addProjection(s){add$1(s.getCode(),s),add(s,s,cloneTransform)}function addProjections(s){s.forEach(addProjection)}function get$1(s){if(typeof s!="string")return s;const e=get$3(s);if(e)return e;for(const t of projectionFactories){const i=t(s);if(i)return i}return null}function getPointResolution(s,e,t,i){s=get$1(s);let n;const r=s.getPointResolutionFunc();if(r)n=r(e,t);else{const o=s.getUnits();if(o=="degrees"&&!i||i=="degrees")n=e;else{const a=getTransformFromProjections(s,get$1("EPSG:4326"));if(!a&&o!=="degrees")n=e*s.getMetersPerUnit();else{let c=[t[0]-e/2,t[1],t[0]+e/2,t[1],t[0],t[1]-e/2,t[0],t[1]+e/2];c=a(c,c,2);const h=getDistance(c.slice(0,2),c.slice(2,4)),u=getDistance(c.slice(4,6),c.slice(6,8));n=(h+u)/2}const l=s.getMetersPerUnit();l!==void 0&&(n/=l)}}return n}function addEquivalentProjections(s){addProjections(s),s.forEach(function(e){s.forEach(function(t){e!==t&&add(e,t,cloneTransform)})})}function addEquivalentTransforms(s,e,t,i){s.forEach(function(n){e.forEach(function(r){add(n,r,t),add(r,n,i)})})}function createProjection(s,e){return s?typeof s=="string"?get$1(s):s:get$1(e)}function createTransformFromCoordinateTransform(s){return function(e,t,i,n){const r=e.length;i=i!==void 0?i:2,n=n??i,t=t!==void 0?t:new Array(r);for(let o=0;o<r;o+=n){const a=s(e.slice(o,o+i)),l=a.length;for(let c=0,h=n;c<h;++c)t[o+c]=c>=l?e[o+c]:a[c]}return t}}function equivalent$1(s,e){if(s===e)return!0;const t=s.getUnits()===e.getUnits();return(s.getCode()===e.getCode()||getTransformFromProjections(s,e)===cloneTransform)&&t}function getTransformFromProjections(s,e){const t=s.getCode(),i=e.getCode();let n=get$2(t,i);if(n)return n;let r=null,o=null;for(const l of transformFactories)r||(r=l(s)),o||(o=l(e));if(!r&&!o)return null;const a="EPSG:4326";if(o)if(r)n=composeTransformFuncs(r.inverse,o.forward);else{const l=get$2(t,a);l&&(n=composeTransformFuncs(l,o.forward))}else{const l=get$2(a,i);l&&(n=composeTransformFuncs(r.inverse,l))}return n&&(addProjection(s),addProjection(e),add(s,e,n)),n}function composeTransformFuncs(s,e){return function(t,i,n,r){return i=s(t,i,n,r),e(i,i,n,r)}}function getTransform(s,e){const t=get$1(s),i=get$1(e);return getTransformFromProjections(t,i)}function transform(s,e,t){const i=getTransform(e,t);if(!i){const n=get$1(e).getCode(),r=get$1(t).getCode();throw new Error(`No transform available between ${n} and ${r}`)}return i(s,void 0,s.length)}function toUserCoordinate(s,e){return s}function fromUserCoordinate(s,e){return showCoordinateWarning&&!equals(s,[0,0])&&s[0]>=-180&&s[0]<=180&&s[1]>=-90&&s[1]<=90&&(showCoordinateWarning=!1,warn("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),s}function toUserExtent(s,e){return s}function fromUserExtent(s,e){return s}function addCommon(){addEquivalentProjections(PROJECTIONS$1),addEquivalentProjections(PROJECTIONS),addEquivalentTransforms(PROJECTIONS,PROJECTIONS$1,fromEPSG4326,toEPSG4326)}addCommon(),new Array(6);function create(){return[1,0,0,1,0,0]}function setFromArray(s,e){return s[0]=e[0],s[1]=e[1],s[2]=e[2],s[3]=e[3],s[4]=e[4],s[5]=e[5],s}function apply(s,e){const t=e[0],i=e[1];return e[0]=s[0]*t+s[2]*i+s[4],e[1]=s[1]*t+s[3]*i+s[5],e}function compose(s,e,t,i,n,r,o,a){const l=Math.sin(r),c=Math.cos(r);return s[0]=i*c,s[1]=n*l,s[2]=-i*l,s[3]=n*c,s[4]=o*i*c-a*i*l+e,s[5]=o*n*l+a*n*c+t,s}function makeInverse(s,e){const t=determinant(e);assert(t!==0,"Transformation matrix cannot be inverted");const i=e[0],n=e[1],r=e[2],o=e[3],a=e[4],l=e[5];return s[0]=o/t,s[1]=-n/t,s[2]=-r/t,s[3]=i/t,s[4]=(r*l-o*a)/t,s[5]=-(i*l-n*a)/t,s}function determinant(s){return s[0]*s[3]-s[1]*s[2]}const matrixPrecision=[1e5,1e5,1e5,1e5,2,2];function toString$1(s){return"matrix("+s.join(", ")+")"}function fromString$1(s){return s.substring(7,s.length-1).split(",").map(parseFloat)}function equivalent(s,e){const t=fromString$1(s),i=fromString$1(e);for(let n=0;n<6;++n)if(Math.round((t[n]-i[n])*matrixPrecision[n])!==0)return!1;return!0}function transform2D(s,e,t,i,n,r,o){r=r||[],o=o||2;let a=0;for(let l=e;l<t;l+=i){const c=s[l],h=s[l+1];r[a++]=n[0]*c+n[2]*h+n[4],r[a++]=n[1]*c+n[3]*h+n[5];for(let u=2;u<o;u++)r[a++]=s[l+u]}return r&&r.length!=a&&(r.length=a),r}function rotate(s,e,t,i,n,r,o){o=o||[];const a=Math.cos(n),l=Math.sin(n),c=r[0],h=r[1];let u=0;for(let d=e;d<t;d+=i){const g=s[d]-c,f=s[d+1]-h;o[u++]=c+g*a-f*l,o[u++]=h+g*l+f*a;for(let m=d+2;m<d+i;++m)o[u++]=s[m]}return o&&o.length!=u&&(o.length=u),o}function scale$1(s,e,t,i,n,r,o,a){a=a||[];const l=o[0],c=o[1];let h=0;for(let u=e;u<t;u+=i){const d=s[u]-l,g=s[u+1]-c;a[h++]=l+n*d,a[h++]=c+r*g;for(let f=u+2;f<u+i;++f)a[h++]=s[f]}return a&&a.length!=h&&(a.length=h),a}function translate(s,e,t,i,n,r,o){o=o||[];let a=0;for(let l=e;l<t;l+=i){o[a++]=s[l]+n,o[a++]=s[l+1]+r;for(let c=l+2;c<l+i;++c)o[a++]=s[c]}return o&&o.length!=a&&(o.length=a),o}const tmpTransform$1=create(),tmpPoint=[NaN,NaN];class Geometry extends BaseObject{constructor(){super(),this.extent_=createEmpty(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=memoizeOne((e,t,i)=>{if(!i)return this.getSimplifiedGeometry(t);const n=this.clone();return n.applyTransform(i),n.getSimplifiedGeometry(t)})}simplifyTransformed(e,t){return this.simplifyTransformedInternal(this.getRevision(),e,t)}clone(){return abstract()}closestPointXY(e,t,i,n){return abstract()}containsXY(e,t){return this.closestPointXY(e,t,tmpPoint,Number.MIN_VALUE)===0}getClosestPoint(e,t){return t=t||[NaN,NaN],this.closestPointXY(e[0],e[1],t,1/0),t}intersectsCoordinate(e){return this.containsXY(e[0],e[1])}computeExtent(e){return abstract()}getExtent(e){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&createOrUpdateEmpty(t),this.extentRevision_=this.getRevision()}return returnOrUpdate(this.extent_,e)}rotate(e,t){abstract()}scale(e,t,i){abstract()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return abstract()}getType(){return abstract()}applyTransform(e){abstract()}intersectsExtent(e){return abstract()}translate(e,t){abstract()}transform(e,t){const i=get$1(e),n=i.getUnits()=="tile-pixels"?function(r,o,a){const l=i.getExtent(),c=i.getWorldExtent(),h=getHeight(c)/getHeight(l);compose(tmpTransform$1,c[0],c[3],h,-h,0,0,0);const u=transform2D(r,0,r.length,a,tmpTransform$1,o),d=getTransform(i,t);return d?d(u,u,a):u}:getTransform(i,t);return this.applyTransform(n),this}}class SimpleGeometry extends Geometry{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(e){return createOrUpdateFromFlatCoordinates(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return abstract()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const t=this.getSimplifiedGeometryInternal(e);return t.getFlatCoordinates().length<this.flatCoordinates.length?t:(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getSimplifiedGeometryInternal(e){return this}getStride(){return this.stride}setFlatCoordinates(e,t){this.stride=getStrideForLayout(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){abstract()}setLayout(e,t,i){let n;if(e)n=getStrideForLayout(e);else{for(let r=0;r<i;++r){if(t.length===0){this.layout="XY",this.stride=2;return}t=t[0]}n=t.length,e=getLayoutForStride(n)}this.layout=e,this.stride=n}applyTransform(e){this.flatCoordinates&&(e(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(e,t){const i=this.getFlatCoordinates();if(i){const n=this.getStride();rotate(i,0,i.length,n,e,t,i),this.changed()}}scale(e,t,i){t===void 0&&(t=e),i||(i=getCenter(this.getExtent()));const n=this.getFlatCoordinates();if(n){const r=this.getStride();scale$1(n,0,n.length,r,e,t,i,n),this.changed()}}translate(e,t){const i=this.getFlatCoordinates();if(i){const n=this.getStride();translate(i,0,i.length,n,e,t,i),this.changed()}}}function getLayoutForStride(s){let e;return s==2?e="XY":s==3?e="XYZ":s==4&&(e="XYZM"),e}function getStrideForLayout(s){let e;return s=="XY"?e=2:s=="XYZ"||s=="XYM"?e=3:s=="XYZM"&&(e=4),e}function transformGeom2D(s,e,t){const i=s.getFlatCoordinates();if(!i)return null;const n=s.getStride();return transform2D(i,0,i.length,n,e,t)}function linearRing(s,e,t,i){let n=0;const r=s[t-i],o=s[t-i+1];let a=0,l=0;for(;e<t;e+=i){const c=s[e]-r,h=s[e+1]-o;n+=l*c-a*h,a=c,l=h}return n/2}function linearRings(s,e,t,i){let n=0;for(let r=0,o=t.length;r<o;++r){const a=t[r];n+=linearRing(s,e,a,i),e=a}return n}function linearRingss$1(s,e,t,i){let n=0;for(let r=0,o=t.length;r<o;++r){const a=t[r];n+=linearRings(s,e,a,i),e=a[a.length-1]}return n}function assignClosest(s,e,t,i,n,r,o){const a=s[e],l=s[e+1],c=s[t]-a,h=s[t+1]-l;let u;if(c===0&&h===0)u=e;else{const d=((n-a)*c+(r-l)*h)/(c*c+h*h);if(d>1)u=t;else if(d>0){for(let g=0;g<i;++g)o[g]=lerp(s[e+g],s[t+g],d);o.length=i;return}else u=e}for(let d=0;d<i;++d)o[d]=s[u+d];o.length=i}function maxSquaredDelta(s,e,t,i,n){let r=s[e],o=s[e+1];for(e+=i;e<t;e+=i){const a=s[e],l=s[e+1],c=squaredDistance(r,o,a,l);c>n&&(n=c),r=a,o=l}return n}function arrayMaxSquaredDelta(s,e,t,i,n){for(let r=0,o=t.length;r<o;++r){const a=t[r];n=maxSquaredDelta(s,e,a,i,n),e=a}return n}function multiArrayMaxSquaredDelta(s,e,t,i,n){for(let r=0,o=t.length;r<o;++r){const a=t[r];n=arrayMaxSquaredDelta(s,e,a,i,n),e=a[a.length-1]}return n}function assignClosestPoint(s,e,t,i,n,r,o,a,l,c,h){if(e==t)return c;let u,d;if(n===0){if(d=squaredDistance(o,a,s[e],s[e+1]),d<c){for(u=0;u<i;++u)l[u]=s[e+u];return l.length=i,d}return c}h=h||[NaN,NaN];let g=e+i;for(;g<t;)if(assignClosest(s,g-i,g,i,o,a,h),d=squaredDistance(o,a,h[0],h[1]),d<c){for(c=d,u=0;u<i;++u)l[u]=h[u];l.length=i,g+=i}else g+=i*Math.max((Math.sqrt(d)-Math.sqrt(c))/n|0,1);if(r&&(assignClosest(s,t-i,e,i,o,a,h),d=squaredDistance(o,a,h[0],h[1]),d<c)){for(c=d,u=0;u<i;++u)l[u]=h[u];l.length=i}return c}function assignClosestArrayPoint(s,e,t,i,n,r,o,a,l,c,h){h=h||[NaN,NaN];for(let u=0,d=t.length;u<d;++u){const g=t[u];c=assignClosestPoint(s,e,g,i,n,r,o,a,l,c,h),e=g}return c}function assignClosestMultiArrayPoint(s,e,t,i,n,r,o,a,l,c,h){h=h||[NaN,NaN];for(let u=0,d=t.length;u<d;++u){const g=t[u];c=assignClosestArrayPoint(s,e,g,i,n,r,o,a,l,c,h),e=g[g.length-1]}return c}function deflateCoordinate(s,e,t,i){for(let n=0,r=t.length;n<r;++n)s[e++]=t[n];return e}function deflateCoordinates(s,e,t,i){for(let n=0,r=t.length;n<r;++n){const o=t[n];for(let a=0;a<i;++a)s[e++]=o[a]}return e}function deflateCoordinatesArray(s,e,t,i,n){n=n||[];let r=0;for(let o=0,a=t.length;o<a;++o){const l=deflateCoordinates(s,e,t[o],i);n[r++]=l,e=l}return n.length=r,n}function deflateMultiCoordinatesArray(s,e,t,i,n){n=n||[];let r=0;for(let o=0,a=t.length;o<a;++o){const l=deflateCoordinatesArray(s,e,t[o],i,n[r]);l.length===0&&(l[0]=e),n[r++]=l,e=l[l.length-1]}return n.length=r,n}function inflateCoordinates(s,e,t,i,n){n=n!==void 0?n:[];let r=0;for(let o=e;o<t;o+=i)n[r++]=s.slice(o,o+i);return n.length=r,n}function inflateCoordinatesArray(s,e,t,i,n){n=n!==void 0?n:[];let r=0;for(let o=0,a=t.length;o<a;++o){const l=t[o];n[r++]=inflateCoordinates(s,e,l,i,n[r]),e=l}return n.length=r,n}function inflateMultiCoordinatesArray(s,e,t,i,n){n=n!==void 0?n:[];let r=0;for(let o=0,a=t.length;o<a;++o){const l=t[o];n[r++]=l.length===1&&l[0]===e?[]:inflateCoordinatesArray(s,e,l,i,n[r]),e=l[l.length-1]}return n.length=r,n}function douglasPeucker(s,e,t,i,n,r,o){const a=(t-e)/i;if(a<3){for(;e<t;e+=i)r[o++]=s[e],r[o++]=s[e+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const c=[e,t-i];let h=0;for(;c.length>0;){const u=c.pop(),d=c.pop();let g=0;const f=s[d],m=s[d+1],p=s[u],_=s[u+1];for(let y=d+i;y<u;y+=i){const A=s[y],x=s[y+1],C=squaredSegmentDistance(A,x,f,m,p,_);C>g&&(h=y,g=C)}g>n&&(l[(h-e)/i]=1,d+i<h&&c.push(d,h),h+i<u&&c.push(h,u))}for(let u=0;u<a;++u)l[u]&&(r[o++]=s[e+u*i],r[o++]=s[e+u*i+1]);return o}function douglasPeuckerArray(s,e,t,i,n,r,o,a){for(let l=0,c=t.length;l<c;++l){const h=t[l];o=douglasPeucker(s,e,h,i,n,r,o),a.push(o),e=h}return o}function snap(s,e){return e*Math.round(s/e)}function quantize(s,e,t,i,n,r,o){if(e==t)return o;let a=snap(s[e],n),l=snap(s[e+1],n);e+=i,r[o++]=a,r[o++]=l;let c,h;do if(c=snap(s[e],n),h=snap(s[e+1],n),e+=i,e==t)return r[o++]=c,r[o++]=h,o;while(c==a&&h==l);for(;e<t;){const u=snap(s[e],n),d=snap(s[e+1],n);if(e+=i,u==c&&d==h)continue;const g=c-a,f=h-l,m=u-a,p=d-l;if(g*p==f*m&&(g<0&&m<g||g==m||g>0&&m>g)&&(f<0&&p<f||f==p||f>0&&p>f)){c=u,h=d;continue}r[o++]=c,r[o++]=h,a=c,l=h,c=u,h=d}return r[o++]=c,r[o++]=h,o}function quantizeArray(s,e,t,i,n,r,o,a){for(let l=0,c=t.length;l<c;++l){const h=t[l];o=quantize(s,e,h,i,n,r,o),a.push(o),e=h}return o}function quantizeMultiArray(s,e,t,i,n,r,o,a){for(let l=0,c=t.length;l<c;++l){const h=t[l],u=[];o=quantizeArray(s,e,h,i,n,r,o,u),a.push(u),e=h[h.length-1]}return o}class LinearRing extends SimpleGeometry{constructor(e,t){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}clone(){return new LinearRing(this.flatCoordinates.slice(),this.layout)}closestPointXY(e,t,i,n){return n<closestSquaredDistanceXY(this.getExtent(),e,t)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(maxSquaredDelta(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),assignClosestPoint(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,i,n))}getArea(){return linearRing(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return inflateCoordinates(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){const t=[];return t.length=douglasPeucker(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new LinearRing(t,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=deflateCoordinates(this.flatCoordinates,0,e,this.stride),this.changed()}}class Point extends SimpleGeometry{constructor(e,t){super(),this.setCoordinates(e,t)}clone(){const e=new Point(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,i,n){const r=this.flatCoordinates,o=squaredDistance(e,t,r[0],r[1]);if(o<n){const a=this.stride;for(let l=0;l<a;++l)i[l]=r[l];return i.length=a,o}return n}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(e){return createOrUpdateFromCoordinate(this.flatCoordinates,e)}getType(){return"Point"}intersectsExtent(e){return containsXY(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=deflateCoordinate(this.flatCoordinates,0,e,this.stride),this.changed()}}function linearRingContainsExtent(s,e,t,i,n){return!forEachCorner(n,function(o){return!linearRingContainsXY(s,e,t,i,o[0],o[1])})}function linearRingContainsXY(s,e,t,i,n,r){let o=0,a=s[t-i],l=s[t-i+1];for(;e<t;e+=i){const c=s[e],h=s[e+1];l<=r?h>r&&(c-a)*(r-l)-(n-a)*(h-l)>0&&o++:h<=r&&(c-a)*(r-l)-(n-a)*(h-l)<0&&o--,a=c,l=h}return o!==0}function linearRingsContainsXY(s,e,t,i,n,r){if(t.length===0||!linearRingContainsXY(s,e,t[0],i,n,r))return!1;for(let o=1,a=t.length;o<a;++o)if(linearRingContainsXY(s,t[o-1],t[o],i,n,r))return!1;return!0}function linearRingssContainsXY(s,e,t,i,n,r){if(t.length===0)return!1;for(let o=0,a=t.length;o<a;++o){const l=t[o];if(linearRingsContainsXY(s,e,l,i,n,r))return!0;e=l[l.length-1]}return!1}function getInteriorPointOfArray(s,e,t,i,n,r,o){let a,l,c,h,u,d,g;const f=n[r+1],m=[];for(let y=0,A=t.length;y<A;++y){const x=t[y];for(h=s[x-i],d=s[x-i+1],a=e;a<x;a+=i)u=s[a],g=s[a+1],(f<=d&&g<=f||d<=f&&f<=g)&&(c=(f-d)/(g-d)*(u-h)+h,m.push(c)),h=u,d=g}let p=NaN,_=-1/0;for(m.sort(ascending),h=m[0],a=1,l=m.length;a<l;++a){u=m[a];const y=Math.abs(u-h);y>_&&(c=(h+u)/2,linearRingsContainsXY(s,e,t,i,c,f)&&(p=c,_=y)),h=u}return isNaN(p)&&(p=n[r]),o?(o.push(p,f,_),o):[p,f,_]}function getInteriorPointsOfMultiArray(s,e,t,i,n){let r=[];for(let o=0,a=t.length;o<a;++o){const l=t[o];r=getInteriorPointOfArray(s,e,l,i,n,2*o,r),e=l[l.length-1]}return r}function forEach(s,e,t,i,n){let r;for(e+=i;e<t;e+=i)if(r=n(s.slice(e-i,e),s.slice(e,e+i)),r)return r;return!1}function intersectsLineString(s,e,t,i,n,r){return r=r??extendFlatCoordinates(createEmpty(),s,e,t,i),intersects$1(n,r)?r[0]>=n[0]&&r[2]<=n[2]||r[1]>=n[1]&&r[3]<=n[3]?!0:forEach(s,e,t,i,function(o,a){return intersectsSegment(n,o,a)}):!1}function intersectsLineStringArray(s,e,t,i,n){for(let r=0,o=t.length;r<o;++r){if(intersectsLineString(s,e,t[r],i,n))return!0;e=t[r]}return!1}function intersectsLinearRing(s,e,t,i,n){return!!(intersectsLineString(s,e,t,i,n)||linearRingContainsXY(s,e,t,i,n[0],n[1])||linearRingContainsXY(s,e,t,i,n[0],n[3])||linearRingContainsXY(s,e,t,i,n[2],n[1])||linearRingContainsXY(s,e,t,i,n[2],n[3]))}function intersectsLinearRingArray(s,e,t,i,n){if(!intersectsLinearRing(s,e,t[0],i,n))return!1;if(t.length===1)return!0;for(let r=1,o=t.length;r<o;++r)if(linearRingContainsExtent(s,t[r-1],t[r],i,n)&&!intersectsLineString(s,t[r-1],t[r],i,n))return!1;return!0}function intersectsLinearRingMultiArray(s,e,t,i,n){for(let r=0,o=t.length;r<o;++r){const a=t[r];if(intersectsLinearRingArray(s,e,a,i,n))return!0;e=a[a.length-1]}return!1}function coordinates(s,e,t,i){for(;e<t-i;){for(let n=0;n<i;++n){const r=s[e+n];s[e+n]=s[t-i+n],s[t-i+n]=r}e+=i,t-=i}}function linearRingIsClockwise(s,e,t,i){let n=0,r=s[t-i],o=s[t-i+1];for(;e<t;e+=i){const a=s[e],l=s[e+1];n+=(a-r)*(l+o),r=a,o=l}return n===0?void 0:n>0}function linearRingsAreOriented(s,e,t,i,n){n=n!==void 0?n:!1;for(let r=0,o=t.length;r<o;++r){const a=t[r],l=linearRingIsClockwise(s,e,a,i);if(r===0){if(n&&l||!n&&!l)return!1}else if(n&&!l||!n&&l)return!1;e=a}return!0}function linearRingssAreOriented(s,e,t,i,n){for(let r=0,o=t.length;r<o;++r){const a=t[r];if(!linearRingsAreOriented(s,e,a,i,n))return!1;a.length&&(e=a[a.length-1])}return!0}function orientLinearRings(s,e,t,i,n){n=n!==void 0?n:!1;for(let r=0,o=t.length;r<o;++r){const a=t[r],l=linearRingIsClockwise(s,e,a,i);(r===0?n&&l||!n&&!l:n&&!l||!n&&l)&&coordinates(s,e,a,i),e=a}return e}function orientLinearRingsArray(s,e,t,i,n){for(let r=0,o=t.length;r<o;++r)e=orientLinearRings(s,e,t[r],i,n);return e}function inflateEnds(s,e){const t=[];let i=0,n=0,r;for(let o=0,a=e.length;o<a;++o){const l=e[o],c=linearRingIsClockwise(s,i,l,2);if(r===void 0&&(r=c),c===r)t.push(e.slice(n,o+1));else{if(t.length===0)continue;t[t.length-1].push(e[n])}n=o+1,i=l}return t}class Polygon extends SimpleGeometry{constructor(e,t,i){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,t!==void 0&&i?(this.setFlatCoordinates(t,e),this.ends_=i):this.setCoordinates(e,t)}appendLinearRing(e){this.flatCoordinates?extend$2(this.flatCoordinates,e.getFlatCoordinates()):this.flatCoordinates=e.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const e=new Polygon(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,i,n){return n<closestSquaredDistanceXY(this.getExtent(),e,t)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(arrayMaxSquaredDelta(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),assignClosestArrayPoint(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,i,n))}containsXY(e,t){return linearRingsContainsXY(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return linearRings(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),orientLinearRings(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,inflateCoordinatesArray(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const e=getCenter(this.getExtent());this.flatInteriorPoint_=getInteriorPointOfArray(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Point(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new LinearRing(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLinearRings(){const e=this.layout,t=this.flatCoordinates,i=this.ends_,n=[];let r=0;for(let o=0,a=i.length;o<a;++o){const l=i[o],c=new LinearRing(t.slice(r,l),e);n.push(c),r=l}return n}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const e=this.flatCoordinates;linearRingsAreOriented(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=orientLinearRings(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){const t=[],i=[];return t.length=quantizeArray(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),t,0,i),new Polygon(t,"XY",i)}getType(){return"Polygon"}intersectsExtent(e){return intersectsLinearRingArray(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=deflateCoordinatesArray(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}}function fromExtent(s){if(isEmpty(s))throw new Error("Cannot create polygon from empty extent");const e=s[0],t=s[1],i=s[2],n=s[3],r=[e,t,e,n,i,n,i,t,e,t];return new Polygon(r,"XY",[r.length])}function getViewportClampedResolution(s,e,t,i){const n=getWidth(e)/t[0],r=getHeight(e)/t[1];return i?Math.min(s,Math.max(n,r)):Math.min(s,Math.min(n,r))}function getSmoothClampedResolution(s,e,t){let i=Math.min(s,e);const n=50;return i*=Math.log(1+n*Math.max(0,s/e-1))/n+1,t&&(i=Math.max(i,t),i/=Math.log(1+n*Math.max(0,t/s-1))/n+1),clamp(i,t/2,e*2)}function createSnapToResolutions(s,e,t,i){return e=e!==void 0?e:!0,function(n,r,o,a){if(n!==void 0){const l=s[0],c=s[s.length-1],h=t?getViewportClampedResolution(l,t,o,i):l;if(a)return e?getSmoothClampedResolution(n,h,c):clamp(n,c,h);const u=Math.min(h,n),d=Math.floor(linearFindNearest(s,u,r));return s[d]>h&&d<s.length-1?s[d+1]:s[d]}}}function createSnapToPower(s,e,t,i,n,r){return i=i!==void 0?i:!0,t=t!==void 0?t:0,function(o,a,l,c){if(o!==void 0){const h=n?getViewportClampedResolution(e,n,l,r):e;if(c)return i?getSmoothClampedResolution(o,h,t):clamp(o,t,h);const u=1e-9,d=Math.ceil(Math.log(e/h)/Math.log(s)-u),g=-a*(.5-u)+.5,f=Math.min(h,o),m=Math.floor(Math.log(e/f)/Math.log(s)+g),p=Math.max(d,m),_=e/Math.pow(s,p);return clamp(_,t,h)}}}function createMinMaxResolution(s,e,t,i,n){return t=t!==void 0?t:!0,function(r,o,a,l){if(r!==void 0){const c=i?getViewportClampedResolution(s,i,a,n):s;return!t||!l?clamp(r,e,c):getSmoothClampedResolution(r,c,e)}}}function disable(s){if(s!==void 0)return 0}function none(s){if(s!==void 0)return s}function createSnapToN(s){const e=2*Math.PI/s;return function(t,i){if(i)return t;if(t!==void 0)return t=Math.floor(t/e+.5)*e,t}}function createSnapToZero(s){const e=toRadians(5);return function(t,i){return i||t===void 0?t:Math.abs(t)<=e?0:t}}const DEFAULT_MAX_ZOOM=42,DEFAULT_TILE_SIZE=256,DEFAULT_MIN_ZOOM=0;class View extends BaseObject{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=createProjection(e.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,e.projection&&disableCoordinateWarning(),e.center&&(e.center=fromUserCoordinate(e.center,this.projection_)),e.extent&&(e.extent=fromUserExtent(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){const t=Object.assign({},e);for(const a in ViewProperty)delete t[a];this.setProperties(t,!0);const i=createResolutionConstraint(e);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=e.resolutions,this.padding_=e.padding,this.minZoom_=i.minZoom;const n=createCenterConstraint(e),r=i.constraint,o=createRotationConstraint(e);this.constraints_={center:n,resolution:r,rotation:o},this.setRotation(e.rotation!==void 0?e.rotation:0),this.setCenterInternal(e.center!==void 0?e.center:null),e.resolution!==void 0?this.setResolution(e.resolution):e.zoom!==void 0&&this.setZoom(e.zoom)}get padding(){return this.padding_}set padding(e){let t=this.padding_;this.padding_=e;const i=this.getCenterInternal();if(i){const n=e||[0,0,0,0];t=t||[0,0,0,0];const r=this.getResolution(),o=r/2*(n[3]-t[3]+t[1]-n[1]),a=r/2*(n[0]-t[0]+t[2]-n[2]);this.setCenterInternal([i[0]+o,i[1]-a])}}getUpdatedOptions_(e){const t=this.getProperties();return t.resolution!==void 0?t.resolution=this.getResolution():t.zoom=this.getZoom(),t.center=this.getCenterInternal(),t.rotation=this.getRotation(),Object.assign({},t,e)}animate(e){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const t=new Array(arguments.length);for(let i=0;i<t.length;++i){let n=arguments[i];n.center&&(n=Object.assign({},n),n.center=fromUserCoordinate(n.center,this.getProjection())),n.anchor&&(n=Object.assign({},n),n.anchor=fromUserCoordinate(n.anchor,this.getProjection())),t[i]=n}this.animateInternal.apply(this,t)}animateInternal(e){let t=arguments.length,i;t>1&&typeof arguments[t-1]=="function"&&(i=arguments[t-1],--t);let n=0;for(;n<t&&!this.isDef();++n){const h=arguments[n];h.center&&this.setCenterInternal(h.center),h.zoom!==void 0?this.setZoom(h.zoom):h.resolution&&this.setResolution(h.resolution),h.rotation!==void 0&&this.setRotation(h.rotation)}if(n===t){i&&animationCallback(i,!0);return}let r=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_;const c=[];for(;n<t;++n){const h=arguments[n],u={start:r,complete:!1,anchor:h.anchor,duration:h.duration!==void 0?h.duration:1e3,easing:h.easing||inAndOut,callback:i};if(h.center&&(u.sourceCenter=o,u.targetCenter=h.center.slice(),o=u.targetCenter),h.zoom!==void 0?(u.sourceResolution=a,u.targetResolution=this.getResolutionForZoom(h.zoom),a=u.targetResolution):h.resolution&&(u.sourceResolution=a,u.targetResolution=h.resolution,a=u.targetResolution),h.rotation!==void 0){u.sourceRotation=l;const d=modulo(h.rotation-l+Math.PI,2*Math.PI)-Math.PI;u.targetRotation=l+d,l=u.targetRotation}isNoopAnimation(u)?u.complete=!0:r+=u.duration,c.push(u)}this.animations_.push(c),this.setHint(ViewHint.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[ViewHint.ANIMATING]>0}getInteracting(){return this.hints_[ViewHint.INTERACTING]>0}cancelAnimations(){this.setHint(ViewHint.ANIMATING,-this.hints_[ViewHint.ANIMATING]);let e;for(let t=0,i=this.animations_.length;t<i;++t){const n=this.animations_[t];if(n[0].callback&&animationCallback(n[0].callback,!1),!e)for(let r=0,o=n.length;r<o;++r){const a=n[r];if(!a.complete){e=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=e,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const e=Date.now();let t=!1;for(let i=this.animations_.length-1;i>=0;--i){const n=this.animations_[i];let r=!0;for(let o=0,a=n.length;o<a;++o){const l=n[o];if(l.complete)continue;const c=e-l.start;let h=l.duration>0?c/l.duration:1;h>=1?(l.complete=!0,h=1):r=!1;const u=l.easing(h);if(l.sourceCenter){const d=l.sourceCenter[0],g=l.sourceCenter[1],f=l.targetCenter[0],m=l.targetCenter[1];this.nextCenter_=l.targetCenter;const p=d+u*(f-d),_=g+u*(m-g);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 g=this.getViewportSize_(this.getRotation()),f=this.constraints_.resolution(d,0,g,!0);this.targetCenter_=this.calculateCenterZoom(f,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?modulo(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+u*(l.targetRotation-l.sourceRotation);if(l.anchor){const g=this.constraints_.rotation(d,!0);this.targetCenter_=this.calculateCenterRotate(g,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=d}if(this.applyTargetState_(!0),t=!0,!l.complete)break}if(r){this.animations_[i]=null,this.setHint(ViewHint.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const o=n[0].callback;o&&animationCallback(o,!0)}}this.animations_=this.animations_.filter(Boolean),t&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let i;const n=this.getCenterInternal();return n!==void 0&&(i=[n[0]-t[0],n[1]-t[1]],rotate$1(i,e-this.getRotation()),add$2(i,t)),i}calculateCenterZoom(e,t){let i;const n=this.getCenterInternal(),r=this.getResolution();if(n!==void 0&&r!==void 0){const o=t[0]-e*(t[0]-n[0])/r,a=t[1]-e*(t[1]-n[1])/r;i=[o,a]}return i}getViewportSize_(e){const t=this.viewportSize_;if(e){const i=t[0],n=t[1];return[Math.abs(i*Math.cos(e))+Math.abs(n*Math.sin(e)),Math.abs(i*Math.sin(e))+Math.abs(n*Math.cos(e))]}return t}setViewportSize(e){this.viewportSize_=Array.isArray(e)?e.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const e=this.getCenterInternal();return e&&toUserCoordinate(e,this.getProjection())}getCenterInternal(){return this.get(ViewProperty.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(e){return e!==void 0?(e[0]=this.hints_[0],e[1]=this.hints_[1],e):this.hints_.slice()}calculateExtent(e){const t=this.calculateExtentInternal(e);return toUserExtent(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();const t=this.getCenterInternal();assert(t,"The view center is not defined");const i=this.getResolution();assert(i!==void 0,"The view resolution is not defined");const n=this.getRotation();return assert(n!==void 0,"The view rotation is not defined"),getForViewAndSize(t,i,n,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get(ViewProperty.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(fromUserExtent(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();const i=getWidth(e)/t[0],n=getHeight(e)/t[1];return Math.max(i,n)}getResolutionForValueFunction(e){e=e||2;const t=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,n=Math.log(t/i)/Math.log(e);return function(r){return t/Math.pow(e,r*n)}}getRotation(){return this.get(ViewProperty.ROTATION)}getValueForResolutionFunction(e){const t=Math.log(e||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(i/n)/t;return function(o){return Math.log(i/o)/t/r}}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e);const i=this.padding_;return i&&(t=[t[0]-i[1]-i[3],t[1]-i[0]-i[2]]),t}getState(){const e=this.getProjection(),t=this.getResolution(),i=this.getRotation();let n=this.getCenterInternal();const r=this.padding_;if(r){const o=this.getViewportSizeMinusPadding_();n=calculateCenterOn(n,this.getViewportSize_(),[o[0]/2+r[3],o[1]/2+r[0]],t,i)}return{center:n.slice(0),projection:e!==void 0?e:null,resolution:t,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let e;const t=this.getResolution();return t!==void 0&&(e=this.getZoomForResolution(t)),e}getZoomForResolution(e){let t=this.minZoom_||0,i,n;if(this.resolutions_){const r=linearFindNearest(this.resolutions_,e,1);t=r,i=this.resolutions_[r],r==this.resolutions_.length-1?n=2:n=i/this.resolutions_[r+1]}else i=this.maxResolution_,n=this.zoomFactor_;return t+Math.log(i/e)/Math.log(n)}getResolutionForZoom(e){var t;if((t=this.resolutions_)!=null&&t.length){if(this.resolutions_.length===1)return this.resolutions_[0];const i=clamp(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[i]/this.resolutions_[i+1];return this.resolutions_[i]/Math.pow(n,clamp(e-i,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let i;if(assert(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(e)){assert(!isEmpty(e),"Cannot fit empty extent provided as `geometry`");const n=fromUserExtent(e,this.getProjection());i=fromExtent(n)}else if(e.getType()==="Circle"){const n=fromUserExtent(e.getExtent(),this.getProjection());i=fromExtent(n),i.rotate(this.getRotation(),getCenter(n))}else i=e;this.fitInternal(i,t)}rotatedExtentForGeometry(e){const t=this.getRotation(),i=Math.cos(t),n=Math.sin(-t),r=e.getFlatCoordinates(),o=e.getStride();let a=1/0,l=1/0,c=-1/0,h=-1/0;for(let u=0,d=r.length;u<d;u+=o){const g=r[u]*i-r[u+1]*n,f=r[u]*n+r[u+1]*i;a=Math.min(a,g),l=Math.min(l,f),c=Math.max(c,g),h=Math.max(h,f)}return[a,l,c,h]}fitInternal(e,t){t=t||{};let i=t.size;i||(i=this.getViewportSizeMinusPadding_());const n=t.padding!==void 0?t.padding:[0,0,0,0],r=t.nearest!==void 0?t.nearest:!1;let o;t.minResolution!==void 0?o=t.minResolution:t.maxZoom!==void 0?o=this.getResolutionForZoom(t.maxZoom):o=0;const a=this.rotatedExtentForGeometry(e);let l=this.getResolutionForExtentInternal(a,[i[0]-n[1]-n[3],i[1]-n[0]-n[2]]);l=isNaN(l)?o:Math.max(l,o),l=this.getConstrainedResolution(l,r?0:1);const c=this.getRotation(),h=Math.sin(c),u=Math.cos(c),d=getCenter(a);d[0]+=(n[1]-n[3])/2*l,d[1]+=(n[0]-n[2])/2*l;const g=d[0]*u-d[1]*h,f=d[1]*u+d[0]*h,m=this.getConstrainedCenter([g,f],l),p=t.callback?t.callback:VOID;t.duration!==void 0?this.animateInternal({resolution:l,center:m,duration:t.duration,easing:t.easing},p):(this.targetResolution_=l,this.targetCenter_=m,this.applyTargetState_(!1,!0),animationCallback(p,!0))}centerOn(e,t,i){this.centerOnInternal(fromUserCoordinate(e,this.getProjection()),t,i)}centerOnInternal(e,t,i){this.setCenterInternal(calculateCenterOn(e,t,i,this.getResolution(),this.getRotation()))}calculateCenterShift(e,t,i,n){let r;const o=this.padding_;if(o&&e){const a=this.getViewportSizeMinusPadding_(-i),l=calculateCenterOn(e,n,[a[0]/2+o[3],a[1]/2+o[0]],t,i);r=[e[0]-l[0],e[1]-l[1]]}return r}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(e){const t=toUserCoordinate(this.targetCenter_,this.getProjection());this.setCenter([t[0]+e[0],t[1]+e[1]])}adjustCenterInternal(e){const t=this.targetCenter_;this.setCenterInternal([t[0]+e[0],t[1]+e[1]])}adjustResolution(e,t){t=t&&fromUserCoordinate(t,this.getProjection()),this.adjustResolutionInternal(e,t)}adjustResolutionInternal(e,t){const i=this.getAnimating()||this.getInteracting(),n=this.getViewportSize_(this.getRotation()),r=this.constraints_.resolution(this.targetResolution_*e,0,n,i);t&&(this.targetCenter_=this.calculateCenterZoom(r,t)),this.targetResolution_*=e,this.applyTargetState_()}adjustZoom(e,t){this.adjustResolution(Math.pow(this.zoomFactor_,-e),t)}adjustRotation(e,t){t&&(t=fromUserCoordinate(t,this.getProjection())),this.adjustRotationInternal(e,t)}adjustRotationInternal(e,t){const i=this.getAnimating()||this.getInteracting(),n=this.constraints_.rotation(this.targetRotation_+e,i);t&&(this.targetCenter_=this.calculateCenterRotate(n,t)),this.targetRotation_+=e,this.applyTargetState_()}setCenter(e){this.setCenterInternal(e&&fromUserCoordinate(e,this.getProjection()))}setCenterInternal(e){this.targetCenter_=e,this.applyTargetState_()}setHint(e,t){return this.hints_[e]+=t,this.changed(),this.hints_[e]}setResolution(e){this.targetResolution_=e,this.applyTargetState_()}setRotation(e){this.targetRotation_=e,this.applyTargetState_()}setZoom(e){this.setResolution(this.getResolutionForZoom(e))}applyTargetState_(e,t){const i=this.getAnimating()||this.getInteracting()||t,n=this.constraints_.rotation(this.targetRotation_,i),r=this.getViewportSize_(n),o=this.constraints_.resolution(this.targetResolution_,0,r,i),a=this.constraints_.center(this.targetCenter_,o,r,i,this.calculateCenterShift(this.targetCenter_,o,n,r));this.get(ViewProperty.ROTATION)!==n&&this.set(ViewProperty.ROTATION,n),this.get(ViewProperty.RESOLUTION)!==o&&(this.set(ViewProperty.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(ViewProperty.CENTER)||!equals(this.get(ViewProperty.CENTER),a))&&this.set(ViewProperty.CENTER,a),this.getAnimating()&&!e&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(e,t,i){e=e!==void 0?e:200;const n=t||0,r=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(r),a=this.constraints_.resolution(this.targetResolution_,n,o),l=this.constraints_.center(this.targetCenter_,a,o,!1,this.calculateCenterShift(this.targetCenter_,a,r,o));if(e===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=r,this.targetCenter_=l,this.applyTargetState_();return}i=i||(e===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==r||!this.getCenterInternal()||!equals(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:r,center:l,resolution:a,duration:e,easing:easeOut,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(ViewHint.INTERACTING,1)}endInteraction(e,t,i){i=i&&fromUserCoordinate(i,this.getProjection()),this.endInteractionInternal(e,t,i)}endInteractionInternal(e,t,i){this.getInteracting()&&(this.setHint(ViewHint.INTERACTING,-1),this.resolveConstraints(e,t,i))}getConstrainedCenter(e,t){const i=this.getViewportSize_(this.getRotation());return this.constraints_.center(e,t||this.getResolution(),i)}getConstrainedZoom(e,t){const i=this.getResolutionForZoom(e);return this.getZoomForResolution(this.getConstrainedResolution(i,t))}getConstrainedResolution(e,t){t=t||0;const i=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(e,t,i)}}function animationCallback(s,e){setTimeout(function(){s(e)},0)}function createCenterConstraint(s){if(s.extent!==void 0){const t=s.smoothExtentConstraint!==void 0?s.smoothExtentConstraint:!0;return createExtent(s.extent,s.constrainOnlyCenter,t)}const e=createProjection(s.projection,"EPSG:3857");if(s.multiWorld!==!0&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,createExtent(t,!1,!1)}return none$1}function createResolutionConstraint(s){let e,t,i,o=s.minZoom!==void 0?s.minZoom:DEFAULT_MIN_ZOOM,a=s.maxZoom!==void 0?s.maxZoom:28;const l=s.zoomFactor!==void 0?s.zoomFactor:2,c=s.multiWorld!==void 0?s.multiWorld:!1,h=s.smoothResolutionConstraint!==void 0?s.smoothResolutionConstraint:!0,u=s.showFullExtent!==void 0?s.showFullExtent:!1,d=createProjection(s.projection,"EPSG:3857"),g=d.getExtent();let f=s.constrainOnlyCenter,m=s.extent;if(!c&&!m&&d.isGlobal()&&(f=!1,m=g),s.resolutions!==void 0){const p=s.resolutions;t=p[o],i=p[a]!==void 0?p[a]:p[p.length-1],s.constrainResolution?e=createSnapToResolutions(p,h,!f&&m,u):e=createMinMaxResolution(t,i,h,!f&&m,u)}else{const _=(g?Math.max(getWidth(g),getHeight(g)):360*METERS_PER_UNIT$1.degrees/d.getMetersPerUnit())/DEFAULT_TILE_SIZE/Math.pow(2,DEFAULT_MIN_ZOOM),y=_/Math.pow(2,28-DEFAULT_MIN_ZOOM);t=s.maxResolution,t!==void 0?o=0:t=_/Math.pow(l,o),i=s.minResolution,i===void 0&&(s.maxZoom!==void 0?s.maxResolution!==void 0?i=t/Math.pow(l,a):i=_/Math.pow(l,a):i=y),a=o+Math.floor(Math.log(t/i)/Math.log(l)),i=t/Math.pow(l,a-o),s.constrainResolution?e=createSnapToPower(l,t,i,h,!f&&m,u):e=createMinMaxResolution(t,i,h,!f&&m,u)}return{constraint:e,maxResolution:t,minResolution:i,minZoom:o,zoomFactor:l}}function createRotationConstraint(s){if(s.enableRotation!==void 0?s.enableRotation:!0){const t=s.constrainRotation;return t===void 0||t===!0?createSnapToZero():t===!1?none:typeof t=="number"?createSnapToN(t):none}return disable}function isNoopAnimation(s){return!(s.sourceCenter&&s.targetCenter&&!equals(s.sourceCenter,s.targetCenter)||s.sourceResolution!==s.targetResolution||s.sourceRotation!==s.targetRotation)}function calculateCenterOn(s,e,t,i,n){const r=Math.cos(-n);let o=Math.sin(-n),a=s[0]*r-s[1]*o,l=s[1]*r+s[0]*o;a+=(e[0]/2-t[0])*i,l+=(t[1]-e[1]/2)*i,o=-o;const c=a*r-l*o,h=l*r+a*o;return[c,h]}const CLASS_HIDDEN="ol-hidden",CLASS_SELECTABLE="ol-selectable",CLASS_UNSELECTABLE="ol-unselectable",CLASS_CONTROL="ol-control",CLASS_COLLAPSED="ol-collapsed",fontRegEx=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z0-9]+?)\\s*$`].join(""),"i"),fontRegExMatchIndex=["style","variant","weight","size","lineHeight","family"],fontWeights={normal:400,bold:700},getFontParameters=function(s){const e=s.match(fontRegEx);if(!e)return null;const t={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let i=0,n=fontRegExMatchIndex.length;i<n;++i){const r=e[i+1];r!==void 0&&(t[fontRegExMatchIndex[i]]=typeof r=="string"?r.trim():r)}return isNaN(Number(t.weight))&&t.weight in fontWeights&&(t.weight=fontWeights[t.weight]),t.families=t.family.split(/,\s?/).map(i=>i.trim().replace(/^['"]|['"]$/g,"")),t};function createCanvasContext2D(s,e,t,i){let n;return t&&t.length?n=t.shift():WORKER_OFFSCREEN_CANVAS?n=new OffscreenCanvas(s||300,e||300):n=document.createElement("canvas"),s&&(n.width=s),e&&(n.height=e),n.getContext("2d",i)}let sharedCanvasContext;function getSharedCanvasContext2D(){return sharedCanvasContext||(sharedCanvasContext=createCanvasContext2D(1,1)),sharedCanvasContext}function releaseCanvas(s){const e=s.canvas;e.width=1,e.height=1,s.clearRect(0,0,1,1)}function outerWidth(s){let e=s.offsetWidth;const t=getComputedStyle(s);return e+=parseInt(t.marginLeft,10)+parseInt(t.marginRight,10),e}function outerHeight(s){let e=s.offsetHeight;const t=getComputedStyle(s);return e+=parseInt(t.marginTop,10)+parseInt(t.marginBottom,10),e}function replaceNode(s,e){const t=e.parentNode;t&&t.replaceChild(s,e)}function removeChildren(s){for(;s.lastChild;)s.lastChild.remove()}function replaceChildren(s,e){const t=s.childNodes;for(let i=0;;++i){const n=t[i],r=e[i];if(!n&&!r)break;if(n!==r){if(!n){s.appendChild(r);continue}if(!r){s.removeChild(n),--i;continue}s.insertBefore(r,n)}}}class Control extends BaseObject{constructor(e){super();const t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents="auto"),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){var e;(e=this.element)==null||e.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(e){var t;this.map_&&((t=this.element)==null||t.remove());for(let i=0,n=this.listenerKeys.length;i<n;++i)unlistenByKey(this.listenerKeys[i]);if(this.listenerKeys.length=0,this.map_=e,e){const i=this.target_??e.getOverlayContainerStopEvent();this.element&&i.appendChild(this.element),this.render!==VOID&&this.listenerKeys.push(listen(e,MapEventType.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}}class Attribution extends Control{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=e.collapsed!==void 0?e.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=e.collapsible!==void 0,this.collapsible_=e.collapsible!==void 0?e.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=e.attributions;const t=e.className!==void 0?e.className:"ol-attribution",i=e.tipLabel!==void 0?e.tipLabel:"Attributions",n=e.expandClassName!==void 0?e.expandClassName:t+"-expand",r=e.collapseLabel!==void 0?e.collapseLabel:"›",o=e.collapseClassName!==void 0?e.collapseClassName:t+"-collapse";typeof r=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=r,this.collapseLabel_.className=o):this.collapseLabel_=r;const a=e.label!==void 0?e.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=n):this.label_=a;const l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=i,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(EventType.CLICK,this.handleClick_.bind(this),!1);const c=t+" "+CLASS_UNSELECTABLE+" "+CLASS_CONTROL+(this.collapsed_&&this.collapsible_?" "+CLASS_COLLAPSED:"")+(this.collapsible_?"":" ol-uncollapsible"),h=this.element;h.className=c,h.appendChild(this.toggleButton_),h.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(e){const t=this.getMap().getAllLayers(),i=new Set(t.flatMap(n=>n.getAttributions(e)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(n=>i.add(n)):i.add(this.attributions_)),!this.overrideCollapsible_){const n=!t.some(r=>{var o;return((o=r.getSource())==null?void 0:o.getAttributionsCollapsible())===!1});this.setCollapsible(n)}return Array.from(i)}async updateElement_(e){if(!e){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const t=await Promise.all(this.collectSourceAttributions_(e).map(n=>toPromise(()=>n))),i=t.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!equals$2(t,this.renderedAttributions_)){removeChildren(this.ulElement_);for(let n=0,r=t.length;n<r;++n){const o=document.createElement("li");o.innerHTML=t[n],this.ulElement_.appendChild(o)}this.renderedAttributions_=t}}handleClick_(e){e.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(CLASS_COLLAPSED),this.collapsed_?replaceNode(this.collapseLabel_,this.label_):replaceNode(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(e){this.collapsible_!==e&&(this.collapsible_=e,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(e){this.userCollapsed_=e,!(!this.collapsible_||this.collapsed_===e)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(e){this.updateElement_(e.frameState)}}class Rotate extends Control{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target});const t=e.className!==void 0?e.className:"ol-rotate",i=e.label!==void 0?e.label:"⇧",n=e.compassClassName!==void 0?e.compassClassName:"ol-compass";this.label_=null,typeof i=="string"?(this.label_=document.createElement("span"),this.label_.className=n,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(n));const r=e.tipLabel?e.tipLabel:"Reset rotation",o=document.createElement("button");o.className=t+"-reset",o.setAttribute("type","button"),o.title=r,o.appendChild(this.label_),o.addEventListener(EventType.CLICK,this.handleClick_.bind(this),!1);const a=t+" "+CLASS_UNSELECTABLE+" "+CLASS_CONTROL,l=this.element;l.className=a,l.appendChild(o),this.callResetNorth_=e.resetNorth?e.resetNorth:void 0,this.duration_=e.duration!==void 0?e.duration:250,this.autoHide_=e.autoHide!==void 0?e.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(CLASS_HIDDEN)}handleClick_(e){e.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const t=this.getMap().getView();if(!t)return;const i=t.getRotation();i!==void 0&&(this.duration_>0&&i%(2*Math.PI)!==0?t.animate({rotation:0,duration:this.duration_,easing:easeOut}):t.setRotation(0))}render(e){const t=e.frameState;if(!t)return;const i=t.viewState.rotation;if(i!=this.rotation_){const n="rotate("+i+"rad)";if(this.autoHide_){const r=this.element.classList.contains(CLASS_HIDDEN);!r&&i===0?this.element.classList.add(CLASS_HIDDEN):r&&i!==0&&this.element.classList.remove(CLASS_HIDDEN)}this.label_.style.transform=n}this.rotation_=i}}class Zoom extends Control{constructor(e){e=e||{},super({element:document.createElement("div"),target:e.target});const t=e.className!==void 0?e.className:"ol-zoom",i=e.delta!==void 0?e.delta:1,n=e.zoomInClassName!==void 0?e.zoomInClassName:t+"-in",r=e.zoomOutClassName!==void 0?e.zoomOutClassName:t+"-out",o=e.zoomInLabel!==void 0?e.zoomInLabel:"+",a=e.zoomOutLabel!==void 0?e.zoomOutLabel:"–",l=e.zoomInTipLabel!==void 0?e.zoomInTipLabel:"Zoom in",c=e.zoomOutTipLabel!==void 0?e.zoomOutTipLabel:"Zoom out",h=document.createElement("button");h.className=n,h.setAttribute("type","button"),h.title=l,h.appendChild(typeof o=="string"?document.createTextNode(o):o),h.addEventListener(EventType.CLICK,this.handleClick_.bind(this,i),!1);const u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=c,u.appendChild(typeof a=="string"?document.createTextNode(a):a),u.addEventListener(EventType.CLICK,this.handleClick_.bind(this,-i),!1);const d=t+" "+CLASS_UNSELECTABLE+" "+CLASS_CONTROL,g=this.element;g.className=d,g.appendChild(h),g.appendChild(u),this.duration_=e.duration!==void 0?e.duration:250}handleClick_(e,t){t.preventDefault(),this.zoomByDelta_(e)}zoomByDelta_(e){const i=this.getMap().getView();if(!i)return;const n=i.getZoom();if(n!==void 0){const r=i.getConstrainedZoom(n+e);this.duration_>0?(i.getAnimating()&&i.cancelAnimations(),i.animate({zoom:r,duration:this.duration_,easing:easeOut})):i.setZoom(r)}}}function defaults$1(s){s=s||{};const e=new Collection;return(s.zoom!==void 0?s.zoom:!0)&&e.push(new Zoom(s.zoomOptions)),(s.rotate!==void 0?s.rotate:!0)&&e.push(new Rotate(s.rotateOptions)),(s.attribution!==void 0?s.attribution:!0)&&e.push(new Attribution(s.attributionOptions)),e}class Kinetic{constructor(e,t,i){this.decay_=e,this.minVelocity_=t,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(e,t){this.points_.push(e,t,Date.now())}end(){if(this.points_.length<6)return!1;const e=Date.now()-this.delay_,t=this.points_.length-3;if(this.points_[t+2]<e)return!1;let i=t-3;for(;i>0&&this.points_[i+2]>e;)i-=3;const n=this.points_[t+2]-this.points_[i+2];if(n<1e3/60)return!1;const r=this.points_[t]-this.points_[i],o=this.points_[t+1]-this.points_[i+1];return this.angle_=Math.atan2(o,r),this.initialVelocity_=Math.sqrt(r*r+o*o)/n,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}const InteractionProperty={ACTIVE:"active"};class Interaction extends BaseObject{constructor(e){super(),this.on,this.once,this.un,e&&e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(InteractionProperty.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(InteractionProperty.ACTIVE,e)}setMap(e){this.map_=e}}function pan(s,e,t){const i=s.getCenterInternal();if(i){const n=[i[0]+e[0],i[1]+e[1]];s.animateInternal({duration:t!==void 0?t:250,easing:linear,center:s.getConstrainedCenter(n)})}}function zoomByDelta(s,e,t,i){const n=s.getZoom();if(n===void 0)return;const r=s.getConstrainedZoom(n+e),o=s.getResolutionForZoom(r);s.getAnimating()&&s.cancelAnimations(),s.animate({resolution:o,anchor:t,duration:i!==void 0?i:250,easing:easeOut})}class DoubleClickZoom extends Interaction{constructor(e){super(),e=e||{},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:250}handleEvent(e){let t=!1;if(e.type==MapBrowserEventType.DBLCLICK){const i=e.originalEvent,n=e.map,r=e.coordinate,o=i.shiftKey?-this.delta_:this.delta_,a=n.getView();zoomByDelta(a,o,r,this.duration_),i.preventDefault(),t=!0}return!t}}function all$1(s){const e=arguments;return function(t){let i=!0;for(let n=0,r=e.length;n<r&&(i=i&&e[n](t),!!i);++n);return i}}const altShiftKeysOnly=function(s){const e=s.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},focus=function(s){const e=s.map.getTargetElement(),t=e.getRootNode(),i=s.map.getOwnerDocument().activeElement;return t instanceof ShadowRoot?t.host.contains(i):e.contains(i)},focusWithTabindex=function(s){const e=s.map.getTargetElement(),t=e.getRootNode();return(t instanceof ShadowRoot?t.host:e).hasAttribute("tabindex")?focus(s):!0},always$1=TRUE,mouseActionButton=function(s){const e=s.originalEvent;return"pointerId"in e&&e.button==0&&!(WEBKIT&&MAC&&e.ctrlKey)},noModifierKeys=function(s){const e=s.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},platformModifierKey=function(s){const e=s.originalEvent;return MAC?e.metaKey:e.ctrlKey},shiftKeyOnly=function(s){const e=s.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},targetNotEditable=function(s){const e=s.originalEvent,t=e.target.tagName;return t!=="INPUT"&&t!=="SELECT"&&t!=="TEXTAREA"&&!e.target.isContentEditable},mouseOnly=function(s){const e=s.originalEvent;return"pointerId"in e&&e.pointerType=="mouse"},primaryAction=function(s){const e=s.originalEvent;return"pointerId"in e&&e.isPrimary&&e.button===0};class PointerInteraction extends Interaction{constructor(e){e=e||{},super(e),e.handleDownEvent&&(this.handleDownEvent=e.handleDownEvent),e.handleDragEvent&&(this.handleDragEvent=e.handleDragEvent),e.handleMoveEvent&&(this.handleMoveEvent=e.handleMoveEvent),e.handleUpEvent&&(this.handleUpEvent=e.handleUpEvent),e.stopDown&&(this.stopDown=e.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(e){return!1}handleDragEvent(e){}handleEvent(e){if(!e.originalEvent)return!0;let t=!1;if(this.updateTrackedPointers_(e),this.handlingDownUpSequence){if(e.type==MapBrowserEventType.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==MapBrowserEventType.POINTERUP){const i=this.handleUpEvent(e);this.handlingDownUpSequence=i&&this.targetPointers.length>0}}else if(e.type==MapBrowserEventType.POINTERDOWN){const i=this.handleDownEvent(e);this.handlingDownUpSequence=i,t=this.stopDown(i)}else e.type==MapBrowserEventType.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}}function centroid(s){const e=s.length;let t=0,i=0;for(let n=0;n<e;n++)t+=s[n].clientX,i+=s[n].clientY;return{clientX:t/e,clientY:i/e}}class DragPan extends PointerInteraction{constructor(e){super({stopDown:FALSE}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const t=e.condition?e.condition:all$1(noModifierKeys,primaryAction);this.condition_=e.onFocusOnly?all$1(focusWithTabindex,t):t,this.noKinetic_=!1}handleDragEvent(e){const t=e.map;this.panning_||(this.panning_=!0,t.getView().beginInteraction());const i=this.targetPointers,n=t.getEventPixel(centroid(i));if(i.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(n[0],n[1]),this.lastCentroid){const r=[this.lastCentroid[0]-n[0],n[1]-this.lastCentroid[1]],a=e.map.getView();scale$2(r,a.getResolution()),rotate$1(r,a.getRotation()),a.adjustCenterInternal(r)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=n,this.lastPointersCount_=i.length,e.originalEvent.preventDefault()}handleUpEvent(e){const t=e.map,i=t.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const n=this.kinetic_.getDistance(),r=this.kinetic_.getAngle(),o=i.getCenterInternal(),a=t.getPixelFromCoordinateInternal(o),l=t.getCoordinateFromPixelInternal([a[0]-n*Math.cos(r),a[1]-n*Math.sin(r)]);i.animateInternal({center:i.getConstrainedCenter(l),duration:500,easing:easeOut})}return this.panning_&&(this.panning_=!1,i.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(e){if(this.targetPointers.length>0&&this.condition_(e)){const i=e.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 DragRotate extends PointerInteraction{constructor(e){e=e||{},super({stopDown:FALSE}),this.condition_=e.condition?e.condition:altShiftKeysOnly,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!mouseOnly(e))return;const t=e.map,i=t.getView();if(i.getConstraints().rotation===disable)return;const n=t.getSize(),r=e.pixel,o=Math.atan2(n[1]/2-r[1],r[0]-n[0]/2);if(this.lastAngle_!==void 0){const a=o-this.lastAngle_;i.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(e){return mouseOnly(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return mouseOnly(e)&&mouseActionButton(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}class RenderBox extends Disposable{constructor(e){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+e,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const e=this.startPixel_,t=this.endPixel_,i="px",n=this.element_.style;n.left=Math.min(e[0],t[0])+i,n.top=Math.min(e[1],t[1])+i,n.width=Math.abs(t[0]-e[0])+i,n.height=Math.abs(t[1]-e[1])+i}setMap(e){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=e,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(e,t){this.startPixel_=e,this.endPixel_=t,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;const e=this.startPixel_,t=this.endPixel_,n=[e,[e[0],t[1]],t,[t[0],e[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);n[4]=n[0].slice(),this.geometry_?this.geometry_.setCoordinates([n]):this.geometry_=new Polygon([n])}getGeometry(){return this.geometry_}}const DragBoxEventType={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class DragBoxEvent extends BaseEvent{constructor(e,t,i){super(e),this.coordinate=t,this.mapBrowserEvent=i}}class DragBox extends PointerInteraction{constructor(e){super(),this.on,this.once,this.un,e=e??{},this.box_=new RenderBox(e.className||"ol-dragbox"),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??mouseActionButton,this.boxEndCondition_=e.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(e,t,i){const n=i[0]-t[0],r=i[1]-t[1];return n*n+r*r>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(e){this.startPixel_&&(this.box_.setPixels(this.startPixel_,e.pixel),this.dispatchEvent(new DragBoxEvent(DragBoxEventType.BOXDRAG,e.coordinate,e)))}handleUpEvent(e){if(!this.startPixel_)return!1;const t=this.boxEndCondition_(e,this.startPixel_,e.pixel);return t&&this.onBoxEnd(e),this.dispatchEvent(new DragBoxEvent(t?DragBoxEventType.BOXEND:DragBoxEventType.BOXCANCEL,e.coordinate,e)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(e){return this.condition_(e)?(this.startPixel_=e.pixel,this.box_.setMap(e.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new DragBoxEvent(DragBoxEventType.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new DragBoxEvent(DragBoxEventType.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new DragBoxEvent(DragBoxEventType.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(e)}}class DragZoom extends DragBox{constructor(e){e=e||{};const t=e.condition?e.condition:shiftKeyOnly;super({condition:t,className:e.className||"ol-dragzoom",minArea:e.minArea}),this.duration_=e.duration!==void 0?e.duration:200,this.out_=e.out!==void 0?e.out:!1}onBoxEnd(e){const i=this.getMap().getView();let n=this.getGeometry();if(this.out_){const r=i.rotatedExtentForGeometry(n),o=i.getResolutionForExtentInternal(r),a=i.getResolution()/o;n=n.clone(),n.scale(a*a)}i.fitInternal(n,{duration:this.duration_,easing:easeOut})}}const Key={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};class KeyboardPan extends Interaction{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return noModifierKeys(t)&&targetNotEditable(t)},this.condition_=e.condition!==void 0?e.condition:this.defaultCondition_,this.duration_=e.duration!==void 0?e.duration:100,this.pixelDelta_=e.pixelDelta!==void 0?e.pixelDelta:128}handleEvent(e){let t=!1;if(e.type==EventType.KEYDOWN){const i=e.originalEvent,n=i.key;if(this.condition_(e)&&(n==Key.DOWN||n==Key.LEFT||n==Key.RIGHT||n==Key.UP)){const o=e.map.getView(),a=o.getResolution()*this.pixelDelta_;let l=0,c=0;n==Key.DOWN?c=-a:n==Key.LEFT?l=-a:n==Key.RIGHT?l=a:c=a;const h=[l,c];rotate$1(h,o.getRotation()),pan(o,h,this.duration_),i.preventDefault(),t=!0}}return!t}}class KeyboardZoom extends Interaction{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(t){return!platformModifierKey(t)&&targetNotEditable(t)},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:100}handleEvent(e){let t=!1;if(e.type==EventType.KEYDOWN||e.type==EventType.KEYPRESS){const i=e.originalEvent,n=i.key;if(this.condition_(e)&&(n==="+"||n==="-")){const r=e.map,o=n==="+"?this.delta_:-this.delta_,a=r.getView();zoomByDelta(a,o,void 0,this.duration_),i.preventDefault(),t=!0}}return!t}}const DELTA_LINE_MULTIPLIER=40,DELTA_PAGE_MULTIPLIER=300;class MouseWheelZoom extends Interaction{constructor(e){e=e||{},super(e),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=e.maxDelta!==void 0?e.maxDelta:1,this.duration_=e.duration!==void 0?e.duration:250,this.timeout_=e.timeout!==void 0?e.timeout:80,this.useAnchor_=e.useAnchor!==void 0?e.useAnchor:!0,this.constrainResolution_=e.constrainResolution!==void 0?e.constrainResolution:!1;const t=e.condition?e.condition:always$1;this.condition_=e.onFocusOnly?all$1(focusWithTabindex,t):t,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const e=this.getMap();if(!e)return;e.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(e){if(!this.condition_(e)||e.type!==EventType.WHEEL)return!0;const i=e.map,n=e.originalEvent;n.preventDefault(),this.useAnchor_&&(this.lastAnchor_=e.pixel);let r=n.deltaY;switch(n.deltaMode){case WheelEvent.DOM_DELTA_LINE:r*=DELTA_LINE_MULTIPLIER;break;case WheelEvent.DOM_DELTA_PAGE:r*=DELTA_PAGE_MULTIPLIER;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_(e){const t=e.getView();t.getAnimating()&&t.cancelAnimations();let i=-clamp(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),zoomByDelta(t,i,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(e){this.useAnchor_=e,e||(this.lastAnchor_=null)}}class PinchRotate extends PointerInteraction{constructor(e){e=e||{};const t=e;t.stopDown||(t.stopDown=FALSE),super(t),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=e.threshold!==void 0?e.threshold:.3,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){let t=0;const i=this.targetPointers[0],n=this.targetPointers[1],r=Math.atan2(n.clientY-i.clientY,n.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),t=l}this.lastAngle_=r;const o=e.map,a=o.getView();a.getConstraints().rotation!==disable&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(centroid(this.targetPointers))),this.rotating_&&(o.render(),a.adjustRotationInternal(t,this.anchor_)))}handleUpEvent(e){return this.targetPointers.length<2?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){if(this.targetPointers.length>=2){const t=e.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}}class PinchZoom extends PointerInteraction{constructor(e){e=e||{};const t=e;t.stopDown||(t.stopDown=FALSE),super(t),this.anchor_=null,this.duration_=e.duration!==void 0?e.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(e){let t=1;const i=this.targetPointers[0],n=this.targetPointers[1],r=i.clientX-n.clientX,o=i.clientY-n.clientY,a=Math.sqrt(r*r+o*o);this.lastDistance_!==void 0&&(t=this.lastDistance_/a),this.lastDistance_=a;const l=e.map,c=l.getView();t!=1&&(this.lastScaleDelta_=t),this.anchor_=l.getCoordinateFromPixelInternal(l.getEventPixel(centroid(this.targetPointers))),l.render(),c.adjustResolutionInternal(t,this.anchor_)}handleUpEvent(e){if(this.targetPointers.length<2){const i=e.map.getView(),n=this.lastScaleDelta_>1?1:-1;return i.endInteraction(this.duration_,n),!1}return!0}handleDownEvent(e){if(this.targetPointers.length>=2){const t=e.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}}function defaults(s){s=s||{};const e=new Collection,t=new Kinetic(-.005,.05,100);return(s.altShiftDragRotate!==void 0?s.altShiftDragRotate:!0)&&e.push(new DragRotate),(s.doubleClickZoom!==void 0?s.doubleClickZoom:!0)&&e.push(new DoubleClickZoom({delta:s.zoomDelta,duration:s.zoomDuration})),(s.dragPan!==void 0?s.dragPan:!0)&&e.push(new DragPan({onFocusOnly:s.onFocusOnly,kinetic:t})),(s.pinchRotate!==void 0?s.pinchRotate:!0)&&e.push(new PinchRotate),(s.pinchZoom!==void 0?s.pinchZoom:!0)&&e.push(new PinchZoom({duration:s.zoomDuration})),(s.keyboard!==void 0?s.keyboard:!0)&&(e.push(new KeyboardPan),e.push(new KeyboardZoom({delta:s.zoomDelta,duration:s.zoomDuration}))),(s.mouseWheelZoom!==void 0?s.mouseWheelZoom:!0)&&e.push(new MouseWheelZoom({onFocusOnly:s.onFocusOnly,duration:s.zoomDuration})),(s.shiftDragZoom!==void 0?s.shiftDragZoom:!0)&&e.push(new DragZoom({duration:s.zoomDuration})),e}const LayerProperty={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 BaseLayer extends BaseObject{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;const t=Object.assign({},e);typeof e.properties=="object"&&(delete t.properties,Object.assign(t,e.properties)),t[LayerProperty.OPACITY]=e.opacity!==void 0?e.opacity:1,assert(typeof t[LayerProperty.OPACITY]=="number","Layer opacity must be a number"),t[LayerProperty.VISIBLE]=e.visible!==void 0?e.visible:!0,t[LayerProperty.Z_INDEX]=e.zIndex,t[LayerProperty.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[LayerProperty.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[LayerProperty.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[LayerProperty.MAX_ZOOM]=e.maxZoom!==void 0?e.maxZoom:1/0,this.className_=t.className!==void 0?t.className:"ol-layer",delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){const t=this.state_||{layer:this,managed:e===void 0?!0:e},i=this.getZIndex();return t.opacity=clamp(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=i===void 0&&!t.managed?1/0:i,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return abstract()}getLayerStatesArray(e){return abstract()}getExtent(){return this.get(LayerProperty.EXTENT)}getMaxResolution(){return this.get(LayerProperty.MAX_RESOLUTION)}getMinResolution(){return this.get(LayerProperty.MIN_RESOLUTION)}getMinZoom(){return this.get(LayerProperty.MIN_ZOOM)}getMaxZoom(){return this.get(LayerProperty.MAX_ZOOM)}getOpacity(){return this.get(LayerProperty.OPACITY)}getSourceState(){return abstract()}getVisible(){return this.get(LayerProperty.VISIBLE)}getZIndex(){return this.get(LayerProperty.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(LayerProperty.EXTENT,e)}setMaxResolution(e){this.set(LayerProperty.MAX_RESOLUTION,e)}setMinResolution(e){this.set(LayerProperty.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(LayerProperty.MAX_ZOOM,e)}setMinZoom(e){this.set(LayerProperty.MIN_ZOOM,e)}setOpacity(e){assert(typeof e=="number","Layer opacity must be a number"),this.set(LayerProperty.OPACITY,e)}setVisible(e){this.set(LayerProperty.VISIBLE,e)}setZIndex(e){this.set(LayerProperty.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}class GroupEvent extends BaseEvent{constructor(e,t){super(e),this.layer=t}}const Property$2={LAYERS:"layers"};class LayerGroup extends BaseLayer{constructor(e){e=e||{};const t=Object.assign({},e);delete t.layers;let i=e.layers;super(t),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(Property$2.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new Collection(i.slice(),{unique:!0}):assert(typeof i.getArray=="function","Expected `layers` to be an array or a `Collection`"):i=new Collection(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(unlistenByKey),this.layersListenerKeys_.length=0;const e=this.getLayers();this.layersListenerKeys_.push(listen(e,CollectionEventType.ADD,this.handleLayersAdd_,this),listen(e,CollectionEventType.REMOVE,this.handleLayersRemove_,this));for(const i in this.listenerKeys_)this.listenerKeys_[i].forEach(unlistenByKey);clear(this.listenerKeys_);const t=e.getArray();for(let i=0,n=t.length;i<n;i++){const r=t[i];this.registerLayerListeners_(r),this.dispatchEvent(new GroupEvent("addlayer",r))}this.changed()}registerLayerListeners_(e){const t=[listen(e,ObjectEventType.PROPERTYCHANGE,this.handleLayerChange_,this),listen(e,EventType.CHANGE,this.handleLayerChange_,this)];e instanceof LayerGroup&&t.push(listen(e,"addlayer",this.handleLayerGroupAdd_,this),listen(e,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[getUid(e)]=t}handleLayerGroupAdd_(e){this.dispatchEvent(new GroupEvent("addlayer",e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new GroupEvent("removelayer",e.layer))}handleLayersAdd_(e){const t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new GroupEvent("addlayer",t)),this.changed()}handleLayersRemove_(e){const t=e.element,i=getUid(t);this.listenerKeys_[i].forEach(unlistenByKey),delete this.listenerKeys_[i],this.dispatchEvent(new GroupEvent("removelayer",t)),this.changed()}getLayers(){return this.get(Property$2.LAYERS)}setLayers(e){const t=this.getLayers();if(t){const i=t.getArray();for(let n=0,r=i.length;n<r;++n)this.dispatchEvent(new GroupEvent("removelayer",i[n]))}this.set(Property$2.LAYERS,e)}getLayersArray(e){return e=e!==void 0?e:[],this.getLayers().forEach(function(t){t.getLayersArray(e)}),e}getLayerStatesArray(e){const t=e!==void 0?e:[],i=t.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(t)});const n=this.getLayerState();let r=n.zIndex;!e&&n.zIndex===void 0&&(r=0);for(let o=i,a=t.length;o<a;o++){const l=t[o];l.opacity*=n.opacity,l.visible=l.visible&&n.visible,l.maxResolution=Math.min(l.maxResolution,n.maxResolution),l.minResolution=Math.max(l.minResolution,n.minResolution),l.minZoom=Math.max(l.minZoom,n.minZoom),l.maxZoom=Math.min(l.maxZoom,n.maxZoom),n.extent!==void 0&&(l.extent!==void 0?l.extent=getIntersection(l.extent,n.extent):l.extent=n.extent),l.zIndex===void 0&&(l.zIndex=r)}return t}getSourceState(){return"ready"}}const RenderEventType={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};class Layer extends BaseLayer{constructor(e){const t=Object.assign({},e);delete t.source,super(t),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,e.render&&(this.render=e.render),e.map&&this.setMap(e.map),this.addChangeListener(LayerProperty.SOURCE,this.handleSourcePropertyChange_);const i=e.source?e.source:null;this.setSource(i)}getLayersArray(e){return e=e||[],e.push(this),e}getLayerStatesArray(e){return e=e||[],e.push(this.getLayerState()),e}getSource(){return this.get(LayerProperty.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){const e=this.getSource();return e?e.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(unlistenByKey(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const e=this.getSource();e&&(this.sourceChangeKey_=listen(e,EventType.CHANGE,this.handleSourceChange_,this),e.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}isVisible(e){let t;const i=this.getMapInternal();!e&&i&&(e=i.getView()),e instanceof View?t={viewState:e.getState(),extent:e.calculateExtent()}:t=e,!t.layerStatesArray&&i&&(t.layerStatesArray=i.getLayerGroup().getLayerStatesArray());let n;if(t.layerStatesArray){if(n=t.layerStatesArray.find(o=>o.layer===this),!n)return!1}else n=this.getLayerState();const r=this.getExtent();return inView(n,t.viewState)&&(!r||intersects$1(r,t.extent))}getAttributions(e){var r;if(!this.isVisible(e))return[];const t=(r=this.getSource())==null?void 0:r.getAttributions();if(!t)return[];const i=e instanceof View?e.getViewStateAndExtent():e;let n=t(i);return Array.isArray(n)||(n=[n]),n}render(e,t){const i=this.getRenderer();return i.prepareFrame(e)?(this.rendered=!0,i.renderFrame(e,t)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(e,t){}renderDeferred(e){const t=this.getRenderer();t&&t.renderDeferred(e)}setMapInternal(e){e||this.unrender(),this.set(LayerProperty.MAP,e)}getMapInternal(){return this.get(LayerProperty.MAP)}setMap(e){this.mapPrecomposeKey_&&(unlistenByKey(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(unlistenByKey(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=listen(e,RenderEventType.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=listen(this,EventType.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){const t=e.frameState.layerStatesArray,i=this.getLayerState(!1);assert(!t.some(n=>n.layer===i.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),t.push(i)}setSource(e){this.set(LayerProperty.SOURCE,e)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}}function inView(s,e){if(!s.visible)return!1;const t=e.resolution;if(t<s.minResolution||t>=s.maxResolution)return!1;const i=e.zoom;return i>s.minZoom&&i<=s.maxZoom}function quickselect(s,e,t=0,i=s.length-1,n=defaultCompare){for(;i>t;){if(i-t>600){const l=i-t+1,c=e-t+1,h=Math.log(l),u=.5*Math.exp(2*h/3),d=.5*Math.sqrt(h*u*(l-u)/l)*(c-l/2<0?-1:1),g=Math.max(t,Math.floor(e-c*u/l+d)),f=Math.min(i,Math.floor(e+(l-c)*u/l+d));quickselect(s,e,g,f,n)}const r=s[e];let o=t,a=i;for(swap(s,t,e),n(s[i],r)>0&&swap(s,t,i);o<a;){for(swap(s,o,a),o++,a--;n(s[o],r)<0;)o++;for(;n(s[a],r)>0;)a--}n(s[t],r)===0?swap(s,t,a):(a++,swap(s,a,i)),a<=e&&(t=a+1),e<=a&&(i=a-1)}}function swap(s,e,t){const i=s[e];s[e]=s[t],s[t]=i}function defaultCompare(s,e){return s<e?-1:s>e?1:0}let RBush$1=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data;const i=[];if(!intersects(e,t))return i;const n=this.toBBox,r=[];for(;t;){for(let o=0;o<t.children.length;o++){const a=t.children[o],l=t.leaf?n(a):a;intersects(e,l)&&(t.leaf?i.push(a):contains(e,l)?this._all(a,i):r.push(a))}t=r.pop()}return i}collides(e){let t=this.data;if(!intersects(e,t))return!1;const i=[];for(;t;){for(let n=0;n<t.children.length;n++){const r=t.children[n],o=t.leaf?this.toBBox(r):r;if(intersects(e,o)){if(t.leaf||contains(e,o))return!0;i.push(r)}}t=i.pop()}return!1}load(e){if(!(e&&e.length))return this;if(e.length<this._minEntries){for(let i=0;i<e.length;i++)this.insert(e[i]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(!this.data.children.length)this.data=t;else if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){const i=this.data;this.data=t,t=i}this._insert(t,this.data.height-t.height-1,!0)}return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=createNode([]),this}remove(e,t){if(!e)return this;let i=this.data;const n=this.toBBox(e),r=[],o=[];let a,l,c;for(;i||r.length;){if(i||(i=r.pop(),l=r[r.length-1],a=o.pop(),c=!0),i.leaf){const h=findItem(e,i.children,t);if(h!==-1)return i.children.splice(h,1),r.push(i),this._condense(r),this}!c&&!i.leaf&&contains(i,n)?(r.push(i),o.push(a),a=0,l=i,i=i.children[0]):l?(a++,i=l.children[a],c=!1):i=null}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){const i=[];for(;e;)e.leaf?t.push(...e.children):i.push(...e.children),e=i.pop();return t}_build(e,t,i,n){const r=i-t+1;let o=this._maxEntries,a;if(r<=o)return a=createNode(e.slice(t,i+1)),calcBBox(a,this.toBBox),a;n||(n=Math.ceil(Math.log(r)/Math.log(o)),o=Math.ceil(r/Math.pow(o,n-1))),a=createNode([]),a.leaf=!1,a.height=n;const l=Math.ceil(r/o),c=l*Math.ceil(Math.sqrt(o));multiSelect(e,t,i,c,this.compareMinX);for(let h=t;h<=i;h+=c){const u=Math.min(h+c-1,i);multiSelect(e,h,u,l,this.compareMinY);for(let d=h;d<=u;d+=l){const g=Math.min(d+l-1,u);a.children.push(this._build(e,d,g,n-1))}}return calcBBox(a,this.toBBox),a}_chooseSubtree(e,t,i,n){for(;n.push(t),!(t.leaf||n.length-1===i);){let r=1/0,o=1/0,a;for(let l=0;l<t.children.length;l++){const c=t.children[l],h=bboxArea(c),u=enlargedArea(e,c)-h;u<o?(o=u,r=h<r?h:r,a=c):u===o&&h<r&&(r=h,a=c)}t=a||t.children[0]}return t}_insert(e,t,i){const n=i?e:this.toBBox(e),r=[],o=this._chooseSubtree(n,this.data,t,r);for(o.children.push(e),extend(o,n);t>=0&&r[t].children.length>this._maxEntries;)this._split(r,t),t--;this._adjustParentBBoxes(n,r,t)}_split(e,t){const i=e[t],n=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,n);const o=this._chooseSplitIndex(i,r,n),a=createNode(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,calcBBox(i,this.toBBox),calcBBox(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(i,a)}_splitRoot(e,t){this.data=createNode([e,t]),this.data.height=e.height+1,this.data.leaf=!1,calcBBox(this.data,this.toBBox)}_chooseSplitIndex(e,t,i){let n,r=1/0,o=1/0;for(let a=t;a<=i-t;a++){const l=distBBox(e,0,a,this.toBBox),c=distBBox(e,a,i,this.toBBox),h=intersectionArea(l,c),u=bboxArea(l)+bboxArea(c);h<r?(r=h,n=a,o=u<o?u:o):h===r&&u<o&&(o=u,n=a)}return n||i-t}_chooseSplitAxis(e,t,i){const n=e.leaf?this.compareMinX:compareNodeMinX,r=e.leaf?this.compareMinY:compareNodeMinY,o=this._allDistMargin(e,t,i,n),a=this._allDistMargin(e,t,i,r);o<a&&e.children.sort(n)}_allDistMargin(e,t,i,n){e.children.sort(n);const r=this.toBBox,o=distBBox(e,0,t,r),a=distBBox(e,i-t,i,r);let l=bboxMargin(o)+bboxMargin(a);for(let c=t;c<i-t;c++){const h=e.children[c];extend(o,e.leaf?r(h):h),l+=bboxMargin(o)}for(let c=i-t-1;c>=t;c--){const h=e.children[c];extend(a,e.leaf?r(h):h),l+=bboxMargin(a)}return l}_adjustParentBBoxes(e,t,i){for(let n=i;n>=0;n--)extend(t[n],e)}_condense(e){for(let t=e.length-1,i;t>=0;t--)e[t].children.length===0?t>0?(i=e[t-1].children,i.splice(i.indexOf(e[t]),1)):this.clear():calcBBox(e[t],this.toBBox)}};function findItem(s,e,t){if(!t)return e.indexOf(s);for(let i=0;i<e.length;i++)if(t(s,e[i]))return i;return-1}function calcBBox(s,e){distBBox(s,0,s.children.length,e,s)}function distBBox(s,e,t,i,n){n||(n=createNode(null)),n.minX=1/0,n.minY=1/0,n.maxX=-1/0,n.maxY=-1/0;for(let r=e;r<t;r++){const o=s.children[r];extend(n,s.leaf?i(o):o)}return n}function extend(s,e){return s.minX=Math.min(s.minX,e.minX),s.minY=Math.min(s.minY,e.minY),s.maxX=Math.max(s.maxX,e.maxX),s.maxY=Math.max(s.maxY,e.maxY),s}function compareNodeMinX(s,e){return s.minX-e.minX}function compareNodeMinY(s,e){return s.minY-e.minY}function bboxArea(s){return(s.maxX-s.minX)*(s.maxY-s.minY)}function bboxMargin(s){return s.maxX-s.minX+(s.maxY-s.minY)}function enlargedArea(s,e){return(Math.max(e.maxX,s.maxX)-Math.min(e.minX,s.minX))*(Math.max(e.maxY,s.maxY)-Math.min(e.minY,s.minY))}function intersectionArea(s,e){const t=Math.max(s.minX,e.minX),i=Math.max(s.minY,e.minY),n=Math.min(s.maxX,e.maxX),r=Math.min(s.maxY,e.maxY);return Math.max(0,n-t)*Math.max(0,r-i)}function contains(s,e){return s.minX<=e.minX&&s.minY<=e.minY&&e.maxX<=s.maxX&&e.maxY<=s.maxY}function intersects(s,e){return e.minX<=s.maxX&&e.minY<=s.maxY&&e.maxX>=s.minX&&e.maxY>=s.minY}function createNode(s){return{children:s,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function multiSelect(s,e,t,i,n){const r=[e,t];for(;r.length;){if(t=r.pop(),e=r.pop(),t-e<=i)continue;const o=e+Math.ceil((t-e)/i/2)*i;quickselect(s,o,e,t,n),r.push(e,o,o,t)}}const NO_COLOR=[NaN,NaN,NaN,0];let colorParseContext;function getColorParseContext(){return colorParseContext||(colorParseContext=createCanvasContext2D(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),colorParseContext}const rgbModernRegEx=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,rgbLegacyAbsoluteRegEx=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,rgbLegacyPercentageRegEx=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,hexRegEx=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function toColorComponent(s,e){return s.endsWith("%")?Number(s.substring(0,s.length-1))/e:Number(s)}function throwInvalidColor(s){throw new Error('failed to parse "'+s+'" as color')}function parseRgba(s){if(s.toLowerCase().startsWith("rgb")){const r=s.match(rgbLegacyAbsoluteRegEx)||s.match(rgbModernRegEx)||s.match(rgbLegacyPercentageRegEx);if(r){const o=r[4],a=100/255;return[clamp(toColorComponent(r[1],a)+.5|0,0,255),clamp(toColorComponent(r[2],a)+.5|0,0,255),clamp(toColorComponent(r[3],a)+.5|0,0,255),o!==void 0?clamp(toColorComponent(o,100),0,1):1]}throwInvalidColor(s)}if(s.startsWith("#")){if(hexRegEx.test(s)){const r=s.substring(1),o=r.length<=4?1:2,a=[0,0,0,255];for(let l=0,c=r.length;l<c;l+=o){let h=parseInt(r.substring(l,l+o),16);o===1&&(h+=h<<4),a[l/o]=h}return a[3]=a[3]/255,a}throwInvalidColor(s)}const e=getColorParseContext();e.fillStyle="#abcdef";let t=e.fillStyle;e.fillStyle=s,e.fillStyle===t&&(e.fillStyle="#fedcba",t=e.fillStyle,e.fillStyle=s,e.fillStyle===t&&throwInvalidColor(s));const i=e.fillStyle;if(i.startsWith("#")||i.startsWith("rgba"))return parseRgba(i);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);const n=Array.from(e.getImageData(0,0,1,1).data);return n[3]=toFixed(n[3]/255,3),n}function asString(s){return typeof s=="string"?s:toString(s)}const MAX_CACHE_SIZE=1024,cache={};let cacheSize=0;function withAlpha(s){if(s.length===4)return s;const e=s.slice();return e[3]=1,e}function b1(s){return s>.0031308?Math.pow(s,1/2.4)*269.025-14.025:s*3294.6}function b2(s){return s>.2068965?Math.pow(s,3):(s-4/29)*(108/841)}function a1(s){return s>10.314724?Math.pow((s+14.025)/269.025,2.4):s/3294.6}function a2(s){return s>.0088564?Math.pow(s,1/3):s/(108/841)+4/29}function rgbaToLcha(s){const e=a1(s[0]),t=a1(s[1]),i=a1(s[2]),n=a2(e*.222488403+t*.716873169+i*.06060791),r=500*(a2(e*.452247074+t*.399439023+i*.148375274)-n),o=200*(n-a2(e*.016863605+t*.117638439+i*.865350722)),a=Math.atan2(o,r)*(180/Math.PI);return[116*n-16,Math.sqrt(r*r+o*o),a<0?a+360:a,s[3]]}function lchaToRgba(s){const e=(s[0]+16)/116,t=s[1],i=s[2]*Math.PI/180,n=b2(e),r=b2(e+t/500*Math.cos(i)),o=b2(e-t/200*Math.sin(i)),a=b1(r*3.021973625-n*1.617392459-o*.404875592),l=b1(r*-.943766287+n*1.916279586+o*.027607165),c=b1(r*.069407491-n*.22898585+o*1.159737864);return[clamp(a+.5|0,0,255),clamp(l+.5|0,0,255),clamp(c+.5|0,0,255),s[3]]}function fromString(s){if(s==="none")return NO_COLOR;if(cache.hasOwnProperty(s))return cache[s];if(cacheSize>=MAX_CACHE_SIZE){let t=0;for(const i in cache)(t++&3)===0&&(delete cache[i],--cacheSize)}const e=parseRgba(s);e.length!==4&&throwInvalidColor(s);for(const t of e)isNaN(t)&&throwInvalidColor(s);return cache[s]=e,++cacheSize,e}function asArray(s){return Array.isArray(s)?s:fromString(s)}function toString(s){let e=s[0];e!=(e|0)&&(e=e+.5|0);let t=s[1];t!=(t|0)&&(t=t+.5|0);let i=s[2];i!=(i|0)&&(i=i+.5|0);const n=s[3]===void 0?1:Math.round(s[3]*1e3)/1e3;return"rgba("+e+","+t+","+i+","+n+")"}function hasArea(s){return s[0]>0&&s[1]>0}function scale(s,e,t){return t===void 0&&(t=[0,0]),t[0]=s[0]*e+.5|0,t[1]=s[1]*e+.5|0,t}function toSize(s,e){return Array.isArray(s)?s:(e===void 0?e=[s,s]:(e[0]=s,e[1]=s),e)}let numTypes=0;const BooleanType=1<<numTypes++,NumberType=1<<numTypes++,StringType=1<<numTypes++,ColorType=1<<numTypes++,NumberArrayType=1<<numTypes++,SizeType=1<<numTypes++,AnyType=Math.pow(2,numTypes)-1,typeNames={[BooleanType]:"boolean",[NumberType]:"number",[StringType]:"string",[ColorType]:"color",[NumberArrayType]:"number[]",[SizeType]:"size"},namedTypes=Object.keys(typeNames).map(Number).sort(ascending);function isSpecific(s){return s in typeNames}function typeName(s){const e=[];for(const t of namedTypes)includesType(s,t)&&e.push(typeNames[t]);return e.length===0?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function includesType(s,e){return(s&e)===e}function isType(s,e){return s===e}class LiteralExpression{constructor(e,t){if(!isSpecific(e))throw new Error(`literal expressions must have a specific type, got ${typeName(e)}`);this.type=e,this.value=t}}class CallExpression{constructor(e,t,...i){this.type=e,this.operator=t,this.args=i}}function newParsingContext(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1,mapState:!1}}function parse(s,e,t){switch(typeof s){case"boolean":{if(isType(e,StringType))return new LiteralExpression(StringType,s?"true":"false");if(!includesType(e,BooleanType))throw new Error(`got a boolean, but expected ${typeName(e)}`);return new LiteralExpression(BooleanType,s)}case"number":{if(isType(e,SizeType))return new LiteralExpression(SizeType,toSize(s));if(isType(e,BooleanType))return new LiteralExpression(BooleanType,!!s);if(isType(e,StringType))return new LiteralExpression(StringType,s.toString());if(!includesType(e,NumberType))throw new Error(`got a number, but expected ${typeName(e)}`);return new LiteralExpression(NumberType,s)}case"string":{if(isType(e,ColorType))return new LiteralExpression(ColorType,fromString(s));if(isType(e,BooleanType))return new LiteralExpression(BooleanType,!!s);if(!includesType(e,StringType))throw new Error(`got a string, but expected ${typeName(e)}`);return new LiteralExpression(StringType,s)}}if(!Array.isArray(s))throw new Error("expression must be an array or a primitive value");if(s.length===0)throw new Error("empty expression");if(typeof s[0]=="string")return parseCallExpression(s,e,t);for(const i of s)if(typeof i!="number")throw new Error("expected an array of numbers");if(isType(e,SizeType)){if(s.length!==2)throw new Error(`expected an array of two values for a size, got ${s.length}`);return new LiteralExpression(SizeType,s)}if(isType(e,ColorType)){if(s.length===3)return new LiteralExpression(ColorType,[...s,1]);if(s.length===4)return new LiteralExpression(ColorType,s);throw new Error(`expected an array of 3 or 4 values for a color, got ${s.length}`)}if(!includesType(e,NumberArrayType))throw new Error(`got an array of numbers, but expected ${typeName(e)}`);return new LiteralExpression(NumberArrayType,s)}const Ops={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",LineMetric:"line-metric",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string",Has:"has"},parsers={[Ops.Get]:createCallExpressionParser(hasArgsCount(1,1/0),withGetArgs),[Ops.Var]:createCallExpressionParser(hasArgsCount(1,1),withVarArgs),[Ops.Has]:createCallExpressionParser(hasArgsCount(1,1/0),withGetArgs),[Ops.Id]:createCallExpressionParser(usesFeatureId,withNoArgs),[Ops.Concat]:createCallExpressionParser(hasArgsCount(2,1/0),withArgsOfType(StringType)),[Ops.GeometryType]:createCallExpressionParser(usesGeometryType,withNoArgs),[Ops.LineMetric]:createCallExpressionParser(withNoArgs),[Ops.Resolution]:createCallExpressionParser(usesMapState,withNoArgs),[Ops.Zoom]:createCallExpressionParser(usesMapState,withNoArgs),[Ops.Time]:createCallExpressionParser(usesMapState,withNoArgs),[Ops.Any]:createCallExpressionParser(hasArgsCount(2,1/0),withArgsOfType(BooleanType)),[Ops.All]:createCallExpressionParser(hasArgsCount(2,1/0),withArgsOfType(BooleanType)),[Ops.Not]:createCallExpressionParser(hasArgsCount(1,1),withArgsOfType(BooleanType)),[Ops.Equal]:createCallExpressionParser(hasArgsCount(2,2),withArgsOfType(AnyType)),[Ops.NotEqual]:createCallExpressionParser(hasArgsCount(2,2),withArgsOfType(AnyType)),[Ops.GreaterThan]:createCallExpressionParser(hasArgsCount(2,2),withArgsOfType(NumberType)),[Ops.GreaterThanOrEqualTo]:createCallExpressionParser(hasArgsCount(2,2),withArgsOfType(NumberType)),[Ops.LessThan]:createCallExpressionParser(hasArgsCount(2,2),withArgsOfType(NumberType)),[Ops.LessThanOrEqualTo]:createCallExpressionParser(hasArgsCount(2,2),withArgsOfType(NumberType)),[Ops.Multiply]:createCallExpressionParser(hasArgsCount(2,1/0),withArgsOfReturnType),[Ops.Coalesce]:createCallExpressionParser(hasArgsCount(2,1/0),withArgsOfReturnType),[Ops.Divide]:createCallExpressionParser(hasArgsCount(2,2),withArgsOfType(NumberType)),[Ops.Add]:createCallExpressionParser(hasArgsCount(2,1/0),withArgsOfType(NumberType)),[Ops.Subtract]:createCallExpressionParser(hasArgsCount(2,2),withArgsOfType(NumberType)),[Ops.Clamp]:createCallExpressionParser(hasArgsCount(3,3),withArgsOfType(NumberType)),[Ops.Mod]:createCallExpressionParser(hasArgsCount(2,2),withArgsOfType(NumberType)),[Ops.Pow]:createCallExpressionParser(hasArgsCount(2,2),withArgsOfType(NumberType)),[Ops.Abs]:createCallExpressionParser(hasArgsCount(1,1),withArgsOfType(NumberType)),[Ops.Floor]:createCallExpressionParser(hasArgsCount(1,1),withArgsOfType(NumberType)),[Ops.Ceil]:createCallExpressionParser(hasArgsCount(1,1),withArgsOfType(NumberType)),[Ops.Round]:createCallExpressionParser(hasArgsCount(1,1),withArgsOfType(NumberType)),[Ops.Sin]:createCallExpressionParser(hasArgsCount(1,1),withArgsOfType(NumberType)),[Ops.Cos]:createCallExpressionParser(hasArgsCount(1,1),withArgsOfType(NumberType)),[Ops.Atan]:createCallExpressionParser(hasArgsCount(1,2),withArgsOfType(NumberType)),[Ops.Sqrt]:createCallExpressionParser(hasArgsCount(1,1),withArgsOfType(NumberType)),[Ops.Match]:createCallExpressionParser(hasArgsCount(4,1/0),hasEvenArgs,withMatchArgs),[Ops.Between]:createCallExpressionParser(hasArgsCount(3,3),withArgsOfType(NumberType)),[Ops.Interpolate]:createCallExpressionParser(hasArgsCount(6,1/0),hasEvenArgs,withInterpolateArgs),[Ops.Case]:createCallExpressionParser(hasArgsCount(3,1/0),hasOddArgs,withCaseArgs),[Ops.In]:createCallExpressionParser(hasArgsCount(2,2),withInArgs),[Ops.Number]:createCallExpressionParser(hasArgsCount(1,1/0),withArgsOfType(AnyType)),[Ops.String]:createCallExpressionParser(hasArgsCount(1,1/0),withArgsOfType(AnyType)),[Ops.Array]:createCallExpressionParser(hasArgsCount(1,1/0),withArgsOfType(NumberType)),[Ops.Color]:createCallExpressionParser(hasArgsCount(1,4),withArgsOfType(NumberType)),[Ops.Band]:createCallExpressionParser(hasArgsCount(1,3),withArgsOfType(NumberType)),[Ops.Palette]:createCallExpressionParser(hasArgsCount(2,2),withPaletteArgs),[Ops.ToString]:createCallExpressionParser(hasArgsCount(1,1),withArgsOfType(BooleanType|NumberType|StringType|ColorType))};function withGetArgs(s,e,t){const i=s.length-1,n=new Array(i);for(let r=0;r<i;++r){const o=s[r+1];switch(typeof o){case"number":{n[r]=new LiteralExpression(NumberType,o);break}case"string":{n[r]=new LiteralExpression(StringType,o);break}default:throw new Error(`expected a string key or numeric array index for a get operation, got ${o}`)}r===0&&t.properties.add(String(o))}return n}function withVarArgs(s,e,t){const i=s[1];if(typeof i!="string")throw new Error("expected a string argument for var operation");return t.variables.add(i),[new LiteralExpression(StringType,i)]}function usesFeatureId(s,e,t){t.featureId=!0}function usesGeometryType(s,e,t){t.geometryType=!0}function usesMapState(s,e,t){t.mapState=!0}function withNoArgs(s,e,t){const i=s[0];if(s.length!==1)throw new Error(`expected no arguments for ${i} operation`);return[]}function hasArgsCount(s,e){return function(t,i,n){const r=t[0],o=t.length-1;if(s===e){if(o!==s){const a=s===1?"":"s";throw new Error(`expected ${s} argument${a} for ${r}, got ${o}`)}}else if(o<s||o>e){const a=e===1/0?`${s} or more`:`${s} to ${e}`;throw new Error(`expected ${a} arguments for ${r}, got ${o}`)}}}function withArgsOfReturnType(s,e,t){const i=s.length-1,n=new Array(i);for(let r=0;r<i;++r){const o=parse(s[r+1],e,t);n[r]=o}return n}function withArgsOfType(s){return function(e,t,i){const n=e.length-1,r=new Array(n);for(let o=0;o<n;++o){const a=parse(e[o+1],s,i);r[o]=a}return r}}function hasOddArgs(s,e,t){const i=s[0],n=s.length-1;if(n%2===0)throw new Error(`expected an odd number of arguments for ${i}, got ${n} instead`)}function hasEvenArgs(s,e,t){const i=s[0],n=s.length-1;if(n%2===1)throw new Error(`expected an even number of arguments for operation ${i}, got ${n} instead`)}function withMatchArgs(s,e,t){const i=s.length-1,n=StringType|NumberType|BooleanType,r=parse(s[1],n,t),o=parse(s[s.length-1],e,t),a=new Array(i-2);for(let l=0;l<i-2;l+=2){try{const c=parse(s[l+2],r.type,t);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+1} of match expression: ${c.message}`)}try{const c=parse(s[l+3],o.type,t);a[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+2} of match expression: ${c.message}`)}}return[r,...a,o]}function withInterpolateArgs(s,e,t){const i=s[1];let n;switch(i[0]){case"linear":n=1;break;case"exponential":const l=i[1];if(typeof l!="number"||l<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(l)} instead`);n=l;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(i)}`)}const r=new LiteralExpression(NumberType,n);let o;try{o=parse(s[2],NumberType,t)}catch(l){throw new Error(`failed to parse argument 1 in interpolate expression: ${l.message}`)}const a=new Array(s.length-3);for(let l=0;l<a.length;l+=2){try{const c=parse(s[l+3],NumberType,t);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${c.message}`)}try{const c=parse(s[l+4],e,t);a[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${c.message}`)}}return[r,o,...a]}function withCaseArgs(s,e,t){const i=parse(s[s.length-1],e,t),n=new Array(s.length-1);for(let r=0;r<n.length-1;r+=2){try{const o=parse(s[r+1],BooleanType,t);n[r]=o}catch(o){throw new Error(`failed to parse argument ${r} of case expression: ${o.message}`)}try{const o=parse(s[r+2],i.type,t);n[r+1]=o}catch(o){throw new Error(`failed to parse argument ${r+1} of case expression: ${o.message}`)}}return n[n.length-1]=i,n}function withInArgs(s,e,t){let i=s[2];if(!Array.isArray(i))throw new Error('the second argument for the "in" operator must be an array');let n;if(typeof i[0]=="string"){if(i[0]!=="literal")throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');if(!Array.isArray(i[1]))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array');i=i[1],n=StringType}else n=NumberType;const r=new Array(i.length);for(let a=0;a<r.length;a++)try{const l=parse(i[a],n,t);r[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[parse(s[1],n,t),...r]}function withPaletteArgs(s,e,t){let i;try{i=parse(s[1],NumberType,t)}catch(o){throw new Error(`failed to parse first argument in palette expression: ${o.message}`)}const n=s[2];if(!Array.isArray(n))throw new Error("the second argument of palette must be an array");const r=new Array(n.length);for(let o=0;o<r.length;o++){let a;try{a=parse(n[o],ColorType,t)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof LiteralExpression))throw new Error(`the palette color at index ${o} must be a literal value`);r[o]=a}return[i,...r]}function createCallExpressionParser(...s){return function(e,t,i){const n=e[0];let r;for(let o=0;o<s.length;o++){const a=s[o](e,t,i);if(o==s.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");r=a}}return new CallExpression(t,n,...r)}}function parseCallExpression(s,e,t){const i=s[0],n=parsers[i];if(!n)throw new Error(`unknown operator: ${i}`);return n(s,e,t)}function computeGeometryType(s){if(!s)return"";const e=s.getType();switch(e){case"Point":case"LineString":case"Polygon":return e;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return e.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return computeGeometryType(s.getGeometries()[0]);default:return""}}function newEvaluationContext(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function buildExpression(s,e,t){const i=parse(s,e,t);return compileExpression(i)}function compileExpression(s,e){if(s instanceof LiteralExpression){if(s.type===ColorType&&typeof s.value=="string"){const i=fromString(s.value);return function(){return i}}return function(){return s.value}}const t=s.operator;switch(t){case Ops.Number:case Ops.String:case Ops.Coalesce:return compileAssertionExpression(s);case Ops.Get:case Ops.Var:case Ops.Has:return compileAccessorExpression(s);case Ops.Id:return i=>i.featureId;case Ops.GeometryType:return i=>i.geometryType;case Ops.Concat:{const i=s.args.map(n=>compileExpression(n));return n=>"".concat(...i.map(r=>r(n).toString()))}case Ops.Resolution:return i=>i.resolution;case Ops.Any:case Ops.All:case Ops.Between:case Ops.In:case Ops.Not:return compileLogicalExpression(s);case Ops.Equal:case Ops.NotEqual:case Ops.LessThan:case Ops.LessThanOrEqualTo:case Ops.GreaterThan:case Ops.GreaterThanOrEqualTo:return compileComparisonExpression(s);case Ops.Multiply:case Ops.Divide:case Ops.Add:case Ops.Subtract:case Ops.Clamp:case Ops.Mod:case Ops.Pow:case Ops.Abs:case Ops.Floor:case Ops.Ceil:case Ops.Round:case Ops.Sin:case Ops.Cos:case Ops.Atan:case Ops.Sqrt:return compileNumericExpression(s);case Ops.Case:return compileCaseExpression(s);case Ops.Match:return compileMatchExpression(s);case Ops.Interpolate:return compileInterpolateExpression(s);case Ops.ToString:return compileConvertExpression(s);default:throw new Error(`Unsupported operator ${t}`)}}function compileAssertionExpression(s,e){const t=s.operator,i=s.args.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=compileExpression(s.args[r]);switch(t){case Ops.Coalesce:return r=>{for(let o=0;o<i;++o){const a=n[o](r);if(typeof a<"u"&&a!==null)return a}throw new Error("Expected one of the values to be non-null")};case Ops.Number:case Ops.String:return r=>{for(let o=0;o<i;++o){const a=n[o](r);if(typeof a===t)return a}throw new Error(`Expected one of the values to be a ${t}`)};default:throw new Error(`Unsupported assertion operator ${t}`)}}function compileAccessorExpression(s,e){const i=s.args[0].value;switch(s.operator){case Ops.Get:return n=>{const r=s.args;let o=n.properties[i];for(let a=1,l=r.length;a<l;++a){const h=r[a].value;o=o[h]}return o};case Ops.Var:return n=>n.variables[i];case Ops.Has:return n=>{const r=s.args;if(!(i in n.properties))return!1;let o=n.properties[i];for(let a=1,l=r.length;a<l;++a){const h=r[a].value;if(!o||!Object.hasOwn(o,h))return!1;o=o[h]}return!0};default:throw new Error(`Unsupported accessor operator ${s.operator}`)}}function compileComparisonExpression(s,e){const t=s.operator,i=compileExpression(s.args[0]),n=compileExpression(s.args[1]);switch(t){case Ops.Equal:return r=>i(r)===n(r);case Ops.NotEqual:return r=>i(r)!==n(r);case Ops.LessThan:return r=>i(r)<n(r);case Ops.LessThanOrEqualTo:return r=>i(r)<=n(r);case Ops.GreaterThan:return r=>i(r)>n(r);case Ops.GreaterThanOrEqualTo:return r=>i(r)>=n(r);default:throw new Error(`Unsupported comparison operator ${t}`)}}function compileLogicalExpression(s,e){const t=s.operator,i=s.args.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=compileExpression(s.args[r]);switch(t){case Ops.Any:return r=>{for(let o=0;o<i;++o)if(n[o](r))return!0;return!1};case Ops.All:return r=>{for(let o=0;o<i;++o)if(!n[o](r))return!1;return!0};case Ops.Between:return r=>{const o=n[0](r),a=n[1](r),l=n[2](r);return o>=a&&o<=l};case Ops.In:return r=>{const o=n[0](r);for(let a=1;a<i;++a)if(o===n[a](r))return!0;return!1};case Ops.Not:return r=>!n[0](r);default:throw new Error(`Unsupported logical operator ${t}`)}}function compileNumericExpression(s,e){const t=s.operator,i=s.args.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=compileExpression(s.args[r]);switch(t){case Ops.Multiply:return r=>{let o=1;for(let a=0;a<i;++a)o*=n[a](r);return o};case Ops.Divide:return r=>n[0](r)/n[1](r);case Ops.Add:return r=>{let o=0;for(let a=0;a<i;++a)o+=n[a](r);return o};case Ops.Subtract:return r=>n[0](r)-n[1](r);case Ops.Clamp:return r=>{const o=n[0](r),a=n[1](r);if(o<a)return a;const l=n[2](r);return o>l?l:o};case Ops.Mod:return r=>n[0](r)%n[1](r);case Ops.Pow:return r=>Math.pow(n[0](r),n[1](r));case Ops.Abs:return r=>Math.abs(n[0](r));case Ops.Floor:return r=>Math.floor(n[0](r));case Ops.Ceil:return r=>Math.ceil(n[0](r));case Ops.Round:return r=>Math.round(n[0](r));case Ops.Sin:return r=>Math.sin(n[0](r));case Ops.Cos:return r=>Math.cos(n[0](r));case Ops.Atan:return i===2?r=>Math.atan2(n[0](r),n[1](r)):r=>Math.atan(n[0](r));case Ops.Sqrt:return r=>Math.sqrt(n[0](r));default:throw new Error(`Unsupported numeric operator ${t}`)}}function compileCaseExpression(s,e){const t=s.args.length,i=new Array(t);for(let n=0;n<t;++n)i[n]=compileExpression(s.args[n]);return n=>{for(let r=0;r<t-1;r+=2)if(i[r](n))return i[r+1](n);return i[t-1](n)}}function compileMatchExpression(s,e){const t=s.args.length,i=new Array(t);for(let n=0;n<t;++n)i[n]=compileExpression(s.args[n]);return n=>{const r=i[0](n);for(let o=1;o<t-1;o+=2)if(r===i[o](n))return i[o+1](n);return i[t-1](n)}}function compileInterpolateExpression(s,e){const t=s.args.length,i=new Array(t);for(let n=0;n<t;++n)i[n]=compileExpression(s.args[n]);return n=>{const r=i[0](n),o=i[1](n);let a,l;for(let c=2;c<t;c+=2){const h=i[c](n);let u=i[c+1](n);const d=Array.isArray(u);if(d&&(u=withAlpha(u)),h>=o)return c===2?u:d?interpolateColor(r,o,a,l,h,u):interpolateNumber(r,o,a,l,h,u);a=h,l=u}return l}}function compileConvertExpression(s,e){const t=s.operator,i=s.args.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=compileExpression(s.args[r]);switch(t){case Ops.ToString:return r=>{const o=n[0](r);return s.args[0].type===ColorType?toString(o):o.toString()};default:throw new Error(`Unsupported convert operator ${t}`)}}function interpolateNumber(s,e,t,i,n,r){const o=n-t;if(o===0)return i;const a=e-t,l=s===1?a/o:(Math.pow(s,a)-1)/(Math.pow(s,o)-1);return i+l*(r-i)}function interpolateColor(s,e,t,i,n,r){if(n-t===0)return i;const a=rgbaToLcha(i),l=rgbaToLcha(r);let c=l[2]-a[2];c>180?c-=360:c<-180&&(c+=360);const h=[interpolateNumber(s,e,t,a[0],n,l[0]),interpolateNumber(s,e,t,a[1],n,l[1]),a[2]+interpolateNumber(s,e,t,0,n,c),interpolateNumber(s,e,t,i[3],n,r[3])];return lchaToRgba(h)}const ImageState={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class ImageWrapper extends Target{constructor(e,t,i,n){super(),this.extent=e,this.pixelRatio_=i,this.resolution=t,this.state=typeof n=="function"?ImageState.IDLE:n,this.image_=null,this.loader=typeof n=="function"?n:null}changed(){this.dispatchEvent(EventType.CHANGE)}getExtent(){return this.extent}getImage(){return this.image_}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){if(this.state==ImageState.IDLE&&this.loader){this.state=ImageState.LOADING,this.changed();const e=this.getResolution(),t=Array.isArray(e)?e[0]:e;toPromise(()=>this.loader(this.getExtent(),t,this.getPixelRatio())).then(i=>{"image"in i&&(this.image_=i.image),"extent"in i&&(this.extent=i.extent),"resolution"in i&&(this.resolution=i.resolution),"pixelRatio"in i&&(this.pixelRatio_=i.pixelRatio),(i instanceof HTMLImageElement||CREATE_IMAGE_BITMAP&&i instanceof ImageBitmap||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement)&&(this.image_=i),this.state=ImageState.LOADED}).catch(i=>{this.state=ImageState.ERROR,console.error(i)}).finally(()=>this.changed())}}setImage(e){this.image_=e}setResolution(e){this.resolution=e}}function listenImage(s,e,t){const i=s;let n=!0,r=!1,o=!1;const a=[listenOnce(i,EventType.LOAD,function(){o=!0,r||e()})];return i.src&&IMAGE_DECODE?(r=!0,i.decode().then(function(){n&&e()}).catch(function(l){n&&(o?e():t())})):a.push(listenOnce(i,EventType.ERROR,t)),function(){n=!1,a.forEach(unlistenByKey)}}function load(s,e){return new Promise((t,i)=>{function n(){o(),t(s)}function r(){o(),i(new Error("Image load error"))}function o(){s.removeEventListener("load",n),s.removeEventListener("error",r)}s.addEventListener("load",n),s.addEventListener("error",r)})}function decodeFallback(s,e){return e&&(s.src=e),s.src&&IMAGE_DECODE?new Promise((t,i)=>s.decode().then(()=>t(s)).catch(n=>s.complete&&s.width?t(s):i(n))):load(s)}function decode(s,e){return e&&(s.src=e),s.src&&IMAGE_DECODE&&CREATE_IMAGE_BITMAP?s.decode().then(()=>createImageBitmap(s)).catch(t=>{if(s.complete&&s.width)return s;throw t}):decodeFallback(s)}class IconImageCache{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let e=0;for(const t in this.cache_){const i=this.cache_[t];(e++&3)===0&&!i.hasListener()&&(delete this.cache_[t],delete this.patternCache_[t],--this.cacheSize_)}}}get(e,t,i){const n=getCacheKey$1(e,t,i);return n in this.cache_?this.cache_[n]:null}getPattern(e,t,i){const n=getCacheKey$1(e,t,i);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,i,n,r){const o=getCacheKey$1(e,t,i),a=o in this.cache_;this.cache_[o]=n,r&&(n.getImageState()===ImageState.IDLE&&n.load(),n.getImageState()===ImageState.LOADING?n.ready().then(()=>{this.patternCache_[o]=getSharedCanvasContext2D().createPattern(n.getImage(1),"repeat")}):this.patternCache_[o]=getSharedCanvasContext2D().createPattern(n.getImage(1),"repeat")),a||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}}function getCacheKey$1(s,e,t){const i=t?asArray(t):"null";return e+":"+s+":"+i}const shared=new IconImageCache;let taintedTestContext=null;class IconImage extends Target{constructor(e,t,i,n,r){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=i,this.canvas_={},this.color_=r,this.imageState_=n===void 0?ImageState.IDLE:n,this.size_=e&&e.width&&e.height?[e.width,e.height]:null,this.src_=t,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===ImageState.LOADED){taintedTestContext||(taintedTestContext=createCanvasContext2D(1,1,void 0,{willReadFrequently:!0})),taintedTestContext.drawImage(this.image_,0,0);try{taintedTestContext.getImageData(0,0,1,1),this.tainted_=!1}catch{taintedTestContext=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(EventType.CHANGE)}handleImageError_(){this.imageState_=ImageState.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=ImageState.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const e=this.size_[0],t=this.size_[1],i=createCanvasContext2D(e,t);i.fillRect(0,0,e,t),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===ImageState.IDLE){this.image_||this.initializeImage_(),this.imageState_=ImageState.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&decodeFallback(this.image_,this.src_).then(e=>{this.image_=e,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==ImageState.LOADED)return;const t=this.image_,i=createCanvasContext2D(Math.ceil(t.width*e),Math.ceil(t.height*e)),n=i.canvas;i.scale(e,e),i.drawImage(t,0,0),i.globalCompositeOperation="multiply",i.fillStyle=asString(this.color_),i.fillRect(0,0,n.width/e,n.height/e),i.globalCompositeOperation="destination-in",i.drawImage(t,0,0),this.canvas_[e]=n}ready(){return this.ready_||(this.ready_=new Promise(e=>{if(this.imageState_===ImageState.LOADED||this.imageState_===ImageState.ERROR)e();else{const t=()=>{(this.imageState_===ImageState.LOADED||this.imageState_===ImageState.ERROR)&&(this.removeEventListener(EventType.CHANGE,t),e())};this.addEventListener(EventType.CHANGE,t)}})),this.ready_}}function get(s,e,t,i,n,r){let o=e===void 0?void 0:shared.get(e,t,n);return o||(o=new IconImage(s,s&&"src"in s?s.src||void 0:e,t,i,n),shared.set(e,t,n,o,r)),r&&o&&!shared.getPattern(e,t,n)&&shared.set(e,t,n,o,r),o}function asColorLike(s){return s?Array.isArray(s)?toString(s):typeof s=="object"&&"src"in s?asCanvasPattern(s):s:null}function asCanvasPattern(s){if(!s.offset||!s.size)return shared.getPattern(s.src,"anonymous",s.color);const e=s.src+":"+s.offset,t=shared.getPattern(e,void 0,s.color);if(t)return t;const i=shared.get(s.src,"anonymous",null);if(i.getImageState()!==ImageState.LOADED)return null;const n=createCanvasContext2D(s.size[0],s.size[1]);return n.drawImage(i.getImage(1),s.offset[0],s.offset[1],s.size[0],s.size[1],0,0,s.size[0],s.size[1]),get(n.canvas,e,void 0,ImageState.LOADED,s.color,!0),shared.getPattern(e,void 0,s.color)}const defaultFont="10px sans-serif",defaultFillStyle="#000",defaultLineCap="round",defaultLineDash=[],defaultLineDashOffset=0,defaultLineJoin="round",defaultMiterLimit=10,defaultStrokeStyle="#000",defaultTextAlign="center",defaultTextBaseline="middle",defaultPadding=[0,0,0,0],defaultLineWidth=1,checkedFonts=new BaseObject;let measureContext=null,measureFont;const textHeights={},genericFontFamilies=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function getFontKey(s,e,t){return`${s} ${e} 16px "${t}"`}const registerFont=function(){let e,t;async function i(r){await t.ready;const o=await t.load(r);if(o.length===0)return!1;const a=getFontParameters(r),l=a.families[0].toLowerCase(),c=a.weight;return o.some(h=>{const u=h.family.replace(/^['"]|['"]$/g,"").toLowerCase(),d=fontWeights[h.weight]||h.weight;return u===l&&h.style===a.style&&d==c})}async function n(){await t.ready;let r=!0;const o=checkedFonts.getProperties(),a=Object.keys(o).filter(l=>o[l]<100);for(let l=a.length-1;l>=0;--l){const c=a[l];let h=o[c];h<100&&(await i(c)?(clear(textHeights),checkedFonts.set(c,100)):(h+=10,checkedFonts.set(c,h,!0),h<100&&(r=!1)))}e=void 0,r||(e=setTimeout(n,100))}return async function(r){t||(t=WORKER_OFFSCREEN_CANVAS?self.fonts:document.fonts);const o=getFontParameters(r);if(!o)return;const a=o.families;let l=!1;for(const c of a){if(genericFontFamilies.has(c))continue;const h=getFontKey(o.style,o.weight,c);checkedFonts.get(h)===void 0&&(checkedFonts.set(h,0,!0),l=!0)}l&&(clearTimeout(e),e=setTimeout(n,100))}}(),measureTextHeight=function(){let s;return function(e){let t=textHeights[e];if(t==null){if(WORKER_OFFSCREEN_CANVAS){const i=getFontParameters(e),n=measureText(e,"Žg");t=(isNaN(Number(i.lineHeight))?1.2:Number(i.lineHeight))*(n.actualBoundingBoxAscent+n.actualBoundingBoxDescent)}else s||(s=document.createElement("div"),s.innerHTML="M",s.style.minHeight="0",s.style.maxHeight="none",s.style.height="auto",s.style.padding="0",s.style.border="none",s.style.position="absolute",s.style.display="block",s.style.left="-99999px"),s.style.font=e,document.body.appendChild(s),t=s.offsetHeight,document.body.removeChild(s);textHeights[e]=t}return t}}();function measureText(s,e){return measureContext||(measureContext=createCanvasContext2D(1,1)),s!=measureFont&&(measureContext.font=s,measureFont=measureContext.font),measureContext.measureText(e)}function measureTextWidth(s,e){return measureText(s,e).width}function measureAndCacheTextWidth(s,e,t){if(e in t)return t[e];const i=e.split(`
|
|
2
|
+
`).reduce((n,r)=>Math.max(n,measureTextWidth(s,r)),0);return t[e]=i,i}function getTextDimensions(s,e){const t=[],i=[],n=[];let r=0,o=0,a=0,l=0;for(let c=0,h=e.length;c<=h;c+=2){const u=e[c];if(u===`
|
|
3
|
+
`||c===h){r=Math.max(r,o),n.push(o),o=0,a+=l,l=0;continue}const d=e[c+1]||s.font,g=measureTextWidth(d,u);t.push(g),o+=g;const f=measureTextHeight(d);i.push(f),l=Math.max(l,f)}return{width:r,height:a,widths:t,heights:i,lineWidths:n}}function drawImageOrLabel(s,e,t,i,n,r,o,a,l,c,h){s.save(),t!==1&&(s.globalAlpha===void 0?s.globalAlpha=u=>u.globalAlpha*=t:s.globalAlpha*=t),e&&s.transform.apply(s,e),i.contextInstructions?(s.translate(l,c),s.scale(h[0],h[1]),executeLabelInstructions(i,s)):h[0]<0||h[1]<0?(s.translate(l,c),s.scale(h[0],h[1]),s.drawImage(i,n,r,o,a,0,0,o,a)):s.drawImage(i,n,r,o,a,l,c,o*h[0],a*h[1]),s.restore()}function executeLabelInstructions(s,e){const t=s.contextInstructions;for(let i=0,n=t.length;i<n;i+=2)Array.isArray(t[i+1])?e[t[i]].apply(e,t[i+1]):e[t[i]]=t[i+1]}class ImageStyle{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=toSize(e.scale),this.displacement_=e.displacement,this.declutterMode_=e.declutterMode}clone(){const e=this.getScale();return new ImageStyle({opacity:this.getOpacity(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return abstract()}getImage(e){return abstract()}getHitDetectionImage(){return abstract()}getPixelRatio(e){return 1}getImageState(){return abstract()}getImageSize(){return abstract()}getOrigin(){return abstract()}getSize(){return abstract()}setDisplacement(e){this.displacement_=e}setOpacity(e){this.opacity_=e}setRotateWithView(e){this.rotateWithView_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=toSize(e)}listenImageChange(e){abstract()}load(){abstract()}unlistenImageChange(e){abstract()}ready(){return Promise.resolve()}}class RegularShape extends ImageStyle{constructor(e){super({opacity:1,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,rotation:e.rotation!==void 0?e.rotation:0,scale:e.scale!==void 0?e.scale:1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=e.fill!==void 0?e.fill:null,this.origin_=[0,0],this.points_=e.points,this.radius=e.radius,this.radius2_=e.radius2,this.angle_=e.angle!==void 0?e.angle:0,this.stroke_=e.stroke!==void 0?e.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?ImageState.LOADING:ImageState.LOADED,this.imageState_===ImageState.LOADING&&this.ready().then(()=>this.imageState_=ImageState.LOADED),this.render()}clone(){const e=this.getScale(),t=new RegularShape({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}getAnchor(){const e=this.size_,t=this.getDisplacement(),i=this.getScaleArray();return[e[0]/2-t[0]/i[0],e[1]/2+t[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(e){var r,o;const t=(r=this.fill_)==null?void 0:r.getKey(),i=`${e},${this.angle_},${this.radius},${this.radius2_},${this.points_},${t}`+Object.values(this.renderOptions_).join(",");let n=(o=shared.get(i,null,null))==null?void 0:o.getImage(1);if(!n){const a=this.renderOptions_,l=Math.ceil(a.size*e),c=createCanvasContext2D(l,l);this.draw_(a,c,e),n=c.canvas,shared.set(i,null,null,new IconImage(n,void 0,null,ImageState.LOADED,null))}return n}getPixelRatio(e){return e}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(e){this.stroke_=e,this.render()}listenImageChange(e){}load(){}unlistenImageChange(e){}calculateLineJoinSize_(e,t,i){if(t===0||this.points_===1/0||e!=="bevel"&&e!=="miter")return t;let n=this.radius,r=this.radius2_===void 0?n:this.radius2_;if(n<r){const T=n;n=r,r=T}const o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=r*Math.sin(a),c=Math.sqrt(r*r-l*l),h=n-c,u=Math.sqrt(l*l+h*h),d=u/l;if(e==="miter"&&d<=i)return d*t;const g=t/2/d,f=t/2*(h/u),p=Math.sqrt((n+g)*(n+g)+f*f)-n;if(this.radius2_===void 0||e==="bevel")return p*2;const _=n*Math.sin(a),y=Math.sqrt(n*n-_*_),A=r-y,C=Math.sqrt(_*_+A*A)/_;if(C<=i){const T=C*t/2-r-n;return 2*Math.max(p,T)}return p*2}createRenderOptions(){let e=defaultLineCap,t=defaultLineJoin,i=0,n=null,r=0,o,a=0;this.stroke_&&(o=asColorLike(this.stroke_.getColor()??defaultStrokeStyle),a=this.stroke_.getWidth()??defaultLineWidth,n=this.stroke_.getLineDash(),r=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??defaultLineJoin,e=this.stroke_.getLineCap()??defaultLineCap,i=this.stroke_.getMiterLimit()??defaultMiterLimit);const l=this.calculateLineJoinSize_(t,a,i),c=Math.max(this.radius,this.radius2_||0),h=Math.ceil(2*c+l);return{strokeStyle:o,strokeWidth:a,size:h,lineCap:e,lineDash:n,lineDashOffset:r,lineJoin:t,miterLimit:i}}render(){this.renderOptions_=this.createRenderOptions();const e=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[e,e]}draw_(e,t,i){if(t.scale(i,i),t.translate(e.size/2,e.size/2),this.createPath_(t),this.fill_){let n=this.fill_.getColor();n===null&&(n=defaultFillStyle),t.fillStyle=asColorLike(n),t.fill()}e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineCap=e.lineCap,t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}createHitDetectionCanvas_(e){let t;if(this.fill_){let i=this.fill_.getColor(),n=0;typeof i=="string"&&(i=asArray(i)),i===null?n=1:Array.isArray(i)&&(n=i.length===4?i[3]:1),n===0&&(t=createCanvasContext2D(e.size,e.size),this.drawHitDetectionCanvas_(e,t))}return t?t.canvas:this.getImage(1)}createPath_(e){let t=this.points_;const i=this.radius;if(t===1/0)e.arc(0,0,i,0,2*Math.PI);else{const n=this.radius2_===void 0?i:this.radius2_;this.radius2_!==void 0&&(t*=2);const r=this.angle_-Math.PI/2,o=2*Math.PI/t;for(let a=0;a<t;a++){const l=r+a*o,c=a%2===0?i:n;e.lineTo(c*Math.cos(l),c*Math.sin(l))}e.closePath()}}drawHitDetectionCanvas_(e,t){t.translate(e.size/2,e.size/2),this.createPath_(t),t.fillStyle=defaultFillStyle,t.fill(),e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}}class CircleStyle extends RegularShape{constructor(e){e=e||{radius:5},super({points:1/0,fill:e.fill,radius:e.radius,stroke:e.stroke,scale:e.scale!==void 0?e.scale:1,rotation:e.rotation!==void 0?e.rotation:0,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode})}clone(){const e=this.getScale(),t=new CircleStyle({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}setRadius(e){this.radius=e,this.render()}}class Fill{constructor(e){e=e||{},this.patternImage_=null,this.color_=null,e.color!==void 0&&this.setColor(e.color)}clone(){const e=this.getColor();return new Fill({color:Array.isArray(e)?e.slice():e||void 0})}getColor(){return this.color_}setColor(e){if(e!==null&&typeof e=="object"&&"src"in e){const t=get(null,e.src,"anonymous",void 0,e.offset?null:e.color?e.color:null,!(e.offset&&e.size));t.ready().then(()=>{this.patternImage_=null}),t.getImageState()===ImageState.IDLE&&t.load(),t.getImageState()===ImageState.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){const e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?getUid(e):typeof e=="object"&&"src"in e?e.src+":"+e.offset:asArray(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}function calculateScale(s,e,t,i){return t!==void 0&&i!==void 0?[t/s,i/e]:t!==void 0?t/s:i!==void 0?i/e:1}class Icon extends ImageStyle{constructor(e){e=e||{};const t=e.opacity!==void 0?e.opacity:1,i=e.rotation!==void 0?e.rotation:0,n=e.scale!==void 0?e.scale:1,r=e.rotateWithView!==void 0?e.rotateWithView:!1;super({opacity:t,rotation:i,scale:n,displacement:e.displacement!==void 0?e.displacement:[0,0],rotateWithView:r,declutterMode:e.declutterMode}),this.anchor_=e.anchor!==void 0?e.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=e.anchorOrigin!==void 0?e.anchorOrigin:"top-left",this.anchorXUnits_=e.anchorXUnits!==void 0?e.anchorXUnits:"fraction",this.anchorYUnits_=e.anchorYUnits!==void 0?e.anchorYUnits:"fraction",this.crossOrigin_=e.crossOrigin!==void 0?e.crossOrigin:null;const o=e.img!==void 0?e.img:null;let a=e.src;assert(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||getUid(o)),assert(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),assert(!((e.width!==void 0||e.height!==void 0)&&e.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(e.src!==void 0?l=ImageState.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?ImageState.LOADED:ImageState.IDLE:l=ImageState.LOADING:l=ImageState.LOADED),this.color_=e.color!==void 0?asArray(e.color):null,this.iconImage_=get(o,a,this.crossOrigin_,l,this.color_),this.offset_=e.offset!==void 0?e.offset:[0,0],this.offsetOrigin_=e.offsetOrigin!==void 0?e.offsetOrigin:"top-left",this.origin_=null,this.size_=e.size!==void 0?e.size:null,this.initialOptions_,e.width!==void 0||e.height!==void 0){let c,h;if(e.size)[c,h]=e.size;else{const u=this.getImage(1);if(u.width&&u.height)c=u.width,h=u.height;else if(u instanceof HTMLImageElement){this.initialOptions_=e;const d=()=>{if(this.unlistenImageChange(d),!this.initialOptions_)return;const g=this.iconImage_.getSize();this.setScale(calculateScale(g[0],g[1],e.width,e.height))};this.listenImageChange(d);return}}c!==void 0&&this.setScale(calculateScale(c,h,e.width,e.height))}}clone(){let e,t,i;return this.initialOptions_?(t=this.initialOptions_.width,i=this.initialOptions_.height):(e=this.getScale(),e=Array.isArray(e)?e.slice():e),new Icon({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:e,width:t,height:i,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let e=this.normalizedAnchor_;if(!e){e=this.anchor_;const n=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!n)return null;e=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(e[0]*=n[0]),this.anchorYUnits_=="fraction"&&(e[1]*=n[1])}if(this.anchorOrigin_!="top-left"){if(!n)return null;e===this.anchor_&&(e=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(e[0]=-e[0]+n[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(e[1]=-e[1]+n[1])}this.normalizedAnchor_=e}const t=this.getDisplacement(),i=this.getScaleArray();return[e[0]-t[0]/i[0],e[1]+t[1]/i[1]]}setAnchor(e){this.anchor_=e,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(e){return this.iconImage_.getImage(e)}getPixelRatio(e){return this.iconImage_.getPixelRatio(e)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let e=this.offset_;if(this.offsetOrigin_!="top-left"){const t=this.getSize(),i=this.iconImage_.getSize();if(!t||!i)return null;e=e.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(e[0]=i[0]-t[0]-e[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(e[1]=i[1]-t[1]-e[1])}return this.origin_=e,this.origin_}getSrc(){return this.iconImage_.getSrc()}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const e=this.getScaleArray();if(this.size_)return this.size_[0]*e[0];if(this.iconImage_.getImageState()==ImageState.LOADED)return this.iconImage_.getSize()[0]*e[0]}getHeight(){const e=this.getScaleArray();if(this.size_)return this.size_[1]*e[1];if(this.iconImage_.getImageState()==ImageState.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(EventType.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(EventType.CHANGE,e)}ready(){return this.iconImage_.ready()}}class Stroke{constructor(e){e=e||{},this.color_=e.color!==void 0?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=e.lineDash!==void 0?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.width_=e.width}clone(){const e=this.getColor();return new Stroke({color:Array.isArray(e)?e.slice():e||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),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(e){this.color_=e}setLineCap(e){this.lineCap_=e}setLineDash(e){this.lineDash_=e}setLineDashOffset(e){this.lineDashOffset_=e}setLineJoin(e){this.lineJoin_=e}setMiterLimit(e){this.miterLimit_=e}setWidth(e){this.width_=e}}class Style{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=defaultGeometryFunction,e.geometry!==void 0&&this.setGeometry(e.geometry),this.fill_=e.fill!==void 0?e.fill:null,this.image_=e.image!==void 0?e.image:null,this.renderer_=e.renderer!==void 0?e.renderer:null,this.hitDetectionRenderer_=e.hitDetectionRenderer!==void 0?e.hitDetectionRenderer:null,this.stroke_=e.stroke!==void 0?e.stroke:null,this.text_=e.text!==void 0?e.text:null,this.zIndex_=e.zIndex}clone(){let e=this.getGeometry();return e&&typeof e=="object"&&(e=e.clone()),new Style({geometry:e??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(e){this.renderer_=e}setHitDetectionRenderer(e){this.hitDetectionRenderer_=e}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(e){this.fill_=e}getImage(){return this.image_}setImage(e){this.image_=e}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e}getText(){return this.text_}setText(e){this.text_=e}getZIndex(){return this.zIndex_}setGeometry(e){typeof e=="function"?this.geometryFunction_=e:typeof e=="string"?this.geometryFunction_=function(t){return t.get(e)}:e?e!==void 0&&(this.geometryFunction_=function(){return e}):this.geometryFunction_=defaultGeometryFunction,this.geometry_=e}setZIndex(e){this.zIndex_=e}}function toFunction(s){let e;if(typeof s=="function")e=s;else{let t;Array.isArray(s)?t=s:(assert(typeof s.getZIndex=="function","Expected an `Style` or an array of `Style`"),t=[s]),e=function(){return t}}return e}let defaultStyles=null;function createDefaultStyle(s,e){if(!defaultStyles){const t=new Fill({color:"rgba(255,255,255,0.4)"}),i=new Stroke({color:"#3399CC",width:1.25});defaultStyles=[new Style({image:new CircleStyle({fill:t,stroke:i,radius:5}),fill:t,stroke:i})]}return defaultStyles}function defaultGeometryFunction(s){return s.getGeometry()}const DEFAULT_FILL_COLOR="#333";class Text{constructor(e){e=e||{},this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.keepUpright_=e.keepUpright,this.scale_=e.scale,this.scaleArray_=toSize(e.scale!==void 0?e.scale:1),this.text_=e.text,this.textAlign_=e.textAlign,this.justify_=e.justify,this.repeat_=e.repeat,this.textBaseline_=e.textBaseline,this.fill_=e.fill!==void 0?e.fill:new Fill({color:DEFAULT_FILL_COLOR}),this.maxAngle_=e.maxAngle!==void 0?e.maxAngle:Math.PI/4,this.placement_=e.placement!==void 0?e.placement:"point",this.overflow_=!!e.overflow,this.stroke_=e.stroke!==void 0?e.stroke:null,this.offsetX_=e.offsetX!==void 0?e.offsetX:0,this.offsetY_=e.offsetY!==void 0?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=e.padding===void 0?null:e.padding,this.declutterMode_=e.declutterMode}clone(){const e=this.getScale();return new Text({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(e)?e.slice():e,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(e){this.overflow_=e}setFont(e){this.font_=e}setMaxAngle(e){this.maxAngle_=e}setOffsetX(e){this.offsetX_=e}setOffsetY(e){this.offsetY_=e}setPlacement(e){this.placement_=e}setRepeat(e){this.repeat_=e}setRotateWithView(e){this.rotateWithView_=e}setKeepUpright(e){this.keepUpright_=e}setFill(e){this.fill_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=toSize(e!==void 0?e:1)}setStroke(e){this.stroke_=e}setText(e){this.text_=e}setTextAlign(e){this.textAlign_=e}setJustify(e){this.justify_=e}setTextBaseline(e){this.textBaseline_=e}setBackgroundFill(e){this.backgroundFill_=e}setBackgroundStroke(e){this.backgroundStroke_=e}setPadding(e){this.padding_=e}}function always(s){return!0}function rulesToStyleFunction(s){const e=newParsingContext(),t=buildRuleSet(s,e),i=newEvaluationContext();return function(n,r){if(i.properties=n.getPropertiesInternal(),i.resolution=r,e.featureId){const o=n.getId();o!==void 0?i.featureId=o:i.featureId=null}return e.geometryType&&(i.geometryType=computeGeometryType(n.getGeometry())),t(i)}}function flatStylesToStyleFunction(s){const e=newParsingContext(),t=s.length,i=new Array(t);for(let o=0;o<t;++o)i[o]=buildStyle(s[o],e);const n=newEvaluationContext(),r=new Array(t);return function(o,a){if(n.properties=o.getPropertiesInternal(),n.resolution=a,e.featureId){const c=o.getId();c!==void 0?n.featureId=c:n.featureId=null}let l=0;for(let c=0;c<t;++c){const h=i[c](n);h&&(r[l]=h,l+=1)}return r.length=l,r}}function buildRuleSet(s,e){const t=s.length,i=new Array(t);for(let n=0;n<t;++n){const r=s[n],o="filter"in r?buildExpression(r.filter,BooleanType,e):always;let a;if(Array.isArray(r.style)){const l=r.style.length;a=new Array(l);for(let c=0;c<l;++c)a[c]=buildStyle(r.style[c],e)}else a=[buildStyle(r.style,e)];i[n]={filter:o,styles:a}}return function(n){const r=[];let o=!1;for(let a=0;a<t;++a){const l=i[a].filter;if(l(n)&&!(s[a].else&&o)){o=!0;for(const c of i[a].styles){const h=c(n);h&&r.push(h)}}}return r}}function buildStyle(s,e){const t=buildFill(s,"",e),i=buildStroke(s,"",e),n=buildText(s,e),r=buildImage(s,e),o=numberEvaluator(s,"z-index",e);if(!t&&!i&&!n&&!r&&!isEmpty$1(s))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(s));const a=new Style;return function(l){let c=!0;if(t){const h=t(l);h&&(c=!1),a.setFill(h)}if(i){const h=i(l);h&&(c=!1),a.setStroke(h)}if(n){const h=n(l);h&&(c=!1),a.setText(h)}if(r){const h=r(l);h&&(c=!1),a.setImage(h)}return o&&a.setZIndex(o(l)),c?null:a}}function buildFill(s,e,t){let i;if(e+"fill-pattern-src"in s)i=patternEvaluator(s,e+"fill-",t);else{if(s[e+"fill-color"]==="none")return r=>null;i=colorLikeEvaluator(s,e+"fill-color",t)}if(!i)return null;const n=new Fill;return function(r){const o=i(r);return o===NO_COLOR?null:(n.setColor(o),n)}}function buildStroke(s,e,t){const i=numberEvaluator(s,e+"stroke-width",t),n=colorLikeEvaluator(s,e+"stroke-color",t);if(!i&&!n)return null;const r=stringEvaluator(s,e+"stroke-line-cap",t),o=stringEvaluator(s,e+"stroke-line-join",t),a=numberArrayEvaluator(s,e+"stroke-line-dash",t),l=numberEvaluator(s,e+"stroke-line-dash-offset",t),c=numberEvaluator(s,e+"stroke-miter-limit",t),h=new Stroke;return function(u){if(n){const d=n(u);if(d===NO_COLOR)return null;h.setColor(d)}if(i&&h.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");h.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");h.setLineJoin(d)}return a&&h.setLineDash(a(u)),l&&h.setLineDashOffset(l(u)),c&&h.setMiterLimit(c(u)),h}}function buildText(s,e){const t="text-",i=stringEvaluator(s,t+"value",e);if(!i)return null;const n=buildFill(s,t,e),r=buildFill(s,t+"background-",e),o=buildStroke(s,t,e),a=buildStroke(s,t+"background-",e),l=stringEvaluator(s,t+"font",e),c=numberEvaluator(s,t+"max-angle",e),h=numberEvaluator(s,t+"offset-x",e),u=numberEvaluator(s,t+"offset-y",e),d=booleanEvaluator(s,t+"overflow",e),g=stringEvaluator(s,t+"placement",e),f=numberEvaluator(s,t+"repeat",e),m=sizeLikeEvaluator(s,t+"scale",e),p=booleanEvaluator(s,t+"rotate-with-view",e),_=numberEvaluator(s,t+"rotation",e),y=stringEvaluator(s,t+"align",e),A=stringEvaluator(s,t+"justify",e),x=stringEvaluator(s,t+"baseline",e),C=booleanEvaluator(s,t+"keep-upright",e),T=numberArrayEvaluator(s,t+"padding",e),S=optionalDeclutterMode(s,t+"declutter-mode"),w=new Text({declutterMode:S});return function(I){if(w.setText(i(I)),n&&w.setFill(n(I)),r&&w.setBackgroundFill(r(I)),o&&w.setStroke(o(I)),a&&w.setBackgroundStroke(a(I)),l&&w.setFont(l(I)),c&&w.setMaxAngle(c(I)),h&&w.setOffsetX(h(I)),u&&w.setOffsetY(u(I)),d&&w.setOverflow(d(I)),g){const L=g(I);if(L!=="point"&&L!=="line")throw new Error("Expected point or line for text-placement");w.setPlacement(L)}if(f&&w.setRepeat(f(I)),m&&w.setScale(m(I)),p&&w.setRotateWithView(p(I)),_&&w.setRotation(_(I)),y){const L=y(I);if(L!=="left"&&L!=="center"&&L!=="right"&&L!=="end"&&L!=="start")throw new Error("Expected left, right, center, start, or end for text-align");w.setTextAlign(L)}if(A){const L=A(I);if(L!=="left"&&L!=="right"&&L!=="center")throw new Error("Expected left, right, or center for text-justify");w.setJustify(L)}if(x){const L=x(I);if(L!=="bottom"&&L!=="top"&&L!=="middle"&&L!=="alphabetic"&&L!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");w.setTextBaseline(L)}return T&&w.setPadding(T(I)),C&&w.setKeepUpright(C(I)),w}}function buildImage(s,e){return"icon-src"in s?buildIcon(s,e):"shape-points"in s?buildShape(s,e):"circle-radius"in s?buildCircle(s,e):null}function buildIcon(s,e){const t="icon-",i=t+"src",n=requireString(s[i],i),r=coordinateEvaluator(s,t+"anchor",e),o=sizeLikeEvaluator(s,t+"scale",e),a=numberEvaluator(s,t+"opacity",e),l=coordinateEvaluator(s,t+"displacement",e),c=numberEvaluator(s,t+"rotation",e),h=booleanEvaluator(s,t+"rotate-with-view",e),u=optionalIconOrigin(s,t+"anchor-origin"),d=optionalIconAnchorUnits(s,t+"anchor-x-units"),g=optionalIconAnchorUnits(s,t+"anchor-y-units"),f=optionalColorLike(s,t+"color"),m=optionalString(s,t+"cross-origin"),p=optionalNumberArray(s,t+"offset"),_=optionalIconOrigin(s,t+"offset-origin"),y=optionalNumber(s,t+"width"),A=optionalNumber(s,t+"height"),x=optionalSize(s,t+"size"),C=optionalDeclutterMode(s,t+"declutter-mode"),T=new Icon({src:n,anchorOrigin:u,anchorXUnits:d,anchorYUnits:g,color:f,crossOrigin:m,offset:p,offsetOrigin:_,height:A,width:y,size:x,declutterMode:C});return function(S){return a&&T.setOpacity(a(S)),l&&T.setDisplacement(l(S)),c&&T.setRotation(c(S)),h&&T.setRotateWithView(h(S)),o&&T.setScale(o(S)),r&&T.setAnchor(r(S)),T}}function buildShape(s,e){const t="shape-",i=t+"points",n=t+"radius",r=requireNumber(s[i],i),o=requireNumber(s[n],n),a=buildFill(s,t,e),l=buildStroke(s,t,e),c=sizeLikeEvaluator(s,t+"scale",e),h=coordinateEvaluator(s,t+"displacement",e),u=numberEvaluator(s,t+"rotation",e),d=booleanEvaluator(s,t+"rotate-with-view",e),g=optionalNumber(s,t+"radius2"),f=optionalNumber(s,t+"angle"),m=optionalDeclutterMode(s,t+"declutter-mode"),p=new RegularShape({points:r,radius:o,radius2:g,angle:f,declutterMode:m});return function(_){return a&&p.setFill(a(_)),l&&p.setStroke(l(_)),h&&p.setDisplacement(h(_)),u&&p.setRotation(u(_)),d&&p.setRotateWithView(d(_)),c&&p.setScale(c(_)),p}}function buildCircle(s,e){const t="circle-",i=buildFill(s,t,e),n=buildStroke(s,t,e),r=numberEvaluator(s,t+"radius",e),o=sizeLikeEvaluator(s,t+"scale",e),a=coordinateEvaluator(s,t+"displacement",e),l=numberEvaluator(s,t+"rotation",e),c=booleanEvaluator(s,t+"rotate-with-view",e),h=optionalDeclutterMode(s,t+"declutter-mode"),u=new CircleStyle({radius:5,declutterMode:h});return function(d){return r&&u.setRadius(r(d)),i&&u.setFill(i(d)),n&&u.setStroke(n(d)),a&&u.setDisplacement(a(d)),l&&u.setRotation(l(d)),c&&u.setRotateWithView(c(d)),o&&u.setScale(o(d)),u}}function numberEvaluator(s,e,t){if(!(e in s))return;const i=buildExpression(s[e],NumberType,t);return function(n){return requireNumber(i(n),e)}}function stringEvaluator(s,e,t){if(!(e in s))return null;const i=buildExpression(s[e],StringType,t);return function(n){return requireString(i(n),e)}}function patternEvaluator(s,e,t){const i=stringEvaluator(s,e+"pattern-src",t),n=sizeEvaluator(s,e+"pattern-offset",t),r=sizeEvaluator(s,e+"pattern-size",t),o=colorLikeEvaluator(s,e+"color",t);return function(a){return{src:i(a),offset:n&&n(a),size:r&&r(a),color:o&&o(a)}}}function booleanEvaluator(s,e,t){if(!(e in s))return null;const i=buildExpression(s[e],BooleanType,t);return function(n){const r=i(n);if(typeof r!="boolean")throw new Error(`Expected a boolean for ${e}`);return r}}function colorLikeEvaluator(s,e,t){if(!(e in s))return null;const i=buildExpression(s[e],ColorType,t);return function(n){return requireColorLike(i(n),e)}}function numberArrayEvaluator(s,e,t){if(!(e in s))return null;const i=buildExpression(s[e],NumberArrayType,t);return function(n){return requireNumberArray(i(n),e)}}function coordinateEvaluator(s,e,t){if(!(e in s))return null;const i=buildExpression(s[e],NumberArrayType,t);return function(n){const r=requireNumberArray(i(n),e);if(r.length!==2)throw new Error(`Expected two numbers for ${e}`);return r}}function sizeEvaluator(s,e,t){if(!(e in s))return null;const i=buildExpression(s[e],NumberArrayType,t);return function(n){return requireSize(i(n),e)}}function sizeLikeEvaluator(s,e,t){if(!(e in s))return null;const i=buildExpression(s[e],NumberArrayType|NumberType,t);return function(n){return requireSizeLike(i(n),e)}}function optionalNumber(s,e){const t=s[e];if(t!==void 0){if(typeof t!="number")throw new Error(`Expected a number for ${e}`);return t}}function optionalSize(s,e){const t=s[e];if(t!==void 0){if(typeof t=="number")return toSize(t);if(!Array.isArray(t))throw new Error(`Expected a number or size array for ${e}`);if(t.length!==2||typeof t[0]!="number"||typeof t[1]!="number")throw new Error(`Expected a number or size array for ${e}`);return t}}function optionalString(s,e){const t=s[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);return t}}function optionalIconOrigin(s,e){const t=s[e];if(t!==void 0){if(t!=="bottom-left"&&t!=="bottom-right"&&t!=="top-left"&&t!=="top-right")throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return t}}function optionalIconAnchorUnits(s,e){const t=s[e];if(t!==void 0){if(t!=="pixels"&&t!=="fraction")throw new Error(`Expected pixels or fraction for ${e}`);return t}}function optionalNumberArray(s,e){const t=s[e];if(t!==void 0)return requireNumberArray(t,e)}function optionalDeclutterMode(s,e){const t=s[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);if(t!=="declutter"&&t!=="obstacle"&&t!=="none")throw new Error(`Expected declutter, obstacle, or none for ${e}`);return t}}function optionalColorLike(s,e){const t=s[e];if(t!==void 0)return requireColorLike(t,e)}function requireNumberArray(s,e){if(!Array.isArray(s))throw new Error(`Expected an array for ${e}`);const t=s.length;for(let i=0;i<t;++i)if(typeof s[i]!="number")throw new Error(`Expected an array of numbers for ${e}`);return s}function requireString(s,e){if(typeof s!="string")throw new Error(`Expected a string for ${e}`);return s}function requireNumber(s,e){if(typeof s!="number")throw new Error(`Expected a number for ${e}`);return s}function requireColorLike(s,e){if(typeof s=="string")return s;const t=requireNumberArray(s,e),i=t.length;if(i<3||i>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return t}function requireSize(s,e){const t=requireNumberArray(s,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function requireSizeLike(s,e){return typeof s=="number"?s:requireSize(s,e)}const Property$1={RENDER_ORDER:"renderOrder"};class BaseVectorLayer extends Layer{constructor(e){e=e||{};const t=Object.assign({},e);delete t.style,delete t.renderBuffer,delete t.updateWhileAnimating,delete t.updateWhileInteracting,super(t),this.declutter_=e.declutter?String(e.declutter):void 0,this.renderBuffer_=e.renderBuffer!==void 0?e.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(e.style),this.updateWhileAnimating_=e.updateWhileAnimating!==void 0?e.updateWhileAnimating:!1,this.updateWhileInteracting_=e.updateWhileInteracting!==void 0?e.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(e){return super.getFeatures(e)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(Property$1.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(e,t){const i=this.getDeclutter();i in e.declutter||(e.declutter[i]=new RBush$1(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(Property$1.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?createDefaultStyle:e;const t=toStyleLike(e);this.styleFunction_=e===null?void 0:toFunction(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}}function toStyleLike(s){if(s===void 0)return createDefaultStyle;if(!s)return null;if(typeof s=="function"||s instanceof Style)return s;if(!Array.isArray(s))return flatStylesToStyleFunction([s]);if(s.length===0)return[];const e=s.length,t=s[0];if(t instanceof Style){const n=new Array(e);for(let r=0;r<e;++r){const o=s[r];if(!(o instanceof Style))throw new Error("Expected a list of style instances");n[r]=o}return n}if("style"in t){const n=new Array(e);for(let r=0;r<e;++r){const o=s[r];if(!("style"in o))throw new Error("Expected a list of rules with a style property");n[r]=o}return rulesToStyleFunction(n)}return flatStylesToStyleFunction(s)}class RenderEvent extends BaseEvent{constructor(e,t,i,n){super(e),this.inversePixelTransform=t,this.frameState=i,this.context=n}}class MapRenderer extends Disposable{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){abstract()}calculateMatrices2D(e){const t=e.viewState,i=e.coordinateToPixelTransform,n=e.pixelToCoordinateTransform;compose(i,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),makeInverse(n,i)}forEachFeatureAtCoordinate(e,t,i,n,r,o,a,l){let c;const h=t.viewState;function u(x,C,T,S){return r.call(o,C,x?T:null,S)}const d=h.projection,g=wrapX$1(e.slice(),d),f=[[0,0]];if(d.canWrapX()&&n){const x=d.getExtent(),C=getWidth(x);f.push([-C,0],[C,0])}const m=t.layerStatesArray,p=m.length,_=[],y=[];for(let x=0;x<f.length;x++)for(let C=p-1;C>=0;--C){const T=m[C],S=T.layer;if(S.hasRenderer()&&inView(T,h)&&a.call(l,S)){const w=S.getRenderer(),I=S.getSource();if(w&&I){const L=I.getWrapX()?g:e,D=u.bind(null,T.managed);y[0]=L[0]+f[x][0],y[1]=L[1]+f[x][1],c=w.forEachFeatureAtCoordinate(y,t,i,D,_)}if(c)return c}}if(_.length===0)return;const A=1/_.length;return _.forEach((x,C)=>x.distanceSq+=C*A),_.sort((x,C)=>x.distanceSq-C.distanceSq),_.some(x=>c=x.callback(x.feature,x.layer,x.geometry)),c}hasFeatureAtCoordinate(e,t,i,n,r,o){return this.forEachFeatureAtCoordinate(e,t,i,n,TRUE,this,r,o)!==void 0}getMap(){return this.map_}renderFrame(e){abstract()}scheduleExpireIconCache(e){shared.canExpireCache()&&e.postRenderFunctions.push(expireIconCache)}}function expireIconCache(s,e){shared.expire()}class CompositeMapRenderer extends MapRenderer{constructor(e){super(e),this.fontChangeListenerKey_=listen(checkedFonts,ObjectEventType.PROPERTYCHANGE,e.redrawText,e),this.element_=document.createElement("div");const t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=CLASS_UNSELECTABLE+" ol-layers";const i=e.getViewport();i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(e,t){const i=this.getMap();if(i.hasListener(e)){const n=new RenderEvent(e,void 0,t);i.dispatchEvent(n)}}disposeInternal(){unlistenByKey(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(e){if(!e){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(e),this.dispatchRenderEvent(RenderEventType.PRECOMPOSE,e);const t=e.layerStatesArray.sort((a,l)=>a.zIndex-l.zIndex);t.some(a=>a.layer instanceof BaseVectorLayer&&a.layer.getDeclutter())&&(e.declutter={});const n=e.viewState;this.children_.length=0;const r=[];let o=null;for(let a=0,l=t.length;a<l;++a){const c=t[a];e.layerIndex=a;const h=c.layer,u=h.getSourceState();if(!inView(c,n)||u!="ready"&&u!="undefined"){h.unrender();continue}const d=h.render(e,o);d&&(d!==o&&(this.children_.push(d),o=d),r.push(c))}this.declutter(e,r),replaceChildren(this.element_,this.children_),this.dispatchRenderEvent(RenderEventType.POSTCOMPOSE,e),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(e)}declutter(e,t){if(e.declutter){for(let i=t.length-1;i>=0;--i){const n=t[i],r=n.layer;r.getDeclutter()&&r.renderDeclutter(e,n)}t.forEach(i=>i.layer.renderDeferred(e))}}}function removeLayerMapProperty(s){if(s instanceof Layer){s.setMapInternal(null);return}s instanceof LayerGroup&&s.getLayers().forEach(removeLayerMapProperty)}function setLayerMapProperty(s,e){if(s instanceof Layer){s.setMapInternal(e);return}if(s instanceof LayerGroup){const t=s.getLayers().getArray();for(let i=0,n=t.length;i<n;++i)setLayerMapProperty(t[i],e)}}class Map extends BaseObject{constructor(e){super(),e=e||{},this.on,this.once,this.un;const t=createOptionsInternal(e);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=e.maxTilesLoading!==void 0?e.maxTilesLoading:16,this.pixelRatio_=e.pixelRatio!==void 0?e.pixelRatio:DEVICE_PIXEL_RATIO,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=create(),this.pixelToCoordinateTransform_=create(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_),this.mapBrowserEventHandler_=null,this.moveTolerance_=e.moveTolerance,this.keyboardEventTarget_=t.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,this.resizeObserver_=new ResizeObserver(()=>this.updateSize()),this.controls=t.controls||defaults$1(),this.interactions=t.interactions||defaults({onFocusOnly:!0}),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new TileQueue(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(MapProperty.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(MapProperty.VIEW,this.handleViewChanged_),this.addChangeListener(MapProperty.SIZE,this.handleSizeChanged_),this.addChangeListener(MapProperty.TARGET,this.handleTargetChanged_),this.setProperties(t.values);const i=this;e.view&&!(e.view instanceof View)&&e.view.then(function(n){i.setView(new View(n))}),this.controls.addEventListener(CollectionEventType.ADD,n=>{n.element.setMap(this)}),this.controls.addEventListener(CollectionEventType.REMOVE,n=>{n.element.setMap(null)}),this.interactions.addEventListener(CollectionEventType.ADD,n=>{n.element.setMap(this)}),this.interactions.addEventListener(CollectionEventType.REMOVE,n=>{n.element.setMap(null)}),this.overlays_.addEventListener(CollectionEventType.ADD,n=>{this.addOverlayInternal_(n.element)}),this.overlays_.addEventListener(CollectionEventType.REMOVE,n=>{const r=n.element.getId();r!==void 0&&delete this.overlayIdIndex_[r.toString()],n.element.setMap(null)}),this.controls.forEach(n=>{n.setMap(this)}),this.interactions.forEach(n=>{n.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(e){this.getControls().push(e)}addInteraction(e){this.getInteractions().push(e)}addLayer(e){this.getLayerGroup().getLayers().push(e)}handleLayerAdd_(e){setLayerMapProperty(e.layer,this)}addOverlay(e){this.getOverlays().push(e)}addOverlayInternal_(e){const t=e.getId();t!==void 0&&(this.overlayIdIndex_[t.toString()]=e),e.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(e,t,i){if(!this.frameState_||!this.renderer_)return;const n=this.getCoordinateFromPixelInternal(e);i=i!==void 0?i:{};const r=i.hitTolerance!==void 0?i.hitTolerance:0,o=i.layerFilter!==void 0?i.layerFilter:TRUE,a=i.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(n,this.frameState_,r,a,t,null,o,null)}getFeaturesAtPixel(e,t){const i=[];return this.forEachFeatureAtPixel(e,function(n){i.push(n)},t),i}getAllLayers(){const e=[];function t(i){i.forEach(function(n){n instanceof LayerGroup?t(n.getLayers()):e.push(n)})}return t(this.getLayers()),e}hasFeatureAtPixel(e,t){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(e);t=t!==void 0?t:{};const n=t.layerFilter!==void 0?t.layerFilter:TRUE,r=t.hitTolerance!==void 0?t.hitTolerance:0,o=t.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,r,o,n,null)}getEventCoordinate(e){return this.getCoordinateFromPixel(this.getEventPixel(e))}getEventCoordinateInternal(e){return this.getCoordinateFromPixelInternal(this.getEventPixel(e))}getEventPixel(e){const i=this.viewport_.getBoundingClientRect(),n=this.getSize(),r=i.width/n[0],o=i.height/n[1],a="changedTouches"in e?e.changedTouches[0]:e;return[(a.clientX-i.left)/r,(a.clientY-i.top)/o]}getTarget(){return this.get(MapProperty.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return toUserCoordinate(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){const t=this.frameState_;return t?apply(t.pixelToCoordinateTransform,e.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(e){const t=this.overlayIdIndex_[e.toString()];return t!==void 0?t:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(MapProperty.LAYERGROUP)}setLayers(e){const t=this.getLayerGroup();if(e instanceof Collection){t.setLayers(e);return}const i=t.getLayers();i.clear(),i.extend(e)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const e=this.getLayerGroup().getLayerStatesArray();for(let t=0,i=e.length;t<i;++t){const n=e[t];if(!n.visible)continue;const r=n.layer.getRenderer();if(r&&!r.ready)return!0;const o=n.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(e){const t=fromUserCoordinate(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){const t=this.frameState_;return t?apply(t.coordinateToPixelTransform,e.slice(0,2)):null}getRenderer(){return this.renderer_}getSize(){return this.get(MapProperty.SIZE)}getView(){return this.get(MapProperty.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const e=this.getTargetElement();return e?e.ownerDocument:document}getTilePriority(e,t,i,n){return getTilePriority(this.frameState_,e,t,i,n)}handleBrowserEvent(e,t){t=t||e.type;const i=new MapBrowserEvent(t,this,e);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(e){if(!this.frameState_)return;const t=e.originalEvent,i=t.type;if(i===PointerEventType.POINTERDOWN||i===EventType.WHEEL||i===EventType.KEYDOWN){const n=this.getOwnerDocument(),r=this.viewport_.getRootNode?this.viewport_.getRootNode():n,o=t.target,a=r instanceof ShadowRoot?r.host===o?r.host.ownerDocument:r:r===n?n.documentElement:r;if(this.overlayContainerStopEvent_.contains(o)||!a.contains(o))return}if(e.frameState=this.frameState_,this.dispatchEvent(e)!==!1){const n=this.getInteractions().getArray().slice();for(let r=n.length-1;r>=0;r--){const o=n[r];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(e)||e.propagationStopped)break}}}handlePostRender(){const e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let n=this.maxTilesLoading_,r=n;if(e){const o=e.viewHints;if(o[ViewHint.ANIMATING]||o[ViewHint.INTERACTING]){const a=Date.now()-e.time>8;n=a?0:8,r=a?0:2}}t.getTilesLoading()<n&&(t.reprioritize(),t.loadMoreTiles(n,r))}e&&this.renderer_&&!e.animate&&(this.renderComplete_?(this.hasListener(RenderEventType.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(RenderEventType.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new MapEvent(MapEventType.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new MapEvent(MapEventType.LOADSTART,this,e))));const i=this.postRenderFunctions_;if(e)for(let n=0,r=i.length;n<r;++n)i[n](this,e);i.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let i=0,n=this.targetChangeHandlerKeys_.length;i<n;++i)unlistenByKey(this.targetChangeHandlerKeys_[i]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(EventType.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(EventType.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_){this.resizeObserver_.unobserve(this.targetElement_);const i=this.targetElement_.getRootNode();i instanceof ShadowRoot&&this.resizeObserver_.unobserve(i.host),this.setSize(void 0)}const e=this.getTarget(),t=typeof e=="string"?document.getElementById(e):e;if(this.targetElement_=t,!t)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new CompositeMapRenderer(this)),this.mapBrowserEventHandler_=new MapBrowserEventHandler(this,this.moveTolerance_);for(const r in MapBrowserEventType)this.mapBrowserEventHandler_.addEventListener(MapBrowserEventType[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(EventType.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(EventType.WHEEL,this.boundHandleBrowserEvent_,PASSIVE_EVENT_LISTENERS?{passive:!1}:!1);let i;if(this.keyboardEventTarget_)i=this.keyboardEventTarget_;else{const r=t.getRootNode();i=r instanceof ShadowRoot?r.host:t}this.targetChangeHandlerKeys_=[listen(i,EventType.KEYDOWN,this.handleBrowserEvent,this),listen(i,EventType.KEYPRESS,this.handleBrowserEvent,this)];const n=t.getRootNode();n instanceof ShadowRoot&&this.resizeObserver_.observe(n.host),this.resizeObserver_.observe(t)}this.updateSize()}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(unlistenByKey(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(unlistenByKey(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=listen(e,ObjectEventType.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=listen(e,EventType.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(unlistenByKey),this.layerGroupPropertyListenerKeys_=null);const e=this.getLayerGroup();e&&(this.handleLayerAdd_(new GroupEvent("addlayer",e)),this.layerGroupPropertyListenerKeys_=[listen(e,ObjectEventType.PROPERTYCHANGE,this.render,this),listen(e,EventType.CHANGE,this.render,this),listen(e,"addlayer",this.handleLayerAdd_,this),listen(e,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;const e=this.frameState_.layerStatesArray;for(let t=0,i=e.length;t<i;++t){const n=e[t].layer;n.hasRenderer()&&n.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(e){return this.getControls().remove(e)}removeInteraction(e){return this.getInteractions().remove(e)}removeLayer(e){return this.getLayerGroup().getLayers().remove(e)}handleLayerRemove_(e){removeLayerMapProperty(e.layer)}removeOverlay(e){return this.getOverlays().remove(e)}renderFrame_(e){const t=this.getSize(),i=this.getView(),n=this.frameState_;let r=null;if(t!==void 0&&hasArea(t)&&i&&i.isDef()){const o=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=i.getState();if(r={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:getForViewAndSize(a.center,a.resolution,a.rotation,t),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:t,tileQueue:this.tileQueue_,time:e,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:getUid(this),renderTargets:{}},a.nextCenter&&a.nextResolution){const l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;r.nextExtent=getForViewAndSize(a.nextCenter,a.nextResolution,l,t)}}this.frameState_=r,this.renderer_.renderFrame(r),r&&(r.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,r.postRenderFunctions),n&&(!this.previousExtent_||!isEmpty(this.previousExtent_)&&!equals$1(r.extent,this.previousExtent_))&&(this.dispatchEvent(new MapEvent(MapEventType.MOVESTART,this,n)),this.previousExtent_=createOrUpdateEmpty(this.previousExtent_)),this.previousExtent_&&!r.viewHints[ViewHint.ANIMATING]&&!r.viewHints[ViewHint.INTERACTING]&&!equals$1(r.extent,this.previousExtent_)&&(this.dispatchEvent(new MapEvent(MapEventType.MOVEEND,this,r)),clone(r.extent,this.previousExtent_))),this.dispatchEvent(new MapEvent(MapEventType.POSTRENDER,this,r)),this.renderComplete_=(this.hasListener(MapEventType.LOADSTART)||this.hasListener(MapEventType.LOADEND)||this.hasListener(RenderEventType.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(e){const t=this.getLayerGroup();t&&this.handleLayerRemove_(new GroupEvent("removelayer",t)),this.set(MapProperty.LAYERGROUP,e)}setSize(e){this.set(MapProperty.SIZE,e)}setTarget(e){this.set(MapProperty.TARGET,e)}setView(e){if(!e||e instanceof View){this.set(MapProperty.VIEW,e);return}this.set(MapProperty.VIEW,new View);const t=this;e.then(function(i){t.setView(new View(i))})}updateSize(){const e=this.getTargetElement();let t;if(e){const n=getComputedStyle(e),r=e.offsetWidth-parseFloat(n.borderLeftWidth)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)-parseFloat(n.borderRightWidth),o=e.offsetHeight-parseFloat(n.borderTopWidth)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)-parseFloat(n.borderBottomWidth);!isNaN(r)&&!isNaN(o)&&(t=[Math.max(0,r),Math.max(0,o)],!hasArea(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&warn("No map visible because the map container's width or height are 0."))}const i=this.getSize();t&&(!i||!equals$2(t,i))&&(this.setSize(t),this.updateViewportSize_(t))}updateViewportSize_(e){const t=this.getView();t&&t.setViewportSize(e)}}function createOptionsInternal(s){let e=null;s.keyboardEventTarget!==void 0&&(e=typeof s.keyboardEventTarget=="string"?document.getElementById(s.keyboardEventTarget):s.keyboardEventTarget);const t={},i=s.layers&&typeof s.layers.getLayers=="function"?s.layers:new LayerGroup({layers:s.layers});t[MapProperty.LAYERGROUP]=i,t[MapProperty.TARGET]=s.target,t[MapProperty.VIEW]=s.view instanceof View?s.view:new View;let n;s.controls!==void 0&&(Array.isArray(s.controls)?n=new Collection(s.controls.slice()):(assert(typeof s.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),n=s.controls));let r;s.interactions!==void 0&&(Array.isArray(s.interactions)?r=new Collection(s.interactions.slice()):(assert(typeof s.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),r=s.interactions));let o;return s.overlays!==void 0?Array.isArray(s.overlays)?o=new Collection(s.overlays.slice()):(assert(typeof s.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=s.overlays):o=new Collection,{controls:n,interactions:r,keyboardEventTarget:e,overlays:o,values:t}}class Feature extends BaseObject{constructor(e){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),e)if(typeof e.getSimplifiedGeometry=="function"){const t=e;this.setGeometry(t)}else{const t=e;this.setProperties(t)}}clone(){const e=new Feature(this.hasProperties()?this.getProperties():null);e.setGeometryName(this.getGeometryName());const t=this.getGeometry();t&&e.setGeometry(t.clone());const i=this.getStyle();return i&&e.setStyle(i),e}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(unlistenByKey(this.geometryChangeKey_),this.geometryChangeKey_=null);const e=this.getGeometry();e&&(this.geometryChangeKey_=listen(e,EventType.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?createStyleFunction(e):void 0,this.changed()}setId(e){this.id_=e,this.changed()}setGeometryName(e){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=e,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}}function createStyleFunction(s){if(typeof s=="function")return s;let e;return Array.isArray(s)?e=s:(assert(typeof s.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[s]),function(){return e}}function interpolatePoint(s,e,t,i,n,r,o){let a,l;const c=(t-e)/i;if(c===1)a=e;else if(c===2)a=e,l=n;else if(c!==0){let h=s[e],u=s[e+1],d=0;const g=[0];for(let p=e+i;p<t;p+=i){const _=s[p],y=s[p+1];d+=Math.sqrt((_-h)*(_-h)+(y-u)*(y-u)),g.push(d),h=_,u=y}const f=n*d,m=binarySearch(g,f);m<0?(l=(f-g[-m-2])/(g[-m-1]-g[-m-2]),a=e+(-m-2)*i):a=e+m*i}o=o>1?o:2,r=r||new Array(o);for(let h=0;h<o;++h)r[h]=a===void 0?NaN:l===void 0?s[a+h]:lerp(s[a+h],s[a+i+h],l);return r}function lineStringCoordinateAtM(s,e,t,i,n,r){if(t==e)return null;let o;if(n<s[e+i-1])return r?(o=s.slice(e,e+i),o[i-1]=n,o):null;if(s[t-1]<n)return r?(o=s.slice(t-i,t),o[i-1]=n,o):null;if(n==s[e+i-1])return s.slice(e,e+i);let a=e/i,l=t/i;for(;a<l;){const d=a+l>>1;n<s[(d+1)*i-1]?l=d:a=d+1}const c=s[a*i-1];if(n==c)return s.slice((a-1)*i,(a-1)*i+i);const h=s[(a+1)*i-1],u=(n-c)/(h-c);o=[];for(let d=0;d<i-1;++d)o.push(lerp(s[(a-1)*i+d],s[a*i+d],u));return o.push(n),o}function lineStringsCoordinateAtM(s,e,t,i,n,r,o){if(o)return lineStringCoordinateAtM(s,e,t[t.length-1],i,n,r);let a;if(n<s[i-1])return r?(a=s.slice(0,i),a[i-1]=n,a):null;if(s[s.length-1]<n)return r?(a=s.slice(s.length-i),a[i-1]=n,a):null;for(let l=0,c=t.length;l<c;++l){const h=t[l];if(e!=h){if(n<s[e+i-1])return null;if(n<=s[h-1])return lineStringCoordinateAtM(s,e,h,i,n,!1);e=h}}return null}function lineStringLength(s,e,t,i){let n=s[e],r=s[e+1],o=0;for(let a=e+i;a<t;a+=i){const l=s[a],c=s[a+1];o+=Math.sqrt((l-n)*(l-n)+(c-r)*(c-r)),n=l,r=c}return o}class LineString extends SimpleGeometry{constructor(e,t){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendCoordinate(e){extend$2(this.flatCoordinates,e),this.changed()}clone(){const e=new LineString(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,i,n){return n<closestSquaredDistanceXY(this.getExtent(),e,t)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(maxSquaredDelta(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),assignClosestPoint(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,e,t,i,n))}forEachSegment(e){return forEach(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinateAtM(e,t){return this.layout!="XYM"&&this.layout!="XYZM"?null:(t=t!==void 0?t:!1,lineStringCoordinateAtM(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t))}getCoordinates(){return inflateCoordinates(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(e,t){return interpolatePoint(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,this.stride)}getLength(){return lineStringLength(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(e){const t=[];return t.length=douglasPeucker(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new LineString(t,"XY")}getType(){return"LineString"}intersectsExtent(e){return intersectsLineString(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,this.getExtent())}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=deflateCoordinates(this.flatCoordinates,0,e,this.stride),this.changed()}}class VectorContext{drawCustom(e,t,i,n,r){}drawGeometry(e){}setStyle(e){}drawCircle(e,t,i){}drawFeature(e,t,i){}drawGeometryCollection(e,t,i){}drawLineString(e,t,i){}drawMultiLineString(e,t,i){}drawMultiPoint(e,t,i){}drawMultiPolygon(e,t,i){}drawPoint(e,t,i){}drawPolygon(e,t,i){}drawText(e,t,i){}setFillStrokeStyle(e,t){}setImageStyle(e,t){}setTextStyle(e,t){}}class CanvasImmediateRenderer extends VectorContext{constructor(e,t,i,n,r,o,a){super(),this.context_=e,this.pixelRatio_=t,this.extent_=i,this.transform_=n,this.transformRotation_=n?toFixed(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=r,this.squaredTolerance_=o,this.userTransform_=a,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=create()}drawImages_(e,t,i,n){if(!this.image_)return;const r=transform2D(e,t,i,n,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=l*this.imageOpacity_);let c=this.imageRotation_;this.transformRotation_===0&&(c-=this.viewRotation_),this.imageRotateWithView_&&(c+=this.viewRotation_);for(let h=0,u=r.length;h<u;h+=2){const d=r[h]-this.imageAnchorX_,g=r[h+1]-this.imageAnchorY_;if(c!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const f=d+this.imageAnchorX_,m=g+this.imageAnchorY_;compose(a,f,m,1,1,c,-f,-m),o.save(),o.transform.apply(o,a),o.translate(f,m),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.restore()}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,d,g,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(e,t,i,n){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const r=transform2D(e,t,i,n,this.transform_,this.pixelCoordinates_),o=this.context_;let a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);t<i;t+=n){const l=r[t]+this.textOffsetX_,c=r[t+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.save(),o.translate(l-this.textOffsetX_,c-this.textOffsetY_),o.rotate(a),o.translate(this.textOffsetX_,this.textOffsetY_),o.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&o.strokeText(this.text_,0,0),this.textFillState_&&o.fillText(this.text_,0,0),o.restore()):(this.textStrokeState_&&o.strokeText(this.text_,l,c),this.textFillState_&&o.fillText(this.text_,l,c))}}moveToLineTo_(e,t,i,n,r){const o=this.context_,a=transform2D(e,t,i,n,this.transform_,this.pixelCoordinates_);o.moveTo(a[0],a[1]);let l=a.length;r&&(l-=2);for(let c=2;c<l;c+=2)o.lineTo(a[c],a[c+1]);return r&&o.closePath(),i}drawRings_(e,t,i,n){for(let r=0,o=i.length;r<o;++r)t=this.moveToLineTo_(e,t,i[r],n,!0);return t}drawCircle(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!intersects$1(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=transformGeom2D(e,this.transform_,this.pixelCoordinates_),i=t[2]-t[0],n=t[3]-t[1],r=Math.sqrt(i*i+n*n),o=this.context_;o.beginPath(),o.arc(t[0],t[1],r,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}this.text_!==""&&this.drawText_(e.getCenter(),0,2,2)}}setStyle(e){this.setFillStrokeStyle(e.getFill(),e.getStroke()),this.setImageStyle(e.getImage()),this.setTextStyle(e.getText())}setTransform(e){this.transform_=e}drawGeometry(e){switch(e.getType()){case"Point":this.drawPoint(e);break;case"LineString":this.drawLineString(e);break;case"Polygon":this.drawPolygon(e);break;case"MultiPoint":this.drawMultiPoint(e);break;case"MultiLineString":this.drawMultiLineString(e);break;case"MultiPolygon":this.drawMultiPolygon(e);break;case"GeometryCollection":this.drawGeometryCollection(e);break;case"Circle":this.drawCircle(e);break}}drawFeature(e,t){const i=t.getGeometryFunction()(e);i&&(this.setStyle(t),this.drawGeometry(i))}drawGeometryCollection(e){const t=e.getGeometriesArray();for(let i=0,n=t.length;i<n;++i)this.drawGeometry(t[i])}drawPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getFlatCoordinates(),i=e.getStride();this.image_&&this.drawImages_(t,0,t.length,i),this.text_!==""&&this.drawText_(t,0,t.length,i)}drawMultiPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getFlatCoordinates(),i=e.getStride();this.image_&&this.drawImages_(t,0,t.length,i),this.text_!==""&&this.drawText_(t,0,t.length,i)}drawLineString(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!intersects$1(this.extent_,e.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const t=this.context_,i=e.getFlatCoordinates();t.beginPath(),this.moveToLineTo_(i,0,i.length,e.getStride(),!1),t.stroke()}if(this.text_!==""){const t=e.getFlatMidpoint();this.drawText_(t,0,2,2)}}}drawMultiLineString(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getExtent();if(intersects$1(this.extent_,t)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const i=this.context_,n=e.getFlatCoordinates();let r=0;const o=e.getEnds(),a=e.getStride();i.beginPath();for(let l=0,c=o.length;l<c;++l)r=this.moveToLineTo_(n,r,o[l],a,!1);i.stroke()}if(this.text_!==""){const i=e.getFlatMidpoints();this.drawText_(i,0,i.length,2)}}}drawPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!intersects$1(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=this.context_;t.beginPath(),this.drawRings_(e.getOrientedFlatCoordinates(),0,e.getEnds(),e.getStride()),this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){const t=e.getFlatInteriorPoint();this.drawText_(t,0,2,2)}}}drawMultiPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!intersects$1(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=this.context_,i=e.getOrientedFlatCoordinates();let n=0;const r=e.getEndss(),o=e.getStride();t.beginPath();for(let a=0,l=r.length;a<l;++a){const c=r[a];n=this.drawRings_(i,n,c,o)}this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){const t=e.getFlatInteriorPoints();this.drawText_(t,0,t.length,2)}}}setContextFillState_(e){const t=this.context_,i=this.contextFillState_;i?i.fillStyle!=e.fillStyle&&(i.fillStyle=e.fillStyle,t.fillStyle=e.fillStyle):(t.fillStyle=e.fillStyle,this.contextFillState_={fillStyle:e.fillStyle})}setContextStrokeState_(e){const t=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=e.lineCap&&(i.lineCap=e.lineCap,t.lineCap=e.lineCap),equals$2(i.lineDash,e.lineDash)||t.setLineDash(i.lineDash=e.lineDash),i.lineDashOffset!=e.lineDashOffset&&(i.lineDashOffset=e.lineDashOffset,t.lineDashOffset=e.lineDashOffset),i.lineJoin!=e.lineJoin&&(i.lineJoin=e.lineJoin,t.lineJoin=e.lineJoin),i.lineWidth!=e.lineWidth&&(i.lineWidth=e.lineWidth,t.lineWidth=e.lineWidth),i.miterLimit!=e.miterLimit&&(i.miterLimit=e.miterLimit,t.miterLimit=e.miterLimit),i.strokeStyle!=e.strokeStyle&&(i.strokeStyle=e.strokeStyle,t.strokeStyle=e.strokeStyle)):(t.lineCap=e.lineCap,t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset,t.lineJoin=e.lineJoin,t.lineWidth=e.lineWidth,t.miterLimit=e.miterLimit,t.strokeStyle=e.strokeStyle,this.contextStrokeState_={lineCap:e.lineCap,lineDash:e.lineDash,lineDashOffset:e.lineDashOffset,lineJoin:e.lineJoin,lineWidth:e.lineWidth,miterLimit:e.miterLimit,strokeStyle:e.strokeStyle})}setContextTextState_(e){const t=this.context_,i=this.contextTextState_,n=e.textAlign?e.textAlign:defaultTextAlign;i?(i.font!=e.font&&(i.font=e.font,t.font=e.font),i.textAlign!=n&&(i.textAlign=n,t.textAlign=n),i.textBaseline!=e.textBaseline&&(i.textBaseline=e.textBaseline,t.textBaseline=e.textBaseline)):(t.font=e.font,t.textAlign=n,t.textBaseline=e.textBaseline,this.contextTextState_={font:e.font,textAlign:n,textBaseline:e.textBaseline})}setFillStrokeStyle(e,t){if(!e)this.fillState_=null;else{const i=e.getColor();this.fillState_={fillStyle:asColorLike(i||defaultFillStyle)}}if(!t)this.strokeState_=null;else{const i=t.getColor(),n=t.getLineCap(),r=t.getLineDash(),o=t.getLineDashOffset(),a=t.getLineJoin(),l=t.getWidth(),c=t.getMiterLimit(),h=r||defaultLineDash;this.strokeState_={lineCap:n!==void 0?n:defaultLineCap,lineDash:this.pixelRatio_===1?h:h.map(u=>u*this.pixelRatio_),lineDashOffset:(o||defaultLineDashOffset)*this.pixelRatio_,lineJoin:a!==void 0?a:defaultLineJoin,lineWidth:(l!==void 0?l:defaultLineWidth)*this.pixelRatio_,miterLimit:c!==void 0?c:defaultMiterLimit,strokeStyle:asColorLike(i||defaultStrokeStyle)}}}setImageStyle(e){let t;if(!e||!(t=e.getSize())){this.image_=null;return}const i=e.getPixelRatio(this.pixelRatio_),n=e.getAnchor(),r=e.getOrigin();this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=t[1]*i,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();const o=e.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/i,o[1]*this.pixelRatio_/i],this.imageWidth_=t[0]*i}setTextStyle(e){if(!e)this.text_="";else{const t=e.getFill();if(!t)this.textFillState_=null;else{const g=t.getColor();this.textFillState_={fillStyle:asColorLike(g||defaultFillStyle)}}const i=e.getStroke();if(!i)this.textStrokeState_=null;else{const g=i.getColor(),f=i.getLineCap(),m=i.getLineDash(),p=i.getLineDashOffset(),_=i.getLineJoin(),y=i.getWidth(),A=i.getMiterLimit();this.textStrokeState_={lineCap:f!==void 0?f:defaultLineCap,lineDash:m||defaultLineDash,lineDashOffset:p||defaultLineDashOffset,lineJoin:_!==void 0?_:defaultLineJoin,lineWidth:y!==void 0?y:defaultLineWidth,miterLimit:A!==void 0?A:defaultMiterLimit,strokeStyle:asColorLike(g||defaultStrokeStyle)}}const n=e.getFont(),r=e.getOffsetX(),o=e.getOffsetY(),a=e.getRotateWithView(),l=e.getRotation(),c=e.getScaleArray(),h=e.getText(),u=e.getTextAlign(),d=e.getTextBaseline();this.textState_={font:n!==void 0?n:defaultFont,textAlign:u!==void 0?u:defaultTextAlign,textBaseline:d!==void 0?d:defaultTextBaseline},this.text_=h!==void 0?Array.isArray(h)?h.reduce((g,f,m)=>g+=m%2?" ":f,""):h:"",this.textOffsetX_=r!==void 0?this.pixelRatio_*r:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*c[0],this.pixelRatio_*c[1]]}}}const SIMPLIFY_TOLERANCE=.5,GEOMETRY_RENDERERS={Point:renderPointGeometry,LineString:renderLineStringGeometry,Polygon:renderPolygonGeometry,MultiPoint:renderMultiPointGeometry,MultiLineString:renderMultiLineStringGeometry,MultiPolygon:renderMultiPolygonGeometry,GeometryCollection:renderGeometryCollectionGeometry,Circle:renderCircleGeometry};function defaultOrder(s,e){return parseInt(getUid(s),10)-parseInt(getUid(e),10)}function getSquaredTolerance(s,e){const t=getTolerance(s,e);return t*t}function getTolerance(s,e){return SIMPLIFY_TOLERANCE*s/e}function renderCircleGeometry(s,e,t,i,n){const r=t.getFill(),o=t.getStroke();if(r||o){const l=s.getBuilder(t.getZIndex(),"Circle");l.setFillStrokeStyle(r,o),l.drawCircle(e,i,n)}const a=t.getText();if(a&&a.getText()){const l=s.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,i)}}function renderFeature(s,e,t,i,n,r,o,a){const l=[],c=t.getImage();if(c){let d=!0;const g=c.getImageState();g==ImageState.LOADED||g==ImageState.ERROR?d=!1:g==ImageState.IDLE&&c.load(),d&&l.push(c.ready())}const h=t.getFill();h&&h.loading()&&l.push(h.ready());const u=l.length>0;return u&&Promise.all(l).then(()=>n(null)),renderFeatureInternal(s,e,t,i,r,o,a),u}function renderFeatureInternal(s,e,t,i,n,r,o){const a=t.getGeometryFunction()(e);if(!a)return;const l=a.simplifyTransformed(i,n);if(t.getRenderer())renderGeometry(s,l,t,e,o);else{const h=GEOMETRY_RENDERERS[l.getType()];h(s,l,t,e,o,r)}}function renderGeometry(s,e,t,i,n){if(e.getType()=="GeometryCollection"){const o=e.getGeometries();for(let a=0,l=o.length;a<l;++a)renderGeometry(s,o[a],t,i,n);return}s.getBuilder(t.getZIndex(),"Default").drawCustom(e,i,t.getRenderer(),t.getHitDetectionRenderer(),n)}function renderGeometryCollectionGeometry(s,e,t,i,n,r){const o=e.getGeometriesArray();let a,l;for(a=0,l=o.length;a<l;++a){const c=GEOMETRY_RENDERERS[o[a].getType()];c(s,o[a],t,i,n,r)}}function renderLineStringGeometry(s,e,t,i,n){const r=t.getStroke();if(r){const a=s.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,r),a.drawLineString(e,i,n)}const o=t.getText();if(o&&o.getText()){const a=s.getBuilder(t.getZIndex(),"Text");a.setTextStyle(o),a.drawText(e,i,n)}}function renderMultiLineStringGeometry(s,e,t,i,n){const r=t.getStroke();if(r){const a=s.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,r),a.drawMultiLineString(e,i,n)}const o=t.getText();if(o&&o.getText()){const a=s.getBuilder(t.getZIndex(),"Text");a.setTextStyle(o),a.drawText(e,i,n)}}function renderMultiPolygonGeometry(s,e,t,i,n){const r=t.getFill(),o=t.getStroke();if(o||r){const l=s.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(r,o),l.drawMultiPolygon(e,i,n)}const a=t.getText();if(a&&a.getText()){const l=s.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,i,n)}}function renderPointGeometry(s,e,t,i,n,r){const o=t.getImage(),a=t.getText(),l=a&&a.getText(),c=r&&o&&l?{}:void 0;if(o){if(o.getImageState()!=ImageState.LOADED)return;const h=s.getBuilder(t.getZIndex(),"Image");h.setImageStyle(o,c),h.drawPoint(e,i,n)}if(l){const h=s.getBuilder(t.getZIndex(),"Text");h.setTextStyle(a,c),h.drawText(e,i,n)}}function renderMultiPointGeometry(s,e,t,i,n,r){const o=t.getImage(),a=o&&o.getOpacity()!==0,l=t.getText(),c=l&&l.getText(),h=r&&a&&c?{}:void 0;if(a){if(o.getImageState()!=ImageState.LOADED)return;const u=s.getBuilder(t.getZIndex(),"Image");u.setImageStyle(o,h),u.drawMultiPoint(e,i,n)}if(c){const u=s.getBuilder(t.getZIndex(),"Text");u.setTextStyle(l,h),u.drawText(e,i,n)}}function renderPolygonGeometry(s,e,t,i,n){const r=t.getFill(),o=t.getStroke();if(r||o){const l=s.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(r,o),l.drawPolygon(e,i,n)}const a=t.getText();if(a&&a.getText()){const l=s.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,i,n)}}let withCredentials=!1;function loadFeaturesXhr(s,e,t,i,n,r,o){const a=new XMLHttpRequest;a.open("GET",typeof s=="function"?s(t,i,n):s,!0),e.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=withCredentials,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){const c=e.getType();try{let h;c=="text"||c=="json"?h=a.responseText:c=="xml"?h=a.responseXML||a.responseText:c=="arraybuffer"&&(h=a.response),h?r(e.readFeatures(h,{extent:t,featureProjection:n}),e.readProjection(h)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function xhr(s,e){return function(t,i,n,r,o){loadFeaturesXhr(s,e,t,i,n,(a,l)=>{this.addFeatures(a),r!==void 0&&r(a)},()=>{this.changed(),o!==void 0&&o()})}}function all(s,e){return[[-1/0,-1/0,1/0,1/0]]}function linearRingss(s,e,t,i){const n=[];let r=createEmpty();for(let o=0,a=t.length;o<a;++o){const l=t[o];r=createOrUpdateFromFlatCoordinates(s,e,l[0],i),n.push((r[0]+r[2])/2,(r[1]+r[3])/2),e=l[l.length-1]}return n}class GeometryCollection extends Geometry{constructor(e){super(),this.geometries_=e,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(unlistenByKey),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const e=this.geometries_;for(let t=0,i=e.length;t<i;++t)this.changeEventsKeys_.push(listen(e[t],EventType.CHANGE,this.changed,this))}clone(){const e=new GeometryCollection(cloneGeometries(this.geometries_));return e.applyProperties(this),e}closestPointXY(e,t,i,n){if(n<closestSquaredDistanceXY(this.getExtent(),e,t))return n;const r=this.geometries_;for(let o=0,a=r.length;o<a;++o)n=r[o].closestPointXY(e,t,i,n);return n}containsXY(e,t){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)if(i[n].containsXY(e,t))return!0;return!1}computeExtent(e){createOrUpdateEmpty(e);const t=this.geometries_;for(let i=0,n=t.length;i<n;++i)extend$1(e,t[i].getExtent());return e}getGeometries(){return cloneGeometries(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let e=[];const t=this.geometries_;for(let i=0,n=t.length;i<n;++i)t[i].getType()===this.getType()?e=e.concat(t[i].getGeometriesArrayRecursive()):e.push(t[i]);return e}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<this.simplifiedGeometryMaxMinSquaredTolerance)return this;const t=[],i=this.geometries_;let n=!1;for(let r=0,o=i.length;r<o;++r){const a=i[r],l=a.getSimplifiedGeometry(e);t.push(l),l!==a&&(n=!0)}return n?new GeometryCollection(t):(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getType(){return"GeometryCollection"}intersectsExtent(e){const t=this.geometries_;for(let i=0,n=t.length;i<n;++i)if(t[i].intersectsExtent(e))return!0;return!1}isEmpty(){return this.geometries_.length===0}rotate(e,t){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)i[n].rotate(e,t);this.changed()}scale(e,t,i){i||(i=getCenter(this.getExtent()));const n=this.geometries_;for(let r=0,o=n.length;r<o;++r)n[r].scale(e,t,i);this.changed()}setGeometries(e){this.setGeometriesArray(cloneGeometries(e))}setGeometriesArray(e){this.unlistenGeometriesChange_(),this.geometries_=e,this.listenGeometriesChange_(),this.changed()}applyTransform(e){const t=this.geometries_;for(let i=0,n=t.length;i<n;++i)t[i].applyTransform(e);this.changed()}translate(e,t){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)i[n].translate(e,t);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function cloneGeometries(s){return s.map(e=>e.clone())}class MultiLineString extends SimpleGeometry{constructor(e,t,i){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(e[0]))this.setCoordinates(e,t);else if(t!==void 0&&i)this.setFlatCoordinates(t,e),this.ends_=i;else{const n=e,r=[],o=[];for(let l=0,c=n.length;l<c;++l){const h=n[l];extend$2(r,h.getFlatCoordinates()),o.push(r.length)}const a=n.length===0?this.getLayout():n[0].getLayout();this.setFlatCoordinates(a,r),this.ends_=o}}appendLineString(e){extend$2(this.flatCoordinates,e.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const e=new MultiLineString(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,i,n){return n<closestSquaredDistanceXY(this.getExtent(),e,t)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(arrayMaxSquaredDelta(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),assignClosestArrayPoint(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,e,t,i,n))}getCoordinateAtM(e,t,i){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(t=t!==void 0?t:!1,i=i!==void 0?i:!1,lineStringsCoordinateAtM(this.flatCoordinates,0,this.ends_,this.stride,e,t,i))}getCoordinates(){return inflateCoordinatesArray(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(e){return e<0||this.ends_.length<=e?null:new LineString(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLineStrings(){const e=this.flatCoordinates,t=this.ends_,i=this.layout,n=[];let r=0;for(let o=0,a=t.length;o<a;++o){const l=t[o],c=new LineString(e.slice(r,l),i);n.push(c),r=l}return n}getLength(){const e=this.ends_;let t=0,i=0;for(let n=0,r=e.length;n<r;++n)i+=lineStringLength(this.flatCoordinates,t,e[n],this.stride),t=e[n];return i}getFlatMidpoints(){const e=[],t=this.flatCoordinates;let i=0;const n=this.ends_,r=this.stride;for(let o=0,a=n.length;o<a;++o){const l=n[o],c=interpolatePoint(t,i,l,r,.5);extend$2(e,c),i=l}return e}getSimplifiedGeometryInternal(e){const t=[],i=[];return t.length=douglasPeuckerArray(this.flatCoordinates,0,this.ends_,this.stride,e,t,0,i),new MultiLineString(t,"XY",i)}getType(){return"MultiLineString"}intersectsExtent(e){return intersectsLineStringArray(this.flatCoordinates,0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=deflateCoordinatesArray(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}}class MultiPoint extends SimpleGeometry{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){extend$2(this.flatCoordinates,e.getFlatCoordinates()),this.changed()}clone(){const e=new MultiPoint(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,i,n){if(n<closestSquaredDistanceXY(this.getExtent(),e,t))return n;const r=this.flatCoordinates,o=this.stride;for(let a=0,l=r.length;a<l;a+=o){const c=squaredDistance(e,t,r[a],r[a+1]);if(c<n){n=c;for(let h=0;h<o;++h)i[h]=r[a+h];i.length=o}}return n}getCoordinates(){return inflateCoordinates(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){const t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new Point(this.flatCoordinates.slice(e*this.stride,(e+1)*this.stride),this.layout)}getPoints(){const e=this.flatCoordinates,t=this.layout,i=this.stride,n=[];for(let r=0,o=e.length;r<o;r+=i){const a=new Point(e.slice(r,r+i),t);n.push(a)}return n}getType(){return"MultiPoint"}intersectsExtent(e){const t=this.flatCoordinates,i=this.stride;for(let n=0,r=t.length;n<r;n+=i){const o=t[n],a=t[n+1];if(containsXY(e,o,a))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=deflateCoordinates(this.flatCoordinates,0,e,this.stride),this.changed()}}class MultiPolygon extends SimpleGeometry{constructor(e,t,i){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!i&&!Array.isArray(e[0])){const n=e,r=[],o=[];for(let a=0,l=n.length;a<l;++a){const c=n[a],h=r.length,u=c.getEnds();for(let d=0,g=u.length;d<g;++d)u[d]+=h;extend$2(r,c.getFlatCoordinates()),o.push(u)}t=n.length===0?this.getLayout():n[0].getLayout(),e=r,i=o}t!==void 0&&i?(this.setFlatCoordinates(t,e),this.endss_=i):this.setCoordinates(e,t)}appendPolygon(e){let t;if(!this.flatCoordinates)this.flatCoordinates=e.getFlatCoordinates().slice(),t=e.getEnds().slice(),this.endss_.push();else{const i=this.flatCoordinates.length;extend$2(this.flatCoordinates,e.getFlatCoordinates()),t=e.getEnds().slice();for(let n=0,r=t.length;n<r;++n)t[n]+=i}this.endss_.push(t),this.changed()}clone(){const e=this.endss_.length,t=new Array(e);for(let n=0;n<e;++n)t[n]=this.endss_[n].slice();const i=new MultiPolygon(this.flatCoordinates.slice(),this.layout,t);return i.applyProperties(this),i}closestPointXY(e,t,i,n){return n<closestSquaredDistanceXY(this.getExtent(),e,t)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(multiArrayMaxSquaredDelta(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),assignClosestMultiArrayPoint(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,i,n))}containsXY(e,t){return linearRingssContainsXY(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return linearRingss$1(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),orientLinearRingsArray(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,inflateMultiCoordinatesArray(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const e=linearRingss(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=getInteriorPointsOfMultiArray(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new MultiPoint(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const e=this.flatCoordinates;linearRingssAreOriented(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=orientLinearRingsArray(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){const t=[],i=[];return t.length=quantizeMultiArray(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(e),t,0,i),new MultiPolygon(t,"XY",i)}getPolygon(e){if(e<0||this.endss_.length<=e)return null;let t;if(e===0)t=0;else{const r=this.endss_[e-1];t=r[r.length-1]}const i=this.endss_[e].slice(),n=i[i.length-1];if(t!==0)for(let r=0,o=i.length;r<o;++r)i[r]-=t;return new Polygon(this.flatCoordinates.slice(t,n),this.layout,i)}getPolygons(){const e=this.layout,t=this.flatCoordinates,i=this.endss_,n=[];let r=0;for(let o=0,a=i.length;o<a;++o){const l=i[o].slice(),c=l[l.length-1];if(r!==0)for(let u=0,d=l.length;u<d;++u)l[u]-=r;const h=new Polygon(t.slice(r,c),e,l);n.push(h),r=c}return n}getType(){return"MultiPolygon"}intersectsExtent(e){return intersectsLinearRingMultiArray(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);const i=deflateMultiCoordinatesArray(this.flatCoordinates,0,e,this.stride,this.endss_);if(i.length===0)this.flatCoordinates.length=0;else{const n=i[i.length-1];this.flatCoordinates.length=n.length===0?0:n[n.length-1]}this.changed()}}const tmpTransform=create();class RenderFeature{constructor(e,t,i,n,r,o){this.styleFunction,this.extent_,this.id_=o,this.type_=e,this.flatCoordinates_=t,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=r,this.squaredTolerance_,this.stride_=n,this.simplifiedGeometry_}get(e){return this.properties_[e]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?createOrUpdateFromCoordinate(this.flatCoordinates_):createOrUpdateFromFlatCoordinates(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const e=getCenter(this.getExtent());this.flatInteriorPoints_=getInteriorPointOfArray(this.flatCoordinates_,0,this.ends_,2,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const e=inflateEnds(this.flatCoordinates_,this.ends_),t=linearRingss(this.flatCoordinates_,0,e,2);this.flatInteriorPoints_=getInteriorPointsOfMultiArray(this.flatCoordinates_,0,e,2,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=interpolatePoint(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const e=this.flatCoordinates_;let t=0;const i=this.ends_;for(let n=0,r=i.length;n<r;++n){const o=i[n],a=interpolatePoint(e,t,o,2,.5);extend$2(this.flatMidpoints_,a),t=o}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(e){return this}simplifyTransformed(e,t){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(e){e=get$1(e);const t=e.getExtent(),i=e.getWorldExtent();if(t&&i){const n=getHeight(i)/getHeight(t);compose(tmpTransform,i[0],i[3],n,-n,0,0,0),transform2D(this.flatCoordinates_,0,this.flatCoordinates_.length,2,tmpTransform,this.flatCoordinates_)}}applyTransform(e){e(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){var e;return new RenderFeature(this.type_,this.flatCoordinates_.slice(),(e=this.ends_)==null?void 0:e.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=memoizeOne((e,t)=>{if(e===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),t&&this.simplifiedGeometry_.applyTransform(t);const i=this.simplifiedGeometry_.getFlatCoordinates();let n;switch(this.type_){case"LineString":i.length=douglasPeucker(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,i,0),n=[i.length];break;case"MultiLineString":n=[],i.length=douglasPeuckerArray(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,i,0,n);break;case"Polygon":n=[],i.length=quantizeArray(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(e),i,0,n);break}return n&&(this.simplifiedGeometry_=new RenderFeature(this.type_,i,n,2,this.properties_,this.id_)),this.squaredTolerance_=e,this.simplifiedGeometry_}),this}}RenderFeature.prototype.getFlatCoordinates=RenderFeature.prototype.getOrientedFlatCoordinates;class RBush{constructor(e){this.rbush_=new RBush$1(e),this.items_={}}insert(e,t){const i={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(i),this.items_[getUid(t)]=i}load(e,t){const i=new Array(t.length);for(let n=0,r=t.length;n<r;n++){const o=e[n],a=t[n],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};i[n]=l,this.items_[getUid(a)]=l}this.rbush_.load(i)}remove(e){const t=getUid(e),i=this.items_[t];return delete this.items_[t],this.rbush_.remove(i)!==null}update(e,t){const i=this.items_[getUid(t)],n=[i.minX,i.minY,i.maxX,i.maxY];equals$1(n,e)||(this.remove(t),this.insert(e,t))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(e){const t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this.rbush_.search(t).map(function(n){return n.value})}forEach(e){return this.forEach_(this.getAll(),e)}forEachInExtent(e,t){return this.forEach_(this.getInExtent(e),t)}forEach_(e,t){let i;for(let n=0,r=e.length;n<r;n++)if(i=t(e[n]),i)return i;return i}isEmpty(){return isEmpty$1(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){const t=this.rbush_.toJSON();return createOrUpdate$2(t.minX,t.minY,t.maxX,t.maxY,e)}concat(e){this.rbush_.load(e.rbush_.all());for(const t in e.items_)this.items_[t]=e.items_[t]}}class Source extends BaseObject{constructor(e){super(),this.projection=get$1(e.projection),this.attributions_=adaptAttributions(e.attributions),this.attributionsCollapsible_=e.attributionsCollapsible??!0,this.loading=!1,this.state_=e.state!==void 0?e.state:"ready",this.wrapX_=e.wrapX!==void 0?e.wrapX:!1,this.interpolate_=!!e.interpolate,this.viewResolver=null,this.viewRejector=null;const t=this;this.viewPromise_=new Promise(function(i,n){t.viewResolver=i,t.viewRejector=n})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(e){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(e){this.attributions_=adaptAttributions(e),this.changed()}setState(e){this.state_=e,this.changed()}}function adaptAttributions(s){return s?typeof s=="function"?s:(Array.isArray(s)||(s=[s]),e=>s):null}const VectorEventType={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};class VectorSourceEvent extends BaseEvent{constructor(e,t,i){super(e),this.feature=t,this.features=i}}class VectorSource extends Source{constructor(e){e=e||{},super({attributions:e.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:e.wrapX!==void 0?e.wrapX:!0}),this.on,this.once,this.un,this.loader_=VOID,this.format_=e.format||null,this.overlaps_=e.overlaps===void 0?!0:e.overlaps,this.url_=e.url,e.loader!==void 0?this.loader_=e.loader:this.url_!==void 0&&(assert(this.format_,"`format` must be set when `url` is set"),this.loader_=xhr(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:all;const t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new RBush:null,this.loadedExtentsRtree_=new RBush,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let i,n;Array.isArray(e.features)?n=e.features:e.features&&(i=e.features,n=i.getArray()),!t&&i===void 0&&(i=new Collection(n)),n!==void 0&&this.addFeaturesInternal(n),i!==void 0&&this.bindFeaturesCollection_(i)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){const t=getUid(e);if(!this.addToIndex_(t,e)){this.featuresCollection_&&this.featuresCollection_.remove(e);return}this.setupChangeEvents_(t,e);const i=e.getGeometry();if(i){const n=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(n,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new VectorSourceEvent(VectorEventType.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof RenderFeature||(this.featureChangeKeys_[e]=[listen(t,EventType.CHANGE,this.handleFeatureChange_,this),listen(t,ObjectEventType.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(e,t){let i=!0;if(t.getId()!==void 0){const n=String(t.getId());if(!(n in this.idIndex_))this.idIndex_[n]=t;else if(t instanceof RenderFeature){const r=this.idIndex_[n];r instanceof RenderFeature?Array.isArray(r)?r.push(t):this.idIndex_[n]=[r,t]:i=!1}else i=!1}return i&&(assert(!(e in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[e]=t),i}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){const t=[],i=[],n=[];for(let r=0,o=e.length;r<o;r++){const a=e[r],l=getUid(a);this.addToIndex_(l,a)&&i.push(a)}for(let r=0,o=i.length;r<o;r++){const a=i[r],l=getUid(a);this.setupChangeEvents_(l,a);const c=a.getGeometry();if(c){const h=c.getExtent();t.push(h),n.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(t,n),this.hasListener(VectorEventType.ADDFEATURE))for(let r=0,o=i.length;r<o;r++)this.dispatchEvent(new VectorSourceEvent(VectorEventType.ADDFEATURE,i[r]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(VectorEventType.ADDFEATURE,function(i){t||(t=!0,e.push(i.feature),t=!1)}),this.addEventListener(VectorEventType.REMOVEFEATURE,function(i){t||(t=!0,e.remove(i.feature),t=!1)}),e.addEventListener(CollectionEventType.ADD,i=>{t||(t=!0,this.addFeature(i.element),t=!1)}),e.addEventListener(CollectionEventType.REMOVE,i=>{t||(t=!0,this.removeFeature(i.element),t=!1)}),this.featuresCollection_=e}clear(e){if(e){for(const i in this.featureChangeKeys_)this.featureChangeKeys_[i].forEach(unlistenByKey);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 t=new VectorSourceEvent(VectorEventType.CLEAR);this.dispatchEvent(t),this.changed()}forEachFeature(e){if(this.featuresRtree_)return this.featuresRtree_.forEach(e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureAtCoordinateDirect(e,t){const i=[e[0],e[1],e[0],e[1]];return this.forEachFeatureInExtent(i,function(n){const r=n.getGeometry();if(r instanceof RenderFeature||r.intersectsCoordinate(e))return t(n)})}forEachFeatureInExtent(e,t){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(e,t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureIntersectingExtent(e,t){return this.forEachFeatureInExtent(e,function(i){const n=i.getGeometry();if(n instanceof RenderFeature||n.intersectsExtent(e)){const r=t(i);if(r)return r}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),isEmpty$1(this.nullGeometryFeatures_)||extend$2(e,Object.values(this.nullGeometryFeatures_))),e}getFeaturesAtCoordinate(e){const t=[];return this.forEachFeatureAtCoordinateDirect(e,function(i){t.push(i)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);const n=wrapAndSliceX(e,t);return[].concat(...n.map(r=>this.featuresRtree_.getInExtent(r)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(e,t){const i=e[0],n=e[1];let r=null;const o=[NaN,NaN];let a=1/0;const l=[-1/0,-1/0,1/0,1/0];return t=t||TRUE,this.featuresRtree_.forEachInExtent(l,function(c){if(t(c)){const h=c.getGeometry(),u=a;if(a=h instanceof RenderFeature?0:h.closestPointXY(i,n,o,a),a<u){r=c;const d=Math.sqrt(a);l[0]=i-d,l[1]=n-d,l[2]=i+d,l[3]=n+d}}}),r}getExtent(e){return this.featuresRtree_.getExtent(e)}getFeatureById(e){const t=this.idIndex_[e.toString()];return t!==void 0?t:null}getFeatureByUid(e){const t=this.uidIndex_[e];return t!==void 0?t:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(e){const t=e.target,i=getUid(t),n=t.getGeometry();if(!n)i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(t),this.nullGeometryFeatures_[i]=t);else{const o=n.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(o,t)):this.featuresRtree_&&this.featuresRtree_.update(o,t)}const r=t.getId();if(r!==void 0){const o=r.toString();this.idIndex_[o]!==t&&(this.removeFromIdIndex_(t),this.idIndex_[o]=t)}else this.removeFromIdIndex_(t),this.uidIndex_[i]=t;this.changed(),this.dispatchEvent(new VectorSourceEvent(VectorEventType.CHANGEFEATURE,t))}hasFeature(e){const t=e.getId();return t!==void 0?t in this.idIndex_:getUid(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&isEmpty$1(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(e,t,i){const n=this.loadedExtentsRtree_,r=this.strategy_(e,t,i);for(let o=0,a=r.length;o<a;++o){const l=r[o];n.forEachInExtent(l,function(h){return containsExtent(h.extent,l)})||(++this.loadingExtentsCount_,this.dispatchEvent(new VectorSourceEvent(VectorEventType.FEATURESLOADSTART)),this.loader_.call(this,l,t,i,h=>{--this.loadingExtentsCount_,this.dispatchEvent(new VectorSourceEvent(VectorEventType.FEATURESLOADEND,void 0,h))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new VectorSourceEvent(VectorEventType.FEATURESLOADERROR))}),n.insert(l,{extent:l.slice()}))}this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){const t=this.loadedExtentsRtree_,i=t.forEachInExtent(e,function(n){if(equals$1(n.extent,e))return n});i&&t.remove(i)}removeFeatures(e){let t=!1;for(let i=0,n=e.length;i<n;++i)t=this.removeFeatureInternal(e[i])||t;t&&this.changed()}removeFeature(e){if(!e)return;this.removeFeatureInternal(e)&&this.changed()}removeFeatureInternal(e){const t=getUid(e);if(!(t in this.uidIndex_))return!1;t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e);const i=this.featureChangeKeys_[t];i==null||i.forEach(unlistenByKey),delete this.featureChangeKeys_[t];const n=e.getId();if(n!==void 0){const r=n.toString(),o=this.idIndex_[r];o===e?delete this.idIndex_[r]:Array.isArray(o)&&(o.splice(o.indexOf(e),1),o.length===1&&(this.idIndex_[r]=o[0]))}return delete this.uidIndex_[t],this.hasListener(VectorEventType.REMOVEFEATURE)&&this.dispatchEvent(new VectorSourceEvent(VectorEventType.REMOVEFEATURE,e)),!0}removeFromIdIndex_(e){for(const t in this.idIndex_)if(this.idIndex_[t]===e){delete this.idIndex_[t];break}}setLoader(e){this.loader_=e}setUrl(e){assert(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(xhr(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}}const Instruction={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},fillInstruction=[Instruction.FILL],strokeInstruction=[Instruction.STROKE],beginPathInstruction=[Instruction.BEGIN_PATH],closePathInstruction=[Instruction.CLOSE_PATH];class CanvasBuilder extends VectorContext{constructor(e,t,i,n){super(),this.tolerance=e,this.maxExtent=t,this.pixelRatio=n,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(e){const t=this.pixelRatio;return t==1?e:e.map(function(i){return i*t})}appendFlatPointCoordinates(e,t){const i=this.getBufferedMaxExtent(),n=this.tmpCoordinate_,r=this.coordinates;let o=r.length;for(let a=0,l=e.length;a<l;a+=t)n[0]=e[a],n[1]=e[a+1],containsCoordinate(i,n)&&(r[o++]=n[0],r[o++]=n[1]);return o}appendFlatLineCoordinates(e,t,i,n,r,o){const a=this.coordinates;let l=a.length;const c=this.getBufferedMaxExtent();o&&(t+=n);let h=e[t],u=e[t+1];const d=this.tmpCoordinate_;let g=!0,f,m,p;for(f=t+n;f<i;f+=n)d[0]=e[f],d[1]=e[f+1],p=coordinateRelationship(c,d),p!==m?(g&&(a[l++]=h,a[l++]=u,g=!1),a[l++]=d[0],a[l++]=d[1]):p===Relationship.INTERSECTING?(a[l++]=d[0],a[l++]=d[1],g=!1):g=!0,h=d[0],u=d[1],m=p;return(r&&g||f===t+n)&&(a[l++]=h,a[l++]=u),l}drawCustomCoordinates_(e,t,i,n,r){for(let o=0,a=i.length;o<a;++o){const l=i[o],c=this.appendFlatLineCoordinates(e,t,l,n,!1,!1);r.push(c),t=l}return t}drawCustom(e,t,i,n,r){this.beginGeometry(e,t,r);const o=e.getType(),a=e.getStride(),l=this.coordinates.length;let c,h,u,d,g;switch(o){case"MultiPolygon":c=e.getOrientedFlatCoordinates(),d=[];const f=e.getEndss();g=0;for(let m=0,p=f.length;m<p;++m){const _=[];g=this.drawCustomCoordinates_(c,g,f[m],a,_),d.push(_)}this.instructions.push([Instruction.CUSTOM,l,d,e,i,inflateMultiCoordinatesArray,r]),this.hitDetectionInstructions.push([Instruction.CUSTOM,l,d,e,n||i,inflateMultiCoordinatesArray,r]);break;case"Polygon":case"MultiLineString":u=[],c=o=="Polygon"?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),g=this.drawCustomCoordinates_(c,0,e.getEnds(),a,u),this.instructions.push([Instruction.CUSTOM,l,u,e,i,inflateCoordinatesArray,r]),this.hitDetectionInstructions.push([Instruction.CUSTOM,l,u,e,n||i,inflateCoordinatesArray,r]);break;case"LineString":case"Circle":c=e.getFlatCoordinates(),h=this.appendFlatLineCoordinates(c,0,c.length,a,!1,!1),this.instructions.push([Instruction.CUSTOM,l,h,e,i,inflateCoordinates,r]),this.hitDetectionInstructions.push([Instruction.CUSTOM,l,h,e,n||i,inflateCoordinates,r]);break;case"MultiPoint":c=e.getFlatCoordinates(),h=this.appendFlatPointCoordinates(c,a),h>l&&(this.instructions.push([Instruction.CUSTOM,l,h,e,i,inflateCoordinates,r]),this.hitDetectionInstructions.push([Instruction.CUSTOM,l,h,e,n||i,inflateCoordinates,r]));break;case"Point":c=e.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),h=this.coordinates.length,this.instructions.push([Instruction.CUSTOM,l,h,e,i,void 0,r]),this.hitDetectionInstructions.push([Instruction.CUSTOM,l,h,e,n||i,void 0,r]);break}this.endGeometry(t)}beginGeometry(e,t,i){this.beginGeometryInstruction1_=[Instruction.BEGIN_GEOMETRY,t,0,e,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[Instruction.BEGIN_GEOMETRY,t,0,e,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const e=this.hitDetectionInstructions;e.reverse();let t;const i=e.length;let n,r,o=-1;for(t=0;t<i;++t)n=e[t],r=n[0],r==Instruction.END_GEOMETRY?o=t:r==Instruction.BEGIN_GEOMETRY&&(n[2]=t,reverseSubArray(this.hitDetectionInstructions,o,t),o=-1)}fillStyleToState(e,t={}){if(e){const i=e.getColor();t.fillPatternScale=i&&typeof i=="object"&&"src"in i?this.pixelRatio:1,t.fillStyle=asColorLike(i||defaultFillStyle)}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){const i=e.getColor();t.strokeStyle=asColorLike(i||defaultStrokeStyle);const n=e.getLineCap();t.lineCap=n!==void 0?n:defaultLineCap;const r=e.getLineDash();t.lineDash=r?r.slice():defaultLineDash;const o=e.getLineDashOffset();t.lineDashOffset=o||defaultLineDashOffset;const a=e.getLineJoin();t.lineJoin=a!==void 0?a:defaultLineJoin;const l=e.getWidth();t.lineWidth=l!==void 0?l:defaultLineWidth;const c=e.getMiterLimit();t.miterLimit=c!==void 0?c:defaultMiterLimit,t.lineWidth>this.maxLineWidth&&(this.maxLineWidth=t.lineWidth,this.bufferedMaxExtent_=null)}else t.strokeStyle=void 0,t.lineCap=void 0,t.lineDash=null,t.lineDashOffset=void 0,t.lineJoin=void 0,t.lineWidth=void 0,t.miterLimit=void 0;return t}setFillStrokeStyle(e,t){const i=this.state;this.fillStyleToState(e,i),this.strokeStyleToState(t,i)}createFill(e){const t=e.fillStyle,i=[Instruction.SET_FILL_STYLE,t];return typeof t!="string"&&i.push(e.fillPatternScale),i}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[Instruction.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,e.lineDash?this.applyPixelRatio(e.lineDash):null,e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){const i=e.fillStyle;(typeof i!="string"||e.currentFillStyle!=i)&&(this.instructions.push(t.call(this,e)),e.currentFillStyle=i)}updateStrokeStyle(e,t){const i=e.strokeStyle,n=e.lineCap,r=e.lineDash,o=e.lineDashOffset,a=e.lineJoin,l=e.lineWidth,c=e.miterLimit;(e.currentStrokeStyle!=i||e.currentLineCap!=n||r!=e.currentLineDash&&!equals$2(e.currentLineDash,r)||e.currentLineDashOffset!=o||e.currentLineJoin!=a||e.currentLineWidth!=l||e.currentMiterLimit!=c)&&(t.call(this,e),e.currentStrokeStyle=i,e.currentLineCap=n,e.currentLineDash=r,e.currentLineDashOffset=o,e.currentLineJoin=a,e.currentLineWidth=l,e.currentMiterLimit=c)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const t=[Instruction.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=clone(this.maxExtent),this.maxLineWidth>0)){const e=this.resolution*(this.maxLineWidth+1)/2;buffer(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class CanvasImageBuilder extends CanvasBuilder{constructor(e,t,i,n){super(e,t,i,n),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(e,t,i){if(!this.image_||this.maxExtent&&!containsCoordinate(this.maxExtent,e.getFlatCoordinates()))return;this.beginGeometry(e,t,i);const n=e.getFlatCoordinates(),r=e.getStride(),o=this.coordinates.length,a=this.appendFlatPointCoordinates(n,r);this.instructions.push([Instruction.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([Instruction.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(t)}drawMultiPoint(e,t,i){if(!this.image_)return;this.beginGeometry(e,t,i);const n=e.getFlatCoordinates(),r=[];for(let l=0,c=n.length;l<c;l+=e.getStride())(!this.maxExtent||containsCoordinate(this.maxExtent,n.slice(l,l+2)))&&r.push(n[l],n[l+1]);const o=this.coordinates.length,a=this.appendFlatPointCoordinates(r,2);this.instructions.push([Instruction.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([Instruction.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(t)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(e,t){const i=e.getAnchor(),n=e.getSize(),r=e.getOrigin();this.imagePixelRatio_=e.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=e.getHitDetectionImage(),this.image_=e.getImage(this.pixelRatio),this.height_=n[1],this.opacity_=e.getOpacity(),this.originX_=r[0],this.originY_=r[1],this.rotateWithView_=e.getRotateWithView(),this.rotation_=e.getRotation(),this.scale_=e.getScaleArray(),this.width_=n[0],this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}}class CanvasLineStringBuilder extends CanvasBuilder{constructor(e,t,i,n){super(e,t,i,n)}drawFlatCoordinates_(e,t,i,n){const r=this.coordinates.length,o=this.appendFlatLineCoordinates(e,t,i,n,!1,!1),a=[Instruction.MOVE_TO_LINE_TO,r,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),i}drawLineString(e,t,i){const n=this.state,r=n.strokeStyle,o=n.lineWidth;if(r===void 0||o===void 0)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(e,t,i),this.hitDetectionInstructions.push([Instruction.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,defaultLineDash,defaultLineDashOffset],beginPathInstruction);const a=e.getFlatCoordinates(),l=e.getStride();this.drawFlatCoordinates_(a,0,a.length,l),this.hitDetectionInstructions.push(strokeInstruction),this.endGeometry(t)}drawMultiLineString(e,t,i){const n=this.state,r=n.strokeStyle,o=n.lineWidth;if(r===void 0||o===void 0)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(e,t,i),this.hitDetectionInstructions.push([Instruction.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,defaultLineDash,defaultLineDashOffset],beginPathInstruction);const a=e.getEnds(),l=e.getFlatCoordinates(),c=e.getStride();let h=0;for(let u=0,d=a.length;u<d;++u)h=this.drawFlatCoordinates_(l,h,a[u],c);this.hitDetectionInstructions.push(strokeInstruction),this.endGeometry(t)}finish(){const e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(strokeInstruction),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(strokeInstruction),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(beginPathInstruction)}}class CanvasPolygonBuilder extends CanvasBuilder{constructor(e,t,i,n){super(e,t,i,n)}drawFlatCoordinatess_(e,t,i,n){const r=this.state,o=r.fillStyle!==void 0,a=r.strokeStyle!==void 0,l=i.length;this.instructions.push(beginPathInstruction),this.hitDetectionInstructions.push(beginPathInstruction);for(let c=0;c<l;++c){const h=i[c],u=this.coordinates.length,d=this.appendFlatLineCoordinates(e,t,h,n,!0,!a),g=[Instruction.MOVE_TO_LINE_TO,u,d];this.instructions.push(g),this.hitDetectionInstructions.push(g),a&&(this.instructions.push(closePathInstruction),this.hitDetectionInstructions.push(closePathInstruction)),t=h}return o&&(this.instructions.push(fillInstruction),this.hitDetectionInstructions.push(fillInstruction)),a&&(this.instructions.push(strokeInstruction),this.hitDetectionInstructions.push(strokeInstruction)),t}drawCircle(e,t,i){const n=this.state,r=n.fillStyle,o=n.strokeStyle;if(r===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,i),n.fillStyle!==void 0&&this.hitDetectionInstructions.push([Instruction.SET_FILL_STYLE,defaultFillStyle]),n.strokeStyle!==void 0&&this.hitDetectionInstructions.push([Instruction.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,defaultLineDash,defaultLineDashOffset]);const a=e.getFlatCoordinates(),l=e.getStride(),c=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,l,!1,!1);const h=[Instruction.CIRCLE,c];this.instructions.push(beginPathInstruction,h),this.hitDetectionInstructions.push(beginPathInstruction,h),n.fillStyle!==void 0&&(this.instructions.push(fillInstruction),this.hitDetectionInstructions.push(fillInstruction)),n.strokeStyle!==void 0&&(this.instructions.push(strokeInstruction),this.hitDetectionInstructions.push(strokeInstruction)),this.endGeometry(t)}drawPolygon(e,t,i){const n=this.state,r=n.fillStyle,o=n.strokeStyle;if(r===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,i),n.fillStyle!==void 0&&this.hitDetectionInstructions.push([Instruction.SET_FILL_STYLE,defaultFillStyle]),n.strokeStyle!==void 0&&this.hitDetectionInstructions.push([Instruction.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,defaultLineDash,defaultLineDashOffset]);const a=e.getEnds(),l=e.getOrientedFlatCoordinates(),c=e.getStride();this.drawFlatCoordinatess_(l,0,a,c),this.endGeometry(t)}drawMultiPolygon(e,t,i){const n=this.state,r=n.fillStyle,o=n.strokeStyle;if(r===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,i),n.fillStyle!==void 0&&this.hitDetectionInstructions.push([Instruction.SET_FILL_STYLE,defaultFillStyle]),n.strokeStyle!==void 0&&this.hitDetectionInstructions.push([Instruction.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,defaultLineDash,defaultLineDashOffset]);const a=e.getEndss(),l=e.getOrientedFlatCoordinates(),c=e.getStride();let h=0;for(let u=0,d=a.length;u<d;++u)h=this.drawFlatCoordinatess_(l,h,a[u],c);this.endGeometry(t)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const e=this.tolerance;if(e!==0){const t=this.coordinates;for(let i=0,n=t.length;i<n;++i)t[i]=snap(t[i],e)}return super.finish()}setFillStrokeStyles_(){const e=this.state;this.updateFillStyle(e,this.createFill),this.updateStrokeStyle(e,this.applyStroke)}}function lineChunk(s,e,t,i,n){const r=[];let o=t,a=0,l=e.slice(t,2);for(;a<s&&o+n<i;){const[c,h]=l.slice(-2),u=e[o+n],d=e[o+n+1],g=Math.sqrt((u-c)*(u-c)+(d-h)*(d-h));if(a+=g,a>=s){const f=(s-a+g)/g,m=lerp(c,u,f),p=lerp(h,d,f);l.push(m,p),r.push(l),l=[m,p],a==s&&(o+=n),a=0}else if(a<s)l.push(e[o+n],e[o+n+1]),o+=n;else{const f=g-a,m=lerp(c,u,f/g),p=lerp(h,d,f/g);l.push(m,p),r.push(l),l=[m,p],a=0,o+=n}}return a>0&&r.push(l),r}function matchingChunk(s,e,t,i,n){let r=t,o=t,a=0,l=0,c=t,h,u,d,g,f,m,p,_,y,A;for(u=t;u<i;u+=n){const x=e[u],C=e[u+1];f!==void 0&&(y=x-f,A=C-m,g=Math.sqrt(y*y+A*A),p!==void 0&&(l+=d,h=Math.acos((p*y+_*A)/(d*g)),h>s&&(l>a&&(a=l,r=c,o=u),l=0,c=u-n)),d=g,p=y,_=A),f=x,m=C}return l+=g,l>a?[c,u]:[r,o]}const TEXT_ALIGN={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class CanvasTextBuilder extends CanvasBuilder{constructor(e,t,i,n){super(e,t,i,n),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[defaultFillStyle]={fillStyle:defaultFillStyle},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t,i){const n=this.textFillState_,r=this.textStrokeState_,o=this.textState_;if(this.text_===""||!o||!n&&!r)return;const a=this.coordinates;let l=a.length;const c=e.getType();let h=null,u=e.getStride();if(o.placement==="line"&&(c=="LineString"||c=="MultiLineString"||c=="Polygon"||c=="MultiPolygon")){if(!intersects$1(this.maxExtent,e.getExtent()))return;let d;if(h=e.getFlatCoordinates(),c=="LineString")d=[h.length];else if(c=="MultiLineString")d=e.getEnds();else if(c=="Polygon")d=e.getEnds().slice(0,1);else if(c=="MultiPolygon"){const p=e.getEndss();d=[];for(let _=0,y=p.length;_<y;++_)d.push(p[_][0])}this.beginGeometry(e,t,i);const g=o.repeat,f=g?void 0:o.textAlign;let m=0;for(let p=0,_=d.length;p<_;++p){let y;g?y=lineChunk(g*this.resolution,h,m,d[p],u):y=[h.slice(m,d[p])];for(let A=0,x=y.length;A<x;++A){const C=y[A];let T=0,S=C.length;if(f==null){const I=matchingChunk(o.maxAngle,C,0,C.length,2);T=I[0],S=I[1]}for(let I=T;I<S;I+=u)a.push(C[I],C[I+1]);const w=a.length;m=d[p],this.drawChars_(l,w),l=w}}this.endGeometry(t)}else{let d=o.overflow?null:[];switch(c){case"Point":case"MultiPoint":h=e.getFlatCoordinates();break;case"LineString":h=e.getFlatMidpoint();break;case"Circle":h=e.getCenter();break;case"MultiLineString":h=e.getFlatMidpoints(),u=2;break;case"Polygon":h=e.getFlatInteriorPoint(),o.overflow||d.push(h[2]/this.resolution),u=3;break;case"MultiPolygon":const x=e.getFlatInteriorPoints();h=[];for(let C=0,T=x.length;C<T;C+=3)o.overflow||d.push(x[C+2]/this.resolution),h.push(x[C],x[C+1]);if(h.length===0)return;u=2;break}const g=this.appendFlatPointCoordinates(h,u);if(g===l)return;if(d&&(g-l)/2!==h.length/u){let x=l/2;d=d.filter((C,T)=>{const S=a[(x+T)*2]===h[T*u]&&a[(x+T)*2+1]===h[T*u+1];return S||--x,S})}this.saveTextStates_();const f=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,m=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(e,t,i);let p=o.padding;if(p!=defaultPadding&&(o.scale[0]<0||o.scale[1]<0)){let x=o.padding[0],C=o.padding[1],T=o.padding[2],S=o.padding[3];o.scale[0]<0&&(C=-C,S=-S),o.scale[1]<0&&(x=-x,T=-T),p=[x,C,T,S]}const _=this.pixelRatio;this.instructions.push([Instruction.DRAW_IMAGE,l,g,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,p==defaultPadding?defaultPadding:p.map(function(x){return x*_}),f,m,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]);const y=1/_,A=f?f.slice(0):null;A&&(A[1]=defaultFillStyle),this.hitDetectionInstructions.push([Instruction.DRAW_IMAGE,l,g,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[y,y],NaN,this.declutterMode_,this.declutterImageWithText_,p,A,m,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?defaultFillStyle:this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]),this.endGeometry(t)}}saveTextStates_(){const e=this.textStrokeState_,t=this.textState_,i=this.textFillState_,n=this.strokeKey_;e&&(n in this.strokeStates||(this.strokeStates[n]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));const r=this.textKey_;r in this.textStates||(this.textStates[r]={font:t.font,textAlign:t.textAlign||defaultTextAlign,justify:t.justify,textBaseline:t.textBaseline||defaultTextBaseline,scale:t.scale});const o=this.fillKey_;i&&(o in this.fillStates||(this.fillStates[o]={fillStyle:i.fillStyle}))}drawChars_(e,t){const i=this.textStrokeState_,n=this.textState_,r=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();const l=this.pixelRatio,c=TEXT_ALIGN[n.textBaseline],h=this.textOffsetY_*l,u=this.text_,d=i?i.lineWidth*Math.abs(n.scale[0])/2:0;this.instructions.push([Instruction.DRAW_CHARS,e,t,c,n.overflow,a,n.maxAngle,l,h,r,d*l,u,o,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([Instruction.DRAW_CHARS,e,t,c,n.overflow,a&&defaultFillStyle,n.maxAngle,l,h,r,d*l,u,o,1/l,this.declutterMode_,this.textKeepUpright_])}setTextStyle(e,t){let i,n,r;if(!e)this.text_="";else{const o=e.getFill();o?(n=this.textFillState_,n||(n={},this.textFillState_=n),n.fillStyle=asColorLike(o.getColor()||defaultFillStyle)):(n=null,this.textFillState_=n);const a=e.getStroke();if(!a)r=null,this.textStrokeState_=r;else{r=this.textStrokeState_,r||(r={},this.textStrokeState_=r);const m=a.getLineDash(),p=a.getLineDashOffset(),_=a.getWidth(),y=a.getMiterLimit();r.lineCap=a.getLineCap()||defaultLineCap,r.lineDash=m?m.slice():defaultLineDash,r.lineDashOffset=p===void 0?defaultLineDashOffset:p,r.lineJoin=a.getLineJoin()||defaultLineJoin,r.lineWidth=_===void 0?defaultLineWidth:_,r.miterLimit=y===void 0?defaultMiterLimit:y,r.strokeStyle=asColorLike(a.getColor()||defaultStrokeStyle)}i=this.textState_;const l=e.getFont()||defaultFont;registerFont(l);const c=e.getScaleArray();i.overflow=e.getOverflow(),i.font=l,i.maxAngle=e.getMaxAngle(),i.placement=e.getPlacement(),i.textAlign=e.getTextAlign(),i.repeat=e.getRepeat(),i.justify=e.getJustify(),i.textBaseline=e.getTextBaseline()||defaultTextBaseline,i.backgroundFill=e.getBackgroundFill(),i.backgroundStroke=e.getBackgroundStroke(),i.padding=e.getPadding()||defaultPadding,i.scale=c===void 0?[1,1]:c;const h=e.getOffsetX(),u=e.getOffsetY(),d=e.getRotateWithView(),g=e.getKeepUpright(),f=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=h===void 0?0:h,this.textOffsetY_=u===void 0?0:u,this.textRotateWithView_=d===void 0?!1:d,this.textKeepUpright_=g===void 0?!0:g,this.textRotation_=f===void 0?0:f,this.strokeKey_=r?(typeof r.strokeStyle=="string"?r.strokeStyle:getUid(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_=n&&n.fillStyle?typeof n.fillStyle=="string"?n.fillStyle:"|"+getUid(n.fillStyle):""}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}}const BATCH_CONSTRUCTORS={Circle:CanvasPolygonBuilder,Default:CanvasBuilder,Image:CanvasImageBuilder,LineString:CanvasLineStringBuilder,Polygon:CanvasPolygonBuilder,Text:CanvasTextBuilder};class BuilderGroup{constructor(e,t,i,n){this.tolerance_=e,this.maxExtent_=t,this.pixelRatio_=n,this.resolution_=i,this.buildersByZIndex_={}}finish(){const e={};for(const t in this.buildersByZIndex_){e[t]=e[t]||{};const i=this.buildersByZIndex_[t];for(const n in i){const r=i[n].finish();e[t][n]=r}}return e}getBuilder(e,t){const i=e!==void 0?e.toString():"0";let n=this.buildersByZIndex_[i];n===void 0&&(n={},this.buildersByZIndex_[i]=n);let r=n[t];if(r===void 0){const o=BATCH_CONSTRUCTORS[t];r=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[t]=r}return r}}function drawTextOnPath(s,e,t,i,n,r,o,a,l,c,h,u,d=!0){let g=s[e],f=s[e+1],m=0,p=0,_=0,y=0;function A(){m=g,p=f,e+=i,g=s[e],f=s[e+1],y+=_,_=Math.sqrt((g-m)*(g-m)+(f-p)*(f-p))}do A();while(e<t-i&&y+_<r);let x=_===0?0:(r-y)/_;const C=lerp(m,g,x),T=lerp(p,f,x),S=e-i,w=y,I=r+a*l(c,n,h);for(;e<t-i&&y+_<I;)A();x=_===0?0:(I-y)/_;const L=lerp(m,g,x),D=lerp(p,f,x);let b=!1;if(d)if(u){const G=[C,T,L,D];rotate(G,0,4,2,u,G,G),b=G[0]>G[2]}else b=C>L;const P=Math.PI,O=[],B=S+i===e;e=S,_=0,y=w,g=s[e],f=s[e+1];let N;if(B){A(),N=Math.atan2(f-p,g-m),b&&(N+=N>0?-P:P);const G=(L+C)/2,F=(D+T)/2;return O[0]=[G,F,(I-r)/2,N,n],O}n=n.replace(/\n/g," ");for(let G=0,F=n.length;G<F;){A();let X=Math.atan2(f-p,g-m);if(b&&(X+=X>0?-P:P),N!==void 0){let z=X-N;if(z+=z>P?-2*P:z<-P?2*P:0,Math.abs(z)>o)return null}N=X;const W=G;let U=0;for(;G<F;++G){const z=b?F-G-1:G,Q=a*l(c,n[z],h);if(e+i<t&&y+_<r+U+Q/2)break;U+=Q}if(G===W)continue;const v=b?n.substring(F-W,F-G):n.substring(W,G);x=_===0?0:(r+U/2-y)/_;const K=lerp(m,g,x),H=lerp(p,f,x);O.push([K,H,U/2,X,v]),r+=U}return O}class ZIndexContext{constructor(){se(this,"pushMethodArgs_",(...e)=>(this.push_(e),this));this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(getSharedCanvasContext2D(),{get:(e,t)=>{if(typeof getSharedCanvasContext2D()[t]=="function")return this.push_(t),this.pushMethodArgs_},set:(e,t,i)=>(this.push_(t,i),!0)})}push_(...e){const t=this.instructions_,i=this.zIndex+this.offset_;t[i]||(t[i]=[]),t[i].push(...e)}pushFunction(e){this.push_(e)}getContext(){return this.context_}draw(e){this.instructions_.forEach(t=>{for(let i=0,n=t.length;i<n;++i){const r=t[i];if(typeof r=="function"){r(e);continue}const o=t[++i];if(typeof e[r]=="function")e[r](...o);else{if(typeof o=="function"){e[r]=o(e);continue}e[r]=o}}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}}const tmpExtent=createEmpty(),p1=[],p2=[],p3=[],p4=[];function getDeclutterBox(s){return s[3].declutterBox}const rtlRegEx=new RegExp("[֑-ࣿיִ-﷿ﹰ-ﻼࠀ--]");function horizontalTextAlign(s,e){return e==="start"?e=rtlRegEx.test(s)?"right":"left":e==="end"&&(e=rtlRegEx.test(s)?"left":"right"),TEXT_ALIGN[e]}function createTextChunks(s,e,t){return t>0&&s.push(`
|
|
4
|
+
`,""),s.push(e,""),s}function richTextToPlainText(s,e,t){return t%2===0&&(s+=e),s}class Executor{constructor(e,t,i,n,r){this.overlaps=i,this.pixelRatio=t,this.resolution=e,this.alignAndScaleFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=create(),this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=r?new ZIndexContext:null}getZIndexContext(){return this.zIndexContext_}createLabel(e,t,i,n){const r=e+t+i+n;if(this.labels_[r])return this.labels_[r];const o=n?this.strokeStates[n]:null,a=i?this.fillStates[i]:null,l=this.textStates[t],c=this.pixelRatio,h=[l.scale[0]*c,l.scale[1]*c],u=l.justify?TEXT_ALIGN[l.justify]:horizontalTextAlign(Array.isArray(e)?e[0]:e,l.textAlign||defaultTextAlign),d=n&&o.lineWidth?o.lineWidth:0,g=Array.isArray(e)?e:String(e).split(`
|
|
5
|
+
`).reduce(createTextChunks,[]),{width:f,height:m,widths:p,heights:_,lineWidths:y}=getTextDimensions(l,g),A=f+d,x=[],C=(A+2)*h[0],T=(m+d)*h[1],S={width:C<0?Math.floor(C):Math.ceil(C),height:T<0?Math.floor(T):Math.ceil(T),contextInstructions:x};(h[0]!=1||h[1]!=1)&&x.push("scale",h),n&&(x.push("strokeStyle",o.strokeStyle),x.push("lineWidth",d),x.push("lineCap",o.lineCap),x.push("lineJoin",o.lineJoin),x.push("miterLimit",o.miterLimit),x.push("setLineDash",[o.lineDash]),x.push("lineDashOffset",o.lineDashOffset)),i&&x.push("fillStyle",a.fillStyle),x.push("textBaseline","middle"),x.push("textAlign","center");const w=.5-u;let I=u*A+w*d;const L=[],D=[];let b=0,P=0,O=0,B=0,N;for(let G=0,F=g.length;G<F;G+=2){const X=g[G];if(X===`
|
|
6
|
+
`){P+=b,b=0,I=u*A+w*d,++B;continue}const W=g[G+1]||l.font;W!==N&&(n&&L.push("font",W),i&&D.push("font",W),N=W),b=Math.max(b,_[O]);const U=[X,I+w*p[O]+u*(p[O]-y[B]),.5*(d+b)+P];I+=p[O],n&&L.push("strokeText",U),i&&D.push("fillText",U),++O}return Array.prototype.push.apply(x,L),Array.prototype.push.apply(x,D),this.labels_[r]=S,S}replayTextBackground_(e,t,i,n,r,o,a){e.beginPath(),e.moveTo.apply(e,t),e.lineTo.apply(e,i),e.lineTo.apply(e,n),e.lineTo.apply(e,r),e.lineTo.apply(e,t),o&&(this.alignAndScaleFill_=o[2],e.fillStyle=o[1],this.fill_(e)),a&&(this.setStrokeStyle_(e,a),e.stroke())}calculateImageOrLabelDimensions_(e,t,i,n,r,o,a,l,c,h,u,d,g,f,m,p){a*=d[0],l*=d[1];let _=i-a,y=n-l;const A=r+c>e?e-c:r,x=o+h>t?t-h:o,C=f[3]+A*d[0]+f[1],T=f[0]+x*d[1]+f[2],S=_-f[3],w=y-f[0];(m||u!==0)&&(p1[0]=S,p4[0]=S,p1[1]=w,p2[1]=w,p2[0]=S+C,p3[0]=p2[0],p3[1]=w+T,p4[1]=p3[1]);let I;return u!==0?(I=compose(create(),i,n,1,1,u,-i,-n),apply(I,p1),apply(I,p2),apply(I,p3),apply(I,p4),createOrUpdate$2(Math.min(p1[0],p2[0],p3[0],p4[0]),Math.min(p1[1],p2[1],p3[1],p4[1]),Math.max(p1[0],p2[0],p3[0],p4[0]),Math.max(p1[1],p2[1],p3[1],p4[1]),tmpExtent)):createOrUpdate$2(Math.min(S,S+C),Math.min(w,w+T),Math.max(S,S+C),Math.max(w,w+T),tmpExtent),g&&(_=Math.round(_),y=Math.round(y)),{drawImageX:_,drawImageY:y,drawImageW:A,drawImageH:x,originX:c,originY:h,declutterBox:{minX:tmpExtent[0],minY:tmpExtent[1],maxX:tmpExtent[2],maxY:tmpExtent[3],value:p},canvasTransform:I,scale:d}}replayImageOrLabel_(e,t,i,n,r,o,a){const l=!!(o||a),c=n.declutterBox,h=a?a[2]*n.scale[0]/2:0;return c.minX-h<=t[0]&&c.maxX+h>=0&&c.minY-h<=t[1]&&c.maxY+h>=0&&(l&&this.replayTextBackground_(e,p1,p2,p3,p4,o,a),drawImageOrLabel(e,n.canvasTransform,r,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(e){const t=this.alignAndScaleFill_;if(t){const i=apply(this.renderedTransform_,[0,0]),n=512*this.pixelRatio;e.save(),e.translate(i[0]%n,i[1]%n),t!==1&&e.scale(t,t),e.rotate(this.viewRotation_)}e.fill(),t&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],t[1]&&(e.lineWidth=t[2],e.lineCap=t[3],e.lineJoin=t[4],e.miterLimit=t[5],e.lineDashOffset=t[7],e.setLineDash(t[6]))}drawLabelWithPointPlacement_(e,t,i,n){const r=this.textStates[t],o=this.createLabel(e,t,n,i),a=this.strokeStates[i],l=this.pixelRatio,c=horizontalTextAlign(Array.isArray(e)?e[0]:e,r.textAlign||defaultTextAlign),h=TEXT_ALIGN[r.textBaseline||defaultTextBaseline],u=a&&a.lineWidth?a.lineWidth:0,d=o.width/l-2*r.scale[0],g=c*d+2*(.5-c)*u,f=h*o.height/l+2*(.5-h)*u;return{label:o,anchorX:g,anchorY:f}}execute_(e,t,i,n,r,o,a,l){const c=this.zIndexContext_;let h;this.pixelCoordinates_&&equals$2(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=transform2D(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),setFromArray(this.renderedTransform_,i));let u=0;const d=n.length;let g=0,f,m,p,_,y,A,x,C,T,S,w,I,L,D=0,b=0;const P=this.coordinateCache_,O=this.viewRotation_,B=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,N={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:O},G=this.instructions!=n||this.overlaps?0:200;let F,X,W,U;for(;u<d;){const v=n[u];switch(v[0]){case Instruction.BEGIN_GEOMETRY:F=v[1],U=v[3],F.getGeometry()?a!==void 0&&!intersects$1(a,U.getExtent())?u=v[2]+1:++u:u=v[2],c&&(c.zIndex=v[4]);break;case Instruction.BEGIN_PATH:D>G&&(this.fill_(e),D=0),b>G&&(e.stroke(),b=0),!D&&!b&&(e.beginPath(),y=NaN,A=NaN),++u;break;case Instruction.CIRCLE:g=v[1];const H=h[g],z=h[g+1],Q=h[g+2],j=h[g+3],re=Q-H,ne=j-z,J=Math.sqrt(re*re+ne*ne);e.moveTo(H+J,z),e.arc(H,z,J,0,2*Math.PI,!0),++u;break;case Instruction.CLOSE_PATH:e.closePath(),++u;break;case Instruction.CUSTOM:g=v[1],f=v[2];const Te=v[3],Ie=v[4],ye=v[5];N.geometry=Te,N.feature=F,u in P||(P[u]=[]);const ue=P[u];ye?ye(h,g,f,2,ue):(ue[0]=h[g],ue[1]=h[g+1],ue.length=2),c&&(c.zIndex=v[6]),Ie(ue,N),++u;break;case Instruction.DRAW_IMAGE:g=v[1],f=v[2],T=v[3],m=v[4],p=v[5];let $=v[6];const oe=v[7],fe=v[8],pe=v[9],Ee=v[10];let de=v[11];const me=v[12];let _e=v[13];_=v[14]||"declutter";const V=v[15];if(!T&&v.length>=20){S=v[19],w=v[20],I=v[21],L=v[22];const ee=this.drawLabelWithPointPlacement_(S,w,I,L);T=ee.label,v[3]=T;const ge=v[23];m=(ee.anchorX-ge)*this.pixelRatio,v[4]=m;const te=v[24];p=(ee.anchorY-te)*this.pixelRatio,v[5]=p,$=T.height,v[6]=$,_e=T.width,v[13]=_e}let ve;v.length>25&&(ve=v[25]);let Re,we,Se;v.length>17?(Re=v[16],we=v[17],Se=v[18]):(Re=defaultPadding,we=null,Se=null),Ee&&B?de+=O:!Ee&&!B&&(de-=O);let Be=0;for(;g<f;g+=2){if(ve&&ve[Be++]<_e/this.pixelRatio)continue;const ee=this.calculateImageOrLabelDimensions_(T.width,T.height,h[g],h[g+1],_e,$,m,p,fe,pe,de,me,r,Re,!!we||!!Se,F),ge=[e,t,T,ee,oe,we,Se];if(l){let te,ae,ie;if(V){const Y=f-g;if(!V[Y]){V[Y]={args:ge,declutterMode:_};continue}const q=V[Y];te=q.args,ae=q.declutterMode,delete V[Y],ie=getDeclutterBox(te)}let le,he;if(te&&(ae!=="declutter"||!l.collides(ie))&&(le=!0),(_!=="declutter"||!l.collides(ee.declutterBox))&&(he=!0),ae==="declutter"&&_==="declutter"){const Y=le&&he;le=Y,he=Y}le&&(ae!=="none"&&l.insert(ie),this.replayImageOrLabel_.apply(this,te)),he&&(_!=="none"&&l.insert(ee.declutterBox),this.replayImageOrLabel_.apply(this,ge))}else this.replayImageOrLabel_.apply(this,ge)}++u;break;case Instruction.DRAW_CHARS:const Oe=v[1],be=v[2],Le=v[3],Xe=v[4];L=v[5];const We=v[6],De=v[7],Fe=v[8];I=v[9];const Pe=v[10];S=v[11],Array.isArray(S)&&(S=S.reduce(richTextToPlainText,"")),w=v[12];const ke=[v[13],v[13]];_=v[14]||"declutter";const Ue=v[15],Me=this.textStates[w],xe=Me.font,Ce=[Me.scale[0]*De,Me.scale[1]*De];let Ae;xe in this.widths_?Ae=this.widths_[xe]:(Ae={},this.widths_[xe]=Ae);const Ne=lineStringLength(h,Oe,be,2),Ge=Math.abs(Ce[0])*measureAndCacheTextWidth(xe,S,Ae);if(Xe||Ge<=Ne){const ee=this.textStates[w].textAlign,ge=(Ne-Ge)*horizontalTextAlign(S,ee),te=drawTextOnPath(h,Oe,be,2,S,ge,We,Math.abs(Ce[0]),measureAndCacheTextWidth,xe,Ae,B?0:this.viewRotation_,Ue);e:if(te){const ae=[];let ie,le,he,Y,q;if(I)for(ie=0,le=te.length;ie<le;++ie){q=te[ie],he=q[4],Y=this.createLabel(he,w,"",I),m=q[2]+(Ce[0]<0?-Pe:Pe),p=Le*Y.height+(.5-Le)*2*Pe*Ce[1]/Ce[0]-Fe;const ce=this.calculateImageOrLabelDimensions_(Y.width,Y.height,q[0],q[1],Y.width,Y.height,m,p,0,0,q[3],ke,!1,defaultPadding,!1,F);if(l&&_==="declutter"&&l.collides(ce.declutterBox))break e;ae.push([e,t,Y,ce,1,null,null])}if(L)for(ie=0,le=te.length;ie<le;++ie){q=te[ie],he=q[4],Y=this.createLabel(he,w,L,""),m=q[2],p=Le*Y.height-Fe;const ce=this.calculateImageOrLabelDimensions_(Y.width,Y.height,q[0],q[1],Y.width,Y.height,m,p,0,0,q[3],ke,!1,defaultPadding,!1,F);if(l&&_==="declutter"&&l.collides(ce.declutterBox))break e;ae.push([e,t,Y,ce,1,null,null])}l&&_!=="none"&&l.load(ae.map(getDeclutterBox));for(let ce=0,Ye=ae.length;ce<Ye;++ce)this.replayImageOrLabel_.apply(this,ae[ce])}}++u;break;case Instruction.END_GEOMETRY:if(o!==void 0){F=v[1];const ee=o(F,U,_);if(ee)return ee}++u;break;case Instruction.FILL:G?D++:this.fill_(e),++u;break;case Instruction.MOVE_TO_LINE_TO:for(g=v[1],f=v[2],X=h[g],W=h[g+1],e.moveTo(X,W),y=X+.5|0,A=W+.5|0,g+=2;g<f;g+=2)X=h[g],W=h[g+1],x=X+.5|0,C=W+.5|0,(g==f-2||x!==y||C!==A)&&(e.lineTo(X,W),y=x,A=C);++u;break;case Instruction.SET_FILL_STYLE:this.alignAndScaleFill_=v[2],D&&(this.fill_(e),D=0,b&&(e.stroke(),b=0)),e.fillStyle=v[1],++u;break;case Instruction.SET_STROKE_STYLE:b&&(e.stroke(),b=0),this.setStrokeStyle_(e,v),++u;break;case Instruction.STROKE:G?b++:e.stroke(),++u;break;default:++u;break}}D&&this.fill_(e),b&&e.stroke()}execute(e,t,i,n,r,o){this.viewRotation_=n,this.execute_(e,t,i,this.instructions,r,void 0,void 0,o)}executeHitDetection(e,t,i,n,r){return this.viewRotation_=i,this.execute_(e,[e.canvas.width,e.canvas.height],t,this.hitDetectionInstructions,!0,n,r)}}const ALL=["Polygon","Circle","LineString","Image","Text","Default"],DECLUTTER=["Image","Text"],NON_DECLUTTER=ALL.filter(s=>!DECLUTTER.includes(s));class ExecutorGroup{constructor(e,t,i,n,r,o,a){this.maxExtent_=e,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=t,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=create(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(r,a)}clip(e,t){const i=this.getClipCoords(t);e.beginPath(),e.moveTo(i[0],i[1]),e.lineTo(i[2],i[3]),e.lineTo(i[4],i[5]),e.lineTo(i[6],i[7]),e.clip()}createExecutors_(e,t){for(const i in e){let n=this.executorsByZIndex_[i];n===void 0&&(n={},this.executorsByZIndex_[i]=n);const r=e[i];for(const o in r){const a=r[o];n[o]=new Executor(this.resolution_,this.pixelRatio_,this.overlaps_,a,t)}}}hasExecutors(e){for(const t in this.executorsByZIndex_){const i=this.executorsByZIndex_[t];for(let n=0,r=e.length;n<r;++n)if(e[n]in i)return!0}return!1}forEachFeatureAtCoordinate(e,t,i,n,r,o){n=Math.round(n);const a=n*2+1,l=compose(this.hitDetectionTransform_,n+.5,n+.5,1/t,-1/t,-i,-e[0],-e[1]),c=!this.hitDetectionContext_;c&&(this.hitDetectionContext_=createCanvasContext2D(a,a));const h=this.hitDetectionContext_;h.canvas.width!==a||h.canvas.height!==a?(h.canvas.width=a,h.canvas.height=a):c||h.clearRect(0,0,a,a);let u;this.renderBuffer_!==void 0&&(u=createEmpty(),extendCoordinate(u,e),buffer(u,t*(this.renderBuffer_+n),u));const d=getPixelIndexArray(n);let g;function f(C,T,S){const w=h.getImageData(0,0,a,a).data;for(let I=0,L=d.length;I<L;I++)if(w[d[I]]>0){if(!o||S==="none"||g!=="Image"&&g!=="Text"||o.includes(C)){const D=(d[I]-3)/4,b=n-D%a,P=n-(D/a|0),O=r(C,T,b*b+P*P);if(O)return O}h.clearRect(0,0,a,a);break}}const m=Object.keys(this.executorsByZIndex_).map(Number);m.sort(ascending);let p,_,y,A,x;for(p=m.length-1;p>=0;--p){const C=m[p].toString();for(y=this.executorsByZIndex_[C],_=ALL.length-1;_>=0;--_)if(g=ALL[_],A=y[g],A!==void 0&&(x=A.executeHitDetection(h,l,i,f,u),x))return x}}getClipCoords(e){const t=this.maxExtent_;if(!t)return null;const i=t[0],n=t[1],r=t[2],o=t[3],a=[i,n,i,o,r,o,r,n];return transform2D(a,0,8,2,e,a),a}isEmpty(){return isEmpty$1(this.executorsByZIndex_)}execute(e,t,i,n,r,o,a){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?descending:ascending),o=o||ALL;const c=ALL.length;for(let h=0,u=l.length;h<u;++h){const d=l[h].toString(),g=this.executorsByZIndex_[d];for(let f=0,m=o.length;f<m;++f){const p=o[f],_=g[p];if(_!==void 0){const y=a===null?void 0:_.getZIndexContext(),A=y?y.getContext():e,x=this.maxExtent_&&p!=="Image"&&p!=="Text";if(x&&(A.save(),this.clip(A,i)),!y||p==="Text"||p==="Image"?_.execute(A,t,i,n,r,a):y.pushFunction(C=>_.execute(C,t,i,n,r,a)),x&&A.restore(),y){y.offset();const C=l[h]*c+ALL.indexOf(p);this.deferredZIndexContexts_[C]||(this.deferredZIndexContexts_[C]=[]),this.deferredZIndexContexts_[C].push(y)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(ascending);for(let i=0,n=t.length;i<n;++i)e[t[i]].forEach(r=>{r.draw(this.renderedContext_),r.clear()}),e[t[i]].length=0}}const circlePixelIndexArrayCache={};function getPixelIndexArray(s){if(circlePixelIndexArrayCache[s]!==void 0)return circlePixelIndexArrayCache[s];const e=s*2+1,t=s*s,i=new Array(t+1);for(let r=0;r<=s;++r)for(let o=0;o<=s;++o){const a=r*r+o*o;if(a>t)break;let l=i[a];l||(l=[],i[a]=l),l.push(((s+r)*e+(s+o))*4+3),r>0&&l.push(((s-r)*e+(s+o))*4+3),o>0&&(l.push(((s+r)*e+(s-o))*4+3),r>0&&l.push(((s-r)*e+(s-o))*4+3))}const n=[];for(let r=0,o=i.length;r<o;++r)i[r]&&n.push(...i[r]);return circlePixelIndexArrayCache[s]=n,n}const HIT_DETECT_RESOLUTION=.5;function createHitDetectionImageData(s,e,t,i,n,r,o,a,l){const c=n,h=s[0]*HIT_DETECT_RESOLUTION,u=s[1]*HIT_DETECT_RESOLUTION,d=createCanvasContext2D(h,u);d.imageSmoothingEnabled=!1;const g=d.canvas,f=new CanvasImmediateRenderer(d,HIT_DETECT_RESOLUTION,n,null,o,a,null),m=t.length,p=Math.floor((256*256*256-1)/m),_={};for(let A=1;A<=m;++A){const x=t[A-1],C=x.getStyleFunction()||i;if(!C)continue;let T=C(x,r);if(!T)continue;Array.isArray(T)||(T=[T]);const w=(A*p).toString(16).padStart(7,"#00000");for(let I=0,L=T.length;I<L;++I){const D=T[I],b=D.getGeometryFunction()(x);if(!b||!intersects$1(c,b.getExtent()))continue;const P=D.clone(),O=P.getFill();O&&O.setColor(w);const B=P.getStroke();B&&(B.setColor(w),B.setLineDash(null)),P.setText(void 0);const N=D.getImage();if(N){const W=N.getImageSize();if(!W)continue;const U=createCanvasContext2D(W[0],W[1],void 0,{alpha:!1}),v=U.canvas;U.fillStyle=w,U.fillRect(0,0,v.width,v.height),P.setImage(new Icon({img:v,anchor:N.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:N.getOrigin(),opacity:1,size:N.getSize(),scale:N.getScale(),rotation:N.getRotation(),rotateWithView:N.getRotateWithView()}))}const G=P.getZIndex()||0;let F=_[G];F||(F={},_[G]=F,F.Polygon=[],F.Circle=[],F.LineString=[],F.Point=[]);const X=b.getType();if(X==="GeometryCollection"){const W=b.getGeometriesArrayRecursive();for(let U=0,v=W.length;U<v;++U){const K=W[U];F[K.getType().replace("Multi","")].push(K,P)}}else F[X.replace("Multi","")].push(b,P)}}const y=Object.keys(_).map(Number).sort(ascending);for(let A=0,x=y.length;A<x;++A){const C=_[y[A]];for(const T in C){const S=C[T];for(let w=0,I=S.length;w<I;w+=2){f.setStyle(S[w+1]);for(let L=0,D=e.length;L<D;++L)f.setTransform(e[L]),f.drawGeometry(S[w])}}}return d.getImageData(0,0,g.width,g.height)}function hitDetect(s,e,t){const i=[];if(t){const n=Math.floor(Math.round(s[0])*HIT_DETECT_RESOLUTION),r=Math.floor(Math.round(s[1])*HIT_DETECT_RESOLUTION),o=(clamp(n,0,t.width-1)+clamp(r,0,t.height-1)*t.width)*4,a=t.data[o],l=t.data[o+1],h=t.data[o+2]+256*(l+256*a),u=Math.floor((256*256*256-1)/e.length);h&&h%u===0&&i.push(e[h/u-1])}return i}const maxStaleKeys=5;class LayerRenderer extends Observable{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=maxStaleKeys}getStaleKeys(){return this.staleKeys_}prependStaleKey(e){this.staleKeys_.unshift(e),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(e){return abstract()}getData(e){return null}prepareFrame(e){return abstract()}renderFrame(e,t){return abstract()}forEachFeatureAtCoordinate(e,t,i,n,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){const t=e.target;(t.getState()===ImageState.LOADED||t.getState()===ImageState.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=ImageState.LOADED&&t!=ImageState.ERROR&&e.addEventListener(EventType.CHANGE,this.boundHandleImageChange_),t==ImageState.IDLE&&(e.load(),t=e.getState()),t==ImageState.LOADED}renderIfReadyAndVisible(){const e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}}const canvasPool$1=[];let pixelContext=null;function createPixelContext(){pixelContext=createCanvasContext2D(1,1,void 0,{willReadFrequently:!0})}class CanvasLayerRenderer extends LayerRenderer{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=create(),this.pixelTransform=create(),this.inversePixelTransform=create(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,i){pixelContext||createPixelContext(),pixelContext.clearRect(0,0,1,1);let n;try{pixelContext.drawImage(e,t,i,1,1,0,0,1,1),n=pixelContext.getImageData(0,0,1,1).data}catch{return pixelContext=null,null}return n}getBackground(e){let i=this.getLayer().getBackground();return typeof i=="function"&&(i=i(e.viewState.resolution)),i||void 0}useContainer(e,t,i){const n=this.getLayer().getClassName();let r,o;if(e&&e.className===n&&(!i||e&&e.style.backgroundColor&&equals$2(asArray(e.style.backgroundColor),asArray(i)))){const a=e.firstElementChild;a instanceof HTMLCanvasElement&&(o=a.getContext("2d"))}if(o&&equivalent(o.canvas.style.transform,t)?(this.container=e,this.context=o,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){r=document.createElement("div"),r.className=n;let a=r.style;a.position="absolute",a.width="100%",a.height="100%",o=createCanvasContext2D();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(e,t,i){const n=getTopLeft(i),r=getTopRight(i),o=getBottomRight(i),a=getBottomLeft(i);apply(t.coordinateToPixelTransform,n),apply(t.coordinateToPixelTransform,r),apply(t.coordinateToPixelTransform,o),apply(t.coordinateToPixelTransform,a);const l=this.inversePixelTransform;apply(l,n),apply(l,r),apply(l,o),apply(l,a),e.save(),e.beginPath(),e.moveTo(Math.round(n[0]),Math.round(n[1])),e.lineTo(Math.round(r[0]),Math.round(r[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.lineTo(Math.round(a[0]),Math.round(a[1])),e.clip()}prepareContainer(e,t){const i=e.extent,n=e.viewState.resolution,r=e.viewState.rotation,o=e.pixelRatio,a=Math.round(getWidth(i)/n*o),l=Math.round(getHeight(i)/n*o);compose(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,r,-a/2,-l/2),makeInverse(this.inversePixelTransform,this.pixelTransform);const c=toString$1(this.pixelTransform);if(this.useContainer(t,c,this.getBackground(e)),!this.containerReused){const h=this.context.canvas;h.width!=a||h.height!=l?(h.width=a,h.height=l):this.context.clearRect(0,0,a,l),c!==h.style.transform&&(h.style.transform=c)}}dispatchRenderEvent_(e,t,i){const n=this.getLayer();if(n.hasListener(e)){const r=new RenderEvent(e,this.inversePixelTransform,i,t);n.dispatchEvent(r)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(RenderEventType.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(RenderEventType.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new ZIndexContext),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(RenderEventType.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(RenderEventType.POSTRENDER,this.context,e))}getRenderTransform(e,t,i,n,r,o,a){const l=r/2,c=o/2,h=n/t,u=-h,d=-e[0]+a,g=-e[1];return compose(this.tempTransform,l,c,h,u,-i,d,g)}disposeInternal(){delete this.frameState,super.disposeInternal()}}class CanvasVectorLayerRenderer extends CanvasLayerRenderer{constructor(e){super(e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipped_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=createEmpty(),this.wrappedRenderedExtent_=createEmpty(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(e,t,i){const n=t.extent,r=t.viewState,o=r.center,a=r.resolution,l=r.projection,c=r.rotation,h=l.getExtent(),u=this.getLayer().getSource(),d=this.getLayer().getDeclutter(),g=t.pixelRatio,f=t.viewHints,m=!(f[ViewHint.ANIMATING]||f[ViewHint.INTERACTING]),p=this.context,_=Math.round(getWidth(n)/a*g),y=Math.round(getHeight(n)/a*g),A=u.getWrapX()&&l.canWrapX(),x=A?getWidth(h):null,C=A?Math.ceil((n[2]-h[2])/x)+1:1;let T=A?Math.floor((n[0]-h[0])/x):0;do{let S=this.getRenderTransform(o,a,0,g,_,y,T*x);t.declutter&&(S=S.slice(0)),e.execute(p,[p.canvas.width,p.canvas.height],S,c,m,i===void 0?ALL:i?DECLUTTER:NON_DECLUTTER,i?d&&t.declutter[d]:void 0)}while(++T<C)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=createCanvasContext2D(this.context.canvas.width,this.context.canvas.height,canvasPool$1))}resetDrawContext_(){if(this.opacity_!==1&&this.targetContext_){const e=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=e,releaseCanvas(this.context),canvasPool$1.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(e){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,e,!0)}renderDeferredInternal(e){this.replayGroup_&&(this.replayGroup_.renderDeferred(),this.clipped_&&this.context.restore(),this.resetDrawContext_())}renderFrame(e,t){const i=e.layerStatesArray[e.layerIndex];this.opacity_=i.opacity;const n=e.viewState;this.prepareContainer(e,t);const r=this.context,o=this.replayGroup_;let a=o&&!o.isEmpty();if(!a&&!(this.getLayer().hasListener(RenderEventType.PRERENDER)||this.getLayer().hasListener(RenderEventType.POSTRENDER)))return this.container;if(this.setDrawContext_(),this.preRender(r,e),n.projection,this.clipped_=!1,a&&i.extent&&this.clipping){const l=fromUserExtent(i.extent);a=intersects$1(l,e.extent),this.clipped_=a&&!containsExtent(l,e.extent),this.clipped_&&this.clipUnrotated(r,e,l)}return a&&this.renderWorlds(o,e,this.getLayer().getDeclutter()?!1:void 0),!e.declutter&&this.clipped_&&r.restore(),this.postRender(r,e),this.renderedRotation_!==n.rotation&&(this.renderedRotation_=n.rotation,this.hitDetectionImageData_=null),e.declutter||this.resetDrawContext_(),this.container}getFeatures(e){return new Promise(t=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const i=this.frameState.size.slice(),n=this.renderedCenter_,r=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,c=this.getLayer(),h=[],u=i[0]*HIT_DETECT_RESOLUTION,d=i[1]*HIT_DETECT_RESOLUTION;h.push(this.getRenderTransform(n,r,o,HIT_DETECT_RESOLUTION,u,d,0).slice());const g=c.getSource(),f=a.getExtent();if(g.getWrapX()&&a.canWrapX()&&!containsExtent(f,l)){let m=l[0];const p=getWidth(f);let _=0,y;for(;m<f[0];)--_,y=p*_,h.push(this.getRenderTransform(n,r,o,HIT_DETECT_RESOLUTION,u,d,y).slice()),m+=p;for(_=0,m=l[2];m>f[2];)++_,y=p*_,h.push(this.getRenderTransform(n,r,o,HIT_DETECT_RESOLUTION,u,d,y).slice()),m-=p}this.hitDetectionImageData_=createHitDetectionImageData(i,h,this.renderedFeatures_,c.getStyleFunction(),l,r,o,getSquaredTolerance(r,this.renderedPixelRatio_))}t(hitDetect(e,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(e,t,i,n,r){var d,g;if(!this.replayGroup_)return;const o=t.viewState.resolution,a=t.viewState.rotation,l=this.getLayer(),c={},h=function(f,m,p){const _=getUid(f),y=c[_];if(y){if(y!==!0&&p<y.distanceSq){if(p===0)return c[_]=!0,r.splice(r.lastIndexOf(y),1),n(f,l,m);y.geometry=m,y.distanceSq=p}}else{if(p===0)return c[_]=!0,n(f,l,m);r.push(c[_]={feature:f,layer:l,geometry:m,distanceSq:p,callback:n})}},u=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(e,o,a,i,h,u?(g=(d=t.declutter)==null?void 0:d[u])==null?void 0:g.all().map(f=>f.value):null)}handleFontsChanged(){const e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){const t=this.getLayer(),i=t.getSource();if(!i)return!1;const n=e.viewHints[ViewHint.ANIMATING],r=e.viewHints[ViewHint.INTERACTING],o=t.getUpdateWhileAnimating(),a=t.getUpdateWhileInteracting();if(this.ready&&!o&&n||!a&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const l=e.extent,c=e.viewState,h=c.projection,u=c.resolution,d=e.pixelRatio,g=t.getRevision(),f=t.getRenderBuffer();let m=t.getRenderOrder();m===void 0&&(m=defaultOrder);const p=c.center.slice(),_=buffer(l,f*u),y=_.slice(),A=[_.slice()],x=h.getExtent();if(i.getWrapX()&&h.canWrapX()&&!containsExtent(x,e.extent)){const O=getWidth(x),B=Math.max(getWidth(_)/2,O);_[0]=x[0]-B,_[2]=x[2]+B,wrapX$1(p,h);const N=wrapX$2(A[0],h);N[0]<x[0]&&N[2]<x[2]?A.push([N[0]+O,N[1],N[2]+O,N[3]]):N[0]>x[0]&&N[2]>x[2]&&A.push([N[0]-O,N[1],N[2]-O,N[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==g&&this.renderedRenderOrder_==m&&this.renderedFrameDeclutter_===!!e.declutter&&containsExtent(this.wrappedRenderedExtent_,_))return equals$2(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=p,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const C=new BuilderGroup(getTolerance(u,d),_,u,d);let T;for(let O=0,B=A.length;O<B;++O)i.loadFeatures(A[O],u,h);const S=getSquaredTolerance(u,d);let w=!0;const I=(O,B)=>{let N;const G=O.getStyleFunction()||t.getStyleFunction();if(G&&(N=G(O,u)),N){const F=this.renderFeature(O,S,N,C,T,this.getLayer().getDeclutter(),B);w=w&&!F}},L=toUserExtent(_),D=i.getFeaturesInExtent(L);m&&D.sort(m);for(let O=0,B=D.length;O<B;++O)I(D[O],O);this.renderedFeatures_=D,this.ready=w;const b=C.finish(),P=new ExecutorGroup(_,u,d,i.getOverlaps(),b,t.getRenderBuffer(),!!e.declutter);return this.renderedResolution_=u,this.renderedRevision_=g,this.renderedRenderOrder_=m,this.renderedFrameDeclutter_=!!e.declutter,this.renderedExtent_=y,this.wrappedRenderedExtent_=_,this.renderedCenter_=p,this.renderedProjection_=h,this.renderedPixelRatio_=d,this.replayGroup_=P,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(e,t,i,n,r,o,a){if(!i)return!1;let l=!1;if(Array.isArray(i))for(let c=0,h=i.length;c<h;++c)l=renderFeature(n,e,i[c],t,this.boundHandleStyleImageChange_,r,o,a)||l;else l=renderFeature(n,e,i,t,this.boundHandleStyleImageChange_,r,o,a);return l}}class VectorLayer extends BaseVectorLayer{constructor(e){super(e)}createRenderer(){return new CanvasVectorLayerRenderer(this)}}class Tile extends Target{constructor(e,t,i){super(),i=i||{},this.tileCoord=e,this.state=t,this.key="",this.transition_=i.transition===void 0?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(EventType.CHANGE)}release(){this.setState(TileState.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(e){if(this.state!==TileState.EMPTY){if(this.state!==TileState.ERROR&&this.state>e)throw new Error("Tile load sequence violation");this.state=e,this.changed()}}load(){abstract()}getAlpha(e,t){if(!this.transition_)return 1;let i=this.transitionStarts_[e];if(!i)i=t,this.transitionStarts_[e]=i;else if(i===-1)return 1;const n=t-i+1e3/60;return n>=this.transition_?1:easeIn(n/this.transition_)}inTransition(e){return this.transition_?this.transitionStarts_[e]!==-1:!1}endTransition(e){this.transition_&&(this.transitionStarts_[e]=-1)}disposeInternal(){this.release(),super.disposeInternal()}}function asImageLike(s){return s instanceof Image||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageBitmap?s:null}const disposedError=new Error("disposed"),defaultSize=[256,256];class DataTile extends Tile{constructor(e){const t=TileState.IDLE;super(e.tileCoord,t,{transition:e.transition,interpolate:e.interpolate}),this.loader_=e.loader,this.data_=null,this.error_=null,this.size_=e.size||null,this.controller_=e.controller||null}getSize(){if(this.size_)return this.size_;const e=asImageLike(this.data_);return e?[e.width,e.height]:defaultSize}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==TileState.IDLE&&this.state!==TileState.ERROR)return;this.state=TileState.LOADING,this.changed();const e=this;this.loader_().then(function(t){e.data_=t,e.state=TileState.LOADED,e.changed()}).catch(function(t){e.error_=t,e.state=TileState.ERROR,e.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(disposedError),this.controller_=null),super.disposeInternal()}}class ImageTile extends Tile{constructor(e,t,i,n,r,o){super(e,t,o),this.crossOrigin_=n,this.src_=i,this.key=i,this.image_=new Image,n!==null&&(this.image_.crossOrigin=n),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(e){this.image_=e,this.state=TileState.LOADED,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=TileState.ERROR,this.unlistenImage_(),this.image_=getBlankImage(),this.changed()}handleImageLoad_(){const e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=TileState.LOADED:this.state=TileState.EMPTY,this.unlistenImage_(),this.changed()}load(){this.state==TileState.ERROR&&(this.state=TileState.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==TileState.IDLE&&(this.state=TileState.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=listenImage(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 getBlankImage(){const s=createCanvasContext2D(1,1);return s.fillStyle="rgba(0,0,0,0)",s.fillRect(0,0,1,1),s.canvas}let brokenDiagonalRendering_;const canvasPool=[];function drawTestTriangle(s,e,t,i,n){s.beginPath(),s.moveTo(0,0),s.lineTo(e,t),s.lineTo(i,n),s.closePath(),s.save(),s.clip(),s.fillRect(0,0,Math.max(e,i)+1,Math.max(t,n)),s.restore()}function verifyBrokenDiagonalRendering(s,e){return Math.abs(s[e*4]-210)>2||Math.abs(s[e*4+3]-.75*255)>2}function isBrokenDiagonalRendering(){if(brokenDiagonalRendering_===void 0){const s=createCanvasContext2D(6,6,canvasPool);s.globalCompositeOperation="lighter",s.fillStyle="rgba(210, 0, 0, 0.75)",drawTestTriangle(s,4,5,4,0),drawTestTriangle(s,4,5,0,5);const e=s.getImageData(0,0,3,3).data;brokenDiagonalRendering_=verifyBrokenDiagonalRendering(e,0)||verifyBrokenDiagonalRendering(e,4)||verifyBrokenDiagonalRendering(e,8),releaseCanvas(s),canvasPool.push(s.canvas)}return brokenDiagonalRendering_}function calculateSourceResolution(s,e,t,i){const n=transform(t,e,s);let r=getPointResolution(e,i,t);const o=e.getMetersPerUnit();o!==void 0&&(r*=o);const a=s.getMetersPerUnit();a!==void 0&&(r/=a);const l=s.getExtent();if(!l||containsCoordinate(l,n)){const c=getPointResolution(s,r,n)/r;isFinite(c)&&c>0&&(r/=c)}return r}function calculateSourceExtentResolution(s,e,t,i){const n=getCenter(t);let r=calculateSourceResolution(s,e,n,i);return(!isFinite(r)||r<=0)&&forEachCorner(t,function(o){return r=calculateSourceResolution(s,e,o,i),isFinite(r)&&r>0}),r}function render(s,e,t,i,n,r,o,a,l,c,h,u,d,g){const f=createCanvasContext2D(Math.round(t*s),Math.round(t*e),canvasPool);if(u||(f.imageSmoothingEnabled=!1),l.length===0)return f.canvas;f.scale(t,t);function m(C){return Math.round(C*t)/t}f.globalCompositeOperation="lighter";const p=createEmpty();l.forEach(function(C,T,S){extend$1(p,C.extent)});let _;const y=t/i,A=(u?1:1+Math.pow(2,-24))/y;(!d||l.length!==1||c!==0)&&(_=createCanvasContext2D(Math.round(getWidth(p)*y),Math.round(getHeight(p)*y),canvasPool),u||(_.imageSmoothingEnabled=!1),l.forEach(function(C,T,S){if(C.image.width>0&&C.image.height>0){if(C.clipExtent){_.save();const b=(C.clipExtent[0]-p[0])*y,P=-(C.clipExtent[3]-p[3])*y,O=getWidth(C.clipExtent)*y,B=getHeight(C.clipExtent)*y;_.rect(u?b:Math.round(b),u?P:Math.round(P),u?O:Math.round(b+O)-Math.round(b),u?B:Math.round(P+B)-Math.round(P)),_.clip()}const w=(C.extent[0]-p[0])*y,I=-(C.extent[3]-p[3])*y,L=getWidth(C.extent)*y,D=getHeight(C.extent)*y;_.drawImage(C.image,c,c,C.image.width-2*c,C.image.height-2*c,u?w:Math.round(w),u?I:Math.round(I),u?L:Math.round(w+L)-Math.round(w),u?D:Math.round(I+D)-Math.round(I)),C.clipExtent&&_.restore()}}));const x=getTopLeft(o);return a.getTriangles().forEach(function(C,T,S){const w=C.source,I=C.target;let L=w[0][0],D=w[0][1],b=w[1][0],P=w[1][1],O=w[2][0],B=w[2][1];const N=m((I[0][0]-x[0])/r),G=m(-(I[0][1]-x[1])/r),F=m((I[1][0]-x[0])/r),X=m(-(I[1][1]-x[1])/r),W=m((I[2][0]-x[0])/r),U=m(-(I[2][1]-x[1])/r),v=L,K=D;L=0,D=0,b-=v,P-=K,O-=v,B-=K;const H=[[b,P,0,0,F-N],[O,B,0,0,W-N],[0,0,b,P,X-G],[0,0,O,B,U-G]],z=solveLinearSystem(H);if(!z)return;if(f.save(),f.beginPath(),isBrokenDiagonalRendering()||!u){f.moveTo(F,X);const j=4,re=N-F,ne=G-X;for(let J=0;J<j;J++)f.lineTo(F+m((J+1)*re/j),X+m(J*ne/(j-1))),J!=j-1&&f.lineTo(F+m((J+1)*re/j),X+m((J+1)*ne/(j-1)));f.lineTo(W,U)}else f.moveTo(F,X),f.lineTo(N,G),f.lineTo(W,U);f.clip(),f.transform(z[0],z[2],z[1],z[3],N,G),f.translate(p[0]-v,p[3]-K);let Q;if(_)Q=_.canvas,f.scale(A,-A);else{const j=l[0],re=j.extent;Q=j.image,f.scale(getWidth(re)/Q.width,-getHeight(re)/Q.height)}f.drawImage(Q,0,0),f.restore()}),_&&(releaseCanvas(_),canvasPool.push(_.canvas)),h&&(f.save(),f.globalCompositeOperation="source-over",f.strokeStyle="black",f.lineWidth=1,a.getTriangles().forEach(function(C,T,S){const w=C.target,I=(w[0][0]-x[0])/r,L=-(w[0][1]-x[1])/r,D=(w[1][0]-x[0])/r,b=-(w[1][1]-x[1])/r,P=(w[2][0]-x[0])/r,O=-(w[2][1]-x[1])/r;f.beginPath(),f.moveTo(D,b),f.lineTo(I,L),f.lineTo(P,O),f.closePath(),f.stroke()}),f.restore()),f.canvas}const MAX_SUBDIVISION=10,MAX_TRIANGLE_WIDTH=.25;class Triangulation{constructor(e,t,i,n,r,o,a){this.sourceProj_=e,this.targetProj_=t;let l={};const c=a?createTransformFromCoordinateTransform(A=>apply(a,transform(A,this.targetProj_,this.sourceProj_))):getTransform(this.targetProj_,this.sourceProj_);this.transformInv_=function(A){const x=A[0]+"/"+A[1];return l[x]||(l[x]=c(A)),l[x]},this.maxSourceExtent_=n,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&getWidth(n)>=getWidth(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?getWidth(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?getWidth(this.targetProj_.getExtent()):null;const h=getTopLeft(i),u=getTopRight(i),d=getBottomRight(i),g=getBottomLeft(i),f=this.transformInv_(h),m=this.transformInv_(u),p=this.transformInv_(d),_=this.transformInv_(g),y=MAX_SUBDIVISION+(o?Math.max(0,Math.ceil(Math.log2(getArea(i)/(o*o*256*256)))):0);if(this.addQuad_(h,u,d,g,f,m,p,_,y),this.wrapsXInSource_){let A=1/0;this.triangles_.forEach(function(x,C,T){A=Math.min(A,x.source[0][0],x.source[1][0],x.source[2][0])}),this.triangles_.forEach(x=>{if(Math.max(x.source[0][0],x.source[1][0],x.source[2][0])-A>this.sourceWorldWidth_/2){const C=[[x.source[0][0],x.source[0][1]],[x.source[1][0],x.source[1][1]],[x.source[2][0],x.source[2][1]]];C[0][0]-A>this.sourceWorldWidth_/2&&(C[0][0]-=this.sourceWorldWidth_),C[1][0]-A>this.sourceWorldWidth_/2&&(C[1][0]-=this.sourceWorldWidth_),C[2][0]-A>this.sourceWorldWidth_/2&&(C[2][0]-=this.sourceWorldWidth_);const T=Math.min(C[0][0],C[1][0],C[2][0]);Math.max(C[0][0],C[1][0],C[2][0])-T<this.sourceWorldWidth_/2&&(x.source=C)}})}l={}}addTriangle_(e,t,i,n,r,o){this.triangles_.push({source:[n,r,o],target:[e,t,i]})}addQuad_(e,t,i,n,r,o,a,l,c){const h=boundingExtent([r,o,a,l]),u=this.sourceWorldWidth_?getWidth(h)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,g=this.sourceProj_.canWrapX()&&u>.5&&u<1;let f=!1;if(c>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const p=boundingExtent([e,t,i,n]);f=getWidth(p)/this.targetWorldWidth_>MAX_TRIANGLE_WIDTH||f}!g&&this.sourceProj_.isGlobal()&&u&&(f=u>MAX_TRIANGLE_WIDTH||f)}if(!f&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3])&&!intersects$1(h,this.maxSourceExtent_))return;let m=0;if(!f&&(!isFinite(r[0])||!isFinite(r[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(c>0)f=!0;else if(m=(!isFinite(r[0])||!isFinite(r[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),m!=1&&m!=2&&m!=4&&m!=8)return}if(c>0){if(!f){const p=[(e[0]+i[0])/2,(e[1]+i[1])/2],_=this.transformInv_(p);let y;g?y=(modulo(r[0],d)+modulo(a[0],d))/2-modulo(_[0],d):y=(r[0]+a[0])/2-_[0];const A=(r[1]+a[1])/2-_[1];f=y*y+A*A>this.errorThresholdSquared_}if(f){if(Math.abs(e[0]-i[0])<=Math.abs(e[1]-i[1])){const p=[(t[0]+i[0])/2,(t[1]+i[1])/2],_=this.transformInv_(p),y=[(n[0]+e[0])/2,(n[1]+e[1])/2],A=this.transformInv_(y);this.addQuad_(e,t,p,y,r,o,_,A,c-1),this.addQuad_(y,p,i,n,A,_,a,l,c-1)}else{const p=[(e[0]+t[0])/2,(e[1]+t[1])/2],_=this.transformInv_(p),y=[(i[0]+n[0])/2,(i[1]+n[1])/2],A=this.transformInv_(y);this.addQuad_(e,p,y,n,r,_,A,l,c-1),this.addQuad_(p,t,i,y,_,o,a,A,c-1)}return}}if(g){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(m&11)==0&&this.addTriangle_(e,i,n,r,a,l),(m&14)==0&&this.addTriangle_(e,i,t,r,a,o),m&&((m&13)==0&&this.addTriangle_(t,n,e,o,l,r),(m&7)==0&&this.addTriangle_(t,n,i,o,l,a))}calculateSourceExtent(){const e=createEmpty();return this.triangles_.forEach(function(t,i,n){const r=t.source;extendCoordinate(e,r[0]),extendCoordinate(e,r[1]),extendCoordinate(e,r[2])}),e}getTriangles(){return this.triangles_}}const ERROR_THRESHOLD=.5;class ReprojTile extends Tile{constructor(e,t,i,n,r,o,a,l,c,h,u,d){super(r,TileState.IDLE,d),this.renderEdges_=u!==void 0?u:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=t,this.targetTileGrid_=n,this.wrappedTileCoord_=o||r,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=e.canWrapX()?e.getExtent():void 0;const g=n.getTileCoordExtent(this.wrappedTileCoord_),f=this.targetTileGrid_.getExtent();let m=this.sourceTileGrid_.getExtent();const p=f?getIntersection(g,f):g;if(getArea(p)===0){this.state=TileState.EMPTY;return}const _=e.getExtent();_&&(m?m=getIntersection(m,_):m=_);const y=n.getResolution(this.wrappedTileCoord_[0]),A=calculateSourceExtentResolution(e,i,p,y);if(!isFinite(A)||A<=0){this.state=TileState.EMPTY;return}const x=h!==void 0?h:ERROR_THRESHOLD;if(this.triangulation_=new Triangulation(e,i,p,m,A*x,y),this.triangulation_.getTriangles().length===0){this.state=TileState.EMPTY;return}this.sourceZ_=t.getZForResolution(A);let C=this.triangulation_.calculateSourceExtent();if(m&&(e.canWrapX()?(C[1]=clamp(C[1],m[1],m[3]),C[3]=clamp(C[3],m[1],m[3])):C=getIntersection(C,m)),!getArea(C))this.state=TileState.EMPTY;else{let T=0,S=0;e.canWrapX()&&(T=getWidth(_),S=Math.floor((C[0]-_[0])/T)),wrapAndSliceX(C.slice(),e,!0).forEach(I=>{const L=t.getTileRangeForExtentAndZ(I,this.sourceZ_);for(let D=L.minX;D<=L.maxX;D++)for(let b=L.minY;b<=L.maxY;b++){const P=c(this.sourceZ_,D,b,a);if(P){const O=S*T;this.sourceTiles_.push({tile:P,offset:O})}}++S}),this.sourceTiles_.length===0&&(this.state=TileState.EMPTY)}}getImage(){return this.canvas_}reproject_(){const e=[];if(this.sourceTiles_.forEach(t=>{var n;const i=t.tile;if(i&&i.getState()==TileState.LOADED){const r=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);r[0]+=t.offset,r[2]+=t.offset;const o=(n=this.clipExtent_)==null?void 0:n.slice();o&&(o[0]+=t.offset,o[2]+=t.offset),e.push({extent:r,clipExtent:o,image:i.getImage()})}}),this.sourceTiles_.length=0,e.length===0)this.state=TileState.ERROR;else{const t=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(t),n=typeof i=="number"?i:i[0],r=typeof i=="number"?i:i[1],o=this.targetTileGrid_.getResolution(t),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=render(n,r,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=TileState.LOADED}this.changed()}load(){if(this.state==TileState.IDLE){this.state=TileState.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:t})=>{const i=t.getState();if(i==TileState.IDLE||i==TileState.LOADING){e++;const n=listen(t,EventType.CHANGE,r=>{const o=t.getState();(o==TileState.LOADED||o==TileState.ERROR||o==TileState.EMPTY)&&(unlistenByKey(n),e--,e===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(n)}}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:t},i,n){t.getState()==TileState.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(unlistenByKey),this.sourcesListenerKeys_=null}release(){this.canvas_&&(releaseCanvas(this.canvas_.getContext("2d")),canvasPool.push(this.canvas_),this.canvas_=null),super.release()}}class TileRange{constructor(e,t,i,n){this.minX=e,this.maxX=t,this.minY=i,this.maxY=n}contains(e){return this.containsXY(e[1],e[2])}containsTileRange(e){return this.minX<=e.minX&&e.maxX<=this.maxX&&this.minY<=e.minY&&e.maxY<=this.maxY}containsXY(e,t){return this.minX<=e&&e<=this.maxX&&this.minY<=t&&t<=this.maxY}equals(e){return this.minX==e.minX&&this.minY==e.minY&&this.maxX==e.maxX&&this.maxY==e.maxY}extend(e){e.minX<this.minX&&(this.minX=e.minX),e.maxX>this.maxX&&(this.maxX=e.maxX),e.minY<this.minY&&(this.minY=e.minY),e.maxY>this.maxY&&(this.maxY=e.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(e){return this.minX<=e.maxX&&this.maxX>=e.minX&&this.minY<=e.maxY&&this.maxY>=e.minY}}function createOrUpdate$1(s,e,t,i,n){return n!==void 0?(n.minX=s,n.maxX=e,n.minY=t,n.maxY=i,n):new TileRange(s,e,t,i)}class LRUCache{constructor(e){this.highWaterMark=e!==void 0?e:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const e=this.pop();e instanceof Disposable&&e.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){const i=this.entries_[e];return assert(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(e){const t=this.entries_[e];return assert(t!==void 0,"Tried to get a value for a key that does not exist in the cache"),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){const e=new Array(this.count_);let t=0,i;for(i=this.newest_;i;i=i.older)e[t++]=i.key_;return e}getValues(){const e=new Array(this.count_);let t=0,i;for(i=this.newest_;i;i=i.older)e[t++]=i.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){var t;return(t=this.entries_[e])==null?void 0:t.value_}pop(){const e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){assert(!(e in this.entries_),"Tried to set a value for a key that is used already");const i={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[e]=i,++this.count_}setSize(e){this.highWaterMark=e}}function createOrUpdate(s,e,t,i){return i!==void 0?(i[0]=s,i[1]=e,i[2]=t,i):[s,e,t]}function getKeyZXY(s,e,t){return s+"/"+e+"/"+t}function hash(s){return hashZXY(s[0],s[1],s[2])}function hashZXY(s,e,t){return(e<<s)+t}function withinExtentAndZ(s,e){const t=s[0],i=s[1],n=s[2];if(e.getMinZoom()>t||t>e.getMaxZoom())return!1;const r=e.getFullTileRange(t);return r?r.containsXY(i,n):!0}class CanvasImageLayerRenderer extends CanvasLayerRenderer{constructor(e){super(e),this.image=null}getImage(){return this.image?this.image.getImage():null}prepareFrame(e){const t=e.layerStatesArray[e.layerIndex],i=e.pixelRatio,n=e.viewState,r=n.resolution,o=this.getLayer().getSource(),a=e.viewHints;let l=e.extent;if(t.extent!==void 0&&(l=getIntersection(l,fromUserExtent(t.extent,n.projection))),!a[ViewHint.ANIMATING]&&!a[ViewHint.INTERACTING]&&!isEmpty(l))if(o){const c=n.projection,h=o.getImage(l,r,i,c);h&&(this.loadImage(h)?this.image=h:h.getState()===ImageState.EMPTY&&(this.image=null))}else this.image=null;return!!this.image}getData(e){const t=this.frameState;if(!t)return null;const i=this.getLayer(),n=apply(t.pixelToCoordinateTransform,e.slice()),r=i.getExtent();if(r&&!containsCoordinate(r,n))return null;const o=this.image.getExtent(),a=this.image.getImage(),l=getWidth(o),c=Math.floor(a.width*((n[0]-o[0])/l));if(c<0||c>=a.width)return null;const h=getHeight(o),u=Math.floor(a.height*((o[3]-n[1])/h));return u<0||u>=a.height?null:this.getImageData(a,c,u)}renderFrame(e,t){const i=this.image,n=i.getExtent(),r=i.getResolution(),[o,a]=Array.isArray(r)?r:[r,r],l=i.getPixelRatio(),c=e.layerStatesArray[e.layerIndex],h=e.pixelRatio,u=e.viewState,d=u.center,g=u.resolution,f=h*o/(g*l),m=h*a/(g*l);this.prepareContainer(e,t);const p=this.context.canvas.width,_=this.context.canvas.height,y=this.getRenderContext(e);let A=!1,x=!0;if(c.extent){const I=fromUserExtent(c.extent,u.projection);x=intersects$1(I,e.extent),A=x&&!containsExtent(I,e.extent),A&&this.clipUnrotated(y,e,I)}const C=i.getImage(),T=compose(this.tempTransform,p/2,_/2,f,m,0,l*(n[0]-d[0])/o,l*(d[1]-n[3])/a);this.renderedResolution=a*h/l;const S=C.width*T[0],w=C.height*T[3];if(this.getLayer().getSource().getInterpolate()||(y.imageSmoothingEnabled=!1),this.preRender(y,e),x&&S>=.5&&w>=.5){const I=T[4],L=T[5],D=c.opacity;D!==1&&(y.save(),y.globalAlpha=D),y.drawImage(C,0,0,+C.width,+C.height,I,L,S,w),D!==1&&y.restore()}return this.postRender(this.context,e),A&&y.restore(),y.imageSmoothingEnabled=!0,this.container}}class BaseImageLayer extends Layer{constructor(e){e=e||{},super(e)}}class ImageLayer extends BaseImageLayer{constructor(e){super(e)}createRenderer(){return new CanvasImageLayerRenderer(this)}getData(e){return super.getData(e)}}function getCacheKey(s,e,t,i,n){return`${getUid(s)},${e},${getKeyZXY(t,i,n)}`}function addTileToLookup(s,e,t){if(!(t in s))return s[t]=new Set([e]),!0;const i=s[t],n=i.has(e);return n||i.add(e),!n}function removeTileFromLookup(s,e,t){const i=s[t];return i?i.delete(e):!1}function getRenderExtent(s,e){const t=s.layerStatesArray[s.layerIndex];t.extent&&(e=getIntersection(e,fromUserExtent(t.extent,s.viewState.projection)));const i=t.layer.getRenderSource();if(!i.getWrapX()){const n=i.getTileGridForProjection(s.viewState.projection).getExtent();n&&(e=getIntersection(e,n))}return e}class CanvasTileLayerRenderer extends CanvasLayerRenderer{constructor(e,t){super(e),t=t||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=createEmpty(),this.tempTileRange_=new TileRange(0,0,0,0),this.tempTileCoord_=createOrUpdate(0,0,0);const i=t.cacheSize!==void 0?t.cacheSize:512;this.tileCache_=new LRUCache(i),this.maxStaleKeys=i*.5}getTileCache(){return this.tileCache_}getOrCreateTile(e,t,i,n){const r=this.tileCache_,a=this.getLayer().getSource(),l=getCacheKey(a,a.getKey(),e,t,i);let c;if(r.containsKey(l))c=r.get(l);else{if(c=a.getTile(e,t,i,n.pixelRatio,n.viewState.projection),!c)return null;r.set(l,c)}return c}getTile(e,t,i,n){const r=this.getOrCreateTile(e,t,i,n);return r||null}getData(e){const t=this.frameState;if(!t)return null;const i=this.getLayer(),n=apply(t.pixelToCoordinateTransform,e.slice()),r=i.getExtent();if(r&&!containsCoordinate(r,n))return null;const o=t.viewState,a=i.getRenderSource(),l=a.getTileGridForProjection(o.projection),c=a.getTilePixelRatio(t.pixelRatio);for(let h=l.getZForResolution(o.resolution);h>=l.getMinZoom();--h){const u=l.getTileCoordForCoordAndZ(n,h),d=this.getTile(h,u[1],u[2],t);if(!d||d.getState()!==TileState.LOADED)continue;const g=l.getOrigin(h),f=toSize(l.getTileSize(h)),m=l.getResolution(h);let p;if(d instanceof ImageTile||d instanceof ReprojTile)p=d.getImage();else if(d instanceof DataTile){if(p=asImageLike(d.getData()),!p)continue}else continue;const _=Math.floor(c*((n[0]-g[0])/m-u[1]*f[0])),y=Math.floor(c*((g[1]-n[1])/m-u[2]*f[1])),A=Math.round(c*a.getGutterForProjection(o.projection));return this.getImageData(p,_+A,y+A)}return null}prepareFrame(e){this.renderedProjection?e.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=e.viewState.projection):this.renderedProjection=e.viewState.projection;const t=this.getLayer().getSource();if(!t)return!1;const i=t.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==i&&(this.renderedSourceRevision_=i,this.renderedSourceKey_===t.getKey()&&this.tileCache_.clear()):this.renderedSourceRevision_=i,!0}enqueueTiles(e,t,i,n,r){const o=e.viewState,a=this.getLayer(),l=a.getRenderSource(),c=l.getTileGridForProjection(o.projection),h=getUid(l);h in e.wantedTiles||(e.wantedTiles[h]={});const u=e.wantedTiles[h],d=a.getMapInternal(),g=Math.max(i-r,c.getMinZoom(),c.getZForResolution(Math.min(a.getMaxResolution(),d?d.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):c.getResolution(0)),l.zDirection)),f=o.rotation,m=f?getRotatedViewport(o.center,o.resolution,f,e.size):void 0;for(let p=i;p>=g;--p){const _=c.getTileRangeForExtentAndZ(t,p,this.tempTileRange_),y=c.getResolution(p);for(let A=_.minX;A<=_.maxX;++A)for(let x=_.minY;x<=_.maxY;++x){if(f&&!c.tileCoordIntersectsViewport([p,A,x],m))continue;const C=this.getTile(p,A,x,e);if(!C||!addTileToLookup(n,C,p))continue;const S=C.getKey();if(u[S]=!0,C.getState()===TileState.IDLE&&!e.tileQueue.isKeyQueued(S)){const w=createOrUpdate(p,A,x,this.tempTileCoord_);e.tileQueue.enqueue([C,h,c.getTileCoordCenter(w),y])}}}}findStaleTile_(e,t){const i=this.tileCache_,n=e[0],r=e[1],o=e[2],a=this.getStaleKeys();for(let l=0;l<a.length;++l){const c=getCacheKey(this.getLayer().getSource(),a[l],n,r,o);if(i.containsKey(c)){const h=i.peek(c);if(h.getState()===TileState.LOADED)return h.endTransition(getUid(this)),addTileToLookup(t,h,n),!0}}return!1}findAltTiles_(e,t,i,n){const r=e.getTileRangeForTileCoordAndZ(t,i,this.tempTileRange_);if(!r)return!1;let o=!0;const a=this.tileCache_,l=this.getLayer().getRenderSource(),c=l.getKey();for(let h=r.minX;h<=r.maxX;++h)for(let u=r.minY;u<=r.maxY;++u){const d=getCacheKey(l,c,i,h,u);let g=!1;if(a.containsKey(d)){const f=a.peek(d);f.getState()===TileState.LOADED&&(addTileToLookup(n,f,i),g=!0)}g||(o=!1)}return o}renderFrame(e,t){this.renderComplete=!0;const i=e.layerStatesArray[e.layerIndex],n=e.viewState,r=n.projection,o=n.resolution,a=n.center,l=e.pixelRatio,c=this.getLayer(),h=c.getSource(),u=h.getTileGridForProjection(r),d=u.getZForResolution(o,h.zDirection),g=u.getResolution(d),f=h.getKey();this.renderedSourceKey_?this.renderedSourceKey_!==f&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=f):this.renderedSourceKey_=f;let m=e.extent;const p=h.getTilePixelRatio(l);this.prepareContainer(e,t);const _=this.context.canvas.width,y=this.context.canvas.height,A=i.extent&&fromUserExtent(i.extent);A&&(m=getIntersection(m,fromUserExtent(i.extent)));const x=g*_/2/p,C=g*y/2/p,T=[a[0]-x,a[1]-C,a[0]+x,a[1]+C],S={};this.renderedTiles.length=0;const w=c.getPreload();if(e.nextExtent){const F=u.getZForResolution(n.nextResolution,h.zDirection),X=getRenderExtent(e,e.nextExtent);this.enqueueTiles(e,X,F,S,w)}const I=getRenderExtent(e,m);if(this.enqueueTiles(e,I,d,S,0),w>0&&setTimeout(()=>{this.enqueueTiles(e,I,d-1,S,w-1)},0),!(d in S))return this.container;const L=getUid(this),D=e.time;for(const F of S[d]){const X=F.getState();if(X===TileState.EMPTY)continue;const W=F.tileCoord;if(X===TileState.LOADED&&F.getAlpha(L,D)===1){F.endTransition(L);continue}if(X!==TileState.ERROR&&(this.renderComplete=!1),this.findStaleTile_(W,S)){removeTileFromLookup(S,F,d),e.animate=!0;continue}if(this.findAltTiles_(u,W,d+1,S))continue;const K=u.getMinZoom();for(let H=d-1;H>=K&&!this.findAltTiles_(u,W,H,S);--H);}const b=g/o*l/p,P=this.getRenderContext(e);compose(this.tempTransform,_/2,y/2,b,b,0,-_/2,-y/2),i.extent&&this.clipUnrotated(P,e,A),h.getInterpolate()||(P.imageSmoothingEnabled=!1),this.preRender(P,e);const O=Object.keys(S).map(Number);O.sort(ascending);let B;const N=[],G=[];for(let F=O.length-1;F>=0;--F){const X=O[F],W=h.getTilePixelSize(X,l,r),v=u.getResolution(X)/g,K=W[0]*v*b,H=W[1]*v*b,z=u.getTileCoordForCoordAndZ(getTopLeft(T),X),Q=u.getTileCoordExtent(z),j=apply(this.tempTransform,[p*(Q[0]-T[0])/g,p*(T[3]-Q[3])/g]),re=p*h.getGutterForProjection(r);for(const ne of S[X]){if(ne.getState()!==TileState.LOADED)continue;const J=ne.tileCoord,Te=z[1]-J[1],Ie=Math.round(j[0]-(Te-1)*K),ye=z[2]-J[2],ue=Math.round(j[1]-(ye-1)*H),$=Math.round(j[0]-Te*K),oe=Math.round(j[1]-ye*H),fe=Ie-$,pe=ue-oe,Ee=O.length===1;let de=!1;B=[$,oe,$+fe,oe,$+fe,oe+pe,$,oe+pe];for(let me=0,_e=N.length;me<_e;++me)if(!Ee&&X<G[me]){const V=N[me];intersects$1([$,oe,$+fe,oe+pe],[V[0],V[3],V[4],V[7]])&&(de||(P.save(),de=!0),P.beginPath(),P.moveTo(B[0],B[1]),P.lineTo(B[2],B[3]),P.lineTo(B[4],B[5]),P.lineTo(B[6],B[7]),P.moveTo(V[6],V[7]),P.lineTo(V[4],V[5]),P.lineTo(V[2],V[3]),P.lineTo(V[0],V[1]),P.clip())}N.push(B),G.push(X),this.drawTile(ne,e,$,oe,fe,pe,re,Ee),de&&P.restore(),this.renderedTiles.unshift(ne),this.updateUsedTiles(e.usedTiles,h,ne)}}if(this.renderedResolution=g,this.extentChanged=!this.renderedExtent_||!equals$1(this.renderedExtent_,T),this.renderedExtent_=T,this.renderedPixelRatio=l,this.postRender(this.context,e),i.extent&&P.restore(),P.imageSmoothingEnabled=!0,this.renderComplete){const F=(X,W)=>{const U=getUid(h),v=W.wantedTiles[U],K=v?Object.keys(v).length:0;this.updateCacheSize(K),this.tileCache_.expireCache()};e.postRenderFunctions.push(F)}return this.container}updateCacheSize(e){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,e*2)}drawTile(e,t,i,n,r,o,a,l){let c;if(e instanceof DataTile){if(c=asImageLike(e.getData()),!c)throw new Error("Rendering array data is not yet supported")}else c=this.getTileImage(e);if(!c)return;const h=this.getRenderContext(t),u=getUid(this),d=t.layerStatesArray[t.layerIndex],g=d.opacity*(l?e.getAlpha(u,t.time):1),f=g!==h.globalAlpha;f&&(h.save(),h.globalAlpha=g),h.drawImage(c,a,a,c.width-2*a,c.height-2*a,i,n,r,o),f&&h.restore(),g!==d.opacity?t.animate=!0:l&&e.endTransition(u)}getImage(){const e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}updateUsedTiles(e,t,i){const n=getUid(t);n in e||(e[n]={}),e[n][i.getKey()]=!0}}const TileProperty={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class BaseTileLayer extends Layer{constructor(e){e=e||{};const t=Object.assign({},e),i=e.cacheSize;delete e.cacheSize,delete t.preload,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=i,this.setPreload(e.preload!==void 0?e.preload:0),this.setUseInterimTilesOnError(e.useInterimTilesOnError!==void 0?e.useInterimTilesOnError:!0)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(TileProperty.PRELOAD)}setPreload(e){this.set(TileProperty.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(TileProperty.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(TileProperty.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}}class TileLayer extends BaseTileLayer{constructor(e){super(e)}createRenderer(){return new CanvasTileLayerRenderer(this,{cacheSize:this.getCacheSize()})}}function fromResolutionLike(s){return Array.isArray(s)?Math.min(...s):s}const tmpTileCoord=[0,0,0],DECIMALS$1=5;class TileGrid{constructor(e){this.minZoom=e.minZoom!==void 0?e.minZoom:0,this.resolutions_=e.resolutions,assert(isSorted(this.resolutions_,(n,r)=>r-n),"`resolutions` must be sorted in descending order");let t;if(!e.origins){for(let n=0,r=this.resolutions_.length-1;n<r;++n)if(!t)t=this.resolutions_[n]/this.resolutions_[n+1];else if(this.resolutions_[n]/this.resolutions_[n+1]!==t){t=void 0;break}}this.zoomFactor_=t,this.maxZoom=this.resolutions_.length-1,this.origin_=e.origin!==void 0?e.origin:null,this.origins_=null,e.origins!==void 0&&(this.origins_=e.origins,assert(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const i=e.extent;i!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=getTopLeft(i)),assert(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,e.tileSizes!==void 0&&(this.tileSizes_=e.tileSizes,assert(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=e.tileSize!==void 0?e.tileSize:this.tileSizes_?null:DEFAULT_TILE_SIZE,assert(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=i!==void 0?i:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],e.sizes!==void 0?this.fullTileRanges_=e.sizes.map((n,r)=>{const o=new TileRange(Math.min(0,n[0]),Math.max(n[0]-1,-1),Math.min(0,n[1]),Math.max(n[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(e,t,i){const n=this.getTileRangeForExtentAndZ(e,t);for(let r=n.minX,o=n.maxX;r<=o;++r)for(let a=n.minY,l=n.maxY;a<=l;++a)i([t,r,a])}forEachTileCoordParentTileRange(e,t,i,n){let r,o,a,l=null,c=e[0]-1;for(this.zoomFactor_===2?(o=e[1],a=e[2]):l=this.getTileCoordExtent(e,n);c>=this.minZoom;){if(o!==void 0&&a!==void 0?(o=Math.floor(o/2),a=Math.floor(a/2),r=createOrUpdate$1(o,o,a,a,i)):r=this.getTileRangeForExtentAndZ(l,c,i),t(c,r))return!0;--c}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_[e]}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,t,i){if(e[0]<this.maxZoom){if(this.zoomFactor_===2){const r=e[1]*2,o=e[2]*2;return createOrUpdate$1(r,r+1,o,o+1,t)}const n=this.getTileCoordExtent(e,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(n,e[0]+1,t)}return null}getTileRangeForTileCoordAndZ(e,t,i){if(t>this.maxZoom||t<this.minZoom)return null;const n=e[0],r=e[1],o=e[2];if(t===n)return createOrUpdate$1(r,o,r,o,i);if(this.zoomFactor_){const l=Math.pow(this.zoomFactor_,t-n),c=Math.floor(r*l),h=Math.floor(o*l);if(t<n)return createOrUpdate$1(c,c,h,h,i);const u=Math.floor(l*(r+1))-1,d=Math.floor(l*(o+1))-1;return createOrUpdate$1(c,u,h,d,i)}const a=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,t,i)}getTileRangeForExtentAndZ(e,t,i){this.getTileCoordForXYAndZ_(e[0],e[3],t,!1,tmpTileCoord);const n=tmpTileCoord[1],r=tmpTileCoord[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,tmpTileCoord);const o=tmpTileCoord[1],a=tmpTileCoord[2];return createOrUpdate$1(n,o,r,a,i)}getTileCoordCenter(e){const t=this.getOrigin(e[0]),i=this.getResolution(e[0]),n=toSize(this.getTileSize(e[0]),this.tmpSize_);return[t[0]+(e[1]+.5)*n[0]*i,t[1]-(e[2]+.5)*n[1]*i]}getTileCoordExtent(e,t){const i=this.getOrigin(e[0]),n=this.getResolution(e[0]),r=toSize(this.getTileSize(e[0]),this.tmpSize_),o=i[0]+e[1]*r[0]*n,a=i[1]-(e[2]+1)*r[1]*n,l=o+r[0]*n,c=a+r[1]*n;return createOrUpdate$2(o,a,l,c,t)}getTileCoordForCoordAndResolution(e,t,i){return this.getTileCoordForXYAndResolution_(e[0],e[1],t,!1,i)}getTileCoordForXYAndResolution_(e,t,i,n,r){const o=this.getZForResolution(i),a=i/this.getResolution(o),l=this.getOrigin(o),c=toSize(this.getTileSize(o),this.tmpSize_);let h=a*(e-l[0])/i/c[0],u=a*(l[1]-t)/i/c[1];return n?(h=ceil(h,DECIMALS$1)-1,u=ceil(u,DECIMALS$1)-1):(h=floor(h,DECIMALS$1),u=floor(u,DECIMALS$1)),createOrUpdate(o,h,u,r)}getTileCoordForXYAndZ_(e,t,i,n,r){const o=this.getOrigin(i),a=this.getResolution(i),l=toSize(this.getTileSize(i),this.tmpSize_);let c=(e-o[0])/a/l[0],h=(o[1]-t)/a/l[1];return n?(c=ceil(c,DECIMALS$1)-1,h=ceil(h,DECIMALS$1)-1):(c=floor(c,DECIMALS$1),h=floor(h,DECIMALS$1)),createOrUpdate(i,c,h,r)}getTileCoordForCoordAndZ(e,t,i){return this.getTileCoordForXYAndZ_(e[0],e[1],t,!1,i)}getTileCoordResolution(e){return this.resolutions_[e[0]]}getTileSize(e){return this.tileSize_?this.tileSize_:this.tileSizes_[e]}getFullTileRange(e){return this.fullTileRanges_?this.fullTileRanges_[e]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,e):null}getZForResolution(e,t){const i=linearFindNearest(this.resolutions_,e,t||0);return clamp(i,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return intersectsLinearRing(t,0,t.length,2,this.getTileCoordExtent(e))}calculateTileRanges_(e){const t=this.resolutions_.length,i=new Array(t);for(let n=this.minZoom;n<t;++n)i[n]=this.getTileRangeForExtentAndZ(e,n);this.fullTileRanges_=i}}function getForProjection(s){let e=s.getDefaultTileGrid();return e||(e=createForProjection(s),s.setDefaultTileGrid(e)),e}function wrapX(s,e,t){const i=e[0],n=s.getTileCoordCenter(e),r=extentFromProjection(t);if(!containsCoordinate(r,n)){const o=getWidth(r),a=Math.ceil((r[0]-n[0])/o);return n[0]+=o*a,s.getTileCoordForCoordAndZ(n,i)}return e}function createForExtent(s,e,t,i){i=i!==void 0?i:"top-left";const n=resolutionsFromExtent(s,e,t);return new TileGrid({extent:s,origin:getCorner(s,i),resolutions:n,tileSize:t})}function createXYZ(s){const e=s||{},t=e.extent||get$1("EPSG:3857").getExtent(),i={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:resolutionsFromExtent(t,e.maxZoom,e.tileSize,e.maxResolution)};return new TileGrid(i)}function resolutionsFromExtent(s,e,t,i){e=e!==void 0?e:DEFAULT_MAX_ZOOM,t=toSize(t!==void 0?t:DEFAULT_TILE_SIZE);const n=getHeight(s),r=getWidth(s);i=i>0?i:Math.max(r/t[0],n/t[1]);const o=e+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=i/Math.pow(2,l);return a}function createForProjection(s,e,t,i){const n=extentFromProjection(s);return createForExtent(n,e,t,i)}function extentFromProjection(s){s=get$1(s);let e=s.getExtent();if(!e){const t=180*METERS_PER_UNIT$1.degrees/s.getMetersPerUnit();e=createOrUpdate$2(-t,-t,t,t)}return e}const zRegEx=/\{z\}/g,xRegEx=/\{x\}/g,yRegEx=/\{y\}/g,dashYRegEx=/\{-y\}/g;function renderXYZTemplate(s,e,t,i,n){return s.replace(zRegEx,e.toString()).replace(xRegEx,t.toString()).replace(yRegEx,i.toString()).replace(dashYRegEx,function(){if(n===void 0)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(n-i).toString()})}function expandUrl(s){const e=[];let t=/\{([a-z])-([a-z])\}/.exec(s);if(t){const i=t[1].charCodeAt(0),n=t[2].charCodeAt(0);let r;for(r=i;r<=n;++r)e.push(s.replace(t[0],String.fromCharCode(r)));return e}if(t=/\{(\d+)-(\d+)\}/.exec(s),t){const i=parseInt(t[2],10);for(let n=parseInt(t[1],10);n<=i;n++)e.push(s.replace(t[0],n.toString()));return e}return e.push(s),e}function createFromTemplate(s,e){return function(t,i,n){if(!t)return;let r;const o=t[0];if(e){const a=e.getFullTileRange(o);a&&(r=a.getHeight()-1)}return renderXYZTemplate(s,o,t[1],t[2],r)}}function createFromTemplates(s,e){const t=s.length,i=new Array(t);for(let n=0;n<t;++n)i[n]=createFromTemplate(s[n],e);return createFromTileUrlFunctions(i)}function createFromTileUrlFunctions(s){return s.length===1?s[0]:function(e,t,i){if(!e)return;const n=hash(e),r=modulo(n,s.length);return s[r](e,t,i)}}class TileSource extends Source{constructor(e){super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX,interpolate:e.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=e.tilePixelRatio!==void 0?e.tilePixelRatio:1,this.tileGrid=e.tileGrid!==void 0?e.tileGrid:null;const t=[256,256];this.tileGrid&&toSize(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),t),this.tmpSize=[0,0],this.key_=e.key||getUid(this),this.tileOptions={transition:e.transition,interpolate:e.interpolate},this.zDirection=e.zDirection?e.zDirection:0}getGutterForProjection(e){return 0}getKey(){return this.key_}setKey(e){this.key_!==e&&(this.key_=e,this.changed())}getResolutions(e){const t=e?this.getTileGridForProjection(e):this.tileGrid;return t?t.getResolutions():null}getTile(e,t,i,n,r){return abstract()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:getForProjection(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,i){const n=this.getTileGridForProjection(i),r=this.getTilePixelRatio(t),o=toSize(n.getTileSize(e),this.tmpSize);return r==1?o:scale(o,r,this.tmpSize)}getTileCoordForTileUrlFunction(e,t){const i=t!==void 0?t:this.getProjection(),n=t!==void 0?this.getTileGridForProjection(i):this.tileGrid||this.getTileGridForProjection(i);return this.getWrapX()&&i.isGlobal()&&(e=wrapX(n,e,i)),withinExtentAndZ(e,n)?e:null}clear(){}refresh(){this.clear(),super.refresh()}}class TileSourceEvent extends BaseEvent{constructor(e,t){super(e),this.tile=t}}const TileEventType={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};class UrlTile extends TileSource{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tilePixelRatio:e.tilePixelRatio,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===UrlTile.prototype.tileUrlFunction,this.tileLoadFunction=e.tileLoadFunction,e.tileUrlFunction&&(this.tileUrlFunction=e.tileUrlFunction),this.urls=null,e.urls?this.setUrls(e.urls):e.url&&this.setUrl(e.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(e){const t=e.target,i=getUid(t),n=t.getState();let r;n==TileState.LOADING?(this.tileLoadingKeys_[i]=!0,r=TileEventType.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=n==TileState.ERROR?TileEventType.TILELOADERROR:n==TileState.LOADED?TileEventType.TILELOADEND:void 0),r!=null&&this.dispatchEvent(new TileSourceEvent(r,t))}setTileLoadFunction(e){this.tileLoadFunction=e,this.changed()}setTileUrlFunction(e,t){this.tileUrlFunction=e,typeof t<"u"?this.setKey(t):this.changed()}setUrl(e){const t=expandUrl(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;const t=e.join(`
|
|
7
|
+
`);this.generateTileUrlFunction_?this.setTileUrlFunction(createFromTemplates(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,i){}}class TileImage extends UrlTile{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:defaultTileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate!==void 0?e.interpolate:!0,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.crossOrigin=e.crossOrigin!==void 0?e.crossOrigin:null,this.tileClass=e.tileClass!==void 0?e.tileClass:ImageTile,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!equivalent$1(this.getProjection(),e)?0:this.getGutter()}getGutter(){return 0}getKey(){let e=super.getKey();return this.getInterpolate()||(e+=":disable-interpolation"),e}getTileGridForProjection(e){const t=this.getProjection();if(this.tileGrid&&(!t||equivalent$1(t,e)))return this.tileGrid;const i=getUid(e);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=getForProjection(e)),this.tileGridForProjection[i]}createTile_(e,t,i,n,r,o){const a=[e,t,i],l=this.getTileCoordForTileUrlFunction(a,r),c=l?this.tileUrlFunction(l,n,r):void 0,h=new this.tileClass(a,c!==void 0?TileState.IDLE:TileState.EMPTY,c!==void 0?c:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return h.key=o,h.addEventListener(EventType.CHANGE,this.handleTileChange.bind(this)),h}getTile(e,t,i,n,r){const o=this.getProjection();if(!o||!r||equivalent$1(o,r))return this.getTileInternal(e,t,i,n,o||r);const a=[e,t,i],l=this.getKey(),c=this.getTileGridForProjection(o),h=this.getTileGridForProjection(r),u=this.getTileCoordForTileUrlFunction(a,r),d=new ReprojTile(o,c,r,h,a,u,this.getTilePixelRatio(n),this.getGutter(),(g,f,m,p)=>this.getTileInternal(g,f,m,p,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return d.key=l,d}getTileInternal(e,t,i,n,r){const o=this.getKey();return this.createTile_(e,t,i,n,r,o)}setRenderReprojectionEdges(e){this.renderReprojectionEdges_!=e&&(this.renderReprojectionEdges_=e,this.changed())}setTileGridForProjection(e,t){const i=get$1(e);if(i){const n=getUid(i);n in this.tileGridForProjection||(this.tileGridForProjection[n]=t)}}}function defaultTileLoadFunction(s,e){s.getImage().src=e}class XYZ extends TileImage{constructor(e){e=e||{};const t=e.projection!==void 0?e.projection:"EPSG:3857",i=e.tileGrid!==void 0?e.tileGrid:createXYZ({extent:extentFromProjection(t),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize});super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,projection:t,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.gutter_=e.gutter!==void 0?e.gutter:0}getGutter(){return this.gutter_}}class ReprojImage extends ImageWrapper{constructor(e,t,i,n,r,o,a){let l=e.getExtent();l&&e.canWrapX()&&(l=l.slice(),l[0]=-1/0,l[2]=1/0);let c=t.getExtent();c&&t.canWrapX()&&(c=c.slice(),c[0]=-1/0,c[2]=1/0);const h=c?getIntersection(i,c):i,u=getCenter(h),d=calculateSourceResolution(e,t,u,n),g=ERROR_THRESHOLD,f=new Triangulation(e,t,h,l,d*g,n),m=f.calculateSourceExtent(),p=isEmpty(m)?null:o(m,d,r),_=p?ImageState.IDLE:ImageState.EMPTY,y=p?p.getPixelRatio():1;super(i,n,y,_),this.targetProj_=t,this.maxSourceExtent_=l,this.triangulation_=f,this.targetResolution_=n,this.targetExtent_=i,this.sourceImage_=p,this.sourcePixelRatio_=y,this.interpolate_=a,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==ImageState.LOADING&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const e=this.sourceImage_.getState();if(e==ImageState.LOADED){const t=getWidth(this.targetExtent_)/this.targetResolution_,i=getHeight(this.targetExtent_)/this.targetResolution_;this.canvas_=render(t,i,this.sourcePixelRatio_,fromResolutionLike(this.sourceImage_.getResolution()),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.interpolate_,!0)}this.state=e,this.changed()}load(){if(this.state==ImageState.IDLE){this.state=ImageState.LOADING,this.changed();const e=this.sourceImage_.getState();e==ImageState.LOADED||e==ImageState.ERROR?this.reproject_():(this.sourceListenerKey_=listen(this.sourceImage_,EventType.CHANGE,t=>{const i=this.sourceImage_.getState();(i==ImageState.LOADED||i==ImageState.ERROR)&&(this.unlistenSource_(),this.reproject_())}),this.sourceImage_.load())}}unlistenSource_(){unlistenByKey(this.sourceListenerKey_),this.sourceListenerKey_=null}}const DECIMALS=4,ImageSourceEventType={IMAGELOADSTART:"imageloadstart",IMAGELOADEND:"imageloadend",IMAGELOADERROR:"imageloaderror"};class ImageSourceEvent extends BaseEvent{constructor(e,t){super(e),this.image=t}}class ImageSource extends Source{constructor(e){super({attributions:e.attributions,projection:e.projection,state:e.state,interpolate:e.interpolate!==void 0?e.interpolate:!0}),this.on,this.once,this.un,this.loader=e.loader||null,this.resolutions_=e.resolutions!==void 0?e.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0,this.image=null,this.wantedExtent_,this.wantedResolution_,this.static_=e.loader?e.loader.length===0:!1,this.wantedProjection_=null}getResolutions(){return this.resolutions_}setResolutions(e){this.resolutions_=e}findNearestResolution(e){const t=this.getResolutions();if(t){const i=linearFindNearest(t,e,0);e=t[i]}return e}getImage(e,t,i,n){const r=this.getProjection();if(!r||!n||equivalent$1(r,n))return r&&(n=r),this.getImageInternal(e,t,i,n);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&equivalent$1(this.reprojectedImage_.getProjection(),n)&&this.reprojectedImage_.getResolution()==t&&equals$1(this.reprojectedImage_.getExtent(),e))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new ReprojImage(r,n,e,t,i,(o,a,l)=>this.getImageInternal(o,a,l,r),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(e,t,i,n){if(this.loader){const r=getRequestExtent(e,t,i,1),o=this.findNearestResolution(t);if(this.image&&(this.static_||this.wantedProjection_===n&&(this.wantedExtent_&&containsExtent(this.wantedExtent_,r)||containsExtent(this.image.getExtent(),r))&&(this.wantedResolution_&&fromResolutionLike(this.wantedResolution_)===o||fromResolutionLike(this.image.getResolution())===o)))return this.image;this.wantedProjection_=n,this.wantedExtent_=r,this.wantedResolution_=o,this.image=new ImageWrapper(r,o,i,this.loader),this.image.addEventListener(EventType.CHANGE,this.handleImageChange.bind(this))}return this.image}handleImageChange(e){const t=e.target;let i;switch(t.getState()){case ImageState.LOADING:this.loading=!0,i=ImageSourceEventType.IMAGELOADSTART;break;case ImageState.LOADED:this.loading=!1,i=ImageSourceEventType.IMAGELOADEND;break;case ImageState.ERROR:this.loading=!1,i=ImageSourceEventType.IMAGELOADERROR;break;default:return}this.hasListener(i)&&this.dispatchEvent(new ImageSourceEvent(i,t))}}function defaultImageLoadFunction(s,e){s.getImage().src=e}function getRequestExtent(s,e,t,i){const n=e/t,r=getCenter(s),o=ceil(getWidth(s)/n,DECIMALS),a=ceil(getHeight(s)/n,DECIMALS),l=ceil((i-1)*o/2,DECIMALS),c=o+2*l,h=ceil((i-1)*a/2,DECIMALS),u=a+2*h;return getForViewAndSize(r,n,0,[c,u])}function createLoader(s){const e=s.load||decode,t=s.imageExtent,i=s.crossOrigin??null;return()=>{const n=new Image;return n.crossOrigin=i,e(n,s.url).then(r=>{const o=getWidth(t)/r.width,a=getHeight(t)/r.height;return{image:r,extent:t,resolution:o!==a?[o,a]:a,pixelRatio:1}})}}class Static extends ImageSource{constructor(e){const t=e.crossOrigin!==void 0?e.crossOrigin:null,i=e.imageLoadFunction!==void 0?e.imageLoadFunction:defaultImageLoadFunction;super({attributions:e.attributions,interpolate:e.interpolate,projection:get$1(e.projection)}),this.url_=e.url,this.imageExtent_=e.imageExtent,this.image=null,this.image=new ImageWrapper(this.imageExtent_,void 0,1,createLoader({url:e.url,imageExtent:e.imageExtent,crossOrigin:t,load:(n,r)=>(this.image.setImage(n),i(this.image,r),decode(n))})),this.image.addEventListener(EventType.CHANGE,this.handleImageChange.bind(this))}getImageExtent(){return this.imageExtent_}getImageInternal(e,t,i,n){return intersects$1(e,this.image.getExtent())?this.image:null}getUrl(){return this.url_}}class WindBarb{constructor(e){se(this,"maxWinds",72);se(this,"windbarbWidth");se(this,"windbarbHeight");se(this,"interval");se(this,"lineWidth",1);se(this,"icons",[]);this.windbarbWidth=e,this.windbarbHeight=e*2,this.interval=this.windbarbHeight/7.8}getIconOfCanvas(e,t=!1){let i=e%2===0?e-e%2:e-e%2+2;if(e>0&&e<=1&&(i=1),this.icons[i])return this.icons[i];const n=document.createElement("canvas");n.width=this.windbarbWidth,n.height=this.windbarbHeight,t&&(n.width*=2,n.height*=2);const r=n.getContext("2d");return r&&(r.lineWidth=this.lineWidth,r.strokeStyle="#ffffff",r.fillStyle="#ffffff",this.createWindBarb(r,i,t),this.icons[i]=n),n}createWindBarb(e,t,i){let n=this.lineWidth/2+1,r=this.windbarbWidth-1;i&&(n=this.lineWidth/2+this.windbarbWidth,r=this.windbarbWidth+this.windbarbWidth);let o=this.lineWidth/2;t>=4&&t<20?(e.beginPath(),e.moveTo(n,this.interval),e.lineTo(n,this.windbarbHeight)):t===0?(e.moveTo(n,this.windbarbHeight-1),e.lineTo(n,this.windbarbHeight)):(e.beginPath(),e.moveTo(n,0),e.lineTo(n,this.windbarbHeight));const a=parseInt(`${t/20}`);if(a>0)for(let h=0;h<a;h++){const u=this.interval*h+this.lineWidth/2*(h+1);o=this.interval*(h+1)+this.lineWidth/2*(h+1),e.moveTo(n,o),e.lineTo(r,u),e.moveTo(n,u),e.lineTo(r,u)}const l=parseInt(`${t%20/4}`);if(l>0)for(let h=0;h<l;h++)o=o+this.interval,e.moveTo(n,o),e.lineTo(r,o-this.interval);parseInt(`${t%20%4/2}`)>0&&(o=o+this.interval,e.moveTo(n,o),e.lineTo(r-this.windbarbWidth/2+2,o-this.interval/2)),e.stroke(),e.beginPath(),e.arc(n,this.windbarbHeight-2,2,0,2*Math.PI),e.fill()}}class FeatureFormat{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=Feature,this.supportedMediaTypes=null}getReadOptions(e,t){if(t){let i=t.dataProjection?get$1(t.dataProjection):this.readProjection(e);t.extent&&i&&i.getUnits()==="tile-pixels"&&(i=get$1(i),i.setWorldExtent(t.extent)),t={dataProjection:i,featureProjection:t.featureProjection}}return this.adaptOptions(t)}adaptOptions(e){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},e)}getType(){return abstract()}readFeature(e,t){return abstract()}readFeatures(e,t){return abstract()}readGeometry(e,t){return abstract()}readProjection(e){return abstract()}writeFeature(e,t){return abstract()}writeFeatures(e,t){return abstract()}writeGeometry(e,t){return abstract()}}function transformGeometryWithOptions(s,e,t){const i=t?get$1(t.featureProjection):null,n=t?get$1(t.dataProjection):null;let r=s;if(i&&n&&!equivalent$1(i,n)){e&&(r=s.clone());const o=e?i:n,a=e?n:i;o.getUnits()==="tile-pixels"?r.transform(o,a):r.applyTransform(getTransform(o,a))}if(e&&t&&t.decimals!==void 0){const o=Math.pow(10,t.decimals),a=function(l){for(let c=0,h=l.length;c<h;++c)l[c]=Math.round(l[c]*o)/o;return l};r===s&&(r=s.clone()),r.applyTransform(a)}return r}class TextFeature extends FeatureFormat{constructor(){super()}getType(){return"text"}readFeature(e,t){return this.readFeatureFromText(getText(e),this.adaptOptions(t))}readFeatureFromText(e,t){return abstract()}readFeatures(e,t){return this.readFeaturesFromText(getText(e),this.adaptOptions(t))}readFeaturesFromText(e,t){return abstract()}readGeometry(e,t){return this.readGeometryFromText(getText(e),this.adaptOptions(t))}readGeometryFromText(e,t){return abstract()}readProjection(e){return this.readProjectionFromText(getText(e))}readProjectionFromText(e){return this.dataProjection}writeFeature(e,t){return this.writeFeatureText(e,this.adaptOptions(t))}writeFeatureText(e,t){return abstract()}writeFeatures(e,t){return this.writeFeaturesText(e,this.adaptOptions(t))}writeFeaturesText(e,t){return abstract()}writeGeometry(e,t){return this.writeGeometryText(e,this.adaptOptions(t))}writeGeometryText(e,t){return abstract()}}function getText(s){return typeof s=="string"?s:""}const GeometryConstructor={POINT:Point,LINESTRING:LineString,POLYGON:Polygon,MULTIPOINT:MultiPoint,MULTILINESTRING:MultiLineString,MULTIPOLYGON:MultiPolygon},EMPTY="EMPTY",Z="Z",M="M",ZM="ZM",TokenType={START:0,TEXT:1,LEFT_PAREN:2,RIGHT_PAREN:3,NUMBER:4,COMMA:5,EOF:6},wktTypeLookup={Point:"POINT",LineString:"LINESTRING",Polygon:"POLYGON",MultiPoint:"MULTIPOINT",MultiLineString:"MULTILINESTRING",MultiPolygon:"MULTIPOLYGON",GeometryCollection:"GEOMETRYCOLLECTION",Circle:"CIRCLE"};class Lexer{constructor(e){this.wkt=e,this.index_=-1}isAlpha_(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"}isNumeric_(e,t){return t=t!==void 0?t:!1,e>="0"&&e<="9"||e=="."&&!t}isWhiteSpace_(e){return e==" "||e==" "||e=="\r"||e==`
|
|
8
|
+
`}nextChar_(){return this.wkt.charAt(++this.index_)}nextToken(){const e=this.nextChar_(),t=this.index_;let i=e,n;if(e=="(")n=TokenType.LEFT_PAREN;else if(e==",")n=TokenType.COMMA;else if(e==")")n=TokenType.RIGHT_PAREN;else if(this.isNumeric_(e)||e=="-")n=TokenType.NUMBER,i=this.readNumber_();else if(this.isAlpha_(e))n=TokenType.TEXT,i=this.readText_();else{if(this.isWhiteSpace_(e))return this.nextToken();if(e==="")n=TokenType.EOF;else throw new Error("Unexpected character: "+e)}return{position:t,value:i,type:n}}readNumber_(){let e;const t=this.index_;let i=!1,n=!1;do e=="."?i=!0:(e=="e"||e=="E")&&(n=!0),e=this.nextChar_();while(this.isNumeric_(e,i)||!n&&(e=="e"||e=="E")||n&&(e=="-"||e=="+"));return parseFloat(this.wkt.substring(t,this.index_--))}readText_(){let e;const t=this.index_;do e=this.nextChar_();while(this.isAlpha_(e));return this.wkt.substring(t,this.index_--).toUpperCase()}}class Parser{constructor(e){this.lexer_=e,this.token_={position:0,type:TokenType.START},this.layout_="XY"}consume_(){this.token_=this.lexer_.nextToken()}isTokenType(e){return this.token_.type==e}match(e){const t=this.isTokenType(e);return t&&this.consume_(),t}parse(){return this.consume_(),this.parseGeometry_()}parseGeometryLayout_(){let e="XY";const t=this.token_;if(this.isTokenType(TokenType.TEXT)){const i=t.value;i===Z?e="XYZ":i===M?e="XYM":i===ZM&&(e="XYZM"),e!=="XY"&&this.consume_()}return e}parseGeometryCollectionText_(){if(this.match(TokenType.LEFT_PAREN)){const e=[];do e.push(this.parseGeometry_());while(this.match(TokenType.COMMA));if(this.match(TokenType.RIGHT_PAREN))return e}throw new Error(this.formatErrorMessage_())}parsePointText_(){if(this.match(TokenType.LEFT_PAREN)){const e=this.parsePoint_();if(this.match(TokenType.RIGHT_PAREN))return e}throw new Error(this.formatErrorMessage_())}parseLineStringText_(){if(this.match(TokenType.LEFT_PAREN)){const e=this.parsePointList_();if(this.match(TokenType.RIGHT_PAREN))return e}throw new Error(this.formatErrorMessage_())}parsePolygonText_(){if(this.match(TokenType.LEFT_PAREN)){const e=this.parseLineStringTextList_();if(this.match(TokenType.RIGHT_PAREN))return e}throw new Error(this.formatErrorMessage_())}parseMultiPointText_(){if(this.match(TokenType.LEFT_PAREN)){let e;if(this.token_.type==TokenType.LEFT_PAREN?e=this.parsePointTextList_():e=this.parsePointList_(),this.match(TokenType.RIGHT_PAREN))return e}throw new Error(this.formatErrorMessage_())}parseMultiLineStringText_(){if(this.match(TokenType.LEFT_PAREN)){const e=this.parseLineStringTextList_();if(this.match(TokenType.RIGHT_PAREN))return e}throw new Error(this.formatErrorMessage_())}parseMultiPolygonText_(){if(this.match(TokenType.LEFT_PAREN)){const e=this.parsePolygonTextList_();if(this.match(TokenType.RIGHT_PAREN))return e}throw new Error(this.formatErrorMessage_())}parsePoint_(){const e=[],t=this.layout_.length;for(let i=0;i<t;++i){const n=this.token_;if(this.match(TokenType.NUMBER))e.push(n.value);else break}if(e.length==t)return e;throw new Error(this.formatErrorMessage_())}parsePointList_(){const e=[this.parsePoint_()];for(;this.match(TokenType.COMMA);)e.push(this.parsePoint_());return e}parsePointTextList_(){const e=[this.parsePointText_()];for(;this.match(TokenType.COMMA);)e.push(this.parsePointText_());return e}parseLineStringTextList_(){const e=[this.parseLineStringText_()];for(;this.match(TokenType.COMMA);)e.push(this.parseLineStringText_());return e}parsePolygonTextList_(){const e=[this.parsePolygonText_()];for(;this.match(TokenType.COMMA);)e.push(this.parsePolygonText_());return e}isEmptyGeometry_(){const e=this.isTokenType(TokenType.TEXT)&&this.token_.value==EMPTY;return e&&this.consume_(),e}formatErrorMessage_(){return"Unexpected `"+this.token_.value+"` at position "+this.token_.position+" in `"+this.lexer_.wkt+"`"}parseGeometry_(){const e=this.token_;if(this.match(TokenType.TEXT)){const t=e.value;this.layout_=this.parseGeometryLayout_();const i=this.isEmptyGeometry_();if(t=="GEOMETRYCOLLECTION"){if(i)return new GeometryCollection([]);const o=this.parseGeometryCollectionText_();return new GeometryCollection(o)}const n=GeometryConstructor[t];if(!n)throw new Error("Invalid geometry type: "+t);let r;if(i)t=="POINT"?r=[NaN,NaN]:r=[];else switch(t){case"POINT":{r=this.parsePointText_();break}case"LINESTRING":{r=this.parseLineStringText_();break}case"POLYGON":{r=this.parsePolygonText_();break}case"MULTIPOINT":{r=this.parseMultiPointText_();break}case"MULTILINESTRING":{r=this.parseMultiLineStringText_();break}case"MULTIPOLYGON":{r=this.parseMultiPolygonText_();break}}return new n(r,this.layout_)}throw new Error(this.formatErrorMessage_())}}class WKT extends TextFeature{constructor(e){super(),e=e||{},this.splitCollection_=e.splitCollection!==void 0?e.splitCollection:!1}parse_(e){const t=new Lexer(e);return new Parser(t).parse()}readFeatureFromText(e,t){const i=this.readGeometryFromText(e,t),n=new Feature;return n.setGeometry(i),n}readFeaturesFromText(e,t){let i=[];const n=this.readGeometryFromText(e,t);this.splitCollection_&&n.getType()=="GeometryCollection"?i=n.getGeometriesArray():i=[n];const r=[];for(let o=0,a=i.length;o<a;++o){const l=new Feature;l.setGeometry(i[o]),r.push(l)}return r}readGeometryFromText(e,t){const i=this.parse_(e);return transformGeometryWithOptions(i,!1,t)}writeFeatureText(e,t){const i=e.getGeometry();return i?this.writeGeometryText(i,t):""}writeFeaturesText(e,t){if(e.length==1)return this.writeFeatureText(e[0],t);const i=[];for(let r=0,o=e.length;r<o;++r)i.push(e[r].getGeometry());const n=new GeometryCollection(i);return this.writeGeometryText(n,t)}writeGeometryText(e,t){return encode(transformGeometryWithOptions(e,!0,t))}}function encodePointGeometry(s){const e=s.getCoordinates();return e.length===0?"":e.join(" ")}function encodeMultiPointGeometry(s){const e=[],t=s.getPoints();for(let i=0,n=t.length;i<n;++i)e.push("("+encodePointGeometry(t[i])+")");return e.join(",")}function encodeGeometryCollectionGeometry(s){const e=[],t=s.getGeometries();for(let i=0,n=t.length;i<n;++i)e.push(encode(t[i]));return e.join(",")}function encodeLineStringGeometry(s){const e=s.getCoordinates(),t=[];for(let i=0,n=e.length;i<n;++i)t.push(e[i].join(" "));return t.join(",")}function encodeMultiLineStringGeometry(s){const e=[],t=s.getLineStrings();for(let i=0,n=t.length;i<n;++i)e.push("("+encodeLineStringGeometry(t[i])+")");return e.join(",")}function encodePolygonGeometry(s){const e=[],t=s.getLinearRings();for(let i=0,n=t.length;i<n;++i)e.push("("+encodeLineStringGeometry(t[i])+")");return e.join(",")}function encodeMultiPolygonGeometry(s){const e=[],t=s.getPolygons();for(let i=0,n=t.length;i<n;++i)e.push("("+encodePolygonGeometry(t[i])+")");return e.join(",")}function encodeGeometryLayout(s){const e=s.getLayout();let t="";return(e==="XYZ"||e==="XYZM")&&(t+=Z),(e==="XYM"||e==="XYZM")&&(t+=M),t}const GeometryEncoder={Point:encodePointGeometry,LineString:encodeLineStringGeometry,Polygon:encodePolygonGeometry,MultiPoint:encodeMultiPointGeometry,MultiLineString:encodeMultiLineStringGeometry,MultiPolygon:encodeMultiPolygonGeometry,GeometryCollection:encodeGeometryCollectionGeometry};function encode(s){const e=s.getType(),t=GeometryEncoder[e],i=t(s);let n=wktTypeLookup[e];if(typeof s.getFlatCoordinates=="function"){const r=encodeGeometryLayout(s);r.length>0&&(n+=" "+r)}return i.length===0?n+" "+EMPTY:n+"("+i+")"}var earthRadius=63710088e-1,factors={centimeters:earthRadius*100,centimetres:earthRadius*100,degrees:360/(2*Math.PI),feet:earthRadius*3.28084,inches:earthRadius*39.37,kilometers:earthRadius/1e3,kilometres:earthRadius/1e3,meters:earthRadius,metres:earthRadius,miles:earthRadius/1609.344,millimeters:earthRadius*1e3,millimetres:earthRadius*1e3,nauticalmiles:earthRadius/1852,radians:1,yards:earthRadius*1.0936};function lengthToRadians(s,e="kilometers"){const t=factors[e];if(!t)throw new Error(e+" units is invalid");return s/t}function lengthToDegrees(s,e){return radiansToDegrees(lengthToRadians(s,e))}function radiansToDegrees(s){return s%(2*Math.PI)*180/Math.PI}class Typhoon{constructor(){se(this,"typhoonLevel",{CZ:"#000000",TD:"#00ff00",TS:"#0000ff",STS:"#ffff00",TY:"#ffa000",STY:"#ff0000",SUPERTY:"#a200a2"});se(this,"vectorSource");se(this,"lastPointLive")}createTrack(e){this.vectorSource||(this.vectorSource=new VectorSource);let t={coordinate:[],color:""};for(let i=0;i<e.live.length;i++){const n=e.live[i],r=[n.longitude,n.latitude];this.drawPoint(this.vectorSource,n,e.baseInfo,e.unit);const o=this.typhoonLevel[n.tcRank]?this.typhoonLevel[n.tcRank]:"#ffffff";if(i>0){const a=[];a.push(t.coordinate),a.push(r);const l=new Feature({geometry:new LineString(a)});let c;n.type==="forecast"&&(c=[5]),l.setStyle(new Style({stroke:new Stroke({color:t.color,width:1,lineDash:c})})),this.vectorSource.addFeature(l)}t={color:o,coordinate:r},this.lastPointLive=n}for(const i in e.forecast){const n=e.forecast[i].fore,r=e.forecast[i].obs,o=[];if(n.length>0){if(r&&r.length>0){const l=this.getLastPoint(e,r[0]);o.push([Number(l.longitude),Number(l.latitude)])}n.forEach(l=>{this.drawPoint(this.vectorSource,l,e.baseInfo,e.unit),o.push([Number(l.longitude),Number(l.latitude)])});const a=new Feature({geometry:new LineString(o)});a.setStyle(new Style({stroke:new Stroke({color:e.forecast[i].color,width:2,lineDash:[5]})})),this.vectorSource.addFeature(a)}}return this.drawWindCircle(),this.vectorSource}drawPoint(e,t,i,n){const r=[t.longitude,t.latitude],o=new Feature({geometry:new Point(r)});t.baseInfo=i,t.unit=n,o.set("mark","typhoon"),o.set("data",t);const a=this.typhoonLevel[t.tcRank]?this.typhoonLevel[t.tcRank]:"#ffffff";o.setStyle(new Style({image:new CircleStyle({radius:4,stroke:new Stroke({width:1,color:"#5e5e5e"}),fill:new Fill({color:a})}),zIndex:2})),e.addFeature(o)}drawWindCircle(e){const t=e||this.lastPointLive;this.vectorSource.forEachFeature(n=>{n.getId()!==void 0&&n.getId().includes("typhoon")&&this.vectorSource.removeFeature(n)});const i={rd06:"#00FF00",rd07:"#0000FF",rd08:"#FFFF00",rd10:"#F59A23",rd12:"#FF0000"};for(const n in i)if(t[n]){let r=t[n].split(",").map(Number);const o={x:Number(t.longitude),y:Number(t.latitude),r:{SE:lengthToDegrees(r[3]),NE:lengthToDegrees(r[2]),NW:lengthToDegrees(r[1]),SW:lengthToDegrees(r[0])},interval:2,color:i[n]},a=new WKT;let l="POLYGON((",c="";for(let u=0;u<360/o.interval;u++){let d=0;const g=u*o.interval;g>0&&g<=90?d=o.r.NE:g>90&&g<=180?d=o.r.NW:g>180&&g<=270?d=o.r.SW:d=o.r.SE;const f=o.x+d*Math.cos(g*Math.PI/180),m=o.y+d*Math.sin(g*Math.PI/180);l=l+`${f} ${m},`,u===0&&(c=`${f} ${m}`)}l=l+c+"))";const h=a.readFeature(l);h.setId(`typhoon_${n}`),h.setStyle(new Style({stroke:new Stroke({color:o.color})})),this.vectorSource.addFeature(h)}}getLastPoint(e,t){let i=e.live[0];return e.live.forEach(n=>{if(new Date(t.ddateTime).getTime()>=new Date(n.ddateTime).getTime())i=n;else return}),i}}const Property={ELEMENT:"element",MAP:"map",OFFSET:"offset",POSITION:"position",POSITIONING:"positioning"};class Overlay extends BaseObject{constructor(e){super(),this.on,this.once,this.un,this.options=e,this.id=e.id,this.insertFirst=e.insertFirst!==void 0?e.insertFirst:!0,this.stopEvent=e.stopEvent!==void 0?e.stopEvent:!0,this.element=document.createElement("div"),this.element.className=e.className!==void 0?e.className:"ol-overlay-container "+CLASS_SELECTABLE,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=e.autoPan===!0?{}:e.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(Property.ELEMENT,this.handleElementChanged),this.addChangeListener(Property.MAP,this.handleMapChanged),this.addChangeListener(Property.OFFSET,this.handleOffsetChanged),this.addChangeListener(Property.POSITION,this.handlePositionChanged),this.addChangeListener(Property.POSITIONING,this.handlePositioningChanged),e.element!==void 0&&this.setElement(e.element),this.setOffset(e.offset!==void 0?e.offset:[0,0]),this.setPositioning(e.positioning||"top-left"),e.position!==void 0&&this.setPosition(e.position)}getElement(){return this.get(Property.ELEMENT)}getId(){return this.id}getMap(){return this.get(Property.MAP)||null}getOffset(){return this.get(Property.OFFSET)}getPosition(){return this.get(Property.POSITION)}getPositioning(){return this.get(Property.POSITIONING)}handleElementChanged(){removeChildren(this.element);const e=this.getElement();e&&this.element.appendChild(e)}handleMapChanged(){var t;this.mapPostrenderListenerKey&&((t=this.element)==null||t.remove(),unlistenByKey(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const e=this.getMap();if(e){this.mapPostrenderListenerKey=listen(e,MapEventType.POSTRENDER,this.render,this),this.updatePixelPosition();const i=this.stopEvent?e.getOverlayContainerStopEvent():e.getOverlayContainer();this.insertFirst?i.insertBefore(this.element,i.childNodes[0]||null):i.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(e){this.set(Property.ELEMENT,e)}setMap(e){this.set(Property.MAP,e)}setOffset(e){this.set(Property.OFFSET,e)}setPosition(e){this.set(Property.POSITION,e)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(e){const t=this.getMap();if(!t||!t.getTargetElement()||!this.get(Property.POSITION))return;const i=this.getRect(t.getTargetElement(),t.getSize()),n=this.getElement(),r=this.getRect(n,[outerWidth(n),outerHeight(n)]);e=e||{};const o=e.margin===void 0?20:e.margin;if(!containsExtent(i,r)){const a=r[0]-i[0],l=i[2]-r[2],c=r[1]-i[1],h=i[3]-r[3],u=[0,0];if(a<0?u[0]=a-o:l<0&&(u[0]=Math.abs(l)+o),c<0?u[1]=c-o:h<0&&(u[1]=Math.abs(h)+o),u[0]!==0||u[1]!==0){const d=t.getView().getCenterInternal(),g=t.getPixelFromCoordinateInternal(d);if(!g)return;const f=[g[0]+u[0],g[1]+u[1]],m=e.animation||{};t.getView().animateInternal({center:t.getCoordinateFromPixelInternal(f),duration:m.duration,easing:m.easing})}}}getRect(e,t){const i=e.getBoundingClientRect(),n=i.left+window.pageXOffset,r=i.top+window.pageYOffset;return[n,r,n+t[0],r+t[1]]}setPositioning(e){this.set(Property.POSITIONING,e)}setVisible(e){this.rendered.visible!==e&&(this.element.style.display=e?"":"none",this.rendered.visible=e)}updatePixelPosition(){const e=this.getMap(),t=this.getPosition();if(!e||!e.isRendered()||!t){this.setVisible(!1);return}const i=e.getPixelFromCoordinate(t),n=e.getSize();this.updateRenderedPosition(i,n)}updateRenderedPosition(e,t){const i=this.element.style,n=this.getOffset(),r=this.getPositioning();this.setVisible(!0);const o=`${e[0]+n[0]}px`,a=`${e[1]+n[1]}px`;let l="0%",c="0%";r=="bottom-right"||r=="center-right"||r=="top-right"?l="-100%":(r=="bottom-center"||r=="center-center"||r=="top-center")&&(l="-50%"),r=="bottom-left"||r=="bottom-center"||r=="bottom-right"?c="-100%":(r=="center-left"||r=="center-center"||r=="center-right")&&(c="-50%");const h=`translate(${l}, ${c}) translate(${o}, ${a})`;this.rendered.transform_!=h&&(this.rendered.transform_=h,i.transform=h)}getOptions(){return this.options}}const _hoisted_1={id:"ol-map",class:"ol-map"},_sfc_main=vue.defineComponent({__name:"VueOl",props:{options:{}},emits:["olMap"],setup(__props,{emit:__emit}){const emits=__emit,props=__props,layers=[],options={target:"ol-map",layers,view:new View(props.options.view)};let map;const typhoonList={},typhoonMarks={},addLayer=s=>{let e=getLayer(s);return e&&e.set("id",s.id),e},updateLayer=(s,e,t)=>{const n=map.getLayers().getArray().find(r=>r.get("id")===s);switch(e){case"xyz":updateXYZLayer(n,t,s);break;case"imageStatic":updateImageStaticLayer(n,t,s);break;case"point":updatePointLayer(n,t);break;case"typhoon":updateTyphoonLayer(n,t,s);break;default:console.error(`未定义类型(${e}),请使用原生ol实现!`);break}},updateXYZLayer=(s,e,t)=>{updated(s,e,t,["extent","map","maxResolution","maxZoom","minResolution","minZoom","opacity","preload","properties","source","useInterimTilesOnError","visible","zIndex"],["attributions","properties","renderReprojectionEdges","tileGridForProjection","tileUrlFunction","url"])},updateImageStaticLayer=(s,e,t)=>{updated(s,e,t,["extent","map","maxResolution","maxZoom","minResolution","minZoom","opacity","properties","source","visible","zIndex"],["attributions","properties"])},updatePointLayer=(layer,info)=>{const layerEffectiveFields=["declutter","extent","map","maxResolution","maxZoom","minResolution","minZoom","opacity","properties","source","style","visible","zIndex"],source=layer.getSource();for(const key in info)if(key==="add"){const s=[];info[key].length>0&&(info[key].forEach(e=>{const t=new Feature;t.setGeometry(new Point([e.lng,e.lat]));const i={...e};delete i.style,t.set("data",i),t.setId(e.id),e.style&&t.setStyle(getStyle(e.style,e)),s.push(t)}),source.addFeatures(s))}else if(key==="update"){if(info[key].length>0){const s=[],e=[];info[key].forEach(t=>{const i=new Feature;i.setGeometry(new Point([t.lng,t.lat])),i.set("data",t),i.setId(t.id),t.style&&i.setStyle(getStyle(t.style,t)),s.push(source.getFeatureById(t.id)),e.push(i)}),source.removeFeatures(s),source.addFeatures(e)}}else if(key==="delete"){const s=[];info[key].length>0&&info[key].forEach(e=>{s.push(source.getFeatureById(e.id))}),source.removeFeatures(s)}else if(key==="style"){const s=typeof info[key]=="function"?info[key]:getStyle(info[key]);layer.setStyle(s)}else layerEffectiveFields.includes(key)&&eval(`layer.set${capitalize(key)}(info[key])`)},updateTyphoonLayer=(s,e,t)=>{const i=["extent","layers","maxResolution","maxZoom","minResolution","minZoom","opacity","properties","visible","zIndex"];if(e.visible!==void 0){const n=props.options.layers.findIndex(o=>o.id===t),r=props.options.layers[n].data.baseInfo.tsId;for(const o in typhoonMarks)if(o.includes(r))if(e.visible){const a=typhoonMarks[o].nameOverlay.get("lnglat"),l=typhoonMarks[o].lastPointOverlay.get("lnglat");typhoonMarks[o].nameOverlay.setPosition(a),typhoonMarks[o].lastPointOverlay.setPosition(l)}else typhoonMarks[o].nameOverlay.setPosition(void 0),typhoonMarks[o].lastPointOverlay.setPosition(void 0)}updated(s,e,t,i,[])},updated=(layer,info,id,layerEffectiveFields,sourceEffectiveFields)=>{for(const key in info)if(key==="source"){const keys=Object.keys(info.source),flag=keys.every(s=>sourceEffectiveFields.includes(s));if(flag)for(const k in info.source)eval(`layer.getSource().set${capitalize(k)}(info.source[k])`);else{const s=props.options.layers.findIndex(e=>e.id===id);layer.setSource(null),setTimeout(()=>{const e=getSource(props.options.layers[s]);layer.setSource(e)})}}else layerEffectiveFields.includes(key)&&eval(`layer.set${capitalize(key)}(info[key])`)},getLayer=s=>{switch(s.type){case"xyz":return getXYZLayer(s);case"imageStatic":return getImageStaticLayer(s);case"point":return getPointLayer(s);case"typhoon":return getTypeoonLayer(s);default:console.error(`layer config error;id:${s.id}`);break}},getXYZLayer=s=>{const e=getSource(s);return new TileLayer({...s,source:e})},getImageStaticLayer=s=>{const e=getSource(s),t={...s,source:e};return new ImageLayer(t)},getPointLayer=s=>{const e={...s};delete e.data,delete e.style;const t=new VectorLayer({...e,source:getPointSource(s)}),i=typeof s.style=="function"?s.style:getStyle(s.style);return t.setStyle(i),t},getTypeoonLayer=s=>{const e=[],t=[];if(s.data.mainPath){const r=s.data.data[s.data.mainPath],o={};o.live=[...r.obs].reverse(),o.forecast=s.data.data,o.baseInfo=s.data.baseInfo,o.unit=s.data.mainPath,e.push(o)}else for(const r in s.data.data){const o={};o.live=[...s.data.data[r].obs].reverse(),o.baseInfo=s.data.baseInfo,o.forecast={},o.forecast[r]=s.data.data[r],o.unit=r,e.push(o)}e.forEach(r=>{if(r.live.length===0)return;const o=new Typhoon,a=s.data.baseInfo.tsId+"_"+r.unit;typhoonList[a]=o;const l=new VectorLayer({source:o.createTrack(r)});if(t.push(l),typhoonMarks[a]||(typhoonMarks[a]={}),s.data.baseInfo.tseName){const h=r.live[0],u=document.createElement("div");u.innerHTML=`<span style="font-weight:bold;font-size:14px">${s.data.baseInfo.tscName}${s.data.baseInfo.tseName}</span>`;let d;(s.visible===void 0||s.visible)&&(d=[h.longitude,h.latitude]);const g=new Overlay({position:d,element:u,positioning:"bottom-center",offset:[0,-10],stopEvent:!1});g.set("lnglat",[h.longitude,h.latitude]),map.addOverlay(g),typhoonMarks[a].nameOverlay=g}const c=r.live[r.live.length-1];if(c.tcRank!==""){const h=new URL(Object.assign({"../assets/images/typhoon-STS.png":__vite_glob_0_0,"../assets/images/typhoon-STY.png":__vite_glob_0_1,"../assets/images/typhoon-SUPERTY.png":__vite_glob_0_2,"../assets/images/typhoon-TD.png":__vite_glob_0_3,"../assets/images/typhoon-TS.png":__vite_glob_0_4,"../assets/images/typhoon-TY.png":__vite_glob_0_5})[`../assets/images/typhoon-${c.tcRank}.png`],typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:_documentCurrentScript&&_documentCurrentScript.tagName.toUpperCase()==="SCRIPT"&&_documentCurrentScript.src||new URL("runbir-tools.umd.js",document.baseURI).href).href,u=document.createElement("div");u.innerHTML=`<img src="${h}" style="width:30px;height: 30px;animation: rotate 2s infinite;"/>`;let d;(s.visible===void 0||s.visible)&&(d=[c.longitude,c.latitude]);const g=new Overlay({position:d,element:u,positioning:"center-center",stopEvent:!1});g.set("lnglat",[c.longitude,c.latitude]),map.addOverlay(g),typhoonMarks[a].lastPointOverlay=g}});const i={...s};return delete i.data,new LayerGroup({...i,layers:t})},getSource=s=>{switch(s.type){case"xyz":return new XYZ({...s.source});case"imageStatic":return new Static({...s.source});case"point":return getPointSource(s);default:console.error(`layer config error;id:${s.id}`);break}},getPointSource=s=>{const e=[];return s.data.forEach(t=>{const i=new Feature;i.setGeometry(new Point([t.lng,t.lat])),i.set("data",t),i.setId(t.id),t.style&&i.setStyle(getStyle(t.style,t)),e.push(i)}),new VectorSource({...s.source,features:e})},getStyle=(s,e)=>{const t={...s};if(s.image){let i;switch(s.image.type){case"circle":{i=new CircleStyle({...s.image,fill:new Fill({...s.image.fill}),stroke:new Stroke({...s.image.stroke})});break}case"icon":i=new Icon({...s.image});break;case"regularShape":{i=new RegularShape({...s.image,fill:new Fill({...s.image.fill}),stroke:new Stroke({...s.image.stroke})});break}case"windBarb":{const n=s.image.size||[12,24],o=new WindBarb(n[0]).getIconOfCanvas(e.winds),a=parseFloat(e.windd)*Math.PI/180;i=new Icon({img:o,size:n,anchor:[2,1],anchorXUnits:"pixels",rotation:a,color:getColor(e.winds),...s.image});break}default:console.error("暂不支持此图标类型,请自行原生处理。");break}t.image=i}if(s.text){const i=new Text({...s.text,text:e.text});t.text=i}return new Style(t)};props.options.layers.forEach(s=>{const e=addLayer(s);e&&layers.push(e)});function capitalize(s){return s.charAt(0).toUpperCase()+s.slice(1)}function getColor(s){return s<10.8?"#404040":s<13.9?"#008000":s<17.2?"#0000ff":s<24.5?"#ff7d00":"#ff0000"}let typhoonPoint;const handlePointermove=s=>{let e=!1;if(map.forEachFeatureAtPixel(s.pixel,t=>{t.get("mark")&&(typhoonPoint=t.get("data"),e=!0)}),e){const t=typhoonPoint.baseInfo.tsId+"_"+typhoonPoint.unit;typhoonList[t].drawWindCircle(typhoonPoint)}else if(typhoonPoint){const t=typhoonPoint.baseInfo.tsId+"_"+typhoonPoint.unit;typhoonList[t].drawWindCircle(),typhoonPoint=void 0}};return vue.onMounted(()=>{map=new Map(options);const s=new Set;props.options.event&&props.options.event.register.forEach(e=>{s.add(e)}),s.add("pointermove"),map.on([...s],e=>{switch(props.options.event.register.includes(e.type)&&props.options.event.callback(e),e.type){case"pointermove":handlePointermove(e);break}}),emits("olMap",map)}),vue.watch(()=>props.options.view.center,s=>{map.getView().setCenter(s)}),vue.watch(()=>props.options.view.constrainResolution,s=>{s&&map.getView().setConstrainResolution(s)}),vue.watch(()=>props.options.view.maxZoom,s=>{s&&map.getView().setMaxZoom(s)}),vue.watch(()=>props.options.view.minZoom,s=>{s&&map.getView().setMinZoom(s)}),vue.watch(()=>props.options.view.resolution,s=>{s&&map.getView().setResolution(s)}),vue.watch(()=>props.options.view.rotation,s=>{s&&map.getView().setRotation(s)}),vue.watch(()=>props.options.view.zoom,s=>{s&&map.getView().setZoom(s)}),vue.watch(()=>props.options.view,s=>{map.setView(new View(s))}),vue.watch(()=>JSON.parse(JSON.stringify(props.options.layers)),(s,e)=>{s.forEach(t=>{const i=e.findIndex(n=>n.id===t.id);if(i>-1){const n={};for(const r in t)if(JSON.stringify(t[r])!==JSON.stringify(e[i][r]))if(r==="source"){const o={};for(const a in t[r])JSON.stringify(t[r][a])!==JSON.stringify(e[i][r][a])&&(o[a]=t[r][a]);n[r]=o}else t.type==="point"&&r==="data"?(n.add=[],n.update=[],n.delete=[],t[r].forEach(o=>{const a=e[i][r].findIndex(l=>l.id===o.id);a<0?n.add.push(o):JSON.stringify(o)!==JSON.stringify(e[i][r][a])&&n.update.push(o)}),e[i][r].forEach(o=>{t[r].find(l=>l.id===o.id)||n.delete.push(o)})):n[r]=t[r];JSON.stringify(n)!=="{}"&&updateLayer(t.id,t.type,n)}else{const n=addLayer(t);map.addLayer(n)}}),e.forEach(t=>{if(s.findIndex(n=>n.id===t.id)<0){const n=map.getLayers(),r=n.getArray().find(o=>o.get("id")===t.id);if(r&&n.remove(r),t.type==="typhoon"){const o=t.data.baseInfo.tsId;for(const a in typhoonMarks)a.includes(o)&&(map.removeOverlay(typhoonMarks[a].nameOverlay),map.removeOverlay(typhoonMarks[a].lastPointOverlay),delete typhoonMarks[a])}}})},{deep:!0}),(s,e)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1))}}),_export_sfc=(s,e)=>{const t=s.__vccOpts||s;for(const[i,n]of e)t[i]=n;return t},VueOl=_export_sfc(_sfc_main,[["__scopeId","data-v-26961a08"]]),components={VueOl},index={install(s,e){for(const t in components)s.component(t,components[t])},...components};exports.VueOl=VueOl,exports.default=index,Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|