@defra/interactive-map 0.0.32-alpha → 0.0.33-alpha

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.
Files changed (44) hide show
  1. package/dist/css/index.css +1 -1
  2. package/dist/esm/im-core.js +1 -1
  3. package/dist/umd/im-core.js +1 -1
  4. package/dist/umd/index.js +1 -1
  5. package/docs/api/map-style-config.md +27 -3
  6. package/docs/assets/images/hero.png +0 -0
  7. package/package.json +1 -1
  8. package/plugins/beta/draw-ml/dist/esm/im-draw-ml-plugin.js +1 -1
  9. package/plugins/beta/draw-ml/dist/umd/im-draw-ml-plugin.js +1 -1
  10. package/plugins/beta/draw-ml/src/DrawInit.jsx +11 -0
  11. package/plugins/beta/draw-ml/src/modes/createDrawMode.js +31 -25
  12. package/plugins/beta/draw-ml/src/modes/editVertex/touchHandlers.js +1 -1
  13. package/plugins/beta/draw-ml/src/modes/editVertex/vertexOperations.js +5 -4
  14. package/plugins/beta/draw-ml/src/modes/editVertexMode.js +49 -21
  15. package/plugins/beta/draw-ol/dist/esm/DrawMode.js +1 -1
  16. package/plugins/beta/draw-ol/dist/esm/EditMode.js +1 -1
  17. package/plugins/beta/draw-ol/dist/esm/im-draw-ol-plugin.js +1 -1
  18. package/plugins/beta/draw-ol/src/core/OLDrawManager.js +3 -0
  19. package/plugins/beta/draw-ol/src/draw/DrawMode.js +57 -49
  20. package/plugins/beta/draw-ol/src/draw/drawInput.js +76 -32
  21. package/plugins/beta/draw-ol/src/edit/EditMode.js +4 -4
  22. package/plugins/beta/draw-ol/src/manifest.js +5 -1
  23. package/plugins/beta/draw-ol/src/reducer.js +1 -1
  24. package/plugins/beta/draw-ol/src/snap/snapEngine.js +75 -31
  25. package/plugins/beta/draw-ol/src/snap/snapGeometry.js +23 -46
  26. package/plugins/beta/draw-ol/src/snap/snapInteraction.js +30 -29
  27. package/plugins/beta/draw-ol/src/snap/snapManager.js +10 -1
  28. package/plugins/beta/draw-ol/src/utils/geometryHelpers.js +9 -3
  29. package/plugins/beta/draw-ol/src/utils/olCoords.js +2 -2
  30. package/plugins/beta/draw-ol/src/utils/spatial.js +4 -8
  31. package/providers/beta/openlayers/dist/esm/im-openlayers-provider.js +1 -1
  32. package/providers/beta/openlayers/dist/umd/im-openlayers-provider.js +1 -1
  33. package/providers/beta/openlayers/dist/umd/index.js +1 -1
  34. package/providers/beta/openlayers/src/utils/tileLayers.js +29 -2
  35. package/providers/beta/openlayers/src/utils/tileLayers.test.js +53 -1
  36. package/src/App/components/MapButton/MapButton.jsx +14 -10
  37. package/src/App/components/MapButton/MapButton.module.scss +1 -1
  38. package/src/App/components/MapButton/MapButton.test.jsx +1 -1
  39. package/src/App/components/PopupMenu/PopupMenu.test.jsx +79 -0
  40. package/src/App/components/PopupMenu/usePopupMenu.js +61 -12
  41. package/src/types.js +12 -3
  42. package/src/utils/findNextTabStop.js +3 -3
  43. package/src/utils/findNextTabStop.test.js +25 -1
  44. package/webpack.dev.mjs +1 -0
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see im-openlayers-provider.js.LICENSE.txt */
2
- "use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[142],{792(t,e,i){i.r(e),i.d(e,{default:()=>pb});const n="add",r="remove",s="propertychange";function o(t){for(const e in t)delete t[e]}function a(t){let e;for(e in t)return!1;return!e}function l(t,e,i,n,r){if(r){const r=i;i=function(s){return t.removeEventListener(e,i),r.call(n??this,s)}}else n&&n!==t&&(i=i.bind(n));const s={target:t,type:e,listener:i};return t.addEventListener(e,i),s}function h(t,e,i,n){return l(t,e,i,n,!0)}function u(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),o(t))}const c="change",d="contextmenu",f="click",p="keydown",g="keypress",m="touchmove",y="wheel",_=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function v(t,e){return t>e?1:t<e?-1:0}function x(t,e){return t<e?1:t>e?-1:0}function w(t,e,i){if(t[0]<=e)return 0;const n=t.length;if(e<=t[n-1])return n-1;if("function"==typeof i){for(let r=1;r<n;++r){const n=t[r];if(n===e)return r;if(n<e)return i(e,t[r-1],n)>0?r-1:r}return n-1}if(i>0){for(let i=1;i<n;++i)if(t[i]<e)return i-1;return n-1}if(i<0){for(let i=1;i<n;++i)if(t[i]<=e)return i;return n-1}for(let i=1;i<n;++i){if(t[i]==e)return i;if(t[i]<e)return t[i-1]-e<e-t[i]?i-1:i}return n-1}function b(t,e,i){for(;e<i;){const n=t[e];t[e]=t[i],t[i]=n,++e,--i}}function S(t,e){const i=Array.isArray(e)?e:[e],n=i.length;for(let e=0;e<n;e++)t[t.length]=i[e]}function M(t,e){const i=t.length;if(i!==e.length)return!1;for(let n=0;n<i;n++)if(t[n]!==e[n])return!1;return!0}function E(){return!0}function C(){return!1}function P(){}function I(t){let e,i,n;return function(){const r=Array.prototype.slice.call(arguments);return i&&this===n&&M(r,i)||(n=this,i=r,e=t.apply(this,arguments)),e}}function T(t){return function(){let e;try{e=t()}catch(t){return Promise.reject(t)}return e instanceof Promise?e:Promise.resolve(e)}()}const k=class{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}},R=class extends _{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),n=i[t]||(i[t]=[]);n.includes(e)||n.push(e)}dispatchEvent(t){const e="string"==typeof t,i=e?t:t.type,n=this.listeners_&&this.listeners_[i];if(!n)return;const r=e?new k(t):t;r.target||(r.target=this.eventTarget_||this);const s=this.dispatching_||(this.dispatching_={}),o=this.pendingRemovals_||(this.pendingRemovals_={});let a;i in s||(s[i]=0,o[i]=0),++s[i];for(let t=0,e=n.length;t<e;++t)if(a="handleEvent"in n[t]?n[t].handleEvent(r):n[t].call(this,r),!1===a||r.propagationStopped){a=!1;break}if(0===--s[i]){let t=o[i];for(delete o[i];t--;)this.removeEventListener(i,P);delete s[i]}return a}disposeInternal(){this.listeners_&&o(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return!!this.listeners_&&(t?t in this.listeners_:Object.keys(this.listeners_).length>0)}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const n=i.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=P,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}};class A extends R{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(c)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=l(this,t[r],e);return n}return l(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const n=t.length;i=new Array(n);for(let r=0;r<n;++r)i[r]=h(this,t[r],e)}else i=h(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)!function(t){if(Array.isArray(t))for(let e=0,i=t.length;e<i;++e)u(t[e]);else u(t)}(i);else if(Array.isArray(t))for(let i=0,n=t.length;i<n;++i)this.removeEventListener(t[i],e);else this.removeEventListener(t,e)}}A.prototype.on,A.prototype.once,A.prototype.un;const G=A;function O(){throw new Error("Unimplemented abstract method.")}let F=0;function L(t){return t.ol_uid||(t.ol_uid=String(++F))}class j extends k{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}const N=class extends G{constructor(t){super(),this.on,this.once,this.un,L(this),this.values_=null,void 0!==t&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new j(i,t,e)),i=s,this.hasListener(i)&&this.dispatchEvent(new j(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const n=this.values_||(this.values_={});if(i)n[t]=e;else{const i=n[t];n[t]=e,i!==e&&this.notify(t,i)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],a(this.values_)&&(this.values_=null),e||this.notify(t,i)}}},D="length";class z extends k{constructor(t,e,i){super(t),this.element=e,this.index=i}}const q=class extends N{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t??[],this.unique_)for(let t=1,e=this.array_.length;t<e;++t)this.assertUnique_(this.array_[t],t);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,i=t.length;e<i;++e)this.push(t[e]);return this}forEach(t){const e=this.array_;for(let i=0,n=e.length;i<n;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(D)}insertAt(t,e){if(t<0||t>this.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new z(n,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,n=e.length;i<n;++i)if(e[i]===t)return this.removeAt(i)}removeAt(t){if(t<0||t>=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new z(r,e,t)),e}setAt(t,e){if(t>=this.getLength())return void this.insertAt(t,e);if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const i=this.array_[t];this.array_[t]=e,this.dispatchEvent(new z(r,i,t)),this.dispatchEvent(new z(n,e,t))}updateLength_(){this.set(D,this.array_.length)}assertUnique_(t,e){const i=this.array_;for(let n=0,r=i.length;n<r;++n)if(i[n]===t&&n!==e)throw new Error("Duplicate item added to a unique collection")}},$=class extends k{constructor(t,e,i){super(t),this.map=e,this.frameState=void 0!==i?i:null}},B=class extends ${constructor(t,e,i,n,r,s){super(t,e,r),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=void 0!==n&&n,this.activePointers=s}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(t){this.pixel_=t}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(t){this.coordinate_=t}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}},U={SINGLECLICK:"singleclick",CLICK:f,DBLCLICK:"dblclick",POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},W="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"",X=(W.includes("safari")&&!W.includes("chrom")&&(W.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(W)),W.includes("webkit")&&!W.includes("edge")),V=W.includes("macintosh"),K="undefined"!=typeof devicePixelRatio?devicePixelRatio:1,Z="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,Y="undefined"!=typeof Image&&Image.prototype.decode,H=function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch{}return t}(),J="pointerdown",Q=class extends R{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=void 0===e?1:e,this.down_=null;const i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=l(i,J,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=l(i,"pointermove",this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(m,this.boundHandleTouchMove_,!!H&&{passive:!1})}emulateClick_(t){let e=new B(U.CLICK,this.map_,t);this.dispatchEvent(e),void 0!==this.clickTimeoutId_?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new B(U.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const e=new B(U.SINGLECLICK,this.map_,t);this.dispatchEvent(e)},250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==U.POINTERUP||e.type==U.POINTERCANCEL){delete this.trackedTouches_[i];for(const t in this.trackedTouches_)if(this.trackedTouches_[t].target!==e.target){delete this.trackedTouches_[t];break}}else e.type!=U.POINTERDOWN&&e.type!=U.POINTERMOVE||(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new B(U.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),0===this.activePointers_.length&&(this.dragListenerKeys_.forEach(u),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return 0===t.button}handlePointerDown_(t){this.emulateClicks_=0===this.activePointers_.length,this.updateActivePointers_(t);const e=new B(U.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),0===this.dragListenerKeys_.length){const t=this.map_.getOwnerDocument();this.dragListenerKeys_.push(l(t,U.POINTERMOVE,this.handlePointerMove_,this),l(t,U.POINTERUP,this.handlePointerUp_,this),l(this.element_,U.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==t&&this.dragListenerKeys_.push(l(this.element_.getRootNode(),U.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new B(U.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!(!this.down_||!this.isMoving_(t));this.dispatchEvent(new B(U.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;e&&!e.defaultPrevented||"boolean"==typeof t.cancelable&&!0!==t.cancelable||t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(u(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(m,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(u(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(u),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},tt="postrender",et="loadstart",it="loadend",nt="layergroup",rt="size",st="target",ot="view";function at(t,e){if(!t)throw new Error(e)}const lt=1/0,ht=class{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,o(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const n=this.keyFunction_(i);return delete this.queuedElements_[n],i}enqueue(t){at(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=lt&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(t){return 2*t+1}getRightChildIndex_(t){return 2*t+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return 0===this.elements_.length}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,n=e.length,r=e[t],s=i[t],o=t;for(;t<n>>1;){const r=this.getLeftChildIndex_(t),s=this.getRightChildIndex_(t),o=s<n&&i[s]<i[r]?s:r;e[t]=e[o],i[t]=i[o],t=o}e[t]=r,i[t]=s,this.siftDown_(o,t)}siftDown_(t,e){const i=this.elements_,n=this.priorities_,r=i[e],s=n[e];for(;e>t;){const t=this.getParentIndex_(e);if(!(n[t]>s))break;i[e]=i[t],n[e]=n[t],e=t}i[e]=r,n[e]=s}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let n=0;const r=e.length;let s,o,a;for(o=0;o<r;++o)s=e[o],a=t(s),a==lt?delete this.queuedElements_[this.keyFunction_(s)]:(i[n]=a,e[n++]=s);e.length=n,i.length=n,this.heapify_()}},ut=class extends ht{constructor(t,e){super(e=>t.apply(null,e),t=>t[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);return e&&t[0].addEventListener(c,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(2===i||3===i||4===i){3!==i&&e.removeEventListener(c,this.boundHandleTileChange_);const t=e.getKey();t in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[t],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i=0;for(;this.tilesLoading_<t&&i<e&&this.getCount()>0;){const t=this.dequeue()[0],e=t.getKey();0!==t.getState()||e in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[e]=!0,++this.tilesLoading_,++i,t.load())}}},ct={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function dt(t,e,i){return Math.min(Math.max(t,e),i)}function ft(t,e,i,n,r,s){const o=r-i,a=s-n;if(0!==o||0!==a){const l=((t-i)*o+(e-n)*a)/(o*o+a*a);l>1?(i=r,n=s):l>0&&(i+=o*l,n+=a*l)}return pt(t,e,i,n)}function pt(t,e,i,n){const r=i-t,s=n-e;return r*r+s*s}function gt(t){return 180*t/Math.PI}function mt(t){return t*Math.PI/180}function yt(t,e){const i=t%e;return i*e<0?i+e:i}function _t(t,e,i){return t+i*(e-t)}function vt(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function xt(t,e){return Math.floor(vt(t,e))}function wt(t,e){return Math.ceil(vt(t,e))}function bt(t,e,i){if(t>=e&&t<i)return t;const n=i-e;return((t-e)%n+n)%n+e}function St(t,e,i){return function(n,r,s,o,a){if(!n)return;if(!r&&!e)return n;const l=e?0:s[0]*r,h=e?0:s[1]*r,u=a?a[0]:0,c=a?a[1]:0;let d=t[0]+l/2+u,f=t[2]-l/2+u,p=t[1]+h/2+c,g=t[3]-h/2+c;d>f&&(d=(f+d)/2,f=d),p>g&&(p=(g+p)/2,g=p);let m=dt(n[0],d,f),y=dt(n[1],p,g);if(o&&i&&r){const t=30*r;m+=-t*Math.log(1+Math.max(0,d-n[0])/t)+t*Math.log(1+Math.max(0,n[0]-f)/t),y+=-t*Math.log(1+Math.max(0,p-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-g)/t)}return[m,y]}}function Mt(t){return t}function Et(t){const e=[1/0,1/0,-1/0,-1/0];for(let i=0,n=t.length;i<n;++i)Dt(e,t[i]);return e}function Ct(t,e,i){return i?(i[0]=t[0]-e,i[1]=t[1]-e,i[2]=t[2]+e,i[3]=t[3]+e,i):[t[0]-e,t[1]-e,t[2]+e,t[3]+e]}function Pt(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t.slice()}function It(t,e,i){let n,r;return n=e<t[0]?t[0]-e:t[2]<e?e-t[2]:0,r=i<t[1]?t[1]-i:t[3]<i?i-t[3]:0,n*n+r*r}function Tt(t,e){return Rt(t,e[0],e[1])}function kt(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]}function Rt(t,e,i){return t[0]<=e&&e<=t[2]&&t[1]<=i&&i<=t[3]}function At(t,e){const i=t[0],n=t[1],r=t[2],s=t[3],o=e[0],a=e[1];let l=0;return o<i?l|=16:o>r&&(l|=4),a<n?l|=8:a>s&&(l|=2),0===l&&(l=1),l}function Gt(t,e,i,n,r){return r?(r[0]=t,r[1]=e,r[2]=i,r[3]=n,r):[t,e,i,n]}function Ot(t){return Gt(1/0,1/0,-1/0,-1/0,t)}function Ft(t,e){const i=t[0],n=t[1];return Gt(i,n,i,n,e)}function Lt(t,e,i,n,r){return zt(Ot(r),t,e,i,n)}function jt(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function Nt(t,e){return e[0]<t[0]&&(t[0]=e[0]),e[2]>t[2]&&(t[2]=e[2]),e[1]<t[1]&&(t[1]=e[1]),e[3]>t[3]&&(t[3]=e[3]),t}function Dt(t,e){e[0]<t[0]&&(t[0]=e[0]),e[0]>t[2]&&(t[2]=e[0]),e[1]<t[1]&&(t[1]=e[1]),e[1]>t[3]&&(t[3]=e[1])}function zt(t,e,i,n,r){for(;i<n;i+=r)qt(t,e[i],e[i+1]);return t}function qt(t,e,i){t[0]=Math.min(t[0],e),t[1]=Math.min(t[1],i),t[2]=Math.max(t[2],e),t[3]=Math.max(t[3],i)}function $t(t,e){let i;return i=e(Ut(t)),i||(i=e(Wt(t)),i||(i=e(Qt(t)),i||(i=e(Jt(t)),i||!1)))}function Bt(t){let e=0;return ie(t)||(e=te(t)*Yt(t)),e}function Ut(t){return[t[0],t[1]]}function Wt(t){return[t[2],t[1]]}function Xt(t){return[(t[0]+t[2])/2,(t[1]+t[3])/2]}function Vt(t,e){let i;if("bottom-left"===e)i=Ut(t);else if("bottom-right"===e)i=Wt(t);else if("top-left"===e)i=Jt(t);else{if("top-right"!==e)throw new Error("Invalid corner");i=Qt(t)}return i}function Kt(t,e,i,n,r){const[s,o,a,l,h,u,c,d]=Zt(t,e,i,n);return Gt(Math.min(s,a,h,c),Math.min(o,l,u,d),Math.max(s,a,h,c),Math.max(o,l,u,d),r)}function Zt(t,e,i,n){const r=e*n[0]/2,s=e*n[1]/2,o=Math.cos(i),a=Math.sin(i),l=r*o,h=r*a,u=s*o,c=s*a,d=t[0],f=t[1];return[d-l+c,f-h-u,d-l-c,f-h+u,d+l-c,f+h+u,d+l+c,f+h-u,d-l+c,f-h-u]}function Yt(t){return t[3]-t[1]}function Ht(t,e,i){const n=i||[1/0,1/0,-1/0,-1/0];return ee(t,e)?(t[0]>e[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]<e[2]?n[2]=t[2]:n[2]=e[2],t[3]<e[3]?n[3]=t[3]:n[3]=e[3]):Ot(n),n}function Jt(t){return[t[0],t[3]]}function Qt(t){return[t[2],t[3]]}function te(t){return t[2]-t[0]}function ee(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function ie(t){return t[2]<t[0]||t[3]<t[1]}function ne(t,e){const i=e.getExtent(),n=Xt(t);if(e.canWrapX()&&(n[0]<i[0]||n[0]>=i[2])){const e=te(i),r=Math.floor((n[0]-i[0])/e)*e;t[0]-=r,t[2]-=r}return t}function re(t,e,i){if(e.canWrapX()){const n=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[n[0],t[1],n[2],t[3]]];ne(t,e);const r=te(n);if(te(t)>r&&!i)return[[n[0],t[1],n[2],t[3]]];if(t[0]<n[0])return[[t[0]+r,t[1],n[2],t[3]],[n[0],t[1],t[2],t[3]]];if(t[2]>n[2])return[[t[0],t[1],n[2],t[3]],[n[0],t[1],t[2]-r,t[3]]]}return[t]}function se(t,e){let i=!0;for(let n=t.length-1;n>=0;--n)if(t[n]!=e[n]){i=!1;break}return i}function oe(t,e){const i=Math.cos(e),n=Math.sin(e),r=t[0]*i-t[1]*n,s=t[1]*i+t[0]*n;return t[0]=r,t[1]=s,t}function ae(t,e){if(e.canWrapX()){const i=te(e.getExtent()),n=le(t,e,i);n&&(t[0]-=n*i)}return t}function le(t,e,i){const n=e.getExtent();let r=0;return e.canWrapX()&&(t[0]<n[0]||t[0]>n[2])&&(i=i||te(n),r=Math.floor((t[0]-n[0])/i)),r}function he(t){return Math.pow(t,3)}function ue(t){return 1-he(1-t)}function ce(t){return 3*t*t-2*t*t*t}function de(t){return t}const fe=2,pe=3;let ge=1;function me(...t){ge>fe||console.warn(...t)}function ye(...t){ge>pe||console.error(...t)}const _e={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937},ve=class{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||_e[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}},xe=6378137,we=Math.PI*xe,be=[-we,-we,we,we],Se=[-180,-85,180,85],Me=xe*Math.log(Math.tan(Math.PI/2));class Ee extends ve{constructor(t){super({code:t,units:"m",extent:be,global:!0,worldExtent:Se,getPointResolution:function(t,e){return t/Math.cosh(e[1]/xe)}})}}const Ce=[new Ee("EPSG:3857"),new Ee("EPSG:102100"),new Ee("EPSG:102113"),new Ee("EPSG:900913"),new Ee("http://www.opengis.net/def/crs/EPSG/0/3857"),new Ee("http://www.opengis.net/gml/srs/epsg.xml#3857")];const Pe=[-180,-90,180,90],Ie=6378137*Math.PI/180;class Te extends ve{constructor(t,e){super({code:t,units:"degrees",extent:Pe,axisOrientation:e,global:!0,metersPerUnit:Ie,worldExtent:Pe})}}const ke=[new Te("CRS:84"),new Te("EPSG:4326","neu"),new Te("urn:ogc:def:crs:OGC:1.3:CRS84"),new Te("urn:ogc:def:crs:OGC:2:84"),new Te("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Te("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Te("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Re={};function Ae(t){return Re[t]||Re[t.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}let Ge={};function Oe(t,e,i){const n=t.getCode(),r=e.getCode();n in Ge||(Ge[n]={}),Ge[n][r]=i}function Fe(t,e){return t in Ge&&e in Ge[t]?Ge[t][e]:null}const Le=.9996,je=.00669438,Ne=je*je,De=Ne*je,ze=je/(1-je),qe=Math.sqrt(1-je),$e=(1-qe)/(1+qe),Be=$e*$e,Ue=Be*$e,We=Ue*$e,Xe=We*$e,Ve=.9983242984503243,Ke=15*Ne/256+45*De/1024,Ze=35*De/3072,Ye=1.5*$e-27/32*Ue+269/512*Xe,He=21/16*Be-55/32*We,Je=151/96*Ue-417/128*Xe,Qe=1097/512*We,ti=6378137;function ei(t,e,i){const n=t-5e5,r=(i.north?e:e-1e7)/Le/(ti*Ve),s=r+Ye*Math.sin(2*r)+He*Math.sin(4*r)+Je*Math.sin(6*r)+Qe*Math.sin(8*r),o=Math.sin(s),a=o*o,l=Math.cos(s),h=o/l,u=h*h,c=u*u,d=1-je*a,f=Math.sqrt(1-je*a),p=ze*l**2,g=p*p,m=n/(ti/f*Le),y=m*m,_=y*m,v=_*m,x=v*m,w=s-h/((1-je)/d)*(y/2-v/24*(5+3*u+10*p-4*g-9*ze))+x*m/720*(61+90*u+298*p+45*c-252*ze-3*g);let b=(m-_/6*(1+2*u+p)+x/120*(5-2*p+28*u-3*g+8*ze+24*c))/l;return b=bt(b+mt(ni(i.number)),-Math.PI,Math.PI),[gt(b),gt(w)]}function ii(t,e,i){t=bt(t,-180,180),e<-80?e=-80:e>84&&(e=84);const n=mt(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,h=mt(t),u=mt(ni(i.number)),c=ti/Math.sqrt(1-je*r**2),d=ze*s**2,f=s*bt(h-u,-Math.PI,Math.PI),p=f*f,g=p*f,m=g*f,y=m*f,_=y*f,v=ti*(Ve*n-.002514607064228144*Math.sin(2*n)+Ke*Math.sin(4*n)-Ze*Math.sin(6*n)),x=Le*c*(f+g/6*(1-a+d)+y/120*(5-18*a+l+72*d-58*ze))+5e5;let w=Le*(v+c*o*(p/2+m/24*(5-a+9*d+4*d**2)+_/720*(61-58*a+l+600*d-330*ze)));return i.north||(w+=1e7),[x,w]}function ni(t){return 6*(t-1)-180+3}const ri=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function si(t){let e=0;for(const i of ri){const n=t.match(i);if(n){e=parseInt(n[1]);break}}if(!e)return null;let i=0,n=!1;return e>32700&&e<32761?i=e-32700:e>32600&&e<32661&&(n=!0,i=e-32600),i?{number:i,north:n}:null}function oi(t,e){return function(i,n,r,s){const o=i.length;r=r>1?r:2,s=s??r,n||(n=r>2?i.slice():new Array(o));for(let r=0;r<o;r+=s){const s=i[r],o=i[r+1],a=t(s,o,e);n[r]=a[0],n[r+1]=a[1]}return n}}function ai(t,e,i){i=i||6371008.8;const n=mt(t[1]),r=mt(e[1]),s=(r-n)/2,o=mt(e[0]-t[0])/2,a=Math.sin(s)*Math.sin(s)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(r);return 2*i*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}const li=[function(t){const e=si(t.getCode());return e?{forward:oi(ii,e),inverse:oi(ei,e)}:null}],hi=[function(t){return si(t)?new ve({code:t,units:"m"}):null}];let ui=!0;function ci(t,e){if(void 0!==e)for(let i=0,n=t.length;i<n;++i)e[i]=t[i];else e=t.slice();return e}function di(t){!function(t,e){Re[t]=e}(t.getCode(),t),Oe(t,t,ci)}function fi(t){if("string"!=typeof t)return t;const e=Ae(t);if(e)return e;for(const e of hi){const i=e(t);if(i)return i}return null}function pi(t,e,i,n){let r;const s=(t=fi(t)).getPointResolutionFunc();if(s){if(r=s(e,i),n&&n!==t.getUnits()){const e=t.getMetersPerUnit();e&&(r=r*e/_e[n])}}else{const s=t.getUnits();if("degrees"==s&&!n||"degrees"==n)r=e;else{const o=xi(t,fi("EPSG:4326"));if(o||"degrees"===s){let t=[i[0]-e/2,i[1],i[0]+e/2,i[1],i[0],i[1]-e/2,i[0],i[1]+e/2];t=o(t,t,2),r=(ai(t.slice(0,2),t.slice(2,4))+ai(t.slice(4,6),t.slice(6,8)))/2}else r=e*t.getMetersPerUnit();const a=n?_e[n]:t.getMetersPerUnit();void 0!==a&&(r/=a)}}return r}function gi(t){!function(t){t.forEach(di)}(t),t.forEach(function(e){t.forEach(function(t){e!==t&&Oe(e,t,ci)})})}function mi(t,e){return t?"string"==typeof t?fi(t):t:fi(e)}function yi(t){return function(e,i,n,r){const s=e.length;n=void 0!==n?n:2,r=r??n,i=void 0!==i?i:new Array(s);for(let o=0;o<s;o+=r){const s=t(e.slice(o,o+n)),a=s.length;for(let t=0,n=r;t<n;++t)i[o+t]=t>=a?e[o+t]:s[t]}return i}}function _i(t,e,i,n){const r=fi(t),s=fi(e);Oe(r,s,yi(i)),Oe(s,r,yi(n))}function vi(t,e){if(t===e)return!0;const i=t.getUnits()===e.getUnits();return(t.getCode()===e.getCode()||xi(t,e)===ci)&&i}function xi(t,e){const i=t.getCode(),n=e.getCode();let r=Fe(i,n);if(r)return r;let s=null,o=null;for(const i of li)s||(s=i(t)),o||(o=i(e));if(!s&&!o)return null;const a="EPSG:4326";if(o)if(s)r=wi(s.inverse,o.forward);else{const t=Fe(i,a);t&&(r=wi(t,o.forward))}else{const t=Fe(a,n);t&&(r=wi(s.inverse,t))}return r&&(di(t),di(e),Oe(t,e,r)),r}function wi(t,e){return function(i,n,r,s){return n=t(i,n,r,s),e(n,n,r,s)}}function bi(t,e){return xi(fi(t),fi(e))}function Si(t,e,i){const n=bi(e,i);if(!n){const t=fi(e).getCode(),n=fi(i).getCode();throw new Error(`No transform available between ${t} and ${n}`)}return n(t,void 0,t.length)}function Mi(t,e,i,n){return function(t,e,i,n){if(ie(t))return Ot(i);let r=[];if(n>1){const e=t[2]-t[0],i=t[3]-t[1];for(let s=0;s<n;++s)r.push(t[0]+e*s/n,t[1],t[2],t[1]+i*s/n,t[2]-e*s/n,t[3],t[0],t[3]-i*s/n)}else r=[t[0],t[1],t[2],t[1],t[2],t[3],t[0],t[3]];e(r,r,2);const s=[],o=[];for(let t=0,e=r.length;t<e;t+=2)s.push(r[t]),o.push(r[t+1]);return function(t,e,i){return Gt(Math.min.apply(null,t),Math.min.apply(null,e),Math.max.apply(null,t),Math.max.apply(null,e),i)}(s,o,i)}(t,bi(e,i),void 0,n)}let Ei=null;function Ci(){return Ei}function Pi(t,e){return t}function Ii(t,e){return ui&&!se(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(ui=!1,me("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t}function Ti(t,e){return t}function ki(t,e){return t}function Ri(t,e){return t}function Ai(t,e,i){return function(n){let r,s;if(t.canWrapX()){const e=t.getExtent(),o=te(e);s=le(n=n.slice(0),t,o),s&&(n[0]=n[0]-s*o),n[0]=dt(n[0],e[0],e[2]),n[1]=dt(n[1],e[1],e[3]),r=i(n)}else r=i(n);return s&&e.canWrapX()&&(r[0]+=s*te(e.getExtent())),r}}var Gi,Oi,Fi;gi(Ce),gi(ke),Gi=Ce,Oi=function(t,e,i,n){const r=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(r));for(let i=0;i<r;i+=n){e[i]=we*t[i]/180;let n=xe*Math.log(Math.tan(Math.PI*(+t[i+1]+90)/360));n>Me?n=Me:n<-Me&&(n=-Me),e[i+1]=n}return e},Fi=function(t,e,i,n){const r=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(r));for(let i=0;i<r;i+=n)e[i]=180*t[i]/we,e[i+1]=360*Math.atan(Math.exp(t[i+1]/xe))/Math.PI-90;return e},ke.forEach(function(t){Gi.forEach(function(e){Oe(t,e,Oi),Oe(e,t,Fi)})});const Li=new Array(6);function ji(t){return Di(t,1,0,0,1,0,0)}function Ni(t,e){const i=t[0],n=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=e[0],h=e[1],u=e[2],c=e[3],d=e[4],f=e[5];return t[0]=i*l+r*h,t[1]=n*l+s*h,t[2]=i*u+r*c,t[3]=n*u+s*c,t[4]=i*d+r*f+o,t[5]=n*d+s*f+a,t}function Di(t,e,i,n,r,s,o){return t[0]=e,t[1]=i,t[2]=n,t[3]=r,t[4]=s,t[5]=o,t}function zi(t,e){const i=e[0],n=e[1];return e[0]=t[0]*i+t[2]*n+t[4],e[1]=t[1]*i+t[3]*n+t[5],e}function qi(t,e,i){return Ni(t,Di(Li,e,0,0,i,0,0))}function $i(t,e,i,n,r,s,o,a){const l=Math.sin(s),h=Math.cos(s);return t[0]=n*h,t[1]=r*l,t[2]=-n*l,t[3]=r*h,t[4]=o*n*h-a*n*l+e,t[5]=o*r*l+a*r*h+i,t}function Bi(t,e){const i=(n=e)[0]*n[3]-n[1]*n[2];var n;at(0!==i,"Transformation matrix cannot be inverted");const r=e[0],s=e[1],o=e[2],a=e[3],l=e[4],h=e[5];return t[0]=a/i,t[1]=-s/i,t[2]=-o/i,t[3]=r/i,t[4]=(o*h-a*l)/i,t[5]=-(r*h-s*l)/i,t}const Ui=[1e5,1e5,1e5,1e5,2,2];function Wi(t){return t.substring(7,t.length-1).split(",").map(parseFloat)}function Xi(t,e,i,n,r,s,o){s=s||[],o=o||2;let a=0;for(let l=e;l<i;l+=n){const e=t[l],i=t[l+1];s[a++]=r[0]*e+r[2]*i+r[4],s[a++]=r[1]*e+r[3]*i+r[5];for(let e=2;e<o;e++)s[a++]=t[l+e]}return s&&s.length!=a&&(s.length=a),s}function Vi(t,e,i,n,r,s,o){o=o||[];const a=Math.cos(r),l=Math.sin(r),h=s[0],u=s[1];let c=0;for(let r=e;r<i;r+=n){const e=t[r]-h,i=t[r+1]-u;o[c++]=h+e*a-i*l,o[c++]=u+e*l+i*a;for(let e=r+2;e<r+n;++e)o[c++]=t[e]}return o&&o.length!=c&&(o.length=c),o}const Ki=[1,0,0,1,0,0],Zi=[NaN,NaN],Yi=class extends N{constructor(){super(),this.extent_=[1/0,1/0,-1/0,-1/0],this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=I((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const n=this.clone();return n.applyTransform(i),n.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return O()}closestPointXY(t,e,i,n){return O()}containsXY(t,e){return 0===this.closestPointXY(t,e,Zi,Number.MIN_VALUE)}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return O()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&Ot(t),this.extentRevision_=this.getRevision()}return function(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t}(this.extent_,t)}rotate(t,e){O()}scale(t,e,i){O()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return O()}getType(){return O()}applyTransform(t){O()}intersectsExtent(t){return O()}translate(t,e){O()}transform(t,e){const i=fi(t),n="tile-pixels"==i.getUnits()?function(t,n,r){const s=i.getExtent(),o=i.getWorldExtent(),a=Yt(o)/Yt(s);$i(Ki,o[0],o[3],a,-a,0,0,0);const l=Xi(t,0,t.length,r,Ki,n),h=bi(i,e);return h?h(l,l,r):l}:bi(i,e);return this.applyTransform(n),this}};function Hi(t){let e;return 2==t?e="XY":3==t?e="XYZ":4==t&&(e="XYZM"),e}function Ji(t){let e;return"XY"==t?e=2:"XYZ"==t||"XYM"==t?e=3:"XYZM"==t&&(e=4),e}const Qi=class extends Yi{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return Lt(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return O()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=Ji(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){O()}setLayout(t,e,i){let n;if(t)n=Ji(t);else{for(let t=0;t<i;++t){if(0===e.length)return this.layout="XY",void(this.stride=2);e=e[0]}n=e.length,t=Hi(n)}this.layout=t,this.stride=n}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();Vi(i,0,i.length,n,t,e,i),this.changed()}}scale(t,e,i){void 0===e&&(e=t),i||(i=Xt(this.getExtent()));const n=this.getFlatCoordinates();if(n){const r=this.getStride();!function(t,e,i,n,r,s,o,a){a=a||[];const l=o[0],h=o[1];let u=0;for(let e=0;e<i;e+=n){const i=t[e]-l,o=t[e+1]-h;a[u++]=l+r*i,a[u++]=h+s*o;for(let i=e+2;i<e+n;++i)a[u++]=t[i]}a&&a.length!=u&&(a.length=u)}(n,0,n.length,r,t,e,i,n),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();!function(t,e,i,n,r,s,o){o=o||[];let a=0;for(let e=0;e<i;e+=n){o[a++]=t[e]+r,o[a++]=t[e+1]+s;for(let i=e+2;i<e+n;++i)o[a++]=t[i]}o&&o.length!=a&&(o.length=a)}(i,0,i.length,n,t,e,i),this.changed()}}};function tn(t,e,i,n){let r=0;const s=t[i-n],o=t[i-n+1];let a=0,l=0;for(;e<i;e+=n){const i=t[e]-s,n=t[e+1]-o;r+=l*i-a*n,a=i,l=n}return r/2}function en(t,e,i,n){let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s];r+=tn(t,e,o,n),e=o}return r}function nn(t,e,i,n,r,s,o){const a=t[e],l=t[e+1],h=t[i]-a,u=t[i+1]-l;let c;if(0===h&&0===u)c=e;else{const d=((r-a)*h+(s-l)*u)/(h*h+u*u);if(d>1)c=i;else{if(d>0){for(let r=0;r<n;++r)o[r]=_t(t[e+r],t[i+r],d);return void(o.length=n)}c=e}}for(let e=0;e<n;++e)o[e]=t[c+e];o.length=n}function rn(t,e,i,n,r){let s=t[e],o=t[e+1];for(e+=n;e<i;e+=n){const i=t[e],n=t[e+1],a=pt(s,o,i,n);a>r&&(r=a),s=i,o=n}return r}function sn(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];r=rn(t,e,o,n,r),e=o}return r}function on(t,e,i,n,r,s,o,a,l,h,u){if(e==i)return h;let c,d;if(0===r){if(d=pt(o,a,t[e],t[e+1]),d<h){for(c=0;c<n;++c)l[c]=t[e+c];return l.length=n,d}return h}u=u||[NaN,NaN];let f=e+n;for(;f<i;)if(nn(t,f-n,f,n,o,a,u),d=pt(o,a,u[0],u[1]),d<h){for(h=d,c=0;c<n;++c)l[c]=u[c];l.length=n,f+=n}else f+=n*Math.max((Math.sqrt(d)-Math.sqrt(h))/r|0,1);if(s&&(nn(t,i-n,e,n,o,a,u),d=pt(o,a,u[0],u[1]),d<h)){for(h=d,c=0;c<n;++c)l[c]=u[c];l.length=n}return h}function an(t,e,i,n,r,s,o,a,l,h,u){u=u||[NaN,NaN];for(let c=0,d=i.length;c<d;++c){const d=i[c];h=on(t,e,d,n,r,s,o,a,l,h,u),e=d}return h}function ln(t,e,i,n){for(let r=0,s=i.length;r<s;++r){const s=i[r];for(let i=0;i<n;++i)t[e++]=s[i]}return e}function hn(t,e,i,n,r){r=r||[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=ln(t,e,i[o],n);r[s++]=a,e=a}return r.length=s,r}function un(t,e,i,n,r){r=r||[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=hn(t,e,i[o],n,r[s]);0===a.length&&(a[0]=e),r[s++]=a,e=a[a.length-1]}return r.length=s,r}function cn(t,e,i,n,r){r=void 0!==r?r:[];let s=0;for(let o=e;o<i;o+=n)r[s++]=t.slice(o,o+n);return r.length=s,r}function dn(t,e,i,n,r){r=void 0!==r?r:[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];r[s++]=cn(t,e,a,n,r[s]),e=a}return r.length=s,r}function fn(t,e,i,n,r){r=void 0!==r?r:[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];r[s++]=1===a.length&&a[0]===e?[]:dn(t,e,a,n,r[s]),e=a[a.length-1]}return r.length=s,r}function pn(t,e,i,n,r,s,o){const a=(i-e)/n;if(a<3){for(;e<i;e+=n)s[o++]=t[e],s[o++]=t[e+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const h=[e,i-n];let u=0;for(;h.length>0;){const i=h.pop(),s=h.pop();let o=0;const a=t[s],c=t[s+1],d=t[i],f=t[i+1];for(let e=s+n;e<i;e+=n){const i=ft(t[e],t[e+1],a,c,d,f);i>o&&(u=e,o=i)}o>r&&(l[(u-e)/n]=1,s+n<u&&h.push(s,u),u+n<i&&h.push(u,i))}for(let i=0;i<a;++i)l[i]&&(s[o++]=t[e+i*n],s[o++]=t[e+i*n+1]);return o}function gn(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l];o=pn(t,e,h,n,r,s,o),a.push(o),e=h}return o}function mn(t,e){return e*Math.round(t/e)}function yn(t,e,i,n,r,s,o){if(e==i)return o;let a,l,h=mn(t[e],r),u=mn(t[e+1],r);e+=n,s[o++]=h,s[o++]=u;do{if(a=mn(t[e],r),l=mn(t[e+1],r),(e+=n)==i)return s[o++]=a,s[o++]=l,o}while(a==h&&l==u);for(;e<i;){const i=mn(t[e],r),c=mn(t[e+1],r);if(e+=n,i==a&&c==l)continue;const d=a-h,f=l-u,p=i-h,g=c-u;d*g==f*p&&(d<0&&p<d||d==p||d>0&&p>d)&&(f<0&&g<f||f==g||f>0&&g>f)?(a=i,l=c):(s[o++]=a,s[o++]=l,h=a,u=l,a=i,l=c)}return s[o++]=a,s[o++]=l,o}function _n(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l];o=yn(t,e,h,n,r,s,o),a.push(o),e=h}return o}class vn extends Qi{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}clone(){return new vn(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,n){return n<It(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(rn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),on(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,n))}getArea(){return tn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return cn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=pn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new vn(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=ln(this.flatCoordinates,0,t,this.stride),this.changed()}}const xn=vn;class wn extends Qi{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new wn(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const r=this.flatCoordinates,s=pt(t,e,r[0],r[1]);if(s<n){const t=this.stride;for(let e=0;e<t;++e)i[e]=r[e];return i.length=t,s}return n}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return Ft(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return Rt(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=function(t,e,i){for(let n=0,r=i.length;n<r;++n)t[e++]=i[n];return e}(this.flatCoordinates,0,t,this.stride),this.changed()}}const bn=wn;function Sn(t,e,i,n,r){return!$t(r,function(r){return!Mn(t,e,i,n,r[0],r[1])})}function Mn(t,e,i,n,r,s){let o=0,a=t[i-n],l=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];l<=s?n>s&&(i-a)*(s-l)-(r-a)*(n-l)>0&&o++:n<=s&&(i-a)*(s-l)-(r-a)*(n-l)<0&&o--,a=i,l=n}return 0!==o}function En(t,e,i,n,r,s){if(0===i.length)return!1;if(!Mn(t,e,i[0],n,r,s))return!1;for(let e=1,o=i.length;e<o;++e)if(Mn(t,i[e-1],i[e],n,r,s))return!1;return!0}function Cn(t,e,i,n,r,s,o){let a,l,h,u,c,d,f;const p=r[s+1],g=[];for(let r=0,s=i.length;r<s;++r){const s=i[r];for(u=t[s-n],d=t[s-n+1],a=e;a<s;a+=n)c=t[a],f=t[a+1],(p<=d&&f<=p||d<=p&&p<=f)&&(h=(p-d)/(f-d)*(c-u)+u,g.push(h)),u=c,d=f}let m=NaN,y=-1/0;for(g.sort(v),u=g[0],a=1,l=g.length;a<l;++a){c=g[a];const r=Math.abs(c-u);r>y&&(h=(u+c)/2,En(t,e,i,n,h,p)&&(m=h,y=r)),u=c}return isNaN(m)&&(m=r[s]),o?(o.push(m,p,y),o):[m,p,y]}function Pn(t,e,i,n,r){let s=[];for(let o=0,a=i.length;o<a;++o){const a=i[o];s=Cn(t,e,a,n,r,2*o,s),e=a[a.length-1]}return s}function In(t,e,i,n,r){let s;for(e+=n;e<i;e+=n)if(s=r(t.slice(e-n,e),t.slice(e,e+n)),s)return s;return!1}function Tn(t,e,i,n,r,s){return s=s??zt([1/0,1/0,-1/0,-1/0],t,e,i,n),!!ee(r,s)&&(s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]||In(t,e,i,n,function(t,e){return function(t,e,i){let n=!1;const r=At(t,e),s=At(t,i);if(1===r||1===s)n=!0;else{const o=t[0],a=t[1],l=t[2],h=t[3],u=e[0],c=e[1],d=i[0],f=i[1],p=(f-c)/(d-u);let g,m;2&s&&!(2&r)&&(g=d-(f-h)/p,n=g>=o&&g<=l),n||!(4&s)||4&r||(m=f-(d-l)*p,n=m>=a&&m<=h),n||!(8&s)||8&r||(g=d-(f-a)/p,n=g>=o&&g<=l),n||!(16&s)||16&r||(m=f-(d-o)*p,n=m>=a&&m<=h)}return n}(r,t,e)}))}function kn(t,e,i,n,r){return!!(Tn(t,e,i,n,r)||Mn(t,e,i,n,r[0],r[1])||Mn(t,e,i,n,r[0],r[3])||Mn(t,e,i,n,r[2],r[1])||Mn(t,e,i,n,r[2],r[3]))}function Rn(t,e,i,n,r){if(!kn(t,e,i[0],n,r))return!1;if(1===i.length)return!0;for(let e=1,s=i.length;e<s;++e)if(Sn(t,i[e-1],i[e],n,r)&&!Tn(t,i[e-1],i[e],n,r))return!1;return!0}function An(t,e,i,n){for(;e<i-n;){for(let r=0;r<n;++r){const s=t[e+r];t[e+r]=t[i-n+r],t[i-n+r]=s}e+=n,i-=n}}function Gn(t,e,i,n){let r=0,s=t[i-n],o=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];r+=(i-s)*(n+o),s=i,o=n}return 0===r?void 0:r>0}function On(t,e,i,n,r){r=void 0!==r&&r;for(let s=0,o=i.length;s<o;++s){const o=i[s],a=Gn(t,e,o,n);if(0===s){if(r&&a||!r&&!a)return!1}else if(r&&!a||!r&&a)return!1;e=o}return!0}function Fn(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];if(!On(t,e,o,n,r))return!1;o.length&&(e=o[o.length-1])}return!0}function Ln(t,e,i,n,r){r=void 0!==r&&r;for(let s=0,o=i.length;s<o;++s){const o=i[s],a=Gn(t,e,o,n);(0===s?r&&a||!r&&!a:r&&!a||!r&&a)&&An(t,e,o,n),e=o}return e}function jn(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s)e=Ln(t,e,i[s],n,r);return e}function Nn(t,e){const i=[];let n,r=0,s=0;for(let o=0,a=e.length;o<a;++o){const a=e[o],l=Gn(t,r,a,2);if(void 0===n&&(n=l),l===n)i.push(e.slice(s,o+1));else{if(0===i.length)continue;i[i.length-1].push(e[s])}s=o+1,r=a}return i}class Dn extends Qi{constructor(t,e,i){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,void 0!==e&&i?(this.setFlatCoordinates(e,t),this.ends_=i):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?S(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Dn(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<It(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(sn(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),an(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return En(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return en(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),Ln(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,dn(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=Xt(this.getExtent());this.flatInteriorPoint_=Cn(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new bn(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new xn(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,n=[];let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s],a=new xn(e.slice(r,o),t);n.push(a),r=o}return n}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;On(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Ln(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=_n(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new Dn(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return Rn(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=hn(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}const zn=Dn;function qn(t){if(ie(t))throw new Error("Cannot create polygon from empty extent");const e=t[0],i=t[1],n=t[2],r=t[3],s=[e,i,e,r,n,r,n,i,e,i];return new Dn(s,"XY",[s.length])}function $n(t,e,i,n){const r=te(e)/i[0],s=Yt(e)/i[1];return n?Math.min(t,Math.max(r,s)):Math.min(t,Math.min(r,s))}function Bn(t,e,i){let n=Math.min(t,e);return n*=Math.log(1+50*Math.max(0,t/e-1))/50+1,i&&(n=Math.max(n,i),n/=Math.log(1+50*Math.max(0,i/t-1))/50+1),dt(n,i/2,2*e)}function Un(t,e,i,n,r){return i=void 0===i||i,function(s,o,a,l){if(void 0!==s){const o=n?$n(t,n,a,r):t;return i&&l?Bn(s,o,e):dt(s,e,o)}}}function Wn(t){if(void 0!==t)return 0}function Xn(t){if(void 0!==t)return t}function Vn(t,e){setTimeout(function(){t(e)},0)}function Kn(t){return!(t.sourceCenter&&t.targetCenter&&!se(t.sourceCenter,t.targetCenter))&&t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation}function Zn(t,e,i,n,r){const s=Math.cos(-r);let o=Math.sin(-r),a=t[0]*s-t[1]*o,l=t[1]*s+t[0]*o;return a+=(e[0]/2-i[0])*n,l+=(i[1]-e[1]/2)*n,o=-o,[a*s-l*o,l*s+a*o]}const Yn=class extends N{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=mi(t.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,t.projection&&function(t){ui=!(void 0===t||t)}(),t.center&&(t.center=Ii(t.center,this.projection_)),t.extent&&(t.extent=ki(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const t in ct)delete e[t];this.setProperties(e,!0);const i=function(t){let e,i,n;let r=void 0!==t.minZoom?t.minZoom:0,s=void 0!==t.maxZoom?t.maxZoom:28;const o=void 0!==t.zoomFactor?t.zoomFactor:2,a=void 0!==t.multiWorld&&t.multiWorld,l=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,h=void 0!==t.showFullExtent&&t.showFullExtent,u=mi(t.projection,"EPSG:3857"),c=u.getExtent();let d=t.constrainOnlyCenter,f=t.extent;if(a||f||!u.isGlobal()||(d=!1,f=c),void 0!==t.resolutions){const o=t.resolutions;i=o[r],n=void 0!==o[s]?o[s]:o[o.length-1],e=t.constrainResolution?function(t,e,i,n){return e=void 0===e||e,function(r,s,o,a){if(void 0!==r){const l=t[0],h=t[t.length-1],u=i?$n(l,i,o,n):l;if(a)return e?Bn(r,u,h):dt(r,h,u);const c=Math.min(u,r),d=Math.floor(w(t,c,s));return t[d]>u&&d<t.length-1?t[d+1]:t[d]}}}(o,l,!d&&f,h):Un(i,n,l,!d&&f,h)}else{const a=(c?Math.max(te(c),Yt(c)):360*_e.degrees/u.getMetersPerUnit())/256/Math.pow(2,0),p=a/Math.pow(2,28);i=t.maxResolution,void 0!==i?r=0:i=a/Math.pow(o,r),n=t.minResolution,void 0===n&&(n=void 0!==t.maxZoom?void 0!==t.maxResolution?i/Math.pow(o,s):a/Math.pow(o,s):p),s=r+Math.floor(Math.log(i/n)/Math.log(o)),n=i/Math.pow(o,s-r),e=t.constrainResolution?function(t,e,i,n,r,s){return n=void 0===n||n,i=void 0!==i?i:0,function(o,a,l,h){if(void 0!==o){const u=r?$n(e,r,l,s):e;if(h)return n?Bn(o,u,i):dt(o,i,u);const c=1e-9,d=Math.ceil(Math.log(e/u)/Math.log(t)-c),f=-a*(.5-c)+.5,p=Math.min(u,o),g=Math.floor(Math.log(e/p)/Math.log(t)+f),m=Math.max(d,g);return dt(e/Math.pow(t,m),i,u)}}}(o,i,n,l,!d&&f,h):Un(i,n,l,!d&&f,h)}return{constraint:e,maxResolution:i,minResolution:n,minZoom:r,zoomFactor:o}}(t);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=i.minZoom;const n=function(t){if(void 0!==t.extent){const e=void 0===t.smoothExtentConstraint||t.smoothExtentConstraint;return St(t.extent,t.constrainOnlyCenter,e)}const e=mi(t.projection,"EPSG:3857");if(!0!==t.multiWorld&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,St(t,!1,!1)}return Mt}(t),r=i.constraint,s=function(t){if(void 0===t.enableRotation||t.enableRotation){const e=t.constrainRotation;return void 0===e||!0===e?function(){const t=mt(5);return function(e,i){return i||void 0===e?e:Math.abs(e)<=t?0:e}}():!1===e?Xn:"number"==typeof e?function(t){const e=2*Math.PI/t;return function(t,i){return i?t:void 0!==t?t=Math.floor(t/e+.5)*e:void 0}}(e):Xn}return Wn}(t);this.constraints_={center:n,resolution:r,rotation:s},this.setRotation(void 0!==t.rotation?t.rotation:0),this.setCenterInternal(void 0!==t.center?t.center:null),void 0!==t.resolution?this.setResolution(t.resolution):void 0!==t.zoom&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const i=this.getCenterInternal();if(i){const n=t||[0,0,0,0];e=e||[0,0,0,0];const r=this.getResolution(),s=r/2*(n[3]-e[3]+e[1]-n[1]),o=r/2*(n[0]-e[0]+e[2]-n[2]);this.setCenterInternal([i[0]+s,i[1]-o])}}getUpdatedOptions_(t){const e=this.getProperties();return void 0!==e.resolution?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let t=0;t<e.length;++t){let i=arguments[t];i.center&&(i=Object.assign({},i),i.center=Ii(i.center,this.getProjection())),i.anchor&&(i=Object.assign({},i),i.anchor=Ii(i.anchor,this.getProjection())),e[t]=i}this.animateInternal.apply(this,e)}animateInternal(t){let e,i=arguments.length;i>1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i);let n=0;for(;n<i&&!this.isDef();++n){const t=arguments[n];t.center&&this.setCenterInternal(t.center),void 0!==t.zoom?this.setZoom(t.zoom):t.resolution&&this.setResolution(t.resolution),void 0!==t.rotation&&this.setRotation(t.rotation)}if(n===i)return void(e&&Vn(e,!0));let r=Date.now(),s=this.targetCenter_.slice(),o=this.targetResolution_,a=this.targetRotation_;const l=[];for(;n<i;++n){const t=arguments[n],i={start:r,complete:!1,anchor:t.anchor,duration:void 0!==t.duration?t.duration:1e3,easing:t.easing||ce,callback:e};if(t.center&&(i.sourceCenter=s,i.targetCenter=t.center.slice(),s=i.targetCenter),void 0!==t.zoom?(i.sourceResolution=o,i.targetResolution=this.getResolutionForZoom(t.zoom),o=i.targetResolution):t.resolution&&(i.sourceResolution=o,i.targetResolution=t.resolution,o=i.targetResolution),void 0!==t.rotation){i.sourceRotation=a;const e=yt(t.rotation-a+Math.PI,2*Math.PI)-Math.PI;i.targetRotation=a+e,a=i.targetRotation}Kn(i)?i.complete=!0:r+=i.duration,l.push(i)}this.animations_.push(l),this.setHint(0,1),this.updateAnimations_()}getAnimating(){return this.hints_[0]>0}getInteracting(){return this.hints_[1]>0}cancelAnimations(){let t;this.setHint(0,-this.hints_[0]);for(let e=0,i=this.animations_.length;e<i;++e){const i=this.animations_[e];if(i[0].callback&&Vn(i[0].callback,!1),!t)for(let e=0,n=i.length;e<n;++e){const n=i[e];if(!n.complete){t=n.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(void 0!==this.updateAnimationKey_&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let i=this.animations_.length-1;i>=0;--i){const n=this.animations_[i];let r=!0;for(let i=0,s=n.length;i<s;++i){const s=n[i];if(s.complete)continue;const o=t-s.start;let a=s.duration>0?o/s.duration:1;a>=1?(s.complete=!0,a=1):r=!1;const l=s.easing(a);if(s.sourceCenter){const t=s.sourceCenter[0],e=s.sourceCenter[1],i=s.targetCenter[0],n=s.targetCenter[1];this.nextCenter_=s.targetCenter;const r=t+l*(i-t),o=e+l*(n-e);this.targetCenter_=[r,o]}if(s.sourceResolution&&s.targetResolution){const t=1===l?s.targetResolution:s.sourceResolution+l*(s.targetResolution-s.sourceResolution);if(s.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,s.anchor)}this.nextResolution_=s.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==s.sourceRotation&&void 0!==s.targetRotation){const t=1===l?yt(s.targetRotation+Math.PI,2*Math.PI)-Math.PI:s.sourceRotation+l*(s.targetRotation-s.sourceRotation);if(s.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,s.anchor)}this.nextRotation_=s.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!s.complete)break}if(r){this.animations_[i]=null,this.setHint(0,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=n[0].callback;t&&Vn(t,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const n=this.getCenterInternal();var r,s;return void 0!==n&&(i=[n[0]-e[0],n[1]-e[1]],oe(i,t-this.getRotation()),s=e,(r=i)[0]+=+s[0],r[1]+=+s[1]),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),r=this.getResolution();return void 0!==n&&void 0!==r&&(i=[e[0]-t*(e[0]-n[0])/r,e[1]-t*(e[1]-n[1])/r]),i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?Pi(t,this.getProjection()):t}getCenterInternal(){return this.get(ct.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){return Ti(this.calculateExtentInternal(t),this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();at(e,"The view center is not defined");const i=this.getResolution();at(void 0!==i,"The view resolution is not defined");const n=this.getRotation();return at(void 0!==n,"The view rotation is not defined"),Kt(e,i,n,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(ct.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(ki(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=te(t)/e[0],n=Yt(t)/e[1];return Math.max(i,n)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,n=Math.log(e/i)/Math.log(t);return function(i){return e/Math.pow(t,i*n)}}getRotation(){return this.get(ct.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(i/n)/e;return function(t){return Math.log(i/t)/e/r}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let n=this.getCenterInternal();const r=this.padding_;if(r){const t=this.getViewportSizeMinusPadding_();n=Zn(n,this.getViewportSize_(),[t[0]/2+r[3],t[1]/2+r[0]],e,i)}return{center:n.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,n=this.minZoom_||0;if(this.resolutions_){const r=w(this.resolutions_,t,1);n=r,e=this.resolutions_[r],i=r==this.resolutions_.length-1?2:e/this.resolutions_[r+1]}else e=this.maxResolution_,i=this.zoomFactor_;return n+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.resolutions_?.length){if(1===this.resolutions_.length)return this.resolutions_[0];const e=dt(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,dt(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(at(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t))at(!ie(t),"Cannot fit empty extent provided as `geometry`"),i=qn(ki(t,this.getProjection()));else if("Circle"===t.getType()){const e=ki(t.getExtent(),this.getProjection());i=qn(e),i.rotate(this.getRotation(),Xt(e))}else{const e=Ci();i=e?t.clone().transform(e,this.getProjection()):t}this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),r=t.getFlatCoordinates(),s=t.getStride();let o=1/0,a=1/0,l=-1/0,h=-1/0;for(let t=0,e=r.length;t<e;t+=s){const e=r[t]*i-r[t+1]*n,s=r[t]*n+r[t+1]*i;o=Math.min(o,e),a=Math.min(a,s),l=Math.max(l,e),h=Math.max(h,s)}return[o,a,l,h]}fitInternal(t,e){let i=(e=e||{}).size;i||(i=this.getViewportSizeMinusPadding_());const n=void 0!==e.padding?e.padding:[0,0,0,0],r=void 0!==e.nearest&&e.nearest;let s;s=void 0!==e.minResolution?e.minResolution:void 0!==e.maxZoom?this.getResolutionForZoom(e.maxZoom):0;const o=this.rotatedExtentForGeometry(t);let a=this.getResolutionForExtentInternal(o,[i[0]-n[1]-n[3],i[1]-n[0]-n[2]]);a=isNaN(a)?s:Math.max(a,s),a=this.getConstrainedResolution(a,r?0:1);const l=this.getRotation(),h=Math.sin(l),u=Math.cos(l),c=Xt(o);c[0]+=(n[1]-n[3])/2*a,c[1]+=(n[0]-n[2])/2*a;const d=c[0]*u-c[1]*h,f=c[1]*u+c[0]*h,p=this.getConstrainedCenter([d,f],a),g=e.callback?e.callback:P;void 0!==e.duration?this.animateInternal({resolution:a,center:p,duration:e.duration,easing:e.easing},g):(this.targetResolution_=a,this.targetCenter_=p,this.applyTargetState_(!1,!0),Vn(g,!0))}centerOn(t,e,i){this.centerOnInternal(Ii(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(Zn(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,n){let r;const s=this.padding_;if(s&&t){const o=this.getViewportSizeMinusPadding_(-i),a=Zn(t,n,[o[0]/2+s[3],o[1]/2+s[0]],e,i);r=[t[0]-a[0],t[1]-a[1]]}return r}isDef(){return!!this.getCenterInternal()&&void 0!==this.getResolution()}adjustCenter(t){const e=Pi(this.targetCenter_,this.getProjection());this.setCenter([e[0]+t[0],e[1]+t[1]])}adjustCenterInternal(t){const e=this.targetCenter_;this.setCenterInternal([e[0]+t[0],e[1]+t[1]])}adjustResolution(t,e){e=e&&Ii(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.getViewportSize_(this.getRotation()),r=this.constraints_.resolution(this.targetResolution_*t,0,n,i);e&&(this.targetCenter_=this.calculateCenterZoom(r,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=Ii(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.constraints_.rotation(this.targetRotation_+t,i);e&&(this.targetCenter_=this.calculateCenterRotate(n,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t?Ii(t,this.getProjection()):t)}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const i=this.getAnimating()||this.getInteracting()||e,n=this.constraints_.rotation(this.targetRotation_,i),r=this.getViewportSize_(n),s=this.constraints_.resolution(this.targetResolution_,0,r,i),o=this.constraints_.center(this.targetCenter_,s,r,i,this.calculateCenterShift(this.targetCenter_,s,n,r));this.get(ct.ROTATION)!==n&&this.set(ct.ROTATION,n),this.get(ct.RESOLUTION)!==s&&(this.set(ct.RESOLUTION,s),this.set("zoom",this.getZoom(),!0)),o&&this.get(ct.CENTER)&&se(this.get(ct.CENTER),o)||this.set(ct.CENTER,o),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=void 0!==t?t:200;const n=e||0,r=this.constraints_.rotation(this.targetRotation_),s=this.getViewportSize_(r),o=this.constraints_.resolution(this.targetResolution_,n,s),a=this.constraints_.center(this.targetCenter_,o,s,!1,this.calculateCenterShift(this.targetCenter_,o,r,s));if(0===t&&!this.cancelAnchor_)return this.targetResolution_=o,this.targetRotation_=r,this.targetCenter_=a,void this.applyTargetState_();i=i||(0===t?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,this.getResolution()===o&&this.getRotation()===r&&this.getCenterInternal()&&se(this.getCenterInternal(),a)||(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:r,center:a,resolution:o,duration:t,easing:ue,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(1,1)}endInteraction(t,e,i){i=i&&Ii(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(1,-1),this.resolveConstraints(t,e,i))}getConstrainedCenter(t,e){const i=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,e||this.getResolution(),i)}getConstrainedZoom(t,e){const i=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(i,e))}getConstrainedResolution(t,e){e=e||0;const i=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,i)}},Hn="ol-hidden",Jn="ol-unselectable",Qn="ol-control",tr="ol-collapsed",er=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"),ir=["style","variant","weight","size","lineHeight","family"],nr={normal:400,bold:700},rr=function(t){const e=t.match(er);if(!e)return null;const i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let t=0,n=ir.length;t<n;++t){const n=e[t+1];void 0!==n&&(i[ir[t]]="string"==typeof n?n.trim():n)}return isNaN(Number(i.weight))&&i.weight in nr&&(i.weight=nr[i.weight]),i.families=i.family.split(/,\s?/).map(t=>t.trim().replace(/^['"]|['"]$/g,"")),i};function sr(t,e,i,n){let r;return r=i&&i.length?i.shift():Z?new class extends OffscreenCanvas{style={}}(t??300,e??150):document.createElement("canvas"),t&&(r.width=t),e&&(r.height=e),r.getContext("2d",n)}let or;function ar(){return or||(or=sr(1,1)),or}function lr(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function hr(t,e){const i=e.parentNode;i&&i.replaceChild(t,e)}function ur(){return new Proxy({childNodes:[],appendChild:function(t){return this.childNodes.push(t),t},remove:function(){},removeChild:function(t){const e=this.childNodes.indexOf(t);if(-1===e)throw new Error("Node to remove was not found");return this.childNodes.splice(e,1),t},insertBefore:function(t,e){const i=this.childNodes.indexOf(e);if(-1===i)throw new Error("Reference node not found");return this.childNodes.splice(i,0,t),t},style:{}},{get:(t,e,i)=>"firstElementChild"===e?t.childNodes.length>0?t.childNodes[0]:null:Reflect.get(t,e,i)})}function cr(t){return"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas}const dr=class extends N{constructor(t){super();const e=t.element;!e||t.target||e.style.pointerEvents||(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&this.element?.remove();for(let t=0,e=this.listenerKeys.length;t<e;++t)u(this.listenerKeys[t]);if(this.listenerKeys.length=0,this.map_=t,t){const e=this.target_??t.getOverlayContainerStopEvent();this.element&&e.appendChild(this.element),this.render!==P&&this.listenerKeys.push(l(t,tt,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_="string"==typeof t?document.getElementById(t):t}},fr=class extends dr{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=void 0===t.collapsed||t.collapsed,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=void 0!==t.collapsible,this.collapsible_=void 0===t.collapsible||t.collapsible,this.collapsible_||(this.collapsed_=!1),this.attributions_=t.attributions;const e=void 0!==t.className?t.className:"ol-attribution",i=void 0!==t.tipLabel?t.tipLabel:"Attributions",n=void 0!==t.expandClassName?t.expandClassName:e+"-expand",r=void 0!==t.collapseLabel?t.collapseLabel:"›",s=void 0!==t.collapseClassName?t.collapseClassName:e+"-collapse";"string"==typeof r?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=r,this.collapseLabel_.className=s):this.collapseLabel_=r;const o=void 0!==t.label?t.label:"i";"string"==typeof o?(this.label_=document.createElement("span"),this.label_.textContent=o,this.label_.className=n):this.label_=o;const a=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=i,this.toggleButton_.appendChild(a),this.toggleButton_.addEventListener(f,this.handleClick_.bind(this),!1);const l=e+" "+Jn+" "+Qn+(this.collapsed_&&this.collapsible_?" "+tr:"")+(this.collapsible_?"":" ol-uncollapsible"),h=this.element;h.className=l,h.appendChild(this.toggleButton_),h.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=this.getMap().getAllLayers(),i=new Set(e.flatMap(e=>e.getAttributions(t)));if(void 0!==this.attributions_&&(Array.isArray(this.attributions_)?this.attributions_.forEach(t=>i.add(t)):i.add(this.attributions_)),!this.overrideCollapsible_){const t=!e.some(t=>!1===t.getSource()?.getAttributionsCollapsible());this.setCollapsible(t)}return Array.from(i)}async updateElement_(t){if(!t)return void(this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1));const e=await Promise.all(this.collectSourceAttributions_(t).map(t=>T(()=>t))),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!M(e,this.renderedAttributions_)){!function(t){for(;t.lastChild;)t.lastChild.remove()}(this.ulElement_);for(let t=0,i=e.length;t<i;++t){const i=document.createElement("li");i.innerHTML=e[t],this.ulElement_.appendChild(i)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(tr),this.collapsed_?hr(this.collapseLabel_,this.label_):hr(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(t){this.userCollapsed_=t,this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(t){this.updateElement_(t.frameState)}},pr=class extends dr{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target});const e=void 0!==t.className?t.className:"ol-rotate",i=void 0!==t.label?t.label:"⇧",n=void 0!==t.compassClassName?t.compassClassName:"ol-compass";this.label_=null,"string"==typeof i?(this.label_=document.createElement("span"),this.label_.className=n,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(n));const r=t.tipLabel?t.tipLabel:"Reset rotation",s=document.createElement("button");s.className=e+"-reset",s.setAttribute("type","button"),s.title=r,s.appendChild(this.label_),s.addEventListener(f,this.handleClick_.bind(this),!1);const o=e+" "+Jn+" "+Qn,a=this.element;a.className=o,a.appendChild(s),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=void 0!==t.duration?t.duration:250,this.autoHide_=void 0===t.autoHide||t.autoHide,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Hn)}handleClick_(t){t.preventDefault(),void 0!==this.callResetNorth_?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const t=this.getMap().getView();if(!t)return;const e=t.getRotation();void 0!==e&&(this.duration_>0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:ue}):t.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const t="rotate("+i+"rad)";if(this.autoHide_){const t=this.element.classList.contains(Hn);t||0!==i?t&&0!==i&&this.element.classList.remove(Hn):this.element.classList.add(Hn)}this.label_.style.transform=t}this.rotation_=i}},gr=class extends dr{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=void 0!==t.className?t.className:"ol-zoom",i=void 0!==t.delta?t.delta:1,n=void 0!==t.zoomInClassName?t.zoomInClassName:e+"-in",r=void 0!==t.zoomOutClassName?t.zoomOutClassName:e+"-out",s=void 0!==t.zoomInLabel?t.zoomInLabel:"+",o=void 0!==t.zoomOutLabel?t.zoomOutLabel:"–",a=void 0!==t.zoomInTipLabel?t.zoomInTipLabel:"Zoom in",l=void 0!==t.zoomOutTipLabel?t.zoomOutTipLabel:"Zoom out",h=document.createElement("button");h.className=n,h.setAttribute("type","button"),h.title=a,h.appendChild("string"==typeof s?document.createTextNode(s):s),h.addEventListener(f,this.handleClick_.bind(this,i),!1);const u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=l,u.appendChild("string"==typeof o?document.createTextNode(o):o),u.addEventListener(f,this.handleClick_.bind(this,-i),!1);const c=e+" "+Jn+" "+Qn,d=this.element;d.className=c,d.appendChild(h),d.appendChild(u),this.duration_=void 0!==t.duration?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const e=this.getMap().getView();if(!e)return;const i=e.getZoom();if(void 0!==i){const n=e.getConstrainedZoom(i+t);this.duration_>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:n,duration:this.duration_,easing:ue})):e.setZoom(n)}}},mr=class{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;let i=e-3;for(;i>0&&this.points_[i+2]>t;)i-=3;const n=this.points_[e+2]-this.points_[i+2];if(n<1e3/60)return!1;const r=this.points_[e]-this.points_[i],s=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(s,r),this.initialVelocity_=Math.sqrt(r*r+s*s)/n,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}},yr="active";function _r(t,e,i,n){const r=t.getZoom();if(void 0===r)return;const s=t.getConstrainedZoom(r+e),o=t.getResolutionForZoom(s);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:o,anchor:i,duration:void 0!==n?n:250,easing:ue})}const vr=class extends N{constructor(t){super(),this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(yr)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(yr,t)}setMap(t){this.map_=t}},xr=class extends vr{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:250}handleEvent(t){let e=!1;if(t.type==U.DBLCLICK){const i=t.originalEvent,n=t.map,r=t.coordinate,s=i.shiftKey?-this.delta_:this.delta_;_r(n.getView(),s,r,this.duration_),i.preventDefault(),e=!0}return!e}};function wr(t){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 br=function(t){const e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Sr=function(t){const e=t.map.getTargetElement(),i=e.getRootNode();return!(i instanceof ShadowRoot?i.host:e).hasAttribute("tabindex")||function(t){const e=t.map.getTargetElement(),i=e.getRootNode(),n=t.map.getOwnerDocument().activeElement;return i instanceof ShadowRoot?i.host.contains(n):e.contains(n)}(t)},Mr=E,Er=function(t){const e=t.originalEvent;return"pointerId"in e&&0==e.button&&!(X&&V&&e.ctrlKey)},Cr=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},Pr=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Ir=function(t){const e=t.originalEvent,i=e.target.tagName;return"INPUT"!==i&&"SELECT"!==i&&"TEXTAREA"!==i&&!e.target.isContentEditable},Tr=function(t){const e=t.originalEvent;return"pointerId"in e&&"mouse"==e.pointerType},kr=function(t){const e=t.originalEvent;return"pointerId"in e&&e.isPrimary&&0===e.button};function Rr(t){const e=t.length;let i=0,n=0;for(let r=0;r<e;r++)i+=t[r].clientX,n+=t[r].clientY;return{clientX:i/e,clientY:n/e}}const Ar=class extends vr{constructor(t){super(t=t||{}),t.handleDownEvent&&(this.handleDownEvent=t.handleDownEvent),t.handleDragEvent&&(this.handleDragEvent=t.handleDragEvent),t.handleMoveEvent&&(this.handleMoveEvent=t.handleMoveEvent),t.handleUpEvent&&(this.handleUpEvent=t.handleUpEvent),t.stopDown&&(this.stopDown=t.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(t){return!1}handleDragEvent(t){}handleEvent(t){if(!t.originalEvent)return!0;let e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==U.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==U.POINTERUP){const e=this.handleUpEvent(t);this.handlingDownUpSequence=e&&this.targetPointers.length>0}}else if(t.type==U.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==U.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}},Gr=class extends Ar{constructor(t){super({stopDown:C}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:wr(Cr,kr);this.condition_=t.onFocusOnly?wr(Sr,e):e,this.noKinetic_=!1}handleDragEvent(t){const e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());const i=this.targetPointers,n=e.getEventPixel(Rr(i));if(i.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(n[0],n[1]),this.lastCentroid){const e=[this.lastCentroid[0]-n[0],n[1]-this.lastCentroid[1]],i=t.map.getView();r=e,s=i.getResolution(),r[0]*=s,r[1]*=s,oe(e,i.getRotation()),i.adjustCenterInternal(e)}}else this.kinetic_&&this.kinetic_.begin();var r,s;this.lastCentroid=n,this.lastPointersCount_=i.length,t.originalEvent.preventDefault()}handleUpEvent(t){const e=t.map,i=e.getView();if(0===this.targetPointers.length){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const t=this.kinetic_.getDistance(),n=this.kinetic_.getAngle(),r=i.getCenterInternal(),s=e.getPixelFromCoordinateInternal(r),o=e.getCoordinateFromPixelInternal([s[0]-t*Math.cos(n),s[1]-t*Math.sin(n)]);i.animateInternal({center:i.getConstrainedCenter(o),duration:500,easing:ue})}return this.panning_&&(this.panning_=!1,i.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(t){if(this.targetPointers.length>0&&this.condition_(t)){const e=t.map.getView();return this.lastCentroid=null,e.getAnimating()&&e.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}},Or=class extends Ar{constructor(t){t=t||{},super({stopDown:C}),this.condition_=t.condition?t.condition:br,this.lastAngle_=void 0,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){if(!Tr(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===Wn)return;const n=e.getSize(),r=t.pixel,s=Math.atan2(n[1]/2-r[1],r[0]-n[0]/2);if(void 0!==this.lastAngle_){const t=s-this.lastAngle_;i.adjustRotationInternal(-t)}this.lastAngle_=s}handleUpEvent(t){return!Tr(t)||(t.map.getView().endInteraction(this.duration_),!1)}handleDownEvent(t){return!!Tr(t)&&(!(!Er(t)||!this.condition_(t))&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0))}},Fr=class extends _{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,i="px",n=this.element_.style;n.left=Math.min(t[0],e[0])+i,n.top=Math.min(t[1],e[1])+i,n.width=Math.abs(e[0]-t[0])+i,n.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;const t=this.startPixel_,e=this.endPixel_,i=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);i[4]=i[0].slice(),this.geometry_?this.geometry_.setCoordinates([i]):this.geometry_=new zn([i])}getGeometry(){return this.geometry_}},Lr="boxcancel";class jr extends k{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}const Nr=class extends Ar{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new Fr(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??Er,this.boxEndCondition_=t.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const n=i[0]-e[0],r=i[1]-e[1];return n*n+r*r>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new jr("boxdrag",t.coordinate,t)))}handleUpEvent(t){if(!this.startPixel_)return!1;const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new jr(e?"boxend":Lr,t.coordinate,t)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(t){return!!this.condition_(t)&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new jr("boxstart",t.coordinate,t)),!0)}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new jr(Lr,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new jr(Lr,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}},Dr=class extends Nr{constructor(t){super({condition:(t=t||{}).condition?t.condition:Pr,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=void 0!==t.duration?t.duration:200,this.out_=void 0!==t.out&&t.out}onBoxEnd(t){const e=this.getMap().getView();let i=this.getGeometry();if(this.out_){const t=e.rotatedExtentForGeometry(i),n=e.getResolutionForExtentInternal(t),r=e.getResolution()/n;i=i.clone(),i.scale(r*r)}e.fitInternal(i,{duration:this.duration_,easing:ue})}},zr="ArrowLeft",qr="ArrowRight",$r="ArrowDown",Br=class extends vr{constructor(t){super(),t=t||{},this.defaultCondition_=function(t){return Cr(t)&&Ir(t)},this.condition_=void 0!==t.condition?t.condition:this.defaultCondition_,this.duration_=void 0!==t.duration?t.duration:100,this.pixelDelta_=void 0!==t.pixelDelta?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==p){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&(n==$r||n==zr||n==qr||"ArrowUp"==n)){const r=t.map.getView(),s=r.getResolution()*this.pixelDelta_;let o=0,a=0;n==$r?a=-s:n==zr?o=-s:n==qr?o=s:a=s;const l=[o,a];oe(l,r.getRotation()),function(t,e,i){const n=t.getCenterInternal();if(n){const r=[n[0]+e[0],n[1]+e[1]];t.animateInternal({duration:void 0!==i?i:250,easing:de,center:t.getConstrainedCenter(r)})}}(r,l,this.duration_),i.preventDefault(),e=!0}}return!e}},Ur=class extends vr{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(t){return!function(t){const e=t.originalEvent;return V?e.metaKey:e.ctrlKey}(t)&&Ir(t)},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:100}handleEvent(t){let e=!1;if(t.type==p||t.type==g){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&("+"===n||"-"===n)){const r=t.map,s="+"===n?this.delta_:-this.delta_;_r(r.getView(),s,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}},Wr=class extends vr{constructor(t){super(t=t||{}),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=void 0!==t.maxDelta?t.maxDelta:1,this.duration_=void 0!==t.duration?t.duration:250,this.timeout_=void 0!==t.timeout?t.timeout:80,this.useAnchor_=void 0===t.useAnchor||t.useAnchor,this.constrainResolution_=void 0!==t.constrainResolution&&t.constrainResolution;const e=t.condition?t.condition:Mr;this.condition_=t.onFocusOnly?wr(Sr,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300,this.ctrlKeyPressed_=!1,this.ctrlKeyListenerKeys_=[]}setMap(t){if(this.ctrlKeyListenerKeys_.forEach(u),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(t),t){const e=t.getOwnerDocument();this.ctrlKeyListenerKeys_.push(l(e,"keydown",t=>{"Control"===t.key&&(this.ctrlKeyPressed_=!0)}),l(e,"keyup",t=>{"Control"===t.key&&(this.ctrlKeyPressed_=!1)}))}}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();if(!t)return;const e=t.getView(),i=this.lastDelta_?this.lastDelta_>0?1:-1:0;e.endInteraction(this.constrainResolution_||e.getConstrainResolution()?100:void 0,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(t){if(!this.condition_(t))return!0;if(t.type!==y)return!0;const e=t.map,i=t.originalEvent;i.preventDefault();const n=i.ctrlKey&&!this.ctrlKeyPressed_;i.ctrlKey||(this.ctrlKeyPressed_=!1),this.useAnchor_&&(this.lastAnchor_=t.pixel);let r=i.deltaY;switch(i.deltaMode){case WheelEvent.DOM_DELTA_LINE:r*=40;break;case WheelEvent.DOM_DELTA_PAGE:r*=300}if(0===r)return!1;this.lastDelta_=r;const s=Date.now();void 0===this.startTime_&&(this.startTime_=s),(!this.mode_||s-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(r)<4?"trackpad":"wheel");const o=e.getView();if("trackpad"===this.mode_)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(o.getAnimating()&&o.cancelAnimations(),o.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),n&&(r*=3),o.adjustZoom(-r/this.deltaPerZoom_,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=s,!1;this.totalDelta_+=r;const a=Math.max(this.timeout_-(s-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,e),a),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-dt(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),_r(e,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}},Xr=class extends Ar{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=C),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=void 0!==t.threshold?t.threshold:.3,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){let e=0;const i=this.targetPointers[0],n=this.targetPointers[1],r=Math.atan2(n.clientY-i.clientY,n.clientX-i.clientX);if(void 0!==this.lastAngle_){const t=r-this.lastAngle_;this.rotationDelta_+=t,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=t}this.lastAngle_=r;const s=t.map,o=s.getView();o.getConstraints().rotation!==Wn&&(this.anchor_=s.getCoordinateFromPixelInternal(s.getEventPixel(Rr(this.targetPointers))),this.rotating_&&(s.render(),o.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){return!(this.targetPointers.length<2)||(t.map.getView().endInteraction(this.duration_),!1)}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}},Vr=class extends Ar{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=C),super(e),this.anchor_=null,this.duration_=void 0!==t.duration?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],n=this.targetPointers[1],r=i.clientX-n.clientX,s=i.clientY-n.clientY,o=Math.sqrt(r*r+s*s);void 0!==this.lastDistance_&&(e=this.lastDistance_/o),this.lastDistance_=o;const a=t.map,l=a.getView();1!=e&&(this.lastScaleDelta_=e),this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(Rr(this.targetPointers))),a.render(),l.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const e=t.map.getView(),i=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,i),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}};function Kr(t){t=t||{};const e=new q,i=new mr(-.005,.05,100);return(void 0===t.altShiftDragRotate||t.altShiftDragRotate)&&e.push(new Or),(void 0===t.doubleClickZoom||t.doubleClickZoom)&&e.push(new xr({delta:t.zoomDelta,duration:t.zoomDuration})),(void 0===t.dragPan||t.dragPan)&&e.push(new Gr({onFocusOnly:t.onFocusOnly,kinetic:i})),(void 0===t.pinchRotate||t.pinchRotate)&&e.push(new Xr),(void 0===t.pinchZoom||t.pinchZoom)&&e.push(new Vr({duration:t.zoomDuration})),(void 0===t.keyboard||t.keyboard)&&(e.push(new Br),e.push(new Ur({delta:t.zoomDelta,duration:t.zoomDuration}))),(void 0===t.mouseWheelZoom||t.mouseWheelZoom)&&e.push(new Wr({onFocusOnly:t.onFocusOnly,duration:t.zoomDuration})),(void 0===t.shiftDragZoom||t.shiftDragZoom)&&e.push(new Dr({duration:t.zoomDuration})),e}const Zr="opacity",Yr="visible",Hr="extent",Jr="zIndex",Qr="maxResolution",ts="minResolution",es="maxZoom",is="minZoom",ns="source",rs=class extends N{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);"object"==typeof t.properties&&(delete e.properties,Object.assign(e,t.properties)),e[Zr]=void 0!==t.opacity?t.opacity:1,at("number"==typeof e[Zr],"Layer opacity must be a number"),e[Yr]=void 0===t.visible||t.visible,e[Jr]=t.zIndex,e[Qr]=void 0!==t.maxResolution?t.maxResolution:1/0,e[ts]=void 0!==t.minResolution?t.minResolution:0,e[is]=void 0!==t.minZoom?t.minZoom:-1/0,e[es]=void 0!==t.maxZoom?t.maxZoom:1/0,this.className_=void 0!==e.className?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:void 0===t||t},i=this.getZIndex();return e.opacity=dt(Math.round(100*this.getOpacity())/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==i||e.managed?i:1/0,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return O()}getLayerStatesArray(t){return O()}getExtent(){return this.get(Hr)}getMaxResolution(){return this.get(Qr)}getMinResolution(){return this.get(ts)}getMinZoom(){return this.get(is)}getMaxZoom(){return this.get(es)}getOpacity(){return this.get(Zr)}getSourceState(){return O()}getVisible(){return this.get(Yr)}getZIndex(){return this.get(Jr)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(Hr,t)}setMaxResolution(t){this.set(Qr,t)}setMinResolution(t){this.set(ts,t)}setMaxZoom(t){this.set(es,t)}setMinZoom(t){this.set(is,t)}setOpacity(t){at("number"==typeof t,"Layer opacity must be a number"),this.set(Zr,t)}setVisible(t){this.set(Yr,t)}setZIndex(t){this.set(Jr,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},ss="addlayer",os="removelayer";class as extends k{constructor(t,e){super(t),this.layer=e}}const ls="layers";class hs extends rs{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let i=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(ls,this.handleLayersChanged_),i?Array.isArray(i)?i=new q(i.slice(),{unique:!0}):at("function"==typeof i.getArray,"Expected `layers` to be an array or a `Collection`"):i=new q(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(u),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(l(t,n,this.handleLayersAdd_,this),l(t,r,this.handleLayersRemove_,this));for(const t in this.listenerKeys_)this.listenerKeys_[t].forEach(u);o(this.listenerKeys_);const e=t.getArray();for(let t=0,i=e.length;t<i;t++){const i=e[t];this.registerLayerListeners_(i),this.dispatchEvent(new as(ss,i))}this.changed()}registerLayerListeners_(t){const e=[l(t,s,this.handleLayerChange_,this),l(t,c,this.handleLayerChange_,this)];t instanceof hs&&e.push(l(t,ss,this.handleLayerGroupAdd_,this),l(t,os,this.handleLayerGroupRemove_,this)),this.listenerKeys_[L(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new as(ss,t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new as(os,t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new as(ss,e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=L(e);this.listenerKeys_[i].forEach(u),delete this.listenerKeys_[i],this.dispatchEvent(new as(os,e)),this.changed()}getLayers(){return this.get(ls)}setLayers(t){const e=this.getLayers();if(e){const t=e.getArray();for(let e=0,i=t.length;e<i;++e)this.dispatchEvent(new as(os,t[e]))}this.set(ls,t)}getLayersArray(t){return t=void 0!==t?t:[],this.getLayers().forEach(function(e){e.getLayersArray(t)}),t}getLayerStatesArray(t){const e=void 0!==t?t:[],i=e.length;this.getLayers().forEach(function(t){t.getLayerStatesArray(e)});const n=this.getLayerState();let r=n.zIndex;t||void 0!==n.zIndex||(r=0);for(let t=i,s=e.length;t<s;t++){const i=e[t];i.opacity*=n.opacity,i.visible=i.visible&&n.visible,i.maxResolution=Math.min(i.maxResolution,n.maxResolution),i.minResolution=Math.max(i.minResolution,n.minResolution),i.minZoom=Math.max(i.minZoom,n.minZoom),i.maxZoom=Math.min(i.maxZoom,n.maxZoom),void 0!==n.extent&&(void 0!==i.extent?i.extent=Ht(i.extent,n.extent):i.extent=n.extent),void 0===i.zIndex&&(i.zIndex=r)}return e}getSourceState(){return"ready"}}const us=hs,cs="prerender",ds="postrender",fs="precompose",ps="rendercomplete";function gs(t,e){if(!t.visible)return!1;const i=e.resolution;if(i<t.minResolution||i>=t.maxResolution)return!1;const n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}const ms=class extends rs{constructor(t){const e=Object.assign({},t);delete e.source,super(e),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(ns,this.handleSourcePropertyChange_);const i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return(t=t||[]).push(this),t}getLayerStatesArray(t){return(t=t||[]).push(this.getLayerState()),t}getSource(){return this.get(ns)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),this.sourceReady_||"ready"!==this.getSource().getState()||(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(u(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=l(t,c,this.handleSourceChange_,this),"ready"===t.getState()&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return this.renderer_&&this.rendered?this.renderer_.getData(t):null}isVisible(t){let e;const i=this.getMapInternal();let n;if(!t&&i&&(t=i.getView()),e=t instanceof Yn?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),e.layerStatesArray){if(n=e.layerStatesArray.find(t=>t.layer===this),!n)return!1}else n=this.getLayerState();const r=this.getExtent();return gs(n,e.viewState)&&(!r||ee(r,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];let i=e(t instanceof Yn?t.getViewStateAndExtent():t);return Array.isArray(i)||(i=[i]),i}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){const e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set("map",t)}getMapInternal(){return this.get("map")}setMap(t){this.mapPrecomposeKey_&&(u(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(u(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=l(t,fs,this.handlePrecompose_,this),this.mapRenderKey_=l(this,c,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);at(!e.some(t=>t.layer===i.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(i)}setSource(t){this.set(ns,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}};function ys(t,e,i=0,n=t.length-1,r=vs){for(;n>i;){if(n-i>600){const s=n-i+1,o=e-i+1,a=Math.log(s),l=.5*Math.exp(2*a/3),h=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);ys(t,e,Math.max(i,Math.floor(e-o*l/s+h)),Math.min(n,Math.floor(e+(s-o)*l/s+h)),r)}const s=t[e];let o=i,a=n;for(_s(t,i,e),r(t[n],s)>0&&_s(t,i,n);o<a;){for(_s(t,o,a),o++,a--;r(t[o],s)<0;)o++;for(;r(t[a],s)>0;)a--}0===r(t[i],s)?_s(t,i,a):(a++,_s(t,a,n)),a<=e&&(i=a+1),e<=a&&(n=a-1)}}function _s(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function vs(t,e){return t<e?-1:t>e?1:0}class xs{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const i=[];if(!As(t,e))return i;const n=this.toBBox,r=[];for(;e;){for(let s=0;s<e.children.length;s++){const o=e.children[s],a=e.leaf?n(o):o;As(t,a)&&(e.leaf?i.push(o):Rs(t,a)?this._all(o,i):r.push(o))}e=r.pop()}return i}collides(t){let e=this.data;if(!As(t,e))return!1;const i=[];for(;e;){for(let n=0;n<e.children.length;n++){const r=e.children[n],s=e.leaf?this.toBBox(r):r;if(As(t,s)){if(e.leaf||Rs(t,s))return!0;i.push(r)}}e=i.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(let e=0;e<t.length;e++)this.insert(t[e]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const t=this.data;this.data=e,e=t}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=Gs([]),this}remove(t,e){if(!t)return this;let i=this.data;const n=this.toBBox(t),r=[],s=[];let o,a,l;for(;i||r.length;){if(i||(i=r.pop(),a=r[r.length-1],o=s.pop(),l=!0),i.leaf){const n=ws(t,i.children,e);if(-1!==n)return i.children.splice(n,1),r.push(i),this._condense(r),this}l||i.leaf||!Rs(i,n)?a?(o++,i=a.children[o],l=!1):i=null:(r.push(i),s.push(o),o=0,a=i,i=i.children[0])}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const i=[];for(;t;)t.leaf?e.push(...t.children):i.push(...t.children),t=i.pop();return e}_build(t,e,i,n){const r=i-e+1;let s,o=this._maxEntries;if(r<=o)return s=Gs(t.slice(e,i+1)),bs(s,this.toBBox),s;n||(n=Math.ceil(Math.log(r)/Math.log(o)),o=Math.ceil(r/Math.pow(o,n-1))),s=Gs([]),s.leaf=!1,s.height=n;const a=Math.ceil(r/o),l=a*Math.ceil(Math.sqrt(o));Os(t,e,i,l,this.compareMinX);for(let r=e;r<=i;r+=l){const e=Math.min(r+l-1,i);Os(t,r,e,a,this.compareMinY);for(let i=r;i<=e;i+=a){const r=Math.min(i+a-1,e);s.children.push(this._build(t,i,r,n-1))}}return bs(s,this.toBBox),s}_chooseSubtree(t,e,i,n){for(;n.push(e),!e.leaf&&n.length-1!==i;){let i,n=1/0,r=1/0;for(let s=0;s<e.children.length;s++){const o=e.children[s],a=Ps(o),l=Ts(t,o)-a;l<r?(r=l,n=a<n?a:n,i=o):l===r&&a<n&&(n=a,i=o)}e=i||e.children[0]}return e}_insert(t,e,i){const n=i?t:this.toBBox(t),r=[],s=this._chooseSubtree(n,this.data,e,r);for(s.children.push(t),Ms(s,n);e>=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(n,r,e)}_split(t,e){const i=t[e],n=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,n);const s=this._chooseSplitIndex(i,r,n),o=Gs(i.children.splice(s,i.children.length-s));o.height=i.height,o.leaf=i.leaf,bs(i,this.toBBox),bs(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)}_splitRoot(t,e){this.data=Gs([t,e]),this.data.height=t.height+1,this.data.leaf=!1,bs(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let n,r=1/0,s=1/0;for(let o=e;o<=i-e;o++){const e=Ss(t,0,o,this.toBBox),a=Ss(t,o,i,this.toBBox),l=ks(e,a),h=Ps(e)+Ps(a);l<r?(r=l,n=o,s=h<s?h:s):l===r&&h<s&&(s=h,n=o)}return n||i-e}_chooseSplitAxis(t,e,i){const n=t.leaf?this.compareMinX:Es,r=t.leaf?this.compareMinY:Cs;this._allDistMargin(t,e,i,n)<this._allDistMargin(t,e,i,r)&&t.children.sort(n)}_allDistMargin(t,e,i,n){t.children.sort(n);const r=this.toBBox,s=Ss(t,0,e,r),o=Ss(t,i-e,i,r);let a=Is(s)+Is(o);for(let n=e;n<i-e;n++){const e=t.children[n];Ms(s,t.leaf?r(e):e),a+=Is(s)}for(let n=i-e-1;n>=e;n--){const e=t.children[n];Ms(o,t.leaf?r(e):e),a+=Is(o)}return a}_adjustParentBBoxes(t,e,i){for(let n=i;n>=0;n--)Ms(e[n],t)}_condense(t){for(let e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children,e.splice(e.indexOf(t[i]),1)):this.clear():bs(t[i],this.toBBox)}}function ws(t,e,i){if(!i)return e.indexOf(t);for(let n=0;n<e.length;n++)if(i(t,e[n]))return n;return-1}function bs(t,e){Ss(t,0,t.children.length,e,t)}function Ss(t,e,i,n,r){r||(r=Gs(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let s=e;s<i;s++){const e=t.children[s];Ms(r,t.leaf?n(e):e)}return r}function Ms(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function Es(t,e){return t.minX-e.minX}function Cs(t,e){return t.minY-e.minY}function Ps(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Is(t){return t.maxX-t.minX+(t.maxY-t.minY)}function Ts(t,e){return(Math.max(e.maxX,t.maxX)-Math.min(e.minX,t.minX))*(Math.max(e.maxY,t.maxY)-Math.min(e.minY,t.minY))}function ks(t,e){const i=Math.max(t.minX,e.minX),n=Math.max(t.minY,e.minY),r=Math.min(t.maxX,e.maxX),s=Math.min(t.maxY,e.maxY);return Math.max(0,r-i)*Math.max(0,s-n)}function Rs(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function As(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function Gs(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Os(t,e,i,n,r){const s=[e,i];for(;s.length;){if((i=s.pop())-(e=s.pop())<=n)continue;const o=e+Math.ceil((i-e)/n/2)*n;ys(t,o,e,i,r),s.push(e,o,o,i)}}const Fs=[NaN,NaN,NaN,0];let Ls;const js=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Ns=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Ds=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,zs=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function qs(t,e){return t.endsWith("%")?Number(t.substring(0,t.length-1))/e:Number(t)}function $s(t){throw new Error('failed to parse "'+t+'" as color')}function Bs(t){if(t.toLowerCase().startsWith("rgb")){const e=t.match(Ns)||t.match(js)||t.match(Ds);if(e){const t=e[4],i=100/255;return[dt(qs(e[1],i)+.5|0,0,255),dt(qs(e[2],i)+.5|0,0,255),dt(qs(e[3],i)+.5|0,0,255),void 0!==t?dt(qs(t,100),0,1):1]}$s(t)}if(t.startsWith("#")){if(zs.test(t)){const e=t.substring(1),i=e.length<=4?1:2,n=[0,0,0,255];for(let t=0,r=e.length;t<r;t+=i){let r=parseInt(e.substring(t,t+i),16);1===i&&(r+=r<<4),n[t/i]=r}return n[3]=n[3]/255,n}$s(t)}const e=(Ls||(Ls=sr(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),Ls);e.fillStyle="#abcdef";let i=e.fillStyle;e.fillStyle=t,e.fillStyle===i&&(e.fillStyle="#fedcba",i=e.fillStyle,e.fillStyle=t,e.fillStyle===i&&$s(t));const n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return Bs(n);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);const r=Array.from(e.getImageData(0,0,1,1).data);return r[3]=vt(r[3]/255,3),r}const Us={};let Ws=0;function Xs(t){if(4===t.length)return t;const e=t.slice();return e[3]=1,e}function Vs(t){return t>.0031308?269.025*Math.pow(t,1/2.4)-14.025:3294.6*t}function Ks(t){return t>.2068965?Math.pow(t,3):108/841*(t-4/29)}function Zs(t){return t>10.314724?Math.pow((t+14.025)/269.025,2.4):t/3294.6}function Ys(t){return t>.0088564?Math.pow(t,1/3):t/(108/841)+4/29}function Hs(t){const e=Zs(t[0]),i=Zs(t[1]),n=Zs(t[2]),r=Ys(.222488403*e+.716873169*i+.06060791*n),s=500*(Ys(.452247074*e+.399439023*i+.148375274*n)-r),o=200*(r-Ys(.016863605*e+.117638439*i+.865350722*n)),a=Math.atan2(o,s)*(180/Math.PI);return[116*r-16,Math.sqrt(s*s+o*o),a<0?a+360:a,t[3]]}function Js(t){if("none"===t)return Fs;if(Us.hasOwnProperty(t))return Us[t];if(Ws>=1024){let t=0;for(const e in Us)3&t++||(delete Us[e],--Ws)}const e=Bs(t);4!==e.length&&$s(t);for(const i of e)isNaN(i)&&$s(t);return Us[t]=e,++Ws,e}function Qs(t){return Array.isArray(t)?t:Js(t)}function to(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let i=t[1];i!=(0|i)&&(i=i+.5|0);let n=t[2];return n!=(0|n)&&(n=n+.5|0),"rgba("+e+","+i+","+n+","+(void 0===t[3]?1:Math.round(1e3*t[3])/1e3)+")"}function eo(t){return t[0]>0&&t[1]>0}function io(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}let no=0;const ro=1<<no++,so=1<<no++,oo=1<<no++,ao=1<<no++,lo=1<<no++,ho=1<<no++,uo=Math.pow(2,6)-1,co={[ro]:"boolean",[so]:"number",[oo]:"string",[ao]:"color",[lo]:"number[]",[ho]:"size"},fo=Object.keys(co).map(Number).sort(v);function po(t){const e=[];for(const i of fo)go(t,i)&&e.push(co[i]);return 0===e.length?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function go(t,e){return(t&e)===e}function mo(t,e){return t===e}class yo{constructor(t,e){if(!function(t){return t in co}(t))throw new Error(`literal expressions must have a specific type, got ${po(t)}`);this.type=t,this.value=e}}class _o{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function vo(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1}}function xo(t,e,i){switch(typeof t){case"boolean":if(mo(e,oo))return new yo(oo,t?"true":"false");if(!go(e,ro))throw new Error(`got a boolean, but expected ${po(e)}`);return new yo(ro,t);case"number":if(mo(e,ho))return new yo(ho,io(t));if(mo(e,ro))return new yo(ro,!!t);if(mo(e,oo))return new yo(oo,t.toString());if(!go(e,so))throw new Error(`got a number, but expected ${po(e)}`);return new yo(so,t);case"string":if(mo(e,ao))return new yo(ao,Js(t));if(mo(e,ro))return new yo(ro,!!t);if(!go(e,oo))throw new Error(`got a string, but expected ${po(e)}`);return new yo(oo,t)}if(!Array.isArray(t))throw new Error("expression must be an array or a primitive value");if(0===t.length)throw new Error("empty expression");if("string"==typeof t[0])return function(t,e,i){const n=t[0],r=pa[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(t,e,i)}(t,e,i);for(const e of t)if("number"!=typeof e)throw new Error("expected an array of numbers");if(mo(e,ho)){if(2!==t.length)throw new Error(`expected an array of two values for a size, got ${t.length}`);return new yo(ho,t)}if(mo(e,ao)){if(3===t.length)return new yo(ao,[...t,1]);if(4===t.length)return new yo(ao,t);throw new Error(`expected an array of 3 or 4 values for a color, got ${t.length}`)}if(!go(e,lo))throw new Error(`got an array of numbers, but expected ${po(e)}`);return new yo(lo,t)}const wo="get",bo="var",So="concat",Mo="geometry-type",Eo="line-metric",Co="any",Po="all",Io="!",To="resolution",ko="zoom",Ro="time",Ao="==",Go="!=",Oo=">",Fo=">=",Lo="<",jo="<=",No="*",Do="/",zo="+",qo="-",$o="clamp",Bo="%",Uo="^",Wo="abs",Xo="floor",Vo="ceil",Ko="round",Zo="sin",Yo="cos",Ho="atan",Jo="sqrt",Qo="match",ta="between",ea="interpolate",ia="coalesce",na="case",ra="in",sa="number",oa="string",aa="array",la="color",ha="id",ua="band",ca="palette",da="to-string",fa="has",pa={[wo]:ba(_a(1,1/0),ga),[bo]:ba(_a(1,1),function(t,e,i){const n=t[1];if("string"!=typeof n)throw new Error("expected a string argument for var operation");return i.variables.add(n),[new yo(oo,n)]}),[fa]:ba(_a(1,1/0),ga),[ha]:ba(function(t,e,i){i.featureId=!0},ya),[So]:ba(_a(2,1/0),xa(oo)),[Mo]:ba(function(t,e,i){i.geometryType=!0},ya),[Eo]:ba(function(t,e,i){i.mCoordinate=!0},ya),[To]:ba(ma,ya),[ko]:ba(ma,ya),[Ro]:ba(ma,ya),[Co]:ba(_a(2,1/0),xa(ro)),[Po]:ba(_a(2,1/0),xa(ro)),[Io]:ba(_a(1,1),xa(ro)),[Ao]:ba(_a(2,2),xa(uo)),[Go]:ba(_a(2,2),xa(uo)),[Oo]:ba(_a(2,2),xa(so)),[Fo]:ba(_a(2,2),xa(so)),[Lo]:ba(_a(2,2),xa(so)),[jo]:ba(_a(2,2),xa(so)),[No]:ba(_a(2,1/0),va),[ia]:ba(_a(2,1/0),va),[Do]:ba(_a(2,2),xa(so)),[zo]:ba(_a(2,1/0),xa(so)),[qo]:ba(_a(2,2),xa(so)),[$o]:ba(_a(3,3),xa(so)),[Bo]:ba(_a(2,2),xa(so)),[Uo]:ba(_a(2,2),xa(so)),[Wo]:ba(_a(1,1),xa(so)),[Xo]:ba(_a(1,1),xa(so)),[Vo]:ba(_a(1,1),xa(so)),[Ko]:ba(_a(1,1),xa(so)),[Zo]:ba(_a(1,1),xa(so)),[Yo]:ba(_a(1,1),xa(so)),[Ho]:ba(_a(1,2),xa(so)),[Jo]:ba(_a(1,1),xa(so)),[Qo]:ba(_a(4,1/0),wa,function(t,e,i){const n=t.length-1,r=oo|so|ro,s=xo(t[1],r,i),o=xo(t[t.length-1],e,i),a=new Array(n-2);for(let e=0;e<n-2;e+=2){try{const n=xo(t[e+2],s.type,i);a[e]=n}catch(t){throw new Error(`failed to parse argument ${e+1} of match expression: ${t.message}`)}try{const n=xo(t[e+3],o.type,i);a[e+1]=n}catch(t){throw new Error(`failed to parse argument ${e+2} of match expression: ${t.message}`)}}return[s,...a,o]}),[ta]:ba(_a(3,3),xa(so)),[ea]:ba(_a(6,1/0),wa,function(t,e,i){const n=t[1];let r;switch(n[0]){case"linear":r=1;break;case"exponential":const t=n[1];if("number"!=typeof t||t<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(t)} instead`);r=t;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(n)}`)}const s=new yo(so,r);let o;try{o=xo(t[2],so,i)}catch(t){throw new Error(`failed to parse argument 1 in interpolate expression: ${t.message}`)}const a=new Array(t.length-3);for(let n=0;n<a.length;n+=2){try{const e=xo(t[n+3],so,i);a[n]=e}catch(t){throw new Error(`failed to parse argument ${n+2} for interpolate expression: ${t.message}`)}try{const r=xo(t[n+4],e,i);a[n+1]=r}catch(t){throw new Error(`failed to parse argument ${n+3} for interpolate expression: ${t.message}`)}}return[s,o,...a]}),[na]:ba(_a(3,1/0),function(t,e,i){const n=t[0],r=t.length-1;if(r%2==0)throw new Error(`expected an odd number of arguments for ${n}, got ${r} instead`)},function(t,e,i){const n=xo(t[t.length-1],e,i),r=new Array(t.length-1);for(let e=0;e<r.length-1;e+=2){try{const n=xo(t[e+1],ro,i);r[e]=n}catch(t){throw new Error(`failed to parse argument ${e} of case expression: ${t.message}`)}try{const s=xo(t[e+2],n.type,i);r[e+1]=s}catch(t){throw new Error(`failed to parse argument ${e+1} of case expression: ${t.message}`)}}return r[r.length-1]=n,r}),[ra]:ba(_a(2,2),function(t,e,i){let n,r=t[2];if(!Array.isArray(r))throw new Error('the second argument for the "in" operator must be an array');if("literal"===r[0]){if(r=r[1],!Array.isArray(r))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array')}else if("string"==typeof r[0])throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');n="string"==typeof r[0]?oo:so;const s=new Array(r.length);for(let t=0;t<s.length;t++)try{const e=xo(r[t],n,i);s[t]=e}catch(e){throw new Error(`failed to parse haystack item ${t} for "in" expression: ${e.message}`)}return[xo(t[1],n,i),...s]}),[sa]:ba(_a(1,1/0),xa(uo)),[oa]:ba(_a(1,1/0),xa(uo)),[aa]:ba(_a(1,1/0),xa(so)),[la]:ba(_a(1,4),xa(so)),[ua]:ba(_a(1,3),xa(so)),[ca]:ba(_a(2,2),function(t,e,i){let n;try{n=xo(t[1],so,i)}catch(t){throw new Error(`failed to parse first argument in palette expression: ${t.message}`)}const r=t[2];if(!Array.isArray(r))throw new Error("the second argument of palette must be an array");const s=new Array(r.length);for(let t=0;t<s.length;t++){let e;try{e=xo(r[t],ao,i)}catch(e){throw new Error(`failed to parse color at index ${t} in palette expression: ${e.message}`)}if(!(e instanceof yo))throw new Error(`the palette color at index ${t} must be a literal value`);s[t]=e}return[n,...s]}),[da]:ba(_a(1,1),xa(ro|so|oo|ao))};function ga(t,e,i){const n=t.length-1,r=new Array(n);for(let e=0;e<n;++e){const n=t[e+1];switch(typeof n){case"number":r[e]=new yo(so,n);break;case"string":r[e]=new yo(oo,n);break;default:throw new Error(`expected a string key or numeric array index for a get operation, got ${n}`)}0===e&&i.properties.add(String(n))}return r}function ma(t,e,i){i.mapState=!0}function ya(t,e,i){const n=t[0];if(1!==t.length)throw new Error(`expected no arguments for ${n} operation`);return[]}function _a(t,e){return function(i,n,r){const s=i[0],o=i.length-1;if(t===e){if(o!==t)throw new Error(`expected ${t} argument${1===t?"":"s"} for ${s}, got ${o}`)}else if(o<t||o>e)throw new Error(`expected ${e===1/0?`${t} or more`:`${t} to ${e}`} arguments for ${s}, got ${o}`)}}function va(t,e,i){const n=t.length-1,r=new Array(n);for(let s=0;s<n;++s){const n=xo(t[s+1],e,i);r[s]=n}return r}function xa(t){return function(e,i,n){const r=e.length-1,s=new Array(r);for(let i=0;i<r;++i){const r=xo(e[i+1],t,n);s[i]=r}return s}}function wa(t,e,i){const n=t[0],r=t.length-1;if(r%2==1)throw new Error(`expected an even number of arguments for operation ${n}, got ${r} instead`)}function ba(...t){return function(e,i,n){const r=e[0];let s;for(let r=0;r<t.length;r++){const o=t[r](e,i,n);if(r==t.length-1){if(!o)throw new Error("expected last argument validator to return the parsed args");s=o}}return new _o(i,r,...s)}}function Sa(t){if(!t)return"";const e=t.getType();switch(e){case"Point":case"LineString":case"Polygon":return e;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return e.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return Sa(t.getGeometries()[0]);default:return""}}function Ma(t,e,i){return Ea(xo(t,e,i),i)}function Ea(t,e){if(t instanceof yo){if(t.type===ao&&"string"==typeof t.value){const e=Js(t.value);return function(){return e}}return function(){return t.value}}const i=t.operator;switch(i){case sa:case oa:case ia:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=Ea(t.args[i],e);switch(i){case ia:return t=>{for(let e=0;e<n;++e){const i=r[e](t);if(null!=i)return i}throw new Error("Expected one of the values to be non-null")};case sa:case oa:return t=>{for(let e=0;e<n;++e){const n=r[e](t);if(typeof n===i)return n}throw new Error(`Expected one of the values to be a ${i}`)};default:throw new Error(`Unsupported assertion operator ${i}`)}}(t,e);case wo:case bo:case fa:return function(t){const e=t.args[0].value;switch(t.operator){case wo:return i=>{const n=t.args;let r=i.properties[e];for(let t=1,e=n.length;t<e;++t)r=r[n[t].value];return r};case bo:return t=>t.variables[e];case fa:return i=>{const n=t.args;if(!(e in i.properties))return!1;let r=i.properties[e];for(let t=1,e=n.length;t<e;++t){const e=n[t].value;if(!r||!Object.hasOwn(r,e))return!1;r=r[e]}return!0};default:throw new Error(`Unsupported accessor operator ${t.operator}`)}}(t);case"id":return t=>t.featureId;case Mo:return t=>t.geometryType;case So:{const i=t.args.map(t=>Ea(t,e));return t=>"".concat(...i.map(e=>e(t).toString()))}case To:return t=>t.resolution;case Co:case Po:case ta:case ra:case"!":return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=Ea(t.args[i],e);switch(i){case Co:return t=>{for(let e=0;e<n;++e)if(r[e](t))return!0;return!1};case Po:return t=>{for(let e=0;e<n;++e)if(!r[e](t))return!1;return!0};case ta:return t=>{const e=r[0](t),i=r[1](t),n=r[2](t);return e>=i&&e<=n};case ra:return t=>{const e=r[0](t);for(let i=1;i<n;++i)if(e===r[i](t))return!0;return!1};case"!":return t=>!r[0](t);default:throw new Error(`Unsupported logical operator ${i}`)}}(t,e);case Ao:case Go:case"<":case jo:case">":case Fo:return function(t,e){const i=t.operator,n=Ea(t.args[0],e),r=Ea(t.args[1],e);switch(i){case Ao:return t=>n(t)===r(t);case Go:return t=>n(t)!==r(t);case"<":return t=>n(t)<r(t);case jo:return t=>n(t)<=r(t);case">":return t=>n(t)>r(t);case Fo:return t=>n(t)>=r(t);default:throw new Error(`Unsupported comparison operator ${i}`)}}(t,e);case"*":case"/":case"+":case"-":case $o:case"%":case"^":case Wo:case Xo:case Vo:case Ko:case Zo:case Yo:case Ho:case Jo:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=Ea(t.args[i],e);switch(i){case"*":return t=>{let e=1;for(let i=0;i<n;++i)e*=r[i](t);return e};case"/":return t=>r[0](t)/r[1](t);case"+":return t=>{let e=0;for(let i=0;i<n;++i)e+=r[i](t);return e};case"-":return t=>r[0](t)-r[1](t);case $o:return t=>{const e=r[0](t),i=r[1](t);if(e<i)return i;const n=r[2](t);return e>n?n:e};case"%":return t=>r[0](t)%r[1](t);case"^":return t=>Math.pow(r[0](t),r[1](t));case Wo:return t=>Math.abs(r[0](t));case Xo:return t=>Math.floor(r[0](t));case Vo:return t=>Math.ceil(r[0](t));case Ko:return t=>Math.round(r[0](t));case Zo:return t=>Math.sin(r[0](t));case Yo:return t=>Math.cos(r[0](t));case Ho:return 2===n?t=>Math.atan2(r[0](t),r[1](t)):t=>Math.atan(r[0](t));case Jo:return t=>Math.sqrt(r[0](t));default:throw new Error(`Unsupported numeric operator ${i}`)}}(t,e);case na:return function(t,e){const i=t.args.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=Ea(t.args[r],e);return t=>{for(let e=0;e<i-1;e+=2)if(n[e](t))return n[e+1](t);return n[i-1](t)}}(t,e);case Qo:return function(t,e){const i=t.args.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=Ea(t.args[r],e);return t=>{const e=n[0](t);for(let r=1;r<i-1;r+=2)if(e===n[r](t))return n[r+1](t);return n[i-1](t)}}(t,e);case ea:return function(t,e){const i=t.args.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=Ea(t.args[r],e);return t=>{const e=n[0](t),r=n[1](t);let s,o;for(let a=2;a<i;a+=2){const i=n[a](t);let l=n[a+1](t);const h=Array.isArray(l);if(h&&(l=Xs(l)),i>=r)return 2===a?l:h?Pa(e,r,s,o,i,l):Ca(e,r,s,o,i,l);s=i,o=l}return o}}(t,e);case da:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=Ea(t.args[i],e);if(i===da)return e=>{const i=r[0](e);return t.args[0].type===ao?to(i):i.toString()};throw new Error(`Unsupported convert operator ${i}`)}(t,e);default:throw new Error(`Unsupported operator ${i}`)}}function Ca(t,e,i,n,r,s){const o=r-i;if(0===o)return n;const a=e-i;return n+(1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1))*(s-n)}function Pa(t,e,i,n,r,s){if(0===r-i)return n;const o=Hs(n),a=Hs(s);let l=a[2]-o[2];return l>180?l-=360:l<-180&&(l+=360),function(t){const e=(t[0]+16)/116,i=t[1],n=t[2]*Math.PI/180,r=Ks(e),s=Ks(e+i/500*Math.cos(n)),o=Ks(e-i/200*Math.sin(n)),a=Vs(3.021973625*s-1.617392459*r-.404875592*o),l=Vs(-.943766287*s+1.916279586*r+.027607165*o),h=Vs(.069407491*s-.22898585*r+1.159737864*o);return[dt(a+.5|0,0,255),dt(l+.5|0,0,255),dt(h+.5|0,0,255),t[3]]}([Ca(t,e,i,o[0],r,a[0]),Ca(t,e,i,o[1],r,a[1]),o[2]+Ca(t,e,i,0,r,l),Ca(t,e,i,n[3],r,s[3])])}function Ia(t,e){return t+":"+(e?Qs(e):"null")}const Ta=new class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];3&t++||i.hasListener()||(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e){const i=Ia(t,e);return i in this.cache_?this.cache_[i]:null}getPattern(t,e){const i=Ia(t,e);return i in this.patternCache_?this.patternCache_[i]:null}set(t,e,i,n){const r=Ia(t,e),s=r in this.cache_;this.cache_[r]=i,n&&(0===i.getImageState()&&i.load(),1===i.getImageState()?i.ready().then(()=>{this.patternCache_[r]=ar().createPattern(i.getImage(1),"repeat")}):this.patternCache_[r]=ar().createPattern(i.getImage(1),"repeat")),s||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}};let ka=null;class Ra extends R{constructor(t,e,i,n,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i?.crossOrigin,this.referrerPolicy_=i?.referrerPolicy,this.canvas_={},this.color_=r,this.imageState_=void 0===n?0:n,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(void 0===this.tainted_&&2===this.imageState_){ka||(ka=sr(1,1,void 0,{willReadFrequently:!0})),ka.drawImage(this.image_,0,0);try{ka.getImageData(0,0,1,1),this.tainted_=!1}catch{ka=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(c)}handleImageError_(){this.imageState_=3,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=2,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}setImage(t){this.image_=t}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=sr(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(0===this.imageState_){this.image_||this.initializeImage_(),this.imageState_=1;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&(t=this.image_,e=this.src_,e&&(t.src=e),t.src&&Y?new Promise((e,i)=>t.decode().then(()=>e(t)).catch(n=>t.complete&&t.width?e(t):i(n))):function(t){return new Promise((e,i)=>{function n(){s(),e(t)}function r(){s(),i(new Error("Image load error"))}function s(){t.removeEventListener("load",n),t.removeEventListener("error",r)}t.addEventListener("load",n),t.addEventListener("error",r)})}(t)).then(t=>{this.image_=t,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}var t,e}replaceColor_(t){if(!this.color_||this.canvas_[t]||2!==this.imageState_)return;const e=this.image_,i=sr(Math.ceil(e.width*t),Math.ceil(e.height*t)),n=i.canvas;var r;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle="string"==typeof(r=this.color_)?r:to(r),i.fillRect(0,0,n.width/t,n.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=n}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(2===this.imageState_||3===this.imageState_)t();else{const e=()=>{2!==this.imageState_&&3!==this.imageState_||(this.removeEventListener(c,e),t())};this.addEventListener(c,e)}})),this.ready_}}function Aa(t,e,i,n,r,s){let o=void 0===e?void 0:Ta.get(e,r);return o||(o=new Ra(t,t&&"src"in t?t.src||void 0:e,i,n,r),Ta.set(e,r,o,s)),s&&o&&!Ta.getPattern(e,r)&&Ta.set(e,r,o,s),o}const Ga=Ra;function Oa(t){return t?Array.isArray(t)?to(t):"object"==typeof t&&"src"in t?function(t){if(!t.offset||!t.size)return Ta.getPattern(t.src,t.color);const e=t.src+":"+t.offset,i=Ta.getPattern(e,t.color);if(i)return i;const n=Ta.get(t.src,null);if(2!==n.getImageState())return null;const r=sr(t.size[0],t.size[1]);return r.drawImage(n.getImage(1),t.offset[0],t.offset[1],t.size[0],t.size[1],0,0,t.size[0],t.size[1]),Aa(r.canvas,e,void 0,2,t.color,!0),Ta.getPattern(e,t.color)}(t):t:null}const Fa="10px sans-serif",La="#000",ja="round",Na=[],Da="round",za="#000",qa="center",$a="middle",Ba=[0,0,0,0],Ua=new N;let Wa,Xa=null;const Va={},Ka=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Za(t,e,i){return`${t} ${e} 16px "${i}"`}const Ya=function(){const t=100;let e,i;async function n(t){await i.ready;const e=await i.load(t);if(0===e.length)return!1;const n=rr(t),r=n.families[0].toLowerCase(),s=n.weight;return e.some(t=>{const e=t.family.replace(/^['"]|['"]$/g,"").toLowerCase(),i=nr[t.weight]||t.weight;return e===r&&t.style===n.style&&i==s})}async function r(){await i.ready;let s=!0;const a=Ua.getProperties(),l=Object.keys(a).filter(e=>a[e]<t);for(let e=l.length-1;e>=0;--e){const i=l[e];let r=a[i];r<t&&(await n(i)?(o(Va),Ua.set(i,t)):(r+=10,Ua.set(i,r,!0),r<t&&(s=!1)))}e=void 0,s||(e=setTimeout(r,100))}return async function(t){i||(i=Z?self.fonts:document.fonts);const n=rr(t);if(!n)return;const s=n.families;let o=!1;for(const t of s){if(Ka.has(t))continue;const e=Za(n.style,n.weight,t);void 0===Ua.get(e)&&(Ua.set(e,0,!0),o=!0)}o&&(clearTimeout(e),e=setTimeout(r,100))}}(),Ha=function(){let t;return function(e){let i=Va[e];if(null==i){if(Z){const t=rr(e),n=Ja(e,"Žg");i=(isNaN(Number(t.lineHeight))?1.2:Number(t.lineHeight))*(n.actualBoundingBoxAscent+n.actualBoundingBoxDescent)}else t||(t=document.createElement("div"),t.innerHTML="M",t.style.minHeight="0",t.style.maxHeight="none",t.style.height="auto",t.style.padding="0",t.style.border="none",t.style.position="absolute",t.style.display="block",t.style.left="-99999px"),t.style.font=e,document.body.appendChild(t),i=t.offsetHeight,document.body.removeChild(t);Va[e]=i}return i}}();function Ja(t,e){return Xa||(Xa=sr(1,1)),t!=Wa&&(Xa.font=t,Wa=Xa.font),Xa.measureText(e)}function Qa(t,e){return Ja(t,e).width}function tl(t,e,i){if(e in i)return i[e];const n=e.split("\n").reduce((e,i)=>Math.max(e,Qa(t,i)),0);return i[e]=n,n}class el{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=io(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new el({opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return O()}getImage(t){return O()}getHitDetectionImage(){return O()}getPixelRatio(t){return 1}getImageState(){return O()}getImageSize(){return O()}getOrigin(){return O()}getSize(){return O()}setDisplacement(t){this.displacement_=t}setOpacity(t){this.opacity_=t}setRotateWithView(t){this.rotateWithView_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=io(t)}listenImageChange(t){O()}load(){O()}unlistenImageChange(t){O()}ready(){return Promise.resolve()}}const il=el;class nl extends il{constructor(t){super({opacity:1,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,rotation:void 0!==t.rotation?t.rotation:0,scale:void 0!==t.scale?t.scale:1,displacement:void 0!==t.displacement?t.displacement:[0,0],declutterMode:t.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=void 0!==t.fill?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius=t.radius,this.radius2_=t.radius2,this.angle_=void 0!==t.angle?t.angle:0,this.stroke_=void 0!==t.stroke?t.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?1:2,1===this.imageState_&&this.ready().then(()=>this.imageState_=2),this.render()}clone(){const t=this.getScale(),e=new nl({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){const e=this.fill_?.getKey(),i=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let n=Ta.get(i,null)?.getImage(1);if(!n){const e=this.renderOptions_,r=Math.ceil(e.size*t),s=sr(r,r);this.draw_(e,s,t),n=s.canvas;const o=new Ga(n,void 0,null,2,null);Ta.set(i,null,o),createImageBitmap(n).then(t=>{o.setImage(t)})}return n}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(t){this.radius!==t&&(this.radius=t,this.render())}getRadius2(){return this.radius2_}setRadius2(t){this.radius2_!==t&&(this.radius2_=t,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(0===e||this.points_===1/0||"bevel"!==t&&"miter"!==t)return e;let n=this.radius,r=void 0===this.radius2_?n:this.radius2_;if(n<r){const t=n;n=r,r=t}const s=void 0===this.radius2_?this.points_:2*this.points_,o=2*Math.PI/s,a=r*Math.sin(o),l=n-Math.sqrt(r*r-a*a),h=Math.sqrt(a*a+l*l),u=h/a;if("miter"===t&&u<=i)return u*e;const c=e/2/u,d=e/2*(l/h),f=Math.sqrt((n+c)*(n+c)+d*d)-n;if(void 0===this.radius2_||"bevel"===t)return 2*f;const p=n*Math.sin(o),g=r-Math.sqrt(n*n-p*p),m=Math.sqrt(p*p+g*g)/p;if(m<=i){const t=m*e/2-r-n;return 2*Math.max(f,t)}return 2*f}createRenderOptions(){let t,e=ja,i=Da,n=0,r=null,s=0,o=0;this.stroke_&&(t=Oa(this.stroke_.getColor()??za),o=this.stroke_.getWidth()??1,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,i=this.stroke_.getLineJoin()??Da,e=this.stroke_.getLineCap()??ja,n=this.stroke_.getMiterLimit()??10);const a=this.calculateLineJoinSize_(i,o,n),l=Math.max(this.radius,this.radius2_||0);return{strokeStyle:t,strokeWidth:o,size:Math.ceil(2*l+a),lineCap:e,lineDash:r,lineDashOffset:s,lineJoin:i,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let t=this.fill_.getColor();null===t&&(t=La),e.fillStyle=Oa(t),e.fill()}t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){let e;if(this.fill_){let i=this.fill_.getColor(),n=0;"string"==typeof i&&(i=Qs(i)),null===i?n=1:Array.isArray(i)&&(n=4===i.length?i[3]:1),0===n&&(e=sr(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_;const i=this.radius;if(e===1/0)t.arc(0,0,i,0,2*Math.PI);else{const n=void 0===this.radius2_?i:this.radius2_;void 0!==this.radius2_&&(e*=2);const r=this.angle_-Math.PI/2,s=2*Math.PI/e;for(let o=0;o<e;o++){const e=r+o*s,a=o%2==0?i:n;t.lineTo(a*Math.cos(e),a*Math.sin(e))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=La,e.fill(),t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}}const rl=nl;class sl extends rl{constructor(t){super({points:1/0,fill:(t=t||{radius:5}).fill,radius:t.radius,stroke:t.stroke,scale:void 0!==t.scale?t.scale:1,rotation:void 0!==t.rotation?t.rotation:0,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,displacement:void 0!==t.displacement?t.displacement:[0,0],declutterMode:t.declutterMode})}clone(){const t=this.getScale(),e=new sl({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}}const ol=sl;class al{constructor(t){t=t||{},this.patternImage_=null,this.color_=null,void 0!==t.color&&this.setColor(t.color)}clone(){const t=this.getColor();return new al({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){if(null!==t&&"object"==typeof t&&"src"in t){const e=Aa(null,t.src,{crossOrigin:"anonymous"},void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));e.ready().then(()=>{this.patternImage_=null}),0===e.getImageState()&&e.load(),1===e.getImageState()&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?L(t):"object"==typeof t&&"src"in t?t.src+":"+t.offset:Qs(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}const ll=al;function hl(t,e,i,n){return void 0!==i&&void 0!==n?[i/t,n/e]:void 0!==i?i/t:void 0!==n?n/e:1}class ul extends il{constructor(t){const e=void 0!==(t=t||{}).opacity?t.opacity:1,i=void 0!==t.rotation?t.rotation:0,n=void 0!==t.scale?t.scale:1,r=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:i,scale:n,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:r,declutterMode:t.declutterMode}),this.anchor_=void 0!==t.anchor?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==t.anchorOrigin?t.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==t.anchorXUnits?t.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==t.anchorYUnits?t.anchorYUnits:"fraction",this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null,this.referrerPolicy_=t.referrerPolicy;const s=void 0!==t.img?t.img:null;let o,a=t.src;if(at(!(void 0!==a&&s),"`image` and `src` cannot be provided at the same time"),void 0!==a&&0!==a.length||!s||(a=s.src||L(s)),at(void 0!==a&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),at(!((void 0!==t.width||void 0!==t.height)&&void 0!==t.scale),"`width` or `height` cannot be provided together with `scale`"),void 0!==t.src?o=0:void 0!==s&&(o="complete"in s?s.complete?s.src?2:0:1:2),this.color_=void 0!==t.color?Qs(t.color):null,this.iconImage_=Aa(s,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},o,this.color_),this.offset_=void 0!==t.offset?t.offset:[0,0],this.offsetOrigin_=void 0!==t.offsetOrigin?t.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==t.size?t.size:null,this.initialOptions_,void 0!==t.width||void 0!==t.height){let e,i;if(t.size)[e,i]=t.size;else{const n=this.getImage(1);if(n.width&&n.height)e=n.width,i=n.height;else if(n instanceof HTMLImageElement){this.initialOptions_=t;const e=()=>{if(this.unlistenImageChange(e),!this.initialOptions_)return;const i=this.iconImage_.getSize();this.setScale(hl(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(hl(e,i,t.width,t.height))}}clone(){let t,e,i;return this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new ul({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:i,size:null!==this.size_?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const e=this.getSize();if("fraction"==this.anchorXUnits_||"fraction"==this.anchorYUnits_){if(!e)return null;t=this.anchor_.slice(),"fraction"==this.anchorXUnits_&&(t[0]*=e[0]),"fraction"==this.anchorYUnits_&&(t[1]*=e[1])}if("top-left"!=this.anchorOrigin_){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),"top-right"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[0]=-t[0]+e[0]),"bottom-left"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[1]=-t[1]+e[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(t){const e=t?Qs(t):null;if(this.color_===e||this.color_&&e&&this.color_.length===e.length&&this.color_.every((t,i)=>t===e[i]))return;this.color_=e;const i=this.getSrc(),n=void 0!==i?null:this.getHitDetectionImage(),r=void 0!==i?0:this.iconImage_.getImageState();this.iconImage_=Aa(n,i,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},r,this.color_)}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if("top-left"!=this.offsetOrigin_){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[0]=i[0]-e[0]-t[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(t){this.iconImage_=Aa(null,t,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},0,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();return this.size_?this.size_[0]*t[0]:2==this.iconImage_.getImageState()?this.iconImage_.getSize()[0]*t[0]:void 0}getHeight(){const t=this.getScaleArray();return this.size_?this.size_[1]*t[1]:2==this.iconImage_.getImageState()?this.iconImage_.getSize()[1]*t[1]:void 0}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(c,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(c,t)}ready(){return this.iconImage_.ready()}}const cl=ul;class dl{constructor(t){t=t||{},this.color_=void 0!==t.color?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=void 0!==t.lineDash?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.offset_=t.offset,this.width_=t.width}clone(){const t=this.getColor();return new dl({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),offset:this.getOffset(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setOffset(t){this.offset_=t}setWidth(t){this.width_=t}}const fl=dl;class pl{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=yl,void 0!==t.geometry&&this.setGeometry(t.geometry),this.fill_=void 0!==t.fill?t.fill:null,this.image_=void 0!==t.image?t.image:null,this.renderer_=void 0!==t.renderer?t.renderer:null,this.hitDetectionRenderer_=void 0!==t.hitDetectionRenderer?t.hitDetectionRenderer:null,this.stroke_=void 0!==t.stroke?t.stroke:null,this.text_=void 0!==t.text?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&"object"==typeof t&&(t=t.clone()),new pl({geometry:t??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=yl,this.geometry_=t}setZIndex(t){this.zIndex_=t}}let gl=null;function ml(t,e){if(!gl){const t=new ll({color:"rgba(255,255,255,0.4)"}),e=new fl({color:"#3399CC",width:1.25});gl=[new pl({image:new ol({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return gl}function yl(t){return t.getGeometry()}const _l=pl;class vl{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.keepUpright_=t.keepUpright,this.scale_=t.scale,this.scaleArray_=io(void 0!==t.scale?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.repeat_=t.repeat,this.textBaseline_=t.textBaseline,this.fill_=void 0!==t.fill?t.fill:new ll({color:"#333"}),this.maxAngle_=void 0!==t.maxAngle?t.maxAngle:Math.PI/4,this.placement_=void 0!==t.placement?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=void 0!==t.stroke?t.stroke:null,this.offsetX_=void 0!==t.offsetX?t.offsetX:0,this.offsetY_=void 0!==t.offsetY?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=void 0===t.padding?null:t.padding,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new vl({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof ll?this.getFill().clone():this.getFill(),stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setKeepUpright(t){this.keepUpright_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=io(void 0!==t?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}}const xl=vl;function wl(t){return!0}function bl(t){const e=vo(),i=function(t,e){const i=t.length,n=new Array(i);for(let r=0;r<i;++r){const i=t[r],s="filter"in i?Ma(i.filter,ro,e):wl;let o;if(Array.isArray(i.style)){const t=i.style.length;o=new Array(t);for(let n=0;n<t;++n)o[n]=Ml(i.style[n],e)}else o=[Ml(i.style,e)];n[r]={filter:s,styles:o}}return function(e){const r=[];let s=!1;for(let o=0;o<i;++o)if((0,n[o].filter)(e)&&(!t[o].else||!s)){s=!0;for(const t of n[o].styles){const i=t(e);i&&r.push(i)}}return r}}(t,e),n={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""};return function(t,r){if(n.properties=t.getPropertiesInternal(),n.resolution=r,e.featureId){const e=t.getId();n.featureId=void 0!==e?e:null}return e.geometryType&&(n.geometryType=Sa(t.getGeometry())),i(n)}}function Sl(t){const e=vo(),i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=Ml(t[r],e);const r={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""},s=new Array(i);return function(t,o){if(r.properties=t.getPropertiesInternal(),r.resolution=o,e.featureId){const e=t.getId();r.featureId=void 0!==e?e:null}let a=0;for(let t=0;t<i;++t){const e=n[t](r);e&&(s[a]=e,a+=1)}return s.length=a,s}}function Ml(t,e){const i=El(t,"",e),n=Cl(t,"",e),r=function(t,e){const i="text-",n=Tl(t,i+"value",e);if(!n)return null;const r=El(t,i,e),s=El(t,i+"background-",e),o=Cl(t,i,e),a=Cl(t,i+"background-",e),l=Tl(t,i+"font",e),h=Il(t,i+"max-angle",e),u=Il(t,i+"offset-x",e),c=Il(t,i+"offset-y",e),d=kl(t,i+"overflow",e),f=Tl(t,i+"placement",e),p=Il(t,i+"repeat",e),g=Fl(t,i+"scale",e),m=kl(t,i+"rotate-with-view",e),y=Il(t,i+"rotation",e),_=Tl(t,i+"align",e),v=Tl(t,i+"justify",e),x=Tl(t,i+"baseline",e),w=kl(t,i+"keep-upright",e),b=Al(t,i+"padding",e),S=Dl(t,i+"declutter-mode"),M=new xl({declutterMode:S});return function(t){if(M.setText(n(t)),r&&M.setFill(r(t)),s&&M.setBackgroundFill(s(t)),o&&M.setStroke(o(t)),a&&M.setBackgroundStroke(a(t)),l&&M.setFont(l(t)),h&&M.setMaxAngle(h(t)),u&&M.setOffsetX(u(t)),c&&M.setOffsetY(c(t)),d&&M.setOverflow(d(t)),f){const e=f(t);if("point"!==e&&"line"!==e)throw new Error("Expected point or line for text-placement");M.setPlacement(e)}if(p&&M.setRepeat(p(t)),g&&M.setScale(g(t)),m&&M.setRotateWithView(m(t)),y&&M.setRotation(y(t)),_){const e=_(t);if("left"!==e&&"center"!==e&&"right"!==e&&"end"!==e&&"start"!==e)throw new Error("Expected left, right, center, start, or end for text-align");M.setTextAlign(e)}if(v){const e=v(t);if("left"!==e&&"right"!==e&&"center"!==e)throw new Error("Expected left, right, or center for text-justify");M.setJustify(e)}if(x){const e=x(t);if("bottom"!==e&&"top"!==e&&"middle"!==e&&"alphabetic"!==e&&"hanging"!==e)throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");M.setTextBaseline(e)}return b&&M.setPadding(b(t)),w&&M.setKeepUpright(w(t)),M}}(t,e),s=function(t,e){return"icon-src"in t?function(t,e){const i="icon-",n=i+"src",r=ql(t[n],n),s=Gl(t,i+"anchor",e),o=Fl(t,i+"scale",e),a=Il(t,i+"opacity",e),l=Gl(t,i+"displacement",e),h=Il(t,i+"rotation",e),u=kl(t,i+"rotate-with-view",e),c=jl(t,i+"anchor-origin"),d=Nl(t,i+"anchor-x-units"),f=Nl(t,i+"anchor-y-units"),p=Pl(t,i+"color");let g,m=null;void 0!==p&&(Array.isArray(p)&&p.length>0&&"string"==typeof p[0]?m=Rl(t,i+"color",e):g=Bl(p,i+"color"));const y=function(t,e){const i=t[e];if(void 0!==i){if("string"!=typeof i)throw new Error(`Expected a string for ${e}`);return i}}(t,i+"cross-origin"),_=function(t,e){const i=t[e];if(void 0!==i)return zl(i,e)}(t,i+"offset"),v=jl(t,i+"offset-origin"),x=Ll(t,i+"width"),w=Ll(t,i+"height"),b=function(t,e){const i=t[e];if(void 0!==i){if("number"==typeof i)return io(i);if(!Array.isArray(i))throw new Error(`Expected a number or size array for ${e}`);if(2!==i.length||"number"!=typeof i[0]||"number"!=typeof i[1])throw new Error(`Expected a number or size array for ${e}`);return i}}(t,i+"size"),S={src:r,anchorOrigin:c,anchorXUnits:d,anchorYUnits:f,crossOrigin:y,offset:_,offsetOrigin:v,height:w,width:x,size:b,declutterMode:Dl(t,i+"declutter-mode")};let M=null;return function(t){if(M)m&&M.setColor(m(t));else{const e=m?m(t):g;M=new cl(void 0!==e?Object.assign({},S,{color:e}):Object.assign({},S))}return a&&M.setOpacity(a(t)),l&&M.setDisplacement(l(t)),h&&M.setRotation(h(t)),u&&M.setRotateWithView(u(t)),o&&M.setScale(o(t)),s&&M.setAnchor(s(t)),M}}(t,e):"shape-points"in t?function(t,e){const i="shape-",n=i+"points",r=i+"radius",s=$l(t[n],n);if(!(r in t))throw new Error(`Expected a number for ${r}`);const o=Il(t,r,e),a="number"==typeof t[r]?t[r]:5,l=i+"radius2",h=Il(t,l,e),u="number"==typeof t[l]?t[l]:void 0,c=El(t,i,e),d=Cl(t,i,e),f=Fl(t,i+"scale",e),p=Gl(t,i+"displacement",e),g=Il(t,i+"rotation",e),m=kl(t,i+"rotate-with-view",e),y=Ll(t,i+"angle"),_=Dl(t,i+"declutter-mode"),v=new rl({points:s,radius:a,radius2:u,angle:y,declutterMode:_});return function(t){return o&&v.setRadius(o(t)),h&&v.setRadius2(h(t)),c&&v.setFill(c(t)),d&&v.setStroke(d(t)),p&&v.setDisplacement(p(t)),g&&v.setRotation(g(t)),m&&v.setRotateWithView(m(t)),f&&v.setScale(f(t)),v}}(t,e):"circle-radius"in t?function(t,e){const i="circle-",n=El(t,i,e),r=Cl(t,i,e),s=Il(t,i+"radius",e),o=Fl(t,i+"scale",e),a=Gl(t,i+"displacement",e),l=Il(t,i+"rotation",e),h=kl(t,i+"rotate-with-view",e),u=Dl(t,i+"declutter-mode"),c=new ol({radius:5,declutterMode:u});return function(t){return s&&c.setRadius(s(t)),n&&c.setFill(n(t)),r&&c.setStroke(r(t)),a&&c.setDisplacement(a(t)),l&&c.setRotation(l(t)),h&&c.setRotateWithView(h(t)),o&&c.setScale(o(t)),c}}(t,e):null}(t,e),o=Il(t,"z-index",e);if(!(i||n||r||s||a(t)))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(t));const l=new _l;return function(t){let e=!0;if(i){const n=i(t);n&&(e=!1),l.setFill(n)}if(n){const i=n(t);i&&(e=!1),l.setStroke(i)}if(r){const i=r(t);i&&(e=!1),l.setText(i)}if(s){const i=s(t);i&&(e=!1),l.setImage(i)}return o&&l.setZIndex(o(t)),e?null:l}}function El(t,e,i){let n;if(e+"fill-pattern-src"in t)n=function(t,e,i){const n=Tl(t,e+"pattern-src",i),r=Ol(t,e+"pattern-offset",i),s=Ol(t,e+"pattern-size",i),o=Rl(t,e+"color",i);return function(t){return{src:n(t),offset:r&&r(t),size:s&&s(t),color:o&&o(t)}}}(t,e+"fill-",i);else{if("none"===t[e+"fill-color"])return t=>null;n=Rl(t,e+"fill-color",i)}if(!n)return null;const r=new ll;return function(t){const e=n(t);return e===Fs?null:(r.setColor(e),r)}}function Cl(t,e,i){const n=Il(t,e+"stroke-width",i),r=Rl(t,e+"stroke-color",i);if(!n&&!r)return null;const s=Tl(t,e+"stroke-line-cap",i),o=Tl(t,e+"stroke-line-join",i),a=Al(t,e+"stroke-line-dash",i),l=Il(t,e+"stroke-line-dash-offset",i),h=Il(t,e+"stroke-miter-limit",i),u=Il(t,e+"stroke-offset",i),c=new fl;return function(t){if(r){const e=r(t);if(e===Fs)return null;c.setColor(e)}if(n&&c.setWidth(n(t)),s){const e=s(t);if("butt"!==e&&"round"!==e&&"square"!==e)throw new Error("Expected butt, round, or square line cap");c.setLineCap(e)}if(o){const e=o(t);if("bevel"!==e&&"round"!==e&&"miter"!==e)throw new Error("Expected bevel, round, or miter line join");c.setLineJoin(e)}return a&&c.setLineDash(a(t)),l&&c.setLineDashOffset(l(t)),h&&c.setMiterLimit(h(t)),u&&c.setOffset(u(t)),c}}function Pl(t,e){if(!(e in t))return;const i=t[e];return void 0===i?void 0:i}function Il(t,e,i){const n=Pl(t,e);if(void 0===n)return;const r=Ma(n,so,i);return function(t){return $l(r(t),e)}}function Tl(t,e,i){const n=Pl(t,e);if(void 0===n)return null;const r=Ma(n,oo,i);return function(t){return ql(r(t),e)}}function kl(t,e,i){const n=Pl(t,e);if(void 0===n)return null;const r=Ma(n,ro,i);return function(t){const i=r(t);if("boolean"!=typeof i)throw new Error(`Expected a boolean for ${e}`);return i}}function Rl(t,e,i){const n=Pl(t,e);if(void 0===n)return null;const r=Ma(n,ao,i);return function(t){return Bl(r(t),e)}}function Al(t,e,i){const n=Pl(t,e);if(void 0===n)return null;if(Array.isArray(n)&&(0===n.length||"string"!=typeof n[0])){const t=n.map((t,n)=>{if("number"==typeof t)return()=>t;const r=Ma(t,so,i);return function(t){return $l(r(t),`${e}[${n}]`)}});return function(e){const i=new Array(t.length);for(let n=0;n<t.length;++n)i[n]=t[n](e);return i}}const r=Ma(n,lo,i);return function(t){return zl(r(t),e)}}function Gl(t,e,i){const n=Pl(t,e);if(void 0===n)return null;const r=Ma(n,lo,i);return function(t){const i=zl(r(t),e);if(2!==i.length)throw new Error(`Expected two numbers for ${e}`);return i}}function Ol(t,e,i){const n=Pl(t,e);if(void 0===n)return null;const r=Ma(n,lo,i);return function(t){return Ul(r(t),e)}}function Fl(t,e,i){const n=Pl(t,e);if(void 0===n)return null;const r=Ma(n,lo|so,i);return function(t){return i=r(t),n=e,"number"==typeof i?i:Ul(i,n);var i,n}}function Ll(t,e){const i=t[e];if(void 0!==i){if("number"!=typeof i)throw new Error(`Expected a number for ${e}`);return i}}function jl(t,e){const i=t[e];if(void 0!==i){if("bottom-left"!==i&&"bottom-right"!==i&&"top-left"!==i&&"top-right"!==i)throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return i}}function Nl(t,e){const i=t[e];if(void 0!==i){if("pixels"!==i&&"fraction"!==i)throw new Error(`Expected pixels or fraction for ${e}`);return i}}function Dl(t,e){const i=t[e];if(void 0!==i){if("string"!=typeof i)throw new Error(`Expected a string for ${e}`);if("declutter"!==i&&"obstacle"!==i&&"none"!==i)throw new Error(`Expected declutter, obstacle, or none for ${e}`);return i}}function zl(t,e){if(!Array.isArray(t))throw new Error(`Expected an array for ${e}`);const i=t.length;for(let n=0;n<i;++n)if("number"!=typeof t[n])throw new Error(`Expected an array of numbers for ${e}`);return t}function ql(t,e){if("string"!=typeof t)throw new Error(`Expected a string for ${e}`);return t}function $l(t,e){if("number"!=typeof t)throw new Error(`Expected a number for ${e}`);return t}function Bl(t,e){if("string"==typeof t)return t;const i=zl(t,e),n=i.length;if(n<3||n>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return i}function Ul(t,e){const i=zl(t,e);if(2!==i.length)throw new Error(`Expected an array of two numbers for ${e}`);return i}const Wl="renderOrder",Xl=class extends ms{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=t.declutter?String(t.declutter):void 0,this.renderBuffer_=void 0!==t.renderBuffer?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=void 0!==t.updateWhileAnimating&&t.updateWhileAnimating,this.updateWhileInteracting_=void 0!==t.updateWhileInteracting&&t.updateWhileInteracting}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(Wl)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const i=this.getDeclutter();i in t.declutter==0&&(t.declutter[i]=new xs(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(Wl,t)}setStyle(t){this.style_=void 0===t?ml:t;const e=function(t){if(void 0===t)return ml;if(!t)return null;if("function"==typeof t)return t;if(t instanceof _l)return t;if(!Array.isArray(t))return Sl([t]);if(0===t.length)return[];const e=t.length,i=t[0];if(i instanceof _l){const i=new Array(e);for(let n=0;n<e;++n){const e=t[n];if(!(e instanceof _l))throw new Error("Expected a list of style instances");i[n]=e}return i}if("style"in i){const i=new Array(e);for(let n=0;n<e;++n){const e=t[n];if(!("style"in e))throw new Error("Expected a list of rules with a style property");i[n]=e}return bl(i)}return Sl(t)}(t);this.styleFunction_=null===t?void 0:function(t){let e;if("function"==typeof t)e=t;else{let i;Array.isArray(t)?i=t:(at("function"==typeof t.getZIndex,"Expected an `Style` or an array of `Style`"),i=[t]),e=function(){return i}}return e}(e),this.changed()}setDeclutter(t){this.declutter_=t?String(t):void 0,this.changed()}},Vl=class extends k{constructor(t,e,i,n){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=n}};function Kl(t,e){Ta.expire()}const Zl=class extends _{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){O()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,n=t.pixelToCoordinateTransform;$i(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),Bi(n,i)}forEachFeatureAtCoordinate(t,e,i,n,r,s,o,a){let l;const h=e.viewState;function u(t,e,i,n){return r.call(s,e,t?i:null,n)}const c=h.projection,d=ae(t.slice(),c),f=[[0,0]];if(c.canWrapX()&&n){const t=te(c.getExtent());f.push([-t,0],[t,0])}const p=e.layerStatesArray,g=p.length,m=[],y=[];for(let n=0;n<f.length;n++)for(let r=g-1;r>=0;--r){const s=p[r],c=s.layer;if(c.hasRenderer()&&gs(s,h)&&o.call(a,c)){const r=c.getRenderer(),o=c.getSource();if(r&&o){const a=o.getWrapX()?d:t,h=u.bind(null,s.managed);y[0]=a[0]+f[n][0],y[1]=a[1]+f[n][1],l=r.forEachFeatureAtCoordinate(y,e,i,h,m)}if(l)return l}}if(0===m.length)return;const _=1/m.length;return m.forEach((t,e)=>t.distanceSq+=e*_),m.sort((t,e)=>t.distanceSq-e.distanceSq),m.some(t=>l=t.callback(t.feature,t.layer,t.geometry)),l}hasFeatureAtCoordinate(t,e,i,n,r,s){return void 0!==this.forEachFeatureAtCoordinate(t,e,i,n,E,this,r,s)}getMap(){return this.map_}renderFrame(t){O()}scheduleExpireIconCache(t){Ta.canExpireCache()&&t.postRenderFunctions.push(Kl)}},Yl=class extends Zl{constructor(t){super(t),this.fontChangeListenerKey_=l(Ua,s,t.redrawText,t),this.element_=Z?ur():document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=Jn+" ol-layers";const i=t.getViewport();i&&i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const n=new Vl(t,void 0,e);i.dispatchEvent(n)}}disposeInternal(){u(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(t){if(!t)return void(this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1));this.calculateMatrices2D(t),this.dispatchRenderEvent(fs,t);const e=t.layerStatesArray.sort((t,e)=>t.zIndex-e.zIndex);e.some(t=>t.layer instanceof Xl&&t.layer.getDeclutter())&&(t.declutter={});const i=t.viewState;this.children_.length=0;const n=[];let r=null;for(let s=0,o=e.length;s<o;++s){const o=e[s];t.layerIndex=s;const a=o.layer,l=a.getSourceState();if(!gs(o,i)||"ready"!=l&&"undefined"!=l){a.unrender();continue}const h=a.render(t,r);h&&(h!==r&&(this.children_.push(h),r=h),n.push(o))}this.declutter(t,n),function(t,e){const i=t.childNodes;for(let n=0;;++n){const r=i[n],s=e[n];if(!r&&!s)break;r!==s&&(r?s?t.insertBefore(s,r):(t.removeChild(r),--n):t.appendChild(s))}}(this.element_,this.children_);const s=this.getMap().getTargetElement();if(cr(s)){const t=s.getContext("2d");for(const e of this.children_){const i=e.firstElementChild||e,n=e.style.backgroundColor;if(n&&(!cr(i)||i.width>0)&&(t.fillStyle=n,t.fillRect(0,0,s.width,s.height)),cr(i)&&i.width>0){t.save();const n=e.style.opacity||i.style.opacity;t.globalAlpha=""===n?1:Number(n);const r=i.style.transform;if(r)t.transform(...Wi(r));else{const e=parseFloat(i.style.width)/i.width,n=parseFloat(i.style.height)/i.height;t.transform(e,0,0,n,0,0)}t.drawImage(i,0,0),t.restore()}}}this.dispatchRenderEvent("postcompose",t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){if(t.declutter){for(let i=e.length-1;i>=0;--i){const n=e[i],r=n.layer;r.getDeclutter()&&r.renderDeclutter(t,n)}e.forEach(e=>e.layer.renderDeferred(t))}}};function Hl(t){t instanceof ms?t.setMapInternal(null):t instanceof us&&t.getLayers().forEach(Hl)}function Jl(t,e){if(t instanceof ms)t.setMapInternal(e);else if(t instanceof us){const i=t.getLayers().getArray();for(let t=0,n=i.length;t<n;++t)Jl(i[t],e)}}const Ql=class extends N{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=function(t){let e=null;void 0!==t.keyboardEventTarget&&(e="string"==typeof t.keyboardEventTarget?document.getElementById(t.keyboardEventTarget):t.keyboardEventTarget);const i={},n=t.layers&&"function"==typeof t.layers.getLayers?t.layers:new us({layers:t.layers});let r,s,o;return i[nt]=n,i[st]=t.target,i[ot]=t.view instanceof Yn?t.view:new Yn,void 0!==t.controls&&(Array.isArray(t.controls)?r=new q(t.controls.slice()):(at("function"==typeof t.controls.getArray,"Expected `controls` to be an array or an `ol/Collection.js`"),r=t.controls)),void 0!==t.interactions&&(Array.isArray(t.interactions)?s=new q(t.interactions.slice()):(at("function"==typeof t.interactions.getArray,"Expected `interactions` to be an array or an `ol/Collection.js`"),s=t.interactions)),void 0!==t.overlays?Array.isArray(t.overlays)?o=new q(t.overlays.slice()):(at("function"==typeof t.overlays.getArray,"Expected `overlays` to be an array or an `ol/Collection.js`"),o=t.overlays):o=new q,{controls:r,interactions:s,keyboardEventTarget:e,overlays:o,values:i}}(t);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=void 0!==t.maxTilesLoading?t.maxTilesLoading:16,this.pixelRatio_=void 0!==t.pixelRatio?t.pixelRatio:K,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=[1,0,0,1,0,0],this.pixelToCoordinateTransform_=[1,0,0,1,0,0],this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,Z||(this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_)),this.mapBrowserEventHandler_=null,this.moveTolerance_=t.moveTolerance,this.keyboardEventTarget_=e.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,Z||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=e.controls||(Z?new q:function(t){t=t||{};const e=new q;return(void 0===t.zoom||t.zoom)&&e.push(new gr(t.zoomOptions)),(void 0===t.rotate||t.rotate)&&e.push(new pr(t.rotateOptions)),(void 0===t.attribution||t.attribution)&&e.push(new fr(t.attributionOptions)),e}()),this.interactions=e.interactions||(Z?new q:Kr({onFocusOnly:!0})),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new ut(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(nt,this.handleLayerGroupChanged_),this.addChangeListener(ot,this.handleViewChanged_),this.addChangeListener(rt,this.handleSizeChanged_),this.addChangeListener(st,this.handleTargetChanged_),this.setProperties(e.values);const i=this;!t.view||t.view instanceof Yn||t.view.then(function(t){i.setView(new Yn(t))}),this.controls.addEventListener(n,t=>{t.element.setMap(this)}),this.controls.addEventListener(r,t=>{t.element.setMap(null)}),this.interactions.addEventListener(n,t=>{t.element.setMap(this)}),this.interactions.addEventListener(r,t=>{t.element.setMap(null)}),this.overlays_.addEventListener(n,t=>{this.addOverlayInternal_(t.element)}),this.overlays_.addEventListener(r,t=>{const e=t.element.getId();void 0!==e&&delete this.overlayIdIndex_[e.toString()],t.element.setMap(null)}),this.controls.forEach(t=>{t.setMap(this)}),this.interactions.forEach(t=>{t.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){Jl(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();void 0!==e&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const n=this.getCoordinateFromPixelInternal(t),r=void 0!==(i=void 0!==i?i:{}).hitTolerance?i.hitTolerance:0,s=void 0!==i.layerFilter?i.layerFilter:E,o=!1!==i.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(n,this.frameState_,r,o,e,null,s,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,function(t){i.push(t)},e),i}getAllLayers(){const t=[];return function e(i){i.forEach(function(i){i instanceof us?e(i.getLayers()):t.push(i)})}(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t),n=void 0!==(e=void 0!==e?e:{}).layerFilter?e.layerFilter:E,r=void 0!==e.hitTolerance?e.hitTolerance:0,s=!1!==e.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,r,s,n,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const e=this.viewport_.getBoundingClientRect(),i=this.getSize(),n=e.width/i[0],r=e.height/i[1],s="changedTouches"in t?t.changedTouches[0]:t;return[(s.clientX-e.left)/n,(s.clientY-e.top)/r]}getTarget(){return this.get(st)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return Pi(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?zi(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return void 0!==e?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(nt)}setLayers(t){const e=this.getLayerGroup();if(t instanceof q)return void e.setLayers(t);const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e<i;++e){const i=t[e];if(!i.visible)continue;const n=i.layer.getRenderer();if(n&&!n.ready)return!0;const r=i.layer.getSource();if(r&&r.loading)return!0}return!1}getPixelFromCoordinate(t){const e=Ii(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?zi(e.coordinateToPixelTransform,t.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(t){this.pixelRatio_!==t&&(this.pixelRatio_=t,this.render())}getRenderer(){return this.renderer_}getSize(){return this.get(rt)}getView(){return this.get(ot)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,i,n){return function(t,e,i,n,r){if(!t||!(i in t.wantedTiles))return lt;if(!t.wantedTiles[i][e.getKey()])return lt;const s=t.viewState.center,o=n[0]-s[0],a=n[1]-s[1];return 65536*Math.log(r)+Math.sqrt(o*o+a*a)/r}(this.frameState_,t,e,i,n)}handleBrowserEvent(t,e){e=e||t.type;const i=new B(e,this,t);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,i=e.type;if(i===J||i===y||i===p){const t=this.getOwnerDocument(),i=this.viewport_.getRootNode?this.viewport_.getRootNode():t,n=e.target,r=i instanceof ShadowRoot?i.host===n?i.host.ownerDocument:i:i===t?t.documentElement:i;if(this.overlayContainerStopEvent_.contains(n)||!r.contains(n))return}if(t.frameState=this.frameState_,!1!==this.dispatchEvent(t)){const e=this.getInteractions().getArray().slice();for(let i=e.length-1;i>=0;i--){const n=e[i];if(n.getMap()===this&&n.getActive()&&this.getTargetElement()&&(!n.handleEvent(t)||t.propagationStopped))break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let i=this.maxTilesLoading_,n=i;const r=t?t.viewHints:void 0,s=!!r&&(r[0]||r[1]);if(s){const e=Date.now()-t.time>8;i=e?0:8,n=e?0:2}e.getTilesLoading()<i&&(s&&e.reprioritize(),e.loadMoreTiles(i,n))}t&&this.renderer_&&!t.animate&&(this.renderComplete_?(this.hasListener(ps)&&this.renderer_.dispatchRenderEvent(ps,t),!1===this.loaded_&&(this.loaded_=!0,this.dispatchEvent(new $(it,this,t)))):!0===this.loaded_&&(this.loaded_=!1,this.dispatchEvent(new $(et,this,t))));const i=this.postRenderFunctions_;if(t)for(let e=0,n=i.length;e<n;++e)i[e](this,t);i.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let t=0,e=this.targetChangeHandlerKeys_.length;t<e;++t)u(this.targetChangeHandlerKeys_[t]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(d,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(y,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!cr(this.targetElement_)){this.resizeObserver_?.unobserve(this.targetElement_);const t=this.targetElement_.getRootNode();t instanceof ShadowRoot&&this.resizeObserver_.unobserve(t.host),this.setSize(void 0)}const t=this.getTarget(),e="string"==typeof t?document.getElementById(t):t;if(this.targetElement_=e,e){if(cr(e)||e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new Yl(this)),!cr(e)){this.mapBrowserEventHandler_=new Q(this,this.moveTolerance_);for(const t in U)this.mapBrowserEventHandler_.addEventListener(U[t],this.handleMapBrowserEvent.bind(this));let t;if(this.viewport_.addEventListener(d,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(y,this.boundHandleBrowserEvent_,!!H&&{passive:!1}),this.keyboardEventTarget_)t=this.keyboardEventTarget_;else{const i=e.getRootNode();t=i instanceof ShadowRoot?i.host:e}if(this.targetChangeHandlerKeys_=[l(t,p,this.handleBrowserEvent,this),l(t,g,this.handleBrowserEvent,this)],e instanceof HTMLElement){const t=e.getRootNode();t instanceof ShadowRoot&&this.resizeObserver_.observe(t.host),this.resizeObserver_?.observe(e)}}this.updateSize()}else this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0)}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(u(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(u(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=l(t,s,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=l(t,c,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(u),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new as("addlayer",t)),this.layerGroupPropertyListenerKeys_=[l(t,s,this.render,this),l(t,c,this.render,this),l(t,"addlayer",this.handleLayerAdd_,this),l(t,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;const t=this.frameState_.layerStatesArray;for(let e=0,i=t.length;e<i;++e){const i=t[e].layer;i.hasRenderer()&&i.getRenderer().handleFontsChanged()}}render(){this.renderer_&&void 0===this.animationDelayKey_&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){return this.getLayerGroup().getLayers().remove(t)}handleLayerRemove_(t){Hl(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),i=this.getView(),n=this.frameState_;let r=null;if(void 0!==e&&eo(e)&&i&&i.isDef()){const n=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),s=i.getState();if(r={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:Kt(s.center,s.resolution,s.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:s,viewHints:n,wantedTiles:{},mapId:L(this),renderTargets:{}},s.nextCenter&&s.nextResolution){const t=isNaN(s.nextRotation)?s.rotation:s.nextRotation;r.nextExtent=Kt(s.nextCenter,s.nextResolution,t,e)}}this.frameState_=r,this.renderer_.renderFrame(r),r&&(r.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,r.postRenderFunctions),n&&(!this.previousExtent_||!ie(this.previousExtent_)&&!jt(r.extent,this.previousExtent_))&&(this.dispatchEvent(new $("movestart",this,n)),this.previousExtent_=Ot(this.previousExtent_)),this.previousExtent_&&!r.viewHints[0]&&!r.viewHints[1]&&!jt(r.extent,this.previousExtent_)&&(this.dispatchEvent(new $("moveend",this,r)),Pt(r.extent,this.previousExtent_))),this.dispatchEvent(new $(tt,this,r)),this.renderComplete_=(this.hasListener(et)||this.hasListener(it)||this.hasListener(ps))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new as("removelayer",e)),this.set(nt,t)}setSize(t){this.set(rt,t)}setTarget(t){this.set(st,t)}setView(t){if(!t||t instanceof Yn)return void this.set(ot,t);this.set(ot,new Yn);const e=this;t.then(function(t){e.setView(new Yn(t))})}updateSize(){const t=this.getTargetElement();let e;if(t){let i,n;if(cr(t)){const e=t.getContext("2d").getTransform();i=t.width/e.a,n=t.height/e.d}else{const e=getComputedStyle(t);i=t.offsetWidth-parseFloat(e.borderLeftWidth)-parseFloat(e.paddingLeft)-parseFloat(e.paddingRight)-parseFloat(e.borderRightWidth),n=t.offsetHeight-parseFloat(e.borderTopWidth)-parseFloat(e.paddingTop)-parseFloat(e.paddingBottom)-parseFloat(e.borderBottomWidth)}isNaN(i)||isNaN(n)||(e=[Math.max(0,i),Math.max(0,n)],!eo(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&me("No map visible because the map container's width or height are 0."))}const i=this.getSize();!e||i&&M(e,i)||(this.updateViewportSize_(e),this.setSize(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}};var th=6378137,eh=.0066943799901413165,ih=484813681109536e-20,nh=Math.PI/2,rh=1e-10,sh=.017453292519943295,oh=57.29577951308232,ah=Math.PI/4,lh=2*Math.PI,hh=3.14159265359;const uh={greenwich:0,lisbon:-9.131906111111,paris:2.337229166667,bogota:-74.080916666667,madrid:-3.687938888889,rome:12.452333333333,bern:7.439583333333,jakarta:106.807719444444,ferro:-17.666666666667,brussels:4.367975,stockholm:18.058277777778,athens:23.7163375,oslo:10.722916666667},ch={mm:{to_meter:.001},cm:{to_meter:.01},ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937},fath:{to_meter:1.8288},kmi:{to_meter:1852},"us-ch":{to_meter:20.1168402336805},"us-mi":{to_meter:1609.34721869444},km:{to_meter:1e3},"ind-ft":{to_meter:.30479841},"ind-yd":{to_meter:.91439523},mi:{to_meter:1609.344},yd:{to_meter:.9144},ch:{to_meter:20.1168},link:{to_meter:.201168},dm:{to_meter:.1},in:{to_meter:.0254},"ind-ch":{to_meter:20.11669506},"us-in":{to_meter:.025400050800101},"us-yd":{to_meter:.914401828803658}};var dh=/[\s_\-\/\(\)]/g;function fh(t,e){if(t[e])return t[e];for(var i,n=Object.keys(t),r=e.toLowerCase().replace(dh,""),s=-1;++s<n.length;)if((i=n[s]).toLowerCase().replace(dh,"")===r)return t[i]}function ph(t){var e,i,n,r={},s=t.split("+").map(function(t){return t.trim()}).filter(function(t){return t}).reduce(function(t,e){var i=e.split("=");return i.push(!0),t[i[0].toLowerCase()]=i[1],t},{}),o={proj:"projName",datum:"datumCode",rf:function(t){r.rf=parseFloat(t)},lat_0:function(t){r.lat0=t*sh},lat_1:function(t){r.lat1=t*sh},lat_2:function(t){r.lat2=t*sh},lat_ts:function(t){r.lat_ts=t*sh},lon_0:function(t){r.long0=t*sh},lon_1:function(t){r.long1=t*sh},lon_2:function(t){r.long2=t*sh},alpha:function(t){r.alpha=parseFloat(t)*sh},gamma:function(t){r.rectified_grid_angle=parseFloat(t)*sh},lonc:function(t){r.longc=t*sh},x_0:function(t){r.x0=parseFloat(t)},y_0:function(t){r.y0=parseFloat(t)},k_0:function(t){r.k0=parseFloat(t)},k:function(t){r.k0=parseFloat(t)},a:function(t){r.a=parseFloat(t)},b:function(t){r.b=parseFloat(t)},r:function(t){r.a=r.b=parseFloat(t)},r_a:function(){r.R_A=!0},zone:function(t){r.zone=parseInt(t,10)},south:function(){r.utmSouth=!0},towgs84:function(t){r.datum_params=t.split(",").map(function(t){return parseFloat(t)})},to_meter:function(t){r.to_meter=parseFloat(t)},units:function(t){r.units=t;var e=fh(ch,t);e&&(r.to_meter=e.to_meter)},from_greenwich:function(t){r.from_greenwich=t*sh},pm:function(t){var e=fh(uh,t);r.from_greenwich=(e||parseFloat(t))*sh},nadgrids:function(t){"@null"===t?r.datumCode="none":r.nadgrids=t},axis:function(t){var e="ewnsud";3===t.length&&-1!==e.indexOf(t.substr(0,1))&&-1!==e.indexOf(t.substr(1,1))&&-1!==e.indexOf(t.substr(2,1))&&(r.axis=t)},approx:function(){r.approx=!0},over:function(){r.over=!0}};for(e in s)i=s[e],e in o?"function"==typeof(n=o[e])?n(i):r[n]=i:r[e]=i;return"string"==typeof r.datumCode&&"WGS84"!==r.datumCode&&(r.datumCode=r.datumCode.toLowerCase()),r.projStr=t,r}const gh=class{static getId(t){const e=t.find(t=>Array.isArray(t)&&"ID"===t[0]);return e&&e.length>=3?{authority:e[1],code:parseInt(e[2],10)}:null}static convertUnit(t,e="unit"){if(!t||t.length<3)return{type:e,name:"unknown",conversion_factor:null};const i=t[1],n=parseFloat(t[2])||null,r=t.find(t=>Array.isArray(t)&&"ID"===t[0]);return{type:e,name:i,conversion_factor:n,id:r?{authority:r[1],code:parseInt(r[2],10)}:null}}static convertAxis(t){const e=t[1]||"Unknown";let i;const n=e.match(/^\((.)\)$/);if(n){const e=n[1].toUpperCase();if("E"===e)i="east";else if("N"===e)i="north";else if("U"===e)i="up";else{if(!t[2])throw new Error(`Unknown axis abbreviation: ${e}`);i=t[2]}}else i=t[2]||"unknown";const r=t.find(t=>Array.isArray(t)&&"ORDER"===t[0]),s=r?parseInt(r[1],10):null,o=t.find(t=>Array.isArray(t)&&("LENGTHUNIT"===t[0]||"ANGLEUNIT"===t[0]||"SCALEUNIT"===t[0]));return{name:e,direction:i,unit:this.convertUnit(o),order:s}}static extractAxes(t){return t.filter(t=>Array.isArray(t)&&"AXIS"===t[0]).map(t=>this.convertAxis(t)).sort((t,e)=>(t.order||0)-(e.order||0))}static convert(t,e={}){switch(t[0]){case"PROJCRS":e.type="ProjectedCRS",e.name=t[1],e.base_crs=t.find(t=>Array.isArray(t)&&"BASEGEOGCRS"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"BASEGEOGCRS"===t[0])):null,e.conversion=t.find(t=>Array.isArray(t)&&"CONVERSION"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"CONVERSION"===t[0])):null;const i=t.find(t=>Array.isArray(t)&&"CS"===t[0]);i&&(e.coordinate_system={type:i[1],axis:this.extractAxes(t)});const n=t.find(t=>Array.isArray(t)&&"LENGTHUNIT"===t[0]);if(n){const t=this.convertUnit(n);e.coordinate_system.unit=t}e.id=this.getId(t);break;case"BASEGEOGCRS":case"GEOGCRS":case"GEODCRS":e.type="GEODCRS"===t[0]?"GeodeticCRS":"GeographicCRS",e.name=t[1];const r=t.find(t=>Array.isArray(t)&&("DATUM"===t[0]||"ENSEMBLE"===t[0]));if(r){const i=this.convert(r);"ENSEMBLE"===r[0]?e.datum_ensemble=i:e.datum=i;const n=t.find(t=>Array.isArray(t)&&"PRIMEM"===t[0]);n&&"Greenwich"!==n[1]&&(i.prime_meridian={name:n[1],longitude:parseFloat(n[2])})}e.coordinate_system={type:"ellipsoidal",axis:this.extractAxes(t)},e.id=this.getId(t);break;case"DATUM":e.type="GeodeticReferenceFrame",e.name=t[1],e.ellipsoid=t.find(t=>Array.isArray(t)&&"ELLIPSOID"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"ELLIPSOID"===t[0])):null;break;case"ENSEMBLE":e.type="DatumEnsemble",e.name=t[1],e.members=t.filter(t=>Array.isArray(t)&&"MEMBER"===t[0]).map(t=>({type:"DatumEnsembleMember",name:t[1],id:this.getId(t)}));const s=t.find(t=>Array.isArray(t)&&"ENSEMBLEACCURACY"===t[0]);s&&(e.accuracy=parseFloat(s[1]));const o=t.find(t=>Array.isArray(t)&&"ELLIPSOID"===t[0]);o&&(e.ellipsoid=this.convert(o)),e.id=this.getId(t);break;case"ELLIPSOID":e.type="Ellipsoid",e.name=t[1],e.semi_major_axis=parseFloat(t[2]),e.inverse_flattening=parseFloat(t[3]),t.find(t=>Array.isArray(t)&&"LENGTHUNIT"===t[0])&&this.convert(t.find(t=>Array.isArray(t)&&"LENGTHUNIT"===t[0]),e);break;case"CONVERSION":e.type="Conversion",e.name=t[1],e.method=t.find(t=>Array.isArray(t)&&"METHOD"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"METHOD"===t[0])):null,e.parameters=t.filter(t=>Array.isArray(t)&&"PARAMETER"===t[0]).map(t=>this.convert(t));break;case"METHOD":e.type="Method",e.name=t[1],e.id=this.getId(t);break;case"PARAMETER":e.type="Parameter",e.name=t[1],e.value=parseFloat(t[2]),e.unit=this.convertUnit(t.find(t=>Array.isArray(t)&&("LENGTHUNIT"===t[0]||"ANGLEUNIT"===t[0]||"SCALEUNIT"===t[0]))),e.id=this.getId(t);break;case"BOUNDCRS":e.type="BoundCRS";const a=t.find(t=>Array.isArray(t)&&"SOURCECRS"===t[0]);if(a){const t=a.find(t=>Array.isArray(t));e.source_crs=t?this.convert(t):null}const l=t.find(t=>Array.isArray(t)&&"TARGETCRS"===t[0]);if(l){const t=l.find(t=>Array.isArray(t));e.target_crs=t?this.convert(t):null}const h=t.find(t=>Array.isArray(t)&&"ABRIDGEDTRANSFORMATION"===t[0]);e.transformation=h?this.convert(h):null;break;case"ABRIDGEDTRANSFORMATION":if(e.type="Transformation",e.name=t[1],e.method=t.find(t=>Array.isArray(t)&&"METHOD"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"METHOD"===t[0])):null,e.parameters=t.filter(t=>Array.isArray(t)&&("PARAMETER"===t[0]||"PARAMETERFILE"===t[0])).map(t=>"PARAMETER"===t[0]?this.convert(t):"PARAMETERFILE"===t[0]?{name:t[1],value:t[2],id:{authority:"EPSG",code:8656}}:void 0),7===e.parameters.length){const t=e.parameters[6];"Scale difference"===t.name&&(t.value=Math.round(1e12*(t.value-1))/1e6)}e.id=this.getId(t);break;case"AXIS":e.coordinate_system||(e.coordinate_system={type:"unspecified",axis:[]}),e.coordinate_system.axis.push(this.convertAxis(t));break;case"LENGTHUNIT":const u=this.convertUnit(t,"LinearUnit");e.coordinate_system&&e.coordinate_system.axis&&e.coordinate_system.axis.forEach(t=>{t.unit||(t.unit=u)}),u.conversion_factor&&1!==u.conversion_factor&&e.semi_major_axis&&(e.semi_major_axis={value:e.semi_major_axis,unit:u});break;default:e.keyword=t[0]}return e}},mh=class extends gh{static convert(t,e={}){return super.convert(t,e),e.coordinate_system&&"Cartesian"===e.coordinate_system.subtype&&delete e.coordinate_system,e.usage&&delete e.usage,e}},yh=class extends gh{static convert(t,e={}){super.convert(t,e);const i=t.find(t=>Array.isArray(t)&&"CS"===t[0]);i&&(e.coordinate_system={subtype:i[1],axis:this.extractAxes(t)});const n=t.find(t=>Array.isArray(t)&&"USAGE"===t[0]);if(n){const t=n.find(t=>Array.isArray(t)&&"SCOPE"===t[0]),i=n.find(t=>Array.isArray(t)&&"AREA"===t[0]),r=n.find(t=>Array.isArray(t)&&"BBOX"===t[0]);e.usage={},t&&(e.usage.scope=t[1]),i&&(e.usage.area=i[1]),r&&(e.usage.bbox=r.slice(1))}return e}};var _h=/\s/,vh=/[A-Za-z]/,xh=/[A-Za-z84_]/,wh=/[,\]]/,bh=/[\d\.E\-\+]/;function Sh(t){if("string"!=typeof t)throw new Error("not a string");this.text=t.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=1}function Mh(t,e,i){Array.isArray(e)&&(i.unshift(e),e=null);var n=e?{}:t,r=i.reduce(function(t,e){return Eh(e,t),t},n);e&&(t[e]=r)}function Eh(t,e){if(Array.isArray(t)){var i=t.shift();if("PARAMETER"===i&&(i=t.shift()),1===t.length)return Array.isArray(t[0])?(e[i]={},void Eh(t[0],e[i])):void(e[i]=t[0]);if(t.length)if("TOWGS84"!==i){if("AXIS"===i)return i in e||(e[i]=[]),void e[i].push(t);var n;switch(Array.isArray(i)||(e[i]={}),i){case"UNIT":case"PRIMEM":case"VERT_DATUM":return e[i]={name:t[0].toLowerCase(),convert:t[1]},void(3===t.length&&Eh(t[2],e[i]));case"SPHEROID":case"ELLIPSOID":return e[i]={name:t[0],a:t[1],rf:t[2]},void(4===t.length&&Eh(t[3],e[i]));case"EDATUM":case"ENGINEERINGDATUM":case"LOCAL_DATUM":case"DATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":return t[0]=["name",t[0]],void Mh(e,i,t);case"COMPD_CS":case"COMPOUNDCRS":case"FITTED_CS":case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"ENGCRS":case"ENGINEERINGCRS":return t[0]=["name",t[0]],Mh(e,i,t),void(e[i].type=i);default:for(n=-1;++n<t.length;)if(!Array.isArray(t[n]))return Eh(t,e[i]);return Mh(e,i,t)}}else e[i]=t;else e[i]=!0}else e[t]=!0}function Ch(t){return.017453292519943295*t}function Ph(t){const e=(t.projName||"").toLowerCase().replace(/_/g," ");void 0===t.long0&&void 0!==t.longc&&(t.long0=t.longc),t.lat_ts||!t.lat1||"stereographic south pole"!==e&&"polar stereographic (variant b)"!==e?t.lat_ts||!t.lat0||"polar stereographic"!==e&&"polar stereographic (variant a)"!==e||(t.lat_ts=t.lat0,t.lat0=Ch(t.lat0>0?90:-90),delete t.lat1):(t.lat0=Ch(t.lat1>0?90:-90),t.lat_ts=t.lat1,delete t.lat1)}function Ih(t){let e={units:null,to_meter:void 0};return"string"==typeof t?(e.units=t.toLowerCase(),"metre"===e.units&&(e.units="meter"),"meter"===e.units&&(e.to_meter=1)):t&&t.name&&(e.units=t.name.toLowerCase(),"metre"===e.units&&(e.units="meter"),e.to_meter=t.conversion_factor),e}function Th(t){return"object"==typeof t?t.value*t.unit.conversion_factor:t}function kh(t,e){t.ellipsoid.radius?(e.a=t.ellipsoid.radius,e.rf=0):(e.a=Th(t.ellipsoid.semi_major_axis),void 0!==t.ellipsoid.inverse_flattening?e.rf=t.ellipsoid.inverse_flattening:void 0!==t.ellipsoid.semi_major_axis&&void 0!==t.ellipsoid.semi_minor_axis&&(e.rf=e.a/(e.a-Th(t.ellipsoid.semi_minor_axis))))}function Rh(t,e={}){return t&&"object"==typeof t?"BoundCRS"===t.type?(Rh(t.source_crs,e),t.transformation&&(t.transformation.method&&"NTv2"===t.transformation.method.name?e.nadgrids=t.transformation.parameters[0].value:e.datum_params=t.transformation.parameters.map(t=>t.value)),e):(Object.keys(t).forEach(i=>{const n=t[i];if(null!==n)switch(i){case"name":if(e.srsCode)break;e.name=n,e.srsCode=n;break;case"type":"GeographicCRS"===n?e.projName="longlat":"GeodeticCRS"===n?t.coordinate_system&&"Cartesian"===t.coordinate_system.subtype?e.projName="geocent":e.projName="longlat":"ProjectedCRS"===n&&t.conversion&&t.conversion.method&&(e.projName=t.conversion.method.name);break;case"datum":case"datum_ensemble":n.ellipsoid&&(e.ellps=n.ellipsoid.name,kh(n,e)),n.prime_meridian&&(e.from_greenwich=n.prime_meridian.longitude*Math.PI/180);break;case"ellipsoid":e.ellps=n.name,kh(n,e);break;case"prime_meridian":e.long0=(n.longitude||0)*Math.PI/180;break;case"coordinate_system":if(n.axis){const t={east:"e",north:"n",west:"w",south:"s",up:"u",down:"d",geocentricx:"e",geocentricy:"n",geocentricz:"u"},i=n.axis.map(e=>t[e.direction.toLowerCase()]);if(i.every(Boolean)&&(e.axis=i.join(""),2===e.axis.length&&(e.axis+="u")),n.unit){const{units:t,to_meter:i}=Ih(n.unit);e.units=t,e.to_meter=i}else if(n.axis[0]&&n.axis[0].unit){const{units:t,to_meter:i}=Ih(n.axis[0].unit);e.units=t,e.to_meter=i}}break;case"id":n.authority&&n.code&&(e.title=n.authority+":"+n.code);break;case"conversion":n.method&&n.method.name&&(e.projName=n.method.name),n.parameters&&n.parameters.forEach(t=>{const i=t.name.toLowerCase().replace(/\s+/g,"_"),n=t.value;t.unit&&t.unit.conversion_factor?e[i]=n*t.unit.conversion_factor:"degree"===t.unit?e[i]=n*Math.PI/180:e[i]=n});break;case"unit":n.name&&(e.units=n.name.toLowerCase(),"metre"===e.units&&(e.units="meter")),n.conversion_factor&&(e.to_meter=n.conversion_factor);break;case"base_crs":Rh(n,e),e.datumCode=n.id?n.id.authority+"_"+n.id.code:n.name}}),void 0!==e.latitude_of_false_origin&&(e.lat0=e.latitude_of_false_origin),void 0!==e.longitude_of_false_origin&&(e.long0=e.longitude_of_false_origin),void 0!==e.latitude_of_standard_parallel&&(e.lat0=e.latitude_of_standard_parallel,e.lat1=e.latitude_of_standard_parallel),void 0!==e.latitude_of_1st_standard_parallel&&(e.lat1=e.latitude_of_1st_standard_parallel),void 0!==e.latitude_of_2nd_standard_parallel&&(e.lat2=e.latitude_of_2nd_standard_parallel),void 0!==e.latitude_of_projection_centre&&(e.lat0=e.latitude_of_projection_centre),void 0!==e.longitude_of_projection_centre&&(e.longc=e.longitude_of_projection_centre),void 0!==e.easting_at_false_origin&&(e.x0=e.easting_at_false_origin),void 0!==e.northing_at_false_origin&&(e.y0=e.northing_at_false_origin),void 0!==e.latitude_of_natural_origin&&(e.lat0=e.latitude_of_natural_origin),void 0!==e.longitude_of_natural_origin&&(e.long0=e.longitude_of_natural_origin),void 0!==e.longitude_of_origin&&(e.long0=e.longitude_of_origin),void 0!==e.false_easting&&(e.x0=e.false_easting),e.easting_at_projection_centre&&(e.x0=e.easting_at_projection_centre),void 0!==e.false_northing&&(e.y0=e.false_northing),e.northing_at_projection_centre&&(e.y0=e.northing_at_projection_centre),void 0!==e.standard_parallel_1&&(e.lat1=e.standard_parallel_1),void 0!==e.standard_parallel_2&&(e.lat2=e.standard_parallel_2),void 0!==e.scale_factor_at_natural_origin&&(e.k0=e.scale_factor_at_natural_origin),void 0!==e.scale_factor_at_projection_centre&&(e.k0=e.scale_factor_at_projection_centre),void 0!==e.scale_factor_on_pseudo_standard_parallel&&(e.k0=e.scale_factor_on_pseudo_standard_parallel),void 0!==e.azimuth&&(e.alpha=e.azimuth),void 0!==e.azimuth_at_projection_centre&&(e.alpha=e.azimuth_at_projection_centre),e.angle_from_rectified_to_skew_grid&&(e.rectified_grid_angle=e.angle_from_rectified_to_skew_grid),Ph(e),e):t}Sh.prototype.readCharicter=function(){var t=this.text[this.place++];if(4!==this.state)for(;_h.test(t);){if(this.place>=this.text.length)return;t=this.text[this.place++]}switch(this.state){case 1:return this.neutral(t);case 2:return this.keyword(t);case 4:return this.quoted(t);case 5:return this.afterquote(t);case 3:return this.number(t);case-1:return}},Sh.prototype.afterquote=function(t){if('"'===t)return this.word+='"',void(this.state=4);if(wh.test(t))return this.word=this.word.trim(),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in afterquote yet, index '+this.place)},Sh.prototype.afterItem=function(t){return","===t?(null!==this.word&&this.currentObject.push(this.word),this.word=null,void(this.state=1)):"]"===t?(this.level--,null!==this.word&&(this.currentObject.push(this.word),this.word=null),this.state=1,this.currentObject=this.stack.pop(),void(this.currentObject||(this.state=-1))):void 0},Sh.prototype.number=function(t){if(!bh.test(t)){if(wh.test(t))return this.word=parseFloat(this.word),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in number yet, index '+this.place)}this.word+=t},Sh.prototype.quoted=function(t){'"'!==t?this.word+=t:this.state=5},Sh.prototype.keyword=function(t){if(xh.test(t))this.word+=t;else{if("["===t){var e=[];return e.push(this.word),this.level++,null===this.root?this.root=e:this.currentObject.push(e),this.stack.push(this.currentObject),this.currentObject=e,void(this.state=1)}if(!wh.test(t))throw new Error("havn't handled \""+t+'" in keyword yet, index '+this.place);this.afterItem(t)}},Sh.prototype.neutral=function(t){if(vh.test(t))return this.word=t,void(this.state=2);if('"'===t)return this.word="",void(this.state=4);if(bh.test(t))return this.word=t,void(this.state=3);if(!wh.test(t))throw new Error("havn't handled \""+t+'" in neutral yet, index '+this.place);this.afterItem(t)},Sh.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(-1===this.state)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};var Ah=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function Gh(t){for(var e=Object.keys(t),i=0,n=e.length;i<n;++i){var r=e[i];-1!==Ah.indexOf(r)&&Oh(t[r]),"object"==typeof t[r]&&Gh(t[r])}}function Oh(t){if(t.AUTHORITY){var e=Object.keys(t.AUTHORITY)[0];e&&e in t.AUTHORITY&&(t.title=e+":"+t.AUTHORITY[e])}if("GEOGCS"===t.type?t.projName="longlat":"LOCAL_CS"===t.type?(t.projName="identity",t.local=!0):"object"==typeof t.PROJECTION?t.projName=Object.keys(t.PROJECTION)[0]:t.projName=t.PROJECTION,t.AXIS){for(var i="",n=0,r=t.AXIS.length;n<r;++n){var s=[t.AXIS[n][0].toLowerCase(),t.AXIS[n][1].toLowerCase()];-1!==s[0].indexOf("north")||("y"===s[0]||"lat"===s[0])&&"north"===s[1]?i+="n":-1!==s[0].indexOf("south")||("y"===s[0]||"lat"===s[0])&&"south"===s[1]?i+="s":-1!==s[0].indexOf("east")||("x"===s[0]||"lon"===s[0])&&"east"===s[1]?i+="e":-1===s[0].indexOf("west")&&("x"!==s[0]&&"lon"!==s[0]||"west"!==s[1])||(i+="w")}2===i.length&&(i+="u"),3===i.length&&(t.axis=i)}t.UNIT&&(t.units=t.UNIT.name.toLowerCase(),"metre"===t.units&&(t.units="meter"),t.UNIT.convert&&("GEOGCS"===t.type?t.DATUM&&t.DATUM.SPHEROID&&(t.to_meter=t.UNIT.convert*t.DATUM.SPHEROID.a):t.to_meter=t.UNIT.convert));var o=t.GEOGCS;function a(e){return e*(t.to_meter||1)}"GEOGCS"===t.type&&(o=t),o&&(o.PRIMEM&&o.PRIMEM.convert&&(t.from_greenwich=Ch(o.PRIMEM.convert)),o.DATUM?t.datumCode=o.DATUM.name.toLowerCase():t.datumCode=o.name.toLowerCase(),"d_"===t.datumCode.slice(0,2)&&(t.datumCode=t.datumCode.slice(2)),"new_zealand_1949"===t.datumCode&&(t.datumCode="nzgd49"),"wgs_1984"!==t.datumCode&&"world_geodetic_system_1984"!==t.datumCode||("Mercator_Auxiliary_Sphere"===t.PROJECTION&&(t.sphere=!0),t.datumCode="wgs84"),"belge_1972"===t.datumCode&&(t.datumCode="rnb72"),o.DATUM&&o.DATUM.SPHEROID&&(t.ellps=o.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),"international"===t.ellps.toLowerCase().slice(0,13)&&(t.ellps="intl"),t.a=o.DATUM.SPHEROID.a,t.rf=parseFloat(o.DATUM.SPHEROID.rf)),o.DATUM&&o.DATUM.TOWGS84&&(t.datum_params=o.DATUM.TOWGS84),~t.datumCode.indexOf("osgb_1936")&&(t.datumCode="osgb36"),~t.datumCode.indexOf("osni_1952")&&(t.datumCode="osni52"),(~t.datumCode.indexOf("tm65")||~t.datumCode.indexOf("geodetic_datum_of_1965"))&&(t.datumCode="ire65"),"ch1903+"===t.datumCode&&(t.datumCode="ch1903"),~t.datumCode.indexOf("israel")&&(t.datumCode="isr93")),t.b&&!isFinite(t.b)&&(t.b=t.a),t.rectified_grid_angle&&(t.rectified_grid_angle=Ch(t.rectified_grid_angle)),[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_1","Latitude of 1st standard parallel"],["standard_parallel_2","Standard_Parallel_2"],["standard_parallel_2","Latitude of 2nd standard parallel"],["false_easting","False_Easting"],["false_easting","False easting"],["false-easting","Easting at false origin"],["false_northing","False_Northing"],["false_northing","False northing"],["false_northing","Northing at false origin"],["central_meridian","Central_Meridian"],["central_meridian","Longitude of natural origin"],["central_meridian","Longitude of false origin"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["latitude_of_origin","Latitude of natural origin"],["latitude_of_origin","Latitude of false origin"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",Ch],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",Ch],["x0","false_easting",a],["y0","false_northing",a],["long0","central_meridian",Ch],["lat0","latitude_of_origin",Ch],["lat0","standard_parallel_1",Ch],["lat1","standard_parallel_1",Ch],["lat2","standard_parallel_2",Ch],["azimuth","Azimuth"],["alpha","azimuth",Ch],["srsCode","name"]].forEach(function(e){return function(t,e){var i=e[0],n=e[1];!(i in t)&&n in t&&(t[i]=t[n],3===e.length&&(t[i]=e[2](t[i])))}(t,e)}),Ph(t)}function Fh(t){if("object"==typeof t)return Rh(t);const e=function(t){const e=t.toUpperCase();return e.includes("PROJCRS")||e.includes("GEOGCRS")||e.includes("BOUNDCRS")||e.includes("VERTCRS")||e.includes("LENGTHUNIT")||e.includes("ANGLEUNIT")||e.includes("SCALEUNIT")?"WKT2":(e.includes("PROJCS")||e.includes("GEOGCS")||e.includes("LOCAL_CS")||e.includes("VERT_CS")||e.includes("UNIT"),"WKT1")}(t);var i=new Sh(t).output();if("WKT2"===e)return Rh(function(t){const e=function(t){return t.find(t=>Array.isArray(t)&&"USAGE"===t[0])?"2019":(t.find(t=>Array.isArray(t)&&"CS"===t[0])||"BOUNDCRS"===t[0]||"PROJCRS"===t[0]||t[0],"2015")}(t);return("2019"===e?yh:mh).convert(t)}(i));var n=i[0],r={};return Eh(i,r),Gh(r),r[n]}function Lh(t){var e=this;if(2===arguments.length){var i=arguments[1];"string"==typeof i?"+"===i.charAt(0)?Lh[t]=ph(arguments[1]):Lh[t]=Fh(arguments[1]):i&&"object"==typeof i&&!("projName"in i)?Lh[t]=Fh(arguments[1]):(Lh[t]=i,i||delete Lh[t])}else if(1===arguments.length){if(Array.isArray(t))return t.map(function(t){return Array.isArray(t)?Lh.apply(e,t):Lh(t)});if("string"==typeof t){if(t in Lh)return Lh[t]}else"EPSG"in t?Lh["EPSG:"+t.EPSG]=t:"ESRI"in t?Lh["ESRI:"+t.ESRI]=t:"IAU2000"in t?Lh["IAU2000:"+t.IAU2000]=t:console.log(t);return}}!function(t){t("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),t("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),t("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs");for(var e=1;e<=60;++e)t("EPSG:"+(32600+e),"+proj=utm +zone="+e+" +datum=WGS84 +units=m"),t("EPSG:"+(32700+e),"+proj=utm +zone="+e+" +south +datum=WGS84 +units=m");t("EPSG:5041","+title=WGS 84 / UPS North (E,N) +proj=stere +lat_0=90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m"),t("EPSG:5042","+title=WGS 84 / UPS South (E,N) +proj=stere +lat_0=-90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m"),t.WGS84=t["EPSG:4326"],t["EPSG:3785"]=t["EPSG:3857"],t.GOOGLE=t["EPSG:3857"],t["EPSG:900913"]=t["EPSG:3857"],t["EPSG:102113"]=t["EPSG:3857"]}(Lh);const jh=Lh;var Nh=["3857","900913","3785","102113"];function Dh(t,e){var i,n;if(t=t||{},!e)return t;for(n in e)void 0!==(i=e[n])&&(t[n]=i);return t}function zh(t,e,i){var n=t*e;return i/Math.sqrt(1-n*n)}function qh(t){return t<0?-1:1}function $h(t,e){return e||Math.abs(t)<=hh?t:t-qh(t)*lh}function Bh(t,e,i){var n=t*i,r=.5*t;return n=Math.pow((1-n)/(1+n),r),Math.tan(.5*(nh-e))/n}function Uh(t,e){for(var i,n,r=.5*t,s=nh-2*Math.atan(e),o=0;o<=15;o++)if(i=t*Math.sin(s),s+=n=nh-2*Math.atan(e*Math.pow((1-i)/(1+i),r))-s,Math.abs(n)<=1e-10)return s;return-9999}function Wh(t){return t}var Xh=["longlat","identity"],Vh=[{init:function(){var t=this.b/this.a;this.es=1-t*t,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=zh(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)},forward:function(t){var e,i,n=t.x,r=t.y;if(r*oh>90&&r*oh<-90&&n*oh>180&&n*oh<-180)return null;if(Math.abs(Math.abs(r)-nh)<=rh)return null;if(this.sphere)e=this.x0+this.a*this.k0*$h(n-this.long0,this.over),i=this.y0+this.a*this.k0*Math.log(Math.tan(ah+.5*r));else{var s=Math.sin(r),o=Bh(this.e,r,s);e=this.x0+this.a*this.k0*$h(n-this.long0,this.over),i=this.y0-this.a*this.k0*Math.log(o)}return t.x=e,t.y=i,t},inverse:function(t){var e,i,n=t.x-this.x0,r=t.y-this.y0;if(this.sphere)i=nh-2*Math.atan(Math.exp(-r/(this.a*this.k0)));else{var s=Math.exp(-r/(this.a*this.k0));if(-9999===(i=Uh(this.e,s)))return null}return e=$h(this.long0+n/(this.a*this.k0),this.over),t.x=e,t.y=i,t},names:["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","Mercator_Variant_A","merc"]},{init:function(){},forward:Wh,inverse:Wh,names:Xh}],Kh={},Zh=[];function Yh(t,e){var i=Zh.length;return t.names?(Zh[i]=t,t.names.forEach(function(t){Kh[t.toLowerCase()]=i}),this):(console.log(e),!0)}function Hh(t){return t.replace(/[-\(\)\s]+/g," ").trim().replace(/ /g,"_")}const Jh={start:function(){Vh.forEach(Yh)},add:Yh,get:function(t){if(!t)return!1;var e=t.toLowerCase();return void 0!==Kh[e]&&Zh[Kh[e]]||(e=Hh(e))in Kh&&Zh[Kh[e]]?Zh[Kh[e]]:void 0}},Qh={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563.396,b:6356256.91,ellipseName:"Airy 1830"},APL4:{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"},andrae:{a:6377104.43,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},clrk80:{a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},clrk80ign:{a:6378249.2,b:6356515,rf:293.4660213,ellipseName:"Clarke 1880 (IGN)"},clrk58:{a:6378293.645208759,rf:294.2606763692654,ellipseName:"Clarke 1858"},CPM:{a:6375738.7,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},plessis:{a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:6356773.3205,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:6355834.8467,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS7:{a:6378135,rf:298.26,ellipseName:"WGS 72"},WGS84:{a:6378137,rf:298.257223563,ellipseName:"WGS 84"},sphere:{a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"}},tu=Qh.WGS84;var eu={wgs84:{towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},ch1903:{towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},ggrs87:{towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},nad83:{towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},nad27:{nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},potsdam:{towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},carthage:{towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},hermannskogel:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},mgi:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Militar-Geographische Institut"},osni52:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},ire65:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},rassadiran:{towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},nzgd49:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},osgb36:{towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Ordnance Survey of Great Britain 1936"},s_jtsk:{towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},beduaram:{towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},gunung_segara:{towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},rnb72:{towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"},EPSG_5451:{towgs84:"6.41,-49.05,-11.28,1.5657,0.5242,6.9718,-5.7649"},IGNF_LURESG:{towgs84:"-192.986,13.673,-39.309,-0.4099,-2.9332,2.6881,0.43"},EPSG_4614:{towgs84:"-119.4248,-303.65872,-11.00061,1.164298,0.174458,1.096259,3.657065"},EPSG_4615:{towgs84:"-494.088,-312.129,279.877,-1.423,-1.013,1.59,-0.748"},ESRI_37241:{towgs84:"-76.822,257.457,-12.817,2.136,-0.033,-2.392,-0.031"},ESRI_37249:{towgs84:"-440.296,58.548,296.265,1.128,10.202,4.559,-0.438"},ESRI_37245:{towgs84:"-511.151,-181.269,139.609,1.05,2.703,1.798,3.071"},EPSG_4178:{towgs84:"24.9,-126.4,-93.2,-0.063,-0.247,-0.041,1.01"},EPSG_4622:{towgs84:"-472.29,-5.63,-304.12,0.4362,-0.8374,0.2563,1.8984"},EPSG_4625:{towgs84:"126.93,547.94,130.41,-2.7867,5.1612,-0.8584,13.8227"},EPSG_5252:{towgs84:"0.023,0.036,-0.068,0.00176,0.00912,-0.01136,0.00439"},EPSG_4314:{towgs84:"597.1,71.4,412.1,0.894,0.068,-1.563,7.58"},EPSG_4282:{towgs84:"-178.3,-316.7,-131.5,5.278,6.077,10.979,19.166"},EPSG_4231:{towgs84:"-83.11,-97.38,-117.22,0.005693,-0.044698,0.044285,0.1218"},EPSG_4274:{towgs84:"-230.994,102.591,25.199,0.633,-0.239,0.9,1.95"},EPSG_4134:{towgs84:"-180.624,-225.516,173.919,-0.81,-1.898,8.336,16.71006"},EPSG_4254:{towgs84:"18.38,192.45,96.82,0.056,-0.142,-0.2,-0.0013"},EPSG_4159:{towgs84:"-194.513,-63.978,-25.759,-3.4027,3.756,-3.352,-0.9175"},EPSG_4687:{towgs84:"0.072,-0.507,-0.245,0.0183,-0.0003,0.007,-0.0093"},EPSG_4227:{towgs84:"-83.58,-397.54,458.78,-17.595,-2.847,4.256,3.225"},EPSG_4746:{towgs84:"599.4,72.4,419.2,-0.062,-0.022,-2.723,6.46"},EPSG_4745:{towgs84:"612.4,77,440.2,-0.054,0.057,-2.797,2.55"},EPSG_6311:{towgs84:"8.846,-4.394,-1.122,-0.00237,-0.146528,0.130428,0.783926"},EPSG_4289:{towgs84:"565.7381,50.4018,465.2904,-0.395026,0.330772,-1.876073,4.07244"},EPSG_4230:{towgs84:"-68.863,-134.888,-111.49,-0.53,-0.14,0.57,-3.4"},EPSG_4154:{towgs84:"-123.02,-158.95,-168.47"},EPSG_4156:{towgs84:"570.8,85.7,462.8,4.998,1.587,5.261,3.56"},EPSG_4299:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4179:{towgs84:"33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84"},EPSG_4313:{towgs84:"-106.8686,52.2978,-103.7239,0.3366,-0.457,1.8422,-1.2747"},EPSG_4194:{towgs84:"163.511,127.533,-159.789"},EPSG_4195:{towgs84:"105,326,-102.5"},EPSG_4196:{towgs84:"-45,417,-3.5"},EPSG_4611:{towgs84:"-162.619,-276.959,-161.764,0.067753,-2.243648,-1.158828,-1.094246"},EPSG_4633:{towgs84:"137.092,131.66,91.475,-1.9436,-11.5993,-4.3321,-7.4824"},EPSG_4641:{towgs84:"-408.809,366.856,-412.987,1.8842,-0.5308,2.1655,-121.0993"},EPSG_4643:{towgs84:"-480.26,-438.32,-643.429,16.3119,20.1721,-4.0349,-111.7002"},EPSG_4300:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4188:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4660:{towgs84:"982.6087,552.753,-540.873,6.681627,-31.611492,-19.848161,16.805"},EPSG_4662:{towgs84:"97.295,-263.247,310.882,-1.5999,0.8386,3.1409,13.3259"},EPSG_3906:{towgs84:"577.88891,165.22205,391.18289,4.9145,-0.94729,-13.05098,7.78664"},EPSG_4307:{towgs84:"-209.3622,-87.8162,404.6198,0.0046,3.4784,0.5805,-1.4547"},EPSG_6892:{towgs84:"-76.269,-16.683,68.562,-6.275,10.536,-4.286,-13.686"},EPSG_4690:{towgs84:"221.597,152.441,176.523,2.403,1.3893,0.884,11.4648"},EPSG_4691:{towgs84:"218.769,150.75,176.75,3.5231,2.0037,1.288,10.9817"},EPSG_4629:{towgs84:"72.51,345.411,79.241,-1.5862,-0.8826,-0.5495,1.3653"},EPSG_4630:{towgs84:"165.804,216.213,180.26,-0.6251,-0.4515,-0.0721,7.4111"},EPSG_4692:{towgs84:"217.109,86.452,23.711,0.0183,-0.0003,0.007,-0.0093"},EPSG_9333:{towgs84:"0,0,0,-0.008393,0.000749,-0.010276,0"},EPSG_9059:{towgs84:"0,0,0"},EPSG_4312:{towgs84:"601.705,84.263,485.227,4.7354,1.3145,5.393,-2.3887"},EPSG_4123:{towgs84:"-96.062,-82.428,-121.753,4.801,0.345,-1.376,1.496"},EPSG_4309:{towgs84:"-124.45,183.74,44.64,-0.4384,0.5446,-0.9706,-2.1365"},ESRI_104106:{towgs84:"-283.088,-70.693,117.445,-1.157,0.059,-0.652,-4.058"},EPSG_4281:{towgs84:"-219.247,-73.802,269.529"},EPSG_4322:{towgs84:"0,0,4.5"},EPSG_4324:{towgs84:"0,0,1.9"},EPSG_4284:{towgs84:"43.822,-108.842,-119.585,1.455,-0.761,0.737,0.549"},EPSG_4277:{towgs84:"446.448,-125.157,542.06,0.15,0.247,0.842,-20.489"},EPSG_4207:{towgs84:"-282.1,-72.2,120,-1.529,0.145,-0.89,-4.46"},EPSG_4688:{towgs84:"347.175,1077.618,2623.677,33.9058,-70.6776,9.4013,186.0647"},EPSG_4689:{towgs84:"410.793,54.542,80.501,-2.5596,-2.3517,-0.6594,17.3218"},EPSG_4720:{towgs84:"0,0,4.5"},EPSG_4273:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},EPSG_4240:{towgs84:"204.64,834.74,293.8"},EPSG_4817:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},ESRI_104131:{towgs84:"426.62,142.62,460.09,4.98,4.49,-12.42,-17.1"},EPSG_4265:{towgs84:"-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68"},EPSG_4263:{towgs84:"-111.92,-87.85,114.5,1.875,0.202,0.219,0.032"},EPSG_4298:{towgs84:"-689.5937,623.84046,-65.93566,-0.02331,1.17094,-0.80054,5.88536"},EPSG_4270:{towgs84:"-253.4392,-148.452,386.5267,0.15605,0.43,-0.1013,-0.0424"},EPSG_4229:{towgs84:"-121.8,98.1,-10.7"},EPSG_4220:{towgs84:"-55.5,-348,-229.2"},EPSG_4214:{towgs84:"12.646,-155.176,-80.863"},EPSG_4232:{towgs84:"-345,3,223"},EPSG_4238:{towgs84:"-1.977,-13.06,-9.993,0.364,0.254,0.689,-1.037"},EPSG_4168:{towgs84:"-170,33,326"},EPSG_4131:{towgs84:"199,931,318.9"},EPSG_4152:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_5228:{towgs84:"572.213,85.334,461.94,4.9732,1.529,5.2484,3.5378"},EPSG_8351:{towgs84:"485.021,169.465,483.839,7.786342,4.397554,4.102655,0"},EPSG_4683:{towgs84:"-127.62,-67.24,-47.04,-3.068,4.903,1.578,-1.06"},EPSG_4133:{towgs84:"0,0,0"},EPSG_7373:{towgs84:"0.819,-0.5762,-1.6446,-0.00378,-0.03317,0.00318,0.0693"},EPSG_9075:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9072:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9294:{towgs84:"1.16835,-1.42001,-2.24431,-0.00822,-0.05508,0.01818,0.23388"},EPSG_4212:{towgs84:"-267.434,173.496,181.814,-13.4704,8.7154,7.3926,14.7492"},EPSG_4191:{towgs84:"-44.183,-0.58,-38.489,2.3867,2.7072,-3.5196,-8.2703"},EPSG_4237:{towgs84:"52.684,-71.194,-13.975,-0.312,-0.1063,-0.3729,1.0191"},EPSG_4740:{towgs84:"-1.08,-0.27,-0.9"},EPSG_4124:{towgs84:"419.3836,99.3335,591.3451,0.850389,1.817277,-7.862238,-0.99496"},EPSG_5681:{towgs84:"584.9636,107.7175,413.8067,1.1155,0.2824,-3.1384,7.9922"},EPSG_4141:{towgs84:"23.772,17.49,17.859,-0.3132,-1.85274,1.67299,-5.4262"},EPSG_4204:{towgs84:"-85.645,-273.077,-79.708,2.289,-1.421,2.532,3.194"},EPSG_4319:{towgs84:"226.702,-193.337,-35.371,-2.229,-4.391,9.238,0.9798"},EPSG_4200:{towgs84:"24.82,-131.21,-82.66"},EPSG_4130:{towgs84:"0,0,0"},EPSG_4127:{towgs84:"-82.875,-57.097,-156.768,-2.158,1.524,-0.982,-0.359"},EPSG_4149:{towgs84:"674.374,15.056,405.346"},EPSG_4617:{towgs84:"-0.991,1.9072,0.5129,0.02579,0.00965,0.01166,0"},EPSG_4663:{towgs84:"-210.502,-66.902,-48.476,2.094,-15.067,-5.817,0.485"},EPSG_4664:{towgs84:"-211.939,137.626,58.3,-0.089,0.251,0.079,0.384"},EPSG_4665:{towgs84:"-105.854,165.589,-38.312,-0.003,-0.026,0.024,-0.048"},EPSG_4666:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},EPSG_4756:{towgs84:"-192.873,-39.382,-111.202,-0.00205,-0.0005,0.00335,0.0188"},EPSG_4723:{towgs84:"-179.483,-69.379,-27.584,-7.862,8.163,6.042,-13.925"},EPSG_4726:{towgs84:"8.853,-52.644,180.304,-0.393,-2.323,2.96,-24.081"},EPSG_4267:{towgs84:"-8.0,160.0,176.0"},EPSG_5365:{towgs84:"-0.16959,0.35312,0.51846,0.03385,-0.16325,0.03446,0.03693"},EPSG_4218:{towgs84:"304.5,306.5,-318.1"},EPSG_4242:{towgs84:"-33.722,153.789,94.959,-8.581,-4.478,4.54,8.95"},EPSG_4216:{towgs84:"-292.295,248.758,429.447,4.9971,2.99,6.6906,1.0289"},ESRI_104105:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},ESRI_104129:{towgs84:"0,0,0"},EPSG_4673:{towgs84:"174.05,-25.49,112.57"},EPSG_4202:{towgs84:"-124,-60,154"},EPSG_4203:{towgs84:"-117.763,-51.51,139.061,0.292,0.443,0.277,-0.191"},EPSG_3819:{towgs84:"595.48,121.69,515.35,4.115,-2.9383,0.853,-3.408"},EPSG_8694:{towgs84:"-93.799,-132.737,-219.073,-1.844,0.648,-6.37,-0.169"},EPSG_4145:{towgs84:"275.57,676.78,229.6"},EPSG_4283:{towgs84:"0.06155,-0.01087,-0.04019,0.039492,0.032722,0.032898,-0.009994"},EPSG_4317:{towgs84:"2.3287,-147.0425,-92.0802,-0.309248,0.324822,0.497299,5.689063"},EPSG_4272:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993"},EPSG_4248:{towgs84:"-307.7,265.3,-363.5"},EPSG_5561:{towgs84:"24,-121,-76"},EPSG_5233:{towgs84:"-0.293,766.95,87.713,0.195704,1.695068,3.473016,-0.039338"},ESRI_104130:{towgs84:"-86,-98,-119"},ESRI_104102:{towgs84:"682,-203,480"},ESRI_37207:{towgs84:"7,-10,-26"},EPSG_4675:{towgs84:"59.935,118.4,-10.871"},ESRI_104109:{towgs84:"-89.121,-348.182,260.871"},ESRI_104112:{towgs84:"-185.583,-230.096,281.361"},ESRI_104113:{towgs84:"25.1,-275.6,222.6"},IGNF_WGS72G:{towgs84:"0,12,6"},IGNF_NTFG:{towgs84:"-168,-60,320"},IGNF_EFATE57G:{towgs84:"-127,-769,472"},IGNF_PGP50G:{towgs84:"324.8,153.6,172.1"},IGNF_REUN47G:{towgs84:"94,-948,-1262"},IGNF_CSG67G:{towgs84:"-186,230,110"},IGNF_GUAD48G:{towgs84:"-467,-16,-300"},IGNF_TAHI51G:{towgs84:"162,117,154"},IGNF_TAHAAG:{towgs84:"65,342,77"},IGNF_NUKU72G:{towgs84:"84,274,65"},IGNF_PETRELS72G:{towgs84:"365,194,166"},IGNF_WALL78G:{towgs84:"253,-133,-127"},IGNF_MAYO50G:{towgs84:"-382,-59,-262"},IGNF_TANNAG:{towgs84:"-139,-967,436"},IGNF_IGN72G:{towgs84:"-13,-348,292"},IGNF_ATIGG:{towgs84:"1118,23,66"},IGNF_FANGA84G:{towgs84:"150.57,158.33,118.32"},IGNF_RUSAT84G:{towgs84:"202.13,174.6,-15.74"},IGNF_KAUE70G:{towgs84:"126.74,300.1,-75.49"},IGNF_MOP90G:{towgs84:"-10.8,-1.8,12.77"},IGNF_MHPF67G:{towgs84:"338.08,212.58,-296.17"},IGNF_TAHI79G:{towgs84:"160.61,116.05,153.69"},IGNF_ANAA92G:{towgs84:"1.5,3.84,4.81"},IGNF_MARQUI72G:{towgs84:"330.91,-13.92,58.56"},IGNF_APAT86G:{towgs84:"143.6,197.82,74.05"},IGNF_TUBU69G:{towgs84:"237.17,171.61,-77.84"},IGNF_STPM50G:{towgs84:"11.363,424.148,373.13"},EPSG_4150:{towgs84:"674.374,15.056,405.346"},EPSG_4754:{towgs84:"-208.4058,-109.8777,-2.5764"},ESRI_104101:{towgs84:"372.87,149.23,585.29"},EPSG_4693:{towgs84:"0,-0.15,0.68"},EPSG_6207:{towgs84:"293.17,726.18,245.36"},EPSG_4153:{towgs84:"-133.63,-157.5,-158.62"},EPSG_4132:{towgs84:"-241.54,-163.64,396.06"},EPSG_4221:{towgs84:"-154.5,150.7,100.4"},EPSG_4266:{towgs84:"-80.7,-132.5,41.1"},EPSG_4193:{towgs84:"-70.9,-151.8,-41.4"},EPSG_5340:{towgs84:"-0.41,0.46,-0.35"},EPSG_4246:{towgs84:"-294.7,-200.1,525.5"},EPSG_4318:{towgs84:"-3.2,-5.7,2.8"},EPSG_4121:{towgs84:"-199.87,74.79,246.62"},EPSG_4223:{towgs84:"-260.1,5.5,432.2"},EPSG_4158:{towgs84:"-0.465,372.095,171.736"},EPSG_4285:{towgs84:"-128.16,-282.42,21.93"},EPSG_4613:{towgs84:"-404.78,685.68,45.47"},EPSG_4607:{towgs84:"195.671,332.517,274.607"},EPSG_4475:{towgs84:"-381.788,-57.501,-256.673"},EPSG_4208:{towgs84:"-157.84,308.54,-146.6"},EPSG_4743:{towgs84:"70.995,-335.916,262.898"},EPSG_4710:{towgs84:"-323.65,551.39,-491.22"},EPSG_7881:{towgs84:"-0.077,0.079,0.086"},EPSG_4682:{towgs84:"283.729,735.942,261.143"},EPSG_4739:{towgs84:"-156,-271,-189"},EPSG_4679:{towgs84:"-80.01,253.26,291.19"},EPSG_4750:{towgs84:"-56.263,16.136,-22.856"},EPSG_4644:{towgs84:"-10.18,-350.43,291.37"},EPSG_4695:{towgs84:"-103.746,-9.614,-255.95"},EPSG_4292:{towgs84:"-355,21,72"},EPSG_4302:{towgs84:"-61.702,284.488,472.052"},EPSG_4143:{towgs84:"-124.76,53,466.79"},EPSG_4606:{towgs84:"-153,153,307"},EPSG_4699:{towgs84:"-770.1,158.4,-498.2"},EPSG_4247:{towgs84:"-273.5,110.6,-357.9"},EPSG_4160:{towgs84:"8.88,184.86,106.69"},EPSG_4161:{towgs84:"-233.43,6.65,173.64"},EPSG_9251:{towgs84:"-9.5,122.9,138.2"},EPSG_9253:{towgs84:"-78.1,101.6,133.3"},EPSG_4297:{towgs84:"-198.383,-240.517,-107.909"},EPSG_4269:{towgs84:"0,0,0"},EPSG_4301:{towgs84:"-147,506,687"},EPSG_4618:{towgs84:"-59,-11,-52"},EPSG_4612:{towgs84:"0,0,0"},EPSG_4678:{towgs84:"44.585,-131.212,-39.544"},EPSG_4250:{towgs84:"-130,29,364"},EPSG_4144:{towgs84:"214,804,268"},EPSG_4147:{towgs84:"-17.51,-108.32,-62.39"},EPSG_4259:{towgs84:"-254.1,-5.36,-100.29"},EPSG_4164:{towgs84:"-76,-138,67"},EPSG_4211:{towgs84:"-378.873,676.002,-46.255"},EPSG_4182:{towgs84:"-422.651,-172.995,84.02"},EPSG_4224:{towgs84:"-143.87,243.37,-33.52"},EPSG_4225:{towgs84:"-205.57,168.77,-4.12"},EPSG_5527:{towgs84:"-67.35,3.88,-38.22"},EPSG_4752:{towgs84:"98,390,-22"},EPSG_4310:{towgs84:"-30,190,89"},EPSG_9248:{towgs84:"-192.26,65.72,132.08"},EPSG_4680:{towgs84:"124.5,-63.5,-281"},EPSG_4701:{towgs84:"-79.9,-158,-168.9"},EPSG_4706:{towgs84:"-146.21,112.63,4.05"},EPSG_4805:{towgs84:"682,-203,480"},EPSG_4201:{towgs84:"-165,-11,206"},EPSG_4210:{towgs84:"-157,-2,-299"},EPSG_4183:{towgs84:"-104,167,-38"},EPSG_4139:{towgs84:"11,72,-101"},EPSG_4668:{towgs84:"-86,-98,-119"},EPSG_4717:{towgs84:"-2,151,181"},EPSG_4732:{towgs84:"102,52,-38"},EPSG_4280:{towgs84:"-377,681,-50"},EPSG_4209:{towgs84:"-138,-105,-289"},EPSG_4261:{towgs84:"31,146,47"},EPSG_4658:{towgs84:"-73,46,-86"},EPSG_4721:{towgs84:"265.025,384.929,-194.046"},EPSG_4222:{towgs84:"-136,-108,-292"},EPSG_4601:{towgs84:"-255,-15,71"},EPSG_4602:{towgs84:"725,685,536"},EPSG_4603:{towgs84:"72,213.7,93"},EPSG_4605:{towgs84:"9,183,236"},EPSG_4621:{towgs84:"137,248,-430"},EPSG_4657:{towgs84:"-28,199,5"},EPSG_4316:{towgs84:"103.25,-100.4,-307.19"},EPSG_4642:{towgs84:"-13,-348,292"},EPSG_4698:{towgs84:"145,-187,103"},EPSG_4192:{towgs84:"-206.1,-174.7,-87.7"},EPSG_4311:{towgs84:"-265,120,-358"},EPSG_4135:{towgs84:"58,-283,-182"},ESRI_104138:{towgs84:"198,-226,-347"},EPSG_4245:{towgs84:"-11,851,5"},EPSG_4142:{towgs84:"-125,53,467"},EPSG_4213:{towgs84:"-106,-87,188"},EPSG_4253:{towgs84:"-133,-77,-51"},EPSG_4129:{towgs84:"-132,-110,-335"},EPSG_4713:{towgs84:"-77,-128,142"},EPSG_4239:{towgs84:"217,823,299"},EPSG_4146:{towgs84:"295,736,257"},EPSG_4155:{towgs84:"-83,37,124"},EPSG_4165:{towgs84:"-173,253,27"},EPSG_4672:{towgs84:"175,-38,113"},EPSG_4236:{towgs84:"-637,-549,-203"},EPSG_4251:{towgs84:"-90,40,88"},EPSG_4271:{towgs84:"-2,374,172"},EPSG_4175:{towgs84:"-88,4,101"},EPSG_4716:{towgs84:"298,-304,-375"},EPSG_4315:{towgs84:"-23,259,-9"},EPSG_4744:{towgs84:"-242.2,-144.9,370.3"},EPSG_4244:{towgs84:"-97,787,86"},EPSG_4293:{towgs84:"616,97,-251"},EPSG_4714:{towgs84:"-127,-769,472"},EPSG_4736:{towgs84:"260,12,-147"},EPSG_6883:{towgs84:"-235,-110,393"},EPSG_6894:{towgs84:"-63,176,185"},EPSG_4205:{towgs84:"-43,-163,45"},EPSG_4256:{towgs84:"41,-220,-134"},EPSG_4262:{towgs84:"639,405,60"},EPSG_4604:{towgs84:"174,359,365"},EPSG_4169:{towgs84:"-115,118,426"},EPSG_4620:{towgs84:"-106,-129,165"},EPSG_4184:{towgs84:"-203,141,53"},EPSG_4616:{towgs84:"-289,-124,60"},EPSG_9403:{towgs84:"-307,-92,127"},EPSG_4684:{towgs84:"-133,-321,50"},EPSG_4708:{towgs84:"-491,-22,435"},EPSG_4707:{towgs84:"114,-116,-333"},EPSG_4709:{towgs84:"145,75,-272"},EPSG_4712:{towgs84:"-205,107,53"},EPSG_4711:{towgs84:"124,-234,-25"},EPSG_4718:{towgs84:"230,-199,-752"},EPSG_4719:{towgs84:"211,147,111"},EPSG_4724:{towgs84:"208,-435,-229"},EPSG_4725:{towgs84:"189,-79,-202"},EPSG_4735:{towgs84:"647,1777,-1124"},EPSG_4722:{towgs84:"-794,119,-298"},EPSG_4728:{towgs84:"-307,-92,127"},EPSG_4734:{towgs84:"-632,438,-609"},EPSG_4727:{towgs84:"912,-58,1227"},EPSG_4729:{towgs84:"185,165,42"},EPSG_4730:{towgs84:"170,42,84"},EPSG_4733:{towgs84:"276,-57,149"},ESRI_37218:{towgs84:"230,-199,-752"},ESRI_37240:{towgs84:"-7,215,225"},ESRI_37221:{towgs84:"252,-209,-751"},ESRI_4305:{towgs84:"-123,-206,219"},ESRI_104139:{towgs84:"-73,-247,227"},EPSG_4748:{towgs84:"51,391,-36"},EPSG_4219:{towgs84:"-384,664,-48"},EPSG_4255:{towgs84:"-333,-222,114"},EPSG_4257:{towgs84:"-587.8,519.75,145.76"},EPSG_4646:{towgs84:"-963,510,-359"},EPSG_6881:{towgs84:"-24,-203,268"},EPSG_6882:{towgs84:"-183,-15,273"},EPSG_4715:{towgs84:"-104,-129,239"},IGNF_RGF93GDD:{towgs84:"0,0,0"},IGNF_RGM04GDD:{towgs84:"0,0,0"},IGNF_RGSPM06GDD:{towgs84:"0,0,0"},IGNF_RGTAAF07GDD:{towgs84:"0,0,0"},IGNF_RGFG95GDD:{towgs84:"0,0,0"},IGNF_RGNCG:{towgs84:"0,0,0"},IGNF_RGPFGDD:{towgs84:"0,0,0"},IGNF_ETRS89G:{towgs84:"0,0,0"},IGNF_RGR92GDD:{towgs84:"0,0,0"},EPSG_4173:{towgs84:"0,0,0"},EPSG_4180:{towgs84:"0,0,0"},EPSG_4619:{towgs84:"0,0,0"},EPSG_4667:{towgs84:"0,0,0"},EPSG_4075:{towgs84:"0,0,0"},EPSG_6706:{towgs84:"0,0,0"},EPSG_7798:{towgs84:"0,0,0"},EPSG_4661:{towgs84:"0,0,0"},EPSG_4669:{towgs84:"0,0,0"},EPSG_8685:{towgs84:"0,0,0"},EPSG_4151:{towgs84:"0,0,0"},EPSG_9702:{towgs84:"0,0,0"},EPSG_4758:{towgs84:"0,0,0"},EPSG_4761:{towgs84:"0,0,0"},EPSG_4765:{towgs84:"0,0,0"},EPSG_8997:{towgs84:"0,0,0"},EPSG_4023:{towgs84:"0,0,0"},EPSG_4670:{towgs84:"0,0,0"},EPSG_4694:{towgs84:"0,0,0"},EPSG_4148:{towgs84:"0,0,0"},EPSG_4163:{towgs84:"0,0,0"},EPSG_4167:{towgs84:"0,0,0"},EPSG_4189:{towgs84:"0,0,0"},EPSG_4190:{towgs84:"0,0,0"},EPSG_4176:{towgs84:"0,0,0"},EPSG_4659:{towgs84:"0,0,0"},EPSG_3824:{towgs84:"0,0,0"},EPSG_3889:{towgs84:"0,0,0"},EPSG_4046:{towgs84:"0,0,0"},EPSG_4081:{towgs84:"0,0,0"},EPSG_4558:{towgs84:"0,0,0"},EPSG_4483:{towgs84:"0,0,0"},EPSG_5013:{towgs84:"0,0,0"},EPSG_5264:{towgs84:"0,0,0"},EPSG_5324:{towgs84:"0,0,0"},EPSG_5354:{towgs84:"0,0,0"},EPSG_5371:{towgs84:"0,0,0"},EPSG_5373:{towgs84:"0,0,0"},EPSG_5381:{towgs84:"0,0,0"},EPSG_5393:{towgs84:"0,0,0"},EPSG_5489:{towgs84:"0,0,0"},EPSG_5593:{towgs84:"0,0,0"},EPSG_6135:{towgs84:"0,0,0"},EPSG_6365:{towgs84:"0,0,0"},EPSG_5246:{towgs84:"0,0,0"},EPSG_7886:{towgs84:"0,0,0"},EPSG_8431:{towgs84:"0,0,0"},EPSG_8427:{towgs84:"0,0,0"},EPSG_8699:{towgs84:"0,0,0"},EPSG_8818:{towgs84:"0,0,0"},EPSG_4757:{towgs84:"0,0,0"},EPSG_9140:{towgs84:"0,0,0"},EPSG_8086:{towgs84:"0,0,0"},EPSG_4686:{towgs84:"0,0,0"},EPSG_4737:{towgs84:"0,0,0"},EPSG_4702:{towgs84:"0,0,0"},EPSG_4747:{towgs84:"0,0,0"},EPSG_4749:{towgs84:"0,0,0"},EPSG_4674:{towgs84:"0,0,0"},EPSG_4755:{towgs84:"0,0,0"},EPSG_4759:{towgs84:"0,0,0"},EPSG_4762:{towgs84:"0,0,0"},EPSG_4763:{towgs84:"0,0,0"},EPSG_4764:{towgs84:"0,0,0"},EPSG_4166:{towgs84:"0,0,0"},EPSG_4170:{towgs84:"0,0,0"},EPSG_5546:{towgs84:"0,0,0"},EPSG_7844:{towgs84:"0,0,0"},EPSG_4818:{towgs84:"589,76,480"},EPSG_10328:{towgs84:"0,0,0"},EPSG_9782:{towgs84:"0,0,0"},EPSG_9777:{towgs84:"0,0,0"},EPSG_10690:{towgs84:"0,0,0"},EPSG_10639:{towgs84:"0,0,0"},EPSG_10739:{towgs84:"0,0,0"},EPSG_7686:{towgs84:"0,0,0"},EPSG_8900:{towgs84:"0,0,0"},EPSG_5886:{towgs84:"0,0,0"},EPSG_7683:{towgs84:"0,0,0"},EPSG_6668:{towgs84:"0,0,0"},EPSG_20046:{towgs84:"0,0,0"},EPSG_10299:{towgs84:"0,0,0"},EPSG_10310:{towgs84:"0,0,0"},EPSG_10475:{towgs84:"0,0,0"},EPSG_4742:{towgs84:"0,0,0"},EPSG_10671:{towgs84:"0,0,0"},EPSG_10762:{towgs84:"0,0,0"},EPSG_10725:{towgs84:"0,0,0"},EPSG_10791:{towgs84:"0,0,0"},EPSG_10800:{towgs84:"0,0,0"},EPSG_10305:{towgs84:"0,0,0"},EPSG_10941:{towgs84:"0,0,0"},EPSG_10968:{towgs84:"0,0,0"},EPSG_10875:{towgs84:"0,0,0"},EPSG_6318:{towgs84:"0,0,0"},EPSG_10910:{towgs84:"0,0,0"}};for(var iu in eu){var nu=eu[iu];nu.datumName&&(eu[nu.datumName]=nu)}const ru=eu;var su={};async function ou(t,e){for(var i=[],n=await e.getImageCount(),r=n-1;r>=0;r--){var s=await e.getImage(r),o=await s.readRasters(),a=[s.getWidth(),s.getHeight()],l=s.getBoundingBox().map(lu),h=[s.fileDirectory.ModelPixelScale[0],s.fileDirectory.ModelPixelScale[1]].map(lu),u=l[0]+(a[0]-1)*h[0],c=l[3]-(a[1]-1)*h[1],d=o[0],f=o[1],p=[];for(let t=a[1]-1;t>=0;t--)for(let e=a[0]-1;e>=0;e--){var g=t*a[0]+e;p.push([-hu(f[g]),hu(d[g])])}i.push({del:h,lim:a,ll:[-u,c],cvs:p})}var m={header:{nSubgrids:n},subgrids:i};return su[t]=m,m}function au(t){if(0===t.length)return null;var e="@"===t[0];return e&&(t=t.slice(1)),"null"===t?{name:"null",mandatory:!e,grid:null,isNull:!0}:{name:t,mandatory:!e,grid:su[t]||null,isNull:!1}}function lu(t){return t*Math.PI/180}function hu(t){return t/3600*Math.PI/180}function uu(t,e,i){return String.fromCharCode.apply(null,new Uint8Array(t.buffer.slice(e,i)))}function cu(t){return t.map(function(t){return[hu(t.longitudeShift),hu(t.latitudeShift)]})}function du(t,e,i){return{name:uu(t,e+8,e+16).trim(),parent:uu(t,e+24,e+24+8).trim(),lowerLatitude:t.getFloat64(e+72,i),upperLatitude:t.getFloat64(e+88,i),lowerLongitude:t.getFloat64(e+104,i),upperLongitude:t.getFloat64(e+120,i),latitudeInterval:t.getFloat64(e+136,i),longitudeInterval:t.getFloat64(e+152,i),gridNodeCount:t.getInt32(e+168,i)}}function fu(t,e,i,n,r){var s=e+176,o=16;!1===r&&(o=8);for(var a=[],l=0;l<i.gridNodeCount;l++){var h={latitudeShift:t.getFloat32(s+l*o,n),longitudeShift:t.getFloat32(s+l*o+4,n)};!1!==r&&(h.latitudeAccuracy=t.getFloat32(s+l*o+8,n),h.longitudeAccuracy=t.getFloat32(s+l*o+12,n)),a.push(h)}return a}function pu(t,e){if(!(this instanceof pu))return new pu(t);this.forward=null,this.inverse=null,this.init=null,this.name,this.names=null,this.title,e=e||function(t){if(t)throw t};var i=function(t){let e;if(function(t){return"string"==typeof t}(t))if(function(t){return t in jh}(t))e=jh[t];else if(function(t){return 0!==t.indexOf("+")&&-1!==t.indexOf("[")||"object"==typeof t&&!("srsCode"in t)}(t)){e=Fh(t);var i=function(t){var e=fh(t,"extension");if(e)return fh(e,"proj4")}(e);i&&(e=ph(i))}else(function(t){return"+"===t[0]})(t)&&(e=ph(t));else e="projName"in t?t:Fh(t);return e&&function(t){if(t.title)return 0===t.title.toLowerCase().indexOf("epsg:")&&Nh.indexOf(t.title.substr(5))>-1;var e=fh(t,"authority");if(e){var i=fh(e,"epsg");return i&&Nh.indexOf(i)>-1}}(e)?jh["EPSG:3857"]:e}(t);if("object"==typeof i){var n=pu.projections.get(i.projName);if(n){if(i.datumCode&&"none"!==i.datumCode){var r=fh(ru,i.datumCode);r&&(i.datum_params=i.datum_params||(r.towgs84?r.towgs84.split(","):null),i.ellps=r.ellipse,i.datumName=r.datumName?r.datumName:i.datumCode)}i.k0=i.k0||1,i.axis=i.axis||"enu",i.ellps=i.ellps||"wgs84",i.lat1=i.lat1||i.lat0;var s=function(t,e,i,n,r){if(!t){var s=fh(Qh,n);s||(s=tu),t=s.a,e=s.b,i=s.rf}return i&&!e&&(e=(1-1/i)*t),(0===i||Math.abs(t-e)<rh)&&(r=!0,e=t),{a:t,b:e,rf:i,sphere:r}}(i.a,i.b,i.rf,i.ellps,i.sphere),o=function(t,e,i,n){var r=t*t,s=e*e,o=(r-s)/r,a=0;return n?(r=(t*=1-o*(.16666666666666666+o*(.04722222222222222+.022156084656084655*o)))*t,o=0):a=Math.sqrt(o),{es:o,e:a,ep2:(r-s)/s}}(s.a,s.b,s.rf,i.R_A),a=function(t){return void 0===t?null:t.split(",").map(au)}(i.nadgrids),l=i.datum||function(t,e,i,n,r,s,o){var a={};return a.datum_type=void 0===t||"none"===t?5:4,e&&(a.datum_params=e.map(parseFloat),0===a.datum_params[0]&&0===a.datum_params[1]&&0===a.datum_params[2]||(a.datum_type=1),a.datum_params.length>3&&(0===a.datum_params[3]&&0===a.datum_params[4]&&0===a.datum_params[5]&&0===a.datum_params[6]||(a.datum_type=2,a.datum_params[3]*=ih,a.datum_params[4]*=ih,a.datum_params[5]*=ih,a.datum_params[6]=a.datum_params[6]/1e6+1))),o&&(a.datum_type=3,a.grids=o),a.a=i,a.b=n,a.es=r,a.ep2=s,a}(i.datumCode,i.datum_params,s.a,s.b,o.es,o.ep2,a);Dh(this,i),Dh(this,n),this.a=s.a,this.b=s.b,this.rf=s.rf,this.sphere=s.sphere,this.es=o.es,this.e=o.e,this.ep2=o.ep2,this.datum=l,"init"in this&&"function"==typeof this.init&&this.init(),e(null,this)}else e("Could not get projection name from: "+t)}else e("Could not parse to valid json: "+t)}pu.projections=Jh,pu.projections.start();const gu=pu;function mu(t,e,i){var n,r,s,o,a=t.x,l=t.y,h=t.z?t.z:0;if(l<-nh&&l>-1.001*nh)l=-nh;else if(l>nh&&l<1.001*nh)l=nh;else{if(l<-nh)return{x:-1/0,y:-1/0,z:t.z};if(l>nh)return{x:1/0,y:1/0,z:t.z}}return a>Math.PI&&(a-=2*Math.PI),r=Math.sin(l),o=Math.cos(l),s=r*r,{x:((n=i/Math.sqrt(1-e*s))+h)*o*Math.cos(a),y:(n+h)*o*Math.sin(a),z:(n*(1-e)+h)*r}}function yu(t,e,i,n){var r,s,o,a,l,h,u,c,d,f,p,g,m,y,_,v=t.x,x=t.y,w=t.z?t.z:0;if(r=Math.sqrt(v*v+x*x),s=Math.sqrt(v*v+x*x+w*w),r/i<1e-12){if(y=0,s/i<1e-12)return _=-n,{x:t.x,y:t.y,z:t.z}}else y=Math.atan2(x,v);o=w/s,c=(a=r/s)*(1-e)*(l=1/Math.sqrt(1-e*(2-e)*a*a)),d=o*l,m=0;do{m++,h=e*(u=i/Math.sqrt(1-e*d*d))/(u+(_=r*c+w*d-u*(1-e*d*d))),g=(p=o*(l=1/Math.sqrt(1-h*(2-h)*a*a)))*c-(f=a*(1-h)*l)*d,c=f,d=p}while(g*g>1e-24&&m<30);return{x:y,y:Math.atan(p/Math.abs(f)),z:_}}function _u(t){return 1===t||2===t}function vu(t,e,i){if(null===t.grids||0===t.grids.length)return console.log("Grid shift grids not found"),-1;var n={x:-i.x,y:i.y},r={x:Number.NaN,y:Number.NaN},s=[];t:for(var o=0;o<t.grids.length;o++){var a=t.grids[o];if(s.push(a.name),a.isNull){r=n;break}if(null!==a.grid)for(var l=a.grid.subgrids,h=0,u=l.length;h<u;h++){var c=l[h],d=(Math.abs(c.del[1])+Math.abs(c.del[0]))/1e4,f=c.ll[0]-d,p=c.ll[1]-d,g=c.ll[0]+(c.lim[0]-1)*c.del[0]+d,m=c.ll[1]+(c.lim[1]-1)*c.del[1]+d;if(!(p>n.y||f>n.x||m<n.y||g<n.x||(r=xu(n,e,c),isNaN(r.x))))break t}else if(a.mandatory)return console.log("Unable to find mandatory grid '"+a.name+"'"),-1}return isNaN(r.x)?(console.log("Failed to find a grid shift table for location '"+-n.x*oh+" "+n.y*oh+" tried: '"+s+"'"),-1):(i.x=-r.x,i.y=r.y,0)}function xu(t,e,i){var n={x:Number.NaN,y:Number.NaN};if(isNaN(t.x))return n;var r={x:t.x,y:t.y};r.x-=i.ll[0],r.y-=i.ll[1],r.x=$h(r.x-Math.PI)+Math.PI;var s=wu(r,i);if(e){if(isNaN(s.x))return n;s.x=r.x-s.x,s.y=r.y-s.y;var o,a,l=9;do{if(a=wu(s,i),isNaN(a.x)){console.log("Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.");break}o={x:r.x-(a.x+s.x),y:r.y-(a.y+s.y)},s.x+=o.x,s.y+=o.y}while(l--&&Math.abs(o.x)>1e-12&&Math.abs(o.y)>1e-12);if(l<0)return console.log("Inverse grid shift iterator failed to converge."),n;n.x=$h(s.x+i.ll[0]),n.y=s.y+i.ll[1]}else isNaN(s.x)||(n.x=t.x+s.x,n.y=t.y+s.y);return n}function wu(t,e){var i,n={x:t.x/e.del[0],y:t.y/e.del[1]},r=Math.floor(n.x),s=Math.floor(n.y),o=n.x-1*r,a=n.y-1*s,l={x:Number.NaN,y:Number.NaN};if(r<0||r>=e.lim[0])return l;if(s<0||s>=e.lim[1])return l;i=s*e.lim[0]+r;var h=e.cvs[i][0],u=e.cvs[i][1];i++;var c=e.cvs[i][0],d=e.cvs[i][1];i+=e.lim[0];var f=e.cvs[i][0],p=e.cvs[i][1];i--;var g=e.cvs[i][0],m=e.cvs[i][1],y=o*a,_=o*(1-a),v=(1-o)*(1-a),x=(1-o)*a;return l.x=v*h+_*c+x*g+y*f,l.y=v*u+_*d+x*m+y*p,l}function bu(t,e,i){var n,r,s,o=i.x,a=i.y,l=i.z||0,h={};for(s=0;s<3;s++)if(!e||2!==s||void 0!==i.z)switch(0===s?(n=o,r=-1!=="ew".indexOf(t.axis[s])?"x":"y"):1===s?(n=a,r=-1!=="ns".indexOf(t.axis[s])?"y":"x"):(n=l,r="z"),t.axis[s]){case"e":case"n":h[r]=n;break;case"w":case"s":h[r]=-n;break;case"u":void 0!==i[r]&&(h.z=n);break;case"d":void 0!==i[r]&&(h.z=-n);break;default:return null}return h}function Su(t){var e={x:t[0],y:t[1]};return t.length>2&&(e.z=t[2]),t.length>3&&(e.m=t[3]),e}function Mu(t){if("function"==typeof Number.isFinite){if(Number.isFinite(t))return;throw new TypeError("coordinates must be finite numbers")}if("number"!=typeof t||t!=t||!isFinite(t))throw new TypeError("coordinates must be finite numbers")}function Eu(t,e,i,n){var r,s=void 0!==(i=Array.isArray(i)?Su(i):{x:i.x,y:i.y,z:i.z,m:i.m}).z;if(function(t){Mu(t.x),Mu(t.y)}(i),t.datum&&e.datum&&function(t,e){return(1===t.datum.datum_type||2===t.datum.datum_type||3===t.datum.datum_type)&&"WGS84"!==e.datumCode||(1===e.datum.datum_type||2===e.datum.datum_type||3===e.datum.datum_type)&&"WGS84"!==t.datumCode}(t,e)&&(i=Eu(t,r=new gu("WGS84"),i,n),t=r),n&&"enu"!==t.axis&&(i=bu(t,!1,i)),"longlat"===t.projName)i={x:i.x*sh,y:i.y*sh,z:i.z||0};else if(t.to_meter&&(i={x:i.x*t.to_meter,y:i.y*t.to_meter,z:i.z||0}),!(i=t.inverse(i)))return;if(t.from_greenwich&&(i.x+=t.from_greenwich),i=function(t,e,i){if(function(t,e){return t.datum_type===e.datum_type&&!(t.a!==e.a||Math.abs(t.es-e.es)>5e-11)&&(1===t.datum_type?t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]:2!==t.datum_type||t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]&&t.datum_params[3]===e.datum_params[3]&&t.datum_params[4]===e.datum_params[4]&&t.datum_params[5]===e.datum_params[5]&&t.datum_params[6]===e.datum_params[6])}(t,e))return i;if(5===t.datum_type||5===e.datum_type)return i;var n=t.a,r=t.es;if(3===t.datum_type){if(0!==vu(t,!1,i))return;n=th,r=eh}var s=e.a,o=e.b,a=e.es;return 3===e.datum_type&&(s=th,o=6356752.314,a=eh),r!==a||n!==s||_u(t.datum_type)||_u(e.datum_type)?(i=mu(i,r,n),_u(t.datum_type)&&(i=function(t,e,i){if(1===e)return{x:t.x+i[0],y:t.y+i[1],z:t.z+i[2]};if(2===e){var n=i[0],r=i[1],s=i[2],o=i[3],a=i[4],l=i[5],h=i[6];return{x:h*(t.x-l*t.y+a*t.z)+n,y:h*(l*t.x+t.y-o*t.z)+r,z:h*(-a*t.x+o*t.y+t.z)+s}}}(i,t.datum_type,t.datum_params)),_u(e.datum_type)&&(i=function(t,e,i){if(1===e)return{x:t.x-i[0],y:t.y-i[1],z:t.z-i[2]};if(2===e){var n=i[0],r=i[1],s=i[2],o=i[3],a=i[4],l=i[5],h=i[6],u=(t.x-n)/h,c=(t.y-r)/h,d=(t.z-s)/h;return{x:u+l*c-a*d,y:-l*u+c+o*d,z:a*u-o*c+d}}}(i,e.datum_type,e.datum_params)),i=yu(i,a,s,o),3!==e.datum_type||0===vu(e,!0,i)?i:void 0):i}(t.datum,e.datum,i))return e.from_greenwich&&(i={x:i.x-e.from_greenwich,y:i.y,z:i.z||0}),"longlat"===e.projName?i={x:i.x*oh,y:i.y*oh,z:i.z||0}:(i=e.forward(i),e.to_meter&&(i={x:i.x/e.to_meter,y:i.y/e.to_meter,z:i.z||0})),n&&"enu"!==e.axis?bu(e,!0,i):(i&&!s&&"geocent"!==e.projName&&delete i.z,i)}var Cu=gu("WGS84");function Pu(t,e,i,n){var r,s,o;return Array.isArray(i)?(r=Eu(t,e,i,n)||{x:NaN,y:NaN},i.length>2?void 0!==t.name&&"geocent"===t.name||void 0!==e.name&&"geocent"===e.name?"number"==typeof r.z?[r.x,r.y,r.z].concat(i.slice(3)):[r.x,r.y,i[2]].concat(i.slice(3)):[r.x,r.y].concat(i.slice(2)):[r.x,r.y]):(s=Eu(t,e,i,n),2===(o=Object.keys(i)).length||o.forEach(function(n){if(void 0!==t.name&&"geocent"===t.name||void 0!==e.name&&"geocent"===e.name){if("x"===n||"y"===n||"z"===n)return}else if("x"===n||"y"===n)return;s[n]=i[n]}),s)}function Iu(t){return t instanceof gu?t:"object"==typeof t&&"oProj"in t?t.oProj:gu(t)}var Tu="AJSAJS",ku="AFAFAF",Ru=65,Au=73,Gu=79;const Ou={forward:Fu,inverse:function(t){var e=Du(qu(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat,e.lon,e.lat]:[e.left,e.bottom,e.right,e.top]},toPoint:Lu};function Fu(t,e){return e=e||5,function(t,e){var i,n,r,s,o,a,l,h,u,c,d,f="00000"+t.easting,p="00000"+t.northing;return t.zoneNumber+t.zoneLetter+(u=t.easting,c=t.northing,d=zu(t.zoneNumber),i=Math.floor(u/1e5),n=Math.floor(c/1e5)%20,s=Tu.charCodeAt(r=d-1),o=ku.charCodeAt(r),h=!1,(a=s+i-1)>90&&(a=a-90+Ru-1,h=!0),(a===Au||s<Au&&a>Au||(a>Au||s<Au)&&h)&&a++,(a===Gu||s<Gu&&a>Gu||(a>Gu||s<Gu)&&h)&&++a===Au&&a++,a>90&&(a=a-90+Ru-1),(l=o+n)>86?(l=l-86+Ru-1,h=!0):h=!1,(l===Au||o<Au&&l>Au||(l>Au||o<Au)&&h)&&l++,(l===Gu||o<Gu&&l>Gu||(l>Gu||o<Gu)&&h)&&++l===Au&&l++,l>86&&(l=l-86+Ru-1),String.fromCharCode(a)+String.fromCharCode(l))+f.substr(f.length-5,e)+p.substr(p.length-5,e)}(function(t){var e,i,n,r,s,o,a,l=t.lat,h=t.lon,u=6378137,c=.00669438,d=.9996,f=ju(l),p=ju(h);a=Math.floor((h+180)/6)+1,180===h&&(a=60),l>=56&&l<64&&h>=3&&h<12&&(a=32),l>=72&&l<84&&(h>=0&&h<9?a=31:h>=9&&h<21?a=33:h>=21&&h<33?a=35:h>=33&&h<42&&(a=37)),o=ju(6*(a-1)-180+3),e=.006739496752268451,i=u/Math.sqrt(1-c*Math.sin(f)*Math.sin(f)),n=Math.tan(f)*Math.tan(f),r=e*Math.cos(f)*Math.cos(f);var g,m,y=d*i*((s=Math.cos(f)*(p-o))+(1-n+r)*s*s*s/6+(5-18*n+n*n+72*r-58*e)*s*s*s*s*s/120)+5e5,_=d*(u*(.9983242984503243*f-.002514607064228144*Math.sin(2*f)+2639046602129982e-21*Math.sin(4*f)-3.418046101696858e-9*Math.sin(6*f))+i*Math.tan(f)*(s*s/2+(5-n+9*r+4*r*r)*s*s*s*s/24+(61-58*n+n*n+600*r-2.2240339282485886)*s*s*s*s*s*s/720));return l<0&&(_+=1e7),{northing:Math.round(_),easting:Math.round(y),zoneNumber:a,zoneLetter:(g=l,m="Z",84>=g&&g>=72?m="X":72>g&&g>=64?m="W":64>g&&g>=56?m="V":56>g&&g>=48?m="U":48>g&&g>=40?m="T":40>g&&g>=32?m="S":32>g&&g>=24?m="R":24>g&&g>=16?m="Q":16>g&&g>=8?m="P":8>g&&g>=0?m="N":0>g&&g>=-8?m="M":-8>g&&g>=-16?m="L":-16>g&&g>=-24?m="K":-24>g&&g>=-32?m="J":-32>g&&g>=-40?m="H":-40>g&&g>=-48?m="G":-48>g&&g>=-56?m="F":-56>g&&g>=-64?m="E":-64>g&&g>=-72?m="D":-72>g&&g>=-80&&(m="C"),m)}}({lat:t[1],lon:t[0]}),e)}function Lu(t){var e=Du(qu(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat]:[(e.left+e.right)/2,(e.top+e.bottom)/2]}function ju(t){return t*(Math.PI/180)}function Nu(t){return t/Math.PI*180}function Du(t){var e=t.northing,i=t.easting,n=t.zoneLetter,r=t.zoneNumber;if(r<0||r>60)return null;var s,o,a,l,h,u,c,d,f,p=.9996,g=6378137,m=.00669438,y=(1-Math.sqrt(.99330562))/(1+Math.sqrt(.99330562)),_=i-5e5,v=e;n<"N"&&(v-=1e7),c=6*(r-1)-180+3,s=.006739496752268451,f=(d=v/p/6367449.145945056)+(3*y/2-27*y*y*y/32)*Math.sin(2*d)+(21*y*y/16-55*y*y*y*y/32)*Math.sin(4*d)+151*y*y*y/96*Math.sin(6*d),o=g/Math.sqrt(1-m*Math.sin(f)*Math.sin(f)),a=Math.tan(f)*Math.tan(f),l=s*Math.cos(f)*Math.cos(f),h=.99330562*g/Math.pow(1-m*Math.sin(f)*Math.sin(f),1.5),u=_/(o*p);var x=f-o*Math.tan(f)/h*(u*u/2-(5+3*a+10*l-4*l*l-9*s)*u*u*u*u/24+(61+90*a+298*l+45*a*a-1.6983531815716497-3*l*l)*u*u*u*u*u*u/720);x=Nu(x);var w,b=(u-(1+2*a+l)*u*u*u/6+(5-2*l+28*a-3*l*l+8*s+24*a*a)*u*u*u*u*u/120)/Math.cos(f);if(b=c+Nu(b),t.accuracy){var S=Du({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});w={top:S.lat,right:S.lon,bottom:x,left:b}}else w={lat:x,lon:b};return w}function zu(t){var e=t%6;return 0===e&&(e=6),e}function qu(t){if(t&&0===t.length)throw"MGRSPoint coverting from nothing";for(var e,i=t.length,n=null,r="",s=0;!/[A-Z]/.test(e=t.charAt(s));){if(s>=2)throw"MGRSPoint bad conversion from: "+t;r+=e,s++}var o=parseInt(r,10);if(0===s||s+3>i)throw"MGRSPoint bad conversion from: "+t;var a=t.charAt(s++);if(a<="A"||"B"===a||"Y"===a||a>="Z"||"I"===a||"O"===a)throw"MGRSPoint zone letter "+a+" not handled: "+t;n=t.substring(s,s+=2);for(var l=zu(o),h=function(t,e){for(var i=Tu.charCodeAt(e-1),n=1e5,r=!1;i!==t.charCodeAt(0);){if(++i===Au&&i++,i===Gu&&i++,i>90){if(r)throw"Bad character: "+t;i=Ru,r=!0}n+=1e5}return n}(n.charAt(0),l),u=function(t,e){if(t>"V")throw"MGRSPoint given invalid Northing "+t;for(var i=ku.charCodeAt(e-1),n=0,r=!1;i!==t.charCodeAt(0);){if(++i===Au&&i++,i===Gu&&i++,i>86){if(r)throw"Bad character: "+t;i=Ru,r=!0}n+=1e5}return n}(n.charAt(1),l);u<$u(a);)u+=2e6;var c=i-s;if(c%2!=0)throw"MGRSPoint has to have an even number \nof digits after the zone letter and two 100km letters - front \nhalf for easting meters, second half for \nnorthing meters"+t;var d,f,p,g=c/2,m=0,y=0;return g>0&&(d=1e5/Math.pow(10,g),f=t.substring(s,s+g),m=parseFloat(f)*d,p=t.substring(s+g),y=parseFloat(p)*d),{easting:m+h,northing:y+u,zoneLetter:a,zoneNumber:o,accuracy:d}}function $u(t){var e;switch(t){case"C":e=11e5;break;case"D":e=2e6;break;case"E":e=28e5;break;case"F":e=37e5;break;case"G":e=46e5;break;case"H":e=55e5;break;case"J":e=64e5;break;case"K":e=73e5;break;case"L":e=82e5;break;case"M":e=91e5;break;case"N":e=0;break;case"P":e=8e5;break;case"Q":e=17e5;break;case"R":e=26e5;break;case"S":e=35e5;break;case"T":e=44e5;break;case"U":e=53e5;break;case"V":e=62e5;break;case"W":e=7e6;break;case"X":e=79e5;break;default:e=-1}if(e>=0)return e;throw"Invalid zone letter: "+t}function Bu(t,e,i){if(!(this instanceof Bu))return new Bu(t,e,i);if(Array.isArray(t))this.x=t[0],this.y=t[1],this.z=t[2]||0;else if("object"==typeof t)this.x=t.x,this.y=t.y,this.z=t.z||0;else if("string"==typeof t&&void 0===e){var n=t.split(",");this.x=parseFloat(n[0]),this.y=parseFloat(n[1]),this.z=parseFloat(n[2])||0}else this.x=t,this.y=e,this.z=i||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}Bu.fromMGRS=function(t){return new Bu(Lu(t))},Bu.prototype.toMGRS=function(t){return Fu([this.x,this.y],t)};const Uu=Bu;var Wu=.046875,Xu=.01953125,Vu=.01068115234375;function Ku(t){var e=[];e[0]=1-t*(.25+t*(Wu+t*(Xu+t*Vu))),e[1]=t*(.75-t*(Wu+t*(Xu+t*Vu)));var i=t*t;return e[2]=i*(.46875-t*(.013020833333333334+.007120768229166667*t)),i*=t,e[3]=i*(.3645833333333333-.005696614583333333*t),e[4]=i*t*.3076171875,e}function Zu(t,e,i,n){return i*=e,e*=e,n[0]*t-i*(n[1]+e*(n[2]+e*(n[3]+e*n[4])))}function Yu(t,e,i){for(var n=1/(1-e),r=t,s=20;s;--s){var o=Math.sin(r),a=1-e*o*o;if(r-=a=(Zu(r,o,Math.cos(r),i)-t)*(a*Math.sqrt(a))*n,Math.abs(a)<rh)return r}return r}const Hu={init:function(){this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.es&&(this.en=Ku(this.es),this.ml0=Zu(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))},forward:function(t){var e,i,n,r=t.x,s=t.y,o=$h(r-this.long0,this.over),a=Math.sin(s),l=Math.cos(s);if(this.es){var h=l*o,u=Math.pow(h,2),c=this.ep2*Math.pow(l,2),d=Math.pow(c,2),f=Math.abs(l)>rh?Math.tan(s):0,p=Math.pow(f,2),g=Math.pow(p,2);e=1-this.es*Math.pow(a,2),h/=Math.sqrt(e);var m=Zu(s,a,l,this.en);i=this.a*(this.k0*h*(1+u/6*(1-p+c+u/20*(5-18*p+g+14*c-58*p*c+u/42*(61+179*g-g*p-479*p)))))+this.x0,n=this.a*(this.k0*(m-this.ml0+a*o*h/2*(1+u/12*(5-p+9*c+4*d+u/30*(61+g-58*p+270*c-330*p*c+u/56*(1385+543*g-g*p-3111*p))))))+this.y0}else{var y=l*Math.sin(o);if(Math.abs(Math.abs(y)-1)<rh)return 93;if(i=.5*this.a*this.k0*Math.log((1+y)/(1-y))+this.x0,n=l*Math.cos(o)/Math.sqrt(1-Math.pow(y,2)),(y=Math.abs(n))>=1){if(y-1>rh)return 93;n=0}else n=Math.acos(n);s<0&&(n=-n),n=this.a*this.k0*(n-this.lat0)+this.y0}return t.x=i,t.y=n,t},inverse:function(t){var e,i,n,r,s=(t.x-this.x0)*(1/this.a),o=(t.y-this.y0)*(1/this.a);if(this.es)if(i=Yu(e=this.ml0+o/this.k0,this.es,this.en),Math.abs(i)<nh){var a=Math.sin(i),l=Math.cos(i),h=Math.abs(l)>rh?Math.tan(i):0,u=this.ep2*Math.pow(l,2),c=Math.pow(u,2),d=Math.pow(h,2),f=Math.pow(d,2);e=1-this.es*Math.pow(a,2);var p=s*Math.sqrt(e)/this.k0,g=Math.pow(p,2);n=i-(e*=h)*g/(1-this.es)*.5*(1-g/12*(5+3*d-9*u*d+u-4*c-g/30*(61+90*d-252*u*d+45*f+46*u-g/56*(1385+3633*d+4095*f+1574*f*d)))),r=$h(this.long0+p*(1-g/6*(1+2*d+u-g/20*(5+28*d+24*f+8*u*d+6*u-g/42*(61+662*d+1320*f+720*f*d))))/l,this.over)}else n=nh*qh(o),r=0;else{var m=Math.exp(s/this.k0),y=.5*(m-1/m),_=this.lat0+o/this.k0,v=Math.cos(_);e=Math.sqrt((1-Math.pow(v,2))/(1+Math.pow(y,2))),n=Math.asin(e),o<0&&(n=-n),r=0===y&&0===v?0:$h(Math.atan2(y,v)+this.long0,this.over)}return t.x=r,t.y=n,t},names:["Fast_Transverse_Mercator","Fast Transverse Mercator"]};function Ju(t){var e=Math.exp(t);return(e-1/e)/2}function Qu(t,e){t=Math.abs(t),e=Math.abs(e);var i=Math.max(t,e),n=Math.min(t,e)/(i||1);return i*Math.sqrt(1+Math.pow(n,2))}function tc(t,e){for(var i,n=2*Math.cos(2*e),r=t.length-1,s=t[r],o=0;--r>=0;)i=n*s-o+t[r],o=s,s=i;return e+i*Math.sin(2*e)}function ec(t,e,i){for(var n,r,s=Math.sin(e),o=Math.cos(e),a=Ju(i),l=function(t){var e=Math.exp(t);return(e+1/e)/2}(i),h=2*o*l,u=-2*s*a,c=t.length-1,d=t[c],f=0,p=0,g=0;--c>=0;)n=p,r=f,d=h*(p=d)-n-u*(f=g)+t[c],g=u*p-r+h*f;return[(h=s*l)*d-(u=o*a)*g,h*g+u*d]}const ic={init:function(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');this.approx&&(Hu.init.apply(this),this.forward=Hu.forward,this.inverse=Hu.inverse),this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var t=this.es/(1+Math.sqrt(1-this.es)),e=t/(2-t),i=e;this.cgb[0]=e*(2+e*(-2/3+e*(e*(116/45+e*(26/45+e*(-2854/675)))-2))),this.cbg[0]=e*(e*(2/3+e*(4/3+e*(-82/45+e*(32/45+e*(4642/4725)))))-2),i*=e,this.cgb[1]=i*(7/3+e*(e*(-227/45+e*(2704/315+e*(2323/945)))-1.6)),this.cbg[1]=i*(5/3+e*(-16/15+e*(-13/9+e*(904/315+e*(-1522/945))))),i*=e,this.cgb[2]=i*(56/15+e*(-136/35+e*(-1262/105+e*(73814/2835)))),this.cbg[2]=i*(-26/15+e*(34/21+e*(1.6+e*(-12686/2835)))),i*=e,this.cgb[3]=i*(4279/630+e*(-332/35+e*(-399572/14175))),this.cbg[3]=i*(1237/630+e*(e*(-24832/14175)-2.4)),i*=e,this.cgb[4]=i*(4174/315+e*(-144838/6237)),this.cbg[4]=i*(-734/315+e*(109598/31185)),i*=e,this.cgb[5]=i*(601676/22275),this.cbg[5]=i*(444337/155925),i=Math.pow(e,2),this.Qn=this.k0/(1+e)*(1+i*(1/4+i*(1/64+i/256))),this.utg[0]=e*(e*(2/3+e*(-37/96+e*(1/360+e*(81/512+e*(-96199/604800)))))-.5),this.gtu[0]=e*(.5+e*(-2/3+e*(5/16+e*(41/180+e*(-127/288+e*(7891/37800)))))),this.utg[1]=i*(-1/48+e*(-1/15+e*(437/1440+e*(-46/105+e*(1118711/3870720))))),this.gtu[1]=i*(13/48+e*(e*(557/1440+e*(281/630+e*(-1983433/1935360)))-.6)),i*=e,this.utg[2]=i*(-17/480+e*(37/840+e*(209/4480+e*(-5569/90720)))),this.gtu[2]=i*(61/240+e*(-103/140+e*(15061/26880+e*(167603/181440)))),i*=e,this.utg[3]=i*(-4397/161280+e*(11/504+e*(830251/7257600))),this.gtu[3]=i*(49561/161280+e*(-179/168+e*(6601661/7257600))),i*=e,this.utg[4]=i*(-4583/161280+e*(108847/3991680)),this.gtu[4]=i*(34729/80640+e*(-3418889/1995840)),i*=e,this.utg[5]=i*(-20648693/638668800),this.gtu[5]=.6650675310896665*i;var n=tc(this.cbg,this.lat0);this.Zb=-this.Qn*(n+function(t,e){for(var i,n=2*Math.cos(e),r=t.length-1,s=t[r],o=0;--r>=0;)i=n*s-o+t[r],o=s,s=i;return Math.sin(e)*i}(this.gtu,2*n))},forward:function(t){var e=$h(t.x-this.long0,this.over),i=t.y;i=tc(this.cbg,i);var n=Math.sin(i),r=Math.cos(i),s=Math.sin(e),o=Math.cos(e);i=Math.atan2(n,o*r),e=Math.atan2(s*r,Qu(n,r*o)),e=function(t){var e=Math.abs(t);return e=function(t){var e=1+t,i=e-1;return 0===i?t:t*Math.log(e)/i}(e*(1+e/(Qu(1,e)+1))),t<0?-e:e}(Math.tan(e));var a,l,h=ec(this.gtu,2*i,2*e);return i+=h[0],e+=h[1],Math.abs(e)<=2.623395162778?(a=this.a*(this.Qn*e)+this.x0,l=this.a*(this.Qn*i+this.Zb)+this.y0):(a=1/0,l=1/0),t.x=a,t.y=l,t},inverse:function(t){var e,i,n=(t.x-this.x0)*(1/this.a),r=(t.y-this.y0)*(1/this.a);if(r=(r-this.Zb)/this.Qn,n/=this.Qn,Math.abs(n)<=2.623395162778){var s=ec(this.utg,2*r,2*n);r+=s[0],n+=s[1],n=Math.atan(Ju(n));var o=Math.sin(r),a=Math.cos(r),l=Math.sin(n),h=Math.cos(n);r=Math.atan2(o*h,Qu(l,h*a)),e=$h((n=Math.atan2(l,h*a))+this.long0,this.over),i=tc(this.cgb,r)}else e=1/0,i=1/0;return t.x=e,t.y=i,t},names:["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","Gauss Kruger","Gauss_Kruger","tmerc"]},nc={init:function(){var t=function(t,e){if(void 0===t){if((t=Math.floor(30*($h(e)+Math.PI)/Math.PI)+1)<0)return 0;if(t>60)return 60}return t}(this.zone,this.long0);if(void 0===t)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(t)-183)*sh,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,ic.init.apply(this),this.forward=ic.forward,this.inverse=ic.inverse},names:["Universal Transverse Mercator System","utm"],dependsOn:"etmerc"};function rc(t,e){return Math.pow((1-t)/(1+t),e)}const sc={init:function(){var t=Math.sin(this.lat0),e=Math.cos(this.lat0);e*=e,this.rc=Math.sqrt(1-this.es)/(1-this.es*t*t),this.C=Math.sqrt(1+this.es*e*e/(1-this.es)),this.phic0=Math.asin(t/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+ah)/(Math.pow(Math.tan(.5*this.lat0+ah),this.C)*rc(this.e*t,this.ratexp))},forward:function(t){var e=t.x,i=t.y;return t.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*i+ah),this.C)*rc(this.e*Math.sin(i),this.ratexp))-nh,t.x=this.C*e,t},inverse:function(t){for(var e=t.x/this.C,i=t.y,n=Math.pow(Math.tan(.5*i+ah)/this.K,1/this.C),r=20;r>0&&(i=2*Math.atan(n*rc(this.e*Math.sin(t.y),-.5*this.e))-nh,!(Math.abs(i-t.y)<1e-14));--r)t.y=i;return r?(t.x=e,t.y=i,t):null},names:["gauss"]},oc={init:function(){sc.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))},forward:function(t){var e,i,n,r;return t.x=$h(t.x-this.long0,this.over),sc.forward.apply(this,[t]),e=Math.sin(t.y),i=Math.cos(t.y),n=Math.cos(t.x),r=this.k0*this.R2/(1+this.sinc0*e+this.cosc0*i*n),t.x=r*i*Math.sin(t.x),t.y=r*(this.cosc0*e-this.sinc0*i*n),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t},inverse:function(t){var e,i,n,r,s;if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,s=Qu(t.x,t.y)){var o=2*Math.atan2(s,this.R2);e=Math.sin(o),i=Math.cos(o),r=Math.asin(i*this.sinc0+t.y*e*this.cosc0/s),n=Math.atan2(t.x*e,s*this.cosc0*i-t.y*this.sinc0*e)}else r=this.phic0,n=0;return t.x=n,t.y=r,sc.inverse.apply(this,[t]),t.x=$h(t.x+this.long0,this.over),t},names:["Stereographic_North_Pole","Oblique_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"]};function ac(t,e,i){return e*=i,Math.tan(.5*(nh+t))*Math.pow((1-e)/(1+e),.5*i)}const lc={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=rh&&(this.k0=.5*(1+qh(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=rh&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=rh&&Math.abs(Math.cos(this.lat_ts))>rh&&(this.k0=.5*this.cons*zh(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/Bh(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=zh(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(ac(this.lat0,this.sinlat0,this.e))-nh,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))},forward:function(t){var e,i,n,r,s,o,a=t.x,l=t.y,h=Math.sin(l),u=Math.cos(l),c=$h(a-this.long0,this.over);return Math.abs(Math.abs(a-this.long0)-Math.PI)<=rh&&Math.abs(l+this.lat0)<=rh?(t.x=NaN,t.y=NaN,t):this.sphere?(e=2*this.k0/(1+this.sinlat0*h+this.coslat0*u*Math.cos(c)),t.x=this.a*e*u*Math.sin(c)+this.x0,t.y=this.a*e*(this.coslat0*h-this.sinlat0*u*Math.cos(c))+this.y0,t):(i=2*Math.atan(ac(l,h,this.e))-nh,r=Math.cos(i),n=Math.sin(i),Math.abs(this.coslat0)<=rh?(s=Bh(this.e,l*this.con,this.con*h),o=2*this.a*this.k0*s/this.cons,t.x=this.x0+o*Math.sin(a-this.long0),t.y=this.y0-this.con*o*Math.cos(a-this.long0),t):(Math.abs(this.sinlat0)<rh?(e=2*this.a*this.k0/(1+r*Math.cos(c)),t.y=e*n):(e=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*n+this.cosX0*r*Math.cos(c))),t.y=e*(this.cosX0*n-this.sinX0*r*Math.cos(c))+this.y0),t.x=e*r*Math.sin(c)+this.x0,t))},inverse:function(t){var e,i,n,r,s;t.x-=this.x0,t.y-=this.y0;var o=Math.sqrt(t.x*t.x+t.y*t.y);if(this.sphere){var a=2*Math.atan(o/(2*this.a*this.k0));return e=this.long0,i=this.lat0,o<=rh?(t.x=e,t.y=i,t):(i=Math.asin(Math.cos(a)*this.sinlat0+t.y*Math.sin(a)*this.coslat0/o),e=Math.abs(this.coslat0)<rh?this.lat0>0?$h(this.long0+Math.atan2(t.x,-1*t.y),this.over):$h(this.long0+Math.atan2(t.x,t.y),this.over):$h(this.long0+Math.atan2(t.x*Math.sin(a),o*this.coslat0*Math.cos(a)-t.y*this.sinlat0*Math.sin(a)),this.over),t.x=e,t.y=i,t)}if(Math.abs(this.coslat0)<=rh){if(o<=rh)return i=this.lat0,e=this.long0,t.x=e,t.y=i,t;t.x*=this.con,t.y*=this.con,n=o*this.cons/(2*this.a*this.k0),i=this.con*Uh(this.e,n),e=this.con*$h(this.con*this.long0+Math.atan2(t.x,-1*t.y),this.over)}else r=2*Math.atan(o*this.cosX0/(2*this.a*this.k0*this.ms1)),e=this.long0,o<=rh?s=this.X0:(s=Math.asin(Math.cos(r)*this.sinX0+t.y*Math.sin(r)*this.cosX0/o),e=$h(this.long0+Math.atan2(t.x*Math.sin(r),o*this.cosX0*Math.cos(r)-t.y*this.sinX0*Math.sin(r)),this.over)),i=-1*Uh(this.e,Math.tan(.5*(nh+s)));return t.x=e,t.y=i,t},names:["stere","Stereographic_South_Pole","Polar_Stereographic_variant_A","Polar_Stereographic_variant_B","Polar_Stereographic"],ssfn_:ac},hc={init:function(){var t=this.lat0;this.lambda0=this.long0;var e=Math.sin(t),i=this.a,n=1/this.rf,r=2*n-Math.pow(n,2),s=this.e=Math.sqrt(r);this.R=this.k0*i*Math.sqrt(1-r)/(1-r*Math.pow(e,2)),this.alpha=Math.sqrt(1+r/(1-r)*Math.pow(Math.cos(t),4)),this.b0=Math.asin(e/this.alpha);var o=Math.log(Math.tan(Math.PI/4+this.b0/2)),a=Math.log(Math.tan(Math.PI/4+t/2)),l=Math.log((1+s*e)/(1-s*e));this.K=o-this.alpha*a+this.alpha*s/2*l},forward:function(t){var e=Math.log(Math.tan(Math.PI/4-t.y/2)),i=this.e/2*Math.log((1+this.e*Math.sin(t.y))/(1-this.e*Math.sin(t.y))),n=-this.alpha*(e+i)+this.K,r=2*(Math.atan(Math.exp(n))-Math.PI/4),s=this.alpha*(t.x-this.lambda0),o=Math.atan(Math.sin(s)/(Math.sin(this.b0)*Math.tan(r)+Math.cos(this.b0)*Math.cos(s))),a=Math.asin(Math.cos(this.b0)*Math.sin(r)-Math.sin(this.b0)*Math.cos(r)*Math.cos(s));return t.y=this.R/2*Math.log((1+Math.sin(a))/(1-Math.sin(a)))+this.y0,t.x=this.R*o+this.x0,t},inverse:function(t){for(var e=t.x-this.x0,i=t.y-this.y0,n=e/this.R,r=2*(Math.atan(Math.exp(i/this.R))-Math.PI/4),s=Math.asin(Math.cos(this.b0)*Math.sin(r)+Math.sin(this.b0)*Math.cos(r)*Math.cos(n)),o=Math.atan(Math.sin(n)/(Math.cos(this.b0)*Math.cos(n)-Math.sin(this.b0)*Math.tan(r))),a=this.lambda0+o/this.alpha,l=0,h=s,u=-1e3,c=0;Math.abs(h-u)>1e-7;){if(++c>20)return;l=1/this.alpha*(Math.log(Math.tan(Math.PI/4+s/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(h))/2)),u=h,h=2*Math.atan(Math.exp(l))-Math.PI/2}return t.x=a,t.y=h,t},names:["somerc"]};var uc=1e-7;const cc={init:function(){var t,e,i,n,r,s,o,a,l,h,u,c,d,f,p=0,g=0,m=0,y=0,_=0,v=0,x=0;this.no_off=(d=["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],f="object"==typeof(c=this).projName?Object.keys(c.projName)[0]:c.projName,"no_uoff"in c||"no_off"in c||-1!==d.indexOf(f)||-1!==d.indexOf(Hh(f))),this.no_rot="no_rot"in this;var w=!1;"alpha"in this&&(w=!0);var b=!1;if("rectified_grid_angle"in this&&(b=!0),w&&(x=this.alpha),b&&(p=this.rectified_grid_angle),w||b)g=this.longc;else if(m=this.long1,_=this.lat1,y=this.long2,v=this.lat2,Math.abs(_-v)<=uc||(t=Math.abs(_))<=uc||Math.abs(t-nh)<=uc||Math.abs(Math.abs(this.lat0)-nh)<=uc||Math.abs(Math.abs(v)-nh)<=uc)throw new Error;var S=1-this.es;e=Math.sqrt(S),Math.abs(this.lat0)>rh?(a=Math.sin(this.lat0),i=Math.cos(this.lat0),t=1-this.es*a*a,this.B=i*i,this.B=Math.sqrt(1+this.es*this.B*this.B/S),this.A=this.B*this.k0*e/t,(r=(n=this.B*e/(i*Math.sqrt(t)))*n-1)<=0?r=0:(r=Math.sqrt(r),this.lat0<0&&(r=-r)),this.E=r+=n,this.E*=Math.pow(Bh(this.e,this.lat0,a),this.B)):(this.B=1/e,this.A=this.k0,this.E=n=r=1),w||b?(w?(u=Math.asin(Math.sin(x)/n),b||(p=x)):(u=p,x=Math.asin(n*Math.sin(u))),this.lam0=g-Math.asin(.5*(r-1/r)*Math.tan(u))/this.B):(s=Math.pow(Bh(this.e,_,Math.sin(_)),this.B),o=Math.pow(Bh(this.e,v,Math.sin(v)),this.B),r=this.E/s,l=(o-s)/(o+s),h=((h=this.E*this.E)-o*s)/(h+o*s),(t=m-y)<-Math.PI?y-=lh:t>Math.PI&&(y+=lh),this.lam0=$h(.5*(m+y)-Math.atan(h*Math.tan(.5*this.B*(m-y))/l)/this.B,this.over),u=Math.atan(2*Math.sin(this.B*$h(m-this.lam0,this.over))/(r-1/r)),p=x=Math.asin(n*Math.sin(u))),this.singam=Math.sin(u),this.cosgam=Math.cos(u),this.sinrot=Math.sin(p),this.cosrot=Math.cos(p),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(n*n-1)/Math.cos(x))),this.lat0<0&&(this.u_0=-this.u_0)),r=.5*u,this.v_pole_n=this.ArB*Math.log(Math.tan(ah-r)),this.v_pole_s=this.ArB*Math.log(Math.tan(ah+r))},forward:function(t){var e,i,n,r,s,o,a,l,h={};if(t.x=t.x-this.lam0,Math.abs(Math.abs(t.y)-nh)>rh){if(e=.5*((s=this.E/Math.pow(Bh(this.e,t.y,Math.sin(t.y)),this.B))-(o=1/s)),i=.5*(s+o),r=Math.sin(this.B*t.x),n=(e*this.singam-r*this.cosgam)/i,Math.abs(Math.abs(n)-1)<rh)throw new Error;l=.5*this.ArB*Math.log((1-n)/(1+n)),o=Math.cos(this.B*t.x),a=Math.abs(o)<uc?this.A*t.x:this.ArB*Math.atan2(e*this.cosgam+r*this.singam,o)}else l=t.y>0?this.v_pole_n:this.v_pole_s,a=this.ArB*t.y;return this.no_rot?(h.x=a,h.y=l):(a-=this.u_0,h.x=l*this.cosrot+a*this.sinrot,h.y=a*this.cosrot-l*this.sinrot),h.x=this.a*h.x+this.x0,h.y=this.a*h.y+this.y0,h},inverse:function(t){var e,i,n,r,s,o,a,l={};if(t.x=(t.x-this.x0)*(1/this.a),t.y=(t.y-this.y0)*(1/this.a),this.no_rot?(i=t.y,e=t.x):(i=t.x*this.cosrot-t.y*this.sinrot,e=t.y*this.cosrot+t.x*this.sinrot+this.u_0),r=.5*((n=Math.exp(-this.BrA*i))-1/n),s=.5*(n+1/n),a=((o=Math.sin(this.BrA*e))*this.cosgam+r*this.singam)/s,Math.abs(Math.abs(a)-1)<rh)l.x=0,l.y=a<0?-nh:nh;else{if(l.y=this.E/Math.sqrt((1+a)/(1-a)),l.y=Uh(this.e,Math.pow(l.y,1/this.B)),l.y===1/0)throw new Error;l.x=-this.rB*Math.atan2(r*this.cosgam-o*this.singam,Math.cos(this.BrA*e))}return l.x+=this.lam0,l},names:["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Variant_B","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","Oblique_Mercator","omerc"]},dc={init:function(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(Math.abs(this.lat1+this.lat2)<rh)){var t=this.b/this.a;this.e=Math.sqrt(1-t*t);var e=Math.sin(this.lat1),i=Math.cos(this.lat1),n=zh(this.e,e,i),r=Bh(this.e,this.lat1,e),s=Math.sin(this.lat2),o=Math.cos(this.lat2),a=zh(this.e,s,o),l=Bh(this.e,this.lat2,s),h=Math.abs(Math.abs(this.lat0)-nh)<rh?0:Bh(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>rh?this.ns=Math.log(n/a)/Math.log(r/l):this.ns=e,isNaN(this.ns)&&(this.ns=e),this.f0=n/(this.ns*Math.pow(r,this.ns)),this.rh=this.a*this.f0*Math.pow(h,this.ns),this.title||(this.title="Lambert Conformal Conic")}},forward:function(t){var e=t.x,i=t.y;Math.abs(2*Math.abs(i)-Math.PI)<=rh&&(i=qh(i)*(nh-2e-10));var n,r,s=Math.abs(Math.abs(i)-nh);if(s>rh)n=Bh(this.e,i,Math.sin(i)),r=this.a*this.f0*Math.pow(n,this.ns);else{if((s=i*this.ns)<=0)return null;r=0}var o=this.ns*$h(e-this.long0,this.over);return t.x=this.k0*(r*Math.sin(o))+this.x0,t.y=this.k0*(this.rh-r*Math.cos(o))+this.y0,t},inverse:function(t){var e,i,n,r,s,o=(t.x-this.x0)/this.k0,a=this.rh-(t.y-this.y0)/this.k0;this.ns>0?(e=Math.sqrt(o*o+a*a),i=1):(e=-Math.sqrt(o*o+a*a),i=-1);var l=0;if(0!==e&&(l=Math.atan2(i*o,i*a)),0!==e||this.ns>0){if(i=1/this.ns,n=Math.pow(e/(this.a*this.f0),i),-9999===(r=Uh(this.e,n)))return null}else r=-nh;return s=$h(l/this.ns+this.long0,this.over),t.x=s,t.y=r,t},names:["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","lcc","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"]},fc={init:function(){this.a=6377397.155,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.4334234309119251),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq},forward:function(t){var e,i,n,r,s,o,a,l=t.x,h=t.y,u=$h(l-this.long0,this.over);return e=Math.pow((1+this.e*Math.sin(h))/(1-this.e*Math.sin(h)),this.alfa*this.e/2),i=2*(Math.atan(this.k*Math.pow(Math.tan(h/2+this.s45),this.alfa)/e)-this.s45),n=-u*this.alfa,r=Math.asin(Math.cos(this.ad)*Math.sin(i)+Math.sin(this.ad)*Math.cos(i)*Math.cos(n)),s=Math.asin(Math.cos(i)*Math.sin(n)/Math.cos(r)),o=this.n*s,a=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(r/2+this.s45),this.n),t.y=a*Math.cos(o)/1,t.x=a*Math.sin(o)/1,this.czech||(t.y*=-1,t.x*=-1),t},inverse:function(t){var e,i,n,r,s,o,a,l=t.x;t.x=t.y,t.y=l,this.czech||(t.y*=-1,t.x*=-1),s=Math.sqrt(t.x*t.x+t.y*t.y),r=Math.atan2(t.y,t.x)/Math.sin(this.s0),n=2*(Math.atan(Math.pow(this.ro0/s,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),e=Math.asin(Math.cos(this.ad)*Math.sin(n)-Math.sin(this.ad)*Math.cos(n)*Math.cos(r)),i=Math.asin(Math.cos(n)*Math.sin(r)/Math.cos(e)),t.x=this.long0-i/this.alfa,o=e,a=0;var h=0;do{t.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(e/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(o))/(1-this.e*Math.sin(o)),this.e/2))-this.s45),Math.abs(o-t.y)<1e-10&&(a=1),o=t.y,h+=1}while(0===a&&h<15);return h>=15?null:t},names:["Krovak","Krovak Modified","Krovak (North Orientated)","Krovak Modified (North Orientated)","krovak"]};function pc(t,e,i,n,r){return t*r-e*Math.sin(2*r)+i*Math.sin(4*r)-n*Math.sin(6*r)}function gc(t){return 1-.25*t*(1+t/16*(3+1.25*t))}function mc(t){return.375*t*(1+.25*t*(1+.46875*t))}function yc(t){return.05859375*t*t*(1+.75*t)}function _c(t){return t*t*t*(35/3072)}function vc(t,e,i){var n=e*i;return t/Math.sqrt(1-n*n)}function xc(t){return Math.abs(t)<nh?t:t-qh(t)*Math.PI}function wc(t,e,i,n,r){var s,o;s=t/e;for(var a=0;a<15;a++)if(s+=o=(t-(e*s-i*Math.sin(2*s)+n*Math.sin(4*s)-r*Math.sin(6*s)))/(e-2*i*Math.cos(2*s)+4*n*Math.cos(4*s)-6*r*Math.cos(6*s)),Math.abs(o)<=1e-10)return s;return NaN}const bc={init:function(){this.sphere||(this.e0=gc(this.es),this.e1=mc(this.es),this.e2=yc(this.es),this.e3=_c(this.es),this.ml0=this.a*pc(this.e0,this.e1,this.e2,this.e3,this.lat0))},forward:function(t){var e,i,n=t.x,r=t.y;if(n=$h(n-this.long0,this.over),this.sphere)e=this.a*Math.asin(Math.cos(r)*Math.sin(n)),i=this.a*(Math.atan2(Math.tan(r),Math.cos(n))-this.lat0);else{var s=Math.sin(r),o=Math.cos(r),a=vc(this.a,this.e,s),l=Math.tan(r)*Math.tan(r),h=n*Math.cos(r),u=h*h,c=this.es*o*o/(1-this.es);e=a*h*(1-u*l*(1/6-(8-l+8*c)*u/120)),i=this.a*pc(this.e0,this.e1,this.e2,this.e3,r)-this.ml0+a*s/o*u*(.5+(5-l+6*c)*u/24)}return t.x=e+this.x0,t.y=i+this.y0,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var e,i,n=t.x/this.a,r=t.y/this.a;if(this.sphere){var s=r+this.lat0;e=Math.asin(Math.sin(s)*Math.cos(n)),i=Math.atan2(Math.tan(n),Math.cos(s))}else{var o=wc(this.ml0/this.a+r,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(o)-nh)<=rh)return t.x=this.long0,t.y=nh,r<0&&(t.y*=-1),t;var a=vc(this.a,this.e,Math.sin(o)),l=a*a*a/this.a/this.a*(1-this.es),h=Math.pow(Math.tan(o),2),u=n*this.a/a,c=u*u;e=o-a*Math.tan(o)/l*u*u*(.5-(1+3*h)*u*u/24),i=u*(1-c*(h/3+(1+3*h)*h*c/15))/Math.cos(o)}return t.x=$h(i+this.long0,this.over),t.y=xc(e),t},names:["Cassini","Cassini_Soldner","cass"]};function Sc(t,e){var i;return t>1e-7?(1-t*t)*(e/(1-(i=t*e)*i)-.5/t*Math.log((1-i)/(1+i))):2*e}const Mc={init:function(){var t,e=Math.abs(this.lat0);if(Math.abs(e-nh)<rh?this.mode=this.lat0<0?1:2:Math.abs(e)<rh?this.mode=3:this.mode=4,this.es>0)switch(this.qp=Sc(this.e,1),this.mmf=.5/(1-this.es),this.apa=function(t){var e,i=[];return i[0]=.3333333333333333*t,e=t*t,i[0]+=.17222222222222222*e,i[1]=.06388888888888888*e,e*=t,i[0]+=.10257936507936508*e,i[1]+=.0664021164021164*e,i[2]=.016415012942191543*e,i}(this.es),this.mode){case 2:case 1:this.dd=1;break;case 3:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case 4:this.rq=Math.sqrt(.5*this.qp),t=Math.sin(this.lat0),this.sinb1=Sc(this.e,t)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*t*t)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd}else 4===this.mode&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))},forward:function(t){var e,i,n,r,s,o,a,l,h,u,c=t.x,d=t.y;if(c=$h(c-this.long0,this.over),this.sphere){if(s=Math.sin(d),u=Math.cos(d),n=Math.cos(c),this.mode===this.OBLIQ||this.mode===this.EQUIT){if((i=this.mode===this.EQUIT?1+u*n:1+this.sinph0*s+this.cosph0*u*n)<=rh)return null;e=(i=Math.sqrt(2/i))*u*Math.sin(c),i*=this.mode===this.EQUIT?s:this.cosph0*s-this.sinph0*u*n}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(n=-n),Math.abs(d+this.lat0)<rh)return null;i=ah-.5*d,e=(i=2*(this.mode===this.S_POLE?Math.cos(i):Math.sin(i)))*Math.sin(c),i*=n}}else{switch(a=0,l=0,h=0,n=Math.cos(c),r=Math.sin(c),s=Math.sin(d),o=Sc(this.e,s),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(a=o/this.qp,l=Math.sqrt(1-a*a)),this.mode){case this.OBLIQ:h=1+this.sinb1*a+this.cosb1*l*n;break;case this.EQUIT:h=1+l*n;break;case this.N_POLE:h=nh+d,o=this.qp-o;break;case this.S_POLE:h=d-nh,o=this.qp+o}if(Math.abs(h)<rh)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:h=Math.sqrt(2/h),i=this.mode===this.OBLIQ?this.ymf*h*(this.cosb1*a-this.sinb1*l*n):(h=Math.sqrt(2/(1+l*n)))*a*this.ymf,e=this.xmf*h*l*r;break;case this.N_POLE:case this.S_POLE:o>=0?(e=(h=Math.sqrt(o))*r,i=n*(this.mode===this.S_POLE?h:-h)):e=i=0}}return t.x=this.a*e+this.x0,t.y=this.a*i+this.y0,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var e,i,n,r,s,o,a,l,h,u,c=t.x/this.a,d=t.y/this.a;if(this.sphere){var f,p=0,g=0;if((i=.5*(f=Math.sqrt(c*c+d*d)))>1)return null;switch(i=2*Math.asin(i),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(g=Math.sin(i),p=Math.cos(i)),this.mode){case this.EQUIT:i=Math.abs(f)<=rh?0:Math.asin(d*g/f),c*=g,d=p*f;break;case this.OBLIQ:i=Math.abs(f)<=rh?this.lat0:Math.asin(p*this.sinph0+d*g*this.cosph0/f),c*=g*this.cosph0,d=(p-Math.sin(i)*this.sinph0)*f;break;case this.N_POLE:d=-d,i=nh-i;break;case this.S_POLE:i-=nh}e=0!==d||this.mode!==this.EQUIT&&this.mode!==this.OBLIQ?Math.atan2(c,d):0}else{if(a=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(c/=this.dd,d*=this.dd,(o=Math.sqrt(c*c+d*d))<rh)return t.x=this.long0,t.y=this.lat0,t;r=2*Math.asin(.5*o/this.rq),n=Math.cos(r),c*=r=Math.sin(r),this.mode===this.OBLIQ?(a=n*this.sinb1+d*r*this.cosb1/o,s=this.qp*a,d=o*this.cosb1*n-d*this.sinb1*r):(a=d*r/o,s=this.qp*a,d=o*n)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(d=-d),!(s=c*c+d*d))return t.x=this.long0,t.y=this.lat0,t;a=1-s/this.qp,this.mode===this.S_POLE&&(a=-a)}e=Math.atan2(c,d),u=(l=Math.asin(a))+l,i=l+(h=this.apa)[0]*Math.sin(u)+h[1]*Math.sin(u+u)+h[2]*Math.sin(u+u+u)}return t.x=$h(this.long0+e,this.over),t.y=i,t},names:["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],S_POLE:1,N_POLE:2,EQUIT:3,OBLIQ:4};function Ec(t){return Math.abs(t)>1&&(t=t>1?1:-1),Math.asin(t)}const Cc={init:function(){Math.abs(this.lat1+this.lat2)<rh||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=zh(this.e3,this.sin_po,this.cos_po),this.qs1=Sc(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=zh(this.e3,this.sin_po,this.cos_po),this.qs2=Sc(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=Sc(this.e3,this.sin_po),Math.abs(this.lat1-this.lat2)>rh?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)},forward:function(t){var e=t.x,i=t.y;this.sin_phi=Math.sin(i),this.cos_phi=Math.cos(i);var n=Sc(this.e3,this.sin_phi),r=this.a*Math.sqrt(this.c-this.ns0*n)/this.ns0,s=this.ns0*$h(e-this.long0,this.over),o=r*Math.sin(s)+this.x0,a=this.rh-r*Math.cos(s)+this.y0;return t.x=o,t.y=a,t},inverse:function(t){var e,i,n,r,s,o;return t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns0>=0?(e=Math.sqrt(t.x*t.x+t.y*t.y),n=1):(e=-Math.sqrt(t.x*t.x+t.y*t.y),n=-1),r=0,0!==e&&(r=Math.atan2(n*t.x,n*t.y)),n=e*this.ns0/this.a,this.sphere?o=Math.asin((this.c-n*n)/(2*this.ns0)):(i=(this.c-n*n)/this.ns0,o=this.phi1z(this.e3,i)),s=$h(r/this.ns0+this.long0,this.over),t.x=s,t.y=o,t},names:["Albers_Conic_Equal_Area","Albers_Equal_Area","Albers","aea"],phi1z:function(t,e){var i,n,r,s,o=Ec(.5*e);if(t<rh)return o;for(var a=t*t,l=1;l<=25;l++)if(o+=s=.5*(r=1-(n=t*(i=Math.sin(o)))*n)*r/Math.cos(o)*(e/(1-a)-i/r+.5/t*Math.log((1-n)/(1+n))),Math.abs(s)<=1e-7)return o;return null}},Pc={init:function(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1},forward:function(t){var e,i,n,r,s,o,a,l=t.x,h=t.y;return n=$h(l-this.long0,this.over),e=Math.sin(h),i=Math.cos(h),r=Math.cos(n),(s=this.sin_p14*e+this.cos_p14*i*r)>0||Math.abs(s)<=rh?(o=this.x0+1*this.a*i*Math.sin(n)/s,a=this.y0+1*this.a*(this.cos_p14*e-this.sin_p14*i*r)/s):(o=this.x0+this.infinity_dist*i*Math.sin(n),a=this.y0+this.infinity_dist*(this.cos_p14*e-this.sin_p14*i*r)),t.x=o,t.y=a,t},inverse:function(t){var e,i,n,r,s,o;return t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,(e=Math.sqrt(t.x*t.x+t.y*t.y))?(r=Math.atan2(e,this.rc),i=Math.sin(r),o=Ec((n=Math.cos(r))*this.sin_p14+t.y*i*this.cos_p14/e),s=Math.atan2(t.x*i,e*this.cos_p14*n-t.y*this.sin_p14*i),s=$h(this.long0+s,this.over)):(o=this.phic0,s=0),t.x=s,t.y=o,t},names:["gnom"]},Ic={init:function(){this.sphere||(this.k0=zh(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))},forward:function(t){var e,i,n=t.x,r=t.y,s=$h(n-this.long0,this.over);if(this.sphere)e=this.x0+this.a*s*Math.cos(this.lat_ts),i=this.y0+this.a*Math.sin(r)/Math.cos(this.lat_ts);else{var o=Sc(this.e,Math.sin(r));e=this.x0+this.a*this.k0*s,i=this.y0+this.a*o*.5/this.k0}return t.x=e,t.y=i,t},inverse:function(t){var e,i;return t.x-=this.x0,t.y-=this.y0,this.sphere?(e=$h(this.long0+t.x/this.a/Math.cos(this.lat_ts),this.over),i=Math.asin(t.y/this.a*Math.cos(this.lat_ts))):(i=function(t,e){var i=1-(1-t*t)/(2*t)*Math.log((1-t)/(1+t));if(Math.abs(Math.abs(e)-i)<1e-6)return e<0?-1*nh:nh;for(var n,r,s,o,a=Math.asin(.5*e),l=0;l<30;l++)if(r=Math.sin(a),s=Math.cos(a),o=t*r,a+=n=Math.pow(1-o*o,2)/(2*s)*(e/(1-t*t)-r/(1-o*o)+.5/t*Math.log((1-o)/(1+o))),Math.abs(n)<=1e-10)return a;return NaN}(this.e,2*t.y*this.k0/this.a),e=$h(this.long0+t.x/(this.a*this.k0),this.over)),t.x=e,t.y=i,t},names:["cea"]},Tc={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)},forward:function(t){var e=t.x,i=t.y,n=$h(e-this.long0,this.over),r=xc(i-this.lat0);return t.x=this.x0+this.a*n*this.rc,t.y=this.y0+this.a*r,t},inverse:function(t){var e=t.x,i=t.y;return t.x=$h(this.long0+(e-this.x0)/(this.a*this.rc),this.over),t.y=xc(this.lat0+(i-this.y0)/this.a),t},names:["Equirectangular","Equidistant_Cylindrical","Equidistant_Cylindrical_Spherical","eqc"]},kc={init:function(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=gc(this.es),this.e1=mc(this.es),this.e2=yc(this.es),this.e3=_c(this.es),this.ml0=this.a*pc(this.e0,this.e1,this.e2,this.e3,this.lat0)},forward:function(t){var e,i,n,r=t.x,s=t.y,o=$h(r-this.long0,this.over);if(n=o*Math.sin(s),this.sphere)Math.abs(s)<=rh?(e=this.a*o,i=-1*this.a*this.lat0):(e=this.a*Math.sin(n)/Math.tan(s),i=this.a*(xc(s-this.lat0)+(1-Math.cos(n))/Math.tan(s)));else if(Math.abs(s)<=rh)e=this.a*o,i=-1*this.ml0;else{var a=vc(this.a,this.e,Math.sin(s))/Math.tan(s);e=a*Math.sin(n),i=this.a*pc(this.e0,this.e1,this.e2,this.e3,s)-this.ml0+a*(1-Math.cos(n))}return t.x=e+this.x0,t.y=i+this.y0,t},inverse:function(t){var e,i,n,r,s,o,a,l,h;if(n=t.x-this.x0,r=t.y-this.y0,this.sphere)if(Math.abs(r+this.a*this.lat0)<=rh)e=$h(n/this.a+this.long0,this.over),i=0;else{var u;for(o=this.lat0+r/this.a,a=n*n/this.a/this.a+o*o,l=o,s=20;s;--s)if(l+=h=-1*(o*(l*(u=Math.tan(l))+1)-l-.5*(l*l+a)*u)/((l-o)/u-1),Math.abs(h)<=rh){i=l;break}e=$h(this.long0+Math.asin(n*Math.tan(l)/this.a)/Math.sin(i),this.over)}else if(Math.abs(r+this.ml0)<=rh)i=0,e=$h(this.long0+n/this.a,this.over);else{var c,d,f,p,g;for(o=(this.ml0+r)/this.a,a=n*n/this.a/this.a+o*o,l=o,s=20;s;--s)if(g=this.e*Math.sin(l),c=Math.sqrt(1-g*g)*Math.tan(l),d=this.a*pc(this.e0,this.e1,this.e2,this.e3,l),f=this.e0-2*this.e1*Math.cos(2*l)+4*this.e2*Math.cos(4*l)-6*this.e3*Math.cos(6*l),l-=h=(o*(c*(p=d/this.a)+1)-p-.5*c*(p*p+a))/(this.es*Math.sin(2*l)*(p*p+a-2*o*p)/(4*c)+(o-p)*(c*f-2/Math.sin(2*l))-f),Math.abs(h)<=rh){i=l;break}c=Math.sqrt(1-this.es*Math.pow(Math.sin(i),2))*Math.tan(i),e=$h(this.long0+Math.asin(n*c/this.a)/Math.sin(i),this.over)}return t.x=e,t.y=i,t},names:["Polyconic","American_Polyconic","poly"]},Rc={init:function(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013},forward:function(t){var e,i=t.x,n=t.y-this.lat0,r=i-this.long0,s=n/ih*1e-5,o=r,a=1,l=0;for(e=1;e<=10;e++)a*=s,l+=this.A[e]*a;var h,u=l,c=o,d=1,f=0,p=0,g=0;for(e=1;e<=6;e++)h=f*u+d*c,d=d*u-f*c,f=h,p=p+this.B_re[e]*d-this.B_im[e]*f,g=g+this.B_im[e]*d+this.B_re[e]*f;return t.x=g*this.a+this.x0,t.y=p*this.a+this.y0,t},inverse:function(t){var e,i,n=t.x,r=t.y,s=n-this.x0,o=(r-this.y0)/this.a,a=s/this.a,l=1,h=0,u=0,c=0;for(e=1;e<=6;e++)i=h*o+l*a,l=l*o-h*a,h=i,u=u+this.C_re[e]*l-this.C_im[e]*h,c=c+this.C_im[e]*l+this.C_re[e]*h;for(var d=0;d<this.iterations;d++){var f,p=u,g=c,m=o,y=a;for(e=2;e<=6;e++)f=g*u+p*c,p=p*u-g*c,g=f,m+=(e-1)*(this.B_re[e]*p-this.B_im[e]*g),y+=(e-1)*(this.B_im[e]*p+this.B_re[e]*g);p=1,g=0;var _=this.B_re[1],v=this.B_im[1];for(e=2;e<=6;e++)f=g*u+p*c,p=p*u-g*c,g=f,_+=e*(this.B_re[e]*p-this.B_im[e]*g),v+=e*(this.B_im[e]*p+this.B_re[e]*g);var x=_*_+v*v;u=(m*_+y*v)/x,c=(y*_-m*v)/x}var w=u,b=c,S=1,M=0;for(e=1;e<=9;e++)S*=w,M+=this.D[e]*S;var E=this.lat0+M*ih*1e5,C=this.long0+b;return t.x=C,t.y=E,t},names:["New_Zealand_Map_Grid","nzmg"]},Ac={init:function(){},forward:function(t){var e=t.x,i=t.y,n=$h(e-this.long0,this.over),r=this.x0+this.a*n,s=this.y0+this.a*Math.log(Math.tan(Math.PI/4+i/2.5))*1.25;return t.x=r,t.y=s,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var e=$h(this.long0+t.x/this.a,this.over),i=2.5*(Math.atan(Math.exp(.8*t.y/this.a))-Math.PI/4);return t.x=e,t.y=i,t},names:["Miller_Cylindrical","mill"]},Gc={init:function(){this.long0=this.long0||0,this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=Ku(this.es)},forward:function(t){var e,i,n=t.x,r=t.y;if(n=$h(n-this.long0,this.over),this.sphere){if(this.m)for(var s=this.n*Math.sin(r),o=20;o;--o){var a=(this.m*r+Math.sin(r)-s)/(this.m+Math.cos(r));if(r-=a,Math.abs(a)<rh)break}else r=1!==this.n?Math.asin(this.n*Math.sin(r)):r;e=this.a*this.C_x*n*(this.m+Math.cos(r)),i=this.a*this.C_y*r}else{var l=Math.sin(r),h=Math.cos(r);i=this.a*Zu(r,l,h,this.en),e=this.a*n*h/Math.sqrt(1-this.es*l*l)}return t.x=e,t.y=i,t},inverse:function(t){var e,i,n;return t.x-=this.x0,i=t.x/this.a,t.y-=this.y0,e=t.y/this.a,this.sphere?(e/=this.C_y,i/=this.C_x*(this.m+Math.cos(e)),this.m?e=Ec((this.m*e+Math.sin(e))/this.n):1!==this.n&&(e=Ec(Math.sin(e)/this.n)),i=$h(i+this.long0,this.over),e=xc(e)):(e=Yu(t.y/this.a,this.es,this.en),(n=Math.abs(e))<nh?(n=Math.sin(e),i=$h(this.long0+t.x*Math.sqrt(1-this.es*n*n)/(this.a*Math.cos(e)),this.over)):n-rh<nh&&(i=this.long0)),t.x=i,t.y=e,t},names:["Sinusoidal","sinu"]},Oc={init:function(){this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0},forward:function(t){for(var e=t.x,i=t.y,n=$h(e-this.long0,this.over),r=i,s=Math.PI*Math.sin(i);;){var o=-(r+Math.sin(r)-s)/(1+Math.cos(r));if(r+=o,Math.abs(o)<rh)break}r/=2,Math.PI/2-Math.abs(i)<rh&&(n=0);var a=.900316316158*this.a*n*Math.cos(r)+this.x0,l=1.4142135623731*this.a*Math.sin(r)+this.y0;return t.x=a,t.y=l,t},inverse:function(t){var e,i;t.x-=this.x0,t.y-=this.y0,i=t.y/(1.4142135623731*this.a),Math.abs(i)>.999999999999&&(i=.999999999999),e=Math.asin(i);var n=$h(this.long0+t.x/(.900316316158*this.a*Math.cos(e)),this.over);n<-Math.PI&&(n=-Math.PI),n>Math.PI&&(n=Math.PI),i=(2*e+Math.sin(2*e))/Math.PI,Math.abs(i)>1&&(i=1);var r=Math.asin(i);return t.x=n,t.y=r,t},names:["Mollweide","moll"]},Fc={init:function(){Math.abs(this.lat1+this.lat2)<rh||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=gc(this.es),this.e1=mc(this.es),this.e2=yc(this.es),this.e3=_c(this.es),this.sin_phi=Math.sin(this.lat1),this.cos_phi=Math.cos(this.lat1),this.ms1=zh(this.e,this.sin_phi,this.cos_phi),this.ml1=pc(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<rh?this.ns=this.sin_phi:(this.sin_phi=Math.sin(this.lat2),this.cos_phi=Math.cos(this.lat2),this.ms2=zh(this.e,this.sin_phi,this.cos_phi),this.ml2=pc(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=pc(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))},forward:function(t){var e,i=t.x,n=t.y;if(this.sphere)e=this.a*(this.g-n);else{var r=pc(this.e0,this.e1,this.e2,this.e3,n);e=this.a*(this.g-r)}var s=this.ns*$h(i-this.long0,this.over),o=this.x0+e*Math.sin(s),a=this.y0+this.rh-e*Math.cos(s);return t.x=o,t.y=a,t},inverse:function(t){var e,i,n,r;t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns>=0?(i=Math.sqrt(t.x*t.x+t.y*t.y),e=1):(i=-Math.sqrt(t.x*t.x+t.y*t.y),e=-1);var s=0;return 0!==i&&(s=Math.atan2(e*t.x,e*t.y)),this.sphere?(r=$h(this.long0+s/this.ns,this.over),n=xc(this.g-i/this.a),t.x=r,t.y=n,t):(n=wc(this.g-i/this.a,this.e0,this.e1,this.e2,this.e3),r=$h(this.long0+s/this.ns,this.over),t.x=r,t.y=n,t)},names:["Equidistant_Conic","eqdc"]},Lc={init:function(){this.R=this.a},forward:function(t){var e,i,n=t.x,r=t.y,s=$h(n-this.long0,this.over);Math.abs(r)<=rh&&(e=this.x0+this.R*s,i=this.y0);var o=Ec(2*Math.abs(r/Math.PI));(Math.abs(s)<=rh||Math.abs(Math.abs(r)-nh)<=rh)&&(e=this.x0,i=r>=0?this.y0+Math.PI*this.R*Math.tan(.5*o):this.y0+Math.PI*this.R*-Math.tan(.5*o));var a=.5*Math.abs(Math.PI/s-s/Math.PI),l=a*a,h=Math.sin(o),u=Math.cos(o),c=u/(h+u-1),d=c*c,f=c*(2/h-1),p=f*f,g=Math.PI*this.R*(a*(c-p)+Math.sqrt(l*(c-p)*(c-p)-(p+l)*(d-p)))/(p+l);s<0&&(g=-g),e=this.x0+g;var m=l+c;return g=Math.PI*this.R*(f*m-a*Math.sqrt((p+l)*(l+1)-m*m))/(p+l),i=r>=0?this.y0+g:this.y0-g,t.x=e,t.y=i,t},inverse:function(t){var e,i,n,r,s,o,a,l,h,u,c,d;return t.x-=this.x0,t.y-=this.y0,c=Math.PI*this.R,s=(n=t.x/c)*n+(r=t.y/c)*r,c=3*(r*r/(l=-2*(o=-Math.abs(r)*(1+s))+1+2*r*r+s*s)+(2*(a=o-2*r*r+n*n)*a*a/l/l/l-9*o*a/l/l)/27)/(h=(o-a*a/3/l)/l)/(u=2*Math.sqrt(-h/3)),Math.abs(c)>1&&(c=c>=0?1:-1),d=Math.acos(c)/3,i=t.y>=0?(-u*Math.cos(d+Math.PI/3)-a/3/l)*Math.PI:-(-u*Math.cos(d+Math.PI/3)-a/3/l)*Math.PI,e=Math.abs(n)<rh?this.long0:$h(this.long0+Math.PI*(s-1+Math.sqrt(1+2*(n*n-r*r)+s*s))/2/n,this.over),t.x=e,t.y=i,t},names:["Van_der_Grinten_I","VanDerGrinten","Van_der_Grinten","vandg"]},jc={init:function(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0),this.f=this.es/(1+Math.sqrt(1-this.es))},forward:function(t){var e,i,n,r,s,o,a,l,h,u,c,d=t.x,f=t.y,p=Math.sin(t.y),g=Math.cos(t.y),m=$h(d-this.long0,this.over);return this.sphere?Math.abs(this.sin_p12-1)<=rh?(t.x=this.x0+this.a*(nh-f)*Math.sin(m),t.y=this.y0-this.a*(nh-f)*Math.cos(m),t):Math.abs(this.sin_p12+1)<=rh?(t.x=this.x0+this.a*(nh+f)*Math.sin(m),t.y=this.y0+this.a*(nh+f)*Math.cos(m),t):(h=this.sin_p12*p+this.cos_p12*g*Math.cos(m),l=(a=Math.acos(h))?a/Math.sin(a):1,t.x=this.x0+this.a*l*g*Math.sin(m),t.y=this.y0+this.a*l*(this.cos_p12*p-this.sin_p12*g*Math.cos(m)),t):(e=gc(this.es),i=mc(this.es),n=yc(this.es),r=_c(this.es),Math.abs(this.sin_p12-1)<=rh?(s=this.a*pc(e,i,n,r,nh),o=this.a*pc(e,i,n,r,f),t.x=this.x0+(s-o)*Math.sin(m),t.y=this.y0-(s-o)*Math.cos(m),t):Math.abs(this.sin_p12+1)<=rh?(s=this.a*pc(e,i,n,r,nh),o=this.a*pc(e,i,n,r,f),t.x=this.x0+(s+o)*Math.sin(m),t.y=this.y0+(s+o)*Math.cos(m),t):Math.abs(d)<rh&&Math.abs(f-this.lat0)<rh?(t.x=t.y=0,t):(u=function(t,e,i,n,r,s){const o=n-e,a=Math.atan((1-s)*Math.tan(t)),l=Math.atan((1-s)*Math.tan(i)),h=Math.sin(a),u=Math.cos(a),c=Math.sin(l),d=Math.cos(l);let f,p,g,m,y,_,v,x,w,b,S,M,E,C,P,I=o,T=100;do{if(p=Math.sin(I),g=Math.cos(I),m=Math.sqrt(d*p*(d*p)+(u*c-h*d*g)*(u*c-h*d*g)),0===m)return{azi1:0,s12:0};y=h*c+u*d*g,_=Math.atan2(m,y),v=u*d*p/m,x=1-v*v,w=0!==x?y-2*h*c/x:0,b=s/16*x*(4+s*(4-3*x)),f=I,I=o+(1-b)*s*v*(_+b*m*(w+b*y*(2*w*w-1)))}while(Math.abs(I-f)>1e-12&&--T>0);return 0===T?{azi1:NaN,s12:NaN}:(S=x*(r*r-r*(1-s)*(r*(1-s)))/(r*(1-s)*(r*(1-s))),M=1+S/16384*(4096+S*(S*(320-175*S)-768)),E=S/1024*(256+S*(S*(74-47*S)-128)),C=E*m*(w+E/4*(y*(2*w*w-1)-E/6*w*(4*m*m-3)*(4*w*w-3))),P=r*(1-s)*M*(_-C),{azi1:Math.atan2(d*p,u*c-h*d*g),s12:P})}(this.lat0,this.long0,f,d,this.a,this.f),c=u.azi1,t.x=u.s12*Math.sin(c),t.y=u.s12*Math.cos(c),t))},inverse:function(t){var e,i,n,r,s,o,a,l,h,u,c,d,f,p,g;if(t.x-=this.x0,t.y-=this.y0,this.sphere){if((e=Math.sqrt(t.x*t.x+t.y*t.y))>2*nh*this.a)return;return i=e/this.a,n=Math.sin(i),r=Math.cos(i),s=this.long0,Math.abs(e)<=rh?o=this.lat0:(o=Ec(r*this.sin_p12+t.y*n*this.cos_p12/e),a=Math.abs(this.lat0)-nh,s=Math.abs(a)<=rh?this.lat0>=0?$h(this.long0+Math.atan2(t.x,-t.y),this.over):$h(this.long0-Math.atan2(-t.x,t.y),this.over):$h(this.long0+Math.atan2(t.x*n,e*this.cos_p12*r-t.y*this.sin_p12*n),this.over)),t.x=s,t.y=o,t}return l=gc(this.es),h=mc(this.es),u=yc(this.es),c=_c(this.es),Math.abs(this.sin_p12-1)<=rh?(o=wc(((d=this.a*pc(l,h,u,c,nh))-(e=Math.sqrt(t.x*t.x+t.y*t.y)))/this.a,l,h,u,c),s=$h(this.long0+Math.atan2(t.x,-1*t.y),this.over),t.x=s,t.y=o,t):Math.abs(this.sin_p12+1)<=rh?(d=this.a*pc(l,h,u,c,nh),o=wc(((e=Math.sqrt(t.x*t.x+t.y*t.y))-d)/this.a,l,h,u,c),s=$h(this.long0+Math.atan2(t.x,t.y),this.over),t.x=s,t.y=o,t):(f=Math.atan2(t.x,t.y),p=Math.sqrt(t.x*t.x+t.y*t.y),g=function(t,e,i,n,r,s){const o=Math.atan((1-s)*Math.tan(t)),a=Math.sin(o),l=Math.cos(o),h=Math.sin(i),u=Math.cos(i),c=Math.atan2(a,l*u),d=l*h,f=1-d*d,p=f*(r*r-r*(1-s)*(r*(1-s)))/(r*(1-s)*(r*(1-s))),g=1+p/16384*(4096+p*(p*(320-175*p)-768)),m=p/1024*(256+p*(p*(74-47*p)-128));let y,_,v,x,w,b=n/(r*(1-s)*g),S=100;do{_=Math.cos(2*c+b),v=Math.sin(b),x=Math.cos(b),w=m*v*(_+m/4*(x*(2*_*_-1)-m/6*_*(4*v*v-3)*(4*_*_-3))),y=b,b=n/(r*(1-s)*g)+w}while(Math.abs(b-y)>1e-12&&--S>0);if(0===S)return{lat2:NaN,lon2:NaN};const M=a*v-l*x*u,E=s/16*f*(4+s*(4-3*f));return{lat2:Math.atan2(a*x+l*v*u,(1-s)*Math.sqrt(d*d+M*M)),lon2:e+(Math.atan2(v*h,l*x-a*v*u)-(1-E)*s*d*(b+E*v*(_+E*x*(2*_*_-1))))}}(this.lat0,this.long0,f,p,this.a,this.f),t.x=g.lon2,t.y=g.lat2,t)},names:["Azimuthal_Equidistant","aeqd"]},Nc={init:function(){this.sin_p14=Math.sin(this.lat0||0),this.cos_p14=Math.cos(this.lat0||0)},forward:function(t){var e,i,n,r,s,o,a,l=t.x,h=t.y;return n=$h(l-(this.long0||0),this.over),e=Math.sin(h),i=Math.cos(h),r=Math.cos(n),((s=this.sin_p14*e+this.cos_p14*i*r)>0||Math.abs(s)<=rh)&&(o=1*this.a*i*Math.sin(n),a=(this.y0||0)+1*this.a*(this.cos_p14*e-this.sin_p14*i*r)),t.x=o,t.y=a,t},inverse:function(t){var e,i,n,r,s,o,a,l,h;return t.x-=this.x0||0,t.y-=this.y0||0,i=Ec((e=Math.sqrt(t.x*t.x+t.y*t.y))/this.a),n=Math.sin(i),r=Math.cos(i),l=this.long0||0,h=this.lat0||0,o=l,Math.abs(e)<=rh?(a=h,t.x=o,t.y=a,t):(a=Ec(r*this.sin_p14+t.y*n*this.cos_p14/e),s=Math.abs(h)-nh,Math.abs(s)<=rh?(o=$h(h>=0?l+Math.atan2(t.x,-t.y):l-Math.atan2(-t.x,t.y),this.over),t.x=o,t.y=a,t):(o=$h(l+Math.atan2(t.x*n,e*this.cos_p14*r-t.y*this.sin_p14*n),this.over),t.x=o,t.y=a,t))},names:["ortho"]};function Dc(t,e,i,n){var r;return t<rh?(n.value=1,r=0):(r=Math.atan2(e,i),Math.abs(r)<=ah?n.value=1:r>ah&&r<=nh+ah?(n.value=2,r-=nh):r>nh+ah||r<=-(nh+ah)?(n.value=3,r=r>=0?r-hh:r+hh):(n.value=4,r+=nh)),r}function zc(t,e){var i=t+e;return i<-hh?i+=lh:i>+hh&&(i-=lh),i}const qc={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=nh-ah/2?this.face=5:this.lat0<=-(nh-ah/2)?this.face=6:Math.abs(this.long0)<=ah?this.face=1:Math.abs(this.long0)<=nh+ah?this.face=this.long0>0?2:4:this.face=3,0!==this.es&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)},forward:function(t){var e,i,n,r,s,o,a={x:0,y:0},l={value:0};if(t.x-=this.long0,e=0!==this.es?Math.atan(this.one_minus_f_squared*Math.tan(t.y)):t.y,i=t.x,5===this.face)r=nh-e,i>=ah&&i<=nh+ah?(l.value=1,n=i-nh):i>nh+ah||i<=-(nh+ah)?(l.value=2,n=i>0?i-hh:i+hh):i>-(nh+ah)&&i<=-ah?(l.value=3,n=i+nh):(l.value=4,n=i);else if(6===this.face)r=nh+e,i>=ah&&i<=nh+ah?(l.value=1,n=-i+nh):i<ah&&i>=-ah?(l.value=2,n=-i):i<-ah&&i>=-(nh+ah)?(l.value=3,n=-i-nh):(l.value=4,n=i>0?-i+hh:-i-hh);else{var h,u,c,d,f,p;2===this.face?i=zc(i,+nh):3===this.face?i=zc(i,+hh):4===this.face&&(i=zc(i,-nh)),d=Math.sin(e),f=Math.cos(e),p=Math.sin(i),h=f*Math.cos(i),u=f*p,c=d,1===this.face?n=Dc(r=Math.acos(h),c,u,l):2===this.face?n=Dc(r=Math.acos(u),c,-h,l):3===this.face?n=Dc(r=Math.acos(-h),c,-u,l):4===this.face?n=Dc(r=Math.acos(-u),c,h,l):(r=n=0,l.value=1)}return o=Math.atan(12/hh*(n+Math.acos(Math.sin(n)*Math.cos(ah))-nh)),s=Math.sqrt((1-Math.cos(r))/(Math.cos(o)*Math.cos(o))/(1-Math.cos(Math.atan(1/Math.cos(n))))),2===l.value?o+=nh:3===l.value?o+=hh:4===l.value&&(o+=1.5*hh),a.x=s*Math.cos(o),a.y=s*Math.sin(o),a.x=a.x*this.a+this.x0,a.y=a.y*this.a+this.y0,t.x=a.x,t.y=a.y,t},inverse:function(t){var e,i,n,r,s,o,a,l,h,u,c,d,f={lam:0,phi:0},p={value:0};if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,i=Math.atan(Math.sqrt(t.x*t.x+t.y*t.y)),e=Math.atan2(t.y,t.x),t.x>=0&&t.x>=Math.abs(t.y)?p.value=1:t.y>=0&&t.y>=Math.abs(t.x)?(p.value=2,e-=nh):t.x<0&&-t.x>=Math.abs(t.y)?(p.value=3,e=e<0?e+hh:e-hh):(p.value=4,e+=nh),h=hh/12*Math.tan(e),s=Math.sin(h)/(Math.cos(h)-1/Math.sqrt(2)),o=Math.atan(s),(a=1-(n=Math.cos(e))*n*(r=Math.tan(i))*r*(1-Math.cos(Math.atan(1/Math.cos(o)))))<-1?a=-1:a>1&&(a=1),5===this.face)l=Math.acos(a),f.phi=nh-l,1===p.value?f.lam=o+nh:2===p.value?f.lam=o<0?o+hh:o-hh:3===p.value?f.lam=o-nh:f.lam=o;else if(6===this.face)l=Math.acos(a),f.phi=l-nh,1===p.value?f.lam=-o+nh:2===p.value?f.lam=-o:3===p.value?f.lam=-o-nh:f.lam=o<0?-o-hh:-o+hh;else{var g,m,y;h=(g=a)*g,m=(h+=(y=h>=1?0:Math.sqrt(1-h)*Math.sin(o))*y)>=1?0:Math.sqrt(1-h),2===p.value?(h=m,m=-y,y=h):3===p.value?(m=-m,y=-y):4===p.value&&(h=m,m=y,y=-h),2===this.face?(h=g,g=-m,m=h):3===this.face?(g=-g,m=-m):4===this.face&&(h=g,g=m,m=-h),f.phi=Math.acos(-y)-nh,f.lam=Math.atan2(m,g),2===this.face?f.lam=zc(f.lam,-nh):3===this.face?f.lam=zc(f.lam,-hh):4===this.face&&(f.lam=zc(f.lam,+nh))}return 0!==this.es&&(u=f.phi<0?1:0,c=Math.tan(f.phi),d=this.b/Math.sqrt(c*c+this.one_minus_f_squared),f.phi=Math.atan(Math.sqrt(this.a*this.a-d*d)/(this.one_minus_f*d)),u&&(f.phi=-f.phi)),f.lam+=this.long0,t.x=f.lam,t.y=f.phi,t},names:["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"]};var $c=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-9.86701e-7],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,1.8736e-8],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,9.34959e-7],[.7986,-.00755338,-500009e-10,9.35324e-7],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],Bc=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-1.26793e-9,4.22642e-10],[.124,.0124,5.07171e-9,-1.60604e-9],[.186,.0123999,-1.90189e-8,6.00152e-9],[.248,.0124002,7.10039e-8,-2.24e-8],[.31,.0123992,-2.64997e-7,8.35986e-8],[.372,.0124029,9.88983e-7,-3.11994e-7],[.434,.0123893,-369093e-11,-4.35621e-7],[.4958,.0123198,-102252e-10,-3.45523e-7],[.5571,.0121916,-154081e-10,-5.82288e-7],[.6176,.0119938,-241424e-10,-5.25327e-7],[.6769,.011713,-320223e-10,-5.16405e-7],[.7346,.0113541,-397684e-10,-6.09052e-7],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-1.40374e-9],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],Uc=.8487,Wc=1.3523,Xc=oh/5,Vc=1/Xc,Kc=function(t,e){return t[0]+e*(t[1]+e*(t[2]+e*t[3]))};const Zc={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"},forward:function(t){var e=$h(t.x-this.long0,this.over),i=Math.abs(t.y),n=Math.floor(i*Xc);n<0?n=0:n>=18&&(n=17);var r={x:Kc($c[n],i=oh*(i-Vc*n))*e,y:Kc(Bc[n],i)};return t.y<0&&(r.y=-r.y),r.x=r.x*this.a*Uc+this.x0,r.y=r.y*this.a*Wc+this.y0,r},inverse:function(t){var e={x:(t.x-this.x0)/(this.a*Uc),y:Math.abs(t.y-this.y0)/(this.a*Wc)};if(e.y>=1)e.x/=$c[18][0],e.y=t.y<0?-nh:nh;else{var i=Math.floor(18*e.y);for(i<0?i=0:i>=18&&(i=17);;)if(Bc[i][0]>e.y)--i;else{if(!(Bc[i+1][0]<=e.y))break;++i}var n=Bc[i],r=5*(e.y-n[0])/(Bc[i+1][0]-n[0]);r=function(t,e,i,n){for(var r=e;n;--n){var s=t(r);if(r-=s,Math.abs(s)<1e-10)break}return r}(function(t){return(Kc(n,t)-e.y)/function(t,e){return t[1]+e*(2*t[2]+3*e*t[3])}(n,t)},r,0,100),e.x/=Kc($c[i],r),e.y=(5*i+r)*sh,t.y<0&&(e.y=-e.y)}return e.x=$h(e.x+this.long0,this.over),e},names:["Robinson","robin"]},Yc={init:function(){this.name="geocent"},forward:function(t){return mu(t,this.es,this.a)},inverse:function(t){return yu(t,this.es,this.a,this.b)},names:["Geocentric","geocentric","geocent","Geocent"]};var Hc={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};const Jc={init:function(){if(Object.keys(Hc).forEach(function(t){if(void 0===this[t])this[t]=Hc[t].def;else{if(Hc[t].num&&isNaN(this[t]))throw new Error("Invalid parameter value, must be numeric "+t+" = "+this[t]);Hc[t].num&&(this[t]=parseFloat(this[t]))}Hc[t].degrees&&(this[t]=this[t]*sh)}.bind(this)),Math.abs(Math.abs(this.lat0)-nh)<rh?this.mode=this.lat0<0?1:0:Math.abs(this.lat0)<rh?this.mode=2:(this.mode=3,this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0)),this.pn1=this.h/this.a,this.pn1<=0||this.pn1>1e10)throw new Error("Invalid height");this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var t=this.tilt,e=this.azi;this.cg=Math.cos(e),this.sg=Math.sin(e),this.cw=Math.cos(t),this.sw=Math.sin(t)},forward:function(t){t.x-=this.long0;var e,i,n,r,s=Math.sin(t.y),o=Math.cos(t.y),a=Math.cos(t.x);switch(this.mode){case 3:i=this.sinph0*s+this.cosph0*o*a;break;case 2:i=o*a;break;case 1:i=-s;break;case 0:i=s}switch(e=(i=this.pn1/(this.p-i))*o*Math.sin(t.x),this.mode){case 3:i*=this.cosph0*s-this.sinph0*o*a;break;case 2:i*=s;break;case 0:i*=-o*a;break;case 1:i*=o*a}return r=1/((n=i*this.cg+e*this.sg)*this.sw*this.h1+this.cw),e=(e*this.cg-i*this.sg)*this.cw*r,i=n*r,t.x=e*this.a,t.y=i*this.a,t},inverse:function(t){t.x/=this.a,t.y/=this.a;var e,i,n,r={x:t.x,y:t.y};n=1/(this.pn1-t.y*this.sw),e=this.pn1*t.x*n,i=this.pn1*t.y*this.cw*n,t.x=e*this.cg+i*this.sg,t.y=i*this.cg-e*this.sg;var s=Qu(t.x,t.y);if(Math.abs(s)<rh)r.x=0,r.y=t.y;else{var o,a;switch(a=1-s*s*this.pfact,a=(this.p-Math.sqrt(a))/(this.pn1/s+s/this.pn1),o=Math.sqrt(1-a*a),this.mode){case 3:r.y=Math.asin(o*this.sinph0+t.y*a*this.cosph0/s),t.y=(o-this.sinph0*Math.sin(r.y))*s,t.x*=a*this.cosph0;break;case 2:r.y=Math.asin(t.y*a/s),t.y=o*s,t.x*=a;break;case 0:r.y=Math.asin(o),t.y=-t.y;break;case 1:r.y=-Math.asin(o)}r.x=Math.atan2(t.x,t.y)}return t.x=r.x+this.long0,t.y=r.y,t},names:["Tilted_Perspective","tpers"]},Qc={init:function(){if(this.flip_axis="x"===this.sweep?1:0,this.h=Number(this.h),this.radius_g_1=this.h/this.a,this.radius_g_1<=0||this.radius_g_1>1e10)throw new Error;if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,0!==this.es){var t=1-this.es,e=1/t;this.radius_p=Math.sqrt(t),this.radius_p2=t,this.radius_p_inv2=e,this.shape="ellipse"}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape="sphere";this.title||(this.title="Geostationary Satellite View")},forward:function(t){var e,i,n,r,s=t.x,o=t.y;if(s-=this.long0,"ellipse"===this.shape){o=Math.atan(this.radius_p2*Math.tan(o));var a=this.radius_p/Qu(this.radius_p*Math.cos(o),Math.sin(o));if(i=a*Math.cos(s)*Math.cos(o),n=a*Math.sin(s)*Math.cos(o),r=a*Math.sin(o),(this.radius_g-i)*i-n*n-r*r*this.radius_p_inv2<0)return t.x=Number.NaN,t.y=Number.NaN,t;e=this.radius_g-i,this.flip_axis?(t.x=this.radius_g_1*Math.atan(n/Qu(r,e)),t.y=this.radius_g_1*Math.atan(r/e)):(t.x=this.radius_g_1*Math.atan(n/e),t.y=this.radius_g_1*Math.atan(r/Qu(n,e)))}else"sphere"===this.shape&&(e=Math.cos(o),i=Math.cos(s)*e,n=Math.sin(s)*e,r=Math.sin(o),e=this.radius_g-i,this.flip_axis?(t.x=this.radius_g_1*Math.atan(n/Qu(r,e)),t.y=this.radius_g_1*Math.atan(r/e)):(t.x=this.radius_g_1*Math.atan(n/e),t.y=this.radius_g_1*Math.atan(r/Qu(n,e))));return t.x=t.x*this.a,t.y=t.y*this.a,t},inverse:function(t){var e,i,n,r,s=-1,o=0,a=0;if(t.x=t.x/this.a,t.y=t.y/this.a,"ellipse"===this.shape){this.flip_axis?(a=Math.tan(t.y/this.radius_g_1),o=Math.tan(t.x/this.radius_g_1)*Qu(1,a)):(o=Math.tan(t.x/this.radius_g_1),a=Math.tan(t.y/this.radius_g_1)*Qu(1,o));var l=a/this.radius_p;if(e=o*o+l*l+s*s,(n=(i=2*this.radius_g*s)*i-4*e*this.C)<0)return t.x=Number.NaN,t.y=Number.NaN,t;r=(-i-Math.sqrt(n))/(2*e),s=this.radius_g+r*s,o*=r,a*=r,t.x=Math.atan2(o,s),t.y=Math.atan(a*Math.cos(t.x)/s),t.y=Math.atan(this.radius_p_inv2*Math.tan(t.y))}else if("sphere"===this.shape){if(this.flip_axis?(a=Math.tan(t.y/this.radius_g_1),o=Math.tan(t.x/this.radius_g_1)*Math.sqrt(1+a*a)):(o=Math.tan(t.x/this.radius_g_1),a=Math.tan(t.y/this.radius_g_1)*Math.sqrt(1+o*o)),e=o*o+a*a+s*s,(n=(i=2*this.radius_g*s)*i-4*e*this.C)<0)return t.x=Number.NaN,t.y=Number.NaN,t;r=(-i-Math.sqrt(n))/(2*e),s=this.radius_g+r*s,o*=r,a*=r,t.x=Math.atan2(o,s),t.y=Math.atan(a*Math.cos(t.x)/s)}return t.x=t.x+this.long0,t},names:["Geostationary Satellite View","Geostationary_Satellite","geos"]};var td=1.340264,ed=-.081106,id=893e-6,nd=.003796,rd=Math.sqrt(3)/2;const sd={init:function(){this.es=0,this.long0=void 0!==this.long0?this.long0:0,this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0},forward:function(t){var e=$h(t.x-this.long0,this.over),i=t.y,n=Math.asin(rd*Math.sin(i)),r=n*n,s=r*r*r;return t.x=e*Math.cos(n)/(rd*(td+3*ed*r+s*(7*id+9*nd*r))),t.y=n*(td+ed*r+s*(id+nd*r)),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t},inverse:function(t){t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a;var e,i,n,r,s=t.y;for(r=0;r<12&&(s-=n=(s*(td+ed*(e=s*s)+(i=e*e*e)*(id+nd*e))-t.y)/(td+3*ed*e+i*(7*id+9*nd*e)),!(Math.abs(n)<1e-9));++r);return i=(e=s*s)*e*e,t.x=rd*t.x*(td+3*ed*e+i*(7*id+9*nd*e))/Math.cos(s),t.y=Math.asin(Math.sin(s)/rd),t.x=$h(t.x+this.long0,this.over),t},names:["eqearth","Equal Earth","Equal_Earth"]};var od=1e-10;function ad(t){var e,i,n,r=$h(t.x-(this.long0||0),this.over),s=t.y;return e=this.am1+this.m1-Zu(s,i=Math.sin(s),n=Math.cos(s),this.en),i=n*r/(e*Math.sqrt(1-this.es*i*i)),t.x=e*Math.sin(i),t.y=this.am1-e*Math.cos(i),t.x=this.a*t.x+(this.x0||0),t.y=this.a*t.y+(this.y0||0),t}function ld(t){var e,i,n,r;if(t.x=(t.x-(this.x0||0))/this.a,t.y=(t.y-(this.y0||0))/this.a,i=Qu(t.x,t.y=this.am1-t.y),r=Yu(this.am1+this.m1-i,this.es,this.en),(e=Math.abs(r))<nh)e=Math.sin(r),n=i*Math.atan2(t.x,t.y)*Math.sqrt(1-this.es*e*e)/Math.cos(r);else{if(!(Math.abs(e-nh)<=od))throw new Error;n=0}return t.x=$h(n+(this.long0||0),this.over),t.y=xc(r),t}function hd(t){var e,i,n=$h(t.x-(this.long0||0),this.over),r=t.y;return i=this.cphi1+this.phi1-r,Math.abs(i)>od?(t.x=i*Math.sin(e=n*Math.cos(r)/i),t.y=this.cphi1-i*Math.cos(e)):t.x=t.y=0,t.x=this.a*t.x+(this.x0||0),t.y=this.a*t.y+(this.y0||0),t}function ud(t){var e,i;t.x=(t.x-(this.x0||0))/this.a,t.y=(t.y-(this.y0||0))/this.a;var n=Qu(t.x,t.y=this.cphi1-t.y);if(i=this.cphi1+this.phi1-n,Math.abs(i)>nh)throw new Error;return e=Math.abs(Math.abs(i)-nh)<=od?0:n*Math.atan2(t.x,t.y)/Math.cos(i),t.x=$h(e+(this.long0||0),this.over),t.y=xc(i),t}const cd={init:function(){var t;if(this.phi1=this.lat1,Math.abs(this.phi1)<od)throw new Error;this.es?(this.en=Ku(this.es),this.m1=Zu(this.phi1,this.am1=Math.sin(this.phi1),t=Math.cos(this.phi1),this.en),this.am1=t/(Math.sqrt(1-this.es*this.am1*this.am1)*this.am1),this.inverse=ld,this.forward=ad):(Math.abs(this.phi1)+od>=nh?this.cphi1=0:this.cphi1=1/Math.tan(this.phi1),this.inverse=ud,this.forward=hd)},names:["bonne","Bonne (Werner lat_1=90)"]},dd={OBLIQUE:{forward:function(t,e){let{x:i,y:n}=e;i+=t.long0;const r=Math.cos(i),s=Math.sin(n),o=Math.cos(n);e.x=$h(Math.atan2(o*Math.sin(i),t.sphip*o*r+t.cphip*s)+t.lamp),e.y=Math.asin(t.sphip*s-t.cphip*o*r);const a=t.obliqueProjection.forward(e);return t.isIdentity&&(a.x*=oh,a.y*=oh),a},inverse:function(t,e){t.isIdentity&&(e.x*=sh,e.y*=sh);const i=t.obliqueProjection.inverse(e);let{x:n,y:r}=i;if(n<Number.MAX_VALUE){n-=t.lamp;const i=Math.cos(n),s=Math.sin(r),o=Math.cos(r);e.x=Math.atan2(o*Math.sin(n),t.sphip*o*i-t.cphip*s),e.y=Math.asin(t.sphip*s+t.cphip*o*i)}return e.x=$h(e.x+t.long0),e}},TRANSVERSE:{forward:function(t,e){let{x:i,y:n}=e;i+=t.long0;const r=Math.cos(n),s=Math.cos(i);e.x=$h(Math.atan2(r*Math.sin(i),Math.sin(n))+t.lamp),e.y=Math.asin(-1*r*s);const o=t.obliqueProjection.forward(e);return t.isIdentity&&(o.x*=oh,o.y*=oh),o},inverse:function(t,e){t.isIdentity&&(e.x*=sh,e.y*=sh);const i=t.obliqueProjection.inverse(e);let{x:n,y:r}=i;if(n<Number.MAX_VALUE){const i=Math.cos(r);n-=t.lamp,e.x=Math.atan2(i*Math.sin(n),-1*Math.sin(r)),e.y=Math.asin(i*Math.cos(n))}return e.x=$h(e.x+t.long0),e}}},fd={ROTATE:{o_alpha:"oAlpha",o_lon_c:"oLongC",o_lat_c:"oLatC"},NEW_POLE:{o_lat_p:"oLatP",o_lon_p:"oLongP"},NEW_EQUATOR:{o_lon_1:"oLong1",o_lat_1:"oLat1",o_lon_2:"oLong2",o_lat_2:"oLat2"}},pd={init:function(){if(this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.title=this.title||"General Oblique Transformation",this.isIdentity=Xh.includes(this.o_proj),!this.o_proj)throw new Error("Missing parameter: o_proj");if("ob_tran"===this.o_proj)throw new Error("Invalid value for o_proj: "+this.o_proj);const t=this.projStr.replace("+proj=ob_tran","").replace("+o_proj=","+proj=").trim(),e=gu(t);if(!e)throw new Error("Invalid parameter: o_proj. Unknown projection "+this.o_proj);let i;e.long0=0,this.obliqueProjection=e;const n=Object.keys(fd),r=t=>{if(void 0===this[t])return;const e=parseFloat(this[t])*sh;if(isNaN(e))throw new Error("Invalid value for "+t+": "+this[t]);return e};for(let t=0;t<n.length;t++){const e=n[t],s=fd[e],o=Object.entries(s);if(o.some(([t])=>void 0!==this[t])){i=s;for(let t=0;t<o.length;t++){const[e,i]=o[t],n=r(e);if(void 0===n)throw new Error("Missing parameter: "+e+".");this[i]=n}break}}if(!i)throw new Error("No valid parameters provided for ob_tran projection.");const{lamp:s,phip:o}=function(t,e){let i,n;if(e===fd.ROTATE){let e=t.oLongC,r=t.oLatC,s=t.oAlpha;if(Math.abs(Math.abs(r)-nh)<=rh)throw new Error("Invalid value for o_lat_c: "+t.o_lat_c+" should be < 90°");n=e+Math.atan2(-1*Math.cos(s),-1*Math.sin(s)*Math.sin(r)),i=Math.asin(Math.cos(r)*Math.sin(s))}else if(e===fd.NEW_POLE)n=t.oLongP,i=t.oLatP;else{let e=t.oLong1,r=t.oLat1,s=t.oLong2,o=t.oLat2,a=Math.abs(r);if(Math.abs(r)>nh-rh)throw new Error("Invalid value for o_lat_1: "+t.o_lat_1+" should be < 90°");if(Math.abs(o)>nh-rh)throw new Error("Invalid value for o_lat_2: "+t.o_lat_2+" should be < 90°");if(Math.abs(r-o)<rh)throw new Error("Invalid value for o_lat_1 and o_lat_2: o_lat_1 should be different from o_lat_2");if(a<rh)throw new Error("Invalid value for o_lat_1: o_lat_1 should be different from zero");n=Math.atan2(Math.cos(r)*Math.sin(o)*Math.cos(e)-Math.sin(r)*Math.cos(o)*Math.cos(s),Math.sin(r)*Math.cos(o)*Math.sin(s)-Math.cos(r)*Math.sin(o)*Math.sin(e)),i=Math.atan(-1*Math.cos(n-e)/Math.tan(r))}return{lamp:n,phip:i}}(this,i);this.lamp=s,Math.abs(o)>rh?(this.cphip=Math.cos(o),this.sphip=Math.sin(o),this.projectionType=dd.OBLIQUE):this.projectionType=dd.TRANSVERSE},forward:function(t){return this.projectionType.forward(this,t)},inverse:function(t){return this.projectionType.inverse(this,t)},names:["General Oblique Transformation","General_Oblique_Transformation","ob_tran"]},gd=Object.assign(function(t,e,i){var n,r,s,o=!1;return void 0===e?(r=Iu(t),n=Cu,o=!0):(void 0!==e.x||Array.isArray(e))&&(i=e,r=Iu(t),n=Cu,o=!0),n||(n=Iu(t)),r||(r=Iu(e)),i?Pu(n,r,i):(s={forward:function(t,e){return Pu(n,r,t,e)},inverse:function(t,e){return Pu(r,n,t,e)}},o&&(s.oProj=r),s)},{defaultDatum:"WGS84",Proj:gu,WGS84:new gu("WGS84"),Point:Uu,toPoint:Su,defs:jh,nadgrid:function(t,e,i){return e instanceof ArrayBuffer?function(t,e,i){var n=!0;void 0!==i&&!1===i.includeErrorFields&&(n=!1);var r=new DataView(e),s=function(t){var e=t.getInt32(8,!1);return 11!==e&&(11!==(e=t.getInt32(8,!0))&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian"),!0)}(r),o=function(t,e){return{nFields:t.getInt32(8,e),nSubgridFields:t.getInt32(24,e),nSubgrids:t.getInt32(40,e),shiftType:uu(t,56,64).trim(),fromSemiMajorAxis:t.getFloat64(120,e),fromSemiMinorAxis:t.getFloat64(136,e),toSemiMajorAxis:t.getFloat64(152,e),toSemiMinorAxis:t.getFloat64(168,e)}}(r,s),a=function(t,e,i,n){for(var r=176,s=[],o=0;o<e.nSubgrids;o++){var a=du(t,r,i),l=fu(t,r,a,i,n),h=Math.round(1+(a.upperLongitude-a.lowerLongitude)/a.longitudeInterval),u=Math.round(1+(a.upperLatitude-a.lowerLatitude)/a.latitudeInterval);s.push({ll:[hu(a.lowerLongitude),hu(a.lowerLatitude)],del:[hu(a.longitudeInterval),hu(a.latitudeInterval)],lim:[h,u],count:a.gridNodeCount,cvs:cu(l)});var c=16;!1===n&&(c=8),r+=176+a.gridNodeCount*c}return s}(r,o,s,n),l={header:o,subgrids:a};return su[t]=l,l}(t,e,i):{ready:ou(t,e)}},transform:Eu,mgrs:Ou,version:"__VERSION__"});var md;(md=gd).Proj.projections.add(Hu),md.Proj.projections.add(ic),md.Proj.projections.add(nc),md.Proj.projections.add(oc),md.Proj.projections.add(lc),md.Proj.projections.add(hc),md.Proj.projections.add(cc),md.Proj.projections.add(dc),md.Proj.projections.add(fc),md.Proj.projections.add(bc),md.Proj.projections.add(Mc),md.Proj.projections.add(Cc),md.Proj.projections.add(Pc),md.Proj.projections.add(Ic),md.Proj.projections.add(Tc),md.Proj.projections.add(kc),md.Proj.projections.add(Rc),md.Proj.projections.add(Ac),md.Proj.projections.add(Gc),md.Proj.projections.add(Oc),md.Proj.projections.add(Fc),md.Proj.projections.add(Lc),md.Proj.projections.add(jc),md.Proj.projections.add(Nc),md.Proj.projections.add(qc),md.Proj.projections.add(Zc),md.Proj.projections.add(Yc),md.Proj.projections.add(Jc),md.Proj.projections.add(Qc),md.Proj.projections.add(sd),md.Proj.projections.add(cd),md.Proj.projections.add(pd);const yd=gd;let _d=null;var vd=[896,448,224,112,56,28,14,7,3.5,1.75,.875,.4375,.21875,.109375],xd=[156543.03392800014,78271.51696400007,39135.758482000034,19567.879241000017,9783.939620500008,4891.969810250004,2445.984905125002,1222.992452562501,611.4962262812505,305.74811314062526,152.87405657031263,76.43702828515632,38.21851414257816,19.10925707128908,9.55462853564454,4.77731426782227,2.388657133911135,1.1943285669555674,.5971642834777837,.29858214173889186,.14929107086944593,.07464553543472296,.03732276771736148,.01866138385868074],wd=[-238375,1376256],bd=300,Sd=["showKeyboardHelp","selectControl","moveLarge","nudgeMap","zoomLarge","nudgeZoom"];function Md(t){return"world"===t?{resolutions:xd,defaultMinZoom:6,maxZoom:20}:{resolutions:vd,defaultMinZoom:0,maxZoom:vd.length-1}}var Ed=function(t,e){var i=null,n=function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];clearTimeout(i),i=setTimeout(function(){t.apply(void 0,r)},e)};return n.cancel=function(){i&&(clearTimeout(i),i=null)},n};function Cd(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,s,o,a=[],l=!0,h=!1;try{if(s=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=s.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw r}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Pd(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Pd(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Pd(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function Id(t){var e=t.map,i=t.source,n=t.events,r=t.eventBus,s=t.getZoom,o=t.getCenter,a=t.getBounds,l=t.getResolution,h=!1,u=[],c=[],d=[],f=e.getView(),p=function(t){var e=function(){if(h)return null;var t=s();return{center:o(),bounds:a(),resolution:l(),zoom:t,isAtMaxZoom:t+.01>=f.getMaxZoom(),isAtMinZoom:t-.01<=f.getMinZoom()}}();e&&r.emit(t,e)},g=function(t,e,i){t.on(e,i),u.push([t,e,i])},m=function(t,e,i){t.on(e,i),c.push([t,e,i])},y=!1,_=function(){y||(y=!0,r.emit(n.MAP_LOADED))},v=Ed(function(){return p(n.MAP_DATA_CHANGE)},500);d.push(v);var x=function(t){h||(c.forEach(function(t){var e=Cd(t,3),i=e[0],n=e[1],r=e[2];return i.un(n,r)}),c=[],m(t,"tileloadend",_),m(t,"tileloadend",v))};return function(t){var e=t.map,i=t.view,n=t.emit,r=t.eventBus,s=t.events,o=t.on,a=t.debouncers,l=!1,h=Ed(function(){l=!1,n(s.MAP_MOVE_END)},500);a.push(h);var u,c,d=(u=function(){return n(s.MAP_MOVE)},c=0,function(){var t=Date.now();t-c>=10&&(c=t,u.apply(void 0,arguments))});o(i,"change",function(){l||(l=!0,r.emit(s.MAP_MOVE_START)),h()}),o(e,"postrender",function(){l&&d()})}({map:e,view:e.getView(),emit:p,eventBus:r,events:n,on:g,debouncers:d}),x(i),e.once("rendercomplete",function(){return p(n.MAP_FIRST_IDLE)}),function(t){var e=t.map,i=t.eventBus,n=t.events,r=t.on,s=null;r(e,"pointerdown",function(t){s=t.pixel}),r(e,"click",function(t){if(s){var e=t.pixel[0]-s[0],r=t.pixel[1]-s[1];if(Math.hypot(e,r)>6)return}i.emit(n.MAP_CLICK,{point:{x:t.pixel[0],y:t.pixel[1]},coords:t.coordinate})})}({map:e,eventBus:r,events:n,on:g}),g(e,"postrender",function(){return r.emit(n.MAP_RENDER)}),{setSource:x,remove:function(){h=!0,d.forEach(function(t){return t.cancel()}),u.forEach(function(t){var e=Cd(t,3),i=e[0],n=e[1],r=e[2];return i.un(n,r)}),c.forEach(function(t){var e=Cd(t,3),i=e[0],n=e[1],r=e[2];return i.un(n,r)})}}}class Td{constructor(t,e,i,n){this.minX=t,this.maxX=e,this.minY=i,this.maxY=n}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function kd(t,e,i,n,r){return void 0!==r?(r.minX=t,r.maxX=e,r.minY=i,r.maxY=n,r):new Td(t,e,i,n)}const Rd=Td;function Ad(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function Gd(t,e,i,n,r){return`${L(t)},${e},${function(t,e,i){return t+"/"+e+"/"+i}(i,n,r)}`}const Od=[0,0,0],Fd=class{constructor(t){let e;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,at(function(t){const e=((t,e)=>e-t)||v;return t.every(function(i,n){if(0===n)return!0;const r=e(t[n-1],i);return!(r>0||0===r)})}(this.resolutions_),"`resolutions` must be sorted in descending order"),!t.origins)for(let t=0,i=this.resolutions_.length-1;t<i;++t)if(e){if(this.resolutions_[t]/this.resolutions_[t+1]!==e){e=void 0;break}}else e=this.resolutions_[t]/this.resolutions_[t+1];this.zoomFactor_=e,this.maxZoom=this.resolutions_.length-1,this.origin_=void 0!==t.origin?t.origin:null,this.origins_=null,void 0!==t.origins&&(this.origins_=t.origins,at(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const i=t.extent;void 0===i||this.origin_||this.origins_||(this.origin_=Jt(i)),at(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,void 0!==t.tileSizes&&(this.tileSizes_=t.tileSizes,at(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=void 0!==t.tileSize?t.tileSize:this.tileSizes_?null:256,at(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=void 0!==i?i:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],void 0!==t.sizes?this.fullTileRanges_=t.sizes.map((t,e)=>{const n=new Rd(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1));if(i){const t=this.getTileRangeForExtentAndZ(i,e);n.minX=Math.max(t.minX,n.minX),n.maxX=Math.min(t.maxX,n.maxX),n.minY=Math.max(t.minY,n.minY),n.maxY=Math.min(t.maxY,n.maxY)}return n}):i&&this.calculateTileRanges_(i)}forEachTileCoord(t,e,i){const n=this.getTileRangeForExtentAndZ(t,e);for(let t=n.minX,r=n.maxX;t<=r;++t)for(let r=n.minY,s=n.maxY;r<=s;++r)i([e,t,r])}forEachTileCoordParentTileRange(t,e,i,n){let r,s,o,a=null,l=t[0]-1;for(2===this.zoomFactor_?(s=t[1],o=t[2]):a=this.getTileCoordExtent(t,n);l>=this.minZoom;){if(void 0!==s&&void 0!==o?(s=Math.floor(s/2),o=Math.floor(o/2),r=kd(s,s,o,o,i)):r=this.getTileRangeForExtentAndZ(a,l,i),e(l,r))return!0;--l}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getOrigins(){return this.origins_}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]<this.maxZoom){if(2===this.zoomFactor_){const i=2*t[1],n=2*t[2];return kd(i,i+1,n,n+1,e)}const n=this.getTileCoordExtent(t,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(n,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,i){if(e>this.maxZoom||e<this.minZoom)return null;const n=t[0],r=t[1],s=t[2];if(e===n)return kd(r,s,r,s,i);if(this.zoomFactor_){const t=Math.pow(this.zoomFactor_,e-n),o=Math.floor(r*t),a=Math.floor(s*t);return e<n?kd(o,o,a,a,i):kd(o,Math.floor(t*(r+1))-1,a,Math.floor(t*(s+1))-1,i)}const o=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(o,e,i)}getTileRangeForExtentAndZ(t,e,i){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,Od);const n=Od[1],r=Od[2];return this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,Od),kd(n,Od[1],r,Od[2],i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),n=io(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*n[0]*i,e[1]-(t[2]+.5)*n[1]*i]}getTileCoordExtent(t,e){const i=this.getOrigin(t[0]),n=this.getResolution(t[0]),r=io(this.getTileSize(t[0]),this.tmpSize_),s=i[0]+t[1]*r[0]*n,o=i[1]-(t[2]+1)*r[1]*n;return Gt(s,o,s+r[0]*n,o+r[1]*n,e)}getTileCoordForCoordAndResolution(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,i)}getTileCoordForXYAndResolution_(t,e,i,n,r){const s=this.getZForResolution(i),o=i/this.getResolution(s),a=this.getOrigin(s),l=io(this.getTileSize(s),this.tmpSize_);let h=o*(t-a[0])/i/l[0],u=o*(a[1]-e)/i/l[1];return n?(h=wt(h,5)-1,u=wt(u,5)-1):(h=xt(h,5),u=xt(u,5)),Ad(s,h,u,r)}getTileCoordForXYAndZ_(t,e,i,n,r){const s=this.getOrigin(i),o=this.getResolution(i),a=io(this.getTileSize(i),this.tmpSize_);let l=(t-s[0])/o/a[0],h=(s[1]-e)/o/a[1];return n?(l=wt(l,5)-1,h=wt(h,5)-1):(l=xt(l,5),h=xt(h,5)),Ad(i,l,h,r)}getTileCoordForCoordAndZ(t,e,i){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,i)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){return dt(w(this.resolutions_,t,e||0),this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return kn(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,i=new Array(e);for(let n=this.minZoom;n<e;++n)i[n]=this.getTileRangeForExtentAndZ(t,n);this.fullTileRanges_=i}};function Ld(t){let e=t.getDefaultTileGrid();return e||(e=function(t){return function(t,e,i,n){n=void 0!==n?n:"top-left";const r=Nd(t,e,i);return new Fd({extent:t,origin:Vt(t,n),resolutions:r,tileSize:i})}(Dd(t),void 0,void 0,void 0)}(t),t.setDefaultTileGrid(e)),e}function jd(t){const e=t||{},i=e.extent||fi("EPSG:3857").getExtent(),n={extent:i,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:Nd(i,e.maxZoom,e.tileSize,e.maxResolution)};return new Fd(n)}function Nd(t,e,i,n){e=void 0!==e?e:42,i=io(void 0!==i?i:256);const r=Yt(t),s=te(t);n=n>0?n:Math.max(s/i[0],r/i[1]);const o=e+1,a=new Array(o);for(let t=0;t<o;++t)a[t]=n/Math.pow(2,t);return a}function Dd(t){let e=(t=fi(t)).getExtent();if(!e){const i=180*_e.degrees/t.getMetersPerUnit();e=Gt(-i,-i,i,i)}return e}const zd=class extends R{constructor(t,e,i){super(),i=i||{},this.tileCoord=t,this.state=e,this.key="",this.transition_=void 0===i.transition?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(c)}release(){this.setState(4)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(4!==this.state){if(3!==this.state&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){O()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(i){if(-1===i)return 1}else i=e,this.transitionStarts_[t]=i;const n=e-i+1e3/60;return n>=this.transition_?1:he(n/this.transition_)}inTransition(t){return!!this.transition_&&-1!==this.transitionStarts_[t]}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}disposeInternal(){this.release(),super.disposeInternal()}},qd=class extends zd{constructor(t,e,i,n,r,s){super(t,e,s),this.crossOrigin_=n?.crossOrigin,this.referrerPolicy_=n?.referrerPolicy,this.src_=i,this.key=i,this.image_,Z?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=2,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=3,this.unlistenImage_(),this.image_=function(){const t=sr(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}(),this.changed()}handleImageLoad_(){if(Z)this.state=2;else{const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=2:this.state=4}this.unlistenImage_(),this.changed()}load(){3==this.state&&(this.state=0,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)),0==this.state&&(this.state=1,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=function(t,e,i){const n=t;let r=!0,s=!1,o=!1;const a=[h(n,"load",function(){o=!0,s||e()})];return n.src&&Y?(s=!0,n.decode().then(function(){r&&e()}).catch(function(t){r&&(o?e():i())})):a.push(h(n,"error",i)),function(){r=!1,a.forEach(u)}}(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}};let $d;const Bd=[];function Ud(t,e,i,n,r){t.beginPath(),t.moveTo(0,0),t.lineTo(e,i),t.lineTo(n,r),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,n)+1,Math.max(i,r)),t.restore()}function Wd(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function Xd(t,e,i,n){const r=Si(i,e,t);let s=pi(e,n,i);const o=e.getMetersPerUnit();void 0!==o&&(s*=o);const a=t.getMetersPerUnit();void 0!==a&&(s/=a);const l=t.getExtent();if(!l||Tt(l,r)){const e=pi(t,s,r)/s;isFinite(e)&&e>0&&(s/=e)}return s}const Vd=class{constructor(t,e,i,n,r,s,o){this.sourceProj_=t,this.targetProj_=e;let a={};const l=o?yi(t=>zi(o,Si(t,this.targetProj_,this.sourceProj_))):bi(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){const e=t[0]+"/"+t[1];return a[e]||(a[e]=l(t)),a[e]},this.maxSourceExtent_=n,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&te(n)>=te(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?te(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?te(this.targetProj_.getExtent()):null;const h=Jt(i),u=Qt(i),c=Wt(i),d=Ut(i),f=this.transformInv_(h),p=this.transformInv_(u),g=this.transformInv_(c),m=this.transformInv_(d),y=10+(s?Math.max(0,Math.ceil(Math.log2(Bt(i)/(s*s*256*256)))):0);if(this.addQuad_(h,u,c,d,f,p,g,m,y),this.wrapsXInSource_){let t=1/0;this.triangles_.forEach(function(e,i,n){t=Math.min(t,e.source[0][0],e.source[1][0],e.source[2][0])}),this.triangles_.forEach(e=>{if(Math.max(e.source[0][0],e.source[1][0],e.source[2][0])-t>this.sourceWorldWidth_/2){const i=[[e.source[0][0],e.source[0][1]],[e.source[1][0],e.source[1][1]],[e.source[2][0],e.source[2][1]]];i[0][0]-t>this.sourceWorldWidth_/2&&(i[0][0]-=this.sourceWorldWidth_),i[1][0]-t>this.sourceWorldWidth_/2&&(i[1][0]-=this.sourceWorldWidth_),i[2][0]-t>this.sourceWorldWidth_/2&&(i[2][0]-=this.sourceWorldWidth_);const n=Math.min(i[0][0],i[1][0],i[2][0]);Math.max(i[0][0],i[1][0],i[2][0])-n<this.sourceWorldWidth_/2&&(e.source=i)}})}a={}}addTriangle_(t,e,i,n,r,s){this.triangles_.push({source:[n,r,s],target:[t,e,i]})}addQuad_(t,e,i,n,r,s,o,a,l){const h=Et([r,s,o,a]),u=this.sourceWorldWidth_?te(h)/this.sourceWorldWidth_:null,c=this.sourceWorldWidth_,d=this.sourceProj_.canWrapX()&&u>.5&&u<1;let f=!1;if(l>0&&(this.targetProj_.isGlobal()&&this.targetWorldWidth_&&(f=te(Et([t,e,i,n]))/this.targetWorldWidth_>.25||f),!d&&this.sourceProj_.isGlobal()&&u&&(f=u>.25||f)),!f&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3])&&!ee(h,this.maxSourceExtent_))return;let p=0;if(!(f||isFinite(r[0])&&isFinite(r[1])&&isFinite(s[0])&&isFinite(s[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])))if(l>0)f=!0;else if(p=(isFinite(r[0])&&isFinite(r[1])?0:8)+(isFinite(s[0])&&isFinite(s[1])?0:4)+(isFinite(o[0])&&isFinite(o[1])?0:2)+(isFinite(a[0])&&isFinite(a[1])?0:1),1!=p&&2!=p&&4!=p&&8!=p)return;if(l>0){if(!f){const e=[(t[0]+i[0])/2,(t[1]+i[1])/2],n=this.transformInv_(e);let s;s=d?(yt(r[0],c)+yt(o[0],c))/2-yt(n[0],c):(r[0]+o[0])/2-n[0];const a=(r[1]+o[1])/2-n[1];f=s*s+a*a>this.errorThresholdSquared_}if(f){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const h=[(e[0]+i[0])/2,(e[1]+i[1])/2],u=this.transformInv_(h),c=[(n[0]+t[0])/2,(n[1]+t[1])/2],d=this.transformInv_(c);this.addQuad_(t,e,h,c,r,s,u,d,l-1),this.addQuad_(c,h,i,n,d,u,o,a,l-1)}else{const h=[(t[0]+e[0])/2,(t[1]+e[1])/2],u=this.transformInv_(h),c=[(i[0]+n[0])/2,(i[1]+n[1])/2],d=this.transformInv_(c);this.addQuad_(t,h,c,n,r,u,d,a,l-1),this.addQuad_(h,e,i,c,u,s,o,d,l-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}11&p||this.addTriangle_(t,i,n,r,o,a),14&p||this.addTriangle_(t,i,e,r,o,s),p&&(13&p||this.addTriangle_(e,n,t,s,a,r),7&p||this.addTriangle_(e,n,i,s,a,o))}calculateSourceExtent(){const t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach(function(e,i,n){const r=e.source;Dt(t,r[0]),Dt(t,r[1]),Dt(t,r[2])}),t}getTriangles(){return this.triangles_}},Kd=class extends zd{constructor(t,e,i,n,r,s,o,a,l,h,u,c){super(r,0,c),this.renderEdges_=void 0!==u&&u,this.pixelRatio_=o,this.gutter_=a,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=n,this.wrappedTileCoord_=s||r,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;const d=n.getTileCoordExtent(this.wrappedTileCoord_),f=this.targetTileGrid_.getExtent();let p=this.sourceTileGrid_.getExtent();const g=f?Ht(d,f):d;if(0===Bt(g))return void(this.state=4);const m=t.getExtent();m&&(p=p?Ht(p,m):m);const y=n.getResolution(this.wrappedTileCoord_[0]),_=function(t,e,i,n){const r=Xt(i);let s=Xd(t,e,r,n);return(!isFinite(s)||s<=0)&&$t(i,function(i){return s=Xd(t,e,i,n),isFinite(s)&&s>0}),s}(t,i,g,y);if(!isFinite(_)||_<=0)return void(this.state=4);const v=void 0!==h?h:.5;if(this.triangulation_=new Vd(t,i,g,p,_*v,y),0===this.triangulation_.getTriangles().length)return void(this.state=4);this.sourceZ_=e.getZForResolution(_);let x=this.triangulation_.calculateSourceExtent();if(p&&(t.canWrapX()?(x[1]=dt(x[1],p[1],p[3]),x[3]=dt(x[3],p[1],p[3])):x=Ht(x,p)),Bt(x)){let i=0,n=0;t.canWrapX()&&(i=te(m),n=Math.floor((x[0]-m[0])/i)),re(x.slice(),t,!0).forEach(t=>{const r=e.getTileRangeForExtentAndZ(t,this.sourceZ_);for(let t=r.minX;t<=r.maxX;t++)for(let e=r.minY;e<=r.maxY;e++){const r=n*i;this.sourceTiles_.push({getTile:()=>l(this.sourceZ_,t,e,o),offset:r})}++n}),0===this.sourceTiles_.length&&(this.state=4)}else this.state=4}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{const i=e.tile;if(i&&2==i.getState()){const n=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);n[0]+=e.offset,n[2]+=e.offset;const r=this.clipExtent_?.slice();r&&(r[0]+=e.offset,r[2]+=e.offset),t.push({extent:n,clipExtent:r,image:i.getImage()})}}),this.sourceTiles_.length=0,0===t.length)this.state=3;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),n="number"==typeof i?i:i[0],r="number"==typeof i?i:i[1],s=this.targetTileGrid_.getResolution(e),o=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=function(t,e,i,n,r,s,o,a,l,h,u,c,d,f){const p=sr(Math.round(i*t),Math.round(i*e),Bd);if(c||(p.imageSmoothingEnabled=!1),0===l.length)return p.canvas;function g(t){return Math.round(t*i)/i}p.scale(i,i),p.globalCompositeOperation="lighter";const m=[1/0,1/0,-1/0,-1/0];let y;l.forEach(function(t,e,i){Nt(m,t.extent)});const _=i/n,v=(c?1:1+Math.pow(2,-24))/_;if(!d||1!==l.length||0!==h){if(y=sr(Math.round(te(m)*_),Math.round(Yt(m)*_),Bd),c||(y.imageSmoothingEnabled=!1),r&&f){const t=(r[0]-m[0])*_,e=-(r[3]-m[3])*_,i=te(r)*_,n=Yt(r)*_;y.rect(t,e,i,n),y.clip()}l.forEach(function(t,e,i){if(t.image.width>0&&t.image.height>0){if(t.clipExtent){y.save();const e=(t.clipExtent[0]-m[0])*_,i=-(t.clipExtent[3]-m[3])*_,n=te(t.clipExtent)*_,r=Yt(t.clipExtent)*_;y.rect(c?e:Math.round(e),c?i:Math.round(i),c?n:Math.round(e+n)-Math.round(e),c?r:Math.round(i+r)-Math.round(i)),y.clip()}const e=(t.extent[0]-m[0])*_,i=-(t.extent[3]-m[3])*_,n=te(t.extent)*_,r=Yt(t.extent)*_;y.drawImage(t.image,h,h,t.image.width-2*h,t.image.height-2*h,c?e:Math.round(e),c?i:Math.round(i),c?n:Math.round(e+n)-Math.round(e),c?r:Math.round(i+r)-Math.round(i)),t.clipExtent&&y.restore()}})}const x=Jt(o);return a.getTriangles().forEach(function(t,e,i){const n=t.source,r=t.target;let o=n[0][0],a=n[0][1],h=n[1][0],u=n[1][1],d=n[2][0],f=n[2][1];const _=g((r[0][0]-x[0])/s),w=g(-(r[0][1]-x[1])/s),b=g((r[1][0]-x[0])/s),S=g(-(r[1][1]-x[1])/s),M=g((r[2][0]-x[0])/s),E=g(-(r[2][1]-x[1])/s),C=o,P=a;o=0,a=0,h-=C,u-=P,d-=C,f-=P;const I=function(t){const e=t.length;for(let i=0;i<e;i++){let n=i,r=Math.abs(t[i][i]);for(let s=i+1;s<e;s++){const e=Math.abs(t[s][i]);e>r&&(r=e,n=s)}if(0===r)return null;const s=t[n];t[n]=t[i],t[i]=s;for(let n=i+1;n<e;n++){const r=-t[n][i]/t[i][i];for(let s=i;s<e+1;s++)i==s?t[n][s]=0:t[n][s]+=r*t[i][s]}}const i=new Array(e);for(let n=e-1;n>=0;n--){i[n]=t[n][e]/t[n][n];for(let r=n-1;r>=0;r--)t[r][e]-=t[r][n]*i[n]}return i}([[h,u,0,0,b-_],[d,f,0,0,M-_],[0,0,h,u,S-w],[0,0,d,f,E-w]]);if(!I)return;if(p.save(),p.beginPath(),function(){if(void 0===$d){const t=sr(6,6,Bd);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",Ud(t,4,5,4,0),Ud(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;$d=Wd(e,0)||Wd(e,4)||Wd(e,8),lr(t),Bd.push(t.canvas)}return $d}()||!c){p.moveTo(b,S);const t=4,e=_-b,i=w-S;for(let n=0;n<t;n++)p.lineTo(b+g((n+1)*e/t),S+g(n*i/(t-1))),n!=t-1&&p.lineTo(b+g((n+1)*e/t),S+g((n+1)*i/(t-1)));p.lineTo(M,E)}else p.moveTo(b,S),p.lineTo(_,w),p.lineTo(M,E);let T;if(p.clip(),p.transform(I[0],I[2],I[1],I[3],_,w),p.translate(m[0]-C,m[3]-P),y)T=y.canvas,p.scale(v,-v);else{const t=l[0],e=t.extent;T=t.image,p.scale(te(e)/T.width,-Yt(e)/T.height)}p.drawImage(T,0,0),p.restore()}),y&&(lr(y),Bd.push(y.canvas)),u&&(p.save(),p.globalCompositeOperation="source-over",p.strokeStyle="black",p.lineWidth=1,a.getTriangles().forEach(function(t,e,i){const n=t.target,r=(n[0][0]-x[0])/s,o=-(n[0][1]-x[1])/s,a=(n[1][0]-x[0])/s,l=-(n[1][1]-x[1])/s,h=(n[2][0]-x[0])/s,u=-(n[2][1]-x[1])/s;p.beginPath(),p.moveTo(a,l),p.lineTo(r,o),p.lineTo(h,u),p.closePath(),p.stroke()}),p.restore()),p.canvas}(n,r,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),s,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=2}this.changed()}load(){for(const t of this.sourceTiles_)t.tile=t.getTile();if(0==this.state){this.state=1,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{const i=e.getState();if(0==i||1==i){t++;const i=l(e,c,n=>{const r=e.getState();2!=r&&3!=r&&4!=r||(u(i),t--,0===t&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(i)}}),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:t},e,i){0==t.getState()&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(u),this.sourcesListenerKeys_=null}release(){this.canvas_&&(lr(this.canvas_.getContext("2d")),Bd.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},Zd=/\{z\}/g,Yd=/\{x\}/g,Hd=/\{y\}/g,Jd=/\{-y\}/g;function Qd(t,e){return function(i,n,r){if(!i)return;let s;const o=i[0];if(e){const t=e.getFullTileRange(o);t&&(s=t.getHeight()-1)}return function(t,e,i,n,r){return t.replace(Zd,e.toString()).replace(Yd,i.toString()).replace(Hd,n.toString()).replace(Jd,function(){if(void 0===r)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(r-n).toString()})}(t,o,i[1],i[2],s)}}function tf(t){return t?"function"==typeof t?t:(Array.isArray(t)||(t=[t]),e=>t):null}const ef=class extends N{constructor(t){super(),this.projection=fi(t.projection),this.attributions_=tf(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible??!0,this.loading=!1,this.state_=void 0!==t.state?t.state:"ready",this.wrapX_=void 0!==t.wrapX&&t.wrapX,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;const e=this;this.viewPromise_=new Promise(function(t,i){e.viewResolver=t,e.viewRejector=i})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(t){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=tf(t),this.changed()}setState(t){this.state_=t,this.changed()}};class nf extends k{constructor(t,e){super(t),this.tile=e}}const rf=class extends ef{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:t.projection,state:t.state,wrapX:t.wrapX,interpolate:t.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=void 0!==t.tilePixelRatio?t.tilePixelRatio:1,this.tileGrid=void 0!==t.tileGrid?t.tileGrid:null;this.tileGrid&&io(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),[256,256]),this.tmpSize=[0,0],this.key_=t.key||L(this),this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,n,r,s){return O()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:Ld(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const n=this.getTileGridForProjection(i),r=this.getTilePixelRatio(e),s=io(n.getTileSize(t),this.tmpSize);return 1==r?s:(o=s,a=r,void 0===(l=this.tmpSize)&&(l=[0,0]),l[0]=o[0]*a+.5|0,l[1]=o[1]*a+.5|0,l);var o,a,l}getTileCoordForTileUrlFunction(t,e){const i=void 0!==e?e:this.getProjection(),n=void 0!==e?this.getTileGridForProjection(i):this.tileGrid||this.getTileGridForProjection(i);return this.getWrapX()&&i.isGlobal()&&(t=function(t,e,i){const n=e[0],r=t.getTileCoordCenter(e),s=Dd(i);if(!Tt(s,r)){const e=te(s),i=Math.ceil((s[0]-r[0])/e);return r[0]+=e*i,t.getTileCoordForCoordAndZ(r,n)}return e}(n,t,i)),function(t,e){const i=t[0],n=t[1],r=t[2];if(e.getMinZoom()>i||i>e.getMaxZoom())return!1;const s=e.getFullTileRange(i);return!s||s.containsXY(n,r)}(t,n)?t:null}clear(){}refresh(){this.clear(),super.refresh()}};class sf extends rf{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===sf.prototype.tileUrlFunction,this.tileLoadFunction=t.tileLoadFunction,t.tileUrlFunction&&(this.tileUrlFunction=t.tileUrlFunction),this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(t){const e=t.target,i=L(e),n=e.getState();let r;1==n?(this.tileLoadingKeys_[i]=!0,r="tileloadstart"):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=3==n?"tileloaderror":2==n?"tileloadend":void 0),null!=r&&this.dispatchEvent(new nf(r,e))}setTileLoadFunction(t){this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,void 0!==e?this.setKey(e):this.changed()}setUrl(t){const e=function(t){const e=[];let i=/\{([a-z])-([a-z])\}/.exec(t);if(i){const n=i[1].charCodeAt(0),r=i[2].charCodeAt(0);let s;for(s=n;s<=r;++s)e.push(t.replace(i[0],String.fromCharCode(s)));return e}if(i=/\{(\d+)-(\d+)\}/.exec(t),i){const n=parseInt(i[2],10);for(let r=parseInt(i[1],10);r<=n;r++)e.push(t.replace(i[0],r.toString()));return e}return e.push(t),e}(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(function(t,e){const i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=Qd(t[r],e);return function(t){return 1===t.length?t[0]:function(e,i,n){if(!e)return;const r=function(t){return e=t[0],(t[1]<<e)+t[2];var e}(e),s=yt(r,t.length);return t[s](e,i,n)}}(n)}(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}}const of=sf;function af(t,e){if(Z){const i=t.getCrossOrigin();let n="same-origin",r="same-origin";"anonymous"===i||""===i?(n="cors",r="omit"):"use-credentials"===i&&(n="cors",r="include");const s={mode:n,credentials:r,referrerPolicy:t.getReferrerPolicy()};return void fetch(e,s).then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.blob()}).then(t=>createImageBitmap(t)).then(e=>{const i=t.getImage();i.width=e.width,i.height=e.height,i.getContext("2d").drawImage(e,0,0),e.close?.(),i.dispatchEvent(new Event("load"))}).catch(()=>{t.getImage().dispatchEvent(new Event("error"))})}t.getImage().src=e}const lf=class extends of{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:af,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:void 0===t.interpolate||t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=void 0!==t.crossOrigin?t.crossOrigin:null,this.referrerPolicy=t.referrerPolicy,this.tileClass=void 0!==t.tileClass?t.tileClass:qd,this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(t){return this.getProjection()&&t&&!vi(this.getProjection(),t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||vi(e,t)))return this.tileGrid;const i=L(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=Ld(t)),this.tileGridForProjection[i]}createTile_(t,e,i,n,r,s){const o=[t,e,i],a=this.getTileCoordForTileUrlFunction(o,r),l=a?this.tileUrlFunction(a,n,r):void 0,h=new this.tileClass(o,void 0!==l?0:4,void 0!==l?l:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return h.key=s,h.addEventListener(c,this.handleTileChange.bind(this)),h}getTile(t,e,i,n,r,s){const o=this.getProjection();if(!o||!r||vi(o,r))return this.getTileInternal(t,e,i,n,o||r);const a=[t,e,i],l=this.getKey(),h=this.getTileGridForProjection(o),u=this.getTileGridForProjection(r),c=this.getTileCoordForTileUrlFunction(a,r),d=new Kd(o,h,r,u,a,c,this.getTilePixelRatio(n),this.getGutter(),(t,e,i,n)=>this.getTileInternal(t,e,i,n,o,s),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return d.key=l,d}getTileInternal(t,e,i,n,r,s){const o=this.getKey(),a=Gd(this,o,t,e,i);if(s&&s.containsKey(a))return s.get(a);const l=this.createTile_(t,e,i,n,r,o);return s?.set(a,l),l}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){const i=fi(t);if(i){const t=L(i);t in this.tileGridForProjection||(this.tileGridForProjection[t]=e)}}},hf=class extends lf{constructor(t){const e=void 0!==(t=t||{}).projection?t.projection:"EPSG:3857",i=void 0!==t.tileGrid?t.tileGrid:jd({extent:Dd(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,interpolate:t.interpolate,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.gutter_=void 0!==t.gutter?t.gutter:0}getGutter(){return this.gutter_}},uf=[],cf=class extends zd{constructor(t,e,i,n,r){super(t,e,{transition:0}),this.context_=null,this.executorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.replayState_={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=n.bind(void 0,this),this.removeSourceTiles_=r,this.wrappedTileCoord=i}getContext(){return this.context_||(this.context_=sr(1,1,uf)),this.context_}hasContext(){return!!this.context_}getImage(){return this.hasContext()?this.getContext().canvas:null}getReplayState(t){const e=L(t);return e in this.replayState_||(this.replayState_[e]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedPixelRatio:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.replayState_[e]}load(){this.getSourceTiles()}release(){this.context_&&(lr(this.context_),uf.push(this.context_.canvas),this.context_=null),this.removeSourceTiles_(this),this.sourceTiles.length=0,super.release()}},df=class extends zd{constructor(t,e,i,n,r,s){super(t,e,s),this.extent=null,this.format_=n,this.features_=null,this.loader_,this.projection=null,this.resolution,this.tileLoadFunction_=r,this.url_=i,this.key=i}getTileUrl(){return this.url_}getFormat(){return this.format_}getFeatures(){return this.features_}load(){0==this.state&&(this.setState(1),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))}onLoad(t,e){this.setFeatures(t)}onError(){this.setState(3)}setFeatures(t){this.features_=t,this.setState(2)}setLoader(t){this.loader_=t}};function ff(t,e,i,n,r,s,o){const a=new XMLHttpRequest;a.open("GET","function"==typeof t?t(i,n,r):t,!0),"arraybuffer"==e.getType()&&(a.responseType="arraybuffer"),a.withCredentials=false,a.onload=function(t){if(!a.status||a.status>=200&&a.status<300){const t=e.getType();try{let n;"text"==t||"json"==t?n=a.responseText:"xml"==t?n=a.responseXML||a.responseText:"arraybuffer"==t&&(n=a.response),n?s(e.readFeatures(n,{extent:i,featureProjection:r}),e.readProjection(n)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function pf(t,e){return function(i,n,r,s,o){ff(t,e,i,n,r,(t,e)=>{this.addFeatures(t),void 0!==s&&s(t)},()=>{this.changed(),void 0!==o&&o()})}}const gf=class extends of{constructor(t){const e=t.projection||"EPSG:3857",i=t.extent||Dd(e),n=t.tileGrid||jd({extent:i,maxResolution:t.maxResolution,maxZoom:void 0!==t.maxZoom?t.maxZoom:22,minZoom:t.minZoom,tileSize:t.tileSize||512});super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,interpolate:!0,projection:e,state:t.state,tileGrid:n,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:mf,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:void 0===t.zDirection?1:t.zDirection}),this.format_=t.format?t.format:null,this.tileKeysBySourceTileUrl_={},this.sourceTiles_={},this.overlaps_=null==t.overlaps||t.overlaps,this.tileClass=t.tileClass?t.tileClass:df,this.tileGrids_={}}getOverlaps(){return this.overlaps_}getSourceTiles(t,e,i,n){if(0===i.getState()){i.setState(1);const r=i.wrappedTileCoord,s=this.getTileGridForProjection(e);let o=s.getTileCoordExtent(r);const l=r[0],h=s.getResolution(l);Ct(o,-h,o);const u=this.projection;e&&this.projection&&!vi(e,u)&&(o=Mi(o,e,u));const d=this.tileGrid,f=d.getExtent();f&&Ht(o,f,o);let p=h;e&&u&&!vi(e,u)&&(p=h/u.getMetersPerUnit()/e.getMetersPerUnit());const g=d.getZForResolution(p,this.zDirection),m=n||this.tileUrlFunction;d.forEachTileCoord(o,g,n=>{const r=m(n,t,e);this.sourceTiles_[r]||(this.sourceTiles_[r]=new this.tileClass(n,r?0:4,r,this.format_,this.tileLoadFunction));const s=this.sourceTiles_[r];i.sourceTiles.push(s),this.tileKeysBySourceTileUrl_[r]||(this.tileKeysBySourceTileUrl_[r]=[]),this.tileKeysBySourceTileUrl_[r].push(i.getKey());const o=s.getState();if(o<2){const t=e=>{this.handleTileChange(e);const n=s.getState();if(2===n||3===n){const e=s.getKey();e in i.errorTileKeys?2===s.getState()&&delete i.errorTileKeys[e]:i.loadingSourceTiles--,3===n?i.errorTileKeys[e]=!0:s.removeEventListener(c,t),0===i.loadingSourceTiles&&i.setState(a(i.errorTileKeys)?2:3)}};s.addEventListener(c,t),i.loadingSourceTiles++}0===o&&(s.extent=d.getTileCoordExtent(n),s.projection=this.projection,s.resolution=d.getResolution(n[0]),s.load())}),i.loadingSourceTiles||i.setState(i.sourceTiles.some(t=>3===t.getState())?3:2)}return i.sourceTiles}removeSourceTiles(t){const e=t.getKey(),i=t.sourceTiles;for(let t=0,n=i.length;t<n;++t){const n=i[t].getTileUrl();if(!this.tileKeysBySourceTileUrl_[n])return;const r=this.tileKeysBySourceTileUrl_[n].indexOf(e);-1!==r&&(this.tileKeysBySourceTileUrl_[n].splice(r,1),0===this.tileKeysBySourceTileUrl_[n].length&&(delete this.tileKeysBySourceTileUrl_[n],delete this.sourceTiles_[n]))}}getTile(t,e,i,n,r){const s=[t,e,i];let o=this.getTileCoordForTileUrlFunction(s,r);const a=this.getTileGrid().getExtent(),l=this.projection,h=this.getTileGridForProjection(r);if(o&&a){const e=h.getTileCoordExtent(o);Ct(e,-h.getResolution(t),e),ee(a,r&&l&&!vi(r,l)?Mi(e,r,l):e)||(o=null)}let u=!0;if(null!==o){const e=this.tileGrid,i=h.getResolution(t);let s=i;r&&l&&!vi(r,l)&&(s=i/l.getMetersPerUnit()/r.getMetersPerUnit());const a=e.getZForResolution(s,1),c=h.getTileCoordExtent(o);Ct(c,-i,c),e.forEachTileCoord(r&&l&&!vi(r,l)?Mi(c,r,l):c,a,t=>{u=u&&!this.tileUrlFunction(t,n,l)})}const c=this.tileUrlFunction,d=new cf(s,u?4:0,o,t=>this.getSourceTiles(n,r,t,c),this.removeSourceTiles.bind(this));return d.key=this.getKey(),d}getTileGridForProjection(t){const e=t.getCode();let i=this.tileGrids_[e];if(!i){const n=this.projection;if(null!==n&&!vi(n,t))return Ld(t);const r=this.tileGrid,s=r.getResolutions().slice(),o=s.map(function(t,e){return r.getOrigin(e)}),a=s.map(function(t,e){return r.getTileSize(e)}),l=43;for(let t=s.length;t<l;++t)s.push(s[t-1]/2),o.push(o[t-1]),a.push(a[t-1]);i=new Fd({extent:r.getExtent(),origins:o,resolutions:s,tileSizes:a}),this.tileGrids_[e]=i}return i}getTilePixelRatio(t){return t}getTilePixelSize(t,e,i){const n=io(this.getTileGridForProjection(i).getTileSize(t),this.tmpSize);return[Math.round(n[0]*e),Math.round(n[1]*e)]}setOverlaps(t){this.overlaps_=t,this.changed()}};function mf(t,e){t.setLoader(function(i,n,r){ff(e,t.getFormat(),i,n,r,t.onLoad.bind(t),t.onError.bind(t))})}function yf(t){return t instanceof Image||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageBitmap?t:null}const _f=new Error("disposed"),vf=[256,256],xf=class extends zd{constructor(t){super(t.tileCoord,0,{transition:t.transition,interpolate:t.interpolate}),this.loader_=t.loader,this.data_=null,this.error_=null,this.size_=t.size||null,this.controller_=t.controller||null}getSize(){if(this.size_)return this.size_;const t=yf(this.data_);return t?[t.width,t.height]:vf}getData(){return this.data_}getError(){return this.error_}load(){if(0!==this.state&&3!==this.state)return;this.state=1,this.changed();const t=this;this.loader_().then(function(e){t.data_=e,t.state=2,t.changed()}).catch(function(e){t.error_=e,t.state=3,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(_f),this.controller_=null),super.disposeInternal()}},wf=class{constructor(t){this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const t=this.pop();t instanceof _&&t.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const i=this.entries_[t];return at(void 0!==i,"Tried to get a value for a key that does not exist in the cache"),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_}remove(t){const e=this.entries_[t];return at(void 0!==e,"Tried to get a value for a key that does not exist in the cache"),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.key_;return t}getValues(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){return this.entries_[t]?.value_}pop(){const t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){at(!(t in this.entries_),"Tried to set a value for a key that is used already");const i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_}setSize(t){this.highWaterMark=t}},bf=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(ar(),{get:(t,e)=>{if("function"==typeof ar()[e])return this.push_(e),this.pushMethodArgs_},set:(t,e,i)=>(this.push_(e,i),!0)})}push_(...t){const e=this.instructions_,i=this.zIndex+this.offset_;e[i]||(e[i]=[]),e[i].push(...t)}pushMethodArgs_=(...t)=>(this.push_(t),this);pushFunction(t){this.push_(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach(e=>{for(let i=0,n=e.length;i<n;++i){const n=e[i];if("function"==typeof n){n(t);continue}const r=e[++i];if("function"==typeof t[n])t[n](...r);else{if("function"==typeof r){t[n]=r(t);continue}t[n]=r}}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}},Sf=class extends G{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=5}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return O()}getData(t){return null}prepareFrame(t){return O()}renderFrame(t,e){return O()}forEachFeatureAtCoordinate(t,e,i,n,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;2!==e.getState()&&3!==e.getState()||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return 2!=e&&3!=e&&t.addEventListener(c,this.boundHandleImageChange_),0==e&&(t.load(),e=t.getState()),2==e}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}},Mf=[];let Ef=null;const Cf=class extends Sf{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=[1,0,0,1,0,0],this.pixelTransform=[1,0,0,1,0,0],this.inversePixelTransform=[1,0,0,1,0,0],this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){let n;Ef||(Ef=sr(1,1,void 0,{willReadFrequently:!0})),Ef.clearRect(0,0,1,1);try{Ef.drawImage(t,e,i,1,1,0,0,1,1),n=Ef.getImageData(0,0,1,1).data}catch{return Ef=null,null}return n}getBackground(t){let e=this.getLayer().getBackground();return"function"==typeof e&&(e=e(t.viewState.resolution)),e||void 0}useContainer(t,e,i){const n=this.getLayer().getClassName();let r,s;if(t&&t.className===n&&(!i||t&&t.style.backgroundColor&&M(Qs(t.style.backgroundColor),Qs(i)))){const e=t.firstElementChild;cr(e)&&(s=e.getContext("2d"))}if(s&&function(t,e){const i=Wi(t),n=Wi(e);for(let t=0;t<6;++t)if(0!==Math.round((i[t]-n[t])*Ui[t]))return!1;return!0}(s.canvas.style.transform,e)?(this.container=t,this.context=s,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){r=Z?ur():document.createElement("div"),r.className=n;let t=r.style;t.position="absolute",t.width="100%",t.height="100%",s=sr();const e=s.canvas;r.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=r,this.context=s}this.containerReused||!i||this.container.style.backgroundColor||(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const n=Jt(i),r=Qt(i),s=Wt(i),o=Ut(i);zi(e.coordinateToPixelTransform,n),zi(e.coordinateToPixelTransform,r),zi(e.coordinateToPixelTransform,s),zi(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;zi(a,n),zi(a,r),zi(a,s),zi(a,o),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.clip()}prepareContainer(t,e){const i=t.extent,n=t.viewState.resolution,r=t.viewState.rotation,s=t.pixelRatio,o=Math.round(te(i)/n*s),a=Math.round(Yt(i)/n*s);$i(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/s,1/s,r,-o/2,-a/2),Bi(this.inversePixelTransform,this.pixelTransform);const l="matrix("+this.pixelTransform.join(", ")+")";if(this.useContainer(e,l,this.getBackground(t)),!this.containerReused){const t=this.context.canvas;t.width!=o||t.height!=a?(t.width=o,t.height=a):this.context.clearRect(0,0,o,a),l!==t.style.transform&&(t.style.transform=l)}}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const r=new Vl(t,this.inversePixelTransform,i,e);n.dispatchEvent(r)}}preRender(t,e){this.frameState=e,e.declutter||this.dispatchRenderEvent_(cs,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(ds,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new bf),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(cs,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(ds,this.context,t))}getRenderTransform(t,e,i,n,r,s,o){const a=r/2,l=s/2,h=n/e,u=-h,c=-t[0]+o,d=-t[1];return $i(this.tempTransform,a,l,h,u,-i,c,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}};function Pf(t,e,i){if(!(i in t))return t[i]=new Set([e]),!0;const n=t[i],r=n.has(e);return r||n.add(e),!r}function If(t,e,i){const n=t[i];return!!n&&n.delete(e)}function Tf(t,e){const i=t.layerStatesArray[t.layerIndex];i.extent&&(e=Ht(e,ki(i.extent,t.viewState.projection)));const n=i.layer.getRenderSource();if(!n.getWrapX()){const i=n.getTileGridForProjection(t.viewState.projection).getExtent();i&&(e=Ht(e,i))}return e}const kf=class extends Cf{constructor(t,e){super(t),e=e||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=[1/0,1/0,-1/0,-1/0],this.tempTileRange_=new Rd(0,0,0,0),this.tempTileCoord_=Ad(0,0,0);const i=void 0!==e.cacheSize?e.cacheSize:512;this.tileCache_=new wf(i),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=.5*i}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new wf(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,n){const r=this.tileCache_,s=this.getLayer().getSource(),o=Gd(s,s.getKey(),t,e,i);let a;if(r.containsKey(o))a=r.get(o);else{const l=n.viewState.projection,h=s.getProjection();if(a=s.getTile(t,e,i,n.pixelRatio,l,!h||vi(h,l)?void 0:this.getSourceTileCache()),!a)return null;r.set(o,a)}return a}getTile(t,e,i,n){return this.getOrCreateTile(t,e,i,n)||null}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=zi(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!Tt(r,n))return null;const s=e.viewState,o=i.getRenderSource(),a=o.getTileGridForProjection(s.projection),l=o.getTilePixelRatio(e.pixelRatio);for(let t=a.getZForResolution(s.resolution);t>=a.getMinZoom();--t){const i=a.getTileCoordForCoordAndZ(n,t),r=this.getTile(t,i[1],i[2],e);if(!r||2!==r.getState())continue;const h=a.getOrigin(t),u=io(a.getTileSize(t)),c=a.getResolution(t);let d;if(r instanceof qd||r instanceof Kd)d=r.getImage();else{if(!(r instanceof xf))continue;if(d=yf(r.getData()),!d)continue}const f=Math.floor(l*((n[0]-h[0])/c-i[1]*u[0])),p=Math.floor(l*((h[1]-n[1])/c-i[2]*u[1])),g=Math.round(l*o.getGutterForProjection(s.projection));return this.getImageData(d,f+g,p+g)}return null}prepareFrame(t){this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;const e=this.getLayer().getSource();if(!e)return!1;const i=e.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==i&&(this.renderedSourceRevision_=i,this.renderedSourceKey_===e.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=i,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(t,e,i,n,r){const s=t.viewState,o=this.getLayer(),a=o.getRenderSource(),l=a.getTileGridForProjection(s.projection),h=L(a);h in t.wantedTiles||(t.wantedTiles[h]={});const u=t.wantedTiles[h],c=o.getMapInternal(),d=Math.max(i-r,l.getMinZoom(),l.getZForResolution(Math.min(o.getMaxResolution(),c?c.getView().getResolutionForZoom(Math.max(o.getMinZoom(),0)):l.getResolution(0)),a.zDirection)),f=s.rotation,p=f?Zt(s.center,s.resolution,f,t.size):void 0;for(let r=i;r>=d;--r){const i=l.getTileRangeForExtentAndZ(e,r,this.tempTileRange_),s=l.getResolution(r);for(let e=i.minX;e<=i.maxX;++e)for(let o=i.minY;o<=i.maxY;++o){if(f&&!l.tileCoordIntersectsViewport([r,e,o],p))continue;const i=this.getTile(r,e,o,t);if(!i)continue;if(!Pf(n,i,r))continue;const a=i.getKey();if(u[a]=!0,0===i.getState()&&!t.tileQueue.isKeyQueued(a)){const n=Ad(r,e,o,this.tempTileCoord_);t.tileQueue.enqueue([i,h,l.getTileCoordCenter(n),s])}}}}findStaleTile_(t,e){const i=this.tileCache_,n=t[0],r=t[1],s=t[2],o=this.getStaleKeys();for(let t=0;t<o.length;++t){const a=Gd(this.getLayer().getSource(),o[t],n,r,s);if(i.containsKey(a)){const t=i.peek(a);if(2===t.getState())return t.endTransition(L(this)),Pf(e,t,n),!0}}return!1}findAltTiles_(t,e,i,n){const r=t.getTileRangeForTileCoordAndZ(e,i,this.tempTileRange_);if(!r)return!1;let s=!0;const o=this.tileCache_,a=this.getLayer().getRenderSource(),l=a.getKey();for(let t=r.minX;t<=r.maxX;++t)for(let e=r.minY;e<=r.maxY;++e){const r=Gd(a,l,i,t,e);let h=!1;if(o.containsKey(r)){const t=o.peek(r);2===t.getState()&&(Pf(n,t,i),h=!0)}h||(s=!1)}return s}renderFrame(t,e){this.renderComplete=!0;const i=t.layerStatesArray[t.layerIndex],n=t.viewState,r=n.projection,s=n.resolution,o=n.center,a=t.pixelRatio,l=this.getLayer(),h=l.getSource(),u=h.getTileGridForProjection(r),c=u.getZForResolution(s,h.zDirection),d=u.getResolution(c),f=h.getKey();this.renderedSourceKey_?this.renderedSourceKey_!==f&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=f):this.renderedSourceKey_=f;let p=t.extent;const g=h.getTilePixelRatio(a);this.prepareContainer(t,e);const m=this.context.canvas.width,y=this.context.canvas.height;this.layerExtent=i.extent?ki(i.extent):null,this.layerExtent&&(p=Ht(p,this.layerExtent));const _=d*m/2/g,x=d*y/2/g,w=[o[0]-_,o[1]-x,o[0]+_,o[1]+x],b={};this.renderedTiles.length=0;const S=l.getPreload();if(t.nextExtent&&this.enqueueTilesForNextExtent()){const e=u.getZForResolution(n.nextResolution,h.zDirection),i=Tf(t,t.nextExtent);this.enqueueTiles(t,i,e,b,S)}const M=Tf(t,p);if(this.enqueueTiles(t,M,c,b,0),S>0&&setTimeout(()=>{this.enqueueTiles(t,M,c-1,b,S-1)},0),!(c in b))return this.container;const E=L(this),C=t.time;for(const e of b[c]){const i=e.getState();if(4===i)continue;const n=e.tileCoord;if(2===i&&1===e.getAlpha(E,C)){e.endTransition(E);continue}if(3!==i&&(this.renderComplete=!1),this.findStaleTile_(n,b)){If(b,e,c),t.animate=!0;continue}if(this.findAltTiles_(u,n,c+1,b))continue;const r=u.getMinZoom();for(let t=c-1;t>=r&&!this.findAltTiles_(u,n,t,b);--t);}const P=d/s*a/g,I=this.getRenderContext(t);$i(this.tempTransform,m/2,y/2,P,P,0,-m/2,-y/2),this.layerExtent&&this.clipUnrotated(I,t,this.layerExtent),h.getInterpolate()||(I.imageSmoothingEnabled=!1),this.preRender(I,t);const T=Object.keys(b).map(Number);let k;T.sort(v);const R=[],A=[];for(let e=T.length-1;e>=0;--e){const i=T[e],n=h.getTilePixelSize(i,a,r),s=u.getResolution(i)/d,o=n[0]*s*P,l=n[1]*s*P,c=u.getTileCoordForCoordAndZ(Jt(w),i),f=u.getTileCoordExtent(c),p=zi(this.tempTransform,[g*(f[0]-w[0])/d,g*(w[3]-f[3])/d]),m=g*h.getGutterForProjection(r);for(const e of b[i]){if(2!==e.getState())continue;const n=e.tileCoord,r=c[1]-n[1],s=Math.round(p[0]-(r-1)*o),a=c[2]-n[2],u=Math.round(p[1]-(a-1)*l),d=Math.round(p[0]-r*o),f=Math.round(p[1]-a*l),g=s-d,y=u-f,_=1===T.length;let v=!1;k=[d,f,d+g,f,d+g,f+y,d,f+y];for(let t=0,e=R.length;t<e;++t)if(!_&&i<A[t]){const e=R[t];ee([d,f,d+g,f+y],[e[0],e[3],e[4],e[7]])&&(v||(I.save(),v=!0),I.beginPath(),I.moveTo(k[0],k[1]),I.lineTo(k[2],k[3]),I.lineTo(k[4],k[5]),I.lineTo(k[6],k[7]),I.moveTo(e[6],e[7]),I.lineTo(e[4],e[5]),I.lineTo(e[2],e[3]),I.lineTo(e[0],e[1]),I.clip())}R.push(k),A.push(i),this.drawTile(e,t,d,f,g,y,m,_),v&&I.restore(),this.renderedTiles.unshift(e),this.updateUsedTiles(t.usedTiles,h,e)}}if(this.renderedResolution=d,this.extentChanged=!this.renderedExtent_||!jt(this.renderedExtent_,w),this.renderedExtent_=w,this.renderedPixelRatio=a,this.postRender(this.context,t),this.layerExtent&&I.restore(),I.imageSmoothingEnabled=!0,this.renderComplete){const e=(t,e)=>{const i=L(h),n=e.wantedTiles[i],r=n?Object.keys(n).length:0;this.updateCacheSize(r),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};t.postRenderFunctions.push(e)}return this.container}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,2*t)}drawTile(t,e,i,n,r,s,o,a){let l;if(t instanceof xf){if(l=yf(t.getData()),!l)throw new Error("Rendering array data is not yet supported")}else l=this.getTileImage(t);if(!l)return;const h=this.getRenderContext(e),u=L(this),c=e.layerStatesArray[e.layerIndex],d=c.opacity*(a?t.getAlpha(u,e.time):1),f=d!==h.globalAlpha;f&&(h.save(),h.globalAlpha=d),h.drawImage(l,o,o,l.width-2*o,l.height-2*o,i,n,r,s),f&&h.restore(),d!==c.opacity?e.animate=!0:a&&t.endTransition(u)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}updateUsedTiles(t,e,i){const n=L(e);n in t||(t[n]={}),t[n][i.getKey()]=!0}},Rf="preload",Af="useInterimTilesOnError",Gf=class extends ms{constructor(t){t=t||{};const e=Object.assign({},t),i=t.cacheSize;delete t.cacheSize,delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=i,this.setPreload(void 0!==t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(Rf)}setPreload(t){this.set(Rf,t)}getUseInterimTilesOnError(){return this.get(Af)}setUseInterimTilesOnError(t){this.set(Af,t)}getData(t){return super.getData(t)}},Of=class extends Gf{constructor(t){super(t)}createRenderer(){return new kf(this,{cacheSize:this.getCacheSize()})}},Ff=class{drawCustom(t,e,i,n,r){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}},Lf={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},jf=[Lf.FILL],Nf=[Lf.STROKE],Df=[Lf.BEGIN_PATH],zf=[Lf.CLOSE_PATH],qf=Lf,$f=class extends Ff{constructor(t,e,i,n){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=n,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return 1==e?t:t.map(function(t){return t*e})}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),n=this.tmpCoordinate_,r=this.coordinates;let s=r.length;for(let o=0,a=t.length;o<a;o+=e)n[0]=t[o],n[1]=t[o+1],Tt(i,n)&&(r[s++]=n[0],r[s++]=n[1]);return s}appendFlatLineCoordinates(t,e,i,n,r,s){const o=this.coordinates;let a=o.length;const l=this.getBufferedMaxExtent();s&&(e+=n);let h=t[e],u=t[e+1];const c=this.tmpCoordinate_;let d,f,p,g=!0;for(d=e+n;d<i;d+=n)c[0]=t[d],c[1]=t[d+1],p=At(l,c),p!==f?(g&&(o[a++]=h,o[a++]=u,g=!1),o[a++]=c[0],o[a++]=c[1]):1===p?(o[a++]=c[0],o[a++]=c[1],g=!1):g=!0,h=c[0],u=c[1],f=p;return(r&&g||d===e+n)&&(o[a++]=h,o[a++]=u),a}drawCustomCoordinates_(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s],a=this.appendFlatLineCoordinates(t,e,o,n,!1,!1);r.push(a),e=o}return e}drawCustom(t,e,i,n,r){this.beginGeometry(t,e,r);const s=t.getType(),o=t.getStride(),a=this.coordinates.length;let l,h,u,c,d;switch(s){case"MultiPolygon":l=t.getOrientedFlatCoordinates(),c=[];const e=t.getEndss();d=0;for(let t=0,i=e.length;t<i;++t){const i=[];d=this.drawCustomCoordinates_(l,d,e[t],o,i),c.push(i)}this.instructions.push([qf.CUSTOM,a,c,t,i,fn,r]),this.hitDetectionInstructions.push([qf.CUSTOM,a,c,t,n||i,fn,r]);break;case"Polygon":case"MultiLineString":u=[],l="Polygon"==s?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),d=this.drawCustomCoordinates_(l,0,t.getEnds(),o,u),this.instructions.push([qf.CUSTOM,a,u,t,i,dn,r]),this.hitDetectionInstructions.push([qf.CUSTOM,a,u,t,n||i,dn,r]);break;case"LineString":case"Circle":l=t.getFlatCoordinates(),h=this.appendFlatLineCoordinates(l,0,l.length,o,!1,!1),this.instructions.push([qf.CUSTOM,a,h,t,i,cn,r]),this.hitDetectionInstructions.push([qf.CUSTOM,a,h,t,n||i,cn,r]);break;case"MultiPoint":l=t.getFlatCoordinates(),h=this.appendFlatPointCoordinates(l,o),h>a&&(this.instructions.push([qf.CUSTOM,a,h,t,i,cn,r]),this.hitDetectionInstructions.push([qf.CUSTOM,a,h,t,n||i,cn,r]));break;case"Point":l=t.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([qf.CUSTOM,a,h,t,i,void 0,r]),this.hitDetectionInstructions.push([qf.CUSTOM,a,h,t,n||i,void 0,r])}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[qf.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[qf.BEGIN_GEOMETRY,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;let e;t.reverse();const i=t.length;let n,r,s=-1;for(e=0;e<i;++e)n=t[e],r=n[0],r==qf.END_GEOMETRY?s=e:r==qf.BEGIN_GEOMETRY&&(n[2]=e,b(this.hitDetectionInstructions,s,e),s=-1)}fillStyleToState(t,e={}){if(t){const i=t.getColor();e.fillPatternScale=i&&"object"==typeof i&&"src"in i?this.pixelRatio:1,e.fillStyle=Oa(i||La)??void 0}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const i=t.getColor();e.strokeStyle=Oa(i||za);const n=t.getLineCap();e.lineCap=void 0!==n?n:ja;const r=t.getLineDash();e.lineDash=r?r.slice():Na;const s=t.getLineDashOffset();e.lineDashOffset=s||0;const o=t.getLineJoin();e.lineJoin=void 0!==o?o:Da;const a=t.getWidth();e.lineWidth=void 0!==a?a:1;const l=t.getMiterLimit();e.miterLimit=void 0!==l?l:10;const h=t.getOffset();e.strokeOffset=h??0,e.lineWidth>this.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0,e.strokeOffset=void 0;return e}setFillStrokeStyle(t,e){const i=this.state;this.fillStyleToState(t,i),this.strokeStyleToState(e,i)}createFill(t){const e=t.fillStyle,i=[qf.SET_FILL_STYLE,e];return"string"!=typeof e&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[qf.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;(void 0!==i&&"string"!=typeof i||t.currentFillStyle!=i)&&(this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,n=t.lineCap,r=t.lineDash,s=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,l=t.miterLimit,h=t.strokeOffset;(t.currentStrokeStyle!=i||t.currentLineCap!=n||r!=t.currentLineDash&&!M(t.currentLineDash,r)||t.currentLineDashOffset!=s||t.currentLineJoin!=o||t.currentLineWidth!=a||t.currentMiterLimit!=l||t.currentStrokeOffset!=h)&&(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=r,t.currentLineDashOffset=s,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=l,t.currentStrokeOffset=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[qf.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Pt(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;Ct(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Bf=class extends $f{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinatess_(t,e,i,n,r){const s=this.state,o=void 0!==s.fillStyle,a=void 0!==s.strokeStyle,l=i.length;this.instructions.push(Df),this.hitDetectionInstructions.push(Df);for(let s=0;s<l;++s){const o=i[s],l=this.coordinates.length,h=this.appendFlatLineCoordinates(t,e,o,n,!0,!a);this.instructions.push([qf.MOVE_TO_LINE_TO,l,h,r*this.pixelRatio,!0]),this.hitDetectionInstructions.push([qf.MOVE_TO_LINE_TO,l,h,r,!0]),a&&(this.instructions.push(zf),this.hitDetectionInstructions.push(zf)),e=o}return o&&(this.instructions.push(jf),this.hitDetectionInstructions.push(jf)),a&&(this.instructions.push(Nf),this.hitDetectionInstructions.push(Nf)),e}drawCircle(t,e,i){const n=this.state,r=n.fillStyle,s=n.strokeStyle,o=n.strokeOffset;if(void 0===r&&void 0===s)return;if(this.handleStrokeOffset_(()=>this.drawCircle(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([qf.SET_FILL_STYLE,La]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([qf.SET_STROKE_STYLE,za,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Na,0]);const a=t.getFlatCoordinates(),l=t.getStride(),h=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,l,!1,!1);const u=[qf.CIRCLE,h,o];this.instructions.push(Df,u),this.hitDetectionInstructions.push(Df,u),void 0!==n.fillStyle&&(this.instructions.push(jf),this.hitDetectionInstructions.push(jf)),void 0!==n.strokeStyle&&(this.instructions.push(Nf),this.hitDetectionInstructions.push(Nf)),this.endGeometry(e)}drawPolygon(t,e,i){const n=this.state,r=n.fillStyle,s=n.strokeStyle,o=n.strokeOffset;if(void 0===r&&void 0===s)return;if(this.handleStrokeOffset_(()=>this.drawPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([qf.SET_FILL_STYLE,La]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([qf.SET_STROKE_STYLE,za,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Na,0]);const a=t.getEnds(),l=t.getOrientedFlatCoordinates(),h=t.getStride();this.drawFlatCoordinatess_(l,0,a,h,o),this.endGeometry(e)}drawMultiPolygon(t,e,i){const n=this.state,r=n.fillStyle,s=n.strokeStyle,o=n.strokeOffset;if(void 0===r&&void 0===s)return;if(this.handleStrokeOffset_(()=>this.drawMultiPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([qf.SET_FILL_STYLE,La]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([qf.SET_STROKE_STYLE,za,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Na,0]);const a=t.getEndss(),l=t.getOrientedFlatCoordinates(),h=t.getStride();let u=0;for(let t=0,e=a.length;t<e;++t)u=this.drawFlatCoordinatess_(l,u,a[t],h,o);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const t=this.tolerance;if(0!==t){const e=this.coordinates;for(let i=0,n=e.length;i<n;++i)e[i]=mn(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;this.updateFillStyle(t,this.createFill),this.updateStrokeStyle(t,this.applyStroke)}handleStrokeOffset_(t){const e=this.state,i=e.fillStyle,n=e.strokeStyle,r=e.strokeOffset;return Math.abs(r)>0&&void 0!==i&&void 0!==n&&(e.strokeStyle=void 0,e.strokeOffset=0,t(),e.fillStyle=void 0,e.strokeStyle=n,e.strokeOffset=r,t(),e.fillStyle=i,!0)}};function Uf(t,e,i,n,r){const s=[];let o=i,a=0,l=e.slice(i,2);for(;a<t&&o+r<n;){const[i,n]=l.slice(-2),h=e[o+r],u=e[o+r+1],c=Math.sqrt((h-i)*(h-i)+(u-n)*(u-n));if(a+=c,a>=t){const e=(t-a+c)/c,d=_t(i,h,e),f=_t(n,u,e);l.push(d,f),s.push(l),l=[d,f],a==t&&(o+=r),a=0}else if(a<t)l.push(e[o+r],e[o+r+1]),o+=r;else{const t=c-a,e=_t(i,h,t/c),d=_t(n,u,t/c);l.push(e,d),s.push(l),l=[e,d],a=0,o+=r}}return a>0&&s.push(l),s}function Wf(t,e,i,n,r){let s,o,a,l,h,u,c,d,f,p,g=i,m=i,y=0,_=0,v=i;for(o=i;o<n;o+=r){const i=e[o],n=e[o+1];void 0!==h&&(f=i-h,p=n-u,l=Math.sqrt(f*f+p*p),void 0!==c&&(_+=a,s=Math.acos((c*f+d*p)/(a*l)),s>t&&(_>y&&(y=_,g=v,m=o),_=0,v=o-r)),a=l,c=f,d=p),h=i,u=n}return _+=l,_>y?[v,o]:[g,m]}const Xf={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},Vf={Circle:Bf,Default:$f,Image:class extends $f{constructor(t,e,i,n){super(t,e,i,n),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e,i){if(!this.image_||this.maxExtent&&!Tt(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),r=t.getStride(),s=this.coordinates.length,o=this.appendFlatPointCoordinates(n,r);this.instructions.push([qf.DRAW_IMAGE,s,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([qf.DRAW_IMAGE,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),r=[];for(let e=0,i=n.length;e<i;e+=t.getStride())this.maxExtent&&!Tt(this.maxExtent,n.slice(e,e+2))||r.push(n[e],n[e+1]);const s=this.coordinates.length,o=this.appendFlatPointCoordinates(r,2);this.instructions.push([qf.DRAW_IMAGE,s,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([qf.DRAW_IMAGE,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const i=t.getAnchor(),n=t.getSize(),r=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=r[0],this.originY_=r[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}},LineString:class extends $f{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinates_(t,e,i,n,r){const s=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,i,n,!1,!1);return this.instructions.push([qf.MOVE_TO_LINE_TO,s,o,r*this.pixelRatio]),this.hitDetectionInstructions.push([qf.MOVE_TO_LINE_TO,s,o,r]),i}drawLineString(t,e,i){const n=this.state,r=n.strokeStyle,s=n.lineWidth,o=n.strokeOffset;if(void 0===r||void 0===s)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([qf.SET_STROKE_STYLE,za,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Na,0],Df);const a=t.getFlatCoordinates(),l=t.getStride();this.drawFlatCoordinates_(a,0,a.length,l,o),this.hitDetectionInstructions.push(Nf),this.endGeometry(e)}drawMultiLineString(t,e,i){const n=this.state,r=n.strokeStyle,s=n.lineWidth,o=n.strokeOffset;if(void 0===r||void 0===s)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([qf.SET_STROKE_STYLE,za,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Na,0],Df);const a=t.getEnds(),l=t.getFlatCoordinates(),h=t.getStride();let u=0;for(let t=0,e=a.length;t<e;++t)u=this.drawFlatCoordinates_(l,u,a[t],h,o);this.hitDetectionInstructions.push(Nf),this.endGeometry(e)}finish(){const t=this.state;return null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&this.instructions.push(Nf),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(Nf),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(Df)}},Polygon:Bf,Text:class extends $f{constructor(t,e,i,n){super(t,e,i,n),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[La]={fillStyle:La},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e,i){const n=this.textFillState_,r=this.textStrokeState_,s=this.textState_;if(""===this.text_||!s||!n&&!r)return;const o=this.coordinates;let a=o.length;const l=t.getType();let h=null,u=t.getStride();if("line"!==s.placement||"LineString"!=l&&"MultiLineString"!=l&&"Polygon"!=l&&"MultiPolygon"!=l){let n=s.overflow?null:[];switch(l){case"Point":case"MultiPoint":h=t.getFlatCoordinates();break;case"LineString":h=t.getFlatMidpoint();break;case"Circle":h=t.getCenter();break;case"MultiLineString":h=t.getFlatMidpoints(),u=2;break;case"Polygon":h=t.getFlatInteriorPoint(),s.overflow||n.push(h[2]/this.resolution),u=3;break;case"MultiPolygon":const e=t.getFlatInteriorPoints();h=[];for(let t=0,i=e.length;t<i;t+=3)s.overflow||n.push(e[t+2]/this.resolution),h.push(e[t],e[t+1]);if(0===h.length)return;u=2}const r=this.appendFlatPointCoordinates(h,u);if(r===a)return;if(n&&(r-a)/2!==h.length/u){let t=a/2;n=n.filter((e,i)=>{const n=o[2*(t+i)]===h[i*u]&&o[2*(t+i)+1]===h[i*u+1];return n||--t,n})}this.saveTextStates_();const c=s.backgroundFill?this.createFill(this.fillStyleToState(s.backgroundFill)):null,d=s.backgroundStroke?this.createStroke(this.strokeStyleToState(s.backgroundStroke)):null;this.beginGeometry(t,e,i);let f=s.padding;if(f!=Ba&&(s.scale[0]<0||s.scale[1]<0)){let t=s.padding[0],e=s.padding[1],i=s.padding[2],n=s.padding[3];s.scale[0]<0&&(e=-e,n=-n),s.scale[1]<0&&(t=-t,i=-i),f=[t,e,i,n]}const p=this.pixelRatio;this.instructions.push([qf.DRAW_IMAGE,a,r,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,f==Ba?Ba:f.map(function(t){return t*p}),c,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]);const g=1/p,m=c?c.slice(0):null;m&&(m[1]=La),this.hitDetectionInstructions.push([qf.DRAW_IMAGE,a,r,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[g,g],NaN,this.declutterMode_,this.declutterImageWithText_,f,m,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?La:this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]),this.endGeometry(e)}else{if(!ee(this.maxExtent,t.getExtent()))return;let n;if(h=t.getFlatCoordinates(),"LineString"==l)n=[h.length];else if("MultiLineString"==l)n=t.getEnds();else if("Polygon"==l)n=t.getEnds().slice(0,1);else if("MultiPolygon"==l){const e=t.getEndss();n=[];for(let t=0,i=e.length;t<i;++t)n.push(e[t][0])}this.beginGeometry(t,e,i);const r=s.repeat,c=r?void 0:s.textAlign;let d=0;for(let t=0,e=n.length;t<e;++t){let e;e=r?Uf(r*this.resolution,h,d,n[t],u):[h.slice(d,n[t])];for(let i=0,r=e.length;i<r;++i){const r=e[i];let l=0,h=r.length;if(null==c){const t=Wf(s.maxAngle,r,0,r.length,2);l=t[0],h=t[1]}for(let t=l;t<h;t+=u)o.push(r[t],r[t+1]);const f=o.length;d=n[t],this.drawChars_(a,f),a=f}}this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,n=this.strokeKey_;t&&(n in this.strokeStates||(this.strokeStates[n]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const r=this.textKey_;r in this.textStates||(this.textStates[r]={font:e.font,textAlign:e.textAlign||qa,justify:e.justify,textBaseline:e.textBaseline||$a,scale:e.scale});const s=this.fillKey_;i&&(s in this.fillStates||(this.fillStates[s]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,n=this.textState_,r=this.strokeKey_,s=this.textKey_,o=this.fillKey_;this.saveTextStates_();const a=this.pixelRatio,l=Xf[n.textBaseline],h=this.textOffsetY_*a,u=this.text_,c=i?i.lineWidth*Math.abs(n.scale[0])/2:0;this.instructions.push([qf.DRAW_CHARS,t,e,l,n.overflow,o,n.maxAngle,a,h,r,c*a,u,s,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([qf.DRAW_CHARS,t,e,l,n.overflow,o?La:o,n.maxAngle,a,h,r,c*a,u,s,1/a,this.declutterMode_,this.textKeepUpright_])}setTextStyle(t,e){let i,n,r;if(t){const e=t.getFill();e?(n=this.textFillState_,n||(n={},this.textFillState_=n),n.fillStyle=Oa(e.getColor()||La)):(n=null,this.textFillState_=n);const s=t.getStroke();if(s){r=this.textStrokeState_,r||(r={},this.textStrokeState_=r);const t=s.getLineDash(),e=s.getLineDashOffset(),i=s.getWidth(),n=s.getMiterLimit();r.lineCap=s.getLineCap()||ja,r.lineDash=t?t.slice():Na,r.lineDashOffset=void 0===e?0:e,r.lineJoin=s.getLineJoin()||Da,r.lineWidth=void 0===i?1:i,r.miterLimit=void 0===n?10:n,r.strokeStyle=Oa(s.getColor()||za)}else r=null,this.textStrokeState_=r;i=this.textState_;const o=t.getFont()||Fa;Ya(o);const a=t.getScaleArray();i.overflow=t.getOverflow(),i.font=o,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||$a,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||Ba,i.scale=void 0===a?[1,1]:a;const l=t.getOffsetX(),h=t.getOffsetY(),u=t.getRotateWithView(),c=t.getKeepUpright(),d=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=void 0===l?0:l,this.textOffsetY_=void 0===h?0:h,this.textRotateWithView_=void 0!==u&&u,this.textKeepUpright_=void 0===c||c,this.textRotation_=void 0===d?0:d,this.strokeKey_=r?("string"==typeof r.strokeStyle?r.strokeStyle:L(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?"string"==typeof n.fillStyle?n.fillStyle:"|"+L(n.fillStyle):""}else this.text_="";this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}},Kf=class{constructor(t,e,i,n){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=n,this.resolution_=i,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const i=this.buildersByZIndex_[e];for(const n in i){const r=i[n].finish();t[e][n]=r}}return t}getBuilder(t,e){const i=void 0!==t?t.toString():"0";let n=this.buildersByZIndex_[i];void 0===n&&(n={},this.buildersByZIndex_[i]=n);let r=n[e];return void 0===r&&(r=new(0,Vf[e])(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[e]=r),r}};function Zf(t,e,i,n){let r=t[e],s=t[e+1],o=0;for(let a=e+n;a<i;a+=n){const e=t[a],i=t[a+1];o+=Math.sqrt((e-r)*(e-r)+(i-s)*(i-s)),r=e,s=i}return o}function Yf(t,e,i,n,r,s,o,a){o=o??[],a=a??n;const l=t[e+n],h=t[e+n+1],u=t[i-2*n],c=t[i-2*n+1];let d,f,p,g,m,y,_,v,x=0;for(let w=e;w<i;w+=n){p=d,g=f,m=void 0,y=void 0,w+n<i&&(m=t[w+n],y=t[w+n+1]),s&&w===e&&(p=u,g=c),s&&w===i-n&&(m=l,y=h),d=t[w],f=t[w+1],[_,v]=Hf(d,f,p,g,m,y,r),o[x++]=_,o[x++]=v;for(let e=2;e<a;e++)o[x++]=t[w+e]}return o.length!=x&&(o.length=x),o}function Hf(t,e,i,n,r,s,o){let a,l;void 0!==i&&void 0!==n?(a=t-i,l=e-n):void 0!==r&&void 0!==s?(a=r-t,l=s-e):(a=1,l=0);const h=Math.hypot(a,l),u=a/h,c=l/h;if(a=-c,l=u,void 0===i||void 0===n)return[t+a*o,e+l*o];if(void 0===r||void 0===s)return[t+a*o,e+l*o];const d=function(t,e,i){const n=Math.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])),r=[(e[0]-t[0])/n,(e[1]-t[1])/n],s=[-r[1],r[0]],o=Math.sqrt((i[0]-t[0])*(i[0]-t[0])+(i[1]-t[1])*(i[1]-t[1])),a=[(i[0]-t[0])/o,(i[1]-t[1])/o];let l=0===n||0===o?0:Math.acos(dt(a[0]*r[0]+a[1]*r[1],-1,1));return l=Math.max(l,1e-5),a[0]*s[0]+a[1]*s[1]>0?l:2*Math.PI-l}([t,e],[i,n],[r,s]);if(Math.cos(d)>.998)return[t+u*o,e+c*o];const f=Math.cos(d/2),p=Math.sin(d/2);return[t+1/p*(p*a+f*l)*o,e+1/p*(-f*a+p*l)*o]}function Jf(t,e){for(let i=0,n=t.length-2;i<n;i+=e)for(let n=t.length-2*e;n>i+e;n-=e){const r=t[i],s=t[i+1],o=t[i+e],a=t[i+e+1],l=t[n],h=t[n+1],u=t[n+e],c=t[n+e+1],d=(c-h)*(o-r)-(u-l)*(a-s);if(0===d)continue;const f=((u-l)*(s-h)-(c-h)*(r-l))/d,p=((o-r)*(s-h)-(a-s)*(r-l))/d;if(f>0&&f<1&&p>0&&p<1){const l=r+f*(o-r),h=s+f*(a-s);t[i+e]=l,t[i+e+1]=h,t.splice(i+2*e,n-i-e);break}}return t}function Qf(t,e,i,n,r,s,o,a,l,h,u,c,d=!0){let f=t[e],p=t[e+1],g=0,m=0,y=0,_=0;function v(){g=f,m=p,f=t[e+=n],p=t[e+1],_+=y,y=Math.sqrt((f-g)*(f-g)+(p-m)*(p-m))}do{v()}while(e<i-n&&_+y<s);let x=0===y?0:(s-_)/y;const w=_t(g,f,x),b=_t(m,p,x),S=e-n,M=_,E=s+a*l(h,r,u);for(;e<i-n&&_+y<E;)v();x=0===y?0:(E-_)/y;const C=_t(g,f,x),P=_t(m,p,x);let I=!1;if(d)if(c){const t=[w,b,C,P];Vi(t,0,4,2,c,t,t),I=t[0]>t[2]}else I=w>C;const T=Math.PI,k=[],R=S+n===e;let A;if(y=0,_=M,f=t[e=S],p=t[e+1],R){v(),A=Math.atan2(p-m,f-g),I&&(A+=A>0?-T:T);const t=(C+w)/2,e=(P+b)/2;return k[0]=[t,e,(E-s)/2,A,r],k}for(let t=0,c=(r=r.replace(/\n/g," ")).length;t<c;){v();let d=Math.atan2(p-m,f-g);if(I&&(d+=d>0?-T:T),void 0!==A){let t=d-A;if(t+=t>T?-2*T:t<-T?2*T:0,Math.abs(t)>o)return null}A=d;const w=t;let b=0;for(;t<c;++t){const o=a*l(h,r[I?c-t-1:t],u);if(e+n<i&&_+y<s+b+o/2)break;b+=o}if(t===w)continue;const S=I?r.substring(c-w,c-t):r.substring(w,t);x=0===y?0:(s+b/2-_)/y;const M=_t(g,f,x),E=_t(m,p,x);k.push([M,E,b/2,d,S]),s+=b}return k}const tp=[1/0,1/0,-1/0,-1/0],ep=[],ip=[],np=[],rp=[];function sp(t){return t[3].declutterBox}const op=new RegExp("["+String.fromCharCode(1425)+"-"+String.fromCharCode(2303)+String.fromCharCode(64285)+"-"+String.fromCharCode(65023)+String.fromCharCode(65136)+"-"+String.fromCharCode(65276)+String.fromCharCode(67584)+"-"+String.fromCharCode(69631)+String.fromCharCode(124928)+"-"+String.fromCharCode(126975)+"]");function ap(t,e){return"start"===e?e=op.test(t)?"right":"left":"end"===e&&(e=op.test(t)?"left":"right"),Xf[e]}function lp(t,e,i){return i>0&&t.push("\n",""),t.push(e,""),t}function hp(t,e,i){return i%2==0&&(t+=e),t}const up=class{constructor(t,e,i,n,r){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=[1,0,0,1,0,0],this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=r?new bf:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,n){const r=t+e+i+n;if(this.labels_[r])return this.labels_[r];const s=n?this.strokeStates[n]:null,o=i?this.fillStates[i]:null,a=this.textStates[e],l=this.pixelRatio,h=[a.scale[0]*l,a.scale[1]*l],u=a.justify?Xf[a.justify]:ap(Array.isArray(t)?t[0]:t,a.textAlign||qa),c=n&&s.lineWidth?s.lineWidth:0,d=Array.isArray(t)?t:String(t).split("\n").reduce(lp,[]),{width:f,height:p,widths:g,heights:m,lineWidths:y}=function(t,e){const i=[],n=[],r=[];let s=0,o=0,a=0,l=0;for(let h=0,u=e.length;h<=u;h+=2){const c=e[h];if("\n"===c||h===u){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}const d=e[h+1]||t.font,f=Qa(d,c);i.push(f),o+=f;const p=Ha(d);n.push(p),l=Math.max(l,p)}return{width:s,height:a,widths:i,heights:n,lineWidths:r}}(a,d),_=f+c,v=[],x=(_+2)*h[0],w=(p+c)*h[1],b={width:x<0?Math.floor(x):Math.ceil(x),height:w<0?Math.floor(w):Math.ceil(w),contextInstructions:v};1==h[0]&&1==h[1]||v.push("scale",h),n&&(v.push("strokeStyle",s.strokeStyle),v.push("lineWidth",c),v.push("lineCap",s.lineCap),v.push("lineJoin",s.lineJoin),v.push("miterLimit",s.miterLimit),v.push("setLineDash",[s.lineDash]),v.push("lineDashOffset",s.lineDashOffset)),i&&v.push("fillStyle",o.fillStyle),v.push("textBaseline","middle"),v.push("textAlign","center");const S=.5-u;let M=u*_+S*c;const E=[],C=[];let P,I=0,T=0,k=0,R=0;for(let t=0,e=d.length;t<e;t+=2){const e=d[t];if("\n"===e){T+=I,I=0,M=u*_+S*c,++R;continue}const r=d[t+1]||a.font;r!==P&&(n&&E.push("font",r),i&&C.push("font",r),P=r),I=Math.max(I,m[k]);const s=[e,M+S*g[k]+u*(g[k]-y[R]),.5*(c+I)+T];M+=g[k],n&&E.push("strokeText",s),i&&C.push("fillText",s),++k}return Array.prototype.push.apply(v,E),Array.prototype.push.apply(v,C),this.labels_[r]=b,b}replayTextBackground_(t,e,i,n,r,s,o){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,n),t.lineTo.apply(t,r),t.lineTo.apply(t,e),s&&(this.alignAndScaleFill_=s[2],t.fillStyle=s[1],this.fill_(t)),o&&(this.setStrokeStyle_(t,o),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,n,r,s,o,a,l,h,u,c,d,f,p,g){let m=i-(o*=c[0]),y=n-(a*=c[1]);const _=r+l>t?t-l:r,v=s+h>e?e-h:s,x=f[3]+_*c[0]+f[1],w=f[0]+v*c[1]+f[2],b=m-f[3],S=y-f[0];let M;return(p||0!==u)&&(ep[0]=b,rp[0]=b,ep[1]=S,ip[1]=S,ip[0]=b+x,np[0]=ip[0],np[1]=S+w,rp[1]=np[1]),0!==u?(M=$i([1,0,0,1,0,0],i,n,1,1,u,-i,-n),zi(M,ep),zi(M,ip),zi(M,np),zi(M,rp),Gt(Math.min(ep[0],ip[0],np[0],rp[0]),Math.min(ep[1],ip[1],np[1],rp[1]),Math.max(ep[0],ip[0],np[0],rp[0]),Math.max(ep[1],ip[1],np[1],rp[1]),tp)):Gt(Math.min(b,b+x),Math.min(S,S+w),Math.max(b,b+x),Math.max(S,S+w),tp),d&&(m=Math.round(m),y=Math.round(y)),{drawImageX:m,drawImageY:y,drawImageW:_,drawImageH:v,originX:l,originY:h,declutterBox:{minX:tp[0],minY:tp[1],maxX:tp[2],maxY:tp[3],value:g},canvasTransform:M,scale:c}}replayImageOrLabel_(t,e,i,n,r,s,o){const a=!(!s&&!o),l=n.declutterBox,h=o?o[2]*n.scale[0]/2:0;return l.minX-h<=e[0]&&l.maxX+h>=0&&l.minY-h<=e[1]&&l.maxY+h>=0&&(a&&this.replayTextBackground_(t,ep,ip,np,rp,s,o),function(t,e,i,n,r,s,o,a,l,h,u){t.save(),1!==i&&(void 0===t.globalAlpha?t.globalAlpha=t=>t.globalAlpha*=i:t.globalAlpha*=i),e&&t.transform.apply(t,e),n.contextInstructions?(t.translate(l,h),t.scale(u[0],u[1]),function(t,e){const i=t.contextInstructions;for(let t=0,n=i.length;t<n;t+=2)Array.isArray(i[t+1])?e[i[t]].apply(e,i[t+1]):e[i[t]]=i[t+1]}(n,t)):u[0]<0||u[1]<0?(t.translate(l,h),t.scale(u[0],u[1]),t.drawImage(n,r,s,o,a,0,0,o,a)):t.drawImage(n,r,s,o,a,l,h,o*u[0],a*u[1]),t.restore()}(t,n.canvasTransform,r,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=zi(this.renderedTransform_,[0,0]),n=512*this.pixelRatio;t.save(),t.translate(i[0]%n,i[1]%n),1!==e&&t.scale(e,e)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],e[1]&&(t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6]))}drawLabelWithPointPlacement_(t,e,i,n){const r=this.textStates[e],s=this.createLabel(t,e,n,i),o=this.strokeStates[i],a=this.pixelRatio,l=ap(Array.isArray(t)?t[0]:t,r.textAlign||qa),h=Xf[r.textBaseline||$a],u=o&&o.lineWidth?o.lineWidth:0;return{label:s,anchorX:l*(s.width/a-2*r.scale[0])+2*(.5-l)*u,anchorY:h*s.height/a+2*(.5-h)*u}}execute_(t,e,i,n,r,s,o,a){const l=this.zIndexContext_;let h;var u,c;this.pixelCoordinates_&&M(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=Xi(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),c=i,(u=this.renderedTransform_)[0]=c[0],u[1]=c[1],u[2]=c[2],u[3]=c[3],u[4]=c[4],u[5]=c[5]);let d=0;const f=n.length;let p,g=0;const m=[];let y,_,v,x,w,b,S,E,C,P,I,T,k,R=0,A=0;const G=this.coordinateCache_,O=this.viewRotation_,F=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,L={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:O},j=this.instructions!=n||this.overlaps?0:200;let N,D,z,q;for(;d<f;){const i=n[d];switch(i[0]){case qf.BEGIN_GEOMETRY:N=i[1],q=i[3],N.getGeometry()?void 0===o||ee(o,q.getExtent())?++d:d=i[2]+1:d=i[2],l&&(l.zIndex=i[4]);break;case qf.BEGIN_PATH:R>j&&(this.fill_(t),R=0),A>j&&(t.stroke(),A=0),R||A||(t.beginPath(),w=NaN,b=NaN),++d;break;case qf.CIRCLE:g=i[1],v=i[2]??0;const n=h[g],u=h[g+1],c=h[g+2]-v-n,f=h[g+3]-v-u,M=Math.sqrt(c*c+f*f);t.moveTo(n+M,u),t.arc(n,u,M,0,2*Math.PI,!0),++d;break;case qf.CLOSE_PATH:t.closePath(),++d;break;case qf.CUSTOM:g=i[1],p=i[2];const $=i[3],B=i[4],U=i[5];L.geometry=$,L.feature=N,d in G||(G[d]=[]);const W=G[d];U?U(h,g,p,2,W):(W[0]=h[g],W[1]=h[g+1],W.length=2),l&&(l.zIndex=i[6]),B(W,L),++d;break;case qf.DRAW_IMAGE:g=i[1],p=i[2],C=i[3],y=i[4],_=i[5];let X=i[6];const V=i[7],K=i[8],Z=i[9],Y=i[10];let H=i[11];const J=i[12];let Q=i[13];x=i[14]||"declutter";const tt=i[15];if(!C&&i.length>=20){P=i[19],I=i[20],T=i[21],k=i[22];const t=this.drawLabelWithPointPlacement_(P,I,T,k);C=t.label,i[3]=C;const e=i[23];y=(t.anchorX-e)*this.pixelRatio,i[4]=y;const n=i[24];_=(t.anchorY-n)*this.pixelRatio,i[5]=_,X=C.height,i[6]=X,Q=C.width,i[13]=Q}let et,it,nt,rt;i.length>25&&(et=i[25]),i.length>17?(it=i[16],nt=i[17],rt=i[18]):(it=Ba,nt=null,rt=null),Y&&F?H+=O:Y||F||(H-=O);let st=0;for(;g<p;g+=2){if(et&&et[st++]<Q/this.pixelRatio)continue;const i=this.calculateImageOrLabelDimensions_(C.width,C.height,h[g],h[g+1],Q,X,y,_,K,Z,H,J,r,it,!!nt||!!rt,N),n=[t,e,C,i,V,nt,rt];if(a){let t,e,r,s,o;if(tt){const i=p-g;if(!tt[i]){tt[i]={args:n,declutterMode:x};continue}const s=tt[i];t=s.args,e=s.declutterMode,delete tt[i],r=sp(t)}if(!t||"declutter"===e&&a.collides(r)||(s=!0),"declutter"===x&&a.collides(i.declutterBox)||(o=!0),"declutter"===e&&"declutter"===x){const t=s&&o;s=t,o=t}s&&("none"!==e&&a.insert(r),this.replayImageOrLabel_.apply(this,t)),o&&("none"!==x&&a.insert(i.declutterBox),this.replayImageOrLabel_.apply(this,n))}else this.replayImageOrLabel_.apply(this,n)}++d;break;case qf.DRAW_CHARS:const ot=i[1],at=i[2],lt=i[3],ht=i[4];k=i[5];const ut=i[6],ct=i[7],dt=i[8];T=i[9];const ft=i[10];P=i[11],Array.isArray(P)&&(P=P.reduce(hp,"")),I=i[12];const pt=[i[13],i[13]];x=i[14]||"declutter";const gt=i[15],mt=this.textStates[I],yt=mt.font,_t=[mt.scale[0]*ct,mt.scale[1]*ct];let vt;yt in this.widths_?vt=this.widths_[yt]:(vt={},this.widths_[yt]=vt);const xt=Zf(h,ot,at,2),wt=Math.abs(_t[0])*tl(yt,P,vt);if(ht||wt<=xt){const i=Qf(h,ot,at,2,P,(xt-wt)*ap(P,this.textStates[I].textAlign),ut,Math.abs(_t[0]),tl,yt,vt,F?0:this.viewRotation_,gt);t:if(i){const n=[];let r,s,o,l,h;if(T)for(r=0,s=i.length;r<s;++r){h=i[r],o=h[4],l=this.createLabel(o,I,"",T),y=h[2]+(_t[0]<0?-ft:ft),_=lt*l.height+2*(.5-lt)*ft*_t[1]/_t[0]-dt;const s=this.calculateImageOrLabelDimensions_(l.width,l.height,h[0],h[1],l.width,l.height,y,_,0,0,h[3],pt,!1,Ba,!1,N);if(a&&"declutter"===x&&a.collides(s.declutterBox))break t;n.push([t,e,l,s,1,null,null])}if(k)for(r=0,s=i.length;r<s;++r){h=i[r],o=h[4],l=this.createLabel(o,I,k,""),y=h[2],_=lt*l.height-dt;const s=this.calculateImageOrLabelDimensions_(l.width,l.height,h[0],h[1],l.width,l.height,y,_,0,0,h[3],pt,!1,Ba,!1,N);if(a&&"declutter"===x&&a.collides(s.declutterBox))break t;n.push([t,e,l,s,1,null,null])}a&&"none"!==x&&a.load(n.map(sp));for(let t=0,e=n.length;t<e;++t)this.replayImageOrLabel_.apply(this,n[t])}}++d;break;case qf.END_GEOMETRY:if(void 0!==s){N=i[1];const t=s(N,q,x);if(t)return t}++d;break;case qf.FILL:j?R++:this.fill_(t),++d;break;case qf.MOVE_TO_LINE_TO:let bt,St,Mt;g=i[1],p=i[2],v=i[3],v?(Yf(h,g,p,2,v,i[4]??!1,m),Jf(m,2),bt=m,St=0,Mt=bt.length):(bt=h,St=g,Mt=p),D=bt[St],z=bt[St+1],t.moveTo(D,z),w=D+.5|0,b=z+.5|0;for(let e=St+2;e<Mt;e+=2)D=bt[e],z=bt[e+1],S=D+.5|0,E=z+.5|0,e!=Mt-2&&S===w&&E===b||(t.lineTo(D,z),w=S,b=E);++d;break;case qf.SET_FILL_STYLE:this.alignAndScaleFill_=i[2],R?(this.fill_(t),R=0,A&&(t.stroke(),A=0)):A&&i[1]&&(t.stroke(),A=0),t.fillStyle=i[1],++d;break;case qf.SET_STROKE_STYLE:R&&i[1]&&(this.fill_(t),R=0),A&&(t.stroke(),A=0),this.setStrokeStyle_(t,i),++d;break;case qf.STROKE:j?A++:t.stroke(),++d;break;default:++d}}R&&this.fill_(t),A&&t.stroke()}execute(t,e,i,n,r,s){this.viewRotation_=n,this.execute_(t,e,i,this.instructions,r,void 0,void 0,s)}executeHitDetection(t,e,i,n,r){return this.viewRotation_=i,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,n,r)}},cp=["Polygon","Circle","LineString","Image","Text","Default"],dp=["Image","Text"],fp=cp.filter(t=>!dp.includes(t));let pp=!1,gp=!1;const mp={},yp=class{constructor(t,e,i,n,r,s,o){this.maxExtent_=t,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=s,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=[1,0,0,1,0,0],this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(r,o)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(const i in t){let n=this.executorsByZIndex_[i];void 0===n&&(n={},this.executorsByZIndex_[i]=n);const r=t[i];for(const t in r){const i=r[t];n[t]=new up(this.resolution_,this.pixelRatio_,this.overlaps_,i,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let e=0,n=t.length;e<n;++e)if(t[e]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,n,r,s){!1===gp&&function(){let t=0;const e=e=>{const i=sr(1,1,null,{willReadFrequently:e});let n=0;const r=performance.now();for(;performance.now()-r<50;++n)i.fillStyle=`rgba(255,0,${n%256},1)`,i.fillRect(0,0,1,1),i.getImageData(0,0,1,1);return t=n>t?n:t,n},i={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0};pp=i[t],gp=!0}();const o=2*(n=Math.round(n))+1,a=$i(this.hitDetectionTransform_,n+.5,n+.5,1/e,-1/e,-i,-t[0],-t[1]),l=!this.hitDetectionContext_;l&&(this.hitDetectionContext_=sr(o,o,null,{willReadFrequently:pp}));const h=this.hitDetectionContext_;let u;h.canvas.width!==o||h.canvas.height!==o?(h.canvas.width=o,h.canvas.height=o):l||h.clearRect(0,0,o,o),void 0!==this.renderBuffer_&&(u=[1/0,1/0,-1/0,-1/0],Dt(u,t),Ct(u,e*(this.renderBuffer_+n),u));const c=function(t){if(void 0!==mp[t])return mp[t];const e=2*t+1,i=t*t,n=new Array(i+1);for(let r=0;r<=t;++r)for(let s=0;s<=t;++s){const o=r*r+s*s;if(o>i)break;let a=n[o];a||(a=[],n[o]=a),a.push(4*((t+r)*e+(t+s))+3),r>0&&a.push(4*((t-r)*e+(t+s))+3),s>0&&(a.push(4*((t+r)*e+(t-s))+3),r>0&&a.push(4*((t-r)*e+(t-s))+3))}const r=[];for(let t=0,e=n.length;t<e;++t)n[t]&&r.push(...n[t]);return mp[t]=r,r}(n);let d;function f(t,e,i){const a=h.getImageData(0,0,o,o).data;for(let l=0,u=c.length;l<u;l++)if(a[c[l]]>0){if(!s||"none"===i||"Image"!==d&&"Text"!==d||s.includes(t)){const i=(c[l]-3)/4,s=n-i%o,a=n-(i/o|0),h=r(t,e,s*s+a*a);if(h)return h}h.clearRect(0,0,o,o);break}}const p=Object.keys(this.executorsByZIndex_).map(Number);let g,m,y,_,x;for(p.sort(v),g=p.length-1;g>=0;--g){const t=p[g].toString();for(y=this.executorsByZIndex_[t],m=cp.length-1;m>=0;--m)if(d=cp[m],_=y[d],void 0!==_&&(x=_.executeHitDetection(h,a,i,f,u),x))return x}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],r=e[2],s=e[3],o=[i,n,i,s,r,s,r,n];return Xi(o,0,8,2,t,o),o}isEmpty(){return a(this.executorsByZIndex_)}execute(t,e,i,n,r,s,o){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(o?x:v),s=s||cp;const l=cp.length;for(let h=0,u=a.length;h<u;++h){const u=a[h].toString(),c=this.executorsByZIndex_[u];for(let u=0,d=s.length;u<d;++u){const d=s[u],f=c[d];if(void 0!==f){const s=null===o?void 0:f.getZIndexContext(),u=s?s.getContext():t,c=this.maxExtent_&&"Image"!==d&&"Text"!==d;if(c&&(u.save(),this.clip(u,i)),s&&"Text"!==d&&"Image"!==d?s.pushFunction(t=>f.execute(t,e,i,n,r,o)):f.execute(u,e,i,n,r,o),c&&u.restore(),s){s.offset();const t=a[h]*l+cp.indexOf(d);this.deferredZIndexContexts_[t]||(this.deferredZIndexContexts_[t]=[]),this.deferredZIndexContexts_[t].push(s)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(v);for(let i=0,n=e.length;i<n;++i)t[e[i]].forEach(t=>{t.draw(this.renderedContext_),t.clear()}),t[e[i]].length=0}},_p=class extends Ff{constructor(t,e,i,n,r,s,o){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=n,this.transformRotation_=n?vt(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=r,this.squaredTolerance_=s,this.userTransform_=o,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=[1,0,0,1,0,0]}drawImages_(t,e,i,n){if(!this.image_)return;const r=Xi(t,e,i,n,this.transform_,this.pixelCoordinates_),s=this.context_,o=this.tmpLocalTransform_,a=s.globalAlpha;1!=this.imageOpacity_&&(s.globalAlpha=a*this.imageOpacity_);let l=this.imageRotation_;0===this.transformRotation_&&(l-=this.viewRotation_),this.imageRotateWithView_&&(l+=this.viewRotation_);for(let t=0,e=r.length;t<e;t+=2){const e=r[t]-this.imageAnchorX_,i=r[t+1]-this.imageAnchorY_;if(0!==l||1!=this.imageScale_[0]||1!=this.imageScale_[1]){const t=e+this.imageAnchorX_,n=i+this.imageAnchorY_;$i(o,t,n,1,1,l,-t,-n),s.save(),s.transform.apply(s,o),s.translate(t,n),s.scale(this.imageScale_[0],this.imageScale_[1]),s.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),s.restore()}else s.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,e,i,this.imageWidth_,this.imageHeight_)}1!=this.imageOpacity_&&(s.globalAlpha=a)}drawText_(t,e,i,n){if(!this.textState_||""===this.text_)return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const r=Xi(t,e,i,n,this.transform_,this.pixelCoordinates_),s=this.context_;let o=this.textRotation_;for(0===this.transformRotation_&&(o-=this.viewRotation_),this.textRotateWithView_&&(o+=this.viewRotation_);e<i;e+=n){const t=r[e]+this.textOffsetX_,i=r[e+1]+this.textOffsetY_;0!==o||1!=this.textScale_[0]||1!=this.textScale_[1]?(s.save(),s.translate(t-this.textOffsetX_,i-this.textOffsetY_),s.rotate(o),s.translate(this.textOffsetX_,this.textOffsetY_),s.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&s.strokeText(this.text_,0,0),this.textFillState_&&s.fillText(this.text_,0,0),s.restore()):(this.textStrokeState_&&s.strokeText(this.text_,t,i),this.textFillState_&&s.fillText(this.text_,t,i))}}moveToLineTo_(t,e,i,n,r,s){const o=this.context_;let a=Xi(t,e,i,n,this.transform_,this.pixelCoordinates_);Math.abs(s)>0&&(a=Yf(a,0,a.length,2,s,r,a),Jf(a,2)),o.moveTo(a[0],a[1]);let l=a.length;r&&(l-=2);for(let t=2;t<l;t+=2)o.lineTo(a[t],a[t+1]);return r&&o.closePath(),i}drawRings_(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s)e=this.moveToLineTo_(t,e,i[s],n,!0,r);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),ee(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=function(t,e,i){const n=t.getFlatCoordinates();if(!n)return null;const r=t.getStride();return Xi(n,0,n.length,r,e,i)}(t,this.transform_,this.pixelCoordinates_),i=e[2]-e[0],n=e[3]-e[1],r=Math.sqrt(i*i+n*n),s=this.context_;s.beginPath(),s.arc(e[0],e[1],r,0,2*Math.PI),this.fillState_&&s.fill(),this.strokeState_&&s.stroke()}""!==this.text_&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t)}}drawFeature(t,e){const i=e.getGeometryFunction()(t);i&&(this.setStyle(e),this.drawGeometry(i))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let t=0,i=e.length;t<i;++t)this.drawGeometry(e[t])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),""!==this.text_&&this.drawText_(e,0,e.length,i)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),""!==this.text_&&this.drawText_(e,0,e.length,i)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),ee(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(i,0,i.length,t.getStride(),!1,this.strokeState_.strokeOffset),e.stroke()}if(""!==this.text_){const e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getExtent();if(ee(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();let n=0;const r=t.getEnds(),s=t.getStride();e.beginPath();for(let t=0,e=r.length;t<e;++t)n=this.moveToLineTo_(i,n,r[t],s,!1,this.strokeState_.strokeOffset);e.stroke()}if(""!==this.text_){const e=t.getFlatMidpoints();this.drawText_(e,0,e.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),ee(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride(),this.strokeState_?.strokeOffset),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){const e=t.getFlatInteriorPoint();this.drawText_(e,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),ee(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getOrientedFlatCoordinates();let n=0;const r=t.getEndss(),s=t.getStride();e.beginPath();for(let t=0,e=r.length;t<e;++t){const e=r[t];n=this.drawRings_(i,n,e,s,this.strokeState_?.strokeOffset)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,i=this.contextFillState_;i?i.fillStyle!=t.fillStyle&&(i.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=t.lineCap&&(i.lineCap=t.lineCap,e.lineCap=t.lineCap),M(i.lineDash,t.lineDash)||e.setLineDash(i.lineDash=t.lineDash),i.lineDashOffset!=t.lineDashOffset&&(i.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),i.lineJoin!=t.lineJoin&&(i.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),i.lineWidth!=t.lineWidth&&(i.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),i.miterLimit!=t.miterLimit&&(i.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),i.strokeStyle!=t.strokeStyle&&(i.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){const e=this.context_,i=this.contextTextState_,n=t.textAlign?t.textAlign:qa;i?(i.font!=t.font&&(i.font=t.font,e.font=t.font),i.textAlign!=n&&(i.textAlign=n,e.textAlign=n),i.textBaseline!=t.textBaseline&&(i.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=n,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:n,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(t){const e=t.getColor();this.fillState_={fillStyle:Oa(e||La)}}else this.fillState_=null;if(e){const t=e.getColor(),i=e.getLineCap(),n=e.getLineDash(),r=e.getLineDashOffset(),s=e.getLineJoin(),o=e.getWidth(),a=e.getMiterLimit(),l=n||Na,h=e.getOffset();this.strokeState_={lineCap:void 0!==i?i:ja,lineDash:1===this.pixelRatio_?l:l.map(t=>t*this.pixelRatio_),lineDashOffset:(r||0)*this.pixelRatio_,lineJoin:void 0!==s?s:Da,lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:Oa(t||za),strokeOffset:(h??0)*this.pixelRatio_}}else this.strokeState_=null}setImageStyle(t){let e;if(!t||!(e=t.getSize()))return void(this.image_=null);const i=t.getPixelRatio(this.pixelRatio_),n=t.getAnchor(),r=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const s=t.getScaleArray();this.imageScale_=[s[0]*this.pixelRatio_/i,s[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.textFillState_={fillStyle:Oa(t||La)}}else this.textFillState_=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),n=i.getLineDash(),r=i.getLineDashOffset(),s=i.getLineJoin(),o=i.getWidth(),a=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:ja,lineDash:n||Na,lineDashOffset:r||0,lineJoin:void 0!==s?s:Da,lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:10,strokeStyle:Oa(t||za)}}else this.textStrokeState_=null;const n=t.getFont(),r=t.getOffsetX(),s=t.getOffsetY(),o=t.getRotateWithView(),a=t.getRotation(),l=t.getScaleArray(),h=t.getText(),u=t.getTextAlign(),c=t.getTextBaseline();this.textState_={font:void 0!==n?n:Fa,textAlign:void 0!==u?u:qa,textBaseline:void 0!==c?c:$a},this.text_=void 0!==h?Array.isArray(h)?h.reduce((t,e,i)=>t+(i%2?" ":e),""):h:"",this.textOffsetX_=void 0!==r?this.pixelRatio_*r:0,this.textOffsetY_=void 0!==s?this.pixelRatio_*s:0,this.textRotateWithView_=void 0!==o&&o,this.textRotation_=void 0!==a?a:0,this.textScale_=[this.pixelRatio_*l[0],this.pixelRatio_*l[1]]}else this.text_=""}},vp=.5;function xp(t,e,i,n,r,s,o,a,l){const h=l?Ti(r):r,u=sr(t[0]*vp,t[1]*vp);u.imageSmoothingEnabled=!1;const c=u.canvas,d=new _p(u,vp,r,null,o,a,l?xi(Ci(),l):null),f=i.length,p=Math.floor(16777215/f),g={};for(let t=1;t<=f;++t){const e=i[t-1],r=e.getStyleFunction()||n;if(!r)continue;let o=r(e,s);if(!o)continue;Array.isArray(o)||(o=[o]);const a=(t*p).toString(16).padStart(7,"#00000");for(let t=0,i=o.length;t<i;++t){const i=o[t],n=i.getGeometryFunction()(e);if(!n||!ee(h,n.getExtent()))continue;const r=i.clone(),s=r.getFill();s&&s.setColor(a);const l=r.getStroke();l&&(l.setColor(a),l.setLineDash(null)),r.setText(void 0);const u=i.getImage();if(u){const t=u.getImageSize();if(!t)continue;const e=sr(t[0],t[1],void 0,{alpha:!1}),i=e.canvas;e.fillStyle=a,e.fillRect(0,0,i.width,i.height),r.setImage(new cl({img:i,anchor:u.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:u.getOrigin(),opacity:1,size:u.getSize(),scale:u.getScale(),rotation:u.getRotation(),rotateWithView:u.getRotateWithView()}))}const c=r.getZIndex()||0;let d=g[c];d||(d={},g[c]=d,d.Polygon=[],d.Circle=[],d.LineString=[],d.Point=[]);const f=n.getType();if("GeometryCollection"===f){const t=n.getGeometriesArrayRecursive();for(let e=0,i=t.length;e<i;++e){const i=t[e];d[i.getType().replace("Multi","")].push(i,r)}}else d[f.replace("Multi","")].push(n,r)}}const m=Object.keys(g).map(Number).sort(v);for(let t=0,i=m.length;t<i;++t){const i=g[m[t]];for(const t in i){const n=i[t];for(let t=0,i=n.length;t<i;t+=2){d.setStyle(n[t+1]);for(let i=0,r=e.length;i<r;++i)d.setTransform(e[i]),d.drawGeometry(n[t])}}}return u.getImageData(0,0,c.width,c.height)}function wp(t,e,i){const n=[];if(i){const r=Math.floor(Math.round(t[0])*vp),s=Math.floor(Math.round(t[1])*vp),o=4*(dt(r,0,i.width-1)+dt(s,0,i.height-1)*i.width),a=i.data[o],l=i.data[o+1],h=i.data[o+2]+256*(l+256*a),u=Math.floor(16777215/e.length);h&&h%u===0&&n.push(e[h/u-1])}return n}const bp={Point:function(t,e,i,n,r,s){const o=i.getImage(),a=i.getText(),l=a&&a.getText(),h=s&&o&&l?{}:void 0;if(o){if(2!=o.getImageState())return;const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(o,h),s.drawPoint(e,n,r)}if(l){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a,h),s.drawText(e,n,r)}},LineString:function(t,e,i,n,r){const s=i.getStroke();if(s){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,s),o.drawLineString(e,n,r)}const o=i.getText();if(o&&o.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(o),s.drawText(e,n,r)}},Polygon:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(s||o){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(s,o),a.drawPolygon(e,n,r)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n,r)}},MultiPoint:function(t,e,i,n,r,s){const o=i.getImage(),a=o&&0!==o.getOpacity(),l=i.getText(),h=l&&l.getText(),u=s&&a&&h?{}:void 0;if(a){if(2!=o.getImageState())return;const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(o,u),s.drawMultiPoint(e,n,r)}if(h){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(l,u),s.drawText(e,n,r)}},MultiLineString:function(t,e,i,n,r){const s=i.getStroke();if(s){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,s),o.drawMultiLineString(e,n,r)}const o=i.getText();if(o&&o.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(o),s.drawText(e,n,r)}},MultiPolygon:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(o||s){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(s,o),a.drawMultiPolygon(e,n,r)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n,r)}},GeometryCollection:function(t,e,i,n,r,s){const o=e.getGeometriesArray();let a,l;for(a=0,l=o.length;a<l;++a)(0,bp[o[a].getType()])(t,o[a],i,n,r,s)},Circle:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(s||o){const a=t.getBuilder(i.getZIndex(),"Circle");a.setFillStrokeStyle(s,o),a.drawCircle(e,n,r)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n,r)}}};function Sp(t,e){return parseInt(L(t),10)-parseInt(L(e),10)}function Mp(t,e){const i=Ep(t,e);return i*i}function Ep(t,e){return.5*t/e}function Cp(t,e,i,n,r,s,o,a){const l=[],h=i.getImage();if(h){let t=!0;const e=h.getImageState();2==e||3==e?t=!1:0==e&&h.load(),t&&l.push(h.ready())}const u=i.getFill();u&&u.loading()&&l.push(u.ready());const c=l.length>0;return c&&Promise.all(l).then(()=>r(null)),function(t,e,i,n,r,s,o){const a=i.getGeometryFunction()(e);if(!a)return;const l=a.simplifyTransformed(n,r);i.getRenderer()?Pp(t,l,i,e,o):(0,bp[l.getType()])(t,l,i,e,o,s)}(t,e,i,n,s,o,a),c}function Pp(t,e,i,n,r){if("GeometryCollection"==e.getType()){const s=e.getGeometries();for(let e=0,o=s.length;e<o;++e)Pp(t,s[e],i,n,r);return}t.getBuilder(i.getZIndex(),"Default").drawCustom(e,n,i.getRenderer(),i.getHitDetectionRenderer(),r)}const Ip={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},Tp={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]},kp=class extends kf{constructor(t,e){super(t,e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=[1,0,0,1,0,0],this.tileClipContexts_=null}enqueueTilesForNextExtent(){return"vector"!==this.getLayer().getRenderMode()}drawTile(t,e,i,n,r,s,o,a){this.updateExecutorGroup_(t,e.pixelRatio,e.viewState.projection),this.tileImageNeedsRender_(t)&&this.renderTileImage_(t,e),super.drawTile(t,e,i,n,r,s,o,a)}getTile(t,e,i,n){const r=this.getOrCreateTile(t,e,i,n);if(!r)return null;const s=n.viewState,o=s.resolution,a=n.viewHints,l=this.getLayer().getSource(),h=l.getTileGridForProjection(s.projection),u=!(a[0]||a[1]),c=h.getZForResolution(o,l.zDirection)===t;return u&&c?r.wantedResolution=o:r.wantedResolution||(r.wantedResolution=h.getResolution(t)),r}prepareFrame(t){const e=this.getLayer().getRevision();return this.renderedLayerRevision_!==e&&(this.renderedLayerRevision_=e,this.renderedTiles.length=0),super.prepareFrame(t)}updateExecutorGroup_(t,e,i){const n=this.getLayer(),r=n.getRevision(),s=n.getRenderOrder()||null,o=t.wantedResolution,a=t.getReplayState(n);if(!a.dirty&&a.renderedResolution===o&&a.renderedRevision==r&&a.renderedPixelRatio===e&&a.renderedRenderOrder==s)return;const l=n.getSource(),h=!!n.getDeclutter(),u=l.getTileGrid(),c=l.getTileGridForProjection(i).getTileCoordExtent(t.wrappedTileCoord),d=l.getSourceTiles(e,i,t),f=L(n);delete t.hitDetectionImageData[f],t.executorGroups[f]=[],a.dirty=!1;for(let r=0,p=d.length;r<p;++r){const p=d[r];if(2!=p.getState())continue;const g=l.getProjection(),m=p.tileCoord;let y=u.getTileCoordExtent(m);i&&g&&!vi(i,g)&&(y=Mi(y,g,i,32));const _=Ht(c,y),v=Ct(_,n.getRenderBuffer()*o,this.tempExtent),x=jt(y,_)?null:v,w=new Kf(0,_,o,e),b=Mp(o,e),S=function(t,e){let i;const r=t.getStyleFunction()||n.getStyleFunction();if(r&&(i=r(t,o)),i){const n=this.renderFeature(t,b,i,w,h,e);a.dirty=a.dirty||n}},M=p.getFeatures();s&&s!==a.renderedRenderOrder&&M.sort(s);for(let t=0,e=M.length;t<e;++t){let e=M[t];i&&p.projection&&!vi(i,p.projection)&&(e=e.clone(),e.getGeometry().applyTransform(bi(p.projection,i))),x&&!ee(x,e.getGeometry().getExtent())||S.call(this,e,t)}const E=w.finish(),C="vector"!==n.getRenderMode()&&h&&1===d.length?null:_,P=new yp(C,o,e,l.getOverlaps(),E,n.getRenderBuffer(),!0);t.executorGroups[f].push(P)}a.renderedRevision=r,a.renderedPixelRatio=e,a.renderedRenderOrder=s,a.renderedResolution=o}forEachFeatureAtCoordinate(t,e,i,n,r){const s=e.viewState.resolution,o=e.viewState.rotation;i=null==i?0:i;const a=this.getLayer(),l=a.getSource().getTileGridForProjection(e.viewState.projection),h=a.getRenderBuffer(),u=Et([t]);Ct(u,s*(h+i),u);const c={},d=function(t,e,i){let s=t.getId();void 0===s&&(s=L(t));const o=c[s];if(o){if(!0!==o&&i<o.distanceSq){if(0===i)return c[s]=!0,r.splice(r.lastIndexOf(o),1),n(t,a,e);o.geometry=e,o.distanceSq=i}}else{if(0===i)return c[s]=!0,n(t,a,e);r.push(c[s]={feature:t,layer:a,geometry:e,distanceSq:i,callback:n})}},f=this.renderedTiles,p=L(a),g=a.getDeclutter(),m=g?e.declutter?.[g]?.all().map(t=>t.value):null;let y;t:for(let e=f.length-1;e>=0;--e){const n=f[e];if(!ee(l.getTileCoordExtent(n.wrappedTileCoord),u))continue;const r=n.executorGroups[p];for(let e=0,n=r.length;e<n;++e)if(y=r[e].forEachFeatureAtCoordinate(t,s,o,i,d,m),y)break t}return y}getFeatures(t){return 0===this.renderedTiles.length?Promise.resolve([]):new Promise((e,i)=>{const n=this.getLayer(),r=n.getSource(),s=this.renderedProjection,o=s.getExtent(),a=this.renderedResolution,l=r.getTileGridForProjection(s),h=zi(this.renderedPixelToCoordinateTransform_,t.slice()),u=l.getTileCoordForCoordAndResolution(h,a).toString(),c=this.renderedTiles.find(t=>t.tileCoord.toString()===u&&2===t.getState());if(!c||c.loadingSourceTiles>0)return void e([]);r.getWrapX()&&s.canWrapX()&&!kt(o,l.getTileCoordExtent(c.tileCoord))&&ae(h,s);const d=L(n),f=Jt(l.getTileCoordExtent(c.wrappedTileCoord)),p=[(h[0]-f[0])/a,(f[1]-h[1])/a],g=c.getSourceTiles().reduce((t,e)=>t.concat(e.getFeatures()),[]);let m=c.hitDetectionImageData[d];if(!m){const t=io(l.getTileSize(l.getZForResolution(a,r.zDirection))),e=this.renderedRotation_;m=xp(t,[this.getRenderTransform(l.getTileCoordCenter(c.wrappedTileCoord),a,0,vp,t[0]*vp,t[1]*vp,0)],g,n.getStyleFunction(),l.getTileCoordExtent(c.wrappedTileCoord),c.getReplayState(n).renderedResolution,e),c.hitDetectionImageData[d]=m}e(wp(p,g,m))})}getFeaturesInExtent(t){const e=[],i=this.getTileCache();if(0===i.getCount())return e;const n=this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),r=n.getZForResolution(this.renderedResolution),s={};return i.forEach(i=>{if(i.tileCoord[0]!==r||2!==i.getState())return;const o=i.getSourceTiles();for(let i=0,r=o.length;i<r;++i){const r=o[i],a=r.getKey();if(a in s)continue;s[a]=!0;const l=r.tileCoord;if(ee(t,n.getTileCoordExtent(l))){const i=r.getFeatures();if(i)for(let n=0,r=i.length;n<r;++n){const r=i[n],s=r.getGeometry();ee(t,s.getExtent())&&e.push(r)}}}}),e}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&void 0!==this.renderedLayerRevision_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}renderDeclutter(t,e){const i=this.context,n=i.globalAlpha;i.globalAlpha=e.opacity;const r=t.viewHints,s=!(r[0]||r[1]),o=[this.context.canvas.width,this.context.canvas.height],a=this.getLayer().getDeclutter(),l=a?t.declutter?.[a]:void 0,h=L(this.getLayer()),u=this.renderedTiles;for(let e=0,i=u.length;e<i;++e){const i=u[e],n=i.executorGroups[h];if(n)for(let e=n.length-1;e>=0;--e)n[e].execute(this.context,o,this.getTileRenderTransform(i,t),t.viewState.rotation,s,dp,l)}i.globalAlpha=n}renderDeferredInternal(t){const e=this.renderedTiles,i=L(this.getLayer()),n=e.reduce((t,e,n)=>(e.executorGroups[i].forEach(e=>t.push({executorGroup:e,index:n})),t),[]),r=n.map(({executorGroup:t})=>t.getDeferredZIndexContexts()),s={};for(let t=0,e=n.length;t<e;++t){const e=n[t].executorGroup.getDeferredZIndexContexts();for(const t in e)s[t]=!0}const o=Object.keys(s).map(Number).sort(v);this.layerExtent&&this.clipUnrotated(this.context,t,this.layerExtent),o.forEach(t=>{r.forEach((e,i)=>{e[t]&&(e[t].forEach(t=>{const{executorGroup:e,index:r}=n[i],s=e.getRenderedContext(),o=s.globalAlpha;s.globalAlpha=this.renderedOpacity_;const a=this.tileClipContexts_[r];a&&a.draw(s),t.draw(s),a&&s.restore(),s.globalAlpha=o,t.clear()}),e[t].length=0)})}),this.layerExtent&&this.context.restore()}getTileRenderTransform(t,e){const i=e.pixelRatio,n=e.viewState,r=n.center,s=n.resolution,o=n.rotation,a=e.size,l=Math.round(a[0]*i),h=Math.round(a[1]*i),u=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),c=t.tileCoord,d=u.getTileCoordExtent(t.wrappedTileCoord),f=u.getTileCoordExtent(c,this.tempExtent)[0]-d[0];return Ni(qi(this.inversePixelTransform.slice(),1/i,1/i),this.getRenderTransform(r,s,o,i,l,h,f))}postRender(t,e){const i=e.viewHints,n=!(i[0]||i[1]);this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation,this.renderedOpacity_=e.layerStatesArray[e.layerIndex].opacity;const r=this.getLayer(),s=r.getRenderMode(),o=t.globalAlpha;t.globalAlpha=this.renderedOpacity_;const a=r.getDeclutter(),l=a?Tp[s].filter(t=>!dp.includes(t)):Tp[s],h=e.viewState,u=h.rotation;this.layerExtent&&this.clipUnrotated(t,e,this.layerExtent);const c=r.getSource(),d=c.getTileGridForProjection(h.projection).getZForResolution(h.resolution,c.zDirection),f=this.renderedTiles,p=[],g=[],m=[],y=L(r);let _=!0;for(let i=f.length-1;i>=0;--i){const s=f[i];_=_&&!s.getReplayState(r).dirty;const o=s.executorGroups[y].filter(t=>t.hasExecutors(l));if(0===o.length)continue;const h=this.getTileRenderTransform(s,e),c=s.tileCoord[0];let v=!1;const x=o[0].getClipCoords(h);let w,b=t;if(x){w=new bf,b=w.getContext();for(let t=0,e=p.length;t<e;++t)if(d!==c&&c<g[t]){const e=p[t];ee([x[0],x[3],x[4],x[7]],[e[0],e[3],e[4],e[7]])&&(v||(b.save(),v=!0),b.beginPath(),b.moveTo(x[0],x[1]),b.lineTo(x[2],x[3]),b.lineTo(x[4],x[5]),b.lineTo(x[6],x[7]),b.moveTo(e[6],e[7]),b.lineTo(e[4],e[5]),b.lineTo(e[2],e[3]),b.lineTo(e[0],e[1]),b.clip())}p.push(x),g.push(c)}for(let i=0,r=o.length;i<r;++i)o[i].execute(t,[t.canvas.width,t.canvas.height],h,u,n,l,e.declutter?.[a]);v&&(b===t?b.restore():m[i]=w)}this.layerExtent&&t.restore(),t.globalAlpha=o,this.ready=_,this.tileClipContexts_=m,e.declutter||this.renderDeferredInternal(e),super.postRender(t,e)}renderFeature(t,e,i,n,r,s){if(!i)return!1;let o=!1;if(Array.isArray(i))for(let a=0,l=i.length;a<l;++a)o=Cp(n,t,i[a],e,this.boundHandleStyleImageChange_,void 0,r,s)||o;else o=Cp(n,t,i,e,this.boundHandleStyleImageChange_,void 0,r,s);return o}tileImageNeedsRender_(t){const e=this.getLayer();if("vector"===e.getRenderMode())return!1;const i=t.getReplayState(e),n=e.getRevision(),r=t.wantedResolution;return i.renderedTileResolution!==r||i.renderedTileRevision!==n}renderTileImage_(t,e){const i=this.getLayer(),n=t.getReplayState(i),r=i.getRevision(),s=t.executorGroups[L(i)];n.renderedTileRevision=r;const o=t.wrappedTileCoord,a=o[0],l=i.getSource();let h=e.pixelRatio;const u=e.viewState.projection,c=l.getTileGridForProjection(u),d=c.getResolution(t.tileCoord[0]),f=e.pixelRatio/t.wantedResolution*d,p=c.getResolution(a),g=t.getContext();h=Math.round(Math.max(h,f/h));const m=l.getTilePixelSize(a,h,u);g.canvas.width=m[0],g.canvas.height=m[1];const y=h/f;if(1!==y){const t=ji(this.tmpTransform_);qi(t,y,y),g.setTransform.apply(g,t)}const _=c.getTileCoordExtent(o,this.tempExtent),v=f/p,x=ji(this.tmpTransform_);qi(x,v,-v),function(t,e,i){Ni(t,Di(Li,1,0,0,1,e,i))}(x,-_[0],-_[3]);for(let t=0,e=s.length;t<e;++t)s[t].execute(g,[g.canvas.width*y,g.canvas.height*y],x,0,!0,Ip[i.getRenderMode()],null);n.renderedTileResolution=t.wantedResolution}},Rp=class extends Xl{constructor(t){t=t||{};const e=Object.assign({},t);delete e.preload;const i=void 0===t.cacheSize?0:t.cacheSize;delete t.cacheSize,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=i;const n=t.renderMode||"hybrid";at("hybrid"==n||"vector"==n,"`renderMode` must be `'hybrid'` or `'vector'`"),this.renderMode_=n,this.setPreload(t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError),this.getBackground,this.setBackground}createRenderer(){return new kp(this,{cacheSize:this.cacheSize_})}getFeatures(t){return super.getFeatures(t)}getFeaturesInExtent(t){return this.getRenderer().getFeaturesInExtent(t)}getRenderMode(){return this.renderMode_}getPreload(){return this.get(Rf)}getUseInterimTilesOnError(){return this.get(Af)}setPreload(t){this.set(Rf,t)}setUseInterimTilesOnError(t){this.set(Af,t)}};class Ap extends Error{constructor(t){super("Unexpected response status: "+t.status),this.name="ResponseError",this.response=t}}class Gp extends Error{constructor(t){super("Failed to issue request"),this.name="ClientError",this.client=t}}function Op(t){return new Promise(function(e,i){const n=new XMLHttpRequest;n.addEventListener("load",function(t){const n=t.target;if(!n.status||n.status>=200&&n.status<300){let t;try{t=JSON.parse(n.responseText)}catch(t){const e="Error parsing response text as JSON: "+t.message;return void i(new Error(e))}return void e(t)}i(new Ap(n))}),n.addEventListener("error",function(t){i(new Gp(t.target))}),n.open("GET",t),n.setRequestHeader("Accept","application/json"),n.send()})}function Fp(t,e){return e.includes("://")?e:new URL(e,t).href}const Lp=class extends Fd{constructor(t){super({extent:t.extent,origin:t.origin,origins:t.origins,resolutions:t.resolutions,tileSize:t.tileSize,tileSizes:t.tileSizes,sizes:t.sizes}),this.matrixIds_=t.matrixIds}getMatrixId(t){return this.matrixIds_[t]}getMatrixIds(){return this.matrixIds_}},jp={"image/png":!0,"image/jpeg":!0,"image/gif":!0,"image/webp":!0},Np={"application/vnd.mapbox-vector-tile":!0,"application/geo+json":!0};function Dp(t,e){if(!e.length)return t;const i=new URL(t,"file:/");if(i.pathname.split("/").includes("collections"))return ye('The "collections" query parameter cannot be added to collection endpoints'),t;const n=e.map(t=>encodeURIComponent(t)).join(",");return i.searchParams.append("collections",n),`${t.split("?")[0]}?${decodeURIComponent(i.searchParams.toString())}`}function zp(t,e,i,n){let r=t.projection;if(!r&&("string"==typeof e.crs?r=fi(e.crs):"uri"in e.crs&&(r=fi(e.crs.uri)),!r))throw new Error(`Unsupported CRS: ${JSON.stringify(e.crs)}`);const s=e.orderedAxes,o=!(s?s.slice(0,2).map(t=>t.replace(/E|X|Lon/i,"e").replace(/N|Y|Lat/i,"n")).join(""):r.getAxisOrientation()).startsWith("en"),a=e.tileMatrices.sort(function(t,e){return e.cellSize-t.cellSize}),l={};for(let t=0;t<a.length;++t){const e=a[t];l[e.id]=e}const h={},u=[];if(n)for(let t=0;t<n.length;++t){const e=n[t],i=e.tileMatrix,r=l[i],s=a.indexOf(r);u[s]=i,h[i]=e}else for(let t=0;t<a.length;++t){const e=a[t].id;u.push(e)}const c=u.length,d=new Array(c),f=new Array(c),p=new Array(c),g=new Array(c),m=[-1/0,-1/0,1/0,1/0];for(let t=0;t<c;++t){const e=u[t],i=l[e],n=i.pointOfOrigin;d[t]=o?[n[1],n[0]]:n,f[t]=i.cellSize,p[t]=[i.matrixWidth,i.matrixHeight],g[t]=[i.tileWidth,i.tileHeight];const r=h[e];if(r){const e=i.cellSize*i.tileWidth,n=d[t][0]+r.minTileCol*e,s=d[t][0]+(r.maxTileCol+1)*e,o=i.cellSize*i.tileHeight;let a,l;"bottomLeft"===i.cornerOfOrigin?(a=d[t][1]+r.minTileRow*o,l=d[t][1]+(r.maxTileRow+1)*o):(a=d[t][1]-(r.maxTileRow+1)*o,l=d[t][1]-r.minTileRow*o),Ht(m,[n,a,s,l],m)}}const y=new Lp({origins:d,resolutions:f,sizes:p,tileSizes:g,extent:n?m:void 0,matrixIds:u});if(!i)return{grid:y,projection:r};const _=t.context,v=t.url;return{grid:y,projection:r,urlTemplate:i,urlFunction:function(t,e,r){if(!t)return;const s=u[t[0]],o=l[s],a="bottomLeft"===o.cornerOfOrigin,c={tileMatrix:s,tileCol:t[1],tileRow:a?-t[2]-1:t[2]};if(n){const t=h[o.id];if(c.tileCol<t.minTileCol||c.tileCol>t.maxTileCol||c.tileRow<t.minTileRow||c.tileRow>t.maxTileRow)return}Object.assign(c,{z:c.tileMatrix,x:c.tileCol,y:c.tileRow},_);const d=i.replace(/\{(\w+?)\}/g,function(t,e){return c[e]});return Fp(v,d)}}}const qp=class extends gf{constructor(t){var e;super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,format:t.format,overlaps:t.overlaps,projection:t.projection,tileClass:t.tileClass,transition:t.transition,wrapX:t.wrapX,zDirection:t.zDirection,state:"loading"}),(e={url:t.url,projection:this.getProjection(),mediaType:t.mediaType,supportedMediaTypes:t.format.supportedMediaTypes,context:t.context||null,collections:t.collections},Op(e.url).then(function(t){return function(t,e){const i=e.tileMatrixSetLimits;let n;if("map"===e.dataType)n=function(t,e,i){let n,r;for(let i=0;i<t.length;++i){const s=t[i];if("item"===s.rel){if(s.type===e){n=s.href;break}(jp[s.type]||!r&&s.type.startsWith("image/"))&&(r=s.href)}}if(!n){if(!r)throw new Error('Could not find "item" link');n=r}return i&&(n=Dp(n,i)),n}(e.links,t.mediaType,t.collections);else{if("vector"!==e.dataType)throw new Error('Expected tileset data type to be "map" or "vector"');n=function(t,e,i,n){let r,s;const o={};for(let i=0;i<t.length;++i){const n=t[i];if(o[n.type]=n.href,"item"===n.rel){if(n.type===e){r=n.href;break}Np[n.type]&&(s=n.href)}}if(!r&&i)for(let t=0;t<i.length;++t){const e=i[t];if(o[e]){r=o[e];break}}if(!r){if(!s)throw new Error('Could not find "item" link');r=s}return n&&(r=Dp(r,n)),r}(e.links,t.mediaType,t.supportedMediaTypes,t.collections)}if(e.tileMatrixSet)return zp(t,e.tileMatrixSet,n,i);const r=e.links.find(t=>"http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme"===t.rel);if(!r)throw new Error("Expected http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme link or tileMatrixSet");const s=r.href;return Op(Fp(t.url,s)).then(function(e){return zp(t,e,n,i)})}(e,t)})).then(this.handleTileSetInfo_.bind(this)).catch(this.handleError_.bind(this))}handleTileSetInfo_(t){this.tileGrid=t.grid,this.projection=t.projection,this.setTileUrlFunction(t.urlFunction,t.urlTemplate),this.setState("ready")}handleError_(t){ye(t),this.setState("error")}},$p=4294967296,Bp=1/$p,Up="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class Wp{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(t,e,i=this.length){for(;this.pos<i;){const i=this.readVarint(),n=i>>3,r=this.pos;this.type=7&i,t(n,e,this),this.pos===r&&this.skip(i)}return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*$p;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*$p;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const e=this.buf;let i,n;return n=e[this.pos++],i=127&n,n<128?i:(n=e[this.pos++],i|=(127&n)<<7,n<128?i:(n=e[this.pos++],i|=(127&n)<<14,n<128?i:(n=e[this.pos++],i|=(127&n)<<21,n<128?i:(n=e[this.pos],i|=(15&n)<<28,function(t,e,i){const n=i.buf;let r,s;if(s=n[i.pos++],r=(112&s)>>4,s<128)return Xp(t,r,e);if(s=n[i.pos++],r|=(127&s)<<3,s<128)return Xp(t,r,e);if(s=n[i.pos++],r|=(127&s)<<10,s<128)return Xp(t,r,e);if(s=n[i.pos++],r|=(127&s)<<17,s<128)return Xp(t,r,e);if(s=n[i.pos++],r|=(127&s)<<24,s<128)return Xp(t,r,e);if(s=n[i.pos++],r|=(1&s)<<31,s<128)return Xp(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(i,t,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return Boolean(this.readVarint())}readString(){const t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Up?Up.decode(this.buf.subarray(e,t)):function(t,e,i){let n="",r=e;for(;r<i;){const e=t[r];let s,o,a,l=null,h=e>239?4:e>223?3:e>191?2:1;if(r+h>i)break;1===h?e<128&&(l=e):2===h?(s=t[r+1],128==(192&s)&&(l=(31&e)<<6|63&s,l<=127&&(l=null))):3===h?(s=t[r+1],o=t[r+2],128==(192&s)&&128==(192&o)&&(l=(15&e)<<12|(63&s)<<6|63&o,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===h&&(s=t[r+1],o=t[r+2],a=t[r+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(l=(15&e)<<18|(63&s)<<12|(63&o)<<6|63&a,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,h=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),r+=h}return n}(this.buf,e,t)}readBytes(){const t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readVarint(e));return t}readPackedSVarint(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFloat());return t}readPackedDouble(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed64());return t}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}skip(t){const e=7&t;if(0===e)for(;this.buf[this.pos++]>127;);else if(2===e)this.pos=this.readVarint()+this.pos;else if(5===e)this.pos+=4;else{if(1!==e)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e<this.pos+t;)e*=2;if(e!==this.length){const t=new Uint8Array(e);t.set(this.buf),this.buf=t,this.dataView=new DataView(t.buffer),this.length=e}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeSFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*Bp),!0),this.pos+=8}writeSFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*Bp),!0),this.pos+=8}writeVarint(t){(t=+t||0)>268435455||t<0?function(t,e){let i,n;if(t>=0?(i=t%4294967296|0,n=t/4294967296|0):(i=~(-t%4294967296),n=~(-t/4294967296),4294967295^i?i=i+1|0:(i=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos]=127&t}(i,0,e),function(t,e){const i=(7&t)<<4;e.buf[e.pos++]|=i|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))}writeSVarint(t){this.writeVarint(t<0?2*-t-1:2*t)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(4*t.length),this.pos++;const e=this.pos;this.pos=function(t,e,i){for(let n,r,s=0;s<e.length;s++){if(n=e.charCodeAt(s),n>55295&&n<57344){if(!r){n>56319||s+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):r=n;continue}if(n<56320){t[i++]=239,t[i++]=191,t[i++]=189,r=n;continue}n=r-55296<<10|n-56320|65536,r=null}else r&&(t[i++]=239,t[i++]=191,t[i++]=189,r=null);n<128?t[i++]=n:(n<2048?t[i++]=n>>6|192:(n<65536?t[i++]=n>>12|224:(t[i++]=n>>18|240,t[i++]=n>>12&63|128),t[i++]=n>>6&63|128),t[i++]=63&n|128)}return i}(this.buf,t,this.pos);const i=this.pos-e;i>=128&&Vp(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){const e=t.length;this.writeVarint(e),this.realloc(e);for(let i=0;i<e;i++)this.buf[this.pos++]=t[i]}writeRawMessage(t,e){this.pos++;const i=this.pos;t(e,this);const n=this.pos-i;n>=128&&Vp(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n}writeMessage(t,e,i){this.writeTag(t,2),this.writeRawMessage(e,i)}writePackedVarint(t,e){e.length&&this.writeMessage(t,Kp,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,Zp,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,Jp,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,Yp,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,Hp,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,Qp,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,tg,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,eg,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,ig,e)}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,2),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}}function Xp(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Vp(t,e,i){const n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(let e=i.pos-1;e>=t;e--)i.buf[e+n]=i.buf[e]}function Kp(t,e){for(let i=0;i<t.length;i++)e.writeVarint(t[i])}function Zp(t,e){for(let i=0;i<t.length;i++)e.writeSVarint(t[i])}function Yp(t,e){for(let i=0;i<t.length;i++)e.writeFloat(t[i])}function Hp(t,e){for(let i=0;i<t.length;i++)e.writeDouble(t[i])}function Jp(t,e){for(let i=0;i<t.length;i++)e.writeBoolean(t[i])}function Qp(t,e){for(let i=0;i<t.length;i++)e.writeFixed32(t[i])}function tg(t,e){for(let i=0;i<t.length;i++)e.writeSFixed32(t[i])}function eg(t,e){for(let i=0;i<t.length;i++)e.writeFixed64(t[i])}function ig(t,e){for(let i=0;i<t.length;i++)e.writeSFixed64(t[i])}function ng(t,e,i,n,r,s,o){let a,l;const h=(i-e)/n;if(1===h)a=e;else if(2===h)a=e,l=r;else if(0!==h){let s=t[e],o=t[e+1],h=0;const u=[0];for(let r=e+n;r<i;r+=n){const e=t[r],i=t[r+1];h+=Math.sqrt((e-s)*(e-s)+(i-o)*(i-o)),u.push(h),s=e,o=i}const c=r*h,d=function(t,e,i){let n,r;i=i||v;let s=0,o=t.length,a=!1;for(;s<o;)n=s+(o-s>>1),r=+i(t[n],e),r<0?s=n+1:(o=n,a=!r);return a?s:~s}(u,c);d<0?(l=(c-u[-d-2])/(u[-d-1]-u[-d-2]),a=e+(-d-2)*n):a=e+d*n}o=o>1?o:2,s=s||new Array(o);for(let e=0;e<o;++e)s[e]=void 0===a?NaN:void 0===l?t[a+e]:_t(t[a+e],t[a+n+e],l);return s}function rg(t,e,i,n,r,s){if(i==e)return null;let o;if(r<t[e+n-1])return s?(o=t.slice(e,e+n),o[n-1]=r,o):null;if(t[i-1]<r)return s?(o=t.slice(i-n,i),o[n-1]=r,o):null;if(r==t[e+n-1])return t.slice(e,e+n);let a=e/n,l=i/n;for(;a<l;){const e=a+l>>1;r<t[(e+1)*n-1]?l=e:a=e+1}const h=t[a*n-1];if(r==h)return t.slice((a-1)*n,(a-1)*n+n);const u=(r-h)/(t[(a+1)*n-1]-h);o=[];for(let e=0;e<n-1;++e)o.push(_t(t[(a-1)*n+e],t[a*n+e],u));return o.push(r),o}class sg extends Qi{constructor(t,e){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}appendCoordinate(t){S(this.flatCoordinates,t),this.changed()}clone(){const t=new sg(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<It(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(rn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),on(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,i,n))}forEachSegment(t){return In(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinateAtM(t,e){return"XYM"!=this.layout&&"XYZM"!=this.layout?null:(e=void 0!==e&&e,rg(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return cn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return ng(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return Zf(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){const e=[];return e.length=pn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new sg(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return Tn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,this.getExtent())}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=ln(this.flatCoordinates,0,t,this.stride),this.changed()}}const og=sg;class ag extends Qi{constructor(t,e,i){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(t[0]))this.setCoordinates(t,e);else if(void 0!==e&&i)this.setFlatCoordinates(e,t),this.ends_=i;else{const e=t,i=[],n=[];for(let t=0,r=e.length;t<r;++t)S(i,e[t].getFlatCoordinates()),n.push(i.length);const r=0===e.length?this.getLayout():e[0].getLayout();this.setFlatCoordinates(r,i),this.ends_=n}}appendLineString(t){S(this.flatCoordinates,t.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new ag(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<It(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(sn(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),an(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,t,e,i,n))}getCoordinateAtM(t,e,i){return"XYM"!=this.layout&&"XYZM"!=this.layout||0===this.flatCoordinates.length?null:(e=void 0!==e&&e,i=void 0!==i&&i,function(t,e,i,n,r,s,o){if(o)return rg(t,e,i[i.length-1],n,r,s);let a;if(r<t[n-1])return s?(a=t.slice(0,n),a[n-1]=r,a):null;if(t[t.length-1]<r)return s?(a=t.slice(t.length-n),a[n-1]=r,a):null;for(let s=0,o=i.length;s<o;++s){const o=i[s];if(e!=o){if(r<t[e+n-1])return null;if(r<=t[o-1])return rg(t,e,o,n,r,!1);e=o}}return null}(this.flatCoordinates,0,this.ends_,this.stride,t,e,i))}getCoordinates(){return dn(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new og(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLineStrings(){const t=this.flatCoordinates,e=this.ends_,i=this.layout,n=[];let r=0;for(let s=0,o=e.length;s<o;++s){const o=e[s],a=new og(t.slice(r,o),i);n.push(a),r=o}return n}getLength(){const t=this.ends_;let e=0,i=0;for(let n=0,r=t.length;n<r;++n)i+=Zf(this.flatCoordinates,e,t[n],this.stride),e=t[n];return i}getFlatMidpoints(){const t=[],e=this.flatCoordinates;let i=0;const n=this.ends_,r=this.stride;for(let s=0,o=n.length;s<o;++s){const o=n[s];S(t,ng(e,i,o,r,.5)),i=o}return t}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=gn(this.flatCoordinates,0,this.ends_,this.stride,t,e,0,i),new ag(e,"XY",i)}getType(){return"MultiLineString"}intersectsExtent(t){return function(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){if(Tn(t,e,i[s],n,r))return!0;e=i[s]}return!1}(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=hn(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}const lg=ag;class hg extends Qi{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){S(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){const t=new hg(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<It(this.getExtent(),t,e))return n;const r=this.flatCoordinates,s=this.stride;for(let o=0,a=r.length;o<a;o+=s){const a=pt(t,e,r[o],r[o+1]);if(a<n){n=a;for(let t=0;t<s;++t)i[t]=r[o+t];i.length=s}}return n}getCoordinates(){return cn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){const e=this.flatCoordinates.length/this.stride;return t<0||e<=t?null:new bn(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){const t=this.flatCoordinates,e=this.layout,i=this.stride,n=[];for(let r=0,s=t.length;r<s;r+=i){const s=new bn(t.slice(r,r+i),e);n.push(s)}return n}getType(){return"MultiPoint"}intersectsExtent(t){const e=this.flatCoordinates,i=this.stride;for(let n=0,r=e.length;n<r;n+=i)if(Rt(t,e[n],e[n+1]))return!0;return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=ln(this.flatCoordinates,0,t,this.stride),this.changed()}}const ug=hg;function cg(t,e,i,n){const r=[];let s=[1/0,1/0,-1/0,-1/0];for(let o=0,a=i.length;o<a;++o){const a=i[o];s=Lt(t,e,a[0],n),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),e=a[a.length-1]}return r}class dg extends Qi{constructor(t,e,i){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!i&&!Array.isArray(t[0])){const n=t,r=[],s=[];for(let t=0,e=n.length;t<e;++t){const e=n[t],i=r.length,o=e.getEnds();for(let t=0,e=o.length;t<e;++t)o[t]+=i;S(r,e.getFlatCoordinates()),s.push(o)}e=0===n.length?this.getLayout():n[0].getLayout(),t=r,i=s}void 0!==e&&i?(this.setFlatCoordinates(e,t),this.endss_=i):this.setCoordinates(t,e)}appendPolygon(t){let e;if(this.flatCoordinates){const i=this.flatCoordinates.length;S(this.flatCoordinates,t.getFlatCoordinates()),e=t.getEnds().slice();for(let t=0,n=e.length;t<n;++t)e[t]+=i}else this.flatCoordinates=t.getFlatCoordinates().slice(),e=t.getEnds().slice(),this.endss_.push();this.endss_.push(e),this.changed()}clone(){const t=this.endss_.length,e=new Array(t);for(let i=0;i<t;++i)e[i]=this.endss_[i].slice();const i=new dg(this.flatCoordinates.slice(),this.layout,e);return i.applyProperties(this),i}closestPointXY(t,e,i,n){return n<It(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(function(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];r=sn(t,e,o,n,r),e=o[o.length-1]}return r}(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),function(t,e,i,n,r,s,o,a,l,h,u){u=u||[NaN,NaN];for(let s=0,c=i.length;s<c;++s){const c=i[s];h=an(t,e,c,n,r,true,o,a,l,h,u),e=c[c.length-1]}return h}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,0,t,e,i,n))}containsXY(t,e){return function(t,e,i,n,r,s){if(0===i.length)return!1;for(let o=0,a=i.length;o<a;++o){const a=i[o];if(En(t,e,a,n,r,s))return!0;e=a[a.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)}getArea(){return function(t,e,i,n){let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s];r+=en(t,e,o,n),e=o[o.length-1]}return r}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),jn(e,0,this.endss_,this.stride,t)):e=this.flatCoordinates,fn(e,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const t=cg(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Pn(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new ug(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;Fn(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=jn(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=function(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l],u=[];o=_n(t,e,h,n,r,s,o,u),a.push(u),e=h[h.length-1]}return o}(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),e,0,i),new dg(e,"XY",i)}getPolygon(t){if(t<0||this.endss_.length<=t)return null;let e;if(0===t)e=0;else{const i=this.endss_[t-1];e=i[i.length-1]}const i=this.endss_[t].slice(),n=i[i.length-1];if(0!==e)for(let t=0,n=i.length;t<n;++t)i[t]-=e;return new zn(this.flatCoordinates.slice(e,n),this.layout,i)}getPolygons(){const t=this.layout,e=this.flatCoordinates,i=this.endss_,n=[];let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s].slice(),a=o[o.length-1];if(0!==r)for(let t=0,e=o.length;t<e;++t)o[t]-=r;const l=new zn(e.slice(r,a),t,o);n.push(l),r=a}return n}getType(){return"MultiPolygon"}intersectsExtent(t){return function(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];if(Rn(t,e,o,n,r))return!0;e=o[o.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,3),this.flatCoordinates||(this.flatCoordinates=[]);const i=un(this.flatCoordinates,0,t,this.stride,this.endss_);if(0===i.length)this.flatCoordinates.length=0;else{const t=i[i.length-1];this.flatCoordinates.length=0===t.length?0:t[t.length-1]}this.changed()}}const fg=dg,pg=[1,0,0,1,0,0];class gg{constructor(t,e,i,n,r,s){this.styleFunction,this.extent_,this.id_=s,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=r,this.squaredTolerance_,this.stride_=n,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_="Point"===this.type_?Ft(this.flatCoordinates_):Lt(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=Xt(this.getExtent());this.flatInteriorPoints_=Cn(this.flatCoordinates_,0,this.ends_,this.stride_,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=Nn(this.flatCoordinates_,this.ends_),e=cg(this.flatCoordinates_,0,t,this.stride_);this.flatInteriorPoints_=Pn(this.flatCoordinates_,0,t,this.stride_,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=ng(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const i=this.ends_;for(let n=0,r=i.length;n<r;++n){const r=i[n],s=ng(t,e,r,this.stride_,.5);S(this.flatMidpoints_,s),e=r}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(t){return this}simplifyTransformed(t,e){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(t){const e=(t=fi(t)).getExtent(),i=t.getWorldExtent();if(e&&i){const t=Yt(i)/Yt(e);$i(pg,i[0],i[3],t,-t,0,0,0),Xi(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,pg,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new gg(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=I((t,e)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const i=this.simplifiedGeometry_.getFlatCoordinates();let n;switch(this.type_){case"LineString":i.length=pn(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),n=[i.length];break;case"MultiLineString":n=[],i.length=gn(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,n);break;case"Polygon":n=[],i.length=_n(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,n)}return n&&(this.simplifiedGeometry_=new gg(this.type_,i,n,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}gg.prototype.getFlatCoordinates=gg.prototype.getOrientedFlatCoordinates;const mg=gg;class yg extends N{constructor(t){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),t)if("function"==typeof t.getSimplifiedGeometry){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new yg,e=this.geometryName_;t.setGeometryName(e);const i=this.getPropertiesInternal();if(i){const n=this.getGeometry();for(const r in i)r===e&&n?t.set(r,n.clone()):t.set(r,i[r],!0)}const n=this.getStyle();return n&&t.setStyle(n),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(u(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=l(t,c,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?function(t){if("function"==typeof t)return t;let e;return Array.isArray(t)?e=t:(at("function"==typeof t.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[t]),function(){return e}}(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){t!==this.geometryName_&&(this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_())}}const _g=yg;class vg extends Yi{constructor(t){super(),this.geometries_=t,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(u),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const t=this.geometries_;for(let e=0,i=t.length;e<i;++e)this.changeEventsKeys_.push(l(t[e],c,this.changed,this))}clone(){const t=new vg(xg(this.geometries_));return t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<It(this.getExtent(),t,e))return n;const r=this.geometries_;for(let s=0,o=r.length;s<o;++s)n=r[s].closestPointXY(t,e,i,n);return n}containsXY(t,e){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)if(i[n].containsXY(t,e))return!0;return!1}computeExtent(t){Ot(t);const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)Nt(t,e[i].getExtent());return t}getGeometries(){return xg(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let t=[];const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)e[i].getType()===this.getType()?t=t.concat(e[i].getGeometriesArrayRecursive()):t.push(e[i]);return t}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=[],i=this.geometries_;let n=!1;for(let r=0,s=i.length;r<s;++r){const s=i[r],o=s.getSimplifiedGeometry(t);e.push(o),o!==s&&(n=!0)}return n?new vg(e):(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getType(){return"GeometryCollection"}intersectsExtent(t){const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)if(e[i].intersectsExtent(t))return!0;return!1}isEmpty(){return 0===this.geometries_.length}rotate(t,e){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)i[n].rotate(t,e);this.changed()}scale(t,e,i){i||(i=Xt(this.getExtent()));const n=this.geometries_;for(let r=0,s=n.length;r<s;++r)n[r].scale(t,e,i);this.changed()}setGeometries(t){this.setGeometriesArray(xg(t))}setGeometriesArray(t){this.unlistenGeometriesChange_(),this.geometries_=t,this.listenGeometriesChange_(),this.changed()}applyTransform(t){const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)e[i].applyTransform(t);this.changed()}translate(t,e){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)i[n].translate(t,e);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function xg(t){return t.map(t=>t.clone())}const wg=vg,bg=class{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=_g,this.supportedMediaTypes=null}getReadOptions(t,e){if(e){let i=e.dataProjection?fi(e.dataProjection):this.readProjection(t);e.extent&&i&&"tile-pixels"===i.getUnits()&&(i=fi(i),i.setWorldExtent(e.extent)),e={dataProjection:i,featureProjection:e.featureProjection}}return this.adaptOptions(e)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},t)}getType(){return O()}readFeature(t,e){return O()}readFeatures(t,e){return O()}readGeometry(t,e){return O()}readProjection(t){return O()}writeFeature(t,e){return O()}writeFeatures(t,e){return O()}writeGeometry(t,e){return O()}};function Sg(t,e,i){const n=i?fi(i.featureProjection):null,r=i?fi(i.dataProjection):null;let s=t;if(n&&r&&!vi(n,r)){e&&(s=t.clone());const i=e?n:r,o=e?r:n;"tile-pixels"===i.getUnits()?s.transform(i,o):s.applyTransform(bi(i,o))}if(e&&i&&void 0!==i.decimals){const e=Math.pow(10,i.decimals),n=function(t){for(let i=0,n=t.length;i<n;++i)t[i]=Math.round(t[i]*e)/e;return t};s===t&&(s=t.clone()),s.applyTransform(n)}return s}const Mg={Point:bn,LineString:og,Polygon:zn,MultiPoint:ug,MultiLineString:lg,MultiPolygon:fg};function Eg(t,e){const i=t.geometry;if(!i)return[];if(Array.isArray(i))return i.map(e=>Eg({...t,geometry:e})).flat();const n="MultiPolygon"===i.type?"Polygon":i.type;if("GeometryCollection"===n||"Circle"===n)throw new Error("Unsupported geometry type: "+n);const r=i.layout.length;return Sg(new mg(n,"Polygon"===n?function(t,e,i){return Array.isArray(e[0])?(Fn(t,0,e,i)||jn(t=t.slice(),0,e,i),t):(On(t,0,e,i)||Ln(t=t.slice(),0,e,i),t)}(i.flatCoordinates,i.ends,r):i.flatCoordinates,i.ends?.flat(),r,t.properties||{},t.id).enableSimplifyTransformed(),!1,e)}function Cg(t,e){if(!t)return null;if(Array.isArray(t)){const i=t.map(t=>Cg(t,e));return new wg(i)}return Sg(new(0,Mg[t.type])(t.flatCoordinates,t.layout||"XY",t.ends),!1,e)}function Pg(t,e,i){if(3===t){const t={keys:[],values:[],features:[]},n=i.readVarint()+i.pos;i.readFields(Ig,t,n),t.length=t.features.length,t.length&&(e[t.name]=t)}}function Ig(t,e,i){if(15===t)e.version=i.readVarint();else if(1===t)e.name=i.readString();else if(5===t)e.extent=i.readVarint();else if(2===t)e.features.push(i.pos);else if(3===t)e.keys.push(i.readString());else if(4===t){let n=null;const r=i.readVarint()+i.pos;for(;i.pos<r;)n=1==(t=i.readVarint()>>3)?i.readString():2===t?i.readFloat():3===t?i.readDouble():4===t?i.readVarint64():5===t?i.readVarint():6===t?i.readSVarint():7===t?i.readBoolean():null;e.values.push(n)}}function Tg(t,e,i){if(1==t)e.id=i.readVarint();else if(2==t){const t=i.readVarint()+i.pos;for(;i.pos<t;){const t=e.layer.keys[i.readVarint()],n=e.layer.values[i.readVarint()];e.properties[t]=n}}else 3==t?e.type=i.readVarint():4==t&&(e.geometry=i.pos)}function kg(t,e,i){t.pos=e.features[i];const n=t.readVarint()+t.pos,r={layer:e,type:0,properties:{}};return t.readFields(Tg,r,n),r}const Rg=class extends bg{constructor(t){super(),t=t||{},this.dataProjection=new ve({code:"",units:"tile-pixels"}),this.featureClass=t.featureClass?t.featureClass:mg,this.geometryName_=t.geometryName,this.layerName_=t.layerName?t.layerName:"layer",this.layers_=t.layers?t.layers:null,this.idProperty_=t.idProperty,this.supportedMediaTypes=["application/vnd.mapbox-vector-tile","application/x-protobuf"]}readRawGeometry_(t,e,i,n){t.pos=e.geometry;const r=t.readVarint()+t.pos;let s=1,o=0,a=0,l=0,h=0,u=0;for(;t.pos<r;){if(!o){const e=t.readVarint();s=7&e,o=e>>3}if(o--,1===s||2===s)a+=t.readSVarint(),l+=t.readSVarint(),1===s&&h>u&&(n.push(h),u=h),i.push(a,l),h+=2;else{if(7!==s)throw new Error("Invalid command found in the PBF");h>u&&(i.push(i[u],i[u+1]),h+=2)}}h>u&&(n.push(h),u=h)}createFeature_(t,e,i){const n=e.type;if(0===n)return null;let r;const s=e.properties;let o;this.idProperty_?(o=s[this.idProperty_],delete s[this.idProperty_]):o=e.id,s[this.layerName_]=e.layer.name;const a=[],l=[];this.readRawGeometry_(t,e,a,l);const h=function(t,e){let i;return 1===t?i=1===e?"Point":"MultiPoint":2===t?i=1===e?"LineString":"MultiLineString":3===t&&(i="Polygon"),i}(n,l.length);if(this.featureClass===mg)r=new this.featureClass(h,a,l,2,s,o),r.transform(i.dataProjection);else{let t;if("Polygon"==h){const e=Nn(a,l);t=e.length>1?new fg(a,"XY",e):new zn(a,"XY",l)}else t="Point"===h?new bn(a,"XY"):"LineString"===h?new og(a,"XY"):"MultiPoint"===h?new ug(a,"XY"):"MultiLineString"===h?new lg(a,"XY",l):null;r=new(0,this.featureClass),this.geometryName_&&r.setGeometryName(this.geometryName_);const e=Sg(t,!1,i);r.setGeometry(e),void 0!==o&&r.setId(o),r.setProperties(s,!0)}return r}getType(){return"arraybuffer"}readFeatures(t,e){const i=this.layers_,n=fi((e=this.adaptOptions(e)).dataProjection);n.setWorldExtent(e.extent),e.dataProjection=n;const r=new Wp(t),s=r.readFields(Pg,{}),o=[];for(const t in s){if(i&&!i.includes(t))continue;const a=s[t],l=a?[0,0,a.extent,a.extent]:null;n.setExtent(l);for(let t=0,i=a.length;t<i;++t){const i=kg(r,a,t),n=this.createFeature_(r,i,e);null!==n&&o.push(n)}}return o}readProjection(t){return this.dataProjection}setLayers(t){this.layers_=t}};function Ag(t){if("string"==typeof t){return JSON.parse(t)||null}return null!==t?t:null}const Gg=class extends bg{constructor(){super()}getType(){return"json"}readFeature(t,e){return this.readFeatureFromObject(Ag(t),this.getReadOptions(t,e))}readFeatures(t,e){return this.readFeaturesFromObject(Ag(t),this.getReadOptions(t,e))}readFeatureFromObject(t,e){return O()}readFeaturesFromObject(t,e){return O()}readGeometry(t,e){return this.readGeometryFromObject(Ag(t),this.getReadOptions(t,e))}readGeometryFromObject(t,e){return O()}readProjection(t){return this.readProjectionFromObject(Ag(t))}readProjectionFromObject(t){return O()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(t,e){return O()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(t,e){return O()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(t,e){return O()}};function Og(t,e){if(!t)return null;let i;switch(t.type){case"Point":i=function(t){const e=t.coordinates;return{type:"Point",flatCoordinates:e,layout:Hi(e.length)}}(t);break;case"LineString":i=function(t){const e=t.coordinates,i=e.flat();return{type:"LineString",flatCoordinates:i,ends:[i.length],layout:Hi(e[0]?.length||2)}}(t);break;case"Polygon":i=function(t){const e=t.coordinates,i=[],n=e[0]?.[0]?.length;return{type:"Polygon",flatCoordinates:i,ends:hn(i,0,e,n),layout:Hi(n)}}(t);break;case"MultiPoint":i=function(t){const e=t.coordinates;return{type:"MultiPoint",flatCoordinates:e.flat(),layout:Hi(e[0]?.length||2)}}(t);break;case"MultiLineString":i=function(t){const e=t.coordinates,i=e[0]?.[0]?.length||2,n=[];return{type:"MultiLineString",flatCoordinates:n,ends:hn(n,0,e,i),layout:Hi(i)}}(t);break;case"MultiPolygon":i=function(t){const e=t.coordinates,i=[],n=e[0]?.[0]?.[0].length||2;return{type:"MultiPolygon",flatCoordinates:i,ends:un(i,0,e,n),layout:Hi(n)}}(t);break;case"GeometryCollection":i=function(t){const e=t.geometries.map(function(t){return Og(t)});return e}(t);break;default:throw new Error("Unsupported GeoJSON type: "+t.type)}return i}function Fg(t,e){const i=(t=Sg(t,!0,e)).getType();let n;switch(i){case"Point":n=function(t){return{type:"Point",coordinates:t.getCoordinates()}}(t);break;case"LineString":n=function(t){return{type:"LineString",coordinates:t.getCoordinates()}}(t);break;case"Polygon":n=function(t,e){let i;return e&&(i=e.rightHanded),{type:"Polygon",coordinates:t.getCoordinates(i)}}(t,e);break;case"MultiPoint":n=function(t){return{type:"MultiPoint",coordinates:t.getCoordinates()}}(t);break;case"MultiLineString":n=function(t){return{type:"MultiLineString",coordinates:t.getCoordinates()}}(t);break;case"MultiPolygon":n=function(t,e){let i;return e&&(i=e.rightHanded),{type:"MultiPolygon",coordinates:t.getCoordinates(i)}}(t,e);break;case"GeometryCollection":n=function(t,e){delete(e=Object.assign({},e)).featureProjection;return{type:"GeometryCollection",geometries:t.getGeometriesArray().map(function(t){return Fg(t,e)})}}(t,e);break;case"Circle":n={type:"GeometryCollection",geometries:[]};break;default:throw new Error("Unsupported geometry type: "+i)}return n}const Lg=class extends Gg{constructor(t){t=t||{},super(),this.dataProjection=fi(t.dataProjection?t.dataProjection:"EPSG:4326"),t.featureProjection&&(this.defaultFeatureProjection=fi(t.featureProjection)),t.featureClass&&(this.featureClass=t.featureClass),this.geometryName_=t.geometryName,this.extractGeometryName_=t.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(t,e){let i=null;i="Feature"===t.type?t:{type:"Feature",geometry:t,properties:null};const n=Og(i.geometry);if(this.featureClass===mg)return Eg({geometry:n,id:i.id,properties:i.properties},e);const r=new _g;return this.geometryName_?r.setGeometryName(this.geometryName_):this.extractGeometryName_&&i.geometry_name&&r.setGeometryName(i.geometry_name),r.setGeometry(Cg(n,e)),"id"in i&&r.setId(i.id),i.properties&&r.setProperties(i.properties,!0),r}readFeaturesFromObject(t,e){let i=null;if("FeatureCollection"===t.type){i=[];const n=t.features;for(let t=0,r=n.length;t<r;++t){const r=this.readFeatureFromObject(n[t],e);r&&i.push(r)}}else i=[this.readFeatureFromObject(t,e)];return i.flat()}readGeometryFromObject(t,e){return function(t,e){return Cg(Og(t),e)}(t,e)}readProjectionFromObject(t){const e=t.crs;let i;if(e)if("name"==e.type)i=fi(e.properties.name);else{if("EPSG"!==e.type)throw new Error("Unknown SRS type");i=fi("EPSG:"+e.properties.code)}else i=this.dataProjection;return i}writeFeatureObject(t,e){e=this.adaptOptions(e);const i={type:"Feature",geometry:null,properties:null},n=t.getId();if(void 0!==n&&(i.id=n),!t.hasProperties())return i;const r=t.getProperties(),s=t.getGeometry();return s&&(i.geometry=Fg(s,e),delete r[t.getGeometryName()]),a(r)||(i.properties=r),i}writeFeaturesObject(t,e){e=this.adaptOptions(e);const i=[];for(let n=0,r=t.length;n<r;++n)i.push(this.writeFeatureObject(t[n],e));return{type:"FeatureCollection",features:i}}writeGeometryObject(t,e){return Fg(t,this.adaptOptions(e))}},jg=class extends Cf{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=[1/0,1/0,-1/0,-1/0],this.wrappedRenderedExtent_=[1/0,1/0,-1/0,-1/0],this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(t,e,i){const n=e.extent,r=e.viewState,s=r.center,o=r.resolution,a=r.projection,l=r.rotation,h=a.getExtent(),u=this.getLayer().getSource(),c=this.getLayer().getDeclutter(),d=e.pixelRatio,f=e.viewHints,p=!(f[0]||f[1]),g=this.context,m=Math.round(te(n)/o*d),y=Math.round(Yt(n)/o*d),_=u.getWrapX()&&a.canWrapX(),v=_?te(h):null,x=_?Math.ceil((n[2]-h[2])/v)+(this.extendX_?2:1):1;let w=_?Math.floor((n[0]-h[0])/v)-(this.extendX_?1:0):0;do{let n=this.getRenderTransform(s,o,0,d,m,y,w*v);e.declutter&&(n=n.slice(0)),t.execute(g,[g.canvas.width,g.canvas.height],n,l,p,void 0===i?cp:i?dp:fp,i?c&&e.declutter[c]:void 0)}while(++w<x)}setDrawContext_(){1!==this.opacity_&&(this.targetContext_=this.context,this.context=sr(this.context.canvas.width,this.context.canvas.height,Mf))}resetDrawContext_(){if(1!==this.opacity_&&this.targetContext_){const t=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=t,lr(this.context),Mf.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(t){this.replayGroup_&&this.getLayer().getDeclutter()&&this.renderWorlds(this.replayGroup_,t,!0)}renderDeferredInternal(t){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,t,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex];this.opacity_=i.opacity;const n=t.viewState;this.prepareContainer(t,e);const r=this.context,s=this.replayGroup_;let o=s&&!s.isEmpty();if(!o&&!this.getLayer().hasListener(cs)&&!this.getLayer().hasListener(ds))return this.container;this.setDrawContext_(),this.preRender(r,t);n.projection;this.clipExtent_=null;let a=!1;if(o&&i.extent&&this.clipping){const e=ki(i.extent);o=ee(e,t.extent),o&&!kt(e,t.extent)&&(t.declutter?this.clipExtent_=e:(this.clipUnrotated(r,t,e),a=!0))}return o&&this.renderWorlds(s,t,!this.getLayer().getDeclutter()&&void 0),a&&r.restore(),this.postRender(r,t),this.renderedRotation_!==n.rotation&&(this.renderedRotation_=n.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise(e=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=this.frameState.size.slice(),e=this.renderedCenter_,i=this.renderedResolution_,n=this.renderedRotation_,r=this.renderedProjection_,s=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],l=t[0]*vp,h=t[1]*vp;a.push(this.getRenderTransform(e,i,n,vp,l,h,0).slice());const u=o.getSource(),c=r.getExtent();if(u.getWrapX()&&r.canWrapX()&&!kt(c,s)){let t=s[0];const r=te(c);let o,u=0;for(;t<c[0];)--u,o=r*u,a.push(this.getRenderTransform(e,i,n,vp,l,h,o).slice()),t+=r;for(u=0,t=s[2];t>c[2];)++u,o=r*u,a.push(this.getRenderTransform(e,i,n,vp,l,h,o).slice()),t-=r}const d=Ci();this.hitDetectionImageData_=xp(t,a,this.renderedFeatures_,o.getStyleFunction(),s,i,n,Mp(i,this.renderedPixelRatio_),d?r:null)}e(wp(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,n,r){if(!this.replayGroup_)return;const s=e.viewState.resolution,o=e.viewState.rotation,a=this.getLayer(),l={},h=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,s,o,i,function(t,e,i){const s=L(t),o=l[s];if(o){if(!0!==o&&i<o.distanceSq){if(0===i)return l[s]=!0,r.splice(r.lastIndexOf(o),1),n(t,a,e);o.geometry=e,o.distanceSq=i}}else{if(0===i)return l[s]=!0,n(t,a,e);r.push(l[s]={feature:t,layer:a,geometry:e,distanceSq:i,callback:n})}},h?e.declutter?.[h]?.all().map(t=>t.value):null)}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const n=t.viewHints[0],r=t.viewHints[1],s=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!s&&n||!o&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=t.extent,l=t.viewState,h=l.projection,u=l.resolution,c=t.pixelRatio,d=e.getRevision(),f=e.getRenderBuffer();let p=e.getRenderOrder();void 0===p&&(p=Sp);const g=l.center.slice(),m=Ct(a,f*u),y=m.slice(),_=[m.slice()],v=h.getExtent(),x=i.getWrapX()&&h.canWrapX();if(this.extendX_=!1,x){const t=i.getExtent();t&&!ie(t)&&(this.extendX_=t[0]<v[0]||t[2]>v[2])}if(x&&(!kt(v,t.extent)||this.extendX_)){const t=te(v),e=Math.max(te(m)/2,t);let i=v[0],n=v[2];this.extendX_&&(i-=t,n+=t),m[0]=i-e,m[2]=n+e,ae(g,h);const r=ne(_[0],h);r[0]<v[0]&&r[2]<v[2]?_.push([r[0]+t,r[1],r[2]+t,r[3]]):r[0]>v[0]&&r[2]>v[2]&&_.push([r[0]-t,r[1],r[2]-t,r[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedPixelRatio_===c&&this.renderedRevision_==d&&this.renderedRenderOrder_==p&&this.renderedFrameDeclutter_===!!t.declutter&&kt(this.wrappedRenderedExtent_,m))return M(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=g,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const w=new Kf(Ep(u,c),m,u,c),b=Ci();let S;if(b){for(let t=0,e=_.length;t<e;++t){const e=Ti(_[t]);i.loadFeatures(e,Ri(u),b)}S=xi(b,h)}else for(let t=0,e=_.length;t<e;++t)i.loadFeatures(_[t],u,h);const E=Mp(u,c);let C=!0;const P=(t,i)=>{let n;const r=t.getStyleFunction()||e.getStyleFunction();if(r&&(n=r(t,u)),n){const e=this.renderFeature(t,E,n,w,S,this.getLayer().getDeclutter(),i);C=C&&!e}},I=Ti(m),T=i.getFeaturesInExtent(I);p&&T.sort(p);for(let t=0,e=T.length;t<e;++t)P(T[t],t);this.renderedFeatures_=T,this.ready=C;const k=w.finish(),R=new yp(m,u,c,i.getOverlaps(),k,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=u,this.renderedRevision_=d,this.renderedRenderOrder_=p,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=y,this.wrappedRenderedExtent_=m,this.renderedCenter_=g,this.renderedProjection_=h,this.renderedPixelRatio_=c,this.replayGroup_=R,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,n,r,s,o){if(!i)return!1;let a=!1;if(Array.isArray(i))for(let l=0,h=i.length;l<h;++l)a=Cp(n,t,i[l],e,this.boundHandleStyleImageChange_,r,s,o)||a;else a=Cp(n,t,i,e,this.boundHandleStyleImageChange_,r,s,o);return a}},Ng=class extends Xl{constructor(t){super(t)}createRenderer(){return new jg(this)}};function Dg(t,e){return[[-1/0,-1/0,1/0,1/0]]}const zg=class{constructor(t){this.rbush_=new xs(t),this.items_={}}insert(t,e){const i={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(i),this.items_[L(e)]=i}load(t,e){const i=new Array(e.length);for(let n=0,r=e.length;n<r;n++){const r=t[n],s=e[n],o={minX:r[0],minY:r[1],maxX:r[2],maxY:r[3],value:s};i[n]=o,this.items_[L(s)]=o}this.rbush_.load(i)}remove(t){const e=L(t),i=this.items_[e];return delete this.items_[e],null!==this.rbush_.remove(i)}update(t,e){const i=this.items_[L(e)];jt([i.minX,i.minY,i.maxX,i.maxY],t)||(this.remove(e),this.insert(t,e))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).map(function(t){return t.value})}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,e){return this.forEach_(this.getInExtent(t),e)}forEach_(t,e){let i;for(let n=0,r=t.length;n<r;n++)if(i=e(t[n]),i)return i;return i}isEmpty(){return a(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return Gt(e.minX,e.minY,e.maxX,e.maxY,t)}concat(t){this.rbush_.load(t.rbush_.all());for(const e in t.items_)this.items_[e]=t.items_[e]}},qg="addfeature",$g="removefeature";class Bg extends k{constructor(t,e,i){super(t),this.feature=e,this.features=i}}const Ug=class extends ef{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:void 0===t.wrapX||t.wrapX}),this.on,this.once,this.un,this.loader_=P,this.format_=t.format||null,this.overlaps_=void 0===t.overlaps||t.overlaps,this.url_=t.url,void 0!==t.loader?this.loader_=t.loader:void 0!==this.url_&&(at(this.format_,"`format` must be set when `url` is set"),this.loader_=pf(this.url_,this.format_)),this.strategy_=void 0!==t.strategy?t.strategy:Dg;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let i,n;this.featuresRtree_=e?new zg:null,this.loadedExtentsRtree_=new zg,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null,Array.isArray(t.features)?n=t.features:t.features&&(i=t.features,n=i.getArray()),e||void 0!==i||(i=new q(n)),void 0!==n&&this.addFeaturesInternal(n),void 0!==i&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=L(t);if(!this.addToIndex_(e,t))return void(this.featuresCollection_&&this.featuresCollection_.remove(t));this.setupChangeEvents_(e,t);const i=t.getGeometry();if(i){const e=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(e,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new Bg(qg,t))}setupChangeEvents_(t,e){e instanceof mg||(this.featureChangeKeys_[t]=[l(e,c,this.handleFeatureChange_,this),l(e,s,this.handleFeatureChange_,this)])}addToIndex_(t,e){let i=!0;if(void 0!==e.getId()){const t=String(e.getId());if(t in this.idIndex_)if(e instanceof mg){const n=this.idIndex_[t];n instanceof mg?Array.isArray(n)?n.push(e):this.idIndex_[t]=[n,e]:i=!1}else i=!1;else this.idIndex_[t]=e}return i&&(at(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],n=[];for(let e=0,n=t.length;e<n;e++){const n=t[e],r=L(n);this.addToIndex_(r,n)&&i.push(n)}for(let t=0,r=i.length;t<r;t++){const r=i[t],s=L(r);this.setupChangeEvents_(s,r);const o=r.getGeometry();if(o){const t=o.getExtent();e.push(t),n.push(r)}else this.nullGeometryFeatures_[s]=r}if(this.featuresRtree_&&this.featuresRtree_.load(e,n),this.hasListener(qg))for(let t=0,e=i.length;t<e;t++)this.dispatchEvent(new Bg(qg,i[t]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(qg,function(i){e||(e=!0,t.push(i.feature),e=!1)}),this.addEventListener($g,function(i){e||(e=!0,t.remove(i.feature),e=!1)}),t.addEventListener(n,t=>{e||(e=!0,this.addFeature(t.element),e=!1)}),t.addEventListener(r,t=>{e||(e=!0,this.removeFeature(t.element),e=!1)}),this.featuresCollection_=t}clear(t){if(t){for(const t in this.featureChangeKeys_)this.featureChangeKeys_[t].forEach(u);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(t=>{this.removeFeatureInternal(t)});for(const t in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[t])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new Bg("clear");this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const i=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(i,function(i){const n=i.getGeometry();if(n instanceof mg||n.intersectsCoordinate(t))return e(i)})}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,function(i){const n=i.getGeometry();if(n instanceof mg||n.intersectsExtent(t)){const t=e(i);if(t)return t}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),a(this.nullGeometryFeatures_)||S(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,function(t){e.push(t)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const i=re(t,e);return[].concat(...i.map(t=>this.featuresRtree_.getInExtent(t)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],n=t[1];let r=null;const s=[NaN,NaN];let o=1/0;const a=[-1/0,-1/0,1/0,1/0];return e=e||E,this.featuresRtree_.forEachInExtent(a,function(t){if(e(t)){const e=t.getGeometry(),l=o;if(o=e instanceof mg?0:e.closestPointXY(i,n,s,o),o<l){r=t;const e=Math.sqrt(o);a[0]=i-e,a[1]=n-e,a[2]=i+e,a[3]=n+e}}}),r}getExtent(t){return this.featuresRtree_?.getExtent(t)??null}getFeatureById(t){const e=this.idIndex_[t.toString()];return void 0!==e?e:null}getFeatureByUid(t){const e=this.uidIndex_[t];return void 0!==e?e:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){const e=t.target,i=L(e),n=e.getGeometry();if(n){const t=n.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(t,e)):this.featuresRtree_&&this.featuresRtree_.update(t,e)}else i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[i]=e);const r=e.getId();if(void 0!==r){const t=r.toString();this.idIndex_[t]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[t]=e)}else this.removeFromIdIndex_(e),this.uidIndex_[i]=e;this.changed(),this.dispatchEvent(new Bg("changefeature",e))}hasFeature(t){const e=t.getId();return void 0!==e?e in this.idIndex_:L(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&a(this.nullGeometryFeatures_):!this.featuresCollection_||0===this.featuresCollection_.getLength()}loadFeatures(t,e,i){const n=this.loadedExtentsRtree_,r=this.strategy_(t,e,i);for(let t=0,s=r.length;t<s;++t){const s=r[t];if(!n.forEachInExtent(s,function(t){return kt(t.extent,s)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new Bg("featuresloadstart"));const t=t=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Bg("featuresloadend",void 0,t))},r=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Bg("featuresloaderror"))};let o=!1;const a=this.loader_.call(this,s,e,i,e=>o||t(e),()=>o||r());a instanceof Promise?(o=!0,a.then(e=>{this.addFeatures(e),t(e)}).catch(r)):this.loader_.length<4&&(this.loading=!1),n.insert(s,{extent:s.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_,i=e.forEachInExtent(t,function(e){if(jt(e.extent,t))return e});i&&e.remove(i)}removeFeatures(t){let e=!1;for(let i=0,n=t.length;i<n;++i)e=this.removeFeatureInternal(t[i])||e;e&&this.changed()}removeFeature(t){t&&this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=L(t);if(!(e in this.uidIndex_))return!1;e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t);const i=this.featureChangeKeys_[e];i?.forEach(u),delete this.featureChangeKeys_[e];const n=t.getId();if(void 0!==n){const e=n.toString(),i=this.idIndex_[e];i===t?delete this.idIndex_[e]:Array.isArray(i)&&(i.splice(i.indexOf(t),1),1===i.length&&(this.idIndex_[e]=i[0]))}return delete this.uidIndex_[e],this.hasListener($g)&&this.dispatchEvent(new Bg($g,t)),!0}removeFromIdIndex_(t){for(const e in this.idIndex_)if(this.idIndex_[e]===t){delete this.idIndex_[e];break}}setLoader(t){this.loader_=t}setUrl(t){at(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(pf(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}};var Wg={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}};const Xg=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Vg(t,e){const i={};for(const e in t)"ref"!==e&&(i[e]=t[e]);return Xg.forEach(t=>{t in e&&(i[t]=e[t])}),i}class Kg{constructor(t,e,i,n){this.message=(t?`${t}: `:"")+i,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)}}function Zg(t,...e){for(const i of e)for(const e in i)t[e]=i[e];return t}class Yg extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class Hg{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,i]of e)this.bindings[t]=i}concat(t){return new Hg(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const Jg={kind:"null"},Qg={kind:"number"},tm={kind:"string"},em={kind:"boolean"},im={kind:"color"},nm={kind:"projectionDefinition"},rm={kind:"object"},sm={kind:"value"},om={kind:"collator"},am={kind:"formatted"},lm={kind:"padding"},hm={kind:"colorArray"},um={kind:"numberArray"},cm={kind:"resolvedImage"},dm={kind:"variableAnchorOffsetCollection"};function fm(t,e){return{kind:"array",itemType:t,N:e}}function pm(t){if("array"===t.kind){const e=pm(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const gm=[Jg,Qg,tm,em,im,nm,am,rm,fm(sm),lm,um,hm,cm,dm];function mm(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!mm(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of gm)if(!mm(t,e))return null}return`Expected ${pm(t)} but found ${pm(e)} instead.`}function ym(t,e){return e.some(e=>e.kind===t.kind)}function _m(t,e){return e.some(e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t)}function vm(t,e){return"array"===t.kind&&"array"===e.kind?t.itemType.kind===e.itemType.kind&&"number"==typeof t.N:t.kind===e.kind}const xm=.96422,wm=.82521,bm=4/29,Sm=6/29,Mm=3*Sm*Sm,Em=Sm*Sm*Sm,Cm=Math.PI/180,Pm=180/Math.PI;function Im(t){return(t%=360)<0&&(t+=360),t}function Tm([t,e,i,n]){let r,s;const o=Rm((.2225045*(t=km(t))+.7168786*(e=km(e))+.0606169*(i=km(i)))/1);t===e&&e===i?r=s=o:(r=Rm((.4360747*t+.3850649*e+.1430804*i)/xm),s=Rm((.0139322*t+.0971045*e+.7141733*i)/wm));const a=116*o-16;return[a<0?0:a,500*(r-o),200*(o-s),n]}function km(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Rm(t){return t>Em?Math.pow(t,1/3):t/Mm+bm}function Am([t,e,i,n]){let r=(t+16)/116,s=isNaN(e)?r:r+e/500,o=isNaN(i)?r:r-i/200;return r=1*Om(r),s=xm*Om(s),o=wm*Om(o),[Gm(3.1338561*s-1.6168667*r-.4906146*o),Gm(-.9787684*s+1.9161415*r+.033454*o),Gm(.0719453*s-.2289914*r+1.4052427*o),n]}function Gm(t){return(t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055)<0?0:t>1?1:t}function Om(t){return t>Sm?t*t*t:Mm*(t-bm)}const Fm=Object.hasOwn||function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};function Lm(t,e){return Fm(t,e)?t[e]:void 0}function jm(t){return parseInt(t.padEnd(2,t),16)/255}function Nm(t,e){return Dm(e?t/100:t,0,1)}function Dm(t,e,i){return Math.min(Math.max(e,t),i)}function zm(t){return!t.some(Number.isNaN)}const qm={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function $m(t,e,i){return t+i*(e-t)}function Bm(t,e,i){return t.map((t,n)=>$m(t,e[n],i))}class Um{constructor(t,e,i,n=1,r=!0){this.r=t,this.g=e,this.b=i,this.a=n,r||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter("rgb",[t,e,i,n]))}static parse(t){if(t instanceof Um)return t;if("string"!=typeof t)return;const e=function(t){if("transparent"===(t=t.toLowerCase().trim()))return[0,0,0,0];const e=Lm(qm,t);if(e){const[t,i,n]=e;return[t/255,i/255,n/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){const e=t.length<6?1:2;let i=1;return[jm(t.slice(i,i+=e)),jm(t.slice(i,i+=e)),jm(t.slice(i,i+=e)),jm(t.slice(i,i+e)||"ff")]}if(t.startsWith("rgb")){const e=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,i=t.match(e);if(i){const[t,e,n,r,s,o,a,l,h,u,c,d]=i,f=[r||" ",a||" ",u].join("");if(" "===f||" /"===f||",,"===f||",,,"===f){const t=[n,o,h].join(""),i="%%%"===t?100:""===t?255:0;if(i){const t=[Dm(+e/i,0,1),Dm(+s/i,0,1),Dm(+l/i,0,1),c?Nm(+c,d):1];if(zm(t))return t}}return}}const i=t.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){const[t,e,n,r,s,o,a,l,h]=i,u=[n||" ",s||" ",a].join("");if(" "===u||" /"===u||",,"===u||",,,"===u){const t=[+e,Dm(+r,0,100),Dm(+o,0,100),l?Nm(+l,h):1];if(zm(t))return function([t,e,i,n]){function r(n){const r=(n+t/30)%12,s=e*Math.min(i,1-i);return i-s*Math.max(-1,Math.min(r-3,9-r,1))}return t=Im(t),e/=100,i/=100,[r(0),r(8),r(4),n]}(t)}}}(t);return e?new Um(...e,!1):void 0}get rgb(){const{r:t,g:e,b:i,a:n}=this,r=n||1/0;return this.overwriteGetter("rgb",[t/r,e/r,i/r,n])}get hcl(){return this.overwriteGetter("hcl",function(t){const[e,i,n,r]=Tm(t),s=Math.sqrt(i*i+n*n);return[Math.round(1e4*s)?Im(Math.atan2(n,i)*Pm):NaN,s,e,r]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Tm(this.rgb))}overwriteGetter(t,e){return Object.defineProperty(this,t,{value:e}),e}toString(){const[t,e,i,n]=this.rgb;return`rgba(${[t,e,i].map(t=>Math.round(255*t)).join(",")},${n})`}static interpolate(t,e,i,n="rgb"){switch(n){case"rgb":{const[n,r,s,o]=Bm(t.rgb,e.rgb,i);return new Um(n,r,s,o,!1)}case"hcl":{const[n,r,s,o]=t.hcl,[a,l,h,u]=e.hcl;let c,d;if(isNaN(n)||isNaN(a))isNaN(n)?isNaN(a)?c=NaN:(c=a,1!==s&&0!==s||(d=l)):(c=n,1!==h&&0!==h||(d=r));else{let t=a-n;a>n&&t>180?t-=360:a<n&&n-a>180&&(t+=360),c=n+i*t}const[f,p,g,m]=function([t,e,i,n]){return t=isNaN(t)?0:t*Cm,Am([i,Math.cos(t)*e,Math.sin(t)*e,n])}([c,null!=d?d:$m(r,l,i),$m(s,h,i),$m(o,u,i)]);return new Um(f,p,g,m,!1)}case"lab":{const[n,r,s,o]=Am(Bm(t.lab,e.lab,i));return new Um(n,r,s,o,!1)}}}}Um.black=new Um(0,0,0,1),Um.white=new Um(1,1,1,1),Um.transparent=new Um(0,0,0,0),Um.red=new Um(1,0,0,1);class Wm{constructor(t,e,i){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const Xm=["bottom","center","top"];class Vm{constructor(t,e,i,n,r,s){this.text=t,this.image=e,this.scale=i,this.fontStack=n,this.textColor=r,this.verticalAlign=s}}class Km{constructor(t){this.sections=t}static fromString(t){return new Km([new Vm(t,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(t=>0!==t.text.length||t.image&&0!==t.image.name.length)}static factory(t){return t instanceof Km?t:Km.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map(t=>t.text).join("")}}class Zm{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Zm)return t;if("number"==typeof t)return new Zm([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const e of t)if("number"!=typeof e)return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new Zm(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i){return new Zm(Bm(t.values,e.values,i))}}class Ym{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Ym)return t;if("number"==typeof t)return new Ym([t]);if(Array.isArray(t)){for(const e of t)if("number"!=typeof e)return;return new Ym(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i){return new Ym(Bm(t.values,e.values,i))}}class Hm{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Hm)return t;if("string"==typeof t){const e=Um.parse(t);if(!e)return;return new Hm([e])}if(!Array.isArray(t))return;const e=[];for(const i of t){if("string"!=typeof i)return;const t=Um.parse(i);if(!t)return;e.push(t)}return new Hm(e)}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i,n="rgb"){const r=[];if(t.values.length!=e.values.length)throw new Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${e.values.length}), cannot interpolate.`);for(let s=0;s<t.values.length;s++)r.push(Um.interpolate(t.values[s],e.values[s],i,n));return new Hm(r)}}class Jm extends Error{constructor(t){super(t),this.name="RuntimeError"}toJSON(){return this.message}}const Qm=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class ty{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ty)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let e=0;e<t.length;e+=2){const i=t[e],n=t[e+1];if("string"!=typeof i||!Qm.has(i))return;if(!Array.isArray(n)||2!==n.length||"number"!=typeof n[0]||"number"!=typeof n[1])return}return new ty(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i){const n=t.values,r=e.values;if(n.length!==r.length)throw new Jm(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${e.toString()}`);const s=[];for(let t=0;t<n.length;t+=2){if(n[t]!==r[t])throw new Jm(`Cannot interpolate values containing mismatched anchors. from[${t}]: ${n[t]}, to[${t}]: ${r[t]}`);s.push(n[t]);const[e,o]=n[t+1],[a,l]=r[t+1];s.push([$m(e,a,i),$m(o,l,i)])}return new ty(s)}}class ey{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new ey({name:t,available:!1}):null}}class iy{constructor(t,e,i){this.from=t,this.to=e,this.transition=i}static interpolate(t,e,i){return new iy(t,e,i)}static parse(t){return t instanceof iy?t:Array.isArray(t)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]?new iy(t[0],t[1],t[2]):"object"==typeof t&&"string"==typeof t.from&&"string"==typeof t.to&&"number"==typeof t.transition?new iy(t.from,t.to,t.transition):"string"==typeof t?new iy(t,t,1):void 0}}function ny(t,e,i,n){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,i,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[t,e,i,n]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ry(t){if(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t||t instanceof iy||t instanceof Um||t instanceof Wm||t instanceof Km||t instanceof Zm||t instanceof Ym||t instanceof Hm||t instanceof ty||t instanceof ey)return!0;if(Array.isArray(t)){for(const e of t)if(!ry(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!ry(t[e]))return!1;return!0}return!1}function sy(t){if(null===t)return Jg;if("string"==typeof t)return tm;if("boolean"==typeof t)return em;if("number"==typeof t)return Qg;if(t instanceof Um)return im;if(t instanceof iy)return nm;if(t instanceof Wm)return om;if(t instanceof Km)return am;if(t instanceof Zm)return lm;if(t instanceof Ym)return um;if(t instanceof Hm)return hm;if(t instanceof ty)return dm;if(t instanceof ey)return cm;if(Array.isArray(t)){const e=t.length;let i;for(const e of t){const t=sy(e);if(i){if(i===t)continue;i=sm;break}i=t}return fm(i||sm,e)}return rm}function oy(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof Um||t instanceof iy||t instanceof Km||t instanceof Zm||t instanceof Ym||t instanceof Hm||t instanceof ty||t instanceof ey?t.toString():JSON.stringify(t)}class ay{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!ry(t[1]))return e.error("invalid value");const i=t[1];let n=sy(i);const r=e.expectedType;return"array"!==n.kind||0!==n.N||!r||"array"!==r.kind||"number"==typeof r.N&&0!==r.N||(n=r),new ay(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const ly={string:tm,number:Qg,boolean:em,object:rm};class hy{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i,n=1;const r=t[0];if("array"===r){let r,s;if(t.length>2){const i=t[1];if("string"!=typeof i||!(i in ly)||"object"===i)return e.error('The item type argument of "array" must be one of string, number, boolean',1);r=ly[i],n++}else r=sm;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);s=t[2],n++}i=fm(r,s)}else{if(!ly[r])throw new Error(`Types doesn't contain name = ${r}`);i=ly[r]}const s=[];for(;n<t.length;n++){const i=e.parse(t[n],n,sm);if(!i)return null;s.push(i)}return new hy(i,s)}evaluate(t){for(let e=0;e<this.args.length;e++){const i=this.args[e].evaluate(t);if(!mm(this.type,sy(i)))return i;if(e===this.args.length-1)throw new Jm(`Expected value to be of type ${pm(this.type)}, but found ${pm(sy(i))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const uy={"to-boolean":em,"to-color":im,"to-number":Qg,"to-string":tm};class cy{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[0];if(!uy[i])throw new Error(`Can't parse ${i} as it is not part of the known types`);if(("to-boolean"===i||"to-string"===i)&&2!==t.length)return e.error("Expected one argument.");const n=uy[i],r=[];for(let i=1;i<t.length;i++){const n=e.parse(t[i],i,sm);if(!n)return null;r.push(n)}return new cy(n,r)}evaluate(t){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(t));case"color":{let e,i;for(const n of this.args){if(e=n.evaluate(t),i=null,e instanceof Um)return e;if("string"==typeof e){const i=t.parseColor(e);if(i)return i}else if(Array.isArray(e)&&(i=e.length<3||e.length>4?`Invalid rgba value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:ny(e[0],e[1],e[2],e[3]),!i))return new Um(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new Jm(i||`Could not parse color from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"padding":{let e;for(const i of this.args){e=i.evaluate(t);const n=Zm.parse(e);if(n)return n}throw new Jm(`Could not parse padding from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"numberArray":{let e;for(const i of this.args){e=i.evaluate(t);const n=Ym.parse(e);if(n)return n}throw new Jm(`Could not parse numberArray from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"colorArray":{let e;for(const i of this.args){e=i.evaluate(t);const n=Hm.parse(e);if(n)return n}throw new Jm(`Could not parse colorArray from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"variableAnchorOffsetCollection":{let e;for(const i of this.args){e=i.evaluate(t);const n=ty.parse(e);if(n)return n}throw new Jm(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"number":{let e=null;for(const i of this.args){if(e=i.evaluate(t),null===e)return 0;const n=Number(e);if(!isNaN(n))return n}throw new Jm(`Could not convert ${JSON.stringify(e)} to number.`)}case"formatted":return Km.fromString(oy(this.args[0].evaluate(t)));case"resolvedImage":return ey.fromString(oy(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return oy(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const dy=["Unknown","Point","LineString","Polygon"];class fy{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?dy[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache.get(t);return e||(e=Um.parse(t),this._parseColorCache.set(t,e)),e}}class py{constructor(t,e,i=[],n,r=new Hg,s=[]){this.registry=t,this.path=i,this.key=i.map(t=>`[${t}]`).join(""),this.scope=r,this.errors=s,this.expectedType=n,this._isConstant=e}parse(t,e,i,n,r={}){return e?this.concat(e,i,n)._parse(t,r):this._parse(t,r)}_parse(t,e){function i(t,e,i){return"assert"===i?new hy(e,[t]):"coerce"===i?new cy(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const n=t[0];if("string"!=typeof n)return this.error(`Expression name must be a string, but found ${typeof n} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const r=this.registry[n];if(r){let n=r.parse(t,this);if(!n)return null;if(this.expectedType){const t=this.expectedType,r=n.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==r.kind){if("projectionDefinition"===t.kind&&["string","array"].includes(r.kind)||["color","formatted","resolvedImage"].includes(t.kind)&&["value","string"].includes(r.kind)||["padding","numberArray"].includes(t.kind)&&["value","number","array"].includes(r.kind)||"colorArray"===t.kind&&["value","string","array"].includes(r.kind)||"variableAnchorOffsetCollection"===t.kind&&["value","array"].includes(r.kind))n=i(n,t,e.typeAnnotation||"coerce");else if(this.checkSubtype(t,r))return null}else n=i(n,t,e.typeAnnotation||"assert")}if(!(n instanceof ay)&&"resolvedImage"!==n.type.kind&&this._isConstant(n)){const t=new fy;try{n=new ay(n.type,n.evaluate(t))}catch(t){return this.error(t.message),null}}return n}return this.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0)}return void 0===t?this.error("'undefined' value invalid. Use null instead."):"object"==typeof t?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof t} instead.`)}concat(t,e,i){const n="number"==typeof t?this.path.concat(t):this.path,r=i?this.scope.concat(i):this.scope;return new py(this.registry,this._isConstant,n,e||null,r,this.errors)}error(t,...e){const i=`${this.key}${e.map(t=>`[${t}]`).join("")}`;this.errors.push(new Yg(i,t))}checkSubtype(t,e){const i=mm(t,e);return i&&this.error(i),i}}class gy{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const i=[];for(let n=1;n<t.length-1;n+=2){const r=t[n];if("string"!=typeof r)return e.error(`Expected string, but found ${typeof r} instead.`,n);if(/[^a-zA-Z0-9_]/.test(r))return e.error("Variable names must contain only alphanumeric characters or '_'.",n);const s=e.parse(t[n+1],n+1);if(!s)return null;i.push([r,s])}const n=e.parse(t[t.length-1],t.length-1,e.expectedType,i);return n?new gy(i,n):null}outputDefined(){return this.result.outputDefined()}}class my{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const i=t[1];return e.scope.has(i)?new my(i,e.scope.get(i)):e.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class yy{constructor(t,e,i){this.type=t,this.index=e,this.input=i}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,Qg),n=e.parse(t[2],2,fm(e.expectedType||sm));if(!i||!n)return null;const r=n.type;return new yy(r.itemType,i,n)}evaluate(t){const e=this.index.evaluate(t),i=this.input.evaluate(t);if(e<0)throw new Jm(`Array index out of bounds: ${e} < 0.`);if(e>=i.length)throw new Jm(`Array index out of bounds: ${e} > ${i.length-1}.`);if(e!==Math.floor(e))throw new Jm(`Array index must be an integer, but found ${e} instead.`);return i[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class _y{constructor(t,e){this.type=em,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,sm),n=e.parse(t[2],2,sm);return i&&n?ym(i.type,[em,tm,Qg,Jg,sm])?new _y(i,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${pm(i.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!_m(e,["boolean","string","number","null"]))throw new Jm(`Expected first argument to be of type boolean, string, number or null, but found ${pm(sy(e))} instead.`);if(!_m(i,["string","array"]))throw new Jm(`Expected second argument to be of type array or string, but found ${pm(sy(i))} instead.`);return i.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class vy{constructor(t,e,i){this.type=Qg,this.needle=t,this.haystack=e,this.fromIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,sm),n=e.parse(t[2],2,sm);if(!i||!n)return null;if(!ym(i.type,[em,tm,Qg,Jg,sm]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${pm(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,Qg);return r?new vy(i,n,r):null}return new vy(i,n)}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!_m(e,["boolean","string","number","null"]))throw new Jm(`Expected first argument to be of type boolean, string, number or null, but found ${pm(sy(e))} instead.`);let n;if(this.fromIndex&&(n=this.fromIndex.evaluate(t)),_m(i,["string"])){const t=i.indexOf(e,n);return-1===t?-1:[...i.slice(0,t)].length}if(_m(i,["array"]))return i.indexOf(e,n);throw new Jm(`Expected second argument to be of type array or string, but found ${pm(sy(i))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class xy{constructor(t,e,i,n,r,s){this.inputType=t,this.type=e,this.input=i,this.cases=n,this.outputs=r,this.otherwise=s}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let i,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const r={},s=[];for(let o=2;o<t.length-1;o+=2){let a=t[o];const l=t[o+1];Array.isArray(a)||(a=[a]);const h=e.concat(o);if(0===a.length)return h.error("Expected at least one branch label.");for(const t of a){if("number"!=typeof t&&"string"!=typeof t)return h.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return h.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return h.error("Numeric branch labels must be integer values.");if(i){if(h.checkSubtype(i,sy(t)))return null}else i=sy(t);if(void 0!==r[String(t)])return h.error("Branch labels must be unique.");r[String(t)]=s.length}const u=e.parse(l,o,n);if(!u)return null;n=n||u.type,s.push(u)}const o=e.parse(t[1],1,sm);if(!o)return null;const a=e.parse(t[t.length-1],t.length-1,n);return a?"value"!==o.type.kind&&e.concat(1).checkSubtype(i,o.type)?null:new xy(i,n,o,r,s,a):null}evaluate(t){const e=this.input.evaluate(t);return(sy(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}}class wy{constructor(t,e,i){this.type=t,this.branches=e,this.otherwise=i}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);const n=[];for(let r=1;r<t.length-1;r+=2){const s=e.parse(t[r],r,em);if(!s)return null;const o=e.parse(t[r+1],r+1,i);if(!o)return null;n.push([s,o]),i=i||o.type}const r=e.parse(t[t.length-1],t.length-1,i);if(!r)return null;if(!i)throw new Error("Can't infer output type");return new wy(i,n,r)}evaluate(t){for(const[e,i]of this.branches)if(e.evaluate(t))return i.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,i]of this.branches)t(e),t(i);t(this.otherwise)}outputDefined(){return this.branches.every(([t,e])=>e.outputDefined())&&this.otherwise.outputDefined()}}class by{constructor(t,e,i,n){this.type=t,this.input=e,this.beginIndex=i,this.endIndex=n}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,sm),n=e.parse(t[2],2,Qg);if(!i||!n)return null;if(!ym(i.type,[fm(sm),tm,sm]))return e.error(`Expected first argument to be of type array or string, but found ${pm(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,Qg);return r?new by(i.type,i,n,r):null}return new by(i.type,i,n)}evaluate(t){const e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);let n;if(this.endIndex&&(n=this.endIndex.evaluate(t)),_m(e,["string"]))return[...e].slice(i,n).join("");if(_m(e,["array"]))return e.slice(i,n);throw new Jm(`Expected first argument to be of type array or string, but found ${pm(sy(e))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function Sy(t,e){const i=t.length-1;let n,r,s=0,o=i,a=0;for(;s<=o;)if(a=Math.floor((s+o)/2),n=t[a],r=t[a+1],n<=e){if(a===i||e<r)return a;s=a+1}else{if(!(n>e))throw new Jm("Input is not a number.");o=a-1}return 0}class My{constructor(t,e,i){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const i=e.parse(t[1],1,Qg);if(!i)return null;const n=[];let r=null;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);for(let i=1;i<t.length;i+=2){const s=1===i?-1/0:t[i],o=t[i+1],a=i,l=i+1;if("number"!=typeof s)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',a);if(n.length&&n[n.length-1][0]>=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const h=e.parse(o,l,r);if(!h)return null;r=r||h.type,n.push([s,h])}return new My(r,i,n)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);const r=e.length;return n>=e[r-1]?i[r-1].evaluate(t):i[Sy(e,n)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function Ey(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Cy,Py,Iy=function(){if(Py)return Cy;function t(t,e,i,n){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=i,this.p2y=n}return Py=1,Cy=t,t.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var i=t,n=0;n<8;n++){var r=this.sampleCurveX(i)-t;if(Math.abs(r)<e)return i;var s=this.sampleCurveDerivativeX(i);if(Math.abs(s)<1e-6)break;i-=r/s}var o=0,a=1;for(i=t,n=0;n<20&&(r=this.sampleCurveX(i),!(Math.abs(r-t)<e));n++)t>r?o=i:a=i,i=.5*(a-o)+o;return i},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},Cy}(),Ty=Ey(Iy);class ky{constructor(t,e,i,n,r){this.type=t,this.operator=e,this.interpolation=i,this.input=n,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(t,e,i,n){let r=0;if("exponential"===t.name)r=Ry(e,t.base,i,n);else if("linear"===t.name)r=Ry(e,1,i,n);else if("cubic-bezier"===t.name){const s=t.controlPoints;r=new Ty(s[0],s[1],s[2],s[3]).solve(Ry(e,1,i,n))}return r}static parse(t,e){let[i,n,r,...s]=t;if(!Array.isArray(n)||0===n.length)return e.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const t=n[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:t}}else{if("cubic-bezier"!==n[0])return e.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const t=n.slice(1);if(4!==t.length||t.some(t=>"number"!=typeof t||t<0||t>1))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(r=e.parse(r,2,Qg),!r)return null;const o=[];let a=null;"interpolate-hcl"!==i&&"interpolate-lab"!==i||e.expectedType==hm?e.expectedType&&"value"!==e.expectedType.kind&&(a=e.expectedType):a=im;for(let t=0;t<s.length;t+=2){const i=s[t],n=s[t+1],r=t+3,l=t+4;if("number"!=typeof i)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',r);if(o.length&&o[o.length-1][0]>=i)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',r);const h=e.parse(n,l,a);if(!h)return null;a=a||h.type,o.push([i,h])}return vm(a,Qg)||vm(a,nm)||vm(a,im)||vm(a,lm)||vm(a,um)||vm(a,hm)||vm(a,dm)||vm(a,fm(Qg))?new ky(a,i,n,r,o):e.error(`Type ${pm(a)} is not interpolatable.`)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);const r=e.length;if(n>=e[r-1])return i[r-1].evaluate(t);const s=Sy(e,n),o=e[s],a=e[s+1],l=ky.interpolationFactor(this.interpolation,n,o,a),h=i[s].evaluate(t),u=i[s+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return $m(h,u,l);case"color":return Um.interpolate(h,u,l);case"padding":return Zm.interpolate(h,u,l);case"colorArray":return Hm.interpolate(h,u,l);case"numberArray":return Ym.interpolate(h,u,l);case"variableAnchorOffsetCollection":return ty.interpolate(h,u,l);case"array":return Bm(h,u,l);case"projectionDefinition":return iy.interpolate(h,u,l)}case"interpolate-hcl":switch(this.type.kind){case"color":return Um.interpolate(h,u,l,"hcl");case"colorArray":return Hm.interpolate(h,u,l,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Um.interpolate(h,u,l,"lab");case"colorArray":return Hm.interpolate(h,u,l,"lab")}}}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function Ry(t,e,i,n){const r=n-i,s=t-i;return 0===r?0:1===e?s/r:(Math.pow(e,s)-1)/(Math.pow(e,r)-1)}Um.interpolate,Zm.interpolate,Ym.interpolate,Hm.interpolate,ty.interpolate;class Ay{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i=null;const n=e.expectedType;n&&"value"!==n.kind&&(i=n);const r=[];for(const n of t.slice(1)){const t=e.parse(n,1+r.length,i,void 0,{typeAnnotation:"omit"});if(!t)return null;i=i||t.type,r.push(t)}if(!i)throw new Error("No output type");const s=n&&r.some(t=>mm(n,t.type));return new Ay(s?sm:i,r)}evaluate(t){let e,i=null,n=0;for(const r of this.args)if(n++,i=r.evaluate(t),i&&i instanceof ey&&!i.available&&(e||(e=i.name),i=null,n===this.args.length&&(i=e)),null!==i)break;return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function Gy(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function Oy(t,e,i,n){return 0===n.compare(e,i)}function Fy(t,e,i){const n="=="!==t&&"!="!==t;return class r{constructor(t,e,i){this.type=em,this.lhs=t,this.rhs=e,this.collator=i,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const i=t[0];let s=e.parse(t[1],1,sm);if(!s)return null;if(!Gy(i,s.type))return e.concat(1).error(`"${i}" comparisons are not supported for type '${pm(s.type)}'.`);let o=e.parse(t[2],2,sm);if(!o)return null;if(!Gy(i,o.type))return e.concat(2).error(`"${i}" comparisons are not supported for type '${pm(o.type)}'.`);if(s.type.kind!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error(`Cannot compare types '${pm(s.type)}' and '${pm(o.type)}'.`);n&&("value"===s.type.kind&&"value"!==o.type.kind?s=new hy(o.type,[s]):"value"!==s.type.kind&&"value"===o.type.kind&&(o=new hy(s.type,[o])));let a=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error("Cannot use collator to compare non-string types.");if(a=e.parse(t[3],3,om),!a)return null}return new r(s,o,a)}evaluate(r){const s=this.lhs.evaluate(r),o=this.rhs.evaluate(r);if(n&&this.hasUntypedArgument){const e=sy(s),i=sy(o);if(e.kind!==i.kind||"string"!==e.kind&&"number"!==e.kind)throw new Jm(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${i.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const t=sy(s),i=sy(o);if("string"!==t.kind||"string"!==i.kind)return e(r,s,o)}return this.collator?i(r,s,o,this.collator.evaluate(r)):e(r,s,o)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}const Ly=Fy("==",function(t,e,i){return e===i},Oy),jy=Fy("!=",function(t,e,i){return e!==i},function(t,e,i,n){return!Oy(0,e,i,n)}),Ny=Fy("<",function(t,e,i){return e<i},function(t,e,i,n){return n.compare(e,i)<0}),Dy=Fy(">",function(t,e,i){return e>i},function(t,e,i,n){return n.compare(e,i)>0}),zy=Fy("<=",function(t,e,i){return e<=i},function(t,e,i,n){return n.compare(e,i)<=0}),qy=Fy(">=",function(t,e,i){return e>=i},function(t,e,i,n){return n.compare(e,i)>=0});class $y{constructor(t,e,i){this.type=om,this.locale=i,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(2!==t.length)return e.error("Expected one argument.");const i=t[1];if("object"!=typeof i||Array.isArray(i))return e.error("Collator options argument must be an object.");const n=e.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,em);if(!n)return null;const r=e.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,em);if(!r)return null;let s=null;return i.locale&&(s=e.parse(i.locale,1,tm),!s)?null:new $y(n,r,s)}evaluate(t){return new Wm(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class By{constructor(t,e,i,n,r,s){this.type=tm,this.number=t,this.locale=e,this.currency=i,this.unit=n,this.minFractionDigits=r,this.maxFractionDigits=s}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,Qg);if(!i)return null;const n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");let r=null;if(n.locale&&(r=e.parse(n.locale,1,tm),!r))return null;let s=null;if(n.currency&&(s=e.parse(n.currency,1,tm),!s))return null;let o=null;if(n.unit&&(o=e.parse(n.unit,1,tm),!o))return null;if(s&&o)return e.error("NumberFormat options `currency` and `unit` are mutually exclusive");let a=null;if(n["min-fraction-digits"]&&(a=e.parse(n["min-fraction-digits"],1,Qg),!a))return null;let l=null;return n["max-fraction-digits"]&&(l=e.parse(n["max-fraction-digits"],1,Qg),!l)?null:new By(i,r,s,o,a,l)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class Uy{constructor(t){this.type=am,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[1];if(!Array.isArray(i)&&"object"==typeof i)return e.error("First argument must be an image or text section.");const n=[];let r=!1;for(let i=1;i<=t.length-1;++i){const s=t[i];if(r&&"object"==typeof s&&!Array.isArray(s)){r=!1;let t=null;if(s["font-scale"]&&(t=e.parse(s["font-scale"],1,Qg),!t))return null;let i=null;if(s["text-font"]&&(i=e.parse(s["text-font"],1,fm(tm)),!i))return null;let o=null;if(s["text-color"]&&(o=e.parse(s["text-color"],1,im),!o))return null;let a=null;if(s["vertical-align"]){if("string"==typeof s["vertical-align"]&&!Xm.includes(s["vertical-align"]))return e.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${s["vertical-align"]}' instead.`);if(a=e.parse(s["vertical-align"],1,tm),!a)return null}const l=n[n.length-1];l.scale=t,l.font=i,l.textColor=o,l.verticalAlign=a}else{const s=e.parse(t[i],1,sm);if(!s)return null;const o=s.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");r=!0,n.push({content:s,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Uy(n)}evaluate(t){return new Km(this.sections.map(e=>{const i=e.content.evaluate(t);return sy(i)===cm?new Vm("",i,null,null,null,e.verticalAlign?e.verticalAlign.evaluate(t):null):new Vm(oy(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null,e.verticalAlign?e.verticalAlign.evaluate(t):null)}))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor),e.verticalAlign&&t(e.verticalAlign)}outputDefined(){return!1}}class Wy{constructor(t){this.type=cm,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,tm);return i?new Wy(i):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),i=ey.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}}class Xy{constructor(t){this.type=Qg,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const i=e.parse(t[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?e.error(`Expected argument of type string or array, but found ${pm(i.type)} instead.`):new Xy(i):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return[...e].length;if(Array.isArray(e))return e.length;throw new Jm(`Expected value to be of type string or array, but found ${pm(sy(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const Vy=8192;function Ky(t,e){const i=(180+t[0])/360,n=(r=t[1],(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360);var r;const s=Math.pow(2,e.z);return[Math.round(i*s*Vy),Math.round(n*s*Vy)]}function Zy(t,e){const i=Math.pow(2,e.z);return[(r=(t[0]/Vy+e.x)/i,360*r-180),(n=(t[1]/Vy+e.y)/i,360/Math.PI*Math.atan(Math.exp((180-360*n)*Math.PI/180))-90)];var n,r}function Yy(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function Hy(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function Jy(t,e,i){return e[1]>t[1]!=i[1]>t[1]&&t[0]<(i[0]-e[0])*(t[1]-e[1])/(i[1]-e[1])+e[0]}function Qy(t,e,i){const n=t[0]-e[0],r=t[1]-e[1],s=t[0]-i[0],o=t[1]-i[1];return n*o-s*r===0&&n*s<=0&&r*o<=0}function t_(t,e,i,n){const r=[e[0]-t[0],e[1]-t[1]];return 0!==(s=[n[0]-i[0],n[1]-i[1]])[0]*(o=r)[1]-s[1]*o[0]&&!(!o_(t,e,i,n)||!o_(i,n,t,e));var s,o}function e_(t,e,i){for(const n of i)for(let i=0;i<n.length-1;++i)if(t_(t,e,n[i],n[i+1]))return!0;return!1}function i_(t,e,i=!1){let n=!1;for(const r of e)for(let e=0;e<r.length-1;e++){if(Qy(t,r[e],r[e+1]))return i;Jy(t,r[e],r[e+1])&&(n=!n)}return n}function n_(t,e){for(const i of e)if(i_(t,i))return!0;return!1}function r_(t,e){for(const i of t)if(!i_(i,e))return!1;for(let i=0;i<t.length-1;++i)if(e_(t[i],t[i+1],e))return!1;return!0}function s_(t,e){for(const i of e)if(r_(t,i))return!0;return!1}function o_(t,e,i,n){const r=t[0]-i[0],s=t[1]-i[1],o=e[0]-i[0],a=e[1]-i[1],l=n[0]-i[0],h=n[1]-i[1],u=r*h-l*s,c=o*h-l*a;return u>0&&c<0||u<0&&c>0}function a_(t,e,i){const n=[];for(let r=0;r<t.length;r++){const s=[];for(let n=0;n<t[r].length;n++){const o=Ky(t[r][n],i);Yy(e,o),s.push(o)}n.push(s)}return n}function l_(t,e,i){const n=[];for(let r=0;r<t.length;r++){const s=a_(t[r],e,i);n.push(s)}return n}function h_(t,e,i,n){if(t[0]<i[0]||t[0]>i[2]){const e=.5*n;let r=t[0]-i[0]>e?-n:i[0]-t[0]>e?n:0;0===r&&(r=t[0]-i[2]>e?-n:i[2]-t[0]>e?n:0),t[0]+=r}Yy(e,t)}function u_(t,e,i,n){const r=Math.pow(2,n.z)*Vy,s=[n.x*Vy,n.y*Vy],o=[];for(const n of t)for(const t of n){const n=[t.x+s[0],t.y+s[1]];h_(n,e,i,r),o.push(n)}return o}function c_(t,e,i,n){const r=Math.pow(2,n.z)*Vy,s=[n.x*Vy,n.y*Vy],o=[];for(const i of t){const t=[];for(const n of i){const i=[n.x+s[0],n.y+s[1]];Yy(e,i),t.push(i)}o.push(t)}if(e[2]-e[0]<=r/2){(a=e)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const t of o)for(const n of t)h_(n,e,i,r)}var a;return o}class d_{constructor(t,e){this.type=em,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(ry(t[1])){const e=t[1];if("FeatureCollection"===e.type){const t=[];for(const i of e.features){const{type:e,coordinates:n}=i.geometry;"Polygon"===e&&t.push(n),"MultiPolygon"===e&&t.push(...n)}if(t.length)return new d_(e,{type:"MultiPolygon",coordinates:t})}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new d_(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new d_(e,e)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],r=t.canonicalID();if("Polygon"===e.type){const s=a_(e.coordinates,n,r),o=u_(t.geometry(),i,n,r);if(!Hy(i,n))return!1;for(const t of o)if(!i_(t,s))return!1}if("MultiPolygon"===e.type){const s=l_(e.coordinates,n,r),o=u_(t.geometry(),i,n,r);if(!Hy(i,n))return!1;for(const t of o)if(!n_(t,s))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],r=t.canonicalID();if("Polygon"===e.type){const s=a_(e.coordinates,n,r),o=c_(t.geometry(),i,n,r);if(!Hy(i,n))return!1;for(const t of o)if(!r_(t,s))return!1}if("MultiPolygon"===e.type){const s=l_(e.coordinates,n,r),o=c_(t.geometry(),i,n,r);if(!Hy(i,n))return!1;for(const t of o)if(!s_(t,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class f_{constructor(t=[],e=(t,e)=>t<e?-1:t>e?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:i}=this,n=e[t];for(;t>0;){const r=t-1>>1,s=e[r];if(i(n,s)>=0)break;e[t]=s,t=r}e[t]=n}_down(t){const{data:e,compare:i}=this,n=this.length>>1,r=e[t];for(;t<n;){let n=1+(t<<1);const s=n+1;if(s<this.length&&i(e[s],e[n])<0&&(n=s),i(e[n],r)>=0)break;e[t]=e[n],t=n}e[t]=r}}function p_(t){let e=0;for(let i,n,r=0,s=t.length,o=s-1;r<s;o=r++)i=t[r],n=t[o],e+=(n.x-i.x)*(i.y+n.y);return e}const g_=1/298.257223563,m_=g_*(2-g_),y_=Math.PI/180;class __{constructor(t){const e=6378.137*y_*1e3,i=Math.cos(t*y_),n=1/(1-m_*(1-i*i)),r=Math.sqrt(n);this.kx=e*r*i,this.ky=e*r*n*(1-m_)}distance(t,e){const i=this.wrap(t[0]-e[0])*this.kx,n=(t[1]-e[1])*this.ky;return Math.sqrt(i*i+n*n)}pointOnLine(t,e){let i,n,r,s,o=1/0;for(let a=0;a<t.length-1;a++){let l=t[a][0],h=t[a][1],u=this.wrap(t[a+1][0]-l)*this.kx,c=(t[a+1][1]-h)*this.ky,d=0;0===u&&0===c||(d=(this.wrap(e[0]-l)*this.kx*u+(e[1]-h)*this.ky*c)/(u*u+c*c),d>1?(l=t[a+1][0],h=t[a+1][1]):d>0&&(l+=u/this.kx*d,h+=c/this.ky*d)),u=this.wrap(e[0]-l)*this.kx,c=(e[1]-h)*this.ky;const f=u*u+c*c;f<o&&(o=f,i=l,n=h,r=a,s=d)}return{point:[i,n],index:r,t:Math.max(0,Math.min(1,s))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function v_(t,e){return e[0]-t[0]}function x_(t){return t[1]-t[0]+1}function w_(t,e){return t[1]>=t[0]&&t[1]<e}function b_(t,e){if(t[0]>t[1])return[null,null];const i=x_(t);if(e){if(2===i)return[t,null];const e=Math.floor(i/2);return[[t[0],t[0]+e],[t[0]+e,t[1]]]}if(1===i)return[t,null];const n=Math.floor(i/2)-1;return[[t[0],t[0]+n],[t[0]+n+1,t[1]]]}function S_(t,e){if(!w_(e,t.length))return[1/0,1/0,-1/0,-1/0];const i=[1/0,1/0,-1/0,-1/0];for(let n=e[0];n<=e[1];++n)Yy(i,t[n]);return i}function M_(t){const e=[1/0,1/0,-1/0,-1/0];for(const i of t)for(const t of i)Yy(e,t);return e}function E_(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function C_(t,e,i){if(!E_(t)||!E_(e))return NaN;let n=0,r=0;return t[2]<e[0]&&(n=e[0]-t[2]),t[0]>e[2]&&(n=t[0]-e[2]),t[1]>e[3]&&(r=t[1]-e[3]),t[3]<e[1]&&(r=e[1]-t[3]),i.distance([0,0],[n,r])}function P_(t,e,i){const n=i.pointOnLine(e,t);return i.distance(t,n.point)}function I_(t,e,i,n,r){const s=Math.min(P_(t,[i,n],r),P_(e,[i,n],r)),o=Math.min(P_(i,[t,e],r),P_(n,[t,e],r));return Math.min(s,o)}function T_(t,e,i,n,r){if(!w_(e,t.length)||!w_(n,i.length))return 1/0;let s=1/0;for(let o=e[0];o<e[1];++o){const e=t[o],a=t[o+1];for(let t=n[0];t<n[1];++t){const n=i[t],o=i[t+1];if(t_(e,a,n,o))return 0;s=Math.min(s,I_(e,a,n,o,r))}}return s}function k_(t,e,i,n,r){if(!w_(e,t.length)||!w_(n,i.length))return NaN;let s=1/0;for(let o=e[0];o<=e[1];++o)for(let e=n[0];e<=n[1];++e)if(s=Math.min(s,r.distance(t[o],i[e])),0===s)return s;return s}function R_(t,e,i){if(i_(t,e,!0))return 0;let n=1/0;for(const r of e){const e=r[0],s=r[r.length-1];if(e!==s&&(n=Math.min(n,P_(t,[s,e],i)),0===n))return n;const o=i.pointOnLine(r,t);if(n=Math.min(n,i.distance(t,o.point)),0===n)return n}return n}function A_(t,e,i,n){if(!w_(e,t.length))return NaN;for(let n=e[0];n<=e[1];++n)if(i_(t[n],i,!0))return 0;let r=1/0;for(let s=e[0];s<e[1];++s){const e=t[s],o=t[s+1];for(const t of i)for(let i=0,s=t.length,a=s-1;i<s;a=i++){const s=t[a],l=t[i];if(t_(e,o,s,l))return 0;r=Math.min(r,I_(e,o,s,l,n))}}return r}function G_(t,e){for(const i of t)for(const t of i)if(i_(t,e,!0))return!0;return!1}function O_(t,e,i,n=1/0){const r=M_(t),s=M_(e);if(n!==1/0&&C_(r,s,i)>=n)return n;if(Hy(r,s)){if(G_(t,e))return 0}else if(G_(e,t))return 0;let o=1/0;for(const n of t)for(let t=0,r=n.length,s=r-1;t<r;s=t++){const r=n[s],a=n[t];for(const t of e)for(let e=0,n=t.length,s=n-1;e<n;s=e++){const n=t[s],l=t[e];if(t_(r,a,n,l))return 0;o=Math.min(o,I_(r,a,n,l,i))}}return o}function F_(t,e,i,n,r,s){if(!s)return;const o=C_(S_(n,s),r,i);o<e&&t.push([o,s,[0,0]])}function L_(t,e,i,n,r,s,o){if(!s||!o)return;const a=C_(S_(n,s),S_(r,o),i);a<e&&t.push([a,s,o])}function j_(t,e,i,n,r=1/0){let s=Math.min(n.distance(t[0],i[0][0]),r);if(0===s)return s;const o=new f_([[0,[0,t.length-1],[0,0]]],v_),a=M_(i);for(;o.length>0;){const r=o.pop();if(r[0]>=s)continue;const l=r[1],h=e?50:100;if(x_(l)<=h){if(!w_(l,t.length))return NaN;if(e){const e=A_(t,l,i,n);if(isNaN(e)||0===e)return e;s=Math.min(s,e)}else for(let e=l[0];e<=l[1];++e){const r=R_(t[e],i,n);if(s=Math.min(s,r),0===s)return 0}}else{const i=b_(l,e);F_(o,s,n,t,a,i[0]),F_(o,s,n,t,a,i[1])}}return s}function N_(t,e,i,n,r,s=1/0){let o=Math.min(s,r.distance(t[0],i[0]));if(0===o)return o;const a=new f_([[0,[0,t.length-1],[0,i.length-1]]],v_);for(;a.length>0;){const s=a.pop();if(s[0]>=o)continue;const l=s[1],h=s[2],u=e?50:100,c=n?50:100;if(x_(l)<=u&&x_(h)<=c){if(!w_(l,t.length)&&w_(h,i.length))return NaN;let s;if(e&&n)s=T_(t,l,i,h,r),o=Math.min(o,s);else if(e&&!n){const e=t.slice(l[0],l[1]+1);for(let t=h[0];t<=h[1];++t)if(s=P_(i[t],e,r),o=Math.min(o,s),0===o)return o}else if(!e&&n){const e=i.slice(h[0],h[1]+1);for(let i=l[0];i<=l[1];++i)if(s=P_(t[i],e,r),o=Math.min(o,s),0===o)return o}else s=k_(t,l,i,h,r),o=Math.min(o,s)}else{const s=b_(l,e),u=b_(h,n);L_(a,o,r,t,i,s[0],u[0]),L_(a,o,r,t,i,s[0],u[1]),L_(a,o,r,t,i,s[1],u[0]),L_(a,o,r,t,i,s[1],u[1])}}return o}function D_(t){return"MultiPolygon"===t.type?t.coordinates.map(t=>({type:"Polygon",coordinates:t})):"MultiLineString"===t.type?t.coordinates.map(t=>({type:"LineString",coordinates:t})):"MultiPoint"===t.type?t.coordinates.map(t=>({type:"Point",coordinates:t})):[t]}class z_{constructor(t,e){this.type=Qg,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(ry(t[1])){const e=t[1];if("FeatureCollection"===e.type)return new z_(e,e.features.map(t=>D_(t.geometry)).flat());if("Feature"===e.type)return new z_(e,D_(e.geometry));if("type"in e&&"coordinates"in e)return new z_(e,D_(e))}return e.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const i=t.geometry(),n=i.flat().map(e=>Zy([e.x,e.y],t.canonical));if(0===i.length)return NaN;const r=new __(n[0][1]);let s=1/0;for(const t of e){switch(t.type){case"Point":s=Math.min(s,N_(n,!1,[t.coordinates],!1,r,s));break;case"LineString":s=Math.min(s,N_(n,!1,t.coordinates,!0,r,s));break;case"Polygon":s=Math.min(s,j_(n,!1,t.coordinates,r,s))}if(0===s)return s}return s}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const i=t.geometry(),n=i.flat().map(e=>Zy([e.x,e.y],t.canonical));if(0===i.length)return NaN;const r=new __(n[0][1]);let s=1/0;for(const t of e){switch(t.type){case"Point":s=Math.min(s,N_(n,!0,[t.coordinates],!1,r,s));break;case"LineString":s=Math.min(s,N_(n,!0,t.coordinates,!0,r,s));break;case"Polygon":s=Math.min(s,j_(n,!0,t.coordinates,r,s))}if(0===s)return s}return s}(t,this.geometries);if("Polygon"===t.geometryType())return function(t,e){const i=t.geometry();if(0===i.length||0===i[0].length)return NaN;const n=function(t){if(t.length<=1)return[t];const e=[];let i,n;for(const r of t){const t=p_(r);0!==t&&(r.area=Math.abs(t),void 0===n&&(n=t<0),n===t<0?(i&&e.push(i),i=[r]):i.push(r))}return i&&e.push(i),e}(i).map(e=>e.map(e=>e.map(e=>Zy([e.x,e.y],t.canonical)))),r=new __(n[0][0][0][1]);let s=1/0;for(const t of e)for(const e of n){switch(t.type){case"Point":s=Math.min(s,j_([t.coordinates],!1,e,r,s));break;case"LineString":s=Math.min(s,j_(t.coordinates,!0,e,r,s));break;case"Polygon":s=Math.min(s,O_(e,t.coordinates,r,s))}if(0===s)return s}return s}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class q_{constructor(t){this.type=sm,this.key=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const i=t[1];return null==i?e.error("Global state property must be defined."):"string"!=typeof i?e.error(`Global state property must be string, but found ${typeof t[1]} instead.`):new q_(i)}evaluate(t){var e;const i=null===(e=t.globals)||void 0===e?void 0:e.globalState;return i&&0!==Object.keys(i).length?Lm(i,this.key):null}eachChild(){}outputDefined(){return!1}}const $_={"==":Ly,"!=":jy,">":Dy,"<":Ny,">=":qy,"<=":zy,array:hy,at:yy,boolean:hy,case:wy,coalesce:Ay,collator:$y,format:Uy,image:Wy,in:_y,"index-of":vy,interpolate:ky,"interpolate-hcl":ky,"interpolate-lab":ky,length:Xy,let:gy,literal:ay,match:xy,number:hy,"number-format":By,object:hy,slice:by,step:My,string:hy,"to-boolean":cy,"to-color":cy,"to-number":cy,"to-string":cy,var:my,within:d_,distance:z_,"global-state":q_};class B_{constructor(t,e,i,n){this.name=t,this.type=e,this._evaluate=i,this.args=n}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,e){const i=t[0],n=B_.definitions[i];if(!n)return e.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const r=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,o=s.filter(([e])=>!Array.isArray(e)||e.length===t.length-1);let a=null;for(const[n,s]of o){a=new py(e.registry,K_,e.path,null,e.scope);const o=[];let l=!1;for(let e=1;e<t.length;e++){const i=t[e],r=Array.isArray(n)?n[e-1]:n.type,s=a.parse(i,1+o.length,r);if(!s){l=!0;break}o.push(s)}if(!l)if(Array.isArray(n)&&n.length!==o.length)a.error(`Expected ${n.length} arguments, but found ${o.length} instead.`);else{for(let t=0;t<o.length;t++){const e=Array.isArray(n)?n[t]:n.type,i=o[t];a.concat(t+1).checkSubtype(e,i.type)}if(0===a.errors.length)return new B_(i,r,s,o)}}if(1===o.length)e.errors.push(...a.errors);else{const i=(o.length?o:s).map(([t])=>{return e=t,Array.isArray(e)?`(${e.map(pm).join(", ")})`:`(${pm(e.type)}...)`;var e}).join(" | "),n=[];for(let i=1;i<t.length;i++){const r=e.parse(t[i],1+n.length);if(!r)return null;n.push(pm(r.type))}e.error(`Expected arguments of type ${i}, but found (${n.join(", ")}) instead.`)}return null}static register(t,e){B_.definitions=e;for(const i in e)t[i]=B_}}function U_(t,[e,i,n,r]){e=e.evaluate(t),i=i.evaluate(t),n=n.evaluate(t);const s=r?r.evaluate(t):1,o=ny(e,i,n,s);if(o)throw new Jm(o);return new Um(e/255,i/255,n/255,s,!1)}function W_(t,e){return t in e}function X_(t,e){const i=e[t];return void 0===i?null:i}function V_(t){return{type:t}}function K_(t){if(t instanceof my)return K_(t.boundExpression);if(t instanceof B_&&"error"===t.name)return!1;if(t instanceof $y)return!1;if(t instanceof d_)return!1;if(t instanceof z_)return!1;if(t instanceof q_)return!1;const e=t instanceof cy||t instanceof hy;let i=!0;return t.eachChild(t=>{i=e?i&&K_(t):i&&t instanceof ay}),!!i&&Z_(t)&&H_(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function Z_(t){if(t instanceof B_){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof d_)return!1;if(t instanceof z_)return!1;let e=!0;return t.eachChild(t=>{e&&!Z_(t)&&(e=!1)}),e}function Y_(t){if(t instanceof B_&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild(t=>{e&&!Y_(t)&&(e=!1)}),e}function H_(t,e){if(t instanceof B_&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild(t=>{i&&!H_(t,e)&&(i=!1)}),i}function J_(t){return{result:"success",value:t}}function Q_(t){return{result:"error",value:t}}function tv(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function ev(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function iv(t){return!!t.expression&&t.expression.interpolated}function nv(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function rv(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)&&sy(t)===rm}B_.register($_,{error:[{kind:"error"},[tm],(t,[e])=>{throw new Jm(e.evaluate(t))}],typeof:[tm,[sm],(t,[e])=>pm(sy(e.evaluate(t)))],"to-rgba":[fm(Qg,4),[im],(t,[e])=>{const[i,n,r,s]=e.evaluate(t).rgb;return[255*i,255*n,255*r,s]}],rgb:[im,[Qg,Qg,Qg],U_],rgba:[im,[Qg,Qg,Qg,Qg],U_],has:{type:em,overloads:[[[tm],(t,[e])=>W_(e.evaluate(t),t.properties())],[[tm,rm],(t,[e,i])=>W_(e.evaluate(t),i.evaluate(t))]]},get:{type:sm,overloads:[[[tm],(t,[e])=>X_(e.evaluate(t),t.properties())],[[tm,rm],(t,[e,i])=>X_(e.evaluate(t),i.evaluate(t))]]},"feature-state":[sm,[tm],(t,[e])=>X_(e.evaluate(t),t.featureState||{})],properties:[rm,[],t=>t.properties()],"geometry-type":[tm,[],t=>t.geometryType()],id:[sm,[],t=>t.id()],zoom:[Qg,[],t=>t.globals.zoom],"heatmap-density":[Qg,[],t=>t.globals.heatmapDensity||0],elevation:[Qg,[],t=>t.globals.elevation||0],"line-progress":[Qg,[],t=>t.globals.lineProgress||0],accumulated:[sm,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[Qg,V_(Qg),(t,e)=>{let i=0;for(const n of e)i+=n.evaluate(t);return i}],"*":[Qg,V_(Qg),(t,e)=>{let i=1;for(const n of e)i*=n.evaluate(t);return i}],"-":{type:Qg,overloads:[[[Qg,Qg],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[Qg],(t,[e])=>-e.evaluate(t)]]},"/":[Qg,[Qg,Qg],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[Qg,[Qg,Qg],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[Qg,[],()=>Math.LN2],pi:[Qg,[],()=>Math.PI],e:[Qg,[],()=>Math.E],"^":[Qg,[Qg,Qg],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[Qg,[Qg],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[Qg,[Qg],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[Qg,[Qg],(t,[e])=>Math.log(e.evaluate(t))],log2:[Qg,[Qg],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[Qg,[Qg],(t,[e])=>Math.sin(e.evaluate(t))],cos:[Qg,[Qg],(t,[e])=>Math.cos(e.evaluate(t))],tan:[Qg,[Qg],(t,[e])=>Math.tan(e.evaluate(t))],asin:[Qg,[Qg],(t,[e])=>Math.asin(e.evaluate(t))],acos:[Qg,[Qg],(t,[e])=>Math.acos(e.evaluate(t))],atan:[Qg,[Qg],(t,[e])=>Math.atan(e.evaluate(t))],min:[Qg,V_(Qg),(t,e)=>Math.min(...e.map(e=>e.evaluate(t)))],max:[Qg,V_(Qg),(t,e)=>Math.max(...e.map(e=>e.evaluate(t)))],abs:[Qg,[Qg],(t,[e])=>Math.abs(e.evaluate(t))],round:[Qg,[Qg],(t,[e])=>{const i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[Qg,[Qg],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[Qg,[Qg],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[em,[tm,sm],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[em,[sm],(t,[e])=>t.id()===e.value],"filter-type-==":[em,[tm],(t,[e])=>t.geometryType()===e.value],"filter-<":[em,[tm,sm],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n<r}],"filter-id-<":[em,[sm],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<n}],"filter->":[em,[tm,sm],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>r}],"filter-id->":[em,[sm],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>n}],"filter-<=":[em,[tm,sm],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n<=r}],"filter-id-<=":[em,[sm],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<=n}],"filter->=":[em,[tm,sm],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>=r}],"filter-id->=":[em,[sm],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>=n}],"filter-has":[em,[sm],(t,[e])=>e.value in t.properties()],"filter-has-id":[em,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[em,[fm(tm)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[em,[fm(sm)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[em,[tm,fm(sm)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[em,[tm,fm(sm)],(t,[e,i])=>function(t,e,i,n){for(;i<=n;){const r=i+n>>1;if(e[r]===t)return!0;e[r]>t?n=r-1:i=r+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:em,overloads:[[[em,em],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[V_(em),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:em,overloads:[[[em,em],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[V_(em),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[em,[em],(t,[e])=>!e.evaluate(t)],"is-supported-script":[em,[tm],(t,[e])=>{const i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[tm,[tm],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[tm,[tm],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[tm,V_(sm),(t,e)=>e.map(e=>oy(e.evaluate(t))).join("")],split:[fm(tm),[tm,tm],(t,[e,i])=>e.evaluate(t).split(i.evaluate(t))],join:[tm,[fm(tm),tm],(t,[e,i])=>e.evaluate(t).join(i.evaluate(t))],"resolved-locale":[tm,[om],(t,[e])=>e.evaluate(t).resolvedLocale()]});class sv{constructor(t,e,i){this.expression=t,this._warningHistory={},this._evaluator=new fy,this._defaultValue=e?function(t){if("color"===t.type&&rv(t.default))return new Um(0,0,0,0);switch(t.type){case"color":return Um.parse(t.default)||null;case"padding":return Zm.parse(t.default)||null;case"numberArray":return Ym.parse(t.default)||null;case"colorArray":return Hm.parse(t.default)||null;case"variableAnchorOffsetCollection":return ty.parse(t.default)||null;case"projectionDefinition":return iy.parse(t.default)||null;default:return void 0===t.default?null:t.default}}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null,this._globalState=i}evaluateWithoutErrorHandling(t,e,i,n,r,s){return this._globalState&&(t=fv(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=n,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=s,this.expression.evaluate(this._evaluator)}evaluate(t,e,i,n,r,s){this._globalState&&(t=fv(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=n,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=s||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new Jm(`Expected value to be one of ${Object.keys(this._enumValues).map(t=>JSON.stringify(t)).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function ov(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in $_}function av(t,e,i){const n=new py($_,K_,[],e?function(t){const e={color:im,string:tm,number:Qg,enum:tm,boolean:em,formatted:am,padding:lm,numberArray:um,colorArray:hm,projectionDefinition:nm,resolvedImage:cm,variableAnchorOffsetCollection:dm};return"array"===t.type?fm(e[t.value]||sm,t.length):e[t.type]}(e):void 0),r=n.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return r?J_(new sv(r,e,i)):Q_(n.errors)}class lv{constructor(t,e,i){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Y_(e.expression),this.globalStateRefs=dv(e.expression),this._globalState=i}evaluateWithoutErrorHandling(t,e,i,n,r,s){return this._globalState&&(t=fv(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,r,s)}evaluate(t,e,i,n,r,s){return this._globalState&&(t=fv(t,this._globalState)),this._styleExpression.evaluate(t,e,i,n,r,s)}}class hv{constructor(t,e,i,n,r){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Y_(e.expression),this.globalStateRefs=dv(e.expression),this.interpolationType=n,this._globalState=r}evaluateWithoutErrorHandling(t,e,i,n,r,s){return this._globalState&&(t=fv(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,r,s)}evaluate(t,e,i,n,r,s){return this._globalState&&(t=fv(t,this._globalState)),this._styleExpression.evaluate(t,e,i,n,r,s)}interpolationFactor(t,e,i){return this.interpolationType?ky.interpolationFactor(this.interpolationType,t,e,i):0}}function uv(t,e,i){const n=av(t,e,i);if("error"===n.result)return n;const r=n.value.expression,s=Z_(r);if(!s&&!tv(e))return Q_([new Yg("","data expressions not supported")]);const o=H_(r,["zoom"]);if(!o&&!ev(e))return Q_([new Yg("","zoom expressions not supported")]);const a=cv(r);if(!a&&!o)return Q_([new Yg("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(a instanceof Yg)return Q_([a]);if(a instanceof ky&&!iv(e))return Q_([new Yg("",'"interpolate" expressions cannot be used with this property')]);if(!a)return J_(new lv(s?"constant":"source",n.value,i));const l=a instanceof ky?a.interpolation:void 0;return J_(new hv(s?"camera":"composite",n.value,a.labels,l,i))}function cv(t){let e=null;if(t instanceof gy)e=cv(t.result);else if(t instanceof Ay){for(const i of t.args)if(e=cv(i),e)break}else(t instanceof My||t instanceof ky)&&t.input instanceof B_&&"zoom"===t.input.name&&(e=t);return e instanceof Yg||t.eachChild(t=>{const i=cv(t);i instanceof Yg?e=i:!e&&i?e=new Yg("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new Yg("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function dv(t,e=new Set){return t instanceof q_&&e.add(t.key),t.eachChild(t=>{dv(t,e)}),e}function fv(t,e){const{zoom:i,heatmapDensity:n,elevation:r,lineProgress:s,isSupportedScript:o,accumulated:a}=null!=t?t:{};return{zoom:i,heatmapDensity:n,elevation:r,lineProgress:s,isSupportedScript:o,accumulated:a,globalState:e}}function pv(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!pv(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const gv={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function mv(t,e){return t<e?-1:t>e?1:0}function yv(t){if(!Array.isArray(t))return!1;if("within"===t[0]||"distance"===t[0])return!0;for(let e=1;e<t.length;e++)if(yv(t[e]))return!0;return!1}function _v(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?vv(t[1],t[2],"=="):"!="===e?bv(vv(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?vv(t[1],t[2],e):"any"===e?(i=t.slice(1),["any"].concat(i.map(_v))):"all"===e?["all"].concat(t.slice(1).map(_v)):"none"===e?["all"].concat(t.slice(1).map(_v).map(bv)):"in"===e?xv(t[1],t.slice(2)):"!in"===e?bv(xv(t[1],t.slice(2))):"has"===e?wv(t[1]):"!has"!==e||bv(wv(t[1]));var i}function vv(t,e,i){switch(t){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,t,e]}}function xv(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(t=>typeof t!=typeof e[0])?["filter-in-large",t,["literal",e.sort(mv)]]:["filter-in-small",t,["literal",e]]}}function wv(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function bv(t){return["!",t]}function Sv(t){return"object"==typeof t?["literal",t]:t}function Mv(t,e){let i=t.stops;if(!i)return function(t,e){const i=["get",t.property];if(void 0===t.default)return"string"===e.type?["string",i]:i;if("enum"===e.type)return["match",i,Object.keys(e.values),i,t.default];{const n=["color"===e.type?"to-color":e.type,i,Sv(t.default)];return"array"===e.type&&n.splice(1,0,e.value,e.length||null),n}}(t,e);const n=i&&"object"==typeof i[0][0],r=n||void 0!==t.property,s=n||!r;return i=i.map(t=>!r&&e.tokens&&"string"==typeof t[1]?[t[0],Rv(t[1])]:[t[0],Sv(t[1])]),n?function(t,e,i){const n={},r={},s=[];for(let e=0;e<i.length;e++){const o=i[e],a=o[0].zoom;void 0===n[a]&&(n[a]={zoom:a,type:t.type,property:t.property,default:t.default},r[a]=[],s.push(a)),r[a].push([o[0].value,o[1]])}if("exponential"===kv({},e)){const i=[Ev(t),["linear"],["zoom"]];for(const t of s)Tv(i,t,Pv(n[t],e,r[t]),!1);return i}{const t=["step",["zoom"]];for(const i of s)Tv(t,i,Pv(n[i],e,r[i]),!0);return Iv(t),t}}(t,e,i):s?function(t,e,i,n=["zoom"]){const r=kv(t,e);let s,o=!1;if("interval"===r)s=["step",n],o=!0;else{if("exponential"!==r)throw new Error(`Unknown zoom function type "${r}"`);{const e=void 0!==t.base?t.base:1;s=[Ev(t),1===e?["linear"]:["exponential",e],n]}}for(const t of i)Tv(s,t[0],t[1],o);return Iv(s),s}(t,e,i):Pv(t,e,i)}function Ev(t){switch(t.colorSpace){case"hcl":return"interpolate-hcl";case"lab":return"interpolate-lab";default:return"interpolate"}}function Cv(t,e){const i=Sv((n=t.default,r=e.default,void 0!==n?n:void 0!==r?r:void 0));var n,r;return void 0===i&&"resolvedImage"===e.type?"":i}function Pv(t,e,i){const n=kv(t,e),r=["get",t.property];if("categorical"===n&&"boolean"==typeof i[0][0]){const n=["case"];for(const t of i)n.push(["==",r,t[0]],t[1]);return n.push(Cv(t,e)),n}if("categorical"===n){const n=["match",r];for(const t of i)Tv(n,t[0],t[1],!1);return n.push(Cv(t,e)),n}if("interval"===n){const e=["step",["number",r]];for(const t of i)Tv(e,t[0],t[1],!0);return Iv(e),void 0===t.default?e:["case",["==",["typeof",r],"number"],e,Sv(t.default)]}if("exponential"===n){const e=void 0!==t.base?t.base:1,n=[Ev(t),1===e?["linear"]:["exponential",e],["number",r]];for(const t of i)Tv(n,t[0],t[1],!1);return void 0===t.default?n:["case",["==",["typeof",r],"number"],n,Sv(t.default)]}throw new Error(`Unknown property function type ${n}`)}function Iv(t){"step"===t[0]&&3===t.length&&(t.push(0),t.push(t[3]))}function Tv(t,e,i,n){t.length>3&&e===t[t.length-2]||(n&&2===t.length||t.push(e),t.push(i))}function kv(t,e){return t.type?t.type:e.expression.interpolated?"exponential":"interval"}function Rv(t){const e=["concat"],i=/{([^{}]+)}/g;let n=0;for(let r=i.exec(t);null!==r;r=i.exec(t)){const s=t.slice(n,i.lastIndex-r[0].length);n=i.lastIndex,s.length>0&&e.push(s),e.push(["get",r[1]])}if(1===e.length)return t;if(n<t.length)e.push(t.slice(n));else if(2===e.length)return["to-string",e[1]];return e}function Av(t){const e=t.key,i=t.value;return i?[new Kg(e,i,"constants have been deprecated as of v8")]:[]}function Gv(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Ov(t){if(Array.isArray(t))return t.map(Ov);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const i in t)e[i]=Ov(t[i]);return e}return Gv(t)}function Fv(t){const e=t.key,i=t.value,n=t.valueSpec||{},r=t.objectElementValidators||{},s=t.style,o=t.styleSpec,a=t.validateSpec;let l=[];const h=nv(i);if("object"!==h)return[new Kg(e,i,`object expected, ${h} found`)];for(const t in i){const h=t.split(".")[0],u=Lm(n,h)||n["*"];let c;if(Lm(r,h))c=r[h];else if(Lm(n,h)){if(void 0===i[t])continue;c=a}else if(r["*"])c=r["*"];else{if(!n["*"]){l.push(new Kg(e,i[t],`unknown property "${t}"`));continue}c=a}l=l.concat(c({key:(e?`${e}.`:e)+t,value:i[t],valueSpec:u,style:s,styleSpec:o,object:i,objectKey:t,validateSpec:a},i))}for(const t in n)r[t]||n[t].required&&void 0===n[t].default&&void 0===i[t]&&l.push(new Kg(e,i,`missing required property "${t}"`));return l}function Lv(t){const e=t.value,i=t.valueSpec,n=t.validateSpec,r=t.style,s=t.styleSpec,o=t.key,a=t.arrayElementValidator||n;if("array"!==nv(e))return[new Kg(o,e,`array expected, ${nv(e)} found`)];if(i.length&&e.length!==i.length)return[new Kg(o,e,`array length ${i.length} expected, length ${e.length} found`)];let l={type:i.value,values:i.values};s.$version<7&&(l.function=i.function),"object"===nv(i.value)&&(l=i.value);let h=[];for(let i=0;i<e.length;i++)h=h.concat(a({array:e,arrayIndex:i,value:e[i],valueSpec:l,validateSpec:t.validateSpec,style:r,styleSpec:s,key:`${o}[${i}]`}));return h}function jv(t){const e=t.key,i=t.value,n=t.valueSpec;let r=nv(i);return"number"===r&&i!=i&&(r="NaN"),"number"!==r?[new Kg(e,i,`number expected, ${r} found`)]:"minimum"in n&&i<n.minimum?[new Kg(e,i,`${i} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&i>n.maximum?[new Kg(e,i,`${i} is greater than the maximum value ${n.maximum}`)]:[]}function Nv(t){const e=t.valueSpec,i=Gv(t.value.type);let n,r,s,o={};const a="categorical"!==i&&void 0===t.value.property,l=!a,h="array"===nv(t.value.stops)&&"array"===nv(t.value.stops[0])&&"object"===nv(t.value.stops[0][0]),u=Fv({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===i)return[new Kg(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const n=t.value;return e=e.concat(Lv({key:t.key,value:n,valueSpec:t.valueSpec,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:c})),"array"===nv(n)&&0===n.length&&e.push(new Kg(t.key,n,"array must have at least one stop")),e},default:function(t){return t.validateSpec({key:t.key,value:t.value,valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===i&&a&&u.push(new Kg(t.key,t.value,'missing required property "property"')),"identity"===i||t.value.stops||u.push(new Kg(t.key,t.value,'missing required property "stops"')),"exponential"===i&&t.valueSpec.expression&&!iv(t.valueSpec)&&u.push(new Kg(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!tv(t.valueSpec)?u.push(new Kg(t.key,t.value,"property functions not supported")):a&&!ev(t.valueSpec)&&u.push(new Kg(t.key,t.value,"zoom functions not supported"))),"categorical"!==i&&!h||void 0!==t.value.property||u.push(new Kg(t.key,t.value,'"property" property is required')),u;function c(t){let i=[];const n=t.value,a=t.key;if("array"!==nv(n))return[new Kg(a,n,`array expected, ${nv(n)} found`)];if(2!==n.length)return[new Kg(a,n,`array length 2 expected, length ${n.length} found`)];if(h){if("object"!==nv(n[0]))return[new Kg(a,n,`object expected, ${nv(n[0])} found`)];if(void 0===n[0].zoom)return[new Kg(a,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new Kg(a,n,"object stop key must have value")];if(s&&s>Gv(n[0].zoom))return[new Kg(a,n[0].zoom,"stop zoom values must appear in ascending order")];Gv(n[0].zoom)!==s&&(s=Gv(n[0].zoom),r=void 0,o={}),i=i.concat(Fv({key:`${a}[0]`,value:n[0],valueSpec:{zoom:{}},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:jv,value:d}}))}else i=i.concat(d({key:`${a}[0]`,value:n[0],validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec},n));return ov(Ov(n[1]))?i.concat([new Kg(`${a}[1]`,n[1],"expressions are not allowed in function stops.")]):i.concat(t.validateSpec({key:`${a}[1]`,value:n[1],valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec}))}function d(t,s){const a=nv(t.value),l=Gv(t.value),h=null!==t.value?t.value:s;if(n){if(a!==n)return[new Kg(t.key,h,`${a} stop domain type must match previous stop domain type ${n}`)]}else n=a;if("number"!==a&&"string"!==a&&"boolean"!==a)return[new Kg(t.key,h,"stop domain value must be a number, string, or boolean")];if("number"!==a&&"categorical"!==i){let n=`number expected, ${a} found`;return tv(e)&&void 0===i&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Kg(t.key,h,n)]}return"categorical"!==i||"number"!==a||isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===a&&void 0!==r&&l<r?[new Kg(t.key,h,"stop domain values must appear in ascending order")]:(r=l,"categorical"===i&&l in o?[new Kg(t.key,h,"stop domain values must be unique")]:(o[l]=!0,[])):[new Kg(t.key,h,`integer expected, found ${l}`)]}}function Dv(t){const e=("property"===t.expressionContext?uv:av)(Ov(t.value),t.valueSpec);if("error"===e.result)return e.value.map(e=>new Kg(`${t.key}${e.key}`,t.value,e.message));const i=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!i.outputDefined())return[new Kg(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!Y_(i))return[new Kg(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!Y_(i))return[new Kg(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!H_(i,["zoom","feature-state"]))return[new Kg(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!Z_(i))return[new Kg(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function zv(t){const e=t.key,i=t.value,n=nv(i);return"string"!==n?[new Kg(e,i,`color expected, ${n} found`)]:Um.parse(String(i))?[]:[new Kg(e,i,`color expected, "${i}" found`)]}function qv(t){const e=t.key,i=t.value,n=t.valueSpec,r=[];return Array.isArray(n.values)?-1===n.values.indexOf(Gv(i))&&r.push(new Kg(e,i,`expected one of [${n.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(n.values).indexOf(Gv(i))&&r.push(new Kg(e,i,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(i)} found`)),r}function $v(t){return pv(Ov(t.value))?Dv(Zg({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Bv(t)}function Bv(t){const e=t.value,i=t.key;if("array"!==nv(e))return[new Kg(i,e,`array expected, ${nv(e)} found`)];const n=t.styleSpec;let r,s=[];if(e.length<1)return[new Kg(i,e,"filter array must have at least 1 element")];switch(s=s.concat(qv({key:`${i}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),Gv(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===Gv(e[1])&&s.push(new Kg(i,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&s.push(new Kg(i,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(r=nv(e[1]),"string"!==r&&s.push(new Kg(`${i}[1]`,e[1],`string expected, ${r} found`)));for(let o=2;o<e.length;o++)r=nv(e[o]),"$type"===Gv(e[1])?s=s.concat(qv({key:`${i}[${o}]`,value:e[o],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==r&&"number"!==r&&"boolean"!==r&&s.push(new Kg(`${i}[${o}]`,e[o],`string, number, or boolean expected, ${r} found`));break;case"any":case"all":case"none":for(let n=1;n<e.length;n++)s=s.concat(Bv({key:`${i}[${n}]`,value:e[n],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":r=nv(e[1]),2!==e.length?s.push(new Kg(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):"string"!==r&&s.push(new Kg(`${i}[1]`,e[1],`string expected, ${r} found`))}return s}function Uv(t,e){const i=t.key,n=t.validateSpec,r=t.style,s=t.styleSpec,o=t.value,a=t.objectKey,l=s[`${e}_${t.layerType}`];if(!l)return[];const h=a.match(/^(.*)-transition$/);if("paint"===e&&h&&l[h[1]]&&l[h[1]].transition)return n({key:i,value:o,valueSpec:s.transition,style:r,styleSpec:s});const u=t.valueSpec||l[a];if(!u)return[new Kg(i,o,`unknown property "${a}"`)];let c;if("string"===nv(o)&&tv(u)&&!u.tokens&&(c=/^{([^}]+)}$/.exec(o)))return[new Kg(i,o,`"${a}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(c[1])} }\`.`)];const d=[];return"symbol"===t.layerType&&"text-font"===a&&rv(Ov(o))&&"identity"===Gv(o.type)&&d.push(new Kg(i,o,'"text-font" does not support identity functions')),d.concat(n({key:t.key,value:o,valueSpec:u,style:r,styleSpec:s,expressionContext:"property",propertyType:e,propertyKey:a}))}function Wv(t){return Uv(t,"paint")}function Xv(t){return Uv(t,"layout")}function Vv(t){var e,i;let n=[];const r=t.value,s=t.key,o=t.style,a=t.styleSpec;if("object"!==nv(r))return[new Kg(s,r,`object expected, ${nv(r)} found`)];r.type||r.ref||n.push(new Kg(s,r,'either "type" or "ref" is required'));let l=Gv(r.type);const h=Gv(r.ref);if(r.id){const e=Gv(r.id);for(let i=0;i<t.arrayIndex;i++){const t=o.layers[i];Gv(t.id)===e&&n.push(new Kg(s,r.id,`duplicate layer id "${r.id}", previously used at line ${t.id.__line__}`))}}if("ref"in r){let t;["type","source","source-layer","filter","layout"].forEach(t=>{t in r&&n.push(new Kg(s,r[t],`"${t}" is prohibited for ref layers`))}),o.layers.forEach(e=>{Gv(e.id)===h&&(t=e)}),t?t.ref?n.push(new Kg(s,r.ref,"ref cannot reference another ref layer")):l=Gv(t.type):n.push(new Kg(s,r.ref,`ref layer "${h}" not found`))}else if("background"!==l)if(r.source){const t=o.sources&&o.sources[r.source],e=t&&Gv(t.type);t?"vector"===e&&"raster"===l?n.push(new Kg(s,r.source,`layer "${r.id}" requires a raster source`)):"raster-dem"!==e&&"hillshade"===l||"raster-dem"!==e&&"color-relief"===l?n.push(new Kg(s,r.source,`layer "${r.id}" requires a raster-dem source`)):"raster"===e&&"raster"!==l?n.push(new Kg(s,r.source,`layer "${r.id}" requires a vector source`)):"vector"!==e||r["source-layer"]?"raster-dem"===e&&"hillshade"!==l&&"color-relief"!==l?n.push(new Kg(s,r.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):"line"!==l||!r.paint||!r.paint["line-gradient"]||"geojson"===e&&t.lineMetrics||n.push(new Kg(s,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):n.push(new Kg(s,r,`layer "${r.id}" must specify a "source-layer"`)):n.push(new Kg(s,r.source,`source "${r.source}" not found`))}else n.push(new Kg(s,r,'missing required property "source"'));return"raster"===l&&(null===(e=r.paint)||void 0===e?void 0:e.resampling)&&(null===(i=r.paint)||void 0===i?void 0:i["raster-resampling"])&&n.push(new Kg(s,r.paint,`layer "${r.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),n=n.concat(Fv({key:s,value:r,valueSpec:a.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":()=>[],type:()=>t.validateSpec({key:`${s}.type`,value:r.type,valueSpec:a.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:"type"}),filter:$v,layout:t=>Fv({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>Xv(Zg({layerType:l},t))}}),paint:t=>Fv({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>Wv(Zg({layerType:l},t))}})}})),n}function Kv(t){const e=t.value,i=t.key,n=nv(e);return"string"!==n?[new Kg(i,e,`string expected, ${n} found`)]:[]}const Zv={promoteId:function({key:t,value:e}){if("string"===nv(e))return Kv({key:t,value:e});{const i=[];for(const n in e)i.push(...Kv({key:`${t}.${n}`,value:e[n]}));return i}}};function Yv(t){const e=t.value,i=t.key,n=t.styleSpec,r=t.style,s=t.validateSpec;if(!e.type)return[new Kg(i,e,'"type" is required')];const o=Gv(e.type);let a;switch(o){case"vector":case"raster":return a=Fv({key:i,value:e,valueSpec:n[`source_${o.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:Zv,validateSpec:s}),a;case"raster-dem":return a=function(t){var e;const i=null!==(e=t.sourceName)&&void 0!==e?e:"",n=t.value,r=t.styleSpec,s=r.source_raster_dem,o=t.style;let a=[];const l=nv(n);if(void 0===n)return a;if("object"!==l)return a.push(new Kg("source_raster_dem",n,`object expected, ${l} found`)),a;const h="custom"===Gv(n.encoding),u=["redFactor","greenFactor","blueFactor","baseShift"],c=t.value.encoding?`"${t.value.encoding}"`:"Default";for(const e in n)!h&&u.includes(e)?a.push(new Kg(e,n[e],`In "${i}": "${e}" is only valid when "encoding" is set to "custom". ${c} encoding found`)):s[e]?a=a.concat(t.validateSpec({key:e,value:n[e],valueSpec:s[e],validateSpec:t.validateSpec,style:o,styleSpec:r})):a.push(new Kg(e,n[e],`unknown property "${e}"`));return a}({sourceName:i,value:e,style:t.style,styleSpec:n,validateSpec:s}),a;case"geojson":if(a=Fv({key:i,value:e,valueSpec:n.source_geojson,style:r,styleSpec:n,validateSpec:s,objectElementValidators:Zv}),e.cluster)for(const t in e.clusterProperties){const[n,r]=e.clusterProperties[t],s="string"==typeof n?[n,["accumulated"],["get",t]]:n;a.push(...Dv({key:`${i}.${t}.map`,value:r,expressionContext:"cluster-map"})),a.push(...Dv({key:`${i}.${t}.reduce`,value:s,expressionContext:"cluster-reduce"}))}return a;case"video":return Fv({key:i,value:e,valueSpec:n.source_video,style:r,validateSpec:s,styleSpec:n});case"image":return Fv({key:i,value:e,valueSpec:n.source_image,style:r,validateSpec:s,styleSpec:n});case"canvas":return[new Kg(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return qv({key:`${i}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Hv(t){const e=t.value,i=t.styleSpec,n=i.light,r=t.style;let s=[];const o=nv(e);if(void 0===e)return s;if("object"!==o)return s=s.concat([new Kg("light",e,`object expected, ${o} found`)]),s;for(const o in e){const a=o.match(/^(.*)-transition$/);s=a&&n[a[1]]&&n[a[1]].transition?s.concat(t.validateSpec({key:o,value:e[o],valueSpec:i.transition,validateSpec:t.validateSpec,style:r,styleSpec:i})):n[o]?s.concat(t.validateSpec({key:o,value:e[o],valueSpec:n[o],validateSpec:t.validateSpec,style:r,styleSpec:i})):s.concat([new Kg(o,e[o],`unknown property "${o}"`)])}return s}function Jv(t){const e=t.value,i=t.styleSpec,n=i.sky,r=t.style,s=nv(e);if(void 0===e)return[];if("object"!==s)return[new Kg("sky",e,`object expected, ${s} found`)];let o=[];for(const s in e)o=n[s]?o.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],style:r,styleSpec:i})):o.concat([new Kg(s,e[s],`unknown property "${s}"`)]);return o}function Qv(t){const e=t.value,i=t.styleSpec,n=i.terrain,r=t.style;let s=[];const o=nv(e);if(void 0===e)return s;if("object"!==o)return s=s.concat([new Kg("terrain",e,`object expected, ${o} found`)]),s;for(const o in e)s=n[o]?s.concat(t.validateSpec({key:o,value:e[o],valueSpec:n[o],validateSpec:t.validateSpec,style:r,styleSpec:i})):s.concat([new Kg(o,e[o],`unknown property "${o}"`)]);return s}function tx(t){let e=[];const i=t.value,n=t.key;if(Array.isArray(i)){const r=[],s=[];for(const o in i){i[o].id&&r.includes(i[o].id)&&e.push(new Kg(n,i,`all the sprites' ids must be unique, but ${i[o].id} is duplicated`)),r.push(i[o].id),i[o].url&&s.includes(i[o].url)&&e.push(new Kg(n,i,`all the sprites' URLs must be unique, but ${i[o].url} is duplicated`)),s.push(i[o].url);const a={id:{type:"string",required:!0},url:{type:"string",required:!0}};e=e.concat(Fv({key:`${n}[${o}]`,value:i[o],valueSpec:a,validateSpec:t.validateSpec}))}return e}return Kv({key:n,value:i})}function ex(t){return Boolean(t)&&t.constructor===Object}function ix(t){return ex(t.value)?[]:[new Kg(t.key,t.value,`object expected, ${nv(t.value)} found`)]}const nx={"*":()=>[],array:Lv,boolean:function(t){const e=t.value,i=t.key,n=nv(e);return"boolean"!==n?[new Kg(i,e,`boolean expected, ${n} found`)]:[]},number:jv,color:zv,constants:Av,enum:qv,filter:$v,function:Nv,layer:Vv,object:Fv,source:Yv,light:Hv,sky:Jv,terrain:Qv,projection:function(t){const e=t.value,i=t.styleSpec,n=i.projection,r=t.style,s=nv(e);if(void 0===e)return[];if("object"!==s)return[new Kg("projection",e,`object expected, ${s} found`)];let o=[];for(const s in e)o=n[s]?o.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],style:r,styleSpec:i})):o.concat([new Kg(s,e[s],`unknown property "${s}"`)]);return o},projectionDefinition:function(t){const e=t.key;let i=t.value;i=i instanceof String?i.valueOf():i;const n=nv(i);return"array"!==n||function(t){return Array.isArray(t)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]}(i)||function(t){return!!["interpolate","step","literal"].includes(t[0])}(i)?["array","string"].includes(n)?[]:[new Kg(e,i,`projection expected, invalid type "${n}" found`)]:[new Kg(e,i,`projection expected, invalid array ${JSON.stringify(i)} found`)]},string:Kv,formatted:function(t){return 0===Kv(t).length?[]:Dv(t)},resolvedImage:function(t){return 0===Kv(t).length?[]:Dv(t)},padding:function(t){const e=t.key,i=t.value;if("array"===nv(i)){if(i.length<1||i.length>4)return[new Kg(e,i,`padding requires 1 to 4 values; ${i.length} values found`)];const n={type:"number"};let r=[];for(let s=0;s<i.length;s++)r=r.concat(t.validateSpec({key:`${e}[${s}]`,value:i[s],validateSpec:t.validateSpec,valueSpec:n}));return r}return jv({key:e,value:i,valueSpec:{}})},numberArray:function(t){const e=t.key,i=t.value;if("array"===nv(i)){const n={type:"number"};if(i.length<1)return[new Kg(e,i,"array length at least 1 expected, length 0 found")];let r=[];for(let s=0;s<i.length;s++)r=r.concat(t.validateSpec({key:`${e}[${s}]`,value:i[s],validateSpec:t.validateSpec,valueSpec:n}));return r}return jv({key:e,value:i,valueSpec:{}})},colorArray:function(t){const e=t.key,i=t.value;if("array"===nv(i)){if(i.length<1)return[new Kg(e,i,"array length at least 1 expected, length 0 found")];let t=[];for(let n=0;n<i.length;n++)t=t.concat(zv({key:`${e}[${n}]`,value:i[n]}));return t}return zv({key:e,value:i})},variableAnchorOffsetCollection:function(t){const e=t.key,i=t.value,n=nv(i),r=t.styleSpec;if("array"!==n||i.length<1||i.length%2!=0)return[new Kg(e,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let s=[];for(let n=0;n<i.length;n+=2)s=s.concat(qv({key:`${e}[${n}]`,value:i[n],valueSpec:r.layout_symbol["text-anchor"]})),s=s.concat(Lv({key:`${e}[${n+1}]`,value:i[n+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:r}));return s},sprite:tx,state:ix,fontFaces:function(t){const e=t.key,i=t.value,n=t.validateSpec,r=t.styleSpec,s=t.style;if(!ex(i))return[new Kg(e,i,`object expected, ${nv(i)} found`)];const o=[];for(const t in i){const a=i[t],l=nv(a);if("string"===l)o.push(...Kv({key:`${e}.${t}`,value:a}));else if("array"===l){const i={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(const[l,h]of a.entries())o.push(...Fv({key:`${e}.${t}[${l}]`,value:h,valueSpec:i,styleSpec:r,style:s,validateSpec:n}))}else o.push(new Kg(`${e}.${t}`,a,`string or array expected, ${l} found`))}return o}};function rx(t){const e=t.value,i=t.valueSpec,n=t.styleSpec;return t.validateSpec=rx,i.expression&&rv(Gv(e))?Nv(t):i.expression&&ov(Ov(e))?Dv(t):i.type&&nx[i.type]?nx[i.type](t):Fv(Zg({},t,{valueSpec:i.type?n[i.type]:i}))}function sx(t){const e=t.value,i=t.key,n=Kv(t);return n.length||(-1===e.indexOf("{fontstack}")&&n.push(new Kg(i,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&n.push(new Kg(i,e,'"glyphs" url must include a "{range}" token'))),n}function ox(t,e=Wg){let i=[];return i=i.concat(rx({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:rx,objectElementValidators:{glyphs:sx,"*":()=>[]}})),t.constants&&(i=i.concat(Av({key:"constants",value:t.constants}))),lx(i)}function ax(t){return function(e){return t(Object.assign({},e,{validateSpec:rx}))}}function lx(t){return[].concat(t).sort((t,e)=>t.line-e.line)}function hx(t){return function(...e){return lx(t.apply(this,e))}}ox.source=hx(ax(Yv)),ox.sprite=hx(ax(tx)),ox.glyphs=hx(ax(sx)),ox.light=hx(ax(Hv)),ox.sky=hx(ax(Jv)),ox.terrain=hx(ax(Qv)),ox.state=hx(ax(ix)),ox.layer=hx(ax(Vv)),ox.filter=hx(ax($v)),ox.paintProperty=hx(ax(Wv)),ox.layoutProperty=hx(ax(Xv));const ux=Wg;function cx(t,e){const i=e[0].evaluate(t),n=e[1].evaluate(t),r=e[2].evaluate(t),s=e[3]?e[3].evaluate(t):1;return Um.parse(`hsla(${i}, ${n}%, ${r}%, ${s})`)}function dx(t){if(Array.isArray(t)){if(0===t.length)return t;const e=t[0];if("literal"===e)return t;if("image"===e&&3===t.length&&"object"==typeof t[2]&&null!==t[2]&&!Array.isArray(t[2]))return["image-config",dx(t[1]),["literal",t[2]]];const i=t.length;for(let n=1;n<i;++n){const r=t[n],s=dx(r);if(s!==r){const r=[e];for(let e=1;e<n;++e)r.push(t[e]);r.push(s);for(let e=n+1;e<i;++e)r.push(dx(t[e]));return r}}}return t}const fx={},px={zoom:0,distanceFromCenter:0};B_.register($_,{...B_.definitions,pitch:[{kind:"number"},[],t=>px.pitch||0],"distance-from-center":[{kind:"number"},[],t=>px.distanceFromCenter||0],"to-hsla":[{kind:"array",itemType:{kind:"number"},N:4},[{kind:"string"}],(t,[e])=>function(t){const e=t[0]/255,i=t[1]/255,n=t[2]/255,r=t[3],s=Math.max(e,i,n),o=Math.min(e,i,n),a=(s+o)/2;let l,h;if(s===o)l=0,h=0;else{const t=s-o;switch(h=a>.5?t/(2-s-o):t/(s+o),s){case e:l=(i-n)/t+(i<n?6:0);break;case i:l=(n-e)/t+2;break;case n:l=(e-i)/t+4;break;default:l=0}l/=6}return[360*l,100*h,100*a,r]}(Js(e.evaluate(t)))],hsl:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"}],cx],hsla:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"},{kind:"number"}],cx],"image-config":[{kind:"value"},[{kind:"string"},{kind:"value"}],(t,[e,i])=>e.evaluate(t)],"measure-light":[{kind:"number"},[{kind:"value"}],()=>1],config:[{kind:"value"},[{kind:"string"}],(t,[e])=>{const i=fx[e.evaluate(t)];return void 0===i?{}:i}]});var gx={thin:100,hairline:100,"ultra-light":200,"extra-light":200,light:300,book:300,regular:400,normal:400,plain:400,roman:400,standard:400,medium:500,"semi-bold":600,"demi-bold":600,bold:700,"extra-bold":800,"ultra-bold":800,heavy:900,black:900,"heavy-black":900,fat:900,poster:900,"ultra-black":950,"extra-black":950},mx=" ",yx=/(italic|oblique)$/i,_x={};function vx(t,e,i){var n=_x[t];if(!n){Array.isArray(t)||(t=[t]);for(var r,s,o=400,a="normal",l=[],h=0,u=t.length;h<u;++h){var c=t[h].split(" "),d=c[c.length-1].toLowerCase();for(var f in"normal"==d||"italic"==d||"oblique"==d?(a=s?a:d,s=!0,c.pop(),d=c[c.length-1].toLowerCase()):yx.test(d)&&(d=d.replace(yx,""),a=s?a:c[c.length-1].replace(d,""),s=!0),gx){var p=c.length>1?c[c.length-2].toLowerCase():"";if(d==f||d==f.replace("-","")||p+"-"+d==f){o=r?o:gx[f],c.pop(),p&&f.startsWith(p)&&c.pop();break}}r||"number"!=typeof d||(o=d,r=!0);var g=c.join(mx).replace("Klokantech Noto Sans","Noto Sans").replace("DIN Pro","Barlow").replace("Arial Unicode MS","Arial");-1!==g.indexOf(mx)&&(g='"'+g+'"'),l.push(g)}n=_x[t]=[a,o,l]}return n[0]+mx+n[1]+mx+e+"px"+(i?"/"+i:"")+mx+n[2]}const xx=Object.freeze({}),wx={},bx={};let Sx=0;function Mx(t){return t.id||(t.id=Sx++),t.id}function Ex(t){return t*Math.PI/180}const Cx=function(){const t=[];for(let e=78271.51696402048;t.length<=24;e/=2)t.push(e);return t}();function Px(t,e){if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas)return new OffscreenCanvas(t,e);const i=document.createElement("canvas");return i.width=t,i.height=e,i}function Ix(t,e,i,n){const r=[2*i*e.pixelRatio+e.width,2*i*e.pixelRatio+e.height],s=Px(r[0],r[1]),o=s.getContext("2d");o.drawImage(t,e.x,e.y,e.width,e.height,i*e.pixelRatio,i*e.pixelRatio,e.width,e.height);const a=o.getImageData(0,0,r[0],r[1]);o.globalCompositeOperation="destination-over",o.fillStyle=`rgba(${255*n.r},${255*n.g},${255*n.b},${n.a})`;const l=a.data;for(let t=0,n=a.width;t<n;++t)for(let r=0,s=a.height;r<s;++r)l[4*(r*n+t)+3]>0&&o.arc(t,r,i*e.pixelRatio,0,2*Math.PI);return o.fill(),s}function Tx(t,e,i){const n=Math.max(0,Math.min(1,(i-t)/(e-t)));return n*n*(3-2*n)}function kx(t,e,i){const n=Px(e.width,e.height),r=n.getContext("2d");r.drawImage(t,e.x,e.y,e.width,e.height,0,0,e.width,e.height);const s=r.getImageData(0,0,e.width,e.height),o=s.data;for(let t=0,e=s.width;t<e;++t)for(let n=0,r=s.height;n<r;++n){const r=4*(n*e+t),s=.75,a=.1,l=Tx(s-a,s+a,o[r+3]/255);l>0?(o[r+0]=Math.round(255*i.r*l),o[r+1]=Math.round(255*i.g*l),o[r+2]=Math.round(255*i.b*l),o[r+3]=Math.round(255*l)):o[r+3]=0}return r.putImageData(s,0,0),n}const Rx=Array(256).join(" ");function Ax(t,e){if(e>=.05){let i="";const n=t.split("\n"),r=Rx.slice(0,Math.round(e/.1));for(let t=0,e=n.length;t<e;++t)t>0&&(i+="\n"),i+=n[t].split("").join(r);return i}return t}let Gx;function Ox(){return Gx||(Gx=Px(1,1).getContext("2d")),Gx}function Fx(t,e){return Ox().measureText(t).width+(t.length-1)*e}const Lx={};function jx(t,e,i,n){if(-1!==t.indexOf("\n")){const r=t.split("\n"),s=[];for(let t=0,o=r.length;t<o;++t)s.push(jx(r[t],e,i,n));return s.join("\n")}const r=i+","+e+","+t+","+n;let s=Lx[r];if(!s){const o=t.split(" ");if(o.length>1){const t=Ox();t.font=e;const r=t.measureText("M").width*i;let a="";const l=[];for(let t=0,e=o.length;t<e;++t){const e=o[t],i=a+(a?" ":"")+e;Fx(i,n)<=r?a=i:(a&&l.push(a),a=e)}a&&l.push(a);for(let t=0,e=l.length;t<e&&e>1;++t){const i=l[t];if(Fx(i,n)<.35*r){const r=t>0?Fx(l[t-1],n):1/0,s=t<e-1?Fx(l[t+1],n):1/0;l.splice(t,1),e-=1,r<s?(l[t-1]+=" "+i,t-=1):l[t]=i+" "+l[t]}}for(let t=0,e=l.length-1;t<e;++t){const i=l[t],s=l[t+1];if(Fx(i,n)>.7*r&&Fx(s,n)<.6*r){const o=i.split(" "),a=o.pop();Fx(a,n)<.2*r&&(l[t]=o.join(" "),l[t+1]=a+" "+s),e-=1}}s=l.join("\n")}else s=t;s=Ax(s,n),Lx[r]=s}return s}Ua.on("propertychange",()=>{for(const t in Lx)delete Lx[t]});const Nx={Point:1,MultiPoint:1,LineString:2,MultiLineString:2,Polygon:3,MultiPolygon:3},Dx={center:[.5,.5],left:[0,.5],right:[1,.5],top:[.5,0],bottom:[.5,1],"top-left":[0,0],"top-right":[1,0],"bottom-left":[0,1],"bottom-right":[1,1]},zx=function(t,e){let i=uv(t,e);if("error"===i.result){const n=dx(t);n!==t&&(i=uv(n,e))}if("error"===i.result){const n=i.value[0];return console.error("Error parsing expression:",t,n.key,n.message),{evaluate:()=>e.default}}return i.value};let qx,$x;function Bx(t,e,i,n,r,s){const o=t.id;r||(r={},console.warn("No functionCache provided to getValue()")),r[o]||(r[o]={});const a=r[o];if(!a[i]){let n=(t[e]||xx)[i];const r=ux[`${e}_${t.type}`]&&ux[`${e}_${t.type}`][i];void 0===n&&r&&(n=r.default);let s=ov(n);if(!s&&rv(n)&&(n=Mv(n,r),s=!0),s){const t=zx(n,r);a[i]=t.evaluate.bind(t)}else{const t=r?r.type:typeof n;"color"!==t&&"colorArray"!==t||(n=Um.parse(n));let e=!1;if("array"===t)for(let t=0;t<n.length;++t){const i=n[t];if(ov(i)||rv(i)){e=!0;break}}if(e){const t=Object.assign({},r,{type:r.value}),e=[];for(let i=0;i<n.length;++i){let r=n[i];if(!ov(r)&&rv(r)&&(r=Mv(r,t)),ov(r)){const i=zx(r,t);e.push(i.evaluate.bind(i))}else e.push(function(){return r})}a[i]=function(t,i,n){const r=[];for(let s=0;s<e.length;++s)r[s]=e[s](t,i,n);return r}}else a[i]=function(){return n}}}return a[i](px,n,s)}function Ux(t,e,i,n){return Bx(t,"layout",`${i}-allow-overlap`,e,n)?Bx(t,"layout",`${i}-ignore-placement`,e,n)?"none":"obstacle":"declutter"}function Wx(t,e,i,n){if(n||console.warn("No filterCache provided to evaluateFilter()"),!(t in n))try{n[t]=function(t,e){if(null==t)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};pv(t)||(t=_v(t));const i=av(t,gv,e);if("error"===i.result)throw new Error(i.value.map(t=>`${t.key}: ${t.message}`).join(", "));return{filter:(t,e,n)=>i.value.evaluate(t,e,{},n),needGeometry:yv(t),getGlobalStateRefs:()=>dv(i.value.expression)}}(e).filter}catch(e){console.warn("Filter will evaluate to false: "+e.message),n[t]=function(){return!1}}return n[t](px,i)}function Xx(t,e){if(t){if(0===t.a||0===e)return;const i=t.a;return e=void 0===e?1:e,0===i?"transparent":"rgba("+Math.round(255*t.r/i)+","+Math.round(255*t.g/i)+","+Math.round(255*t.b/i)+","+i*e+")"}return t}const Vx=/\{[^{}}]*\}/g;function Kx(t,e){return t.replace(Vx,function(t){return e[t.slice(1,-1)]||""})}function Zx(t,e){let i=t.split(":")[0];return i===t&&(i="default"),e[i]}let Yx=!1;const Hx={};function Jx(t,e,i,n=Cx,r=void 0,s=void 0,o=void 0,a=void 0){if("string"==typeof e&&(e=JSON.parse(e)),e.schema)for(const t in e.schema){const i=e.schema[t];"default"in i&&(fx[t]=i.default)}if(8!=e.version)throw new Error("glStyle version 8 required.");Hx[function(t,e){return Mx(t)+"."+L(e)}(e,t)]=Array.from(arguments);const l={};("string"==typeof s||s instanceof Request||s instanceof Response||s instanceof Promise)&&(s={default:s});for(const e in s){const i=s[e];T(()=>i).then(async i=>{let n;if("undefined"!=typeof Image){const r=new Image;if("string"==typeof i)r.crossOrigin="anonymous",r.src=i;else{let t;i instanceof Request?t=await fetch(i):i instanceof Response&&(t=i);const e=await t.blob();n=URL.createObjectURL(e),r.src=n}r.addEventListener("load",function i(){r.removeEventListener("load",i),l[e]={image:r,size:[r.width,r.height]},t.changed(),n&&URL.revokeObjectURL(n)}),r.addEventListener("error",function t(){URL.revokeObjectURL(n),r.removeEventListener("error",t)})}else if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope){const t=self;t.postMessage({action:"loadImage",src:i}),t.addEventListener("message",function(t){"imageLoaded"===t.data.action&&t.data.src===i&&(l[e]={image:t.data.image,size:[t.data.image.width,t.data.image.height]})})}})}const h=function(t){t=t.slice();const e=Object.create(null);for(let i=0;i<t.length;i++)e[t[i].id]=t[i];for(let i=0;i<t.length;i++)"ref"in t[i]&&(t[i]=Vg(t[i],e[t[i].ref]));return t}(e.layers),u={},c=[],d={},f={},p=function(t){let e=wx[t.id];return e||(e={},wx[Mx(t)]=e),e}(e),g=function(t){let e=bx[t.id];return e||(e={},bx[Mx(t)]=e),e}(e);let m;for(let t=0,n=h.length;t<n;++t){const n=h[t],r=n.id;if("string"==typeof i&&n.source==i||Array.isArray(i)&&-1!==i.indexOf(r)){const i=n["source-layer"];if(m){if(n.source!==m)throw new Error(`Layer "${r}" does not use source "${m}`)}else{m=n.source;const t=e.sources[m];if(!t)throw new Error(`Source "${m}" is not defined`);const i=t.type;if("vector"!==i&&"geojson"!==i)throw new Error(`Source "${m}" is not of type "vector" or "geojson", but "${i}"`)}let s=u[i];s||(s=[],u[i]=s),s.push({layer:n,index:t}),c.push(r)}}const y=[],_=function(i,s,h){const c=t.getSource?.()?.format_?.layerName_??"mvt:layer",m=i.getProperties(),_=u[m[c]];if(!_)return;let v=n.indexOf(s);-1==v&&(v=function(t,e){let i=0;const n=e.length;for(;i<n;++i)if(e[i]<t&&i+1<n){const n=e[i]/e[i+1];return i+Math.log(e[i]/t)/Math.log(n)}return n-1}(s,n)),px.zoom=v,px.distanceFromCenter=0;const x=i.getGeometry(),w=Nx[x.getType()],b=t.get("map");if(b&&b instanceof Ql&&1===w){const t=b.getSize();if(t){const e=b.getView().getCenter(),i=Xt(x.getExtent());px.distanceFromCenter=(S=e,M=i,Math.sqrt(function(t,e){const i=t[0]-e[0],n=t[1]-e[1];return i*i+n*n}(S,M))/s/t[1])}}var S,M;const E={id:i.getId(),properties:m,type:w},C=t.get("mapbox-featurestate")[i.getId()];let P,I=-1;for(let n=0,u=_.length;n<u;++n){const u=_[n],c=u.layer,x=c.id;if(void 0!==h&&h!==x)continue;const b=c.layout||xx,S=c.paint||xx;if("none"===Bx(c,"layout","visibility",E,p,C)||"minzoom"in c&&v<c.minzoom||"maxzoom"in c&&v>=c.maxzoom)continue;const M=c.filter;if(!M||Wx(x,M,E,g)){let n,h,g,_,v,x;P=c;const M=u.index;if(3==w&&("fill"==c.type||"fill-extrusion"==c.type))if(h=Bx(c,"paint",c.type+"-opacity",E,p,C),c.type+"-pattern"in S){const t=Bx(c,"paint",c.type+"-pattern",E,p,C);if(t){const e="string"==typeof t?Kx(t,m):t.toString(),i=Zx(e,l);if(r&&r[e]&&i){++I,x=y[I],x&&x.getFill()&&!x.getStroke()&&!x.getText()||(x=new _l({fill:new ll}),y[I]=x),g=x.getFill(),x.setZIndex(M);const t=e+"."+h;let n=f[t];if(!n){const s=r[e],o=Px(s.width,s.height),a=o.getContext("2d");a.globalAlpha=h,a.drawImage(i.image,s.x,s.y,s.width,s.height,0,0,s.width,s.height),n=a.createPattern(o,"repeat"),f[t]=n}g.setColor(n)}}}else if(n=Xx(Bx(c,"paint",c.type+"-color",E,p,C),h),c.type+"-outline-color"in S&&(v=Xx(Bx(c,"paint",c.type+"-outline-color",E,p,C),h)),v||(v=n),n||v){if(++I,x=y[I],(!x||n&&!x.getFill()||!n&&x.getFill()||v&&!x.getStroke()||!v&&x.getStroke()||x.getText())&&(x=new _l({fill:n?new ll:void 0,stroke:v?new fl:void 0}),y[I]=x),n&&(g=x.getFill(),g.setColor(n)),"fill-extrusion"===c.type){const t=Bx(c,"paint","fill-extrusion-height",E,p,C);if(t>0){const e=Math.max(.1,.9-Math.min(t,225)/280);if(v&&"transparent"!==v){const t=Um.parse(v);v=`rgba(${Math.round(255*t.r*e)},${Math.round(255*t.g*e)},${Math.round(255*t.b*e)},${t.a})`}}}v&&(_=x.getStroke(),_.setColor(v),_.setWidth(.5)),x.setZIndex(M)}if(1!=w&&"line"==c.type){n="line-pattern"in S?void 0:Xx(Bx(c,"paint","line-color",E,p,C),Bx(c,"paint","line-opacity",E,p,C));const t=Bx(c,"paint","line-width",E,p,C);n&&t>0&&(++I,x=y[I],x&&x.getStroke()&&!x.getFill()&&!x.getText()||(x=new _l({stroke:new fl}),y[I]=x),_=x.getStroke(),_.setLineCap(Bx(c,"layout","line-cap",E,p,C)),_.setLineJoin(Bx(c,"layout","line-join",E,p,C)),_.setMiterLimit(Bx(c,"layout","line-miter-limit",E,p,C)),_.setColor(n),_.setWidth(t),_.setLineDash(S["line-dasharray"]?Bx(c,"paint","line-dasharray",E,p,C).map(function(e){return e*t}):null),"function"==typeof _.setOffset&&_.setOffset(Bx(c,"paint","line-offset",E,p,C)),x.setZIndex(M))}let T,k,R,A,G,O,F,L,j,N=!1,D=null,z=0;if((1==w||2==w)&&"icon-image"in b){const e=Bx(c,"layout","icon-image",E,p,C);if(e){let n;T="string"==typeof e?Kx(e,m):e.toString();const o=a?a(t,T):void 0,h=Zx(T,l);if(r&&r[T]&&h||o){const t=Bx(c,"layout","icon-rotation-alignment",E,p,C);if(2==w){const e=i.getGeometry();if(e.getFlatMidpoint||e.getFlatMidpoints){const i=e.getExtent();if(Math.sqrt(Math.max(Math.pow((i[2]-i[0])/s,2),Math.pow((i[3]-i[1])/s,2)))>150){const i="MultiLineString"===e.getType()?e.getFlatMidpoints():e.getFlatMidpoint();if($x||(qx=[NaN,NaN],$x=new mg("Point",qx,[],2,{},void 0)),n=$x,qx[0]=i[0],qx[1]=i[1],"line"===Bx(c,"layout","symbol-placement",E,p,C)&&"map"===t){const t=e.getStride(),n=e.getFlatCoordinates();for(let e=0,r=n.length-t;e<r;e+=t){const r=n[e],s=n[e+1],o=n[e+t],a=n[e+t+1],l=Math.min(r,o),h=Math.max(r,o),u=i[0],c=(a-s)*(u-r)-(o-r)*(i[1]-s);if(Math.abs(c)<.001&&u<=h&&u>=l){z=Math.atan2(s-a,o-r);break}}}}}}if(2!==w||n){const e=Bx(c,"layout","icon-size",E,p,C),i=void 0!==S["icon-color"]?Bx(c,"paint","icon-color",E,p,C):null;if(!i||0!==i.a){const n=Bx(c,"paint","icon-halo-color",E,p,C),s=Bx(c,"paint","icon-halo-width",E,p,C);let a=`${T}.${e}.${s}.${n}`;if(null!==i&&(a+=`.${i}`),k=d[a],!k){const l=Ux(c,E,"icon",p);let u;"icon-offset"in b&&(u=Bx(c,"layout","icon-offset",E,p,C).slice(0),u[0]*=e,u[1]*=-e);let f=i?[255*i.r,255*i.g,255*i.b,i.a]:void 0;if(o){const i={color:f,rotateWithView:"map"===t,displacement:u,declutterMode:l,scale:e};"string"==typeof o?i.src=o:(i.img=o,i.imgSize=[o.width,o.height]),k=new cl(i)}else{const o=r[T];let a,c,d;if(s)o.sdf?(a=Ix(kx(h.image,o,i||[0,0,0,1]),{x:0,y:0,width:o.width,height:o.height,pixelRatio:o.pixelRatio},s,n),f=void 0):a=Ix(h.image,o,s,n);else{if(o.sdf&&!h.unSDFed){const t=kx(h.image,{x:0,y:0,width:h.size[0],height:h.size[1]},{r:1,g:1,b:1,a:1});h.image=t,h.unSDFed=!0}a=h.image,c=[o.width,o.height],d=[o.x,o.y]}k=new cl({color:f,img:a,imgSize:h.size,size:c,offset:d,rotateWithView:"map"===t,scale:e/o.pixelRatio,displacement:u,declutterMode:l})}d[a]=k}}k&&(++I,x=y[I],x&&x.getImage()&&!x.getFill()&&!x.getStroke()||(x=new _l,y[I]=x),x.setGeometry(n),k.setRotation(z+Ex(Bx(c,"layout","icon-rotate",E,p,C))),k.setOpacity(Bx(c,"paint","icon-opacity",E,p,C)),k.setAnchor(Dx[Bx(c,"layout","icon-anchor",E,p,C)]),x.setImage(k),D=x.getText(),x.setText(void 0),x.setZIndex(M),N=!0,R=!1)}else R=!0}}}if(1==w&&"circle"===c.type){++I,x=y[I],x&&x.getImage()&&!x.getFill()&&!x.getStroke()||(x=new _l,y[I]=x);const t="circle-radius"in S?Bx(c,"paint","circle-radius",E,p,C):5,e=Xx(Bx(c,"paint","circle-stroke-color",E,p,C),Bx(c,"paint","circle-stroke-opacity",E,p,C)),i=Bx(c,"paint","circle-translate",E,p,C),n=Xx(Bx(c,"paint","circle-color",E,p,C),Bx(c,"paint","circle-opacity",E,p,C)),r=Bx(c,"paint","circle-stroke-width",E,p,C),s=t+"."+e+"."+n+"."+r+"."+i[0]+"."+i[1];k=d[s],k||(k=new ol({radius:t,displacement:[i[0],-i[1]],stroke:e&&r>0?new fl({width:r,color:e}):void 0,fill:n?new ll({color:n}):void 0,declutterMode:"none"}),d[s]=k),x.setImage(k),D=x.getText(),x.setText(void 0),x.setGeometry(void 0),x.setZIndex(M),N=!0}if("text-field"in b){F=Math.round(Bx(c,"layout","text-size",E,p,C));const t=Bx(c,"layout","text-font",E,p,C);O=Bx(c,"layout","text-line-height",E,p,C),G=vx(o?o(t,e.metadata?e.metadata["ol:webfonts"]:void 0):t,F,O),G.includes("sans-serif")||(G+=",sans-serif"),L=Bx(c,"layout","text-letter-spacing",E,p,C),j=Bx(c,"layout","text-max-width",E,p,C);const i=Bx(c,"layout","text-field",E,p,C);A="object"==typeof i&&i.sections?1===i.sections.length?i.toString():i.sections.reduce((e,i,n)=>{const r=i.fontStack?i.fontStack.split(","):t,s=vx(o?o(r):r,F*(i.scale||1),O);let a=i.text;if("\n"===a)return e.push("\n",""),e;if(2==w)return e.push(Ax(a,L),s),e;a=jx(a,s,j,L).split("\n");for(let t=0,i=a.length;t<i;++t)t>0&&e.push("\n",""),e.push(a[t],s);return e},[]):Kx(i,m).trim(),h=Bx(c,"paint","text-opacity",E,p,C)}if(A&&h&&!R){N||(++I,x=y[I],x&&x.getText()&&!x.getFill()&&!x.getStroke()||(x=new _l,y[I]=x),x.setImage(void 0),x.setGeometry(void 0));const t=Ux(c,E,"text",p);x.getText()||x.setText(D),D=x.getText(),(!D||"getDeclutterMode"in D&&D.getDeclutterMode()!==t)&&(D=new xl({padding:[2,2,2,2],declutterMode:t}),x.setText(D));const e=Bx(c,"layout","text-transform",E,p,C);"uppercase"==e?A=Array.isArray(A)?A.map((t,e)=>e%2?t:t.toUpperCase()):A.toUpperCase():"lowercase"==e&&(A=Array.isArray(A)?A.map((t,e)=>e%2?t:t.toLowerCase()):A.toLowerCase());const i=Array.isArray(A)?A:2==w?Ax(A,L):jx(A,G,j,L);if(D.setText(i),D.setFont(G),D.setRotation(Ex(Bx(c,"layout","text-rotate",E,p,C))),"function"==typeof D.setKeepUpright){const t=Bx(c,"layout","text-keep-upright",E,p,C);D.setKeepUpright(t)}const n=Bx(c,"layout","text-anchor",E,p,C),r=N||1==w?"point":Bx(c,"layout","symbol-placement",E,p,C);let s;if("line-center"===r?(D.setPlacement("line"),s="center"):D.setPlacement(r),"line"===r&&"function"==typeof D.setRepeat){const t=Bx(c,"layout","symbol-spacing",E,p,C);D.setRepeat(2*t)}D.setOverflow("point"===r);let o=Bx(c,"paint","text-halo-width",E,p,C);const a=Bx(c,"layout","text-offset",E,p,C),l=Bx(c,"paint","text-translate",E,p,C);let u=0,d=0;if("point"==r){s="center",-1!==n.indexOf("left")?(s="left",d=o):-1!==n.indexOf("right")&&(s="right",d=-o);const t=Bx(c,"layout","text-rotation-alignment",E,p,C);D.setRotateWithView("map"==t)}else D.setMaxAngle(Ex(Bx(c,"layout","text-max-angle",E,p,C))*A.length/i.length),D.setRotateWithView(!1);D.setTextAlign(s);let f="middle";0==n.indexOf("bottom")?(f="bottom",u=-o-.5*(O-1)*F):0==n.indexOf("top")&&(f="top",u=o+.5*(O-1)*F),D.setTextBaseline(f);const g=Bx(c,"layout","text-justify",E,p,C);D.setJustify("auto"===g?void 0:g),D.setOffsetX(a[0]*F+d+l[0]),D.setOffsetY(a[1]*F+u+l[1]);const m=D.getFill()||new ll;m.setColor(Xx(Bx(c,"paint","text-color",E,p,C),h)),D.setFill(m);const _=Xx(Bx(c,"paint","text-halo-color",E,p,C),h);if(_&&o>0){const t=D.getStroke()||new fl;t.setColor(_),o*=2;const e=.5*F;t.setWidth(o<=e?o:e),D.setStroke(t)}else D.setStroke(void 0);const v=Bx(c,"layout","text-padding",E,p,C),b=D.getPadding();v!==b[0]&&(b[0]=v,b[1]=v,b[2]=v,b[3]=v),x.setZIndex(M)}}}return I>-1?(y.length=I+1,Yx&&("set"in i?i.set("mapbox-layer",P):i.getProperties()["mapbox-layer"]=P),y):void 0};return t.setStyle(_),t.set("mapbox-layers",c),t.set("mapbox-source",m),t.set("mapbox-featurestate",t.get("mapbox-featurestate")||{}),_}function Qx(t){return Qx="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qx(t)}function tw(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function ew(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?tw(Object(i),!0).forEach(function(e){iw(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):tw(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function iw(t,e,i){return(e=function(t){var e=function(t){if("object"!=Qx(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=Qx(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Qx(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function nw(){var t,e,i="function"==typeof Symbol?Symbol:{},n=i.iterator||"@@iterator",r=i.toStringTag||"@@toStringTag";function s(i,n,r,s){var l=n&&n.prototype instanceof a?n:a,h=Object.create(l.prototype);return rw(h,"_invoke",function(i,n,r){var s,a,l,h=0,u=r||[],c=!1,d={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,i){return s=e,a=0,l=t,d.n=i,o}};function f(i,n){for(a=i,l=n,e=0;!c&&h&&!r&&e<u.length;e++){var r,s=u[e],f=d.p,p=s[2];i>3?(r=p===n)&&(l=s[(a=s[4])?5:(a=3,3)],s[4]=s[5]=t):s[0]<=f&&((r=i<2&&f<s[1])?(a=0,d.v=n,d.n=s[1]):f<p&&(r=i<3||s[0]>n||n>p)&&(s[4]=i,s[5]=n,d.n=p,a=0))}if(r||i>1)return o;throw c=!0,n}return function(r,u,p){if(h>1)throw TypeError("Generator is already running");for(c&&1===u&&f(u,p),a=u,l=p;(e=a<2?t:l)||!c;){s||(a?a<3?(a>1&&(d.n=-1),f(a,l)):d.n=l:d.v=l);try{if(h=2,s){if(a||(r="next"),e=s[r]){if(!(e=e.call(s,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,a<2&&(a=0)}else 1===a&&(e=s.return)&&e.call(s),a<2&&(l=TypeError("The iterator does not provide a '"+r+"' method"),a=1);s=t}else if((e=(c=d.n<0)?l:i.call(n,d))!==o)break}catch(e){s=t,a=1,l=e}finally{h=1}}return{value:e,done:c}}}(i,r,s),!0),h}var o={};function a(){}function l(){}function h(){}e=Object.getPrototypeOf;var u=[][n]?e(e([][n]())):(rw(e={},n,function(){return this}),e),c=h.prototype=a.prototype=Object.create(u);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,rw(t,r,"GeneratorFunction")),t.prototype=Object.create(c),t}return l.prototype=h,rw(c,"constructor",h),rw(h,"constructor",l),l.displayName="GeneratorFunction",rw(h,r,"GeneratorFunction"),rw(c),rw(c,r,"Generator"),rw(c,n,function(){return this}),rw(c,"toString",function(){return"[object Generator]"}),(nw=function(){return{w:s,m:d}})()}function rw(t,e,i,n){var r=Object.defineProperty;try{r({},"",{})}catch(t){r=0}rw=function(t,e,i,n){function s(e,i){rw(t,e,function(t){return this._invoke(e,i,t)})}e?r?r(t,e,{value:i,enumerable:!n,configurable:!n,writable:!n}):t[e]=i:(s("next",0),s("throw",1),s("return",2))},rw(t,e,i,n)}function sw(t,e,i,n,r,s,o){try{var a=t[s](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(n,r)}function ow(t){return function(){var e=this,i=arguments;return new Promise(function(n,r){var s=t.apply(e,i);function o(t){sw(s,n,r,o,a,"next",t)}function a(t){sw(s,n,r,o,a,"throw",t)}o(void 0)})}}function aw(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,s,o,a=[],l=!0,h=!1;try{if(s=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=s.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw r}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return lw(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?lw(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function lw(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}Um.parse("#000000"),Um.parse("#FFFFFF"),Um.parse("#000000"),function(t=!1){Yx=t}(!0);var hw="EPSG:27700";function uw(t,e,i){var n=i&&i(t,e)||{};return fetch(n.url||t,{headers:n.headers||{}})}var cw=function(t){return function(e,i){var n=t(i,"Tile")||{},r=n.url||i,s=n.headers||{};fetch(r,{headers:s}).then(function(t){return t.blob()}).then(function(t){e.getImage().src=URL.createObjectURL(t)}).catch(function(){return e.setState(3)})}};function dw(t,e){var i=new Fd({resolutions:vd,origin:wd,tileSize:256});return new hf({projection:hw,tileGrid:i,tileUrlFunction:function(e){var i=aw(e,3),n=i[0],r=i[1],s=i[2];return t.replace("{z}",n).replace("{x}",r).replace("{y}",s)},tileLoadFunction:e?cw(e):void 0})}function fw(t,e){return pw.apply(this,arguments)}function pw(){return(pw=ow(nw().m(function t(e,i){var n;return nw().w(function(t){for(;;)switch(t.n){case 0:if("raster"!==e.type){t.n=1;break}return n=dw(e.url,i),t.a(2,{layer:new Of({source:n}),source:n});case 1:if("ogc-vt"!==e.type){t.n=2;break}return t.a(2,vw(e.url,i,e));case 2:return t.a(2,yw(e.url,i,e))}},t)}))).apply(this,arguments)}function gw(t,e){var i=t.indexOf("?"),n=aw(i>=0?[t.slice(0,i),t.slice(i)]:[t,""],2),r=n[0],s=n[1],o="".concat(r,".json").concat(s),a="".concat(r,".png").concat(s);return{jsonUrl:o,pngUrl:a,fetch:function(){return uw(o,"SpriteJSON",e).then(function(t){return t.json()})}}}function mw(t){t.layers.forEach(function(t){var e;null!==(e=t.paint)&&void 0!==e&&e["icon-color"]&&(t.paint["icon-color"]=t.paint["icon-color"].replace(",0)",",1)"))})}function yw(t,e){return _w.apply(this,arguments)}function _w(){return _w=ow(nw().m(function t(e,i){var n,r,s,o,a,l,h,u,c,d,f,p,g,m,y,_=arguments;return nw().w(function(t){for(;;)switch(t.n){case 0:return n=(_.length>2&&void 0!==_[2]?_[2]:{}).renderMode,t.n=1,uw(e,"Style",i).then(function(t){return t.json()});case 1:return r=t.v,s=Object.keys(r.sources)[0],o=r.sources[s].url,t.n=2,uw(o,"Source",i).then(function(t){return t.json()});case 2:return a=t.v,l=[a.fullExtent.xmin,a.fullExtent.ymin,a.fullExtent.xmax,a.fullExtent.ymax],h=[a.tileInfo.origin.x,a.tileInfo.origin.y],u=a.tileInfo.lods.map(function(t){return t.resolution}).slice(0,16),c=a.tileInfo.rows,d=a.tiles[0],f=gw(r.sprite,i),t.n=3,f.fetch();case 3:return p=t.v,mw(r),g=new Fd({extent:l,origin:h,resolutions:u,tileSize:c}),m=new gf({format:new Rg,url:d,projection:hw,tileGrid:g}),Jx(y=new Rp(ew({source:m,declutter:!0},n&&{renderMode:n})),r,s,u,p,f.pngUrl),t.a(2,{layer:y,source:m})}},t)})),_w.apply(this,arguments)}function vw(t,e){return xw.apply(this,arguments)}function xw(){return xw=ow(nw().m(function t(e,i){var n,r,s,o,a,l,h,u,c,d,f,p,g,m,y,_,v,x,w,b=arguments;return nw().w(function(t){for(;;)switch(t.n){case 0:return r=(b.length>2&&void 0!==b[2]?b[2]:{}).renderMode,t.n=1,uw(e,"Style",i).then(function(t){return t.json()});case 1:return s=t.v,o=Object.keys(s.sources)[0],a=s.sources[o].url,l=gw(s.sprite,i),t.n=2,uw(a,"Source",i).then(function(t){return t.json()});case 2:return h=t.v,u=null===(n=h.links)||void 0===n?void 0:n.find(function(t){return"http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme"===t.rel}),t.n=3,Promise.all([uw(u.href,"Source",i).then(function(t){return t.json()}),l.fetch()]);case 3:return c=t.v,d=aw(c,2),f=d[0],p=d[1],g=f.tileMatrices.map(function(t){return t.cellSize}),m=f.tileMatrices[0].pointOfOrigin,y=[f.tileMatrices[0].tileHeight,f.tileMatrices[0].tileWidth],(_=new Rg).supportedMediaTypes.push("application/octet-stream"),v=new Fd({resolutions:g,origin:m,tileSize:y}),x=new qp({url:a,format:_,tileGrid:v,projection:hw}),Jx(w=new Rp(ew({source:x,declutter:!0},r&&{renderMode:r})),s,o,g,p,l.pngUrl),t.a(2,{layer:w,source:x})}},t)})),xw.apply(this,arguments)}function ww(){var t,e,i="function"==typeof Symbol?Symbol:{},n=i.iterator||"@@iterator",r=i.toStringTag||"@@toStringTag";function s(i,n,r,s){var l=n&&n.prototype instanceof a?n:a,h=Object.create(l.prototype);return bw(h,"_invoke",function(i,n,r){var s,a,l,h=0,u=r||[],c=!1,d={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,i){return s=e,a=0,l=t,d.n=i,o}};function f(i,n){for(a=i,l=n,e=0;!c&&h&&!r&&e<u.length;e++){var r,s=u[e],f=d.p,p=s[2];i>3?(r=p===n)&&(l=s[(a=s[4])?5:(a=3,3)],s[4]=s[5]=t):s[0]<=f&&((r=i<2&&f<s[1])?(a=0,d.v=n,d.n=s[1]):f<p&&(r=i<3||s[0]>n||n>p)&&(s[4]=i,s[5]=n,d.n=p,a=0))}if(r||i>1)return o;throw c=!0,n}return function(r,u,p){if(h>1)throw TypeError("Generator is already running");for(c&&1===u&&f(u,p),a=u,l=p;(e=a<2?t:l)||!c;){s||(a?a<3?(a>1&&(d.n=-1),f(a,l)):d.n=l:d.v=l);try{if(h=2,s){if(a||(r="next"),e=s[r]){if(!(e=e.call(s,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,a<2&&(a=0)}else 1===a&&(e=s.return)&&e.call(s),a<2&&(l=TypeError("The iterator does not provide a '"+r+"' method"),a=1);s=t}else if((e=(c=d.n<0)?l:i.call(n,d))!==o)break}catch(e){s=t,a=1,l=e}finally{h=1}}return{value:e,done:c}}}(i,r,s),!0),h}var o={};function a(){}function l(){}function h(){}e=Object.getPrototypeOf;var u=[][n]?e(e([][n]())):(bw(e={},n,function(){return this}),e),c=h.prototype=a.prototype=Object.create(u);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,bw(t,r,"GeneratorFunction")),t.prototype=Object.create(c),t}return l.prototype=h,bw(c,"constructor",h),bw(h,"constructor",l),l.displayName="GeneratorFunction",bw(h,r,"GeneratorFunction"),bw(c),bw(c,r,"Generator"),bw(c,n,function(){return this}),bw(c,"toString",function(){return"[object Generator]"}),(ww=function(){return{w:s,m:d}})()}function bw(t,e,i,n){var r=Object.defineProperty;try{r({},"",{})}catch(t){r=0}bw=function(t,e,i,n){function s(e,i){bw(t,e,function(t){return this._invoke(e,i,t)})}e?r?r(t,e,{value:i,enumerable:!n,configurable:!n,writable:!n}):t[e]=i:(s("next",0),s("throw",1),s("return",2))},bw(t,e,i,n)}function Sw(t,e,i,n,r,s,o){try{var a=t[s](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(n,r)}function Mw(t){var e=t.mapProvider,i=t.transformRequest,n=t.events,r=t.eventBus,s=t.map,o=t.onBaseSourceChange,a=function(){var t,a=(t=ww().m(function t(a){var l,h,u;return ww().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,fw(a,i);case 1:l=t.v,h=l.layer,u=l.source,s.getLayers().setAt(0,h),o(u),r.emit(n.MAP_STYLE_CHANGE,{mapStyleId:a.id}),e.reapplyHighlights();case 2:return t.a(2)}},t)}),function(){var e=this,i=arguments;return new Promise(function(n,r){var s=t.apply(e,i);function o(t){Sw(s,n,r,o,a,"next",t)}function a(t){Sw(s,n,r,o,a,"throw",t)}o(void 0)})});return function(t){return a.apply(this,arguments)}}(),l=function(t){s.setPixelRatio(t)},h=function(t){var i=t.mapSize;e.mapSize=i};return r.on(n.MAP_SET_STYLE,a),r.on(n.MAP_SET_PIXEL_RATIO,l),r.on(n.MAP_SIZE_CHANGE,h),{remove:function(){r.off(n.MAP_SET_STYLE,a),r.off(n.MAP_SET_PIXEL_RATIO,l),r.off(n.MAP_SIZE_CHANGE,h)}}}function Ew(t,e,i){if(null!==t)for(var n,r,s,o,a,l,h,u,c=0,d=0,f=t.type,p="FeatureCollection"===f,g="Feature"===f,m=p?t.features.length:1,y=0;y<m;y++){a=(u=!!(h=p?t.features[y].geometry:g?t.geometry:t)&&"GeometryCollection"===h.type)?h.geometries.length:1;for(var _=0;_<a;_++){var v=0,x=0;if(null!==(o=u?h.geometries[_]:h)){l=o.coordinates;var w=o.type;switch(c=!i||"Polygon"!==w&&"MultiPolygon"!==w?0:1,w){case null:break;case"Point":if(!1===e(l,d,y,v,x))return!1;d++,v++;break;case"LineString":case"MultiPoint":for(n=0;n<l.length;n++){if(!1===e(l[n],d,y,v,x))return!1;d++,"MultiPoint"===w&&v++}"LineString"===w&&v++;break;case"Polygon":case"MultiLineString":for(n=0;n<l.length;n++){for(r=0;r<l[n].length-c;r++){if(!1===e(l[n][r],d,y,v,x))return!1;d++}"MultiLineString"===w&&v++,"Polygon"===w&&x++}"Polygon"===w&&v++;break;case"MultiPolygon":for(n=0;n<l.length;n++){for(x=0,r=0;r<l[n].length;r++){for(s=0;s<l[n][r].length-c;s++){if(!1===e(l[n][r][s],d,y,v,x))return!1;d++}x++}v++}break;case"GeometryCollection":for(n=0;n<o.geometries.length;n++)if(!1===Ew(o.geometries[n],e,i))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}var Cw=function(t,e={}){if(null!=t.bbox&&!0!==e.recompute)return t.bbox;const i=[1/0,1/0,-1/0,-1/0];return Ew(t,t=>{i[0]>t[0]&&(i[0]=t[0]),i[1]>t[1]&&(i[1]=t[1]),i[2]<t[0]&&(i[2]=t[0]),i[3]<t[1]&&(i[3]=t[1])}),i};function Pw(t){return function(t){if(Array.isArray(t))return kw(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Tw(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Iw(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,s,o,a=[],l=!0,h=!1;try{if(s=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=s.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw r}}return a}}(t,e)||Tw(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Tw(t,e){if(t){if("string"==typeof t)return kw(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?kw(t,e):void 0}}function kw(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}var Rw=function(t){var e=t/1609.344;if(e<.5)return"".concat(Math.round(t),"m");if(e<10){var i=Number.parseFloat(e.toFixed(1)),n=1===i?"mile":"miles";return"".concat(i," ").concat(n)}var r=Math.round(e);return"".concat(r," miles")},Aw=function(t,e,i){for(var n=[],r=e;r<i;r+=2)n.push([t[r],t[r+1]]);return n},Gw=function(t){var e=t.getType(),i=t.getFlatCoordinates();if("Point"===e)return{type:"Point",coordinates:[i[0],i[1]]};if("LineString"===e)return{type:"LineString",coordinates:Aw(i,0,i.length)};if("Polygon"===e){var n=t.getEnds(),r=0;return{type:"Polygon",coordinates:n.map(function(t){var e=Aw(i,r,t);return r=t,e})}}if("MultiPolygon"===e){var s=t.getEndss(),o=0,a=s.map(function(t){var e=o,n=t.map(function(t){var n=Aw(i,e,t);return e=t,n});return o=t[t.length-1],n});return{type:"MultiPolygon",coordinates:a}}return{type:e,coordinates:Aw(i,0,i.length)}},Ow=function(t,e,i,n){var r=[];return t.getLayers().forEach(function(t){if(t instanceof Rp){var s=t.getSource(),o=null==s?void 0:s.sourceTiles_;o&&Object.values(o).forEach(function(t){2===t.getState()&&t.getFeatures().forEach(function(t){var s;if((null===(s=t.get("mapbox-layer"))||void 0===s?void 0:s.id)===e){var o=n?t.get(n):t.getId();String(o)===String(i)&&r.push(Gw(t))}})})}}),r};function Fw(t){return Fw="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fw(t)}function Lw(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function jw(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Lw(Object(i),!0).forEach(function(e){Nw(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Lw(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function Nw(t,e,i){return(e=function(t){var e=function(t){if("object"!=Fw(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=Fw(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Fw(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Dw(t){return function(t){if(Array.isArray(t))return $w(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||qw(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function zw(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=qw(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function qw(t,e){if(t){if("string"==typeof t)return $w(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?$w(t,e):void 0}}function $w(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}var Bw="EPSG:27700",Uw=new Lg({dataProjection:Bw,featureProjection:Bw}),Ww="_highlight",Xw=function(t,e){if(!t)return[];var i=t.stroke,n=t.selectionStroke,r=t.fill,s=t.strokeWidth,o=t.activeStrokeWidth;if(e)return[new _l({stroke:new fl({color:i,width:o}),zIndex:999}),new _l({stroke:new fl({color:n,width:s}),zIndex:1e3})];var a=[new _l({stroke:new fl({color:n,width:s}),zIndex:999})];return r&&"transparent"!==r&&a.push(new _l({fill:new ll({color:r}),zIndex:999})),a},Vw=function(t){var e,i=new Set,n={},r=zw(null!=t?t:[]);try{for(r.s();!(e=r.n()).done;){var s=e.value,o=s.layerId,a=s.featureId,l=s.idProperty;i.add("".concat(o,":").concat(a)),l&&(n[o]=l)}}catch(t){r.e(t)}finally{r.f()}return{keys:i,idProps:n}},Kw=function(t,e,i,n){var r,s=zw(null!=e?e:[]);try{for(s.s();!(r=s.n()).done;){var o=r.value,a=o.layerId,l=o.geometry;if(l){var h=Xw(null==n?void 0:n[a],i);if(h.length){var u=new _g({geometry:Uw.readGeometry(l)});u.setStyle(h),t.addFeature(u)}}}}catch(t){s.e(t)}finally{s.f()}},Zw=function(t,e){var i=t.type,n=t.coordinates,r=function(t){var i,n,r=(n=2,function(t){if(Array.isArray(t))return t}(i=t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,s,o,a=[],l=!0,h=!1;try{if(s=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=s.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw r}}return a}}(i,n)||qw(i,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),s=r[0],o=r[1];return e(s,o)},s=function(t){return t.forEach(r)};"Point"===i?r(n):"MultiPoint"===i||"LineString"===i?n.forEach(r):"MultiLineString"===i||"Polygon"===i?n.forEach(s):"MultiPolygon"===i&&n.forEach(function(t){return t.forEach(s)})},Yw=function(t,e,i,n){if(!t)return null;var r=new Set;t.getLayers().forEach(function(t){if(t instanceof Ng&&!t.get(Ww)){var e=t.get("layerId");e&&r.add(e)}});var s=Vw(e),o=s.keys,a=s.idProps,l=Vw(i),h=l.keys,u=l.idProps,c=jw(jw({},a),u);!function(t,e,i,n,r){t.getLayers().forEach(function(t){if(t instanceof Rp)if(e.size>0||i.size>0){t._highlightOriginalStyle||(t._highlightOriginalStyle=t.getStyleFunction());var s=t._highlightOriginalStyle;t.setStyle(function(t,o){var a,l=s(t,o),h=null===(a=t.get("mapbox-layer"))||void 0===a?void 0:a.id;if(!h)return l;var u=n[h],c=u?t.get(u):t.getId(),d="".concat(h,":").concat(c),f=i.has(d),p=!f&&e.has(d);if(!f&&!p)return l;var g=Xw(null==r?void 0:r[h],f);if(!g.length)return l;var m=l?Array.isArray(l)?l:[l]:[];return[].concat(Dw(m),Dw(g))})}else t._highlightOriginalStyle&&(t.setStyle(t._highlightOriginalStyle),delete t._highlightOriginalStyle)})}(t,o,h,c,n);var d=function(t){var e=null;return t.getLayers().forEach(function(t){t.get(Ww)&&(e=t)}),e||((e=new Ng({source:new Ug,zIndex:1001})).set(Ww,!0),t.addLayer(e)),e}(t),f=d.getSource();f.clear();var p=(null!=e?e:[]).filter(function(t){return r.has(t.layerId)}),g=(null!=i?i:[]).filter(function(t){return r.has(t.layerId)});Kw(f,g,!0,n),Kw(f,p,!1,n);var m=(null!=e?e:[]).flatMap(function(e){return function(t,e){var i=e.layerId,n=e.featureId,r=e.idProperty,s=e.geometry;if(null!=n){var o=Ow(t,i,n,r);if(o.length>0)return o}return s?[s]:[]}(t,e)});return function(t){if(!t.length)return null;var e,i=1/0,n=1/0,r=-1/0,s=-1/0,o=zw(t);try{for(o.s();!(e=o.n()).done;){var a=e.value;Zw(a,function(t,e){t<i&&(i=t),e<n&&(n=e),t>r&&(r=t),e>s&&(s=e)})}}catch(t){o.e(t)}finally{o.f()}return i===1/0?null:[i,n,r,s]}(m)};function Hw(t){return Hw="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hw(t)}function Jw(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function Qw(t,e,i){return(e=function(t){var e=function(t){if("object"!=Hw(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=Hw(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Hw(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}var tb="EPSG:27700",eb=new Lg({dataProjection:tb,featureProjection:tb});function ib(t){return ib="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ib(t)}function nb(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function rb(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?nb(Object(i),!0).forEach(function(e){sb(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):nb(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function sb(t,e,i){return(e=function(t){var e=function(t){if("object"!=ib(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=ib(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ib(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function ob(t){return ob="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ob(t)}function ab(){var t,e,i="function"==typeof Symbol?Symbol:{},n=i.iterator||"@@iterator",r=i.toStringTag||"@@toStringTag";function s(i,n,r,s){var l=n&&n.prototype instanceof a?n:a,h=Object.create(l.prototype);return lb(h,"_invoke",function(i,n,r){var s,a,l,h=0,u=r||[],c=!1,d={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,i){return s=e,a=0,l=t,d.n=i,o}};function f(i,n){for(a=i,l=n,e=0;!c&&h&&!r&&e<u.length;e++){var r,s=u[e],f=d.p,p=s[2];i>3?(r=p===n)&&(l=s[(a=s[4])?5:(a=3,3)],s[4]=s[5]=t):s[0]<=f&&((r=i<2&&f<s[1])?(a=0,d.v=n,d.n=s[1]):f<p&&(r=i<3||s[0]>n||n>p)&&(s[4]=i,s[5]=n,d.n=p,a=0))}if(r||i>1)return o;throw c=!0,n}return function(r,u,p){if(h>1)throw TypeError("Generator is already running");for(c&&1===u&&f(u,p),a=u,l=p;(e=a<2?t:l)||!c;){s||(a?a<3?(a>1&&(d.n=-1),f(a,l)):d.n=l:d.v=l);try{if(h=2,s){if(a||(r="next"),e=s[r]){if(!(e=e.call(s,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,a<2&&(a=0)}else 1===a&&(e=s.return)&&e.call(s),a<2&&(l=TypeError("The iterator does not provide a '"+r+"' method"),a=1);s=t}else if((e=(c=d.n<0)?l:i.call(n,d))!==o)break}catch(e){s=t,a=1,l=e}finally{h=1}}return{value:e,done:c}}}(i,r,s),!0),h}var o={};function a(){}function l(){}function h(){}e=Object.getPrototypeOf;var u=[][n]?e(e([][n]())):(lb(e={},n,function(){return this}),e),c=h.prototype=a.prototype=Object.create(u);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,lb(t,r,"GeneratorFunction")),t.prototype=Object.create(c),t}return l.prototype=h,lb(c,"constructor",h),lb(h,"constructor",l),l.displayName="GeneratorFunction",lb(h,r,"GeneratorFunction"),lb(c),lb(c,r,"Generator"),lb(c,n,function(){return this}),lb(c,"toString",function(){return"[object Generator]"}),(ab=function(){return{w:s,m:d}})()}function lb(t,e,i,n){var r=Object.defineProperty;try{r({},"",{})}catch(t){r=0}lb=function(t,e,i,n){function s(e,i){lb(t,e,function(t){return this._invoke(e,i,t)})}e?r?r(t,e,{value:i,enumerable:!n,configurable:!n,writable:!n}):t[e]=i:(s("next",0),s("throw",1),s("return",2))},lb(t,e,i,n)}function hb(t,e,i,n,r,s,o){try{var a=t[s](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(n,r)}function ub(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,cb(n.key),n)}}function cb(t){var e=function(t){if("object"!=ob(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=ob(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ob(e)?e:e+""}!function(){if("undefined"!=typeof HTMLCanvasElement){var t=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=function(e,i){for(var n=arguments.length,r=new Array(n>2?n-2:0),s=2;s<n;s++)r[s-2]=arguments[s];return t.call.apply(t,[this,e,"2d"===e?rb(rb({},i),{},{willReadFrequently:!0}):i].concat(r))}}}();var db="EPSG:27700",fb=function(t){if(t){var e=t.top,i=void 0===e?0:e,n=t.right,r=void 0===n?0:n,s=t.bottom,o=void 0===s?0:s,a=t.left;return[i,r,o,void 0===a?0:a]}};yd.defs(db,"+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs"),function(t){_d=t;const e=Object.keys(t.defs),i=e.length;let n,r;for(n=0;n<i;++n){const i=e[n];if(!Ae(i)){const e=t.defs(i);let n=e.units;n||"longlat"!==e.projName||(n="degrees"),di(new ve({code:i,axisOrientation:e.axis,metersPerUnit:e.to_meter,units:n}))}}for(n=0;n<i;++n){const s=e[n],o=Ae(s);for(r=0;r<i;++r){const i=e[r],n=Ae(i);if(!Fe(s,i))if(t.defs[s]===t.defs[i])gi([o,n]);else{const e=t(s,i);_i(o,n,Ai(o,n,e.forward),Ai(n,o,e.inverse))}}}}(yd);var pb=function(){return t=function t(e){var i=e.mapProviderConfig,n=void 0===i?{}:i,r=e.events,s=e.eventBus;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.events=r,this.eventBus=s,this.capabilities={supportedShortcuts:Sd,supportsMapSizes:!0},Object.assign(this,n)},e=[{key:"name",get:function(){return"OpenLayersProvider"}},{key:"initMap",value:(i=ab().m(function t(e){var i,n,r,s,o,a,l,h,u,c,d,f,p,g,m,y,_,v,x,w;return ab().w(function(t){for(;;)switch(t.n){case 0:return n=e.container,r=e.padding,s=e.mapStyle,o=e.mapSize,a=e.center,l=e.zoom,h=e.bounds,u=e.minZoom,c=e.maxZoom,d=e.transformRequest,f=e.pixelRatio,this.mapStyleId=null==s?void 0:s.id,this.mapSize=o,p=this.events,g=this.eventBus,t.n=1,fw(s,d);case 1:m=t.v,y=m.layer,_=m.source,v=Md(null!==(i=this.zoomAlignment)&&void 0!==i?i:"uk"),x=new Yn({projection:db,center:a,zoom:null!=l?l:v.defaultMinZoom,minZoom:Math.max(null!=u?u:v.defaultMinZoom,v.defaultMinZoom),maxZoom:null!=c?c:v.maxZoom,resolutions:v.resolutions,constrainResolution:!1,padding:fb(r)}),w=new Ql({target:n,layers:[y],view:x,controls:[],interactions:Kr({doubleClickZoom:!1}),pixelRatio:f}),h&&w.once("rendercomplete",function(){x.fit(h,{size:w.getSize(),duration:0})}),this.mapEventHandles=Id({map:w,source:_,events:p,eventBus:g,getZoom:this.getZoom.bind(this),getCenter:this.getCenter.bind(this),getBounds:this.getBounds.bind(this),getResolution:this.getResolution.bind(this)}),this.appEventHandles=Mw({mapProvider:this,transformRequest:d,events:p,eventBus:g,map:w,onBaseSourceChange:this.mapEventHandles.setSource})||[],this.map=w,this.view=x,g.emit(p.MAP_READY,{map:this.map,mapStyleId:this.mapStyleId,mapSize:this.mapSize,crs:this.crs});case 2:return t.a(2)}},t,this)}),n=function(){var t=this,e=arguments;return new Promise(function(n,r){var s=i.apply(t,e);function o(t){hb(s,n,r,o,a,"next",t)}function a(t){hb(s,n,r,o,a,"throw",t)}o(void 0)})},function(t){return n.apply(this,arguments)})},{key:"destroyMap",value:function(){var t,e;null===(t=this.mapEventHandles)||void 0===t||t.remove(),null===(e=this.appEventHandles)||void 0===e||e.remove(),this.mapEventHandles=null,this.appEventHandles=null,this.map&&(this._onHoverMove&&(this.map.un("pointermove",this._onHoverMove),this._onHoverMove=null),this.map.setTarget(null),this.map=null),this.view=null}},{key:"setView",value:function(t){var e=t.center,i=t.zoom;this.view.animate({center:null!=e?e:this.view.getCenter(),zoom:null!=i?i:this.view.getZoom(),duration:bd})}},{key:"zoomIn",value:function(t){this.view.animate({zoom:this.view.getZoom()+t,duration:bd})}},{key:"zoomOut",value:function(t){this.view.animate({zoom:this.view.getZoom()-t,duration:bd})}},{key:"panBy",value:function(t){var e=this.view.getCenter(),i=this.view.getResolution();this.view.animate({center:[e[0]+t[0]*i,e[1]-t[1]*i],duration:bd})}},{key:"fitToBounds",value:function(t){var e=Array.isArray(t)?t:Mi(Cw(t),"EPSG:4326","EPSG:27700");this.view.fit(e,{duration:bd})}},{key:"setPadding",value:function(t){this.view.padding=fb(t)}},{key:"getCenter",value:function(){var t=this.view.getCenter();return[Math.round(t[0]*Math.pow(10,2))/Math.pow(10,2),Math.round(t[1]*Math.pow(10,2))/Math.pow(10,2)]}},{key:"getZoom",value:function(){return this.view.getZoom()}},{key:"getBounds",value:function(){return this.view.calculateExtent(this.map.getSize()).map(function(t){return Math.round(100*t)/100})}},{key:"getFeaturesAtPoint",value:function(t,e){return function(t,e){if(!e)return[];var i=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).radius,n=void 0===i?10:i,r=[e.x,e.y],s=[],o=new Set;return t.forEachFeatureAtPixel(r,function(t,e){if(e instanceof Rp){var i=t.get("mapbox-layer"),n=null==i?void 0:i.id;if(!n||"background"===(null==i?void 0:i.type))return;var r="".concat(n,":").concat(function(t){var e=t.getId();if(null!=e)return e;var i=function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Jw(Object(i),!0).forEach(function(e){Qw(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Jw(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}({},t.getProperties());return delete i["mapbox-layer"],JSON.stringify(i)}(t));if(o.has(r))return;o.add(r),s.push({id:t.getId(),layer:{id:n},geometry:Gw(t),properties:t.getProperties()})}else if(e instanceof Ng){var a=e.get("layerId");if(!a||e.get("_highlight"))return;var l=t.getId(),h="".concat(a,":").concat(l);if(o.has(h))return;o.add(h),s.push({id:l,layer:{id:a},geometry:eb.writeGeometryObject(t.getGeometry()),properties:t.getProperties()})}},{hitTolerance:n}),s}(this.map,t,e)}},{key:"getFeatureGeometry",value:function(t,e,i){var n=Ow(this.map,t,e,i);return 0===n.length?null:1===n.length?n[0]:{type:"MultiPolygon",coordinates:n.flatMap(function(t){return"MultiPolygon"===t.type?t.coordinates:[t.coordinates]})}}},{key:"setHoverCursor",value:function(t){this.map&&(this._onHoverMove=function(t,e,i){var n=t.getViewport();if(i&&t.un("pointermove",i),null==e||!e.length)return n.style.cursor="",null;var r=new Set(e),s=null,o=function(e){var i;if("mouse"===(null===(i=e.originalEvent)||void 0===i?void 0:i.pointerType)){var o=e.pixel;null!==s&&cancelAnimationFrame(s),s=requestAnimationFrame(function(){s=null;var e=t.forEachFeatureAtPixel(o,function(t,e){return function(t,e,i){if(e instanceof Rp){var n,r=null===(n=t.get("mapbox-layer"))||void 0===n?void 0:n.id;return Boolean(r&&i.has(r))}if(e instanceof Ng&&!e.get("_highlight")){var s=e.get("layerId");return Boolean(s&&i.has(s))}return!1}(t,e,r)},{hitTolerance:8});n.style.cursor=e?"pointer":""})}};return t.on("pointermove",o),o}(this.map,t,this._onHoverMove))}},{key:"getVisibleFeatures",value:function(t){return[]}},{key:"updateHighlightedFeatures",value:function(t,e,i){return this._lastHighlightArgs={selectedFeatures:t,activeFeatures:e,stylesMap:i},Yw(this.map,t,e,i)}},{key:"reapplyHighlights",value:function(){if(this._lastHighlightArgs){var t=this._lastHighlightArgs,e=t.selectedFeatures,i=t.activeFeatures,n=t.stylesMap;Yw(this.map,e,i,n)}}},{key:"getAreaDimensions",value:function(){return function(t){if(!t)return"";var e=Iw(t,4),i=e[0],n=e[1],r=e[2],s=e[3],o=r-i;return"".concat(Rw(s-n)," by ").concat(Rw(o))}((e=(t=this.map).getSize(),n=(i=Iw(t.getView().padding||[0,0,0,0],4))[0],r=i[1],s=i[2],o=[i[3],e[1]-s],a=[e[0]-r,n],l=t.getCoordinateFromPixel(o),h=t.getCoordinateFromPixel(a),l&&h?[l[0],l[1],h[0],h[1]]:null));var t,e,i,n,r,s,o,a,l,h}},{key:"getCardinalMove",value:function(t,e){return function(t,e){var i=e[0]-t[0],n=e[1]-t[1],r=[];return Math.abs(n)>1&&r.push("".concat(n>0?"north":"south"," ").concat(Rw(Math.abs(n)))),Math.abs(i)>1&&r.push("".concat(i>0?"east":"west"," ").concat(Rw(Math.abs(i)))),r.join(", ")}(t,e)}},{key:"getResolution",value:function(){return this.view.getResolution()}},{key:"mapToScreen",value:function(t){if(!this.map)return{x:0,y:0};var e=this.map.getPixelFromCoordinate(t);return e?{x:e[0],y:e[1]}:{x:0,y:0}}},{key:"screenToMap",value:function(t){return this.map.getCoordinateFromPixel([t.x,t.y])}},{key:"isGeometryObscured",value:function(t,e){return function(t,e,i){var n=i.getTargetElement().getBoundingClientRect();if(!n.width||!n.height)return!1;var r=i.getViewport().getBoundingClientRect(),s=r.width/n.width,o=r.height/n.height,a=function(t){return Cw(t)}(t),l=Iw(a,4),h=l[0],u=l[1],c=l[2],d=l[3],f=[[h,u],[h,d],[c,u],[c,d]].map(function(t){return i.getPixelFromCoordinate(t)}).filter(Boolean);if(!f.length)return!1;var p=n.left+Math.min.apply(Math,Pw(f.map(function(t){return t[0]})))*s,g=n.left+Math.max.apply(Math,Pw(f.map(function(t){return t[0]})))*s,m=n.top+Math.min.apply(Math,Pw(f.map(function(t){return t[1]})))*o,y=n.top+Math.max.apply(Math,Pw(f.map(function(t){return t[1]})))*o;return p<e.right&&g>e.left&&m<e.bottom&&y>e.top}(t,e,this.map)}}],e&&ub(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i,n}()}}]);
2
+ "use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[142],{93(t,e,i){i.r(e),i.d(e,{default:()=>Eb});const n="add",r="remove",s="propertychange";function o(t){for(const e in t)delete t[e]}function a(t){let e;for(e in t)return!1;return!e}function l(t,e,i,n,r){if(r){const r=i;i=function(s){return t.removeEventListener(e,i),r.call(n??this,s)}}else n&&n!==t&&(i=i.bind(n));const s={target:t,type:e,listener:i};return t.addEventListener(e,i),s}function h(t,e,i,n){return l(t,e,i,n,!0)}function u(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),o(t))}const c="change",d="contextmenu",f="click",p="keydown",g="keypress",m="touchmove",y="wheel",_=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function v(t,e){return t>e?1:t<e?-1:0}function x(t,e){return t<e?1:t>e?-1:0}function w(t,e,i){if(t[0]<=e)return 0;const n=t.length;if(e<=t[n-1])return n-1;if("function"==typeof i){for(let r=1;r<n;++r){const n=t[r];if(n===e)return r;if(n<e)return i(e,t[r-1],n)>0?r-1:r}return n-1}if(i>0){for(let i=1;i<n;++i)if(t[i]<e)return i-1;return n-1}if(i<0){for(let i=1;i<n;++i)if(t[i]<=e)return i;return n-1}for(let i=1;i<n;++i){if(t[i]==e)return i;if(t[i]<e)return t[i-1]-e<e-t[i]?i-1:i}return n-1}function b(t,e,i){for(;e<i;){const n=t[e];t[e]=t[i],t[i]=n,++e,--i}}function S(t,e){const i=Array.isArray(e)?e:[e],n=i.length;for(let e=0;e<n;e++)t[t.length]=i[e]}function M(t,e){const i=t.length;if(i!==e.length)return!1;for(let n=0;n<i;n++)if(t[n]!==e[n])return!1;return!0}function E(){return!0}function C(){return!1}function P(){}function I(t){let e,i,n;return function(){const r=Array.prototype.slice.call(arguments);return i&&this===n&&M(r,i)||(n=this,i=r,e=t.apply(this,arguments)),e}}function T(t){return function(){let e;try{e=t()}catch(t){return Promise.reject(t)}return e instanceof Promise?e:Promise.resolve(e)}()}const R=class{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}},k=class extends _{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),n=i[t]||(i[t]=[]);n.includes(e)||n.push(e)}dispatchEvent(t){const e="string"==typeof t,i=e?t:t.type,n=this.listeners_&&this.listeners_[i];if(!n)return;const r=e?new R(t):t;r.target||(r.target=this.eventTarget_||this);const s=this.dispatching_||(this.dispatching_={}),o=this.pendingRemovals_||(this.pendingRemovals_={});let a;i in s||(s[i]=0,o[i]=0),++s[i];for(let t=0,e=n.length;t<e;++t)if(a="handleEvent"in n[t]?n[t].handleEvent(r):n[t].call(this,r),!1===a||r.propagationStopped){a=!1;break}if(0===--s[i]){let t=o[i];for(delete o[i];t--;)this.removeEventListener(i,P);delete s[i]}return a}disposeInternal(){this.listeners_&&o(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return!!this.listeners_&&(t?t in this.listeners_:Object.keys(this.listeners_).length>0)}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const n=i.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=P,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}};class A extends k{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(c)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=l(this,t[r],e);return n}return l(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const n=t.length;i=new Array(n);for(let r=0;r<n;++r)i[r]=h(this,t[r],e)}else i=h(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)!function(t){if(Array.isArray(t))for(let e=0,i=t.length;e<i;++e)u(t[e]);else u(t)}(i);else if(Array.isArray(t))for(let i=0,n=t.length;i<n;++i)this.removeEventListener(t[i],e);else this.removeEventListener(t,e)}}A.prototype.on,A.prototype.once,A.prototype.un;const G=A;function O(){throw new Error("Unimplemented abstract method.")}let F=0;function L(t){return t.ol_uid||(t.ol_uid=String(++F))}class j extends R{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}const N=class extends G{constructor(t){super(),this.on,this.once,this.un,L(this),this.values_=null,void 0!==t&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new j(i,t,e)),i=s,this.hasListener(i)&&this.dispatchEvent(new j(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const n=this.values_||(this.values_={});if(i)n[t]=e;else{const i=n[t];n[t]=e,i!==e&&this.notify(t,i)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],a(this.values_)&&(this.values_=null),e||this.notify(t,i)}}},D="length";class z extends R{constructor(t,e,i){super(t),this.element=e,this.index=i}}const q=class extends N{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t??[],this.unique_)for(let t=1,e=this.array_.length;t<e;++t)this.assertUnique_(this.array_[t],t);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,i=t.length;e<i;++e)this.push(t[e]);return this}forEach(t){const e=this.array_;for(let i=0,n=e.length;i<n;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(D)}insertAt(t,e){if(t<0||t>this.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new z(n,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,n=e.length;i<n;++i)if(e[i]===t)return this.removeAt(i)}removeAt(t){if(t<0||t>=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new z(r,e,t)),e}setAt(t,e){if(t>=this.getLength())return void this.insertAt(t,e);if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const i=this.array_[t];this.array_[t]=e,this.dispatchEvent(new z(r,i,t)),this.dispatchEvent(new z(n,e,t))}updateLength_(){this.set(D,this.array_.length)}assertUnique_(t,e){const i=this.array_;for(let n=0,r=i.length;n<r;++n)if(i[n]===t&&n!==e)throw new Error("Duplicate item added to a unique collection")}},$=class extends R{constructor(t,e,i){super(t),this.map=e,this.frameState=void 0!==i?i:null}},B=class extends ${constructor(t,e,i,n,r,s){super(t,e,r),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=void 0!==n&&n,this.activePointers=s}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(t){this.pixel_=t}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(t){this.coordinate_=t}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}},U={SINGLECLICK:"singleclick",CLICK:f,DBLCLICK:"dblclick",POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},W="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"",X=(W.includes("safari")&&!W.includes("chrom")&&(W.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(W)),W.includes("webkit")&&!W.includes("edge")),V=W.includes("macintosh"),K="undefined"!=typeof devicePixelRatio?devicePixelRatio:1,Y="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,Z="undefined"!=typeof Image&&Image.prototype.decode,H=function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch{}return t}(),J="pointerdown",Q=class extends k{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=void 0===e?1:e,this.down_=null;const i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=l(i,J,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=l(i,"pointermove",this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(m,this.boundHandleTouchMove_,!!H&&{passive:!1})}emulateClick_(t){let e=new B(U.CLICK,this.map_,t);this.dispatchEvent(e),void 0!==this.clickTimeoutId_?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new B(U.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const e=new B(U.SINGLECLICK,this.map_,t);this.dispatchEvent(e)},250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==U.POINTERUP||e.type==U.POINTERCANCEL){delete this.trackedTouches_[i];for(const t in this.trackedTouches_)if(this.trackedTouches_[t].target!==e.target){delete this.trackedTouches_[t];break}}else e.type!=U.POINTERDOWN&&e.type!=U.POINTERMOVE||(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new B(U.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),0===this.activePointers_.length&&(this.dragListenerKeys_.forEach(u),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return 0===t.button}handlePointerDown_(t){this.emulateClicks_=0===this.activePointers_.length,this.updateActivePointers_(t);const e=new B(U.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),0===this.dragListenerKeys_.length){const t=this.map_.getOwnerDocument();this.dragListenerKeys_.push(l(t,U.POINTERMOVE,this.handlePointerMove_,this),l(t,U.POINTERUP,this.handlePointerUp_,this),l(this.element_,U.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==t&&this.dragListenerKeys_.push(l(this.element_.getRootNode(),U.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new B(U.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!(!this.down_||!this.isMoving_(t));this.dispatchEvent(new B(U.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;e&&!e.defaultPrevented||"boolean"==typeof t.cancelable&&!0!==t.cancelable||t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(u(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(m,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(u(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(u),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},tt="postrender",et="loadstart",it="loadend",nt="layergroup",rt="size",st="target",ot="view";function at(t,e){if(!t)throw new Error(e)}const lt=1/0,ht=class{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,o(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const n=this.keyFunction_(i);return delete this.queuedElements_[n],i}enqueue(t){at(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=lt&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(t){return 2*t+1}getRightChildIndex_(t){return 2*t+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return 0===this.elements_.length}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,n=e.length,r=e[t],s=i[t],o=t;for(;t<n>>1;){const r=this.getLeftChildIndex_(t),s=this.getRightChildIndex_(t),o=s<n&&i[s]<i[r]?s:r;e[t]=e[o],i[t]=i[o],t=o}e[t]=r,i[t]=s,this.siftDown_(o,t)}siftDown_(t,e){const i=this.elements_,n=this.priorities_,r=i[e],s=n[e];for(;e>t;){const t=this.getParentIndex_(e);if(!(n[t]>s))break;i[e]=i[t],n[e]=n[t],e=t}i[e]=r,n[e]=s}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let n=0;const r=e.length;let s,o,a;for(o=0;o<r;++o)s=e[o],a=t(s),a==lt?delete this.queuedElements_[this.keyFunction_(s)]:(i[n]=a,e[n++]=s);e.length=n,i.length=n,this.heapify_()}},ut=class extends ht{constructor(t,e){super(e=>t.apply(null,e),t=>t[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);return e&&t[0].addEventListener(c,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(2===i||3===i||4===i){3!==i&&e.removeEventListener(c,this.boundHandleTileChange_);const t=e.getKey();t in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[t],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i=0;for(;this.tilesLoading_<t&&i<e&&this.getCount()>0;){const t=this.dequeue()[0],e=t.getKey();0!==t.getState()||e in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[e]=!0,++this.tilesLoading_,++i,t.load())}}},ct={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function dt(t,e,i){return Math.min(Math.max(t,e),i)}function ft(t,e,i,n,r,s){const o=r-i,a=s-n;if(0!==o||0!==a){const l=((t-i)*o+(e-n)*a)/(o*o+a*a);l>1?(i=r,n=s):l>0&&(i+=o*l,n+=a*l)}return pt(t,e,i,n)}function pt(t,e,i,n){const r=i-t,s=n-e;return r*r+s*s}function gt(t){return 180*t/Math.PI}function mt(t){return t*Math.PI/180}function yt(t,e){const i=t%e;return i*e<0?i+e:i}function _t(t,e,i){return t+i*(e-t)}function vt(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function xt(t,e){return Math.round(vt(t,e))}function wt(t,e){return Math.floor(vt(t,e))}function bt(t,e){return Math.ceil(vt(t,e))}function St(t,e,i){if(t>=e&&t<i)return t;const n=i-e;return((t-e)%n+n)%n+e}function Mt(t,e,i){return function(n,r,s,o,a){if(!n)return;if(!r&&!e)return n;const l=e?0:s[0]*r,h=e?0:s[1]*r,u=a?a[0]:0,c=a?a[1]:0;let d=t[0]+l/2+u,f=t[2]-l/2+u,p=t[1]+h/2+c,g=t[3]-h/2+c;d>f&&(d=(f+d)/2,f=d),p>g&&(p=(g+p)/2,g=p);let m=dt(n[0],d,f),y=dt(n[1],p,g);if(o&&i&&r){const t=30*r;m+=-t*Math.log(1+Math.max(0,d-n[0])/t)+t*Math.log(1+Math.max(0,n[0]-f)/t),y+=-t*Math.log(1+Math.max(0,p-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-g)/t)}return[m,y]}}function Et(t){return t}function Ct(t){const e=[1/0,1/0,-1/0,-1/0];for(let i=0,n=t.length;i<n;++i)zt(e,t[i]);return e}function Pt(t,e,i){return i?(i[0]=t[0]-e,i[1]=t[1]-e,i[2]=t[2]+e,i[3]=t[3]+e,i):[t[0]-e,t[1]-e,t[2]+e,t[3]+e]}function It(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t.slice()}function Tt(t,e,i){let n,r;return n=e<t[0]?t[0]-e:t[2]<e?e-t[2]:0,r=i<t[1]?t[1]-i:t[3]<i?i-t[3]:0,n*n+r*r}function Rt(t,e){return At(t,e[0],e[1])}function kt(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]}function At(t,e,i){return t[0]<=e&&e<=t[2]&&t[1]<=i&&i<=t[3]}function Gt(t,e){const i=t[0],n=t[1],r=t[2],s=t[3],o=e[0],a=e[1];let l=0;return o<i?l|=16:o>r&&(l|=4),a<n?l|=8:a>s&&(l|=2),0===l&&(l=1),l}function Ot(t,e,i,n,r){return r?(r[0]=t,r[1]=e,r[2]=i,r[3]=n,r):[t,e,i,n]}function Ft(t){return Ot(1/0,1/0,-1/0,-1/0,t)}function Lt(t,e){const i=t[0],n=t[1];return Ot(i,n,i,n,e)}function jt(t,e,i,n,r){return qt(Ft(r),t,e,i,n)}function Nt(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function Dt(t,e){return e[0]<t[0]&&(t[0]=e[0]),e[2]>t[2]&&(t[2]=e[2]),e[1]<t[1]&&(t[1]=e[1]),e[3]>t[3]&&(t[3]=e[3]),t}function zt(t,e){e[0]<t[0]&&(t[0]=e[0]),e[0]>t[2]&&(t[2]=e[0]),e[1]<t[1]&&(t[1]=e[1]),e[1]>t[3]&&(t[3]=e[1])}function qt(t,e,i,n,r){for(;i<n;i+=r)$t(t,e[i],e[i+1]);return t}function $t(t,e,i){t[0]=Math.min(t[0],e),t[1]=Math.min(t[1],i),t[2]=Math.max(t[2],e),t[3]=Math.max(t[3],i)}function Bt(t,e){let i;return i=e(Wt(t)),i||(i=e(Xt(t)),i||(i=e(te(t)),i||(i=e(Qt(t)),i||!1)))}function Ut(t){let e=0;return ne(t)||(e=ee(t)*Ht(t)),e}function Wt(t){return[t[0],t[1]]}function Xt(t){return[t[2],t[1]]}function Vt(t){return[(t[0]+t[2])/2,(t[1]+t[3])/2]}function Kt(t,e){let i;if("bottom-left"===e)i=Wt(t);else if("bottom-right"===e)i=Xt(t);else if("top-left"===e)i=Qt(t);else{if("top-right"!==e)throw new Error("Invalid corner");i=te(t)}return i}function Yt(t,e,i,n,r){const[s,o,a,l,h,u,c,d]=Zt(t,e,i,n);return Ot(Math.min(s,a,h,c),Math.min(o,l,u,d),Math.max(s,a,h,c),Math.max(o,l,u,d),r)}function Zt(t,e,i,n){const r=e*n[0]/2,s=e*n[1]/2,o=Math.cos(i),a=Math.sin(i),l=r*o,h=r*a,u=s*o,c=s*a,d=t[0],f=t[1];return[d-l+c,f-h-u,d-l-c,f-h+u,d+l-c,f+h+u,d+l+c,f+h-u,d-l+c,f-h-u]}function Ht(t){return t[3]-t[1]}function Jt(t,e,i){const n=i||[1/0,1/0,-1/0,-1/0];return ie(t,e)?(t[0]>e[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]<e[2]?n[2]=t[2]:n[2]=e[2],t[3]<e[3]?n[3]=t[3]:n[3]=e[3]):Ft(n),n}function Qt(t){return[t[0],t[3]]}function te(t){return[t[2],t[3]]}function ee(t){return t[2]-t[0]}function ie(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function ne(t){return t[2]<t[0]||t[3]<t[1]}function re(t,e){const i=e.getExtent(),n=Vt(t);if(e.canWrapX()&&(n[0]<i[0]||n[0]>=i[2])){const e=ee(i),r=Math.floor((n[0]-i[0])/e)*e;t[0]-=r,t[2]-=r}return t}function se(t,e,i){if(e.canWrapX()){const n=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[n[0],t[1],n[2],t[3]]];re(t,e);const r=ee(n);if(ee(t)>r&&!i)return[[n[0],t[1],n[2],t[3]]];if(t[0]<n[0])return[[t[0]+r,t[1],n[2],t[3]],[n[0],t[1],t[2],t[3]]];if(t[2]>n[2])return[[t[0],t[1],n[2],t[3]],[n[0],t[1],t[2]-r,t[3]]]}return[t]}function oe(t,e){let i=!0;for(let n=t.length-1;n>=0;--n)if(t[n]!=e[n]){i=!1;break}return i}function ae(t,e){const i=Math.cos(e),n=Math.sin(e),r=t[0]*i-t[1]*n,s=t[1]*i+t[0]*n;return t[0]=r,t[1]=s,t}function le(t,e){if(e.canWrapX()){const i=ee(e.getExtent()),n=he(t,e,i);n&&(t[0]-=n*i)}return t}function he(t,e,i){const n=e.getExtent();let r=0;return e.canWrapX()&&(t[0]<n[0]||t[0]>n[2])&&(i=i||ee(n),r=Math.floor((t[0]-n[0])/i)),r}function ue(t){return Math.pow(t,3)}function ce(t){return 1-ue(1-t)}function de(t){return 3*t*t-2*t*t*t}function fe(t){return t}const pe=2,ge=3;let me=1;function ye(...t){me>pe||console.warn(...t)}function _e(...t){me>ge||console.error(...t)}const ve={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937},xe=class{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||ve[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}},we=6378137,be=Math.PI*we,Se=[-be,-be,be,be],Me=[-180,-85,180,85],Ee=we*Math.log(Math.tan(Math.PI/2));class Ce extends xe{constructor(t){super({code:t,units:"m",extent:Se,global:!0,worldExtent:Me,getPointResolution:function(t,e){return t/Math.cosh(e[1]/we)}})}}const Pe=[new Ce("EPSG:3857"),new Ce("EPSG:102100"),new Ce("EPSG:102113"),new Ce("EPSG:900913"),new Ce("http://www.opengis.net/def/crs/EPSG/0/3857"),new Ce("http://www.opengis.net/gml/srs/epsg.xml#3857")];const Ie=[-180,-90,180,90],Te=6378137*Math.PI/180;class Re extends xe{constructor(t,e){super({code:t,units:"degrees",extent:Ie,axisOrientation:e,global:!0,metersPerUnit:Te,worldExtent:Ie})}}const ke=[new Re("CRS:84"),new Re("EPSG:4326","neu"),new Re("urn:ogc:def:crs:OGC:1.3:CRS84"),new Re("urn:ogc:def:crs:OGC:2:84"),new Re("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Re("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Re("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Ae={};function Ge(t){return Ae[t]||Ae[t.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}let Oe={};function Fe(t,e,i){const n=t.getCode(),r=e.getCode();n in Oe||(Oe[n]={}),Oe[n][r]=i}function Le(t,e){return t in Oe&&e in Oe[t]?Oe[t][e]:null}const je=.9996,Ne=.00669438,De=Ne*Ne,ze=De*Ne,qe=Ne/(1-Ne),$e=Math.sqrt(1-Ne),Be=(1-$e)/(1+$e),Ue=Be*Be,We=Ue*Be,Xe=We*Be,Ve=Xe*Be,Ke=.9983242984503243,Ye=15*De/256+45*ze/1024,Ze=35*ze/3072,He=1.5*Be-27/32*We+269/512*Ve,Je=21/16*Ue-55/32*Xe,Qe=151/96*We-417/128*Ve,ti=1097/512*Xe,ei=6378137;function ii(t,e,i){const n=t-5e5,r=(i.north?e:e-1e7)/je/(ei*Ke),s=r+He*Math.sin(2*r)+Je*Math.sin(4*r)+Qe*Math.sin(6*r)+ti*Math.sin(8*r),o=Math.sin(s),a=o*o,l=Math.cos(s),h=o/l,u=h*h,c=u*u,d=1-Ne*a,f=Math.sqrt(1-Ne*a),p=qe*l**2,g=p*p,m=n/(ei/f*je),y=m*m,_=y*m,v=_*m,x=v*m,w=s-h/((1-Ne)/d)*(y/2-v/24*(5+3*u+10*p-4*g-9*qe))+x*m/720*(61+90*u+298*p+45*c-252*qe-3*g);let b=(m-_/6*(1+2*u+p)+x/120*(5-2*p+28*u-3*g+8*qe+24*c))/l;return b=St(b+mt(ri(i.number)),-Math.PI,Math.PI),[gt(b),gt(w)]}function ni(t,e,i){t=St(t,-180,180),e<-80?e=-80:e>84&&(e=84);const n=mt(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,h=mt(t),u=mt(ri(i.number)),c=ei/Math.sqrt(1-Ne*r**2),d=qe*s**2,f=s*St(h-u,-Math.PI,Math.PI),p=f*f,g=p*f,m=g*f,y=m*f,_=y*f,v=ei*(Ke*n-.002514607064228144*Math.sin(2*n)+Ye*Math.sin(4*n)-Ze*Math.sin(6*n)),x=je*c*(f+g/6*(1-a+d)+y/120*(5-18*a+l+72*d-58*qe))+5e5;let w=je*(v+c*o*(p/2+m/24*(5-a+9*d+4*d**2)+_/720*(61-58*a+l+600*d-330*qe)));return i.north||(w+=1e7),[x,w]}function ri(t){return 6*(t-1)-180+3}const si=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function oi(t){let e=0;for(const i of si){const n=t.match(i);if(n){e=parseInt(n[1]);break}}if(!e)return null;let i=0,n=!1;return e>32700&&e<32761?i=e-32700:e>32600&&e<32661&&(n=!0,i=e-32600),i?{number:i,north:n}:null}function ai(t,e){return function(i,n,r,s){const o=i.length;r=r>1?r:2,s=s??r,n||(n=r>2?i.slice():new Array(o));for(let r=0;r<o;r+=s){const s=i[r],o=i[r+1],a=t(s,o,e);n[r]=a[0],n[r+1]=a[1]}return n}}function li(t,e,i){i=i||6371008.8;const n=mt(t[1]),r=mt(e[1]),s=(r-n)/2,o=mt(e[0]-t[0])/2,a=Math.sin(s)*Math.sin(s)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(r);return 2*i*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}const hi=[function(t){const e=oi(t.getCode());return e?{forward:ai(ni,e),inverse:ai(ii,e)}:null}],ui=[function(t){return oi(t)?new xe({code:t,units:"m"}):null}];let ci=!0;function di(t,e){if(void 0!==e)for(let i=0,n=t.length;i<n;++i)e[i]=t[i];else e=t.slice();return e}function fi(t){!function(t,e){Ae[t]=e}(t.getCode(),t),Fe(t,t,di)}function pi(t){if("string"!=typeof t)return t;const e=Ge(t);if(e)return e;for(const e of ui){const i=e(t);if(i)return i}return null}function gi(t,e,i,n){let r;const s=(t=pi(t)).getPointResolutionFunc();if(s){if(r=s(e,i),n&&n!==t.getUnits()){const e=t.getMetersPerUnit();e&&(r=r*e/ve[n])}}else{const s=t.getUnits();if("degrees"==s&&!n||"degrees"==n)r=e;else{const o=wi(t,pi("EPSG:4326"));if(o||"degrees"===s){let t=[i[0]-e/2,i[1],i[0]+e/2,i[1],i[0],i[1]-e/2,i[0],i[1]+e/2];t=o(t,t,2),r=(li(t.slice(0,2),t.slice(2,4))+li(t.slice(4,6),t.slice(6,8)))/2}else r=e*t.getMetersPerUnit();const a=n?ve[n]:t.getMetersPerUnit();void 0!==a&&(r/=a)}}return r}function mi(t){!function(t){t.forEach(fi)}(t),t.forEach(function(e){t.forEach(function(t){e!==t&&Fe(e,t,di)})})}function yi(t,e){return t?"string"==typeof t?pi(t):t:pi(e)}function _i(t){return function(e,i,n,r){const s=e.length;n=void 0!==n?n:2,r=r??n,i=void 0!==i?i:new Array(s);for(let o=0;o<s;o+=r){const s=t(e.slice(o,o+n)),a=s.length;for(let t=0,n=r;t<n;++t)i[o+t]=t>=a?e[o+t]:s[t]}return i}}function vi(t,e,i,n){const r=pi(t),s=pi(e);Fe(r,s,_i(i)),Fe(s,r,_i(n))}function xi(t,e){if(t===e)return!0;const i=t.getUnits()===e.getUnits();return(t.getCode()===e.getCode()||wi(t,e)===di)&&i}function wi(t,e){const i=t.getCode(),n=e.getCode();let r=Le(i,n);if(r)return r;let s=null,o=null;for(const i of hi)s||(s=i(t)),o||(o=i(e));if(!s&&!o)return null;const a="EPSG:4326";if(o)if(s)r=bi(s.inverse,o.forward);else{const t=Le(i,a);t&&(r=bi(t,o.forward))}else{const t=Le(a,n);t&&(r=bi(s.inverse,t))}return r&&(fi(t),fi(e),Fe(t,e,r)),r}function bi(t,e){return function(i,n,r,s){return n=t(i,n,r,s),e(n,n,r,s)}}function Si(t,e){return wi(pi(t),pi(e))}function Mi(t,e,i){const n=Si(e,i);if(!n){const t=pi(e).getCode(),n=pi(i).getCode();throw new Error(`No transform available between ${t} and ${n}`)}return n(t,void 0,t.length)}function Ei(t,e,i,n){return function(t,e,i,n){if(ne(t))return Ft(i);let r=[];if(n>1){const e=t[2]-t[0],i=t[3]-t[1];for(let s=0;s<n;++s)r.push(t[0]+e*s/n,t[1],t[2],t[1]+i*s/n,t[2]-e*s/n,t[3],t[0],t[3]-i*s/n)}else r=[t[0],t[1],t[2],t[1],t[2],t[3],t[0],t[3]];e(r,r,2);const s=[],o=[];for(let t=0,e=r.length;t<e;t+=2)s.push(r[t]),o.push(r[t+1]);return function(t,e,i){return Ot(Math.min.apply(null,t),Math.min.apply(null,e),Math.max.apply(null,t),Math.max.apply(null,e),i)}(s,o,i)}(t,Si(e,i),void 0,n)}let Ci=null;function Pi(){return Ci}function Ii(t,e){return t}function Ti(t,e){return ci&&!oe(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(ci=!1,ye("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t}function Ri(t,e){return t}function ki(t,e){return t}function Ai(t,e){return t}function Gi(t,e,i){return function(n){let r,s;if(t.canWrapX()){const e=t.getExtent(),o=ee(e);s=he(n=n.slice(0),t,o),s&&(n[0]=n[0]-s*o),n[0]=dt(n[0],e[0],e[2]),n[1]=dt(n[1],e[1],e[3]),r=i(n)}else r=i(n);return s&&e.canWrapX()&&(r[0]+=s*ee(e.getExtent())),r}}var Oi,Fi,Li;mi(Pe),mi(ke),Oi=Pe,Fi=function(t,e,i,n){const r=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(r));for(let i=0;i<r;i+=n){e[i]=be*t[i]/180;let n=we*Math.log(Math.tan(Math.PI*(+t[i+1]+90)/360));n>Ee?n=Ee:n<-Ee&&(n=-Ee),e[i+1]=n}return e},Li=function(t,e,i,n){const r=t.length;i=i>1?i:2,n=n??i,void 0===e&&(e=i>2?t.slice():new Array(r));for(let i=0;i<r;i+=n)e[i]=180*t[i]/be,e[i+1]=360*Math.atan(Math.exp(t[i+1]/we))/Math.PI-90;return e},ke.forEach(function(t){Oi.forEach(function(e){Fe(t,e,Fi),Fe(e,t,Li)})});const ji=new Array(6);function Ni(t){return zi(t,1,0,0,1,0,0)}function Di(t,e){const i=t[0],n=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=e[0],h=e[1],u=e[2],c=e[3],d=e[4],f=e[5];return t[0]=i*l+r*h,t[1]=n*l+s*h,t[2]=i*u+r*c,t[3]=n*u+s*c,t[4]=i*d+r*f+o,t[5]=n*d+s*f+a,t}function zi(t,e,i,n,r,s,o){return t[0]=e,t[1]=i,t[2]=n,t[3]=r,t[4]=s,t[5]=o,t}function qi(t,e){const i=e[0],n=e[1];return e[0]=t[0]*i+t[2]*n+t[4],e[1]=t[1]*i+t[3]*n+t[5],e}function $i(t,e,i){return Di(t,zi(ji,e,0,0,i,0,0))}function Bi(t,e,i,n,r,s,o,a){const l=Math.sin(s),h=Math.cos(s);return t[0]=n*h,t[1]=r*l,t[2]=-n*l,t[3]=r*h,t[4]=o*n*h-a*n*l+e,t[5]=o*r*l+a*r*h+i,t}function Ui(t,e){const i=(n=e)[0]*n[3]-n[1]*n[2];var n;at(0!==i,"Transformation matrix cannot be inverted");const r=e[0],s=e[1],o=e[2],a=e[3],l=e[4],h=e[5];return t[0]=a/i,t[1]=-s/i,t[2]=-o/i,t[3]=r/i,t[4]=(o*h-a*l)/i,t[5]=-(r*h-s*l)/i,t}const Wi=[1e5,1e5,1e5,1e5,2,2];function Xi(t){return t.substring(7,t.length-1).split(",").map(parseFloat)}function Vi(t,e,i,n,r,s,o){s=s||[],o=o||2;let a=0;for(let l=e;l<i;l+=n){const e=t[l],i=t[l+1];s[a++]=r[0]*e+r[2]*i+r[4],s[a++]=r[1]*e+r[3]*i+r[5];for(let e=2;e<o;e++)s[a++]=t[l+e]}return s&&s.length!=a&&(s.length=a),s}function Ki(t,e,i,n,r,s,o){o=o||[];const a=Math.cos(r),l=Math.sin(r),h=s[0],u=s[1];let c=0;for(let r=e;r<i;r+=n){const e=t[r]-h,i=t[r+1]-u;o[c++]=h+e*a-i*l,o[c++]=u+e*l+i*a;for(let e=r+2;e<r+n;++e)o[c++]=t[e]}return o&&o.length!=c&&(o.length=c),o}const Yi=[1,0,0,1,0,0],Zi=[NaN,NaN],Hi=class extends N{constructor(){super(),this.extent_=[1/0,1/0,-1/0,-1/0],this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=I((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const n=this.clone();return n.applyTransform(i),n.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return O()}closestPointXY(t,e,i,n){return O()}containsXY(t,e){return 0===this.closestPointXY(t,e,Zi,Number.MIN_VALUE)}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return O()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&Ft(t),this.extentRevision_=this.getRevision()}return function(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t}(this.extent_,t)}rotate(t,e){O()}scale(t,e,i){O()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return O()}getType(){return O()}applyTransform(t){O()}intersectsExtent(t){return O()}translate(t,e){O()}transform(t,e){const i=pi(t),n="tile-pixels"==i.getUnits()?function(t,n,r){const s=i.getExtent(),o=i.getWorldExtent(),a=Ht(o)/Ht(s);Bi(Yi,o[0],o[3],a,-a,0,0,0);const l=Vi(t,0,t.length,r,Yi,n),h=Si(i,e);return h?h(l,l,r):l}:Si(i,e);return this.applyTransform(n),this}};function Ji(t){let e;return 2==t?e="XY":3==t?e="XYZ":4==t&&(e="XYZM"),e}function Qi(t){let e;return"XY"==t?e=2:"XYZ"==t||"XYM"==t?e=3:"XYZM"==t&&(e=4),e}const tn=class extends Hi{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return jt(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return O()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=Qi(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){O()}setLayout(t,e,i){let n;if(t)n=Qi(t);else{for(let t=0;t<i;++t){if(0===e.length)return this.layout="XY",void(this.stride=2);e=e[0]}n=e.length,t=Ji(n)}this.layout=t,this.stride=n}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();Ki(i,0,i.length,n,t,e,i),this.changed()}}scale(t,e,i){void 0===e&&(e=t),i||(i=Vt(this.getExtent()));const n=this.getFlatCoordinates();if(n){const r=this.getStride();!function(t,e,i,n,r,s,o,a){a=a||[];const l=o[0],h=o[1];let u=0;for(let e=0;e<i;e+=n){const i=t[e]-l,o=t[e+1]-h;a[u++]=l+r*i,a[u++]=h+s*o;for(let i=e+2;i<e+n;++i)a[u++]=t[i]}a&&a.length!=u&&(a.length=u)}(n,0,n.length,r,t,e,i,n),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();!function(t,e,i,n,r,s,o){o=o||[];let a=0;for(let e=0;e<i;e+=n){o[a++]=t[e]+r,o[a++]=t[e+1]+s;for(let i=e+2;i<e+n;++i)o[a++]=t[i]}o&&o.length!=a&&(o.length=a)}(i,0,i.length,n,t,e,i),this.changed()}}};function en(t,e,i,n){let r=0;const s=t[i-n],o=t[i-n+1];let a=0,l=0;for(;e<i;e+=n){const i=t[e]-s,n=t[e+1]-o;r+=l*i-a*n,a=i,l=n}return r/2}function nn(t,e,i,n){let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s];r+=en(t,e,o,n),e=o}return r}function rn(t,e,i,n,r,s,o){const a=t[e],l=t[e+1],h=t[i]-a,u=t[i+1]-l;let c;if(0===h&&0===u)c=e;else{const d=((r-a)*h+(s-l)*u)/(h*h+u*u);if(d>1)c=i;else{if(d>0){for(let r=0;r<n;++r)o[r]=_t(t[e+r],t[i+r],d);return void(o.length=n)}c=e}}for(let e=0;e<n;++e)o[e]=t[c+e];o.length=n}function sn(t,e,i,n,r){let s=t[e],o=t[e+1];for(e+=n;e<i;e+=n){const i=t[e],n=t[e+1],a=pt(s,o,i,n);a>r&&(r=a),s=i,o=n}return r}function on(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];r=sn(t,e,o,n,r),e=o}return r}function an(t,e,i,n,r,s,o,a,l,h,u){if(e==i)return h;let c,d;if(0===r){if(d=pt(o,a,t[e],t[e+1]),d<h){for(c=0;c<n;++c)l[c]=t[e+c];return l.length=n,d}return h}u=u||[NaN,NaN];let f=e+n;for(;f<i;)if(rn(t,f-n,f,n,o,a,u),d=pt(o,a,u[0],u[1]),d<h){for(h=d,c=0;c<n;++c)l[c]=u[c];l.length=n,f+=n}else f+=n*Math.max((Math.sqrt(d)-Math.sqrt(h))/r|0,1);if(s&&(rn(t,i-n,e,n,o,a,u),d=pt(o,a,u[0],u[1]),d<h)){for(h=d,c=0;c<n;++c)l[c]=u[c];l.length=n}return h}function ln(t,e,i,n,r,s,o,a,l,h,u){u=u||[NaN,NaN];for(let c=0,d=i.length;c<d;++c){const d=i[c];h=an(t,e,d,n,r,s,o,a,l,h,u),e=d}return h}function hn(t,e,i,n){for(let r=0,s=i.length;r<s;++r){const s=i[r];for(let i=0;i<n;++i)t[e++]=s[i]}return e}function un(t,e,i,n,r){r=r||[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=hn(t,e,i[o],n);r[s++]=a,e=a}return r.length=s,r}function cn(t,e,i,n,r){r=r||[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=un(t,e,i[o],n,r[s]);0===a.length&&(a[0]=e),r[s++]=a,e=a[a.length-1]}return r.length=s,r}function dn(t,e,i,n,r){r=void 0!==r?r:[];let s=0;for(let o=e;o<i;o+=n)r[s++]=t.slice(o,o+n);return r.length=s,r}function fn(t,e,i,n,r){r=void 0!==r?r:[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];r[s++]=dn(t,e,a,n,r[s]),e=a}return r.length=s,r}function pn(t,e,i,n,r){r=void 0!==r?r:[];let s=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];r[s++]=1===a.length&&a[0]===e?[]:fn(t,e,a,n,r[s]),e=a[a.length-1]}return r.length=s,r}function gn(t,e,i,n,r,s,o){const a=(i-e)/n;if(a<3){for(;e<i;e+=n)s[o++]=t[e],s[o++]=t[e+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const h=[e,i-n];let u=0;for(;h.length>0;){const i=h.pop(),s=h.pop();let o=0;const a=t[s],c=t[s+1],d=t[i],f=t[i+1];for(let e=s+n;e<i;e+=n){const i=ft(t[e],t[e+1],a,c,d,f);i>o&&(u=e,o=i)}o>r&&(l[(u-e)/n]=1,s+n<u&&h.push(s,u),u+n<i&&h.push(u,i))}for(let i=0;i<a;++i)l[i]&&(s[o++]=t[e+i*n],s[o++]=t[e+i*n+1]);return o}function mn(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l];o=gn(t,e,h,n,r,s,o),a.push(o),e=h}return o}function yn(t,e){return e*Math.round(t/e)}function _n(t,e,i,n,r,s,o){if(e==i)return o;let a,l,h=yn(t[e],r),u=yn(t[e+1],r);e+=n,s[o++]=h,s[o++]=u;do{if(a=yn(t[e],r),l=yn(t[e+1],r),(e+=n)==i)return s[o++]=a,s[o++]=l,o}while(a==h&&l==u);for(;e<i;){const i=yn(t[e],r),c=yn(t[e+1],r);if(e+=n,i==a&&c==l)continue;const d=a-h,f=l-u,p=i-h,g=c-u;d*g==f*p&&(d<0&&p<d||d==p||d>0&&p>d)&&(f<0&&g<f||f==g||f>0&&g>f)?(a=i,l=c):(s[o++]=a,s[o++]=l,h=a,u=l,a=i,l=c)}return s[o++]=a,s[o++]=l,o}function vn(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l];o=_n(t,e,h,n,r,s,o),a.push(o),e=h}return o}class xn extends tn{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}clone(){return new xn(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,n){return n<Tt(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(sn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),an(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,n))}getArea(){return en(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return dn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=gn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new xn(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=hn(this.flatCoordinates,0,t,this.stride),this.changed()}}const wn=xn;class bn extends tn{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new bn(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const r=this.flatCoordinates,s=pt(t,e,r[0],r[1]);if(s<n){const t=this.stride;for(let e=0;e<t;++e)i[e]=r[e];return i.length=t,s}return n}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return Lt(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return At(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=function(t,e,i){for(let n=0,r=i.length;n<r;++n)t[e++]=i[n];return e}(this.flatCoordinates,0,t,this.stride),this.changed()}}const Sn=bn;function Mn(t,e,i,n,r){return!Bt(r,function(r){return!En(t,e,i,n,r[0],r[1])})}function En(t,e,i,n,r,s){let o=0,a=t[i-n],l=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];l<=s?n>s&&(i-a)*(s-l)-(r-a)*(n-l)>0&&o++:n<=s&&(i-a)*(s-l)-(r-a)*(n-l)<0&&o--,a=i,l=n}return 0!==o}function Cn(t,e,i,n,r,s){if(0===i.length)return!1;if(!En(t,e,i[0],n,r,s))return!1;for(let e=1,o=i.length;e<o;++e)if(En(t,i[e-1],i[e],n,r,s))return!1;return!0}function Pn(t,e,i,n,r,s,o){let a,l,h,u,c,d,f;const p=r[s+1],g=[];for(let r=0,s=i.length;r<s;++r){const s=i[r];for(u=t[s-n],d=t[s-n+1],a=e;a<s;a+=n)c=t[a],f=t[a+1],(p<=d&&f<=p||d<=p&&p<=f)&&(h=(p-d)/(f-d)*(c-u)+u,g.push(h)),u=c,d=f}let m=NaN,y=-1/0;for(g.sort(v),u=g[0],a=1,l=g.length;a<l;++a){c=g[a];const r=Math.abs(c-u);r>y&&(h=(u+c)/2,Cn(t,e,i,n,h,p)&&(m=h,y=r)),u=c}return isNaN(m)&&(m=r[s]),o?(o.push(m,p,y),o):[m,p,y]}function In(t,e,i,n,r){let s=[];for(let o=0,a=i.length;o<a;++o){const a=i[o];s=Pn(t,e,a,n,r,2*o,s),e=a[a.length-1]}return s}function Tn(t,e,i,n,r){let s;for(e+=n;e<i;e+=n)if(s=r(t.slice(e-n,e),t.slice(e,e+n)),s)return s;return!1}function Rn(t,e,i,n,r,s){return s=s??qt([1/0,1/0,-1/0,-1/0],t,e,i,n),!!ie(r,s)&&(s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]||Tn(t,e,i,n,function(t,e){return function(t,e,i){let n=!1;const r=Gt(t,e),s=Gt(t,i);if(1===r||1===s)n=!0;else{const o=t[0],a=t[1],l=t[2],h=t[3],u=e[0],c=e[1],d=i[0],f=i[1],p=(f-c)/(d-u);let g,m;2&s&&!(2&r)&&(g=d-(f-h)/p,n=g>=o&&g<=l),n||!(4&s)||4&r||(m=f-(d-l)*p,n=m>=a&&m<=h),n||!(8&s)||8&r||(g=d-(f-a)/p,n=g>=o&&g<=l),n||!(16&s)||16&r||(m=f-(d-o)*p,n=m>=a&&m<=h)}return n}(r,t,e)}))}function kn(t,e,i,n,r){return!!(Rn(t,e,i,n,r)||En(t,e,i,n,r[0],r[1])||En(t,e,i,n,r[0],r[3])||En(t,e,i,n,r[2],r[1])||En(t,e,i,n,r[2],r[3]))}function An(t,e,i,n,r){if(!kn(t,e,i[0],n,r))return!1;if(1===i.length)return!0;for(let e=1,s=i.length;e<s;++e)if(Mn(t,i[e-1],i[e],n,r)&&!Rn(t,i[e-1],i[e],n,r))return!1;return!0}function Gn(t,e,i,n){for(;e<i-n;){for(let r=0;r<n;++r){const s=t[e+r];t[e+r]=t[i-n+r],t[i-n+r]=s}e+=n,i-=n}}function On(t,e,i,n){let r=0,s=t[i-n],o=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];r+=(i-s)*(n+o),s=i,o=n}return 0===r?void 0:r>0}function Fn(t,e,i,n,r){r=void 0!==r&&r;for(let s=0,o=i.length;s<o;++s){const o=i[s],a=On(t,e,o,n);if(0===s){if(r&&a||!r&&!a)return!1}else if(r&&!a||!r&&a)return!1;e=o}return!0}function Ln(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];if(!Fn(t,e,o,n,r))return!1;o.length&&(e=o[o.length-1])}return!0}function jn(t,e,i,n,r){r=void 0!==r&&r;for(let s=0,o=i.length;s<o;++s){const o=i[s],a=On(t,e,o,n);(0===s?r&&a||!r&&!a:r&&!a||!r&&a)&&Gn(t,e,o,n),e=o}return e}function Nn(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s)e=jn(t,e,i[s],n,r);return e}function Dn(t,e){const i=[];let n,r=0,s=0;for(let o=0,a=e.length;o<a;++o){const a=e[o],l=On(t,r,a,2);if(void 0===n&&(n=l),l===n)i.push(e.slice(s,o+1));else{if(0===i.length)continue;i[i.length-1].push(e[s])}s=o+1,r=a}return i}class zn extends tn{constructor(t,e,i){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,void 0!==e&&i?(this.setFlatCoordinates(e,t),this.ends_=i):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?S(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new zn(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Tt(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(on(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ln(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return Cn(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return nn(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),jn(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,fn(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=Vt(this.getExtent());this.flatInteriorPoint_=Pn(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Sn(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new wn(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,n=[];let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s],a=new wn(e.slice(r,o),t);n.push(a),r=o}return n}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;Fn(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=jn(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=vn(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new zn(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return An(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=un(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}const qn=zn;function $n(t){if(ne(t))throw new Error("Cannot create polygon from empty extent");const e=t[0],i=t[1],n=t[2],r=t[3],s=[e,i,e,r,n,r,n,i,e,i];return new zn(s,"XY",[s.length])}function Bn(t,e,i,n){const r=ee(e)/i[0],s=Ht(e)/i[1];return n?Math.min(t,Math.max(r,s)):Math.min(t,Math.min(r,s))}function Un(t,e,i){let n=Math.min(t,e);return n*=Math.log(1+50*Math.max(0,t/e-1))/50+1,i&&(n=Math.max(n,i),n/=Math.log(1+50*Math.max(0,i/t-1))/50+1),dt(n,i/2,2*e)}function Wn(t,e,i,n,r){return i=void 0===i||i,function(s,o,a,l){if(void 0!==s){const o=n?Bn(t,n,a,r):t;return i&&l?Un(s,o,e):dt(s,e,o)}}}function Xn(t){if(void 0!==t)return 0}function Vn(t){if(void 0!==t)return t}function Kn(t,e){setTimeout(function(){t(e)},0)}function Yn(t){return!(t.sourceCenter&&t.targetCenter&&!oe(t.sourceCenter,t.targetCenter))&&t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation}function Zn(t,e,i,n,r){const s=Math.cos(-r);let o=Math.sin(-r),a=t[0]*s-t[1]*o,l=t[1]*s+t[0]*o;return a+=(e[0]/2-i[0])*n,l+=(i[1]-e[1]/2)*n,o=-o,[a*s-l*o,l*s+a*o]}const Hn=class extends N{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=yi(t.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,t.projection&&function(t){ci=!(void 0===t||t)}(),t.center&&(t.center=Ti(t.center,this.projection_)),t.extent&&(t.extent=ki(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const t in ct)delete e[t];this.setProperties(e,!0);const i=function(t){let e,i,n;let r=void 0!==t.minZoom?t.minZoom:0,s=void 0!==t.maxZoom?t.maxZoom:28;const o=void 0!==t.zoomFactor?t.zoomFactor:2,a=void 0!==t.multiWorld&&t.multiWorld,l=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,h=void 0!==t.showFullExtent&&t.showFullExtent,u=yi(t.projection,"EPSG:3857"),c=u.getExtent();let d=t.constrainOnlyCenter,f=t.extent;if(a||f||!u.isGlobal()||(d=!1,f=c),void 0!==t.resolutions){const o=t.resolutions;i=o[r],n=void 0!==o[s]?o[s]:o[o.length-1],e=t.constrainResolution?function(t,e,i,n){return e=void 0===e||e,function(r,s,o,a){if(void 0!==r){const l=t[0],h=t[t.length-1],u=i?Bn(l,i,o,n):l;if(a)return e?Un(r,u,h):dt(r,h,u);const c=Math.min(u,r),d=Math.floor(w(t,c,s));return t[d]>u&&d<t.length-1?t[d+1]:t[d]}}}(o,l,!d&&f,h):Wn(i,n,l,!d&&f,h)}else{const a=(c?Math.max(ee(c),Ht(c)):360*ve.degrees/u.getMetersPerUnit())/256/Math.pow(2,0),p=a/Math.pow(2,28);i=t.maxResolution,void 0!==i?r=0:i=a/Math.pow(o,r),n=t.minResolution,void 0===n&&(n=void 0!==t.maxZoom?void 0!==t.maxResolution?i/Math.pow(o,s):a/Math.pow(o,s):p),s=r+Math.floor(Math.log(i/n)/Math.log(o)),n=i/Math.pow(o,s-r),e=t.constrainResolution?function(t,e,i,n,r,s){return n=void 0===n||n,i=void 0!==i?i:0,function(o,a,l,h){if(void 0!==o){const u=r?Bn(e,r,l,s):e;if(h)return n?Un(o,u,i):dt(o,i,u);const c=1e-9,d=Math.ceil(Math.log(e/u)/Math.log(t)-c),f=-a*(.5-c)+.5,p=Math.min(u,o),g=Math.floor(Math.log(e/p)/Math.log(t)+f),m=Math.max(d,g);return dt(e/Math.pow(t,m),i,u)}}}(o,i,n,l,!d&&f,h):Wn(i,n,l,!d&&f,h)}return{constraint:e,maxResolution:i,minResolution:n,minZoom:r,zoomFactor:o}}(t);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=i.minZoom;const n=function(t){if(void 0!==t.extent){const e=void 0===t.smoothExtentConstraint||t.smoothExtentConstraint;return Mt(t.extent,t.constrainOnlyCenter,e)}const e=yi(t.projection,"EPSG:3857");if(!0!==t.multiWorld&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,Mt(t,!1,!1)}return Et}(t),r=i.constraint,s=function(t){if(void 0===t.enableRotation||t.enableRotation){const e=t.constrainRotation;return void 0===e||!0===e?function(){const t=mt(5);return function(e,i){return i||void 0===e?e:Math.abs(e)<=t?0:e}}():!1===e?Vn:"number"==typeof e?function(t){const e=2*Math.PI/t;return function(t,i){return i?t:void 0!==t?t=Math.floor(t/e+.5)*e:void 0}}(e):Vn}return Xn}(t);this.constraints_={center:n,resolution:r,rotation:s},this.setRotation(void 0!==t.rotation?t.rotation:0),this.setCenterInternal(void 0!==t.center?t.center:null),void 0!==t.resolution?this.setResolution(t.resolution):void 0!==t.zoom&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const i=this.getCenterInternal();if(i){const n=t||[0,0,0,0];e=e||[0,0,0,0];const r=this.getResolution(),s=r/2*(n[3]-e[3]+e[1]-n[1]),o=r/2*(n[0]-e[0]+e[2]-n[2]);this.setCenterInternal([i[0]+s,i[1]-o])}}getUpdatedOptions_(t){const e=this.getProperties();return void 0!==e.resolution?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let t=0;t<e.length;++t){let i=arguments[t];i.center&&(i=Object.assign({},i),i.center=Ti(i.center,this.getProjection())),i.anchor&&(i=Object.assign({},i),i.anchor=Ti(i.anchor,this.getProjection())),e[t]=i}this.animateInternal.apply(this,e)}animateInternal(t){let e,i=arguments.length;i>1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i);let n=0;for(;n<i&&!this.isDef();++n){const t=arguments[n];t.center&&this.setCenterInternal(t.center),void 0!==t.zoom?this.setZoom(t.zoom):t.resolution&&this.setResolution(t.resolution),void 0!==t.rotation&&this.setRotation(t.rotation)}if(n===i)return void(e&&Kn(e,!0));let r=Date.now(),s=this.targetCenter_.slice(),o=this.targetResolution_,a=this.targetRotation_;const l=[];for(;n<i;++n){const t=arguments[n],i={start:r,complete:!1,anchor:t.anchor,duration:void 0!==t.duration?t.duration:1e3,easing:t.easing||de,callback:e};if(t.center&&(i.sourceCenter=s,i.targetCenter=t.center.slice(),s=i.targetCenter),void 0!==t.zoom?(i.sourceResolution=o,i.targetResolution=this.getResolutionForZoom(t.zoom),o=i.targetResolution):t.resolution&&(i.sourceResolution=o,i.targetResolution=t.resolution,o=i.targetResolution),void 0!==t.rotation){i.sourceRotation=a;const e=yt(t.rotation-a+Math.PI,2*Math.PI)-Math.PI;i.targetRotation=a+e,a=i.targetRotation}Yn(i)?i.complete=!0:r+=i.duration,l.push(i)}this.animations_.push(l),this.setHint(0,1),this.updateAnimations_()}getAnimating(){return this.hints_[0]>0}getInteracting(){return this.hints_[1]>0}cancelAnimations(){let t;this.setHint(0,-this.hints_[0]);for(let e=0,i=this.animations_.length;e<i;++e){const i=this.animations_[e];if(i[0].callback&&Kn(i[0].callback,!1),!t)for(let e=0,n=i.length;e<n;++e){const n=i[e];if(!n.complete){t=n.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(void 0!==this.updateAnimationKey_&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let i=this.animations_.length-1;i>=0;--i){const n=this.animations_[i];let r=!0;for(let i=0,s=n.length;i<s;++i){const s=n[i];if(s.complete)continue;const o=t-s.start;let a=s.duration>0?o/s.duration:1;a>=1?(s.complete=!0,a=1):r=!1;const l=s.easing(a);if(s.sourceCenter){const t=s.sourceCenter[0],e=s.sourceCenter[1],i=s.targetCenter[0],n=s.targetCenter[1];this.nextCenter_=s.targetCenter;const r=t+l*(i-t),o=e+l*(n-e);this.targetCenter_=[r,o]}if(s.sourceResolution&&s.targetResolution){const t=1===l?s.targetResolution:s.sourceResolution+l*(s.targetResolution-s.sourceResolution);if(s.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,s.anchor)}this.nextResolution_=s.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==s.sourceRotation&&void 0!==s.targetRotation){const t=1===l?yt(s.targetRotation+Math.PI,2*Math.PI)-Math.PI:s.sourceRotation+l*(s.targetRotation-s.sourceRotation);if(s.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,s.anchor)}this.nextRotation_=s.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!s.complete)break}if(r){this.animations_[i]=null,this.setHint(0,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=n[0].callback;t&&Kn(t,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const n=this.getCenterInternal();var r,s;return void 0!==n&&(i=[n[0]-e[0],n[1]-e[1]],ae(i,t-this.getRotation()),s=e,(r=i)[0]+=+s[0],r[1]+=+s[1]),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),r=this.getResolution();return void 0!==n&&void 0!==r&&(i=[e[0]-t*(e[0]-n[0])/r,e[1]-t*(e[1]-n[1])/r]),i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?Ii(t,this.getProjection()):t}getCenterInternal(){return this.get(ct.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){return Ri(this.calculateExtentInternal(t),this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();at(e,"The view center is not defined");const i=this.getResolution();at(void 0!==i,"The view resolution is not defined");const n=this.getRotation();return at(void 0!==n,"The view rotation is not defined"),Yt(e,i,n,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(ct.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(ki(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=ee(t)/e[0],n=Ht(t)/e[1];return Math.max(i,n)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,n=Math.log(e/i)/Math.log(t);return function(i){return e/Math.pow(t,i*n)}}getRotation(){return this.get(ct.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(i/n)/e;return function(t){return Math.log(i/t)/e/r}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let n=this.getCenterInternal();const r=this.padding_;if(r){const t=this.getViewportSizeMinusPadding_();n=Zn(n,this.getViewportSize_(),[t[0]/2+r[3],t[1]/2+r[0]],e,i)}return{center:n.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,n=this.minZoom_||0;if(this.resolutions_){const r=w(this.resolutions_,t,1);n=r,e=this.resolutions_[r],i=r==this.resolutions_.length-1?2:e/this.resolutions_[r+1]}else e=this.maxResolution_,i=this.zoomFactor_;return n+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.resolutions_?.length){if(1===this.resolutions_.length)return this.resolutions_[0];const e=dt(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,dt(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(at(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t))at(!ne(t),"Cannot fit empty extent provided as `geometry`"),i=$n(ki(t,this.getProjection()));else if("Circle"===t.getType()){const e=ki(t.getExtent(),this.getProjection());i=$n(e),i.rotate(this.getRotation(),Vt(e))}else{const e=Pi();i=e?t.clone().transform(e,this.getProjection()):t}this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),r=t.getFlatCoordinates(),s=t.getStride();let o=1/0,a=1/0,l=-1/0,h=-1/0;for(let t=0,e=r.length;t<e;t+=s){const e=r[t]*i-r[t+1]*n,s=r[t]*n+r[t+1]*i;o=Math.min(o,e),a=Math.min(a,s),l=Math.max(l,e),h=Math.max(h,s)}return[o,a,l,h]}fitInternal(t,e){let i=(e=e||{}).size;i||(i=this.getViewportSizeMinusPadding_());const n=void 0!==e.padding?e.padding:[0,0,0,0],r=void 0!==e.nearest&&e.nearest;let s;s=void 0!==e.minResolution?e.minResolution:void 0!==e.maxZoom?this.getResolutionForZoom(e.maxZoom):0;const o=this.rotatedExtentForGeometry(t);let a=this.getResolutionForExtentInternal(o,[i[0]-n[1]-n[3],i[1]-n[0]-n[2]]);a=isNaN(a)?s:Math.max(a,s),a=this.getConstrainedResolution(a,r?0:1);const l=this.getRotation(),h=Math.sin(l),u=Math.cos(l),c=Vt(o);c[0]+=(n[1]-n[3])/2*a,c[1]+=(n[0]-n[2])/2*a;const d=c[0]*u-c[1]*h,f=c[1]*u+c[0]*h,p=this.getConstrainedCenter([d,f],a),g=e.callback?e.callback:P;void 0!==e.duration?this.animateInternal({resolution:a,center:p,duration:e.duration,easing:e.easing},g):(this.targetResolution_=a,this.targetCenter_=p,this.applyTargetState_(!1,!0),Kn(g,!0))}centerOn(t,e,i){this.centerOnInternal(Ti(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(Zn(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,n){let r;const s=this.padding_;if(s&&t){const o=this.getViewportSizeMinusPadding_(-i),a=Zn(t,n,[o[0]/2+s[3],o[1]/2+s[0]],e,i);r=[t[0]-a[0],t[1]-a[1]]}return r}isDef(){return!!this.getCenterInternal()&&void 0!==this.getResolution()}adjustCenter(t){const e=Ii(this.targetCenter_,this.getProjection());this.setCenter([e[0]+t[0],e[1]+t[1]])}adjustCenterInternal(t){const e=this.targetCenter_;this.setCenterInternal([e[0]+t[0],e[1]+t[1]])}adjustResolution(t,e){e=e&&Ti(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.getViewportSize_(this.getRotation()),r=this.constraints_.resolution(this.targetResolution_*t,0,n,i);e&&(this.targetCenter_=this.calculateCenterZoom(r,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=Ti(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.constraints_.rotation(this.targetRotation_+t,i);e&&(this.targetCenter_=this.calculateCenterRotate(n,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t?Ti(t,this.getProjection()):t)}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const i=this.getAnimating()||this.getInteracting()||e,n=this.constraints_.rotation(this.targetRotation_,i),r=this.getViewportSize_(n),s=this.constraints_.resolution(this.targetResolution_,0,r,i),o=this.constraints_.center(this.targetCenter_,s,r,i,this.calculateCenterShift(this.targetCenter_,s,n,r));this.get(ct.ROTATION)!==n&&this.set(ct.ROTATION,n),this.get(ct.RESOLUTION)!==s&&(this.set(ct.RESOLUTION,s),this.set("zoom",this.getZoom(),!0)),o&&this.get(ct.CENTER)&&oe(this.get(ct.CENTER),o)||this.set(ct.CENTER,o),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=void 0!==t?t:200;const n=e||0,r=this.constraints_.rotation(this.targetRotation_),s=this.getViewportSize_(r),o=this.constraints_.resolution(this.targetResolution_,n,s),a=this.constraints_.center(this.targetCenter_,o,s,!1,this.calculateCenterShift(this.targetCenter_,o,r,s));if(0===t&&!this.cancelAnchor_)return this.targetResolution_=o,this.targetRotation_=r,this.targetCenter_=a,void this.applyTargetState_();i=i||(0===t?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,this.getResolution()===o&&this.getRotation()===r&&this.getCenterInternal()&&oe(this.getCenterInternal(),a)||(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:r,center:a,resolution:o,duration:t,easing:ce,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(1,1)}endInteraction(t,e,i){i=i&&Ti(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(1,-1),this.resolveConstraints(t,e,i))}getConstrainedCenter(t,e){const i=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,e||this.getResolution(),i)}getConstrainedZoom(t,e){const i=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(i,e))}getConstrainedResolution(t,e){e=e||0;const i=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,i)}},Jn="ol-hidden",Qn="ol-unselectable",tr="ol-control",er="ol-collapsed",ir=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"),nr=["style","variant","weight","size","lineHeight","family"],rr={normal:400,bold:700},sr=function(t){const e=t.match(ir);if(!e)return null;const i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let t=0,n=nr.length;t<n;++t){const n=e[t+1];void 0!==n&&(i[nr[t]]="string"==typeof n?n.trim():n)}return isNaN(Number(i.weight))&&i.weight in rr&&(i.weight=rr[i.weight]),i.families=i.family.split(/,\s?/).map(t=>t.trim().replace(/^['"]|['"]$/g,"")),i};function or(t,e,i,n){let r;return r=i&&i.length?i.shift():Y?new class extends OffscreenCanvas{style={}}(t??300,e??150):document.createElement("canvas"),t&&(r.width=t),e&&(r.height=e),r.getContext("2d",n)}let ar;function lr(){return ar||(ar=or(1,1)),ar}function hr(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function ur(t,e){const i=e.parentNode;i&&i.replaceChild(t,e)}function cr(){return new Proxy({childNodes:[],appendChild:function(t){return this.childNodes.push(t),t},remove:function(){},removeChild:function(t){const e=this.childNodes.indexOf(t);if(-1===e)throw new Error("Node to remove was not found");return this.childNodes.splice(e,1),t},insertBefore:function(t,e){const i=this.childNodes.indexOf(e);if(-1===i)throw new Error("Reference node not found");return this.childNodes.splice(i,0,t),t},style:{}},{get:(t,e,i)=>"firstElementChild"===e?t.childNodes.length>0?t.childNodes[0]:null:Reflect.get(t,e,i)})}function dr(t){return"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas}const fr=class extends N{constructor(t){super();const e=t.element;!e||t.target||e.style.pointerEvents||(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&this.element?.remove();for(let t=0,e=this.listenerKeys.length;t<e;++t)u(this.listenerKeys[t]);if(this.listenerKeys.length=0,this.map_=t,t){const e=this.target_??t.getOverlayContainerStopEvent();this.element&&e.appendChild(this.element),this.render!==P&&this.listenerKeys.push(l(t,tt,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_="string"==typeof t?document.getElementById(t):t}},pr=class extends fr{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=void 0===t.collapsed||t.collapsed,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=void 0!==t.collapsible,this.collapsible_=void 0===t.collapsible||t.collapsible,this.collapsible_||(this.collapsed_=!1),this.attributions_=t.attributions;const e=void 0!==t.className?t.className:"ol-attribution",i=void 0!==t.tipLabel?t.tipLabel:"Attributions",n=void 0!==t.expandClassName?t.expandClassName:e+"-expand",r=void 0!==t.collapseLabel?t.collapseLabel:"›",s=void 0!==t.collapseClassName?t.collapseClassName:e+"-collapse";"string"==typeof r?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=r,this.collapseLabel_.className=s):this.collapseLabel_=r;const o=void 0!==t.label?t.label:"i";"string"==typeof o?(this.label_=document.createElement("span"),this.label_.textContent=o,this.label_.className=n):this.label_=o;const a=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=i,this.toggleButton_.appendChild(a),this.toggleButton_.addEventListener(f,this.handleClick_.bind(this),!1);const l=e+" "+Qn+" "+tr+(this.collapsed_&&this.collapsible_?" "+er:"")+(this.collapsible_?"":" ol-uncollapsible"),h=this.element;h.className=l,h.appendChild(this.toggleButton_),h.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=this.getMap().getAllLayers(),i=new Set(e.flatMap(e=>e.getAttributions(t)));if(void 0!==this.attributions_&&(Array.isArray(this.attributions_)?this.attributions_.forEach(t=>i.add(t)):i.add(this.attributions_)),!this.overrideCollapsible_){const t=!e.some(t=>!1===t.getSource()?.getAttributionsCollapsible());this.setCollapsible(t)}return Array.from(i)}async updateElement_(t){if(!t)return void(this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1));const e=await Promise.all(this.collectSourceAttributions_(t).map(t=>T(()=>t))),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!M(e,this.renderedAttributions_)){!function(t){for(;t.lastChild;)t.lastChild.remove()}(this.ulElement_);for(let t=0,i=e.length;t<i;++t){const i=document.createElement("li");i.innerHTML=e[t],this.ulElement_.appendChild(i)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(er),this.collapsed_?ur(this.collapseLabel_,this.label_):ur(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(t){this.userCollapsed_=t,this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(t){this.updateElement_(t.frameState)}},gr=class extends fr{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target});const e=void 0!==t.className?t.className:"ol-rotate",i=void 0!==t.label?t.label:"⇧",n=void 0!==t.compassClassName?t.compassClassName:"ol-compass";this.label_=null,"string"==typeof i?(this.label_=document.createElement("span"),this.label_.className=n,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(n));const r=t.tipLabel?t.tipLabel:"Reset rotation",s=document.createElement("button");s.className=e+"-reset",s.setAttribute("type","button"),s.title=r,s.appendChild(this.label_),s.addEventListener(f,this.handleClick_.bind(this),!1);const o=e+" "+Qn+" "+tr,a=this.element;a.className=o,a.appendChild(s),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=void 0!==t.duration?t.duration:250,this.autoHide_=void 0===t.autoHide||t.autoHide,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Jn)}handleClick_(t){t.preventDefault(),void 0!==this.callResetNorth_?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const t=this.getMap().getView();if(!t)return;const e=t.getRotation();void 0!==e&&(this.duration_>0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:ce}):t.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const t="rotate("+i+"rad)";if(this.autoHide_){const t=this.element.classList.contains(Jn);t||0!==i?t&&0!==i&&this.element.classList.remove(Jn):this.element.classList.add(Jn)}this.label_.style.transform=t}this.rotation_=i}},mr=class extends fr{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=void 0!==t.className?t.className:"ol-zoom",i=void 0!==t.delta?t.delta:1,n=void 0!==t.zoomInClassName?t.zoomInClassName:e+"-in",r=void 0!==t.zoomOutClassName?t.zoomOutClassName:e+"-out",s=void 0!==t.zoomInLabel?t.zoomInLabel:"+",o=void 0!==t.zoomOutLabel?t.zoomOutLabel:"–",a=void 0!==t.zoomInTipLabel?t.zoomInTipLabel:"Zoom in",l=void 0!==t.zoomOutTipLabel?t.zoomOutTipLabel:"Zoom out",h=document.createElement("button");h.className=n,h.setAttribute("type","button"),h.title=a,h.appendChild("string"==typeof s?document.createTextNode(s):s),h.addEventListener(f,this.handleClick_.bind(this,i),!1);const u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=l,u.appendChild("string"==typeof o?document.createTextNode(o):o),u.addEventListener(f,this.handleClick_.bind(this,-i),!1);const c=e+" "+Qn+" "+tr,d=this.element;d.className=c,d.appendChild(h),d.appendChild(u),this.duration_=void 0!==t.duration?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const e=this.getMap().getView();if(!e)return;const i=e.getZoom();if(void 0!==i){const n=e.getConstrainedZoom(i+t);this.duration_>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:n,duration:this.duration_,easing:ce})):e.setZoom(n)}}},yr=class{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;let i=e-3;for(;i>0&&this.points_[i+2]>t;)i-=3;const n=this.points_[e+2]-this.points_[i+2];if(n<1e3/60)return!1;const r=this.points_[e]-this.points_[i],s=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(s,r),this.initialVelocity_=Math.sqrt(r*r+s*s)/n,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}},_r="active";function vr(t,e,i,n){const r=t.getZoom();if(void 0===r)return;const s=t.getConstrainedZoom(r+e),o=t.getResolutionForZoom(s);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:o,anchor:i,duration:void 0!==n?n:250,easing:ce})}const xr=class extends N{constructor(t){super(),this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(_r)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(_r,t)}setMap(t){this.map_=t}},wr=class extends xr{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:250}handleEvent(t){let e=!1;if(t.type==U.DBLCLICK){const i=t.originalEvent,n=t.map,r=t.coordinate,s=i.shiftKey?-this.delta_:this.delta_;vr(n.getView(),s,r,this.duration_),i.preventDefault(),e=!0}return!e}};function br(t){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 Sr=function(t){const e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Mr=function(t){const e=t.map.getTargetElement(),i=e.getRootNode();return!(i instanceof ShadowRoot?i.host:e).hasAttribute("tabindex")||function(t){const e=t.map.getTargetElement(),i=e.getRootNode(),n=t.map.getOwnerDocument().activeElement;return i instanceof ShadowRoot?i.host.contains(n):e.contains(n)}(t)},Er=E,Cr=function(t){const e=t.originalEvent;return"pointerId"in e&&0==e.button&&!(X&&V&&e.ctrlKey)},Pr=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},Ir=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Tr=function(t){const e=t.originalEvent,i=e.target.tagName;return"INPUT"!==i&&"SELECT"!==i&&"TEXTAREA"!==i&&!e.target.isContentEditable},Rr=function(t){const e=t.originalEvent;return"pointerId"in e&&"mouse"==e.pointerType},kr=function(t){const e=t.originalEvent;return"pointerId"in e&&e.isPrimary&&0===e.button};function Ar(t){const e=t.length;let i=0,n=0;for(let r=0;r<e;r++)i+=t[r].clientX,n+=t[r].clientY;return{clientX:i/e,clientY:n/e}}const Gr=class extends xr{constructor(t){super(t=t||{}),t.handleDownEvent&&(this.handleDownEvent=t.handleDownEvent),t.handleDragEvent&&(this.handleDragEvent=t.handleDragEvent),t.handleMoveEvent&&(this.handleMoveEvent=t.handleMoveEvent),t.handleUpEvent&&(this.handleUpEvent=t.handleUpEvent),t.stopDown&&(this.stopDown=t.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(t){return!1}handleDragEvent(t){}handleEvent(t){if(!t.originalEvent)return!0;let e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==U.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==U.POINTERUP){const e=this.handleUpEvent(t);this.handlingDownUpSequence=e&&this.targetPointers.length>0}}else if(t.type==U.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==U.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}},Or=class extends Gr{constructor(t){super({stopDown:C}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:br(Pr,kr);this.condition_=t.onFocusOnly?br(Mr,e):e,this.noKinetic_=!1}handleDragEvent(t){const e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());const i=this.targetPointers,n=e.getEventPixel(Ar(i));if(i.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(n[0],n[1]),this.lastCentroid){const e=[this.lastCentroid[0]-n[0],n[1]-this.lastCentroid[1]],i=t.map.getView();r=e,s=i.getResolution(),r[0]*=s,r[1]*=s,ae(e,i.getRotation()),i.adjustCenterInternal(e)}}else this.kinetic_&&this.kinetic_.begin();var r,s;this.lastCentroid=n,this.lastPointersCount_=i.length,t.originalEvent.preventDefault()}handleUpEvent(t){const e=t.map,i=e.getView();if(0===this.targetPointers.length){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const t=this.kinetic_.getDistance(),n=this.kinetic_.getAngle(),r=i.getCenterInternal(),s=e.getPixelFromCoordinateInternal(r),o=e.getCoordinateFromPixelInternal([s[0]-t*Math.cos(n),s[1]-t*Math.sin(n)]);i.animateInternal({center:i.getConstrainedCenter(o),duration:500,easing:ce})}return this.panning_&&(this.panning_=!1,i.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(t){if(this.targetPointers.length>0&&this.condition_(t)){const e=t.map.getView();return this.lastCentroid=null,e.getAnimating()&&e.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}},Fr=class extends Gr{constructor(t){t=t||{},super({stopDown:C}),this.condition_=t.condition?t.condition:Sr,this.lastAngle_=void 0,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){if(!Rr(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===Xn)return;const n=e.getSize(),r=t.pixel,s=Math.atan2(n[1]/2-r[1],r[0]-n[0]/2);if(void 0!==this.lastAngle_){const t=s-this.lastAngle_;i.adjustRotationInternal(-t)}this.lastAngle_=s}handleUpEvent(t){return!Rr(t)||(t.map.getView().endInteraction(this.duration_),!1)}handleDownEvent(t){return!!Rr(t)&&(!(!Cr(t)||!this.condition_(t))&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0))}},Lr=class extends _{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,i="px",n=this.element_.style;n.left=Math.min(t[0],e[0])+i,n.top=Math.min(t[1],e[1])+i,n.width=Math.abs(e[0]-t[0])+i,n.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;const t=this.startPixel_,e=this.endPixel_,i=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);i[4]=i[0].slice(),this.geometry_?this.geometry_.setCoordinates([i]):this.geometry_=new qn([i])}getGeometry(){return this.geometry_}},jr="boxcancel";class Nr extends R{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}const Dr=class extends Gr{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new Lr(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??Cr,this.boxEndCondition_=t.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const n=i[0]-e[0],r=i[1]-e[1];return n*n+r*r>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new Nr("boxdrag",t.coordinate,t)))}handleUpEvent(t){if(!this.startPixel_)return!1;const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new Nr(e?"boxend":jr,t.coordinate,t)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(t){return!!this.condition_(t)&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new Nr("boxstart",t.coordinate,t)),!0)}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Nr(jr,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Nr(jr,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}},zr=class extends Dr{constructor(t){super({condition:(t=t||{}).condition?t.condition:Ir,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=void 0!==t.duration?t.duration:200,this.out_=void 0!==t.out&&t.out}onBoxEnd(t){const e=this.getMap().getView();let i=this.getGeometry();if(this.out_){const t=e.rotatedExtentForGeometry(i),n=e.getResolutionForExtentInternal(t),r=e.getResolution()/n;i=i.clone(),i.scale(r*r)}e.fitInternal(i,{duration:this.duration_,easing:ce})}},qr="ArrowLeft",$r="ArrowRight",Br="ArrowDown",Ur=class extends xr{constructor(t){super(),t=t||{},this.defaultCondition_=function(t){return Pr(t)&&Tr(t)},this.condition_=void 0!==t.condition?t.condition:this.defaultCondition_,this.duration_=void 0!==t.duration?t.duration:100,this.pixelDelta_=void 0!==t.pixelDelta?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==p){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&(n==Br||n==qr||n==$r||"ArrowUp"==n)){const r=t.map.getView(),s=r.getResolution()*this.pixelDelta_;let o=0,a=0;n==Br?a=-s:n==qr?o=-s:n==$r?o=s:a=s;const l=[o,a];ae(l,r.getRotation()),function(t,e,i){const n=t.getCenterInternal();if(n){const r=[n[0]+e[0],n[1]+e[1]];t.animateInternal({duration:void 0!==i?i:250,easing:fe,center:t.getConstrainedCenter(r)})}}(r,l,this.duration_),i.preventDefault(),e=!0}}return!e}},Wr=class extends xr{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(t){return!function(t){const e=t.originalEvent;return V?e.metaKey:e.ctrlKey}(t)&&Tr(t)},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:100}handleEvent(t){let e=!1;if(t.type==p||t.type==g){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&("+"===n||"-"===n)){const r=t.map,s="+"===n?this.delta_:-this.delta_;vr(r.getView(),s,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}},Xr=class extends xr{constructor(t){super(t=t||{}),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=void 0!==t.maxDelta?t.maxDelta:1,this.duration_=void 0!==t.duration?t.duration:250,this.timeout_=void 0!==t.timeout?t.timeout:80,this.useAnchor_=void 0===t.useAnchor||t.useAnchor,this.constrainResolution_=void 0!==t.constrainResolution&&t.constrainResolution;const e=t.condition?t.condition:Er;this.condition_=t.onFocusOnly?br(Mr,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300,this.ctrlKeyPressed_=!1,this.ctrlKeyListenerKeys_=[]}setMap(t){if(this.ctrlKeyListenerKeys_.forEach(u),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(t),t){const e=t.getOwnerDocument();this.ctrlKeyListenerKeys_.push(l(e,"keydown",t=>{"Control"===t.key&&(this.ctrlKeyPressed_=!0)}),l(e,"keyup",t=>{"Control"===t.key&&(this.ctrlKeyPressed_=!1)}))}}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();if(!t)return;const e=t.getView(),i=this.lastDelta_?this.lastDelta_>0?1:-1:0;e.endInteraction(this.constrainResolution_||e.getConstrainResolution()?100:void 0,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(t){if(!this.condition_(t))return!0;if(t.type!==y)return!0;const e=t.map,i=t.originalEvent;i.preventDefault();const n=i.ctrlKey&&!this.ctrlKeyPressed_;i.ctrlKey||(this.ctrlKeyPressed_=!1),this.useAnchor_&&(this.lastAnchor_=t.pixel);let r=i.deltaY;switch(i.deltaMode){case WheelEvent.DOM_DELTA_LINE:r*=40;break;case WheelEvent.DOM_DELTA_PAGE:r*=300}if(0===r)return!1;this.lastDelta_=r;const s=Date.now();void 0===this.startTime_&&(this.startTime_=s),(!this.mode_||s-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(r)<4?"trackpad":"wheel");const o=e.getView();if("trackpad"===this.mode_)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(o.getAnimating()&&o.cancelAnimations(),o.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),n&&(r*=3),o.adjustZoom(-r/this.deltaPerZoom_,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=s,!1;this.totalDelta_+=r;const a=Math.max(this.timeout_-(s-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,e),a),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-dt(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),vr(e,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}},Vr=class extends Gr{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=C),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=void 0!==t.threshold?t.threshold:.3,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){let e=0;const i=this.targetPointers[0],n=this.targetPointers[1],r=Math.atan2(n.clientY-i.clientY,n.clientX-i.clientX);if(void 0!==this.lastAngle_){const t=r-this.lastAngle_;this.rotationDelta_+=t,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=t}this.lastAngle_=r;const s=t.map,o=s.getView();o.getConstraints().rotation!==Xn&&(this.anchor_=s.getCoordinateFromPixelInternal(s.getEventPixel(Ar(this.targetPointers))),this.rotating_&&(s.render(),o.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){return!(this.targetPointers.length<2)||(t.map.getView().endInteraction(this.duration_),!1)}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}},Kr=class extends Gr{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=C),super(e),this.anchor_=null,this.duration_=void 0!==t.duration?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],n=this.targetPointers[1],r=i.clientX-n.clientX,s=i.clientY-n.clientY,o=Math.sqrt(r*r+s*s);void 0!==this.lastDistance_&&(e=this.lastDistance_/o),this.lastDistance_=o;const a=t.map,l=a.getView();1!=e&&(this.lastScaleDelta_=e),this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(Ar(this.targetPointers))),a.render(),l.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const e=t.map.getView(),i=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,i),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}};function Yr(t){t=t||{};const e=new q,i=new yr(-.005,.05,100);return(void 0===t.altShiftDragRotate||t.altShiftDragRotate)&&e.push(new Fr),(void 0===t.doubleClickZoom||t.doubleClickZoom)&&e.push(new wr({delta:t.zoomDelta,duration:t.zoomDuration})),(void 0===t.dragPan||t.dragPan)&&e.push(new Or({onFocusOnly:t.onFocusOnly,kinetic:i})),(void 0===t.pinchRotate||t.pinchRotate)&&e.push(new Vr),(void 0===t.pinchZoom||t.pinchZoom)&&e.push(new Kr({duration:t.zoomDuration})),(void 0===t.keyboard||t.keyboard)&&(e.push(new Ur),e.push(new Wr({delta:t.zoomDelta,duration:t.zoomDuration}))),(void 0===t.mouseWheelZoom||t.mouseWheelZoom)&&e.push(new Xr({onFocusOnly:t.onFocusOnly,duration:t.zoomDuration})),(void 0===t.shiftDragZoom||t.shiftDragZoom)&&e.push(new zr({duration:t.zoomDuration})),e}const Zr="opacity",Hr="visible",Jr="extent",Qr="zIndex",ts="maxResolution",es="minResolution",is="maxZoom",ns="minZoom",rs="source",ss=class extends N{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);"object"==typeof t.properties&&(delete e.properties,Object.assign(e,t.properties)),e[Zr]=void 0!==t.opacity?t.opacity:1,at("number"==typeof e[Zr],"Layer opacity must be a number"),e[Hr]=void 0===t.visible||t.visible,e[Qr]=t.zIndex,e[ts]=void 0!==t.maxResolution?t.maxResolution:1/0,e[es]=void 0!==t.minResolution?t.minResolution:0,e[ns]=void 0!==t.minZoom?t.minZoom:-1/0,e[is]=void 0!==t.maxZoom?t.maxZoom:1/0,this.className_=void 0!==e.className?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:void 0===t||t},i=this.getZIndex();return e.opacity=dt(Math.round(100*this.getOpacity())/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==i||e.managed?i:1/0,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return O()}getLayerStatesArray(t){return O()}getExtent(){return this.get(Jr)}getMaxResolution(){return this.get(ts)}getMinResolution(){return this.get(es)}getMinZoom(){return this.get(ns)}getMaxZoom(){return this.get(is)}getOpacity(){return this.get(Zr)}getSourceState(){return O()}getVisible(){return this.get(Hr)}getZIndex(){return this.get(Qr)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(Jr,t)}setMaxResolution(t){this.set(ts,t)}setMinResolution(t){this.set(es,t)}setMaxZoom(t){this.set(is,t)}setMinZoom(t){this.set(ns,t)}setOpacity(t){at("number"==typeof t,"Layer opacity must be a number"),this.set(Zr,t)}setVisible(t){this.set(Hr,t)}setZIndex(t){this.set(Qr,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},os="addlayer",as="removelayer";class ls extends R{constructor(t,e){super(t),this.layer=e}}const hs="layers";class us extends ss{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let i=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(hs,this.handleLayersChanged_),i?Array.isArray(i)?i=new q(i.slice(),{unique:!0}):at("function"==typeof i.getArray,"Expected `layers` to be an array or a `Collection`"):i=new q(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(u),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(l(t,n,this.handleLayersAdd_,this),l(t,r,this.handleLayersRemove_,this));for(const t in this.listenerKeys_)this.listenerKeys_[t].forEach(u);o(this.listenerKeys_);const e=t.getArray();for(let t=0,i=e.length;t<i;t++){const i=e[t];this.registerLayerListeners_(i),this.dispatchEvent(new ls(os,i))}this.changed()}registerLayerListeners_(t){const e=[l(t,s,this.handleLayerChange_,this),l(t,c,this.handleLayerChange_,this)];t instanceof us&&e.push(l(t,os,this.handleLayerGroupAdd_,this),l(t,as,this.handleLayerGroupRemove_,this)),this.listenerKeys_[L(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new ls(os,t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new ls(as,t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new ls(os,e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=L(e);this.listenerKeys_[i].forEach(u),delete this.listenerKeys_[i],this.dispatchEvent(new ls(as,e)),this.changed()}getLayers(){return this.get(hs)}setLayers(t){const e=this.getLayers();if(e){const t=e.getArray();for(let e=0,i=t.length;e<i;++e)this.dispatchEvent(new ls(as,t[e]))}this.set(hs,t)}getLayersArray(t){return t=void 0!==t?t:[],this.getLayers().forEach(function(e){e.getLayersArray(t)}),t}getLayerStatesArray(t){const e=void 0!==t?t:[],i=e.length;this.getLayers().forEach(function(t){t.getLayerStatesArray(e)});const n=this.getLayerState();let r=n.zIndex;t||void 0!==n.zIndex||(r=0);for(let t=i,s=e.length;t<s;t++){const i=e[t];i.opacity*=n.opacity,i.visible=i.visible&&n.visible,i.maxResolution=Math.min(i.maxResolution,n.maxResolution),i.minResolution=Math.max(i.minResolution,n.minResolution),i.minZoom=Math.max(i.minZoom,n.minZoom),i.maxZoom=Math.min(i.maxZoom,n.maxZoom),void 0!==n.extent&&(void 0!==i.extent?i.extent=Jt(i.extent,n.extent):i.extent=n.extent),void 0===i.zIndex&&(i.zIndex=r)}return e}getSourceState(){return"ready"}}const cs=us,ds="prerender",fs="postrender",ps="precompose",gs="rendercomplete";function ms(t,e){if(!t.visible)return!1;const i=e.resolution;if(i<t.minResolution||i>=t.maxResolution)return!1;const n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}const ys=class extends ss{constructor(t){const e=Object.assign({},t);delete e.source,super(e),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(rs,this.handleSourcePropertyChange_);const i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return(t=t||[]).push(this),t}getLayerStatesArray(t){return(t=t||[]).push(this.getLayerState()),t}getSource(){return this.get(rs)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),this.sourceReady_||"ready"!==this.getSource().getState()||(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(u(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=l(t,c,this.handleSourceChange_,this),"ready"===t.getState()&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return this.renderer_&&this.rendered?this.renderer_.getData(t):null}isVisible(t){let e;const i=this.getMapInternal();let n;if(!t&&i&&(t=i.getView()),e=t instanceof Hn?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),e.layerStatesArray){if(n=e.layerStatesArray.find(t=>t.layer===this),!n)return!1}else n=this.getLayerState();const r=this.getExtent();return ms(n,e.viewState)&&(!r||ie(r,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];let i=e(t instanceof Hn?t.getViewStateAndExtent():t);return Array.isArray(i)||(i=[i]),i}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){const e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set("map",t)}getMapInternal(){return this.get("map")}setMap(t){this.mapPrecomposeKey_&&(u(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(u(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=l(t,ps,this.handlePrecompose_,this),this.mapRenderKey_=l(this,c,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);at(!e.some(t=>t.layer===i.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(i)}setSource(t){this.set(rs,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}};function _s(t,e,i=0,n=t.length-1,r=xs){for(;n>i;){if(n-i>600){const s=n-i+1,o=e-i+1,a=Math.log(s),l=.5*Math.exp(2*a/3),h=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);_s(t,e,Math.max(i,Math.floor(e-o*l/s+h)),Math.min(n,Math.floor(e+(s-o)*l/s+h)),r)}const s=t[e];let o=i,a=n;for(vs(t,i,e),r(t[n],s)>0&&vs(t,i,n);o<a;){for(vs(t,o,a),o++,a--;r(t[o],s)<0;)o++;for(;r(t[a],s)>0;)a--}0===r(t[i],s)?vs(t,i,a):(a++,vs(t,a,n)),a<=e&&(i=a+1),e<=a&&(n=a-1)}}function vs(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function xs(t,e){return t<e?-1:t>e?1:0}class ws{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const i=[];if(!Gs(t,e))return i;const n=this.toBBox,r=[];for(;e;){for(let s=0;s<e.children.length;s++){const o=e.children[s],a=e.leaf?n(o):o;Gs(t,a)&&(e.leaf?i.push(o):As(t,a)?this._all(o,i):r.push(o))}e=r.pop()}return i}collides(t){let e=this.data;if(!Gs(t,e))return!1;const i=[];for(;e;){for(let n=0;n<e.children.length;n++){const r=e.children[n],s=e.leaf?this.toBBox(r):r;if(Gs(t,s)){if(e.leaf||As(t,s))return!0;i.push(r)}}e=i.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(let e=0;e<t.length;e++)this.insert(t[e]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const t=this.data;this.data=e,e=t}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=Os([]),this}remove(t,e){if(!t)return this;let i=this.data;const n=this.toBBox(t),r=[],s=[];let o,a,l;for(;i||r.length;){if(i||(i=r.pop(),a=r[r.length-1],o=s.pop(),l=!0),i.leaf){const n=bs(t,i.children,e);if(-1!==n)return i.children.splice(n,1),r.push(i),this._condense(r),this}l||i.leaf||!As(i,n)?a?(o++,i=a.children[o],l=!1):i=null:(r.push(i),s.push(o),o=0,a=i,i=i.children[0])}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const i=[];for(;t;)t.leaf?e.push(...t.children):i.push(...t.children),t=i.pop();return e}_build(t,e,i,n){const r=i-e+1;let s,o=this._maxEntries;if(r<=o)return s=Os(t.slice(e,i+1)),Ss(s,this.toBBox),s;n||(n=Math.ceil(Math.log(r)/Math.log(o)),o=Math.ceil(r/Math.pow(o,n-1))),s=Os([]),s.leaf=!1,s.height=n;const a=Math.ceil(r/o),l=a*Math.ceil(Math.sqrt(o));Fs(t,e,i,l,this.compareMinX);for(let r=e;r<=i;r+=l){const e=Math.min(r+l-1,i);Fs(t,r,e,a,this.compareMinY);for(let i=r;i<=e;i+=a){const r=Math.min(i+a-1,e);s.children.push(this._build(t,i,r,n-1))}}return Ss(s,this.toBBox),s}_chooseSubtree(t,e,i,n){for(;n.push(e),!e.leaf&&n.length-1!==i;){let i,n=1/0,r=1/0;for(let s=0;s<e.children.length;s++){const o=e.children[s],a=Is(o),l=Rs(t,o)-a;l<r?(r=l,n=a<n?a:n,i=o):l===r&&a<n&&(n=a,i=o)}e=i||e.children[0]}return e}_insert(t,e,i){const n=i?t:this.toBBox(t),r=[],s=this._chooseSubtree(n,this.data,e,r);for(s.children.push(t),Es(s,n);e>=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(n,r,e)}_split(t,e){const i=t[e],n=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,n);const s=this._chooseSplitIndex(i,r,n),o=Os(i.children.splice(s,i.children.length-s));o.height=i.height,o.leaf=i.leaf,Ss(i,this.toBBox),Ss(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)}_splitRoot(t,e){this.data=Os([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Ss(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let n,r=1/0,s=1/0;for(let o=e;o<=i-e;o++){const e=Ms(t,0,o,this.toBBox),a=Ms(t,o,i,this.toBBox),l=ks(e,a),h=Is(e)+Is(a);l<r?(r=l,n=o,s=h<s?h:s):l===r&&h<s&&(s=h,n=o)}return n||i-e}_chooseSplitAxis(t,e,i){const n=t.leaf?this.compareMinX:Cs,r=t.leaf?this.compareMinY:Ps;this._allDistMargin(t,e,i,n)<this._allDistMargin(t,e,i,r)&&t.children.sort(n)}_allDistMargin(t,e,i,n){t.children.sort(n);const r=this.toBBox,s=Ms(t,0,e,r),o=Ms(t,i-e,i,r);let a=Ts(s)+Ts(o);for(let n=e;n<i-e;n++){const e=t.children[n];Es(s,t.leaf?r(e):e),a+=Ts(s)}for(let n=i-e-1;n>=e;n--){const e=t.children[n];Es(o,t.leaf?r(e):e),a+=Ts(o)}return a}_adjustParentBBoxes(t,e,i){for(let n=i;n>=0;n--)Es(e[n],t)}_condense(t){for(let e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children,e.splice(e.indexOf(t[i]),1)):this.clear():Ss(t[i],this.toBBox)}}function bs(t,e,i){if(!i)return e.indexOf(t);for(let n=0;n<e.length;n++)if(i(t,e[n]))return n;return-1}function Ss(t,e){Ms(t,0,t.children.length,e,t)}function Ms(t,e,i,n,r){r||(r=Os(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let s=e;s<i;s++){const e=t.children[s];Es(r,t.leaf?n(e):e)}return r}function Es(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function Cs(t,e){return t.minX-e.minX}function Ps(t,e){return t.minY-e.minY}function Is(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Ts(t){return t.maxX-t.minX+(t.maxY-t.minY)}function Rs(t,e){return(Math.max(e.maxX,t.maxX)-Math.min(e.minX,t.minX))*(Math.max(e.maxY,t.maxY)-Math.min(e.minY,t.minY))}function ks(t,e){const i=Math.max(t.minX,e.minX),n=Math.max(t.minY,e.minY),r=Math.min(t.maxX,e.maxX),s=Math.min(t.maxY,e.maxY);return Math.max(0,r-i)*Math.max(0,s-n)}function As(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function Gs(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function Os(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Fs(t,e,i,n,r){const s=[e,i];for(;s.length;){if((i=s.pop())-(e=s.pop())<=n)continue;const o=e+Math.ceil((i-e)/n/2)*n;_s(t,o,e,i,r),s.push(e,o,o,i)}}const Ls=[NaN,NaN,NaN,0];let js;const Ns=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Ds=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,zs=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,qs=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function $s(t,e){return t.endsWith("%")?Number(t.substring(0,t.length-1))/e:Number(t)}function Bs(t){throw new Error('failed to parse "'+t+'" as color')}function Us(t){if(t.toLowerCase().startsWith("rgb")){const e=t.match(Ds)||t.match(Ns)||t.match(zs);if(e){const t=e[4],i=100/255;return[dt($s(e[1],i)+.5|0,0,255),dt($s(e[2],i)+.5|0,0,255),dt($s(e[3],i)+.5|0,0,255),void 0!==t?dt($s(t,100),0,1):1]}Bs(t)}if(t.startsWith("#")){if(qs.test(t)){const e=t.substring(1),i=e.length<=4?1:2,n=[0,0,0,255];for(let t=0,r=e.length;t<r;t+=i){let r=parseInt(e.substring(t,t+i),16);1===i&&(r+=r<<4),n[t/i]=r}return n[3]=n[3]/255,n}Bs(t)}const e=(js||(js=or(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),js);e.fillStyle="#abcdef";let i=e.fillStyle;e.fillStyle=t,e.fillStyle===i&&(e.fillStyle="#fedcba",i=e.fillStyle,e.fillStyle=t,e.fillStyle===i&&Bs(t));const n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return Us(n);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);const r=Array.from(e.getImageData(0,0,1,1).data);return r[3]=vt(r[3]/255,3),r}const Ws={};let Xs=0;function Vs(t){if(4===t.length)return t;const e=t.slice();return e[3]=1,e}function Ks(t){return t>.0031308?269.025*Math.pow(t,1/2.4)-14.025:3294.6*t}function Ys(t){return t>.2068965?Math.pow(t,3):108/841*(t-4/29)}function Zs(t){return t>10.314724?Math.pow((t+14.025)/269.025,2.4):t/3294.6}function Hs(t){return t>.0088564?Math.pow(t,1/3):t/(108/841)+4/29}function Js(t){const e=Zs(t[0]),i=Zs(t[1]),n=Zs(t[2]),r=Hs(.222488403*e+.716873169*i+.06060791*n),s=500*(Hs(.452247074*e+.399439023*i+.148375274*n)-r),o=200*(r-Hs(.016863605*e+.117638439*i+.865350722*n)),a=Math.atan2(o,s)*(180/Math.PI);return[116*r-16,Math.sqrt(s*s+o*o),a<0?a+360:a,t[3]]}function Qs(t){if("none"===t)return Ls;if(Ws.hasOwnProperty(t))return Ws[t];if(Xs>=1024){let t=0;for(const e in Ws)3&t++||(delete Ws[e],--Xs)}const e=Us(t);4!==e.length&&Bs(t);for(const i of e)isNaN(i)&&Bs(t);return Ws[t]=e,++Xs,e}function to(t){return Array.isArray(t)?t:Qs(t)}function eo(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let i=t[1];i!=(0|i)&&(i=i+.5|0);let n=t[2];return n!=(0|n)&&(n=n+.5|0),"rgba("+e+","+i+","+n+","+(void 0===t[3]?1:Math.round(1e3*t[3])/1e3)+")"}function io(t){return t[0]>0&&t[1]>0}function no(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}let ro=0;const so=1<<ro++,oo=1<<ro++,ao=1<<ro++,lo=1<<ro++,ho=1<<ro++,uo=1<<ro++,co=Math.pow(2,6)-1,fo={[so]:"boolean",[oo]:"number",[ao]:"string",[lo]:"color",[ho]:"number[]",[uo]:"size"},po=Object.keys(fo).map(Number).sort(v);function go(t){const e=[];for(const i of po)mo(t,i)&&e.push(fo[i]);return 0===e.length?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function mo(t,e){return(t&e)===e}function yo(t,e){return t===e}class _o{constructor(t,e){if(!function(t){return t in fo}(t))throw new Error(`literal expressions must have a specific type, got ${go(t)}`);this.type=t,this.value=e}}class vo{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function xo(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1}}function wo(t,e,i){switch(typeof t){case"boolean":if(yo(e,ao))return new _o(ao,t?"true":"false");if(!mo(e,so))throw new Error(`got a boolean, but expected ${go(e)}`);return new _o(so,t);case"number":if(yo(e,uo))return new _o(uo,no(t));if(yo(e,so))return new _o(so,!!t);if(yo(e,ao))return new _o(ao,t.toString());if(!mo(e,oo))throw new Error(`got a number, but expected ${go(e)}`);return new _o(oo,t);case"string":if(yo(e,lo))return new _o(lo,Qs(t));if(yo(e,so))return new _o(so,!!t);if(!mo(e,ao))throw new Error(`got a string, but expected ${go(e)}`);return new _o(ao,t)}if(!Array.isArray(t))throw new Error("expression must be an array or a primitive value");if(0===t.length)throw new Error("empty expression");if("string"==typeof t[0])return function(t,e,i){const n=t[0],r=ga[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(t,e,i)}(t,e,i);for(const e of t)if("number"!=typeof e)throw new Error("expected an array of numbers");if(yo(e,uo)){if(2!==t.length)throw new Error(`expected an array of two values for a size, got ${t.length}`);return new _o(uo,t)}if(yo(e,lo)){if(3===t.length)return new _o(lo,[...t,1]);if(4===t.length)return new _o(lo,t);throw new Error(`expected an array of 3 or 4 values for a color, got ${t.length}`)}if(!mo(e,ho))throw new Error(`got an array of numbers, but expected ${go(e)}`);return new _o(ho,t)}const bo="get",So="var",Mo="concat",Eo="geometry-type",Co="line-metric",Po="any",Io="all",To="!",Ro="resolution",ko="zoom",Ao="time",Go="==",Oo="!=",Fo=">",Lo=">=",jo="<",No="<=",Do="*",zo="/",qo="+",$o="-",Bo="clamp",Uo="%",Wo="^",Xo="abs",Vo="floor",Ko="ceil",Yo="round",Zo="sin",Ho="cos",Jo="atan",Qo="sqrt",ta="match",ea="between",ia="interpolate",na="coalesce",ra="case",sa="in",oa="number",aa="string",la="array",ha="color",ua="id",ca="band",da="palette",fa="to-string",pa="has",ga={[bo]:Sa(va(1,1/0),ma),[So]:Sa(va(1,1),function(t,e,i){const n=t[1];if("string"!=typeof n)throw new Error("expected a string argument for var operation");return i.variables.add(n),[new _o(ao,n)]}),[pa]:Sa(va(1,1/0),ma),[ua]:Sa(function(t,e,i){i.featureId=!0},_a),[Mo]:Sa(va(2,1/0),wa(ao)),[Eo]:Sa(function(t,e,i){i.geometryType=!0},_a),[Co]:Sa(function(t,e,i){i.mCoordinate=!0},_a),[Ro]:Sa(ya,_a),[ko]:Sa(ya,_a),[Ao]:Sa(ya,_a),[Po]:Sa(va(2,1/0),wa(so)),[Io]:Sa(va(2,1/0),wa(so)),[To]:Sa(va(1,1),wa(so)),[Go]:Sa(va(2,2),wa(co)),[Oo]:Sa(va(2,2),wa(co)),[Fo]:Sa(va(2,2),wa(oo)),[Lo]:Sa(va(2,2),wa(oo)),[jo]:Sa(va(2,2),wa(oo)),[No]:Sa(va(2,2),wa(oo)),[Do]:Sa(va(2,1/0),xa),[na]:Sa(va(2,1/0),xa),[zo]:Sa(va(2,2),wa(oo)),[qo]:Sa(va(2,1/0),wa(oo)),[$o]:Sa(va(2,2),wa(oo)),[Bo]:Sa(va(3,3),wa(oo)),[Uo]:Sa(va(2,2),wa(oo)),[Wo]:Sa(va(2,2),wa(oo)),[Xo]:Sa(va(1,1),wa(oo)),[Vo]:Sa(va(1,1),wa(oo)),[Ko]:Sa(va(1,1),wa(oo)),[Yo]:Sa(va(1,1),wa(oo)),[Zo]:Sa(va(1,1),wa(oo)),[Ho]:Sa(va(1,1),wa(oo)),[Jo]:Sa(va(1,2),wa(oo)),[Qo]:Sa(va(1,1),wa(oo)),[ta]:Sa(va(4,1/0),ba,function(t,e,i){const n=t.length-1,r=ao|oo|so,s=wo(t[1],r,i),o=wo(t[t.length-1],e,i),a=new Array(n-2);for(let e=0;e<n-2;e+=2){try{const n=wo(t[e+2],s.type,i);a[e]=n}catch(t){throw new Error(`failed to parse argument ${e+1} of match expression: ${t.message}`)}try{const n=wo(t[e+3],o.type,i);a[e+1]=n}catch(t){throw new Error(`failed to parse argument ${e+2} of match expression: ${t.message}`)}}return[s,...a,o]}),[ea]:Sa(va(3,3),wa(oo)),[ia]:Sa(va(6,1/0),ba,function(t,e,i){const n=t[1];let r;switch(n[0]){case"linear":r=1;break;case"exponential":const t=n[1];if("number"!=typeof t||t<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(t)} instead`);r=t;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(n)}`)}const s=new _o(oo,r);let o;try{o=wo(t[2],oo,i)}catch(t){throw new Error(`failed to parse argument 1 in interpolate expression: ${t.message}`)}const a=new Array(t.length-3);for(let n=0;n<a.length;n+=2){try{const e=wo(t[n+3],oo,i);a[n]=e}catch(t){throw new Error(`failed to parse argument ${n+2} for interpolate expression: ${t.message}`)}try{const r=wo(t[n+4],e,i);a[n+1]=r}catch(t){throw new Error(`failed to parse argument ${n+3} for interpolate expression: ${t.message}`)}}return[s,o,...a]}),[ra]:Sa(va(3,1/0),function(t,e,i){const n=t[0],r=t.length-1;if(r%2==0)throw new Error(`expected an odd number of arguments for ${n}, got ${r} instead`)},function(t,e,i){const n=wo(t[t.length-1],e,i),r=new Array(t.length-1);for(let e=0;e<r.length-1;e+=2){try{const n=wo(t[e+1],so,i);r[e]=n}catch(t){throw new Error(`failed to parse argument ${e} of case expression: ${t.message}`)}try{const s=wo(t[e+2],n.type,i);r[e+1]=s}catch(t){throw new Error(`failed to parse argument ${e+1} of case expression: ${t.message}`)}}return r[r.length-1]=n,r}),[sa]:Sa(va(2,2),function(t,e,i){let n,r=t[2];if(!Array.isArray(r))throw new Error('the second argument for the "in" operator must be an array');if("literal"===r[0]){if(r=r[1],!Array.isArray(r))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array')}else if("string"==typeof r[0])throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');n="string"==typeof r[0]?ao:oo;const s=new Array(r.length);for(let t=0;t<s.length;t++)try{const e=wo(r[t],n,i);s[t]=e}catch(e){throw new Error(`failed to parse haystack item ${t} for "in" expression: ${e.message}`)}return[wo(t[1],n,i),...s]}),[oa]:Sa(va(1,1/0),wa(co)),[aa]:Sa(va(1,1/0),wa(co)),[la]:Sa(va(1,1/0),wa(oo)),[ha]:Sa(va(1,4),wa(oo)),[ca]:Sa(va(1,3),wa(oo)),[da]:Sa(va(2,2),function(t,e,i){let n;try{n=wo(t[1],oo,i)}catch(t){throw new Error(`failed to parse first argument in palette expression: ${t.message}`)}const r=t[2];if(!Array.isArray(r))throw new Error("the second argument of palette must be an array");const s=new Array(r.length);for(let t=0;t<s.length;t++){let e;try{e=wo(r[t],lo,i)}catch(e){throw new Error(`failed to parse color at index ${t} in palette expression: ${e.message}`)}if(!(e instanceof _o))throw new Error(`the palette color at index ${t} must be a literal value`);s[t]=e}return[n,...s]}),[fa]:Sa(va(1,1),wa(so|oo|ao|lo))};function ma(t,e,i){const n=t.length-1,r=new Array(n);for(let e=0;e<n;++e){const n=t[e+1];switch(typeof n){case"number":r[e]=new _o(oo,n);break;case"string":r[e]=new _o(ao,n);break;default:throw new Error(`expected a string key or numeric array index for a get operation, got ${n}`)}0===e&&i.properties.add(String(n))}return r}function ya(t,e,i){i.mapState=!0}function _a(t,e,i){const n=t[0];if(1!==t.length)throw new Error(`expected no arguments for ${n} operation`);return[]}function va(t,e){return function(i,n,r){const s=i[0],o=i.length-1;if(t===e){if(o!==t)throw new Error(`expected ${t} argument${1===t?"":"s"} for ${s}, got ${o}`)}else if(o<t||o>e)throw new Error(`expected ${e===1/0?`${t} or more`:`${t} to ${e}`} arguments for ${s}, got ${o}`)}}function xa(t,e,i){const n=t.length-1,r=new Array(n);for(let s=0;s<n;++s){const n=wo(t[s+1],e,i);r[s]=n}return r}function wa(t){return function(e,i,n){const r=e.length-1,s=new Array(r);for(let i=0;i<r;++i){const r=wo(e[i+1],t,n);s[i]=r}return s}}function ba(t,e,i){const n=t[0],r=t.length-1;if(r%2==1)throw new Error(`expected an even number of arguments for operation ${n}, got ${r} instead`)}function Sa(...t){return function(e,i,n){const r=e[0];let s;for(let r=0;r<t.length;r++){const o=t[r](e,i,n);if(r==t.length-1){if(!o)throw new Error("expected last argument validator to return the parsed args");s=o}}return new vo(i,r,...s)}}function Ma(t){if(!t)return"";const e=t.getType();switch(e){case"Point":case"LineString":case"Polygon":return e;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return e.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return Ma(t.getGeometries()[0]);default:return""}}function Ea(t,e,i){return Ca(wo(t,e,i),i)}function Ca(t,e){if(t instanceof _o){if(t.type===lo&&"string"==typeof t.value){const e=Qs(t.value);return function(){return e}}return function(){return t.value}}const i=t.operator;switch(i){case oa:case aa:case na:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=Ca(t.args[i],e);switch(i){case na:return t=>{for(let e=0;e<n;++e){const i=r[e](t);if(null!=i)return i}throw new Error("Expected one of the values to be non-null")};case oa:case aa:return t=>{for(let e=0;e<n;++e){const n=r[e](t);if(typeof n===i)return n}throw new Error(`Expected one of the values to be a ${i}`)};default:throw new Error(`Unsupported assertion operator ${i}`)}}(t,e);case bo:case So:case pa:return function(t){const e=t.args[0].value;switch(t.operator){case bo:return i=>{const n=t.args;let r=i.properties[e];for(let t=1,e=n.length;t<e;++t)r=r[n[t].value];return r};case So:return t=>t.variables[e];case pa:return i=>{const n=t.args;if(!(e in i.properties))return!1;let r=i.properties[e];for(let t=1,e=n.length;t<e;++t){const e=n[t].value;if(!r||!Object.hasOwn(r,e))return!1;r=r[e]}return!0};default:throw new Error(`Unsupported accessor operator ${t.operator}`)}}(t);case"id":return t=>t.featureId;case Eo:return t=>t.geometryType;case Mo:{const i=t.args.map(t=>Ca(t,e));return t=>"".concat(...i.map(e=>e(t).toString()))}case Ro:return t=>t.resolution;case Po:case Io:case ea:case sa:case"!":return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=Ca(t.args[i],e);switch(i){case Po:return t=>{for(let e=0;e<n;++e)if(r[e](t))return!0;return!1};case Io:return t=>{for(let e=0;e<n;++e)if(!r[e](t))return!1;return!0};case ea:return t=>{const e=r[0](t),i=r[1](t),n=r[2](t);return e>=i&&e<=n};case sa:return t=>{const e=r[0](t);for(let i=1;i<n;++i)if(e===r[i](t))return!0;return!1};case"!":return t=>!r[0](t);default:throw new Error(`Unsupported logical operator ${i}`)}}(t,e);case Go:case Oo:case"<":case No:case">":case Lo:return function(t,e){const i=t.operator,n=Ca(t.args[0],e),r=Ca(t.args[1],e);switch(i){case Go:return t=>n(t)===r(t);case Oo:return t=>n(t)!==r(t);case"<":return t=>n(t)<r(t);case No:return t=>n(t)<=r(t);case">":return t=>n(t)>r(t);case Lo:return t=>n(t)>=r(t);default:throw new Error(`Unsupported comparison operator ${i}`)}}(t,e);case"*":case"/":case"+":case"-":case Bo:case"%":case"^":case Xo:case Vo:case Ko:case Yo:case Zo:case Ho:case Jo:case Qo:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=Ca(t.args[i],e);switch(i){case"*":return t=>{let e=1;for(let i=0;i<n;++i)e*=r[i](t);return e};case"/":return t=>r[0](t)/r[1](t);case"+":return t=>{let e=0;for(let i=0;i<n;++i)e+=r[i](t);return e};case"-":return t=>r[0](t)-r[1](t);case Bo:return t=>{const e=r[0](t),i=r[1](t);if(e<i)return i;const n=r[2](t);return e>n?n:e};case"%":return t=>r[0](t)%r[1](t);case"^":return t=>Math.pow(r[0](t),r[1](t));case Xo:return t=>Math.abs(r[0](t));case Vo:return t=>Math.floor(r[0](t));case Ko:return t=>Math.ceil(r[0](t));case Yo:return t=>Math.round(r[0](t));case Zo:return t=>Math.sin(r[0](t));case Ho:return t=>Math.cos(r[0](t));case Jo:return 2===n?t=>Math.atan2(r[0](t),r[1](t)):t=>Math.atan(r[0](t));case Qo:return t=>Math.sqrt(r[0](t));default:throw new Error(`Unsupported numeric operator ${i}`)}}(t,e);case ra:return function(t,e){const i=t.args.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=Ca(t.args[r],e);return t=>{for(let e=0;e<i-1;e+=2)if(n[e](t))return n[e+1](t);return n[i-1](t)}}(t,e);case ta:return function(t,e){const i=t.args.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=Ca(t.args[r],e);return t=>{const e=n[0](t);for(let r=1;r<i-1;r+=2)if(e===n[r](t))return n[r+1](t);return n[i-1](t)}}(t,e);case ia:return function(t,e){const i=t.args.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=Ca(t.args[r],e);return t=>{const e=n[0](t),r=n[1](t);let s,o;for(let a=2;a<i;a+=2){const i=n[a](t);let l=n[a+1](t);const h=Array.isArray(l);if(h&&(l=Vs(l)),i>=r)return 2===a?l:h?Ia(e,r,s,o,i,l):Pa(e,r,s,o,i,l);s=i,o=l}return o}}(t,e);case fa:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=Ca(t.args[i],e);if(i===fa)return e=>{const i=r[0](e);return t.args[0].type===lo?eo(i):i.toString()};throw new Error(`Unsupported convert operator ${i}`)}(t,e);default:throw new Error(`Unsupported operator ${i}`)}}function Pa(t,e,i,n,r,s){const o=r-i;if(0===o)return n;const a=e-i;return n+(1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1))*(s-n)}function Ia(t,e,i,n,r,s){if(0===r-i)return n;const o=Js(n),a=Js(s);let l=a[2]-o[2];return l>180?l-=360:l<-180&&(l+=360),function(t){const e=(t[0]+16)/116,i=t[1],n=t[2]*Math.PI/180,r=Ys(e),s=Ys(e+i/500*Math.cos(n)),o=Ys(e-i/200*Math.sin(n)),a=Ks(3.021973625*s-1.617392459*r-.404875592*o),l=Ks(-.943766287*s+1.916279586*r+.027607165*o),h=Ks(.069407491*s-.22898585*r+1.159737864*o);return[dt(a+.5|0,0,255),dt(l+.5|0,0,255),dt(h+.5|0,0,255),t[3]]}([Pa(t,e,i,o[0],r,a[0]),Pa(t,e,i,o[1],r,a[1]),o[2]+Pa(t,e,i,0,r,l),Pa(t,e,i,n[3],r,s[3])])}function Ta(t,e){return t+":"+(e?to(e):"null")}const Ra=new class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];3&t++||i.hasListener()||(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e){const i=Ta(t,e);return i in this.cache_?this.cache_[i]:null}getPattern(t,e){const i=Ta(t,e);return i in this.patternCache_?this.patternCache_[i]:null}set(t,e,i,n){const r=Ta(t,e),s=r in this.cache_;this.cache_[r]=i,n&&(0===i.getImageState()&&i.load(),1===i.getImageState()?i.ready().then(()=>{this.patternCache_[r]=lr().createPattern(i.getImage(1),"repeat")}):this.patternCache_[r]=lr().createPattern(i.getImage(1),"repeat")),s||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}};let ka=null;class Aa extends k{constructor(t,e,i,n,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i?.crossOrigin,this.referrerPolicy_=i?.referrerPolicy,this.canvas_={},this.color_=r,this.imageState_=void 0===n?0:n,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(void 0===this.tainted_&&2===this.imageState_){ka||(ka=or(1,1,void 0,{willReadFrequently:!0})),ka.drawImage(this.image_,0,0);try{ka.getImageData(0,0,1,1),this.tainted_=!1}catch{ka=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(c)}handleImageError_(){this.imageState_=3,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=2,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}setImage(t){this.image_=t}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=or(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(0===this.imageState_){this.image_||this.initializeImage_(),this.imageState_=1;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&(t=this.image_,e=this.src_,e&&(t.src=e),t.src&&Z?new Promise((e,i)=>t.decode().then(()=>e(t)).catch(n=>t.complete&&t.width?e(t):i(n))):function(t){return new Promise((e,i)=>{function n(){s(),e(t)}function r(){s(),i(new Error("Image load error"))}function s(){t.removeEventListener("load",n),t.removeEventListener("error",r)}t.addEventListener("load",n),t.addEventListener("error",r)})}(t)).then(t=>{this.image_=t,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}var t,e}replaceColor_(t){if(!this.color_||this.canvas_[t]||2!==this.imageState_)return;const e=this.image_,i=or(Math.ceil(e.width*t),Math.ceil(e.height*t)),n=i.canvas;var r;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle="string"==typeof(r=this.color_)?r:eo(r),i.fillRect(0,0,n.width/t,n.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=n}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(2===this.imageState_||3===this.imageState_)t();else{const e=()=>{2!==this.imageState_&&3!==this.imageState_||(this.removeEventListener(c,e),t())};this.addEventListener(c,e)}})),this.ready_}}function Ga(t,e,i,n,r,s){let o=void 0===e?void 0:Ra.get(e,r);return o||(o=new Aa(t,t&&"src"in t?t.src||void 0:e,i,n,r),Ra.set(e,r,o,s)),s&&o&&!Ra.getPattern(e,r)&&Ra.set(e,r,o,s),o}const Oa=Aa;function Fa(t){return t?Array.isArray(t)?eo(t):"object"==typeof t&&"src"in t?function(t){if(!t.offset||!t.size)return Ra.getPattern(t.src,t.color);const e=t.src+":"+t.offset,i=Ra.getPattern(e,t.color);if(i)return i;const n=Ra.get(t.src,null);if(2!==n.getImageState())return null;const r=or(t.size[0],t.size[1]);return r.drawImage(n.getImage(1),t.offset[0],t.offset[1],t.size[0],t.size[1],0,0,t.size[0],t.size[1]),Ga(r.canvas,e,void 0,2,t.color,!0),Ra.getPattern(e,t.color)}(t):t:null}const La="10px sans-serif",ja="#000",Na="round",Da=[],za="round",qa="#000",$a="center",Ba="middle",Ua=[0,0,0,0],Wa=new N;let Xa,Va=null;const Ka={},Ya=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Za(t,e,i){return`${t} ${e} 16px "${i}"`}const Ha=function(){const t=100;let e,i;async function n(t){await i.ready;const e=await i.load(t);if(0===e.length)return!1;const n=sr(t),r=n.families[0].toLowerCase(),s=n.weight;return e.some(t=>{const e=t.family.replace(/^['"]|['"]$/g,"").toLowerCase(),i=rr[t.weight]||t.weight;return e===r&&t.style===n.style&&i==s})}async function r(){await i.ready;let s=!0;const a=Wa.getProperties(),l=Object.keys(a).filter(e=>a[e]<t);for(let e=l.length-1;e>=0;--e){const i=l[e];let r=a[i];r<t&&(await n(i)?(o(Ka),Wa.set(i,t)):(r+=10,Wa.set(i,r,!0),r<t&&(s=!1)))}e=void 0,s||(e=setTimeout(r,100))}return async function(t){i||(i=Y?self.fonts:document.fonts);const n=sr(t);if(!n)return;const s=n.families;let o=!1;for(const t of s){if(Ya.has(t))continue;const e=Za(n.style,n.weight,t);void 0===Wa.get(e)&&(Wa.set(e,0,!0),o=!0)}o&&(clearTimeout(e),e=setTimeout(r,100))}}(),Ja=function(){let t;return function(e){let i=Ka[e];if(null==i){if(Y){const t=sr(e),n=Qa(e,"Žg");i=(isNaN(Number(t.lineHeight))?1.2:Number(t.lineHeight))*(n.actualBoundingBoxAscent+n.actualBoundingBoxDescent)}else t||(t=document.createElement("div"),t.innerHTML="M",t.style.minHeight="0",t.style.maxHeight="none",t.style.height="auto",t.style.padding="0",t.style.border="none",t.style.position="absolute",t.style.display="block",t.style.left="-99999px"),t.style.font=e,document.body.appendChild(t),i=t.offsetHeight,document.body.removeChild(t);Ka[e]=i}return i}}();function Qa(t,e){return Va||(Va=or(1,1)),t!=Xa&&(Va.font=t,Xa=Va.font),Va.measureText(e)}function tl(t,e){return Qa(t,e).width}function el(t,e,i){if(e in i)return i[e];const n=e.split("\n").reduce((e,i)=>Math.max(e,tl(t,i)),0);return i[e]=n,n}class il{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=no(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new il({opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return O()}getImage(t){return O()}getHitDetectionImage(){return O()}getPixelRatio(t){return 1}getImageState(){return O()}getImageSize(){return O()}getOrigin(){return O()}getSize(){return O()}setDisplacement(t){this.displacement_=t}setOpacity(t){this.opacity_=t}setRotateWithView(t){this.rotateWithView_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=no(t)}listenImageChange(t){O()}load(){O()}unlistenImageChange(t){O()}ready(){return Promise.resolve()}}const nl=il;class rl extends nl{constructor(t){super({opacity:1,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,rotation:void 0!==t.rotation?t.rotation:0,scale:void 0!==t.scale?t.scale:1,displacement:void 0!==t.displacement?t.displacement:[0,0],declutterMode:t.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=void 0!==t.fill?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius=t.radius,this.radius2_=t.radius2,this.angle_=void 0!==t.angle?t.angle:0,this.stroke_=void 0!==t.stroke?t.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?1:2,1===this.imageState_&&this.ready().then(()=>this.imageState_=2),this.render()}clone(){const t=this.getScale(),e=new rl({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){const e=this.fill_?.getKey(),i=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let n=Ra.get(i,null)?.getImage(1);if(!n){const e=this.renderOptions_,r=Math.ceil(e.size*t),s=or(r,r);this.draw_(e,s,t),n=s.canvas;const o=new Oa(n,void 0,null,2,null);Ra.set(i,null,o),createImageBitmap(n).then(t=>{o.setImage(t)})}return n}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(t){this.radius!==t&&(this.radius=t,this.render())}getRadius2(){return this.radius2_}setRadius2(t){this.radius2_!==t&&(this.radius2_=t,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(0===e||this.points_===1/0||"bevel"!==t&&"miter"!==t)return e;let n=this.radius,r=void 0===this.radius2_?n:this.radius2_;if(n<r){const t=n;n=r,r=t}const s=void 0===this.radius2_?this.points_:2*this.points_,o=2*Math.PI/s,a=r*Math.sin(o),l=n-Math.sqrt(r*r-a*a),h=Math.sqrt(a*a+l*l),u=h/a;if("miter"===t&&u<=i)return u*e;const c=e/2/u,d=e/2*(l/h),f=Math.sqrt((n+c)*(n+c)+d*d)-n;if(void 0===this.radius2_||"bevel"===t)return 2*f;const p=n*Math.sin(o),g=r-Math.sqrt(n*n-p*p),m=Math.sqrt(p*p+g*g)/p;if(m<=i){const t=m*e/2-r-n;return 2*Math.max(f,t)}return 2*f}createRenderOptions(){let t,e=Na,i=za,n=0,r=null,s=0,o=0;this.stroke_&&(t=Fa(this.stroke_.getColor()??qa),o=this.stroke_.getWidth()??1,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,i=this.stroke_.getLineJoin()??za,e=this.stroke_.getLineCap()??Na,n=this.stroke_.getMiterLimit()??10);const a=this.calculateLineJoinSize_(i,o,n),l=Math.max(this.radius,this.radius2_||0);return{strokeStyle:t,strokeWidth:o,size:Math.ceil(2*l+a),lineCap:e,lineDash:r,lineDashOffset:s,lineJoin:i,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let t=this.fill_.getColor();null===t&&(t=ja),e.fillStyle=Fa(t),e.fill()}t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){let e;if(this.fill_){let i=this.fill_.getColor(),n=0;"string"==typeof i&&(i=to(i)),null===i?n=1:Array.isArray(i)&&(n=4===i.length?i[3]:1),0===n&&(e=or(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_;const i=this.radius;if(e===1/0)t.arc(0,0,i,0,2*Math.PI);else{const n=void 0===this.radius2_?i:this.radius2_;void 0!==this.radius2_&&(e*=2);const r=this.angle_-Math.PI/2,s=2*Math.PI/e;for(let o=0;o<e;o++){const e=r+o*s,a=o%2==0?i:n;t.lineTo(a*Math.cos(e),a*Math.sin(e))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=ja,e.fill(),t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}}const sl=rl;class ol extends sl{constructor(t){super({points:1/0,fill:(t=t||{radius:5}).fill,radius:t.radius,stroke:t.stroke,scale:void 0!==t.scale?t.scale:1,rotation:void 0!==t.rotation?t.rotation:0,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,displacement:void 0!==t.displacement?t.displacement:[0,0],declutterMode:t.declutterMode})}clone(){const t=this.getScale(),e=new ol({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}}const al=ol;class ll{constructor(t){t=t||{},this.patternImage_=null,this.color_=null,void 0!==t.color&&this.setColor(t.color)}clone(){const t=this.getColor();return new ll({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){if(null!==t&&"object"==typeof t&&"src"in t){const e=Ga(null,t.src,{crossOrigin:"anonymous"},void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));e.ready().then(()=>{this.patternImage_=null}),0===e.getImageState()&&e.load(),1===e.getImageState()&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?L(t):"object"==typeof t&&"src"in t?t.src+":"+t.offset:to(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}const hl=ll;function ul(t,e,i,n){return void 0!==i&&void 0!==n?[i/t,n/e]:void 0!==i?i/t:void 0!==n?n/e:1}class cl extends nl{constructor(t){const e=void 0!==(t=t||{}).opacity?t.opacity:1,i=void 0!==t.rotation?t.rotation:0,n=void 0!==t.scale?t.scale:1,r=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:i,scale:n,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:r,declutterMode:t.declutterMode}),this.anchor_=void 0!==t.anchor?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==t.anchorOrigin?t.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==t.anchorXUnits?t.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==t.anchorYUnits?t.anchorYUnits:"fraction",this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null,this.referrerPolicy_=t.referrerPolicy;const s=void 0!==t.img?t.img:null;let o,a=t.src;if(at(!(void 0!==a&&s),"`image` and `src` cannot be provided at the same time"),void 0!==a&&0!==a.length||!s||(a=s.src||L(s)),at(void 0!==a&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),at(!((void 0!==t.width||void 0!==t.height)&&void 0!==t.scale),"`width` or `height` cannot be provided together with `scale`"),void 0!==t.src?o=0:void 0!==s&&(o="complete"in s?s.complete?s.src?2:0:1:2),this.color_=void 0!==t.color?to(t.color):null,this.iconImage_=Ga(s,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},o,this.color_),this.offset_=void 0!==t.offset?t.offset:[0,0],this.offsetOrigin_=void 0!==t.offsetOrigin?t.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==t.size?t.size:null,this.initialOptions_,void 0!==t.width||void 0!==t.height){let e,i;if(t.size)[e,i]=t.size;else{const n=this.getImage(1);if(n.width&&n.height)e=n.width,i=n.height;else if(n instanceof HTMLImageElement){this.initialOptions_=t;const e=()=>{if(this.unlistenImageChange(e),!this.initialOptions_)return;const i=this.iconImage_.getSize();this.setScale(ul(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(ul(e,i,t.width,t.height))}}clone(){let t,e,i;return this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new cl({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:i,size:null!==this.size_?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const e=this.getSize();if("fraction"==this.anchorXUnits_||"fraction"==this.anchorYUnits_){if(!e)return null;t=this.anchor_.slice(),"fraction"==this.anchorXUnits_&&(t[0]*=e[0]),"fraction"==this.anchorYUnits_&&(t[1]*=e[1])}if("top-left"!=this.anchorOrigin_){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),"top-right"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[0]=-t[0]+e[0]),"bottom-left"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[1]=-t[1]+e[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(t){const e=t?to(t):null;if(this.color_===e||this.color_&&e&&this.color_.length===e.length&&this.color_.every((t,i)=>t===e[i]))return;this.color_=e;const i=this.getSrc(),n=void 0!==i?null:this.getHitDetectionImage(),r=void 0!==i?0:this.iconImage_.getImageState();this.iconImage_=Ga(n,i,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},r,this.color_)}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if("top-left"!=this.offsetOrigin_){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[0]=i[0]-e[0]-t[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(t){this.iconImage_=Ga(null,t,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},0,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();return this.size_?this.size_[0]*t[0]:2==this.iconImage_.getImageState()?this.iconImage_.getSize()[0]*t[0]:void 0}getHeight(){const t=this.getScaleArray();return this.size_?this.size_[1]*t[1]:2==this.iconImage_.getImageState()?this.iconImage_.getSize()[1]*t[1]:void 0}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(c,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(c,t)}ready(){return this.iconImage_.ready()}}const dl=cl;class fl{constructor(t){t=t||{},this.color_=void 0!==t.color?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=void 0!==t.lineDash?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.offset_=t.offset,this.width_=t.width}clone(){const t=this.getColor();return new fl({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),offset:this.getOffset(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setOffset(t){this.offset_=t}setWidth(t){this.width_=t}}const pl=fl;class gl{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=_l,void 0!==t.geometry&&this.setGeometry(t.geometry),this.fill_=void 0!==t.fill?t.fill:null,this.image_=void 0!==t.image?t.image:null,this.renderer_=void 0!==t.renderer?t.renderer:null,this.hitDetectionRenderer_=void 0!==t.hitDetectionRenderer?t.hitDetectionRenderer:null,this.stroke_=void 0!==t.stroke?t.stroke:null,this.text_=void 0!==t.text?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&"object"==typeof t&&(t=t.clone()),new gl({geometry:t??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=_l,this.geometry_=t}setZIndex(t){this.zIndex_=t}}let ml=null;function yl(t,e){if(!ml){const t=new hl({color:"rgba(255,255,255,0.4)"}),e=new pl({color:"#3399CC",width:1.25});ml=[new gl({image:new al({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return ml}function _l(t){return t.getGeometry()}const vl=gl;class xl{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.keepUpright_=t.keepUpright,this.scale_=t.scale,this.scaleArray_=no(void 0!==t.scale?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.repeat_=t.repeat,this.textBaseline_=t.textBaseline,this.fill_=void 0!==t.fill?t.fill:new hl({color:"#333"}),this.maxAngle_=void 0!==t.maxAngle?t.maxAngle:Math.PI/4,this.placement_=void 0!==t.placement?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=void 0!==t.stroke?t.stroke:null,this.offsetX_=void 0!==t.offsetX?t.offsetX:0,this.offsetY_=void 0!==t.offsetY?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=void 0===t.padding?null:t.padding,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new xl({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof hl?this.getFill().clone():this.getFill(),stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setKeepUpright(t){this.keepUpright_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=no(void 0!==t?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}}const wl=xl;function bl(t){return!0}function Sl(t){const e=xo(),i=function(t,e){const i=t.length,n=new Array(i);for(let r=0;r<i;++r){const i=t[r],s="filter"in i?Ea(i.filter,so,e):bl;let o;if(Array.isArray(i.style)){const t=i.style.length;o=new Array(t);for(let n=0;n<t;++n)o[n]=El(i.style[n],e)}else o=[El(i.style,e)];n[r]={filter:s,styles:o}}return function(e){const r=[];let s=!1;for(let o=0;o<i;++o)if((0,n[o].filter)(e)&&(!t[o].else||!s)){s=!0;for(const t of n[o].styles){const i=t(e);i&&r.push(i)}}return r}}(t,e),n={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""};return function(t,r){if(n.properties=t.getPropertiesInternal(),n.resolution=r,e.featureId){const e=t.getId();n.featureId=void 0!==e?e:null}return e.geometryType&&(n.geometryType=Ma(t.getGeometry())),i(n)}}function Ml(t){const e=xo(),i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=El(t[r],e);const r={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""},s=new Array(i);return function(t,o){if(r.properties=t.getPropertiesInternal(),r.resolution=o,e.featureId){const e=t.getId();r.featureId=void 0!==e?e:null}let a=0;for(let t=0;t<i;++t){const e=n[t](r);e&&(s[a]=e,a+=1)}return s.length=a,s}}function El(t,e){const i=Cl(t,"",e),n=Pl(t,"",e),r=function(t,e){const i="text-",n=Rl(t,i+"value",e);if(!n)return null;const r=Cl(t,i,e),s=Cl(t,i+"background-",e),o=Pl(t,i,e),a=Pl(t,i+"background-",e),l=Rl(t,i+"font",e),h=Tl(t,i+"max-angle",e),u=Tl(t,i+"offset-x",e),c=Tl(t,i+"offset-y",e),d=kl(t,i+"overflow",e),f=Rl(t,i+"placement",e),p=Tl(t,i+"repeat",e),g=Ll(t,i+"scale",e),m=kl(t,i+"rotate-with-view",e),y=Tl(t,i+"rotation",e),_=Rl(t,i+"align",e),v=Rl(t,i+"justify",e),x=Rl(t,i+"baseline",e),w=kl(t,i+"keep-upright",e),b=Gl(t,i+"padding",e),S=zl(t,i+"declutter-mode"),M=new wl({declutterMode:S});return function(t){if(M.setText(n(t)),r&&M.setFill(r(t)),s&&M.setBackgroundFill(s(t)),o&&M.setStroke(o(t)),a&&M.setBackgroundStroke(a(t)),l&&M.setFont(l(t)),h&&M.setMaxAngle(h(t)),u&&M.setOffsetX(u(t)),c&&M.setOffsetY(c(t)),d&&M.setOverflow(d(t)),f){const e=f(t);if("point"!==e&&"line"!==e)throw new Error("Expected point or line for text-placement");M.setPlacement(e)}if(p&&M.setRepeat(p(t)),g&&M.setScale(g(t)),m&&M.setRotateWithView(m(t)),y&&M.setRotation(y(t)),_){const e=_(t);if("left"!==e&&"center"!==e&&"right"!==e&&"end"!==e&&"start"!==e)throw new Error("Expected left, right, center, start, or end for text-align");M.setTextAlign(e)}if(v){const e=v(t);if("left"!==e&&"right"!==e&&"center"!==e)throw new Error("Expected left, right, or center for text-justify");M.setJustify(e)}if(x){const e=x(t);if("bottom"!==e&&"top"!==e&&"middle"!==e&&"alphabetic"!==e&&"hanging"!==e)throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");M.setTextBaseline(e)}return b&&M.setPadding(b(t)),w&&M.setKeepUpright(w(t)),M}}(t,e),s=function(t,e){return"icon-src"in t?function(t,e){const i="icon-",n=i+"src",r=$l(t[n],n),s=Ol(t,i+"anchor",e),o=Ll(t,i+"scale",e),a=Tl(t,i+"opacity",e),l=Ol(t,i+"displacement",e),h=Tl(t,i+"rotation",e),u=kl(t,i+"rotate-with-view",e),c=Nl(t,i+"anchor-origin"),d=Dl(t,i+"anchor-x-units"),f=Dl(t,i+"anchor-y-units"),p=Il(t,i+"color");let g,m=null;void 0!==p&&(Array.isArray(p)&&p.length>0&&"string"==typeof p[0]?m=Al(t,i+"color",e):g=Ul(p,i+"color"));const y=function(t,e){const i=t[e];if(void 0!==i){if("string"!=typeof i)throw new Error(`Expected a string for ${e}`);return i}}(t,i+"cross-origin"),_=function(t,e){const i=t[e];if(void 0!==i)return ql(i,e)}(t,i+"offset"),v=Nl(t,i+"offset-origin"),x=jl(t,i+"width"),w=jl(t,i+"height"),b=function(t,e){const i=t[e];if(void 0!==i){if("number"==typeof i)return no(i);if(!Array.isArray(i))throw new Error(`Expected a number or size array for ${e}`);if(2!==i.length||"number"!=typeof i[0]||"number"!=typeof i[1])throw new Error(`Expected a number or size array for ${e}`);return i}}(t,i+"size"),S={src:r,anchorOrigin:c,anchorXUnits:d,anchorYUnits:f,crossOrigin:y,offset:_,offsetOrigin:v,height:w,width:x,size:b,declutterMode:zl(t,i+"declutter-mode")};let M=null;return function(t){if(M)m&&M.setColor(m(t));else{const e=m?m(t):g;M=new dl(void 0!==e?Object.assign({},S,{color:e}):Object.assign({},S))}return a&&M.setOpacity(a(t)),l&&M.setDisplacement(l(t)),h&&M.setRotation(h(t)),u&&M.setRotateWithView(u(t)),o&&M.setScale(o(t)),s&&M.setAnchor(s(t)),M}}(t,e):"shape-points"in t?function(t,e){const i="shape-",n=i+"points",r=i+"radius",s=Bl(t[n],n);if(!(r in t))throw new Error(`Expected a number for ${r}`);const o=Tl(t,r,e),a="number"==typeof t[r]?t[r]:5,l=i+"radius2",h=Tl(t,l,e),u="number"==typeof t[l]?t[l]:void 0,c=Cl(t,i,e),d=Pl(t,i,e),f=Ll(t,i+"scale",e),p=Ol(t,i+"displacement",e),g=Tl(t,i+"rotation",e),m=kl(t,i+"rotate-with-view",e),y=jl(t,i+"angle"),_=zl(t,i+"declutter-mode"),v=new sl({points:s,radius:a,radius2:u,angle:y,declutterMode:_});return function(t){return o&&v.setRadius(o(t)),h&&v.setRadius2(h(t)),c&&v.setFill(c(t)),d&&v.setStroke(d(t)),p&&v.setDisplacement(p(t)),g&&v.setRotation(g(t)),m&&v.setRotateWithView(m(t)),f&&v.setScale(f(t)),v}}(t,e):"circle-radius"in t?function(t,e){const i="circle-",n=Cl(t,i,e),r=Pl(t,i,e),s=Tl(t,i+"radius",e),o=Ll(t,i+"scale",e),a=Ol(t,i+"displacement",e),l=Tl(t,i+"rotation",e),h=kl(t,i+"rotate-with-view",e),u=zl(t,i+"declutter-mode"),c=new al({radius:5,declutterMode:u});return function(t){return s&&c.setRadius(s(t)),n&&c.setFill(n(t)),r&&c.setStroke(r(t)),a&&c.setDisplacement(a(t)),l&&c.setRotation(l(t)),h&&c.setRotateWithView(h(t)),o&&c.setScale(o(t)),c}}(t,e):null}(t,e),o=Tl(t,"z-index",e);if(!(i||n||r||s||a(t)))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(t));const l=new vl;return function(t){let e=!0;if(i){const n=i(t);n&&(e=!1),l.setFill(n)}if(n){const i=n(t);i&&(e=!1),l.setStroke(i)}if(r){const i=r(t);i&&(e=!1),l.setText(i)}if(s){const i=s(t);i&&(e=!1),l.setImage(i)}return o&&l.setZIndex(o(t)),e?null:l}}function Cl(t,e,i){let n;if(e+"fill-pattern-src"in t)n=function(t,e,i){const n=Rl(t,e+"pattern-src",i),r=Fl(t,e+"pattern-offset",i),s=Fl(t,e+"pattern-size",i),o=Al(t,e+"color",i);return function(t){return{src:n(t),offset:r&&r(t),size:s&&s(t),color:o&&o(t)}}}(t,e+"fill-",i);else{if("none"===t[e+"fill-color"])return t=>null;n=Al(t,e+"fill-color",i)}if(!n)return null;const r=new hl;return function(t){const e=n(t);return e===Ls?null:(r.setColor(e),r)}}function Pl(t,e,i){const n=Tl(t,e+"stroke-width",i),r=Al(t,e+"stroke-color",i);if(!n&&!r)return null;const s=Rl(t,e+"stroke-line-cap",i),o=Rl(t,e+"stroke-line-join",i),a=Gl(t,e+"stroke-line-dash",i),l=Tl(t,e+"stroke-line-dash-offset",i),h=Tl(t,e+"stroke-miter-limit",i),u=Tl(t,e+"stroke-offset",i),c=new pl;return function(t){if(r){const e=r(t);if(e===Ls)return null;c.setColor(e)}if(n&&c.setWidth(n(t)),s){const e=s(t);if("butt"!==e&&"round"!==e&&"square"!==e)throw new Error("Expected butt, round, or square line cap");c.setLineCap(e)}if(o){const e=o(t);if("bevel"!==e&&"round"!==e&&"miter"!==e)throw new Error("Expected bevel, round, or miter line join");c.setLineJoin(e)}return a&&c.setLineDash(a(t)),l&&c.setLineDashOffset(l(t)),h&&c.setMiterLimit(h(t)),u&&c.setOffset(u(t)),c}}function Il(t,e){if(!(e in t))return;const i=t[e];return void 0===i?void 0:i}function Tl(t,e,i){const n=Il(t,e);if(void 0===n)return;const r=Ea(n,oo,i);return function(t){return Bl(r(t),e)}}function Rl(t,e,i){const n=Il(t,e);if(void 0===n)return null;const r=Ea(n,ao,i);return function(t){return $l(r(t),e)}}function kl(t,e,i){const n=Il(t,e);if(void 0===n)return null;const r=Ea(n,so,i);return function(t){const i=r(t);if("boolean"!=typeof i)throw new Error(`Expected a boolean for ${e}`);return i}}function Al(t,e,i){const n=Il(t,e);if(void 0===n)return null;const r=Ea(n,lo,i);return function(t){return Ul(r(t),e)}}function Gl(t,e,i){const n=Il(t,e);if(void 0===n)return null;if(Array.isArray(n)&&(0===n.length||"string"!=typeof n[0])){const t=n.map((t,n)=>{if("number"==typeof t)return()=>t;const r=Ea(t,oo,i);return function(t){return Bl(r(t),`${e}[${n}]`)}});return function(e){const i=new Array(t.length);for(let n=0;n<t.length;++n)i[n]=t[n](e);return i}}const r=Ea(n,ho,i);return function(t){return ql(r(t),e)}}function Ol(t,e,i){const n=Il(t,e);if(void 0===n)return null;const r=Ea(n,ho,i);return function(t){const i=ql(r(t),e);if(2!==i.length)throw new Error(`Expected two numbers for ${e}`);return i}}function Fl(t,e,i){const n=Il(t,e);if(void 0===n)return null;const r=Ea(n,ho,i);return function(t){return Wl(r(t),e)}}function Ll(t,e,i){const n=Il(t,e);if(void 0===n)return null;const r=Ea(n,ho|oo,i);return function(t){return i=r(t),n=e,"number"==typeof i?i:Wl(i,n);var i,n}}function jl(t,e){const i=t[e];if(void 0!==i){if("number"!=typeof i)throw new Error(`Expected a number for ${e}`);return i}}function Nl(t,e){const i=t[e];if(void 0!==i){if("bottom-left"!==i&&"bottom-right"!==i&&"top-left"!==i&&"top-right"!==i)throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return i}}function Dl(t,e){const i=t[e];if(void 0!==i){if("pixels"!==i&&"fraction"!==i)throw new Error(`Expected pixels or fraction for ${e}`);return i}}function zl(t,e){const i=t[e];if(void 0!==i){if("string"!=typeof i)throw new Error(`Expected a string for ${e}`);if("declutter"!==i&&"obstacle"!==i&&"none"!==i)throw new Error(`Expected declutter, obstacle, or none for ${e}`);return i}}function ql(t,e){if(!Array.isArray(t))throw new Error(`Expected an array for ${e}`);const i=t.length;for(let n=0;n<i;++n)if("number"!=typeof t[n])throw new Error(`Expected an array of numbers for ${e}`);return t}function $l(t,e){if("string"!=typeof t)throw new Error(`Expected a string for ${e}`);return t}function Bl(t,e){if("number"!=typeof t)throw new Error(`Expected a number for ${e}`);return t}function Ul(t,e){if("string"==typeof t)return t;const i=ql(t,e),n=i.length;if(n<3||n>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return i}function Wl(t,e){const i=ql(t,e);if(2!==i.length)throw new Error(`Expected an array of two numbers for ${e}`);return i}const Xl="renderOrder",Vl=class extends ys{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=t.declutter?String(t.declutter):void 0,this.renderBuffer_=void 0!==t.renderBuffer?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=void 0!==t.updateWhileAnimating&&t.updateWhileAnimating,this.updateWhileInteracting_=void 0!==t.updateWhileInteracting&&t.updateWhileInteracting}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(Xl)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const i=this.getDeclutter();i in t.declutter==0&&(t.declutter[i]=new ws(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(Xl,t)}setStyle(t){this.style_=void 0===t?yl:t;const e=function(t){if(void 0===t)return yl;if(!t)return null;if("function"==typeof t)return t;if(t instanceof vl)return t;if(!Array.isArray(t))return Ml([t]);if(0===t.length)return[];const e=t.length,i=t[0];if(i instanceof vl){const i=new Array(e);for(let n=0;n<e;++n){const e=t[n];if(!(e instanceof vl))throw new Error("Expected a list of style instances");i[n]=e}return i}if("style"in i){const i=new Array(e);for(let n=0;n<e;++n){const e=t[n];if(!("style"in e))throw new Error("Expected a list of rules with a style property");i[n]=e}return Sl(i)}return Ml(t)}(t);this.styleFunction_=null===t?void 0:function(t){let e;if("function"==typeof t)e=t;else{let i;Array.isArray(t)?i=t:(at("function"==typeof t.getZIndex,"Expected an `Style` or an array of `Style`"),i=[t]),e=function(){return i}}return e}(e),this.changed()}setDeclutter(t){this.declutter_=t?String(t):void 0,this.changed()}},Kl=class extends R{constructor(t,e,i,n){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=n}};function Yl(t,e){Ra.expire()}const Zl=class extends _{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){O()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,n=t.pixelToCoordinateTransform;Bi(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),Ui(n,i)}forEachFeatureAtCoordinate(t,e,i,n,r,s,o,a){let l;const h=e.viewState;function u(t,e,i,n){return r.call(s,e,t?i:null,n)}const c=h.projection,d=le(t.slice(),c),f=[[0,0]];if(c.canWrapX()&&n){const t=ee(c.getExtent());f.push([-t,0],[t,0])}const p=e.layerStatesArray,g=p.length,m=[],y=[];for(let n=0;n<f.length;n++)for(let r=g-1;r>=0;--r){const s=p[r],c=s.layer;if(c.hasRenderer()&&ms(s,h)&&o.call(a,c)){const r=c.getRenderer(),o=c.getSource();if(r&&o){const a=o.getWrapX()?d:t,h=u.bind(null,s.managed);y[0]=a[0]+f[n][0],y[1]=a[1]+f[n][1],l=r.forEachFeatureAtCoordinate(y,e,i,h,m)}if(l)return l}}if(0===m.length)return;const _=1/m.length;return m.forEach((t,e)=>t.distanceSq+=e*_),m.sort((t,e)=>t.distanceSq-e.distanceSq),m.some(t=>l=t.callback(t.feature,t.layer,t.geometry)),l}hasFeatureAtCoordinate(t,e,i,n,r,s){return void 0!==this.forEachFeatureAtCoordinate(t,e,i,n,E,this,r,s)}getMap(){return this.map_}renderFrame(t){O()}scheduleExpireIconCache(t){Ra.canExpireCache()&&t.postRenderFunctions.push(Yl)}},Hl=class extends Zl{constructor(t){super(t),this.fontChangeListenerKey_=l(Wa,s,t.redrawText,t),this.element_=Y?cr():document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=Qn+" ol-layers";const i=t.getViewport();i&&i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const n=new Kl(t,void 0,e);i.dispatchEvent(n)}}disposeInternal(){u(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(t){if(!t)return void(this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1));this.calculateMatrices2D(t),this.dispatchRenderEvent(ps,t);const e=t.layerStatesArray.sort((t,e)=>t.zIndex-e.zIndex);e.some(t=>t.layer instanceof Vl&&t.layer.getDeclutter())&&(t.declutter={});const i=t.viewState;this.children_.length=0;const n=[];let r=null;for(let s=0,o=e.length;s<o;++s){const o=e[s];t.layerIndex=s;const a=o.layer,l=a.getSourceState();if(!ms(o,i)||"ready"!=l&&"undefined"!=l){a.unrender();continue}const h=a.render(t,r);h&&(h!==r&&(this.children_.push(h),r=h),n.push(o))}this.declutter(t,n),function(t,e){const i=t.childNodes;for(let n=0;;++n){const r=i[n],s=e[n];if(!r&&!s)break;r!==s&&(r?s?t.insertBefore(s,r):(t.removeChild(r),--n):t.appendChild(s))}}(this.element_,this.children_);const s=this.getMap().getTargetElement();if(dr(s)){const t=s.getContext("2d");for(const e of this.children_){const i=e.firstElementChild||e,n=e.style.backgroundColor;if(n&&(!dr(i)||i.width>0)&&(t.fillStyle=n,t.fillRect(0,0,s.width,s.height)),dr(i)&&i.width>0){t.save();const n=e.style.opacity||i.style.opacity;t.globalAlpha=""===n?1:Number(n);const r=i.style.transform;if(r)t.transform(...Xi(r));else{const e=parseFloat(i.style.width)/i.width,n=parseFloat(i.style.height)/i.height;t.transform(e,0,0,n,0,0)}t.drawImage(i,0,0),t.restore()}}}this.dispatchRenderEvent("postcompose",t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){if(t.declutter){for(let i=e.length-1;i>=0;--i){const n=e[i],r=n.layer;r.getDeclutter()&&r.renderDeclutter(t,n)}e.forEach(e=>e.layer.renderDeferred(t))}}};function Jl(t){t instanceof ys?t.setMapInternal(null):t instanceof cs&&t.getLayers().forEach(Jl)}function Ql(t,e){if(t instanceof ys)t.setMapInternal(e);else if(t instanceof cs){const i=t.getLayers().getArray();for(let t=0,n=i.length;t<n;++t)Ql(i[t],e)}}const th=class extends N{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=function(t){let e=null;void 0!==t.keyboardEventTarget&&(e="string"==typeof t.keyboardEventTarget?document.getElementById(t.keyboardEventTarget):t.keyboardEventTarget);const i={},n=t.layers&&"function"==typeof t.layers.getLayers?t.layers:new cs({layers:t.layers});let r,s,o;return i[nt]=n,i[st]=t.target,i[ot]=t.view instanceof Hn?t.view:new Hn,void 0!==t.controls&&(Array.isArray(t.controls)?r=new q(t.controls.slice()):(at("function"==typeof t.controls.getArray,"Expected `controls` to be an array or an `ol/Collection.js`"),r=t.controls)),void 0!==t.interactions&&(Array.isArray(t.interactions)?s=new q(t.interactions.slice()):(at("function"==typeof t.interactions.getArray,"Expected `interactions` to be an array or an `ol/Collection.js`"),s=t.interactions)),void 0!==t.overlays?Array.isArray(t.overlays)?o=new q(t.overlays.slice()):(at("function"==typeof t.overlays.getArray,"Expected `overlays` to be an array or an `ol/Collection.js`"),o=t.overlays):o=new q,{controls:r,interactions:s,keyboardEventTarget:e,overlays:o,values:i}}(t);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=void 0!==t.maxTilesLoading?t.maxTilesLoading:16,this.pixelRatio_=void 0!==t.pixelRatio?t.pixelRatio:K,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=[1,0,0,1,0,0],this.pixelToCoordinateTransform_=[1,0,0,1,0,0],this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,Y||(this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_)),this.mapBrowserEventHandler_=null,this.moveTolerance_=t.moveTolerance,this.keyboardEventTarget_=e.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,Y||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=e.controls||(Y?new q:function(t){t=t||{};const e=new q;return(void 0===t.zoom||t.zoom)&&e.push(new mr(t.zoomOptions)),(void 0===t.rotate||t.rotate)&&e.push(new gr(t.rotateOptions)),(void 0===t.attribution||t.attribution)&&e.push(new pr(t.attributionOptions)),e}()),this.interactions=e.interactions||(Y?new q:Yr({onFocusOnly:!0})),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new ut(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(nt,this.handleLayerGroupChanged_),this.addChangeListener(ot,this.handleViewChanged_),this.addChangeListener(rt,this.handleSizeChanged_),this.addChangeListener(st,this.handleTargetChanged_),this.setProperties(e.values);const i=this;!t.view||t.view instanceof Hn||t.view.then(function(t){i.setView(new Hn(t))}),this.controls.addEventListener(n,t=>{t.element.setMap(this)}),this.controls.addEventListener(r,t=>{t.element.setMap(null)}),this.interactions.addEventListener(n,t=>{t.element.setMap(this)}),this.interactions.addEventListener(r,t=>{t.element.setMap(null)}),this.overlays_.addEventListener(n,t=>{this.addOverlayInternal_(t.element)}),this.overlays_.addEventListener(r,t=>{const e=t.element.getId();void 0!==e&&delete this.overlayIdIndex_[e.toString()],t.element.setMap(null)}),this.controls.forEach(t=>{t.setMap(this)}),this.interactions.forEach(t=>{t.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){Ql(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();void 0!==e&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const n=this.getCoordinateFromPixelInternal(t),r=void 0!==(i=void 0!==i?i:{}).hitTolerance?i.hitTolerance:0,s=void 0!==i.layerFilter?i.layerFilter:E,o=!1!==i.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(n,this.frameState_,r,o,e,null,s,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,function(t){i.push(t)},e),i}getAllLayers(){const t=[];return function e(i){i.forEach(function(i){i instanceof cs?e(i.getLayers()):t.push(i)})}(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t),n=void 0!==(e=void 0!==e?e:{}).layerFilter?e.layerFilter:E,r=void 0!==e.hitTolerance?e.hitTolerance:0,s=!1!==e.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,r,s,n,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const e=this.viewport_.getBoundingClientRect(),i=this.getSize(),n=e.width/i[0],r=e.height/i[1],s="changedTouches"in t?t.changedTouches[0]:t;return[(s.clientX-e.left)/n,(s.clientY-e.top)/r]}getTarget(){return this.get(st)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return Ii(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?qi(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return void 0!==e?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(nt)}setLayers(t){const e=this.getLayerGroup();if(t instanceof q)return void e.setLayers(t);const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e<i;++e){const i=t[e];if(!i.visible)continue;const n=i.layer.getRenderer();if(n&&!n.ready)return!0;const r=i.layer.getSource();if(r&&r.loading)return!0}return!1}getPixelFromCoordinate(t){const e=Ti(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?qi(e.coordinateToPixelTransform,t.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(t){this.pixelRatio_!==t&&(this.pixelRatio_=t,this.render())}getRenderer(){return this.renderer_}getSize(){return this.get(rt)}getView(){return this.get(ot)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,i,n){return function(t,e,i,n,r){if(!t||!(i in t.wantedTiles))return lt;if(!t.wantedTiles[i][e.getKey()])return lt;const s=t.viewState.center,o=n[0]-s[0],a=n[1]-s[1];return 65536*Math.log(r)+Math.sqrt(o*o+a*a)/r}(this.frameState_,t,e,i,n)}handleBrowserEvent(t,e){e=e||t.type;const i=new B(e,this,t);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,i=e.type;if(i===J||i===y||i===p){const t=this.getOwnerDocument(),i=this.viewport_.getRootNode?this.viewport_.getRootNode():t,n=e.target,r=i instanceof ShadowRoot?i.host===n?i.host.ownerDocument:i:i===t?t.documentElement:i;if(this.overlayContainerStopEvent_.contains(n)||!r.contains(n))return}if(t.frameState=this.frameState_,!1!==this.dispatchEvent(t)){const e=this.getInteractions().getArray().slice();for(let i=e.length-1;i>=0;i--){const n=e[i];if(n.getMap()===this&&n.getActive()&&this.getTargetElement()&&(!n.handleEvent(t)||t.propagationStopped))break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let i=this.maxTilesLoading_,n=i;const r=t?t.viewHints:void 0,s=!!r&&(r[0]||r[1]);if(s){const e=Date.now()-t.time>8;i=e?0:8,n=e?0:2}e.getTilesLoading()<i&&(s&&e.reprioritize(),e.loadMoreTiles(i,n))}t&&this.renderer_&&!t.animate&&(this.renderComplete_?(this.hasListener(gs)&&this.renderer_.dispatchRenderEvent(gs,t),!1===this.loaded_&&(this.loaded_=!0,this.dispatchEvent(new $(it,this,t)))):!0===this.loaded_&&(this.loaded_=!1,this.dispatchEvent(new $(et,this,t))));const i=this.postRenderFunctions_;if(t)for(let e=0,n=i.length;e<n;++e)i[e](this,t);i.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let t=0,e=this.targetChangeHandlerKeys_.length;t<e;++t)u(this.targetChangeHandlerKeys_[t]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(d,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(y,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!dr(this.targetElement_)){this.resizeObserver_?.unobserve(this.targetElement_);const t=this.targetElement_.getRootNode();t instanceof ShadowRoot&&this.resizeObserver_.unobserve(t.host),this.setSize(void 0)}const t=this.getTarget(),e="string"==typeof t?document.getElementById(t):t;if(this.targetElement_=e,e){if(dr(e)||e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new Hl(this)),!dr(e)){this.mapBrowserEventHandler_=new Q(this,this.moveTolerance_);for(const t in U)this.mapBrowserEventHandler_.addEventListener(U[t],this.handleMapBrowserEvent.bind(this));let t;if(this.viewport_.addEventListener(d,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(y,this.boundHandleBrowserEvent_,!!H&&{passive:!1}),this.keyboardEventTarget_)t=this.keyboardEventTarget_;else{const i=e.getRootNode();t=i instanceof ShadowRoot?i.host:e}if(this.targetChangeHandlerKeys_=[l(t,p,this.handleBrowserEvent,this),l(t,g,this.handleBrowserEvent,this)],e instanceof HTMLElement){const t=e.getRootNode();t instanceof ShadowRoot&&this.resizeObserver_.observe(t.host),this.resizeObserver_?.observe(e)}}this.updateSize()}else this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0)}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(u(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(u(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=l(t,s,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=l(t,c,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(u),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new ls("addlayer",t)),this.layerGroupPropertyListenerKeys_=[l(t,s,this.render,this),l(t,c,this.render,this),l(t,"addlayer",this.handleLayerAdd_,this),l(t,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;const t=this.frameState_.layerStatesArray;for(let e=0,i=t.length;e<i;++e){const i=t[e].layer;i.hasRenderer()&&i.getRenderer().handleFontsChanged()}}render(){this.renderer_&&void 0===this.animationDelayKey_&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){return this.getLayerGroup().getLayers().remove(t)}handleLayerRemove_(t){Jl(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),i=this.getView(),n=this.frameState_;let r=null;if(void 0!==e&&io(e)&&i&&i.isDef()){const n=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),s=i.getState();if(r={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:Yt(s.center,s.resolution,s.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:s,viewHints:n,wantedTiles:{},mapId:L(this),renderTargets:{}},s.nextCenter&&s.nextResolution){const t=isNaN(s.nextRotation)?s.rotation:s.nextRotation;r.nextExtent=Yt(s.nextCenter,s.nextResolution,t,e)}}this.frameState_=r,this.renderer_.renderFrame(r),r&&(r.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,r.postRenderFunctions),n&&(!this.previousExtent_||!ne(this.previousExtent_)&&!Nt(r.extent,this.previousExtent_))&&(this.dispatchEvent(new $("movestart",this,n)),this.previousExtent_=Ft(this.previousExtent_)),this.previousExtent_&&!r.viewHints[0]&&!r.viewHints[1]&&!Nt(r.extent,this.previousExtent_)&&(this.dispatchEvent(new $("moveend",this,r)),It(r.extent,this.previousExtent_))),this.dispatchEvent(new $(tt,this,r)),this.renderComplete_=(this.hasListener(et)||this.hasListener(it)||this.hasListener(gs))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new ls("removelayer",e)),this.set(nt,t)}setSize(t){this.set(rt,t)}setTarget(t){this.set(st,t)}setView(t){if(!t||t instanceof Hn)return void this.set(ot,t);this.set(ot,new Hn);const e=this;t.then(function(t){e.setView(new Hn(t))})}updateSize(){const t=this.getTargetElement();let e;if(t){let i,n;if(dr(t)){const e=t.getContext("2d").getTransform();i=t.width/e.a,n=t.height/e.d}else{const e=getComputedStyle(t);i=t.offsetWidth-parseFloat(e.borderLeftWidth)-parseFloat(e.paddingLeft)-parseFloat(e.paddingRight)-parseFloat(e.borderRightWidth),n=t.offsetHeight-parseFloat(e.borderTopWidth)-parseFloat(e.paddingTop)-parseFloat(e.paddingBottom)-parseFloat(e.borderBottomWidth)}isNaN(i)||isNaN(n)||(e=[Math.max(0,i),Math.max(0,n)],!io(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&ye("No map visible because the map container's width or height are 0."))}const i=this.getSize();!e||i&&M(e,i)||(this.updateViewportSize_(e),this.setSize(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}};var eh=6378137,ih=.0066943799901413165,nh=484813681109536e-20,rh=Math.PI/2,sh=1e-10,oh=.017453292519943295,ah=57.29577951308232,lh=Math.PI/4,hh=2*Math.PI,uh=3.14159265359;const ch={greenwich:0,lisbon:-9.131906111111,paris:2.337229166667,bogota:-74.080916666667,madrid:-3.687938888889,rome:12.452333333333,bern:7.439583333333,jakarta:106.807719444444,ferro:-17.666666666667,brussels:4.367975,stockholm:18.058277777778,athens:23.7163375,oslo:10.722916666667},dh={mm:{to_meter:.001},cm:{to_meter:.01},ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937},fath:{to_meter:1.8288},kmi:{to_meter:1852},"us-ch":{to_meter:20.1168402336805},"us-mi":{to_meter:1609.34721869444},km:{to_meter:1e3},"ind-ft":{to_meter:.30479841},"ind-yd":{to_meter:.91439523},mi:{to_meter:1609.344},yd:{to_meter:.9144},ch:{to_meter:20.1168},link:{to_meter:.201168},dm:{to_meter:.1},in:{to_meter:.0254},"ind-ch":{to_meter:20.11669506},"us-in":{to_meter:.025400050800101},"us-yd":{to_meter:.914401828803658}};var fh=/[\s_\-\/\(\)]/g;function ph(t,e){if(t[e])return t[e];for(var i,n=Object.keys(t),r=e.toLowerCase().replace(fh,""),s=-1;++s<n.length;)if((i=n[s]).toLowerCase().replace(fh,"")===r)return t[i]}function gh(t){var e,i,n,r={},s=t.split("+").map(function(t){return t.trim()}).filter(function(t){return t}).reduce(function(t,e){var i=e.split("=");return i.push(!0),t[i[0].toLowerCase()]=i[1],t},{}),o={proj:"projName",datum:"datumCode",rf:function(t){r.rf=parseFloat(t)},lat_0:function(t){r.lat0=t*oh},lat_1:function(t){r.lat1=t*oh},lat_2:function(t){r.lat2=t*oh},lat_ts:function(t){r.lat_ts=t*oh},lon_0:function(t){r.long0=t*oh},lon_1:function(t){r.long1=t*oh},lon_2:function(t){r.long2=t*oh},alpha:function(t){r.alpha=parseFloat(t)*oh},gamma:function(t){r.rectified_grid_angle=parseFloat(t)*oh},lonc:function(t){r.longc=t*oh},x_0:function(t){r.x0=parseFloat(t)},y_0:function(t){r.y0=parseFloat(t)},k_0:function(t){r.k0=parseFloat(t)},k:function(t){r.k0=parseFloat(t)},a:function(t){r.a=parseFloat(t)},b:function(t){r.b=parseFloat(t)},r:function(t){r.a=r.b=parseFloat(t)},r_a:function(){r.R_A=!0},zone:function(t){r.zone=parseInt(t,10)},south:function(){r.utmSouth=!0},towgs84:function(t){r.datum_params=t.split(",").map(function(t){return parseFloat(t)})},to_meter:function(t){r.to_meter=parseFloat(t)},units:function(t){r.units=t;var e=ph(dh,t);e&&(r.to_meter=e.to_meter)},from_greenwich:function(t){r.from_greenwich=t*oh},pm:function(t){var e=ph(ch,t);r.from_greenwich=(e||parseFloat(t))*oh},nadgrids:function(t){"@null"===t?r.datumCode="none":r.nadgrids=t},axis:function(t){var e="ewnsud";3===t.length&&-1!==e.indexOf(t.substr(0,1))&&-1!==e.indexOf(t.substr(1,1))&&-1!==e.indexOf(t.substr(2,1))&&(r.axis=t)},approx:function(){r.approx=!0},over:function(){r.over=!0}};for(e in s)i=s[e],e in o?"function"==typeof(n=o[e])?n(i):r[n]=i:r[e]=i;return"string"==typeof r.datumCode&&"WGS84"!==r.datumCode&&(r.datumCode=r.datumCode.toLowerCase()),r.projStr=t,r}const mh=class{static getId(t){const e=t.find(t=>Array.isArray(t)&&"ID"===t[0]);return e&&e.length>=3?{authority:e[1],code:parseInt(e[2],10)}:null}static convertUnit(t,e="unit"){if(!t||t.length<3)return{type:e,name:"unknown",conversion_factor:null};const i=t[1],n=parseFloat(t[2])||null,r=t.find(t=>Array.isArray(t)&&"ID"===t[0]);return{type:e,name:i,conversion_factor:n,id:r?{authority:r[1],code:parseInt(r[2],10)}:null}}static convertAxis(t){const e=t[1]||"Unknown";let i;const n=e.match(/^\((.)\)$/);if(n){const e=n[1].toUpperCase();if("E"===e)i="east";else if("N"===e)i="north";else if("U"===e)i="up";else{if(!t[2])throw new Error(`Unknown axis abbreviation: ${e}`);i=t[2]}}else i=t[2]||"unknown";const r=t.find(t=>Array.isArray(t)&&"ORDER"===t[0]),s=r?parseInt(r[1],10):null,o=t.find(t=>Array.isArray(t)&&("LENGTHUNIT"===t[0]||"ANGLEUNIT"===t[0]||"SCALEUNIT"===t[0]));return{name:e,direction:i,unit:this.convertUnit(o),order:s}}static extractAxes(t){return t.filter(t=>Array.isArray(t)&&"AXIS"===t[0]).map(t=>this.convertAxis(t)).sort((t,e)=>(t.order||0)-(e.order||0))}static convert(t,e={}){switch(t[0]){case"PROJCRS":e.type="ProjectedCRS",e.name=t[1],e.base_crs=t.find(t=>Array.isArray(t)&&"BASEGEOGCRS"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"BASEGEOGCRS"===t[0])):null,e.conversion=t.find(t=>Array.isArray(t)&&"CONVERSION"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"CONVERSION"===t[0])):null;const i=t.find(t=>Array.isArray(t)&&"CS"===t[0]);i&&(e.coordinate_system={type:i[1],axis:this.extractAxes(t)});const n=t.find(t=>Array.isArray(t)&&"LENGTHUNIT"===t[0]);if(n){const t=this.convertUnit(n);e.coordinate_system.unit=t}e.id=this.getId(t);break;case"BASEGEOGCRS":case"GEOGCRS":case"GEODCRS":e.type="GEODCRS"===t[0]?"GeodeticCRS":"GeographicCRS",e.name=t[1];const r=t.find(t=>Array.isArray(t)&&("DATUM"===t[0]||"ENSEMBLE"===t[0]));if(r){const i=this.convert(r);"ENSEMBLE"===r[0]?e.datum_ensemble=i:e.datum=i;const n=t.find(t=>Array.isArray(t)&&"PRIMEM"===t[0]);n&&"Greenwich"!==n[1]&&(i.prime_meridian={name:n[1],longitude:parseFloat(n[2])})}e.coordinate_system={type:"ellipsoidal",axis:this.extractAxes(t)},e.id=this.getId(t);break;case"DATUM":e.type="GeodeticReferenceFrame",e.name=t[1],e.ellipsoid=t.find(t=>Array.isArray(t)&&"ELLIPSOID"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"ELLIPSOID"===t[0])):null;break;case"ENSEMBLE":e.type="DatumEnsemble",e.name=t[1],e.members=t.filter(t=>Array.isArray(t)&&"MEMBER"===t[0]).map(t=>({type:"DatumEnsembleMember",name:t[1],id:this.getId(t)}));const s=t.find(t=>Array.isArray(t)&&"ENSEMBLEACCURACY"===t[0]);s&&(e.accuracy=parseFloat(s[1]));const o=t.find(t=>Array.isArray(t)&&"ELLIPSOID"===t[0]);o&&(e.ellipsoid=this.convert(o)),e.id=this.getId(t);break;case"ELLIPSOID":e.type="Ellipsoid",e.name=t[1],e.semi_major_axis=parseFloat(t[2]),e.inverse_flattening=parseFloat(t[3]),t.find(t=>Array.isArray(t)&&"LENGTHUNIT"===t[0])&&this.convert(t.find(t=>Array.isArray(t)&&"LENGTHUNIT"===t[0]),e);break;case"CONVERSION":e.type="Conversion",e.name=t[1],e.method=t.find(t=>Array.isArray(t)&&"METHOD"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"METHOD"===t[0])):null,e.parameters=t.filter(t=>Array.isArray(t)&&"PARAMETER"===t[0]).map(t=>this.convert(t));break;case"METHOD":e.type="Method",e.name=t[1],e.id=this.getId(t);break;case"PARAMETER":e.type="Parameter",e.name=t[1],e.value=parseFloat(t[2]),e.unit=this.convertUnit(t.find(t=>Array.isArray(t)&&("LENGTHUNIT"===t[0]||"ANGLEUNIT"===t[0]||"SCALEUNIT"===t[0]))),e.id=this.getId(t);break;case"BOUNDCRS":e.type="BoundCRS";const a=t.find(t=>Array.isArray(t)&&"SOURCECRS"===t[0]);if(a){const t=a.find(t=>Array.isArray(t));e.source_crs=t?this.convert(t):null}const l=t.find(t=>Array.isArray(t)&&"TARGETCRS"===t[0]);if(l){const t=l.find(t=>Array.isArray(t));e.target_crs=t?this.convert(t):null}const h=t.find(t=>Array.isArray(t)&&"ABRIDGEDTRANSFORMATION"===t[0]);e.transformation=h?this.convert(h):null;break;case"ABRIDGEDTRANSFORMATION":if(e.type="Transformation",e.name=t[1],e.method=t.find(t=>Array.isArray(t)&&"METHOD"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"METHOD"===t[0])):null,e.parameters=t.filter(t=>Array.isArray(t)&&("PARAMETER"===t[0]||"PARAMETERFILE"===t[0])).map(t=>"PARAMETER"===t[0]?this.convert(t):"PARAMETERFILE"===t[0]?{name:t[1],value:t[2],id:{authority:"EPSG",code:8656}}:void 0),7===e.parameters.length){const t=e.parameters[6];"Scale difference"===t.name&&(t.value=Math.round(1e12*(t.value-1))/1e6)}e.id=this.getId(t);break;case"AXIS":e.coordinate_system||(e.coordinate_system={type:"unspecified",axis:[]}),e.coordinate_system.axis.push(this.convertAxis(t));break;case"LENGTHUNIT":const u=this.convertUnit(t,"LinearUnit");e.coordinate_system&&e.coordinate_system.axis&&e.coordinate_system.axis.forEach(t=>{t.unit||(t.unit=u)}),u.conversion_factor&&1!==u.conversion_factor&&e.semi_major_axis&&(e.semi_major_axis={value:e.semi_major_axis,unit:u});break;default:e.keyword=t[0]}return e}},yh=class extends mh{static convert(t,e={}){return super.convert(t,e),e.coordinate_system&&"Cartesian"===e.coordinate_system.subtype&&delete e.coordinate_system,e.usage&&delete e.usage,e}},_h=class extends mh{static convert(t,e={}){super.convert(t,e);const i=t.find(t=>Array.isArray(t)&&"CS"===t[0]);i&&(e.coordinate_system={subtype:i[1],axis:this.extractAxes(t)});const n=t.find(t=>Array.isArray(t)&&"USAGE"===t[0]);if(n){const t=n.find(t=>Array.isArray(t)&&"SCOPE"===t[0]),i=n.find(t=>Array.isArray(t)&&"AREA"===t[0]),r=n.find(t=>Array.isArray(t)&&"BBOX"===t[0]);e.usage={},t&&(e.usage.scope=t[1]),i&&(e.usage.area=i[1]),r&&(e.usage.bbox=r.slice(1))}return e}};var vh=/\s/,xh=/[A-Za-z]/,wh=/[A-Za-z84_]/,bh=/[,\]]/,Sh=/[\d\.E\-\+]/;function Mh(t){if("string"!=typeof t)throw new Error("not a string");this.text=t.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=1}function Eh(t,e,i){Array.isArray(e)&&(i.unshift(e),e=null);var n=e?{}:t,r=i.reduce(function(t,e){return Ch(e,t),t},n);e&&(t[e]=r)}function Ch(t,e){if(Array.isArray(t)){var i=t.shift();if("PARAMETER"===i&&(i=t.shift()),1===t.length)return Array.isArray(t[0])?(e[i]={},void Ch(t[0],e[i])):void(e[i]=t[0]);if(t.length)if("TOWGS84"!==i){if("AXIS"===i)return i in e||(e[i]=[]),void e[i].push(t);var n;switch(Array.isArray(i)||(e[i]={}),i){case"UNIT":case"PRIMEM":case"VERT_DATUM":return e[i]={name:t[0].toLowerCase(),convert:t[1]},void(3===t.length&&Ch(t[2],e[i]));case"SPHEROID":case"ELLIPSOID":return e[i]={name:t[0],a:t[1],rf:t[2]},void(4===t.length&&Ch(t[3],e[i]));case"EDATUM":case"ENGINEERINGDATUM":case"LOCAL_DATUM":case"DATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":return t[0]=["name",t[0]],void Eh(e,i,t);case"COMPD_CS":case"COMPOUNDCRS":case"FITTED_CS":case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"ENGCRS":case"ENGINEERINGCRS":return t[0]=["name",t[0]],Eh(e,i,t),void(e[i].type=i);default:for(n=-1;++n<t.length;)if(!Array.isArray(t[n]))return Ch(t,e[i]);return Eh(e,i,t)}}else e[i]=t;else e[i]=!0}else e[t]=!0}function Ph(t){return.017453292519943295*t}function Ih(t){const e=(t.projName||"").toLowerCase().replace(/_/g," ");void 0===t.long0&&void 0!==t.longc&&(t.long0=t.longc),t.lat_ts||!t.lat1||"stereographic south pole"!==e&&"polar stereographic (variant b)"!==e?t.lat_ts||!t.lat0||"polar stereographic"!==e&&"polar stereographic (variant a)"!==e||(t.lat_ts=t.lat0,t.lat0=Ph(t.lat0>0?90:-90),delete t.lat1):(t.lat0=Ph(t.lat1>0?90:-90),t.lat_ts=t.lat1,delete t.lat1)}function Th(t){let e={units:null,to_meter:void 0};return"string"==typeof t?(e.units=t.toLowerCase(),"metre"===e.units&&(e.units="meter"),"meter"===e.units&&(e.to_meter=1)):t&&t.name&&(e.units=t.name.toLowerCase(),"metre"===e.units&&(e.units="meter"),e.to_meter=t.conversion_factor),e}function Rh(t){return"object"==typeof t?t.value*t.unit.conversion_factor:t}function kh(t,e){t.ellipsoid.radius?(e.a=t.ellipsoid.radius,e.rf=0):(e.a=Rh(t.ellipsoid.semi_major_axis),void 0!==t.ellipsoid.inverse_flattening?e.rf=t.ellipsoid.inverse_flattening:void 0!==t.ellipsoid.semi_major_axis&&void 0!==t.ellipsoid.semi_minor_axis&&(e.rf=e.a/(e.a-Rh(t.ellipsoid.semi_minor_axis))))}function Ah(t,e={}){return t&&"object"==typeof t?"BoundCRS"===t.type?(Ah(t.source_crs,e),t.transformation&&(t.transformation.method&&"NTv2"===t.transformation.method.name?e.nadgrids=t.transformation.parameters[0].value:e.datum_params=t.transformation.parameters.map(t=>t.value)),e):(Object.keys(t).forEach(i=>{const n=t[i];if(null!==n)switch(i){case"name":if(e.srsCode)break;e.name=n,e.srsCode=n;break;case"type":"GeographicCRS"===n?e.projName="longlat":"GeodeticCRS"===n?t.coordinate_system&&"Cartesian"===t.coordinate_system.subtype?e.projName="geocent":e.projName="longlat":"ProjectedCRS"===n&&t.conversion&&t.conversion.method&&(e.projName=t.conversion.method.name);break;case"datum":case"datum_ensemble":n.ellipsoid&&(e.ellps=n.ellipsoid.name,kh(n,e)),n.prime_meridian&&(e.from_greenwich=n.prime_meridian.longitude*Math.PI/180);break;case"ellipsoid":e.ellps=n.name,kh(n,e);break;case"prime_meridian":e.long0=(n.longitude||0)*Math.PI/180;break;case"coordinate_system":if(n.axis){const t={east:"e",north:"n",west:"w",south:"s",up:"u",down:"d",geocentricx:"e",geocentricy:"n",geocentricz:"u"},i=n.axis.map(e=>t[e.direction.toLowerCase()]);if(i.every(Boolean)&&(e.axis=i.join(""),2===e.axis.length&&(e.axis+="u")),n.unit){const{units:t,to_meter:i}=Th(n.unit);e.units=t,e.to_meter=i}else if(n.axis[0]&&n.axis[0].unit){const{units:t,to_meter:i}=Th(n.axis[0].unit);e.units=t,e.to_meter=i}}break;case"id":n.authority&&n.code&&(e.title=n.authority+":"+n.code);break;case"conversion":n.method&&n.method.name&&(e.projName=n.method.name),n.parameters&&n.parameters.forEach(t=>{const i=t.name.toLowerCase().replace(/\s+/g,"_"),n=t.value;t.unit&&t.unit.conversion_factor?e[i]=n*t.unit.conversion_factor:"degree"===t.unit?e[i]=n*Math.PI/180:e[i]=n});break;case"unit":n.name&&(e.units=n.name.toLowerCase(),"metre"===e.units&&(e.units="meter")),n.conversion_factor&&(e.to_meter=n.conversion_factor);break;case"base_crs":Ah(n,e),e.datumCode=n.id?n.id.authority+"_"+n.id.code:n.name}}),void 0!==e.latitude_of_false_origin&&(e.lat0=e.latitude_of_false_origin),void 0!==e.longitude_of_false_origin&&(e.long0=e.longitude_of_false_origin),void 0!==e.latitude_of_standard_parallel&&(e.lat0=e.latitude_of_standard_parallel,e.lat1=e.latitude_of_standard_parallel),void 0!==e.latitude_of_1st_standard_parallel&&(e.lat1=e.latitude_of_1st_standard_parallel),void 0!==e.latitude_of_2nd_standard_parallel&&(e.lat2=e.latitude_of_2nd_standard_parallel),void 0!==e.latitude_of_projection_centre&&(e.lat0=e.latitude_of_projection_centre),void 0!==e.longitude_of_projection_centre&&(e.longc=e.longitude_of_projection_centre),void 0!==e.easting_at_false_origin&&(e.x0=e.easting_at_false_origin),void 0!==e.northing_at_false_origin&&(e.y0=e.northing_at_false_origin),void 0!==e.latitude_of_natural_origin&&(e.lat0=e.latitude_of_natural_origin),void 0!==e.longitude_of_natural_origin&&(e.long0=e.longitude_of_natural_origin),void 0!==e.longitude_of_origin&&(e.long0=e.longitude_of_origin),void 0!==e.false_easting&&(e.x0=e.false_easting),e.easting_at_projection_centre&&(e.x0=e.easting_at_projection_centre),void 0!==e.false_northing&&(e.y0=e.false_northing),e.northing_at_projection_centre&&(e.y0=e.northing_at_projection_centre),void 0!==e.standard_parallel_1&&(e.lat1=e.standard_parallel_1),void 0!==e.standard_parallel_2&&(e.lat2=e.standard_parallel_2),void 0!==e.scale_factor_at_natural_origin&&(e.k0=e.scale_factor_at_natural_origin),void 0!==e.scale_factor_at_projection_centre&&(e.k0=e.scale_factor_at_projection_centre),void 0!==e.scale_factor_on_pseudo_standard_parallel&&(e.k0=e.scale_factor_on_pseudo_standard_parallel),void 0!==e.azimuth&&(e.alpha=e.azimuth),void 0!==e.azimuth_at_projection_centre&&(e.alpha=e.azimuth_at_projection_centre),e.angle_from_rectified_to_skew_grid&&(e.rectified_grid_angle=e.angle_from_rectified_to_skew_grid),Ih(e),e):t}Mh.prototype.readCharicter=function(){var t=this.text[this.place++];if(4!==this.state)for(;vh.test(t);){if(this.place>=this.text.length)return;t=this.text[this.place++]}switch(this.state){case 1:return this.neutral(t);case 2:return this.keyword(t);case 4:return this.quoted(t);case 5:return this.afterquote(t);case 3:return this.number(t);case-1:return}},Mh.prototype.afterquote=function(t){if('"'===t)return this.word+='"',void(this.state=4);if(bh.test(t))return this.word=this.word.trim(),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in afterquote yet, index '+this.place)},Mh.prototype.afterItem=function(t){return","===t?(null!==this.word&&this.currentObject.push(this.word),this.word=null,void(this.state=1)):"]"===t?(this.level--,null!==this.word&&(this.currentObject.push(this.word),this.word=null),this.state=1,this.currentObject=this.stack.pop(),void(this.currentObject||(this.state=-1))):void 0},Mh.prototype.number=function(t){if(!Sh.test(t)){if(bh.test(t))return this.word=parseFloat(this.word),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in number yet, index '+this.place)}this.word+=t},Mh.prototype.quoted=function(t){'"'!==t?this.word+=t:this.state=5},Mh.prototype.keyword=function(t){if(wh.test(t))this.word+=t;else{if("["===t){var e=[];return e.push(this.word),this.level++,null===this.root?this.root=e:this.currentObject.push(e),this.stack.push(this.currentObject),this.currentObject=e,void(this.state=1)}if(!bh.test(t))throw new Error("havn't handled \""+t+'" in keyword yet, index '+this.place);this.afterItem(t)}},Mh.prototype.neutral=function(t){if(xh.test(t))return this.word=t,void(this.state=2);if('"'===t)return this.word="",void(this.state=4);if(Sh.test(t))return this.word=t,void(this.state=3);if(!bh.test(t))throw new Error("havn't handled \""+t+'" in neutral yet, index '+this.place);this.afterItem(t)},Mh.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(-1===this.state)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};var Gh=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function Oh(t){for(var e=Object.keys(t),i=0,n=e.length;i<n;++i){var r=e[i];-1!==Gh.indexOf(r)&&Fh(t[r]),"object"==typeof t[r]&&Oh(t[r])}}function Fh(t){if(t.AUTHORITY){var e=Object.keys(t.AUTHORITY)[0];e&&e in t.AUTHORITY&&(t.title=e+":"+t.AUTHORITY[e])}if("GEOGCS"===t.type?t.projName="longlat":"LOCAL_CS"===t.type?(t.projName="identity",t.local=!0):"object"==typeof t.PROJECTION?t.projName=Object.keys(t.PROJECTION)[0]:t.projName=t.PROJECTION,t.AXIS){for(var i="",n=0,r=t.AXIS.length;n<r;++n){var s=[t.AXIS[n][0].toLowerCase(),t.AXIS[n][1].toLowerCase()];-1!==s[0].indexOf("north")||("y"===s[0]||"lat"===s[0])&&"north"===s[1]?i+="n":-1!==s[0].indexOf("south")||("y"===s[0]||"lat"===s[0])&&"south"===s[1]?i+="s":-1!==s[0].indexOf("east")||("x"===s[0]||"lon"===s[0])&&"east"===s[1]?i+="e":-1===s[0].indexOf("west")&&("x"!==s[0]&&"lon"!==s[0]||"west"!==s[1])||(i+="w")}2===i.length&&(i+="u"),3===i.length&&(t.axis=i)}t.UNIT&&(t.units=t.UNIT.name.toLowerCase(),"metre"===t.units&&(t.units="meter"),t.UNIT.convert&&("GEOGCS"===t.type?t.DATUM&&t.DATUM.SPHEROID&&(t.to_meter=t.UNIT.convert*t.DATUM.SPHEROID.a):t.to_meter=t.UNIT.convert));var o=t.GEOGCS;function a(e){return e*(t.to_meter||1)}"GEOGCS"===t.type&&(o=t),o&&(o.PRIMEM&&o.PRIMEM.convert&&(t.from_greenwich=Ph(o.PRIMEM.convert)),o.DATUM?t.datumCode=o.DATUM.name.toLowerCase():t.datumCode=o.name.toLowerCase(),"d_"===t.datumCode.slice(0,2)&&(t.datumCode=t.datumCode.slice(2)),"new_zealand_1949"===t.datumCode&&(t.datumCode="nzgd49"),"wgs_1984"!==t.datumCode&&"world_geodetic_system_1984"!==t.datumCode||("Mercator_Auxiliary_Sphere"===t.PROJECTION&&(t.sphere=!0),t.datumCode="wgs84"),"belge_1972"===t.datumCode&&(t.datumCode="rnb72"),o.DATUM&&o.DATUM.SPHEROID&&(t.ellps=o.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),"international"===t.ellps.toLowerCase().slice(0,13)&&(t.ellps="intl"),t.a=o.DATUM.SPHEROID.a,t.rf=parseFloat(o.DATUM.SPHEROID.rf)),o.DATUM&&o.DATUM.TOWGS84&&(t.datum_params=o.DATUM.TOWGS84),~t.datumCode.indexOf("osgb_1936")&&(t.datumCode="osgb36"),~t.datumCode.indexOf("osni_1952")&&(t.datumCode="osni52"),(~t.datumCode.indexOf("tm65")||~t.datumCode.indexOf("geodetic_datum_of_1965"))&&(t.datumCode="ire65"),"ch1903+"===t.datumCode&&(t.datumCode="ch1903"),~t.datumCode.indexOf("israel")&&(t.datumCode="isr93")),t.b&&!isFinite(t.b)&&(t.b=t.a),t.rectified_grid_angle&&(t.rectified_grid_angle=Ph(t.rectified_grid_angle)),[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_1","Latitude of 1st standard parallel"],["standard_parallel_2","Standard_Parallel_2"],["standard_parallel_2","Latitude of 2nd standard parallel"],["false_easting","False_Easting"],["false_easting","False easting"],["false-easting","Easting at false origin"],["false_northing","False_Northing"],["false_northing","False northing"],["false_northing","Northing at false origin"],["central_meridian","Central_Meridian"],["central_meridian","Longitude of natural origin"],["central_meridian","Longitude of false origin"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["latitude_of_origin","Latitude of natural origin"],["latitude_of_origin","Latitude of false origin"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",Ph],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",Ph],["x0","false_easting",a],["y0","false_northing",a],["long0","central_meridian",Ph],["lat0","latitude_of_origin",Ph],["lat0","standard_parallel_1",Ph],["lat1","standard_parallel_1",Ph],["lat2","standard_parallel_2",Ph],["azimuth","Azimuth"],["alpha","azimuth",Ph],["srsCode","name"]].forEach(function(e){return function(t,e){var i=e[0],n=e[1];!(i in t)&&n in t&&(t[i]=t[n],3===e.length&&(t[i]=e[2](t[i])))}(t,e)}),Ih(t)}function Lh(t){if("object"==typeof t)return Ah(t);const e=function(t){const e=t.toUpperCase();return e.includes("PROJCRS")||e.includes("GEOGCRS")||e.includes("BOUNDCRS")||e.includes("VERTCRS")||e.includes("LENGTHUNIT")||e.includes("ANGLEUNIT")||e.includes("SCALEUNIT")?"WKT2":(e.includes("PROJCS")||e.includes("GEOGCS")||e.includes("LOCAL_CS")||e.includes("VERT_CS")||e.includes("UNIT"),"WKT1")}(t);var i=new Mh(t).output();if("WKT2"===e)return Ah(function(t){const e=function(t){return t.find(t=>Array.isArray(t)&&"USAGE"===t[0])?"2019":(t.find(t=>Array.isArray(t)&&"CS"===t[0])||"BOUNDCRS"===t[0]||"PROJCRS"===t[0]||t[0],"2015")}(t);return("2019"===e?_h:yh).convert(t)}(i));var n=i[0],r={};return Ch(i,r),Oh(r),r[n]}function jh(t){var e=this;if(2===arguments.length){var i=arguments[1];"string"==typeof i?"+"===i.charAt(0)?jh[t]=gh(arguments[1]):jh[t]=Lh(arguments[1]):i&&"object"==typeof i&&!("projName"in i)?jh[t]=Lh(arguments[1]):(jh[t]=i,i||delete jh[t])}else if(1===arguments.length){if(Array.isArray(t))return t.map(function(t){return Array.isArray(t)?jh.apply(e,t):jh(t)});if("string"==typeof t){if(t in jh)return jh[t]}else"EPSG"in t?jh["EPSG:"+t.EPSG]=t:"ESRI"in t?jh["ESRI:"+t.ESRI]=t:"IAU2000"in t?jh["IAU2000:"+t.IAU2000]=t:console.log(t);return}}!function(t){t("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),t("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),t("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs");for(var e=1;e<=60;++e)t("EPSG:"+(32600+e),"+proj=utm +zone="+e+" +datum=WGS84 +units=m"),t("EPSG:"+(32700+e),"+proj=utm +zone="+e+" +south +datum=WGS84 +units=m");t("EPSG:5041","+title=WGS 84 / UPS North (E,N) +proj=stere +lat_0=90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m"),t("EPSG:5042","+title=WGS 84 / UPS South (E,N) +proj=stere +lat_0=-90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m"),t.WGS84=t["EPSG:4326"],t["EPSG:3785"]=t["EPSG:3857"],t.GOOGLE=t["EPSG:3857"],t["EPSG:900913"]=t["EPSG:3857"],t["EPSG:102113"]=t["EPSG:3857"]}(jh);const Nh=jh;var Dh=["3857","900913","3785","102113"];function zh(t,e){var i,n;if(t=t||{},!e)return t;for(n in e)void 0!==(i=e[n])&&(t[n]=i);return t}function qh(t,e,i){var n=t*e;return i/Math.sqrt(1-n*n)}function $h(t){return t<0?-1:1}function Bh(t,e){return e||Math.abs(t)<=uh?t:t-$h(t)*hh}function Uh(t,e,i){var n=t*i,r=.5*t;return n=Math.pow((1-n)/(1+n),r),Math.tan(.5*(rh-e))/n}function Wh(t,e){for(var i,n,r=.5*t,s=rh-2*Math.atan(e),o=0;o<=15;o++)if(i=t*Math.sin(s),s+=n=rh-2*Math.atan(e*Math.pow((1-i)/(1+i),r))-s,Math.abs(n)<=1e-10)return s;return-9999}function Xh(t){return t}var Vh=["longlat","identity"],Kh=[{init:function(){var t=this.b/this.a;this.es=1-t*t,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=qh(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)},forward:function(t){var e,i,n=t.x,r=t.y;if(r*ah>90&&r*ah<-90&&n*ah>180&&n*ah<-180)return null;if(Math.abs(Math.abs(r)-rh)<=sh)return null;if(this.sphere)e=this.x0+this.a*this.k0*Bh(n-this.long0,this.over),i=this.y0+this.a*this.k0*Math.log(Math.tan(lh+.5*r));else{var s=Math.sin(r),o=Uh(this.e,r,s);e=this.x0+this.a*this.k0*Bh(n-this.long0,this.over),i=this.y0-this.a*this.k0*Math.log(o)}return t.x=e,t.y=i,t},inverse:function(t){var e,i,n=t.x-this.x0,r=t.y-this.y0;if(this.sphere)i=rh-2*Math.atan(Math.exp(-r/(this.a*this.k0)));else{var s=Math.exp(-r/(this.a*this.k0));if(-9999===(i=Wh(this.e,s)))return null}return e=Bh(this.long0+n/(this.a*this.k0),this.over),t.x=e,t.y=i,t},names:["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","Mercator_Variant_A","merc"]},{init:function(){},forward:Xh,inverse:Xh,names:Vh}],Yh={},Zh=[];function Hh(t,e){var i=Zh.length;return t.names?(Zh[i]=t,t.names.forEach(function(t){Yh[t.toLowerCase()]=i}),this):(console.log(e),!0)}function Jh(t){return t.replace(/[-\(\)\s]+/g," ").trim().replace(/ /g,"_")}const Qh={start:function(){Kh.forEach(Hh)},add:Hh,get:function(t){if(!t)return!1;var e=t.toLowerCase();return void 0!==Yh[e]&&Zh[Yh[e]]||(e=Jh(e))in Yh&&Zh[Yh[e]]?Zh[Yh[e]]:void 0}},tu={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563.396,b:6356256.91,ellipseName:"Airy 1830"},APL4:{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"},andrae:{a:6377104.43,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},clrk80:{a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},clrk80ign:{a:6378249.2,b:6356515,rf:293.4660213,ellipseName:"Clarke 1880 (IGN)"},clrk58:{a:6378293.645208759,rf:294.2606763692654,ellipseName:"Clarke 1858"},CPM:{a:6375738.7,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},plessis:{a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:6356773.3205,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:6355834.8467,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS7:{a:6378135,rf:298.26,ellipseName:"WGS 72"},WGS84:{a:6378137,rf:298.257223563,ellipseName:"WGS 84"},sphere:{a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"}},eu=tu.WGS84;var iu={wgs84:{towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},ch1903:{towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},ggrs87:{towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},nad83:{towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},nad27:{nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},potsdam:{towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},carthage:{towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},hermannskogel:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},mgi:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Militar-Geographische Institut"},osni52:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},ire65:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},rassadiran:{towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},nzgd49:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},osgb36:{towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Ordnance Survey of Great Britain 1936"},s_jtsk:{towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},beduaram:{towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},gunung_segara:{towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},rnb72:{towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"},EPSG_5451:{towgs84:"6.41,-49.05,-11.28,1.5657,0.5242,6.9718,-5.7649"},IGNF_LURESG:{towgs84:"-192.986,13.673,-39.309,-0.4099,-2.9332,2.6881,0.43"},EPSG_4614:{towgs84:"-119.4248,-303.65872,-11.00061,1.164298,0.174458,1.096259,3.657065"},EPSG_4615:{towgs84:"-494.088,-312.129,279.877,-1.423,-1.013,1.59,-0.748"},ESRI_37241:{towgs84:"-76.822,257.457,-12.817,2.136,-0.033,-2.392,-0.031"},ESRI_37249:{towgs84:"-440.296,58.548,296.265,1.128,10.202,4.559,-0.438"},ESRI_37245:{towgs84:"-511.151,-181.269,139.609,1.05,2.703,1.798,3.071"},EPSG_4178:{towgs84:"24.9,-126.4,-93.2,-0.063,-0.247,-0.041,1.01"},EPSG_4622:{towgs84:"-472.29,-5.63,-304.12,0.4362,-0.8374,0.2563,1.8984"},EPSG_4625:{towgs84:"126.93,547.94,130.41,-2.7867,5.1612,-0.8584,13.8227"},EPSG_5252:{towgs84:"0.023,0.036,-0.068,0.00176,0.00912,-0.01136,0.00439"},EPSG_4314:{towgs84:"597.1,71.4,412.1,0.894,0.068,-1.563,7.58"},EPSG_4282:{towgs84:"-178.3,-316.7,-131.5,5.278,6.077,10.979,19.166"},EPSG_4231:{towgs84:"-83.11,-97.38,-117.22,0.005693,-0.044698,0.044285,0.1218"},EPSG_4274:{towgs84:"-230.994,102.591,25.199,0.633,-0.239,0.9,1.95"},EPSG_4134:{towgs84:"-180.624,-225.516,173.919,-0.81,-1.898,8.336,16.71006"},EPSG_4254:{towgs84:"18.38,192.45,96.82,0.056,-0.142,-0.2,-0.0013"},EPSG_4159:{towgs84:"-194.513,-63.978,-25.759,-3.4027,3.756,-3.352,-0.9175"},EPSG_4687:{towgs84:"0.072,-0.507,-0.245,0.0183,-0.0003,0.007,-0.0093"},EPSG_4227:{towgs84:"-83.58,-397.54,458.78,-17.595,-2.847,4.256,3.225"},EPSG_4746:{towgs84:"599.4,72.4,419.2,-0.062,-0.022,-2.723,6.46"},EPSG_4745:{towgs84:"612.4,77,440.2,-0.054,0.057,-2.797,2.55"},EPSG_6311:{towgs84:"8.846,-4.394,-1.122,-0.00237,-0.146528,0.130428,0.783926"},EPSG_4289:{towgs84:"565.7381,50.4018,465.2904,-0.395026,0.330772,-1.876073,4.07244"},EPSG_4230:{towgs84:"-68.863,-134.888,-111.49,-0.53,-0.14,0.57,-3.4"},EPSG_4154:{towgs84:"-123.02,-158.95,-168.47"},EPSG_4156:{towgs84:"570.8,85.7,462.8,4.998,1.587,5.261,3.56"},EPSG_4299:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4179:{towgs84:"33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84"},EPSG_4313:{towgs84:"-106.8686,52.2978,-103.7239,0.3366,-0.457,1.8422,-1.2747"},EPSG_4194:{towgs84:"163.511,127.533,-159.789"},EPSG_4195:{towgs84:"105,326,-102.5"},EPSG_4196:{towgs84:"-45,417,-3.5"},EPSG_4611:{towgs84:"-162.619,-276.959,-161.764,0.067753,-2.243648,-1.158828,-1.094246"},EPSG_4633:{towgs84:"137.092,131.66,91.475,-1.9436,-11.5993,-4.3321,-7.4824"},EPSG_4641:{towgs84:"-408.809,366.856,-412.987,1.8842,-0.5308,2.1655,-121.0993"},EPSG_4643:{towgs84:"-480.26,-438.32,-643.429,16.3119,20.1721,-4.0349,-111.7002"},EPSG_4300:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4188:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4660:{towgs84:"982.6087,552.753,-540.873,6.681627,-31.611492,-19.848161,16.805"},EPSG_4662:{towgs84:"97.295,-263.247,310.882,-1.5999,0.8386,3.1409,13.3259"},EPSG_3906:{towgs84:"577.88891,165.22205,391.18289,4.9145,-0.94729,-13.05098,7.78664"},EPSG_4307:{towgs84:"-209.3622,-87.8162,404.6198,0.0046,3.4784,0.5805,-1.4547"},EPSG_6892:{towgs84:"-76.269,-16.683,68.562,-6.275,10.536,-4.286,-13.686"},EPSG_4690:{towgs84:"221.597,152.441,176.523,2.403,1.3893,0.884,11.4648"},EPSG_4691:{towgs84:"218.769,150.75,176.75,3.5231,2.0037,1.288,10.9817"},EPSG_4629:{towgs84:"72.51,345.411,79.241,-1.5862,-0.8826,-0.5495,1.3653"},EPSG_4630:{towgs84:"165.804,216.213,180.26,-0.6251,-0.4515,-0.0721,7.4111"},EPSG_4692:{towgs84:"217.109,86.452,23.711,0.0183,-0.0003,0.007,-0.0093"},EPSG_9333:{towgs84:"0,0,0,-0.008393,0.000749,-0.010276,0"},EPSG_9059:{towgs84:"0,0,0"},EPSG_4312:{towgs84:"601.705,84.263,485.227,4.7354,1.3145,5.393,-2.3887"},EPSG_4123:{towgs84:"-96.062,-82.428,-121.753,4.801,0.345,-1.376,1.496"},EPSG_4309:{towgs84:"-124.45,183.74,44.64,-0.4384,0.5446,-0.9706,-2.1365"},ESRI_104106:{towgs84:"-283.088,-70.693,117.445,-1.157,0.059,-0.652,-4.058"},EPSG_4281:{towgs84:"-219.247,-73.802,269.529"},EPSG_4322:{towgs84:"0,0,4.5"},EPSG_4324:{towgs84:"0,0,1.9"},EPSG_4284:{towgs84:"43.822,-108.842,-119.585,1.455,-0.761,0.737,0.549"},EPSG_4277:{towgs84:"446.448,-125.157,542.06,0.15,0.247,0.842,-20.489"},EPSG_4207:{towgs84:"-282.1,-72.2,120,-1.529,0.145,-0.89,-4.46"},EPSG_4688:{towgs84:"347.175,1077.618,2623.677,33.9058,-70.6776,9.4013,186.0647"},EPSG_4689:{towgs84:"410.793,54.542,80.501,-2.5596,-2.3517,-0.6594,17.3218"},EPSG_4720:{towgs84:"0,0,4.5"},EPSG_4273:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},EPSG_4240:{towgs84:"204.64,834.74,293.8"},EPSG_4817:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},ESRI_104131:{towgs84:"426.62,142.62,460.09,4.98,4.49,-12.42,-17.1"},EPSG_4265:{towgs84:"-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68"},EPSG_4263:{towgs84:"-111.92,-87.85,114.5,1.875,0.202,0.219,0.032"},EPSG_4298:{towgs84:"-689.5937,623.84046,-65.93566,-0.02331,1.17094,-0.80054,5.88536"},EPSG_4270:{towgs84:"-253.4392,-148.452,386.5267,0.15605,0.43,-0.1013,-0.0424"},EPSG_4229:{towgs84:"-121.8,98.1,-10.7"},EPSG_4220:{towgs84:"-55.5,-348,-229.2"},EPSG_4214:{towgs84:"12.646,-155.176,-80.863"},EPSG_4232:{towgs84:"-345,3,223"},EPSG_4238:{towgs84:"-1.977,-13.06,-9.993,0.364,0.254,0.689,-1.037"},EPSG_4168:{towgs84:"-170,33,326"},EPSG_4131:{towgs84:"199,931,318.9"},EPSG_4152:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_5228:{towgs84:"572.213,85.334,461.94,4.9732,1.529,5.2484,3.5378"},EPSG_8351:{towgs84:"485.021,169.465,483.839,7.786342,4.397554,4.102655,0"},EPSG_4683:{towgs84:"-127.62,-67.24,-47.04,-3.068,4.903,1.578,-1.06"},EPSG_4133:{towgs84:"0,0,0"},EPSG_7373:{towgs84:"0.819,-0.5762,-1.6446,-0.00378,-0.03317,0.00318,0.0693"},EPSG_9075:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9072:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9294:{towgs84:"1.16835,-1.42001,-2.24431,-0.00822,-0.05508,0.01818,0.23388"},EPSG_4212:{towgs84:"-267.434,173.496,181.814,-13.4704,8.7154,7.3926,14.7492"},EPSG_4191:{towgs84:"-44.183,-0.58,-38.489,2.3867,2.7072,-3.5196,-8.2703"},EPSG_4237:{towgs84:"52.684,-71.194,-13.975,-0.312,-0.1063,-0.3729,1.0191"},EPSG_4740:{towgs84:"-1.08,-0.27,-0.9"},EPSG_4124:{towgs84:"419.3836,99.3335,591.3451,0.850389,1.817277,-7.862238,-0.99496"},EPSG_5681:{towgs84:"584.9636,107.7175,413.8067,1.1155,0.2824,-3.1384,7.9922"},EPSG_4141:{towgs84:"23.772,17.49,17.859,-0.3132,-1.85274,1.67299,-5.4262"},EPSG_4204:{towgs84:"-85.645,-273.077,-79.708,2.289,-1.421,2.532,3.194"},EPSG_4319:{towgs84:"226.702,-193.337,-35.371,-2.229,-4.391,9.238,0.9798"},EPSG_4200:{towgs84:"24.82,-131.21,-82.66"},EPSG_4130:{towgs84:"0,0,0"},EPSG_4127:{towgs84:"-82.875,-57.097,-156.768,-2.158,1.524,-0.982,-0.359"},EPSG_4149:{towgs84:"674.374,15.056,405.346"},EPSG_4617:{towgs84:"-0.991,1.9072,0.5129,0.02579,0.00965,0.01166,0"},EPSG_4663:{towgs84:"-210.502,-66.902,-48.476,2.094,-15.067,-5.817,0.485"},EPSG_4664:{towgs84:"-211.939,137.626,58.3,-0.089,0.251,0.079,0.384"},EPSG_4665:{towgs84:"-105.854,165.589,-38.312,-0.003,-0.026,0.024,-0.048"},EPSG_4666:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},EPSG_4756:{towgs84:"-192.873,-39.382,-111.202,-0.00205,-0.0005,0.00335,0.0188"},EPSG_4723:{towgs84:"-179.483,-69.379,-27.584,-7.862,8.163,6.042,-13.925"},EPSG_4726:{towgs84:"8.853,-52.644,180.304,-0.393,-2.323,2.96,-24.081"},EPSG_4267:{towgs84:"-8.0,160.0,176.0"},EPSG_5365:{towgs84:"-0.16959,0.35312,0.51846,0.03385,-0.16325,0.03446,0.03693"},EPSG_4218:{towgs84:"304.5,306.5,-318.1"},EPSG_4242:{towgs84:"-33.722,153.789,94.959,-8.581,-4.478,4.54,8.95"},EPSG_4216:{towgs84:"-292.295,248.758,429.447,4.9971,2.99,6.6906,1.0289"},ESRI_104105:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},ESRI_104129:{towgs84:"0,0,0"},EPSG_4673:{towgs84:"174.05,-25.49,112.57"},EPSG_4202:{towgs84:"-124,-60,154"},EPSG_4203:{towgs84:"-117.763,-51.51,139.061,0.292,0.443,0.277,-0.191"},EPSG_3819:{towgs84:"595.48,121.69,515.35,4.115,-2.9383,0.853,-3.408"},EPSG_8694:{towgs84:"-93.799,-132.737,-219.073,-1.844,0.648,-6.37,-0.169"},EPSG_4145:{towgs84:"275.57,676.78,229.6"},EPSG_4283:{towgs84:"0.06155,-0.01087,-0.04019,0.039492,0.032722,0.032898,-0.009994"},EPSG_4317:{towgs84:"2.3287,-147.0425,-92.0802,-0.309248,0.324822,0.497299,5.689063"},EPSG_4272:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993"},EPSG_4248:{towgs84:"-307.7,265.3,-363.5"},EPSG_5561:{towgs84:"24,-121,-76"},EPSG_5233:{towgs84:"-0.293,766.95,87.713,0.195704,1.695068,3.473016,-0.039338"},ESRI_104130:{towgs84:"-86,-98,-119"},ESRI_104102:{towgs84:"682,-203,480"},ESRI_37207:{towgs84:"7,-10,-26"},EPSG_4675:{towgs84:"59.935,118.4,-10.871"},ESRI_104109:{towgs84:"-89.121,-348.182,260.871"},ESRI_104112:{towgs84:"-185.583,-230.096,281.361"},ESRI_104113:{towgs84:"25.1,-275.6,222.6"},IGNF_WGS72G:{towgs84:"0,12,6"},IGNF_NTFG:{towgs84:"-168,-60,320"},IGNF_EFATE57G:{towgs84:"-127,-769,472"},IGNF_PGP50G:{towgs84:"324.8,153.6,172.1"},IGNF_REUN47G:{towgs84:"94,-948,-1262"},IGNF_CSG67G:{towgs84:"-186,230,110"},IGNF_GUAD48G:{towgs84:"-467,-16,-300"},IGNF_TAHI51G:{towgs84:"162,117,154"},IGNF_TAHAAG:{towgs84:"65,342,77"},IGNF_NUKU72G:{towgs84:"84,274,65"},IGNF_PETRELS72G:{towgs84:"365,194,166"},IGNF_WALL78G:{towgs84:"253,-133,-127"},IGNF_MAYO50G:{towgs84:"-382,-59,-262"},IGNF_TANNAG:{towgs84:"-139,-967,436"},IGNF_IGN72G:{towgs84:"-13,-348,292"},IGNF_ATIGG:{towgs84:"1118,23,66"},IGNF_FANGA84G:{towgs84:"150.57,158.33,118.32"},IGNF_RUSAT84G:{towgs84:"202.13,174.6,-15.74"},IGNF_KAUE70G:{towgs84:"126.74,300.1,-75.49"},IGNF_MOP90G:{towgs84:"-10.8,-1.8,12.77"},IGNF_MHPF67G:{towgs84:"338.08,212.58,-296.17"},IGNF_TAHI79G:{towgs84:"160.61,116.05,153.69"},IGNF_ANAA92G:{towgs84:"1.5,3.84,4.81"},IGNF_MARQUI72G:{towgs84:"330.91,-13.92,58.56"},IGNF_APAT86G:{towgs84:"143.6,197.82,74.05"},IGNF_TUBU69G:{towgs84:"237.17,171.61,-77.84"},IGNF_STPM50G:{towgs84:"11.363,424.148,373.13"},EPSG_4150:{towgs84:"674.374,15.056,405.346"},EPSG_4754:{towgs84:"-208.4058,-109.8777,-2.5764"},ESRI_104101:{towgs84:"372.87,149.23,585.29"},EPSG_4693:{towgs84:"0,-0.15,0.68"},EPSG_6207:{towgs84:"293.17,726.18,245.36"},EPSG_4153:{towgs84:"-133.63,-157.5,-158.62"},EPSG_4132:{towgs84:"-241.54,-163.64,396.06"},EPSG_4221:{towgs84:"-154.5,150.7,100.4"},EPSG_4266:{towgs84:"-80.7,-132.5,41.1"},EPSG_4193:{towgs84:"-70.9,-151.8,-41.4"},EPSG_5340:{towgs84:"-0.41,0.46,-0.35"},EPSG_4246:{towgs84:"-294.7,-200.1,525.5"},EPSG_4318:{towgs84:"-3.2,-5.7,2.8"},EPSG_4121:{towgs84:"-199.87,74.79,246.62"},EPSG_4223:{towgs84:"-260.1,5.5,432.2"},EPSG_4158:{towgs84:"-0.465,372.095,171.736"},EPSG_4285:{towgs84:"-128.16,-282.42,21.93"},EPSG_4613:{towgs84:"-404.78,685.68,45.47"},EPSG_4607:{towgs84:"195.671,332.517,274.607"},EPSG_4475:{towgs84:"-381.788,-57.501,-256.673"},EPSG_4208:{towgs84:"-157.84,308.54,-146.6"},EPSG_4743:{towgs84:"70.995,-335.916,262.898"},EPSG_4710:{towgs84:"-323.65,551.39,-491.22"},EPSG_7881:{towgs84:"-0.077,0.079,0.086"},EPSG_4682:{towgs84:"283.729,735.942,261.143"},EPSG_4739:{towgs84:"-156,-271,-189"},EPSG_4679:{towgs84:"-80.01,253.26,291.19"},EPSG_4750:{towgs84:"-56.263,16.136,-22.856"},EPSG_4644:{towgs84:"-10.18,-350.43,291.37"},EPSG_4695:{towgs84:"-103.746,-9.614,-255.95"},EPSG_4292:{towgs84:"-355,21,72"},EPSG_4302:{towgs84:"-61.702,284.488,472.052"},EPSG_4143:{towgs84:"-124.76,53,466.79"},EPSG_4606:{towgs84:"-153,153,307"},EPSG_4699:{towgs84:"-770.1,158.4,-498.2"},EPSG_4247:{towgs84:"-273.5,110.6,-357.9"},EPSG_4160:{towgs84:"8.88,184.86,106.69"},EPSG_4161:{towgs84:"-233.43,6.65,173.64"},EPSG_9251:{towgs84:"-9.5,122.9,138.2"},EPSG_9253:{towgs84:"-78.1,101.6,133.3"},EPSG_4297:{towgs84:"-198.383,-240.517,-107.909"},EPSG_4269:{towgs84:"0,0,0"},EPSG_4301:{towgs84:"-147,506,687"},EPSG_4618:{towgs84:"-59,-11,-52"},EPSG_4612:{towgs84:"0,0,0"},EPSG_4678:{towgs84:"44.585,-131.212,-39.544"},EPSG_4250:{towgs84:"-130,29,364"},EPSG_4144:{towgs84:"214,804,268"},EPSG_4147:{towgs84:"-17.51,-108.32,-62.39"},EPSG_4259:{towgs84:"-254.1,-5.36,-100.29"},EPSG_4164:{towgs84:"-76,-138,67"},EPSG_4211:{towgs84:"-378.873,676.002,-46.255"},EPSG_4182:{towgs84:"-422.651,-172.995,84.02"},EPSG_4224:{towgs84:"-143.87,243.37,-33.52"},EPSG_4225:{towgs84:"-205.57,168.77,-4.12"},EPSG_5527:{towgs84:"-67.35,3.88,-38.22"},EPSG_4752:{towgs84:"98,390,-22"},EPSG_4310:{towgs84:"-30,190,89"},EPSG_9248:{towgs84:"-192.26,65.72,132.08"},EPSG_4680:{towgs84:"124.5,-63.5,-281"},EPSG_4701:{towgs84:"-79.9,-158,-168.9"},EPSG_4706:{towgs84:"-146.21,112.63,4.05"},EPSG_4805:{towgs84:"682,-203,480"},EPSG_4201:{towgs84:"-165,-11,206"},EPSG_4210:{towgs84:"-157,-2,-299"},EPSG_4183:{towgs84:"-104,167,-38"},EPSG_4139:{towgs84:"11,72,-101"},EPSG_4668:{towgs84:"-86,-98,-119"},EPSG_4717:{towgs84:"-2,151,181"},EPSG_4732:{towgs84:"102,52,-38"},EPSG_4280:{towgs84:"-377,681,-50"},EPSG_4209:{towgs84:"-138,-105,-289"},EPSG_4261:{towgs84:"31,146,47"},EPSG_4658:{towgs84:"-73,46,-86"},EPSG_4721:{towgs84:"265.025,384.929,-194.046"},EPSG_4222:{towgs84:"-136,-108,-292"},EPSG_4601:{towgs84:"-255,-15,71"},EPSG_4602:{towgs84:"725,685,536"},EPSG_4603:{towgs84:"72,213.7,93"},EPSG_4605:{towgs84:"9,183,236"},EPSG_4621:{towgs84:"137,248,-430"},EPSG_4657:{towgs84:"-28,199,5"},EPSG_4316:{towgs84:"103.25,-100.4,-307.19"},EPSG_4642:{towgs84:"-13,-348,292"},EPSG_4698:{towgs84:"145,-187,103"},EPSG_4192:{towgs84:"-206.1,-174.7,-87.7"},EPSG_4311:{towgs84:"-265,120,-358"},EPSG_4135:{towgs84:"58,-283,-182"},ESRI_104138:{towgs84:"198,-226,-347"},EPSG_4245:{towgs84:"-11,851,5"},EPSG_4142:{towgs84:"-125,53,467"},EPSG_4213:{towgs84:"-106,-87,188"},EPSG_4253:{towgs84:"-133,-77,-51"},EPSG_4129:{towgs84:"-132,-110,-335"},EPSG_4713:{towgs84:"-77,-128,142"},EPSG_4239:{towgs84:"217,823,299"},EPSG_4146:{towgs84:"295,736,257"},EPSG_4155:{towgs84:"-83,37,124"},EPSG_4165:{towgs84:"-173,253,27"},EPSG_4672:{towgs84:"175,-38,113"},EPSG_4236:{towgs84:"-637,-549,-203"},EPSG_4251:{towgs84:"-90,40,88"},EPSG_4271:{towgs84:"-2,374,172"},EPSG_4175:{towgs84:"-88,4,101"},EPSG_4716:{towgs84:"298,-304,-375"},EPSG_4315:{towgs84:"-23,259,-9"},EPSG_4744:{towgs84:"-242.2,-144.9,370.3"},EPSG_4244:{towgs84:"-97,787,86"},EPSG_4293:{towgs84:"616,97,-251"},EPSG_4714:{towgs84:"-127,-769,472"},EPSG_4736:{towgs84:"260,12,-147"},EPSG_6883:{towgs84:"-235,-110,393"},EPSG_6894:{towgs84:"-63,176,185"},EPSG_4205:{towgs84:"-43,-163,45"},EPSG_4256:{towgs84:"41,-220,-134"},EPSG_4262:{towgs84:"639,405,60"},EPSG_4604:{towgs84:"174,359,365"},EPSG_4169:{towgs84:"-115,118,426"},EPSG_4620:{towgs84:"-106,-129,165"},EPSG_4184:{towgs84:"-203,141,53"},EPSG_4616:{towgs84:"-289,-124,60"},EPSG_9403:{towgs84:"-307,-92,127"},EPSG_4684:{towgs84:"-133,-321,50"},EPSG_4708:{towgs84:"-491,-22,435"},EPSG_4707:{towgs84:"114,-116,-333"},EPSG_4709:{towgs84:"145,75,-272"},EPSG_4712:{towgs84:"-205,107,53"},EPSG_4711:{towgs84:"124,-234,-25"},EPSG_4718:{towgs84:"230,-199,-752"},EPSG_4719:{towgs84:"211,147,111"},EPSG_4724:{towgs84:"208,-435,-229"},EPSG_4725:{towgs84:"189,-79,-202"},EPSG_4735:{towgs84:"647,1777,-1124"},EPSG_4722:{towgs84:"-794,119,-298"},EPSG_4728:{towgs84:"-307,-92,127"},EPSG_4734:{towgs84:"-632,438,-609"},EPSG_4727:{towgs84:"912,-58,1227"},EPSG_4729:{towgs84:"185,165,42"},EPSG_4730:{towgs84:"170,42,84"},EPSG_4733:{towgs84:"276,-57,149"},ESRI_37218:{towgs84:"230,-199,-752"},ESRI_37240:{towgs84:"-7,215,225"},ESRI_37221:{towgs84:"252,-209,-751"},ESRI_4305:{towgs84:"-123,-206,219"},ESRI_104139:{towgs84:"-73,-247,227"},EPSG_4748:{towgs84:"51,391,-36"},EPSG_4219:{towgs84:"-384,664,-48"},EPSG_4255:{towgs84:"-333,-222,114"},EPSG_4257:{towgs84:"-587.8,519.75,145.76"},EPSG_4646:{towgs84:"-963,510,-359"},EPSG_6881:{towgs84:"-24,-203,268"},EPSG_6882:{towgs84:"-183,-15,273"},EPSG_4715:{towgs84:"-104,-129,239"},IGNF_RGF93GDD:{towgs84:"0,0,0"},IGNF_RGM04GDD:{towgs84:"0,0,0"},IGNF_RGSPM06GDD:{towgs84:"0,0,0"},IGNF_RGTAAF07GDD:{towgs84:"0,0,0"},IGNF_RGFG95GDD:{towgs84:"0,0,0"},IGNF_RGNCG:{towgs84:"0,0,0"},IGNF_RGPFGDD:{towgs84:"0,0,0"},IGNF_ETRS89G:{towgs84:"0,0,0"},IGNF_RGR92GDD:{towgs84:"0,0,0"},EPSG_4173:{towgs84:"0,0,0"},EPSG_4180:{towgs84:"0,0,0"},EPSG_4619:{towgs84:"0,0,0"},EPSG_4667:{towgs84:"0,0,0"},EPSG_4075:{towgs84:"0,0,0"},EPSG_6706:{towgs84:"0,0,0"},EPSG_7798:{towgs84:"0,0,0"},EPSG_4661:{towgs84:"0,0,0"},EPSG_4669:{towgs84:"0,0,0"},EPSG_8685:{towgs84:"0,0,0"},EPSG_4151:{towgs84:"0,0,0"},EPSG_9702:{towgs84:"0,0,0"},EPSG_4758:{towgs84:"0,0,0"},EPSG_4761:{towgs84:"0,0,0"},EPSG_4765:{towgs84:"0,0,0"},EPSG_8997:{towgs84:"0,0,0"},EPSG_4023:{towgs84:"0,0,0"},EPSG_4670:{towgs84:"0,0,0"},EPSG_4694:{towgs84:"0,0,0"},EPSG_4148:{towgs84:"0,0,0"},EPSG_4163:{towgs84:"0,0,0"},EPSG_4167:{towgs84:"0,0,0"},EPSG_4189:{towgs84:"0,0,0"},EPSG_4190:{towgs84:"0,0,0"},EPSG_4176:{towgs84:"0,0,0"},EPSG_4659:{towgs84:"0,0,0"},EPSG_3824:{towgs84:"0,0,0"},EPSG_3889:{towgs84:"0,0,0"},EPSG_4046:{towgs84:"0,0,0"},EPSG_4081:{towgs84:"0,0,0"},EPSG_4558:{towgs84:"0,0,0"},EPSG_4483:{towgs84:"0,0,0"},EPSG_5013:{towgs84:"0,0,0"},EPSG_5264:{towgs84:"0,0,0"},EPSG_5324:{towgs84:"0,0,0"},EPSG_5354:{towgs84:"0,0,0"},EPSG_5371:{towgs84:"0,0,0"},EPSG_5373:{towgs84:"0,0,0"},EPSG_5381:{towgs84:"0,0,0"},EPSG_5393:{towgs84:"0,0,0"},EPSG_5489:{towgs84:"0,0,0"},EPSG_5593:{towgs84:"0,0,0"},EPSG_6135:{towgs84:"0,0,0"},EPSG_6365:{towgs84:"0,0,0"},EPSG_5246:{towgs84:"0,0,0"},EPSG_7886:{towgs84:"0,0,0"},EPSG_8431:{towgs84:"0,0,0"},EPSG_8427:{towgs84:"0,0,0"},EPSG_8699:{towgs84:"0,0,0"},EPSG_8818:{towgs84:"0,0,0"},EPSG_4757:{towgs84:"0,0,0"},EPSG_9140:{towgs84:"0,0,0"},EPSG_8086:{towgs84:"0,0,0"},EPSG_4686:{towgs84:"0,0,0"},EPSG_4737:{towgs84:"0,0,0"},EPSG_4702:{towgs84:"0,0,0"},EPSG_4747:{towgs84:"0,0,0"},EPSG_4749:{towgs84:"0,0,0"},EPSG_4674:{towgs84:"0,0,0"},EPSG_4755:{towgs84:"0,0,0"},EPSG_4759:{towgs84:"0,0,0"},EPSG_4762:{towgs84:"0,0,0"},EPSG_4763:{towgs84:"0,0,0"},EPSG_4764:{towgs84:"0,0,0"},EPSG_4166:{towgs84:"0,0,0"},EPSG_4170:{towgs84:"0,0,0"},EPSG_5546:{towgs84:"0,0,0"},EPSG_7844:{towgs84:"0,0,0"},EPSG_4818:{towgs84:"589,76,480"},EPSG_10328:{towgs84:"0,0,0"},EPSG_9782:{towgs84:"0,0,0"},EPSG_9777:{towgs84:"0,0,0"},EPSG_10690:{towgs84:"0,0,0"},EPSG_10639:{towgs84:"0,0,0"},EPSG_10739:{towgs84:"0,0,0"},EPSG_7686:{towgs84:"0,0,0"},EPSG_8900:{towgs84:"0,0,0"},EPSG_5886:{towgs84:"0,0,0"},EPSG_7683:{towgs84:"0,0,0"},EPSG_6668:{towgs84:"0,0,0"},EPSG_20046:{towgs84:"0,0,0"},EPSG_10299:{towgs84:"0,0,0"},EPSG_10310:{towgs84:"0,0,0"},EPSG_10475:{towgs84:"0,0,0"},EPSG_4742:{towgs84:"0,0,0"},EPSG_10671:{towgs84:"0,0,0"},EPSG_10762:{towgs84:"0,0,0"},EPSG_10725:{towgs84:"0,0,0"},EPSG_10791:{towgs84:"0,0,0"},EPSG_10800:{towgs84:"0,0,0"},EPSG_10305:{towgs84:"0,0,0"},EPSG_10941:{towgs84:"0,0,0"},EPSG_10968:{towgs84:"0,0,0"},EPSG_10875:{towgs84:"0,0,0"},EPSG_6318:{towgs84:"0,0,0"},EPSG_10910:{towgs84:"0,0,0"}};for(var nu in iu){var ru=iu[nu];ru.datumName&&(iu[ru.datumName]=ru)}const su=iu;var ou={};async function au(t,e){for(var i=[],n=await e.getImageCount(),r=n-1;r>=0;r--){var s=await e.getImage(r),o=await s.readRasters(),a=[s.getWidth(),s.getHeight()],l=s.getBoundingBox().map(hu),h=[s.fileDirectory.ModelPixelScale[0],s.fileDirectory.ModelPixelScale[1]].map(hu),u=l[0]+(a[0]-1)*h[0],c=l[3]-(a[1]-1)*h[1],d=o[0],f=o[1],p=[];for(let t=a[1]-1;t>=0;t--)for(let e=a[0]-1;e>=0;e--){var g=t*a[0]+e;p.push([-uu(f[g]),uu(d[g])])}i.push({del:h,lim:a,ll:[-u,c],cvs:p})}var m={header:{nSubgrids:n},subgrids:i};return ou[t]=m,m}function lu(t){if(0===t.length)return null;var e="@"===t[0];return e&&(t=t.slice(1)),"null"===t?{name:"null",mandatory:!e,grid:null,isNull:!0}:{name:t,mandatory:!e,grid:ou[t]||null,isNull:!1}}function hu(t){return t*Math.PI/180}function uu(t){return t/3600*Math.PI/180}function cu(t,e,i){return String.fromCharCode.apply(null,new Uint8Array(t.buffer.slice(e,i)))}function du(t){return t.map(function(t){return[uu(t.longitudeShift),uu(t.latitudeShift)]})}function fu(t,e,i){return{name:cu(t,e+8,e+16).trim(),parent:cu(t,e+24,e+24+8).trim(),lowerLatitude:t.getFloat64(e+72,i),upperLatitude:t.getFloat64(e+88,i),lowerLongitude:t.getFloat64(e+104,i),upperLongitude:t.getFloat64(e+120,i),latitudeInterval:t.getFloat64(e+136,i),longitudeInterval:t.getFloat64(e+152,i),gridNodeCount:t.getInt32(e+168,i)}}function pu(t,e,i,n,r){var s=e+176,o=16;!1===r&&(o=8);for(var a=[],l=0;l<i.gridNodeCount;l++){var h={latitudeShift:t.getFloat32(s+l*o,n),longitudeShift:t.getFloat32(s+l*o+4,n)};!1!==r&&(h.latitudeAccuracy=t.getFloat32(s+l*o+8,n),h.longitudeAccuracy=t.getFloat32(s+l*o+12,n)),a.push(h)}return a}function gu(t,e){if(!(this instanceof gu))return new gu(t);this.forward=null,this.inverse=null,this.init=null,this.name,this.names=null,this.title,e=e||function(t){if(t)throw t};var i=function(t){let e;if(function(t){return"string"==typeof t}(t))if(function(t){return t in Nh}(t))e=Nh[t];else if(function(t){return 0!==t.indexOf("+")&&-1!==t.indexOf("[")||"object"==typeof t&&!("srsCode"in t)}(t)){e=Lh(t);var i=function(t){var e=ph(t,"extension");if(e)return ph(e,"proj4")}(e);i&&(e=gh(i))}else(function(t){return"+"===t[0]})(t)&&(e=gh(t));else e="projName"in t?t:Lh(t);return e&&function(t){if(t.title)return 0===t.title.toLowerCase().indexOf("epsg:")&&Dh.indexOf(t.title.substr(5))>-1;var e=ph(t,"authority");if(e){var i=ph(e,"epsg");return i&&Dh.indexOf(i)>-1}}(e)?Nh["EPSG:3857"]:e}(t);if("object"==typeof i){var n=gu.projections.get(i.projName);if(n){if(i.datumCode&&"none"!==i.datumCode){var r=ph(su,i.datumCode);r&&(i.datum_params=i.datum_params||(r.towgs84?r.towgs84.split(","):null),i.ellps=r.ellipse,i.datumName=r.datumName?r.datumName:i.datumCode)}i.k0=i.k0||1,i.axis=i.axis||"enu",i.ellps=i.ellps||"wgs84",i.lat1=i.lat1||i.lat0;var s=function(t,e,i,n,r){if(!t){var s=ph(tu,n);s||(s=eu),t=s.a,e=s.b,i=s.rf}return i&&!e&&(e=(1-1/i)*t),(0===i||Math.abs(t-e)<sh)&&(r=!0,e=t),{a:t,b:e,rf:i,sphere:r}}(i.a,i.b,i.rf,i.ellps,i.sphere),o=function(t,e,i,n){var r=t*t,s=e*e,o=(r-s)/r,a=0;return n?(r=(t*=1-o*(.16666666666666666+o*(.04722222222222222+.022156084656084655*o)))*t,o=0):a=Math.sqrt(o),{es:o,e:a,ep2:(r-s)/s}}(s.a,s.b,s.rf,i.R_A),a=function(t){return void 0===t?null:t.split(",").map(lu)}(i.nadgrids),l=i.datum||function(t,e,i,n,r,s,o){var a={};return a.datum_type=void 0===t||"none"===t?5:4,e&&(a.datum_params=e.map(parseFloat),0===a.datum_params[0]&&0===a.datum_params[1]&&0===a.datum_params[2]||(a.datum_type=1),a.datum_params.length>3&&(0===a.datum_params[3]&&0===a.datum_params[4]&&0===a.datum_params[5]&&0===a.datum_params[6]||(a.datum_type=2,a.datum_params[3]*=nh,a.datum_params[4]*=nh,a.datum_params[5]*=nh,a.datum_params[6]=a.datum_params[6]/1e6+1))),o&&(a.datum_type=3,a.grids=o),a.a=i,a.b=n,a.es=r,a.ep2=s,a}(i.datumCode,i.datum_params,s.a,s.b,o.es,o.ep2,a);zh(this,i),zh(this,n),this.a=s.a,this.b=s.b,this.rf=s.rf,this.sphere=s.sphere,this.es=o.es,this.e=o.e,this.ep2=o.ep2,this.datum=l,"init"in this&&"function"==typeof this.init&&this.init(),e(null,this)}else e("Could not get projection name from: "+t)}else e("Could not parse to valid json: "+t)}gu.projections=Qh,gu.projections.start();const mu=gu;function yu(t,e,i){var n,r,s,o,a=t.x,l=t.y,h=t.z?t.z:0;if(l<-rh&&l>-1.001*rh)l=-rh;else if(l>rh&&l<1.001*rh)l=rh;else{if(l<-rh)return{x:-1/0,y:-1/0,z:t.z};if(l>rh)return{x:1/0,y:1/0,z:t.z}}return a>Math.PI&&(a-=2*Math.PI),r=Math.sin(l),o=Math.cos(l),s=r*r,{x:((n=i/Math.sqrt(1-e*s))+h)*o*Math.cos(a),y:(n+h)*o*Math.sin(a),z:(n*(1-e)+h)*r}}function _u(t,e,i,n){var r,s,o,a,l,h,u,c,d,f,p,g,m,y,_,v=t.x,x=t.y,w=t.z?t.z:0;if(r=Math.sqrt(v*v+x*x),s=Math.sqrt(v*v+x*x+w*w),r/i<1e-12){if(y=0,s/i<1e-12)return _=-n,{x:t.x,y:t.y,z:t.z}}else y=Math.atan2(x,v);o=w/s,c=(a=r/s)*(1-e)*(l=1/Math.sqrt(1-e*(2-e)*a*a)),d=o*l,m=0;do{m++,h=e*(u=i/Math.sqrt(1-e*d*d))/(u+(_=r*c+w*d-u*(1-e*d*d))),g=(p=o*(l=1/Math.sqrt(1-h*(2-h)*a*a)))*c-(f=a*(1-h)*l)*d,c=f,d=p}while(g*g>1e-24&&m<30);return{x:y,y:Math.atan(p/Math.abs(f)),z:_}}function vu(t){return 1===t||2===t}function xu(t,e,i){if(null===t.grids||0===t.grids.length)return console.log("Grid shift grids not found"),-1;var n={x:-i.x,y:i.y},r={x:Number.NaN,y:Number.NaN},s=[];t:for(var o=0;o<t.grids.length;o++){var a=t.grids[o];if(s.push(a.name),a.isNull){r=n;break}if(null!==a.grid)for(var l=a.grid.subgrids,h=0,u=l.length;h<u;h++){var c=l[h],d=(Math.abs(c.del[1])+Math.abs(c.del[0]))/1e4,f=c.ll[0]-d,p=c.ll[1]-d,g=c.ll[0]+(c.lim[0]-1)*c.del[0]+d,m=c.ll[1]+(c.lim[1]-1)*c.del[1]+d;if(!(p>n.y||f>n.x||m<n.y||g<n.x||(r=wu(n,e,c),isNaN(r.x))))break t}else if(a.mandatory)return console.log("Unable to find mandatory grid '"+a.name+"'"),-1}return isNaN(r.x)?(console.log("Failed to find a grid shift table for location '"+-n.x*ah+" "+n.y*ah+" tried: '"+s+"'"),-1):(i.x=-r.x,i.y=r.y,0)}function wu(t,e,i){var n={x:Number.NaN,y:Number.NaN};if(isNaN(t.x))return n;var r={x:t.x,y:t.y};r.x-=i.ll[0],r.y-=i.ll[1],r.x=Bh(r.x-Math.PI)+Math.PI;var s=bu(r,i);if(e){if(isNaN(s.x))return n;s.x=r.x-s.x,s.y=r.y-s.y;var o,a,l=9;do{if(a=bu(s,i),isNaN(a.x)){console.log("Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.");break}o={x:r.x-(a.x+s.x),y:r.y-(a.y+s.y)},s.x+=o.x,s.y+=o.y}while(l--&&Math.abs(o.x)>1e-12&&Math.abs(o.y)>1e-12);if(l<0)return console.log("Inverse grid shift iterator failed to converge."),n;n.x=Bh(s.x+i.ll[0]),n.y=s.y+i.ll[1]}else isNaN(s.x)||(n.x=t.x+s.x,n.y=t.y+s.y);return n}function bu(t,e){var i,n={x:t.x/e.del[0],y:t.y/e.del[1]},r=Math.floor(n.x),s=Math.floor(n.y),o=n.x-1*r,a=n.y-1*s,l={x:Number.NaN,y:Number.NaN};if(r<0||r>=e.lim[0])return l;if(s<0||s>=e.lim[1])return l;i=s*e.lim[0]+r;var h=e.cvs[i][0],u=e.cvs[i][1];i++;var c=e.cvs[i][0],d=e.cvs[i][1];i+=e.lim[0];var f=e.cvs[i][0],p=e.cvs[i][1];i--;var g=e.cvs[i][0],m=e.cvs[i][1],y=o*a,_=o*(1-a),v=(1-o)*(1-a),x=(1-o)*a;return l.x=v*h+_*c+x*g+y*f,l.y=v*u+_*d+x*m+y*p,l}function Su(t,e,i){var n,r,s,o=i.x,a=i.y,l=i.z||0,h={};for(s=0;s<3;s++)if(!e||2!==s||void 0!==i.z)switch(0===s?(n=o,r=-1!=="ew".indexOf(t.axis[s])?"x":"y"):1===s?(n=a,r=-1!=="ns".indexOf(t.axis[s])?"y":"x"):(n=l,r="z"),t.axis[s]){case"e":case"n":h[r]=n;break;case"w":case"s":h[r]=-n;break;case"u":void 0!==i[r]&&(h.z=n);break;case"d":void 0!==i[r]&&(h.z=-n);break;default:return null}return h}function Mu(t){var e={x:t[0],y:t[1]};return t.length>2&&(e.z=t[2]),t.length>3&&(e.m=t[3]),e}function Eu(t){if("function"==typeof Number.isFinite){if(Number.isFinite(t))return;throw new TypeError("coordinates must be finite numbers")}if("number"!=typeof t||t!=t||!isFinite(t))throw new TypeError("coordinates must be finite numbers")}function Cu(t,e,i,n){var r,s=void 0!==(i=Array.isArray(i)?Mu(i):{x:i.x,y:i.y,z:i.z,m:i.m}).z;if(function(t){Eu(t.x),Eu(t.y)}(i),t.datum&&e.datum&&function(t,e){return(1===t.datum.datum_type||2===t.datum.datum_type||3===t.datum.datum_type)&&"WGS84"!==e.datumCode||(1===e.datum.datum_type||2===e.datum.datum_type||3===e.datum.datum_type)&&"WGS84"!==t.datumCode}(t,e)&&(i=Cu(t,r=new mu("WGS84"),i,n),t=r),n&&"enu"!==t.axis&&(i=Su(t,!1,i)),"longlat"===t.projName)i={x:i.x*oh,y:i.y*oh,z:i.z||0};else if(t.to_meter&&(i={x:i.x*t.to_meter,y:i.y*t.to_meter,z:i.z||0}),!(i=t.inverse(i)))return;if(t.from_greenwich&&(i.x+=t.from_greenwich),i=function(t,e,i){if(function(t,e){return t.datum_type===e.datum_type&&!(t.a!==e.a||Math.abs(t.es-e.es)>5e-11)&&(1===t.datum_type?t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]:2!==t.datum_type||t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]&&t.datum_params[3]===e.datum_params[3]&&t.datum_params[4]===e.datum_params[4]&&t.datum_params[5]===e.datum_params[5]&&t.datum_params[6]===e.datum_params[6])}(t,e))return i;if(5===t.datum_type||5===e.datum_type)return i;var n=t.a,r=t.es;if(3===t.datum_type){if(0!==xu(t,!1,i))return;n=eh,r=ih}var s=e.a,o=e.b,a=e.es;return 3===e.datum_type&&(s=eh,o=6356752.314,a=ih),r!==a||n!==s||vu(t.datum_type)||vu(e.datum_type)?(i=yu(i,r,n),vu(t.datum_type)&&(i=function(t,e,i){if(1===e)return{x:t.x+i[0],y:t.y+i[1],z:t.z+i[2]};if(2===e){var n=i[0],r=i[1],s=i[2],o=i[3],a=i[4],l=i[5],h=i[6];return{x:h*(t.x-l*t.y+a*t.z)+n,y:h*(l*t.x+t.y-o*t.z)+r,z:h*(-a*t.x+o*t.y+t.z)+s}}}(i,t.datum_type,t.datum_params)),vu(e.datum_type)&&(i=function(t,e,i){if(1===e)return{x:t.x-i[0],y:t.y-i[1],z:t.z-i[2]};if(2===e){var n=i[0],r=i[1],s=i[2],o=i[3],a=i[4],l=i[5],h=i[6],u=(t.x-n)/h,c=(t.y-r)/h,d=(t.z-s)/h;return{x:u+l*c-a*d,y:-l*u+c+o*d,z:a*u-o*c+d}}}(i,e.datum_type,e.datum_params)),i=_u(i,a,s,o),3!==e.datum_type||0===xu(e,!0,i)?i:void 0):i}(t.datum,e.datum,i))return e.from_greenwich&&(i={x:i.x-e.from_greenwich,y:i.y,z:i.z||0}),"longlat"===e.projName?i={x:i.x*ah,y:i.y*ah,z:i.z||0}:(i=e.forward(i),e.to_meter&&(i={x:i.x/e.to_meter,y:i.y/e.to_meter,z:i.z||0})),n&&"enu"!==e.axis?Su(e,!0,i):(i&&!s&&"geocent"!==e.projName&&delete i.z,i)}var Pu=mu("WGS84");function Iu(t,e,i,n){var r,s,o;return Array.isArray(i)?(r=Cu(t,e,i,n)||{x:NaN,y:NaN},i.length>2?void 0!==t.name&&"geocent"===t.name||void 0!==e.name&&"geocent"===e.name?"number"==typeof r.z?[r.x,r.y,r.z].concat(i.slice(3)):[r.x,r.y,i[2]].concat(i.slice(3)):[r.x,r.y].concat(i.slice(2)):[r.x,r.y]):(s=Cu(t,e,i,n),2===(o=Object.keys(i)).length||o.forEach(function(n){if(void 0!==t.name&&"geocent"===t.name||void 0!==e.name&&"geocent"===e.name){if("x"===n||"y"===n||"z"===n)return}else if("x"===n||"y"===n)return;s[n]=i[n]}),s)}function Tu(t){return t instanceof mu?t:"object"==typeof t&&"oProj"in t?t.oProj:mu(t)}var Ru="AJSAJS",ku="AFAFAF",Au=65,Gu=73,Ou=79;const Fu={forward:Lu,inverse:function(t){var e=zu($u(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat,e.lon,e.lat]:[e.left,e.bottom,e.right,e.top]},toPoint:ju};function Lu(t,e){return e=e||5,function(t,e){var i,n,r,s,o,a,l,h,u,c,d,f="00000"+t.easting,p="00000"+t.northing;return t.zoneNumber+t.zoneLetter+(u=t.easting,c=t.northing,d=qu(t.zoneNumber),i=Math.floor(u/1e5),n=Math.floor(c/1e5)%20,s=Ru.charCodeAt(r=d-1),o=ku.charCodeAt(r),h=!1,(a=s+i-1)>90&&(a=a-90+Au-1,h=!0),(a===Gu||s<Gu&&a>Gu||(a>Gu||s<Gu)&&h)&&a++,(a===Ou||s<Ou&&a>Ou||(a>Ou||s<Ou)&&h)&&++a===Gu&&a++,a>90&&(a=a-90+Au-1),(l=o+n)>86?(l=l-86+Au-1,h=!0):h=!1,(l===Gu||o<Gu&&l>Gu||(l>Gu||o<Gu)&&h)&&l++,(l===Ou||o<Ou&&l>Ou||(l>Ou||o<Ou)&&h)&&++l===Gu&&l++,l>86&&(l=l-86+Au-1),String.fromCharCode(a)+String.fromCharCode(l))+f.substr(f.length-5,e)+p.substr(p.length-5,e)}(function(t){var e,i,n,r,s,o,a,l=t.lat,h=t.lon,u=6378137,c=.00669438,d=.9996,f=Nu(l),p=Nu(h);a=Math.floor((h+180)/6)+1,180===h&&(a=60),l>=56&&l<64&&h>=3&&h<12&&(a=32),l>=72&&l<84&&(h>=0&&h<9?a=31:h>=9&&h<21?a=33:h>=21&&h<33?a=35:h>=33&&h<42&&(a=37)),o=Nu(6*(a-1)-180+3),e=.006739496752268451,i=u/Math.sqrt(1-c*Math.sin(f)*Math.sin(f)),n=Math.tan(f)*Math.tan(f),r=e*Math.cos(f)*Math.cos(f);var g,m,y=d*i*((s=Math.cos(f)*(p-o))+(1-n+r)*s*s*s/6+(5-18*n+n*n+72*r-58*e)*s*s*s*s*s/120)+5e5,_=d*(u*(.9983242984503243*f-.002514607064228144*Math.sin(2*f)+2639046602129982e-21*Math.sin(4*f)-3.418046101696858e-9*Math.sin(6*f))+i*Math.tan(f)*(s*s/2+(5-n+9*r+4*r*r)*s*s*s*s/24+(61-58*n+n*n+600*r-2.2240339282485886)*s*s*s*s*s*s/720));return l<0&&(_+=1e7),{northing:Math.round(_),easting:Math.round(y),zoneNumber:a,zoneLetter:(g=l,m="Z",84>=g&&g>=72?m="X":72>g&&g>=64?m="W":64>g&&g>=56?m="V":56>g&&g>=48?m="U":48>g&&g>=40?m="T":40>g&&g>=32?m="S":32>g&&g>=24?m="R":24>g&&g>=16?m="Q":16>g&&g>=8?m="P":8>g&&g>=0?m="N":0>g&&g>=-8?m="M":-8>g&&g>=-16?m="L":-16>g&&g>=-24?m="K":-24>g&&g>=-32?m="J":-32>g&&g>=-40?m="H":-40>g&&g>=-48?m="G":-48>g&&g>=-56?m="F":-56>g&&g>=-64?m="E":-64>g&&g>=-72?m="D":-72>g&&g>=-80&&(m="C"),m)}}({lat:t[1],lon:t[0]}),e)}function ju(t){var e=zu($u(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat]:[(e.left+e.right)/2,(e.top+e.bottom)/2]}function Nu(t){return t*(Math.PI/180)}function Du(t){return t/Math.PI*180}function zu(t){var e=t.northing,i=t.easting,n=t.zoneLetter,r=t.zoneNumber;if(r<0||r>60)return null;var s,o,a,l,h,u,c,d,f,p=.9996,g=6378137,m=.00669438,y=(1-Math.sqrt(.99330562))/(1+Math.sqrt(.99330562)),_=i-5e5,v=e;n<"N"&&(v-=1e7),c=6*(r-1)-180+3,s=.006739496752268451,f=(d=v/p/6367449.145945056)+(3*y/2-27*y*y*y/32)*Math.sin(2*d)+(21*y*y/16-55*y*y*y*y/32)*Math.sin(4*d)+151*y*y*y/96*Math.sin(6*d),o=g/Math.sqrt(1-m*Math.sin(f)*Math.sin(f)),a=Math.tan(f)*Math.tan(f),l=s*Math.cos(f)*Math.cos(f),h=.99330562*g/Math.pow(1-m*Math.sin(f)*Math.sin(f),1.5),u=_/(o*p);var x=f-o*Math.tan(f)/h*(u*u/2-(5+3*a+10*l-4*l*l-9*s)*u*u*u*u/24+(61+90*a+298*l+45*a*a-1.6983531815716497-3*l*l)*u*u*u*u*u*u/720);x=Du(x);var w,b=(u-(1+2*a+l)*u*u*u/6+(5-2*l+28*a-3*l*l+8*s+24*a*a)*u*u*u*u*u/120)/Math.cos(f);if(b=c+Du(b),t.accuracy){var S=zu({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});w={top:S.lat,right:S.lon,bottom:x,left:b}}else w={lat:x,lon:b};return w}function qu(t){var e=t%6;return 0===e&&(e=6),e}function $u(t){if(t&&0===t.length)throw"MGRSPoint coverting from nothing";for(var e,i=t.length,n=null,r="",s=0;!/[A-Z]/.test(e=t.charAt(s));){if(s>=2)throw"MGRSPoint bad conversion from: "+t;r+=e,s++}var o=parseInt(r,10);if(0===s||s+3>i)throw"MGRSPoint bad conversion from: "+t;var a=t.charAt(s++);if(a<="A"||"B"===a||"Y"===a||a>="Z"||"I"===a||"O"===a)throw"MGRSPoint zone letter "+a+" not handled: "+t;n=t.substring(s,s+=2);for(var l=qu(o),h=function(t,e){for(var i=Ru.charCodeAt(e-1),n=1e5,r=!1;i!==t.charCodeAt(0);){if(++i===Gu&&i++,i===Ou&&i++,i>90){if(r)throw"Bad character: "+t;i=Au,r=!0}n+=1e5}return n}(n.charAt(0),l),u=function(t,e){if(t>"V")throw"MGRSPoint given invalid Northing "+t;for(var i=ku.charCodeAt(e-1),n=0,r=!1;i!==t.charCodeAt(0);){if(++i===Gu&&i++,i===Ou&&i++,i>86){if(r)throw"Bad character: "+t;i=Au,r=!0}n+=1e5}return n}(n.charAt(1),l);u<Bu(a);)u+=2e6;var c=i-s;if(c%2!=0)throw"MGRSPoint has to have an even number \nof digits after the zone letter and two 100km letters - front \nhalf for easting meters, second half for \nnorthing meters"+t;var d,f,p,g=c/2,m=0,y=0;return g>0&&(d=1e5/Math.pow(10,g),f=t.substring(s,s+g),m=parseFloat(f)*d,p=t.substring(s+g),y=parseFloat(p)*d),{easting:m+h,northing:y+u,zoneLetter:a,zoneNumber:o,accuracy:d}}function Bu(t){var e;switch(t){case"C":e=11e5;break;case"D":e=2e6;break;case"E":e=28e5;break;case"F":e=37e5;break;case"G":e=46e5;break;case"H":e=55e5;break;case"J":e=64e5;break;case"K":e=73e5;break;case"L":e=82e5;break;case"M":e=91e5;break;case"N":e=0;break;case"P":e=8e5;break;case"Q":e=17e5;break;case"R":e=26e5;break;case"S":e=35e5;break;case"T":e=44e5;break;case"U":e=53e5;break;case"V":e=62e5;break;case"W":e=7e6;break;case"X":e=79e5;break;default:e=-1}if(e>=0)return e;throw"Invalid zone letter: "+t}function Uu(t,e,i){if(!(this instanceof Uu))return new Uu(t,e,i);if(Array.isArray(t))this.x=t[0],this.y=t[1],this.z=t[2]||0;else if("object"==typeof t)this.x=t.x,this.y=t.y,this.z=t.z||0;else if("string"==typeof t&&void 0===e){var n=t.split(",");this.x=parseFloat(n[0]),this.y=parseFloat(n[1]),this.z=parseFloat(n[2])||0}else this.x=t,this.y=e,this.z=i||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}Uu.fromMGRS=function(t){return new Uu(ju(t))},Uu.prototype.toMGRS=function(t){return Lu([this.x,this.y],t)};const Wu=Uu;var Xu=.046875,Vu=.01953125,Ku=.01068115234375;function Yu(t){var e=[];e[0]=1-t*(.25+t*(Xu+t*(Vu+t*Ku))),e[1]=t*(.75-t*(Xu+t*(Vu+t*Ku)));var i=t*t;return e[2]=i*(.46875-t*(.013020833333333334+.007120768229166667*t)),i*=t,e[3]=i*(.3645833333333333-.005696614583333333*t),e[4]=i*t*.3076171875,e}function Zu(t,e,i,n){return i*=e,e*=e,n[0]*t-i*(n[1]+e*(n[2]+e*(n[3]+e*n[4])))}function Hu(t,e,i){for(var n=1/(1-e),r=t,s=20;s;--s){var o=Math.sin(r),a=1-e*o*o;if(r-=a=(Zu(r,o,Math.cos(r),i)-t)*(a*Math.sqrt(a))*n,Math.abs(a)<sh)return r}return r}const Ju={init:function(){this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.es&&(this.en=Yu(this.es),this.ml0=Zu(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))},forward:function(t){var e,i,n,r=t.x,s=t.y,o=Bh(r-this.long0,this.over),a=Math.sin(s),l=Math.cos(s);if(this.es){var h=l*o,u=Math.pow(h,2),c=this.ep2*Math.pow(l,2),d=Math.pow(c,2),f=Math.abs(l)>sh?Math.tan(s):0,p=Math.pow(f,2),g=Math.pow(p,2);e=1-this.es*Math.pow(a,2),h/=Math.sqrt(e);var m=Zu(s,a,l,this.en);i=this.a*(this.k0*h*(1+u/6*(1-p+c+u/20*(5-18*p+g+14*c-58*p*c+u/42*(61+179*g-g*p-479*p)))))+this.x0,n=this.a*(this.k0*(m-this.ml0+a*o*h/2*(1+u/12*(5-p+9*c+4*d+u/30*(61+g-58*p+270*c-330*p*c+u/56*(1385+543*g-g*p-3111*p))))))+this.y0}else{var y=l*Math.sin(o);if(Math.abs(Math.abs(y)-1)<sh)return 93;if(i=.5*this.a*this.k0*Math.log((1+y)/(1-y))+this.x0,n=l*Math.cos(o)/Math.sqrt(1-Math.pow(y,2)),(y=Math.abs(n))>=1){if(y-1>sh)return 93;n=0}else n=Math.acos(n);s<0&&(n=-n),n=this.a*this.k0*(n-this.lat0)+this.y0}return t.x=i,t.y=n,t},inverse:function(t){var e,i,n,r,s=(t.x-this.x0)*(1/this.a),o=(t.y-this.y0)*(1/this.a);if(this.es)if(i=Hu(e=this.ml0+o/this.k0,this.es,this.en),Math.abs(i)<rh){var a=Math.sin(i),l=Math.cos(i),h=Math.abs(l)>sh?Math.tan(i):0,u=this.ep2*Math.pow(l,2),c=Math.pow(u,2),d=Math.pow(h,2),f=Math.pow(d,2);e=1-this.es*Math.pow(a,2);var p=s*Math.sqrt(e)/this.k0,g=Math.pow(p,2);n=i-(e*=h)*g/(1-this.es)*.5*(1-g/12*(5+3*d-9*u*d+u-4*c-g/30*(61+90*d-252*u*d+45*f+46*u-g/56*(1385+3633*d+4095*f+1574*f*d)))),r=Bh(this.long0+p*(1-g/6*(1+2*d+u-g/20*(5+28*d+24*f+8*u*d+6*u-g/42*(61+662*d+1320*f+720*f*d))))/l,this.over)}else n=rh*$h(o),r=0;else{var m=Math.exp(s/this.k0),y=.5*(m-1/m),_=this.lat0+o/this.k0,v=Math.cos(_);e=Math.sqrt((1-Math.pow(v,2))/(1+Math.pow(y,2))),n=Math.asin(e),o<0&&(n=-n),r=0===y&&0===v?0:Bh(Math.atan2(y,v)+this.long0,this.over)}return t.x=r,t.y=n,t},names:["Fast_Transverse_Mercator","Fast Transverse Mercator"]};function Qu(t){var e=Math.exp(t);return(e-1/e)/2}function tc(t,e){t=Math.abs(t),e=Math.abs(e);var i=Math.max(t,e),n=Math.min(t,e)/(i||1);return i*Math.sqrt(1+Math.pow(n,2))}function ec(t,e){for(var i,n=2*Math.cos(2*e),r=t.length-1,s=t[r],o=0;--r>=0;)i=n*s-o+t[r],o=s,s=i;return e+i*Math.sin(2*e)}function ic(t,e,i){for(var n,r,s=Math.sin(e),o=Math.cos(e),a=Qu(i),l=function(t){var e=Math.exp(t);return(e+1/e)/2}(i),h=2*o*l,u=-2*s*a,c=t.length-1,d=t[c],f=0,p=0,g=0;--c>=0;)n=p,r=f,d=h*(p=d)-n-u*(f=g)+t[c],g=u*p-r+h*f;return[(h=s*l)*d-(u=o*a)*g,h*g+u*d]}const nc={init:function(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');this.approx&&(Ju.init.apply(this),this.forward=Ju.forward,this.inverse=Ju.inverse),this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var t=this.es/(1+Math.sqrt(1-this.es)),e=t/(2-t),i=e;this.cgb[0]=e*(2+e*(-2/3+e*(e*(116/45+e*(26/45+e*(-2854/675)))-2))),this.cbg[0]=e*(e*(2/3+e*(4/3+e*(-82/45+e*(32/45+e*(4642/4725)))))-2),i*=e,this.cgb[1]=i*(7/3+e*(e*(-227/45+e*(2704/315+e*(2323/945)))-1.6)),this.cbg[1]=i*(5/3+e*(-16/15+e*(-13/9+e*(904/315+e*(-1522/945))))),i*=e,this.cgb[2]=i*(56/15+e*(-136/35+e*(-1262/105+e*(73814/2835)))),this.cbg[2]=i*(-26/15+e*(34/21+e*(1.6+e*(-12686/2835)))),i*=e,this.cgb[3]=i*(4279/630+e*(-332/35+e*(-399572/14175))),this.cbg[3]=i*(1237/630+e*(e*(-24832/14175)-2.4)),i*=e,this.cgb[4]=i*(4174/315+e*(-144838/6237)),this.cbg[4]=i*(-734/315+e*(109598/31185)),i*=e,this.cgb[5]=i*(601676/22275),this.cbg[5]=i*(444337/155925),i=Math.pow(e,2),this.Qn=this.k0/(1+e)*(1+i*(1/4+i*(1/64+i/256))),this.utg[0]=e*(e*(2/3+e*(-37/96+e*(1/360+e*(81/512+e*(-96199/604800)))))-.5),this.gtu[0]=e*(.5+e*(-2/3+e*(5/16+e*(41/180+e*(-127/288+e*(7891/37800)))))),this.utg[1]=i*(-1/48+e*(-1/15+e*(437/1440+e*(-46/105+e*(1118711/3870720))))),this.gtu[1]=i*(13/48+e*(e*(557/1440+e*(281/630+e*(-1983433/1935360)))-.6)),i*=e,this.utg[2]=i*(-17/480+e*(37/840+e*(209/4480+e*(-5569/90720)))),this.gtu[2]=i*(61/240+e*(-103/140+e*(15061/26880+e*(167603/181440)))),i*=e,this.utg[3]=i*(-4397/161280+e*(11/504+e*(830251/7257600))),this.gtu[3]=i*(49561/161280+e*(-179/168+e*(6601661/7257600))),i*=e,this.utg[4]=i*(-4583/161280+e*(108847/3991680)),this.gtu[4]=i*(34729/80640+e*(-3418889/1995840)),i*=e,this.utg[5]=i*(-20648693/638668800),this.gtu[5]=.6650675310896665*i;var n=ec(this.cbg,this.lat0);this.Zb=-this.Qn*(n+function(t,e){for(var i,n=2*Math.cos(e),r=t.length-1,s=t[r],o=0;--r>=0;)i=n*s-o+t[r],o=s,s=i;return Math.sin(e)*i}(this.gtu,2*n))},forward:function(t){var e=Bh(t.x-this.long0,this.over),i=t.y;i=ec(this.cbg,i);var n=Math.sin(i),r=Math.cos(i),s=Math.sin(e),o=Math.cos(e);i=Math.atan2(n,o*r),e=Math.atan2(s*r,tc(n,r*o)),e=function(t){var e=Math.abs(t);return e=function(t){var e=1+t,i=e-1;return 0===i?t:t*Math.log(e)/i}(e*(1+e/(tc(1,e)+1))),t<0?-e:e}(Math.tan(e));var a,l,h=ic(this.gtu,2*i,2*e);return i+=h[0],e+=h[1],Math.abs(e)<=2.623395162778?(a=this.a*(this.Qn*e)+this.x0,l=this.a*(this.Qn*i+this.Zb)+this.y0):(a=1/0,l=1/0),t.x=a,t.y=l,t},inverse:function(t){var e,i,n=(t.x-this.x0)*(1/this.a),r=(t.y-this.y0)*(1/this.a);if(r=(r-this.Zb)/this.Qn,n/=this.Qn,Math.abs(n)<=2.623395162778){var s=ic(this.utg,2*r,2*n);r+=s[0],n+=s[1],n=Math.atan(Qu(n));var o=Math.sin(r),a=Math.cos(r),l=Math.sin(n),h=Math.cos(n);r=Math.atan2(o*h,tc(l,h*a)),e=Bh((n=Math.atan2(l,h*a))+this.long0,this.over),i=ec(this.cgb,r)}else e=1/0,i=1/0;return t.x=e,t.y=i,t},names:["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","Gauss Kruger","Gauss_Kruger","tmerc"]},rc={init:function(){var t=function(t,e){if(void 0===t){if((t=Math.floor(30*(Bh(e)+Math.PI)/Math.PI)+1)<0)return 0;if(t>60)return 60}return t}(this.zone,this.long0);if(void 0===t)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(t)-183)*oh,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,nc.init.apply(this),this.forward=nc.forward,this.inverse=nc.inverse},names:["Universal Transverse Mercator System","utm"],dependsOn:"etmerc"};function sc(t,e){return Math.pow((1-t)/(1+t),e)}const oc={init:function(){var t=Math.sin(this.lat0),e=Math.cos(this.lat0);e*=e,this.rc=Math.sqrt(1-this.es)/(1-this.es*t*t),this.C=Math.sqrt(1+this.es*e*e/(1-this.es)),this.phic0=Math.asin(t/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+lh)/(Math.pow(Math.tan(.5*this.lat0+lh),this.C)*sc(this.e*t,this.ratexp))},forward:function(t){var e=t.x,i=t.y;return t.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*i+lh),this.C)*sc(this.e*Math.sin(i),this.ratexp))-rh,t.x=this.C*e,t},inverse:function(t){for(var e=t.x/this.C,i=t.y,n=Math.pow(Math.tan(.5*i+lh)/this.K,1/this.C),r=20;r>0&&(i=2*Math.atan(n*sc(this.e*Math.sin(t.y),-.5*this.e))-rh,!(Math.abs(i-t.y)<1e-14));--r)t.y=i;return r?(t.x=e,t.y=i,t):null},names:["gauss"]},ac={init:function(){oc.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))},forward:function(t){var e,i,n,r;return t.x=Bh(t.x-this.long0,this.over),oc.forward.apply(this,[t]),e=Math.sin(t.y),i=Math.cos(t.y),n=Math.cos(t.x),r=this.k0*this.R2/(1+this.sinc0*e+this.cosc0*i*n),t.x=r*i*Math.sin(t.x),t.y=r*(this.cosc0*e-this.sinc0*i*n),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t},inverse:function(t){var e,i,n,r,s;if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,s=tc(t.x,t.y)){var o=2*Math.atan2(s,this.R2);e=Math.sin(o),i=Math.cos(o),r=Math.asin(i*this.sinc0+t.y*e*this.cosc0/s),n=Math.atan2(t.x*e,s*this.cosc0*i-t.y*this.sinc0*e)}else r=this.phic0,n=0;return t.x=n,t.y=r,oc.inverse.apply(this,[t]),t.x=Bh(t.x+this.long0,this.over),t},names:["Stereographic_North_Pole","Oblique_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"]};function lc(t,e,i){return e*=i,Math.tan(.5*(rh+t))*Math.pow((1-e)/(1+e),.5*i)}const hc={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=sh&&(this.k0=.5*(1+$h(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=sh&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=sh&&Math.abs(Math.cos(this.lat_ts))>sh&&(this.k0=.5*this.cons*qh(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/Uh(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=qh(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(lc(this.lat0,this.sinlat0,this.e))-rh,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))},forward:function(t){var e,i,n,r,s,o,a=t.x,l=t.y,h=Math.sin(l),u=Math.cos(l),c=Bh(a-this.long0,this.over);return Math.abs(Math.abs(a-this.long0)-Math.PI)<=sh&&Math.abs(l+this.lat0)<=sh?(t.x=NaN,t.y=NaN,t):this.sphere?(e=2*this.k0/(1+this.sinlat0*h+this.coslat0*u*Math.cos(c)),t.x=this.a*e*u*Math.sin(c)+this.x0,t.y=this.a*e*(this.coslat0*h-this.sinlat0*u*Math.cos(c))+this.y0,t):(i=2*Math.atan(lc(l,h,this.e))-rh,r=Math.cos(i),n=Math.sin(i),Math.abs(this.coslat0)<=sh?(s=Uh(this.e,l*this.con,this.con*h),o=2*this.a*this.k0*s/this.cons,t.x=this.x0+o*Math.sin(a-this.long0),t.y=this.y0-this.con*o*Math.cos(a-this.long0),t):(Math.abs(this.sinlat0)<sh?(e=2*this.a*this.k0/(1+r*Math.cos(c)),t.y=e*n):(e=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*n+this.cosX0*r*Math.cos(c))),t.y=e*(this.cosX0*n-this.sinX0*r*Math.cos(c))+this.y0),t.x=e*r*Math.sin(c)+this.x0,t))},inverse:function(t){var e,i,n,r,s;t.x-=this.x0,t.y-=this.y0;var o=Math.sqrt(t.x*t.x+t.y*t.y);if(this.sphere){var a=2*Math.atan(o/(2*this.a*this.k0));return e=this.long0,i=this.lat0,o<=sh?(t.x=e,t.y=i,t):(i=Math.asin(Math.cos(a)*this.sinlat0+t.y*Math.sin(a)*this.coslat0/o),e=Math.abs(this.coslat0)<sh?this.lat0>0?Bh(this.long0+Math.atan2(t.x,-1*t.y),this.over):Bh(this.long0+Math.atan2(t.x,t.y),this.over):Bh(this.long0+Math.atan2(t.x*Math.sin(a),o*this.coslat0*Math.cos(a)-t.y*this.sinlat0*Math.sin(a)),this.over),t.x=e,t.y=i,t)}if(Math.abs(this.coslat0)<=sh){if(o<=sh)return i=this.lat0,e=this.long0,t.x=e,t.y=i,t;t.x*=this.con,t.y*=this.con,n=o*this.cons/(2*this.a*this.k0),i=this.con*Wh(this.e,n),e=this.con*Bh(this.con*this.long0+Math.atan2(t.x,-1*t.y),this.over)}else r=2*Math.atan(o*this.cosX0/(2*this.a*this.k0*this.ms1)),e=this.long0,o<=sh?s=this.X0:(s=Math.asin(Math.cos(r)*this.sinX0+t.y*Math.sin(r)*this.cosX0/o),e=Bh(this.long0+Math.atan2(t.x*Math.sin(r),o*this.cosX0*Math.cos(r)-t.y*this.sinX0*Math.sin(r)),this.over)),i=-1*Wh(this.e,Math.tan(.5*(rh+s)));return t.x=e,t.y=i,t},names:["stere","Stereographic_South_Pole","Polar_Stereographic_variant_A","Polar_Stereographic_variant_B","Polar_Stereographic"],ssfn_:lc},uc={init:function(){var t=this.lat0;this.lambda0=this.long0;var e=Math.sin(t),i=this.a,n=1/this.rf,r=2*n-Math.pow(n,2),s=this.e=Math.sqrt(r);this.R=this.k0*i*Math.sqrt(1-r)/(1-r*Math.pow(e,2)),this.alpha=Math.sqrt(1+r/(1-r)*Math.pow(Math.cos(t),4)),this.b0=Math.asin(e/this.alpha);var o=Math.log(Math.tan(Math.PI/4+this.b0/2)),a=Math.log(Math.tan(Math.PI/4+t/2)),l=Math.log((1+s*e)/(1-s*e));this.K=o-this.alpha*a+this.alpha*s/2*l},forward:function(t){var e=Math.log(Math.tan(Math.PI/4-t.y/2)),i=this.e/2*Math.log((1+this.e*Math.sin(t.y))/(1-this.e*Math.sin(t.y))),n=-this.alpha*(e+i)+this.K,r=2*(Math.atan(Math.exp(n))-Math.PI/4),s=this.alpha*(t.x-this.lambda0),o=Math.atan(Math.sin(s)/(Math.sin(this.b0)*Math.tan(r)+Math.cos(this.b0)*Math.cos(s))),a=Math.asin(Math.cos(this.b0)*Math.sin(r)-Math.sin(this.b0)*Math.cos(r)*Math.cos(s));return t.y=this.R/2*Math.log((1+Math.sin(a))/(1-Math.sin(a)))+this.y0,t.x=this.R*o+this.x0,t},inverse:function(t){for(var e=t.x-this.x0,i=t.y-this.y0,n=e/this.R,r=2*(Math.atan(Math.exp(i/this.R))-Math.PI/4),s=Math.asin(Math.cos(this.b0)*Math.sin(r)+Math.sin(this.b0)*Math.cos(r)*Math.cos(n)),o=Math.atan(Math.sin(n)/(Math.cos(this.b0)*Math.cos(n)-Math.sin(this.b0)*Math.tan(r))),a=this.lambda0+o/this.alpha,l=0,h=s,u=-1e3,c=0;Math.abs(h-u)>1e-7;){if(++c>20)return;l=1/this.alpha*(Math.log(Math.tan(Math.PI/4+s/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(h))/2)),u=h,h=2*Math.atan(Math.exp(l))-Math.PI/2}return t.x=a,t.y=h,t},names:["somerc"]};var cc=1e-7;const dc={init:function(){var t,e,i,n,r,s,o,a,l,h,u,c,d,f,p=0,g=0,m=0,y=0,_=0,v=0,x=0;this.no_off=(d=["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],f="object"==typeof(c=this).projName?Object.keys(c.projName)[0]:c.projName,"no_uoff"in c||"no_off"in c||-1!==d.indexOf(f)||-1!==d.indexOf(Jh(f))),this.no_rot="no_rot"in this;var w=!1;"alpha"in this&&(w=!0);var b=!1;if("rectified_grid_angle"in this&&(b=!0),w&&(x=this.alpha),b&&(p=this.rectified_grid_angle),w||b)g=this.longc;else if(m=this.long1,_=this.lat1,y=this.long2,v=this.lat2,Math.abs(_-v)<=cc||(t=Math.abs(_))<=cc||Math.abs(t-rh)<=cc||Math.abs(Math.abs(this.lat0)-rh)<=cc||Math.abs(Math.abs(v)-rh)<=cc)throw new Error;var S=1-this.es;e=Math.sqrt(S),Math.abs(this.lat0)>sh?(a=Math.sin(this.lat0),i=Math.cos(this.lat0),t=1-this.es*a*a,this.B=i*i,this.B=Math.sqrt(1+this.es*this.B*this.B/S),this.A=this.B*this.k0*e/t,(r=(n=this.B*e/(i*Math.sqrt(t)))*n-1)<=0?r=0:(r=Math.sqrt(r),this.lat0<0&&(r=-r)),this.E=r+=n,this.E*=Math.pow(Uh(this.e,this.lat0,a),this.B)):(this.B=1/e,this.A=this.k0,this.E=n=r=1),w||b?(w?(u=Math.asin(Math.sin(x)/n),b||(p=x)):(u=p,x=Math.asin(n*Math.sin(u))),this.lam0=g-Math.asin(.5*(r-1/r)*Math.tan(u))/this.B):(s=Math.pow(Uh(this.e,_,Math.sin(_)),this.B),o=Math.pow(Uh(this.e,v,Math.sin(v)),this.B),r=this.E/s,l=(o-s)/(o+s),h=((h=this.E*this.E)-o*s)/(h+o*s),(t=m-y)<-Math.PI?y-=hh:t>Math.PI&&(y+=hh),this.lam0=Bh(.5*(m+y)-Math.atan(h*Math.tan(.5*this.B*(m-y))/l)/this.B,this.over),u=Math.atan(2*Math.sin(this.B*Bh(m-this.lam0,this.over))/(r-1/r)),p=x=Math.asin(n*Math.sin(u))),this.singam=Math.sin(u),this.cosgam=Math.cos(u),this.sinrot=Math.sin(p),this.cosrot=Math.cos(p),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(n*n-1)/Math.cos(x))),this.lat0<0&&(this.u_0=-this.u_0)),r=.5*u,this.v_pole_n=this.ArB*Math.log(Math.tan(lh-r)),this.v_pole_s=this.ArB*Math.log(Math.tan(lh+r))},forward:function(t){var e,i,n,r,s,o,a,l,h={};if(t.x=t.x-this.lam0,Math.abs(Math.abs(t.y)-rh)>sh){if(e=.5*((s=this.E/Math.pow(Uh(this.e,t.y,Math.sin(t.y)),this.B))-(o=1/s)),i=.5*(s+o),r=Math.sin(this.B*t.x),n=(e*this.singam-r*this.cosgam)/i,Math.abs(Math.abs(n)-1)<sh)throw new Error;l=.5*this.ArB*Math.log((1-n)/(1+n)),o=Math.cos(this.B*t.x),a=Math.abs(o)<cc?this.A*t.x:this.ArB*Math.atan2(e*this.cosgam+r*this.singam,o)}else l=t.y>0?this.v_pole_n:this.v_pole_s,a=this.ArB*t.y;return this.no_rot?(h.x=a,h.y=l):(a-=this.u_0,h.x=l*this.cosrot+a*this.sinrot,h.y=a*this.cosrot-l*this.sinrot),h.x=this.a*h.x+this.x0,h.y=this.a*h.y+this.y0,h},inverse:function(t){var e,i,n,r,s,o,a,l={};if(t.x=(t.x-this.x0)*(1/this.a),t.y=(t.y-this.y0)*(1/this.a),this.no_rot?(i=t.y,e=t.x):(i=t.x*this.cosrot-t.y*this.sinrot,e=t.y*this.cosrot+t.x*this.sinrot+this.u_0),r=.5*((n=Math.exp(-this.BrA*i))-1/n),s=.5*(n+1/n),a=((o=Math.sin(this.BrA*e))*this.cosgam+r*this.singam)/s,Math.abs(Math.abs(a)-1)<sh)l.x=0,l.y=a<0?-rh:rh;else{if(l.y=this.E/Math.sqrt((1+a)/(1-a)),l.y=Wh(this.e,Math.pow(l.y,1/this.B)),l.y===1/0)throw new Error;l.x=-this.rB*Math.atan2(r*this.cosgam-o*this.singam,Math.cos(this.BrA*e))}return l.x+=this.lam0,l},names:["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Variant_B","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","Oblique_Mercator","omerc"]},fc={init:function(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(Math.abs(this.lat1+this.lat2)<sh)){var t=this.b/this.a;this.e=Math.sqrt(1-t*t);var e=Math.sin(this.lat1),i=Math.cos(this.lat1),n=qh(this.e,e,i),r=Uh(this.e,this.lat1,e),s=Math.sin(this.lat2),o=Math.cos(this.lat2),a=qh(this.e,s,o),l=Uh(this.e,this.lat2,s),h=Math.abs(Math.abs(this.lat0)-rh)<sh?0:Uh(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>sh?this.ns=Math.log(n/a)/Math.log(r/l):this.ns=e,isNaN(this.ns)&&(this.ns=e),this.f0=n/(this.ns*Math.pow(r,this.ns)),this.rh=this.a*this.f0*Math.pow(h,this.ns),this.title||(this.title="Lambert Conformal Conic")}},forward:function(t){var e=t.x,i=t.y;Math.abs(2*Math.abs(i)-Math.PI)<=sh&&(i=$h(i)*(rh-2e-10));var n,r,s=Math.abs(Math.abs(i)-rh);if(s>sh)n=Uh(this.e,i,Math.sin(i)),r=this.a*this.f0*Math.pow(n,this.ns);else{if((s=i*this.ns)<=0)return null;r=0}var o=this.ns*Bh(e-this.long0,this.over);return t.x=this.k0*(r*Math.sin(o))+this.x0,t.y=this.k0*(this.rh-r*Math.cos(o))+this.y0,t},inverse:function(t){var e,i,n,r,s,o=(t.x-this.x0)/this.k0,a=this.rh-(t.y-this.y0)/this.k0;this.ns>0?(e=Math.sqrt(o*o+a*a),i=1):(e=-Math.sqrt(o*o+a*a),i=-1);var l=0;if(0!==e&&(l=Math.atan2(i*o,i*a)),0!==e||this.ns>0){if(i=1/this.ns,n=Math.pow(e/(this.a*this.f0),i),-9999===(r=Wh(this.e,n)))return null}else r=-rh;return s=Bh(l/this.ns+this.long0,this.over),t.x=s,t.y=r,t},names:["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","lcc","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"]},pc={init:function(){this.a=6377397.155,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.4334234309119251),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq},forward:function(t){var e,i,n,r,s,o,a,l=t.x,h=t.y,u=Bh(l-this.long0,this.over);return e=Math.pow((1+this.e*Math.sin(h))/(1-this.e*Math.sin(h)),this.alfa*this.e/2),i=2*(Math.atan(this.k*Math.pow(Math.tan(h/2+this.s45),this.alfa)/e)-this.s45),n=-u*this.alfa,r=Math.asin(Math.cos(this.ad)*Math.sin(i)+Math.sin(this.ad)*Math.cos(i)*Math.cos(n)),s=Math.asin(Math.cos(i)*Math.sin(n)/Math.cos(r)),o=this.n*s,a=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(r/2+this.s45),this.n),t.y=a*Math.cos(o)/1,t.x=a*Math.sin(o)/1,this.czech||(t.y*=-1,t.x*=-1),t},inverse:function(t){var e,i,n,r,s,o,a,l=t.x;t.x=t.y,t.y=l,this.czech||(t.y*=-1,t.x*=-1),s=Math.sqrt(t.x*t.x+t.y*t.y),r=Math.atan2(t.y,t.x)/Math.sin(this.s0),n=2*(Math.atan(Math.pow(this.ro0/s,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),e=Math.asin(Math.cos(this.ad)*Math.sin(n)-Math.sin(this.ad)*Math.cos(n)*Math.cos(r)),i=Math.asin(Math.cos(n)*Math.sin(r)/Math.cos(e)),t.x=this.long0-i/this.alfa,o=e,a=0;var h=0;do{t.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(e/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(o))/(1-this.e*Math.sin(o)),this.e/2))-this.s45),Math.abs(o-t.y)<1e-10&&(a=1),o=t.y,h+=1}while(0===a&&h<15);return h>=15?null:t},names:["Krovak","Krovak Modified","Krovak (North Orientated)","Krovak Modified (North Orientated)","krovak"]};function gc(t,e,i,n,r){return t*r-e*Math.sin(2*r)+i*Math.sin(4*r)-n*Math.sin(6*r)}function mc(t){return 1-.25*t*(1+t/16*(3+1.25*t))}function yc(t){return.375*t*(1+.25*t*(1+.46875*t))}function _c(t){return.05859375*t*t*(1+.75*t)}function vc(t){return t*t*t*(35/3072)}function xc(t,e,i){var n=e*i;return t/Math.sqrt(1-n*n)}function wc(t){return Math.abs(t)<rh?t:t-$h(t)*Math.PI}function bc(t,e,i,n,r){var s,o;s=t/e;for(var a=0;a<15;a++)if(s+=o=(t-(e*s-i*Math.sin(2*s)+n*Math.sin(4*s)-r*Math.sin(6*s)))/(e-2*i*Math.cos(2*s)+4*n*Math.cos(4*s)-6*r*Math.cos(6*s)),Math.abs(o)<=1e-10)return s;return NaN}const Sc={init:function(){this.sphere||(this.e0=mc(this.es),this.e1=yc(this.es),this.e2=_c(this.es),this.e3=vc(this.es),this.ml0=this.a*gc(this.e0,this.e1,this.e2,this.e3,this.lat0))},forward:function(t){var e,i,n=t.x,r=t.y;if(n=Bh(n-this.long0,this.over),this.sphere)e=this.a*Math.asin(Math.cos(r)*Math.sin(n)),i=this.a*(Math.atan2(Math.tan(r),Math.cos(n))-this.lat0);else{var s=Math.sin(r),o=Math.cos(r),a=xc(this.a,this.e,s),l=Math.tan(r)*Math.tan(r),h=n*Math.cos(r),u=h*h,c=this.es*o*o/(1-this.es);e=a*h*(1-u*l*(1/6-(8-l+8*c)*u/120)),i=this.a*gc(this.e0,this.e1,this.e2,this.e3,r)-this.ml0+a*s/o*u*(.5+(5-l+6*c)*u/24)}return t.x=e+this.x0,t.y=i+this.y0,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var e,i,n=t.x/this.a,r=t.y/this.a;if(this.sphere){var s=r+this.lat0;e=Math.asin(Math.sin(s)*Math.cos(n)),i=Math.atan2(Math.tan(n),Math.cos(s))}else{var o=bc(this.ml0/this.a+r,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(o)-rh)<=sh)return t.x=this.long0,t.y=rh,r<0&&(t.y*=-1),t;var a=xc(this.a,this.e,Math.sin(o)),l=a*a*a/this.a/this.a*(1-this.es),h=Math.pow(Math.tan(o),2),u=n*this.a/a,c=u*u;e=o-a*Math.tan(o)/l*u*u*(.5-(1+3*h)*u*u/24),i=u*(1-c*(h/3+(1+3*h)*h*c/15))/Math.cos(o)}return t.x=Bh(i+this.long0,this.over),t.y=wc(e),t},names:["Cassini","Cassini_Soldner","cass"]};function Mc(t,e){var i;return t>1e-7?(1-t*t)*(e/(1-(i=t*e)*i)-.5/t*Math.log((1-i)/(1+i))):2*e}const Ec={init:function(){var t,e=Math.abs(this.lat0);if(Math.abs(e-rh)<sh?this.mode=this.lat0<0?1:2:Math.abs(e)<sh?this.mode=3:this.mode=4,this.es>0)switch(this.qp=Mc(this.e,1),this.mmf=.5/(1-this.es),this.apa=function(t){var e,i=[];return i[0]=.3333333333333333*t,e=t*t,i[0]+=.17222222222222222*e,i[1]=.06388888888888888*e,e*=t,i[0]+=.10257936507936508*e,i[1]+=.0664021164021164*e,i[2]=.016415012942191543*e,i}(this.es),this.mode){case 2:case 1:this.dd=1;break;case 3:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case 4:this.rq=Math.sqrt(.5*this.qp),t=Math.sin(this.lat0),this.sinb1=Mc(this.e,t)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*t*t)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd}else 4===this.mode&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))},forward:function(t){var e,i,n,r,s,o,a,l,h,u,c=t.x,d=t.y;if(c=Bh(c-this.long0,this.over),this.sphere){if(s=Math.sin(d),u=Math.cos(d),n=Math.cos(c),this.mode===this.OBLIQ||this.mode===this.EQUIT){if((i=this.mode===this.EQUIT?1+u*n:1+this.sinph0*s+this.cosph0*u*n)<=sh)return null;e=(i=Math.sqrt(2/i))*u*Math.sin(c),i*=this.mode===this.EQUIT?s:this.cosph0*s-this.sinph0*u*n}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(n=-n),Math.abs(d+this.lat0)<sh)return null;i=lh-.5*d,e=(i=2*(this.mode===this.S_POLE?Math.cos(i):Math.sin(i)))*Math.sin(c),i*=n}}else{switch(a=0,l=0,h=0,n=Math.cos(c),r=Math.sin(c),s=Math.sin(d),o=Mc(this.e,s),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(a=o/this.qp,l=Math.sqrt(1-a*a)),this.mode){case this.OBLIQ:h=1+this.sinb1*a+this.cosb1*l*n;break;case this.EQUIT:h=1+l*n;break;case this.N_POLE:h=rh+d,o=this.qp-o;break;case this.S_POLE:h=d-rh,o=this.qp+o}if(Math.abs(h)<sh)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:h=Math.sqrt(2/h),i=this.mode===this.OBLIQ?this.ymf*h*(this.cosb1*a-this.sinb1*l*n):(h=Math.sqrt(2/(1+l*n)))*a*this.ymf,e=this.xmf*h*l*r;break;case this.N_POLE:case this.S_POLE:o>=0?(e=(h=Math.sqrt(o))*r,i=n*(this.mode===this.S_POLE?h:-h)):e=i=0}}return t.x=this.a*e+this.x0,t.y=this.a*i+this.y0,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var e,i,n,r,s,o,a,l,h,u,c=t.x/this.a,d=t.y/this.a;if(this.sphere){var f,p=0,g=0;if((i=.5*(f=Math.sqrt(c*c+d*d)))>1)return null;switch(i=2*Math.asin(i),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(g=Math.sin(i),p=Math.cos(i)),this.mode){case this.EQUIT:i=Math.abs(f)<=sh?0:Math.asin(d*g/f),c*=g,d=p*f;break;case this.OBLIQ:i=Math.abs(f)<=sh?this.lat0:Math.asin(p*this.sinph0+d*g*this.cosph0/f),c*=g*this.cosph0,d=(p-Math.sin(i)*this.sinph0)*f;break;case this.N_POLE:d=-d,i=rh-i;break;case this.S_POLE:i-=rh}e=0!==d||this.mode!==this.EQUIT&&this.mode!==this.OBLIQ?Math.atan2(c,d):0}else{if(a=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(c/=this.dd,d*=this.dd,(o=Math.sqrt(c*c+d*d))<sh)return t.x=this.long0,t.y=this.lat0,t;r=2*Math.asin(.5*o/this.rq),n=Math.cos(r),c*=r=Math.sin(r),this.mode===this.OBLIQ?(a=n*this.sinb1+d*r*this.cosb1/o,s=this.qp*a,d=o*this.cosb1*n-d*this.sinb1*r):(a=d*r/o,s=this.qp*a,d=o*n)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(d=-d),!(s=c*c+d*d))return t.x=this.long0,t.y=this.lat0,t;a=1-s/this.qp,this.mode===this.S_POLE&&(a=-a)}e=Math.atan2(c,d),u=(l=Math.asin(a))+l,i=l+(h=this.apa)[0]*Math.sin(u)+h[1]*Math.sin(u+u)+h[2]*Math.sin(u+u+u)}return t.x=Bh(this.long0+e,this.over),t.y=i,t},names:["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],S_POLE:1,N_POLE:2,EQUIT:3,OBLIQ:4};function Cc(t){return Math.abs(t)>1&&(t=t>1?1:-1),Math.asin(t)}const Pc={init:function(){Math.abs(this.lat1+this.lat2)<sh||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=qh(this.e3,this.sin_po,this.cos_po),this.qs1=Mc(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=qh(this.e3,this.sin_po,this.cos_po),this.qs2=Mc(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=Mc(this.e3,this.sin_po),Math.abs(this.lat1-this.lat2)>sh?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)},forward:function(t){var e=t.x,i=t.y;this.sin_phi=Math.sin(i),this.cos_phi=Math.cos(i);var n=Mc(this.e3,this.sin_phi),r=this.a*Math.sqrt(this.c-this.ns0*n)/this.ns0,s=this.ns0*Bh(e-this.long0,this.over),o=r*Math.sin(s)+this.x0,a=this.rh-r*Math.cos(s)+this.y0;return t.x=o,t.y=a,t},inverse:function(t){var e,i,n,r,s,o;return t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns0>=0?(e=Math.sqrt(t.x*t.x+t.y*t.y),n=1):(e=-Math.sqrt(t.x*t.x+t.y*t.y),n=-1),r=0,0!==e&&(r=Math.atan2(n*t.x,n*t.y)),n=e*this.ns0/this.a,this.sphere?o=Math.asin((this.c-n*n)/(2*this.ns0)):(i=(this.c-n*n)/this.ns0,o=this.phi1z(this.e3,i)),s=Bh(r/this.ns0+this.long0,this.over),t.x=s,t.y=o,t},names:["Albers_Conic_Equal_Area","Albers_Equal_Area","Albers","aea"],phi1z:function(t,e){var i,n,r,s,o=Cc(.5*e);if(t<sh)return o;for(var a=t*t,l=1;l<=25;l++)if(o+=s=.5*(r=1-(n=t*(i=Math.sin(o)))*n)*r/Math.cos(o)*(e/(1-a)-i/r+.5/t*Math.log((1-n)/(1+n))),Math.abs(s)<=1e-7)return o;return null}},Ic={init:function(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1},forward:function(t){var e,i,n,r,s,o,a,l=t.x,h=t.y;return n=Bh(l-this.long0,this.over),e=Math.sin(h),i=Math.cos(h),r=Math.cos(n),(s=this.sin_p14*e+this.cos_p14*i*r)>0||Math.abs(s)<=sh?(o=this.x0+1*this.a*i*Math.sin(n)/s,a=this.y0+1*this.a*(this.cos_p14*e-this.sin_p14*i*r)/s):(o=this.x0+this.infinity_dist*i*Math.sin(n),a=this.y0+this.infinity_dist*(this.cos_p14*e-this.sin_p14*i*r)),t.x=o,t.y=a,t},inverse:function(t){var e,i,n,r,s,o;return t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,(e=Math.sqrt(t.x*t.x+t.y*t.y))?(r=Math.atan2(e,this.rc),i=Math.sin(r),o=Cc((n=Math.cos(r))*this.sin_p14+t.y*i*this.cos_p14/e),s=Math.atan2(t.x*i,e*this.cos_p14*n-t.y*this.sin_p14*i),s=Bh(this.long0+s,this.over)):(o=this.phic0,s=0),t.x=s,t.y=o,t},names:["gnom"]},Tc={init:function(){this.sphere||(this.k0=qh(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))},forward:function(t){var e,i,n=t.x,r=t.y,s=Bh(n-this.long0,this.over);if(this.sphere)e=this.x0+this.a*s*Math.cos(this.lat_ts),i=this.y0+this.a*Math.sin(r)/Math.cos(this.lat_ts);else{var o=Mc(this.e,Math.sin(r));e=this.x0+this.a*this.k0*s,i=this.y0+this.a*o*.5/this.k0}return t.x=e,t.y=i,t},inverse:function(t){var e,i;return t.x-=this.x0,t.y-=this.y0,this.sphere?(e=Bh(this.long0+t.x/this.a/Math.cos(this.lat_ts),this.over),i=Math.asin(t.y/this.a*Math.cos(this.lat_ts))):(i=function(t,e){var i=1-(1-t*t)/(2*t)*Math.log((1-t)/(1+t));if(Math.abs(Math.abs(e)-i)<1e-6)return e<0?-1*rh:rh;for(var n,r,s,o,a=Math.asin(.5*e),l=0;l<30;l++)if(r=Math.sin(a),s=Math.cos(a),o=t*r,a+=n=Math.pow(1-o*o,2)/(2*s)*(e/(1-t*t)-r/(1-o*o)+.5/t*Math.log((1-o)/(1+o))),Math.abs(n)<=1e-10)return a;return NaN}(this.e,2*t.y*this.k0/this.a),e=Bh(this.long0+t.x/(this.a*this.k0),this.over)),t.x=e,t.y=i,t},names:["cea"]},Rc={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)},forward:function(t){var e=t.x,i=t.y,n=Bh(e-this.long0,this.over),r=wc(i-this.lat0);return t.x=this.x0+this.a*n*this.rc,t.y=this.y0+this.a*r,t},inverse:function(t){var e=t.x,i=t.y;return t.x=Bh(this.long0+(e-this.x0)/(this.a*this.rc),this.over),t.y=wc(this.lat0+(i-this.y0)/this.a),t},names:["Equirectangular","Equidistant_Cylindrical","Equidistant_Cylindrical_Spherical","eqc"]},kc={init:function(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=mc(this.es),this.e1=yc(this.es),this.e2=_c(this.es),this.e3=vc(this.es),this.ml0=this.a*gc(this.e0,this.e1,this.e2,this.e3,this.lat0)},forward:function(t){var e,i,n,r=t.x,s=t.y,o=Bh(r-this.long0,this.over);if(n=o*Math.sin(s),this.sphere)Math.abs(s)<=sh?(e=this.a*o,i=-1*this.a*this.lat0):(e=this.a*Math.sin(n)/Math.tan(s),i=this.a*(wc(s-this.lat0)+(1-Math.cos(n))/Math.tan(s)));else if(Math.abs(s)<=sh)e=this.a*o,i=-1*this.ml0;else{var a=xc(this.a,this.e,Math.sin(s))/Math.tan(s);e=a*Math.sin(n),i=this.a*gc(this.e0,this.e1,this.e2,this.e3,s)-this.ml0+a*(1-Math.cos(n))}return t.x=e+this.x0,t.y=i+this.y0,t},inverse:function(t){var e,i,n,r,s,o,a,l,h;if(n=t.x-this.x0,r=t.y-this.y0,this.sphere)if(Math.abs(r+this.a*this.lat0)<=sh)e=Bh(n/this.a+this.long0,this.over),i=0;else{var u;for(o=this.lat0+r/this.a,a=n*n/this.a/this.a+o*o,l=o,s=20;s;--s)if(l+=h=-1*(o*(l*(u=Math.tan(l))+1)-l-.5*(l*l+a)*u)/((l-o)/u-1),Math.abs(h)<=sh){i=l;break}e=Bh(this.long0+Math.asin(n*Math.tan(l)/this.a)/Math.sin(i),this.over)}else if(Math.abs(r+this.ml0)<=sh)i=0,e=Bh(this.long0+n/this.a,this.over);else{var c,d,f,p,g;for(o=(this.ml0+r)/this.a,a=n*n/this.a/this.a+o*o,l=o,s=20;s;--s)if(g=this.e*Math.sin(l),c=Math.sqrt(1-g*g)*Math.tan(l),d=this.a*gc(this.e0,this.e1,this.e2,this.e3,l),f=this.e0-2*this.e1*Math.cos(2*l)+4*this.e2*Math.cos(4*l)-6*this.e3*Math.cos(6*l),l-=h=(o*(c*(p=d/this.a)+1)-p-.5*c*(p*p+a))/(this.es*Math.sin(2*l)*(p*p+a-2*o*p)/(4*c)+(o-p)*(c*f-2/Math.sin(2*l))-f),Math.abs(h)<=sh){i=l;break}c=Math.sqrt(1-this.es*Math.pow(Math.sin(i),2))*Math.tan(i),e=Bh(this.long0+Math.asin(n*c/this.a)/Math.sin(i),this.over)}return t.x=e,t.y=i,t},names:["Polyconic","American_Polyconic","poly"]},Ac={init:function(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013},forward:function(t){var e,i=t.x,n=t.y-this.lat0,r=i-this.long0,s=n/nh*1e-5,o=r,a=1,l=0;for(e=1;e<=10;e++)a*=s,l+=this.A[e]*a;var h,u=l,c=o,d=1,f=0,p=0,g=0;for(e=1;e<=6;e++)h=f*u+d*c,d=d*u-f*c,f=h,p=p+this.B_re[e]*d-this.B_im[e]*f,g=g+this.B_im[e]*d+this.B_re[e]*f;return t.x=g*this.a+this.x0,t.y=p*this.a+this.y0,t},inverse:function(t){var e,i,n=t.x,r=t.y,s=n-this.x0,o=(r-this.y0)/this.a,a=s/this.a,l=1,h=0,u=0,c=0;for(e=1;e<=6;e++)i=h*o+l*a,l=l*o-h*a,h=i,u=u+this.C_re[e]*l-this.C_im[e]*h,c=c+this.C_im[e]*l+this.C_re[e]*h;for(var d=0;d<this.iterations;d++){var f,p=u,g=c,m=o,y=a;for(e=2;e<=6;e++)f=g*u+p*c,p=p*u-g*c,g=f,m+=(e-1)*(this.B_re[e]*p-this.B_im[e]*g),y+=(e-1)*(this.B_im[e]*p+this.B_re[e]*g);p=1,g=0;var _=this.B_re[1],v=this.B_im[1];for(e=2;e<=6;e++)f=g*u+p*c,p=p*u-g*c,g=f,_+=e*(this.B_re[e]*p-this.B_im[e]*g),v+=e*(this.B_im[e]*p+this.B_re[e]*g);var x=_*_+v*v;u=(m*_+y*v)/x,c=(y*_-m*v)/x}var w=u,b=c,S=1,M=0;for(e=1;e<=9;e++)S*=w,M+=this.D[e]*S;var E=this.lat0+M*nh*1e5,C=this.long0+b;return t.x=C,t.y=E,t},names:["New_Zealand_Map_Grid","nzmg"]},Gc={init:function(){},forward:function(t){var e=t.x,i=t.y,n=Bh(e-this.long0,this.over),r=this.x0+this.a*n,s=this.y0+this.a*Math.log(Math.tan(Math.PI/4+i/2.5))*1.25;return t.x=r,t.y=s,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var e=Bh(this.long0+t.x/this.a,this.over),i=2.5*(Math.atan(Math.exp(.8*t.y/this.a))-Math.PI/4);return t.x=e,t.y=i,t},names:["Miller_Cylindrical","mill"]},Oc={init:function(){this.long0=this.long0||0,this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=Yu(this.es)},forward:function(t){var e,i,n=t.x,r=t.y;if(n=Bh(n-this.long0,this.over),this.sphere){if(this.m)for(var s=this.n*Math.sin(r),o=20;o;--o){var a=(this.m*r+Math.sin(r)-s)/(this.m+Math.cos(r));if(r-=a,Math.abs(a)<sh)break}else r=1!==this.n?Math.asin(this.n*Math.sin(r)):r;e=this.a*this.C_x*n*(this.m+Math.cos(r)),i=this.a*this.C_y*r}else{var l=Math.sin(r),h=Math.cos(r);i=this.a*Zu(r,l,h,this.en),e=this.a*n*h/Math.sqrt(1-this.es*l*l)}return t.x=e,t.y=i,t},inverse:function(t){var e,i,n;return t.x-=this.x0,i=t.x/this.a,t.y-=this.y0,e=t.y/this.a,this.sphere?(e/=this.C_y,i/=this.C_x*(this.m+Math.cos(e)),this.m?e=Cc((this.m*e+Math.sin(e))/this.n):1!==this.n&&(e=Cc(Math.sin(e)/this.n)),i=Bh(i+this.long0,this.over),e=wc(e)):(e=Hu(t.y/this.a,this.es,this.en),(n=Math.abs(e))<rh?(n=Math.sin(e),i=Bh(this.long0+t.x*Math.sqrt(1-this.es*n*n)/(this.a*Math.cos(e)),this.over)):n-sh<rh&&(i=this.long0)),t.x=i,t.y=e,t},names:["Sinusoidal","sinu"]},Fc={init:function(){this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0},forward:function(t){for(var e=t.x,i=t.y,n=Bh(e-this.long0,this.over),r=i,s=Math.PI*Math.sin(i);;){var o=-(r+Math.sin(r)-s)/(1+Math.cos(r));if(r+=o,Math.abs(o)<sh)break}r/=2,Math.PI/2-Math.abs(i)<sh&&(n=0);var a=.900316316158*this.a*n*Math.cos(r)+this.x0,l=1.4142135623731*this.a*Math.sin(r)+this.y0;return t.x=a,t.y=l,t},inverse:function(t){var e,i;t.x-=this.x0,t.y-=this.y0,i=t.y/(1.4142135623731*this.a),Math.abs(i)>.999999999999&&(i=.999999999999),e=Math.asin(i);var n=Bh(this.long0+t.x/(.900316316158*this.a*Math.cos(e)),this.over);n<-Math.PI&&(n=-Math.PI),n>Math.PI&&(n=Math.PI),i=(2*e+Math.sin(2*e))/Math.PI,Math.abs(i)>1&&(i=1);var r=Math.asin(i);return t.x=n,t.y=r,t},names:["Mollweide","moll"]},Lc={init:function(){Math.abs(this.lat1+this.lat2)<sh||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=mc(this.es),this.e1=yc(this.es),this.e2=_c(this.es),this.e3=vc(this.es),this.sin_phi=Math.sin(this.lat1),this.cos_phi=Math.cos(this.lat1),this.ms1=qh(this.e,this.sin_phi,this.cos_phi),this.ml1=gc(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<sh?this.ns=this.sin_phi:(this.sin_phi=Math.sin(this.lat2),this.cos_phi=Math.cos(this.lat2),this.ms2=qh(this.e,this.sin_phi,this.cos_phi),this.ml2=gc(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=gc(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))},forward:function(t){var e,i=t.x,n=t.y;if(this.sphere)e=this.a*(this.g-n);else{var r=gc(this.e0,this.e1,this.e2,this.e3,n);e=this.a*(this.g-r)}var s=this.ns*Bh(i-this.long0,this.over),o=this.x0+e*Math.sin(s),a=this.y0+this.rh-e*Math.cos(s);return t.x=o,t.y=a,t},inverse:function(t){var e,i,n,r;t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns>=0?(i=Math.sqrt(t.x*t.x+t.y*t.y),e=1):(i=-Math.sqrt(t.x*t.x+t.y*t.y),e=-1);var s=0;return 0!==i&&(s=Math.atan2(e*t.x,e*t.y)),this.sphere?(r=Bh(this.long0+s/this.ns,this.over),n=wc(this.g-i/this.a),t.x=r,t.y=n,t):(n=bc(this.g-i/this.a,this.e0,this.e1,this.e2,this.e3),r=Bh(this.long0+s/this.ns,this.over),t.x=r,t.y=n,t)},names:["Equidistant_Conic","eqdc"]},jc={init:function(){this.R=this.a},forward:function(t){var e,i,n=t.x,r=t.y,s=Bh(n-this.long0,this.over);Math.abs(r)<=sh&&(e=this.x0+this.R*s,i=this.y0);var o=Cc(2*Math.abs(r/Math.PI));(Math.abs(s)<=sh||Math.abs(Math.abs(r)-rh)<=sh)&&(e=this.x0,i=r>=0?this.y0+Math.PI*this.R*Math.tan(.5*o):this.y0+Math.PI*this.R*-Math.tan(.5*o));var a=.5*Math.abs(Math.PI/s-s/Math.PI),l=a*a,h=Math.sin(o),u=Math.cos(o),c=u/(h+u-1),d=c*c,f=c*(2/h-1),p=f*f,g=Math.PI*this.R*(a*(c-p)+Math.sqrt(l*(c-p)*(c-p)-(p+l)*(d-p)))/(p+l);s<0&&(g=-g),e=this.x0+g;var m=l+c;return g=Math.PI*this.R*(f*m-a*Math.sqrt((p+l)*(l+1)-m*m))/(p+l),i=r>=0?this.y0+g:this.y0-g,t.x=e,t.y=i,t},inverse:function(t){var e,i,n,r,s,o,a,l,h,u,c,d;return t.x-=this.x0,t.y-=this.y0,c=Math.PI*this.R,s=(n=t.x/c)*n+(r=t.y/c)*r,c=3*(r*r/(l=-2*(o=-Math.abs(r)*(1+s))+1+2*r*r+s*s)+(2*(a=o-2*r*r+n*n)*a*a/l/l/l-9*o*a/l/l)/27)/(h=(o-a*a/3/l)/l)/(u=2*Math.sqrt(-h/3)),Math.abs(c)>1&&(c=c>=0?1:-1),d=Math.acos(c)/3,i=t.y>=0?(-u*Math.cos(d+Math.PI/3)-a/3/l)*Math.PI:-(-u*Math.cos(d+Math.PI/3)-a/3/l)*Math.PI,e=Math.abs(n)<sh?this.long0:Bh(this.long0+Math.PI*(s-1+Math.sqrt(1+2*(n*n-r*r)+s*s))/2/n,this.over),t.x=e,t.y=i,t},names:["Van_der_Grinten_I","VanDerGrinten","Van_der_Grinten","vandg"]},Nc={init:function(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0),this.f=this.es/(1+Math.sqrt(1-this.es))},forward:function(t){var e,i,n,r,s,o,a,l,h,u,c,d=t.x,f=t.y,p=Math.sin(t.y),g=Math.cos(t.y),m=Bh(d-this.long0,this.over);return this.sphere?Math.abs(this.sin_p12-1)<=sh?(t.x=this.x0+this.a*(rh-f)*Math.sin(m),t.y=this.y0-this.a*(rh-f)*Math.cos(m),t):Math.abs(this.sin_p12+1)<=sh?(t.x=this.x0+this.a*(rh+f)*Math.sin(m),t.y=this.y0+this.a*(rh+f)*Math.cos(m),t):(h=this.sin_p12*p+this.cos_p12*g*Math.cos(m),l=(a=Math.acos(h))?a/Math.sin(a):1,t.x=this.x0+this.a*l*g*Math.sin(m),t.y=this.y0+this.a*l*(this.cos_p12*p-this.sin_p12*g*Math.cos(m)),t):(e=mc(this.es),i=yc(this.es),n=_c(this.es),r=vc(this.es),Math.abs(this.sin_p12-1)<=sh?(s=this.a*gc(e,i,n,r,rh),o=this.a*gc(e,i,n,r,f),t.x=this.x0+(s-o)*Math.sin(m),t.y=this.y0-(s-o)*Math.cos(m),t):Math.abs(this.sin_p12+1)<=sh?(s=this.a*gc(e,i,n,r,rh),o=this.a*gc(e,i,n,r,f),t.x=this.x0+(s+o)*Math.sin(m),t.y=this.y0+(s+o)*Math.cos(m),t):Math.abs(d)<sh&&Math.abs(f-this.lat0)<sh?(t.x=t.y=0,t):(u=function(t,e,i,n,r,s){const o=n-e,a=Math.atan((1-s)*Math.tan(t)),l=Math.atan((1-s)*Math.tan(i)),h=Math.sin(a),u=Math.cos(a),c=Math.sin(l),d=Math.cos(l);let f,p,g,m,y,_,v,x,w,b,S,M,E,C,P,I=o,T=100;do{if(p=Math.sin(I),g=Math.cos(I),m=Math.sqrt(d*p*(d*p)+(u*c-h*d*g)*(u*c-h*d*g)),0===m)return{azi1:0,s12:0};y=h*c+u*d*g,_=Math.atan2(m,y),v=u*d*p/m,x=1-v*v,w=0!==x?y-2*h*c/x:0,b=s/16*x*(4+s*(4-3*x)),f=I,I=o+(1-b)*s*v*(_+b*m*(w+b*y*(2*w*w-1)))}while(Math.abs(I-f)>1e-12&&--T>0);return 0===T?{azi1:NaN,s12:NaN}:(S=x*(r*r-r*(1-s)*(r*(1-s)))/(r*(1-s)*(r*(1-s))),M=1+S/16384*(4096+S*(S*(320-175*S)-768)),E=S/1024*(256+S*(S*(74-47*S)-128)),C=E*m*(w+E/4*(y*(2*w*w-1)-E/6*w*(4*m*m-3)*(4*w*w-3))),P=r*(1-s)*M*(_-C),{azi1:Math.atan2(d*p,u*c-h*d*g),s12:P})}(this.lat0,this.long0,f,d,this.a,this.f),c=u.azi1,t.x=u.s12*Math.sin(c),t.y=u.s12*Math.cos(c),t))},inverse:function(t){var e,i,n,r,s,o,a,l,h,u,c,d,f,p,g;if(t.x-=this.x0,t.y-=this.y0,this.sphere){if((e=Math.sqrt(t.x*t.x+t.y*t.y))>2*rh*this.a)return;return i=e/this.a,n=Math.sin(i),r=Math.cos(i),s=this.long0,Math.abs(e)<=sh?o=this.lat0:(o=Cc(r*this.sin_p12+t.y*n*this.cos_p12/e),a=Math.abs(this.lat0)-rh,s=Math.abs(a)<=sh?this.lat0>=0?Bh(this.long0+Math.atan2(t.x,-t.y),this.over):Bh(this.long0-Math.atan2(-t.x,t.y),this.over):Bh(this.long0+Math.atan2(t.x*n,e*this.cos_p12*r-t.y*this.sin_p12*n),this.over)),t.x=s,t.y=o,t}return l=mc(this.es),h=yc(this.es),u=_c(this.es),c=vc(this.es),Math.abs(this.sin_p12-1)<=sh?(o=bc(((d=this.a*gc(l,h,u,c,rh))-(e=Math.sqrt(t.x*t.x+t.y*t.y)))/this.a,l,h,u,c),s=Bh(this.long0+Math.atan2(t.x,-1*t.y),this.over),t.x=s,t.y=o,t):Math.abs(this.sin_p12+1)<=sh?(d=this.a*gc(l,h,u,c,rh),o=bc(((e=Math.sqrt(t.x*t.x+t.y*t.y))-d)/this.a,l,h,u,c),s=Bh(this.long0+Math.atan2(t.x,t.y),this.over),t.x=s,t.y=o,t):(f=Math.atan2(t.x,t.y),p=Math.sqrt(t.x*t.x+t.y*t.y),g=function(t,e,i,n,r,s){const o=Math.atan((1-s)*Math.tan(t)),a=Math.sin(o),l=Math.cos(o),h=Math.sin(i),u=Math.cos(i),c=Math.atan2(a,l*u),d=l*h,f=1-d*d,p=f*(r*r-r*(1-s)*(r*(1-s)))/(r*(1-s)*(r*(1-s))),g=1+p/16384*(4096+p*(p*(320-175*p)-768)),m=p/1024*(256+p*(p*(74-47*p)-128));let y,_,v,x,w,b=n/(r*(1-s)*g),S=100;do{_=Math.cos(2*c+b),v=Math.sin(b),x=Math.cos(b),w=m*v*(_+m/4*(x*(2*_*_-1)-m/6*_*(4*v*v-3)*(4*_*_-3))),y=b,b=n/(r*(1-s)*g)+w}while(Math.abs(b-y)>1e-12&&--S>0);if(0===S)return{lat2:NaN,lon2:NaN};const M=a*v-l*x*u,E=s/16*f*(4+s*(4-3*f));return{lat2:Math.atan2(a*x+l*v*u,(1-s)*Math.sqrt(d*d+M*M)),lon2:e+(Math.atan2(v*h,l*x-a*v*u)-(1-E)*s*d*(b+E*v*(_+E*x*(2*_*_-1))))}}(this.lat0,this.long0,f,p,this.a,this.f),t.x=g.lon2,t.y=g.lat2,t)},names:["Azimuthal_Equidistant","aeqd"]},Dc={init:function(){this.sin_p14=Math.sin(this.lat0||0),this.cos_p14=Math.cos(this.lat0||0)},forward:function(t){var e,i,n,r,s,o,a,l=t.x,h=t.y;return n=Bh(l-(this.long0||0),this.over),e=Math.sin(h),i=Math.cos(h),r=Math.cos(n),((s=this.sin_p14*e+this.cos_p14*i*r)>0||Math.abs(s)<=sh)&&(o=1*this.a*i*Math.sin(n),a=(this.y0||0)+1*this.a*(this.cos_p14*e-this.sin_p14*i*r)),t.x=o,t.y=a,t},inverse:function(t){var e,i,n,r,s,o,a,l,h;return t.x-=this.x0||0,t.y-=this.y0||0,i=Cc((e=Math.sqrt(t.x*t.x+t.y*t.y))/this.a),n=Math.sin(i),r=Math.cos(i),l=this.long0||0,h=this.lat0||0,o=l,Math.abs(e)<=sh?(a=h,t.x=o,t.y=a,t):(a=Cc(r*this.sin_p14+t.y*n*this.cos_p14/e),s=Math.abs(h)-rh,Math.abs(s)<=sh?(o=Bh(h>=0?l+Math.atan2(t.x,-t.y):l-Math.atan2(-t.x,t.y),this.over),t.x=o,t.y=a,t):(o=Bh(l+Math.atan2(t.x*n,e*this.cos_p14*r-t.y*this.sin_p14*n),this.over),t.x=o,t.y=a,t))},names:["ortho"]};function zc(t,e,i,n){var r;return t<sh?(n.value=1,r=0):(r=Math.atan2(e,i),Math.abs(r)<=lh?n.value=1:r>lh&&r<=rh+lh?(n.value=2,r-=rh):r>rh+lh||r<=-(rh+lh)?(n.value=3,r=r>=0?r-uh:r+uh):(n.value=4,r+=rh)),r}function qc(t,e){var i=t+e;return i<-uh?i+=hh:i>+uh&&(i-=hh),i}const $c={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=rh-lh/2?this.face=5:this.lat0<=-(rh-lh/2)?this.face=6:Math.abs(this.long0)<=lh?this.face=1:Math.abs(this.long0)<=rh+lh?this.face=this.long0>0?2:4:this.face=3,0!==this.es&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)},forward:function(t){var e,i,n,r,s,o,a={x:0,y:0},l={value:0};if(t.x-=this.long0,e=0!==this.es?Math.atan(this.one_minus_f_squared*Math.tan(t.y)):t.y,i=t.x,5===this.face)r=rh-e,i>=lh&&i<=rh+lh?(l.value=1,n=i-rh):i>rh+lh||i<=-(rh+lh)?(l.value=2,n=i>0?i-uh:i+uh):i>-(rh+lh)&&i<=-lh?(l.value=3,n=i+rh):(l.value=4,n=i);else if(6===this.face)r=rh+e,i>=lh&&i<=rh+lh?(l.value=1,n=-i+rh):i<lh&&i>=-lh?(l.value=2,n=-i):i<-lh&&i>=-(rh+lh)?(l.value=3,n=-i-rh):(l.value=4,n=i>0?-i+uh:-i-uh);else{var h,u,c,d,f,p;2===this.face?i=qc(i,+rh):3===this.face?i=qc(i,+uh):4===this.face&&(i=qc(i,-rh)),d=Math.sin(e),f=Math.cos(e),p=Math.sin(i),h=f*Math.cos(i),u=f*p,c=d,1===this.face?n=zc(r=Math.acos(h),c,u,l):2===this.face?n=zc(r=Math.acos(u),c,-h,l):3===this.face?n=zc(r=Math.acos(-h),c,-u,l):4===this.face?n=zc(r=Math.acos(-u),c,h,l):(r=n=0,l.value=1)}return o=Math.atan(12/uh*(n+Math.acos(Math.sin(n)*Math.cos(lh))-rh)),s=Math.sqrt((1-Math.cos(r))/(Math.cos(o)*Math.cos(o))/(1-Math.cos(Math.atan(1/Math.cos(n))))),2===l.value?o+=rh:3===l.value?o+=uh:4===l.value&&(o+=1.5*uh),a.x=s*Math.cos(o),a.y=s*Math.sin(o),a.x=a.x*this.a+this.x0,a.y=a.y*this.a+this.y0,t.x=a.x,t.y=a.y,t},inverse:function(t){var e,i,n,r,s,o,a,l,h,u,c,d,f={lam:0,phi:0},p={value:0};if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,i=Math.atan(Math.sqrt(t.x*t.x+t.y*t.y)),e=Math.atan2(t.y,t.x),t.x>=0&&t.x>=Math.abs(t.y)?p.value=1:t.y>=0&&t.y>=Math.abs(t.x)?(p.value=2,e-=rh):t.x<0&&-t.x>=Math.abs(t.y)?(p.value=3,e=e<0?e+uh:e-uh):(p.value=4,e+=rh),h=uh/12*Math.tan(e),s=Math.sin(h)/(Math.cos(h)-1/Math.sqrt(2)),o=Math.atan(s),(a=1-(n=Math.cos(e))*n*(r=Math.tan(i))*r*(1-Math.cos(Math.atan(1/Math.cos(o)))))<-1?a=-1:a>1&&(a=1),5===this.face)l=Math.acos(a),f.phi=rh-l,1===p.value?f.lam=o+rh:2===p.value?f.lam=o<0?o+uh:o-uh:3===p.value?f.lam=o-rh:f.lam=o;else if(6===this.face)l=Math.acos(a),f.phi=l-rh,1===p.value?f.lam=-o+rh:2===p.value?f.lam=-o:3===p.value?f.lam=-o-rh:f.lam=o<0?-o-uh:-o+uh;else{var g,m,y;h=(g=a)*g,m=(h+=(y=h>=1?0:Math.sqrt(1-h)*Math.sin(o))*y)>=1?0:Math.sqrt(1-h),2===p.value?(h=m,m=-y,y=h):3===p.value?(m=-m,y=-y):4===p.value&&(h=m,m=y,y=-h),2===this.face?(h=g,g=-m,m=h):3===this.face?(g=-g,m=-m):4===this.face&&(h=g,g=m,m=-h),f.phi=Math.acos(-y)-rh,f.lam=Math.atan2(m,g),2===this.face?f.lam=qc(f.lam,-rh):3===this.face?f.lam=qc(f.lam,-uh):4===this.face&&(f.lam=qc(f.lam,+rh))}return 0!==this.es&&(u=f.phi<0?1:0,c=Math.tan(f.phi),d=this.b/Math.sqrt(c*c+this.one_minus_f_squared),f.phi=Math.atan(Math.sqrt(this.a*this.a-d*d)/(this.one_minus_f*d)),u&&(f.phi=-f.phi)),f.lam+=this.long0,t.x=f.lam,t.y=f.phi,t},names:["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"]};var Bc=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-9.86701e-7],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,1.8736e-8],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,9.34959e-7],[.7986,-.00755338,-500009e-10,9.35324e-7],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],Uc=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-1.26793e-9,4.22642e-10],[.124,.0124,5.07171e-9,-1.60604e-9],[.186,.0123999,-1.90189e-8,6.00152e-9],[.248,.0124002,7.10039e-8,-2.24e-8],[.31,.0123992,-2.64997e-7,8.35986e-8],[.372,.0124029,9.88983e-7,-3.11994e-7],[.434,.0123893,-369093e-11,-4.35621e-7],[.4958,.0123198,-102252e-10,-3.45523e-7],[.5571,.0121916,-154081e-10,-5.82288e-7],[.6176,.0119938,-241424e-10,-5.25327e-7],[.6769,.011713,-320223e-10,-5.16405e-7],[.7346,.0113541,-397684e-10,-6.09052e-7],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-1.40374e-9],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],Wc=.8487,Xc=1.3523,Vc=ah/5,Kc=1/Vc,Yc=function(t,e){return t[0]+e*(t[1]+e*(t[2]+e*t[3]))};const Zc={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"},forward:function(t){var e=Bh(t.x-this.long0,this.over),i=Math.abs(t.y),n=Math.floor(i*Vc);n<0?n=0:n>=18&&(n=17);var r={x:Yc(Bc[n],i=ah*(i-Kc*n))*e,y:Yc(Uc[n],i)};return t.y<0&&(r.y=-r.y),r.x=r.x*this.a*Wc+this.x0,r.y=r.y*this.a*Xc+this.y0,r},inverse:function(t){var e={x:(t.x-this.x0)/(this.a*Wc),y:Math.abs(t.y-this.y0)/(this.a*Xc)};if(e.y>=1)e.x/=Bc[18][0],e.y=t.y<0?-rh:rh;else{var i=Math.floor(18*e.y);for(i<0?i=0:i>=18&&(i=17);;)if(Uc[i][0]>e.y)--i;else{if(!(Uc[i+1][0]<=e.y))break;++i}var n=Uc[i],r=5*(e.y-n[0])/(Uc[i+1][0]-n[0]);r=function(t,e,i,n){for(var r=e;n;--n){var s=t(r);if(r-=s,Math.abs(s)<1e-10)break}return r}(function(t){return(Yc(n,t)-e.y)/function(t,e){return t[1]+e*(2*t[2]+3*e*t[3])}(n,t)},r,0,100),e.x/=Yc(Bc[i],r),e.y=(5*i+r)*oh,t.y<0&&(e.y=-e.y)}return e.x=Bh(e.x+this.long0,this.over),e},names:["Robinson","robin"]},Hc={init:function(){this.name="geocent"},forward:function(t){return yu(t,this.es,this.a)},inverse:function(t){return _u(t,this.es,this.a,this.b)},names:["Geocentric","geocentric","geocent","Geocent"]};var Jc={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};const Qc={init:function(){if(Object.keys(Jc).forEach(function(t){if(void 0===this[t])this[t]=Jc[t].def;else{if(Jc[t].num&&isNaN(this[t]))throw new Error("Invalid parameter value, must be numeric "+t+" = "+this[t]);Jc[t].num&&(this[t]=parseFloat(this[t]))}Jc[t].degrees&&(this[t]=this[t]*oh)}.bind(this)),Math.abs(Math.abs(this.lat0)-rh)<sh?this.mode=this.lat0<0?1:0:Math.abs(this.lat0)<sh?this.mode=2:(this.mode=3,this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0)),this.pn1=this.h/this.a,this.pn1<=0||this.pn1>1e10)throw new Error("Invalid height");this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var t=this.tilt,e=this.azi;this.cg=Math.cos(e),this.sg=Math.sin(e),this.cw=Math.cos(t),this.sw=Math.sin(t)},forward:function(t){t.x-=this.long0;var e,i,n,r,s=Math.sin(t.y),o=Math.cos(t.y),a=Math.cos(t.x);switch(this.mode){case 3:i=this.sinph0*s+this.cosph0*o*a;break;case 2:i=o*a;break;case 1:i=-s;break;case 0:i=s}switch(e=(i=this.pn1/(this.p-i))*o*Math.sin(t.x),this.mode){case 3:i*=this.cosph0*s-this.sinph0*o*a;break;case 2:i*=s;break;case 0:i*=-o*a;break;case 1:i*=o*a}return r=1/((n=i*this.cg+e*this.sg)*this.sw*this.h1+this.cw),e=(e*this.cg-i*this.sg)*this.cw*r,i=n*r,t.x=e*this.a,t.y=i*this.a,t},inverse:function(t){t.x/=this.a,t.y/=this.a;var e,i,n,r={x:t.x,y:t.y};n=1/(this.pn1-t.y*this.sw),e=this.pn1*t.x*n,i=this.pn1*t.y*this.cw*n,t.x=e*this.cg+i*this.sg,t.y=i*this.cg-e*this.sg;var s=tc(t.x,t.y);if(Math.abs(s)<sh)r.x=0,r.y=t.y;else{var o,a;switch(a=1-s*s*this.pfact,a=(this.p-Math.sqrt(a))/(this.pn1/s+s/this.pn1),o=Math.sqrt(1-a*a),this.mode){case 3:r.y=Math.asin(o*this.sinph0+t.y*a*this.cosph0/s),t.y=(o-this.sinph0*Math.sin(r.y))*s,t.x*=a*this.cosph0;break;case 2:r.y=Math.asin(t.y*a/s),t.y=o*s,t.x*=a;break;case 0:r.y=Math.asin(o),t.y=-t.y;break;case 1:r.y=-Math.asin(o)}r.x=Math.atan2(t.x,t.y)}return t.x=r.x+this.long0,t.y=r.y,t},names:["Tilted_Perspective","tpers"]},td={init:function(){if(this.flip_axis="x"===this.sweep?1:0,this.h=Number(this.h),this.radius_g_1=this.h/this.a,this.radius_g_1<=0||this.radius_g_1>1e10)throw new Error;if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,0!==this.es){var t=1-this.es,e=1/t;this.radius_p=Math.sqrt(t),this.radius_p2=t,this.radius_p_inv2=e,this.shape="ellipse"}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape="sphere";this.title||(this.title="Geostationary Satellite View")},forward:function(t){var e,i,n,r,s=t.x,o=t.y;if(s-=this.long0,"ellipse"===this.shape){o=Math.atan(this.radius_p2*Math.tan(o));var a=this.radius_p/tc(this.radius_p*Math.cos(o),Math.sin(o));if(i=a*Math.cos(s)*Math.cos(o),n=a*Math.sin(s)*Math.cos(o),r=a*Math.sin(o),(this.radius_g-i)*i-n*n-r*r*this.radius_p_inv2<0)return t.x=Number.NaN,t.y=Number.NaN,t;e=this.radius_g-i,this.flip_axis?(t.x=this.radius_g_1*Math.atan(n/tc(r,e)),t.y=this.radius_g_1*Math.atan(r/e)):(t.x=this.radius_g_1*Math.atan(n/e),t.y=this.radius_g_1*Math.atan(r/tc(n,e)))}else"sphere"===this.shape&&(e=Math.cos(o),i=Math.cos(s)*e,n=Math.sin(s)*e,r=Math.sin(o),e=this.radius_g-i,this.flip_axis?(t.x=this.radius_g_1*Math.atan(n/tc(r,e)),t.y=this.radius_g_1*Math.atan(r/e)):(t.x=this.radius_g_1*Math.atan(n/e),t.y=this.radius_g_1*Math.atan(r/tc(n,e))));return t.x=t.x*this.a,t.y=t.y*this.a,t},inverse:function(t){var e,i,n,r,s=-1,o=0,a=0;if(t.x=t.x/this.a,t.y=t.y/this.a,"ellipse"===this.shape){this.flip_axis?(a=Math.tan(t.y/this.radius_g_1),o=Math.tan(t.x/this.radius_g_1)*tc(1,a)):(o=Math.tan(t.x/this.radius_g_1),a=Math.tan(t.y/this.radius_g_1)*tc(1,o));var l=a/this.radius_p;if(e=o*o+l*l+s*s,(n=(i=2*this.radius_g*s)*i-4*e*this.C)<0)return t.x=Number.NaN,t.y=Number.NaN,t;r=(-i-Math.sqrt(n))/(2*e),s=this.radius_g+r*s,o*=r,a*=r,t.x=Math.atan2(o,s),t.y=Math.atan(a*Math.cos(t.x)/s),t.y=Math.atan(this.radius_p_inv2*Math.tan(t.y))}else if("sphere"===this.shape){if(this.flip_axis?(a=Math.tan(t.y/this.radius_g_1),o=Math.tan(t.x/this.radius_g_1)*Math.sqrt(1+a*a)):(o=Math.tan(t.x/this.radius_g_1),a=Math.tan(t.y/this.radius_g_1)*Math.sqrt(1+o*o)),e=o*o+a*a+s*s,(n=(i=2*this.radius_g*s)*i-4*e*this.C)<0)return t.x=Number.NaN,t.y=Number.NaN,t;r=(-i-Math.sqrt(n))/(2*e),s=this.radius_g+r*s,o*=r,a*=r,t.x=Math.atan2(o,s),t.y=Math.atan(a*Math.cos(t.x)/s)}return t.x=t.x+this.long0,t},names:["Geostationary Satellite View","Geostationary_Satellite","geos"]};var ed=1.340264,id=-.081106,nd=893e-6,rd=.003796,sd=Math.sqrt(3)/2;const od={init:function(){this.es=0,this.long0=void 0!==this.long0?this.long0:0,this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0},forward:function(t){var e=Bh(t.x-this.long0,this.over),i=t.y,n=Math.asin(sd*Math.sin(i)),r=n*n,s=r*r*r;return t.x=e*Math.cos(n)/(sd*(ed+3*id*r+s*(7*nd+9*rd*r))),t.y=n*(ed+id*r+s*(nd+rd*r)),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t},inverse:function(t){t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a;var e,i,n,r,s=t.y;for(r=0;r<12&&(s-=n=(s*(ed+id*(e=s*s)+(i=e*e*e)*(nd+rd*e))-t.y)/(ed+3*id*e+i*(7*nd+9*rd*e)),!(Math.abs(n)<1e-9));++r);return i=(e=s*s)*e*e,t.x=sd*t.x*(ed+3*id*e+i*(7*nd+9*rd*e))/Math.cos(s),t.y=Math.asin(Math.sin(s)/sd),t.x=Bh(t.x+this.long0,this.over),t},names:["eqearth","Equal Earth","Equal_Earth"]};var ad=1e-10;function ld(t){var e,i,n,r=Bh(t.x-(this.long0||0),this.over),s=t.y;return e=this.am1+this.m1-Zu(s,i=Math.sin(s),n=Math.cos(s),this.en),i=n*r/(e*Math.sqrt(1-this.es*i*i)),t.x=e*Math.sin(i),t.y=this.am1-e*Math.cos(i),t.x=this.a*t.x+(this.x0||0),t.y=this.a*t.y+(this.y0||0),t}function hd(t){var e,i,n,r;if(t.x=(t.x-(this.x0||0))/this.a,t.y=(t.y-(this.y0||0))/this.a,i=tc(t.x,t.y=this.am1-t.y),r=Hu(this.am1+this.m1-i,this.es,this.en),(e=Math.abs(r))<rh)e=Math.sin(r),n=i*Math.atan2(t.x,t.y)*Math.sqrt(1-this.es*e*e)/Math.cos(r);else{if(!(Math.abs(e-rh)<=ad))throw new Error;n=0}return t.x=Bh(n+(this.long0||0),this.over),t.y=wc(r),t}function ud(t){var e,i,n=Bh(t.x-(this.long0||0),this.over),r=t.y;return i=this.cphi1+this.phi1-r,Math.abs(i)>ad?(t.x=i*Math.sin(e=n*Math.cos(r)/i),t.y=this.cphi1-i*Math.cos(e)):t.x=t.y=0,t.x=this.a*t.x+(this.x0||0),t.y=this.a*t.y+(this.y0||0),t}function cd(t){var e,i;t.x=(t.x-(this.x0||0))/this.a,t.y=(t.y-(this.y0||0))/this.a;var n=tc(t.x,t.y=this.cphi1-t.y);if(i=this.cphi1+this.phi1-n,Math.abs(i)>rh)throw new Error;return e=Math.abs(Math.abs(i)-rh)<=ad?0:n*Math.atan2(t.x,t.y)/Math.cos(i),t.x=Bh(e+(this.long0||0),this.over),t.y=wc(i),t}const dd={init:function(){var t;if(this.phi1=this.lat1,Math.abs(this.phi1)<ad)throw new Error;this.es?(this.en=Yu(this.es),this.m1=Zu(this.phi1,this.am1=Math.sin(this.phi1),t=Math.cos(this.phi1),this.en),this.am1=t/(Math.sqrt(1-this.es*this.am1*this.am1)*this.am1),this.inverse=hd,this.forward=ld):(Math.abs(this.phi1)+ad>=rh?this.cphi1=0:this.cphi1=1/Math.tan(this.phi1),this.inverse=cd,this.forward=ud)},names:["bonne","Bonne (Werner lat_1=90)"]},fd={OBLIQUE:{forward:function(t,e){let{x:i,y:n}=e;i+=t.long0;const r=Math.cos(i),s=Math.sin(n),o=Math.cos(n);e.x=Bh(Math.atan2(o*Math.sin(i),t.sphip*o*r+t.cphip*s)+t.lamp),e.y=Math.asin(t.sphip*s-t.cphip*o*r);const a=t.obliqueProjection.forward(e);return t.isIdentity&&(a.x*=ah,a.y*=ah),a},inverse:function(t,e){t.isIdentity&&(e.x*=oh,e.y*=oh);const i=t.obliqueProjection.inverse(e);let{x:n,y:r}=i;if(n<Number.MAX_VALUE){n-=t.lamp;const i=Math.cos(n),s=Math.sin(r),o=Math.cos(r);e.x=Math.atan2(o*Math.sin(n),t.sphip*o*i-t.cphip*s),e.y=Math.asin(t.sphip*s+t.cphip*o*i)}return e.x=Bh(e.x+t.long0),e}},TRANSVERSE:{forward:function(t,e){let{x:i,y:n}=e;i+=t.long0;const r=Math.cos(n),s=Math.cos(i);e.x=Bh(Math.atan2(r*Math.sin(i),Math.sin(n))+t.lamp),e.y=Math.asin(-1*r*s);const o=t.obliqueProjection.forward(e);return t.isIdentity&&(o.x*=ah,o.y*=ah),o},inverse:function(t,e){t.isIdentity&&(e.x*=oh,e.y*=oh);const i=t.obliqueProjection.inverse(e);let{x:n,y:r}=i;if(n<Number.MAX_VALUE){const i=Math.cos(r);n-=t.lamp,e.x=Math.atan2(i*Math.sin(n),-1*Math.sin(r)),e.y=Math.asin(i*Math.cos(n))}return e.x=Bh(e.x+t.long0),e}}},pd={ROTATE:{o_alpha:"oAlpha",o_lon_c:"oLongC",o_lat_c:"oLatC"},NEW_POLE:{o_lat_p:"oLatP",o_lon_p:"oLongP"},NEW_EQUATOR:{o_lon_1:"oLong1",o_lat_1:"oLat1",o_lon_2:"oLong2",o_lat_2:"oLat2"}},gd={init:function(){if(this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.title=this.title||"General Oblique Transformation",this.isIdentity=Vh.includes(this.o_proj),!this.o_proj)throw new Error("Missing parameter: o_proj");if("ob_tran"===this.o_proj)throw new Error("Invalid value for o_proj: "+this.o_proj);const t=this.projStr.replace("+proj=ob_tran","").replace("+o_proj=","+proj=").trim(),e=mu(t);if(!e)throw new Error("Invalid parameter: o_proj. Unknown projection "+this.o_proj);let i;e.long0=0,this.obliqueProjection=e;const n=Object.keys(pd),r=t=>{if(void 0===this[t])return;const e=parseFloat(this[t])*oh;if(isNaN(e))throw new Error("Invalid value for "+t+": "+this[t]);return e};for(let t=0;t<n.length;t++){const e=n[t],s=pd[e],o=Object.entries(s);if(o.some(([t])=>void 0!==this[t])){i=s;for(let t=0;t<o.length;t++){const[e,i]=o[t],n=r(e);if(void 0===n)throw new Error("Missing parameter: "+e+".");this[i]=n}break}}if(!i)throw new Error("No valid parameters provided for ob_tran projection.");const{lamp:s,phip:o}=function(t,e){let i,n;if(e===pd.ROTATE){let e=t.oLongC,r=t.oLatC,s=t.oAlpha;if(Math.abs(Math.abs(r)-rh)<=sh)throw new Error("Invalid value for o_lat_c: "+t.o_lat_c+" should be < 90°");n=e+Math.atan2(-1*Math.cos(s),-1*Math.sin(s)*Math.sin(r)),i=Math.asin(Math.cos(r)*Math.sin(s))}else if(e===pd.NEW_POLE)n=t.oLongP,i=t.oLatP;else{let e=t.oLong1,r=t.oLat1,s=t.oLong2,o=t.oLat2,a=Math.abs(r);if(Math.abs(r)>rh-sh)throw new Error("Invalid value for o_lat_1: "+t.o_lat_1+" should be < 90°");if(Math.abs(o)>rh-sh)throw new Error("Invalid value for o_lat_2: "+t.o_lat_2+" should be < 90°");if(Math.abs(r-o)<sh)throw new Error("Invalid value for o_lat_1 and o_lat_2: o_lat_1 should be different from o_lat_2");if(a<sh)throw new Error("Invalid value for o_lat_1: o_lat_1 should be different from zero");n=Math.atan2(Math.cos(r)*Math.sin(o)*Math.cos(e)-Math.sin(r)*Math.cos(o)*Math.cos(s),Math.sin(r)*Math.cos(o)*Math.sin(s)-Math.cos(r)*Math.sin(o)*Math.sin(e)),i=Math.atan(-1*Math.cos(n-e)/Math.tan(r))}return{lamp:n,phip:i}}(this,i);this.lamp=s,Math.abs(o)>sh?(this.cphip=Math.cos(o),this.sphip=Math.sin(o),this.projectionType=fd.OBLIQUE):this.projectionType=fd.TRANSVERSE},forward:function(t){return this.projectionType.forward(this,t)},inverse:function(t){return this.projectionType.inverse(this,t)},names:["General Oblique Transformation","General_Oblique_Transformation","ob_tran"]},md=Object.assign(function(t,e,i){var n,r,s,o=!1;return void 0===e?(r=Tu(t),n=Pu,o=!0):(void 0!==e.x||Array.isArray(e))&&(i=e,r=Tu(t),n=Pu,o=!0),n||(n=Tu(t)),r||(r=Tu(e)),i?Iu(n,r,i):(s={forward:function(t,e){return Iu(n,r,t,e)},inverse:function(t,e){return Iu(r,n,t,e)}},o&&(s.oProj=r),s)},{defaultDatum:"WGS84",Proj:mu,WGS84:new mu("WGS84"),Point:Wu,toPoint:Mu,defs:Nh,nadgrid:function(t,e,i){return e instanceof ArrayBuffer?function(t,e,i){var n=!0;void 0!==i&&!1===i.includeErrorFields&&(n=!1);var r=new DataView(e),s=function(t){var e=t.getInt32(8,!1);return 11!==e&&(11!==(e=t.getInt32(8,!0))&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian"),!0)}(r),o=function(t,e){return{nFields:t.getInt32(8,e),nSubgridFields:t.getInt32(24,e),nSubgrids:t.getInt32(40,e),shiftType:cu(t,56,64).trim(),fromSemiMajorAxis:t.getFloat64(120,e),fromSemiMinorAxis:t.getFloat64(136,e),toSemiMajorAxis:t.getFloat64(152,e),toSemiMinorAxis:t.getFloat64(168,e)}}(r,s),a=function(t,e,i,n){for(var r=176,s=[],o=0;o<e.nSubgrids;o++){var a=fu(t,r,i),l=pu(t,r,a,i,n),h=Math.round(1+(a.upperLongitude-a.lowerLongitude)/a.longitudeInterval),u=Math.round(1+(a.upperLatitude-a.lowerLatitude)/a.latitudeInterval);s.push({ll:[uu(a.lowerLongitude),uu(a.lowerLatitude)],del:[uu(a.longitudeInterval),uu(a.latitudeInterval)],lim:[h,u],count:a.gridNodeCount,cvs:du(l)});var c=16;!1===n&&(c=8),r+=176+a.gridNodeCount*c}return s}(r,o,s,n),l={header:o,subgrids:a};return ou[t]=l,l}(t,e,i):{ready:au(t,e)}},transform:Cu,mgrs:Fu,version:"__VERSION__"});var yd;(yd=md).Proj.projections.add(Ju),yd.Proj.projections.add(nc),yd.Proj.projections.add(rc),yd.Proj.projections.add(ac),yd.Proj.projections.add(hc),yd.Proj.projections.add(uc),yd.Proj.projections.add(dc),yd.Proj.projections.add(fc),yd.Proj.projections.add(pc),yd.Proj.projections.add(Sc),yd.Proj.projections.add(Ec),yd.Proj.projections.add(Pc),yd.Proj.projections.add(Ic),yd.Proj.projections.add(Tc),yd.Proj.projections.add(Rc),yd.Proj.projections.add(kc),yd.Proj.projections.add(Ac),yd.Proj.projections.add(Gc),yd.Proj.projections.add(Oc),yd.Proj.projections.add(Fc),yd.Proj.projections.add(Lc),yd.Proj.projections.add(jc),yd.Proj.projections.add(Nc),yd.Proj.projections.add(Dc),yd.Proj.projections.add($c),yd.Proj.projections.add(Zc),yd.Proj.projections.add(Hc),yd.Proj.projections.add(Qc),yd.Proj.projections.add(td),yd.Proj.projections.add(od),yd.Proj.projections.add(dd),yd.Proj.projections.add(gd);const _d=md;let vd=null;var xd=[896,448,224,112,56,28,14,7,3.5,1.75,.875,.4375,.21875,.109375],wd=[156543.03392800014,78271.51696400007,39135.758482000034,19567.879241000017,9783.939620500008,4891.969810250004,2445.984905125002,1222.992452562501,611.4962262812505,305.74811314062526,152.87405657031263,76.43702828515632,38.21851414257816,19.10925707128908,9.55462853564454,4.77731426782227,2.388657133911135,1.1943285669555674,.5971642834777837,.29858214173889186,.14929107086944593,.07464553543472296,.03732276771736148,.01866138385868074],bd=[-238375,1376256],Sd=300,Md=["showKeyboardHelp","selectControl","moveLarge","nudgeMap","zoomLarge","nudgeZoom"];function Ed(t){return"world"===t?{resolutions:wd,defaultMinZoom:6,maxZoom:20}:{resolutions:xd,defaultMinZoom:0,maxZoom:xd.length-1}}var Cd=function(t,e){var i=null,n=function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];clearTimeout(i),i=setTimeout(function(){t.apply(void 0,r)},e)};return n.cancel=function(){i&&(clearTimeout(i),i=null)},n};function Pd(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,s,o,a=[],l=!0,h=!1;try{if(s=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=s.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw r}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Id(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Id(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Id(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function Td(t){var e=t.map,i=t.source,n=t.events,r=t.eventBus,s=t.getZoom,o=t.getCenter,a=t.getBounds,l=t.getResolution,h=!1,u=[],c=[],d=[],f=e.getView(),p=function(t){var e=function(){if(h)return null;var t=s();return{center:o(),bounds:a(),resolution:l(),zoom:t,isAtMaxZoom:t+.01>=f.getMaxZoom(),isAtMinZoom:t-.01<=f.getMinZoom()}}();e&&r.emit(t,e)},g=function(t,e,i){t.on(e,i),u.push([t,e,i])},m=function(t,e,i){t.on(e,i),c.push([t,e,i])},y=!1,_=function(){y||(y=!0,r.emit(n.MAP_LOADED))},v=Cd(function(){return p(n.MAP_DATA_CHANGE)},500);d.push(v);var x=function(t){h||(c.forEach(function(t){var e=Pd(t,3),i=e[0],n=e[1],r=e[2];return i.un(n,r)}),c=[],m(t,"tileloadend",_),m(t,"tileloadend",v))};return function(t){var e=t.map,i=t.view,n=t.emit,r=t.eventBus,s=t.events,o=t.on,a=t.debouncers,l=!1,h=Cd(function(){l=!1,n(s.MAP_MOVE_END)},500);a.push(h);var u,c,d=(u=function(){return n(s.MAP_MOVE)},c=0,function(){var t=Date.now();t-c>=10&&(c=t,u.apply(void 0,arguments))});o(i,"change",function(){l||(l=!0,r.emit(s.MAP_MOVE_START)),h()}),o(e,"postrender",function(){l&&d()})}({map:e,view:e.getView(),emit:p,eventBus:r,events:n,on:g,debouncers:d}),x(i),e.once("rendercomplete",function(){return p(n.MAP_FIRST_IDLE)}),function(t){var e=t.map,i=t.eventBus,n=t.events,r=t.on,s=null;r(e,"pointerdown",function(t){s=t.pixel}),r(e,"click",function(t){if(s){var e=t.pixel[0]-s[0],r=t.pixel[1]-s[1];if(Math.hypot(e,r)>6)return}i.emit(n.MAP_CLICK,{point:{x:t.pixel[0],y:t.pixel[1]},coords:t.coordinate})})}({map:e,eventBus:r,events:n,on:g}),g(e,"postrender",function(){return r.emit(n.MAP_RENDER)}),{setSource:x,remove:function(){h=!0,d.forEach(function(t){return t.cancel()}),u.forEach(function(t){var e=Pd(t,3),i=e[0],n=e[1],r=e[2];return i.un(n,r)}),c.forEach(function(t){var e=Pd(t,3),i=e[0],n=e[1],r=e[2];return i.un(n,r)})}}}class Rd{constructor(t,e,i,n){this.minX=t,this.maxX=e,this.minY=i,this.maxY=n}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function kd(t,e,i,n,r){return void 0!==r?(r.minX=t,r.maxX=e,r.minY=i,r.maxY=n,r):new Rd(t,e,i,n)}const Ad=Rd;function Gd(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function Od(t,e,i,n,r){return`${L(t)},${e},${function(t,e,i){return t+"/"+e+"/"+i}(i,n,r)}`}function Fd(t){return e=t[0],(t[1]<<e)+t[2];var e}const Ld=[0,0,0],jd=class{constructor(t){let e;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,at(function(t){const e=((t,e)=>e-t)||v;return t.every(function(i,n){if(0===n)return!0;const r=e(t[n-1],i);return!(r>0||0===r)})}(this.resolutions_),"`resolutions` must be sorted in descending order"),!t.origins)for(let t=0,i=this.resolutions_.length-1;t<i;++t)if(e){if(this.resolutions_[t]/this.resolutions_[t+1]!==e){e=void 0;break}}else e=this.resolutions_[t]/this.resolutions_[t+1];this.zoomFactor_=e,this.maxZoom=this.resolutions_.length-1,this.origin_=void 0!==t.origin?t.origin:null,this.origins_=null,void 0!==t.origins&&(this.origins_=t.origins,at(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const i=t.extent;void 0===i||this.origin_||this.origins_||(this.origin_=Qt(i)),at(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,void 0!==t.tileSizes&&(this.tileSizes_=t.tileSizes,at(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=void 0!==t.tileSize?t.tileSize:this.tileSizes_?null:256,at(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=void 0!==i?i:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],void 0!==t.sizes?this.fullTileRanges_=t.sizes.map((t,e)=>{const n=new Ad(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1));if(i){const t=this.getTileRangeForExtentAndZ(i,e);n.minX=Math.max(t.minX,n.minX),n.maxX=Math.min(t.maxX,n.maxX),n.minY=Math.max(t.minY,n.minY),n.maxY=Math.min(t.maxY,n.maxY)}return n}):i&&this.calculateTileRanges_(i)}forEachTileCoord(t,e,i){const n=this.getTileRangeForExtentAndZ(t,e);for(let t=n.minX,r=n.maxX;t<=r;++t)for(let r=n.minY,s=n.maxY;r<=s;++r)i([e,t,r])}forEachTileCoordParentTileRange(t,e,i,n){let r,s,o,a=null,l=t[0]-1;for(2===this.zoomFactor_?(s=t[1],o=t[2]):a=this.getTileCoordExtent(t,n);l>=this.minZoom;){if(void 0!==s&&void 0!==o?(s=Math.floor(s/2),o=Math.floor(o/2),r=kd(s,s,o,o,i)):r=this.getTileRangeForExtentAndZ(a,l,i),e(l,r))return!0;--l}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getOrigins(){return this.origins_}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]<this.maxZoom){if(2===this.zoomFactor_){const i=2*t[1],n=2*t[2];return kd(i,i+1,n,n+1,e)}const n=this.getTileCoordExtent(t,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(n,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,i){if(e>this.maxZoom||e<this.minZoom)return null;const n=t[0],r=t[1],s=t[2];if(e===n)return kd(r,s,r,s,i);if(this.zoomFactor_){const t=Math.pow(this.zoomFactor_,e-n),o=Math.floor(r*t),a=Math.floor(s*t);return e<n?kd(o,o,a,a,i):kd(o,Math.floor(t*(r+1))-1,a,Math.floor(t*(s+1))-1,i)}const o=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(o,e,i)}getTileRangeForExtentAndZ(t,e,i){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,Ld);const n=Ld[1],r=Ld[2];return this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,Ld),kd(n,Ld[1],r,Ld[2],i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),n=no(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*n[0]*i,e[1]-(t[2]+.5)*n[1]*i]}getTileCoordExtent(t,e){const i=this.getOrigin(t[0]),n=this.getResolution(t[0]),r=no(this.getTileSize(t[0]),this.tmpSize_),s=i[0]+t[1]*r[0]*n,o=i[1]-(t[2]+1)*r[1]*n;return Ot(s,o,s+r[0]*n,o+r[1]*n,e)}getTileCoordForCoordAndResolution(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,i)}getTileCoordForXYAndResolution_(t,e,i,n,r){const s=this.getZForResolution(i),o=i/this.getResolution(s),a=this.getOrigin(s),l=no(this.getTileSize(s),this.tmpSize_);let h=o*(t-a[0])/i/l[0],u=o*(a[1]-e)/i/l[1];return n?(h=bt(h,5)-1,u=bt(u,5)-1):(h=wt(h,5),u=wt(u,5)),Gd(s,h,u,r)}getTileCoordForXYAndZ_(t,e,i,n,r){const s=this.getOrigin(i),o=this.getResolution(i),a=no(this.getTileSize(i),this.tmpSize_);let l=(t-s[0])/o/a[0],h=(s[1]-e)/o/a[1];return n?(l=bt(l,5)-1,h=bt(h,5)-1):(l=wt(l,5),h=wt(h,5)),Gd(i,l,h,r)}getTileCoordForCoordAndZ(t,e,i){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,i)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){return dt(w(this.resolutions_,t,e||0),this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return kn(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,i=new Array(e);for(let n=this.minZoom;n<e;++n)i[n]=this.getTileRangeForExtentAndZ(t,n);this.fullTileRanges_=i}};function Nd(t){let e=t.getDefaultTileGrid();return e||(e=function(t){return function(t,e,i,n){n=void 0!==n?n:"top-left";const r=zd(t,e,i);return new jd({extent:t,origin:Kt(t,n),resolutions:r,tileSize:i})}(qd(t),void 0,void 0,void 0)}(t),t.setDefaultTileGrid(e)),e}function Dd(t){const e=t||{},i=e.extent||pi("EPSG:3857").getExtent(),n={extent:i,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:zd(i,e.maxZoom,e.tileSize,e.maxResolution)};return new jd(n)}function zd(t,e,i,n){e=void 0!==e?e:42,i=no(void 0!==i?i:256);const r=Ht(t),s=ee(t);n=n>0?n:Math.max(s/i[0],r/i[1]);const o=e+1,a=new Array(o);for(let t=0;t<o;++t)a[t]=n/Math.pow(2,t);return a}function qd(t){let e=(t=pi(t)).getExtent();if(!e){const i=180*ve.degrees/t.getMetersPerUnit();e=Ot(-i,-i,i,i)}return e}const $d=class extends k{constructor(t,e,i){super(),i=i||{},this.tileCoord=t,this.state=e,this.key="",this.transition_=void 0===i.transition?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(c)}release(){this.setState(4)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(4!==this.state){if(3!==this.state&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){O()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(i){if(-1===i)return 1}else i=e,this.transitionStarts_[t]=i;const n=e-i+1e3/60;return n>=this.transition_?1:ue(n/this.transition_)}inTransition(t){return!!this.transition_&&-1!==this.transitionStarts_[t]}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}disposeInternal(){this.release(),super.disposeInternal()}},Bd=class extends $d{constructor(t,e,i,n,r,s){super(t,e,s),this.crossOrigin_=n?.crossOrigin,this.referrerPolicy_=n?.referrerPolicy,this.src_=i,this.key=i,this.image_,Y?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=2,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=3,this.unlistenImage_(),this.image_=function(){const t=or(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}(),this.changed()}handleImageLoad_(){if(Y)this.state=2;else{const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=2:this.state=4}this.unlistenImage_(),this.changed()}load(){3==this.state&&(this.state=0,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)),0==this.state&&(this.state=1,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=function(t,e,i){const n=t;let r=!0,s=!1,o=!1;const a=[h(n,"load",function(){o=!0,s||e()})];return n.src&&Z?(s=!0,n.decode().then(function(){r&&e()}).catch(function(t){r&&(o?e():i())})):a.push(h(n,"error",i)),function(){r=!1,a.forEach(u)}}(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}};let Ud;const Wd=[];function Xd(t,e,i,n,r){t.beginPath(),t.moveTo(0,0),t.lineTo(e,i),t.lineTo(n,r),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,n)+1,Math.max(i,r)),t.restore()}function Vd(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function Kd(t,e,i,n){const r=Mi(i,e,t);let s=gi(e,n,i);const o=e.getMetersPerUnit();void 0!==o&&(s*=o);const a=t.getMetersPerUnit();void 0!==a&&(s/=a);const l=t.getExtent();if(!l||Rt(l,r)){const e=gi(t,s,r)/s;isFinite(e)&&e>0&&(s/=e)}return s}const Yd=class{constructor(t,e,i,n,r,s,o){this.sourceProj_=t,this.targetProj_=e;let a={};const l=o?_i(t=>qi(o,Mi(t,this.targetProj_,this.sourceProj_))):Si(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){const e=t[0]+"/"+t[1];return a[e]||(a[e]=l(t)),a[e]},this.maxSourceExtent_=n,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&ee(n)>=ee(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?ee(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?ee(this.targetProj_.getExtent()):null;const h=Qt(i),u=te(i),c=Xt(i),d=Wt(i),f=this.transformInv_(h),p=this.transformInv_(u),g=this.transformInv_(c),m=this.transformInv_(d),y=10+(s?Math.max(0,Math.ceil(Math.log2(Ut(i)/(s*s*256*256)))):0);if(this.addQuad_(h,u,c,d,f,p,g,m,y),this.wrapsXInSource_){let t=1/0;this.triangles_.forEach(function(e,i,n){t=Math.min(t,e.source[0][0],e.source[1][0],e.source[2][0])}),this.triangles_.forEach(e=>{if(Math.max(e.source[0][0],e.source[1][0],e.source[2][0])-t>this.sourceWorldWidth_/2){const i=[[e.source[0][0],e.source[0][1]],[e.source[1][0],e.source[1][1]],[e.source[2][0],e.source[2][1]]];i[0][0]-t>this.sourceWorldWidth_/2&&(i[0][0]-=this.sourceWorldWidth_),i[1][0]-t>this.sourceWorldWidth_/2&&(i[1][0]-=this.sourceWorldWidth_),i[2][0]-t>this.sourceWorldWidth_/2&&(i[2][0]-=this.sourceWorldWidth_);const n=Math.min(i[0][0],i[1][0],i[2][0]);Math.max(i[0][0],i[1][0],i[2][0])-n<this.sourceWorldWidth_/2&&(e.source=i)}})}a={}}addTriangle_(t,e,i,n,r,s){this.triangles_.push({source:[n,r,s],target:[t,e,i]})}addQuad_(t,e,i,n,r,s,o,a,l){const h=Ct([r,s,o,a]),u=this.sourceWorldWidth_?ee(h)/this.sourceWorldWidth_:null,c=this.sourceWorldWidth_,d=this.sourceProj_.canWrapX()&&u>.5&&u<1;let f=!1;if(l>0&&(this.targetProj_.isGlobal()&&this.targetWorldWidth_&&(f=ee(Ct([t,e,i,n]))/this.targetWorldWidth_>.25||f),!d&&this.sourceProj_.isGlobal()&&u&&(f=u>.25||f)),!f&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3])&&!ie(h,this.maxSourceExtent_))return;let p=0;if(!(f||isFinite(r[0])&&isFinite(r[1])&&isFinite(s[0])&&isFinite(s[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])))if(l>0)f=!0;else if(p=(isFinite(r[0])&&isFinite(r[1])?0:8)+(isFinite(s[0])&&isFinite(s[1])?0:4)+(isFinite(o[0])&&isFinite(o[1])?0:2)+(isFinite(a[0])&&isFinite(a[1])?0:1),1!=p&&2!=p&&4!=p&&8!=p)return;if(l>0){if(!f){const e=[(t[0]+i[0])/2,(t[1]+i[1])/2],n=this.transformInv_(e);let s;s=d?(yt(r[0],c)+yt(o[0],c))/2-yt(n[0],c):(r[0]+o[0])/2-n[0];const a=(r[1]+o[1])/2-n[1];f=s*s+a*a>this.errorThresholdSquared_}if(f){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const h=[(e[0]+i[0])/2,(e[1]+i[1])/2],u=this.transformInv_(h),c=[(n[0]+t[0])/2,(n[1]+t[1])/2],d=this.transformInv_(c);this.addQuad_(t,e,h,c,r,s,u,d,l-1),this.addQuad_(c,h,i,n,d,u,o,a,l-1)}else{const h=[(t[0]+e[0])/2,(t[1]+e[1])/2],u=this.transformInv_(h),c=[(i[0]+n[0])/2,(i[1]+n[1])/2],d=this.transformInv_(c);this.addQuad_(t,h,c,n,r,u,d,a,l-1),this.addQuad_(h,e,i,c,u,s,o,d,l-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}11&p||this.addTriangle_(t,i,n,r,o,a),14&p||this.addTriangle_(t,i,e,r,o,s),p&&(13&p||this.addTriangle_(e,n,t,s,a,r),7&p||this.addTriangle_(e,n,i,s,a,o))}calculateSourceExtent(){const t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach(function(e,i,n){const r=e.source;zt(t,r[0]),zt(t,r[1]),zt(t,r[2])}),t}getTriangles(){return this.triangles_}},Zd=class extends $d{constructor(t,e,i,n,r,s,o,a,l,h,u,c){super(r,0,c),this.renderEdges_=void 0!==u&&u,this.pixelRatio_=o,this.gutter_=a,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=n,this.wrappedTileCoord_=s||r,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;const d=n.getTileCoordExtent(this.wrappedTileCoord_),f=this.targetTileGrid_.getExtent();let p=this.sourceTileGrid_.getExtent();const g=f?Jt(d,f):d;if(0===Ut(g))return void(this.state=4);const m=t.getExtent();m&&(p=p?Jt(p,m):m);const y=n.getResolution(this.wrappedTileCoord_[0]),_=function(t,e,i,n){const r=Vt(i);let s=Kd(t,e,r,n);return(!isFinite(s)||s<=0)&&Bt(i,function(i){return s=Kd(t,e,i,n),isFinite(s)&&s>0}),s}(t,i,g,y);if(!isFinite(_)||_<=0)return void(this.state=4);const v=void 0!==h?h:.5;if(this.triangulation_=new Yd(t,i,g,p,_*v,y),0===this.triangulation_.getTriangles().length)return void(this.state=4);this.sourceZ_=e.getZForResolution(_);let x=this.triangulation_.calculateSourceExtent();if(p&&(t.canWrapX()?(x[1]=dt(x[1],p[1],p[3]),x[3]=dt(x[3],p[1],p[3])):x=Jt(x,p)),Ut(x)){let i=0,n=0;t.canWrapX()&&(i=ee(m),n=Math.floor((x[0]-m[0])/i)),se(x.slice(),t,!0).forEach(t=>{const r=e.getTileRangeForExtentAndZ(t,this.sourceZ_);for(let t=r.minX;t<=r.maxX;t++)for(let e=r.minY;e<=r.maxY;e++){const r=n*i;this.sourceTiles_.push({getTile:()=>l(this.sourceZ_,t,e,o),offset:r})}++n}),0===this.sourceTiles_.length&&(this.state=4)}else this.state=4}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{const i=e.tile;if(i&&2==i.getState()){const n=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);n[0]+=e.offset,n[2]+=e.offset;const r=this.clipExtent_?.slice();r&&(r[0]+=e.offset,r[2]+=e.offset),t.push({extent:n,clipExtent:r,image:i.getImage()})}}),this.sourceTiles_.length=0,0===t.length)this.state=3;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),n="number"==typeof i?i:i[0],r="number"==typeof i?i:i[1],s=this.targetTileGrid_.getResolution(e),o=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=function(t,e,i,n,r,s,o,a,l,h,u,c,d,f){const p=or(Math.round(i*t),Math.round(i*e),Wd);if(c||(p.imageSmoothingEnabled=!1),0===l.length)return p.canvas;function g(t){return Math.round(t*i)/i}p.scale(i,i),p.globalCompositeOperation="lighter";const m=[1/0,1/0,-1/0,-1/0];let y;l.forEach(function(t,e,i){Dt(m,t.extent)});const _=i/n,v=(c?1:1+Math.pow(2,-24))/_;if(!d||1!==l.length||0!==h){if(y=or(Math.round(ee(m)*_),Math.round(Ht(m)*_),Wd),c||(y.imageSmoothingEnabled=!1),r&&f){const t=(r[0]-m[0])*_,e=-(r[3]-m[3])*_,i=ee(r)*_,n=Ht(r)*_;y.rect(t,e,i,n),y.clip()}l.forEach(function(t,e,i){if(t.image.width>0&&t.image.height>0){if(t.clipExtent){y.save();const e=(t.clipExtent[0]-m[0])*_,i=-(t.clipExtent[3]-m[3])*_,n=ee(t.clipExtent)*_,r=Ht(t.clipExtent)*_;y.rect(c?e:Math.round(e),c?i:Math.round(i),c?n:Math.round(e+n)-Math.round(e),c?r:Math.round(i+r)-Math.round(i)),y.clip()}const e=(t.extent[0]-m[0])*_,i=-(t.extent[3]-m[3])*_,n=ee(t.extent)*_,r=Ht(t.extent)*_;y.drawImage(t.image,h,h,t.image.width-2*h,t.image.height-2*h,c?e:Math.round(e),c?i:Math.round(i),c?n:Math.round(e+n)-Math.round(e),c?r:Math.round(i+r)-Math.round(i)),t.clipExtent&&y.restore()}})}const x=Qt(o);return a.getTriangles().forEach(function(t,e,i){const n=t.source,r=t.target;let o=n[0][0],a=n[0][1],h=n[1][0],u=n[1][1],d=n[2][0],f=n[2][1];const _=g((r[0][0]-x[0])/s),w=g(-(r[0][1]-x[1])/s),b=g((r[1][0]-x[0])/s),S=g(-(r[1][1]-x[1])/s),M=g((r[2][0]-x[0])/s),E=g(-(r[2][1]-x[1])/s),C=o,P=a;o=0,a=0,h-=C,u-=P,d-=C,f-=P;const I=function(t){const e=t.length;for(let i=0;i<e;i++){let n=i,r=Math.abs(t[i][i]);for(let s=i+1;s<e;s++){const e=Math.abs(t[s][i]);e>r&&(r=e,n=s)}if(0===r)return null;const s=t[n];t[n]=t[i],t[i]=s;for(let n=i+1;n<e;n++){const r=-t[n][i]/t[i][i];for(let s=i;s<e+1;s++)i==s?t[n][s]=0:t[n][s]+=r*t[i][s]}}const i=new Array(e);for(let n=e-1;n>=0;n--){i[n]=t[n][e]/t[n][n];for(let r=n-1;r>=0;r--)t[r][e]-=t[r][n]*i[n]}return i}([[h,u,0,0,b-_],[d,f,0,0,M-_],[0,0,h,u,S-w],[0,0,d,f,E-w]]);if(!I)return;if(p.save(),p.beginPath(),function(){if(void 0===Ud){const t=or(6,6,Wd);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",Xd(t,4,5,4,0),Xd(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;Ud=Vd(e,0)||Vd(e,4)||Vd(e,8),hr(t),Wd.push(t.canvas)}return Ud}()||!c){p.moveTo(b,S);const t=4,e=_-b,i=w-S;for(let n=0;n<t;n++)p.lineTo(b+g((n+1)*e/t),S+g(n*i/(t-1))),n!=t-1&&p.lineTo(b+g((n+1)*e/t),S+g((n+1)*i/(t-1)));p.lineTo(M,E)}else p.moveTo(b,S),p.lineTo(_,w),p.lineTo(M,E);let T;if(p.clip(),p.transform(I[0],I[2],I[1],I[3],_,w),p.translate(m[0]-C,m[3]-P),y)T=y.canvas,p.scale(v,-v);else{const t=l[0],e=t.extent;T=t.image,p.scale(ee(e)/T.width,-Ht(e)/T.height)}p.drawImage(T,0,0),p.restore()}),y&&(hr(y),Wd.push(y.canvas)),u&&(p.save(),p.globalCompositeOperation="source-over",p.strokeStyle="black",p.lineWidth=1,a.getTriangles().forEach(function(t,e,i){const n=t.target,r=(n[0][0]-x[0])/s,o=-(n[0][1]-x[1])/s,a=(n[1][0]-x[0])/s,l=-(n[1][1]-x[1])/s,h=(n[2][0]-x[0])/s,u=-(n[2][1]-x[1])/s;p.beginPath(),p.moveTo(a,l),p.lineTo(r,o),p.lineTo(h,u),p.closePath(),p.stroke()}),p.restore()),p.canvas}(n,r,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),s,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=2}this.changed()}load(){for(const t of this.sourceTiles_)t.tile=t.getTile();if(0==this.state){this.state=1,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{const i=e.getState();if(0==i||1==i){t++;const i=l(e,c,n=>{const r=e.getState();2!=r&&3!=r&&4!=r||(u(i),t--,0===t&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(i)}}),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:t},e,i){0==t.getState()&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(u),this.sourcesListenerKeys_=null}release(){this.canvas_&&(hr(this.canvas_.getContext("2d")),Wd.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}};function Hd(t,e){const i=[];Object.keys(e).forEach(function(t){null!==e[t]&&void 0!==e[t]&&i.push(t+"="+encodeURIComponent(e[t]))});const n=i.join("&");return t=t.replace(/[?&]$/,""),(t+=t.includes("?")?"&":"?")+n}const Jd=/\{z\}/g,Qd=/\{x\}/g,tf=/\{y\}/g,ef=/\{-y\}/g;function nf(t,e){return function(i,n,r){if(!i)return;let s;const o=i[0];if(e){const t=e.getFullTileRange(o);t&&(s=t.getHeight()-1)}return function(t,e,i,n,r){return t.replace(Jd,e.toString()).replace(Qd,i.toString()).replace(tf,n.toString()).replace(ef,function(){if(void 0===r)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(r-n).toString()})}(t,o,i[1],i[2],s)}}function rf(t){return t?"function"==typeof t?t:(Array.isArray(t)||(t=[t]),e=>t):null}const sf=class extends N{constructor(t){super(),this.projection=pi(t.projection),this.attributions_=rf(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible??!0,this.loading=!1,this.state_=void 0!==t.state?t.state:"ready",this.wrapX_=void 0!==t.wrapX&&t.wrapX,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;const e=this;this.viewPromise_=new Promise(function(t,i){e.viewResolver=t,e.viewRejector=i})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(t){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=rf(t),this.changed()}setState(t){this.state_=t,this.changed()}};class of extends R{constructor(t,e){super(t),this.tile=e}}const af=class extends sf{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:t.projection,state:t.state,wrapX:t.wrapX,interpolate:t.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=void 0!==t.tilePixelRatio?t.tilePixelRatio:1,this.tileGrid=void 0!==t.tileGrid?t.tileGrid:null;this.tileGrid&&no(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),[256,256]),this.tmpSize=[0,0],this.key_=t.key||L(this),this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,n,r,s){return O()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:Nd(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const n=this.getTileGridForProjection(i),r=this.getTilePixelRatio(e),s=no(n.getTileSize(t),this.tmpSize);return 1==r?s:(o=s,a=r,void 0===(l=this.tmpSize)&&(l=[0,0]),l[0]=o[0]*a+.5|0,l[1]=o[1]*a+.5|0,l);var o,a,l}getTileCoordForTileUrlFunction(t,e){const i=void 0!==e?e:this.getProjection(),n=void 0!==e?this.getTileGridForProjection(i):this.tileGrid||this.getTileGridForProjection(i);return this.getWrapX()&&i.isGlobal()&&(t=function(t,e,i){const n=e[0],r=t.getTileCoordCenter(e),s=qd(i);if(!Rt(s,r)){const e=ee(s),i=Math.ceil((s[0]-r[0])/e);return r[0]+=e*i,t.getTileCoordForCoordAndZ(r,n)}return e}(n,t,i)),function(t,e){const i=t[0],n=t[1],r=t[2];if(e.getMinZoom()>i||i>e.getMaxZoom())return!1;const s=e.getFullTileRange(i);return!s||s.containsXY(n,r)}(t,n)?t:null}clear(){}refresh(){this.clear(),super.refresh()}};class lf extends af{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===lf.prototype.tileUrlFunction,this.tileLoadFunction=t.tileLoadFunction,t.tileUrlFunction&&(this.tileUrlFunction=t.tileUrlFunction),this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(t){const e=t.target,i=L(e),n=e.getState();let r;1==n?(this.tileLoadingKeys_[i]=!0,r="tileloadstart"):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=3==n?"tileloaderror":2==n?"tileloadend":void 0),null!=r&&this.dispatchEvent(new of(r,e))}setTileLoadFunction(t){this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,void 0!==e?this.setKey(e):this.changed()}setUrl(t){const e=function(t){const e=[];let i=/\{([a-z])-([a-z])\}/.exec(t);if(i){const n=i[1].charCodeAt(0),r=i[2].charCodeAt(0);let s;for(s=n;s<=r;++s)e.push(t.replace(i[0],String.fromCharCode(s)));return e}if(i=/\{(\d+)-(\d+)\}/.exec(t),i){const n=parseInt(i[2],10);for(let r=parseInt(i[1],10);r<=n;r++)e.push(t.replace(i[0],r.toString()));return e}return e.push(t),e}(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(function(t,e){const i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=nf(t[r],e);return function(t){return 1===t.length?t[0]:function(e,i,n){if(!e)return;const r=yt(Fd(e),t.length);return t[r](e,i,n)}}(n)}(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}}const hf=lf;function uf(t,e){if(Y){const i=t.getCrossOrigin();let n="same-origin",r="same-origin";"anonymous"===i||""===i?(n="cors",r="omit"):"use-credentials"===i&&(n="cors",r="include");const s={mode:n,credentials:r,referrerPolicy:t.getReferrerPolicy()};return void fetch(e,s).then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.blob()}).then(t=>createImageBitmap(t)).then(e=>{const i=t.getImage();i.width=e.width,i.height=e.height,i.getContext("2d").drawImage(e,0,0),e.close?.(),i.dispatchEvent(new Event("load"))}).catch(()=>{t.getImage().dispatchEvent(new Event("error"))})}t.getImage().src=e}const cf=class extends hf{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:uf,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:void 0===t.interpolate||t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=void 0!==t.crossOrigin?t.crossOrigin:null,this.referrerPolicy=t.referrerPolicy,this.tileClass=void 0!==t.tileClass?t.tileClass:Bd,this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(t){return this.getProjection()&&t&&!xi(this.getProjection(),t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||xi(e,t)))return this.tileGrid;const i=L(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=Nd(t)),this.tileGridForProjection[i]}createTile_(t,e,i,n,r,s){const o=[t,e,i],a=this.getTileCoordForTileUrlFunction(o,r),l=a?this.tileUrlFunction(a,n,r):void 0,h=new this.tileClass(o,void 0!==l?0:4,void 0!==l?l:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return h.key=s,h.addEventListener(c,this.handleTileChange.bind(this)),h}getTile(t,e,i,n,r,s){const o=this.getProjection();if(!o||!r||xi(o,r))return this.getTileInternal(t,e,i,n,o||r);const a=[t,e,i],l=this.getKey(),h=this.getTileGridForProjection(o),u=this.getTileGridForProjection(r),c=this.getTileCoordForTileUrlFunction(a,r),d=new Zd(o,h,r,u,a,c,this.getTilePixelRatio(n),this.getGutter(),(t,e,i,n)=>this.getTileInternal(t,e,i,n,o,s),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return d.key=l,d}getTileInternal(t,e,i,n,r,s){const o=this.getKey(),a=Od(this,o,t,e,i);if(s&&s.containsKey(a))return s.get(a);const l=this.createTile_(t,e,i,n,r,o);return s?.set(a,l),l}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){const i=pi(t);if(i){const t=L(i);t in this.tileGridForProjection||(this.tileGridForProjection[t]=e)}}},df=class extends cf{constructor(t){const e=void 0!==(t=t||{}).projection?t.projection:"EPSG:3857",i=void 0!==t.tileGrid?t.tileGrid:Dd({extent:qd(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,interpolate:t.interpolate,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.gutter_=void 0!==t.gutter?t.gutter:0}getGutter(){return this.gutter_}};function ff(t,e){const i=(""+t).split("."),n=(""+e).split(".");for(let t=0;t<Math.max(i.length,n.length);t++){const e=parseInt(i[t]||"0",10),r=parseInt(n[t]||"0",10);if(e>r)return 1;if(r>e)return-1}return 0}const pf="1.3.0";function gf(t,e,i,n,r,s,o){s=Object.assign({REQUEST:"GetMap"},s);const a=e/i,l=[xt(ee(t)/a,4),xt(Ht(t)/a,4)];if(1!=i)switch(o){case"geoserver":const t=90*i+.5|0;"FORMAT_OPTIONS"in s?s.FORMAT_OPTIONS+=";dpi:"+t:s.FORMAT_OPTIONS="dpi:"+t;break;case"mapserver":s.MAP_RESOLUTION=90*i;break;case"carmentaserver":case"qgis":s.DPI=90*i;break;default:throw new Error("Unknown `serverType` configured")}return function(t,e,i,n,r){r.WIDTH=i[0],r.HEIGHT=i[1];const s=n.getAxisOrientation(),o=ff(r.VERSION,"1.3")>=0;r[o?"CRS":"SRS"]=n.getCode();const a=o&&s.startsWith("ne")?[e[1],e[0],e[3],e[2]]:e;return r.BBOX=a.join(","),Hd(t,r)}(r,t,l,n,s)}function mf(t,e){return Object.assign({REQUEST:e,SERVICE:"WMS",VERSION:pf,FORMAT:"image/png",STYLES:"",TRANSPARENT:"TRUE"},t)}const yf=class extends cf{constructor(t){t=t||{};const e=Object.assign({},t.params);super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.gutter_=void 0!==t.gutter?t.gutter:0,this.params_=e,this.v13_=!0,this.serverType_=t.serverType,this.hidpi_=void 0===t.hidpi||t.hidpi,this.tmpExtent_=[1/0,1/0,-1/0,-1/0],this.updateV13_(),this.setKey(this.getKeyForParams_())}getFeatureInfoUrl(t,e,i,n){const r=pi(i),s=this.getProjection()||r;let o=this.getTileGrid();o||(o=this.getTileGridForProjection(s));const a=Mi(t,r,s),l=Kd(s,r,t,e),h=o.getZForResolution(l,this.zDirection),u=o.getResolution(h),c=o.getTileCoordForCoordAndZ(a,h);if(o.getResolutions().length<=c[0])return;let d=o.getTileCoordExtent(c,this.tmpExtent_);const f=this.gutter_;0!==f&&(d=Pt(d,u*f,d));const p={QUERY_LAYERS:this.params_.LAYERS};Object.assign(p,mf(this.params_,"GetFeatureInfo"),n);const g=Math.floor((a[0]-d[0])/u),m=Math.floor((d[3]-a[1])/u);return p[this.v13_?"I":"X"]=g,p[this.v13_?"J":"Y"]=m,this.getRequestUrl_(c,d,1,s||r,p)}getLegendUrl(t,e){if(void 0===this.urls[0])return;const i={SERVICE:"WMS",VERSION:pf,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){const t=this.params_.LAYERS;if(Array.isArray(t)&&1!==t.length)return;i.LAYER=t}if(void 0!==t){const e=this.getProjection()?this.getProjection().getMetersPerUnit():1,n=28e-5;i.SCALE=t*e/n}return Object.assign(i,e),Hd(this.urls[0],i)}getGutter(){return this.gutter_}getParams(){return this.params_}getRequestUrl_(t,e,i,n,r){const s=this.urls;if(!s)return;let o;return o=1==s.length?s[0]:s[yt(Fd(t),s.length)],gf(e,(this.tileGrid||this.getTileGridForProjection(n)).getResolution(t[0]),i,n,o,r,this.serverType_)}getTilePixelRatio(t){return this.hidpi_&&void 0!==this.serverType_?t:1}getKeyForParams_(){let t=0;const e=[];for(const i in this.params_)e[t++]=i+"-"+this.params_[i];return e.join("/")}setParams_(t){this.params_=t,this.updateV13_(),this.setKey(this.getKeyForParams_())}setParams(t){this.setParams_(Object.assign({},t))}updateParams(t){this.setParams_(Object.assign(this.params_,t))}updateV13_(){const t=this.params_.VERSION||pf;this.v13_=ff(t,"1.3")>=0}tileUrlFunction(t,e,i){let n=this.getTileGrid();if(n||(n=this.getTileGridForProjection(i)),n.getResolutions().length<=t[0])return;1==e||this.hidpi_&&void 0!==this.serverType_||(e=1);const r=n.getResolution(t[0]);let s=n.getTileCoordExtent(t,this.tmpExtent_);const o=this.gutter_;0!==o&&(s=Pt(s,r*o,s));const a=Object.assign({},mf(this.params_,"GetMap"));return this.getRequestUrl_(t,s,e,i,a)}},_f=[],vf=class extends $d{constructor(t,e,i,n,r){super(t,e,{transition:0}),this.context_=null,this.executorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.replayState_={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=n.bind(void 0,this),this.removeSourceTiles_=r,this.wrappedTileCoord=i}getContext(){return this.context_||(this.context_=or(1,1,_f)),this.context_}hasContext(){return!!this.context_}getImage(){return this.hasContext()?this.getContext().canvas:null}getReplayState(t){const e=L(t);return e in this.replayState_||(this.replayState_[e]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedPixelRatio:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.replayState_[e]}load(){this.getSourceTiles()}release(){this.context_&&(hr(this.context_),_f.push(this.context_.canvas),this.context_=null),this.removeSourceTiles_(this),this.sourceTiles.length=0,super.release()}},xf=class extends $d{constructor(t,e,i,n,r,s){super(t,e,s),this.extent=null,this.format_=n,this.features_=null,this.loader_,this.projection=null,this.resolution,this.tileLoadFunction_=r,this.url_=i,this.key=i}getTileUrl(){return this.url_}getFormat(){return this.format_}getFeatures(){return this.features_}load(){0==this.state&&(this.setState(1),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))}onLoad(t,e){this.setFeatures(t)}onError(){this.setState(3)}setFeatures(t){this.features_=t,this.setState(2)}setLoader(t){this.loader_=t}};function wf(t,e,i,n,r,s,o){const a=new XMLHttpRequest;a.open("GET","function"==typeof t?t(i,n,r):t,!0),"arraybuffer"==e.getType()&&(a.responseType="arraybuffer"),a.withCredentials=false,a.onload=function(t){if(!a.status||a.status>=200&&a.status<300){const t=e.getType();try{let n;"text"==t||"json"==t?n=a.responseText:"xml"==t?n=a.responseXML||a.responseText:"arraybuffer"==t&&(n=a.response),n?s(e.readFeatures(n,{extent:i,featureProjection:r}),e.readProjection(n)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function bf(t,e){return function(i,n,r,s,o){wf(t,e,i,n,r,(t,e)=>{this.addFeatures(t),void 0!==s&&s(t)},()=>{this.changed(),void 0!==o&&o()})}}const Sf=class extends hf{constructor(t){const e=t.projection||"EPSG:3857",i=t.extent||qd(e),n=t.tileGrid||Dd({extent:i,maxResolution:t.maxResolution,maxZoom:void 0!==t.maxZoom?t.maxZoom:22,minZoom:t.minZoom,tileSize:t.tileSize||512});super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,interpolate:!0,projection:e,state:t.state,tileGrid:n,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:Mf,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:void 0===t.zDirection?1:t.zDirection}),this.format_=t.format?t.format:null,this.tileKeysBySourceTileUrl_={},this.sourceTiles_={},this.overlaps_=null==t.overlaps||t.overlaps,this.tileClass=t.tileClass?t.tileClass:xf,this.tileGrids_={}}getOverlaps(){return this.overlaps_}getSourceTiles(t,e,i,n){if(0===i.getState()){i.setState(1);const r=i.wrappedTileCoord,s=this.getTileGridForProjection(e);let o=s.getTileCoordExtent(r);const l=r[0],h=s.getResolution(l);Pt(o,-h,o);const u=this.projection;e&&this.projection&&!xi(e,u)&&(o=Ei(o,e,u));const d=this.tileGrid,f=d.getExtent();f&&Jt(o,f,o);let p=h;e&&u&&!xi(e,u)&&(p=h/u.getMetersPerUnit()/e.getMetersPerUnit());const g=d.getZForResolution(p,this.zDirection),m=n||this.tileUrlFunction;d.forEachTileCoord(o,g,n=>{const r=m(n,t,e);this.sourceTiles_[r]||(this.sourceTiles_[r]=new this.tileClass(n,r?0:4,r,this.format_,this.tileLoadFunction));const s=this.sourceTiles_[r];i.sourceTiles.push(s),this.tileKeysBySourceTileUrl_[r]||(this.tileKeysBySourceTileUrl_[r]=[]),this.tileKeysBySourceTileUrl_[r].push(i.getKey());const o=s.getState();if(o<2){const t=e=>{this.handleTileChange(e);const n=s.getState();if(2===n||3===n){const e=s.getKey();e in i.errorTileKeys?2===s.getState()&&delete i.errorTileKeys[e]:i.loadingSourceTiles--,3===n?i.errorTileKeys[e]=!0:s.removeEventListener(c,t),0===i.loadingSourceTiles&&i.setState(a(i.errorTileKeys)?2:3)}};s.addEventListener(c,t),i.loadingSourceTiles++}0===o&&(s.extent=d.getTileCoordExtent(n),s.projection=this.projection,s.resolution=d.getResolution(n[0]),s.load())}),i.loadingSourceTiles||i.setState(i.sourceTiles.some(t=>3===t.getState())?3:2)}return i.sourceTiles}removeSourceTiles(t){const e=t.getKey(),i=t.sourceTiles;for(let t=0,n=i.length;t<n;++t){const n=i[t].getTileUrl();if(!this.tileKeysBySourceTileUrl_[n])return;const r=this.tileKeysBySourceTileUrl_[n].indexOf(e);-1!==r&&(this.tileKeysBySourceTileUrl_[n].splice(r,1),0===this.tileKeysBySourceTileUrl_[n].length&&(delete this.tileKeysBySourceTileUrl_[n],delete this.sourceTiles_[n]))}}getTile(t,e,i,n,r){const s=[t,e,i];let o=this.getTileCoordForTileUrlFunction(s,r);const a=this.getTileGrid().getExtent(),l=this.projection,h=this.getTileGridForProjection(r);if(o&&a){const e=h.getTileCoordExtent(o);Pt(e,-h.getResolution(t),e),ie(a,r&&l&&!xi(r,l)?Ei(e,r,l):e)||(o=null)}let u=!0;if(null!==o){const e=this.tileGrid,i=h.getResolution(t);let s=i;r&&l&&!xi(r,l)&&(s=i/l.getMetersPerUnit()/r.getMetersPerUnit());const a=e.getZForResolution(s,1),c=h.getTileCoordExtent(o);Pt(c,-i,c),e.forEachTileCoord(r&&l&&!xi(r,l)?Ei(c,r,l):c,a,t=>{u=u&&!this.tileUrlFunction(t,n,l)})}const c=this.tileUrlFunction,d=new vf(s,u?4:0,o,t=>this.getSourceTiles(n,r,t,c),this.removeSourceTiles.bind(this));return d.key=this.getKey(),d}getTileGridForProjection(t){const e=t.getCode();let i=this.tileGrids_[e];if(!i){const n=this.projection;if(null!==n&&!xi(n,t))return Nd(t);const r=this.tileGrid,s=r.getResolutions().slice(),o=s.map(function(t,e){return r.getOrigin(e)}),a=s.map(function(t,e){return r.getTileSize(e)}),l=43;for(let t=s.length;t<l;++t)s.push(s[t-1]/2),o.push(o[t-1]),a.push(a[t-1]);i=new jd({extent:r.getExtent(),origins:o,resolutions:s,tileSizes:a}),this.tileGrids_[e]=i}return i}getTilePixelRatio(t){return t}getTilePixelSize(t,e,i){const n=no(this.getTileGridForProjection(i).getTileSize(t),this.tmpSize);return[Math.round(n[0]*e),Math.round(n[1]*e)]}setOverlaps(t){this.overlaps_=t,this.changed()}};function Mf(t,e){t.setLoader(function(i,n,r){wf(e,t.getFormat(),i,n,r,t.onLoad.bind(t),t.onError.bind(t))})}function Ef(t){return t instanceof Image||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageBitmap?t:null}const Cf=new Error("disposed"),Pf=[256,256],If=class extends $d{constructor(t){super(t.tileCoord,0,{transition:t.transition,interpolate:t.interpolate}),this.loader_=t.loader,this.data_=null,this.error_=null,this.size_=t.size||null,this.controller_=t.controller||null}getSize(){if(this.size_)return this.size_;const t=Ef(this.data_);return t?[t.width,t.height]:Pf}getData(){return this.data_}getError(){return this.error_}load(){if(0!==this.state&&3!==this.state)return;this.state=1,this.changed();const t=this;this.loader_().then(function(e){t.data_=e,t.state=2,t.changed()}).catch(function(e){t.error_=e,t.state=3,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(Cf),this.controller_=null),super.disposeInternal()}},Tf=class{constructor(t){this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const t=this.pop();t instanceof _&&t.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const i=this.entries_[t];return at(void 0!==i,"Tried to get a value for a key that does not exist in the cache"),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_}remove(t){const e=this.entries_[t];return at(void 0!==e,"Tried to get a value for a key that does not exist in the cache"),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.key_;return t}getValues(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){return this.entries_[t]?.value_}pop(){const t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){at(!(t in this.entries_),"Tried to set a value for a key that is used already");const i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_}setSize(t){this.highWaterMark=t}},Rf=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(lr(),{get:(t,e)=>{if("function"==typeof lr()[e])return this.push_(e),this.pushMethodArgs_},set:(t,e,i)=>(this.push_(e,i),!0)})}push_(...t){const e=this.instructions_,i=this.zIndex+this.offset_;e[i]||(e[i]=[]),e[i].push(...t)}pushMethodArgs_=(...t)=>(this.push_(t),this);pushFunction(t){this.push_(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach(e=>{for(let i=0,n=e.length;i<n;++i){const n=e[i];if("function"==typeof n){n(t);continue}const r=e[++i];if("function"==typeof t[n])t[n](...r);else{if("function"==typeof r){t[n]=r(t);continue}t[n]=r}}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}},kf=class extends G{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=5}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(t){return O()}getData(t){return null}prepareFrame(t){return O()}renderFrame(t,e){return O()}forEachFeatureAtCoordinate(t,e,i,n,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;2!==e.getState()&&3!==e.getState()||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return 2!=e&&3!=e&&t.addEventListener(c,this.boundHandleImageChange_),0==e&&(t.load(),e=t.getState()),2==e}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}},Af=[];let Gf=null;const Of=class extends kf{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=[1,0,0,1,0,0],this.pixelTransform=[1,0,0,1,0,0],this.inversePixelTransform=[1,0,0,1,0,0],this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){let n;Gf||(Gf=or(1,1,void 0,{willReadFrequently:!0})),Gf.clearRect(0,0,1,1);try{Gf.drawImage(t,e,i,1,1,0,0,1,1),n=Gf.getImageData(0,0,1,1).data}catch{return Gf=null,null}return n}getBackground(t){let e=this.getLayer().getBackground();return"function"==typeof e&&(e=e(t.viewState.resolution)),e||void 0}useContainer(t,e,i){const n=this.getLayer().getClassName();let r,s;if(t&&t.className===n&&(!i||t&&t.style.backgroundColor&&M(to(t.style.backgroundColor),to(i)))){const e=t.firstElementChild;dr(e)&&(s=e.getContext("2d"))}if(s&&function(t,e){const i=Xi(t),n=Xi(e);for(let t=0;t<6;++t)if(0!==Math.round((i[t]-n[t])*Wi[t]))return!1;return!0}(s.canvas.style.transform,e)?(this.container=t,this.context=s,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){r=Y?cr():document.createElement("div"),r.className=n;let t=r.style;t.position="absolute",t.width="100%",t.height="100%",s=or();const e=s.canvas;r.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=r,this.context=s}this.containerReused||!i||this.container.style.backgroundColor||(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const n=Qt(i),r=te(i),s=Xt(i),o=Wt(i);qi(e.coordinateToPixelTransform,n),qi(e.coordinateToPixelTransform,r),qi(e.coordinateToPixelTransform,s),qi(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;qi(a,n),qi(a,r),qi(a,s),qi(a,o),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.clip()}prepareContainer(t,e){const i=t.extent,n=t.viewState.resolution,r=t.viewState.rotation,s=t.pixelRatio,o=Math.round(ee(i)/n*s),a=Math.round(Ht(i)/n*s);Bi(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/s,1/s,r,-o/2,-a/2),Ui(this.inversePixelTransform,this.pixelTransform);const l="matrix("+this.pixelTransform.join(", ")+")";if(this.useContainer(e,l,this.getBackground(t)),!this.containerReused){const t=this.context.canvas;t.width!=o||t.height!=a?(t.width=o,t.height=a):this.context.clearRect(0,0,o,a),l!==t.style.transform&&(t.style.transform=l)}}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const r=new Kl(t,this.inversePixelTransform,i,e);n.dispatchEvent(r)}}preRender(t,e){this.frameState=e,e.declutter||this.dispatchRenderEvent_(ds,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(fs,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new Rf),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(ds,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(fs,this.context,t))}getRenderTransform(t,e,i,n,r,s,o){const a=r/2,l=s/2,h=n/e,u=-h,c=-t[0]+o,d=-t[1];return Bi(this.tempTransform,a,l,h,u,-i,c,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}};function Ff(t,e,i){if(!(i in t))return t[i]=new Set([e]),!0;const n=t[i],r=n.has(e);return r||n.add(e),!r}function Lf(t,e,i){const n=t[i];return!!n&&n.delete(e)}function jf(t,e){const i=t.layerStatesArray[t.layerIndex];i.extent&&(e=Jt(e,ki(i.extent,t.viewState.projection)));const n=i.layer.getRenderSource();if(!n.getWrapX()){const i=n.getTileGridForProjection(t.viewState.projection).getExtent();i&&(e=Jt(e,i))}return e}const Nf=class extends Of{constructor(t,e){super(t),e=e||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=[1/0,1/0,-1/0,-1/0],this.tempTileRange_=new Ad(0,0,0,0),this.tempTileCoord_=Gd(0,0,0);const i=void 0!==e.cacheSize?e.cacheSize:512;this.tileCache_=new Tf(i),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=.5*i}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new Tf(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,n){const r=this.tileCache_,s=this.getLayer().getSource(),o=Od(s,s.getKey(),t,e,i);let a;if(r.containsKey(o))a=r.get(o);else{const l=n.viewState.projection,h=s.getProjection();if(a=s.getTile(t,e,i,n.pixelRatio,l,!h||xi(h,l)?void 0:this.getSourceTileCache()),!a)return null;r.set(o,a)}return a}getTile(t,e,i,n){return this.getOrCreateTile(t,e,i,n)||null}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=qi(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!Rt(r,n))return null;const s=e.viewState,o=i.getRenderSource(),a=o.getTileGridForProjection(s.projection),l=o.getTilePixelRatio(e.pixelRatio);for(let t=a.getZForResolution(s.resolution);t>=a.getMinZoom();--t){const i=a.getTileCoordForCoordAndZ(n,t),r=this.getTile(t,i[1],i[2],e);if(!r||2!==r.getState())continue;const h=a.getOrigin(t),u=no(a.getTileSize(t)),c=a.getResolution(t);let d;if(r instanceof Bd||r instanceof Zd)d=r.getImage();else{if(!(r instanceof If))continue;if(d=Ef(r.getData()),!d)continue}const f=Math.floor(l*((n[0]-h[0])/c-i[1]*u[0])),p=Math.floor(l*((h[1]-n[1])/c-i[2]*u[1])),g=Math.round(l*o.getGutterForProjection(s.projection));return this.getImageData(d,f+g,p+g)}return null}prepareFrame(t){this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;const e=this.getLayer().getSource();if(!e)return!1;const i=e.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==i&&(this.renderedSourceRevision_=i,this.renderedSourceKey_===e.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=i,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(t,e,i,n,r){const s=t.viewState,o=this.getLayer(),a=o.getRenderSource(),l=a.getTileGridForProjection(s.projection),h=L(a);h in t.wantedTiles||(t.wantedTiles[h]={});const u=t.wantedTiles[h],c=o.getMapInternal(),d=Math.max(i-r,l.getMinZoom(),l.getZForResolution(Math.min(o.getMaxResolution(),c?c.getView().getResolutionForZoom(Math.max(o.getMinZoom(),0)):l.getResolution(0)),a.zDirection)),f=s.rotation,p=f?Zt(s.center,s.resolution,f,t.size):void 0;for(let r=i;r>=d;--r){const i=l.getTileRangeForExtentAndZ(e,r,this.tempTileRange_),s=l.getResolution(r);for(let e=i.minX;e<=i.maxX;++e)for(let o=i.minY;o<=i.maxY;++o){if(f&&!l.tileCoordIntersectsViewport([r,e,o],p))continue;const i=this.getTile(r,e,o,t);if(!i)continue;if(!Ff(n,i,r))continue;const a=i.getKey();if(u[a]=!0,0===i.getState()&&!t.tileQueue.isKeyQueued(a)){const n=Gd(r,e,o,this.tempTileCoord_);t.tileQueue.enqueue([i,h,l.getTileCoordCenter(n),s])}}}}findStaleTile_(t,e){const i=this.tileCache_,n=t[0],r=t[1],s=t[2],o=this.getStaleKeys();for(let t=0;t<o.length;++t){const a=Od(this.getLayer().getSource(),o[t],n,r,s);if(i.containsKey(a)){const t=i.peek(a);if(2===t.getState())return t.endTransition(L(this)),Ff(e,t,n),!0}}return!1}findAltTiles_(t,e,i,n){const r=t.getTileRangeForTileCoordAndZ(e,i,this.tempTileRange_);if(!r)return!1;let s=!0;const o=this.tileCache_,a=this.getLayer().getRenderSource(),l=a.getKey();for(let t=r.minX;t<=r.maxX;++t)for(let e=r.minY;e<=r.maxY;++e){const r=Od(a,l,i,t,e);let h=!1;if(o.containsKey(r)){const t=o.peek(r);2===t.getState()&&(Ff(n,t,i),h=!0)}h||(s=!1)}return s}renderFrame(t,e){this.renderComplete=!0;const i=t.layerStatesArray[t.layerIndex],n=t.viewState,r=n.projection,s=n.resolution,o=n.center,a=t.pixelRatio,l=this.getLayer(),h=l.getSource(),u=h.getTileGridForProjection(r),c=u.getZForResolution(s,h.zDirection),d=u.getResolution(c),f=h.getKey();this.renderedSourceKey_?this.renderedSourceKey_!==f&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=f):this.renderedSourceKey_=f;let p=t.extent;const g=h.getTilePixelRatio(a);this.prepareContainer(t,e);const m=this.context.canvas.width,y=this.context.canvas.height;this.layerExtent=i.extent?ki(i.extent):null,this.layerExtent&&(p=Jt(p,this.layerExtent));const _=d*m/2/g,x=d*y/2/g,w=[o[0]-_,o[1]-x,o[0]+_,o[1]+x],b={};this.renderedTiles.length=0;const S=l.getPreload();if(t.nextExtent&&this.enqueueTilesForNextExtent()){const e=u.getZForResolution(n.nextResolution,h.zDirection),i=jf(t,t.nextExtent);this.enqueueTiles(t,i,e,b,S)}const M=jf(t,p);if(this.enqueueTiles(t,M,c,b,0),S>0&&setTimeout(()=>{this.enqueueTiles(t,M,c-1,b,S-1)},0),!(c in b))return this.container;const E=L(this),C=t.time;for(const e of b[c]){const i=e.getState();if(4===i)continue;const n=e.tileCoord;if(2===i&&1===e.getAlpha(E,C)){e.endTransition(E);continue}if(3!==i&&(this.renderComplete=!1),this.findStaleTile_(n,b)){Lf(b,e,c),t.animate=!0;continue}if(this.findAltTiles_(u,n,c+1,b))continue;const r=u.getMinZoom();for(let t=c-1;t>=r&&!this.findAltTiles_(u,n,t,b);--t);}const P=d/s*a/g,I=this.getRenderContext(t);Bi(this.tempTransform,m/2,y/2,P,P,0,-m/2,-y/2),this.layerExtent&&this.clipUnrotated(I,t,this.layerExtent),h.getInterpolate()||(I.imageSmoothingEnabled=!1),this.preRender(I,t);const T=Object.keys(b).map(Number);let R;T.sort(v);const k=[],A=[];for(let e=T.length-1;e>=0;--e){const i=T[e],n=h.getTilePixelSize(i,a,r),s=u.getResolution(i)/d,o=n[0]*s*P,l=n[1]*s*P,c=u.getTileCoordForCoordAndZ(Qt(w),i),f=u.getTileCoordExtent(c),p=qi(this.tempTransform,[g*(f[0]-w[0])/d,g*(w[3]-f[3])/d]),m=g*h.getGutterForProjection(r);for(const e of b[i]){if(2!==e.getState())continue;const n=e.tileCoord,r=c[1]-n[1],s=Math.round(p[0]-(r-1)*o),a=c[2]-n[2],u=Math.round(p[1]-(a-1)*l),d=Math.round(p[0]-r*o),f=Math.round(p[1]-a*l),g=s-d,y=u-f,_=1===T.length;let v=!1;R=[d,f,d+g,f,d+g,f+y,d,f+y];for(let t=0,e=k.length;t<e;++t)if(!_&&i<A[t]){const e=k[t];ie([d,f,d+g,f+y],[e[0],e[3],e[4],e[7]])&&(v||(I.save(),v=!0),I.beginPath(),I.moveTo(R[0],R[1]),I.lineTo(R[2],R[3]),I.lineTo(R[4],R[5]),I.lineTo(R[6],R[7]),I.moveTo(e[6],e[7]),I.lineTo(e[4],e[5]),I.lineTo(e[2],e[3]),I.lineTo(e[0],e[1]),I.clip())}k.push(R),A.push(i),this.drawTile(e,t,d,f,g,y,m,_),v&&I.restore(),this.renderedTiles.unshift(e),this.updateUsedTiles(t.usedTiles,h,e)}}if(this.renderedResolution=d,this.extentChanged=!this.renderedExtent_||!Nt(this.renderedExtent_,w),this.renderedExtent_=w,this.renderedPixelRatio=a,this.postRender(this.context,t),this.layerExtent&&I.restore(),I.imageSmoothingEnabled=!0,this.renderComplete){const e=(t,e)=>{const i=L(h),n=e.wantedTiles[i],r=n?Object.keys(n).length:0;this.updateCacheSize(r),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};t.postRenderFunctions.push(e)}return this.container}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,2*t)}drawTile(t,e,i,n,r,s,o,a){let l;if(t instanceof If){if(l=Ef(t.getData()),!l)throw new Error("Rendering array data is not yet supported")}else l=this.getTileImage(t);if(!l)return;const h=this.getRenderContext(e),u=L(this),c=e.layerStatesArray[e.layerIndex],d=c.opacity*(a?t.getAlpha(u,e.time):1),f=d!==h.globalAlpha;f&&(h.save(),h.globalAlpha=d),h.drawImage(l,o,o,l.width-2*o,l.height-2*o,i,n,r,s),f&&h.restore(),d!==c.opacity?e.animate=!0:a&&t.endTransition(u)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}updateUsedTiles(t,e,i){const n=L(e);n in t||(t[n]={}),t[n][i.getKey()]=!0}},Df="preload",zf="useInterimTilesOnError",qf=class extends ys{constructor(t){t=t||{};const e=Object.assign({},t),i=t.cacheSize;delete t.cacheSize,delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=i,this.setPreload(void 0!==t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(Df)}setPreload(t){this.set(Df,t)}getUseInterimTilesOnError(){return this.get(zf)}setUseInterimTilesOnError(t){this.set(zf,t)}getData(t){return super.getData(t)}},$f=class extends qf{constructor(t){super(t)}createRenderer(){return new Nf(this,{cacheSize:this.getCacheSize()})}},Bf=class{drawCustom(t,e,i,n,r){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}},Uf={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},Wf=[Uf.FILL],Xf=[Uf.STROKE],Vf=[Uf.BEGIN_PATH],Kf=[Uf.CLOSE_PATH],Yf=Uf,Zf=class extends Bf{constructor(t,e,i,n){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=n,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return 1==e?t:t.map(function(t){return t*e})}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),n=this.tmpCoordinate_,r=this.coordinates;let s=r.length;for(let o=0,a=t.length;o<a;o+=e)n[0]=t[o],n[1]=t[o+1],Rt(i,n)&&(r[s++]=n[0],r[s++]=n[1]);return s}appendFlatLineCoordinates(t,e,i,n,r,s){const o=this.coordinates;let a=o.length;const l=this.getBufferedMaxExtent();s&&(e+=n);let h=t[e],u=t[e+1];const c=this.tmpCoordinate_;let d,f,p,g=!0;for(d=e+n;d<i;d+=n)c[0]=t[d],c[1]=t[d+1],p=Gt(l,c),p!==f?(g&&(o[a++]=h,o[a++]=u,g=!1),o[a++]=c[0],o[a++]=c[1]):1===p?(o[a++]=c[0],o[a++]=c[1],g=!1):g=!0,h=c[0],u=c[1],f=p;return(r&&g||d===e+n)&&(o[a++]=h,o[a++]=u),a}drawCustomCoordinates_(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s],a=this.appendFlatLineCoordinates(t,e,o,n,!1,!1);r.push(a),e=o}return e}drawCustom(t,e,i,n,r){this.beginGeometry(t,e,r);const s=t.getType(),o=t.getStride(),a=this.coordinates.length;let l,h,u,c,d;switch(s){case"MultiPolygon":l=t.getOrientedFlatCoordinates(),c=[];const e=t.getEndss();d=0;for(let t=0,i=e.length;t<i;++t){const i=[];d=this.drawCustomCoordinates_(l,d,e[t],o,i),c.push(i)}this.instructions.push([Yf.CUSTOM,a,c,t,i,pn,r]),this.hitDetectionInstructions.push([Yf.CUSTOM,a,c,t,n||i,pn,r]);break;case"Polygon":case"MultiLineString":u=[],l="Polygon"==s?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),d=this.drawCustomCoordinates_(l,0,t.getEnds(),o,u),this.instructions.push([Yf.CUSTOM,a,u,t,i,fn,r]),this.hitDetectionInstructions.push([Yf.CUSTOM,a,u,t,n||i,fn,r]);break;case"LineString":case"Circle":l=t.getFlatCoordinates(),h=this.appendFlatLineCoordinates(l,0,l.length,o,!1,!1),this.instructions.push([Yf.CUSTOM,a,h,t,i,dn,r]),this.hitDetectionInstructions.push([Yf.CUSTOM,a,h,t,n||i,dn,r]);break;case"MultiPoint":l=t.getFlatCoordinates(),h=this.appendFlatPointCoordinates(l,o),h>a&&(this.instructions.push([Yf.CUSTOM,a,h,t,i,dn,r]),this.hitDetectionInstructions.push([Yf.CUSTOM,a,h,t,n||i,dn,r]));break;case"Point":l=t.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([Yf.CUSTOM,a,h,t,i,void 0,r]),this.hitDetectionInstructions.push([Yf.CUSTOM,a,h,t,n||i,void 0,r])}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[Yf.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[Yf.BEGIN_GEOMETRY,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;let e;t.reverse();const i=t.length;let n,r,s=-1;for(e=0;e<i;++e)n=t[e],r=n[0],r==Yf.END_GEOMETRY?s=e:r==Yf.BEGIN_GEOMETRY&&(n[2]=e,b(this.hitDetectionInstructions,s,e),s=-1)}fillStyleToState(t,e={}){if(t){const i=t.getColor();e.fillPatternScale=i&&"object"==typeof i&&"src"in i?this.pixelRatio:1,e.fillStyle=Fa(i||ja)??void 0}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const i=t.getColor();e.strokeStyle=Fa(i||qa);const n=t.getLineCap();e.lineCap=void 0!==n?n:Na;const r=t.getLineDash();e.lineDash=r?r.slice():Da;const s=t.getLineDashOffset();e.lineDashOffset=s||0;const o=t.getLineJoin();e.lineJoin=void 0!==o?o:za;const a=t.getWidth();e.lineWidth=void 0!==a?a:1;const l=t.getMiterLimit();e.miterLimit=void 0!==l?l:10;const h=t.getOffset();e.strokeOffset=h??0,e.lineWidth>this.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0,e.strokeOffset=void 0;return e}setFillStrokeStyle(t,e){const i=this.state;this.fillStyleToState(t,i),this.strokeStyleToState(e,i)}createFill(t){const e=t.fillStyle,i=[Yf.SET_FILL_STYLE,e];return"string"!=typeof e&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[Yf.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;(void 0!==i&&"string"!=typeof i||t.currentFillStyle!=i)&&(this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,n=t.lineCap,r=t.lineDash,s=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,l=t.miterLimit,h=t.strokeOffset;(t.currentStrokeStyle!=i||t.currentLineCap!=n||r!=t.currentLineDash&&!M(t.currentLineDash,r)||t.currentLineDashOffset!=s||t.currentLineJoin!=o||t.currentLineWidth!=a||t.currentMiterLimit!=l||t.currentStrokeOffset!=h)&&(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=r,t.currentLineDashOffset=s,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=l,t.currentStrokeOffset=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[Yf.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=It(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;Pt(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Hf=class extends Zf{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinatess_(t,e,i,n,r){const s=this.state,o=void 0!==s.fillStyle,a=void 0!==s.strokeStyle,l=i.length;this.instructions.push(Vf),this.hitDetectionInstructions.push(Vf);for(let s=0;s<l;++s){const o=i[s],l=this.coordinates.length,h=this.appendFlatLineCoordinates(t,e,o,n,!0,!a);this.instructions.push([Yf.MOVE_TO_LINE_TO,l,h,r*this.pixelRatio,!0]),this.hitDetectionInstructions.push([Yf.MOVE_TO_LINE_TO,l,h,r,!0]),a&&(this.instructions.push(Kf),this.hitDetectionInstructions.push(Kf)),e=o}return o&&(this.instructions.push(Wf),this.hitDetectionInstructions.push(Wf)),a&&(this.instructions.push(Xf),this.hitDetectionInstructions.push(Xf)),e}drawCircle(t,e,i){const n=this.state,r=n.fillStyle,s=n.strokeStyle,o=n.strokeOffset;if(void 0===r&&void 0===s)return;if(this.handleStrokeOffset_(()=>this.drawCircle(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([Yf.SET_FILL_STYLE,ja]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([Yf.SET_STROKE_STYLE,qa,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Da,0]);const a=t.getFlatCoordinates(),l=t.getStride(),h=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,l,!1,!1);const u=[Yf.CIRCLE,h,o];this.instructions.push(Vf,u),this.hitDetectionInstructions.push(Vf,u),void 0!==n.fillStyle&&(this.instructions.push(Wf),this.hitDetectionInstructions.push(Wf)),void 0!==n.strokeStyle&&(this.instructions.push(Xf),this.hitDetectionInstructions.push(Xf)),this.endGeometry(e)}drawPolygon(t,e,i){const n=this.state,r=n.fillStyle,s=n.strokeStyle,o=n.strokeOffset;if(void 0===r&&void 0===s)return;if(this.handleStrokeOffset_(()=>this.drawPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([Yf.SET_FILL_STYLE,ja]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([Yf.SET_STROKE_STYLE,qa,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Da,0]);const a=t.getEnds(),l=t.getOrientedFlatCoordinates(),h=t.getStride();this.drawFlatCoordinatess_(l,0,a,h,o),this.endGeometry(e)}drawMultiPolygon(t,e,i){const n=this.state,r=n.fillStyle,s=n.strokeStyle,o=n.strokeOffset;if(void 0===r&&void 0===s)return;if(this.handleStrokeOffset_(()=>this.drawMultiPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==n.fillStyle&&this.hitDetectionInstructions.push([Yf.SET_FILL_STYLE,ja]),void 0!==n.strokeStyle&&this.hitDetectionInstructions.push([Yf.SET_STROKE_STYLE,qa,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Da,0]);const a=t.getEndss(),l=t.getOrientedFlatCoordinates(),h=t.getStride();let u=0;for(let t=0,e=a.length;t<e;++t)u=this.drawFlatCoordinatess_(l,u,a[t],h,o);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const t=this.tolerance;if(0!==t){const e=this.coordinates;for(let i=0,n=e.length;i<n;++i)e[i]=yn(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;this.updateFillStyle(t,this.createFill),this.updateStrokeStyle(t,this.applyStroke)}handleStrokeOffset_(t){const e=this.state,i=e.fillStyle,n=e.strokeStyle,r=e.strokeOffset;return Math.abs(r)>0&&void 0!==i&&void 0!==n&&(e.strokeStyle=void 0,e.strokeOffset=0,t(),e.fillStyle=void 0,e.strokeStyle=n,e.strokeOffset=r,t(),e.fillStyle=i,!0)}};function Jf(t,e,i,n,r){const s=[];let o=i,a=0,l=e.slice(i,2);for(;a<t&&o+r<n;){const[i,n]=l.slice(-2),h=e[o+r],u=e[o+r+1],c=Math.sqrt((h-i)*(h-i)+(u-n)*(u-n));if(a+=c,a>=t){const e=(t-a+c)/c,d=_t(i,h,e),f=_t(n,u,e);l.push(d,f),s.push(l),l=[d,f],a==t&&(o+=r),a=0}else if(a<t)l.push(e[o+r],e[o+r+1]),o+=r;else{const t=c-a,e=_t(i,h,t/c),d=_t(n,u,t/c);l.push(e,d),s.push(l),l=[e,d],a=0,o+=r}}return a>0&&s.push(l),s}function Qf(t,e,i,n,r){let s,o,a,l,h,u,c,d,f,p,g=i,m=i,y=0,_=0,v=i;for(o=i;o<n;o+=r){const i=e[o],n=e[o+1];void 0!==h&&(f=i-h,p=n-u,l=Math.sqrt(f*f+p*p),void 0!==c&&(_+=a,s=Math.acos((c*f+d*p)/(a*l)),s>t&&(_>y&&(y=_,g=v,m=o),_=0,v=o-r)),a=l,c=f,d=p),h=i,u=n}return _+=l,_>y?[v,o]:[g,m]}const tp={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},ep={Circle:Hf,Default:Zf,Image:class extends Zf{constructor(t,e,i,n){super(t,e,i,n),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e,i){if(!this.image_||this.maxExtent&&!Rt(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),r=t.getStride(),s=this.coordinates.length,o=this.appendFlatPointCoordinates(n,r);this.instructions.push([Yf.DRAW_IMAGE,s,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([Yf.DRAW_IMAGE,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),r=[];for(let e=0,i=n.length;e<i;e+=t.getStride())this.maxExtent&&!Rt(this.maxExtent,n.slice(e,e+2))||r.push(n[e],n[e+1]);const s=this.coordinates.length,o=this.appendFlatPointCoordinates(r,2);this.instructions.push([Yf.DRAW_IMAGE,s,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([Yf.DRAW_IMAGE,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const i=t.getAnchor(),n=t.getSize(),r=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=r[0],this.originY_=r[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}},LineString:class extends Zf{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinates_(t,e,i,n,r){const s=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,i,n,!1,!1);return this.instructions.push([Yf.MOVE_TO_LINE_TO,s,o,r*this.pixelRatio]),this.hitDetectionInstructions.push([Yf.MOVE_TO_LINE_TO,s,o,r]),i}drawLineString(t,e,i){const n=this.state,r=n.strokeStyle,s=n.lineWidth,o=n.strokeOffset;if(void 0===r||void 0===s)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([Yf.SET_STROKE_STYLE,qa,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Da,0],Vf);const a=t.getFlatCoordinates(),l=t.getStride();this.drawFlatCoordinates_(a,0,a.length,l,o),this.hitDetectionInstructions.push(Xf),this.endGeometry(e)}drawMultiLineString(t,e,i){const n=this.state,r=n.strokeStyle,s=n.lineWidth,o=n.strokeOffset;if(void 0===r||void 0===s)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([Yf.SET_STROKE_STYLE,qa,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,Da,0],Vf);const a=t.getEnds(),l=t.getFlatCoordinates(),h=t.getStride();let u=0;for(let t=0,e=a.length;t<e;++t)u=this.drawFlatCoordinates_(l,u,a[t],h,o);this.hitDetectionInstructions.push(Xf),this.endGeometry(e)}finish(){const t=this.state;return null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&this.instructions.push(Xf),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(Xf),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(Vf)}},Polygon:Hf,Text:class extends Zf{constructor(t,e,i,n){super(t,e,i,n),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[ja]={fillStyle:ja},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e,i){const n=this.textFillState_,r=this.textStrokeState_,s=this.textState_;if(""===this.text_||!s||!n&&!r)return;const o=this.coordinates;let a=o.length;const l=t.getType();let h=null,u=t.getStride();if("line"!==s.placement||"LineString"!=l&&"MultiLineString"!=l&&"Polygon"!=l&&"MultiPolygon"!=l){let n=s.overflow?null:[];switch(l){case"Point":case"MultiPoint":h=t.getFlatCoordinates();break;case"LineString":h=t.getFlatMidpoint();break;case"Circle":h=t.getCenter();break;case"MultiLineString":h=t.getFlatMidpoints(),u=2;break;case"Polygon":h=t.getFlatInteriorPoint(),s.overflow||n.push(h[2]/this.resolution),u=3;break;case"MultiPolygon":const e=t.getFlatInteriorPoints();h=[];for(let t=0,i=e.length;t<i;t+=3)s.overflow||n.push(e[t+2]/this.resolution),h.push(e[t],e[t+1]);if(0===h.length)return;u=2}const r=this.appendFlatPointCoordinates(h,u);if(r===a)return;if(n&&(r-a)/2!==h.length/u){let t=a/2;n=n.filter((e,i)=>{const n=o[2*(t+i)]===h[i*u]&&o[2*(t+i)+1]===h[i*u+1];return n||--t,n})}this.saveTextStates_();const c=s.backgroundFill?this.createFill(this.fillStyleToState(s.backgroundFill)):null,d=s.backgroundStroke?this.createStroke(this.strokeStyleToState(s.backgroundStroke)):null;this.beginGeometry(t,e,i);let f=s.padding;if(f!=Ua&&(s.scale[0]<0||s.scale[1]<0)){let t=s.padding[0],e=s.padding[1],i=s.padding[2],n=s.padding[3];s.scale[0]<0&&(e=-e,n=-n),s.scale[1]<0&&(t=-t,i=-i),f=[t,e,i,n]}const p=this.pixelRatio;this.instructions.push([Yf.DRAW_IMAGE,a,r,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,f==Ua?Ua:f.map(function(t){return t*p}),c,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]);const g=1/p,m=c?c.slice(0):null;m&&(m[1]=ja),this.hitDetectionInstructions.push([Yf.DRAW_IMAGE,a,r,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[g,g],NaN,this.declutterMode_,this.declutterImageWithText_,f,m,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?ja:this.fillKey_,this.textOffsetX_,this.textOffsetY_,n]),this.endGeometry(e)}else{if(!ie(this.maxExtent,t.getExtent()))return;let n;if(h=t.getFlatCoordinates(),"LineString"==l)n=[h.length];else if("MultiLineString"==l)n=t.getEnds();else if("Polygon"==l)n=t.getEnds().slice(0,1);else if("MultiPolygon"==l){const e=t.getEndss();n=[];for(let t=0,i=e.length;t<i;++t)n.push(e[t][0])}this.beginGeometry(t,e,i);const r=s.repeat,c=r?void 0:s.textAlign;let d=0;for(let t=0,e=n.length;t<e;++t){let e;e=r?Jf(r*this.resolution,h,d,n[t],u):[h.slice(d,n[t])];for(let i=0,r=e.length;i<r;++i){const r=e[i];let l=0,h=r.length;if(null==c){const t=Qf(s.maxAngle,r,0,r.length,2);l=t[0],h=t[1]}for(let t=l;t<h;t+=u)o.push(r[t],r[t+1]);const f=o.length;d=n[t],this.drawChars_(a,f),a=f}}this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,n=this.strokeKey_;t&&(n in this.strokeStates||(this.strokeStates[n]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const r=this.textKey_;r in this.textStates||(this.textStates[r]={font:e.font,textAlign:e.textAlign||$a,justify:e.justify,textBaseline:e.textBaseline||Ba,scale:e.scale});const s=this.fillKey_;i&&(s in this.fillStates||(this.fillStates[s]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,n=this.textState_,r=this.strokeKey_,s=this.textKey_,o=this.fillKey_;this.saveTextStates_();const a=this.pixelRatio,l=tp[n.textBaseline],h=this.textOffsetY_*a,u=this.text_,c=i?i.lineWidth*Math.abs(n.scale[0])/2:0;this.instructions.push([Yf.DRAW_CHARS,t,e,l,n.overflow,o,n.maxAngle,a,h,r,c*a,u,s,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([Yf.DRAW_CHARS,t,e,l,n.overflow,o?ja:o,n.maxAngle,a,h,r,c*a,u,s,1/a,this.declutterMode_,this.textKeepUpright_])}setTextStyle(t,e){let i,n,r;if(t){const e=t.getFill();e?(n=this.textFillState_,n||(n={},this.textFillState_=n),n.fillStyle=Fa(e.getColor()||ja)):(n=null,this.textFillState_=n);const s=t.getStroke();if(s){r=this.textStrokeState_,r||(r={},this.textStrokeState_=r);const t=s.getLineDash(),e=s.getLineDashOffset(),i=s.getWidth(),n=s.getMiterLimit();r.lineCap=s.getLineCap()||Na,r.lineDash=t?t.slice():Da,r.lineDashOffset=void 0===e?0:e,r.lineJoin=s.getLineJoin()||za,r.lineWidth=void 0===i?1:i,r.miterLimit=void 0===n?10:n,r.strokeStyle=Fa(s.getColor()||qa)}else r=null,this.textStrokeState_=r;i=this.textState_;const o=t.getFont()||La;Ha(o);const a=t.getScaleArray();i.overflow=t.getOverflow(),i.font=o,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||Ba,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||Ua,i.scale=void 0===a?[1,1]:a;const l=t.getOffsetX(),h=t.getOffsetY(),u=t.getRotateWithView(),c=t.getKeepUpright(),d=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=void 0===l?0:l,this.textOffsetY_=void 0===h?0:h,this.textRotateWithView_=void 0!==u&&u,this.textKeepUpright_=void 0===c||c,this.textRotation_=void 0===d?0:d,this.strokeKey_=r?("string"==typeof r.strokeStyle?r.strokeStyle:L(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?"string"==typeof n.fillStyle?n.fillStyle:"|"+L(n.fillStyle):""}else this.text_="";this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}},ip=class{constructor(t,e,i,n){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=n,this.resolution_=i,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const i=this.buildersByZIndex_[e];for(const n in i){const r=i[n].finish();t[e][n]=r}}return t}getBuilder(t,e){const i=void 0!==t?t.toString():"0";let n=this.buildersByZIndex_[i];void 0===n&&(n={},this.buildersByZIndex_[i]=n);let r=n[e];return void 0===r&&(r=new(0,ep[e])(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[e]=r),r}};function np(t,e,i,n){let r=t[e],s=t[e+1],o=0;for(let a=e+n;a<i;a+=n){const e=t[a],i=t[a+1];o+=Math.sqrt((e-r)*(e-r)+(i-s)*(i-s)),r=e,s=i}return o}function rp(t,e,i,n,r,s,o,a){o=o??[],a=a??n;const l=t[e+n],h=t[e+n+1],u=t[i-2*n],c=t[i-2*n+1];let d,f,p,g,m,y,_,v,x=0;for(let w=e;w<i;w+=n){p=d,g=f,m=void 0,y=void 0,w+n<i&&(m=t[w+n],y=t[w+n+1]),s&&w===e&&(p=u,g=c),s&&w===i-n&&(m=l,y=h),d=t[w],f=t[w+1],[_,v]=sp(d,f,p,g,m,y,r),o[x++]=_,o[x++]=v;for(let e=2;e<a;e++)o[x++]=t[w+e]}return o.length!=x&&(o.length=x),o}function sp(t,e,i,n,r,s,o){let a,l;void 0!==i&&void 0!==n?(a=t-i,l=e-n):void 0!==r&&void 0!==s?(a=r-t,l=s-e):(a=1,l=0);const h=Math.hypot(a,l),u=a/h,c=l/h;if(a=-c,l=u,void 0===i||void 0===n)return[t+a*o,e+l*o];if(void 0===r||void 0===s)return[t+a*o,e+l*o];const d=function(t,e,i){const n=Math.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])),r=[(e[0]-t[0])/n,(e[1]-t[1])/n],s=[-r[1],r[0]],o=Math.sqrt((i[0]-t[0])*(i[0]-t[0])+(i[1]-t[1])*(i[1]-t[1])),a=[(i[0]-t[0])/o,(i[1]-t[1])/o];let l=0===n||0===o?0:Math.acos(dt(a[0]*r[0]+a[1]*r[1],-1,1));return l=Math.max(l,1e-5),a[0]*s[0]+a[1]*s[1]>0?l:2*Math.PI-l}([t,e],[i,n],[r,s]);if(Math.cos(d)>.998)return[t+u*o,e+c*o];const f=Math.cos(d/2),p=Math.sin(d/2);return[t+1/p*(p*a+f*l)*o,e+1/p*(-f*a+p*l)*o]}function op(t,e){for(let i=0,n=t.length-2;i<n;i+=e)for(let n=t.length-2*e;n>i+e;n-=e){const r=t[i],s=t[i+1],o=t[i+e],a=t[i+e+1],l=t[n],h=t[n+1],u=t[n+e],c=t[n+e+1],d=(c-h)*(o-r)-(u-l)*(a-s);if(0===d)continue;const f=((u-l)*(s-h)-(c-h)*(r-l))/d,p=((o-r)*(s-h)-(a-s)*(r-l))/d;if(f>0&&f<1&&p>0&&p<1){const l=r+f*(o-r),h=s+f*(a-s);t[i+e]=l,t[i+e+1]=h,t.splice(i+2*e,n-i-e);break}}return t}function ap(t,e,i,n,r,s,o,a,l,h,u,c,d=!0){let f=t[e],p=t[e+1],g=0,m=0,y=0,_=0;function v(){g=f,m=p,f=t[e+=n],p=t[e+1],_+=y,y=Math.sqrt((f-g)*(f-g)+(p-m)*(p-m))}do{v()}while(e<i-n&&_+y<s);let x=0===y?0:(s-_)/y;const w=_t(g,f,x),b=_t(m,p,x),S=e-n,M=_,E=s+a*l(h,r,u);for(;e<i-n&&_+y<E;)v();x=0===y?0:(E-_)/y;const C=_t(g,f,x),P=_t(m,p,x);let I=!1;if(d)if(c){const t=[w,b,C,P];Ki(t,0,4,2,c,t,t),I=t[0]>t[2]}else I=w>C;const T=Math.PI,R=[],k=S+n===e;let A;if(y=0,_=M,f=t[e=S],p=t[e+1],k){v(),A=Math.atan2(p-m,f-g),I&&(A+=A>0?-T:T);const t=(C+w)/2,e=(P+b)/2;return R[0]=[t,e,(E-s)/2,A,r],R}for(let t=0,c=(r=r.replace(/\n/g," ")).length;t<c;){v();let d=Math.atan2(p-m,f-g);if(I&&(d+=d>0?-T:T),void 0!==A){let t=d-A;if(t+=t>T?-2*T:t<-T?2*T:0,Math.abs(t)>o)return null}A=d;const w=t;let b=0;for(;t<c;++t){const o=a*l(h,r[I?c-t-1:t],u);if(e+n<i&&_+y<s+b+o/2)break;b+=o}if(t===w)continue;const S=I?r.substring(c-w,c-t):r.substring(w,t);x=0===y?0:(s+b/2-_)/y;const M=_t(g,f,x),E=_t(m,p,x);R.push([M,E,b/2,d,S]),s+=b}return R}const lp=[1/0,1/0,-1/0,-1/0],hp=[],up=[],cp=[],dp=[];function fp(t){return t[3].declutterBox}const pp=new RegExp("["+String.fromCharCode(1425)+"-"+String.fromCharCode(2303)+String.fromCharCode(64285)+"-"+String.fromCharCode(65023)+String.fromCharCode(65136)+"-"+String.fromCharCode(65276)+String.fromCharCode(67584)+"-"+String.fromCharCode(69631)+String.fromCharCode(124928)+"-"+String.fromCharCode(126975)+"]");function gp(t,e){return"start"===e?e=pp.test(t)?"right":"left":"end"===e&&(e=pp.test(t)?"left":"right"),tp[e]}function mp(t,e,i){return i>0&&t.push("\n",""),t.push(e,""),t}function yp(t,e,i){return i%2==0&&(t+=e),t}const _p=class{constructor(t,e,i,n,r){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=[1,0,0,1,0,0],this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=r?new Rf:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,n){const r=t+e+i+n;if(this.labels_[r])return this.labels_[r];const s=n?this.strokeStates[n]:null,o=i?this.fillStates[i]:null,a=this.textStates[e],l=this.pixelRatio,h=[a.scale[0]*l,a.scale[1]*l],u=a.justify?tp[a.justify]:gp(Array.isArray(t)?t[0]:t,a.textAlign||$a),c=n&&s.lineWidth?s.lineWidth:0,d=Array.isArray(t)?t:String(t).split("\n").reduce(mp,[]),{width:f,height:p,widths:g,heights:m,lineWidths:y}=function(t,e){const i=[],n=[],r=[];let s=0,o=0,a=0,l=0;for(let h=0,u=e.length;h<=u;h+=2){const c=e[h];if("\n"===c||h===u){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}const d=e[h+1]||t.font,f=tl(d,c);i.push(f),o+=f;const p=Ja(d);n.push(p),l=Math.max(l,p)}return{width:s,height:a,widths:i,heights:n,lineWidths:r}}(a,d),_=f+c,v=[],x=(_+2)*h[0],w=(p+c)*h[1],b={width:x<0?Math.floor(x):Math.ceil(x),height:w<0?Math.floor(w):Math.ceil(w),contextInstructions:v};1==h[0]&&1==h[1]||v.push("scale",h),n&&(v.push("strokeStyle",s.strokeStyle),v.push("lineWidth",c),v.push("lineCap",s.lineCap),v.push("lineJoin",s.lineJoin),v.push("miterLimit",s.miterLimit),v.push("setLineDash",[s.lineDash]),v.push("lineDashOffset",s.lineDashOffset)),i&&v.push("fillStyle",o.fillStyle),v.push("textBaseline","middle"),v.push("textAlign","center");const S=.5-u;let M=u*_+S*c;const E=[],C=[];let P,I=0,T=0,R=0,k=0;for(let t=0,e=d.length;t<e;t+=2){const e=d[t];if("\n"===e){T+=I,I=0,M=u*_+S*c,++k;continue}const r=d[t+1]||a.font;r!==P&&(n&&E.push("font",r),i&&C.push("font",r),P=r),I=Math.max(I,m[R]);const s=[e,M+S*g[R]+u*(g[R]-y[k]),.5*(c+I)+T];M+=g[R],n&&E.push("strokeText",s),i&&C.push("fillText",s),++R}return Array.prototype.push.apply(v,E),Array.prototype.push.apply(v,C),this.labels_[r]=b,b}replayTextBackground_(t,e,i,n,r,s,o){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,n),t.lineTo.apply(t,r),t.lineTo.apply(t,e),s&&(this.alignAndScaleFill_=s[2],t.fillStyle=s[1],this.fill_(t)),o&&(this.setStrokeStyle_(t,o),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,n,r,s,o,a,l,h,u,c,d,f,p,g){let m=i-(o*=c[0]),y=n-(a*=c[1]);const _=r+l>t?t-l:r,v=s+h>e?e-h:s,x=f[3]+_*c[0]+f[1],w=f[0]+v*c[1]+f[2],b=m-f[3],S=y-f[0];let M;return(p||0!==u)&&(hp[0]=b,dp[0]=b,hp[1]=S,up[1]=S,up[0]=b+x,cp[0]=up[0],cp[1]=S+w,dp[1]=cp[1]),0!==u?(M=Bi([1,0,0,1,0,0],i,n,1,1,u,-i,-n),qi(M,hp),qi(M,up),qi(M,cp),qi(M,dp),Ot(Math.min(hp[0],up[0],cp[0],dp[0]),Math.min(hp[1],up[1],cp[1],dp[1]),Math.max(hp[0],up[0],cp[0],dp[0]),Math.max(hp[1],up[1],cp[1],dp[1]),lp)):Ot(Math.min(b,b+x),Math.min(S,S+w),Math.max(b,b+x),Math.max(S,S+w),lp),d&&(m=Math.round(m),y=Math.round(y)),{drawImageX:m,drawImageY:y,drawImageW:_,drawImageH:v,originX:l,originY:h,declutterBox:{minX:lp[0],minY:lp[1],maxX:lp[2],maxY:lp[3],value:g},canvasTransform:M,scale:c}}replayImageOrLabel_(t,e,i,n,r,s,o){const a=!(!s&&!o),l=n.declutterBox,h=o?o[2]*n.scale[0]/2:0;return l.minX-h<=e[0]&&l.maxX+h>=0&&l.minY-h<=e[1]&&l.maxY+h>=0&&(a&&this.replayTextBackground_(t,hp,up,cp,dp,s,o),function(t,e,i,n,r,s,o,a,l,h,u){t.save(),1!==i&&(void 0===t.globalAlpha?t.globalAlpha=t=>t.globalAlpha*=i:t.globalAlpha*=i),e&&t.transform.apply(t,e),n.contextInstructions?(t.translate(l,h),t.scale(u[0],u[1]),function(t,e){const i=t.contextInstructions;for(let t=0,n=i.length;t<n;t+=2)Array.isArray(i[t+1])?e[i[t]].apply(e,i[t+1]):e[i[t]]=i[t+1]}(n,t)):u[0]<0||u[1]<0?(t.translate(l,h),t.scale(u[0],u[1]),t.drawImage(n,r,s,o,a,0,0,o,a)):t.drawImage(n,r,s,o,a,l,h,o*u[0],a*u[1]),t.restore()}(t,n.canvasTransform,r,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=qi(this.renderedTransform_,[0,0]),n=512*this.pixelRatio;t.save(),t.translate(i[0]%n,i[1]%n),1!==e&&t.scale(e,e)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],e[1]&&(t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6]))}drawLabelWithPointPlacement_(t,e,i,n){const r=this.textStates[e],s=this.createLabel(t,e,n,i),o=this.strokeStates[i],a=this.pixelRatio,l=gp(Array.isArray(t)?t[0]:t,r.textAlign||$a),h=tp[r.textBaseline||Ba],u=o&&o.lineWidth?o.lineWidth:0;return{label:s,anchorX:l*(s.width/a-2*r.scale[0])+2*(.5-l)*u,anchorY:h*s.height/a+2*(.5-h)*u}}execute_(t,e,i,n,r,s,o,a){const l=this.zIndexContext_;let h;var u,c;this.pixelCoordinates_&&M(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=Vi(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),c=i,(u=this.renderedTransform_)[0]=c[0],u[1]=c[1],u[2]=c[2],u[3]=c[3],u[4]=c[4],u[5]=c[5]);let d=0;const f=n.length;let p,g=0;const m=[];let y,_,v,x,w,b,S,E,C,P,I,T,R,k=0,A=0;const G=this.coordinateCache_,O=this.viewRotation_,F=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,L={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:O},j=this.instructions!=n||this.overlaps?0:200;let N,D,z,q;for(;d<f;){const i=n[d];switch(i[0]){case Yf.BEGIN_GEOMETRY:N=i[1],q=i[3],N.getGeometry()?void 0===o||ie(o,q.getExtent())?++d:d=i[2]+1:d=i[2],l&&(l.zIndex=i[4]);break;case Yf.BEGIN_PATH:k>j&&(this.fill_(t),k=0),A>j&&(t.stroke(),A=0),k||A||(t.beginPath(),w=NaN,b=NaN),++d;break;case Yf.CIRCLE:g=i[1],v=i[2]??0;const n=h[g],u=h[g+1],c=h[g+2]-v-n,f=h[g+3]-v-u,M=Math.sqrt(c*c+f*f);t.moveTo(n+M,u),t.arc(n,u,M,0,2*Math.PI,!0),++d;break;case Yf.CLOSE_PATH:t.closePath(),++d;break;case Yf.CUSTOM:g=i[1],p=i[2];const $=i[3],B=i[4],U=i[5];L.geometry=$,L.feature=N,d in G||(G[d]=[]);const W=G[d];U?U(h,g,p,2,W):(W[0]=h[g],W[1]=h[g+1],W.length=2),l&&(l.zIndex=i[6]),B(W,L),++d;break;case Yf.DRAW_IMAGE:g=i[1],p=i[2],C=i[3],y=i[4],_=i[5];let X=i[6];const V=i[7],K=i[8],Y=i[9],Z=i[10];let H=i[11];const J=i[12];let Q=i[13];x=i[14]||"declutter";const tt=i[15];if(!C&&i.length>=20){P=i[19],I=i[20],T=i[21],R=i[22];const t=this.drawLabelWithPointPlacement_(P,I,T,R);C=t.label,i[3]=C;const e=i[23];y=(t.anchorX-e)*this.pixelRatio,i[4]=y;const n=i[24];_=(t.anchorY-n)*this.pixelRatio,i[5]=_,X=C.height,i[6]=X,Q=C.width,i[13]=Q}let et,it,nt,rt;i.length>25&&(et=i[25]),i.length>17?(it=i[16],nt=i[17],rt=i[18]):(it=Ua,nt=null,rt=null),Z&&F?H+=O:Z||F||(H-=O);let st=0;for(;g<p;g+=2){if(et&&et[st++]<Q/this.pixelRatio)continue;const i=this.calculateImageOrLabelDimensions_(C.width,C.height,h[g],h[g+1],Q,X,y,_,K,Y,H,J,r,it,!!nt||!!rt,N),n=[t,e,C,i,V,nt,rt];if(a){let t,e,r,s,o;if(tt){const i=p-g;if(!tt[i]){tt[i]={args:n,declutterMode:x};continue}const s=tt[i];t=s.args,e=s.declutterMode,delete tt[i],r=fp(t)}if(!t||"declutter"===e&&a.collides(r)||(s=!0),"declutter"===x&&a.collides(i.declutterBox)||(o=!0),"declutter"===e&&"declutter"===x){const t=s&&o;s=t,o=t}s&&("none"!==e&&a.insert(r),this.replayImageOrLabel_.apply(this,t)),o&&("none"!==x&&a.insert(i.declutterBox),this.replayImageOrLabel_.apply(this,n))}else this.replayImageOrLabel_.apply(this,n)}++d;break;case Yf.DRAW_CHARS:const ot=i[1],at=i[2],lt=i[3],ht=i[4];R=i[5];const ut=i[6],ct=i[7],dt=i[8];T=i[9];const ft=i[10];P=i[11],Array.isArray(P)&&(P=P.reduce(yp,"")),I=i[12];const pt=[i[13],i[13]];x=i[14]||"declutter";const gt=i[15],mt=this.textStates[I],yt=mt.font,_t=[mt.scale[0]*ct,mt.scale[1]*ct];let vt;yt in this.widths_?vt=this.widths_[yt]:(vt={},this.widths_[yt]=vt);const xt=np(h,ot,at,2),wt=Math.abs(_t[0])*el(yt,P,vt);if(ht||wt<=xt){const i=ap(h,ot,at,2,P,(xt-wt)*gp(P,this.textStates[I].textAlign),ut,Math.abs(_t[0]),el,yt,vt,F?0:this.viewRotation_,gt);t:if(i){const n=[];let r,s,o,l,h;if(T)for(r=0,s=i.length;r<s;++r){h=i[r],o=h[4],l=this.createLabel(o,I,"",T),y=h[2]+(_t[0]<0?-ft:ft),_=lt*l.height+2*(.5-lt)*ft*_t[1]/_t[0]-dt;const s=this.calculateImageOrLabelDimensions_(l.width,l.height,h[0],h[1],l.width,l.height,y,_,0,0,h[3],pt,!1,Ua,!1,N);if(a&&"declutter"===x&&a.collides(s.declutterBox))break t;n.push([t,e,l,s,1,null,null])}if(R)for(r=0,s=i.length;r<s;++r){h=i[r],o=h[4],l=this.createLabel(o,I,R,""),y=h[2],_=lt*l.height-dt;const s=this.calculateImageOrLabelDimensions_(l.width,l.height,h[0],h[1],l.width,l.height,y,_,0,0,h[3],pt,!1,Ua,!1,N);if(a&&"declutter"===x&&a.collides(s.declutterBox))break t;n.push([t,e,l,s,1,null,null])}a&&"none"!==x&&a.load(n.map(fp));for(let t=0,e=n.length;t<e;++t)this.replayImageOrLabel_.apply(this,n[t])}}++d;break;case Yf.END_GEOMETRY:if(void 0!==s){N=i[1];const t=s(N,q,x);if(t)return t}++d;break;case Yf.FILL:j?k++:this.fill_(t),++d;break;case Yf.MOVE_TO_LINE_TO:let bt,St,Mt;g=i[1],p=i[2],v=i[3],v?(rp(h,g,p,2,v,i[4]??!1,m),op(m,2),bt=m,St=0,Mt=bt.length):(bt=h,St=g,Mt=p),D=bt[St],z=bt[St+1],t.moveTo(D,z),w=D+.5|0,b=z+.5|0;for(let e=St+2;e<Mt;e+=2)D=bt[e],z=bt[e+1],S=D+.5|0,E=z+.5|0,e!=Mt-2&&S===w&&E===b||(t.lineTo(D,z),w=S,b=E);++d;break;case Yf.SET_FILL_STYLE:this.alignAndScaleFill_=i[2],k?(this.fill_(t),k=0,A&&(t.stroke(),A=0)):A&&i[1]&&(t.stroke(),A=0),t.fillStyle=i[1],++d;break;case Yf.SET_STROKE_STYLE:k&&i[1]&&(this.fill_(t),k=0),A&&(t.stroke(),A=0),this.setStrokeStyle_(t,i),++d;break;case Yf.STROKE:j?A++:t.stroke(),++d;break;default:++d}}k&&this.fill_(t),A&&t.stroke()}execute(t,e,i,n,r,s){this.viewRotation_=n,this.execute_(t,e,i,this.instructions,r,void 0,void 0,s)}executeHitDetection(t,e,i,n,r){return this.viewRotation_=i,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,n,r)}},vp=["Polygon","Circle","LineString","Image","Text","Default"],xp=["Image","Text"],wp=vp.filter(t=>!xp.includes(t));let bp=!1,Sp=!1;const Mp={},Ep=class{constructor(t,e,i,n,r,s,o){this.maxExtent_=t,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=s,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=[1,0,0,1,0,0],this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(r,o)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(const i in t){let n=this.executorsByZIndex_[i];void 0===n&&(n={},this.executorsByZIndex_[i]=n);const r=t[i];for(const t in r){const i=r[t];n[t]=new _p(this.resolution_,this.pixelRatio_,this.overlaps_,i,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let e=0,n=t.length;e<n;++e)if(t[e]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,n,r,s){!1===Sp&&function(){let t=0;const e=e=>{const i=or(1,1,null,{willReadFrequently:e});let n=0;const r=performance.now();for(;performance.now()-r<50;++n)i.fillStyle=`rgba(255,0,${n%256},1)`,i.fillRect(0,0,1,1),i.getImageData(0,0,1,1);return t=n>t?n:t,n},i={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0};bp=i[t],Sp=!0}();const o=2*(n=Math.round(n))+1,a=Bi(this.hitDetectionTransform_,n+.5,n+.5,1/e,-1/e,-i,-t[0],-t[1]),l=!this.hitDetectionContext_;l&&(this.hitDetectionContext_=or(o,o,null,{willReadFrequently:bp}));const h=this.hitDetectionContext_;let u;h.canvas.width!==o||h.canvas.height!==o?(h.canvas.width=o,h.canvas.height=o):l||h.clearRect(0,0,o,o),void 0!==this.renderBuffer_&&(u=[1/0,1/0,-1/0,-1/0],zt(u,t),Pt(u,e*(this.renderBuffer_+n),u));const c=function(t){if(void 0!==Mp[t])return Mp[t];const e=2*t+1,i=t*t,n=new Array(i+1);for(let r=0;r<=t;++r)for(let s=0;s<=t;++s){const o=r*r+s*s;if(o>i)break;let a=n[o];a||(a=[],n[o]=a),a.push(4*((t+r)*e+(t+s))+3),r>0&&a.push(4*((t-r)*e+(t+s))+3),s>0&&(a.push(4*((t+r)*e+(t-s))+3),r>0&&a.push(4*((t-r)*e+(t-s))+3))}const r=[];for(let t=0,e=n.length;t<e;++t)n[t]&&r.push(...n[t]);return Mp[t]=r,r}(n);let d;function f(t,e,i){const a=h.getImageData(0,0,o,o).data;for(let l=0,u=c.length;l<u;l++)if(a[c[l]]>0){if(!s||"none"===i||"Image"!==d&&"Text"!==d||s.includes(t)){const i=(c[l]-3)/4,s=n-i%o,a=n-(i/o|0),h=r(t,e,s*s+a*a);if(h)return h}h.clearRect(0,0,o,o);break}}const p=Object.keys(this.executorsByZIndex_).map(Number);let g,m,y,_,x;for(p.sort(v),g=p.length-1;g>=0;--g){const t=p[g].toString();for(y=this.executorsByZIndex_[t],m=vp.length-1;m>=0;--m)if(d=vp[m],_=y[d],void 0!==_&&(x=_.executeHitDetection(h,a,i,f,u),x))return x}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],r=e[2],s=e[3],o=[i,n,i,s,r,s,r,n];return Vi(o,0,8,2,t,o),o}isEmpty(){return a(this.executorsByZIndex_)}execute(t,e,i,n,r,s,o){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(o?x:v),s=s||vp;const l=vp.length;for(let h=0,u=a.length;h<u;++h){const u=a[h].toString(),c=this.executorsByZIndex_[u];for(let u=0,d=s.length;u<d;++u){const d=s[u],f=c[d];if(void 0!==f){const s=null===o?void 0:f.getZIndexContext(),u=s?s.getContext():t,c=this.maxExtent_&&"Image"!==d&&"Text"!==d;if(c&&(u.save(),this.clip(u,i)),s&&"Text"!==d&&"Image"!==d?s.pushFunction(t=>f.execute(t,e,i,n,r,o)):f.execute(u,e,i,n,r,o),c&&u.restore(),s){s.offset();const t=a[h]*l+vp.indexOf(d);this.deferredZIndexContexts_[t]||(this.deferredZIndexContexts_[t]=[]),this.deferredZIndexContexts_[t].push(s)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(v);for(let i=0,n=e.length;i<n;++i)t[e[i]].forEach(t=>{t.draw(this.renderedContext_),t.clear()}),t[e[i]].length=0}},Cp=class extends Bf{constructor(t,e,i,n,r,s,o){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=n,this.transformRotation_=n?vt(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=r,this.squaredTolerance_=s,this.userTransform_=o,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=[1,0,0,1,0,0]}drawImages_(t,e,i,n){if(!this.image_)return;const r=Vi(t,e,i,n,this.transform_,this.pixelCoordinates_),s=this.context_,o=this.tmpLocalTransform_,a=s.globalAlpha;1!=this.imageOpacity_&&(s.globalAlpha=a*this.imageOpacity_);let l=this.imageRotation_;0===this.transformRotation_&&(l-=this.viewRotation_),this.imageRotateWithView_&&(l+=this.viewRotation_);for(let t=0,e=r.length;t<e;t+=2){const e=r[t]-this.imageAnchorX_,i=r[t+1]-this.imageAnchorY_;if(0!==l||1!=this.imageScale_[0]||1!=this.imageScale_[1]){const t=e+this.imageAnchorX_,n=i+this.imageAnchorY_;Bi(o,t,n,1,1,l,-t,-n),s.save(),s.transform.apply(s,o),s.translate(t,n),s.scale(this.imageScale_[0],this.imageScale_[1]),s.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),s.restore()}else s.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,e,i,this.imageWidth_,this.imageHeight_)}1!=this.imageOpacity_&&(s.globalAlpha=a)}drawText_(t,e,i,n){if(!this.textState_||""===this.text_)return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const r=Vi(t,e,i,n,this.transform_,this.pixelCoordinates_),s=this.context_;let o=this.textRotation_;for(0===this.transformRotation_&&(o-=this.viewRotation_),this.textRotateWithView_&&(o+=this.viewRotation_);e<i;e+=n){const t=r[e]+this.textOffsetX_,i=r[e+1]+this.textOffsetY_;0!==o||1!=this.textScale_[0]||1!=this.textScale_[1]?(s.save(),s.translate(t-this.textOffsetX_,i-this.textOffsetY_),s.rotate(o),s.translate(this.textOffsetX_,this.textOffsetY_),s.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&s.strokeText(this.text_,0,0),this.textFillState_&&s.fillText(this.text_,0,0),s.restore()):(this.textStrokeState_&&s.strokeText(this.text_,t,i),this.textFillState_&&s.fillText(this.text_,t,i))}}moveToLineTo_(t,e,i,n,r,s){const o=this.context_;let a=Vi(t,e,i,n,this.transform_,this.pixelCoordinates_);Math.abs(s)>0&&(a=rp(a,0,a.length,2,s,r,a),op(a,2)),o.moveTo(a[0],a[1]);let l=a.length;r&&(l-=2);for(let t=2;t<l;t+=2)o.lineTo(a[t],a[t+1]);return r&&o.closePath(),i}drawRings_(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s)e=this.moveToLineTo_(t,e,i[s],n,!0,r);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),ie(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=function(t,e,i){const n=t.getFlatCoordinates();if(!n)return null;const r=t.getStride();return Vi(n,0,n.length,r,e,i)}(t,this.transform_,this.pixelCoordinates_),i=e[2]-e[0],n=e[3]-e[1],r=Math.sqrt(i*i+n*n),s=this.context_;s.beginPath(),s.arc(e[0],e[1],r,0,2*Math.PI),this.fillState_&&s.fill(),this.strokeState_&&s.stroke()}""!==this.text_&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t)}}drawFeature(t,e){const i=e.getGeometryFunction()(t);i&&(this.setStyle(e),this.drawGeometry(i))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let t=0,i=e.length;t<i;++t)this.drawGeometry(e[t])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),""!==this.text_&&this.drawText_(e,0,e.length,i)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),""!==this.text_&&this.drawText_(e,0,e.length,i)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),ie(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(i,0,i.length,t.getStride(),!1,this.strokeState_.strokeOffset),e.stroke()}if(""!==this.text_){const e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getExtent();if(ie(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();let n=0;const r=t.getEnds(),s=t.getStride();e.beginPath();for(let t=0,e=r.length;t<e;++t)n=this.moveToLineTo_(i,n,r[t],s,!1,this.strokeState_.strokeOffset);e.stroke()}if(""!==this.text_){const e=t.getFlatMidpoints();this.drawText_(e,0,e.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),ie(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride(),this.strokeState_?.strokeOffset),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){const e=t.getFlatInteriorPoint();this.drawText_(e,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),ie(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getOrientedFlatCoordinates();let n=0;const r=t.getEndss(),s=t.getStride();e.beginPath();for(let t=0,e=r.length;t<e;++t){const e=r[t];n=this.drawRings_(i,n,e,s,this.strokeState_?.strokeOffset)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,i=this.contextFillState_;i?i.fillStyle!=t.fillStyle&&(i.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=t.lineCap&&(i.lineCap=t.lineCap,e.lineCap=t.lineCap),M(i.lineDash,t.lineDash)||e.setLineDash(i.lineDash=t.lineDash),i.lineDashOffset!=t.lineDashOffset&&(i.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),i.lineJoin!=t.lineJoin&&(i.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),i.lineWidth!=t.lineWidth&&(i.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),i.miterLimit!=t.miterLimit&&(i.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),i.strokeStyle!=t.strokeStyle&&(i.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){const e=this.context_,i=this.contextTextState_,n=t.textAlign?t.textAlign:$a;i?(i.font!=t.font&&(i.font=t.font,e.font=t.font),i.textAlign!=n&&(i.textAlign=n,e.textAlign=n),i.textBaseline!=t.textBaseline&&(i.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=n,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:n,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(t){const e=t.getColor();this.fillState_={fillStyle:Fa(e||ja)}}else this.fillState_=null;if(e){const t=e.getColor(),i=e.getLineCap(),n=e.getLineDash(),r=e.getLineDashOffset(),s=e.getLineJoin(),o=e.getWidth(),a=e.getMiterLimit(),l=n||Da,h=e.getOffset();this.strokeState_={lineCap:void 0!==i?i:Na,lineDash:1===this.pixelRatio_?l:l.map(t=>t*this.pixelRatio_),lineDashOffset:(r||0)*this.pixelRatio_,lineJoin:void 0!==s?s:za,lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:Fa(t||qa),strokeOffset:(h??0)*this.pixelRatio_}}else this.strokeState_=null}setImageStyle(t){let e;if(!t||!(e=t.getSize()))return void(this.image_=null);const i=t.getPixelRatio(this.pixelRatio_),n=t.getAnchor(),r=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const s=t.getScaleArray();this.imageScale_=[s[0]*this.pixelRatio_/i,s[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.textFillState_={fillStyle:Fa(t||ja)}}else this.textFillState_=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),n=i.getLineDash(),r=i.getLineDashOffset(),s=i.getLineJoin(),o=i.getWidth(),a=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:Na,lineDash:n||Da,lineDashOffset:r||0,lineJoin:void 0!==s?s:za,lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:10,strokeStyle:Fa(t||qa)}}else this.textStrokeState_=null;const n=t.getFont(),r=t.getOffsetX(),s=t.getOffsetY(),o=t.getRotateWithView(),a=t.getRotation(),l=t.getScaleArray(),h=t.getText(),u=t.getTextAlign(),c=t.getTextBaseline();this.textState_={font:void 0!==n?n:La,textAlign:void 0!==u?u:$a,textBaseline:void 0!==c?c:Ba},this.text_=void 0!==h?Array.isArray(h)?h.reduce((t,e,i)=>t+(i%2?" ":e),""):h:"",this.textOffsetX_=void 0!==r?this.pixelRatio_*r:0,this.textOffsetY_=void 0!==s?this.pixelRatio_*s:0,this.textRotateWithView_=void 0!==o&&o,this.textRotation_=void 0!==a?a:0,this.textScale_=[this.pixelRatio_*l[0],this.pixelRatio_*l[1]]}else this.text_=""}},Pp=.5;function Ip(t,e,i,n,r,s,o,a,l){const h=l?Ri(r):r,u=or(t[0]*Pp,t[1]*Pp);u.imageSmoothingEnabled=!1;const c=u.canvas,d=new Cp(u,Pp,r,null,o,a,l?wi(Pi(),l):null),f=i.length,p=Math.floor(16777215/f),g={};for(let t=1;t<=f;++t){const e=i[t-1],r=e.getStyleFunction()||n;if(!r)continue;let o=r(e,s);if(!o)continue;Array.isArray(o)||(o=[o]);const a=(t*p).toString(16).padStart(7,"#00000");for(let t=0,i=o.length;t<i;++t){const i=o[t],n=i.getGeometryFunction()(e);if(!n||!ie(h,n.getExtent()))continue;const r=i.clone(),s=r.getFill();s&&s.setColor(a);const l=r.getStroke();l&&(l.setColor(a),l.setLineDash(null)),r.setText(void 0);const u=i.getImage();if(u){const t=u.getImageSize();if(!t)continue;const e=or(t[0],t[1],void 0,{alpha:!1}),i=e.canvas;e.fillStyle=a,e.fillRect(0,0,i.width,i.height),r.setImage(new dl({img:i,anchor:u.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:u.getOrigin(),opacity:1,size:u.getSize(),scale:u.getScale(),rotation:u.getRotation(),rotateWithView:u.getRotateWithView()}))}const c=r.getZIndex()||0;let d=g[c];d||(d={},g[c]=d,d.Polygon=[],d.Circle=[],d.LineString=[],d.Point=[]);const f=n.getType();if("GeometryCollection"===f){const t=n.getGeometriesArrayRecursive();for(let e=0,i=t.length;e<i;++e){const i=t[e];d[i.getType().replace("Multi","")].push(i,r)}}else d[f.replace("Multi","")].push(n,r)}}const m=Object.keys(g).map(Number).sort(v);for(let t=0,i=m.length;t<i;++t){const i=g[m[t]];for(const t in i){const n=i[t];for(let t=0,i=n.length;t<i;t+=2){d.setStyle(n[t+1]);for(let i=0,r=e.length;i<r;++i)d.setTransform(e[i]),d.drawGeometry(n[t])}}}return u.getImageData(0,0,c.width,c.height)}function Tp(t,e,i){const n=[];if(i){const r=Math.floor(Math.round(t[0])*Pp),s=Math.floor(Math.round(t[1])*Pp),o=4*(dt(r,0,i.width-1)+dt(s,0,i.height-1)*i.width),a=i.data[o],l=i.data[o+1],h=i.data[o+2]+256*(l+256*a),u=Math.floor(16777215/e.length);h&&h%u===0&&n.push(e[h/u-1])}return n}const Rp={Point:function(t,e,i,n,r,s){const o=i.getImage(),a=i.getText(),l=a&&a.getText(),h=s&&o&&l?{}:void 0;if(o){if(2!=o.getImageState())return;const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(o,h),s.drawPoint(e,n,r)}if(l){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a,h),s.drawText(e,n,r)}},LineString:function(t,e,i,n,r){const s=i.getStroke();if(s){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,s),o.drawLineString(e,n,r)}const o=i.getText();if(o&&o.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(o),s.drawText(e,n,r)}},Polygon:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(s||o){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(s,o),a.drawPolygon(e,n,r)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n,r)}},MultiPoint:function(t,e,i,n,r,s){const o=i.getImage(),a=o&&0!==o.getOpacity(),l=i.getText(),h=l&&l.getText(),u=s&&a&&h?{}:void 0;if(a){if(2!=o.getImageState())return;const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(o,u),s.drawMultiPoint(e,n,r)}if(h){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(l,u),s.drawText(e,n,r)}},MultiLineString:function(t,e,i,n,r){const s=i.getStroke();if(s){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,s),o.drawMultiLineString(e,n,r)}const o=i.getText();if(o&&o.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(o),s.drawText(e,n,r)}},MultiPolygon:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(o||s){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(s,o),a.drawMultiPolygon(e,n,r)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n,r)}},GeometryCollection:function(t,e,i,n,r,s){const o=e.getGeometriesArray();let a,l;for(a=0,l=o.length;a<l;++a)(0,Rp[o[a].getType()])(t,o[a],i,n,r,s)},Circle:function(t,e,i,n,r){const s=i.getFill(),o=i.getStroke();if(s||o){const a=t.getBuilder(i.getZIndex(),"Circle");a.setFillStrokeStyle(s,o),a.drawCircle(e,n,r)}const a=i.getText();if(a&&a.getText()){const s=t.getBuilder(i.getZIndex(),"Text");s.setTextStyle(a),s.drawText(e,n,r)}}};function kp(t,e){return parseInt(L(t),10)-parseInt(L(e),10)}function Ap(t,e){const i=Gp(t,e);return i*i}function Gp(t,e){return.5*t/e}function Op(t,e,i,n,r,s,o,a){const l=[],h=i.getImage();if(h){let t=!0;const e=h.getImageState();2==e||3==e?t=!1:0==e&&h.load(),t&&l.push(h.ready())}const u=i.getFill();u&&u.loading()&&l.push(u.ready());const c=l.length>0;return c&&Promise.all(l).then(()=>r(null)),function(t,e,i,n,r,s,o){const a=i.getGeometryFunction()(e);if(!a)return;const l=a.simplifyTransformed(n,r);i.getRenderer()?Fp(t,l,i,e,o):(0,Rp[l.getType()])(t,l,i,e,o,s)}(t,e,i,n,s,o,a),c}function Fp(t,e,i,n,r){if("GeometryCollection"==e.getType()){const s=e.getGeometries();for(let e=0,o=s.length;e<o;++e)Fp(t,s[e],i,n,r);return}t.getBuilder(i.getZIndex(),"Default").drawCustom(e,n,i.getRenderer(),i.getHitDetectionRenderer(),r)}const Lp={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},jp={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]},Np=class extends Nf{constructor(t,e){super(t,e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=[1,0,0,1,0,0],this.tileClipContexts_=null}enqueueTilesForNextExtent(){return"vector"!==this.getLayer().getRenderMode()}drawTile(t,e,i,n,r,s,o,a){this.updateExecutorGroup_(t,e.pixelRatio,e.viewState.projection),this.tileImageNeedsRender_(t)&&this.renderTileImage_(t,e),super.drawTile(t,e,i,n,r,s,o,a)}getTile(t,e,i,n){const r=this.getOrCreateTile(t,e,i,n);if(!r)return null;const s=n.viewState,o=s.resolution,a=n.viewHints,l=this.getLayer().getSource(),h=l.getTileGridForProjection(s.projection),u=!(a[0]||a[1]),c=h.getZForResolution(o,l.zDirection)===t;return u&&c?r.wantedResolution=o:r.wantedResolution||(r.wantedResolution=h.getResolution(t)),r}prepareFrame(t){const e=this.getLayer().getRevision();return this.renderedLayerRevision_!==e&&(this.renderedLayerRevision_=e,this.renderedTiles.length=0),super.prepareFrame(t)}updateExecutorGroup_(t,e,i){const n=this.getLayer(),r=n.getRevision(),s=n.getRenderOrder()||null,o=t.wantedResolution,a=t.getReplayState(n);if(!a.dirty&&a.renderedResolution===o&&a.renderedRevision==r&&a.renderedPixelRatio===e&&a.renderedRenderOrder==s)return;const l=n.getSource(),h=!!n.getDeclutter(),u=l.getTileGrid(),c=l.getTileGridForProjection(i).getTileCoordExtent(t.wrappedTileCoord),d=l.getSourceTiles(e,i,t),f=L(n);delete t.hitDetectionImageData[f],t.executorGroups[f]=[],a.dirty=!1;for(let r=0,p=d.length;r<p;++r){const p=d[r];if(2!=p.getState())continue;const g=l.getProjection(),m=p.tileCoord;let y=u.getTileCoordExtent(m);i&&g&&!xi(i,g)&&(y=Ei(y,g,i,32));const _=Jt(c,y),v=Pt(_,n.getRenderBuffer()*o,this.tempExtent),x=Nt(y,_)?null:v,w=new ip(0,_,o,e),b=Ap(o,e),S=function(t,e){let i;const r=t.getStyleFunction()||n.getStyleFunction();if(r&&(i=r(t,o)),i){const n=this.renderFeature(t,b,i,w,h,e);a.dirty=a.dirty||n}},M=p.getFeatures();s&&s!==a.renderedRenderOrder&&M.sort(s);for(let t=0,e=M.length;t<e;++t){let e=M[t];i&&p.projection&&!xi(i,p.projection)&&(e=e.clone(),e.getGeometry().applyTransform(Si(p.projection,i))),x&&!ie(x,e.getGeometry().getExtent())||S.call(this,e,t)}const E=w.finish(),C="vector"!==n.getRenderMode()&&h&&1===d.length?null:_,P=new Ep(C,o,e,l.getOverlaps(),E,n.getRenderBuffer(),!0);t.executorGroups[f].push(P)}a.renderedRevision=r,a.renderedPixelRatio=e,a.renderedRenderOrder=s,a.renderedResolution=o}forEachFeatureAtCoordinate(t,e,i,n,r){const s=e.viewState.resolution,o=e.viewState.rotation;i=null==i?0:i;const a=this.getLayer(),l=a.getSource().getTileGridForProjection(e.viewState.projection),h=a.getRenderBuffer(),u=Ct([t]);Pt(u,s*(h+i),u);const c={},d=function(t,e,i){let s=t.getId();void 0===s&&(s=L(t));const o=c[s];if(o){if(!0!==o&&i<o.distanceSq){if(0===i)return c[s]=!0,r.splice(r.lastIndexOf(o),1),n(t,a,e);o.geometry=e,o.distanceSq=i}}else{if(0===i)return c[s]=!0,n(t,a,e);r.push(c[s]={feature:t,layer:a,geometry:e,distanceSq:i,callback:n})}},f=this.renderedTiles,p=L(a),g=a.getDeclutter(),m=g?e.declutter?.[g]?.all().map(t=>t.value):null;let y;t:for(let e=f.length-1;e>=0;--e){const n=f[e];if(!ie(l.getTileCoordExtent(n.wrappedTileCoord),u))continue;const r=n.executorGroups[p];for(let e=0,n=r.length;e<n;++e)if(y=r[e].forEachFeatureAtCoordinate(t,s,o,i,d,m),y)break t}return y}getFeatures(t){return 0===this.renderedTiles.length?Promise.resolve([]):new Promise((e,i)=>{const n=this.getLayer(),r=n.getSource(),s=this.renderedProjection,o=s.getExtent(),a=this.renderedResolution,l=r.getTileGridForProjection(s),h=qi(this.renderedPixelToCoordinateTransform_,t.slice()),u=l.getTileCoordForCoordAndResolution(h,a).toString(),c=this.renderedTiles.find(t=>t.tileCoord.toString()===u&&2===t.getState());if(!c||c.loadingSourceTiles>0)return void e([]);r.getWrapX()&&s.canWrapX()&&!kt(o,l.getTileCoordExtent(c.tileCoord))&&le(h,s);const d=L(n),f=Qt(l.getTileCoordExtent(c.wrappedTileCoord)),p=[(h[0]-f[0])/a,(f[1]-h[1])/a],g=c.getSourceTiles().reduce((t,e)=>t.concat(e.getFeatures()),[]);let m=c.hitDetectionImageData[d];if(!m){const t=no(l.getTileSize(l.getZForResolution(a,r.zDirection))),e=this.renderedRotation_;m=Ip(t,[this.getRenderTransform(l.getTileCoordCenter(c.wrappedTileCoord),a,0,Pp,t[0]*Pp,t[1]*Pp,0)],g,n.getStyleFunction(),l.getTileCoordExtent(c.wrappedTileCoord),c.getReplayState(n).renderedResolution,e),c.hitDetectionImageData[d]=m}e(Tp(p,g,m))})}getFeaturesInExtent(t){const e=[],i=this.getTileCache();if(0===i.getCount())return e;const n=this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),r=n.getZForResolution(this.renderedResolution),s={};return i.forEach(i=>{if(i.tileCoord[0]!==r||2!==i.getState())return;const o=i.getSourceTiles();for(let i=0,r=o.length;i<r;++i){const r=o[i],a=r.getKey();if(a in s)continue;s[a]=!0;const l=r.tileCoord;if(ie(t,n.getTileCoordExtent(l))){const i=r.getFeatures();if(i)for(let n=0,r=i.length;n<r;++n){const r=i[n],s=r.getGeometry();ie(t,s.getExtent())&&e.push(r)}}}}),e}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&void 0!==this.renderedLayerRevision_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}renderDeclutter(t,e){const i=this.context,n=i.globalAlpha;i.globalAlpha=e.opacity;const r=t.viewHints,s=!(r[0]||r[1]),o=[this.context.canvas.width,this.context.canvas.height],a=this.getLayer().getDeclutter(),l=a?t.declutter?.[a]:void 0,h=L(this.getLayer()),u=this.renderedTiles;for(let e=0,i=u.length;e<i;++e){const i=u[e],n=i.executorGroups[h];if(n)for(let e=n.length-1;e>=0;--e)n[e].execute(this.context,o,this.getTileRenderTransform(i,t),t.viewState.rotation,s,xp,l)}i.globalAlpha=n}renderDeferredInternal(t){const e=this.renderedTiles,i=L(this.getLayer()),n=e.reduce((t,e,n)=>(e.executorGroups[i].forEach(e=>t.push({executorGroup:e,index:n})),t),[]),r=n.map(({executorGroup:t})=>t.getDeferredZIndexContexts()),s={};for(let t=0,e=n.length;t<e;++t){const e=n[t].executorGroup.getDeferredZIndexContexts();for(const t in e)s[t]=!0}const o=Object.keys(s).map(Number).sort(v);this.layerExtent&&this.clipUnrotated(this.context,t,this.layerExtent),o.forEach(t=>{r.forEach((e,i)=>{e[t]&&(e[t].forEach(t=>{const{executorGroup:e,index:r}=n[i],s=e.getRenderedContext(),o=s.globalAlpha;s.globalAlpha=this.renderedOpacity_;const a=this.tileClipContexts_[r];a&&a.draw(s),t.draw(s),a&&s.restore(),s.globalAlpha=o,t.clear()}),e[t].length=0)})}),this.layerExtent&&this.context.restore()}getTileRenderTransform(t,e){const i=e.pixelRatio,n=e.viewState,r=n.center,s=n.resolution,o=n.rotation,a=e.size,l=Math.round(a[0]*i),h=Math.round(a[1]*i),u=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),c=t.tileCoord,d=u.getTileCoordExtent(t.wrappedTileCoord),f=u.getTileCoordExtent(c,this.tempExtent)[0]-d[0];return Di($i(this.inversePixelTransform.slice(),1/i,1/i),this.getRenderTransform(r,s,o,i,l,h,f))}postRender(t,e){const i=e.viewHints,n=!(i[0]||i[1]);this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation,this.renderedOpacity_=e.layerStatesArray[e.layerIndex].opacity;const r=this.getLayer(),s=r.getRenderMode(),o=t.globalAlpha;t.globalAlpha=this.renderedOpacity_;const a=r.getDeclutter(),l=a?jp[s].filter(t=>!xp.includes(t)):jp[s],h=e.viewState,u=h.rotation;this.layerExtent&&this.clipUnrotated(t,e,this.layerExtent);const c=r.getSource(),d=c.getTileGridForProjection(h.projection).getZForResolution(h.resolution,c.zDirection),f=this.renderedTiles,p=[],g=[],m=[],y=L(r);let _=!0;for(let i=f.length-1;i>=0;--i){const s=f[i];_=_&&!s.getReplayState(r).dirty;const o=s.executorGroups[y].filter(t=>t.hasExecutors(l));if(0===o.length)continue;const h=this.getTileRenderTransform(s,e),c=s.tileCoord[0];let v=!1;const x=o[0].getClipCoords(h);let w,b=t;if(x){w=new Rf,b=w.getContext();for(let t=0,e=p.length;t<e;++t)if(d!==c&&c<g[t]){const e=p[t];ie([x[0],x[3],x[4],x[7]],[e[0],e[3],e[4],e[7]])&&(v||(b.save(),v=!0),b.beginPath(),b.moveTo(x[0],x[1]),b.lineTo(x[2],x[3]),b.lineTo(x[4],x[5]),b.lineTo(x[6],x[7]),b.moveTo(e[6],e[7]),b.lineTo(e[4],e[5]),b.lineTo(e[2],e[3]),b.lineTo(e[0],e[1]),b.clip())}p.push(x),g.push(c)}for(let i=0,r=o.length;i<r;++i)o[i].execute(t,[t.canvas.width,t.canvas.height],h,u,n,l,e.declutter?.[a]);v&&(b===t?b.restore():m[i]=w)}this.layerExtent&&t.restore(),t.globalAlpha=o,this.ready=_,this.tileClipContexts_=m,e.declutter||this.renderDeferredInternal(e),super.postRender(t,e)}renderFeature(t,e,i,n,r,s){if(!i)return!1;let o=!1;if(Array.isArray(i))for(let a=0,l=i.length;a<l;++a)o=Op(n,t,i[a],e,this.boundHandleStyleImageChange_,void 0,r,s)||o;else o=Op(n,t,i,e,this.boundHandleStyleImageChange_,void 0,r,s);return o}tileImageNeedsRender_(t){const e=this.getLayer();if("vector"===e.getRenderMode())return!1;const i=t.getReplayState(e),n=e.getRevision(),r=t.wantedResolution;return i.renderedTileResolution!==r||i.renderedTileRevision!==n}renderTileImage_(t,e){const i=this.getLayer(),n=t.getReplayState(i),r=i.getRevision(),s=t.executorGroups[L(i)];n.renderedTileRevision=r;const o=t.wrappedTileCoord,a=o[0],l=i.getSource();let h=e.pixelRatio;const u=e.viewState.projection,c=l.getTileGridForProjection(u),d=c.getResolution(t.tileCoord[0]),f=e.pixelRatio/t.wantedResolution*d,p=c.getResolution(a),g=t.getContext();h=Math.round(Math.max(h,f/h));const m=l.getTilePixelSize(a,h,u);g.canvas.width=m[0],g.canvas.height=m[1];const y=h/f;if(1!==y){const t=Ni(this.tmpTransform_);$i(t,y,y),g.setTransform.apply(g,t)}const _=c.getTileCoordExtent(o,this.tempExtent),v=f/p,x=Ni(this.tmpTransform_);$i(x,v,-v),function(t,e,i){Di(t,zi(ji,1,0,0,1,e,i))}(x,-_[0],-_[3]);for(let t=0,e=s.length;t<e;++t)s[t].execute(g,[g.canvas.width*y,g.canvas.height*y],x,0,!0,Lp[i.getRenderMode()],null);n.renderedTileResolution=t.wantedResolution}},Dp=class extends Vl{constructor(t){t=t||{};const e=Object.assign({},t);delete e.preload;const i=void 0===t.cacheSize?0:t.cacheSize;delete t.cacheSize,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=i;const n=t.renderMode||"hybrid";at("hybrid"==n||"vector"==n,"`renderMode` must be `'hybrid'` or `'vector'`"),this.renderMode_=n,this.setPreload(t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError),this.getBackground,this.setBackground}createRenderer(){return new Np(this,{cacheSize:this.cacheSize_})}getFeatures(t){return super.getFeatures(t)}getFeaturesInExtent(t){return this.getRenderer().getFeaturesInExtent(t)}getRenderMode(){return this.renderMode_}getPreload(){return this.get(Df)}getUseInterimTilesOnError(){return this.get(zf)}setPreload(t){this.set(Df,t)}setUseInterimTilesOnError(t){this.set(zf,t)}};class zp extends Error{constructor(t){super("Unexpected response status: "+t.status),this.name="ResponseError",this.response=t}}class qp extends Error{constructor(t){super("Failed to issue request"),this.name="ClientError",this.client=t}}function $p(t){return new Promise(function(e,i){const n=new XMLHttpRequest;n.addEventListener("load",function(t){const n=t.target;if(!n.status||n.status>=200&&n.status<300){let t;try{t=JSON.parse(n.responseText)}catch(t){const e="Error parsing response text as JSON: "+t.message;return void i(new Error(e))}return void e(t)}i(new zp(n))}),n.addEventListener("error",function(t){i(new qp(t.target))}),n.open("GET",t),n.setRequestHeader("Accept","application/json"),n.send()})}function Bp(t,e){return e.includes("://")?e:new URL(e,t).href}const Up=class extends jd{constructor(t){super({extent:t.extent,origin:t.origin,origins:t.origins,resolutions:t.resolutions,tileSize:t.tileSize,tileSizes:t.tileSizes,sizes:t.sizes}),this.matrixIds_=t.matrixIds}getMatrixId(t){return this.matrixIds_[t]}getMatrixIds(){return this.matrixIds_}},Wp={"image/png":!0,"image/jpeg":!0,"image/gif":!0,"image/webp":!0},Xp={"application/vnd.mapbox-vector-tile":!0,"application/geo+json":!0};function Vp(t,e){if(!e.length)return t;const i=new URL(t,"file:/");if(i.pathname.split("/").includes("collections"))return _e('The "collections" query parameter cannot be added to collection endpoints'),t;const n=e.map(t=>encodeURIComponent(t)).join(",");return i.searchParams.append("collections",n),`${t.split("?")[0]}?${decodeURIComponent(i.searchParams.toString())}`}function Kp(t,e,i,n){let r=t.projection;if(!r&&("string"==typeof e.crs?r=pi(e.crs):"uri"in e.crs&&(r=pi(e.crs.uri)),!r))throw new Error(`Unsupported CRS: ${JSON.stringify(e.crs)}`);const s=e.orderedAxes,o=!(s?s.slice(0,2).map(t=>t.replace(/E|X|Lon/i,"e").replace(/N|Y|Lat/i,"n")).join(""):r.getAxisOrientation()).startsWith("en"),a=e.tileMatrices.sort(function(t,e){return e.cellSize-t.cellSize}),l={};for(let t=0;t<a.length;++t){const e=a[t];l[e.id]=e}const h={},u=[];if(n)for(let t=0;t<n.length;++t){const e=n[t],i=e.tileMatrix,r=l[i],s=a.indexOf(r);u[s]=i,h[i]=e}else for(let t=0;t<a.length;++t){const e=a[t].id;u.push(e)}const c=u.length,d=new Array(c),f=new Array(c),p=new Array(c),g=new Array(c),m=[-1/0,-1/0,1/0,1/0];for(let t=0;t<c;++t){const e=u[t],i=l[e],n=i.pointOfOrigin;d[t]=o?[n[1],n[0]]:n,f[t]=i.cellSize,p[t]=[i.matrixWidth,i.matrixHeight],g[t]=[i.tileWidth,i.tileHeight];const r=h[e];if(r){const e=i.cellSize*i.tileWidth,n=d[t][0]+r.minTileCol*e,s=d[t][0]+(r.maxTileCol+1)*e,o=i.cellSize*i.tileHeight;let a,l;"bottomLeft"===i.cornerOfOrigin?(a=d[t][1]+r.minTileRow*o,l=d[t][1]+(r.maxTileRow+1)*o):(a=d[t][1]-(r.maxTileRow+1)*o,l=d[t][1]-r.minTileRow*o),Jt(m,[n,a,s,l],m)}}const y=new Up({origins:d,resolutions:f,sizes:p,tileSizes:g,extent:n?m:void 0,matrixIds:u});if(!i)return{grid:y,projection:r};const _=t.context,v=t.url;return{grid:y,projection:r,urlTemplate:i,urlFunction:function(t,e,r){if(!t)return;const s=u[t[0]],o=l[s],a="bottomLeft"===o.cornerOfOrigin,c={tileMatrix:s,tileCol:t[1],tileRow:a?-t[2]-1:t[2]};if(n){const t=h[o.id];if(c.tileCol<t.minTileCol||c.tileCol>t.maxTileCol||c.tileRow<t.minTileRow||c.tileRow>t.maxTileRow)return}Object.assign(c,{z:c.tileMatrix,x:c.tileCol,y:c.tileRow},_);const d=i.replace(/\{(\w+?)\}/g,function(t,e){return c[e]});return Bp(v,d)}}}const Yp=class extends Sf{constructor(t){var e;super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,format:t.format,overlaps:t.overlaps,projection:t.projection,tileClass:t.tileClass,transition:t.transition,wrapX:t.wrapX,zDirection:t.zDirection,state:"loading"}),(e={url:t.url,projection:this.getProjection(),mediaType:t.mediaType,supportedMediaTypes:t.format.supportedMediaTypes,context:t.context||null,collections:t.collections},$p(e.url).then(function(t){return function(t,e){const i=e.tileMatrixSetLimits;let n;if("map"===e.dataType)n=function(t,e,i){let n,r;for(let i=0;i<t.length;++i){const s=t[i];if("item"===s.rel){if(s.type===e){n=s.href;break}(Wp[s.type]||!r&&s.type.startsWith("image/"))&&(r=s.href)}}if(!n){if(!r)throw new Error('Could not find "item" link');n=r}return i&&(n=Vp(n,i)),n}(e.links,t.mediaType,t.collections);else{if("vector"!==e.dataType)throw new Error('Expected tileset data type to be "map" or "vector"');n=function(t,e,i,n){let r,s;const o={};for(let i=0;i<t.length;++i){const n=t[i];if(o[n.type]=n.href,"item"===n.rel){if(n.type===e){r=n.href;break}Xp[n.type]&&(s=n.href)}}if(!r&&i)for(let t=0;t<i.length;++t){const e=i[t];if(o[e]){r=o[e];break}}if(!r){if(!s)throw new Error('Could not find "item" link');r=s}return n&&(r=Vp(r,n)),r}(e.links,t.mediaType,t.supportedMediaTypes,t.collections)}if(e.tileMatrixSet)return Kp(t,e.tileMatrixSet,n,i);const r=e.links.find(t=>"http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme"===t.rel);if(!r)throw new Error("Expected http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme link or tileMatrixSet");const s=r.href;return $p(Bp(t.url,s)).then(function(e){return Kp(t,e,n,i)})}(e,t)})).then(this.handleTileSetInfo_.bind(this)).catch(this.handleError_.bind(this))}handleTileSetInfo_(t){this.tileGrid=t.grid,this.projection=t.projection,this.setTileUrlFunction(t.urlFunction,t.urlTemplate),this.setState("ready")}handleError_(t){_e(t),this.setState("error")}},Zp=4294967296,Hp=1/Zp,Jp="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class Qp{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(t,e,i=this.length){for(;this.pos<i;){const i=this.readVarint(),n=i>>3,r=this.pos;this.type=7&i,t(n,e,this),this.pos===r&&this.skip(i)}return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Zp;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Zp;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const e=this.buf;let i,n;return n=e[this.pos++],i=127&n,n<128?i:(n=e[this.pos++],i|=(127&n)<<7,n<128?i:(n=e[this.pos++],i|=(127&n)<<14,n<128?i:(n=e[this.pos++],i|=(127&n)<<21,n<128?i:(n=e[this.pos],i|=(15&n)<<28,function(t,e,i){const n=i.buf;let r,s;if(s=n[i.pos++],r=(112&s)>>4,s<128)return tg(t,r,e);if(s=n[i.pos++],r|=(127&s)<<3,s<128)return tg(t,r,e);if(s=n[i.pos++],r|=(127&s)<<10,s<128)return tg(t,r,e);if(s=n[i.pos++],r|=(127&s)<<17,s<128)return tg(t,r,e);if(s=n[i.pos++],r|=(127&s)<<24,s<128)return tg(t,r,e);if(s=n[i.pos++],r|=(1&s)<<31,s<128)return tg(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(i,t,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return Boolean(this.readVarint())}readString(){const t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Jp?Jp.decode(this.buf.subarray(e,t)):function(t,e,i){let n="",r=e;for(;r<i;){const e=t[r];let s,o,a,l=null,h=e>239?4:e>223?3:e>191?2:1;if(r+h>i)break;1===h?e<128&&(l=e):2===h?(s=t[r+1],128==(192&s)&&(l=(31&e)<<6|63&s,l<=127&&(l=null))):3===h?(s=t[r+1],o=t[r+2],128==(192&s)&&128==(192&o)&&(l=(15&e)<<12|(63&s)<<6|63&o,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===h&&(s=t[r+1],o=t[r+2],a=t[r+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(l=(15&e)<<18|(63&s)<<12|(63&o)<<6|63&a,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,h=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),r+=h}return n}(this.buf,e,t)}readBytes(){const t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readVarint(e));return t}readPackedSVarint(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFloat());return t}readPackedDouble(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed64());return t}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}skip(t){const e=7&t;if(0===e)for(;this.buf[this.pos++]>127;);else if(2===e)this.pos=this.readVarint()+this.pos;else if(5===e)this.pos+=4;else{if(1!==e)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e<this.pos+t;)e*=2;if(e!==this.length){const t=new Uint8Array(e);t.set(this.buf),this.buf=t,this.dataView=new DataView(t.buffer),this.length=e}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeSFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*Hp),!0),this.pos+=8}writeSFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*Hp),!0),this.pos+=8}writeVarint(t){(t=+t||0)>268435455||t<0?function(t,e){let i,n;if(t>=0?(i=t%4294967296|0,n=t/4294967296|0):(i=~(-t%4294967296),n=~(-t/4294967296),4294967295^i?i=i+1|0:(i=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos]=127&t}(i,0,e),function(t,e){const i=(7&t)<<4;e.buf[e.pos++]|=i|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))}writeSVarint(t){this.writeVarint(t<0?2*-t-1:2*t)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(4*t.length),this.pos++;const e=this.pos;this.pos=function(t,e,i){for(let n,r,s=0;s<e.length;s++){if(n=e.charCodeAt(s),n>55295&&n<57344){if(!r){n>56319||s+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):r=n;continue}if(n<56320){t[i++]=239,t[i++]=191,t[i++]=189,r=n;continue}n=r-55296<<10|n-56320|65536,r=null}else r&&(t[i++]=239,t[i++]=191,t[i++]=189,r=null);n<128?t[i++]=n:(n<2048?t[i++]=n>>6|192:(n<65536?t[i++]=n>>12|224:(t[i++]=n>>18|240,t[i++]=n>>12&63|128),t[i++]=n>>6&63|128),t[i++]=63&n|128)}return i}(this.buf,t,this.pos);const i=this.pos-e;i>=128&&eg(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){const e=t.length;this.writeVarint(e),this.realloc(e);for(let i=0;i<e;i++)this.buf[this.pos++]=t[i]}writeRawMessage(t,e){this.pos++;const i=this.pos;t(e,this);const n=this.pos-i;n>=128&&eg(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n}writeMessage(t,e,i){this.writeTag(t,2),this.writeRawMessage(e,i)}writePackedVarint(t,e){e.length&&this.writeMessage(t,ig,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,ng,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,og,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,rg,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,sg,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,ag,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,lg,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,hg,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,ug,e)}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,2),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}}function tg(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function eg(t,e,i){const n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(let e=i.pos-1;e>=t;e--)i.buf[e+n]=i.buf[e]}function ig(t,e){for(let i=0;i<t.length;i++)e.writeVarint(t[i])}function ng(t,e){for(let i=0;i<t.length;i++)e.writeSVarint(t[i])}function rg(t,e){for(let i=0;i<t.length;i++)e.writeFloat(t[i])}function sg(t,e){for(let i=0;i<t.length;i++)e.writeDouble(t[i])}function og(t,e){for(let i=0;i<t.length;i++)e.writeBoolean(t[i])}function ag(t,e){for(let i=0;i<t.length;i++)e.writeFixed32(t[i])}function lg(t,e){for(let i=0;i<t.length;i++)e.writeSFixed32(t[i])}function hg(t,e){for(let i=0;i<t.length;i++)e.writeFixed64(t[i])}function ug(t,e){for(let i=0;i<t.length;i++)e.writeSFixed64(t[i])}function cg(t,e,i,n,r,s,o){let a,l;const h=(i-e)/n;if(1===h)a=e;else if(2===h)a=e,l=r;else if(0!==h){let s=t[e],o=t[e+1],h=0;const u=[0];for(let r=e+n;r<i;r+=n){const e=t[r],i=t[r+1];h+=Math.sqrt((e-s)*(e-s)+(i-o)*(i-o)),u.push(h),s=e,o=i}const c=r*h,d=function(t,e,i){let n,r;i=i||v;let s=0,o=t.length,a=!1;for(;s<o;)n=s+(o-s>>1),r=+i(t[n],e),r<0?s=n+1:(o=n,a=!r);return a?s:~s}(u,c);d<0?(l=(c-u[-d-2])/(u[-d-1]-u[-d-2]),a=e+(-d-2)*n):a=e+d*n}o=o>1?o:2,s=s||new Array(o);for(let e=0;e<o;++e)s[e]=void 0===a?NaN:void 0===l?t[a+e]:_t(t[a+e],t[a+n+e],l);return s}function dg(t,e,i,n,r,s){if(i==e)return null;let o;if(r<t[e+n-1])return s?(o=t.slice(e,e+n),o[n-1]=r,o):null;if(t[i-1]<r)return s?(o=t.slice(i-n,i),o[n-1]=r,o):null;if(r==t[e+n-1])return t.slice(e,e+n);let a=e/n,l=i/n;for(;a<l;){const e=a+l>>1;r<t[(e+1)*n-1]?l=e:a=e+1}const h=t[a*n-1];if(r==h)return t.slice((a-1)*n,(a-1)*n+n);const u=(r-h)/(t[(a+1)*n-1]-h);o=[];for(let e=0;e<n-1;++e)o.push(_t(t[(a-1)*n+e],t[a*n+e],u));return o.push(r),o}class fg extends tn{constructor(t,e){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}appendCoordinate(t){S(this.flatCoordinates,t),this.changed()}clone(){const t=new fg(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Tt(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(sn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),an(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,i,n))}forEachSegment(t){return Tn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinateAtM(t,e){return"XYM"!=this.layout&&"XYZM"!=this.layout?null:(e=void 0!==e&&e,dg(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return dn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return cg(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return np(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){const e=[];return e.length=gn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new fg(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return Rn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,this.getExtent())}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=hn(this.flatCoordinates,0,t,this.stride),this.changed()}}const pg=fg;class gg extends tn{constructor(t,e,i){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(t[0]))this.setCoordinates(t,e);else if(void 0!==e&&i)this.setFlatCoordinates(e,t),this.ends_=i;else{const e=t,i=[],n=[];for(let t=0,r=e.length;t<r;++t)S(i,e[t].getFlatCoordinates()),n.push(i.length);const r=0===e.length?this.getLayout():e[0].getLayout();this.setFlatCoordinates(r,i),this.ends_=n}}appendLineString(t){S(this.flatCoordinates,t.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new gg(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Tt(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(on(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ln(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,t,e,i,n))}getCoordinateAtM(t,e,i){return"XYM"!=this.layout&&"XYZM"!=this.layout||0===this.flatCoordinates.length?null:(e=void 0!==e&&e,i=void 0!==i&&i,function(t,e,i,n,r,s,o){if(o)return dg(t,e,i[i.length-1],n,r,s);let a;if(r<t[n-1])return s?(a=t.slice(0,n),a[n-1]=r,a):null;if(t[t.length-1]<r)return s?(a=t.slice(t.length-n),a[n-1]=r,a):null;for(let s=0,o=i.length;s<o;++s){const o=i[s];if(e!=o){if(r<t[e+n-1])return null;if(r<=t[o-1])return dg(t,e,o,n,r,!1);e=o}}return null}(this.flatCoordinates,0,this.ends_,this.stride,t,e,i))}getCoordinates(){return fn(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new pg(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLineStrings(){const t=this.flatCoordinates,e=this.ends_,i=this.layout,n=[];let r=0;for(let s=0,o=e.length;s<o;++s){const o=e[s],a=new pg(t.slice(r,o),i);n.push(a),r=o}return n}getLength(){const t=this.ends_;let e=0,i=0;for(let n=0,r=t.length;n<r;++n)i+=np(this.flatCoordinates,e,t[n],this.stride),e=t[n];return i}getFlatMidpoints(){const t=[],e=this.flatCoordinates;let i=0;const n=this.ends_,r=this.stride;for(let s=0,o=n.length;s<o;++s){const o=n[s];S(t,cg(e,i,o,r,.5)),i=o}return t}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=mn(this.flatCoordinates,0,this.ends_,this.stride,t,e,0,i),new gg(e,"XY",i)}getType(){return"MultiLineString"}intersectsExtent(t){return function(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){if(Rn(t,e,i[s],n,r))return!0;e=i[s]}return!1}(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=un(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}const mg=gg;class yg extends tn{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){S(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){const t=new yg(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<Tt(this.getExtent(),t,e))return n;const r=this.flatCoordinates,s=this.stride;for(let o=0,a=r.length;o<a;o+=s){const a=pt(t,e,r[o],r[o+1]);if(a<n){n=a;for(let t=0;t<s;++t)i[t]=r[o+t];i.length=s}}return n}getCoordinates(){return dn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){const e=this.flatCoordinates.length/this.stride;return t<0||e<=t?null:new Sn(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){const t=this.flatCoordinates,e=this.layout,i=this.stride,n=[];for(let r=0,s=t.length;r<s;r+=i){const s=new Sn(t.slice(r,r+i),e);n.push(s)}return n}getType(){return"MultiPoint"}intersectsExtent(t){const e=this.flatCoordinates,i=this.stride;for(let n=0,r=e.length;n<r;n+=i)if(At(t,e[n],e[n+1]))return!0;return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=hn(this.flatCoordinates,0,t,this.stride),this.changed()}}const _g=yg;function vg(t,e,i,n){const r=[];let s=[1/0,1/0,-1/0,-1/0];for(let o=0,a=i.length;o<a;++o){const a=i[o];s=jt(t,e,a[0],n),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),e=a[a.length-1]}return r}class xg extends tn{constructor(t,e,i){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!i&&!Array.isArray(t[0])){const n=t,r=[],s=[];for(let t=0,e=n.length;t<e;++t){const e=n[t],i=r.length,o=e.getEnds();for(let t=0,e=o.length;t<e;++t)o[t]+=i;S(r,e.getFlatCoordinates()),s.push(o)}e=0===n.length?this.getLayout():n[0].getLayout(),t=r,i=s}void 0!==e&&i?(this.setFlatCoordinates(e,t),this.endss_=i):this.setCoordinates(t,e)}appendPolygon(t){let e;if(this.flatCoordinates){const i=this.flatCoordinates.length;S(this.flatCoordinates,t.getFlatCoordinates()),e=t.getEnds().slice();for(let t=0,n=e.length;t<n;++t)e[t]+=i}else this.flatCoordinates=t.getFlatCoordinates().slice(),e=t.getEnds().slice(),this.endss_.push();this.endss_.push(e),this.changed()}clone(){const t=this.endss_.length,e=new Array(t);for(let i=0;i<t;++i)e[i]=this.endss_[i].slice();const i=new xg(this.flatCoordinates.slice(),this.layout,e);return i.applyProperties(this),i}closestPointXY(t,e,i,n){return n<Tt(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(function(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];r=on(t,e,o,n,r),e=o[o.length-1]}return r}(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),function(t,e,i,n,r,s,o,a,l,h,u){u=u||[NaN,NaN];for(let s=0,c=i.length;s<c;++s){const c=i[s];h=ln(t,e,c,n,r,true,o,a,l,h,u),e=c[c.length-1]}return h}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,0,t,e,i,n))}containsXY(t,e){return function(t,e,i,n,r,s){if(0===i.length)return!1;for(let o=0,a=i.length;o<a;++o){const a=i[o];if(Cn(t,e,a,n,r,s))return!0;e=a[a.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)}getArea(){return function(t,e,i,n){let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s];r+=nn(t,e,o,n),e=o[o.length-1]}return r}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),Nn(e,0,this.endss_,this.stride,t)):e=this.flatCoordinates,pn(e,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const t=vg(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=In(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new _g(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;Ln(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Nn(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=function(t,e,i,n,r,s,o,a){for(let l=0,h=i.length;l<h;++l){const h=i[l],u=[];o=vn(t,e,h,n,r,s,o,u),a.push(u),e=h[h.length-1]}return o}(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),e,0,i),new xg(e,"XY",i)}getPolygon(t){if(t<0||this.endss_.length<=t)return null;let e;if(0===t)e=0;else{const i=this.endss_[t-1];e=i[i.length-1]}const i=this.endss_[t].slice(),n=i[i.length-1];if(0!==e)for(let t=0,n=i.length;t<n;++t)i[t]-=e;return new qn(this.flatCoordinates.slice(e,n),this.layout,i)}getPolygons(){const t=this.layout,e=this.flatCoordinates,i=this.endss_,n=[];let r=0;for(let s=0,o=i.length;s<o;++s){const o=i[s].slice(),a=o[o.length-1];if(0!==r)for(let t=0,e=o.length;t<e;++t)o[t]-=r;const l=new qn(e.slice(r,a),t,o);n.push(l),r=a}return n}getType(){return"MultiPolygon"}intersectsExtent(t){return function(t,e,i,n,r){for(let s=0,o=i.length;s<o;++s){const o=i[s];if(An(t,e,o,n,r))return!0;e=o[o.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,3),this.flatCoordinates||(this.flatCoordinates=[]);const i=cn(this.flatCoordinates,0,t,this.stride,this.endss_);if(0===i.length)this.flatCoordinates.length=0;else{const t=i[i.length-1];this.flatCoordinates.length=0===t.length?0:t[t.length-1]}this.changed()}}const wg=xg,bg=[1,0,0,1,0,0];class Sg{constructor(t,e,i,n,r,s){this.styleFunction,this.extent_,this.id_=s,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=r,this.squaredTolerance_,this.stride_=n,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_="Point"===this.type_?Lt(this.flatCoordinates_):jt(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=Vt(this.getExtent());this.flatInteriorPoints_=Pn(this.flatCoordinates_,0,this.ends_,this.stride_,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=Dn(this.flatCoordinates_,this.ends_),e=vg(this.flatCoordinates_,0,t,this.stride_);this.flatInteriorPoints_=In(this.flatCoordinates_,0,t,this.stride_,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=cg(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const i=this.ends_;for(let n=0,r=i.length;n<r;++n){const r=i[n],s=cg(t,e,r,this.stride_,.5);S(this.flatMidpoints_,s),e=r}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(t){return this}simplifyTransformed(t,e){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(t){const e=(t=pi(t)).getExtent(),i=t.getWorldExtent();if(e&&i){const t=Ht(i)/Ht(e);Bi(bg,i[0],i[3],t,-t,0,0,0),Vi(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,bg,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new Sg(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=I((t,e)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const i=this.simplifiedGeometry_.getFlatCoordinates();let n;switch(this.type_){case"LineString":i.length=gn(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),n=[i.length];break;case"MultiLineString":n=[],i.length=mn(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,n);break;case"Polygon":n=[],i.length=vn(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,n)}return n&&(this.simplifiedGeometry_=new Sg(this.type_,i,n,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}Sg.prototype.getFlatCoordinates=Sg.prototype.getOrientedFlatCoordinates;const Mg=Sg;class Eg extends N{constructor(t){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),t)if("function"==typeof t.getSimplifiedGeometry){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new Eg,e=this.geometryName_;t.setGeometryName(e);const i=this.getPropertiesInternal();if(i){const n=this.getGeometry();for(const r in i)r===e&&n?t.set(r,n.clone()):t.set(r,i[r],!0)}const n=this.getStyle();return n&&t.setStyle(n),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(u(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=l(t,c,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?function(t){if("function"==typeof t)return t;let e;return Array.isArray(t)?e=t:(at("function"==typeof t.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[t]),function(){return e}}(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){t!==this.geometryName_&&(this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_())}}const Cg=Eg;class Pg extends Hi{constructor(t){super(),this.geometries_=t,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(u),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const t=this.geometries_;for(let e=0,i=t.length;e<i;++e)this.changeEventsKeys_.push(l(t[e],c,this.changed,this))}clone(){const t=new Pg(Ig(this.geometries_));return t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<Tt(this.getExtent(),t,e))return n;const r=this.geometries_;for(let s=0,o=r.length;s<o;++s)n=r[s].closestPointXY(t,e,i,n);return n}containsXY(t,e){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)if(i[n].containsXY(t,e))return!0;return!1}computeExtent(t){Ft(t);const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)Dt(t,e[i].getExtent());return t}getGeometries(){return Ig(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let t=[];const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)e[i].getType()===this.getType()?t=t.concat(e[i].getGeometriesArrayRecursive()):t.push(e[i]);return t}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=[],i=this.geometries_;let n=!1;for(let r=0,s=i.length;r<s;++r){const s=i[r],o=s.getSimplifiedGeometry(t);e.push(o),o!==s&&(n=!0)}return n?new Pg(e):(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getType(){return"GeometryCollection"}intersectsExtent(t){const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)if(e[i].intersectsExtent(t))return!0;return!1}isEmpty(){return 0===this.geometries_.length}rotate(t,e){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)i[n].rotate(t,e);this.changed()}scale(t,e,i){i||(i=Vt(this.getExtent()));const n=this.geometries_;for(let r=0,s=n.length;r<s;++r)n[r].scale(t,e,i);this.changed()}setGeometries(t){this.setGeometriesArray(Ig(t))}setGeometriesArray(t){this.unlistenGeometriesChange_(),this.geometries_=t,this.listenGeometriesChange_(),this.changed()}applyTransform(t){const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)e[i].applyTransform(t);this.changed()}translate(t,e){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)i[n].translate(t,e);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function Ig(t){return t.map(t=>t.clone())}const Tg=Pg,Rg=class{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=Cg,this.supportedMediaTypes=null}getReadOptions(t,e){if(e){let i=e.dataProjection?pi(e.dataProjection):this.readProjection(t);e.extent&&i&&"tile-pixels"===i.getUnits()&&(i=pi(i),i.setWorldExtent(e.extent)),e={dataProjection:i,featureProjection:e.featureProjection}}return this.adaptOptions(e)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},t)}getType(){return O()}readFeature(t,e){return O()}readFeatures(t,e){return O()}readGeometry(t,e){return O()}readProjection(t){return O()}writeFeature(t,e){return O()}writeFeatures(t,e){return O()}writeGeometry(t,e){return O()}};function kg(t,e,i){const n=i?pi(i.featureProjection):null,r=i?pi(i.dataProjection):null;let s=t;if(n&&r&&!xi(n,r)){e&&(s=t.clone());const i=e?n:r,o=e?r:n;"tile-pixels"===i.getUnits()?s.transform(i,o):s.applyTransform(Si(i,o))}if(e&&i&&void 0!==i.decimals){const e=Math.pow(10,i.decimals),n=function(t){for(let i=0,n=t.length;i<n;++i)t[i]=Math.round(t[i]*e)/e;return t};s===t&&(s=t.clone()),s.applyTransform(n)}return s}const Ag={Point:Sn,LineString:pg,Polygon:qn,MultiPoint:_g,MultiLineString:mg,MultiPolygon:wg};function Gg(t,e){const i=t.geometry;if(!i)return[];if(Array.isArray(i))return i.map(e=>Gg({...t,geometry:e})).flat();const n="MultiPolygon"===i.type?"Polygon":i.type;if("GeometryCollection"===n||"Circle"===n)throw new Error("Unsupported geometry type: "+n);const r=i.layout.length;return kg(new Mg(n,"Polygon"===n?function(t,e,i){return Array.isArray(e[0])?(Ln(t,0,e,i)||Nn(t=t.slice(),0,e,i),t):(Fn(t,0,e,i)||jn(t=t.slice(),0,e,i),t)}(i.flatCoordinates,i.ends,r):i.flatCoordinates,i.ends?.flat(),r,t.properties||{},t.id).enableSimplifyTransformed(),!1,e)}function Og(t,e){if(!t)return null;if(Array.isArray(t)){const i=t.map(t=>Og(t,e));return new Tg(i)}return kg(new(0,Ag[t.type])(t.flatCoordinates,t.layout||"XY",t.ends),!1,e)}function Fg(t,e,i){if(3===t){const t={keys:[],values:[],features:[]},n=i.readVarint()+i.pos;i.readFields(Lg,t,n),t.length=t.features.length,t.length&&(e[t.name]=t)}}function Lg(t,e,i){if(15===t)e.version=i.readVarint();else if(1===t)e.name=i.readString();else if(5===t)e.extent=i.readVarint();else if(2===t)e.features.push(i.pos);else if(3===t)e.keys.push(i.readString());else if(4===t){let n=null;const r=i.readVarint()+i.pos;for(;i.pos<r;)n=1==(t=i.readVarint()>>3)?i.readString():2===t?i.readFloat():3===t?i.readDouble():4===t?i.readVarint64():5===t?i.readVarint():6===t?i.readSVarint():7===t?i.readBoolean():null;e.values.push(n)}}function jg(t,e,i){if(1==t)e.id=i.readVarint();else if(2==t){const t=i.readVarint()+i.pos;for(;i.pos<t;){const t=e.layer.keys[i.readVarint()],n=e.layer.values[i.readVarint()];e.properties[t]=n}}else 3==t?e.type=i.readVarint():4==t&&(e.geometry=i.pos)}function Ng(t,e,i){t.pos=e.features[i];const n=t.readVarint()+t.pos,r={layer:e,type:0,properties:{}};return t.readFields(jg,r,n),r}const Dg=class extends Rg{constructor(t){super(),t=t||{},this.dataProjection=new xe({code:"",units:"tile-pixels"}),this.featureClass=t.featureClass?t.featureClass:Mg,this.geometryName_=t.geometryName,this.layerName_=t.layerName?t.layerName:"layer",this.layers_=t.layers?t.layers:null,this.idProperty_=t.idProperty,this.supportedMediaTypes=["application/vnd.mapbox-vector-tile","application/x-protobuf"]}readRawGeometry_(t,e,i,n){t.pos=e.geometry;const r=t.readVarint()+t.pos;let s=1,o=0,a=0,l=0,h=0,u=0;for(;t.pos<r;){if(!o){const e=t.readVarint();s=7&e,o=e>>3}if(o--,1===s||2===s)a+=t.readSVarint(),l+=t.readSVarint(),1===s&&h>u&&(n.push(h),u=h),i.push(a,l),h+=2;else{if(7!==s)throw new Error("Invalid command found in the PBF");h>u&&(i.push(i[u],i[u+1]),h+=2)}}h>u&&(n.push(h),u=h)}createFeature_(t,e,i){const n=e.type;if(0===n)return null;let r;const s=e.properties;let o;this.idProperty_?(o=s[this.idProperty_],delete s[this.idProperty_]):o=e.id,s[this.layerName_]=e.layer.name;const a=[],l=[];this.readRawGeometry_(t,e,a,l);const h=function(t,e){let i;return 1===t?i=1===e?"Point":"MultiPoint":2===t?i=1===e?"LineString":"MultiLineString":3===t&&(i="Polygon"),i}(n,l.length);if(this.featureClass===Mg)r=new this.featureClass(h,a,l,2,s,o),r.transform(i.dataProjection);else{let t;if("Polygon"==h){const e=Dn(a,l);t=e.length>1?new wg(a,"XY",e):new qn(a,"XY",l)}else t="Point"===h?new Sn(a,"XY"):"LineString"===h?new pg(a,"XY"):"MultiPoint"===h?new _g(a,"XY"):"MultiLineString"===h?new mg(a,"XY",l):null;r=new(0,this.featureClass),this.geometryName_&&r.setGeometryName(this.geometryName_);const e=kg(t,!1,i);r.setGeometry(e),void 0!==o&&r.setId(o),r.setProperties(s,!0)}return r}getType(){return"arraybuffer"}readFeatures(t,e){const i=this.layers_,n=pi((e=this.adaptOptions(e)).dataProjection);n.setWorldExtent(e.extent),e.dataProjection=n;const r=new Qp(t),s=r.readFields(Fg,{}),o=[];for(const t in s){if(i&&!i.includes(t))continue;const a=s[t],l=a?[0,0,a.extent,a.extent]:null;n.setExtent(l);for(let t=0,i=a.length;t<i;++t){const i=Ng(r,a,t),n=this.createFeature_(r,i,e);null!==n&&o.push(n)}}return o}readProjection(t){return this.dataProjection}setLayers(t){this.layers_=t}};function zg(t){if("string"==typeof t){return JSON.parse(t)||null}return null!==t?t:null}const qg=class extends Rg{constructor(){super()}getType(){return"json"}readFeature(t,e){return this.readFeatureFromObject(zg(t),this.getReadOptions(t,e))}readFeatures(t,e){return this.readFeaturesFromObject(zg(t),this.getReadOptions(t,e))}readFeatureFromObject(t,e){return O()}readFeaturesFromObject(t,e){return O()}readGeometry(t,e){return this.readGeometryFromObject(zg(t),this.getReadOptions(t,e))}readGeometryFromObject(t,e){return O()}readProjection(t){return this.readProjectionFromObject(zg(t))}readProjectionFromObject(t){return O()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(t,e){return O()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(t,e){return O()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(t,e){return O()}};function $g(t,e){if(!t)return null;let i;switch(t.type){case"Point":i=function(t){const e=t.coordinates;return{type:"Point",flatCoordinates:e,layout:Ji(e.length)}}(t);break;case"LineString":i=function(t){const e=t.coordinates,i=e.flat();return{type:"LineString",flatCoordinates:i,ends:[i.length],layout:Ji(e[0]?.length||2)}}(t);break;case"Polygon":i=function(t){const e=t.coordinates,i=[],n=e[0]?.[0]?.length;return{type:"Polygon",flatCoordinates:i,ends:un(i,0,e,n),layout:Ji(n)}}(t);break;case"MultiPoint":i=function(t){const e=t.coordinates;return{type:"MultiPoint",flatCoordinates:e.flat(),layout:Ji(e[0]?.length||2)}}(t);break;case"MultiLineString":i=function(t){const e=t.coordinates,i=e[0]?.[0]?.length||2,n=[];return{type:"MultiLineString",flatCoordinates:n,ends:un(n,0,e,i),layout:Ji(i)}}(t);break;case"MultiPolygon":i=function(t){const e=t.coordinates,i=[],n=e[0]?.[0]?.[0].length||2;return{type:"MultiPolygon",flatCoordinates:i,ends:cn(i,0,e,n),layout:Ji(n)}}(t);break;case"GeometryCollection":i=function(t){const e=t.geometries.map(function(t){return $g(t)});return e}(t);break;default:throw new Error("Unsupported GeoJSON type: "+t.type)}return i}function Bg(t,e){const i=(t=kg(t,!0,e)).getType();let n;switch(i){case"Point":n=function(t){return{type:"Point",coordinates:t.getCoordinates()}}(t);break;case"LineString":n=function(t){return{type:"LineString",coordinates:t.getCoordinates()}}(t);break;case"Polygon":n=function(t,e){let i;return e&&(i=e.rightHanded),{type:"Polygon",coordinates:t.getCoordinates(i)}}(t,e);break;case"MultiPoint":n=function(t){return{type:"MultiPoint",coordinates:t.getCoordinates()}}(t);break;case"MultiLineString":n=function(t){return{type:"MultiLineString",coordinates:t.getCoordinates()}}(t);break;case"MultiPolygon":n=function(t,e){let i;return e&&(i=e.rightHanded),{type:"MultiPolygon",coordinates:t.getCoordinates(i)}}(t,e);break;case"GeometryCollection":n=function(t,e){delete(e=Object.assign({},e)).featureProjection;return{type:"GeometryCollection",geometries:t.getGeometriesArray().map(function(t){return Bg(t,e)})}}(t,e);break;case"Circle":n={type:"GeometryCollection",geometries:[]};break;default:throw new Error("Unsupported geometry type: "+i)}return n}const Ug=class extends qg{constructor(t){t=t||{},super(),this.dataProjection=pi(t.dataProjection?t.dataProjection:"EPSG:4326"),t.featureProjection&&(this.defaultFeatureProjection=pi(t.featureProjection)),t.featureClass&&(this.featureClass=t.featureClass),this.geometryName_=t.geometryName,this.extractGeometryName_=t.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(t,e){let i=null;i="Feature"===t.type?t:{type:"Feature",geometry:t,properties:null};const n=$g(i.geometry);if(this.featureClass===Mg)return Gg({geometry:n,id:i.id,properties:i.properties},e);const r=new Cg;return this.geometryName_?r.setGeometryName(this.geometryName_):this.extractGeometryName_&&i.geometry_name&&r.setGeometryName(i.geometry_name),r.setGeometry(Og(n,e)),"id"in i&&r.setId(i.id),i.properties&&r.setProperties(i.properties,!0),r}readFeaturesFromObject(t,e){let i=null;if("FeatureCollection"===t.type){i=[];const n=t.features;for(let t=0,r=n.length;t<r;++t){const r=this.readFeatureFromObject(n[t],e);r&&i.push(r)}}else i=[this.readFeatureFromObject(t,e)];return i.flat()}readGeometryFromObject(t,e){return function(t,e){return Og($g(t),e)}(t,e)}readProjectionFromObject(t){const e=t.crs;let i;if(e)if("name"==e.type)i=pi(e.properties.name);else{if("EPSG"!==e.type)throw new Error("Unknown SRS type");i=pi("EPSG:"+e.properties.code)}else i=this.dataProjection;return i}writeFeatureObject(t,e){e=this.adaptOptions(e);const i={type:"Feature",geometry:null,properties:null},n=t.getId();if(void 0!==n&&(i.id=n),!t.hasProperties())return i;const r=t.getProperties(),s=t.getGeometry();return s&&(i.geometry=Bg(s,e),delete r[t.getGeometryName()]),a(r)||(i.properties=r),i}writeFeaturesObject(t,e){e=this.adaptOptions(e);const i=[];for(let n=0,r=t.length;n<r;++n)i.push(this.writeFeatureObject(t[n],e));return{type:"FeatureCollection",features:i}}writeGeometryObject(t,e){return Bg(t,this.adaptOptions(e))}},Wg=class extends Of{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=[1/0,1/0,-1/0,-1/0],this.wrappedRenderedExtent_=[1/0,1/0,-1/0,-1/0],this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(t,e,i){const n=e.extent,r=e.viewState,s=r.center,o=r.resolution,a=r.projection,l=r.rotation,h=a.getExtent(),u=this.getLayer().getSource(),c=this.getLayer().getDeclutter(),d=e.pixelRatio,f=e.viewHints,p=!(f[0]||f[1]),g=this.context,m=Math.round(ee(n)/o*d),y=Math.round(Ht(n)/o*d),_=u.getWrapX()&&a.canWrapX(),v=_?ee(h):null,x=_?Math.ceil((n[2]-h[2])/v)+(this.extendX_?2:1):1;let w=_?Math.floor((n[0]-h[0])/v)-(this.extendX_?1:0):0;do{let n=this.getRenderTransform(s,o,0,d,m,y,w*v);e.declutter&&(n=n.slice(0)),t.execute(g,[g.canvas.width,g.canvas.height],n,l,p,void 0===i?vp:i?xp:wp,i?c&&e.declutter[c]:void 0)}while(++w<x)}setDrawContext_(){1!==this.opacity_&&(this.targetContext_=this.context,this.context=or(this.context.canvas.width,this.context.canvas.height,Af))}resetDrawContext_(){if(1!==this.opacity_&&this.targetContext_){const t=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=t,hr(this.context),Af.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(t){this.replayGroup_&&this.getLayer().getDeclutter()&&this.renderWorlds(this.replayGroup_,t,!0)}renderDeferredInternal(t){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,t,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex];this.opacity_=i.opacity;const n=t.viewState;this.prepareContainer(t,e);const r=this.context,s=this.replayGroup_;let o=s&&!s.isEmpty();if(!o&&!this.getLayer().hasListener(ds)&&!this.getLayer().hasListener(fs))return this.container;this.setDrawContext_(),this.preRender(r,t);n.projection;this.clipExtent_=null;let a=!1;if(o&&i.extent&&this.clipping){const e=ki(i.extent);o=ie(e,t.extent),o&&!kt(e,t.extent)&&(t.declutter?this.clipExtent_=e:(this.clipUnrotated(r,t,e),a=!0))}return o&&this.renderWorlds(s,t,!this.getLayer().getDeclutter()&&void 0),a&&r.restore(),this.postRender(r,t),this.renderedRotation_!==n.rotation&&(this.renderedRotation_=n.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise(e=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=this.frameState.size.slice(),e=this.renderedCenter_,i=this.renderedResolution_,n=this.renderedRotation_,r=this.renderedProjection_,s=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],l=t[0]*Pp,h=t[1]*Pp;a.push(this.getRenderTransform(e,i,n,Pp,l,h,0).slice());const u=o.getSource(),c=r.getExtent();if(u.getWrapX()&&r.canWrapX()&&!kt(c,s)){let t=s[0];const r=ee(c);let o,u=0;for(;t<c[0];)--u,o=r*u,a.push(this.getRenderTransform(e,i,n,Pp,l,h,o).slice()),t+=r;for(u=0,t=s[2];t>c[2];)++u,o=r*u,a.push(this.getRenderTransform(e,i,n,Pp,l,h,o).slice()),t-=r}const d=Pi();this.hitDetectionImageData_=Ip(t,a,this.renderedFeatures_,o.getStyleFunction(),s,i,n,Ap(i,this.renderedPixelRatio_),d?r:null)}e(Tp(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,n,r){if(!this.replayGroup_)return;const s=e.viewState.resolution,o=e.viewState.rotation,a=this.getLayer(),l={},h=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,s,o,i,function(t,e,i){const s=L(t),o=l[s];if(o){if(!0!==o&&i<o.distanceSq){if(0===i)return l[s]=!0,r.splice(r.lastIndexOf(o),1),n(t,a,e);o.geometry=e,o.distanceSq=i}}else{if(0===i)return l[s]=!0,n(t,a,e);r.push(l[s]={feature:t,layer:a,geometry:e,distanceSq:i,callback:n})}},h?e.declutter?.[h]?.all().map(t=>t.value):null)}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const n=t.viewHints[0],r=t.viewHints[1],s=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!s&&n||!o&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=t.extent,l=t.viewState,h=l.projection,u=l.resolution,c=t.pixelRatio,d=e.getRevision(),f=e.getRenderBuffer();let p=e.getRenderOrder();void 0===p&&(p=kp);const g=l.center.slice(),m=Pt(a,f*u),y=m.slice(),_=[m.slice()],v=h.getExtent(),x=i.getWrapX()&&h.canWrapX();if(this.extendX_=!1,x){const t=i.getExtent();t&&!ne(t)&&(this.extendX_=t[0]<v[0]||t[2]>v[2])}if(x&&(!kt(v,t.extent)||this.extendX_)){const t=ee(v),e=Math.max(ee(m)/2,t);let i=v[0],n=v[2];this.extendX_&&(i-=t,n+=t),m[0]=i-e,m[2]=n+e,le(g,h);const r=re(_[0],h);r[0]<v[0]&&r[2]<v[2]?_.push([r[0]+t,r[1],r[2]+t,r[3]]):r[0]>v[0]&&r[2]>v[2]&&_.push([r[0]-t,r[1],r[2]-t,r[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedPixelRatio_===c&&this.renderedRevision_==d&&this.renderedRenderOrder_==p&&this.renderedFrameDeclutter_===!!t.declutter&&kt(this.wrappedRenderedExtent_,m))return M(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=g,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const w=new ip(Gp(u,c),m,u,c),b=Pi();let S;if(b){for(let t=0,e=_.length;t<e;++t){const e=Ri(_[t]);i.loadFeatures(e,Ai(u),b)}S=wi(b,h)}else for(let t=0,e=_.length;t<e;++t)i.loadFeatures(_[t],u,h);const E=Ap(u,c);let C=!0;const P=(t,i)=>{let n;const r=t.getStyleFunction()||e.getStyleFunction();if(r&&(n=r(t,u)),n){const e=this.renderFeature(t,E,n,w,S,this.getLayer().getDeclutter(),i);C=C&&!e}},I=Ri(m),T=i.getFeaturesInExtent(I);p&&T.sort(p);for(let t=0,e=T.length;t<e;++t)P(T[t],t);this.renderedFeatures_=T,this.ready=C;const R=w.finish(),k=new Ep(m,u,c,i.getOverlaps(),R,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=u,this.renderedRevision_=d,this.renderedRenderOrder_=p,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=y,this.wrappedRenderedExtent_=m,this.renderedCenter_=g,this.renderedProjection_=h,this.renderedPixelRatio_=c,this.replayGroup_=k,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,n,r,s,o){if(!i)return!1;let a=!1;if(Array.isArray(i))for(let l=0,h=i.length;l<h;++l)a=Op(n,t,i[l],e,this.boundHandleStyleImageChange_,r,s,o)||a;else a=Op(n,t,i,e,this.boundHandleStyleImageChange_,r,s,o);return a}},Xg=class extends Vl{constructor(t){super(t)}createRenderer(){return new Wg(this)}};function Vg(t,e){return[[-1/0,-1/0,1/0,1/0]]}const Kg=class{constructor(t){this.rbush_=new ws(t),this.items_={}}insert(t,e){const i={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(i),this.items_[L(e)]=i}load(t,e){const i=new Array(e.length);for(let n=0,r=e.length;n<r;n++){const r=t[n],s=e[n],o={minX:r[0],minY:r[1],maxX:r[2],maxY:r[3],value:s};i[n]=o,this.items_[L(s)]=o}this.rbush_.load(i)}remove(t){const e=L(t),i=this.items_[e];return delete this.items_[e],null!==this.rbush_.remove(i)}update(t,e){const i=this.items_[L(e)];Nt([i.minX,i.minY,i.maxX,i.maxY],t)||(this.remove(e),this.insert(t,e))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).map(function(t){return t.value})}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,e){return this.forEach_(this.getInExtent(t),e)}forEach_(t,e){let i;for(let n=0,r=t.length;n<r;n++)if(i=e(t[n]),i)return i;return i}isEmpty(){return a(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return Ot(e.minX,e.minY,e.maxX,e.maxY,t)}concat(t){this.rbush_.load(t.rbush_.all());for(const e in t.items_)this.items_[e]=t.items_[e]}},Yg="addfeature",Zg="removefeature";class Hg extends R{constructor(t,e,i){super(t),this.feature=e,this.features=i}}const Jg=class extends sf{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:void 0===t.wrapX||t.wrapX}),this.on,this.once,this.un,this.loader_=P,this.format_=t.format||null,this.overlaps_=void 0===t.overlaps||t.overlaps,this.url_=t.url,void 0!==t.loader?this.loader_=t.loader:void 0!==this.url_&&(at(this.format_,"`format` must be set when `url` is set"),this.loader_=bf(this.url_,this.format_)),this.strategy_=void 0!==t.strategy?t.strategy:Vg;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let i,n;this.featuresRtree_=e?new Kg:null,this.loadedExtentsRtree_=new Kg,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null,Array.isArray(t.features)?n=t.features:t.features&&(i=t.features,n=i.getArray()),e||void 0!==i||(i=new q(n)),void 0!==n&&this.addFeaturesInternal(n),void 0!==i&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=L(t);if(!this.addToIndex_(e,t))return void(this.featuresCollection_&&this.featuresCollection_.remove(t));this.setupChangeEvents_(e,t);const i=t.getGeometry();if(i){const e=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(e,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new Hg(Yg,t))}setupChangeEvents_(t,e){e instanceof Mg||(this.featureChangeKeys_[t]=[l(e,c,this.handleFeatureChange_,this),l(e,s,this.handleFeatureChange_,this)])}addToIndex_(t,e){let i=!0;if(void 0!==e.getId()){const t=String(e.getId());if(t in this.idIndex_)if(e instanceof Mg){const n=this.idIndex_[t];n instanceof Mg?Array.isArray(n)?n.push(e):this.idIndex_[t]=[n,e]:i=!1}else i=!1;else this.idIndex_[t]=e}return i&&(at(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],n=[];for(let e=0,n=t.length;e<n;e++){const n=t[e],r=L(n);this.addToIndex_(r,n)&&i.push(n)}for(let t=0,r=i.length;t<r;t++){const r=i[t],s=L(r);this.setupChangeEvents_(s,r);const o=r.getGeometry();if(o){const t=o.getExtent();e.push(t),n.push(r)}else this.nullGeometryFeatures_[s]=r}if(this.featuresRtree_&&this.featuresRtree_.load(e,n),this.hasListener(Yg))for(let t=0,e=i.length;t<e;t++)this.dispatchEvent(new Hg(Yg,i[t]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(Yg,function(i){e||(e=!0,t.push(i.feature),e=!1)}),this.addEventListener(Zg,function(i){e||(e=!0,t.remove(i.feature),e=!1)}),t.addEventListener(n,t=>{e||(e=!0,this.addFeature(t.element),e=!1)}),t.addEventListener(r,t=>{e||(e=!0,this.removeFeature(t.element),e=!1)}),this.featuresCollection_=t}clear(t){if(t){for(const t in this.featureChangeKeys_)this.featureChangeKeys_[t].forEach(u);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(t=>{this.removeFeatureInternal(t)});for(const t in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[t])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new Hg("clear");this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const i=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(i,function(i){const n=i.getGeometry();if(n instanceof Mg||n.intersectsCoordinate(t))return e(i)})}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,function(i){const n=i.getGeometry();if(n instanceof Mg||n.intersectsExtent(t)){const t=e(i);if(t)return t}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),a(this.nullGeometryFeatures_)||S(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,function(t){e.push(t)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const i=se(t,e);return[].concat(...i.map(t=>this.featuresRtree_.getInExtent(t)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],n=t[1];let r=null;const s=[NaN,NaN];let o=1/0;const a=[-1/0,-1/0,1/0,1/0];return e=e||E,this.featuresRtree_.forEachInExtent(a,function(t){if(e(t)){const e=t.getGeometry(),l=o;if(o=e instanceof Mg?0:e.closestPointXY(i,n,s,o),o<l){r=t;const e=Math.sqrt(o);a[0]=i-e,a[1]=n-e,a[2]=i+e,a[3]=n+e}}}),r}getExtent(t){return this.featuresRtree_?.getExtent(t)??null}getFeatureById(t){const e=this.idIndex_[t.toString()];return void 0!==e?e:null}getFeatureByUid(t){const e=this.uidIndex_[t];return void 0!==e?e:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){const e=t.target,i=L(e),n=e.getGeometry();if(n){const t=n.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(t,e)):this.featuresRtree_&&this.featuresRtree_.update(t,e)}else i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[i]=e);const r=e.getId();if(void 0!==r){const t=r.toString();this.idIndex_[t]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[t]=e)}else this.removeFromIdIndex_(e),this.uidIndex_[i]=e;this.changed(),this.dispatchEvent(new Hg("changefeature",e))}hasFeature(t){const e=t.getId();return void 0!==e?e in this.idIndex_:L(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&a(this.nullGeometryFeatures_):!this.featuresCollection_||0===this.featuresCollection_.getLength()}loadFeatures(t,e,i){const n=this.loadedExtentsRtree_,r=this.strategy_(t,e,i);for(let t=0,s=r.length;t<s;++t){const s=r[t];if(!n.forEachInExtent(s,function(t){return kt(t.extent,s)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new Hg("featuresloadstart"));const t=t=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Hg("featuresloadend",void 0,t))},r=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Hg("featuresloaderror"))};let o=!1;const a=this.loader_.call(this,s,e,i,e=>o||t(e),()=>o||r());a instanceof Promise?(o=!0,a.then(e=>{this.addFeatures(e),t(e)}).catch(r)):this.loader_.length<4&&(this.loading=!1),n.insert(s,{extent:s.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_,i=e.forEachInExtent(t,function(e){if(Nt(e.extent,t))return e});i&&e.remove(i)}removeFeatures(t){let e=!1;for(let i=0,n=t.length;i<n;++i)e=this.removeFeatureInternal(t[i])||e;e&&this.changed()}removeFeature(t){t&&this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=L(t);if(!(e in this.uidIndex_))return!1;e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t);const i=this.featureChangeKeys_[e];i?.forEach(u),delete this.featureChangeKeys_[e];const n=t.getId();if(void 0!==n){const e=n.toString(),i=this.idIndex_[e];i===t?delete this.idIndex_[e]:Array.isArray(i)&&(i.splice(i.indexOf(t),1),1===i.length&&(this.idIndex_[e]=i[0]))}return delete this.uidIndex_[e],this.hasListener(Zg)&&this.dispatchEvent(new Hg(Zg,t)),!0}removeFromIdIndex_(t){for(const e in this.idIndex_)if(this.idIndex_[e]===t){delete this.idIndex_[e];break}}setLoader(t){this.loader_=t}setUrl(t){at(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(bf(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}};var Qg={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}};const tm=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function em(t,e){const i={};for(const e in t)"ref"!==e&&(i[e]=t[e]);return tm.forEach(t=>{t in e&&(i[t]=e[t])}),i}class im{constructor(t,e,i,n){this.message=(t?`${t}: `:"")+i,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)}}function nm(t,...e){for(const i of e)for(const e in i)t[e]=i[e];return t}class rm extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class sm{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,i]of e)this.bindings[t]=i}concat(t){return new sm(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const om={kind:"null"},am={kind:"number"},lm={kind:"string"},hm={kind:"boolean"},um={kind:"color"},cm={kind:"projectionDefinition"},dm={kind:"object"},fm={kind:"value"},pm={kind:"collator"},gm={kind:"formatted"},mm={kind:"padding"},ym={kind:"colorArray"},_m={kind:"numberArray"},vm={kind:"resolvedImage"},xm={kind:"variableAnchorOffsetCollection"};function wm(t,e){return{kind:"array",itemType:t,N:e}}function bm(t){if("array"===t.kind){const e=bm(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const Sm=[om,am,lm,hm,um,cm,gm,dm,wm(fm),mm,_m,ym,vm,xm];function Mm(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Mm(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of Sm)if(!Mm(t,e))return null}return`Expected ${bm(t)} but found ${bm(e)} instead.`}function Em(t,e){return e.some(e=>e.kind===t.kind)}function Cm(t,e){return e.some(e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t)}function Pm(t,e){return"array"===t.kind&&"array"===e.kind?t.itemType.kind===e.itemType.kind&&"number"==typeof t.N:t.kind===e.kind}const Im=.96422,Tm=.82521,Rm=4/29,km=6/29,Am=3*km*km,Gm=km*km*km,Om=Math.PI/180,Fm=180/Math.PI;function Lm(t){return(t%=360)<0&&(t+=360),t}function jm([t,e,i,n]){let r,s;const o=Dm((.2225045*(t=Nm(t))+.7168786*(e=Nm(e))+.0606169*(i=Nm(i)))/1);t===e&&e===i?r=s=o:(r=Dm((.4360747*t+.3850649*e+.1430804*i)/Im),s=Dm((.0139322*t+.0971045*e+.7141733*i)/Tm));const a=116*o-16;return[a<0?0:a,500*(r-o),200*(o-s),n]}function Nm(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Dm(t){return t>Gm?Math.pow(t,1/3):t/Am+Rm}function zm([t,e,i,n]){let r=(t+16)/116,s=isNaN(e)?r:r+e/500,o=isNaN(i)?r:r-i/200;return r=1*$m(r),s=Im*$m(s),o=Tm*$m(o),[qm(3.1338561*s-1.6168667*r-.4906146*o),qm(-.9787684*s+1.9161415*r+.033454*o),qm(.0719453*s-.2289914*r+1.4052427*o),n]}function qm(t){return(t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055)<0?0:t>1?1:t}function $m(t){return t>km?t*t*t:Am*(t-Rm)}const Bm=Object.hasOwn||function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};function Um(t,e){return Bm(t,e)?t[e]:void 0}function Wm(t){return parseInt(t.padEnd(2,t),16)/255}function Xm(t,e){return Vm(e?t/100:t,0,1)}function Vm(t,e,i){return Math.min(Math.max(e,t),i)}function Km(t){return!t.some(Number.isNaN)}const Ym={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function Zm(t,e,i){return t+i*(e-t)}function Hm(t,e,i){return t.map((t,n)=>Zm(t,e[n],i))}class Jm{constructor(t,e,i,n=1,r=!0){this.r=t,this.g=e,this.b=i,this.a=n,r||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter("rgb",[t,e,i,n]))}static parse(t){if(t instanceof Jm)return t;if("string"!=typeof t)return;const e=function(t){if("transparent"===(t=t.toLowerCase().trim()))return[0,0,0,0];const e=Um(Ym,t);if(e){const[t,i,n]=e;return[t/255,i/255,n/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){const e=t.length<6?1:2;let i=1;return[Wm(t.slice(i,i+=e)),Wm(t.slice(i,i+=e)),Wm(t.slice(i,i+=e)),Wm(t.slice(i,i+e)||"ff")]}if(t.startsWith("rgb")){const e=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,i=t.match(e);if(i){const[t,e,n,r,s,o,a,l,h,u,c,d]=i,f=[r||" ",a||" ",u].join("");if(" "===f||" /"===f||",,"===f||",,,"===f){const t=[n,o,h].join(""),i="%%%"===t?100:""===t?255:0;if(i){const t=[Vm(+e/i,0,1),Vm(+s/i,0,1),Vm(+l/i,0,1),c?Xm(+c,d):1];if(Km(t))return t}}return}}const i=t.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){const[t,e,n,r,s,o,a,l,h]=i,u=[n||" ",s||" ",a].join("");if(" "===u||" /"===u||",,"===u||",,,"===u){const t=[+e,Vm(+r,0,100),Vm(+o,0,100),l?Xm(+l,h):1];if(Km(t))return function([t,e,i,n]){function r(n){const r=(n+t/30)%12,s=e*Math.min(i,1-i);return i-s*Math.max(-1,Math.min(r-3,9-r,1))}return t=Lm(t),e/=100,i/=100,[r(0),r(8),r(4),n]}(t)}}}(t);return e?new Jm(...e,!1):void 0}get rgb(){const{r:t,g:e,b:i,a:n}=this,r=n||1/0;return this.overwriteGetter("rgb",[t/r,e/r,i/r,n])}get hcl(){return this.overwriteGetter("hcl",function(t){const[e,i,n,r]=jm(t),s=Math.sqrt(i*i+n*n);return[Math.round(1e4*s)?Lm(Math.atan2(n,i)*Fm):NaN,s,e,r]}(this.rgb))}get lab(){return this.overwriteGetter("lab",jm(this.rgb))}overwriteGetter(t,e){return Object.defineProperty(this,t,{value:e}),e}toString(){const[t,e,i,n]=this.rgb;return`rgba(${[t,e,i].map(t=>Math.round(255*t)).join(",")},${n})`}static interpolate(t,e,i,n="rgb"){switch(n){case"rgb":{const[n,r,s,o]=Hm(t.rgb,e.rgb,i);return new Jm(n,r,s,o,!1)}case"hcl":{const[n,r,s,o]=t.hcl,[a,l,h,u]=e.hcl;let c,d;if(isNaN(n)||isNaN(a))isNaN(n)?isNaN(a)?c=NaN:(c=a,1!==s&&0!==s||(d=l)):(c=n,1!==h&&0!==h||(d=r));else{let t=a-n;a>n&&t>180?t-=360:a<n&&n-a>180&&(t+=360),c=n+i*t}const[f,p,g,m]=function([t,e,i,n]){return t=isNaN(t)?0:t*Om,zm([i,Math.cos(t)*e,Math.sin(t)*e,n])}([c,null!=d?d:Zm(r,l,i),Zm(s,h,i),Zm(o,u,i)]);return new Jm(f,p,g,m,!1)}case"lab":{const[n,r,s,o]=zm(Hm(t.lab,e.lab,i));return new Jm(n,r,s,o,!1)}}}}Jm.black=new Jm(0,0,0,1),Jm.white=new Jm(1,1,1,1),Jm.transparent=new Jm(0,0,0,0),Jm.red=new Jm(1,0,0,1);class Qm{constructor(t,e,i){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const ty=["bottom","center","top"];class ey{constructor(t,e,i,n,r,s){this.text=t,this.image=e,this.scale=i,this.fontStack=n,this.textColor=r,this.verticalAlign=s}}class iy{constructor(t){this.sections=t}static fromString(t){return new iy([new ey(t,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(t=>0!==t.text.length||t.image&&0!==t.image.name.length)}static factory(t){return t instanceof iy?t:iy.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map(t=>t.text).join("")}}class ny{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ny)return t;if("number"==typeof t)return new ny([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const e of t)if("number"!=typeof e)return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new ny(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i){return new ny(Hm(t.values,e.values,i))}}class ry{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ry)return t;if("number"==typeof t)return new ry([t]);if(Array.isArray(t)){for(const e of t)if("number"!=typeof e)return;return new ry(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i){return new ry(Hm(t.values,e.values,i))}}class sy{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof sy)return t;if("string"==typeof t){const e=Jm.parse(t);if(!e)return;return new sy([e])}if(!Array.isArray(t))return;const e=[];for(const i of t){if("string"!=typeof i)return;const t=Jm.parse(i);if(!t)return;e.push(t)}return new sy(e)}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i,n="rgb"){const r=[];if(t.values.length!=e.values.length)throw new Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${e.values.length}), cannot interpolate.`);for(let s=0;s<t.values.length;s++)r.push(Jm.interpolate(t.values[s],e.values[s],i,n));return new sy(r)}}class oy extends Error{constructor(t){super(t),this.name="RuntimeError"}toJSON(){return this.message}}const ay=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class ly{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ly)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let e=0;e<t.length;e+=2){const i=t[e],n=t[e+1];if("string"!=typeof i||!ay.has(i))return;if(!Array.isArray(n)||2!==n.length||"number"!=typeof n[0]||"number"!=typeof n[1])return}return new ly(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i){const n=t.values,r=e.values;if(n.length!==r.length)throw new oy(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${e.toString()}`);const s=[];for(let t=0;t<n.length;t+=2){if(n[t]!==r[t])throw new oy(`Cannot interpolate values containing mismatched anchors. from[${t}]: ${n[t]}, to[${t}]: ${r[t]}`);s.push(n[t]);const[e,o]=n[t+1],[a,l]=r[t+1];s.push([Zm(e,a,i),Zm(o,l,i)])}return new ly(s)}}class hy{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new hy({name:t,available:!1}):null}}class uy{constructor(t,e,i){this.from=t,this.to=e,this.transition=i}static interpolate(t,e,i){return new uy(t,e,i)}static parse(t){return t instanceof uy?t:Array.isArray(t)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]?new uy(t[0],t[1],t[2]):"object"==typeof t&&"string"==typeof t.from&&"string"==typeof t.to&&"number"==typeof t.transition?new uy(t.from,t.to,t.transition):"string"==typeof t?new uy(t,t,1):void 0}}function cy(t,e,i,n){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,i,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[t,e,i,n]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function dy(t){if(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t||t instanceof uy||t instanceof Jm||t instanceof Qm||t instanceof iy||t instanceof ny||t instanceof ry||t instanceof sy||t instanceof ly||t instanceof hy)return!0;if(Array.isArray(t)){for(const e of t)if(!dy(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!dy(t[e]))return!1;return!0}return!1}function fy(t){if(null===t)return om;if("string"==typeof t)return lm;if("boolean"==typeof t)return hm;if("number"==typeof t)return am;if(t instanceof Jm)return um;if(t instanceof uy)return cm;if(t instanceof Qm)return pm;if(t instanceof iy)return gm;if(t instanceof ny)return mm;if(t instanceof ry)return _m;if(t instanceof sy)return ym;if(t instanceof ly)return xm;if(t instanceof hy)return vm;if(Array.isArray(t)){const e=t.length;let i;for(const e of t){const t=fy(e);if(i){if(i===t)continue;i=fm;break}i=t}return wm(i||fm,e)}return dm}function py(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof Jm||t instanceof uy||t instanceof iy||t instanceof ny||t instanceof ry||t instanceof sy||t instanceof ly||t instanceof hy?t.toString():JSON.stringify(t)}class gy{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!dy(t[1]))return e.error("invalid value");const i=t[1];let n=fy(i);const r=e.expectedType;return"array"!==n.kind||0!==n.N||!r||"array"!==r.kind||"number"==typeof r.N&&0!==r.N||(n=r),new gy(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const my={string:lm,number:am,boolean:hm,object:dm};class yy{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i,n=1;const r=t[0];if("array"===r){let r,s;if(t.length>2){const i=t[1];if("string"!=typeof i||!(i in my)||"object"===i)return e.error('The item type argument of "array" must be one of string, number, boolean',1);r=my[i],n++}else r=fm;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);s=t[2],n++}i=wm(r,s)}else{if(!my[r])throw new Error(`Types doesn't contain name = ${r}`);i=my[r]}const s=[];for(;n<t.length;n++){const i=e.parse(t[n],n,fm);if(!i)return null;s.push(i)}return new yy(i,s)}evaluate(t){for(let e=0;e<this.args.length;e++){const i=this.args[e].evaluate(t);if(!Mm(this.type,fy(i)))return i;if(e===this.args.length-1)throw new oy(`Expected value to be of type ${bm(this.type)}, but found ${bm(fy(i))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const _y={"to-boolean":hm,"to-color":um,"to-number":am,"to-string":lm};class vy{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[0];if(!_y[i])throw new Error(`Can't parse ${i} as it is not part of the known types`);if(("to-boolean"===i||"to-string"===i)&&2!==t.length)return e.error("Expected one argument.");const n=_y[i],r=[];for(let i=1;i<t.length;i++){const n=e.parse(t[i],i,fm);if(!n)return null;r.push(n)}return new vy(n,r)}evaluate(t){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(t));case"color":{let e,i;for(const n of this.args){if(e=n.evaluate(t),i=null,e instanceof Jm)return e;if("string"==typeof e){const i=t.parseColor(e);if(i)return i}else if(Array.isArray(e)&&(i=e.length<3||e.length>4?`Invalid rgba value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:cy(e[0],e[1],e[2],e[3]),!i))return new Jm(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new oy(i||`Could not parse color from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"padding":{let e;for(const i of this.args){e=i.evaluate(t);const n=ny.parse(e);if(n)return n}throw new oy(`Could not parse padding from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"numberArray":{let e;for(const i of this.args){e=i.evaluate(t);const n=ry.parse(e);if(n)return n}throw new oy(`Could not parse numberArray from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"colorArray":{let e;for(const i of this.args){e=i.evaluate(t);const n=sy.parse(e);if(n)return n}throw new oy(`Could not parse colorArray from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"variableAnchorOffsetCollection":{let e;for(const i of this.args){e=i.evaluate(t);const n=ly.parse(e);if(n)return n}throw new oy(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"number":{let e=null;for(const i of this.args){if(e=i.evaluate(t),null===e)return 0;const n=Number(e);if(!isNaN(n))return n}throw new oy(`Could not convert ${JSON.stringify(e)} to number.`)}case"formatted":return iy.fromString(py(this.args[0].evaluate(t)));case"resolvedImage":return hy.fromString(py(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return py(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const xy=["Unknown","Point","LineString","Polygon"];class wy{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?xy[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache.get(t);return e||(e=Jm.parse(t),this._parseColorCache.set(t,e)),e}}class by{constructor(t,e,i=[],n,r=new sm,s=[]){this.registry=t,this.path=i,this.key=i.map(t=>`[${t}]`).join(""),this.scope=r,this.errors=s,this.expectedType=n,this._isConstant=e}parse(t,e,i,n,r={}){return e?this.concat(e,i,n)._parse(t,r):this._parse(t,r)}_parse(t,e){function i(t,e,i){return"assert"===i?new yy(e,[t]):"coerce"===i?new vy(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const n=t[0];if("string"!=typeof n)return this.error(`Expression name must be a string, but found ${typeof n} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const r=this.registry[n];if(r){let n=r.parse(t,this);if(!n)return null;if(this.expectedType){const t=this.expectedType,r=n.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==r.kind){if("projectionDefinition"===t.kind&&["string","array"].includes(r.kind)||["color","formatted","resolvedImage"].includes(t.kind)&&["value","string"].includes(r.kind)||["padding","numberArray"].includes(t.kind)&&["value","number","array"].includes(r.kind)||"colorArray"===t.kind&&["value","string","array"].includes(r.kind)||"variableAnchorOffsetCollection"===t.kind&&["value","array"].includes(r.kind))n=i(n,t,e.typeAnnotation||"coerce");else if(this.checkSubtype(t,r))return null}else n=i(n,t,e.typeAnnotation||"assert")}if(!(n instanceof gy)&&"resolvedImage"!==n.type.kind&&this._isConstant(n)){const t=new wy;try{n=new gy(n.type,n.evaluate(t))}catch(t){return this.error(t.message),null}}return n}return this.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0)}return void 0===t?this.error("'undefined' value invalid. Use null instead."):"object"==typeof t?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof t} instead.`)}concat(t,e,i){const n="number"==typeof t?this.path.concat(t):this.path,r=i?this.scope.concat(i):this.scope;return new by(this.registry,this._isConstant,n,e||null,r,this.errors)}error(t,...e){const i=`${this.key}${e.map(t=>`[${t}]`).join("")}`;this.errors.push(new rm(i,t))}checkSubtype(t,e){const i=Mm(t,e);return i&&this.error(i),i}}class Sy{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const i=[];for(let n=1;n<t.length-1;n+=2){const r=t[n];if("string"!=typeof r)return e.error(`Expected string, but found ${typeof r} instead.`,n);if(/[^a-zA-Z0-9_]/.test(r))return e.error("Variable names must contain only alphanumeric characters or '_'.",n);const s=e.parse(t[n+1],n+1);if(!s)return null;i.push([r,s])}const n=e.parse(t[t.length-1],t.length-1,e.expectedType,i);return n?new Sy(i,n):null}outputDefined(){return this.result.outputDefined()}}class My{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const i=t[1];return e.scope.has(i)?new My(i,e.scope.get(i)):e.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class Ey{constructor(t,e,i){this.type=t,this.index=e,this.input=i}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,am),n=e.parse(t[2],2,wm(e.expectedType||fm));if(!i||!n)return null;const r=n.type;return new Ey(r.itemType,i,n)}evaluate(t){const e=this.index.evaluate(t),i=this.input.evaluate(t);if(e<0)throw new oy(`Array index out of bounds: ${e} < 0.`);if(e>=i.length)throw new oy(`Array index out of bounds: ${e} > ${i.length-1}.`);if(e!==Math.floor(e))throw new oy(`Array index must be an integer, but found ${e} instead.`);return i[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class Cy{constructor(t,e){this.type=hm,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,fm),n=e.parse(t[2],2,fm);return i&&n?Em(i.type,[hm,lm,am,om,fm])?new Cy(i,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${bm(i.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!Cm(e,["boolean","string","number","null"]))throw new oy(`Expected first argument to be of type boolean, string, number or null, but found ${bm(fy(e))} instead.`);if(!Cm(i,["string","array"]))throw new oy(`Expected second argument to be of type array or string, but found ${bm(fy(i))} instead.`);return i.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class Py{constructor(t,e,i){this.type=am,this.needle=t,this.haystack=e,this.fromIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,fm),n=e.parse(t[2],2,fm);if(!i||!n)return null;if(!Em(i.type,[hm,lm,am,om,fm]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${bm(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,am);return r?new Py(i,n,r):null}return new Py(i,n)}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!Cm(e,["boolean","string","number","null"]))throw new oy(`Expected first argument to be of type boolean, string, number or null, but found ${bm(fy(e))} instead.`);let n;if(this.fromIndex&&(n=this.fromIndex.evaluate(t)),Cm(i,["string"])){const t=i.indexOf(e,n);return-1===t?-1:[...i.slice(0,t)].length}if(Cm(i,["array"]))return i.indexOf(e,n);throw new oy(`Expected second argument to be of type array or string, but found ${bm(fy(i))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class Iy{constructor(t,e,i,n,r,s){this.inputType=t,this.type=e,this.input=i,this.cases=n,this.outputs=r,this.otherwise=s}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let i,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const r={},s=[];for(let o=2;o<t.length-1;o+=2){let a=t[o];const l=t[o+1];Array.isArray(a)||(a=[a]);const h=e.concat(o);if(0===a.length)return h.error("Expected at least one branch label.");for(const t of a){if("number"!=typeof t&&"string"!=typeof t)return h.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return h.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return h.error("Numeric branch labels must be integer values.");if(i){if(h.checkSubtype(i,fy(t)))return null}else i=fy(t);if(void 0!==r[String(t)])return h.error("Branch labels must be unique.");r[String(t)]=s.length}const u=e.parse(l,o,n);if(!u)return null;n=n||u.type,s.push(u)}const o=e.parse(t[1],1,fm);if(!o)return null;const a=e.parse(t[t.length-1],t.length-1,n);return a?"value"!==o.type.kind&&e.concat(1).checkSubtype(i,o.type)?null:new Iy(i,n,o,r,s,a):null}evaluate(t){const e=this.input.evaluate(t);return(fy(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}}class Ty{constructor(t,e,i){this.type=t,this.branches=e,this.otherwise=i}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);const n=[];for(let r=1;r<t.length-1;r+=2){const s=e.parse(t[r],r,hm);if(!s)return null;const o=e.parse(t[r+1],r+1,i);if(!o)return null;n.push([s,o]),i=i||o.type}const r=e.parse(t[t.length-1],t.length-1,i);if(!r)return null;if(!i)throw new Error("Can't infer output type");return new Ty(i,n,r)}evaluate(t){for(const[e,i]of this.branches)if(e.evaluate(t))return i.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,i]of this.branches)t(e),t(i);t(this.otherwise)}outputDefined(){return this.branches.every(([t,e])=>e.outputDefined())&&this.otherwise.outputDefined()}}class Ry{constructor(t,e,i,n){this.type=t,this.input=e,this.beginIndex=i,this.endIndex=n}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,fm),n=e.parse(t[2],2,am);if(!i||!n)return null;if(!Em(i.type,[wm(fm),lm,fm]))return e.error(`Expected first argument to be of type array or string, but found ${bm(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,am);return r?new Ry(i.type,i,n,r):null}return new Ry(i.type,i,n)}evaluate(t){const e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);let n;if(this.endIndex&&(n=this.endIndex.evaluate(t)),Cm(e,["string"]))return[...e].slice(i,n).join("");if(Cm(e,["array"]))return e.slice(i,n);throw new oy(`Expected first argument to be of type array or string, but found ${bm(fy(e))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function ky(t,e){const i=t.length-1;let n,r,s=0,o=i,a=0;for(;s<=o;)if(a=Math.floor((s+o)/2),n=t[a],r=t[a+1],n<=e){if(a===i||e<r)return a;s=a+1}else{if(!(n>e))throw new oy("Input is not a number.");o=a-1}return 0}class Ay{constructor(t,e,i){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const i=e.parse(t[1],1,am);if(!i)return null;const n=[];let r=null;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);for(let i=1;i<t.length;i+=2){const s=1===i?-1/0:t[i],o=t[i+1],a=i,l=i+1;if("number"!=typeof s)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',a);if(n.length&&n[n.length-1][0]>=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const h=e.parse(o,l,r);if(!h)return null;r=r||h.type,n.push([s,h])}return new Ay(r,i,n)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);const r=e.length;return n>=e[r-1]?i[r-1].evaluate(t):i[ky(e,n)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function Gy(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Oy,Fy,Ly=function(){if(Fy)return Oy;function t(t,e,i,n){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=i,this.p2y=n}return Fy=1,Oy=t,t.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var i=t,n=0;n<8;n++){var r=this.sampleCurveX(i)-t;if(Math.abs(r)<e)return i;var s=this.sampleCurveDerivativeX(i);if(Math.abs(s)<1e-6)break;i-=r/s}var o=0,a=1;for(i=t,n=0;n<20&&(r=this.sampleCurveX(i),!(Math.abs(r-t)<e));n++)t>r?o=i:a=i,i=.5*(a-o)+o;return i},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},Oy}(),jy=Gy(Ly);class Ny{constructor(t,e,i,n,r){this.type=t,this.operator=e,this.interpolation=i,this.input=n,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(t,e,i,n){let r=0;if("exponential"===t.name)r=Dy(e,t.base,i,n);else if("linear"===t.name)r=Dy(e,1,i,n);else if("cubic-bezier"===t.name){const s=t.controlPoints;r=new jy(s[0],s[1],s[2],s[3]).solve(Dy(e,1,i,n))}return r}static parse(t,e){let[i,n,r,...s]=t;if(!Array.isArray(n)||0===n.length)return e.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const t=n[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:t}}else{if("cubic-bezier"!==n[0])return e.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const t=n.slice(1);if(4!==t.length||t.some(t=>"number"!=typeof t||t<0||t>1))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(r=e.parse(r,2,am),!r)return null;const o=[];let a=null;"interpolate-hcl"!==i&&"interpolate-lab"!==i||e.expectedType==ym?e.expectedType&&"value"!==e.expectedType.kind&&(a=e.expectedType):a=um;for(let t=0;t<s.length;t+=2){const i=s[t],n=s[t+1],r=t+3,l=t+4;if("number"!=typeof i)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',r);if(o.length&&o[o.length-1][0]>=i)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',r);const h=e.parse(n,l,a);if(!h)return null;a=a||h.type,o.push([i,h])}return Pm(a,am)||Pm(a,cm)||Pm(a,um)||Pm(a,mm)||Pm(a,_m)||Pm(a,ym)||Pm(a,xm)||Pm(a,wm(am))?new Ny(a,i,n,r,o):e.error(`Type ${bm(a)} is not interpolatable.`)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);const r=e.length;if(n>=e[r-1])return i[r-1].evaluate(t);const s=ky(e,n),o=e[s],a=e[s+1],l=Ny.interpolationFactor(this.interpolation,n,o,a),h=i[s].evaluate(t),u=i[s+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Zm(h,u,l);case"color":return Jm.interpolate(h,u,l);case"padding":return ny.interpolate(h,u,l);case"colorArray":return sy.interpolate(h,u,l);case"numberArray":return ry.interpolate(h,u,l);case"variableAnchorOffsetCollection":return ly.interpolate(h,u,l);case"array":return Hm(h,u,l);case"projectionDefinition":return uy.interpolate(h,u,l)}case"interpolate-hcl":switch(this.type.kind){case"color":return Jm.interpolate(h,u,l,"hcl");case"colorArray":return sy.interpolate(h,u,l,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Jm.interpolate(h,u,l,"lab");case"colorArray":return sy.interpolate(h,u,l,"lab")}}}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function Dy(t,e,i,n){const r=n-i,s=t-i;return 0===r?0:1===e?s/r:(Math.pow(e,s)-1)/(Math.pow(e,r)-1)}Jm.interpolate,ny.interpolate,ry.interpolate,sy.interpolate,ly.interpolate;class zy{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i=null;const n=e.expectedType;n&&"value"!==n.kind&&(i=n);const r=[];for(const n of t.slice(1)){const t=e.parse(n,1+r.length,i,void 0,{typeAnnotation:"omit"});if(!t)return null;i=i||t.type,r.push(t)}if(!i)throw new Error("No output type");const s=n&&r.some(t=>Mm(n,t.type));return new zy(s?fm:i,r)}evaluate(t){let e,i=null,n=0;for(const r of this.args)if(n++,i=r.evaluate(t),i&&i instanceof hy&&!i.available&&(e||(e=i.name),i=null,n===this.args.length&&(i=e)),null!==i)break;return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function qy(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function $y(t,e,i,n){return 0===n.compare(e,i)}function By(t,e,i){const n="=="!==t&&"!="!==t;return class r{constructor(t,e,i){this.type=hm,this.lhs=t,this.rhs=e,this.collator=i,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const i=t[0];let s=e.parse(t[1],1,fm);if(!s)return null;if(!qy(i,s.type))return e.concat(1).error(`"${i}" comparisons are not supported for type '${bm(s.type)}'.`);let o=e.parse(t[2],2,fm);if(!o)return null;if(!qy(i,o.type))return e.concat(2).error(`"${i}" comparisons are not supported for type '${bm(o.type)}'.`);if(s.type.kind!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error(`Cannot compare types '${bm(s.type)}' and '${bm(o.type)}'.`);n&&("value"===s.type.kind&&"value"!==o.type.kind?s=new yy(o.type,[s]):"value"!==s.type.kind&&"value"===o.type.kind&&(o=new yy(s.type,[o])));let a=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error("Cannot use collator to compare non-string types.");if(a=e.parse(t[3],3,pm),!a)return null}return new r(s,o,a)}evaluate(r){const s=this.lhs.evaluate(r),o=this.rhs.evaluate(r);if(n&&this.hasUntypedArgument){const e=fy(s),i=fy(o);if(e.kind!==i.kind||"string"!==e.kind&&"number"!==e.kind)throw new oy(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${i.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const t=fy(s),i=fy(o);if("string"!==t.kind||"string"!==i.kind)return e(r,s,o)}return this.collator?i(r,s,o,this.collator.evaluate(r)):e(r,s,o)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}const Uy=By("==",function(t,e,i){return e===i},$y),Wy=By("!=",function(t,e,i){return e!==i},function(t,e,i,n){return!$y(0,e,i,n)}),Xy=By("<",function(t,e,i){return e<i},function(t,e,i,n){return n.compare(e,i)<0}),Vy=By(">",function(t,e,i){return e>i},function(t,e,i,n){return n.compare(e,i)>0}),Ky=By("<=",function(t,e,i){return e<=i},function(t,e,i,n){return n.compare(e,i)<=0}),Yy=By(">=",function(t,e,i){return e>=i},function(t,e,i,n){return n.compare(e,i)>=0});class Zy{constructor(t,e,i){this.type=pm,this.locale=i,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(2!==t.length)return e.error("Expected one argument.");const i=t[1];if("object"!=typeof i||Array.isArray(i))return e.error("Collator options argument must be an object.");const n=e.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,hm);if(!n)return null;const r=e.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,hm);if(!r)return null;let s=null;return i.locale&&(s=e.parse(i.locale,1,lm),!s)?null:new Zy(n,r,s)}evaluate(t){return new Qm(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class Hy{constructor(t,e,i,n,r,s){this.type=lm,this.number=t,this.locale=e,this.currency=i,this.unit=n,this.minFractionDigits=r,this.maxFractionDigits=s}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,am);if(!i)return null;const n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");let r=null;if(n.locale&&(r=e.parse(n.locale,1,lm),!r))return null;let s=null;if(n.currency&&(s=e.parse(n.currency,1,lm),!s))return null;let o=null;if(n.unit&&(o=e.parse(n.unit,1,lm),!o))return null;if(s&&o)return e.error("NumberFormat options `currency` and `unit` are mutually exclusive");let a=null;if(n["min-fraction-digits"]&&(a=e.parse(n["min-fraction-digits"],1,am),!a))return null;let l=null;return n["max-fraction-digits"]&&(l=e.parse(n["max-fraction-digits"],1,am),!l)?null:new Hy(i,r,s,o,a,l)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class Jy{constructor(t){this.type=gm,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[1];if(!Array.isArray(i)&&"object"==typeof i)return e.error("First argument must be an image or text section.");const n=[];let r=!1;for(let i=1;i<=t.length-1;++i){const s=t[i];if(r&&"object"==typeof s&&!Array.isArray(s)){r=!1;let t=null;if(s["font-scale"]&&(t=e.parse(s["font-scale"],1,am),!t))return null;let i=null;if(s["text-font"]&&(i=e.parse(s["text-font"],1,wm(lm)),!i))return null;let o=null;if(s["text-color"]&&(o=e.parse(s["text-color"],1,um),!o))return null;let a=null;if(s["vertical-align"]){if("string"==typeof s["vertical-align"]&&!ty.includes(s["vertical-align"]))return e.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${s["vertical-align"]}' instead.`);if(a=e.parse(s["vertical-align"],1,lm),!a)return null}const l=n[n.length-1];l.scale=t,l.font=i,l.textColor=o,l.verticalAlign=a}else{const s=e.parse(t[i],1,fm);if(!s)return null;const o=s.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");r=!0,n.push({content:s,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Jy(n)}evaluate(t){return new iy(this.sections.map(e=>{const i=e.content.evaluate(t);return fy(i)===vm?new ey("",i,null,null,null,e.verticalAlign?e.verticalAlign.evaluate(t):null):new ey(py(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null,e.verticalAlign?e.verticalAlign.evaluate(t):null)}))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor),e.verticalAlign&&t(e.verticalAlign)}outputDefined(){return!1}}class Qy{constructor(t){this.type=vm,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,lm);return i?new Qy(i):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),i=hy.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}}class t_{constructor(t){this.type=am,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const i=e.parse(t[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?e.error(`Expected argument of type string or array, but found ${bm(i.type)} instead.`):new t_(i):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return[...e].length;if(Array.isArray(e))return e.length;throw new oy(`Expected value to be of type string or array, but found ${bm(fy(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const e_=8192;function i_(t,e){const i=(180+t[0])/360,n=(r=t[1],(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360);var r;const s=Math.pow(2,e.z);return[Math.round(i*s*e_),Math.round(n*s*e_)]}function n_(t,e){const i=Math.pow(2,e.z);return[(r=(t[0]/e_+e.x)/i,360*r-180),(n=(t[1]/e_+e.y)/i,360/Math.PI*Math.atan(Math.exp((180-360*n)*Math.PI/180))-90)];var n,r}function r_(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function s_(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function o_(t,e,i){return e[1]>t[1]!=i[1]>t[1]&&t[0]<(i[0]-e[0])*(t[1]-e[1])/(i[1]-e[1])+e[0]}function a_(t,e,i){const n=t[0]-e[0],r=t[1]-e[1],s=t[0]-i[0],o=t[1]-i[1];return n*o-s*r===0&&n*s<=0&&r*o<=0}function l_(t,e,i,n){const r=[e[0]-t[0],e[1]-t[1]];return 0!==(s=[n[0]-i[0],n[1]-i[1]])[0]*(o=r)[1]-s[1]*o[0]&&!(!p_(t,e,i,n)||!p_(i,n,t,e));var s,o}function h_(t,e,i){for(const n of i)for(let i=0;i<n.length-1;++i)if(l_(t,e,n[i],n[i+1]))return!0;return!1}function u_(t,e,i=!1){let n=!1;for(const r of e)for(let e=0;e<r.length-1;e++){if(a_(t,r[e],r[e+1]))return i;o_(t,r[e],r[e+1])&&(n=!n)}return n}function c_(t,e){for(const i of e)if(u_(t,i))return!0;return!1}function d_(t,e){for(const i of t)if(!u_(i,e))return!1;for(let i=0;i<t.length-1;++i)if(h_(t[i],t[i+1],e))return!1;return!0}function f_(t,e){for(const i of e)if(d_(t,i))return!0;return!1}function p_(t,e,i,n){const r=t[0]-i[0],s=t[1]-i[1],o=e[0]-i[0],a=e[1]-i[1],l=n[0]-i[0],h=n[1]-i[1],u=r*h-l*s,c=o*h-l*a;return u>0&&c<0||u<0&&c>0}function g_(t,e,i){const n=[];for(let r=0;r<t.length;r++){const s=[];for(let n=0;n<t[r].length;n++){const o=i_(t[r][n],i);r_(e,o),s.push(o)}n.push(s)}return n}function m_(t,e,i){const n=[];for(let r=0;r<t.length;r++){const s=g_(t[r],e,i);n.push(s)}return n}function y_(t,e,i,n){if(t[0]<i[0]||t[0]>i[2]){const e=.5*n;let r=t[0]-i[0]>e?-n:i[0]-t[0]>e?n:0;0===r&&(r=t[0]-i[2]>e?-n:i[2]-t[0]>e?n:0),t[0]+=r}r_(e,t)}function __(t,e,i,n){const r=Math.pow(2,n.z)*e_,s=[n.x*e_,n.y*e_],o=[];for(const n of t)for(const t of n){const n=[t.x+s[0],t.y+s[1]];y_(n,e,i,r),o.push(n)}return o}function v_(t,e,i,n){const r=Math.pow(2,n.z)*e_,s=[n.x*e_,n.y*e_],o=[];for(const i of t){const t=[];for(const n of i){const i=[n.x+s[0],n.y+s[1]];r_(e,i),t.push(i)}o.push(t)}if(e[2]-e[0]<=r/2){(a=e)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const t of o)for(const n of t)y_(n,e,i,r)}var a;return o}class x_{constructor(t,e){this.type=hm,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(dy(t[1])){const e=t[1];if("FeatureCollection"===e.type){const t=[];for(const i of e.features){const{type:e,coordinates:n}=i.geometry;"Polygon"===e&&t.push(n),"MultiPolygon"===e&&t.push(...n)}if(t.length)return new x_(e,{type:"MultiPolygon",coordinates:t})}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new x_(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new x_(e,e)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],r=t.canonicalID();if("Polygon"===e.type){const s=g_(e.coordinates,n,r),o=__(t.geometry(),i,n,r);if(!s_(i,n))return!1;for(const t of o)if(!u_(t,s))return!1}if("MultiPolygon"===e.type){const s=m_(e.coordinates,n,r),o=__(t.geometry(),i,n,r);if(!s_(i,n))return!1;for(const t of o)if(!c_(t,s))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],r=t.canonicalID();if("Polygon"===e.type){const s=g_(e.coordinates,n,r),o=v_(t.geometry(),i,n,r);if(!s_(i,n))return!1;for(const t of o)if(!d_(t,s))return!1}if("MultiPolygon"===e.type){const s=m_(e.coordinates,n,r),o=v_(t.geometry(),i,n,r);if(!s_(i,n))return!1;for(const t of o)if(!f_(t,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class w_{constructor(t=[],e=(t,e)=>t<e?-1:t>e?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:i}=this,n=e[t];for(;t>0;){const r=t-1>>1,s=e[r];if(i(n,s)>=0)break;e[t]=s,t=r}e[t]=n}_down(t){const{data:e,compare:i}=this,n=this.length>>1,r=e[t];for(;t<n;){let n=1+(t<<1);const s=n+1;if(s<this.length&&i(e[s],e[n])<0&&(n=s),i(e[n],r)>=0)break;e[t]=e[n],t=n}e[t]=r}}function b_(t){let e=0;for(let i,n,r=0,s=t.length,o=s-1;r<s;o=r++)i=t[r],n=t[o],e+=(n.x-i.x)*(i.y+n.y);return e}const S_=1/298.257223563,M_=S_*(2-S_),E_=Math.PI/180;class C_{constructor(t){const e=6378.137*E_*1e3,i=Math.cos(t*E_),n=1/(1-M_*(1-i*i)),r=Math.sqrt(n);this.kx=e*r*i,this.ky=e*r*n*(1-M_)}distance(t,e){const i=this.wrap(t[0]-e[0])*this.kx,n=(t[1]-e[1])*this.ky;return Math.sqrt(i*i+n*n)}pointOnLine(t,e){let i,n,r,s,o=1/0;for(let a=0;a<t.length-1;a++){let l=t[a][0],h=t[a][1],u=this.wrap(t[a+1][0]-l)*this.kx,c=(t[a+1][1]-h)*this.ky,d=0;0===u&&0===c||(d=(this.wrap(e[0]-l)*this.kx*u+(e[1]-h)*this.ky*c)/(u*u+c*c),d>1?(l=t[a+1][0],h=t[a+1][1]):d>0&&(l+=u/this.kx*d,h+=c/this.ky*d)),u=this.wrap(e[0]-l)*this.kx,c=(e[1]-h)*this.ky;const f=u*u+c*c;f<o&&(o=f,i=l,n=h,r=a,s=d)}return{point:[i,n],index:r,t:Math.max(0,Math.min(1,s))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function P_(t,e){return e[0]-t[0]}function I_(t){return t[1]-t[0]+1}function T_(t,e){return t[1]>=t[0]&&t[1]<e}function R_(t,e){if(t[0]>t[1])return[null,null];const i=I_(t);if(e){if(2===i)return[t,null];const e=Math.floor(i/2);return[[t[0],t[0]+e],[t[0]+e,t[1]]]}if(1===i)return[t,null];const n=Math.floor(i/2)-1;return[[t[0],t[0]+n],[t[0]+n+1,t[1]]]}function k_(t,e){if(!T_(e,t.length))return[1/0,1/0,-1/0,-1/0];const i=[1/0,1/0,-1/0,-1/0];for(let n=e[0];n<=e[1];++n)r_(i,t[n]);return i}function A_(t){const e=[1/0,1/0,-1/0,-1/0];for(const i of t)for(const t of i)r_(e,t);return e}function G_(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function O_(t,e,i){if(!G_(t)||!G_(e))return NaN;let n=0,r=0;return t[2]<e[0]&&(n=e[0]-t[2]),t[0]>e[2]&&(n=t[0]-e[2]),t[1]>e[3]&&(r=t[1]-e[3]),t[3]<e[1]&&(r=e[1]-t[3]),i.distance([0,0],[n,r])}function F_(t,e,i){const n=i.pointOnLine(e,t);return i.distance(t,n.point)}function L_(t,e,i,n,r){const s=Math.min(F_(t,[i,n],r),F_(e,[i,n],r)),o=Math.min(F_(i,[t,e],r),F_(n,[t,e],r));return Math.min(s,o)}function j_(t,e,i,n,r){if(!T_(e,t.length)||!T_(n,i.length))return 1/0;let s=1/0;for(let o=e[0];o<e[1];++o){const e=t[o],a=t[o+1];for(let t=n[0];t<n[1];++t){const n=i[t],o=i[t+1];if(l_(e,a,n,o))return 0;s=Math.min(s,L_(e,a,n,o,r))}}return s}function N_(t,e,i,n,r){if(!T_(e,t.length)||!T_(n,i.length))return NaN;let s=1/0;for(let o=e[0];o<=e[1];++o)for(let e=n[0];e<=n[1];++e)if(s=Math.min(s,r.distance(t[o],i[e])),0===s)return s;return s}function D_(t,e,i){if(u_(t,e,!0))return 0;let n=1/0;for(const r of e){const e=r[0],s=r[r.length-1];if(e!==s&&(n=Math.min(n,F_(t,[s,e],i)),0===n))return n;const o=i.pointOnLine(r,t);if(n=Math.min(n,i.distance(t,o.point)),0===n)return n}return n}function z_(t,e,i,n){if(!T_(e,t.length))return NaN;for(let n=e[0];n<=e[1];++n)if(u_(t[n],i,!0))return 0;let r=1/0;for(let s=e[0];s<e[1];++s){const e=t[s],o=t[s+1];for(const t of i)for(let i=0,s=t.length,a=s-1;i<s;a=i++){const s=t[a],l=t[i];if(l_(e,o,s,l))return 0;r=Math.min(r,L_(e,o,s,l,n))}}return r}function q_(t,e){for(const i of t)for(const t of i)if(u_(t,e,!0))return!0;return!1}function $_(t,e,i,n=1/0){const r=A_(t),s=A_(e);if(n!==1/0&&O_(r,s,i)>=n)return n;if(s_(r,s)){if(q_(t,e))return 0}else if(q_(e,t))return 0;let o=1/0;for(const n of t)for(let t=0,r=n.length,s=r-1;t<r;s=t++){const r=n[s],a=n[t];for(const t of e)for(let e=0,n=t.length,s=n-1;e<n;s=e++){const n=t[s],l=t[e];if(l_(r,a,n,l))return 0;o=Math.min(o,L_(r,a,n,l,i))}}return o}function B_(t,e,i,n,r,s){if(!s)return;const o=O_(k_(n,s),r,i);o<e&&t.push([o,s,[0,0]])}function U_(t,e,i,n,r,s,o){if(!s||!o)return;const a=O_(k_(n,s),k_(r,o),i);a<e&&t.push([a,s,o])}function W_(t,e,i,n,r=1/0){let s=Math.min(n.distance(t[0],i[0][0]),r);if(0===s)return s;const o=new w_([[0,[0,t.length-1],[0,0]]],P_),a=A_(i);for(;o.length>0;){const r=o.pop();if(r[0]>=s)continue;const l=r[1],h=e?50:100;if(I_(l)<=h){if(!T_(l,t.length))return NaN;if(e){const e=z_(t,l,i,n);if(isNaN(e)||0===e)return e;s=Math.min(s,e)}else for(let e=l[0];e<=l[1];++e){const r=D_(t[e],i,n);if(s=Math.min(s,r),0===s)return 0}}else{const i=R_(l,e);B_(o,s,n,t,a,i[0]),B_(o,s,n,t,a,i[1])}}return s}function X_(t,e,i,n,r,s=1/0){let o=Math.min(s,r.distance(t[0],i[0]));if(0===o)return o;const a=new w_([[0,[0,t.length-1],[0,i.length-1]]],P_);for(;a.length>0;){const s=a.pop();if(s[0]>=o)continue;const l=s[1],h=s[2],u=e?50:100,c=n?50:100;if(I_(l)<=u&&I_(h)<=c){if(!T_(l,t.length)&&T_(h,i.length))return NaN;let s;if(e&&n)s=j_(t,l,i,h,r),o=Math.min(o,s);else if(e&&!n){const e=t.slice(l[0],l[1]+1);for(let t=h[0];t<=h[1];++t)if(s=F_(i[t],e,r),o=Math.min(o,s),0===o)return o}else if(!e&&n){const e=i.slice(h[0],h[1]+1);for(let i=l[0];i<=l[1];++i)if(s=F_(t[i],e,r),o=Math.min(o,s),0===o)return o}else s=N_(t,l,i,h,r),o=Math.min(o,s)}else{const s=R_(l,e),u=R_(h,n);U_(a,o,r,t,i,s[0],u[0]),U_(a,o,r,t,i,s[0],u[1]),U_(a,o,r,t,i,s[1],u[0]),U_(a,o,r,t,i,s[1],u[1])}}return o}function V_(t){return"MultiPolygon"===t.type?t.coordinates.map(t=>({type:"Polygon",coordinates:t})):"MultiLineString"===t.type?t.coordinates.map(t=>({type:"LineString",coordinates:t})):"MultiPoint"===t.type?t.coordinates.map(t=>({type:"Point",coordinates:t})):[t]}class K_{constructor(t,e){this.type=am,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(dy(t[1])){const e=t[1];if("FeatureCollection"===e.type)return new K_(e,e.features.map(t=>V_(t.geometry)).flat());if("Feature"===e.type)return new K_(e,V_(e.geometry));if("type"in e&&"coordinates"in e)return new K_(e,V_(e))}return e.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const i=t.geometry(),n=i.flat().map(e=>n_([e.x,e.y],t.canonical));if(0===i.length)return NaN;const r=new C_(n[0][1]);let s=1/0;for(const t of e){switch(t.type){case"Point":s=Math.min(s,X_(n,!1,[t.coordinates],!1,r,s));break;case"LineString":s=Math.min(s,X_(n,!1,t.coordinates,!0,r,s));break;case"Polygon":s=Math.min(s,W_(n,!1,t.coordinates,r,s))}if(0===s)return s}return s}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const i=t.geometry(),n=i.flat().map(e=>n_([e.x,e.y],t.canonical));if(0===i.length)return NaN;const r=new C_(n[0][1]);let s=1/0;for(const t of e){switch(t.type){case"Point":s=Math.min(s,X_(n,!0,[t.coordinates],!1,r,s));break;case"LineString":s=Math.min(s,X_(n,!0,t.coordinates,!0,r,s));break;case"Polygon":s=Math.min(s,W_(n,!0,t.coordinates,r,s))}if(0===s)return s}return s}(t,this.geometries);if("Polygon"===t.geometryType())return function(t,e){const i=t.geometry();if(0===i.length||0===i[0].length)return NaN;const n=function(t){if(t.length<=1)return[t];const e=[];let i,n;for(const r of t){const t=b_(r);0!==t&&(r.area=Math.abs(t),void 0===n&&(n=t<0),n===t<0?(i&&e.push(i),i=[r]):i.push(r))}return i&&e.push(i),e}(i).map(e=>e.map(e=>e.map(e=>n_([e.x,e.y],t.canonical)))),r=new C_(n[0][0][0][1]);let s=1/0;for(const t of e)for(const e of n){switch(t.type){case"Point":s=Math.min(s,W_([t.coordinates],!1,e,r,s));break;case"LineString":s=Math.min(s,W_(t.coordinates,!0,e,r,s));break;case"Polygon":s=Math.min(s,$_(e,t.coordinates,r,s))}if(0===s)return s}return s}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Y_{constructor(t){this.type=fm,this.key=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const i=t[1];return null==i?e.error("Global state property must be defined."):"string"!=typeof i?e.error(`Global state property must be string, but found ${typeof t[1]} instead.`):new Y_(i)}evaluate(t){var e;const i=null===(e=t.globals)||void 0===e?void 0:e.globalState;return i&&0!==Object.keys(i).length?Um(i,this.key):null}eachChild(){}outputDefined(){return!1}}const Z_={"==":Uy,"!=":Wy,">":Vy,"<":Xy,">=":Yy,"<=":Ky,array:yy,at:Ey,boolean:yy,case:Ty,coalesce:zy,collator:Zy,format:Jy,image:Qy,in:Cy,"index-of":Py,interpolate:Ny,"interpolate-hcl":Ny,"interpolate-lab":Ny,length:t_,let:Sy,literal:gy,match:Iy,number:yy,"number-format":Hy,object:yy,slice:Ry,step:Ay,string:yy,"to-boolean":vy,"to-color":vy,"to-number":vy,"to-string":vy,var:My,within:x_,distance:K_,"global-state":Y_};class H_{constructor(t,e,i,n){this.name=t,this.type=e,this._evaluate=i,this.args=n}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,e){const i=t[0],n=H_.definitions[i];if(!n)return e.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const r=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,o=s.filter(([e])=>!Array.isArray(e)||e.length===t.length-1);let a=null;for(const[n,s]of o){a=new by(e.registry,iv,e.path,null,e.scope);const o=[];let l=!1;for(let e=1;e<t.length;e++){const i=t[e],r=Array.isArray(n)?n[e-1]:n.type,s=a.parse(i,1+o.length,r);if(!s){l=!0;break}o.push(s)}if(!l)if(Array.isArray(n)&&n.length!==o.length)a.error(`Expected ${n.length} arguments, but found ${o.length} instead.`);else{for(let t=0;t<o.length;t++){const e=Array.isArray(n)?n[t]:n.type,i=o[t];a.concat(t+1).checkSubtype(e,i.type)}if(0===a.errors.length)return new H_(i,r,s,o)}}if(1===o.length)e.errors.push(...a.errors);else{const i=(o.length?o:s).map(([t])=>{return e=t,Array.isArray(e)?`(${e.map(bm).join(", ")})`:`(${bm(e.type)}...)`;var e}).join(" | "),n=[];for(let i=1;i<t.length;i++){const r=e.parse(t[i],1+n.length);if(!r)return null;n.push(bm(r.type))}e.error(`Expected arguments of type ${i}, but found (${n.join(", ")}) instead.`)}return null}static register(t,e){H_.definitions=e;for(const i in e)t[i]=H_}}function J_(t,[e,i,n,r]){e=e.evaluate(t),i=i.evaluate(t),n=n.evaluate(t);const s=r?r.evaluate(t):1,o=cy(e,i,n,s);if(o)throw new oy(o);return new Jm(e/255,i/255,n/255,s,!1)}function Q_(t,e){return t in e}function tv(t,e){const i=e[t];return void 0===i?null:i}function ev(t){return{type:t}}function iv(t){if(t instanceof My)return iv(t.boundExpression);if(t instanceof H_&&"error"===t.name)return!1;if(t instanceof Zy)return!1;if(t instanceof x_)return!1;if(t instanceof K_)return!1;if(t instanceof Y_)return!1;const e=t instanceof vy||t instanceof yy;let i=!0;return t.eachChild(t=>{i=e?i&&iv(t):i&&t instanceof gy}),!!i&&nv(t)&&sv(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function nv(t){if(t instanceof H_){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof x_)return!1;if(t instanceof K_)return!1;let e=!0;return t.eachChild(t=>{e&&!nv(t)&&(e=!1)}),e}function rv(t){if(t instanceof H_&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild(t=>{e&&!rv(t)&&(e=!1)}),e}function sv(t,e){if(t instanceof H_&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild(t=>{i&&!sv(t,e)&&(i=!1)}),i}function ov(t){return{result:"success",value:t}}function av(t){return{result:"error",value:t}}function lv(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function hv(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function uv(t){return!!t.expression&&t.expression.interpolated}function cv(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function dv(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)&&fy(t)===dm}H_.register(Z_,{error:[{kind:"error"},[lm],(t,[e])=>{throw new oy(e.evaluate(t))}],typeof:[lm,[fm],(t,[e])=>bm(fy(e.evaluate(t)))],"to-rgba":[wm(am,4),[um],(t,[e])=>{const[i,n,r,s]=e.evaluate(t).rgb;return[255*i,255*n,255*r,s]}],rgb:[um,[am,am,am],J_],rgba:[um,[am,am,am,am],J_],has:{type:hm,overloads:[[[lm],(t,[e])=>Q_(e.evaluate(t),t.properties())],[[lm,dm],(t,[e,i])=>Q_(e.evaluate(t),i.evaluate(t))]]},get:{type:fm,overloads:[[[lm],(t,[e])=>tv(e.evaluate(t),t.properties())],[[lm,dm],(t,[e,i])=>tv(e.evaluate(t),i.evaluate(t))]]},"feature-state":[fm,[lm],(t,[e])=>tv(e.evaluate(t),t.featureState||{})],properties:[dm,[],t=>t.properties()],"geometry-type":[lm,[],t=>t.geometryType()],id:[fm,[],t=>t.id()],zoom:[am,[],t=>t.globals.zoom],"heatmap-density":[am,[],t=>t.globals.heatmapDensity||0],elevation:[am,[],t=>t.globals.elevation||0],"line-progress":[am,[],t=>t.globals.lineProgress||0],accumulated:[fm,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[am,ev(am),(t,e)=>{let i=0;for(const n of e)i+=n.evaluate(t);return i}],"*":[am,ev(am),(t,e)=>{let i=1;for(const n of e)i*=n.evaluate(t);return i}],"-":{type:am,overloads:[[[am,am],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[am],(t,[e])=>-e.evaluate(t)]]},"/":[am,[am,am],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[am,[am,am],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[am,[],()=>Math.LN2],pi:[am,[],()=>Math.PI],e:[am,[],()=>Math.E],"^":[am,[am,am],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[am,[am],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[am,[am],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[am,[am],(t,[e])=>Math.log(e.evaluate(t))],log2:[am,[am],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[am,[am],(t,[e])=>Math.sin(e.evaluate(t))],cos:[am,[am],(t,[e])=>Math.cos(e.evaluate(t))],tan:[am,[am],(t,[e])=>Math.tan(e.evaluate(t))],asin:[am,[am],(t,[e])=>Math.asin(e.evaluate(t))],acos:[am,[am],(t,[e])=>Math.acos(e.evaluate(t))],atan:[am,[am],(t,[e])=>Math.atan(e.evaluate(t))],min:[am,ev(am),(t,e)=>Math.min(...e.map(e=>e.evaluate(t)))],max:[am,ev(am),(t,e)=>Math.max(...e.map(e=>e.evaluate(t)))],abs:[am,[am],(t,[e])=>Math.abs(e.evaluate(t))],round:[am,[am],(t,[e])=>{const i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[am,[am],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[am,[am],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[hm,[lm,fm],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[hm,[fm],(t,[e])=>t.id()===e.value],"filter-type-==":[hm,[lm],(t,[e])=>t.geometryType()===e.value],"filter-<":[hm,[lm,fm],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n<r}],"filter-id-<":[hm,[fm],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<n}],"filter->":[hm,[lm,fm],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>r}],"filter-id->":[hm,[fm],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>n}],"filter-<=":[hm,[lm,fm],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n<=r}],"filter-id-<=":[hm,[fm],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<=n}],"filter->=":[hm,[lm,fm],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>=r}],"filter-id->=":[hm,[fm],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>=n}],"filter-has":[hm,[fm],(t,[e])=>e.value in t.properties()],"filter-has-id":[hm,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[hm,[wm(lm)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[hm,[wm(fm)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[hm,[lm,wm(fm)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[hm,[lm,wm(fm)],(t,[e,i])=>function(t,e,i,n){for(;i<=n;){const r=i+n>>1;if(e[r]===t)return!0;e[r]>t?n=r-1:i=r+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:hm,overloads:[[[hm,hm],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[ev(hm),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:hm,overloads:[[[hm,hm],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[ev(hm),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[hm,[hm],(t,[e])=>!e.evaluate(t)],"is-supported-script":[hm,[lm],(t,[e])=>{const i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[lm,[lm],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[lm,[lm],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[lm,ev(fm),(t,e)=>e.map(e=>py(e.evaluate(t))).join("")],split:[wm(lm),[lm,lm],(t,[e,i])=>e.evaluate(t).split(i.evaluate(t))],join:[lm,[wm(lm),lm],(t,[e,i])=>e.evaluate(t).join(i.evaluate(t))],"resolved-locale":[lm,[pm],(t,[e])=>e.evaluate(t).resolvedLocale()]});class fv{constructor(t,e,i){this.expression=t,this._warningHistory={},this._evaluator=new wy,this._defaultValue=e?function(t){if("color"===t.type&&dv(t.default))return new Jm(0,0,0,0);switch(t.type){case"color":return Jm.parse(t.default)||null;case"padding":return ny.parse(t.default)||null;case"numberArray":return ry.parse(t.default)||null;case"colorArray":return sy.parse(t.default)||null;case"variableAnchorOffsetCollection":return ly.parse(t.default)||null;case"projectionDefinition":return uy.parse(t.default)||null;default:return void 0===t.default?null:t.default}}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null,this._globalState=i}evaluateWithoutErrorHandling(t,e,i,n,r,s){return this._globalState&&(t=wv(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=n,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=s,this.expression.evaluate(this._evaluator)}evaluate(t,e,i,n,r,s){this._globalState&&(t=wv(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=n,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=s||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new oy(`Expected value to be one of ${Object.keys(this._enumValues).map(t=>JSON.stringify(t)).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function pv(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in Z_}function gv(t,e,i){const n=new by(Z_,iv,[],e?function(t){const e={color:um,string:lm,number:am,enum:lm,boolean:hm,formatted:gm,padding:mm,numberArray:_m,colorArray:ym,projectionDefinition:cm,resolvedImage:vm,variableAnchorOffsetCollection:xm};return"array"===t.type?wm(e[t.value]||fm,t.length):e[t.type]}(e):void 0),r=n.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return r?ov(new fv(r,e,i)):av(n.errors)}class mv{constructor(t,e,i){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!rv(e.expression),this.globalStateRefs=xv(e.expression),this._globalState=i}evaluateWithoutErrorHandling(t,e,i,n,r,s){return this._globalState&&(t=wv(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,r,s)}evaluate(t,e,i,n,r,s){return this._globalState&&(t=wv(t,this._globalState)),this._styleExpression.evaluate(t,e,i,n,r,s)}}class yv{constructor(t,e,i,n,r){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!rv(e.expression),this.globalStateRefs=xv(e.expression),this.interpolationType=n,this._globalState=r}evaluateWithoutErrorHandling(t,e,i,n,r,s){return this._globalState&&(t=wv(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,r,s)}evaluate(t,e,i,n,r,s){return this._globalState&&(t=wv(t,this._globalState)),this._styleExpression.evaluate(t,e,i,n,r,s)}interpolationFactor(t,e,i){return this.interpolationType?Ny.interpolationFactor(this.interpolationType,t,e,i):0}}function _v(t,e,i){const n=gv(t,e,i);if("error"===n.result)return n;const r=n.value.expression,s=nv(r);if(!s&&!lv(e))return av([new rm("","data expressions not supported")]);const o=sv(r,["zoom"]);if(!o&&!hv(e))return av([new rm("","zoom expressions not supported")]);const a=vv(r);if(!a&&!o)return av([new rm("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(a instanceof rm)return av([a]);if(a instanceof Ny&&!uv(e))return av([new rm("",'"interpolate" expressions cannot be used with this property')]);if(!a)return ov(new mv(s?"constant":"source",n.value,i));const l=a instanceof Ny?a.interpolation:void 0;return ov(new yv(s?"camera":"composite",n.value,a.labels,l,i))}function vv(t){let e=null;if(t instanceof Sy)e=vv(t.result);else if(t instanceof zy){for(const i of t.args)if(e=vv(i),e)break}else(t instanceof Ay||t instanceof Ny)&&t.input instanceof H_&&"zoom"===t.input.name&&(e=t);return e instanceof rm||t.eachChild(t=>{const i=vv(t);i instanceof rm?e=i:!e&&i?e=new rm("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new rm("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function xv(t,e=new Set){return t instanceof Y_&&e.add(t.key),t.eachChild(t=>{xv(t,e)}),e}function wv(t,e){const{zoom:i,heatmapDensity:n,elevation:r,lineProgress:s,isSupportedScript:o,accumulated:a}=null!=t?t:{};return{zoom:i,heatmapDensity:n,elevation:r,lineProgress:s,isSupportedScript:o,accumulated:a,globalState:e}}function bv(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!bv(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const Sv={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Mv(t,e){return t<e?-1:t>e?1:0}function Ev(t){if(!Array.isArray(t))return!1;if("within"===t[0]||"distance"===t[0])return!0;for(let e=1;e<t.length;e++)if(Ev(t[e]))return!0;return!1}function Cv(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?Pv(t[1],t[2],"=="):"!="===e?Rv(Pv(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?Pv(t[1],t[2],e):"any"===e?(i=t.slice(1),["any"].concat(i.map(Cv))):"all"===e?["all"].concat(t.slice(1).map(Cv)):"none"===e?["all"].concat(t.slice(1).map(Cv).map(Rv)):"in"===e?Iv(t[1],t.slice(2)):"!in"===e?Rv(Iv(t[1],t.slice(2))):"has"===e?Tv(t[1]):"!has"!==e||Rv(Tv(t[1]));var i}function Pv(t,e,i){switch(t){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,t,e]}}function Iv(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(t=>typeof t!=typeof e[0])?["filter-in-large",t,["literal",e.sort(Mv)]]:["filter-in-small",t,["literal",e]]}}function Tv(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Rv(t){return["!",t]}function kv(t){return"object"==typeof t?["literal",t]:t}function Av(t,e){let i=t.stops;if(!i)return function(t,e){const i=["get",t.property];if(void 0===t.default)return"string"===e.type?["string",i]:i;if("enum"===e.type)return["match",i,Object.keys(e.values),i,t.default];{const n=["color"===e.type?"to-color":e.type,i,kv(t.default)];return"array"===e.type&&n.splice(1,0,e.value,e.length||null),n}}(t,e);const n=i&&"object"==typeof i[0][0],r=n||void 0!==t.property,s=n||!r;return i=i.map(t=>!r&&e.tokens&&"string"==typeof t[1]?[t[0],Dv(t[1])]:[t[0],kv(t[1])]),n?function(t,e,i){const n={},r={},s=[];for(let e=0;e<i.length;e++){const o=i[e],a=o[0].zoom;void 0===n[a]&&(n[a]={zoom:a,type:t.type,property:t.property,default:t.default},r[a]=[],s.push(a)),r[a].push([o[0].value,o[1]])}if("exponential"===Nv({},e)){const i=[Gv(t),["linear"],["zoom"]];for(const t of s)jv(i,t,Fv(n[t],e,r[t]),!1);return i}{const t=["step",["zoom"]];for(const i of s)jv(t,i,Fv(n[i],e,r[i]),!0);return Lv(t),t}}(t,e,i):s?function(t,e,i,n=["zoom"]){const r=Nv(t,e);let s,o=!1;if("interval"===r)s=["step",n],o=!0;else{if("exponential"!==r)throw new Error(`Unknown zoom function type "${r}"`);{const e=void 0!==t.base?t.base:1;s=[Gv(t),1===e?["linear"]:["exponential",e],n]}}for(const t of i)jv(s,t[0],t[1],o);return Lv(s),s}(t,e,i):Fv(t,e,i)}function Gv(t){switch(t.colorSpace){case"hcl":return"interpolate-hcl";case"lab":return"interpolate-lab";default:return"interpolate"}}function Ov(t,e){const i=kv((n=t.default,r=e.default,void 0!==n?n:void 0!==r?r:void 0));var n,r;return void 0===i&&"resolvedImage"===e.type?"":i}function Fv(t,e,i){const n=Nv(t,e),r=["get",t.property];if("categorical"===n&&"boolean"==typeof i[0][0]){const n=["case"];for(const t of i)n.push(["==",r,t[0]],t[1]);return n.push(Ov(t,e)),n}if("categorical"===n){const n=["match",r];for(const t of i)jv(n,t[0],t[1],!1);return n.push(Ov(t,e)),n}if("interval"===n){const e=["step",["number",r]];for(const t of i)jv(e,t[0],t[1],!0);return Lv(e),void 0===t.default?e:["case",["==",["typeof",r],"number"],e,kv(t.default)]}if("exponential"===n){const e=void 0!==t.base?t.base:1,n=[Gv(t),1===e?["linear"]:["exponential",e],["number",r]];for(const t of i)jv(n,t[0],t[1],!1);return void 0===t.default?n:["case",["==",["typeof",r],"number"],n,kv(t.default)]}throw new Error(`Unknown property function type ${n}`)}function Lv(t){"step"===t[0]&&3===t.length&&(t.push(0),t.push(t[3]))}function jv(t,e,i,n){t.length>3&&e===t[t.length-2]||(n&&2===t.length||t.push(e),t.push(i))}function Nv(t,e){return t.type?t.type:e.expression.interpolated?"exponential":"interval"}function Dv(t){const e=["concat"],i=/{([^{}]+)}/g;let n=0;for(let r=i.exec(t);null!==r;r=i.exec(t)){const s=t.slice(n,i.lastIndex-r[0].length);n=i.lastIndex,s.length>0&&e.push(s),e.push(["get",r[1]])}if(1===e.length)return t;if(n<t.length)e.push(t.slice(n));else if(2===e.length)return["to-string",e[1]];return e}function zv(t){const e=t.key,i=t.value;return i?[new im(e,i,"constants have been deprecated as of v8")]:[]}function qv(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function $v(t){if(Array.isArray(t))return t.map($v);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const i in t)e[i]=$v(t[i]);return e}return qv(t)}function Bv(t){const e=t.key,i=t.value,n=t.valueSpec||{},r=t.objectElementValidators||{},s=t.style,o=t.styleSpec,a=t.validateSpec;let l=[];const h=cv(i);if("object"!==h)return[new im(e,i,`object expected, ${h} found`)];for(const t in i){const h=t.split(".")[0],u=Um(n,h)||n["*"];let c;if(Um(r,h))c=r[h];else if(Um(n,h)){if(void 0===i[t])continue;c=a}else if(r["*"])c=r["*"];else{if(!n["*"]){l.push(new im(e,i[t],`unknown property "${t}"`));continue}c=a}l=l.concat(c({key:(e?`${e}.`:e)+t,value:i[t],valueSpec:u,style:s,styleSpec:o,object:i,objectKey:t,validateSpec:a},i))}for(const t in n)r[t]||n[t].required&&void 0===n[t].default&&void 0===i[t]&&l.push(new im(e,i,`missing required property "${t}"`));return l}function Uv(t){const e=t.value,i=t.valueSpec,n=t.validateSpec,r=t.style,s=t.styleSpec,o=t.key,a=t.arrayElementValidator||n;if("array"!==cv(e))return[new im(o,e,`array expected, ${cv(e)} found`)];if(i.length&&e.length!==i.length)return[new im(o,e,`array length ${i.length} expected, length ${e.length} found`)];let l={type:i.value,values:i.values};s.$version<7&&(l.function=i.function),"object"===cv(i.value)&&(l=i.value);let h=[];for(let i=0;i<e.length;i++)h=h.concat(a({array:e,arrayIndex:i,value:e[i],valueSpec:l,validateSpec:t.validateSpec,style:r,styleSpec:s,key:`${o}[${i}]`}));return h}function Wv(t){const e=t.key,i=t.value,n=t.valueSpec;let r=cv(i);return"number"===r&&i!=i&&(r="NaN"),"number"!==r?[new im(e,i,`number expected, ${r} found`)]:"minimum"in n&&i<n.minimum?[new im(e,i,`${i} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&i>n.maximum?[new im(e,i,`${i} is greater than the maximum value ${n.maximum}`)]:[]}function Xv(t){const e=t.valueSpec,i=qv(t.value.type);let n,r,s,o={};const a="categorical"!==i&&void 0===t.value.property,l=!a,h="array"===cv(t.value.stops)&&"array"===cv(t.value.stops[0])&&"object"===cv(t.value.stops[0][0]),u=Bv({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===i)return[new im(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const n=t.value;return e=e.concat(Uv({key:t.key,value:n,valueSpec:t.valueSpec,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:c})),"array"===cv(n)&&0===n.length&&e.push(new im(t.key,n,"array must have at least one stop")),e},default:function(t){return t.validateSpec({key:t.key,value:t.value,valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===i&&a&&u.push(new im(t.key,t.value,'missing required property "property"')),"identity"===i||t.value.stops||u.push(new im(t.key,t.value,'missing required property "stops"')),"exponential"===i&&t.valueSpec.expression&&!uv(t.valueSpec)&&u.push(new im(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!lv(t.valueSpec)?u.push(new im(t.key,t.value,"property functions not supported")):a&&!hv(t.valueSpec)&&u.push(new im(t.key,t.value,"zoom functions not supported"))),"categorical"!==i&&!h||void 0!==t.value.property||u.push(new im(t.key,t.value,'"property" property is required')),u;function c(t){let i=[];const n=t.value,a=t.key;if("array"!==cv(n))return[new im(a,n,`array expected, ${cv(n)} found`)];if(2!==n.length)return[new im(a,n,`array length 2 expected, length ${n.length} found`)];if(h){if("object"!==cv(n[0]))return[new im(a,n,`object expected, ${cv(n[0])} found`)];if(void 0===n[0].zoom)return[new im(a,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new im(a,n,"object stop key must have value")];if(s&&s>qv(n[0].zoom))return[new im(a,n[0].zoom,"stop zoom values must appear in ascending order")];qv(n[0].zoom)!==s&&(s=qv(n[0].zoom),r=void 0,o={}),i=i.concat(Bv({key:`${a}[0]`,value:n[0],valueSpec:{zoom:{}},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Wv,value:d}}))}else i=i.concat(d({key:`${a}[0]`,value:n[0],validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec},n));return pv($v(n[1]))?i.concat([new im(`${a}[1]`,n[1],"expressions are not allowed in function stops.")]):i.concat(t.validateSpec({key:`${a}[1]`,value:n[1],valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec}))}function d(t,s){const a=cv(t.value),l=qv(t.value),h=null!==t.value?t.value:s;if(n){if(a!==n)return[new im(t.key,h,`${a} stop domain type must match previous stop domain type ${n}`)]}else n=a;if("number"!==a&&"string"!==a&&"boolean"!==a)return[new im(t.key,h,"stop domain value must be a number, string, or boolean")];if("number"!==a&&"categorical"!==i){let n=`number expected, ${a} found`;return lv(e)&&void 0===i&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new im(t.key,h,n)]}return"categorical"!==i||"number"!==a||isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===a&&void 0!==r&&l<r?[new im(t.key,h,"stop domain values must appear in ascending order")]:(r=l,"categorical"===i&&l in o?[new im(t.key,h,"stop domain values must be unique")]:(o[l]=!0,[])):[new im(t.key,h,`integer expected, found ${l}`)]}}function Vv(t){const e=("property"===t.expressionContext?_v:gv)($v(t.value),t.valueSpec);if("error"===e.result)return e.value.map(e=>new im(`${t.key}${e.key}`,t.value,e.message));const i=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!i.outputDefined())return[new im(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!rv(i))return[new im(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!rv(i))return[new im(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!sv(i,["zoom","feature-state"]))return[new im(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!nv(i))return[new im(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Kv(t){const e=t.key,i=t.value,n=cv(i);return"string"!==n?[new im(e,i,`color expected, ${n} found`)]:Jm.parse(String(i))?[]:[new im(e,i,`color expected, "${i}" found`)]}function Yv(t){const e=t.key,i=t.value,n=t.valueSpec,r=[];return Array.isArray(n.values)?-1===n.values.indexOf(qv(i))&&r.push(new im(e,i,`expected one of [${n.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(n.values).indexOf(qv(i))&&r.push(new im(e,i,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(i)} found`)),r}function Zv(t){return bv($v(t.value))?Vv(nm({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Hv(t)}function Hv(t){const e=t.value,i=t.key;if("array"!==cv(e))return[new im(i,e,`array expected, ${cv(e)} found`)];const n=t.styleSpec;let r,s=[];if(e.length<1)return[new im(i,e,"filter array must have at least 1 element")];switch(s=s.concat(Yv({key:`${i}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),qv(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===qv(e[1])&&s.push(new im(i,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&s.push(new im(i,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(r=cv(e[1]),"string"!==r&&s.push(new im(`${i}[1]`,e[1],`string expected, ${r} found`)));for(let o=2;o<e.length;o++)r=cv(e[o]),"$type"===qv(e[1])?s=s.concat(Yv({key:`${i}[${o}]`,value:e[o],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==r&&"number"!==r&&"boolean"!==r&&s.push(new im(`${i}[${o}]`,e[o],`string, number, or boolean expected, ${r} found`));break;case"any":case"all":case"none":for(let n=1;n<e.length;n++)s=s.concat(Hv({key:`${i}[${n}]`,value:e[n],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":r=cv(e[1]),2!==e.length?s.push(new im(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):"string"!==r&&s.push(new im(`${i}[1]`,e[1],`string expected, ${r} found`))}return s}function Jv(t,e){const i=t.key,n=t.validateSpec,r=t.style,s=t.styleSpec,o=t.value,a=t.objectKey,l=s[`${e}_${t.layerType}`];if(!l)return[];const h=a.match(/^(.*)-transition$/);if("paint"===e&&h&&l[h[1]]&&l[h[1]].transition)return n({key:i,value:o,valueSpec:s.transition,style:r,styleSpec:s});const u=t.valueSpec||l[a];if(!u)return[new im(i,o,`unknown property "${a}"`)];let c;if("string"===cv(o)&&lv(u)&&!u.tokens&&(c=/^{([^}]+)}$/.exec(o)))return[new im(i,o,`"${a}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(c[1])} }\`.`)];const d=[];return"symbol"===t.layerType&&"text-font"===a&&dv($v(o))&&"identity"===qv(o.type)&&d.push(new im(i,o,'"text-font" does not support identity functions')),d.concat(n({key:t.key,value:o,valueSpec:u,style:r,styleSpec:s,expressionContext:"property",propertyType:e,propertyKey:a}))}function Qv(t){return Jv(t,"paint")}function tx(t){return Jv(t,"layout")}function ex(t){var e,i;let n=[];const r=t.value,s=t.key,o=t.style,a=t.styleSpec;if("object"!==cv(r))return[new im(s,r,`object expected, ${cv(r)} found`)];r.type||r.ref||n.push(new im(s,r,'either "type" or "ref" is required'));let l=qv(r.type);const h=qv(r.ref);if(r.id){const e=qv(r.id);for(let i=0;i<t.arrayIndex;i++){const t=o.layers[i];qv(t.id)===e&&n.push(new im(s,r.id,`duplicate layer id "${r.id}", previously used at line ${t.id.__line__}`))}}if("ref"in r){let t;["type","source","source-layer","filter","layout"].forEach(t=>{t in r&&n.push(new im(s,r[t],`"${t}" is prohibited for ref layers`))}),o.layers.forEach(e=>{qv(e.id)===h&&(t=e)}),t?t.ref?n.push(new im(s,r.ref,"ref cannot reference another ref layer")):l=qv(t.type):n.push(new im(s,r.ref,`ref layer "${h}" not found`))}else if("background"!==l)if(r.source){const t=o.sources&&o.sources[r.source],e=t&&qv(t.type);t?"vector"===e&&"raster"===l?n.push(new im(s,r.source,`layer "${r.id}" requires a raster source`)):"raster-dem"!==e&&"hillshade"===l||"raster-dem"!==e&&"color-relief"===l?n.push(new im(s,r.source,`layer "${r.id}" requires a raster-dem source`)):"raster"===e&&"raster"!==l?n.push(new im(s,r.source,`layer "${r.id}" requires a vector source`)):"vector"!==e||r["source-layer"]?"raster-dem"===e&&"hillshade"!==l&&"color-relief"!==l?n.push(new im(s,r.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):"line"!==l||!r.paint||!r.paint["line-gradient"]||"geojson"===e&&t.lineMetrics||n.push(new im(s,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):n.push(new im(s,r,`layer "${r.id}" must specify a "source-layer"`)):n.push(new im(s,r.source,`source "${r.source}" not found`))}else n.push(new im(s,r,'missing required property "source"'));return"raster"===l&&(null===(e=r.paint)||void 0===e?void 0:e.resampling)&&(null===(i=r.paint)||void 0===i?void 0:i["raster-resampling"])&&n.push(new im(s,r.paint,`layer "${r.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),n=n.concat(Bv({key:s,value:r,valueSpec:a.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":()=>[],type:()=>t.validateSpec({key:`${s}.type`,value:r.type,valueSpec:a.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:"type"}),filter:Zv,layout:t=>Bv({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>tx(nm({layerType:l},t))}}),paint:t=>Bv({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>Qv(nm({layerType:l},t))}})}})),n}function ix(t){const e=t.value,i=t.key,n=cv(e);return"string"!==n?[new im(i,e,`string expected, ${n} found`)]:[]}const nx={promoteId:function({key:t,value:e}){if("string"===cv(e))return ix({key:t,value:e});{const i=[];for(const n in e)i.push(...ix({key:`${t}.${n}`,value:e[n]}));return i}}};function rx(t){const e=t.value,i=t.key,n=t.styleSpec,r=t.style,s=t.validateSpec;if(!e.type)return[new im(i,e,'"type" is required')];const o=qv(e.type);let a;switch(o){case"vector":case"raster":return a=Bv({key:i,value:e,valueSpec:n[`source_${o.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:nx,validateSpec:s}),a;case"raster-dem":return a=function(t){var e;const i=null!==(e=t.sourceName)&&void 0!==e?e:"",n=t.value,r=t.styleSpec,s=r.source_raster_dem,o=t.style;let a=[];const l=cv(n);if(void 0===n)return a;if("object"!==l)return a.push(new im("source_raster_dem",n,`object expected, ${l} found`)),a;const h="custom"===qv(n.encoding),u=["redFactor","greenFactor","blueFactor","baseShift"],c=t.value.encoding?`"${t.value.encoding}"`:"Default";for(const e in n)!h&&u.includes(e)?a.push(new im(e,n[e],`In "${i}": "${e}" is only valid when "encoding" is set to "custom". ${c} encoding found`)):s[e]?a=a.concat(t.validateSpec({key:e,value:n[e],valueSpec:s[e],validateSpec:t.validateSpec,style:o,styleSpec:r})):a.push(new im(e,n[e],`unknown property "${e}"`));return a}({sourceName:i,value:e,style:t.style,styleSpec:n,validateSpec:s}),a;case"geojson":if(a=Bv({key:i,value:e,valueSpec:n.source_geojson,style:r,styleSpec:n,validateSpec:s,objectElementValidators:nx}),e.cluster)for(const t in e.clusterProperties){const[n,r]=e.clusterProperties[t],s="string"==typeof n?[n,["accumulated"],["get",t]]:n;a.push(...Vv({key:`${i}.${t}.map`,value:r,expressionContext:"cluster-map"})),a.push(...Vv({key:`${i}.${t}.reduce`,value:s,expressionContext:"cluster-reduce"}))}return a;case"video":return Bv({key:i,value:e,valueSpec:n.source_video,style:r,validateSpec:s,styleSpec:n});case"image":return Bv({key:i,value:e,valueSpec:n.source_image,style:r,validateSpec:s,styleSpec:n});case"canvas":return[new im(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Yv({key:`${i}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function sx(t){const e=t.value,i=t.styleSpec,n=i.light,r=t.style;let s=[];const o=cv(e);if(void 0===e)return s;if("object"!==o)return s=s.concat([new im("light",e,`object expected, ${o} found`)]),s;for(const o in e){const a=o.match(/^(.*)-transition$/);s=a&&n[a[1]]&&n[a[1]].transition?s.concat(t.validateSpec({key:o,value:e[o],valueSpec:i.transition,validateSpec:t.validateSpec,style:r,styleSpec:i})):n[o]?s.concat(t.validateSpec({key:o,value:e[o],valueSpec:n[o],validateSpec:t.validateSpec,style:r,styleSpec:i})):s.concat([new im(o,e[o],`unknown property "${o}"`)])}return s}function ox(t){const e=t.value,i=t.styleSpec,n=i.sky,r=t.style,s=cv(e);if(void 0===e)return[];if("object"!==s)return[new im("sky",e,`object expected, ${s} found`)];let o=[];for(const s in e)o=n[s]?o.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],style:r,styleSpec:i})):o.concat([new im(s,e[s],`unknown property "${s}"`)]);return o}function ax(t){const e=t.value,i=t.styleSpec,n=i.terrain,r=t.style;let s=[];const o=cv(e);if(void 0===e)return s;if("object"!==o)return s=s.concat([new im("terrain",e,`object expected, ${o} found`)]),s;for(const o in e)s=n[o]?s.concat(t.validateSpec({key:o,value:e[o],valueSpec:n[o],validateSpec:t.validateSpec,style:r,styleSpec:i})):s.concat([new im(o,e[o],`unknown property "${o}"`)]);return s}function lx(t){let e=[];const i=t.value,n=t.key;if(Array.isArray(i)){const r=[],s=[];for(const o in i){i[o].id&&r.includes(i[o].id)&&e.push(new im(n,i,`all the sprites' ids must be unique, but ${i[o].id} is duplicated`)),r.push(i[o].id),i[o].url&&s.includes(i[o].url)&&e.push(new im(n,i,`all the sprites' URLs must be unique, but ${i[o].url} is duplicated`)),s.push(i[o].url);const a={id:{type:"string",required:!0},url:{type:"string",required:!0}};e=e.concat(Bv({key:`${n}[${o}]`,value:i[o],valueSpec:a,validateSpec:t.validateSpec}))}return e}return ix({key:n,value:i})}function hx(t){return Boolean(t)&&t.constructor===Object}function ux(t){return hx(t.value)?[]:[new im(t.key,t.value,`object expected, ${cv(t.value)} found`)]}const cx={"*":()=>[],array:Uv,boolean:function(t){const e=t.value,i=t.key,n=cv(e);return"boolean"!==n?[new im(i,e,`boolean expected, ${n} found`)]:[]},number:Wv,color:Kv,constants:zv,enum:Yv,filter:Zv,function:Xv,layer:ex,object:Bv,source:rx,light:sx,sky:ox,terrain:ax,projection:function(t){const e=t.value,i=t.styleSpec,n=i.projection,r=t.style,s=cv(e);if(void 0===e)return[];if("object"!==s)return[new im("projection",e,`object expected, ${s} found`)];let o=[];for(const s in e)o=n[s]?o.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],style:r,styleSpec:i})):o.concat([new im(s,e[s],`unknown property "${s}"`)]);return o},projectionDefinition:function(t){const e=t.key;let i=t.value;i=i instanceof String?i.valueOf():i;const n=cv(i);return"array"!==n||function(t){return Array.isArray(t)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]}(i)||function(t){return!!["interpolate","step","literal"].includes(t[0])}(i)?["array","string"].includes(n)?[]:[new im(e,i,`projection expected, invalid type "${n}" found`)]:[new im(e,i,`projection expected, invalid array ${JSON.stringify(i)} found`)]},string:ix,formatted:function(t){return 0===ix(t).length?[]:Vv(t)},resolvedImage:function(t){return 0===ix(t).length?[]:Vv(t)},padding:function(t){const e=t.key,i=t.value;if("array"===cv(i)){if(i.length<1||i.length>4)return[new im(e,i,`padding requires 1 to 4 values; ${i.length} values found`)];const n={type:"number"};let r=[];for(let s=0;s<i.length;s++)r=r.concat(t.validateSpec({key:`${e}[${s}]`,value:i[s],validateSpec:t.validateSpec,valueSpec:n}));return r}return Wv({key:e,value:i,valueSpec:{}})},numberArray:function(t){const e=t.key,i=t.value;if("array"===cv(i)){const n={type:"number"};if(i.length<1)return[new im(e,i,"array length at least 1 expected, length 0 found")];let r=[];for(let s=0;s<i.length;s++)r=r.concat(t.validateSpec({key:`${e}[${s}]`,value:i[s],validateSpec:t.validateSpec,valueSpec:n}));return r}return Wv({key:e,value:i,valueSpec:{}})},colorArray:function(t){const e=t.key,i=t.value;if("array"===cv(i)){if(i.length<1)return[new im(e,i,"array length at least 1 expected, length 0 found")];let t=[];for(let n=0;n<i.length;n++)t=t.concat(Kv({key:`${e}[${n}]`,value:i[n]}));return t}return Kv({key:e,value:i})},variableAnchorOffsetCollection:function(t){const e=t.key,i=t.value,n=cv(i),r=t.styleSpec;if("array"!==n||i.length<1||i.length%2!=0)return[new im(e,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let s=[];for(let n=0;n<i.length;n+=2)s=s.concat(Yv({key:`${e}[${n}]`,value:i[n],valueSpec:r.layout_symbol["text-anchor"]})),s=s.concat(Uv({key:`${e}[${n+1}]`,value:i[n+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:r}));return s},sprite:lx,state:ux,fontFaces:function(t){const e=t.key,i=t.value,n=t.validateSpec,r=t.styleSpec,s=t.style;if(!hx(i))return[new im(e,i,`object expected, ${cv(i)} found`)];const o=[];for(const t in i){const a=i[t],l=cv(a);if("string"===l)o.push(...ix({key:`${e}.${t}`,value:a}));else if("array"===l){const i={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(const[l,h]of a.entries())o.push(...Bv({key:`${e}.${t}[${l}]`,value:h,valueSpec:i,styleSpec:r,style:s,validateSpec:n}))}else o.push(new im(`${e}.${t}`,a,`string or array expected, ${l} found`))}return o}};function dx(t){const e=t.value,i=t.valueSpec,n=t.styleSpec;return t.validateSpec=dx,i.expression&&dv(qv(e))?Xv(t):i.expression&&pv($v(e))?Vv(t):i.type&&cx[i.type]?cx[i.type](t):Bv(nm({},t,{valueSpec:i.type?n[i.type]:i}))}function fx(t){const e=t.value,i=t.key,n=ix(t);return n.length||(-1===e.indexOf("{fontstack}")&&n.push(new im(i,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&n.push(new im(i,e,'"glyphs" url must include a "{range}" token'))),n}function px(t,e=Qg){let i=[];return i=i.concat(dx({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:dx,objectElementValidators:{glyphs:fx,"*":()=>[]}})),t.constants&&(i=i.concat(zv({key:"constants",value:t.constants}))),mx(i)}function gx(t){return function(e){return t(Object.assign({},e,{validateSpec:dx}))}}function mx(t){return[].concat(t).sort((t,e)=>t.line-e.line)}function yx(t){return function(...e){return mx(t.apply(this,e))}}px.source=yx(gx(rx)),px.sprite=yx(gx(lx)),px.glyphs=yx(gx(fx)),px.light=yx(gx(sx)),px.sky=yx(gx(ox)),px.terrain=yx(gx(ax)),px.state=yx(gx(ux)),px.layer=yx(gx(ex)),px.filter=yx(gx(Zv)),px.paintProperty=yx(gx(Qv)),px.layoutProperty=yx(gx(tx));const _x=Qg;function vx(t,e){const i=e[0].evaluate(t),n=e[1].evaluate(t),r=e[2].evaluate(t),s=e[3]?e[3].evaluate(t):1;return Jm.parse(`hsla(${i}, ${n}%, ${r}%, ${s})`)}function xx(t){if(Array.isArray(t)){if(0===t.length)return t;const e=t[0];if("literal"===e)return t;if("image"===e&&3===t.length&&"object"==typeof t[2]&&null!==t[2]&&!Array.isArray(t[2]))return["image-config",xx(t[1]),["literal",t[2]]];const i=t.length;for(let n=1;n<i;++n){const r=t[n],s=xx(r);if(s!==r){const r=[e];for(let e=1;e<n;++e)r.push(t[e]);r.push(s);for(let e=n+1;e<i;++e)r.push(xx(t[e]));return r}}}return t}const wx={},bx={zoom:0,distanceFromCenter:0};H_.register(Z_,{...H_.definitions,pitch:[{kind:"number"},[],t=>bx.pitch||0],"distance-from-center":[{kind:"number"},[],t=>bx.distanceFromCenter||0],"to-hsla":[{kind:"array",itemType:{kind:"number"},N:4},[{kind:"string"}],(t,[e])=>function(t){const e=t[0]/255,i=t[1]/255,n=t[2]/255,r=t[3],s=Math.max(e,i,n),o=Math.min(e,i,n),a=(s+o)/2;let l,h;if(s===o)l=0,h=0;else{const t=s-o;switch(h=a>.5?t/(2-s-o):t/(s+o),s){case e:l=(i-n)/t+(i<n?6:0);break;case i:l=(n-e)/t+2;break;case n:l=(e-i)/t+4;break;default:l=0}l/=6}return[360*l,100*h,100*a,r]}(Qs(e.evaluate(t)))],hsl:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"}],vx],hsla:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"},{kind:"number"}],vx],"image-config":[{kind:"value"},[{kind:"string"},{kind:"value"}],(t,[e,i])=>e.evaluate(t)],"measure-light":[{kind:"number"},[{kind:"value"}],()=>1],config:[{kind:"value"},[{kind:"string"}],(t,[e])=>{const i=wx[e.evaluate(t)];return void 0===i?{}:i}]});var Sx={thin:100,hairline:100,"ultra-light":200,"extra-light":200,light:300,book:300,regular:400,normal:400,plain:400,roman:400,standard:400,medium:500,"semi-bold":600,"demi-bold":600,bold:700,"extra-bold":800,"ultra-bold":800,heavy:900,black:900,"heavy-black":900,fat:900,poster:900,"ultra-black":950,"extra-black":950},Mx=" ",Ex=/(italic|oblique)$/i,Cx={};function Px(t,e,i){var n=Cx[t];if(!n){Array.isArray(t)||(t=[t]);for(var r,s,o=400,a="normal",l=[],h=0,u=t.length;h<u;++h){var c=t[h].split(" "),d=c[c.length-1].toLowerCase();for(var f in"normal"==d||"italic"==d||"oblique"==d?(a=s?a:d,s=!0,c.pop(),d=c[c.length-1].toLowerCase()):Ex.test(d)&&(d=d.replace(Ex,""),a=s?a:c[c.length-1].replace(d,""),s=!0),Sx){var p=c.length>1?c[c.length-2].toLowerCase():"";if(d==f||d==f.replace("-","")||p+"-"+d==f){o=r?o:Sx[f],c.pop(),p&&f.startsWith(p)&&c.pop();break}}r||"number"!=typeof d||(o=d,r=!0);var g=c.join(Mx).replace("Klokantech Noto Sans","Noto Sans").replace("DIN Pro","Barlow").replace("Arial Unicode MS","Arial");-1!==g.indexOf(Mx)&&(g='"'+g+'"'),l.push(g)}n=Cx[t]=[a,o,l]}return n[0]+Mx+n[1]+Mx+e+"px"+(i?"/"+i:"")+Mx+n[2]}const Ix=Object.freeze({}),Tx={},Rx={};let kx=0;function Ax(t){return t.id||(t.id=kx++),t.id}function Gx(t){return t*Math.PI/180}const Ox=function(){const t=[];for(let e=78271.51696402048;t.length<=24;e/=2)t.push(e);return t}();function Fx(t,e){if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas)return new OffscreenCanvas(t,e);const i=document.createElement("canvas");return i.width=t,i.height=e,i}function Lx(t,e,i,n){const r=[2*i*e.pixelRatio+e.width,2*i*e.pixelRatio+e.height],s=Fx(r[0],r[1]),o=s.getContext("2d");o.drawImage(t,e.x,e.y,e.width,e.height,i*e.pixelRatio,i*e.pixelRatio,e.width,e.height);const a=o.getImageData(0,0,r[0],r[1]);o.globalCompositeOperation="destination-over",o.fillStyle=`rgba(${255*n.r},${255*n.g},${255*n.b},${n.a})`;const l=a.data;for(let t=0,n=a.width;t<n;++t)for(let r=0,s=a.height;r<s;++r)l[4*(r*n+t)+3]>0&&o.arc(t,r,i*e.pixelRatio,0,2*Math.PI);return o.fill(),s}function jx(t,e,i){const n=Math.max(0,Math.min(1,(i-t)/(e-t)));return n*n*(3-2*n)}function Nx(t,e,i){const n=Fx(e.width,e.height),r=n.getContext("2d");r.drawImage(t,e.x,e.y,e.width,e.height,0,0,e.width,e.height);const s=r.getImageData(0,0,e.width,e.height),o=s.data;for(let t=0,e=s.width;t<e;++t)for(let n=0,r=s.height;n<r;++n){const r=4*(n*e+t),s=.75,a=.1,l=jx(s-a,s+a,o[r+3]/255);l>0?(o[r+0]=Math.round(255*i.r*l),o[r+1]=Math.round(255*i.g*l),o[r+2]=Math.round(255*i.b*l),o[r+3]=Math.round(255*l)):o[r+3]=0}return r.putImageData(s,0,0),n}const Dx=Array(256).join(" ");function zx(t,e){if(e>=.05){let i="";const n=t.split("\n"),r=Dx.slice(0,Math.round(e/.1));for(let t=0,e=n.length;t<e;++t)t>0&&(i+="\n"),i+=n[t].split("").join(r);return i}return t}let qx;function $x(){return qx||(qx=Fx(1,1).getContext("2d")),qx}function Bx(t,e){return $x().measureText(t).width+(t.length-1)*e}const Ux={};function Wx(t,e,i,n){if(-1!==t.indexOf("\n")){const r=t.split("\n"),s=[];for(let t=0,o=r.length;t<o;++t)s.push(Wx(r[t],e,i,n));return s.join("\n")}const r=i+","+e+","+t+","+n;let s=Ux[r];if(!s){const o=t.split(" ");if(o.length>1){const t=$x();t.font=e;const r=t.measureText("M").width*i;let a="";const l=[];for(let t=0,e=o.length;t<e;++t){const e=o[t],i=a+(a?" ":"")+e;Bx(i,n)<=r?a=i:(a&&l.push(a),a=e)}a&&l.push(a);for(let t=0,e=l.length;t<e&&e>1;++t){const i=l[t];if(Bx(i,n)<.35*r){const r=t>0?Bx(l[t-1],n):1/0,s=t<e-1?Bx(l[t+1],n):1/0;l.splice(t,1),e-=1,r<s?(l[t-1]+=" "+i,t-=1):l[t]=i+" "+l[t]}}for(let t=0,e=l.length-1;t<e;++t){const i=l[t],s=l[t+1];if(Bx(i,n)>.7*r&&Bx(s,n)<.6*r){const o=i.split(" "),a=o.pop();Bx(a,n)<.2*r&&(l[t]=o.join(" "),l[t+1]=a+" "+s),e-=1}}s=l.join("\n")}else s=t;s=zx(s,n),Ux[r]=s}return s}Wa.on("propertychange",()=>{for(const t in Ux)delete Ux[t]});const Xx={Point:1,MultiPoint:1,LineString:2,MultiLineString:2,Polygon:3,MultiPolygon:3},Vx={center:[.5,.5],left:[0,.5],right:[1,.5],top:[.5,0],bottom:[.5,1],"top-left":[0,0],"top-right":[1,0],"bottom-left":[0,1],"bottom-right":[1,1]},Kx=function(t,e){let i=_v(t,e);if("error"===i.result){const n=xx(t);n!==t&&(i=_v(n,e))}if("error"===i.result){const n=i.value[0];return console.error("Error parsing expression:",t,n.key,n.message),{evaluate:()=>e.default}}return i.value};let Yx,Zx;function Hx(t,e,i,n,r,s){const o=t.id;r||(r={},console.warn("No functionCache provided to getValue()")),r[o]||(r[o]={});const a=r[o];if(!a[i]){let n=(t[e]||Ix)[i];const r=_x[`${e}_${t.type}`]&&_x[`${e}_${t.type}`][i];void 0===n&&r&&(n=r.default);let s=pv(n);if(!s&&dv(n)&&(n=Av(n,r),s=!0),s){const t=Kx(n,r);a[i]=t.evaluate.bind(t)}else{const t=r?r.type:typeof n;"color"!==t&&"colorArray"!==t||(n=Jm.parse(n));let e=!1;if("array"===t)for(let t=0;t<n.length;++t){const i=n[t];if(pv(i)||dv(i)){e=!0;break}}if(e){const t=Object.assign({},r,{type:r.value}),e=[];for(let i=0;i<n.length;++i){let r=n[i];if(!pv(r)&&dv(r)&&(r=Av(r,t)),pv(r)){const i=Kx(r,t);e.push(i.evaluate.bind(i))}else e.push(function(){return r})}a[i]=function(t,i,n){const r=[];for(let s=0;s<e.length;++s)r[s]=e[s](t,i,n);return r}}else a[i]=function(){return n}}}return a[i](bx,n,s)}function Jx(t,e,i,n){return Hx(t,"layout",`${i}-allow-overlap`,e,n)?Hx(t,"layout",`${i}-ignore-placement`,e,n)?"none":"obstacle":"declutter"}function Qx(t,e,i,n){if(n||console.warn("No filterCache provided to evaluateFilter()"),!(t in n))try{n[t]=function(t,e){if(null==t)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};bv(t)||(t=Cv(t));const i=gv(t,Sv,e);if("error"===i.result)throw new Error(i.value.map(t=>`${t.key}: ${t.message}`).join(", "));return{filter:(t,e,n)=>i.value.evaluate(t,e,{},n),needGeometry:Ev(t),getGlobalStateRefs:()=>xv(i.value.expression)}}(e).filter}catch(e){console.warn("Filter will evaluate to false: "+e.message),n[t]=function(){return!1}}return n[t](bx,i)}function tw(t,e){if(t){if(0===t.a||0===e)return;const i=t.a;return e=void 0===e?1:e,0===i?"transparent":"rgba("+Math.round(255*t.r/i)+","+Math.round(255*t.g/i)+","+Math.round(255*t.b/i)+","+i*e+")"}return t}const ew=/\{[^{}}]*\}/g;function iw(t,e){return t.replace(ew,function(t){return e[t.slice(1,-1)]||""})}function nw(t,e){let i=t.split(":")[0];return i===t&&(i="default"),e[i]}let rw=!1;const sw={};function ow(t,e,i,n=Ox,r=void 0,s=void 0,o=void 0,a=void 0){if("string"==typeof e&&(e=JSON.parse(e)),e.schema)for(const t in e.schema){const i=e.schema[t];"default"in i&&(wx[t]=i.default)}if(8!=e.version)throw new Error("glStyle version 8 required.");sw[function(t,e){return Ax(t)+"."+L(e)}(e,t)]=Array.from(arguments);const l={};("string"==typeof s||s instanceof Request||s instanceof Response||s instanceof Promise)&&(s={default:s});for(const e in s){const i=s[e];T(()=>i).then(async i=>{let n;if("undefined"!=typeof Image){const r=new Image;if("string"==typeof i)r.crossOrigin="anonymous",r.src=i;else{let t;i instanceof Request?t=await fetch(i):i instanceof Response&&(t=i);const e=await t.blob();n=URL.createObjectURL(e),r.src=n}r.addEventListener("load",function i(){r.removeEventListener("load",i),l[e]={image:r,size:[r.width,r.height]},t.changed(),n&&URL.revokeObjectURL(n)}),r.addEventListener("error",function t(){URL.revokeObjectURL(n),r.removeEventListener("error",t)})}else if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope){const t=self;t.postMessage({action:"loadImage",src:i}),t.addEventListener("message",function(t){"imageLoaded"===t.data.action&&t.data.src===i&&(l[e]={image:t.data.image,size:[t.data.image.width,t.data.image.height]})})}})}const h=function(t){t=t.slice();const e=Object.create(null);for(let i=0;i<t.length;i++)e[t[i].id]=t[i];for(let i=0;i<t.length;i++)"ref"in t[i]&&(t[i]=em(t[i],e[t[i].ref]));return t}(e.layers),u={},c=[],d={},f={},p=function(t){let e=Tx[t.id];return e||(e={},Tx[Ax(t)]=e),e}(e),g=function(t){let e=Rx[t.id];return e||(e={},Rx[Ax(t)]=e),e}(e);let m;for(let t=0,n=h.length;t<n;++t){const n=h[t],r=n.id;if("string"==typeof i&&n.source==i||Array.isArray(i)&&-1!==i.indexOf(r)){const i=n["source-layer"];if(m){if(n.source!==m)throw new Error(`Layer "${r}" does not use source "${m}`)}else{m=n.source;const t=e.sources[m];if(!t)throw new Error(`Source "${m}" is not defined`);const i=t.type;if("vector"!==i&&"geojson"!==i)throw new Error(`Source "${m}" is not of type "vector" or "geojson", but "${i}"`)}let s=u[i];s||(s=[],u[i]=s),s.push({layer:n,index:t}),c.push(r)}}const y=[],_=function(i,s,h){const c=t.getSource?.()?.format_?.layerName_??"mvt:layer",m=i.getProperties(),_=u[m[c]];if(!_)return;let v=n.indexOf(s);-1==v&&(v=function(t,e){let i=0;const n=e.length;for(;i<n;++i)if(e[i]<t&&i+1<n){const n=e[i]/e[i+1];return i+Math.log(e[i]/t)/Math.log(n)}return n-1}(s,n)),bx.zoom=v,bx.distanceFromCenter=0;const x=i.getGeometry(),w=Xx[x.getType()],b=t.get("map");if(b&&b instanceof th&&1===w){const t=b.getSize();if(t){const e=b.getView().getCenter(),i=Vt(x.getExtent());bx.distanceFromCenter=(S=e,M=i,Math.sqrt(function(t,e){const i=t[0]-e[0],n=t[1]-e[1];return i*i+n*n}(S,M))/s/t[1])}}var S,M;const E={id:i.getId(),properties:m,type:w},C=t.get("mapbox-featurestate")[i.getId()];let P,I=-1;for(let n=0,u=_.length;n<u;++n){const u=_[n],c=u.layer,x=c.id;if(void 0!==h&&h!==x)continue;const b=c.layout||Ix,S=c.paint||Ix;if("none"===Hx(c,"layout","visibility",E,p,C)||"minzoom"in c&&v<c.minzoom||"maxzoom"in c&&v>=c.maxzoom)continue;const M=c.filter;if(!M||Qx(x,M,E,g)){let n,h,g,_,v,x;P=c;const M=u.index;if(3==w&&("fill"==c.type||"fill-extrusion"==c.type))if(h=Hx(c,"paint",c.type+"-opacity",E,p,C),c.type+"-pattern"in S){const t=Hx(c,"paint",c.type+"-pattern",E,p,C);if(t){const e="string"==typeof t?iw(t,m):t.toString(),i=nw(e,l);if(r&&r[e]&&i){++I,x=y[I],x&&x.getFill()&&!x.getStroke()&&!x.getText()||(x=new vl({fill:new hl}),y[I]=x),g=x.getFill(),x.setZIndex(M);const t=e+"."+h;let n=f[t];if(!n){const s=r[e],o=Fx(s.width,s.height),a=o.getContext("2d");a.globalAlpha=h,a.drawImage(i.image,s.x,s.y,s.width,s.height,0,0,s.width,s.height),n=a.createPattern(o,"repeat"),f[t]=n}g.setColor(n)}}}else if(n=tw(Hx(c,"paint",c.type+"-color",E,p,C),h),c.type+"-outline-color"in S&&(v=tw(Hx(c,"paint",c.type+"-outline-color",E,p,C),h)),v||(v=n),n||v){if(++I,x=y[I],(!x||n&&!x.getFill()||!n&&x.getFill()||v&&!x.getStroke()||!v&&x.getStroke()||x.getText())&&(x=new vl({fill:n?new hl:void 0,stroke:v?new pl:void 0}),y[I]=x),n&&(g=x.getFill(),g.setColor(n)),"fill-extrusion"===c.type){const t=Hx(c,"paint","fill-extrusion-height",E,p,C);if(t>0){const e=Math.max(.1,.9-Math.min(t,225)/280);if(v&&"transparent"!==v){const t=Jm.parse(v);v=`rgba(${Math.round(255*t.r*e)},${Math.round(255*t.g*e)},${Math.round(255*t.b*e)},${t.a})`}}}v&&(_=x.getStroke(),_.setColor(v),_.setWidth(.5)),x.setZIndex(M)}if(1!=w&&"line"==c.type){n="line-pattern"in S?void 0:tw(Hx(c,"paint","line-color",E,p,C),Hx(c,"paint","line-opacity",E,p,C));const t=Hx(c,"paint","line-width",E,p,C);n&&t>0&&(++I,x=y[I],x&&x.getStroke()&&!x.getFill()&&!x.getText()||(x=new vl({stroke:new pl}),y[I]=x),_=x.getStroke(),_.setLineCap(Hx(c,"layout","line-cap",E,p,C)),_.setLineJoin(Hx(c,"layout","line-join",E,p,C)),_.setMiterLimit(Hx(c,"layout","line-miter-limit",E,p,C)),_.setColor(n),_.setWidth(t),_.setLineDash(S["line-dasharray"]?Hx(c,"paint","line-dasharray",E,p,C).map(function(e){return e*t}):null),"function"==typeof _.setOffset&&_.setOffset(Hx(c,"paint","line-offset",E,p,C)),x.setZIndex(M))}let T,R,k,A,G,O,F,L,j,N=!1,D=null,z=0;if((1==w||2==w)&&"icon-image"in b){const e=Hx(c,"layout","icon-image",E,p,C);if(e){let n;T="string"==typeof e?iw(e,m):e.toString();const o=a?a(t,T):void 0,h=nw(T,l);if(r&&r[T]&&h||o){const t=Hx(c,"layout","icon-rotation-alignment",E,p,C);if(2==w){const e=i.getGeometry();if(e.getFlatMidpoint||e.getFlatMidpoints){const i=e.getExtent();if(Math.sqrt(Math.max(Math.pow((i[2]-i[0])/s,2),Math.pow((i[3]-i[1])/s,2)))>150){const i="MultiLineString"===e.getType()?e.getFlatMidpoints():e.getFlatMidpoint();if(Zx||(Yx=[NaN,NaN],Zx=new Mg("Point",Yx,[],2,{},void 0)),n=Zx,Yx[0]=i[0],Yx[1]=i[1],"line"===Hx(c,"layout","symbol-placement",E,p,C)&&"map"===t){const t=e.getStride(),n=e.getFlatCoordinates();for(let e=0,r=n.length-t;e<r;e+=t){const r=n[e],s=n[e+1],o=n[e+t],a=n[e+t+1],l=Math.min(r,o),h=Math.max(r,o),u=i[0],c=(a-s)*(u-r)-(o-r)*(i[1]-s);if(Math.abs(c)<.001&&u<=h&&u>=l){z=Math.atan2(s-a,o-r);break}}}}}}if(2!==w||n){const e=Hx(c,"layout","icon-size",E,p,C),i=void 0!==S["icon-color"]?Hx(c,"paint","icon-color",E,p,C):null;if(!i||0!==i.a){const n=Hx(c,"paint","icon-halo-color",E,p,C),s=Hx(c,"paint","icon-halo-width",E,p,C);let a=`${T}.${e}.${s}.${n}`;if(null!==i&&(a+=`.${i}`),R=d[a],!R){const l=Jx(c,E,"icon",p);let u;"icon-offset"in b&&(u=Hx(c,"layout","icon-offset",E,p,C).slice(0),u[0]*=e,u[1]*=-e);let f=i?[255*i.r,255*i.g,255*i.b,i.a]:void 0;if(o){const i={color:f,rotateWithView:"map"===t,displacement:u,declutterMode:l,scale:e};"string"==typeof o?i.src=o:(i.img=o,i.imgSize=[o.width,o.height]),R=new dl(i)}else{const o=r[T];let a,c,d;if(s)o.sdf?(a=Lx(Nx(h.image,o,i||[0,0,0,1]),{x:0,y:0,width:o.width,height:o.height,pixelRatio:o.pixelRatio},s,n),f=void 0):a=Lx(h.image,o,s,n);else{if(o.sdf&&!h.unSDFed){const t=Nx(h.image,{x:0,y:0,width:h.size[0],height:h.size[1]},{r:1,g:1,b:1,a:1});h.image=t,h.unSDFed=!0}a=h.image,c=[o.width,o.height],d=[o.x,o.y]}R=new dl({color:f,img:a,imgSize:h.size,size:c,offset:d,rotateWithView:"map"===t,scale:e/o.pixelRatio,displacement:u,declutterMode:l})}d[a]=R}}R&&(++I,x=y[I],x&&x.getImage()&&!x.getFill()&&!x.getStroke()||(x=new vl,y[I]=x),x.setGeometry(n),R.setRotation(z+Gx(Hx(c,"layout","icon-rotate",E,p,C))),R.setOpacity(Hx(c,"paint","icon-opacity",E,p,C)),R.setAnchor(Vx[Hx(c,"layout","icon-anchor",E,p,C)]),x.setImage(R),D=x.getText(),x.setText(void 0),x.setZIndex(M),N=!0,k=!1)}else k=!0}}}if(1==w&&"circle"===c.type){++I,x=y[I],x&&x.getImage()&&!x.getFill()&&!x.getStroke()||(x=new vl,y[I]=x);const t="circle-radius"in S?Hx(c,"paint","circle-radius",E,p,C):5,e=tw(Hx(c,"paint","circle-stroke-color",E,p,C),Hx(c,"paint","circle-stroke-opacity",E,p,C)),i=Hx(c,"paint","circle-translate",E,p,C),n=tw(Hx(c,"paint","circle-color",E,p,C),Hx(c,"paint","circle-opacity",E,p,C)),r=Hx(c,"paint","circle-stroke-width",E,p,C),s=t+"."+e+"."+n+"."+r+"."+i[0]+"."+i[1];R=d[s],R||(R=new al({radius:t,displacement:[i[0],-i[1]],stroke:e&&r>0?new pl({width:r,color:e}):void 0,fill:n?new hl({color:n}):void 0,declutterMode:"none"}),d[s]=R),x.setImage(R),D=x.getText(),x.setText(void 0),x.setGeometry(void 0),x.setZIndex(M),N=!0}if("text-field"in b){F=Math.round(Hx(c,"layout","text-size",E,p,C));const t=Hx(c,"layout","text-font",E,p,C);O=Hx(c,"layout","text-line-height",E,p,C),G=Px(o?o(t,e.metadata?e.metadata["ol:webfonts"]:void 0):t,F,O),G.includes("sans-serif")||(G+=",sans-serif"),L=Hx(c,"layout","text-letter-spacing",E,p,C),j=Hx(c,"layout","text-max-width",E,p,C);const i=Hx(c,"layout","text-field",E,p,C);A="object"==typeof i&&i.sections?1===i.sections.length?i.toString():i.sections.reduce((e,i,n)=>{const r=i.fontStack?i.fontStack.split(","):t,s=Px(o?o(r):r,F*(i.scale||1),O);let a=i.text;if("\n"===a)return e.push("\n",""),e;if(2==w)return e.push(zx(a,L),s),e;a=Wx(a,s,j,L).split("\n");for(let t=0,i=a.length;t<i;++t)t>0&&e.push("\n",""),e.push(a[t],s);return e},[]):iw(i,m).trim(),h=Hx(c,"paint","text-opacity",E,p,C)}if(A&&h&&!k){N||(++I,x=y[I],x&&x.getText()&&!x.getFill()&&!x.getStroke()||(x=new vl,y[I]=x),x.setImage(void 0),x.setGeometry(void 0));const t=Jx(c,E,"text",p);x.getText()||x.setText(D),D=x.getText(),(!D||"getDeclutterMode"in D&&D.getDeclutterMode()!==t)&&(D=new wl({padding:[2,2,2,2],declutterMode:t}),x.setText(D));const e=Hx(c,"layout","text-transform",E,p,C);"uppercase"==e?A=Array.isArray(A)?A.map((t,e)=>e%2?t:t.toUpperCase()):A.toUpperCase():"lowercase"==e&&(A=Array.isArray(A)?A.map((t,e)=>e%2?t:t.toLowerCase()):A.toLowerCase());const i=Array.isArray(A)?A:2==w?zx(A,L):Wx(A,G,j,L);if(D.setText(i),D.setFont(G),D.setRotation(Gx(Hx(c,"layout","text-rotate",E,p,C))),"function"==typeof D.setKeepUpright){const t=Hx(c,"layout","text-keep-upright",E,p,C);D.setKeepUpright(t)}const n=Hx(c,"layout","text-anchor",E,p,C),r=N||1==w?"point":Hx(c,"layout","symbol-placement",E,p,C);let s;if("line-center"===r?(D.setPlacement("line"),s="center"):D.setPlacement(r),"line"===r&&"function"==typeof D.setRepeat){const t=Hx(c,"layout","symbol-spacing",E,p,C);D.setRepeat(2*t)}D.setOverflow("point"===r);let o=Hx(c,"paint","text-halo-width",E,p,C);const a=Hx(c,"layout","text-offset",E,p,C),l=Hx(c,"paint","text-translate",E,p,C);let u=0,d=0;if("point"==r){s="center",-1!==n.indexOf("left")?(s="left",d=o):-1!==n.indexOf("right")&&(s="right",d=-o);const t=Hx(c,"layout","text-rotation-alignment",E,p,C);D.setRotateWithView("map"==t)}else D.setMaxAngle(Gx(Hx(c,"layout","text-max-angle",E,p,C))*A.length/i.length),D.setRotateWithView(!1);D.setTextAlign(s);let f="middle";0==n.indexOf("bottom")?(f="bottom",u=-o-.5*(O-1)*F):0==n.indexOf("top")&&(f="top",u=o+.5*(O-1)*F),D.setTextBaseline(f);const g=Hx(c,"layout","text-justify",E,p,C);D.setJustify("auto"===g?void 0:g),D.setOffsetX(a[0]*F+d+l[0]),D.setOffsetY(a[1]*F+u+l[1]);const m=D.getFill()||new hl;m.setColor(tw(Hx(c,"paint","text-color",E,p,C),h)),D.setFill(m);const _=tw(Hx(c,"paint","text-halo-color",E,p,C),h);if(_&&o>0){const t=D.getStroke()||new pl;t.setColor(_),o*=2;const e=.5*F;t.setWidth(o<=e?o:e),D.setStroke(t)}else D.setStroke(void 0);const v=Hx(c,"layout","text-padding",E,p,C),b=D.getPadding();v!==b[0]&&(b[0]=v,b[1]=v,b[2]=v,b[3]=v),x.setZIndex(M)}}}return I>-1?(y.length=I+1,rw&&("set"in i?i.set("mapbox-layer",P):i.getProperties()["mapbox-layer"]=P),y):void 0};return t.setStyle(_),t.set("mapbox-layers",c),t.set("mapbox-source",m),t.set("mapbox-featurestate",t.get("mapbox-featurestate")||{}),_}function aw(t){return aw="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},aw(t)}function lw(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function hw(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?lw(Object(i),!0).forEach(function(e){uw(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):lw(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function uw(t,e,i){return(e=function(t){var e=function(t){if("object"!=aw(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=aw(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==aw(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function cw(){var t,e,i="function"==typeof Symbol?Symbol:{},n=i.iterator||"@@iterator",r=i.toStringTag||"@@toStringTag";function s(i,n,r,s){var l=n&&n.prototype instanceof a?n:a,h=Object.create(l.prototype);return dw(h,"_invoke",function(i,n,r){var s,a,l,h=0,u=r||[],c=!1,d={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,i){return s=e,a=0,l=t,d.n=i,o}};function f(i,n){for(a=i,l=n,e=0;!c&&h&&!r&&e<u.length;e++){var r,s=u[e],f=d.p,p=s[2];i>3?(r=p===n)&&(l=s[(a=s[4])?5:(a=3,3)],s[4]=s[5]=t):s[0]<=f&&((r=i<2&&f<s[1])?(a=0,d.v=n,d.n=s[1]):f<p&&(r=i<3||s[0]>n||n>p)&&(s[4]=i,s[5]=n,d.n=p,a=0))}if(r||i>1)return o;throw c=!0,n}return function(r,u,p){if(h>1)throw TypeError("Generator is already running");for(c&&1===u&&f(u,p),a=u,l=p;(e=a<2?t:l)||!c;){s||(a?a<3?(a>1&&(d.n=-1),f(a,l)):d.n=l:d.v=l);try{if(h=2,s){if(a||(r="next"),e=s[r]){if(!(e=e.call(s,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,a<2&&(a=0)}else 1===a&&(e=s.return)&&e.call(s),a<2&&(l=TypeError("The iterator does not provide a '"+r+"' method"),a=1);s=t}else if((e=(c=d.n<0)?l:i.call(n,d))!==o)break}catch(e){s=t,a=1,l=e}finally{h=1}}return{value:e,done:c}}}(i,r,s),!0),h}var o={};function a(){}function l(){}function h(){}e=Object.getPrototypeOf;var u=[][n]?e(e([][n]())):(dw(e={},n,function(){return this}),e),c=h.prototype=a.prototype=Object.create(u);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,dw(t,r,"GeneratorFunction")),t.prototype=Object.create(c),t}return l.prototype=h,dw(c,"constructor",h),dw(h,"constructor",l),l.displayName="GeneratorFunction",dw(h,r,"GeneratorFunction"),dw(c),dw(c,r,"Generator"),dw(c,n,function(){return this}),dw(c,"toString",function(){return"[object Generator]"}),(cw=function(){return{w:s,m:d}})()}function dw(t,e,i,n){var r=Object.defineProperty;try{r({},"",{})}catch(t){r=0}dw=function(t,e,i,n){function s(e,i){dw(t,e,function(t){return this._invoke(e,i,t)})}e?r?r(t,e,{value:i,enumerable:!n,configurable:!n,writable:!n}):t[e]=i:(s("next",0),s("throw",1),s("return",2))},dw(t,e,i,n)}function fw(t,e,i,n,r,s,o){try{var a=t[s](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(n,r)}function pw(t){return function(){var e=this,i=arguments;return new Promise(function(n,r){var s=t.apply(e,i);function o(t){fw(s,n,r,o,a,"next",t)}function a(t){fw(s,n,r,o,a,"throw",t)}o(void 0)})}}function gw(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,s,o,a=[],l=!0,h=!1;try{if(s=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=s.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw r}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return mw(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?mw(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function mw(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}Jm.parse("#000000"),Jm.parse("#FFFFFF"),Jm.parse("#000000"),function(t=!1){rw=t}(!0);var yw="EPSG:27700",_w=["vector","raster","wms","ogc-vt"];function vw(t,e,i){var n=i&&i(t,e)||{};return fetch(n.url||t,{headers:n.headers||{}})}var xw=function(t){return function(e,i){var n=t(i,"Tile")||{},r=n.url||i,s=n.headers||{};fetch(r,{headers:s}).then(function(t){return t.blob()}).then(function(t){e.getImage().src=URL.createObjectURL(t)}).catch(function(){return e.setState(3)})}};function ww(){return new jd({resolutions:xd,origin:bd,tileSize:256})}function bw(t,e,i){var n=ww();return new yf({url:t,params:e,projection:yw,tileGrid:n,tileLoadFunction:i?xw(i):void 0})}function Sw(t,e){var i=ww();return new df({projection:yw,tileGrid:i,tileUrlFunction:function(e){var i=gw(e,3),n=i[0],r=i[1],s=i[2];return t.replace("{z}",n).replace("{x}",r).replace("{y}",s)},tileLoadFunction:e?xw(e):void 0})}function Mw(t,e){return Ew.apply(this,arguments)}function Ew(){return(Ew=pw(cw().m(function t(e,i){var n,r;return cw().w(function(t){for(;;)switch(t.n){case 0:if(!e.type||_w.includes(e.type)){t.n=1;break}throw new Error("Unsupported map style type: '".concat(e.type,"'"));case 1:if("wms"!==e.type){t.n=2;break}return n=bw(e.url,e.params||{},i),t.a(2,{layer:new $f({source:n}),source:n});case 2:if("raster"!==e.type){t.n=3;break}return r=Sw(e.url,i),t.a(2,{layer:new $f({source:r}),source:r});case 3:if("ogc-vt"!==e.type){t.n=4;break}return t.a(2,Rw(e.url,i,e));case 4:return t.a(2,Iw(e.url,i,e))}},t)}))).apply(this,arguments)}function Cw(t,e){var i=t.indexOf("?"),n=gw(i>=0?[t.slice(0,i),t.slice(i)]:[t,""],2),r=n[0],s=n[1],o="".concat(r,".json").concat(s),a="".concat(r,".png").concat(s);return{jsonUrl:o,pngUrl:a,fetch:function(){return vw(o,"SpriteJSON",e).then(function(t){return t.json()})}}}function Pw(t){t.layers.forEach(function(t){var e;null!==(e=t.paint)&&void 0!==e&&e["icon-color"]&&(t.paint["icon-color"]=t.paint["icon-color"].replace(",0)",",1)"))})}function Iw(t,e){return Tw.apply(this,arguments)}function Tw(){return Tw=pw(cw().m(function t(e,i){var n,r,s,o,a,l,h,u,c,d,f,p,g,m,y,_=arguments;return cw().w(function(t){for(;;)switch(t.n){case 0:return n=(_.length>2&&void 0!==_[2]?_[2]:{}).renderMode,t.n=1,vw(e,"Style",i).then(function(t){return t.json()});case 1:return r=t.v,s=Object.keys(r.sources)[0],o=r.sources[s].url,t.n=2,vw(o,"Source",i).then(function(t){return t.json()});case 2:return a=t.v,l=[a.fullExtent.xmin,a.fullExtent.ymin,a.fullExtent.xmax,a.fullExtent.ymax],h=[a.tileInfo.origin.x,a.tileInfo.origin.y],u=a.tileInfo.lods.map(function(t){return t.resolution}).slice(0,16),c=a.tileInfo.rows,d=a.tiles[0],f=Cw(r.sprite,i),t.n=3,f.fetch();case 3:return p=t.v,Pw(r),g=new jd({extent:l,origin:h,resolutions:u,tileSize:c}),m=new Sf({format:new Dg,url:d,projection:yw,tileGrid:g}),ow(y=new Dp(hw({source:m,declutter:!0},n&&{renderMode:n})),r,s,u,p,f.pngUrl),t.a(2,{layer:y,source:m})}},t)})),Tw.apply(this,arguments)}function Rw(t,e){return kw.apply(this,arguments)}function kw(){return kw=pw(cw().m(function t(e,i){var n,r,s,o,a,l,h,u,c,d,f,p,g,m,y,_,v,x,w,b=arguments;return cw().w(function(t){for(;;)switch(t.n){case 0:return r=(b.length>2&&void 0!==b[2]?b[2]:{}).renderMode,t.n=1,vw(e,"Style",i).then(function(t){return t.json()});case 1:return s=t.v,o=Object.keys(s.sources)[0],a=s.sources[o].url,l=Cw(s.sprite,i),t.n=2,vw(a,"Source",i).then(function(t){return t.json()});case 2:return h=t.v,u=null===(n=h.links)||void 0===n?void 0:n.find(function(t){return"http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme"===t.rel}),t.n=3,Promise.all([vw(u.href,"Source",i).then(function(t){return t.json()}),l.fetch()]);case 3:return c=t.v,d=gw(c,2),f=d[0],p=d[1],g=f.tileMatrices.map(function(t){return t.cellSize}),m=f.tileMatrices[0].pointOfOrigin,y=[f.tileMatrices[0].tileHeight,f.tileMatrices[0].tileWidth],(_=new Dg).supportedMediaTypes.push("application/octet-stream"),v=new jd({resolutions:g,origin:m,tileSize:y}),x=new Yp({url:a,format:_,tileGrid:v,projection:yw}),ow(w=new Dp(hw({source:x,declutter:!0},r&&{renderMode:r})),s,o,g,p,l.pngUrl),t.a(2,{layer:w,source:x})}},t)})),kw.apply(this,arguments)}function Aw(){var t,e,i="function"==typeof Symbol?Symbol:{},n=i.iterator||"@@iterator",r=i.toStringTag||"@@toStringTag";function s(i,n,r,s){var l=n&&n.prototype instanceof a?n:a,h=Object.create(l.prototype);return Gw(h,"_invoke",function(i,n,r){var s,a,l,h=0,u=r||[],c=!1,d={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,i){return s=e,a=0,l=t,d.n=i,o}};function f(i,n){for(a=i,l=n,e=0;!c&&h&&!r&&e<u.length;e++){var r,s=u[e],f=d.p,p=s[2];i>3?(r=p===n)&&(l=s[(a=s[4])?5:(a=3,3)],s[4]=s[5]=t):s[0]<=f&&((r=i<2&&f<s[1])?(a=0,d.v=n,d.n=s[1]):f<p&&(r=i<3||s[0]>n||n>p)&&(s[4]=i,s[5]=n,d.n=p,a=0))}if(r||i>1)return o;throw c=!0,n}return function(r,u,p){if(h>1)throw TypeError("Generator is already running");for(c&&1===u&&f(u,p),a=u,l=p;(e=a<2?t:l)||!c;){s||(a?a<3?(a>1&&(d.n=-1),f(a,l)):d.n=l:d.v=l);try{if(h=2,s){if(a||(r="next"),e=s[r]){if(!(e=e.call(s,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,a<2&&(a=0)}else 1===a&&(e=s.return)&&e.call(s),a<2&&(l=TypeError("The iterator does not provide a '"+r+"' method"),a=1);s=t}else if((e=(c=d.n<0)?l:i.call(n,d))!==o)break}catch(e){s=t,a=1,l=e}finally{h=1}}return{value:e,done:c}}}(i,r,s),!0),h}var o={};function a(){}function l(){}function h(){}e=Object.getPrototypeOf;var u=[][n]?e(e([][n]())):(Gw(e={},n,function(){return this}),e),c=h.prototype=a.prototype=Object.create(u);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,Gw(t,r,"GeneratorFunction")),t.prototype=Object.create(c),t}return l.prototype=h,Gw(c,"constructor",h),Gw(h,"constructor",l),l.displayName="GeneratorFunction",Gw(h,r,"GeneratorFunction"),Gw(c),Gw(c,r,"Generator"),Gw(c,n,function(){return this}),Gw(c,"toString",function(){return"[object Generator]"}),(Aw=function(){return{w:s,m:d}})()}function Gw(t,e,i,n){var r=Object.defineProperty;try{r({},"",{})}catch(t){r=0}Gw=function(t,e,i,n){function s(e,i){Gw(t,e,function(t){return this._invoke(e,i,t)})}e?r?r(t,e,{value:i,enumerable:!n,configurable:!n,writable:!n}):t[e]=i:(s("next",0),s("throw",1),s("return",2))},Gw(t,e,i,n)}function Ow(t,e,i,n,r,s,o){try{var a=t[s](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(n,r)}function Fw(t){var e=t.mapProvider,i=t.transformRequest,n=t.events,r=t.eventBus,s=t.map,o=t.onBaseSourceChange,a=function(){var t,a=(t=Aw().m(function t(a){var l,h,u;return Aw().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,Mw(a,i);case 1:l=t.v,h=l.layer,u=l.source,s.getLayers().setAt(0,h),o(u),r.emit(n.MAP_STYLE_CHANGE,{mapStyleId:a.id}),e.reapplyHighlights();case 2:return t.a(2)}},t)}),function(){var e=this,i=arguments;return new Promise(function(n,r){var s=t.apply(e,i);function o(t){Ow(s,n,r,o,a,"next",t)}function a(t){Ow(s,n,r,o,a,"throw",t)}o(void 0)})});return function(t){return a.apply(this,arguments)}}(),l=function(t){s.setPixelRatio(t)},h=function(t){var i=t.mapSize;e.mapSize=i};return r.on(n.MAP_SET_STYLE,a),r.on(n.MAP_SET_PIXEL_RATIO,l),r.on(n.MAP_SIZE_CHANGE,h),{remove:function(){r.off(n.MAP_SET_STYLE,a),r.off(n.MAP_SET_PIXEL_RATIO,l),r.off(n.MAP_SIZE_CHANGE,h)}}}function Lw(t,e,i){if(null!==t)for(var n,r,s,o,a,l,h,u,c=0,d=0,f=t.type,p="FeatureCollection"===f,g="Feature"===f,m=p?t.features.length:1,y=0;y<m;y++){a=(u=!!(h=p?t.features[y].geometry:g?t.geometry:t)&&"GeometryCollection"===h.type)?h.geometries.length:1;for(var _=0;_<a;_++){var v=0,x=0;if(null!==(o=u?h.geometries[_]:h)){l=o.coordinates;var w=o.type;switch(c=!i||"Polygon"!==w&&"MultiPolygon"!==w?0:1,w){case null:break;case"Point":if(!1===e(l,d,y,v,x))return!1;d++,v++;break;case"LineString":case"MultiPoint":for(n=0;n<l.length;n++){if(!1===e(l[n],d,y,v,x))return!1;d++,"MultiPoint"===w&&v++}"LineString"===w&&v++;break;case"Polygon":case"MultiLineString":for(n=0;n<l.length;n++){for(r=0;r<l[n].length-c;r++){if(!1===e(l[n][r],d,y,v,x))return!1;d++}"MultiLineString"===w&&v++,"Polygon"===w&&x++}"Polygon"===w&&v++;break;case"MultiPolygon":for(n=0;n<l.length;n++){for(x=0,r=0;r<l[n].length;r++){for(s=0;s<l[n][r].length-c;s++){if(!1===e(l[n][r][s],d,y,v,x))return!1;d++}x++}v++}break;case"GeometryCollection":for(n=0;n<o.geometries.length;n++)if(!1===Lw(o.geometries[n],e,i))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}var jw=function(t,e={}){if(null!=t.bbox&&!0!==e.recompute)return t.bbox;const i=[1/0,1/0,-1/0,-1/0];return Lw(t,t=>{i[0]>t[0]&&(i[0]=t[0]),i[1]>t[1]&&(i[1]=t[1]),i[2]<t[0]&&(i[2]=t[0]),i[3]<t[1]&&(i[3]=t[1])}),i};function Nw(t){return function(t){if(Array.isArray(t))return qw(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||zw(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Dw(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,s,o,a=[],l=!0,h=!1;try{if(s=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=s.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw r}}return a}}(t,e)||zw(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function zw(t,e){if(t){if("string"==typeof t)return qw(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?qw(t,e):void 0}}function qw(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}var $w=function(t){var e=t/1609.344;if(e<.5)return"".concat(Math.round(t),"m");if(e<10){var i=Number.parseFloat(e.toFixed(1)),n=1===i?"mile":"miles";return"".concat(i," ").concat(n)}var r=Math.round(e);return"".concat(r," miles")},Bw=function(t,e,i){for(var n=[],r=e;r<i;r+=2)n.push([t[r],t[r+1]]);return n},Uw=function(t){var e=t.getType(),i=t.getFlatCoordinates();if("Point"===e)return{type:"Point",coordinates:[i[0],i[1]]};if("LineString"===e)return{type:"LineString",coordinates:Bw(i,0,i.length)};if("Polygon"===e){var n=t.getEnds(),r=0;return{type:"Polygon",coordinates:n.map(function(t){var e=Bw(i,r,t);return r=t,e})}}if("MultiPolygon"===e){var s=t.getEndss(),o=0,a=s.map(function(t){var e=o,n=t.map(function(t){var n=Bw(i,e,t);return e=t,n});return o=t[t.length-1],n});return{type:"MultiPolygon",coordinates:a}}return{type:e,coordinates:Bw(i,0,i.length)}},Ww=function(t,e,i,n){var r=[];return t.getLayers().forEach(function(t){if(t instanceof Dp){var s=t.getSource(),o=null==s?void 0:s.sourceTiles_;o&&Object.values(o).forEach(function(t){2===t.getState()&&t.getFeatures().forEach(function(t){var s;if((null===(s=t.get("mapbox-layer"))||void 0===s?void 0:s.id)===e){var o=n?t.get(n):t.getId();String(o)===String(i)&&r.push(Uw(t))}})})}}),r};function Xw(t){return Xw="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xw(t)}function Vw(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function Kw(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Vw(Object(i),!0).forEach(function(e){Yw(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Vw(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function Yw(t,e,i){return(e=function(t){var e=function(t){if("object"!=Xw(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=Xw(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Xw(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Zw(t){return function(t){if(Array.isArray(t))return Qw(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Jw(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Hw(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=Jw(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function Jw(t,e){if(t){if("string"==typeof t)return Qw(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Qw(t,e):void 0}}function Qw(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}var tb="EPSG:27700",eb=new Ug({dataProjection:tb,featureProjection:tb}),ib="_highlight",nb=function(t,e){if(!t)return[];var i=t.stroke,n=t.selectionStroke,r=t.fill,s=t.strokeWidth,o=t.activeStrokeWidth;if(e)return[new vl({stroke:new pl({color:i,width:o}),zIndex:999}),new vl({stroke:new pl({color:n,width:s}),zIndex:1e3})];var a=[new vl({stroke:new pl({color:n,width:s}),zIndex:999})];return r&&"transparent"!==r&&a.push(new vl({fill:new hl({color:r}),zIndex:999})),a},rb=function(t){var e,i=new Set,n={},r=Hw(null!=t?t:[]);try{for(r.s();!(e=r.n()).done;){var s=e.value,o=s.layerId,a=s.featureId,l=s.idProperty;i.add("".concat(o,":").concat(a)),l&&(n[o]=l)}}catch(t){r.e(t)}finally{r.f()}return{keys:i,idProps:n}},sb=function(t,e,i,n){var r,s=Hw(null!=e?e:[]);try{for(s.s();!(r=s.n()).done;){var o=r.value,a=o.layerId,l=o.geometry;if(l){var h=nb(null==n?void 0:n[a],i);if(h.length){var u=new Cg({geometry:eb.readGeometry(l)});u.setStyle(h),t.addFeature(u)}}}}catch(t){s.e(t)}finally{s.f()}},ob=function(t,e){var i=t.type,n=t.coordinates,r=function(t){var i,n,r=(n=2,function(t){if(Array.isArray(t))return t}(i=t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,s,o,a=[],l=!0,h=!1;try{if(s=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=s.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw r}}return a}}(i,n)||Jw(i,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),s=r[0],o=r[1];return e(s,o)},s=function(t){return t.forEach(r)};"Point"===i?r(n):"MultiPoint"===i||"LineString"===i?n.forEach(r):"MultiLineString"===i||"Polygon"===i?n.forEach(s):"MultiPolygon"===i&&n.forEach(function(t){return t.forEach(s)})},ab=function(t,e,i,n){if(!t)return null;var r=new Set;t.getLayers().forEach(function(t){if(t instanceof Xg&&!t.get(ib)){var e=t.get("layerId");e&&r.add(e)}});var s=rb(e),o=s.keys,a=s.idProps,l=rb(i),h=l.keys,u=l.idProps,c=Kw(Kw({},a),u);!function(t,e,i,n,r){t.getLayers().forEach(function(t){if(t instanceof Dp)if(e.size>0||i.size>0){t._highlightOriginalStyle||(t._highlightOriginalStyle=t.getStyleFunction());var s=t._highlightOriginalStyle;t.setStyle(function(t,o){var a,l=s(t,o),h=null===(a=t.get("mapbox-layer"))||void 0===a?void 0:a.id;if(!h)return l;var u=n[h],c=u?t.get(u):t.getId(),d="".concat(h,":").concat(c),f=i.has(d),p=!f&&e.has(d);if(!f&&!p)return l;var g=nb(null==r?void 0:r[h],f);if(!g.length)return l;var m=l?Array.isArray(l)?l:[l]:[];return[].concat(Zw(m),Zw(g))})}else t._highlightOriginalStyle&&(t.setStyle(t._highlightOriginalStyle),delete t._highlightOriginalStyle)})}(t,o,h,c,n);var d=function(t){var e=null;return t.getLayers().forEach(function(t){t.get(ib)&&(e=t)}),e||((e=new Xg({source:new Jg,zIndex:1001})).set(ib,!0),t.addLayer(e)),e}(t),f=d.getSource();f.clear();var p=(null!=e?e:[]).filter(function(t){return r.has(t.layerId)}),g=(null!=i?i:[]).filter(function(t){return r.has(t.layerId)});sb(f,g,!0,n),sb(f,p,!1,n);var m=(null!=e?e:[]).flatMap(function(e){return function(t,e){var i=e.layerId,n=e.featureId,r=e.idProperty,s=e.geometry;if(null!=n){var o=Ww(t,i,n,r);if(o.length>0)return o}return s?[s]:[]}(t,e)});return function(t){if(!t.length)return null;var e,i=1/0,n=1/0,r=-1/0,s=-1/0,o=Hw(t);try{for(o.s();!(e=o.n()).done;){var a=e.value;ob(a,function(t,e){t<i&&(i=t),e<n&&(n=e),t>r&&(r=t),e>s&&(s=e)})}}catch(t){o.e(t)}finally{o.f()}return i===1/0?null:[i,n,r,s]}(m)};function lb(t){return lb="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lb(t)}function hb(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function ub(t,e,i){return(e=function(t){var e=function(t){if("object"!=lb(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=lb(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==lb(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}var cb="EPSG:27700",db=new Ug({dataProjection:cb,featureProjection:cb});function fb(t){return fb="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fb(t)}function pb(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function gb(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?pb(Object(i),!0).forEach(function(e){mb(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):pb(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function mb(t,e,i){return(e=function(t){var e=function(t){if("object"!=fb(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=fb(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==fb(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function yb(t){return yb="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yb(t)}function _b(){var t,e,i="function"==typeof Symbol?Symbol:{},n=i.iterator||"@@iterator",r=i.toStringTag||"@@toStringTag";function s(i,n,r,s){var l=n&&n.prototype instanceof a?n:a,h=Object.create(l.prototype);return vb(h,"_invoke",function(i,n,r){var s,a,l,h=0,u=r||[],c=!1,d={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,i){return s=e,a=0,l=t,d.n=i,o}};function f(i,n){for(a=i,l=n,e=0;!c&&h&&!r&&e<u.length;e++){var r,s=u[e],f=d.p,p=s[2];i>3?(r=p===n)&&(l=s[(a=s[4])?5:(a=3,3)],s[4]=s[5]=t):s[0]<=f&&((r=i<2&&f<s[1])?(a=0,d.v=n,d.n=s[1]):f<p&&(r=i<3||s[0]>n||n>p)&&(s[4]=i,s[5]=n,d.n=p,a=0))}if(r||i>1)return o;throw c=!0,n}return function(r,u,p){if(h>1)throw TypeError("Generator is already running");for(c&&1===u&&f(u,p),a=u,l=p;(e=a<2?t:l)||!c;){s||(a?a<3?(a>1&&(d.n=-1),f(a,l)):d.n=l:d.v=l);try{if(h=2,s){if(a||(r="next"),e=s[r]){if(!(e=e.call(s,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,a<2&&(a=0)}else 1===a&&(e=s.return)&&e.call(s),a<2&&(l=TypeError("The iterator does not provide a '"+r+"' method"),a=1);s=t}else if((e=(c=d.n<0)?l:i.call(n,d))!==o)break}catch(e){s=t,a=1,l=e}finally{h=1}}return{value:e,done:c}}}(i,r,s),!0),h}var o={};function a(){}function l(){}function h(){}e=Object.getPrototypeOf;var u=[][n]?e(e([][n]())):(vb(e={},n,function(){return this}),e),c=h.prototype=a.prototype=Object.create(u);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,vb(t,r,"GeneratorFunction")),t.prototype=Object.create(c),t}return l.prototype=h,vb(c,"constructor",h),vb(h,"constructor",l),l.displayName="GeneratorFunction",vb(h,r,"GeneratorFunction"),vb(c),vb(c,r,"Generator"),vb(c,n,function(){return this}),vb(c,"toString",function(){return"[object Generator]"}),(_b=function(){return{w:s,m:d}})()}function vb(t,e,i,n){var r=Object.defineProperty;try{r({},"",{})}catch(t){r=0}vb=function(t,e,i,n){function s(e,i){vb(t,e,function(t){return this._invoke(e,i,t)})}e?r?r(t,e,{value:i,enumerable:!n,configurable:!n,writable:!n}):t[e]=i:(s("next",0),s("throw",1),s("return",2))},vb(t,e,i,n)}function xb(t,e,i,n,r,s,o){try{var a=t[s](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(n,r)}function wb(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,bb(n.key),n)}}function bb(t){var e=function(t){if("object"!=yb(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=yb(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==yb(e)?e:e+""}!function(){if("undefined"!=typeof HTMLCanvasElement){var t=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=function(e,i){for(var n=arguments.length,r=new Array(n>2?n-2:0),s=2;s<n;s++)r[s-2]=arguments[s];return t.call.apply(t,[this,e,"2d"===e?gb(gb({},i),{},{willReadFrequently:!0}):i].concat(r))}}}();var Sb="EPSG:27700",Mb=function(t){if(t){var e=t.top,i=void 0===e?0:e,n=t.right,r=void 0===n?0:n,s=t.bottom,o=void 0===s?0:s,a=t.left;return[i,r,o,void 0===a?0:a]}};_d.defs(Sb,"+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs"),function(t){vd=t;const e=Object.keys(t.defs),i=e.length;let n,r;for(n=0;n<i;++n){const i=e[n];if(!Ge(i)){const e=t.defs(i);let n=e.units;n||"longlat"!==e.projName||(n="degrees"),fi(new xe({code:i,axisOrientation:e.axis,metersPerUnit:e.to_meter,units:n}))}}for(n=0;n<i;++n){const s=e[n],o=Ge(s);for(r=0;r<i;++r){const i=e[r],n=Ge(i);if(!Le(s,i))if(t.defs[s]===t.defs[i])mi([o,n]);else{const e=t(s,i);vi(o,n,Gi(o,n,e.forward),Gi(n,o,e.inverse))}}}}(_d);var Eb=function(){return t=function t(e){var i=e.mapProviderConfig,n=void 0===i?{}:i,r=e.events,s=e.eventBus;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.events=r,this.eventBus=s,this.capabilities={supportedShortcuts:Md,supportsMapSizes:!0},Object.assign(this,n)},e=[{key:"name",get:function(){return"OpenLayersProvider"}},{key:"initMap",value:(i=_b().m(function t(e){var i,n,r,s,o,a,l,h,u,c,d,f,p,g,m,y,_,v,x,w;return _b().w(function(t){for(;;)switch(t.n){case 0:return n=e.container,r=e.padding,s=e.mapStyle,o=e.mapSize,a=e.center,l=e.zoom,h=e.bounds,u=e.minZoom,c=e.maxZoom,d=e.transformRequest,f=e.pixelRatio,this.mapStyleId=null==s?void 0:s.id,this.mapSize=o,p=this.events,g=this.eventBus,t.n=1,Mw(s,d);case 1:m=t.v,y=m.layer,_=m.source,v=Ed(null!==(i=this.zoomAlignment)&&void 0!==i?i:"uk"),x=new Hn({projection:Sb,center:a,zoom:null!=l?l:v.defaultMinZoom,minZoom:Math.max(null!=u?u:v.defaultMinZoom,v.defaultMinZoom),maxZoom:null!=c?c:v.maxZoom,resolutions:v.resolutions,constrainResolution:!1,padding:Mb(r)}),w=new th({target:n,layers:[y],view:x,controls:[],interactions:Yr({doubleClickZoom:!1}),pixelRatio:f}),h&&w.once("rendercomplete",function(){x.fit(h,{size:w.getSize(),duration:0})}),this.mapEventHandles=Td({map:w,source:_,events:p,eventBus:g,getZoom:this.getZoom.bind(this),getCenter:this.getCenter.bind(this),getBounds:this.getBounds.bind(this),getResolution:this.getResolution.bind(this)}),this.appEventHandles=Fw({mapProvider:this,transformRequest:d,events:p,eventBus:g,map:w,onBaseSourceChange:this.mapEventHandles.setSource})||[],this.map=w,this.view=x,g.emit(p.MAP_READY,{map:this.map,mapStyleId:this.mapStyleId,mapSize:this.mapSize,crs:this.crs});case 2:return t.a(2)}},t,this)}),n=function(){var t=this,e=arguments;return new Promise(function(n,r){var s=i.apply(t,e);function o(t){xb(s,n,r,o,a,"next",t)}function a(t){xb(s,n,r,o,a,"throw",t)}o(void 0)})},function(t){return n.apply(this,arguments)})},{key:"destroyMap",value:function(){var t,e;null===(t=this.mapEventHandles)||void 0===t||t.remove(),null===(e=this.appEventHandles)||void 0===e||e.remove(),this.mapEventHandles=null,this.appEventHandles=null,this.map&&(this._onHoverMove&&(this.map.un("pointermove",this._onHoverMove),this._onHoverMove=null),this.map.setTarget(null),this.map=null),this.view=null}},{key:"setView",value:function(t){var e=t.center,i=t.zoom;this.view.animate({center:null!=e?e:this.view.getCenter(),zoom:null!=i?i:this.view.getZoom(),duration:Sd})}},{key:"zoomIn",value:function(t){this.view.animate({zoom:this.view.getZoom()+t,duration:Sd})}},{key:"zoomOut",value:function(t){this.view.animate({zoom:this.view.getZoom()-t,duration:Sd})}},{key:"panBy",value:function(t){var e=this.view.getCenter(),i=this.view.getResolution();this.view.animate({center:[e[0]+t[0]*i,e[1]-t[1]*i],duration:Sd})}},{key:"fitToBounds",value:function(t){var e=Array.isArray(t)?t:Ei(jw(t),"EPSG:4326","EPSG:27700");this.view.fit(e,{duration:Sd})}},{key:"setPadding",value:function(t){this.view.padding=Mb(t)}},{key:"getCenter",value:function(){var t=this.view.getCenter();return[Math.round(t[0]*Math.pow(10,2))/Math.pow(10,2),Math.round(t[1]*Math.pow(10,2))/Math.pow(10,2)]}},{key:"getZoom",value:function(){return this.view.getZoom()}},{key:"getBounds",value:function(){return this.view.calculateExtent(this.map.getSize()).map(function(t){return Math.round(100*t)/100})}},{key:"getFeaturesAtPoint",value:function(t,e){return function(t,e){if(!e)return[];var i=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).radius,n=void 0===i?10:i,r=[e.x,e.y],s=[],o=new Set;return t.forEachFeatureAtPixel(r,function(t,e){if(e instanceof Dp){var i=t.get("mapbox-layer"),n=null==i?void 0:i.id;if(!n||"background"===(null==i?void 0:i.type))return;var r="".concat(n,":").concat(function(t){var e=t.getId();if(null!=e)return e;var i=function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?hb(Object(i),!0).forEach(function(e){ub(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):hb(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}({},t.getProperties());return delete i["mapbox-layer"],JSON.stringify(i)}(t));if(o.has(r))return;o.add(r),s.push({id:t.getId(),layer:{id:n},geometry:Uw(t),properties:t.getProperties()})}else if(e instanceof Xg){var a=e.get("layerId");if(!a||e.get("_highlight"))return;var l=t.getId(),h="".concat(a,":").concat(l);if(o.has(h))return;o.add(h),s.push({id:l,layer:{id:a},geometry:db.writeGeometryObject(t.getGeometry()),properties:t.getProperties()})}},{hitTolerance:n}),s}(this.map,t,e)}},{key:"getFeatureGeometry",value:function(t,e,i){var n=Ww(this.map,t,e,i);return 0===n.length?null:1===n.length?n[0]:{type:"MultiPolygon",coordinates:n.flatMap(function(t){return"MultiPolygon"===t.type?t.coordinates:[t.coordinates]})}}},{key:"setHoverCursor",value:function(t){this.map&&(this._onHoverMove=function(t,e,i){var n=t.getViewport();if(i&&t.un("pointermove",i),null==e||!e.length)return n.style.cursor="",null;var r=new Set(e),s=null,o=function(e){var i;if("mouse"===(null===(i=e.originalEvent)||void 0===i?void 0:i.pointerType)){var o=e.pixel;null!==s&&cancelAnimationFrame(s),s=requestAnimationFrame(function(){s=null;var e=t.forEachFeatureAtPixel(o,function(t,e){return function(t,e,i){if(e instanceof Dp){var n,r=null===(n=t.get("mapbox-layer"))||void 0===n?void 0:n.id;return Boolean(r&&i.has(r))}if(e instanceof Xg&&!e.get("_highlight")){var s=e.get("layerId");return Boolean(s&&i.has(s))}return!1}(t,e,r)},{hitTolerance:8});n.style.cursor=e?"pointer":""})}};return t.on("pointermove",o),o}(this.map,t,this._onHoverMove))}},{key:"getVisibleFeatures",value:function(t){return[]}},{key:"updateHighlightedFeatures",value:function(t,e,i){return this._lastHighlightArgs={selectedFeatures:t,activeFeatures:e,stylesMap:i},ab(this.map,t,e,i)}},{key:"reapplyHighlights",value:function(){if(this._lastHighlightArgs){var t=this._lastHighlightArgs,e=t.selectedFeatures,i=t.activeFeatures,n=t.stylesMap;ab(this.map,e,i,n)}}},{key:"getAreaDimensions",value:function(){return function(t){if(!t)return"";var e=Dw(t,4),i=e[0],n=e[1],r=e[2],s=e[3],o=r-i;return"".concat($w(s-n)," by ").concat($w(o))}((e=(t=this.map).getSize(),n=(i=Dw(t.getView().padding||[0,0,0,0],4))[0],r=i[1],s=i[2],o=[i[3],e[1]-s],a=[e[0]-r,n],l=t.getCoordinateFromPixel(o),h=t.getCoordinateFromPixel(a),l&&h?[l[0],l[1],h[0],h[1]]:null));var t,e,i,n,r,s,o,a,l,h}},{key:"getCardinalMove",value:function(t,e){return function(t,e){var i=e[0]-t[0],n=e[1]-t[1],r=[];return Math.abs(n)>1&&r.push("".concat(n>0?"north":"south"," ").concat($w(Math.abs(n)))),Math.abs(i)>1&&r.push("".concat(i>0?"east":"west"," ").concat($w(Math.abs(i)))),r.join(", ")}(t,e)}},{key:"getResolution",value:function(){return this.view.getResolution()}},{key:"mapToScreen",value:function(t){if(!this.map)return{x:0,y:0};var e=this.map.getPixelFromCoordinate(t);return e?{x:e[0],y:e[1]}:{x:0,y:0}}},{key:"screenToMap",value:function(t){return this.map.getCoordinateFromPixel([t.x,t.y])}},{key:"isGeometryObscured",value:function(t,e){return function(t,e,i){var n=i.getTargetElement().getBoundingClientRect();if(!n.width||!n.height)return!1;var r=i.getViewport().getBoundingClientRect(),s=r.width/n.width,o=r.height/n.height,a=function(t){return jw(t)}(t),l=Dw(a,4),h=l[0],u=l[1],c=l[2],d=l[3],f=[[h,u],[h,d],[c,u],[c,d]].map(function(t){return i.getPixelFromCoordinate(t)}).filter(Boolean);if(!f.length)return!1;var p=n.left+Math.min.apply(Math,Nw(f.map(function(t){return t[0]})))*s,g=n.left+Math.max.apply(Math,Nw(f.map(function(t){return t[0]})))*s,m=n.top+Math.min.apply(Math,Nw(f.map(function(t){return t[1]})))*o,y=n.top+Math.max.apply(Math,Nw(f.map(function(t){return t[1]})))*o;return p<e.right&&g>e.left&&m<e.bottom&&y>e.top}(t,e,this.map)}}],e&&wb(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i,n}()}}]);